@surething/cockpit 1.0.256 → 1.0.258

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 (680) hide show
  1. package/.next-prod/BUILD_ID +1 -1
  2. package/.next-prod/app-path-routes-manifest.json +3 -4
  3. package/.next-prod/build-manifest.json +3 -3
  4. package/.next-prod/cockpit-build.json +1 -1
  5. package/.next-prod/prerender-manifest.json +4 -4
  6. package/.next-prod/react-loadable-manifest.json +2 -1
  7. package/.next-prod/routes-manifest.json +0 -6
  8. package/.next-prod/server/app/_global-error/page.js +2 -2
  9. package/.next-prod/server/app/_global-error/page.js.nft.json +1 -1
  10. package/.next-prod/server/app/_global-error/page_client-reference-manifest.js +1 -1
  11. package/.next-prod/server/app/_global-error.html +1 -1
  12. package/.next-prod/server/app/_global-error.rsc +1 -1
  13. package/.next-prod/server/app/_global-error.segments/_full.segment.rsc +1 -1
  14. package/.next-prod/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  15. package/.next-prod/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next-prod/server/app/_not-found/page.js +1 -1
  17. package/.next-prod/server/app/_not-found/page.js.nft.json +1 -1
  18. package/.next-prod/server/app/_not-found/page_client-reference-manifest.js +1 -1
  19. package/.next-prod/server/app/_not-found.html +2 -2
  20. package/.next-prod/server/app/_not-found.rsc +3 -3
  21. package/.next-prod/server/app/_not-found.segments/_full.segment.rsc +3 -3
  22. package/.next-prod/server/app/_not-found.segments/_index.segment.rsc +3 -3
  23. package/.next-prod/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  24. package/.next-prod/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  25. package/.next-prod/server/app/api/agent/test/route.js +1 -1
  26. package/.next-prod/server/app/api/agent/test/route.js.nft.json +1 -1
  27. package/.next-prod/server/app/api/bash/route.js +1 -1
  28. package/.next-prod/server/app/api/bash/route.js.nft.json +1 -1
  29. package/.next-prod/server/app/api/chat/codex/route.js +1 -5
  30. package/.next-prod/server/app/api/chat/codex/route.js.nft.json +1 -1
  31. package/.next-prod/server/app/api/chat/deepseek/route.js +1 -1
  32. package/.next-prod/server/app/api/chat/deepseek/route.js.nft.json +1 -1
  33. package/.next-prod/server/app/api/chat/glm/route.js +1 -1
  34. package/.next-prod/server/app/api/chat/glm/route.js.nft.json +1 -1
  35. package/.next-prod/server/app/api/chat/kimi/route.js +1 -1
  36. package/.next-prod/server/app/api/chat/kimi/route.js.nft.json +1 -1
  37. package/.next-prod/server/app/api/chat/ollama/route.js +1 -1
  38. package/.next-prod/server/app/api/chat/ollama/route.js.nft.json +1 -1
  39. package/.next-prod/server/app/api/chat/route.js +1 -1
  40. package/.next-prod/server/app/api/chat/route.js.nft.json +1 -1
  41. package/.next-prod/server/app/api/chat/stop/route.js +1 -1
  42. package/.next-prod/server/app/api/chat/stop/route.js.nft.json +1 -1
  43. package/.next-prod/server/app/api/claude-stats/route.js +1 -1
  44. package/.next-prod/server/app/api/claude-stats/route.js.nft.json +1 -1
  45. package/.next-prod/server/app/api/commands/route.js +1 -1
  46. package/.next-prod/server/app/api/commands/route.js.nft.json +1 -1
  47. package/.next-prod/server/app/api/comments/route.js +1 -1
  48. package/.next-prod/server/app/api/comments/route.js.nft.json +1 -1
  49. package/.next-prod/server/app/api/db/columns/route.js +2 -2
  50. package/.next-prod/server/app/api/db/columns/route.js.nft.json +1 -1
  51. package/.next-prod/server/app/api/db/connect/route.js +1 -1
  52. package/.next-prod/server/app/api/db/connect/route.js.nft.json +1 -1
  53. package/.next-prod/server/app/api/db/disconnect/route.js +1 -1
  54. package/.next-prod/server/app/api/db/disconnect/route.js.nft.json +1 -1
  55. package/.next-prod/server/app/api/db/export/route.js +1 -1
  56. package/.next-prod/server/app/api/db/export/route.js.nft.json +1 -1
  57. package/.next-prod/server/app/api/db/query/route.js +1 -1
  58. package/.next-prod/server/app/api/db/query/route.js.nft.json +1 -1
  59. package/.next-prod/server/app/api/db/schemas/route.js +1 -1
  60. package/.next-prod/server/app/api/db/schemas/route.js.nft.json +1 -1
  61. package/.next-prod/server/app/api/deepseek/balance/route.js +1 -1
  62. package/.next-prod/server/app/api/deepseek/balance/route.js.nft.json +1 -1
  63. package/.next-prod/server/app/api/deepseek/credentials/route.js +1 -1
  64. package/.next-prod/server/app/api/deepseek/credentials/route.js.nft.json +1 -1
  65. package/.next-prod/server/app/api/deepseek/models/route.js +1 -1
  66. package/.next-prod/server/app/api/deepseek/models/route.js.nft.json +1 -1
  67. package/.next-prod/server/app/api/dev/spans/route.js +1 -1
  68. package/.next-prod/server/app/api/dev/spans/route.js.nft.json +1 -1
  69. package/.next-prod/server/app/api/extension/version/route.js +1 -1
  70. package/.next-prod/server/app/api/extension/version/route.js.nft.json +1 -1
  71. package/.next-prod/server/app/api/file/route.js +1 -1
  72. package/.next-prod/server/app/api/file/route.js.nft.json +1 -1
  73. package/.next-prod/server/app/api/files/blame/route.js +1 -1
  74. package/.next-prod/server/app/api/files/blame/route.js.nft.json +1 -1
  75. package/.next-prod/server/app/api/files/clipboard/route.js +1 -1
  76. package/.next-prod/server/app/api/files/clipboard/route.js.nft.json +1 -1
  77. package/.next-prod/server/app/api/files/copy/route.js +1 -1
  78. package/.next-prod/server/app/api/files/copy/route.js.nft.json +1 -1
  79. package/.next-prod/server/app/api/files/delete/route.js +1 -1
  80. package/.next-prod/server/app/api/files/delete/route.js.nft.json +1 -1
  81. package/.next-prod/server/app/api/files/expanded/route.js +1 -1
  82. package/.next-prod/server/app/api/files/expanded/route.js.nft.json +1 -1
  83. package/.next-prod/server/app/api/files/index/route.js +1 -1
  84. package/.next-prod/server/app/api/files/index/route.js.nft.json +1 -1
  85. package/.next-prod/server/app/api/files/init/route.js +1 -1
  86. package/.next-prod/server/app/api/files/init/route.js.nft.json +1 -1
  87. package/.next-prod/server/app/api/files/paste/route.js +1 -1
  88. package/.next-prod/server/app/api/files/paste/route.js.nft.json +1 -1
  89. package/.next-prod/server/app/api/files/read/route.js +1 -1
  90. package/.next-prod/server/app/api/files/read/route.js.nft.json +1 -1
  91. package/.next-prod/server/app/api/files/readdir/route.js +1 -1
  92. package/.next-prod/server/app/api/files/readdir/route.js.nft.json +1 -1
  93. package/.next-prod/server/app/api/files/recent/route.js +1 -1
  94. package/.next-prod/server/app/api/files/recent/route.js.nft.json +1 -1
  95. package/.next-prod/server/app/api/files/save/route.js +1 -1
  96. package/.next-prod/server/app/api/files/save/route.js.nft.json +1 -1
  97. package/.next-prod/server/app/api/files/search/route.js +1 -1
  98. package/.next-prod/server/app/api/files/search/route.js.nft.json +1 -1
  99. package/.next-prod/server/app/api/files/stat/route.js +1 -1
  100. package/.next-prod/server/app/api/files/stat/route.js.nft.json +1 -1
  101. package/.next-prod/server/app/api/files/text/route.js +1 -1
  102. package/.next-prod/server/app/api/files/text/route.js.nft.json +1 -1
  103. package/.next-prod/server/app/api/git/branch-diff/route.js +1 -1
  104. package/.next-prod/server/app/api/git/branch-diff/route.js.nft.json +1 -1
  105. package/.next-prod/server/app/api/git/branches/route.js +1 -1
  106. package/.next-prod/server/app/api/git/branches/route.js.nft.json +1 -1
  107. package/.next-prod/server/app/api/git/commit-diff/route.js +1 -1
  108. package/.next-prod/server/app/api/git/commit-diff/route.js.nft.json +1 -1
  109. package/.next-prod/server/app/api/git/commits/route.js +1 -1
  110. package/.next-prod/server/app/api/git/commits/route.js.nft.json +1 -1
  111. package/.next-prod/server/app/api/git/current-branch/route.js +1 -1
  112. package/.next-prod/server/app/api/git/current-branch/route.js.nft.json +1 -1
  113. package/.next-prod/server/app/api/git/diff/route.js +1 -1
  114. package/.next-prod/server/app/api/git/diff/route.js.nft.json +1 -1
  115. package/.next-prod/server/app/api/git/discard/route.js +1 -1
  116. package/.next-prod/server/app/api/git/discard/route.js.nft.json +1 -1
  117. package/.next-prod/server/app/api/git/stage/route.js +1 -1
  118. package/.next-prod/server/app/api/git/stage/route.js.nft.json +1 -1
  119. package/.next-prod/server/app/api/git/status/route.js +1 -1
  120. package/.next-prod/server/app/api/git/status/route.js.nft.json +1 -1
  121. package/.next-prod/server/app/api/git/unstage/route.js +1 -1
  122. package/.next-prod/server/app/api/git/unstage/route.js.nft.json +1 -1
  123. package/.next-prod/server/app/api/git/worktree/route.js +1 -1
  124. package/.next-prod/server/app/api/git/worktree/route.js.nft.json +1 -1
  125. package/.next-prod/server/app/api/glm/credentials/route.js +1 -1
  126. package/.next-prod/server/app/api/glm/credentials/route.js.nft.json +1 -1
  127. package/.next-prod/server/app/api/glm/models/route.js +1 -1
  128. package/.next-prod/server/app/api/glm/models/route.js.nft.json +1 -1
  129. package/.next-prod/server/app/api/glm/usage/route.js +1 -1
  130. package/.next-prod/server/app/api/glm/usage/route.js.nft.json +1 -1
  131. package/.next-prod/server/app/api/global-state/route.js +1 -1
  132. package/.next-prod/server/app/api/global-state/route.js.nft.json +1 -1
  133. package/.next-prod/server/app/api/health/route.js +1 -1
  134. package/.next-prod/server/app/api/health/route.js.nft.json +1 -1
  135. package/.next-prod/server/app/api/html-apps/[id]/route.js +1 -1
  136. package/.next-prod/server/app/api/html-apps/[id]/route.js.nft.json +1 -1
  137. package/.next-prod/server/app/api/html-apps/route.js +1 -1
  138. package/.next-prod/server/app/api/html-apps/route.js.nft.json +1 -1
  139. package/.next-prod/server/app/api/jupyter/load/route.js +1 -1
  140. package/.next-prod/server/app/api/jupyter/load/route.js.nft.json +1 -1
  141. package/.next-prod/server/app/api/jupyter/save/route.js +1 -1
  142. package/.next-prod/server/app/api/jupyter/save/route.js.nft.json +1 -1
  143. package/.next-prod/server/app/api/jupyter/shutdown/route.js +1 -1
  144. package/.next-prod/server/app/api/jupyter/shutdown/route.js.nft.json +1 -1
  145. package/.next-prod/server/app/api/kimi/credentials/route.js +1 -1
  146. package/.next-prod/server/app/api/kimi/credentials/route.js.nft.json +1 -1
  147. package/.next-prod/server/app/api/kimi/models/route.js +1 -1
  148. package/.next-prod/server/app/api/kimi/models/route.js.nft.json +1 -1
  149. package/.next-prod/server/app/api/kimi/usage/route.js +1 -1
  150. package/.next-prod/server/app/api/kimi/usage/route.js.nft.json +1 -1
  151. package/.next-prod/server/app/api/lsp/definition/route.js +1 -1
  152. package/.next-prod/server/app/api/lsp/definition/route.js.nft.json +1 -1
  153. package/.next-prod/server/app/api/lsp/hover/route.js +1 -1
  154. package/.next-prod/server/app/api/lsp/hover/route.js.nft.json +1 -1
  155. package/.next-prod/server/app/api/lsp/references/route.js +1 -1
  156. package/.next-prod/server/app/api/lsp/references/route.js.nft.json +1 -1
  157. package/.next-prod/server/app/api/lsp/status/route.js +1 -1
  158. package/.next-prod/server/app/api/lsp/status/route.js.nft.json +1 -1
  159. package/.next-prod/server/app/api/lsp/warmup/route.js +1 -1
  160. package/.next-prod/server/app/api/lsp/warmup/route.js.nft.json +1 -1
  161. package/.next-prod/server/app/api/mysql/columns/route.js +2 -2
  162. package/.next-prod/server/app/api/mysql/columns/route.js.nft.json +1 -1
  163. package/.next-prod/server/app/api/mysql/connect/route.js +1 -1
  164. package/.next-prod/server/app/api/mysql/connect/route.js.nft.json +1 -1
  165. package/.next-prod/server/app/api/mysql/disconnect/route.js +1 -1
  166. package/.next-prod/server/app/api/mysql/disconnect/route.js.nft.json +1 -1
  167. package/.next-prod/server/app/api/mysql/export/route.js +1 -1
  168. package/.next-prod/server/app/api/mysql/export/route.js.nft.json +1 -1
  169. package/.next-prod/server/app/api/mysql/query/route.js +1 -1
  170. package/.next-prod/server/app/api/mysql/query/route.js.nft.json +1 -1
  171. package/.next-prod/server/app/api/mysql/schemas/route.js +1 -1
  172. package/.next-prod/server/app/api/mysql/schemas/route.js.nft.json +1 -1
  173. package/.next-prod/server/app/api/neo4j/connect/route.js +1 -1
  174. package/.next-prod/server/app/api/neo4j/connect/route.js.nft.json +1 -1
  175. package/.next-prod/server/app/api/neo4j/disconnect/route.js +1 -1
  176. package/.next-prod/server/app/api/neo4j/disconnect/route.js.nft.json +1 -1
  177. package/.next-prod/server/app/api/neo4j/query/route.js +1 -1
  178. package/.next-prod/server/app/api/neo4j/query/route.js.nft.json +1 -1
  179. package/.next-prod/server/app/api/neo4j/schema/route.js +1 -1
  180. package/.next-prod/server/app/api/neo4j/schema/route.js.nft.json +1 -1
  181. package/.next-prod/server/app/api/note/route.js +1 -1
  182. package/.next-prod/server/app/api/note/route.js.nft.json +1 -1
  183. package/.next-prod/server/app/api/ollama/config/route.js +1 -1
  184. package/.next-prod/server/app/api/ollama/config/route.js.nft.json +1 -1
  185. package/.next-prod/server/app/api/ollama/models/route.js +1 -1
  186. package/.next-prod/server/app/api/ollama/models/route.js.nft.json +1 -1
  187. package/.next-prod/server/app/api/ollama/start/route.js +1 -1
  188. package/.next-prod/server/app/api/ollama/start/route.js.nft.json +1 -1
  189. package/.next-prod/server/app/api/open-cursor/route.js +1 -1
  190. package/.next-prod/server/app/api/open-cursor/route.js.nft.json +1 -1
  191. package/.next-prod/server/app/api/open-vscode/route.js +1 -1
  192. package/.next-prod/server/app/api/open-vscode/route.js.nft.json +1 -1
  193. package/.next-prod/server/app/api/pick-folder/route.js +1 -1
  194. package/.next-prod/server/app/api/pick-folder/route.js.nft.json +1 -1
  195. package/.next-prod/server/app/api/pinned-sessions/route.js +1 -1
  196. package/.next-prod/server/app/api/pinned-sessions/route.js.nft.json +1 -1
  197. package/.next-prod/server/app/api/project-settings/route.js +1 -1
  198. package/.next-prod/server/app/api/project-settings/route.js.nft.json +1 -1
  199. package/.next-prod/server/app/api/project-state/route.js +2 -2
  200. package/.next-prod/server/app/api/project-state/route.js.nft.json +1 -1
  201. package/.next-prod/server/app/api/projectGraph/affected/route.js +1 -1
  202. package/.next-prod/server/app/api/projectGraph/affected/route.js.nft.json +1 -1
  203. package/.next-prod/server/app/api/projectGraph/callees/route.js +1 -1
  204. package/.next-prod/server/app/api/projectGraph/callees/route.js.nft.json +1 -1
  205. package/.next-prod/server/app/api/projectGraph/callers/route.js +1 -1
  206. package/.next-prod/server/app/api/projectGraph/callers/route.js.nft.json +1 -1
  207. package/.next-prod/server/app/api/projectGraph/coedit/route.js +1 -1
  208. package/.next-prod/server/app/api/projectGraph/coedit/route.js.nft.json +1 -1
  209. package/.next-prod/server/app/api/projectGraph/context/route.js +1 -1
  210. package/.next-prod/server/app/api/projectGraph/context/route.js.nft.json +1 -1
  211. package/.next-prod/server/app/api/projectGraph/file/route.js +1 -1
  212. package/.next-prod/server/app/api/projectGraph/file/route.js.nft.json +1 -1
  213. package/.next-prod/server/app/api/projectGraph/file-functions/route.js +1 -1
  214. package/.next-prod/server/app/api/projectGraph/file-functions/route.js.nft.json +1 -1
  215. package/.next-prod/server/app/api/projectGraph/impact/route.js +1 -1
  216. package/.next-prod/server/app/api/projectGraph/impact/route.js.nft.json +1 -1
  217. package/.next-prod/server/app/api/projectGraph/related/route.js +1 -1
  218. package/.next-prod/server/app/api/projectGraph/related/route.js.nft.json +1 -1
  219. package/.next-prod/server/app/api/projectGraph/risk/route.js +1 -1
  220. package/.next-prod/server/app/api/projectGraph/risk/route.js.nft.json +1 -1
  221. package/.next-prod/server/app/api/projectGraph/search/route.js +1 -1
  222. package/.next-prod/server/app/api/projectGraph/search/route.js.nft.json +1 -1
  223. package/.next-prod/server/app/api/projects/route.js +1 -1
  224. package/.next-prod/server/app/api/projects/route.js.nft.json +1 -1
  225. package/.next-prod/server/app/api/prompts/config/route.js +1 -1
  226. package/.next-prod/server/app/api/prompts/config/route.js.nft.json +1 -1
  227. package/.next-prod/server/app/api/push/public-key/route.js +1 -1
  228. package/.next-prod/server/app/api/push/public-key/route.js.nft.json +1 -1
  229. package/.next-prod/server/app/api/push/subscribe/route.js +1 -1
  230. package/.next-prod/server/app/api/push/subscribe/route.js.nft.json +1 -1
  231. package/.next-prod/server/app/api/push/unsubscribe/route.js +1 -1
  232. package/.next-prod/server/app/api/push/unsubscribe/route.js.nft.json +1 -1
  233. package/.next-prod/server/app/api/redis/command/route.js +1 -1
  234. package/.next-prod/server/app/api/redis/command/route.js.nft.json +1 -1
  235. package/.next-prod/server/app/api/redis/connect/route.js +1 -1
  236. package/.next-prod/server/app/api/redis/connect/route.js.nft.json +1 -1
  237. package/.next-prod/server/app/api/redis/delete/route.js +1 -1
  238. package/.next-prod/server/app/api/redis/delete/route.js.nft.json +1 -1
  239. package/.next-prod/server/app/api/redis/disconnect/route.js +1 -1
  240. package/.next-prod/server/app/api/redis/disconnect/route.js.nft.json +1 -1
  241. package/.next-prod/server/app/api/redis/get/route.js +1 -1
  242. package/.next-prod/server/app/api/redis/get/route.js.nft.json +1 -1
  243. package/.next-prod/server/app/api/redis/keys/route.js +1 -1
  244. package/.next-prod/server/app/api/redis/keys/route.js.nft.json +1 -1
  245. package/.next-prod/server/app/api/redis/set/route.js +1 -1
  246. package/.next-prod/server/app/api/redis/set/route.js.nft.json +1 -1
  247. package/.next-prod/server/app/api/review/[id]/comments/route.js +1 -1
  248. package/.next-prod/server/app/api/review/[id]/comments/route.js.nft.json +1 -1
  249. package/.next-prod/server/app/api/review/[id]/replies/route.js +1 -1
  250. package/.next-prod/server/app/api/review/[id]/replies/route.js.nft.json +1 -1
  251. package/.next-prod/server/app/api/review/[id]/route.js +1 -1
  252. package/.next-prod/server/app/api/review/[id]/route.js.nft.json +1 -1
  253. package/.next-prod/server/app/api/review/identify/route.js +1 -1
  254. package/.next-prod/server/app/api/review/identify/route.js.nft.json +1 -1
  255. package/.next-prod/server/app/api/review/order/route.js +1 -1
  256. package/.next-prod/server/app/api/review/order/route.js.nft.json +1 -1
  257. package/.next-prod/server/app/api/review/route.js +1 -1
  258. package/.next-prod/server/app/api/review/route.js.nft.json +1 -1
  259. package/.next-prod/server/app/api/review/share-info/route.js +1 -1
  260. package/.next-prod/server/app/api/review/share-info/route.js.nft.json +1 -1
  261. package/.next-prod/server/app/api/review/users/route.js +1 -1
  262. package/.next-prod/server/app/api/review/users/route.js.nft.json +1 -1
  263. package/.next-prod/server/app/api/scheduled-tasks/route.js +2 -6
  264. package/.next-prod/server/app/api/scheduled-tasks/route.js.nft.json +1 -1
  265. package/.next-prod/server/app/api/services/config/route.js +1 -1
  266. package/.next-prod/server/app/api/services/config/route.js.nft.json +1 -1
  267. package/.next-prod/server/app/api/services/scripts/route.js +1 -1
  268. package/.next-prod/server/app/api/services/scripts/route.js.nft.json +1 -1
  269. package/.next-prod/server/app/api/session/[sessionId]/fork/route.js +1 -1
  270. package/.next-prod/server/app/api/session/[sessionId]/fork/route.js.nft.json +1 -1
  271. package/.next-prod/server/app/api/session/[sessionId]/history/route.js +1 -1
  272. package/.next-prod/server/app/api/session/[sessionId]/history/route.js.nft.json +1 -1
  273. package/.next-prod/server/app/api/session-by-path/route.js +1 -1
  274. package/.next-prod/server/app/api/session-by-path/route.js.nft.json +1 -1
  275. package/.next-prod/server/app/api/sessions/projects/[encodedPath]/route.js +1 -1
  276. package/.next-prod/server/app/api/sessions/projects/[encodedPath]/route.js.nft.json +1 -1
  277. package/.next-prod/server/app/api/sessions/projects/route.js +1 -1
  278. package/.next-prod/server/app/api/sessions/projects/route.js.nft.json +1 -1
  279. package/.next-prod/server/app/api/sessions/route.js +1 -1
  280. package/.next-prod/server/app/api/sessions/route.js.nft.json +1 -1
  281. package/.next-prod/server/app/api/settings/route.js +1 -1
  282. package/.next-prod/server/app/api/settings/route.js.nft.json +1 -1
  283. package/.next-prod/server/app/api/skills/[id]/route.js +1 -1
  284. package/.next-prod/server/app/api/skills/[id]/route.js.nft.json +1 -1
  285. package/.next-prod/server/app/api/skills/content/route.js +1 -1
  286. package/.next-prod/server/app/api/skills/content/route.js.nft.json +1 -1
  287. package/.next-prod/server/app/api/skills/route.js +1 -1
  288. package/.next-prod/server/app/api/skills/route.js.nft.json +1 -1
  289. package/.next-prod/server/app/api/snapshots/diff/route.js +1 -1
  290. package/.next-prod/server/app/api/snapshots/diff/route.js.nft.json +1 -1
  291. package/.next-prod/server/app/api/snapshots/route.js +1 -1
  292. package/.next-prod/server/app/api/snapshots/route.js.nft.json +1 -1
  293. package/.next-prod/server/app/api/terminal/aliases/route.js +1 -1
  294. package/.next-prod/server/app/api/terminal/aliases/route.js.nft.json +1 -1
  295. package/.next-prod/server/app/api/terminal/autocomplete/route.js +1 -1
  296. package/.next-prod/server/app/api/terminal/autocomplete/route.js.nft.json +1 -1
  297. package/.next-prod/server/app/api/terminal/bubble-order/route.js +1 -1
  298. package/.next-prod/server/app/api/terminal/bubble-order/route.js.nft.json +1 -1
  299. package/.next-prod/server/app/api/terminal/env/route.js +1 -1
  300. package/.next-prod/server/app/api/terminal/env/route.js.nft.json +1 -1
  301. package/.next-prod/server/app/api/terminal/history/route.js +1 -1
  302. package/.next-prod/server/app/api/terminal/history/route.js.nft.json +1 -1
  303. package/.next-prod/server/app/api/version/route.js +1 -1
  304. package/.next-prod/server/app/api/version/route.js.nft.json +1 -1
  305. package/.next-prod/server/app/apps/[...path]/route.js +1 -1
  306. package/.next-prod/server/app/apps/[...path]/route.js.nft.json +1 -1
  307. package/.next-prod/server/app/favicon.ico/route.js +1 -1
  308. package/.next-prod/server/app/favicon.ico/route.js.nft.json +1 -1
  309. package/.next-prod/server/app/m/page.js +1 -1
  310. package/.next-prod/server/app/m/page.js.nft.json +1 -1
  311. package/.next-prod/server/app/m/page_client-reference-manifest.js +1 -1
  312. package/.next-prod/server/app/manifest.webmanifest/route.js +2 -2
  313. package/.next-prod/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  314. package/.next-prod/server/app/page.js +1 -1
  315. package/.next-prod/server/app/page.js.nft.json +1 -1
  316. package/.next-prod/server/app/page_client-reference-manifest.js +1 -1
  317. package/.next-prod/server/app/project/page.js +1 -1
  318. package/.next-prod/server/app/project/page.js.nft.json +1 -1
  319. package/.next-prod/server/app/project/page_client-reference-manifest.js +1 -1
  320. package/.next-prod/server/app/review/[id]/page.js +1 -1
  321. package/.next-prod/server/app/review/[id]/page.js.nft.json +1 -1
  322. package/.next-prod/server/app/review/[id]/page_client-reference-manifest.js +1 -1
  323. package/.next-prod/server/app-paths-manifest.json +3 -4
  324. package/.next-prod/server/chunks/1564.js +5 -0
  325. package/.next-prod/server/chunks/3286.js +5 -5
  326. package/.next-prod/server/chunks/3863.js +1 -4
  327. package/.next-prod/server/chunks/5750.js +419 -0
  328. package/.next-prod/server/chunks/6495.js +1 -0
  329. package/.next-prod/server/chunks/6548.js +1 -1
  330. package/.next-prod/server/chunks/7270.js +3 -3
  331. package/.next-prod/server/chunks/8557.js +114 -0
  332. package/.next-prod/server/chunks/8764.js +26 -0
  333. package/.next-prod/server/chunks/9312.js +1 -0
  334. package/.next-prod/server/chunks/9352.js +6 -0
  335. package/.next-prod/server/chunks/9830.js +1 -1
  336. package/.next-prod/server/middleware-build-manifest.js +1 -1
  337. package/.next-prod/server/middleware-react-loadable-manifest.js +1 -1
  338. package/.next-prod/server/pages/404.html +2 -2
  339. package/.next-prod/server/pages/500.html +1 -1
  340. package/.next-prod/server/server-reference-manifest.json +1 -1
  341. package/.next-prod/static/ZFNy0XuBWptMqEQGi7GTy/_buildManifest.js +1 -0
  342. package/.next-prod/static/chunks/1372-cc9afa045dc4eb5e.js +15 -0
  343. package/.next-prod/static/chunks/6784-500e233d3e8f6b41.js +381 -0
  344. package/.next-prod/static/chunks/7482-8478af06d5aa0972.js +25 -0
  345. package/.next-prod/static/chunks/9b0008ae.d0c8feea26186989.js +45 -0
  346. package/.next-prod/static/chunks/app/_global-error/page-3c1c06e2de280418.js +1 -0
  347. package/.next-prod/static/chunks/app/api/agent/test/route-3c1c06e2de280418.js +1 -0
  348. package/.next-prod/static/chunks/app/api/bash/route-3c1c06e2de280418.js +1 -0
  349. package/.next-prod/static/chunks/app/api/chat/codex/route-3c1c06e2de280418.js +1 -0
  350. package/.next-prod/static/chunks/app/api/chat/deepseek/route-3c1c06e2de280418.js +1 -0
  351. package/.next-prod/static/chunks/app/api/chat/glm/route-3c1c06e2de280418.js +1 -0
  352. package/.next-prod/static/chunks/app/api/chat/kimi/route-3c1c06e2de280418.js +1 -0
  353. package/.next-prod/static/chunks/app/api/chat/ollama/route-3c1c06e2de280418.js +1 -0
  354. package/.next-prod/static/chunks/app/api/chat/route-3c1c06e2de280418.js +1 -0
  355. package/.next-prod/static/chunks/app/api/chat/stop/route-3c1c06e2de280418.js +1 -0
  356. package/.next-prod/static/chunks/app/api/claude-stats/route-3c1c06e2de280418.js +1 -0
  357. package/.next-prod/static/chunks/app/api/commands/route-3c1c06e2de280418.js +1 -0
  358. package/.next-prod/static/chunks/app/api/comments/route-3c1c06e2de280418.js +1 -0
  359. package/.next-prod/static/chunks/app/api/db/columns/route-3c1c06e2de280418.js +1 -0
  360. package/.next-prod/static/chunks/app/api/db/connect/route-3c1c06e2de280418.js +1 -0
  361. package/.next-prod/static/chunks/app/api/db/disconnect/route-3c1c06e2de280418.js +1 -0
  362. package/.next-prod/static/chunks/app/api/db/export/route-3c1c06e2de280418.js +1 -0
  363. package/.next-prod/static/chunks/app/api/db/query/route-3c1c06e2de280418.js +1 -0
  364. package/.next-prod/static/chunks/app/api/db/schemas/route-3c1c06e2de280418.js +1 -0
  365. package/.next-prod/static/chunks/app/api/deepseek/balance/route-3c1c06e2de280418.js +1 -0
  366. package/.next-prod/static/chunks/app/api/deepseek/credentials/route-3c1c06e2de280418.js +1 -0
  367. package/.next-prod/static/chunks/app/api/deepseek/models/route-3c1c06e2de280418.js +1 -0
  368. package/.next-prod/static/chunks/app/api/dev/spans/route-3c1c06e2de280418.js +1 -0
  369. package/.next-prod/static/chunks/app/api/extension/version/route-3c1c06e2de280418.js +1 -0
  370. package/.next-prod/static/chunks/app/api/file/route-3c1c06e2de280418.js +1 -0
  371. package/.next-prod/static/chunks/app/api/files/blame/route-3c1c06e2de280418.js +1 -0
  372. package/.next-prod/static/chunks/app/api/files/clipboard/route-3c1c06e2de280418.js +1 -0
  373. package/.next-prod/static/chunks/app/api/files/copy/route-3c1c06e2de280418.js +1 -0
  374. package/.next-prod/static/chunks/app/api/files/delete/route-3c1c06e2de280418.js +1 -0
  375. package/.next-prod/static/chunks/app/api/files/expanded/route-3c1c06e2de280418.js +1 -0
  376. package/.next-prod/static/chunks/app/api/files/index/route-3c1c06e2de280418.js +1 -0
  377. package/.next-prod/static/chunks/app/api/files/init/route-3c1c06e2de280418.js +1 -0
  378. package/.next-prod/static/chunks/app/api/files/paste/route-3c1c06e2de280418.js +1 -0
  379. package/.next-prod/static/chunks/app/api/files/read/route-3c1c06e2de280418.js +1 -0
  380. package/.next-prod/static/chunks/app/api/files/readdir/route-3c1c06e2de280418.js +1 -0
  381. package/.next-prod/static/chunks/app/api/files/recent/route-3c1c06e2de280418.js +1 -0
  382. package/.next-prod/static/chunks/app/api/files/save/route-3c1c06e2de280418.js +1 -0
  383. package/.next-prod/static/chunks/app/api/files/search/route-3c1c06e2de280418.js +1 -0
  384. package/.next-prod/static/chunks/app/api/files/stat/route-3c1c06e2de280418.js +1 -0
  385. package/.next-prod/static/chunks/app/api/files/text/route-3c1c06e2de280418.js +1 -0
  386. package/.next-prod/static/chunks/app/api/git/branch-diff/route-3c1c06e2de280418.js +1 -0
  387. package/.next-prod/static/chunks/app/api/git/branches/route-3c1c06e2de280418.js +1 -0
  388. package/.next-prod/static/chunks/app/api/git/commit-diff/route-3c1c06e2de280418.js +1 -0
  389. package/.next-prod/static/chunks/app/api/git/commits/route-3c1c06e2de280418.js +1 -0
  390. package/.next-prod/static/chunks/app/api/git/current-branch/route-3c1c06e2de280418.js +1 -0
  391. package/.next-prod/static/chunks/app/api/git/diff/route-3c1c06e2de280418.js +1 -0
  392. package/.next-prod/static/chunks/app/api/git/discard/route-3c1c06e2de280418.js +1 -0
  393. package/.next-prod/static/chunks/app/api/git/stage/route-3c1c06e2de280418.js +1 -0
  394. package/.next-prod/static/chunks/app/api/git/status/route-3c1c06e2de280418.js +1 -0
  395. package/.next-prod/static/chunks/app/api/git/unstage/route-3c1c06e2de280418.js +1 -0
  396. package/.next-prod/static/chunks/app/api/git/worktree/route-3c1c06e2de280418.js +1 -0
  397. package/.next-prod/static/chunks/app/api/glm/credentials/route-3c1c06e2de280418.js +1 -0
  398. package/.next-prod/static/chunks/app/api/glm/models/route-3c1c06e2de280418.js +1 -0
  399. package/.next-prod/static/chunks/app/api/glm/usage/route-3c1c06e2de280418.js +1 -0
  400. package/.next-prod/static/chunks/app/api/global-state/route-3c1c06e2de280418.js +1 -0
  401. package/.next-prod/static/chunks/app/api/health/route-3c1c06e2de280418.js +1 -0
  402. package/.next-prod/static/chunks/app/api/html-apps/[id]/route-3c1c06e2de280418.js +1 -0
  403. package/.next-prod/static/chunks/app/api/html-apps/route-3c1c06e2de280418.js +1 -0
  404. package/.next-prod/static/chunks/app/api/jupyter/load/route-3c1c06e2de280418.js +1 -0
  405. package/.next-prod/static/chunks/app/api/jupyter/save/route-3c1c06e2de280418.js +1 -0
  406. package/.next-prod/static/chunks/app/api/jupyter/shutdown/route-3c1c06e2de280418.js +1 -0
  407. package/.next-prod/static/chunks/app/api/kimi/credentials/route-3c1c06e2de280418.js +1 -0
  408. package/.next-prod/static/chunks/app/api/kimi/models/route-3c1c06e2de280418.js +1 -0
  409. package/.next-prod/static/chunks/app/api/kimi/usage/route-3c1c06e2de280418.js +1 -0
  410. package/.next-prod/static/chunks/app/api/lsp/definition/route-3c1c06e2de280418.js +1 -0
  411. package/.next-prod/static/chunks/app/api/lsp/hover/route-3c1c06e2de280418.js +1 -0
  412. package/.next-prod/static/chunks/app/api/lsp/references/route-3c1c06e2de280418.js +1 -0
  413. package/.next-prod/static/chunks/app/api/lsp/status/route-3c1c06e2de280418.js +1 -0
  414. package/.next-prod/static/chunks/app/api/lsp/warmup/route-3c1c06e2de280418.js +1 -0
  415. package/.next-prod/static/chunks/app/api/mysql/columns/route-3c1c06e2de280418.js +1 -0
  416. package/.next-prod/static/chunks/app/api/mysql/connect/route-3c1c06e2de280418.js +1 -0
  417. package/.next-prod/static/chunks/app/api/mysql/disconnect/route-3c1c06e2de280418.js +1 -0
  418. package/.next-prod/static/chunks/app/api/mysql/export/route-3c1c06e2de280418.js +1 -0
  419. package/.next-prod/static/chunks/app/api/mysql/query/route-3c1c06e2de280418.js +1 -0
  420. package/.next-prod/static/chunks/app/api/mysql/schemas/route-3c1c06e2de280418.js +1 -0
  421. package/.next-prod/static/chunks/app/api/neo4j/connect/route-3c1c06e2de280418.js +1 -0
  422. package/.next-prod/static/chunks/app/api/neo4j/disconnect/route-3c1c06e2de280418.js +1 -0
  423. package/.next-prod/static/chunks/app/api/neo4j/query/route-3c1c06e2de280418.js +1 -0
  424. package/.next-prod/static/chunks/app/api/neo4j/schema/route-3c1c06e2de280418.js +1 -0
  425. package/.next-prod/static/chunks/app/api/note/route-3c1c06e2de280418.js +1 -0
  426. package/.next-prod/static/chunks/app/api/ollama/config/route-3c1c06e2de280418.js +1 -0
  427. package/.next-prod/static/chunks/app/api/ollama/models/route-3c1c06e2de280418.js +1 -0
  428. package/.next-prod/static/chunks/app/api/ollama/start/route-3c1c06e2de280418.js +1 -0
  429. package/.next-prod/static/chunks/app/api/open-cursor/route-3c1c06e2de280418.js +1 -0
  430. package/.next-prod/static/chunks/app/api/open-vscode/route-3c1c06e2de280418.js +1 -0
  431. package/.next-prod/static/chunks/app/api/pick-folder/route-3c1c06e2de280418.js +1 -0
  432. package/.next-prod/static/chunks/app/api/pinned-sessions/route-3c1c06e2de280418.js +1 -0
  433. package/.next-prod/static/chunks/app/api/project-settings/route-3c1c06e2de280418.js +1 -0
  434. package/.next-prod/static/chunks/app/api/project-state/route-3c1c06e2de280418.js +1 -0
  435. package/.next-prod/static/chunks/app/api/projectGraph/affected/route-3c1c06e2de280418.js +1 -0
  436. package/.next-prod/static/chunks/app/api/projectGraph/callees/route-3c1c06e2de280418.js +1 -0
  437. package/.next-prod/static/chunks/app/api/projectGraph/callers/route-3c1c06e2de280418.js +1 -0
  438. package/.next-prod/static/chunks/app/api/projectGraph/coedit/route-3c1c06e2de280418.js +1 -0
  439. package/.next-prod/static/chunks/app/api/projectGraph/context/route-3c1c06e2de280418.js +1 -0
  440. package/.next-prod/static/chunks/app/api/projectGraph/file/route-3c1c06e2de280418.js +1 -0
  441. package/.next-prod/static/chunks/app/api/projectGraph/file-functions/route-3c1c06e2de280418.js +1 -0
  442. package/.next-prod/static/chunks/app/api/projectGraph/impact/route-3c1c06e2de280418.js +1 -0
  443. package/.next-prod/static/chunks/app/api/projectGraph/related/route-3c1c06e2de280418.js +1 -0
  444. package/.next-prod/static/chunks/app/api/projectGraph/risk/route-3c1c06e2de280418.js +1 -0
  445. package/.next-prod/static/chunks/app/api/projectGraph/search/route-3c1c06e2de280418.js +1 -0
  446. package/.next-prod/static/chunks/app/api/projects/route-3c1c06e2de280418.js +1 -0
  447. package/.next-prod/static/chunks/app/api/prompts/config/route-3c1c06e2de280418.js +1 -0
  448. package/.next-prod/static/chunks/app/api/push/public-key/route-3c1c06e2de280418.js +1 -0
  449. package/.next-prod/static/chunks/app/api/push/subscribe/route-3c1c06e2de280418.js +1 -0
  450. package/.next-prod/static/chunks/app/api/push/unsubscribe/route-3c1c06e2de280418.js +1 -0
  451. package/.next-prod/static/chunks/app/api/redis/command/route-3c1c06e2de280418.js +1 -0
  452. package/.next-prod/static/chunks/app/api/redis/connect/route-3c1c06e2de280418.js +1 -0
  453. package/.next-prod/static/chunks/app/api/redis/delete/route-3c1c06e2de280418.js +1 -0
  454. package/.next-prod/static/chunks/app/api/redis/disconnect/route-3c1c06e2de280418.js +1 -0
  455. package/.next-prod/static/chunks/app/api/redis/get/route-3c1c06e2de280418.js +1 -0
  456. package/.next-prod/static/chunks/app/api/redis/keys/route-3c1c06e2de280418.js +1 -0
  457. package/.next-prod/static/chunks/app/api/redis/set/route-3c1c06e2de280418.js +1 -0
  458. package/.next-prod/static/chunks/app/api/review/[id]/comments/route-3c1c06e2de280418.js +1 -0
  459. package/.next-prod/static/chunks/app/api/review/[id]/replies/route-3c1c06e2de280418.js +1 -0
  460. package/.next-prod/static/chunks/app/api/review/[id]/route-3c1c06e2de280418.js +1 -0
  461. package/.next-prod/static/chunks/app/api/review/identify/route-3c1c06e2de280418.js +1 -0
  462. package/.next-prod/static/chunks/app/api/review/order/route-3c1c06e2de280418.js +1 -0
  463. package/.next-prod/static/chunks/app/api/review/route-3c1c06e2de280418.js +1 -0
  464. package/.next-prod/static/chunks/app/api/review/share-info/route-3c1c06e2de280418.js +1 -0
  465. package/.next-prod/static/chunks/app/api/review/users/route-3c1c06e2de280418.js +1 -0
  466. package/.next-prod/static/chunks/app/api/scheduled-tasks/route-3c1c06e2de280418.js +1 -0
  467. package/.next-prod/static/chunks/app/api/services/config/route-3c1c06e2de280418.js +1 -0
  468. package/.next-prod/static/chunks/app/api/services/scripts/route-3c1c06e2de280418.js +1 -0
  469. package/.next-prod/static/chunks/app/api/session/[sessionId]/fork/route-3c1c06e2de280418.js +1 -0
  470. package/.next-prod/static/chunks/app/api/session/[sessionId]/history/route-3c1c06e2de280418.js +1 -0
  471. package/.next-prod/static/chunks/app/api/session-by-path/route-3c1c06e2de280418.js +1 -0
  472. package/.next-prod/static/chunks/app/api/sessions/projects/[encodedPath]/route-3c1c06e2de280418.js +1 -0
  473. package/.next-prod/static/chunks/app/api/sessions/projects/route-3c1c06e2de280418.js +1 -0
  474. package/.next-prod/static/chunks/app/api/sessions/route-3c1c06e2de280418.js +1 -0
  475. package/.next-prod/static/chunks/app/api/settings/route-3c1c06e2de280418.js +1 -0
  476. package/.next-prod/static/chunks/app/api/skills/[id]/route-3c1c06e2de280418.js +1 -0
  477. package/.next-prod/static/chunks/app/api/skills/content/route-3c1c06e2de280418.js +1 -0
  478. package/.next-prod/static/chunks/app/api/skills/route-3c1c06e2de280418.js +1 -0
  479. package/.next-prod/static/chunks/app/api/snapshots/diff/route-3c1c06e2de280418.js +1 -0
  480. package/.next-prod/static/chunks/app/api/snapshots/route-3c1c06e2de280418.js +1 -0
  481. package/.next-prod/static/chunks/app/api/terminal/aliases/route-3c1c06e2de280418.js +1 -0
  482. package/.next-prod/static/chunks/app/api/terminal/autocomplete/route-3c1c06e2de280418.js +1 -0
  483. package/.next-prod/static/chunks/app/api/terminal/bubble-order/route-3c1c06e2de280418.js +1 -0
  484. package/.next-prod/static/chunks/app/api/terminal/env/route-3c1c06e2de280418.js +1 -0
  485. package/.next-prod/static/chunks/app/api/terminal/history/route-3c1c06e2de280418.js +1 -0
  486. package/.next-prod/static/chunks/app/api/version/route-3c1c06e2de280418.js +1 -0
  487. package/.next-prod/static/chunks/app/apps/[...path]/route-3c1c06e2de280418.js +1 -0
  488. package/.next-prod/static/chunks/app/{layout-f90feff7c76b0946.js → layout-bec1cf218bc88d81.js} +1 -1
  489. package/.next-prod/static/chunks/app/m/page-aff83d3f5f4047c5.js +1 -0
  490. package/.next-prod/static/chunks/app/manifest.webmanifest/route-3c1c06e2de280418.js +1 -0
  491. package/.next-prod/static/chunks/app/{page-c4b0acf767168141.js → page-5e6dbc9731415743.js} +1 -1
  492. package/.next-prod/static/chunks/app/project/{page-c4b0acf767168141.js → page-5e6dbc9731415743.js} +1 -1
  493. package/.next-prod/static/chunks/next/dist/client/components/builtin/app-error-3c1c06e2de280418.js +1 -0
  494. package/.next-prod/static/chunks/next/dist/client/components/builtin/forbidden-3c1c06e2de280418.js +1 -0
  495. package/.next-prod/static/chunks/next/dist/client/components/builtin/not-found-3c1c06e2de280418.js +1 -0
  496. package/.next-prod/static/chunks/next/dist/client/components/builtin/unauthorized-3c1c06e2de280418.js +1 -0
  497. package/.next-prod/static/chunks/webpack-ce60587570394496.js +1 -0
  498. package/.next-prod/static/css/2334aed02a409f57.css +1 -0
  499. package/.next-prod/trace +14 -14
  500. package/.next-prod/trace-build +1 -1
  501. package/.next-prod/types/routes.d.ts +1 -2
  502. package/.next-prod/types/validator.ts +0 -9
  503. package/dist/{chunk-AK47NPAX.mjs → chunk-L5TWVHYB.mjs} +128 -7
  504. package/dist/{chunk-BKJB2B6J.mjs → chunk-RSRPFWNL.mjs} +42 -24
  505. package/dist/{chunk-47FA22UG.mjs → chunk-YEZ3U3F2.mjs} +1 -1
  506. package/dist/httpApi.mjs +2 -2
  507. package/dist/scheduledTasks.mjs +716 -867
  508. package/dist/{server-MAWFYWEQ.mjs → server-UZPDELUK.mjs} +2 -2
  509. package/dist/wsServer.mjs +74 -16
  510. package/package.json +3 -2
  511. package/public/html-lib/pdf-viewer.js +12 -12
  512. package/public/pdfjs/pdf.worker.min.mjs +4 -4
  513. package/.next-prod/server/app/api/chat/pty-input/route.js +0 -1
  514. package/.next-prod/server/app/api/chat/pty-input/route.js.nft.json +0 -1
  515. package/.next-prod/server/app/api/chat/pty-input/route_client-reference-manifest.js +0 -1
  516. package/.next-prod/server/chunks/304.js +0 -5
  517. package/.next-prod/server/chunks/3630.js +0 -131
  518. package/.next-prod/server/chunks/3792.js +0 -9
  519. package/.next-prod/server/chunks/6244.js +0 -1
  520. package/.next-prod/server/chunks/816.js +0 -1
  521. package/.next-prod/server/chunks/9658.js +0 -419
  522. package/.next-prod/static/Czv7BvSRgbv_YxaPTAg76/_buildManifest.js +0 -1
  523. package/.next-prod/static/chunks/6784-a667d5c1bad7809f.js +0 -381
  524. package/.next-prod/static/chunks/68-f485ff0192217706.js +0 -15
  525. package/.next-prod/static/chunks/8209-8bdd924515d12e09.js +0 -25
  526. package/.next-prod/static/chunks/9b0008ae.295c31138a16177d.js +0 -45
  527. package/.next-prod/static/chunks/app/_global-error/page-9dac0ffeb2327967.js +0 -1
  528. package/.next-prod/static/chunks/app/api/agent/test/route-9dac0ffeb2327967.js +0 -1
  529. package/.next-prod/static/chunks/app/api/bash/route-9dac0ffeb2327967.js +0 -1
  530. package/.next-prod/static/chunks/app/api/chat/codex/route-9dac0ffeb2327967.js +0 -1
  531. package/.next-prod/static/chunks/app/api/chat/deepseek/route-9dac0ffeb2327967.js +0 -1
  532. package/.next-prod/static/chunks/app/api/chat/glm/route-9dac0ffeb2327967.js +0 -1
  533. package/.next-prod/static/chunks/app/api/chat/kimi/route-9dac0ffeb2327967.js +0 -1
  534. package/.next-prod/static/chunks/app/api/chat/ollama/route-9dac0ffeb2327967.js +0 -1
  535. package/.next-prod/static/chunks/app/api/chat/pty-input/route-9dac0ffeb2327967.js +0 -1
  536. package/.next-prod/static/chunks/app/api/chat/route-9dac0ffeb2327967.js +0 -1
  537. package/.next-prod/static/chunks/app/api/chat/stop/route-9dac0ffeb2327967.js +0 -1
  538. package/.next-prod/static/chunks/app/api/claude-stats/route-9dac0ffeb2327967.js +0 -1
  539. package/.next-prod/static/chunks/app/api/commands/route-9dac0ffeb2327967.js +0 -1
  540. package/.next-prod/static/chunks/app/api/comments/route-9dac0ffeb2327967.js +0 -1
  541. package/.next-prod/static/chunks/app/api/db/columns/route-9dac0ffeb2327967.js +0 -1
  542. package/.next-prod/static/chunks/app/api/db/connect/route-9dac0ffeb2327967.js +0 -1
  543. package/.next-prod/static/chunks/app/api/db/disconnect/route-9dac0ffeb2327967.js +0 -1
  544. package/.next-prod/static/chunks/app/api/db/export/route-9dac0ffeb2327967.js +0 -1
  545. package/.next-prod/static/chunks/app/api/db/query/route-9dac0ffeb2327967.js +0 -1
  546. package/.next-prod/static/chunks/app/api/db/schemas/route-9dac0ffeb2327967.js +0 -1
  547. package/.next-prod/static/chunks/app/api/deepseek/balance/route-9dac0ffeb2327967.js +0 -1
  548. package/.next-prod/static/chunks/app/api/deepseek/credentials/route-9dac0ffeb2327967.js +0 -1
  549. package/.next-prod/static/chunks/app/api/deepseek/models/route-9dac0ffeb2327967.js +0 -1
  550. package/.next-prod/static/chunks/app/api/dev/spans/route-9dac0ffeb2327967.js +0 -1
  551. package/.next-prod/static/chunks/app/api/extension/version/route-9dac0ffeb2327967.js +0 -1
  552. package/.next-prod/static/chunks/app/api/file/route-9dac0ffeb2327967.js +0 -1
  553. package/.next-prod/static/chunks/app/api/files/blame/route-9dac0ffeb2327967.js +0 -1
  554. package/.next-prod/static/chunks/app/api/files/clipboard/route-9dac0ffeb2327967.js +0 -1
  555. package/.next-prod/static/chunks/app/api/files/copy/route-9dac0ffeb2327967.js +0 -1
  556. package/.next-prod/static/chunks/app/api/files/delete/route-9dac0ffeb2327967.js +0 -1
  557. package/.next-prod/static/chunks/app/api/files/expanded/route-9dac0ffeb2327967.js +0 -1
  558. package/.next-prod/static/chunks/app/api/files/index/route-9dac0ffeb2327967.js +0 -1
  559. package/.next-prod/static/chunks/app/api/files/init/route-9dac0ffeb2327967.js +0 -1
  560. package/.next-prod/static/chunks/app/api/files/paste/route-9dac0ffeb2327967.js +0 -1
  561. package/.next-prod/static/chunks/app/api/files/read/route-9dac0ffeb2327967.js +0 -1
  562. package/.next-prod/static/chunks/app/api/files/readdir/route-9dac0ffeb2327967.js +0 -1
  563. package/.next-prod/static/chunks/app/api/files/recent/route-9dac0ffeb2327967.js +0 -1
  564. package/.next-prod/static/chunks/app/api/files/save/route-9dac0ffeb2327967.js +0 -1
  565. package/.next-prod/static/chunks/app/api/files/search/route-9dac0ffeb2327967.js +0 -1
  566. package/.next-prod/static/chunks/app/api/files/stat/route-9dac0ffeb2327967.js +0 -1
  567. package/.next-prod/static/chunks/app/api/files/text/route-9dac0ffeb2327967.js +0 -1
  568. package/.next-prod/static/chunks/app/api/git/branch-diff/route-9dac0ffeb2327967.js +0 -1
  569. package/.next-prod/static/chunks/app/api/git/branches/route-9dac0ffeb2327967.js +0 -1
  570. package/.next-prod/static/chunks/app/api/git/commit-diff/route-9dac0ffeb2327967.js +0 -1
  571. package/.next-prod/static/chunks/app/api/git/commits/route-9dac0ffeb2327967.js +0 -1
  572. package/.next-prod/static/chunks/app/api/git/current-branch/route-9dac0ffeb2327967.js +0 -1
  573. package/.next-prod/static/chunks/app/api/git/diff/route-9dac0ffeb2327967.js +0 -1
  574. package/.next-prod/static/chunks/app/api/git/discard/route-9dac0ffeb2327967.js +0 -1
  575. package/.next-prod/static/chunks/app/api/git/stage/route-9dac0ffeb2327967.js +0 -1
  576. package/.next-prod/static/chunks/app/api/git/status/route-9dac0ffeb2327967.js +0 -1
  577. package/.next-prod/static/chunks/app/api/git/unstage/route-9dac0ffeb2327967.js +0 -1
  578. package/.next-prod/static/chunks/app/api/git/worktree/route-9dac0ffeb2327967.js +0 -1
  579. package/.next-prod/static/chunks/app/api/glm/credentials/route-9dac0ffeb2327967.js +0 -1
  580. package/.next-prod/static/chunks/app/api/glm/models/route-9dac0ffeb2327967.js +0 -1
  581. package/.next-prod/static/chunks/app/api/glm/usage/route-9dac0ffeb2327967.js +0 -1
  582. package/.next-prod/static/chunks/app/api/global-state/route-9dac0ffeb2327967.js +0 -1
  583. package/.next-prod/static/chunks/app/api/health/route-9dac0ffeb2327967.js +0 -1
  584. package/.next-prod/static/chunks/app/api/html-apps/[id]/route-9dac0ffeb2327967.js +0 -1
  585. package/.next-prod/static/chunks/app/api/html-apps/route-9dac0ffeb2327967.js +0 -1
  586. package/.next-prod/static/chunks/app/api/jupyter/load/route-9dac0ffeb2327967.js +0 -1
  587. package/.next-prod/static/chunks/app/api/jupyter/save/route-9dac0ffeb2327967.js +0 -1
  588. package/.next-prod/static/chunks/app/api/jupyter/shutdown/route-9dac0ffeb2327967.js +0 -1
  589. package/.next-prod/static/chunks/app/api/kimi/credentials/route-9dac0ffeb2327967.js +0 -1
  590. package/.next-prod/static/chunks/app/api/kimi/models/route-9dac0ffeb2327967.js +0 -1
  591. package/.next-prod/static/chunks/app/api/kimi/usage/route-9dac0ffeb2327967.js +0 -1
  592. package/.next-prod/static/chunks/app/api/lsp/definition/route-9dac0ffeb2327967.js +0 -1
  593. package/.next-prod/static/chunks/app/api/lsp/hover/route-9dac0ffeb2327967.js +0 -1
  594. package/.next-prod/static/chunks/app/api/lsp/references/route-9dac0ffeb2327967.js +0 -1
  595. package/.next-prod/static/chunks/app/api/lsp/status/route-9dac0ffeb2327967.js +0 -1
  596. package/.next-prod/static/chunks/app/api/lsp/warmup/route-9dac0ffeb2327967.js +0 -1
  597. package/.next-prod/static/chunks/app/api/mysql/columns/route-9dac0ffeb2327967.js +0 -1
  598. package/.next-prod/static/chunks/app/api/mysql/connect/route-9dac0ffeb2327967.js +0 -1
  599. package/.next-prod/static/chunks/app/api/mysql/disconnect/route-9dac0ffeb2327967.js +0 -1
  600. package/.next-prod/static/chunks/app/api/mysql/export/route-9dac0ffeb2327967.js +0 -1
  601. package/.next-prod/static/chunks/app/api/mysql/query/route-9dac0ffeb2327967.js +0 -1
  602. package/.next-prod/static/chunks/app/api/mysql/schemas/route-9dac0ffeb2327967.js +0 -1
  603. package/.next-prod/static/chunks/app/api/neo4j/connect/route-9dac0ffeb2327967.js +0 -1
  604. package/.next-prod/static/chunks/app/api/neo4j/disconnect/route-9dac0ffeb2327967.js +0 -1
  605. package/.next-prod/static/chunks/app/api/neo4j/query/route-9dac0ffeb2327967.js +0 -1
  606. package/.next-prod/static/chunks/app/api/neo4j/schema/route-9dac0ffeb2327967.js +0 -1
  607. package/.next-prod/static/chunks/app/api/note/route-9dac0ffeb2327967.js +0 -1
  608. package/.next-prod/static/chunks/app/api/ollama/config/route-9dac0ffeb2327967.js +0 -1
  609. package/.next-prod/static/chunks/app/api/ollama/models/route-9dac0ffeb2327967.js +0 -1
  610. package/.next-prod/static/chunks/app/api/ollama/start/route-9dac0ffeb2327967.js +0 -1
  611. package/.next-prod/static/chunks/app/api/open-cursor/route-9dac0ffeb2327967.js +0 -1
  612. package/.next-prod/static/chunks/app/api/open-vscode/route-9dac0ffeb2327967.js +0 -1
  613. package/.next-prod/static/chunks/app/api/pick-folder/route-9dac0ffeb2327967.js +0 -1
  614. package/.next-prod/static/chunks/app/api/pinned-sessions/route-9dac0ffeb2327967.js +0 -1
  615. package/.next-prod/static/chunks/app/api/project-settings/route-9dac0ffeb2327967.js +0 -1
  616. package/.next-prod/static/chunks/app/api/project-state/route-9dac0ffeb2327967.js +0 -1
  617. package/.next-prod/static/chunks/app/api/projectGraph/affected/route-9dac0ffeb2327967.js +0 -1
  618. package/.next-prod/static/chunks/app/api/projectGraph/callees/route-9dac0ffeb2327967.js +0 -1
  619. package/.next-prod/static/chunks/app/api/projectGraph/callers/route-9dac0ffeb2327967.js +0 -1
  620. package/.next-prod/static/chunks/app/api/projectGraph/coedit/route-9dac0ffeb2327967.js +0 -1
  621. package/.next-prod/static/chunks/app/api/projectGraph/context/route-9dac0ffeb2327967.js +0 -1
  622. package/.next-prod/static/chunks/app/api/projectGraph/file/route-9dac0ffeb2327967.js +0 -1
  623. package/.next-prod/static/chunks/app/api/projectGraph/file-functions/route-9dac0ffeb2327967.js +0 -1
  624. package/.next-prod/static/chunks/app/api/projectGraph/impact/route-9dac0ffeb2327967.js +0 -1
  625. package/.next-prod/static/chunks/app/api/projectGraph/related/route-9dac0ffeb2327967.js +0 -1
  626. package/.next-prod/static/chunks/app/api/projectGraph/risk/route-9dac0ffeb2327967.js +0 -1
  627. package/.next-prod/static/chunks/app/api/projectGraph/search/route-9dac0ffeb2327967.js +0 -1
  628. package/.next-prod/static/chunks/app/api/projects/route-9dac0ffeb2327967.js +0 -1
  629. package/.next-prod/static/chunks/app/api/prompts/config/route-9dac0ffeb2327967.js +0 -1
  630. package/.next-prod/static/chunks/app/api/push/public-key/route-9dac0ffeb2327967.js +0 -1
  631. package/.next-prod/static/chunks/app/api/push/subscribe/route-9dac0ffeb2327967.js +0 -1
  632. package/.next-prod/static/chunks/app/api/push/unsubscribe/route-9dac0ffeb2327967.js +0 -1
  633. package/.next-prod/static/chunks/app/api/redis/command/route-9dac0ffeb2327967.js +0 -1
  634. package/.next-prod/static/chunks/app/api/redis/connect/route-9dac0ffeb2327967.js +0 -1
  635. package/.next-prod/static/chunks/app/api/redis/delete/route-9dac0ffeb2327967.js +0 -1
  636. package/.next-prod/static/chunks/app/api/redis/disconnect/route-9dac0ffeb2327967.js +0 -1
  637. package/.next-prod/static/chunks/app/api/redis/get/route-9dac0ffeb2327967.js +0 -1
  638. package/.next-prod/static/chunks/app/api/redis/keys/route-9dac0ffeb2327967.js +0 -1
  639. package/.next-prod/static/chunks/app/api/redis/set/route-9dac0ffeb2327967.js +0 -1
  640. package/.next-prod/static/chunks/app/api/review/[id]/comments/route-9dac0ffeb2327967.js +0 -1
  641. package/.next-prod/static/chunks/app/api/review/[id]/replies/route-9dac0ffeb2327967.js +0 -1
  642. package/.next-prod/static/chunks/app/api/review/[id]/route-9dac0ffeb2327967.js +0 -1
  643. package/.next-prod/static/chunks/app/api/review/identify/route-9dac0ffeb2327967.js +0 -1
  644. package/.next-prod/static/chunks/app/api/review/order/route-9dac0ffeb2327967.js +0 -1
  645. package/.next-prod/static/chunks/app/api/review/route-9dac0ffeb2327967.js +0 -1
  646. package/.next-prod/static/chunks/app/api/review/share-info/route-9dac0ffeb2327967.js +0 -1
  647. package/.next-prod/static/chunks/app/api/review/users/route-9dac0ffeb2327967.js +0 -1
  648. package/.next-prod/static/chunks/app/api/scheduled-tasks/route-9dac0ffeb2327967.js +0 -1
  649. package/.next-prod/static/chunks/app/api/services/config/route-9dac0ffeb2327967.js +0 -1
  650. package/.next-prod/static/chunks/app/api/services/scripts/route-9dac0ffeb2327967.js +0 -1
  651. package/.next-prod/static/chunks/app/api/session/[sessionId]/fork/route-9dac0ffeb2327967.js +0 -1
  652. package/.next-prod/static/chunks/app/api/session/[sessionId]/history/route-9dac0ffeb2327967.js +0 -1
  653. package/.next-prod/static/chunks/app/api/session-by-path/route-9dac0ffeb2327967.js +0 -1
  654. package/.next-prod/static/chunks/app/api/sessions/projects/[encodedPath]/route-9dac0ffeb2327967.js +0 -1
  655. package/.next-prod/static/chunks/app/api/sessions/projects/route-9dac0ffeb2327967.js +0 -1
  656. package/.next-prod/static/chunks/app/api/sessions/route-9dac0ffeb2327967.js +0 -1
  657. package/.next-prod/static/chunks/app/api/settings/route-9dac0ffeb2327967.js +0 -1
  658. package/.next-prod/static/chunks/app/api/skills/[id]/route-9dac0ffeb2327967.js +0 -1
  659. package/.next-prod/static/chunks/app/api/skills/content/route-9dac0ffeb2327967.js +0 -1
  660. package/.next-prod/static/chunks/app/api/skills/route-9dac0ffeb2327967.js +0 -1
  661. package/.next-prod/static/chunks/app/api/snapshots/diff/route-9dac0ffeb2327967.js +0 -1
  662. package/.next-prod/static/chunks/app/api/snapshots/route-9dac0ffeb2327967.js +0 -1
  663. package/.next-prod/static/chunks/app/api/terminal/aliases/route-9dac0ffeb2327967.js +0 -1
  664. package/.next-prod/static/chunks/app/api/terminal/autocomplete/route-9dac0ffeb2327967.js +0 -1
  665. package/.next-prod/static/chunks/app/api/terminal/bubble-order/route-9dac0ffeb2327967.js +0 -1
  666. package/.next-prod/static/chunks/app/api/terminal/env/route-9dac0ffeb2327967.js +0 -1
  667. package/.next-prod/static/chunks/app/api/terminal/history/route-9dac0ffeb2327967.js +0 -1
  668. package/.next-prod/static/chunks/app/api/version/route-9dac0ffeb2327967.js +0 -1
  669. package/.next-prod/static/chunks/app/apps/[...path]/route-9dac0ffeb2327967.js +0 -1
  670. package/.next-prod/static/chunks/app/m/page-76152d251f696ab0.js +0 -1
  671. package/.next-prod/static/chunks/app/manifest.webmanifest/route-9dac0ffeb2327967.js +0 -1
  672. package/.next-prod/static/chunks/next/dist/client/components/builtin/app-error-9dac0ffeb2327967.js +0 -1
  673. package/.next-prod/static/chunks/next/dist/client/components/builtin/forbidden-9dac0ffeb2327967.js +0 -1
  674. package/.next-prod/static/chunks/next/dist/client/components/builtin/not-found-9dac0ffeb2327967.js +0 -1
  675. package/.next-prod/static/chunks/next/dist/client/components/builtin/unauthorized-9dac0ffeb2327967.js +0 -1
  676. package/.next-prod/static/chunks/webpack-2c0b747c5f1f1292.js +0 -1
  677. package/.next-prod/static/css/cec4dec703a9f1ee.css +0 -1
  678. package/.next-prod/types/app/api/chat/pty-input/route.ts +0 -353
  679. /package/.next-prod/static/{Czv7BvSRgbv_YxaPTAg76 → ZFNy0XuBWptMqEQGi7GTy}/_ssgManifest.js +0 -0
  680. /package/.next-prod/static/chunks/{e868780c-bf7462247eeab995.js → e868780c.bf7462247eeab995.js} +0 -0
@@ -1,13 +1,13 @@
1
- "use strict";(()=>{var Xb=Object.create;var oc=Object.defineProperty;var Yb=Object.getOwnPropertyDescriptor;var qb=Object.getOwnPropertyNames;var Kb=Object.getPrototypeOf,Wb=Object.prototype.hasOwnProperty;var Qb=(i,t,e)=>()=>{if(e)throw e[0];try{return i&&(t=i(i=0)),t}catch(n){throw e=[n],n}};var je=(i,t)=>()=>{try{return t||i((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}},$b=(i,t)=>{for(var e in t)oc(i,e,{get:t[e],enumerable:!0})},Zb=(i,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of qb(t))!Wb.call(i,s)&&s!==e&&oc(i,s,{get:()=>t[s],enumerable:!(n=Yb(t,s))||n.enumerable});return i};var Ci=(i,t,e)=>(e=i!=null?Xb(Kb(i)):{},Zb(t||!i||!i.__esModule?oc(e,"default",{value:i,enumerable:!0}):e,i));var Qf=je(mt=>{"use strict";function hc(i,t){var e=i.length;i.push(t);t:for(;0<e;){var n=e-1>>>1,s=i[n];if(0<Or(s,t))i[n]=t,i[e]=s,e=n;else break t}}function Ve(i){return i.length===0?null:i[0]}function Nr(i){if(i.length===0)return null;var t=i[0],e=i.pop();if(e!==t){i[0]=e;t:for(var n=0,s=i.length,a=s>>>1;n<a;){var r=2*(n+1)-1,o=i[r],l=r+1,c=i[l];if(0>Or(o,e))l<s&&0>Or(c,o)?(i[n]=c,i[l]=e,n=l):(i[n]=o,i[r]=e,n=r);else if(l<s&&0>Or(c,e))i[n]=c,i[l]=e,n=l;else break t}}return t}function Or(i,t){var e=i.sortIndex-t.sortIndex;return e!==0?e:i.id-t.id}mt.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(Uf=performance,mt.unstable_now=function(){return Uf.now()}):(lc=Date,Gf=lc.now(),mt.unstable_now=function(){return lc.now()-Gf});var Uf,lc,Gf,ti=[],Mi=[],Jb=1,we=null,qt=3,dc=!1,Zs=!1,Js=!1,fc=!1,Xf=typeof setTimeout=="function"?setTimeout:null,Yf=typeof clearTimeout=="function"?clearTimeout:null,jf=typeof setImmediate<"u"?setImmediate:null;function Rr(i){for(var t=Ve(Mi);t!==null;){if(t.callback===null)Nr(Mi);else if(t.startTime<=i)Nr(Mi),t.sortIndex=t.expirationTime,hc(ti,t);else break;t=Ve(Mi)}}function pc(i){if(Js=!1,Rr(i),!Zs)if(Ve(ti)!==null)Zs=!0,Hn||(Hn=!0,Fn());else{var t=Ve(Mi);t!==null&&gc(pc,t.startTime-i)}}var Hn=!1,ta=-1,qf=5,Kf=-1;function Wf(){return fc?!0:!(mt.unstable_now()-Kf<qf)}function cc(){if(fc=!1,Hn){var i=mt.unstable_now();Kf=i;var t=!0;try{t:{Zs=!1,Js&&(Js=!1,Yf(ta),ta=-1),dc=!0;var e=qt;try{e:{for(Rr(i),we=Ve(ti);we!==null&&!(we.expirationTime>i&&Wf());){var n=we.callback;if(typeof n=="function"){we.callback=null,qt=we.priorityLevel;var s=n(we.expirationTime<=i);if(i=mt.unstable_now(),typeof s=="function"){we.callback=s,Rr(i),t=!0;break e}we===Ve(ti)&&Nr(ti),Rr(i)}else Nr(ti);we=Ve(ti)}if(we!==null)t=!0;else{var a=Ve(Mi);a!==null&&gc(pc,a.startTime-i),t=!1}}break t}finally{we=null,qt=e,dc=!1}t=void 0}}finally{t?Fn():Hn=!1}}}var Fn;typeof jf=="function"?Fn=function(){jf(cc)}:typeof MessageChannel<"u"?(uc=new MessageChannel,Vf=uc.port2,uc.port1.onmessage=cc,Fn=function(){Vf.postMessage(null)}):Fn=function(){Xf(cc,0)};var uc,Vf;function gc(i,t){ta=Xf(function(){i(mt.unstable_now())},t)}mt.unstable_IdlePriority=5;mt.unstable_ImmediatePriority=1;mt.unstable_LowPriority=4;mt.unstable_NormalPriority=3;mt.unstable_Profiling=null;mt.unstable_UserBlockingPriority=2;mt.unstable_cancelCallback=function(i){i.callback=null};mt.unstable_forceFrameRate=function(i){0>i||125<i?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):qf=0<i?Math.floor(1e3/i):5};mt.unstable_getCurrentPriorityLevel=function(){return qt};mt.unstable_next=function(i){switch(qt){case 1:case 2:case 3:var t=3;break;default:t=qt}var e=qt;qt=t;try{return i()}finally{qt=e}};mt.unstable_requestPaint=function(){fc=!0};mt.unstable_runWithPriority=function(i,t){switch(i){case 1:case 2:case 3:case 4:case 5:break;default:i=3}var e=qt;qt=i;try{return t()}finally{qt=e}};mt.unstable_scheduleCallback=function(i,t,e){var n=mt.unstable_now();switch(typeof e=="object"&&e!==null?(e=e.delay,e=typeof e=="number"&&0<e?n+e:n):e=n,i){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=e+s,i={id:Jb++,callback:t,priorityLevel:i,startTime:e,expirationTime:s,sortIndex:-1},e>n?(i.sortIndex=e,hc(Mi,i),Ve(ti)===null&&i===Ve(Mi)&&(Js?(Yf(ta),ta=-1):Js=!0,gc(pc,e-n))):(i.sortIndex=s,hc(ti,i),Zs||dc||(Zs=!0,Hn||(Hn=!0,Fn()))),i};mt.unstable_shouldYield=Wf;mt.unstable_wrapCallback=function(i){var t=qt;return function(){var e=qt;qt=t;try{return i.apply(this,arguments)}finally{qt=e}}}});var Zf=je((XS,$f)=>{"use strict";$f.exports=Qf()});var cp=je(F=>{"use strict";var bc=Symbol.for("react.transitional.element"),tv=Symbol.for("react.portal"),ev=Symbol.for("react.fragment"),iv=Symbol.for("react.strict_mode"),nv=Symbol.for("react.profiler"),sv=Symbol.for("react.consumer"),av=Symbol.for("react.context"),rv=Symbol.for("react.forward_ref"),ov=Symbol.for("react.suspense"),lv=Symbol.for("react.memo"),np=Symbol.for("react.lazy"),cv=Symbol.for("react.activity"),Jf=Symbol.iterator;function uv(i){return i===null||typeof i!="object"?null:(i=Jf&&i[Jf]||i["@@iterator"],typeof i=="function"?i:null)}var sp={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ap=Object.assign,rp={};function Gn(i,t,e){this.props=i,this.context=t,this.refs=rp,this.updater=e||sp}Gn.prototype.isReactComponent={};Gn.prototype.setState=function(i,t){if(typeof i!="object"&&typeof i!="function"&&i!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,i,t,"setState")};Gn.prototype.forceUpdate=function(i){this.updater.enqueueForceUpdate(this,i,"forceUpdate")};function op(){}op.prototype=Gn.prototype;function vc(i,t,e){this.props=i,this.context=t,this.refs=rp,this.updater=e||sp}var Ac=vc.prototype=new op;Ac.constructor=vc;ap(Ac,Gn.prototype);Ac.isPureReactComponent=!0;var tp=Array.isArray;function yc(){}var dt={H:null,A:null,T:null,S:null},lp=Object.prototype.hasOwnProperty;function Sc(i,t,e){var n=e.ref;return{$$typeof:bc,type:i,key:t,ref:n!==void 0?n:null,props:e}}function hv(i,t){return Sc(i.type,t,i.props)}function Ec(i){return typeof i=="object"&&i!==null&&i.$$typeof===bc}function dv(i){var t={"=":"=0",":":"=2"};return"$"+i.replace(/[=:]/g,function(e){return t[e]})}var ep=/\/+/g;function mc(i,t){return typeof i=="object"&&i!==null&&i.key!=null?dv(""+i.key):t.toString(36)}function fv(i){switch(i.status){case"fulfilled":return i.value;case"rejected":throw i.reason;default:switch(typeof i.status=="string"?i.then(yc,yc):(i.status="pending",i.then(function(t){i.status==="pending"&&(i.status="fulfilled",i.value=t)},function(t){i.status==="pending"&&(i.status="rejected",i.reason=t)})),i.status){case"fulfilled":return i.value;case"rejected":throw i.reason}}throw i}function Un(i,t,e,n,s){var a=typeof i;(a==="undefined"||a==="boolean")&&(i=null);var r=!1;if(i===null)r=!0;else switch(a){case"bigint":case"string":case"number":r=!0;break;case"object":switch(i.$$typeof){case bc:case tv:r=!0;break;case np:return r=i._init,Un(r(i._payload),t,e,n,s)}}if(r)return s=s(i),r=n===""?"."+mc(i,0):n,tp(s)?(e="",r!=null&&(e=r.replace(ep,"$&/")+"/"),Un(s,t,e,"",function(c){return c})):s!=null&&(Ec(s)&&(s=hv(s,e+(s.key==null||i&&i.key===s.key?"":(""+s.key).replace(ep,"$&/")+"/")+r)),t.push(s)),1;r=0;var o=n===""?".":n+":";if(tp(i))for(var l=0;l<i.length;l++)n=i[l],a=o+mc(n,l),r+=Un(n,t,e,a,s);else if(l=uv(i),typeof l=="function")for(i=l.call(i),l=0;!(n=i.next()).done;)n=n.value,a=o+mc(n,l++),r+=Un(n,t,e,a,s);else if(a==="object"){if(typeof i.then=="function")return Un(fv(i),t,e,n,s);throw t=String(i),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return r}function Lr(i,t,e){if(i==null)return i;var n=[],s=0;return Un(i,n,"","",function(a){return t.call(e,a,s++)}),n}function pv(i){if(i._status===-1){var t=i._result;t=t(),t.then(function(e){(i._status===0||i._status===-1)&&(i._status=1,i._result=e)},function(e){(i._status===0||i._status===-1)&&(i._status=2,i._result=e)}),i._status===-1&&(i._status=0,i._result=t)}if(i._status===1)return i._result.default;throw i._result}var ip=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},gv={map:Lr,forEach:function(i,t,e){Lr(i,function(){t.apply(this,arguments)},e)},count:function(i){var t=0;return Lr(i,function(){t++}),t},toArray:function(i){return Lr(i,function(t){return t})||[]},only:function(i){if(!Ec(i))throw Error("React.Children.only expected to receive a single React element child.");return i}};F.Activity=cv;F.Children=gv;F.Component=Gn;F.Fragment=ev;F.Profiler=nv;F.PureComponent=vc;F.StrictMode=iv;F.Suspense=ov;F.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=dt;F.__COMPILER_RUNTIME={__proto__:null,c:function(i){return dt.H.useMemoCache(i)}};F.cache=function(i){return function(){return i.apply(null,arguments)}};F.cacheSignal=function(){return null};F.cloneElement=function(i,t,e){if(i==null)throw Error("The argument must be a React element, but you passed "+i+".");var n=ap({},i.props),s=i.key;if(t!=null)for(a in t.key!==void 0&&(s=""+t.key),t)!lp.call(t,a)||a==="key"||a==="__self"||a==="__source"||a==="ref"&&t.ref===void 0||(n[a]=t[a]);var a=arguments.length-2;if(a===1)n.children=e;else if(1<a){for(var r=Array(a),o=0;o<a;o++)r[o]=arguments[o+2];n.children=r}return Sc(i.type,s,n)};F.createContext=function(i){return i={$$typeof:av,_currentValue:i,_currentValue2:i,_threadCount:0,Provider:null,Consumer:null},i.Provider=i,i.Consumer={$$typeof:sv,_context:i},i};F.createElement=function(i,t,e){var n,s={},a=null;if(t!=null)for(n in t.key!==void 0&&(a=""+t.key),t)lp.call(t,n)&&n!=="key"&&n!=="__self"&&n!=="__source"&&(s[n]=t[n]);var r=arguments.length-2;if(r===1)s.children=e;else if(1<r){for(var o=Array(r),l=0;l<r;l++)o[l]=arguments[l+2];s.children=o}if(i&&i.defaultProps)for(n in r=i.defaultProps,r)s[n]===void 0&&(s[n]=r[n]);return Sc(i,a,s)};F.createRef=function(){return{current:null}};F.forwardRef=function(i){return{$$typeof:rv,render:i}};F.isValidElement=Ec;F.lazy=function(i){return{$$typeof:np,_payload:{_status:-1,_result:i},_init:pv}};F.memo=function(i,t){return{$$typeof:lv,type:i,compare:t===void 0?null:t}};F.startTransition=function(i){var t=dt.T,e={};dt.T=e;try{var n=i(),s=dt.S;s!==null&&s(e,n),typeof n=="object"&&n!==null&&typeof n.then=="function"&&n.then(yc,ip)}catch(a){ip(a)}finally{t!==null&&e.types!==null&&(t.types=e.types),dt.T=t}};F.unstable_useCacheRefresh=function(){return dt.H.useCacheRefresh()};F.use=function(i){return dt.H.use(i)};F.useActionState=function(i,t,e){return dt.H.useActionState(i,t,e)};F.useCallback=function(i,t){return dt.H.useCallback(i,t)};F.useContext=function(i){return dt.H.useContext(i)};F.useDebugValue=function(){};F.useDeferredValue=function(i,t){return dt.H.useDeferredValue(i,t)};F.useEffect=function(i,t){return dt.H.useEffect(i,t)};F.useEffectEvent=function(i){return dt.H.useEffectEvent(i)};F.useId=function(){return dt.H.useId()};F.useImperativeHandle=function(i,t,e){return dt.H.useImperativeHandle(i,t,e)};F.useInsertionEffect=function(i,t){return dt.H.useInsertionEffect(i,t)};F.useLayoutEffect=function(i,t){return dt.H.useLayoutEffect(i,t)};F.useMemo=function(i,t){return dt.H.useMemo(i,t)};F.useOptimistic=function(i,t){return dt.H.useOptimistic(i,t)};F.useReducer=function(i,t,e){return dt.H.useReducer(i,t,e)};F.useRef=function(i){return dt.H.useRef(i)};F.useState=function(i){return dt.H.useState(i)};F.useSyncExternalStore=function(i,t,e){return dt.H.useSyncExternalStore(i,t,e)};F.useTransition=function(){return dt.H.useTransition()};F.version="19.2.3"});var ea=je((qS,up)=>{"use strict";up.exports=cp()});var dp=je($t=>{"use strict";var mv=ea();function hp(i){var t="https://react.dev/errors/"+i;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var e=2;e<arguments.length;e++)t+="&args[]="+encodeURIComponent(arguments[e])}return"Minified React error #"+i+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function Di(){}var Qt={d:{f:Di,r:function(){throw Error(hp(522))},D:Di,C:Di,L:Di,m:Di,X:Di,S:Di,M:Di},p:0,findDOMNode:null},yv=Symbol.for("react.portal");function bv(i,t,e){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:yv,key:n==null?null:""+n,children:i,containerInfo:t,implementation:e}}var ia=mv.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function kr(i,t){if(i==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}$t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Qt;$t.createPortal=function(i,t){var e=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(hp(299));return bv(i,t,null,e)};$t.flushSync=function(i){var t=ia.T,e=Qt.p;try{if(ia.T=null,Qt.p=2,i)return i()}finally{ia.T=t,Qt.p=e,Qt.d.f()}};$t.preconnect=function(i,t){typeof i=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Qt.d.C(i,t))};$t.prefetchDNS=function(i){typeof i=="string"&&Qt.d.D(i)};$t.preinit=function(i,t){if(typeof i=="string"&&t&&typeof t.as=="string"){var e=t.as,n=kr(e,t.crossOrigin),s=typeof t.integrity=="string"?t.integrity:void 0,a=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;e==="style"?Qt.d.S(i,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:n,integrity:s,fetchPriority:a}):e==="script"&&Qt.d.X(i,{crossOrigin:n,integrity:s,fetchPriority:a,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};$t.preinitModule=function(i,t){if(typeof i=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var e=kr(t.as,t.crossOrigin);Qt.d.M(i,{crossOrigin:e,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&Qt.d.M(i)};$t.preload=function(i,t){if(typeof i=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var e=t.as,n=kr(e,t.crossOrigin);Qt.d.L(i,e,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};$t.preloadModule=function(i,t){if(typeof i=="string")if(t){var e=kr(t.as,t.crossOrigin);Qt.d.m(i,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:e,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else Qt.d.m(i)};$t.requestFormReset=function(i){Qt.d.r(i)};$t.unstable_batchedUpdates=function(i,t){return i(t)};$t.useFormState=function(i,t,e){return ia.H.useFormState(i,t,e)};$t.useFormStatus=function(){return ia.H.useHostTransitionStatus()};$t.version="19.2.3"});var Tc=je((WS,pp)=>{"use strict";function fp(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(fp)}catch(i){console.error(i)}}fp(),pp.exports=dp()});var xy=je(rl=>{"use strict";var zt=Zf(),Hg=ea(),vv=Tc();function x(i){var t="https://react.dev/errors/"+i;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var e=2;e<arguments.length;e++)t+="&args[]="+encodeURIComponent(arguments[e])}return"Minified React error #"+i+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function Ug(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function Ga(i){var t=i,e=i;if(i.alternate)for(;t.return;)t=t.return;else{i=t;do t=i,(t.flags&4098)!==0&&(e=t.return),i=t.return;while(i)}return t.tag===3?e:null}function Gg(i){if(i.tag===13){var t=i.memoizedState;if(t===null&&(i=i.alternate,i!==null&&(t=i.memoizedState)),t!==null)return t.dehydrated}return null}function jg(i){if(i.tag===31){var t=i.memoizedState;if(t===null&&(i=i.alternate,i!==null&&(t=i.memoizedState)),t!==null)return t.dehydrated}return null}function gp(i){if(Ga(i)!==i)throw Error(x(188))}function Av(i){var t=i.alternate;if(!t){if(t=Ga(i),t===null)throw Error(x(188));return t!==i?null:i}for(var e=i,n=t;;){var s=e.return;if(s===null)break;var a=s.alternate;if(a===null){if(n=s.return,n!==null){e=n;continue}break}if(s.child===a.child){for(a=s.child;a;){if(a===e)return gp(s),i;if(a===n)return gp(s),t;a=a.sibling}throw Error(x(188))}if(e.return!==n.return)e=s,n=a;else{for(var r=!1,o=s.child;o;){if(o===e){r=!0,e=s,n=a;break}if(o===n){r=!0,n=s,e=a;break}o=o.sibling}if(!r){for(o=a.child;o;){if(o===e){r=!0,e=a,n=s;break}if(o===n){r=!0,n=a,e=s;break}o=o.sibling}if(!r)throw Error(x(189))}}if(e.alternate!==n)throw Error(x(190))}if(e.tag!==3)throw Error(x(188));return e.stateNode.current===e?i:t}function Vg(i){var t=i.tag;if(t===5||t===26||t===27||t===6)return i;for(i=i.child;i!==null;){if(t=Vg(i),t!==null)return t;i=i.sibling}return null}var gt=Object.assign,Sv=Symbol.for("react.element"),Br=Symbol.for("react.transitional.element"),ua=Symbol.for("react.portal"),Kn=Symbol.for("react.fragment"),Xg=Symbol.for("react.strict_mode"),nu=Symbol.for("react.profiler"),Yg=Symbol.for("react.consumer"),li=Symbol.for("react.context"),Zu=Symbol.for("react.forward_ref"),su=Symbol.for("react.suspense"),au=Symbol.for("react.suspense_list"),Ju=Symbol.for("react.memo"),Oi=Symbol.for("react.lazy"),ru=Symbol.for("react.activity"),Ev=Symbol.for("react.memo_cache_sentinel"),mp=Symbol.iterator;function na(i){return i===null||typeof i!="object"?null:(i=mp&&i[mp]||i["@@iterator"],typeof i=="function"?i:null)}var Tv=Symbol.for("react.client.reference");function ou(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===Tv?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case Kn:return"Fragment";case nu:return"Profiler";case Xg:return"StrictMode";case su:return"Suspense";case au:return"SuspenseList";case ru:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case ua:return"Portal";case li:return i.displayName||"Context";case Yg:return(i._context.displayName||"Context")+".Consumer";case Zu:var t=i.render;return i=i.displayName,i||(i=t.displayName||t.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case Ju:return t=i.displayName||null,t!==null?t:ou(i.type)||"Memo";case Oi:t=i._payload,i=i._init;try{return ou(i(t))}catch{}}return null}var ha=Array.isArray,k=Hg.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=vv.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,dn={pending:!1,data:null,method:null,action:null},lu=[],Wn=-1;function We(i){return{current:i}}function Ht(i){0>Wn||(i.current=lu[Wn],lu[Wn]=null,Wn--)}function ct(i,t){Wn++,lu[Wn]=i.current,i.current=t}var Ke=We(null),Ma=We(null),Ui=We(null),go=We(null);function mo(i,t){switch(ct(Ui,t),ct(Ma,i),ct(Ke,null),t.nodeType){case 9:case 11:i=(i=t.documentElement)&&(i=i.namespaceURI)?Tg(i):0;break;default:if(i=t.tagName,t=t.namespaceURI)t=Tg(t),i=dy(t,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}Ht(Ke),ct(Ke,i)}function fs(){Ht(Ke),Ht(Ma),Ht(Ui)}function cu(i){i.memoizedState!==null&&ct(go,i);var t=Ke.current,e=dy(t,i.type);t!==e&&(ct(Ma,i),ct(Ke,e))}function yo(i){Ma.current===i&&(Ht(Ke),Ht(Ma)),go.current===i&&(Ht(go),Fa._currentValue=dn)}var wc,yp;function ln(i){if(wc===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);wc=t&&t[1]||"",yp=-1<e.stack.indexOf(`
1
+ "use strict";(()=>{var Xb=Object.create;var rc=Object.defineProperty;var Yb=Object.getOwnPropertyDescriptor;var qb=Object.getOwnPropertyNames;var Kb=Object.getPrototypeOf,Wb=Object.prototype.hasOwnProperty;var Qb=(i,t,e)=>()=>{if(e)throw e[0];try{return i&&(t=i(i=0)),t}catch(n){throw e=[n],n}};var je=(i,t)=>()=>{try{return t||i((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}},$b=(i,t)=>{for(var e in t)rc(i,e,{get:t[e],enumerable:!0})},Zb=(i,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of qb(t))!Wb.call(i,s)&&s!==e&&rc(i,s,{get:()=>t[s],enumerable:!(n=Yb(t,s))||n.enumerable});return i};var Ci=(i,t,e)=>(e=i!=null?Xb(Kb(i)):{},Zb(t||!i||!i.__esModule?rc(e,"default",{value:i,enumerable:!0}):e,i));var Wf=je(mt=>{"use strict";function uc(i,t){var e=i.length;i.push(t);t:for(;0<e;){var n=e-1>>>1,s=i[n];if(0<Or(s,t))i[n]=t,i[e]=s,e=n;else break t}}function Ve(i){return i.length===0?null:i[0]}function Nr(i){if(i.length===0)return null;var t=i[0],e=i.pop();if(e!==t){i[0]=e;t:for(var n=0,s=i.length,a=s>>>1;n<a;){var r=2*(n+1)-1,o=i[r],l=r+1,c=i[l];if(0>Or(o,e))l<s&&0>Or(c,o)?(i[n]=c,i[l]=e,n=l):(i[n]=o,i[r]=e,n=r);else if(l<s&&0>Or(c,e))i[n]=c,i[l]=e,n=l;else break t}}return t}function Or(i,t){var e=i.sortIndex-t.sortIndex;return e!==0?e:i.id-t.id}mt.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(Hf=performance,mt.unstable_now=function(){return Hf.now()}):(oc=Date,Uf=oc.now(),mt.unstable_now=function(){return oc.now()-Uf});var Hf,oc,Uf,ti=[],Mi=[],Jb=1,we=null,qt=3,hc=!1,Zs=!1,Js=!1,dc=!1,Vf=typeof setTimeout=="function"?setTimeout:null,Xf=typeof clearTimeout=="function"?clearTimeout:null,Gf=typeof setImmediate<"u"?setImmediate:null;function Rr(i){for(var t=Ve(Mi);t!==null;){if(t.callback===null)Nr(Mi);else if(t.startTime<=i)Nr(Mi),t.sortIndex=t.expirationTime,uc(ti,t);else break;t=Ve(Mi)}}function fc(i){if(Js=!1,Rr(i),!Zs)if(Ve(ti)!==null)Zs=!0,Hn||(Hn=!0,Fn());else{var t=Ve(Mi);t!==null&&pc(fc,t.startTime-i)}}var Hn=!1,ta=-1,Yf=5,qf=-1;function Kf(){return dc?!0:!(mt.unstable_now()-qf<Yf)}function lc(){if(dc=!1,Hn){var i=mt.unstable_now();qf=i;var t=!0;try{t:{Zs=!1,Js&&(Js=!1,Xf(ta),ta=-1),hc=!0;var e=qt;try{e:{for(Rr(i),we=Ve(ti);we!==null&&!(we.expirationTime>i&&Kf());){var n=we.callback;if(typeof n=="function"){we.callback=null,qt=we.priorityLevel;var s=n(we.expirationTime<=i);if(i=mt.unstable_now(),typeof s=="function"){we.callback=s,Rr(i),t=!0;break e}we===Ve(ti)&&Nr(ti),Rr(i)}else Nr(ti);we=Ve(ti)}if(we!==null)t=!0;else{var a=Ve(Mi);a!==null&&pc(fc,a.startTime-i),t=!1}}break t}finally{we=null,qt=e,hc=!1}t=void 0}}finally{t?Fn():Hn=!1}}}var Fn;typeof Gf=="function"?Fn=function(){Gf(lc)}:typeof MessageChannel<"u"?(cc=new MessageChannel,jf=cc.port2,cc.port1.onmessage=lc,Fn=function(){jf.postMessage(null)}):Fn=function(){Vf(lc,0)};var cc,jf;function pc(i,t){ta=Vf(function(){i(mt.unstable_now())},t)}mt.unstable_IdlePriority=5;mt.unstable_ImmediatePriority=1;mt.unstable_LowPriority=4;mt.unstable_NormalPriority=3;mt.unstable_Profiling=null;mt.unstable_UserBlockingPriority=2;mt.unstable_cancelCallback=function(i){i.callback=null};mt.unstable_forceFrameRate=function(i){0>i||125<i?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Yf=0<i?Math.floor(1e3/i):5};mt.unstable_getCurrentPriorityLevel=function(){return qt};mt.unstable_next=function(i){switch(qt){case 1:case 2:case 3:var t=3;break;default:t=qt}var e=qt;qt=t;try{return i()}finally{qt=e}};mt.unstable_requestPaint=function(){dc=!0};mt.unstable_runWithPriority=function(i,t){switch(i){case 1:case 2:case 3:case 4:case 5:break;default:i=3}var e=qt;qt=i;try{return t()}finally{qt=e}};mt.unstable_scheduleCallback=function(i,t,e){var n=mt.unstable_now();switch(typeof e=="object"&&e!==null?(e=e.delay,e=typeof e=="number"&&0<e?n+e:n):e=n,i){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=e+s,i={id:Jb++,callback:t,priorityLevel:i,startTime:e,expirationTime:s,sortIndex:-1},e>n?(i.sortIndex=e,uc(Mi,i),Ve(ti)===null&&i===Ve(Mi)&&(Js?(Xf(ta),ta=-1):Js=!0,pc(fc,e-n))):(i.sortIndex=s,uc(ti,i),Zs||hc||(Zs=!0,Hn||(Hn=!0,Fn()))),i};mt.unstable_shouldYield=Kf;mt.unstable_wrapCallback=function(i){var t=qt;return function(){var e=qt;qt=t;try{return i.apply(this,arguments)}finally{qt=e}}}});var $f=je((YS,Qf)=>{"use strict";Qf.exports=Wf()});var lp=je(F=>{"use strict";var yc=Symbol.for("react.transitional.element"),tv=Symbol.for("react.portal"),ev=Symbol.for("react.fragment"),iv=Symbol.for("react.strict_mode"),nv=Symbol.for("react.profiler"),sv=Symbol.for("react.consumer"),av=Symbol.for("react.context"),rv=Symbol.for("react.forward_ref"),ov=Symbol.for("react.suspense"),lv=Symbol.for("react.memo"),ip=Symbol.for("react.lazy"),cv=Symbol.for("react.activity"),Zf=Symbol.iterator;function uv(i){return i===null||typeof i!="object"?null:(i=Zf&&i[Zf]||i["@@iterator"],typeof i=="function"?i:null)}var np={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},sp=Object.assign,ap={};function Gn(i,t,e){this.props=i,this.context=t,this.refs=ap,this.updater=e||np}Gn.prototype.isReactComponent={};Gn.prototype.setState=function(i,t){if(typeof i!="object"&&typeof i!="function"&&i!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,i,t,"setState")};Gn.prototype.forceUpdate=function(i){this.updater.enqueueForceUpdate(this,i,"forceUpdate")};function rp(){}rp.prototype=Gn.prototype;function bc(i,t,e){this.props=i,this.context=t,this.refs=ap,this.updater=e||np}var vc=bc.prototype=new rp;vc.constructor=bc;sp(vc,Gn.prototype);vc.isPureReactComponent=!0;var Jf=Array.isArray;function mc(){}var dt={H:null,A:null,T:null,S:null},op=Object.prototype.hasOwnProperty;function Ac(i,t,e){var n=e.ref;return{$$typeof:yc,type:i,key:t,ref:n!==void 0?n:null,props:e}}function hv(i,t){return Ac(i.type,t,i.props)}function Sc(i){return typeof i=="object"&&i!==null&&i.$$typeof===yc}function dv(i){var t={"=":"=0",":":"=2"};return"$"+i.replace(/[=:]/g,function(e){return t[e]})}var tp=/\/+/g;function gc(i,t){return typeof i=="object"&&i!==null&&i.key!=null?dv(""+i.key):t.toString(36)}function fv(i){switch(i.status){case"fulfilled":return i.value;case"rejected":throw i.reason;default:switch(typeof i.status=="string"?i.then(mc,mc):(i.status="pending",i.then(function(t){i.status==="pending"&&(i.status="fulfilled",i.value=t)},function(t){i.status==="pending"&&(i.status="rejected",i.reason=t)})),i.status){case"fulfilled":return i.value;case"rejected":throw i.reason}}throw i}function Un(i,t,e,n,s){var a=typeof i;(a==="undefined"||a==="boolean")&&(i=null);var r=!1;if(i===null)r=!0;else switch(a){case"bigint":case"string":case"number":r=!0;break;case"object":switch(i.$$typeof){case yc:case tv:r=!0;break;case ip:return r=i._init,Un(r(i._payload),t,e,n,s)}}if(r)return s=s(i),r=n===""?"."+gc(i,0):n,Jf(s)?(e="",r!=null&&(e=r.replace(tp,"$&/")+"/"),Un(s,t,e,"",function(c){return c})):s!=null&&(Sc(s)&&(s=hv(s,e+(s.key==null||i&&i.key===s.key?"":(""+s.key).replace(tp,"$&/")+"/")+r)),t.push(s)),1;r=0;var o=n===""?".":n+":";if(Jf(i))for(var l=0;l<i.length;l++)n=i[l],a=o+gc(n,l),r+=Un(n,t,e,a,s);else if(l=uv(i),typeof l=="function")for(i=l.call(i),l=0;!(n=i.next()).done;)n=n.value,a=o+gc(n,l++),r+=Un(n,t,e,a,s);else if(a==="object"){if(typeof i.then=="function")return Un(fv(i),t,e,n,s);throw t=String(i),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return r}function kr(i,t,e){if(i==null)return i;var n=[],s=0;return Un(i,n,"","",function(a){return t.call(e,a,s++)}),n}function pv(i){if(i._status===-1){var t=i._result;t=t(),t.then(function(e){(i._status===0||i._status===-1)&&(i._status=1,i._result=e)},function(e){(i._status===0||i._status===-1)&&(i._status=2,i._result=e)}),i._status===-1&&(i._status=0,i._result=t)}if(i._status===1)return i._result.default;throw i._result}var ep=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},gv={map:kr,forEach:function(i,t,e){kr(i,function(){t.apply(this,arguments)},e)},count:function(i){var t=0;return kr(i,function(){t++}),t},toArray:function(i){return kr(i,function(t){return t})||[]},only:function(i){if(!Sc(i))throw Error("React.Children.only expected to receive a single React element child.");return i}};F.Activity=cv;F.Children=gv;F.Component=Gn;F.Fragment=ev;F.Profiler=nv;F.PureComponent=bc;F.StrictMode=iv;F.Suspense=ov;F.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=dt;F.__COMPILER_RUNTIME={__proto__:null,c:function(i){return dt.H.useMemoCache(i)}};F.cache=function(i){return function(){return i.apply(null,arguments)}};F.cacheSignal=function(){return null};F.cloneElement=function(i,t,e){if(i==null)throw Error("The argument must be a React element, but you passed "+i+".");var n=sp({},i.props),s=i.key;if(t!=null)for(a in t.key!==void 0&&(s=""+t.key),t)!op.call(t,a)||a==="key"||a==="__self"||a==="__source"||a==="ref"&&t.ref===void 0||(n[a]=t[a]);var a=arguments.length-2;if(a===1)n.children=e;else if(1<a){for(var r=Array(a),o=0;o<a;o++)r[o]=arguments[o+2];n.children=r}return Ac(i.type,s,n)};F.createContext=function(i){return i={$$typeof:av,_currentValue:i,_currentValue2:i,_threadCount:0,Provider:null,Consumer:null},i.Provider=i,i.Consumer={$$typeof:sv,_context:i},i};F.createElement=function(i,t,e){var n,s={},a=null;if(t!=null)for(n in t.key!==void 0&&(a=""+t.key),t)op.call(t,n)&&n!=="key"&&n!=="__self"&&n!=="__source"&&(s[n]=t[n]);var r=arguments.length-2;if(r===1)s.children=e;else if(1<r){for(var o=Array(r),l=0;l<r;l++)o[l]=arguments[l+2];s.children=o}if(i&&i.defaultProps)for(n in r=i.defaultProps,r)s[n]===void 0&&(s[n]=r[n]);return Ac(i,a,s)};F.createRef=function(){return{current:null}};F.forwardRef=function(i){return{$$typeof:rv,render:i}};F.isValidElement=Sc;F.lazy=function(i){return{$$typeof:ip,_payload:{_status:-1,_result:i},_init:pv}};F.memo=function(i,t){return{$$typeof:lv,type:i,compare:t===void 0?null:t}};F.startTransition=function(i){var t=dt.T,e={};dt.T=e;try{var n=i(),s=dt.S;s!==null&&s(e,n),typeof n=="object"&&n!==null&&typeof n.then=="function"&&n.then(mc,ep)}catch(a){ep(a)}finally{t!==null&&e.types!==null&&(t.types=e.types),dt.T=t}};F.unstable_useCacheRefresh=function(){return dt.H.useCacheRefresh()};F.use=function(i){return dt.H.use(i)};F.useActionState=function(i,t,e){return dt.H.useActionState(i,t,e)};F.useCallback=function(i,t){return dt.H.useCallback(i,t)};F.useContext=function(i){return dt.H.useContext(i)};F.useDebugValue=function(){};F.useDeferredValue=function(i,t){return dt.H.useDeferredValue(i,t)};F.useEffect=function(i,t){return dt.H.useEffect(i,t)};F.useEffectEvent=function(i){return dt.H.useEffectEvent(i)};F.useId=function(){return dt.H.useId()};F.useImperativeHandle=function(i,t,e){return dt.H.useImperativeHandle(i,t,e)};F.useInsertionEffect=function(i,t){return dt.H.useInsertionEffect(i,t)};F.useLayoutEffect=function(i,t){return dt.H.useLayoutEffect(i,t)};F.useMemo=function(i,t){return dt.H.useMemo(i,t)};F.useOptimistic=function(i,t){return dt.H.useOptimistic(i,t)};F.useReducer=function(i,t,e){return dt.H.useReducer(i,t,e)};F.useRef=function(i){return dt.H.useRef(i)};F.useState=function(i){return dt.H.useState(i)};F.useSyncExternalStore=function(i,t,e){return dt.H.useSyncExternalStore(i,t,e)};F.useTransition=function(){return dt.H.useTransition()};F.version="19.2.3"});var ea=je((KS,cp)=>{"use strict";cp.exports=lp()});var hp=je($t=>{"use strict";var mv=ea();function up(i){var t="https://react.dev/errors/"+i;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var e=2;e<arguments.length;e++)t+="&args[]="+encodeURIComponent(arguments[e])}return"Minified React error #"+i+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function Di(){}var Qt={d:{f:Di,r:function(){throw Error(up(522))},D:Di,C:Di,L:Di,m:Di,X:Di,S:Di,M:Di},p:0,findDOMNode:null},yv=Symbol.for("react.portal");function bv(i,t,e){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:yv,key:n==null?null:""+n,children:i,containerInfo:t,implementation:e}}var ia=mv.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Lr(i,t){if(i==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}$t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Qt;$t.createPortal=function(i,t){var e=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(up(299));return bv(i,t,null,e)};$t.flushSync=function(i){var t=ia.T,e=Qt.p;try{if(ia.T=null,Qt.p=2,i)return i()}finally{ia.T=t,Qt.p=e,Qt.d.f()}};$t.preconnect=function(i,t){typeof i=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Qt.d.C(i,t))};$t.prefetchDNS=function(i){typeof i=="string"&&Qt.d.D(i)};$t.preinit=function(i,t){if(typeof i=="string"&&t&&typeof t.as=="string"){var e=t.as,n=Lr(e,t.crossOrigin),s=typeof t.integrity=="string"?t.integrity:void 0,a=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;e==="style"?Qt.d.S(i,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:n,integrity:s,fetchPriority:a}):e==="script"&&Qt.d.X(i,{crossOrigin:n,integrity:s,fetchPriority:a,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};$t.preinitModule=function(i,t){if(typeof i=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var e=Lr(t.as,t.crossOrigin);Qt.d.M(i,{crossOrigin:e,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&Qt.d.M(i)};$t.preload=function(i,t){if(typeof i=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var e=t.as,n=Lr(e,t.crossOrigin);Qt.d.L(i,e,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};$t.preloadModule=function(i,t){if(typeof i=="string")if(t){var e=Lr(t.as,t.crossOrigin);Qt.d.m(i,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:e,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else Qt.d.m(i)};$t.requestFormReset=function(i){Qt.d.r(i)};$t.unstable_batchedUpdates=function(i,t){return i(t)};$t.useFormState=function(i,t,e){return ia.H.useFormState(i,t,e)};$t.useFormStatus=function(){return ia.H.useHostTransitionStatus()};$t.version="19.2.3"});var Ec=je((QS,fp)=>{"use strict";function dp(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(dp)}catch(i){console.error(i)}}dp(),fp.exports=hp()});var _y=je(rl=>{"use strict";var zt=$f(),Fg=ea(),vv=Ec();function x(i){var t="https://react.dev/errors/"+i;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var e=2;e<arguments.length;e++)t+="&args[]="+encodeURIComponent(arguments[e])}return"Minified React error #"+i+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function Hg(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function Ga(i){var t=i,e=i;if(i.alternate)for(;t.return;)t=t.return;else{i=t;do t=i,(t.flags&4098)!==0&&(e=t.return),i=t.return;while(i)}return t.tag===3?e:null}function Ug(i){if(i.tag===13){var t=i.memoizedState;if(t===null&&(i=i.alternate,i!==null&&(t=i.memoizedState)),t!==null)return t.dehydrated}return null}function Gg(i){if(i.tag===31){var t=i.memoizedState;if(t===null&&(i=i.alternate,i!==null&&(t=i.memoizedState)),t!==null)return t.dehydrated}return null}function pp(i){if(Ga(i)!==i)throw Error(x(188))}function Av(i){var t=i.alternate;if(!t){if(t=Ga(i),t===null)throw Error(x(188));return t!==i?null:i}for(var e=i,n=t;;){var s=e.return;if(s===null)break;var a=s.alternate;if(a===null){if(n=s.return,n!==null){e=n;continue}break}if(s.child===a.child){for(a=s.child;a;){if(a===e)return pp(s),i;if(a===n)return pp(s),t;a=a.sibling}throw Error(x(188))}if(e.return!==n.return)e=s,n=a;else{for(var r=!1,o=s.child;o;){if(o===e){r=!0,e=s,n=a;break}if(o===n){r=!0,n=s,e=a;break}o=o.sibling}if(!r){for(o=a.child;o;){if(o===e){r=!0,e=a,n=s;break}if(o===n){r=!0,n=a,e=s;break}o=o.sibling}if(!r)throw Error(x(189))}}if(e.alternate!==n)throw Error(x(190))}if(e.tag!==3)throw Error(x(188));return e.stateNode.current===e?i:t}function jg(i){var t=i.tag;if(t===5||t===26||t===27||t===6)return i;for(i=i.child;i!==null;){if(t=jg(i),t!==null)return t;i=i.sibling}return null}var gt=Object.assign,Sv=Symbol.for("react.element"),Br=Symbol.for("react.transitional.element"),ua=Symbol.for("react.portal"),Kn=Symbol.for("react.fragment"),Vg=Symbol.for("react.strict_mode"),iu=Symbol.for("react.profiler"),Xg=Symbol.for("react.consumer"),li=Symbol.for("react.context"),$u=Symbol.for("react.forward_ref"),nu=Symbol.for("react.suspense"),su=Symbol.for("react.suspense_list"),Zu=Symbol.for("react.memo"),Oi=Symbol.for("react.lazy"),au=Symbol.for("react.activity"),Ev=Symbol.for("react.memo_cache_sentinel"),gp=Symbol.iterator;function na(i){return i===null||typeof i!="object"?null:(i=gp&&i[gp]||i["@@iterator"],typeof i=="function"?i:null)}var Tv=Symbol.for("react.client.reference");function ru(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===Tv?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case Kn:return"Fragment";case iu:return"Profiler";case Vg:return"StrictMode";case nu:return"Suspense";case su:return"SuspenseList";case au:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case ua:return"Portal";case li:return i.displayName||"Context";case Xg:return(i._context.displayName||"Context")+".Consumer";case $u:var t=i.render;return i=i.displayName,i||(i=t.displayName||t.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case Zu:return t=i.displayName||null,t!==null?t:ru(i.type)||"Memo";case Oi:t=i._payload,i=i._init;try{return ru(i(t))}catch{}}return null}var ha=Array.isArray,B=Fg.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=vv.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,dn={pending:!1,data:null,method:null,action:null},ou=[],Wn=-1;function We(i){return{current:i}}function Ht(i){0>Wn||(i.current=ou[Wn],ou[Wn]=null,Wn--)}function ct(i,t){Wn++,ou[Wn]=i.current,i.current=t}var Ke=We(null),Ma=We(null),Ui=We(null),go=We(null);function mo(i,t){switch(ct(Ui,t),ct(Ma,i),ct(Ke,null),t.nodeType){case 9:case 11:i=(i=t.documentElement)&&(i=i.namespaceURI)?Eg(i):0;break;default:if(i=t.tagName,t=t.namespaceURI)t=Eg(t),i=hy(t,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}Ht(Ke),ct(Ke,i)}function fs(){Ht(Ke),Ht(Ma),Ht(Ui)}function lu(i){i.memoizedState!==null&&ct(go,i);var t=Ke.current,e=hy(t,i.type);t!==e&&(ct(Ma,i),ct(Ke,e))}function yo(i){Ma.current===i&&(Ht(Ke),Ht(Ma)),go.current===i&&(Ht(go),Fa._currentValue=dn)}var Tc,mp;function ln(i){if(Tc===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Tc=t&&t[1]||"",mp=-1<e.stack.indexOf(`
2
2
  at`)?" (<anonymous>)":-1<e.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+wc+i+yp}var _c=!1;function xc(i,t){if(!i||_c)return"";_c=!0;var e=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var n={DetermineComponentFrameRoot:function(){try{if(t){var h=function(){throw Error()};if(Object.defineProperty(h.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(h,[])}catch(f){var d=f}Reflect.construct(i,[],h)}else{try{h.call()}catch(f){d=f}i.call(h.prototype)}}else{try{throw Error()}catch(f){d=f}(h=i())&&typeof h.catch=="function"&&h.catch(function(){})}}catch(f){if(f&&d&&typeof f.stack=="string")return[f.stack,d.stack]}return[null,null]}};n.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var a=n.DetermineComponentFrameRoot(),r=a[0],o=a[1];if(r&&o){var l=r.split(`
3
+ `+Tc+i+mp}var wc=!1;function _c(i,t){if(!i||wc)return"";wc=!0;var e=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var n={DetermineComponentFrameRoot:function(){try{if(t){var h=function(){throw Error()};if(Object.defineProperty(h.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(h,[])}catch(f){var d=f}Reflect.construct(i,[],h)}else{try{h.call()}catch(f){d=f}i.call(h.prototype)}}else{try{throw Error()}catch(f){d=f}(h=i())&&typeof h.catch=="function"&&h.catch(function(){})}}catch(f){if(f&&d&&typeof f.stack=="string")return[f.stack,d.stack]}return[null,null]}};n.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var a=n.DetermineComponentFrameRoot(),r=a[0],o=a[1];if(r&&o){var l=r.split(`
4
4
  `),c=o.split(`
5
5
  `);for(s=n=0;n<l.length&&!l[n].includes("DetermineComponentFrameRoot");)n++;for(;s<c.length&&!c[s].includes("DetermineComponentFrameRoot");)s++;if(n===l.length||s===c.length)for(n=l.length-1,s=c.length-1;1<=n&&0<=s&&l[n]!==c[s];)s--;for(;1<=n&&0<=s;n--,s--)if(l[n]!==c[s]){if(n!==1||s!==1)do if(n--,s--,0>s||l[n]!==c[s]){var u=`
6
- `+l[n].replace(" at new "," at ");return i.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",i.displayName)),u}while(1<=n&&0<=s);break}}}finally{_c=!1,Error.prepareStackTrace=e}return(e=i?i.displayName||i.name:"")?ln(e):""}function wv(i,t){switch(i.tag){case 26:case 27:case 5:return ln(i.type);case 16:return ln("Lazy");case 13:return i.child!==t&&t!==null?ln("Suspense Fallback"):ln("Suspense");case 19:return ln("SuspenseList");case 0:case 15:return xc(i.type,!1);case 11:return xc(i.type.render,!1);case 1:return xc(i.type,!0);case 31:return ln("Activity");default:return""}}function bp(i){try{var t="",e=null;do t+=wv(i,e),e=i,i=i.return;while(i);return t}catch(n){return`
6
+ `+l[n].replace(" at new "," at ");return i.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",i.displayName)),u}while(1<=n&&0<=s);break}}}finally{wc=!1,Error.prepareStackTrace=e}return(e=i?i.displayName||i.name:"")?ln(e):""}function wv(i,t){switch(i.tag){case 26:case 27:case 5:return ln(i.type);case 16:return ln("Lazy");case 13:return i.child!==t&&t!==null?ln("Suspense Fallback"):ln("Suspense");case 19:return ln("SuspenseList");case 0:case 15:return _c(i.type,!1);case 11:return _c(i.type.render,!1);case 1:return _c(i.type,!0);case 31:return ln("Activity");default:return""}}function yp(i){try{var t="",e=null;do t+=wv(i,e),e=i,i=i.return;while(i);return t}catch(n){return`
7
7
  Error generating stack: `+n.message+`
8
- `+n.stack}}var uu=Object.prototype.hasOwnProperty,th=zt.unstable_scheduleCallback,Cc=zt.unstable_cancelCallback,_v=zt.unstable_shouldYield,xv=zt.unstable_requestPaint,de=zt.unstable_now,Cv=zt.unstable_getCurrentPriorityLevel,qg=zt.unstable_ImmediatePriority,Kg=zt.unstable_UserBlockingPriority,bo=zt.unstable_NormalPriority,Mv=zt.unstable_LowPriority,Wg=zt.unstable_IdlePriority,Dv=zt.log,Ov=zt.unstable_setDisableYieldValue,ja=null,fe=null;function zi(i){if(typeof Dv=="function"&&Ov(i),fe&&typeof fe.setStrictMode=="function")try{fe.setStrictMode(ja,i)}catch{}}var pe=Math.clz32?Math.clz32:Lv,Rv=Math.log,Nv=Math.LN2;function Lv(i){return i>>>=0,i===0?32:31-(Rv(i)/Nv|0)|0}var zr=256,Pr=262144,Ir=4194304;function cn(i){var t=i&42;if(t!==0)return t;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Vo(i,t,e){var n=i.pendingLanes;if(n===0)return 0;var s=0,a=i.suspendedLanes,r=i.pingedLanes;i=i.warmLanes;var o=n&134217727;return o!==0?(n=o&~a,n!==0?s=cn(n):(r&=o,r!==0?s=cn(r):e||(e=o&~i,e!==0&&(s=cn(e))))):(o=n&~a,o!==0?s=cn(o):r!==0?s=cn(r):e||(e=n&~i,e!==0&&(s=cn(e)))),s===0?0:t!==0&&t!==s&&(t&a)===0&&(a=s&-s,e=t&-t,a>=e||a===32&&(e&4194048)!==0)?t:s}function Va(i,t){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&t)===0}function kv(i,t){switch(i){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Qg(){var i=Ir;return Ir<<=1,(Ir&62914560)===0&&(Ir=4194304),i}function Mc(i){for(var t=[],e=0;31>e;e++)t.push(i);return t}function Xa(i,t){i.pendingLanes|=t,t!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Bv(i,t,e,n,s,a){var r=i.pendingLanes;i.pendingLanes=e,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=e,i.entangledLanes&=e,i.errorRecoveryDisabledLanes&=e,i.shellSuspendCounter=0;var o=i.entanglements,l=i.expirationTimes,c=i.hiddenUpdates;for(e=r&~e;0<e;){var u=31-pe(e),h=1<<u;o[u]=0,l[u]=-1;var d=c[u];if(d!==null)for(c[u]=null,u=0;u<d.length;u++){var f=d[u];f!==null&&(f.lane&=-536870913)}e&=~h}n!==0&&$g(i,n,0),a!==0&&s===0&&i.tag!==0&&(i.suspendedLanes|=a&~(r&~t))}function $g(i,t,e){i.pendingLanes|=t,i.suspendedLanes&=~t;var n=31-pe(t);i.entangledLanes|=t,i.entanglements[n]=i.entanglements[n]|1073741824|e&261930}function Zg(i,t){var e=i.entangledLanes|=t;for(i=i.entanglements;e;){var n=31-pe(e),s=1<<n;s&t|i[n]&t&&(i[n]|=t),e&=~s}}function Jg(i,t){var e=t&-t;return e=(e&42)!==0?1:eh(e),(e&(i.suspendedLanes|t))!==0?0:e}function eh(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function ih(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function tm(){var i=Z.p;return i!==0?i:(i=window.event,i===void 0?32:Ty(i.type))}function vp(i,t){var e=Z.p;try{return Z.p=i,t()}finally{Z.p=e}}var tn=Math.random().toString(36).slice(2),Gt="__reactFiber$"+tn,se="__reactProps$"+tn,ws="__reactContainer$"+tn,hu="__reactEvents$"+tn,zv="__reactListeners$"+tn,Pv="__reactHandles$"+tn,Ap="__reactResources$"+tn,Ya="__reactMarker$"+tn;function nh(i){delete i[Gt],delete i[se],delete i[hu],delete i[zv],delete i[Pv]}function Qn(i){var t=i[Gt];if(t)return t;for(var e=i.parentNode;e;){if(t=e[ws]||e[Gt]){if(e=t.alternate,t.child!==null||e!==null&&e.child!==null)for(i=Mg(i);i!==null;){if(e=i[Gt])return e;i=Mg(i)}return t}i=e,e=i.parentNode}return null}function _s(i){if(i=i[Gt]||i[ws]){var t=i.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return i}return null}function da(i){var t=i.tag;if(t===5||t===26||t===27||t===6)return i.stateNode;throw Error(x(33))}function rs(i){var t=i[Ap];return t||(t=i[Ap]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ft(i){i[Ya]=!0}var em=new Set,im={};function En(i,t){ps(i,t),ps(i+"Capture",t)}function ps(i,t){for(im[i]=t,i=0;i<t.length;i++)em.add(t[i])}var Iv=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Sp={},Ep={};function Fv(i){return uu.call(Ep,i)?!0:uu.call(Sp,i)?!1:Iv.test(i)?Ep[i]=!0:(Sp[i]=!0,!1)}function Jr(i,t,e){if(Fv(t))if(e===null)i.removeAttribute(t);else{switch(typeof e){case"undefined":case"function":case"symbol":i.removeAttribute(t);return;case"boolean":var n=t.toLowerCase().slice(0,5);if(n!=="data-"&&n!=="aria-"){i.removeAttribute(t);return}}i.setAttribute(t,""+e)}}function Fr(i,t,e){if(e===null)i.removeAttribute(t);else{switch(typeof e){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(t);return}i.setAttribute(t,""+e)}}function ei(i,t,e,n){if(n===null)i.removeAttribute(e);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(e);return}i.setAttributeNS(t,e,""+n)}}function xe(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function nm(i){var t=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Hv(i,t,e){var n=Object.getOwnPropertyDescriptor(i.constructor.prototype,t);if(!i.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,a=n.set;return Object.defineProperty(i,t,{configurable:!0,get:function(){return s.call(this)},set:function(r){e=""+r,a.call(this,r)}}),Object.defineProperty(i,t,{enumerable:n.enumerable}),{getValue:function(){return e},setValue:function(r){e=""+r},stopTracking:function(){i._valueTracker=null,delete i[t]}}}}function du(i){if(!i._valueTracker){var t=nm(i)?"checked":"value";i._valueTracker=Hv(i,t,""+i[t])}}function sm(i){if(!i)return!1;var t=i._valueTracker;if(!t)return!0;var e=t.getValue(),n="";return i&&(n=nm(i)?i.checked?"true":"false":i.value),i=n,i!==e?(t.setValue(i),!0):!1}function vo(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var Uv=/[\n"\\]/g;function De(i){return i.replace(Uv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function fu(i,t,e,n,s,a,r,o){i.name="",r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"?i.type=r:i.removeAttribute("type"),t!=null?r==="number"?(t===0&&i.value===""||i.value!=t)&&(i.value=""+xe(t)):i.value!==""+xe(t)&&(i.value=""+xe(t)):r!=="submit"&&r!=="reset"||i.removeAttribute("value"),t!=null?pu(i,r,xe(t)):e!=null?pu(i,r,xe(e)):n!=null&&i.removeAttribute("value"),s==null&&a!=null&&(i.defaultChecked=!!a),s!=null&&(i.checked=s&&typeof s!="function"&&typeof s!="symbol"),o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?i.name=""+xe(o):i.removeAttribute("name")}function am(i,t,e,n,s,a,r,o){if(a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"&&(i.type=a),t!=null||e!=null){if(!(a!=="submit"&&a!=="reset"||t!=null)){du(i);return}e=e!=null?""+xe(e):"",t=t!=null?""+xe(t):e,o||t===i.value||(i.value=t),i.defaultValue=t}n=n??s,n=typeof n!="function"&&typeof n!="symbol"&&!!n,i.checked=o?i.checked:!!n,i.defaultChecked=!!n,r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(i.name=r),du(i)}function pu(i,t,e){t==="number"&&vo(i.ownerDocument)===i||i.defaultValue===""+e||(i.defaultValue=""+e)}function os(i,t,e,n){if(i=i.options,t){t={};for(var s=0;s<e.length;s++)t["$"+e[s]]=!0;for(e=0;e<i.length;e++)s=t.hasOwnProperty("$"+i[e].value),i[e].selected!==s&&(i[e].selected=s),s&&n&&(i[e].defaultSelected=!0)}else{for(e=""+xe(e),t=null,s=0;s<i.length;s++){if(i[s].value===e){i[s].selected=!0,n&&(i[s].defaultSelected=!0);return}t!==null||i[s].disabled||(t=i[s])}t!==null&&(t.selected=!0)}}function rm(i,t,e){if(t!=null&&(t=""+xe(t),t!==i.value&&(i.value=t),e==null)){i.defaultValue!==t&&(i.defaultValue=t);return}i.defaultValue=e!=null?""+xe(e):""}function om(i,t,e,n){if(t==null){if(n!=null){if(e!=null)throw Error(x(92));if(ha(n)){if(1<n.length)throw Error(x(93));n=n[0]}e=n}e==null&&(e=""),t=e}e=xe(t),i.defaultValue=e,n=i.textContent,n===e&&n!==""&&n!==null&&(i.value=n),du(i)}function gs(i,t){if(t){var e=i.firstChild;if(e&&e===i.lastChild&&e.nodeType===3){e.nodeValue=t;return}}i.textContent=t}var Gv=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Tp(i,t,e){var n=t.indexOf("--")===0;e==null||typeof e=="boolean"||e===""?n?i.setProperty(t,""):t==="float"?i.cssFloat="":i[t]="":n?i.setProperty(t,e):typeof e!="number"||e===0||Gv.has(t)?t==="float"?i.cssFloat=e:i[t]=(""+e).trim():i[t]=e+"px"}function lm(i,t,e){if(t!=null&&typeof t!="object")throw Error(x(62));if(i=i.style,e!=null){for(var n in e)!e.hasOwnProperty(n)||t!=null&&t.hasOwnProperty(n)||(n.indexOf("--")===0?i.setProperty(n,""):n==="float"?i.cssFloat="":i[n]="");for(var s in t)n=t[s],t.hasOwnProperty(s)&&e[s]!==n&&Tp(i,s,n)}else for(var a in t)t.hasOwnProperty(a)&&Tp(i,a,t[a])}function sh(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var jv=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Vv=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function to(i){return Vv.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function ci(){}var gu=null;function ah(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var $n=null,ls=null;function wp(i){var t=_s(i);if(t&&(i=t.stateNode)){var e=i[se]||null;t:switch(i=t.stateNode,t.type){case"input":if(fu(i,e.value,e.defaultValue,e.defaultValue,e.checked,e.defaultChecked,e.type,e.name),t=e.name,e.type==="radio"&&t!=null){for(e=i;e.parentNode;)e=e.parentNode;for(e=e.querySelectorAll('input[name="'+De(""+t)+'"][type="radio"]'),t=0;t<e.length;t++){var n=e[t];if(n!==i&&n.form===i.form){var s=n[se]||null;if(!s)throw Error(x(90));fu(n,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name)}}for(t=0;t<e.length;t++)n=e[t],n.form===i.form&&sm(n)}break t;case"textarea":rm(i,e.value,e.defaultValue);break t;case"select":t=e.value,t!=null&&os(i,!!e.multiple,t,!1)}}}var Dc=!1;function cm(i,t,e){if(Dc)return i(t,e);Dc=!0;try{var n=i(t);return n}finally{if(Dc=!1,($n!==null||ls!==null)&&(il(),$n&&(t=$n,i=ls,ls=$n=null,wp(t),i)))for(t=0;t<i.length;t++)wp(i[t])}}function Da(i,t){var e=i.stateNode;if(e===null)return null;var n=e[se]||null;if(n===null)return null;e=n[t];t:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(i=i.type,n=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!n;break t;default:i=!1}if(i)return null;if(e&&typeof e!="function")throw Error(x(231,t,typeof e));return e}var pi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mu=!1;if(pi)try{jn={},Object.defineProperty(jn,"passive",{get:function(){mu=!0}}),window.addEventListener("test",jn,jn),window.removeEventListener("test",jn,jn)}catch{mu=!1}var jn,Pi=null,rh=null,eo=null;function um(){if(eo)return eo;var i,t=rh,e=t.length,n,s="value"in Pi?Pi.value:Pi.textContent,a=s.length;for(i=0;i<e&&t[i]===s[i];i++);var r=e-i;for(n=1;n<=r&&t[e-n]===s[a-n];n++);return eo=s.slice(i,1<n?1-n:void 0)}function io(i){var t=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&t===13&&(i=13)):i=t,i===10&&(i=13),32<=i||i===13?i:0}function Hr(){return!0}function _p(){return!1}function ae(i){function t(e,n,s,a,r){this._reactName=e,this._targetInst=s,this.type=n,this.nativeEvent=a,this.target=r,this.currentTarget=null;for(var o in i)i.hasOwnProperty(o)&&(e=i[o],this[o]=e?e(a):a[o]);return this.isDefaultPrevented=(a.defaultPrevented!=null?a.defaultPrevented:a.returnValue===!1)?Hr:_p,this.isPropagationStopped=_p,this}return gt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!="unknown"&&(e.returnValue=!1),this.isDefaultPrevented=Hr)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!="unknown"&&(e.cancelBubble=!0),this.isPropagationStopped=Hr)},persist:function(){},isPersistent:Hr}),t}var Tn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xo=ae(Tn),qa=gt({},Tn,{view:0,detail:0}),Xv=ae(qa),Oc,Rc,sa,Yo=gt({},qa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:oh,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==sa&&(sa&&i.type==="mousemove"?(Oc=i.screenX-sa.screenX,Rc=i.screenY-sa.screenY):Rc=Oc=0,sa=i),Oc)},movementY:function(i){return"movementY"in i?i.movementY:Rc}}),xp=ae(Yo),Yv=gt({},Yo,{dataTransfer:0}),qv=ae(Yv),Kv=gt({},qa,{relatedTarget:0}),Nc=ae(Kv),Wv=gt({},Tn,{animationName:0,elapsedTime:0,pseudoElement:0}),Qv=ae(Wv),$v=gt({},Tn,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),Zv=ae($v),Jv=gt({},Tn,{data:0}),Cp=ae(Jv),tA={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},eA={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},iA={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function nA(i){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(i):(i=iA[i])?!!t[i]:!1}function oh(){return nA}var sA=gt({},qa,{key:function(i){if(i.key){var t=tA[i.key]||i.key;if(t!=="Unidentified")return t}return i.type==="keypress"?(i=io(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?eA[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:oh,charCode:function(i){return i.type==="keypress"?io(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?io(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),aA=ae(sA),rA=gt({},Yo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mp=ae(rA),oA=gt({},qa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:oh}),lA=ae(oA),cA=gt({},Tn,{propertyName:0,elapsedTime:0,pseudoElement:0}),uA=ae(cA),hA=gt({},Yo,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),dA=ae(hA),fA=gt({},Tn,{newState:0,oldState:0}),pA=ae(fA),gA=[9,13,27,32],lh=pi&&"CompositionEvent"in window,ga=null;pi&&"documentMode"in document&&(ga=document.documentMode);var mA=pi&&"TextEvent"in window&&!ga,hm=pi&&(!lh||ga&&8<ga&&11>=ga),Dp=" ",Op=!1;function dm(i,t){switch(i){case"keyup":return gA.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fm(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Zn=!1;function yA(i,t){switch(i){case"compositionend":return fm(t);case"keypress":return t.which!==32?null:(Op=!0,Dp);case"textInput":return i=t.data,i===Dp&&Op?null:i;default:return null}}function bA(i,t){if(Zn)return i==="compositionend"||!lh&&dm(i,t)?(i=um(),eo=rh=Pi=null,Zn=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return hm&&t.locale!=="ko"?null:t.data;default:return null}}var vA={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Rp(i){var t=i&&i.nodeName&&i.nodeName.toLowerCase();return t==="input"?!!vA[i.type]:t==="textarea"}function pm(i,t,e,n){$n?ls?ls.push(n):ls=[n]:$n=n,t=Po(t,"onChange"),0<t.length&&(e=new Xo("onChange","change",null,e,n),i.push({event:e,listeners:t}))}var ma=null,Oa=null;function AA(i){cy(i,0)}function qo(i){var t=da(i);if(sm(t))return i}function Np(i,t){if(i==="change")return t}var gm=!1;pi&&(pi?(Gr="oninput"in document,Gr||(Lc=document.createElement("div"),Lc.setAttribute("oninput","return;"),Gr=typeof Lc.oninput=="function"),Ur=Gr):Ur=!1,gm=Ur&&(!document.documentMode||9<document.documentMode));var Ur,Gr,Lc;function Lp(){ma&&(ma.detachEvent("onpropertychange",mm),Oa=ma=null)}function mm(i){if(i.propertyName==="value"&&qo(Oa)){var t=[];pm(t,Oa,i,ah(i)),cm(AA,t)}}function SA(i,t,e){i==="focusin"?(Lp(),ma=t,Oa=e,ma.attachEvent("onpropertychange",mm)):i==="focusout"&&Lp()}function EA(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return qo(Oa)}function TA(i,t){if(i==="click")return qo(t)}function wA(i,t){if(i==="input"||i==="change")return qo(t)}function _A(i,t){return i===t&&(i!==0||1/i===1/t)||i!==i&&t!==t}var me=typeof Object.is=="function"?Object.is:_A;function Ra(i,t){if(me(i,t))return!0;if(typeof i!="object"||i===null||typeof t!="object"||t===null)return!1;var e=Object.keys(i),n=Object.keys(t);if(e.length!==n.length)return!1;for(n=0;n<e.length;n++){var s=e[n];if(!uu.call(t,s)||!me(i[s],t[s]))return!1}return!0}function kp(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Bp(i,t){var e=kp(i);i=0;for(var n;e;){if(e.nodeType===3){if(n=i+e.textContent.length,i<=t&&n>=t)return{node:e,offset:t-i};i=n}t:{for(;e;){if(e.nextSibling){e=e.nextSibling;break t}e=e.parentNode}e=void 0}e=kp(e)}}function ym(i,t){return i&&t?i===t?!0:i&&i.nodeType===3?!1:t&&t.nodeType===3?ym(i,t.parentNode):"contains"in i?i.contains(t):i.compareDocumentPosition?!!(i.compareDocumentPosition(t)&16):!1:!1}function bm(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var t=vo(i.document);t instanceof i.HTMLIFrameElement;){try{var e=typeof t.contentWindow.location.href=="string"}catch{e=!1}if(e)i=t.contentWindow;else break;t=vo(i.document)}return t}function ch(i){var t=i&&i.nodeName&&i.nodeName.toLowerCase();return t&&(t==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||t==="textarea"||i.contentEditable==="true")}var xA=pi&&"documentMode"in document&&11>=document.documentMode,Jn=null,yu=null,ya=null,bu=!1;function zp(i,t,e){var n=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;bu||Jn==null||Jn!==vo(n)||(n=Jn,"selectionStart"in n&&ch(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),ya&&Ra(ya,n)||(ya=n,n=Po(yu,"onSelect"),0<n.length&&(t=new Xo("onSelect","select",null,t,e),i.push({event:t,listeners:n}),t.target=Jn)))}function on(i,t){var e={};return e[i.toLowerCase()]=t.toLowerCase(),e["Webkit"+i]="webkit"+t,e["Moz"+i]="moz"+t,e}var ts={animationend:on("Animation","AnimationEnd"),animationiteration:on("Animation","AnimationIteration"),animationstart:on("Animation","AnimationStart"),transitionrun:on("Transition","TransitionRun"),transitionstart:on("Transition","TransitionStart"),transitioncancel:on("Transition","TransitionCancel"),transitionend:on("Transition","TransitionEnd")},kc={},vm={};pi&&(vm=document.createElement("div").style,"AnimationEvent"in window||(delete ts.animationend.animation,delete ts.animationiteration.animation,delete ts.animationstart.animation),"TransitionEvent"in window||delete ts.transitionend.transition);function wn(i){if(kc[i])return kc[i];if(!ts[i])return i;var t=ts[i],e;for(e in t)if(t.hasOwnProperty(e)&&e in vm)return kc[i]=t[e];return i}var Am=wn("animationend"),Sm=wn("animationiteration"),Em=wn("animationstart"),CA=wn("transitionrun"),MA=wn("transitionstart"),DA=wn("transitioncancel"),Tm=wn("transitionend"),wm=new Map,vu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");vu.push("scrollEnd");function He(i,t){wm.set(i,t),En(t,[i])}var Ao=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},_e=[],es=0,uh=0;function Ko(){for(var i=es,t=uh=es=0;t<i;){var e=_e[t];_e[t++]=null;var n=_e[t];_e[t++]=null;var s=_e[t];_e[t++]=null;var a=_e[t];if(_e[t++]=null,n!==null&&s!==null){var r=n.pending;r===null?s.next=s:(s.next=r.next,r.next=s),n.pending=s}a!==0&&_m(e,s,a)}}function Wo(i,t,e,n){_e[es++]=i,_e[es++]=t,_e[es++]=e,_e[es++]=n,uh|=n,i.lanes|=n,i=i.alternate,i!==null&&(i.lanes|=n)}function hh(i,t,e,n){return Wo(i,t,e,n),So(i)}function _n(i,t){return Wo(i,null,null,t),So(i)}function _m(i,t,e){i.lanes|=e;var n=i.alternate;n!==null&&(n.lanes|=e);for(var s=!1,a=i.return;a!==null;)a.childLanes|=e,n=a.alternate,n!==null&&(n.childLanes|=e),a.tag===22&&(i=a.stateNode,i===null||i._visibility&1||(s=!0)),i=a,a=a.return;return i.tag===3?(a=i.stateNode,s&&t!==null&&(s=31-pe(e),i=a.hiddenUpdates,n=i[s],n===null?i[s]=[t]:n.push(t),t.lane=e|536870912),a):null}function So(i){if(50<xa)throw xa=0,Hu=null,Error(x(185));for(var t=i.return;t!==null;)i=t,t=i.return;return i.tag===3?i.stateNode:null}var is={};function OA(i,t,e,n){this.tag=i,this.key=e,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ue(i,t,e,n){return new OA(i,t,e,n)}function dh(i){return i=i.prototype,!(!i||!i.isReactComponent)}function hi(i,t){var e=i.alternate;return e===null?(e=ue(i.tag,t,i.key,i.mode),e.elementType=i.elementType,e.type=i.type,e.stateNode=i.stateNode,e.alternate=i,i.alternate=e):(e.pendingProps=t,e.type=i.type,e.flags=0,e.subtreeFlags=0,e.deletions=null),e.flags=i.flags&65011712,e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},e.sibling=i.sibling,e.index=i.index,e.ref=i.ref,e.refCleanup=i.refCleanup,e}function xm(i,t){i.flags&=65011714;var e=i.alternate;return e===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,i.type=e.type,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),i}function no(i,t,e,n,s,a){var r=0;if(n=i,typeof i=="function")dh(i)&&(r=1);else if(typeof i=="string")r=L1(i,e,Ke.current)?26:i==="html"||i==="head"||i==="body"?27:5;else t:switch(i){case ru:return i=ue(31,e,t,s),i.elementType=ru,i.lanes=a,i;case Kn:return fn(e.children,s,a,t);case Xg:r=8,s|=24;break;case nu:return i=ue(12,e,t,s|2),i.elementType=nu,i.lanes=a,i;case su:return i=ue(13,e,t,s),i.elementType=su,i.lanes=a,i;case au:return i=ue(19,e,t,s),i.elementType=au,i.lanes=a,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case li:r=10;break t;case Yg:r=9;break t;case Zu:r=11;break t;case Ju:r=14;break t;case Oi:r=16,n=null;break t}r=29,e=Error(x(130,i===null?"null":typeof i,"")),n=null}return t=ue(r,e,t,s),t.elementType=i,t.type=n,t.lanes=a,t}function fn(i,t,e,n){return i=ue(7,i,n,t),i.lanes=e,i}function Bc(i,t,e){return i=ue(6,i,null,t),i.lanes=e,i}function Cm(i){var t=ue(18,null,null,0);return t.stateNode=i,t}function zc(i,t,e){return t=ue(4,i.children!==null?i.children:[],i.key,t),t.lanes=e,t.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},t}var Pp=new WeakMap;function Oe(i,t){if(typeof i=="object"&&i!==null){var e=Pp.get(i);return e!==void 0?e:(t={value:i,source:t,stack:bp(t)},Pp.set(i,t),t)}return{value:i,source:t,stack:bp(t)}}var ns=[],ss=0,Eo=null,Na=0,Ce=[],Me=0,Qi=null,Xe=1,Ye="";function ri(i,t){ns[ss++]=Na,ns[ss++]=Eo,Eo=i,Na=t}function Mm(i,t,e){Ce[Me++]=Xe,Ce[Me++]=Ye,Ce[Me++]=Qi,Qi=i;var n=Xe;i=Ye;var s=32-pe(n)-1;n&=~(1<<s),e+=1;var a=32-pe(t)+s;if(30<a){var r=s-s%5;a=(n&(1<<r)-1).toString(32),n>>=r,s-=r,Xe=1<<32-pe(t)+s|e<<s|n,Ye=a+i}else Xe=1<<a|e<<s|n,Ye=i}function fh(i){i.return!==null&&(ri(i,1),Mm(i,1,0))}function ph(i){for(;i===Eo;)Eo=ns[--ss],ns[ss]=null,Na=ns[--ss],ns[ss]=null;for(;i===Qi;)Qi=Ce[--Me],Ce[Me]=null,Ye=Ce[--Me],Ce[Me]=null,Xe=Ce[--Me],Ce[Me]=null}function Dm(i,t){Ce[Me++]=Xe,Ce[Me++]=Ye,Ce[Me++]=Qi,Xe=t.id,Ye=t.overflow,Qi=i}var jt=null,pt=null,K=!1,Gi=null,Re=!1,Au=Error(x(519));function $i(i){var t=Error(x(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw La(Oe(t,i)),Au}function Ip(i){var t=i.stateNode,e=i.type,n=i.memoizedProps;switch(t[Gt]=i,t[se]=n,e){case"dialog":j("cancel",t),j("close",t);break;case"iframe":case"object":case"embed":j("load",t);break;case"video":case"audio":for(e=0;e<Pa.length;e++)j(Pa[e],t);break;case"source":j("error",t);break;case"img":case"image":case"link":j("error",t),j("load",t);break;case"details":j("toggle",t);break;case"input":j("invalid",t),am(t,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0);break;case"select":j("invalid",t);break;case"textarea":j("invalid",t),om(t,n.value,n.defaultValue,n.children)}e=n.children,typeof e!="string"&&typeof e!="number"&&typeof e!="bigint"||t.textContent===""+e||n.suppressHydrationWarning===!0||hy(t.textContent,e)?(n.popover!=null&&(j("beforetoggle",t),j("toggle",t)),n.onScroll!=null&&j("scroll",t),n.onScrollEnd!=null&&j("scrollend",t),n.onClick!=null&&(t.onclick=ci),t=!0):t=!1,t||$i(i,!0)}function Fp(i){for(jt=i.return;jt;)switch(jt.tag){case 5:case 31:case 13:Re=!1;return;case 27:case 3:Re=!0;return;default:jt=jt.return}}function Vn(i){if(i!==jt)return!1;if(!K)return Fp(i),K=!0,!1;var t=i.tag,e;if((e=t!==3&&t!==27)&&((e=t===5)&&(e=i.type,e=!(e!=="form"&&e!=="button")||Xu(i.type,i.memoizedProps)),e=!e),e&&pt&&$i(i),Fp(i),t===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(x(317));pt=Cg(i)}else if(t===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(x(317));pt=Cg(i)}else t===27?(t=pt,en(i.type)?(i=Wu,Wu=null,pt=i):pt=t):pt=jt?Le(i.stateNode.nextSibling):null;return!0}function yn(){pt=jt=null,K=!1}function Pc(){var i=Gi;return i!==null&&(ie===null?ie=i:ie.push.apply(ie,i),Gi=null),i}function La(i){Gi===null?Gi=[i]:Gi.push(i)}var Su=We(null),xn=null,ui=null;function Ni(i,t,e){ct(Su,t._currentValue),t._currentValue=e}function di(i){i._currentValue=Su.current,Ht(Su)}function Eu(i,t,e){for(;i!==null;){var n=i.alternate;if((i.childLanes&t)!==t?(i.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),i===e)break;i=i.return}}function Tu(i,t,e,n){var s=i.child;for(s!==null&&(s.return=i);s!==null;){var a=s.dependencies;if(a!==null){var r=s.child;a=a.firstContext;t:for(;a!==null;){var o=a;a=s;for(var l=0;l<t.length;l++)if(o.context===t[l]){a.lanes|=e,o=a.alternate,o!==null&&(o.lanes|=e),Eu(a.return,e,i),n||(r=null);break t}a=o.next}}else if(s.tag===18){if(r=s.return,r===null)throw Error(x(341));r.lanes|=e,a=r.alternate,a!==null&&(a.lanes|=e),Eu(r,e,i),r=null}else r=s.child;if(r!==null)r.return=s;else for(r=s;r!==null;){if(r===i){r=null;break}if(s=r.sibling,s!==null){s.return=r.return,r=s;break}r=r.return}s=r}}function xs(i,t,e,n){i=null;for(var s=t,a=!1;s!==null;){if(!a){if((s.flags&524288)!==0)a=!0;else if((s.flags&262144)!==0)break}if(s.tag===10){var r=s.alternate;if(r===null)throw Error(x(387));if(r=r.memoizedProps,r!==null){var o=s.type;me(s.pendingProps.value,r.value)||(i!==null?i.push(o):i=[o])}}else if(s===go.current){if(r=s.alternate,r===null)throw Error(x(387));r.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(i!==null?i.push(Fa):i=[Fa])}s=s.return}i!==null&&Tu(t,i,e,n),t.flags|=262144}function To(i){for(i=i.firstContext;i!==null;){if(!me(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function bn(i){xn=i,ui=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Vt(i){return Om(xn,i)}function jr(i,t){return xn===null&&bn(i),Om(i,t)}function Om(i,t){var e=t._currentValue;if(t={context:t,memoizedValue:e,next:null},ui===null){if(i===null)throw Error(x(308));ui=t,i.dependencies={lanes:0,firstContext:t},i.flags|=524288}else ui=ui.next=t;return e}var RA=typeof AbortController<"u"?AbortController:function(){var i=[],t=this.signal={aborted:!1,addEventListener:function(e,n){i.push(n)}};this.abort=function(){t.aborted=!0,i.forEach(function(e){return e()})}},NA=zt.unstable_scheduleCallback,LA=zt.unstable_NormalPriority,Ot={$$typeof:li,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function gh(){return{controller:new RA,data:new Map,refCount:0}}function Ka(i){i.refCount--,i.refCount===0&&NA(LA,function(){i.controller.abort()})}var ba=null,wu=0,ms=0,cs=null;function kA(i,t){if(ba===null){var e=ba=[];wu=0,ms=Hh(),cs={status:"pending",value:void 0,then:function(n){e.push(n)}}}return wu++,t.then(Hp,Hp),t}function Hp(){if(--wu===0&&ba!==null){cs!==null&&(cs.status="fulfilled");var i=ba;ba=null,ms=0,cs=null;for(var t=0;t<i.length;t++)(0,i[t])()}}function BA(i,t){var e=[],n={status:"pending",value:null,reason:null,then:function(s){e.push(s)}};return i.then(function(){n.status="fulfilled",n.value=t;for(var s=0;s<e.length;s++)(0,e[s])(t)},function(s){for(n.status="rejected",n.reason=s,s=0;s<e.length;s++)(0,e[s])(void 0)}),n}var Up=k.S;k.S=function(i,t){V0=de(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&kA(i,t),Up!==null&&Up(i,t)};var pn=We(null);function mh(){var i=pn.current;return i!==null?i:ot.pooledCache}function so(i,t){t===null?ct(pn,pn.current):ct(pn,t.pool)}function Rm(){var i=mh();return i===null?null:{parent:Ot._currentValue,pool:i}}var Cs=Error(x(460)),yh=Error(x(474)),Qo=Error(x(542)),wo={then:function(){}};function Gp(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Nm(i,t,e){switch(e=i[e],e===void 0?i.push(t):e!==t&&(t.then(ci,ci),t=e),t.status){case"fulfilled":return t.value;case"rejected":throw i=t.reason,Vp(i),i;default:if(typeof t.status=="string")t.then(ci,ci);else{if(i=ot,i!==null&&100<i.shellSuspendCounter)throw Error(x(482));i=t,i.status="pending",i.then(function(n){if(t.status==="pending"){var s=t;s.status="fulfilled",s.value=n}},function(n){if(t.status==="pending"){var s=t;s.status="rejected",s.reason=n}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw i=t.reason,Vp(i),i}throw gn=t,Cs}}function un(i){try{var t=i._init;return t(i._payload)}catch(e){throw e!==null&&typeof e=="object"&&typeof e.then=="function"?(gn=e,Cs):e}}var gn=null;function jp(){if(gn===null)throw Error(x(459));var i=gn;return gn=null,i}function Vp(i){if(i===Cs||i===Qo)throw Error(x(483))}var us=null,ka=0;function Vr(i){var t=ka;return ka+=1,us===null&&(us=[]),Nm(us,i,t)}function aa(i,t){t=t.props.ref,i.ref=t!==void 0?t:null}function Xr(i,t){throw t.$$typeof===Sv?Error(x(525)):(i=Object.prototype.toString.call(t),Error(x(31,i==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":i)))}function Lm(i){function t(p,g){if(i){var b=p.deletions;b===null?(p.deletions=[g],p.flags|=16):b.push(g)}}function e(p,g){if(!i)return null;for(;g!==null;)t(p,g),g=g.sibling;return null}function n(p){for(var g=new Map;p!==null;)p.key!==null?g.set(p.key,p):g.set(p.index,p),p=p.sibling;return g}function s(p,g){return p=hi(p,g),p.index=0,p.sibling=null,p}function a(p,g,b){return p.index=b,i?(b=p.alternate,b!==null?(b=b.index,b<g?(p.flags|=67108866,g):b):(p.flags|=67108866,g)):(p.flags|=1048576,g)}function r(p){return i&&p.alternate===null&&(p.flags|=67108866),p}function o(p,g,b,A){return g===null||g.tag!==6?(g=Bc(b,p.mode,A),g.return=p,g):(g=s(g,b),g.return=p,g)}function l(p,g,b,A){var S=b.type;return S===Kn?u(p,g,b.props.children,A,b.key):g!==null&&(g.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Oi&&un(S)===g.type)?(g=s(g,b.props),aa(g,b),g.return=p,g):(g=no(b.type,b.key,b.props,null,p.mode,A),aa(g,b),g.return=p,g)}function c(p,g,b,A){return g===null||g.tag!==4||g.stateNode.containerInfo!==b.containerInfo||g.stateNode.implementation!==b.implementation?(g=zc(b,p.mode,A),g.return=p,g):(g=s(g,b.children||[]),g.return=p,g)}function u(p,g,b,A,S){return g===null||g.tag!==7?(g=fn(b,p.mode,A,S),g.return=p,g):(g=s(g,b),g.return=p,g)}function h(p,g,b){if(typeof g=="string"&&g!==""||typeof g=="number"||typeof g=="bigint")return g=Bc(""+g,p.mode,b),g.return=p,g;if(typeof g=="object"&&g!==null){switch(g.$$typeof){case Br:return b=no(g.type,g.key,g.props,null,p.mode,b),aa(b,g),b.return=p,b;case ua:return g=zc(g,p.mode,b),g.return=p,g;case Oi:return g=un(g),h(p,g,b)}if(ha(g)||na(g))return g=fn(g,p.mode,b,null),g.return=p,g;if(typeof g.then=="function")return h(p,Vr(g),b);if(g.$$typeof===li)return h(p,jr(p,g),b);Xr(p,g)}return null}function d(p,g,b,A){var S=g!==null?g.key:null;if(typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint")return S!==null?null:o(p,g,""+b,A);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Br:return b.key===S?l(p,g,b,A):null;case ua:return b.key===S?c(p,g,b,A):null;case Oi:return b=un(b),d(p,g,b,A)}if(ha(b)||na(b))return S!==null?null:u(p,g,b,A,null);if(typeof b.then=="function")return d(p,g,Vr(b),A);if(b.$$typeof===li)return d(p,g,jr(p,b),A);Xr(p,b)}return null}function f(p,g,b,A,S){if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return p=p.get(b)||null,o(g,p,""+A,S);if(typeof A=="object"&&A!==null){switch(A.$$typeof){case Br:return p=p.get(A.key===null?b:A.key)||null,l(g,p,A,S);case ua:return p=p.get(A.key===null?b:A.key)||null,c(g,p,A,S);case Oi:return A=un(A),f(p,g,b,A,S)}if(ha(A)||na(A))return p=p.get(b)||null,u(g,p,A,S,null);if(typeof A.then=="function")return f(p,g,b,Vr(A),S);if(A.$$typeof===li)return f(p,g,b,jr(g,A),S);Xr(g,A)}return null}function m(p,g,b,A){for(var S=null,E=null,T=g,w=g=0,_=null;T!==null&&w<b.length;w++){T.index>w?(_=T,T=null):_=T.sibling;var C=d(p,T,b[w],A);if(C===null){T===null&&(T=_);break}i&&T&&C.alternate===null&&t(p,T),g=a(C,g,w),E===null?S=C:E.sibling=C,E=C,T=_}if(w===b.length)return e(p,T),K&&ri(p,w),S;if(T===null){for(;w<b.length;w++)T=h(p,b[w],A),T!==null&&(g=a(T,g,w),E===null?S=T:E.sibling=T,E=T);return K&&ri(p,w),S}for(T=n(T);w<b.length;w++)_=f(T,p,w,b[w],A),_!==null&&(i&&_.alternate!==null&&T.delete(_.key===null?w:_.key),g=a(_,g,w),E===null?S=_:E.sibling=_,E=_);return i&&T.forEach(function(D){return t(p,D)}),K&&ri(p,w),S}function y(p,g,b,A){if(b==null)throw Error(x(151));for(var S=null,E=null,T=g,w=g=0,_=null,C=b.next();T!==null&&!C.done;w++,C=b.next()){T.index>w?(_=T,T=null):_=T.sibling;var D=d(p,T,C.value,A);if(D===null){T===null&&(T=_);break}i&&T&&D.alternate===null&&t(p,T),g=a(D,g,w),E===null?S=D:E.sibling=D,E=D,T=_}if(C.done)return e(p,T),K&&ri(p,w),S;if(T===null){for(;!C.done;w++,C=b.next())C=h(p,C.value,A),C!==null&&(g=a(C,g,w),E===null?S=C:E.sibling=C,E=C);return K&&ri(p,w),S}for(T=n(T);!C.done;w++,C=b.next())C=f(T,p,w,C.value,A),C!==null&&(i&&C.alternate!==null&&T.delete(C.key===null?w:C.key),g=a(C,g,w),E===null?S=C:E.sibling=C,E=C);return i&&T.forEach(function(N){return t(p,N)}),K&&ri(p,w),S}function v(p,g,b,A){if(typeof b=="object"&&b!==null&&b.type===Kn&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Br:t:{for(var S=b.key;g!==null;){if(g.key===S){if(S=b.type,S===Kn){if(g.tag===7){e(p,g.sibling),A=s(g,b.props.children),A.return=p,p=A;break t}}else if(g.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Oi&&un(S)===g.type){e(p,g.sibling),A=s(g,b.props),aa(A,b),A.return=p,p=A;break t}e(p,g);break}else t(p,g);g=g.sibling}b.type===Kn?(A=fn(b.props.children,p.mode,A,b.key),A.return=p,p=A):(A=no(b.type,b.key,b.props,null,p.mode,A),aa(A,b),A.return=p,p=A)}return r(p);case ua:t:{for(S=b.key;g!==null;){if(g.key===S)if(g.tag===4&&g.stateNode.containerInfo===b.containerInfo&&g.stateNode.implementation===b.implementation){e(p,g.sibling),A=s(g,b.children||[]),A.return=p,p=A;break t}else{e(p,g);break}else t(p,g);g=g.sibling}A=zc(b,p.mode,A),A.return=p,p=A}return r(p);case Oi:return b=un(b),v(p,g,b,A)}if(ha(b))return m(p,g,b,A);if(na(b)){if(S=na(b),typeof S!="function")throw Error(x(150));return b=S.call(b),y(p,g,b,A)}if(typeof b.then=="function")return v(p,g,Vr(b),A);if(b.$$typeof===li)return v(p,g,jr(p,b),A);Xr(p,b)}return typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint"?(b=""+b,g!==null&&g.tag===6?(e(p,g.sibling),A=s(g,b),A.return=p,p=A):(e(p,g),A=Bc(b,p.mode,A),A.return=p,p=A),r(p)):e(p,g)}return function(p,g,b,A){try{ka=0;var S=v(p,g,b,A);return us=null,S}catch(T){if(T===Cs||T===Qo)throw T;var E=ue(29,T,null,p.mode);return E.lanes=A,E.return=p,E}}}var vn=Lm(!0),km=Lm(!1),Ri=!1;function bh(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function _u(i,t){i=i.updateQueue,t.updateQueue===i&&(t.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function ji(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Vi(i,t,e){var n=i.updateQueue;if(n===null)return null;if(n=n.shared,($&2)!==0){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,t=So(i),_m(i,null,e),t}return Wo(i,n,t,e),So(i)}function va(i,t,e){if(t=t.updateQueue,t!==null&&(t=t.shared,(e&4194048)!==0)){var n=t.lanes;n&=i.pendingLanes,e|=n,t.lanes=e,Zg(i,e)}}function Ic(i,t){var e=i.updateQueue,n=i.alternate;if(n!==null&&(n=n.updateQueue,e===n)){var s=null,a=null;if(e=e.firstBaseUpdate,e!==null){do{var r={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};a===null?s=a=r:a=a.next=r,e=e.next}while(e!==null);a===null?s=a=t:a=a.next=t}else s=a=t;e={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:a,shared:n.shared,callbacks:n.callbacks},i.updateQueue=e;return}i=e.lastBaseUpdate,i===null?e.firstBaseUpdate=t:i.next=t,e.lastBaseUpdate=t}var xu=!1;function Aa(){if(xu){var i=cs;if(i!==null)throw i}}function Sa(i,t,e,n){xu=!1;var s=i.updateQueue;Ri=!1;var a=s.firstBaseUpdate,r=s.lastBaseUpdate,o=s.shared.pending;if(o!==null){s.shared.pending=null;var l=o,c=l.next;l.next=null,r===null?a=c:r.next=c,r=l;var u=i.alternate;u!==null&&(u=u.updateQueue,o=u.lastBaseUpdate,o!==r&&(o===null?u.firstBaseUpdate=c:o.next=c,u.lastBaseUpdate=l))}if(a!==null){var h=s.baseState;r=0,u=c=l=null,o=a;do{var d=o.lane&-536870913,f=d!==o.lane;if(f?(Y&d)===d:(n&d)===d){d!==0&&d===ms&&(xu=!0),u!==null&&(u=u.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});t:{var m=i,y=o;d=t;var v=e;switch(y.tag){case 1:if(m=y.payload,typeof m=="function"){h=m.call(v,h,d);break t}h=m;break t;case 3:m.flags=m.flags&-65537|128;case 0:if(m=y.payload,d=typeof m=="function"?m.call(v,h,d):m,d==null)break t;h=gt({},h,d);break t;case 2:Ri=!0}}d=o.callback,d!==null&&(i.flags|=64,f&&(i.flags|=8192),f=s.callbacks,f===null?s.callbacks=[d]:f.push(d))}else f={lane:d,tag:o.tag,payload:o.payload,callback:o.callback,next:null},u===null?(c=u=f,l=h):u=u.next=f,r|=d;if(o=o.next,o===null){if(o=s.shared.pending,o===null)break;f=o,o=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);u===null&&(l=h),s.baseState=l,s.firstBaseUpdate=c,s.lastBaseUpdate=u,a===null&&(s.shared.lanes=0),Ji|=r,i.lanes=r,i.memoizedState=h}}function Bm(i,t){if(typeof i!="function")throw Error(x(191,i));i.call(t)}function zm(i,t){var e=i.callbacks;if(e!==null)for(i.callbacks=null,i=0;i<e.length;i++)Bm(e[i],t)}var ys=We(null),_o=We(0);function Xp(i,t){i=bi,ct(_o,i),ct(ys,t),bi=i|t.baseLanes}function Cu(){ct(_o,bi),ct(ys,ys.current)}function vh(){bi=_o.current,Ht(ys),Ht(_o)}var ye=We(null),Ne=null;function Li(i){var t=i.alternate;ct(_t,_t.current&1),ct(ye,i),Ne===null&&(t===null||ys.current!==null||t.memoizedState!==null)&&(Ne=i)}function Mu(i){ct(_t,_t.current),ct(ye,i),Ne===null&&(Ne=i)}function Pm(i){i.tag===22?(ct(_t,_t.current),ct(ye,i),Ne===null&&(Ne=i)):ki(i)}function ki(){ct(_t,_t.current),ct(ye,ye.current)}function ce(i){Ht(ye),Ne===i&&(Ne=null),Ht(_t)}var _t=We(0);function xo(i){for(var t=i;t!==null;){if(t.tag===13){var e=t.memoizedState;if(e!==null&&(e=e.dehydrated,e===null||qu(e)||Ku(e)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===i)break;for(;t.sibling===null;){if(t.return===null||t.return===i)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var gi=0,U=null,st=null,Mt=null,Co=!1,hs=!1,An=!1,Mo=0,Ba=0,ds=null,zA=0;function Tt(){throw Error(x(321))}function Ah(i,t){if(t===null)return!1;for(var e=0;e<t.length&&e<i.length;e++)if(!me(i[e],t[e]))return!1;return!0}function Sh(i,t,e,n,s,a){return gi=a,U=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,k.H=i===null||i.memoizedState===null?p0:Nh,An=!1,a=e(n,s),An=!1,hs&&(a=Fm(t,e,n,s)),Im(i),a}function Im(i){k.H=za;var t=st!==null&&st.next!==null;if(gi=0,Mt=st=U=null,Co=!1,Ba=0,ds=null,t)throw Error(x(300));i===null||Rt||(i=i.dependencies,i!==null&&To(i)&&(Rt=!0))}function Fm(i,t,e,n){U=i;var s=0;do{if(hs&&(ds=null),Ba=0,hs=!1,25<=s)throw Error(x(301));if(s+=1,Mt=st=null,i.updateQueue!=null){var a=i.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}k.H=g0,a=t(e,n)}while(hs);return a}function PA(){var i=k.H,t=i.useState()[0];return t=typeof t.then=="function"?Wa(t):t,i=i.useState()[0],(st!==null?st.memoizedState:null)!==i&&(U.flags|=1024),t}function Eh(){var i=Mo!==0;return Mo=0,i}function Th(i,t,e){t.updateQueue=i.updateQueue,t.flags&=-2053,i.lanes&=~e}function wh(i){if(Co){for(i=i.memoizedState;i!==null;){var t=i.queue;t!==null&&(t.pending=null),i=i.next}Co=!1}gi=0,Mt=st=U=null,hs=!1,Ba=Mo=0,ds=null}function Zt(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?U.memoizedState=Mt=i:Mt=Mt.next=i,Mt}function xt(){if(st===null){var i=U.alternate;i=i!==null?i.memoizedState:null}else i=st.next;var t=Mt===null?U.memoizedState:Mt.next;if(t!==null)Mt=t,st=i;else{if(i===null)throw U.alternate===null?Error(x(467)):Error(x(310));st=i,i={memoizedState:st.memoizedState,baseState:st.baseState,baseQueue:st.baseQueue,queue:st.queue,next:null},Mt===null?U.memoizedState=Mt=i:Mt=Mt.next=i}return Mt}function $o(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Wa(i){var t=Ba;return Ba+=1,ds===null&&(ds=[]),i=Nm(ds,i,t),t=U,(Mt===null?t.memoizedState:Mt.next)===null&&(t=t.alternate,k.H=t===null||t.memoizedState===null?p0:Nh),i}function Zo(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Wa(i);if(i.$$typeof===li)return Vt(i)}throw Error(x(438,String(i)))}function _h(i){var t=null,e=U.updateQueue;if(e!==null&&(t=e.memoCache),t==null){var n=U.alternate;n!==null&&(n=n.updateQueue,n!==null&&(n=n.memoCache,n!=null&&(t={data:n.data.map(function(s){return s.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),e===null&&(e=$o(),U.updateQueue=e),e.memoCache=t,e=t.data[t.index],e===void 0)for(e=t.data[t.index]=Array(i),n=0;n<i;n++)e[n]=Ev;return t.index++,e}function mi(i,t){return typeof t=="function"?t(i):t}function ao(i){var t=xt();return xh(t,st,i)}function xh(i,t,e){var n=i.queue;if(n===null)throw Error(x(311));n.lastRenderedReducer=e;var s=i.baseQueue,a=n.pending;if(a!==null){if(s!==null){var r=s.next;s.next=a.next,a.next=r}t.baseQueue=s=a,n.pending=null}if(a=i.baseState,s===null)i.memoizedState=a;else{t=s.next;var o=r=null,l=null,c=t,u=!1;do{var h=c.lane&-536870913;if(h!==c.lane?(Y&h)===h:(gi&h)===h){var d=c.revertLane;if(d===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),h===ms&&(u=!0);else if((gi&d)===d){c=c.next,d===ms&&(u=!0);continue}else h={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(o=l=h,r=a):l=l.next=h,U.lanes|=d,Ji|=d;h=c.action,An&&e(a,h),a=c.hasEagerState?c.eagerState:e(a,h)}else d={lane:h,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(o=l=d,r=a):l=l.next=d,U.lanes|=h,Ji|=h;c=c.next}while(c!==null&&c!==t);if(l===null?r=a:l.next=o,!me(a,i.memoizedState)&&(Rt=!0,u&&(e=cs,e!==null)))throw e;i.memoizedState=a,i.baseState=r,i.baseQueue=l,n.lastRenderedState=a}return s===null&&(n.lanes=0),[i.memoizedState,n.dispatch]}function Fc(i){var t=xt(),e=t.queue;if(e===null)throw Error(x(311));e.lastRenderedReducer=i;var n=e.dispatch,s=e.pending,a=t.memoizedState;if(s!==null){e.pending=null;var r=s=s.next;do a=i(a,r.action),r=r.next;while(r!==s);me(a,t.memoizedState)||(Rt=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),e.lastRenderedState=a}return[a,n]}function Hm(i,t,e){var n=U,s=xt(),a=K;if(a){if(e===void 0)throw Error(x(407));e=e()}else e=t();var r=!me((st||s).memoizedState,e);if(r&&(s.memoizedState=e,Rt=!0),s=s.queue,Ch(jm.bind(null,n,s,i),[i]),s.getSnapshot!==t||r||Mt!==null&&Mt.memoizedState.tag&1){if(n.flags|=2048,bs(9,{destroy:void 0},Gm.bind(null,n,s,e,t),null),ot===null)throw Error(x(349));a||(gi&127)!==0||Um(n,t,e)}return e}function Um(i,t,e){i.flags|=16384,i={getSnapshot:t,value:e},t=U.updateQueue,t===null?(t=$o(),U.updateQueue=t,t.stores=[i]):(e=t.stores,e===null?t.stores=[i]:e.push(i))}function Gm(i,t,e,n){t.value=e,t.getSnapshot=n,Vm(t)&&Xm(i)}function jm(i,t,e){return e(function(){Vm(t)&&Xm(i)})}function Vm(i){var t=i.getSnapshot;i=i.value;try{var e=t();return!me(i,e)}catch{return!0}}function Xm(i){var t=_n(i,2);t!==null&&ne(t,i,2)}function Du(i){var t=Zt();if(typeof i=="function"){var e=i;if(i=e(),An){zi(!0);try{e()}finally{zi(!1)}}}return t.memoizedState=t.baseState=i,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mi,lastRenderedState:i},t}function Ym(i,t,e,n){return i.baseState=e,xh(i,st,typeof n=="function"?n:mi)}function IA(i,t,e,n,s){if(tl(i))throw Error(x(485));if(i=t.action,i!==null){var a={payload:s,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(r){a.listeners.push(r)}};k.T!==null?e(!0):a.isTransition=!1,n(a),e=t.pending,e===null?(a.next=t.pending=a,qm(t,a)):(a.next=e.next,t.pending=e.next=a)}}function qm(i,t){var e=t.action,n=t.payload,s=i.state;if(t.isTransition){var a=k.T,r={};k.T=r;try{var o=e(s,n),l=k.S;l!==null&&l(r,o),Yp(i,t,o)}catch(c){Ou(i,t,c)}finally{a!==null&&r.types!==null&&(a.types=r.types),k.T=a}}else try{a=e(s,n),Yp(i,t,a)}catch(c){Ou(i,t,c)}}function Yp(i,t,e){e!==null&&typeof e=="object"&&typeof e.then=="function"?e.then(function(n){qp(i,t,n)},function(n){return Ou(i,t,n)}):qp(i,t,e)}function qp(i,t,e){t.status="fulfilled",t.value=e,Km(t),i.state=e,t=i.pending,t!==null&&(e=t.next,e===t?i.pending=null:(e=e.next,t.next=e,qm(i,e)))}function Ou(i,t,e){var n=i.pending;if(i.pending=null,n!==null){n=n.next;do t.status="rejected",t.reason=e,Km(t),t=t.next;while(t!==n)}i.action=null}function Km(i){i=i.listeners;for(var t=0;t<i.length;t++)(0,i[t])()}function Wm(i,t){return t}function Kp(i,t){if(K){var e=ot.formState;if(e!==null){t:{var n=U;if(K){if(pt){e:{for(var s=pt,a=Re;s.nodeType!==8;){if(!a){s=null;break e}if(s=Le(s.nextSibling),s===null){s=null;break e}}a=s.data,s=a==="F!"||a==="F"?s:null}if(s){pt=Le(s.nextSibling),n=s.data==="F!";break t}}$i(n)}n=!1}n&&(t=e[0])}}return e=Zt(),e.memoizedState=e.baseState=t,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wm,lastRenderedState:t},e.queue=n,e=h0.bind(null,U,n),n.dispatch=e,n=Du(!1),a=Rh.bind(null,U,!1,n.queue),n=Zt(),s={state:t,dispatch:null,action:i,pending:null},n.queue=s,e=IA.bind(null,U,s,a,e),s.dispatch=e,n.memoizedState=i,[t,e,!1]}function Wp(i){var t=xt();return Qm(t,st,i)}function Qm(i,t,e){if(t=xh(i,t,Wm)[0],i=ao(mi)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var n=Wa(t)}catch(r){throw r===Cs?Qo:r}else n=t;t=xt();var s=t.queue,a=s.dispatch;return e!==t.memoizedState&&(U.flags|=2048,bs(9,{destroy:void 0},FA.bind(null,s,e),null)),[n,a,i]}function FA(i,t){i.action=t}function Qp(i){var t=xt(),e=st;if(e!==null)return Qm(t,e,i);xt(),t=t.memoizedState,e=xt();var n=e.queue.dispatch;return e.memoizedState=i,[t,n,!1]}function bs(i,t,e,n){return i={tag:i,create:e,deps:n,inst:t,next:null},t=U.updateQueue,t===null&&(t=$o(),U.updateQueue=t),e=t.lastEffect,e===null?t.lastEffect=i.next=i:(n=e.next,e.next=i,i.next=n,t.lastEffect=i),i}function $m(){return xt().memoizedState}function ro(i,t,e,n){var s=Zt();U.flags|=i,s.memoizedState=bs(1|t,{destroy:void 0},e,n===void 0?null:n)}function Jo(i,t,e,n){var s=xt();n=n===void 0?null:n;var a=s.memoizedState.inst;st!==null&&n!==null&&Ah(n,st.memoizedState.deps)?s.memoizedState=bs(t,a,e,n):(U.flags|=i,s.memoizedState=bs(1|t,a,e,n))}function $p(i,t){ro(8390656,8,i,t)}function Ch(i,t){Jo(2048,8,i,t)}function HA(i){U.flags|=4;var t=U.updateQueue;if(t===null)t=$o(),U.updateQueue=t,t.events=[i];else{var e=t.events;e===null?t.events=[i]:e.push(i)}}function Zm(i){var t=xt().memoizedState;return HA({ref:t,nextImpl:i}),function(){if(($&2)!==0)throw Error(x(440));return t.impl.apply(void 0,arguments)}}function Jm(i,t){return Jo(4,2,i,t)}function t0(i,t){return Jo(4,4,i,t)}function e0(i,t){if(typeof t=="function"){i=i();var e=t(i);return function(){typeof e=="function"?e():t(null)}}if(t!=null)return i=i(),t.current=i,function(){t.current=null}}function i0(i,t,e){e=e!=null?e.concat([i]):null,Jo(4,4,e0.bind(null,t,i),e)}function Mh(){}function n0(i,t){var e=xt();t=t===void 0?null:t;var n=e.memoizedState;return t!==null&&Ah(t,n[1])?n[0]:(e.memoizedState=[i,t],i)}function s0(i,t){var e=xt();t=t===void 0?null:t;var n=e.memoizedState;if(t!==null&&Ah(t,n[1]))return n[0];if(n=i(),An){zi(!0);try{i()}finally{zi(!1)}}return e.memoizedState=[n,t],n}function Dh(i,t,e){return e===void 0||(gi&1073741824)!==0&&(Y&261930)===0?i.memoizedState=t:(i.memoizedState=e,i=Y0(),U.lanes|=i,Ji|=i,e)}function a0(i,t,e,n){return me(e,t)?e:ys.current!==null?(i=Dh(i,e,n),me(i,t)||(Rt=!0),i):(gi&42)===0||(gi&1073741824)!==0&&(Y&261930)===0?(Rt=!0,i.memoizedState=e):(i=Y0(),U.lanes|=i,Ji|=i,t)}function r0(i,t,e,n,s){var a=Z.p;Z.p=a!==0&&8>a?a:8;var r=k.T,o={};k.T=o,Rh(i,!1,t,e);try{var l=s(),c=k.S;if(c!==null&&c(o,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=BA(l,n);Ea(i,t,u,ge(i))}else Ea(i,t,n,ge(i))}catch(h){Ea(i,t,{then:function(){},status:"rejected",reason:h},ge())}finally{Z.p=a,r!==null&&o.types!==null&&(r.types=o.types),k.T=r}}function UA(){}function Ru(i,t,e,n){if(i.tag!==5)throw Error(x(476));var s=o0(i).queue;r0(i,s,t,dn,e===null?UA:function(){return l0(i),e(n)})}function o0(i){var t=i.memoizedState;if(t!==null)return t;t={memoizedState:dn,baseState:dn,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mi,lastRenderedState:dn},next:null};var e={};return t.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mi,lastRenderedState:e},next:null},i.memoizedState=t,i=i.alternate,i!==null&&(i.memoizedState=t),t}function l0(i){var t=o0(i);t.next===null&&(t=i.alternate.memoizedState),Ea(i,t.next.queue,{},ge())}function Oh(){return Vt(Fa)}function c0(){return xt().memoizedState}function u0(){return xt().memoizedState}function GA(i){for(var t=i.return;t!==null;){switch(t.tag){case 24:case 3:var e=ge();i=ji(e);var n=Vi(t,i,e);n!==null&&(ne(n,t,e),va(n,t,e)),t={cache:gh()},i.payload=t;return}t=t.return}}function jA(i,t,e){var n=ge();e={lane:n,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},tl(i)?d0(t,e):(e=hh(i,t,e,n),e!==null&&(ne(e,i,n),f0(e,t,n)))}function h0(i,t,e){var n=ge();Ea(i,t,e,n)}function Ea(i,t,e,n){var s={lane:n,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null};if(tl(i))d0(t,s);else{var a=i.alternate;if(i.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var r=t.lastRenderedState,o=a(r,e);if(s.hasEagerState=!0,s.eagerState=o,me(o,r))return Wo(i,t,s,0),ot===null&&Ko(),!1}catch{}if(e=hh(i,t,s,n),e!==null)return ne(e,i,n),f0(e,t,n),!0}return!1}function Rh(i,t,e,n){if(n={lane:2,revertLane:Hh(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},tl(i)){if(t)throw Error(x(479))}else t=hh(i,e,n,2),t!==null&&ne(t,i,2)}function tl(i){var t=i.alternate;return i===U||t!==null&&t===U}function d0(i,t){hs=Co=!0;var e=i.pending;e===null?t.next=t:(t.next=e.next,e.next=t),i.pending=t}function f0(i,t,e){if((e&4194048)!==0){var n=t.lanes;n&=i.pendingLanes,e|=n,t.lanes=e,Zg(i,e)}}var za={readContext:Vt,use:Zo,useCallback:Tt,useContext:Tt,useEffect:Tt,useImperativeHandle:Tt,useLayoutEffect:Tt,useInsertionEffect:Tt,useMemo:Tt,useReducer:Tt,useRef:Tt,useState:Tt,useDebugValue:Tt,useDeferredValue:Tt,useTransition:Tt,useSyncExternalStore:Tt,useId:Tt,useHostTransitionStatus:Tt,useFormState:Tt,useActionState:Tt,useOptimistic:Tt,useMemoCache:Tt,useCacheRefresh:Tt};za.useEffectEvent=Tt;var p0={readContext:Vt,use:Zo,useCallback:function(i,t){return Zt().memoizedState=[i,t===void 0?null:t],i},useContext:Vt,useEffect:$p,useImperativeHandle:function(i,t,e){e=e!=null?e.concat([i]):null,ro(4194308,4,e0.bind(null,t,i),e)},useLayoutEffect:function(i,t){return ro(4194308,4,i,t)},useInsertionEffect:function(i,t){ro(4,2,i,t)},useMemo:function(i,t){var e=Zt();t=t===void 0?null:t;var n=i();if(An){zi(!0);try{i()}finally{zi(!1)}}return e.memoizedState=[n,t],n},useReducer:function(i,t,e){var n=Zt();if(e!==void 0){var s=e(t);if(An){zi(!0);try{e(t)}finally{zi(!1)}}}else s=t;return n.memoizedState=n.baseState=s,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:s},n.queue=i,i=i.dispatch=jA.bind(null,U,i),[n.memoizedState,i]},useRef:function(i){var t=Zt();return i={current:i},t.memoizedState=i},useState:function(i){i=Du(i);var t=i.queue,e=h0.bind(null,U,t);return t.dispatch=e,[i.memoizedState,e]},useDebugValue:Mh,useDeferredValue:function(i,t){var e=Zt();return Dh(e,i,t)},useTransition:function(){var i=Du(!1);return i=r0.bind(null,U,i.queue,!0,!1),Zt().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,t,e){var n=U,s=Zt();if(K){if(e===void 0)throw Error(x(407));e=e()}else{if(e=t(),ot===null)throw Error(x(349));(Y&127)!==0||Um(n,t,e)}s.memoizedState=e;var a={value:e,getSnapshot:t};return s.queue=a,$p(jm.bind(null,n,a,i),[i]),n.flags|=2048,bs(9,{destroy:void 0},Gm.bind(null,n,a,e,t),null),e},useId:function(){var i=Zt(),t=ot.identifierPrefix;if(K){var e=Ye,n=Xe;e=(n&~(1<<32-pe(n)-1)).toString(32)+e,t="_"+t+"R_"+e,e=Mo++,0<e&&(t+="H"+e.toString(32)),t+="_"}else e=zA++,t="_"+t+"r_"+e.toString(32)+"_";return i.memoizedState=t},useHostTransitionStatus:Oh,useFormState:Kp,useActionState:Kp,useOptimistic:function(i){var t=Zt();t.memoizedState=t.baseState=i;var e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=e,t=Rh.bind(null,U,!0,e),e.dispatch=t,[i,t]},useMemoCache:_h,useCacheRefresh:function(){return Zt().memoizedState=GA.bind(null,U)},useEffectEvent:function(i){var t=Zt(),e={impl:i};return t.memoizedState=e,function(){if(($&2)!==0)throw Error(x(440));return e.impl.apply(void 0,arguments)}}},Nh={readContext:Vt,use:Zo,useCallback:n0,useContext:Vt,useEffect:Ch,useImperativeHandle:i0,useInsertionEffect:Jm,useLayoutEffect:t0,useMemo:s0,useReducer:ao,useRef:$m,useState:function(){return ao(mi)},useDebugValue:Mh,useDeferredValue:function(i,t){var e=xt();return a0(e,st.memoizedState,i,t)},useTransition:function(){var i=ao(mi)[0],t=xt().memoizedState;return[typeof i=="boolean"?i:Wa(i),t]},useSyncExternalStore:Hm,useId:c0,useHostTransitionStatus:Oh,useFormState:Wp,useActionState:Wp,useOptimistic:function(i,t){var e=xt();return Ym(e,st,i,t)},useMemoCache:_h,useCacheRefresh:u0};Nh.useEffectEvent=Zm;var g0={readContext:Vt,use:Zo,useCallback:n0,useContext:Vt,useEffect:Ch,useImperativeHandle:i0,useInsertionEffect:Jm,useLayoutEffect:t0,useMemo:s0,useReducer:Fc,useRef:$m,useState:function(){return Fc(mi)},useDebugValue:Mh,useDeferredValue:function(i,t){var e=xt();return st===null?Dh(e,i,t):a0(e,st.memoizedState,i,t)},useTransition:function(){var i=Fc(mi)[0],t=xt().memoizedState;return[typeof i=="boolean"?i:Wa(i),t]},useSyncExternalStore:Hm,useId:c0,useHostTransitionStatus:Oh,useFormState:Qp,useActionState:Qp,useOptimistic:function(i,t){var e=xt();return st!==null?Ym(e,st,i,t):(e.baseState=i,[i,e.queue.dispatch])},useMemoCache:_h,useCacheRefresh:u0};g0.useEffectEvent=Zm;function Hc(i,t,e,n){t=i.memoizedState,e=e(n,t),e=e==null?t:gt({},t,e),i.memoizedState=e,i.lanes===0&&(i.updateQueue.baseState=e)}var Nu={enqueueSetState:function(i,t,e){i=i._reactInternals;var n=ge(),s=ji(n);s.payload=t,e!=null&&(s.callback=e),t=Vi(i,s,n),t!==null&&(ne(t,i,n),va(t,i,n))},enqueueReplaceState:function(i,t,e){i=i._reactInternals;var n=ge(),s=ji(n);s.tag=1,s.payload=t,e!=null&&(s.callback=e),t=Vi(i,s,n),t!==null&&(ne(t,i,n),va(t,i,n))},enqueueForceUpdate:function(i,t){i=i._reactInternals;var e=ge(),n=ji(e);n.tag=2,t!=null&&(n.callback=t),t=Vi(i,n,e),t!==null&&(ne(t,i,e),va(t,i,e))}};function Zp(i,t,e,n,s,a,r){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(n,a,r):t.prototype&&t.prototype.isPureReactComponent?!Ra(e,n)||!Ra(s,a):!0}function Jp(i,t,e,n){i=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(e,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(e,n),t.state!==i&&Nu.enqueueReplaceState(t,t.state,null)}function Sn(i,t){var e=t;if("ref"in t){e={};for(var n in t)n!=="ref"&&(e[n]=t[n])}if(i=i.defaultProps){e===t&&(e=gt({},e));for(var s in i)e[s]===void 0&&(e[s]=i[s])}return e}function m0(i){Ao(i)}function y0(i){console.error(i)}function b0(i){Ao(i)}function Do(i,t){try{var e=i.onUncaughtError;e(t.value,{componentStack:t.stack})}catch(n){setTimeout(function(){throw n})}}function tg(i,t,e){try{var n=i.onCaughtError;n(e.value,{componentStack:e.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(s){setTimeout(function(){throw s})}}function Lu(i,t,e){return e=ji(e),e.tag=3,e.payload={element:null},e.callback=function(){Do(i,t)},e}function v0(i){return i=ji(i),i.tag=3,i}function A0(i,t,e,n){var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var a=n.value;i.payload=function(){return s(a)},i.callback=function(){tg(t,e,n)}}var r=e.stateNode;r!==null&&typeof r.componentDidCatch=="function"&&(i.callback=function(){tg(t,e,n),typeof s!="function"&&(Xi===null?Xi=new Set([this]):Xi.add(this));var o=n.stack;this.componentDidCatch(n.value,{componentStack:o!==null?o:""})})}function VA(i,t,e,n,s){if(e.flags|=32768,n!==null&&typeof n=="object"&&typeof n.then=="function"){if(t=e.alternate,t!==null&&xs(t,e,s,!0),e=ye.current,e!==null){switch(e.tag){case 31:case 13:return Ne===null?ko():e.alternate===null&&wt===0&&(wt=3),e.flags&=-257,e.flags|=65536,e.lanes=s,n===wo?e.flags|=16384:(t=e.updateQueue,t===null?e.updateQueue=new Set([n]):t.add(n),$c(i,n,s)),!1;case 22:return e.flags|=65536,n===wo?e.flags|=16384:(t=e.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([n])},e.updateQueue=t):(e=t.retryQueue,e===null?t.retryQueue=new Set([n]):e.add(n)),$c(i,n,s)),!1}throw Error(x(435,e.tag))}return $c(i,n,s),ko(),!1}if(K)return t=ye.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=s,n!==Au&&(i=Error(x(422),{cause:n}),La(Oe(i,e)))):(n!==Au&&(t=Error(x(423),{cause:n}),La(Oe(t,e))),i=i.current.alternate,i.flags|=65536,s&=-s,i.lanes|=s,n=Oe(n,e),s=Lu(i.stateNode,n,s),Ic(i,s),wt!==4&&(wt=2)),!1;var a=Error(x(520),{cause:n});if(a=Oe(a,e),_a===null?_a=[a]:_a.push(a),wt!==4&&(wt=2),t===null)return!0;n=Oe(n,e),e=t;do{switch(e.tag){case 3:return e.flags|=65536,i=s&-s,e.lanes|=i,i=Lu(e.stateNode,n,i),Ic(e,i),!1;case 1:if(t=e.type,a=e.stateNode,(e.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||a!==null&&typeof a.componentDidCatch=="function"&&(Xi===null||!Xi.has(a))))return e.flags|=65536,s&=-s,e.lanes|=s,s=v0(s),A0(s,i,e,n),Ic(e,s),!1}e=e.return}while(e!==null);return!1}var Lh=Error(x(461)),Rt=!1;function Ut(i,t,e,n){t.child=i===null?km(t,null,e,n):vn(t,i.child,e,n)}function eg(i,t,e,n,s){e=e.render;var a=t.ref;if("ref"in n){var r={};for(var o in n)o!=="ref"&&(r[o]=n[o])}else r=n;return bn(t),n=Sh(i,t,e,r,a,s),o=Eh(),i!==null&&!Rt?(Th(i,t,s),yi(i,t,s)):(K&&o&&fh(t),t.flags|=1,Ut(i,t,n,s),t.child)}function ig(i,t,e,n,s){if(i===null){var a=e.type;return typeof a=="function"&&!dh(a)&&a.defaultProps===void 0&&e.compare===null?(t.tag=15,t.type=a,S0(i,t,a,n,s)):(i=no(e.type,null,n,t,t.mode,s),i.ref=t.ref,i.return=t,t.child=i)}if(a=i.child,!kh(i,s)){var r=a.memoizedProps;if(e=e.compare,e=e!==null?e:Ra,e(r,n)&&i.ref===t.ref)return yi(i,t,s)}return t.flags|=1,i=hi(a,n),i.ref=t.ref,i.return=t,t.child=i}function S0(i,t,e,n,s){if(i!==null){var a=i.memoizedProps;if(Ra(a,n)&&i.ref===t.ref)if(Rt=!1,t.pendingProps=n=a,kh(i,s))(i.flags&131072)!==0&&(Rt=!0);else return t.lanes=i.lanes,yi(i,t,s)}return ku(i,t,e,n,s)}function E0(i,t,e,n){var s=n.children,a=i!==null?i.memoizedState:null;if(i===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.mode==="hidden"){if((t.flags&128)!==0){if(a=a!==null?a.baseLanes|e:e,i!==null){for(n=t.child=i.child,s=0;n!==null;)s=s|n.lanes|n.childLanes,n=n.sibling;n=s&~a}else n=0,t.child=null;return ng(i,t,a,e,n)}if((e&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},i!==null&&so(t,a!==null?a.cachePool:null),a!==null?Xp(t,a):Cu(),Pm(t);else return n=t.lanes=536870912,ng(i,t,a!==null?a.baseLanes|e:e,e,n)}else a!==null?(so(t,a.cachePool),Xp(t,a),ki(t),t.memoizedState=null):(i!==null&&so(t,null),Cu(),ki(t));return Ut(i,t,s,e),t.child}function fa(i,t){return i!==null&&i.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ng(i,t,e,n,s){var a=mh();return a=a===null?null:{parent:Ot._currentValue,pool:a},t.memoizedState={baseLanes:e,cachePool:a},i!==null&&so(t,null),Cu(),Pm(t),i!==null&&xs(i,t,n,!0),t.childLanes=s,null}function oo(i,t){return t=Oo({mode:t.mode,children:t.children},i.mode),t.ref=i.ref,i.child=t,t.return=i,t}function sg(i,t,e){return vn(t,i.child,null,e),i=oo(t,t.pendingProps),i.flags|=2,ce(t),t.memoizedState=null,i}function XA(i,t,e){var n=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,i===null){if(K){if(n.mode==="hidden")return i=oo(t,n),t.lanes=536870912,fa(null,i);if(Mu(t),(i=pt)?(i=py(i,Re),i=i!==null&&i.data==="&"?i:null,i!==null&&(t.memoizedState={dehydrated:i,treeContext:Qi!==null?{id:Xe,overflow:Ye}:null,retryLane:536870912,hydrationErrors:null},e=Cm(i),e.return=t,t.child=e,jt=t,pt=null)):i=null,i===null)throw $i(t);return t.lanes=536870912,null}return oo(t,n)}var a=i.memoizedState;if(a!==null){var r=a.dehydrated;if(Mu(t),s)if(t.flags&256)t.flags&=-257,t=sg(i,t,e);else if(t.memoizedState!==null)t.child=i.child,t.flags|=128,t=null;else throw Error(x(558));else if(Rt||xs(i,t,e,!1),s=(e&i.childLanes)!==0,Rt||s){if(n=ot,n!==null&&(r=Jg(n,e),r!==0&&r!==a.retryLane))throw a.retryLane=r,_n(i,r),ne(n,i,r),Lh;ko(),t=sg(i,t,e)}else i=a.treeContext,pt=Le(r.nextSibling),jt=t,K=!0,Gi=null,Re=!1,i!==null&&Dm(t,i),t=oo(t,n),t.flags|=4096;return t}return i=hi(i.child,{mode:n.mode,children:n.children}),i.ref=t.ref,t.child=i,i.return=t,i}function lo(i,t){var e=t.ref;if(e===null)i!==null&&i.ref!==null&&(t.flags|=4194816);else{if(typeof e!="function"&&typeof e!="object")throw Error(x(284));(i===null||i.ref!==e)&&(t.flags|=4194816)}}function ku(i,t,e,n,s){return bn(t),e=Sh(i,t,e,n,void 0,s),n=Eh(),i!==null&&!Rt?(Th(i,t,s),yi(i,t,s)):(K&&n&&fh(t),t.flags|=1,Ut(i,t,e,s),t.child)}function ag(i,t,e,n,s,a){return bn(t),t.updateQueue=null,e=Fm(t,n,e,s),Im(i),n=Eh(),i!==null&&!Rt?(Th(i,t,a),yi(i,t,a)):(K&&n&&fh(t),t.flags|=1,Ut(i,t,e,a),t.child)}function rg(i,t,e,n,s){if(bn(t),t.stateNode===null){var a=is,r=e.contextType;typeof r=="object"&&r!==null&&(a=Vt(r)),a=new e(n,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Nu,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=n,a.state=t.memoizedState,a.refs={},bh(t),r=e.contextType,a.context=typeof r=="object"&&r!==null?Vt(r):is,a.state=t.memoizedState,r=e.getDerivedStateFromProps,typeof r=="function"&&(Hc(t,e,r,n),a.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof a.getSnapshotBeforeUpdate=="function"||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(r=a.state,typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount(),r!==a.state&&Nu.enqueueReplaceState(a,a.state,null),Sa(t,n,a,s),Aa(),a.state=t.memoizedState),typeof a.componentDidMount=="function"&&(t.flags|=4194308),n=!0}else if(i===null){a=t.stateNode;var o=t.memoizedProps,l=Sn(e,o);a.props=l;var c=a.context,u=e.contextType;r=is,typeof u=="object"&&u!==null&&(r=Vt(u));var h=e.getDerivedStateFromProps;u=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function",o=t.pendingProps!==o,u||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o||c!==r)&&Jp(t,a,n,r),Ri=!1;var d=t.memoizedState;a.state=d,Sa(t,n,a,s),Aa(),c=t.memoizedState,o||d!==c||Ri?(typeof h=="function"&&(Hc(t,e,h,n),c=t.memoizedState),(l=Ri||Zp(t,e,l,n,d,c,r))?(u||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=c),a.props=n,a.state=c,a.context=r,n=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{a=t.stateNode,_u(i,t),r=t.memoizedProps,u=Sn(e,r),a.props=u,h=t.pendingProps,d=a.context,c=e.contextType,l=is,typeof c=="object"&&c!==null&&(l=Vt(c)),o=e.getDerivedStateFromProps,(c=typeof o=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(r!==h||d!==l)&&Jp(t,a,n,l),Ri=!1,d=t.memoizedState,a.state=d,Sa(t,n,a,s),Aa();var f=t.memoizedState;r!==h||d!==f||Ri||i!==null&&i.dependencies!==null&&To(i.dependencies)?(typeof o=="function"&&(Hc(t,e,o,n),f=t.memoizedState),(u=Ri||Zp(t,e,u,n,d,f,l)||i!==null&&i.dependencies!==null&&To(i.dependencies))?(c||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,f,l),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,f,l)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||r===i.memoizedProps&&d===i.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||r===i.memoizedProps&&d===i.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=f),a.props=n,a.state=f,a.context=l,n=u):(typeof a.componentDidUpdate!="function"||r===i.memoizedProps&&d===i.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||r===i.memoizedProps&&d===i.memoizedState||(t.flags|=1024),n=!1)}return a=n,lo(i,t),n=(t.flags&128)!==0,a||n?(a=t.stateNode,e=n&&typeof e.getDerivedStateFromError!="function"?null:a.render(),t.flags|=1,i!==null&&n?(t.child=vn(t,i.child,null,s),t.child=vn(t,null,e,s)):Ut(i,t,e,s),t.memoizedState=a.state,i=t.child):i=yi(i,t,s),i}function og(i,t,e,n){return yn(),t.flags|=256,Ut(i,t,e,n),t.child}var Uc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Gc(i){return{baseLanes:i,cachePool:Rm()}}function jc(i,t,e){return i=i!==null?i.childLanes&~e:0,t&&(i|=he),i}function T0(i,t,e){var n=t.pendingProps,s=!1,a=(t.flags&128)!==0,r;if((r=a)||(r=i!==null&&i.memoizedState===null?!1:(_t.current&2)!==0),r&&(s=!0,t.flags&=-129),r=(t.flags&32)!==0,t.flags&=-33,i===null){if(K){if(s?Li(t):ki(t),(i=pt)?(i=py(i,Re),i=i!==null&&i.data!=="&"?i:null,i!==null&&(t.memoizedState={dehydrated:i,treeContext:Qi!==null?{id:Xe,overflow:Ye}:null,retryLane:536870912,hydrationErrors:null},e=Cm(i),e.return=t,t.child=e,jt=t,pt=null)):i=null,i===null)throw $i(t);return Ku(i)?t.lanes=32:t.lanes=536870912,null}var o=n.children;return n=n.fallback,s?(ki(t),s=t.mode,o=Oo({mode:"hidden",children:o},s),n=fn(n,s,e,null),o.return=t,n.return=t,o.sibling=n,t.child=o,n=t.child,n.memoizedState=Gc(e),n.childLanes=jc(i,r,e),t.memoizedState=Uc,fa(null,n)):(Li(t),Bu(t,o))}var l=i.memoizedState;if(l!==null&&(o=l.dehydrated,o!==null)){if(a)t.flags&256?(Li(t),t.flags&=-257,t=Vc(i,t,e)):t.memoizedState!==null?(ki(t),t.child=i.child,t.flags|=128,t=null):(ki(t),o=n.fallback,s=t.mode,n=Oo({mode:"visible",children:n.children},s),o=fn(o,s,e,null),o.flags|=2,n.return=t,o.return=t,n.sibling=o,t.child=n,vn(t,i.child,null,e),n=t.child,n.memoizedState=Gc(e),n.childLanes=jc(i,r,e),t.memoizedState=Uc,t=fa(null,n));else if(Li(t),Ku(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var c=r.dgst;r=c,n=Error(x(419)),n.stack="",n.digest=r,La({value:n,source:null,stack:null}),t=Vc(i,t,e)}else if(Rt||xs(i,t,e,!1),r=(e&i.childLanes)!==0,Rt||r){if(r=ot,r!==null&&(n=Jg(r,e),n!==0&&n!==l.retryLane))throw l.retryLane=n,_n(i,n),ne(r,i,n),Lh;qu(o)||ko(),t=Vc(i,t,e)}else qu(o)?(t.flags|=192,t.child=i.child,t=null):(i=l.treeContext,pt=Le(o.nextSibling),jt=t,K=!0,Gi=null,Re=!1,i!==null&&Dm(t,i),t=Bu(t,n.children),t.flags|=4096);return t}return s?(ki(t),o=n.fallback,s=t.mode,l=i.child,c=l.sibling,n=hi(l,{mode:"hidden",children:n.children}),n.subtreeFlags=l.subtreeFlags&65011712,c!==null?o=hi(c,o):(o=fn(o,s,e,null),o.flags|=2),o.return=t,n.return=t,n.sibling=o,t.child=n,fa(null,n),n=t.child,o=i.child.memoizedState,o===null?o=Gc(e):(s=o.cachePool,s!==null?(l=Ot._currentValue,s=s.parent!==l?{parent:l,pool:l}:s):s=Rm(),o={baseLanes:o.baseLanes|e,cachePool:s}),n.memoizedState=o,n.childLanes=jc(i,r,e),t.memoizedState=Uc,fa(i.child,n)):(Li(t),e=i.child,i=e.sibling,e=hi(e,{mode:"visible",children:n.children}),e.return=t,e.sibling=null,i!==null&&(r=t.deletions,r===null?(t.deletions=[i],t.flags|=16):r.push(i)),t.child=e,t.memoizedState=null,e)}function Bu(i,t){return t=Oo({mode:"visible",children:t},i.mode),t.return=i,i.child=t}function Oo(i,t){return i=ue(22,i,null,t),i.lanes=0,i}function Vc(i,t,e){return vn(t,i.child,null,e),i=Bu(t,t.pendingProps.children),i.flags|=2,t.memoizedState=null,i}function lg(i,t,e){i.lanes|=t;var n=i.alternate;n!==null&&(n.lanes|=t),Eu(i.return,t,e)}function Xc(i,t,e,n,s,a){var r=i.memoizedState;r===null?i.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:e,tailMode:s,treeForkCount:a}:(r.isBackwards=t,r.rendering=null,r.renderingStartTime=0,r.last=n,r.tail=e,r.tailMode=s,r.treeForkCount=a)}function w0(i,t,e){var n=t.pendingProps,s=n.revealOrder,a=n.tail;n=n.children;var r=_t.current,o=(r&2)!==0;if(o?(r=r&1|2,t.flags|=128):r&=1,ct(_t,r),Ut(i,t,n,e),n=K?Na:0,!o&&i!==null&&(i.flags&128)!==0)t:for(i=t.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&lg(i,e,t);else if(i.tag===19)lg(i,e,t);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break t;for(;i.sibling===null;){if(i.return===null||i.return===t)break t;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(s){case"forwards":for(e=t.child,s=null;e!==null;)i=e.alternate,i!==null&&xo(i)===null&&(s=e),e=e.sibling;e=s,e===null?(s=t.child,t.child=null):(s=e.sibling,e.sibling=null),Xc(t,!1,s,e,a,n);break;case"backwards":case"unstable_legacy-backwards":for(e=null,s=t.child,t.child=null;s!==null;){if(i=s.alternate,i!==null&&xo(i)===null){t.child=s;break}i=s.sibling,s.sibling=e,e=s,s=i}Xc(t,!0,e,null,a,n);break;case"together":Xc(t,!1,null,null,void 0,n);break;default:t.memoizedState=null}return t.child}function yi(i,t,e){if(i!==null&&(t.dependencies=i.dependencies),Ji|=t.lanes,(e&t.childLanes)===0)if(i!==null){if(xs(i,t,e,!1),(e&t.childLanes)===0)return null}else return null;if(i!==null&&t.child!==i.child)throw Error(x(153));if(t.child!==null){for(i=t.child,e=hi(i,i.pendingProps),t.child=e,e.return=t;i.sibling!==null;)i=i.sibling,e=e.sibling=hi(i,i.pendingProps),e.return=t;e.sibling=null}return t.child}function kh(i,t){return(i.lanes&t)!==0?!0:(i=i.dependencies,!!(i!==null&&To(i)))}function YA(i,t,e){switch(t.tag){case 3:mo(t,t.stateNode.containerInfo),Ni(t,Ot,i.memoizedState.cache),yn();break;case 27:case 5:cu(t);break;case 4:mo(t,t.stateNode.containerInfo);break;case 10:Ni(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Mu(t),null;break;case 13:var n=t.memoizedState;if(n!==null)return n.dehydrated!==null?(Li(t),t.flags|=128,null):(e&t.child.childLanes)!==0?T0(i,t,e):(Li(t),i=yi(i,t,e),i!==null?i.sibling:null);Li(t);break;case 19:var s=(i.flags&128)!==0;if(n=(e&t.childLanes)!==0,n||(xs(i,t,e,!1),n=(e&t.childLanes)!==0),s){if(n)return w0(i,t,e);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),ct(_t,_t.current),n)break;return null;case 22:return t.lanes=0,E0(i,t,e,t.pendingProps);case 24:Ni(t,Ot,i.memoizedState.cache)}return yi(i,t,e)}function _0(i,t,e){if(i!==null)if(i.memoizedProps!==t.pendingProps)Rt=!0;else{if(!kh(i,e)&&(t.flags&128)===0)return Rt=!1,YA(i,t,e);Rt=(i.flags&131072)!==0}else Rt=!1,K&&(t.flags&1048576)!==0&&Mm(t,Na,t.index);switch(t.lanes=0,t.tag){case 16:t:{var n=t.pendingProps;if(i=un(t.elementType),t.type=i,typeof i=="function")dh(i)?(n=Sn(i,n),t.tag=1,t=rg(null,t,i,n,e)):(t.tag=0,t=ku(null,t,i,n,e));else{if(i!=null){var s=i.$$typeof;if(s===Zu){t.tag=11,t=eg(null,t,i,n,e);break t}else if(s===Ju){t.tag=14,t=ig(null,t,i,n,e);break t}}throw t=ou(i)||i,Error(x(306,t,""))}}return t;case 0:return ku(i,t,t.type,t.pendingProps,e);case 1:return n=t.type,s=Sn(n,t.pendingProps),rg(i,t,n,s,e);case 3:t:{if(mo(t,t.stateNode.containerInfo),i===null)throw Error(x(387));n=t.pendingProps;var a=t.memoizedState;s=a.element,_u(i,t),Sa(t,n,null,e);var r=t.memoizedState;if(n=r.cache,Ni(t,Ot,n),n!==a.cache&&Tu(t,[Ot],e,!0),Aa(),n=r.element,a.isDehydrated)if(a={element:n,isDehydrated:!1,cache:r.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=og(i,t,n,e);break t}else if(n!==s){s=Oe(Error(x(424)),t),La(s),t=og(i,t,n,e);break t}else for(i=t.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,pt=Le(i.firstChild),jt=t,K=!0,Gi=null,Re=!0,e=km(t,null,n,e),t.child=e;e;)e.flags=e.flags&-3|4096,e=e.sibling;else{if(yn(),n===s){t=yi(i,t,e);break t}Ut(i,t,n,e)}t=t.child}return t;case 26:return lo(i,t),i===null?(e=Og(t.type,null,t.pendingProps,null))?t.memoizedState=e:K||(e=t.type,i=t.pendingProps,n=Io(Ui.current).createElement(e),n[Gt]=t,n[se]=i,Xt(n,e,i),Ft(n),t.stateNode=n):t.memoizedState=Og(t.type,i.memoizedProps,t.pendingProps,i.memoizedState),null;case 27:return cu(t),i===null&&K&&(n=t.stateNode=gy(t.type,t.pendingProps,Ui.current),jt=t,Re=!0,s=pt,en(t.type)?(Wu=s,pt=Le(n.firstChild)):pt=s),Ut(i,t,t.pendingProps.children,e),lo(i,t),i===null&&(t.flags|=4194304),t.child;case 5:return i===null&&K&&((s=n=pt)&&(n=A1(n,t.type,t.pendingProps,Re),n!==null?(t.stateNode=n,jt=t,pt=Le(n.firstChild),Re=!1,s=!0):s=!1),s||$i(t)),cu(t),s=t.type,a=t.pendingProps,r=i!==null?i.memoizedProps:null,n=a.children,Xu(s,a)?n=null:r!==null&&Xu(s,r)&&(t.flags|=32),t.memoizedState!==null&&(s=Sh(i,t,PA,null,null,e),Fa._currentValue=s),lo(i,t),Ut(i,t,n,e),t.child;case 6:return i===null&&K&&((i=e=pt)&&(e=S1(e,t.pendingProps,Re),e!==null?(t.stateNode=e,jt=t,pt=null,i=!0):i=!1),i||$i(t)),null;case 13:return T0(i,t,e);case 4:return mo(t,t.stateNode.containerInfo),n=t.pendingProps,i===null?t.child=vn(t,null,n,e):Ut(i,t,n,e),t.child;case 11:return eg(i,t,t.type,t.pendingProps,e);case 7:return Ut(i,t,t.pendingProps,e),t.child;case 8:return Ut(i,t,t.pendingProps.children,e),t.child;case 12:return Ut(i,t,t.pendingProps.children,e),t.child;case 10:return n=t.pendingProps,Ni(t,t.type,n.value),Ut(i,t,n.children,e),t.child;case 9:return s=t.type._context,n=t.pendingProps.children,bn(t),s=Vt(s),n=n(s),t.flags|=1,Ut(i,t,n,e),t.child;case 14:return ig(i,t,t.type,t.pendingProps,e);case 15:return S0(i,t,t.type,t.pendingProps,e);case 19:return w0(i,t,e);case 31:return XA(i,t,e);case 22:return E0(i,t,e,t.pendingProps);case 24:return bn(t),n=Vt(Ot),i===null?(s=mh(),s===null&&(s=ot,a=gh(),s.pooledCache=a,a.refCount++,a!==null&&(s.pooledCacheLanes|=e),s=a),t.memoizedState={parent:n,cache:s},bh(t),Ni(t,Ot,s)):((i.lanes&e)!==0&&(_u(i,t),Sa(t,null,null,e),Aa()),s=i.memoizedState,a=t.memoizedState,s.parent!==n?(s={parent:n,cache:n},t.memoizedState=s,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=s),Ni(t,Ot,n)):(n=a.cache,Ni(t,Ot,n),n!==s.cache&&Tu(t,[Ot],e,!0))),Ut(i,t,t.pendingProps.children,e),t.child;case 29:throw t.pendingProps}throw Error(x(156,t.tag))}function ii(i){i.flags|=4}function Yc(i,t,e,n,s){if((t=(i.mode&32)!==0)&&(t=!1),t){if(i.flags|=16777216,(s&335544128)===s)if(i.stateNode.complete)i.flags|=8192;else if(W0())i.flags|=8192;else throw gn=wo,yh}else i.flags&=-16777217}function cg(i,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!by(t))if(W0())i.flags|=8192;else throw gn=wo,yh}function Yr(i,t){t!==null&&(i.flags|=4),i.flags&16384&&(t=i.tag!==22?Qg():536870912,i.lanes|=t,vs|=t)}function ra(i,t){if(!K)switch(i.tailMode){case"hidden":t=i.tail;for(var e=null;t!==null;)t.alternate!==null&&(e=t),t=t.sibling;e===null?i.tail=null:e.sibling=null;break;case"collapsed":e=i.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t||i.tail===null?i.tail=null:i.tail.sibling=null:n.sibling=null}}function ft(i){var t=i.alternate!==null&&i.alternate.child===i.child,e=0,n=0;if(t)for(var s=i.child;s!==null;)e|=s.lanes|s.childLanes,n|=s.subtreeFlags&65011712,n|=s.flags&65011712,s.return=i,s=s.sibling;else for(s=i.child;s!==null;)e|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=i,s=s.sibling;return i.subtreeFlags|=n,i.childLanes=e,t}function qA(i,t,e){var n=t.pendingProps;switch(ph(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ft(t),null;case 1:return ft(t),null;case 3:return e=t.stateNode,n=null,i!==null&&(n=i.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),di(Ot),fs(),e.pendingContext&&(e.context=e.pendingContext,e.pendingContext=null),(i===null||i.child===null)&&(Vn(t)?ii(t):i===null||i.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Pc())),ft(t),null;case 26:var s=t.type,a=t.memoizedState;return i===null?(ii(t),a!==null?(ft(t),cg(t,a)):(ft(t),Yc(t,s,null,n,e))):a?a!==i.memoizedState?(ii(t),ft(t),cg(t,a)):(ft(t),t.flags&=-16777217):(i=i.memoizedProps,i!==n&&ii(t),ft(t),Yc(t,s,i,n,e)),null;case 27:if(yo(t),e=Ui.current,s=t.type,i!==null&&t.stateNode!=null)i.memoizedProps!==n&&ii(t);else{if(!n){if(t.stateNode===null)throw Error(x(166));return ft(t),null}i=Ke.current,Vn(t)?Ip(t,i):(i=gy(s,n,e),t.stateNode=i,ii(t))}return ft(t),null;case 5:if(yo(t),s=t.type,i!==null&&t.stateNode!=null)i.memoizedProps!==n&&ii(t);else{if(!n){if(t.stateNode===null)throw Error(x(166));return ft(t),null}if(a=Ke.current,Vn(t))Ip(t,a);else{var r=Io(Ui.current);switch(a){case 1:a=r.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:a=r.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":a=r.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":a=r.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":a=r.createElement("div"),a.innerHTML="<script><\/script>",a=a.removeChild(a.firstChild);break;case"select":a=typeof n.is=="string"?r.createElement("select",{is:n.is}):r.createElement("select"),n.multiple?a.multiple=!0:n.size&&(a.size=n.size);break;default:a=typeof n.is=="string"?r.createElement(s,{is:n.is}):r.createElement(s)}}a[Gt]=t,a[se]=n;t:for(r=t.child;r!==null;){if(r.tag===5||r.tag===6)a.appendChild(r.stateNode);else if(r.tag!==4&&r.tag!==27&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break t;for(;r.sibling===null;){if(r.return===null||r.return===t)break t;r=r.return}r.sibling.return=r.return,r=r.sibling}t.stateNode=a;t:switch(Xt(a,s,n),s){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break t;case"img":n=!0;break t;default:n=!1}n&&ii(t)}}return ft(t),Yc(t,t.type,i===null?null:i.memoizedProps,t.pendingProps,e),null;case 6:if(i&&t.stateNode!=null)i.memoizedProps!==n&&ii(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(x(166));if(i=Ui.current,Vn(t)){if(i=t.stateNode,e=t.memoizedProps,n=null,s=jt,s!==null)switch(s.tag){case 27:case 5:n=s.memoizedProps}i[Gt]=t,i=!!(i.nodeValue===e||n!==null&&n.suppressHydrationWarning===!0||hy(i.nodeValue,e)),i||$i(t,!0)}else i=Io(i).createTextNode(n),i[Gt]=t,t.stateNode=i}return ft(t),null;case 31:if(e=t.memoizedState,i===null||i.memoizedState!==null){if(n=Vn(t),e!==null){if(i===null){if(!n)throw Error(x(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(x(557));i[Gt]=t}else yn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ft(t),i=!1}else e=Pc(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=e),i=!0;if(!i)return t.flags&256?(ce(t),t):(ce(t),null);if((t.flags&128)!==0)throw Error(x(558))}return ft(t),null;case 13:if(n=t.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(s=Vn(t),n!==null&&n.dehydrated!==null){if(i===null){if(!s)throw Error(x(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(x(317));s[Gt]=t}else yn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ft(t),s=!1}else s=Pc(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(ce(t),t):(ce(t),null)}return ce(t),(t.flags&128)!==0?(t.lanes=e,t):(e=n!==null,i=i!==null&&i.memoizedState!==null,e&&(n=t.child,s=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(s=n.alternate.memoizedState.cachePool.pool),a=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(a=n.memoizedState.cachePool.pool),a!==s&&(n.flags|=2048)),e!==i&&e&&(t.child.flags|=8192),Yr(t,t.updateQueue),ft(t),null);case 4:return fs(),i===null&&Uh(t.stateNode.containerInfo),ft(t),null;case 10:return di(t.type),ft(t),null;case 19:if(Ht(_t),n=t.memoizedState,n===null)return ft(t),null;if(s=(t.flags&128)!==0,a=n.rendering,a===null)if(s)ra(n,!1);else{if(wt!==0||i!==null&&(i.flags&128)!==0)for(i=t.child;i!==null;){if(a=xo(i),a!==null){for(t.flags|=128,ra(n,!1),i=a.updateQueue,t.updateQueue=i,Yr(t,i),t.subtreeFlags=0,i=e,e=t.child;e!==null;)xm(e,i),e=e.sibling;return ct(_t,_t.current&1|2),K&&ri(t,n.treeForkCount),t.child}i=i.sibling}n.tail!==null&&de()>No&&(t.flags|=128,s=!0,ra(n,!1),t.lanes=4194304)}else{if(!s)if(i=xo(a),i!==null){if(t.flags|=128,s=!0,i=i.updateQueue,t.updateQueue=i,Yr(t,i),ra(n,!0),n.tail===null&&n.tailMode==="hidden"&&!a.alternate&&!K)return ft(t),null}else 2*de()-n.renderingStartTime>No&&e!==536870912&&(t.flags|=128,s=!0,ra(n,!1),t.lanes=4194304);n.isBackwards?(a.sibling=t.child,t.child=a):(i=n.last,i!==null?i.sibling=a:t.child=a,n.last=a)}return n.tail!==null?(i=n.tail,n.rendering=i,n.tail=i.sibling,n.renderingStartTime=de(),i.sibling=null,e=_t.current,ct(_t,s?e&1|2:e&1),K&&ri(t,n.treeForkCount),i):(ft(t),null);case 22:case 23:return ce(t),vh(),n=t.memoizedState!==null,i!==null?i.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(e&536870912)!==0&&(t.flags&128)===0&&(ft(t),t.subtreeFlags&6&&(t.flags|=8192)):ft(t),e=t.updateQueue,e!==null&&Yr(t,e.retryQueue),e=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(e=i.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==e&&(t.flags|=2048),i!==null&&Ht(pn),null;case 24:return e=null,i!==null&&(e=i.memoizedState.cache),t.memoizedState.cache!==e&&(t.flags|=2048),di(Ot),ft(t),null;case 25:return null;case 30:return null}throw Error(x(156,t.tag))}function KA(i,t){switch(ph(t),t.tag){case 1:return i=t.flags,i&65536?(t.flags=i&-65537|128,t):null;case 3:return di(Ot),fs(),i=t.flags,(i&65536)!==0&&(i&128)===0?(t.flags=i&-65537|128,t):null;case 26:case 27:case 5:return yo(t),null;case 31:if(t.memoizedState!==null){if(ce(t),t.alternate===null)throw Error(x(340));yn()}return i=t.flags,i&65536?(t.flags=i&-65537|128,t):null;case 13:if(ce(t),i=t.memoizedState,i!==null&&i.dehydrated!==null){if(t.alternate===null)throw Error(x(340));yn()}return i=t.flags,i&65536?(t.flags=i&-65537|128,t):null;case 19:return Ht(_t),null;case 4:return fs(),null;case 10:return di(t.type),null;case 22:case 23:return ce(t),vh(),i!==null&&Ht(pn),i=t.flags,i&65536?(t.flags=i&-65537|128,t):null;case 24:return di(Ot),null;case 25:return null;default:return null}}function x0(i,t){switch(ph(t),t.tag){case 3:di(Ot),fs();break;case 26:case 27:case 5:yo(t);break;case 4:fs();break;case 31:t.memoizedState!==null&&ce(t);break;case 13:ce(t);break;case 19:Ht(_t);break;case 10:di(t.type);break;case 22:case 23:ce(t),vh(),i!==null&&Ht(pn);break;case 24:di(Ot)}}function Qa(i,t){try{var e=t.updateQueue,n=e!==null?e.lastEffect:null;if(n!==null){var s=n.next;e=s;do{if((e.tag&i)===i){n=void 0;var a=e.create,r=e.inst;n=a(),r.destroy=n}e=e.next}while(e!==s)}}catch(o){it(t,t.return,o)}}function Zi(i,t,e){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var a=s.next;n=a;do{if((n.tag&i)===i){var r=n.inst,o=r.destroy;if(o!==void 0){r.destroy=void 0,s=t;var l=e,c=o;try{c()}catch(u){it(s,l,u)}}}n=n.next}while(n!==a)}}catch(u){it(t,t.return,u)}}function C0(i){var t=i.updateQueue;if(t!==null){var e=i.stateNode;try{zm(t,e)}catch(n){it(i,i.return,n)}}}function M0(i,t,e){e.props=Sn(i.type,i.memoizedProps),e.state=i.memoizedState;try{e.componentWillUnmount()}catch(n){it(i,t,n)}}function Ta(i,t){try{var e=i.ref;if(e!==null){switch(i.tag){case 26:case 27:case 5:var n=i.stateNode;break;case 30:n=i.stateNode;break;default:n=i.stateNode}typeof e=="function"?i.refCleanup=e(n):e.current=n}}catch(s){it(i,t,s)}}function qe(i,t){var e=i.ref,n=i.refCleanup;if(e!==null)if(typeof n=="function")try{n()}catch(s){it(i,t,s)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(s){it(i,t,s)}else e.current=null}function D0(i){var t=i.type,e=i.memoizedProps,n=i.stateNode;try{t:switch(t){case"button":case"input":case"select":case"textarea":e.autoFocus&&n.focus();break t;case"img":e.src?n.src=e.src:e.srcSet&&(n.srcset=e.srcSet)}}catch(s){it(i,i.return,s)}}function qc(i,t,e){try{var n=i.stateNode;p1(n,i.type,e,t),n[se]=t}catch(s){it(i,i.return,s)}}function O0(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&en(i.type)||i.tag===4}function Kc(i){t:for(;;){for(;i.sibling===null;){if(i.return===null||O0(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&en(i.type)||i.flags&2||i.child===null||i.tag===4)continue t;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function zu(i,t,e){var n=i.tag;if(n===5||n===6)i=i.stateNode,t?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(i,t):(t=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,t.appendChild(i),e=e._reactRootContainer,e!=null||t.onclick!==null||(t.onclick=ci));else if(n!==4&&(n===27&&en(i.type)&&(e=i.stateNode,t=null),i=i.child,i!==null))for(zu(i,t,e),i=i.sibling;i!==null;)zu(i,t,e),i=i.sibling}function Ro(i,t,e){var n=i.tag;if(n===5||n===6)i=i.stateNode,t?e.insertBefore(i,t):e.appendChild(i);else if(n!==4&&(n===27&&en(i.type)&&(e=i.stateNode),i=i.child,i!==null))for(Ro(i,t,e),i=i.sibling;i!==null;)Ro(i,t,e),i=i.sibling}function R0(i){var t=i.stateNode,e=i.memoizedProps;try{for(var n=i.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);Xt(t,n,e),t[Gt]=i,t[se]=e}catch(a){it(i,i.return,a)}}var oi=!1,Dt=!1,Wc=!1,ug=typeof WeakSet=="function"?WeakSet:Set,It=null;function WA(i,t){if(i=i.containerInfo,ju=Go,i=bm(i),ch(i)){if("selectionStart"in i)var e={start:i.selectionStart,end:i.selectionEnd};else t:{e=(e=i.ownerDocument)&&e.defaultView||window;var n=e.getSelection&&e.getSelection();if(n&&n.rangeCount!==0){e=n.anchorNode;var s=n.anchorOffset,a=n.focusNode;n=n.focusOffset;try{e.nodeType,a.nodeType}catch{e=null;break t}var r=0,o=-1,l=-1,c=0,u=0,h=i,d=null;e:for(;;){for(var f;h!==e||s!==0&&h.nodeType!==3||(o=r+s),h!==a||n!==0&&h.nodeType!==3||(l=r+n),h.nodeType===3&&(r+=h.nodeValue.length),(f=h.firstChild)!==null;)d=h,h=f;for(;;){if(h===i)break e;if(d===e&&++c===s&&(o=r),d===a&&++u===n&&(l=r),(f=h.nextSibling)!==null)break;h=d,d=h.parentNode}h=f}e=o===-1||l===-1?null:{start:o,end:l}}else e=null}e=e||{start:0,end:0}}else e=null;for(Vu={focusedElem:i,selectionRange:e},Go=!1,It=t;It!==null;)if(t=It,i=t.child,(t.subtreeFlags&1028)!==0&&i!==null)i.return=t,It=i;else for(;It!==null;){switch(t=It,a=t.alternate,i=t.flags,t.tag){case 0:if((i&4)!==0&&(i=t.updateQueue,i=i!==null?i.events:null,i!==null))for(e=0;e<i.length;e++)s=i[e],s.ref.impl=s.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&a!==null){i=void 0,e=t,s=a.memoizedProps,a=a.memoizedState,n=e.stateNode;try{var m=Sn(e.type,s);i=n.getSnapshotBeforeUpdate(m,a),n.__reactInternalSnapshotBeforeUpdate=i}catch(y){it(e,e.return,y)}}break;case 3:if((i&1024)!==0){if(i=t.stateNode.containerInfo,e=i.nodeType,e===9)Yu(i);else if(e===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Yu(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(x(163))}if(i=t.sibling,i!==null){i.return=t.return,It=i;break}It=t.return}}function N0(i,t,e){var n=e.flags;switch(e.tag){case 0:case 11:case 15:si(i,e),n&4&&Qa(5,e);break;case 1:if(si(i,e),n&4)if(i=e.stateNode,t===null)try{i.componentDidMount()}catch(r){it(e,e.return,r)}else{var s=Sn(e.type,t.memoizedProps);t=t.memoizedState;try{i.componentDidUpdate(s,t,i.__reactInternalSnapshotBeforeUpdate)}catch(r){it(e,e.return,r)}}n&64&&C0(e),n&512&&Ta(e,e.return);break;case 3:if(si(i,e),n&64&&(i=e.updateQueue,i!==null)){if(t=null,e.child!==null)switch(e.child.tag){case 27:case 5:t=e.child.stateNode;break;case 1:t=e.child.stateNode}try{zm(i,t)}catch(r){it(e,e.return,r)}}break;case 27:t===null&&n&4&&R0(e);case 26:case 5:si(i,e),t===null&&n&4&&D0(e),n&512&&Ta(e,e.return);break;case 12:si(i,e);break;case 31:si(i,e),n&4&&B0(i,e);break;case 13:si(i,e),n&4&&z0(i,e),n&64&&(i=e.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(e=s1.bind(null,e),E1(i,e))));break;case 22:if(n=e.memoizedState!==null||oi,!n){t=t!==null&&t.memoizedState!==null||Dt,s=oi;var a=Dt;oi=n,(Dt=t)&&!a?ai(i,e,(e.subtreeFlags&8772)!==0):si(i,e),oi=s,Dt=a}break;case 30:break;default:si(i,e)}}function L0(i){var t=i.alternate;t!==null&&(i.alternate=null,L0(t)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(t=i.stateNode,t!==null&&nh(t)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var yt=null,ee=!1;function ni(i,t,e){for(e=e.child;e!==null;)k0(i,t,e),e=e.sibling}function k0(i,t,e){if(fe&&typeof fe.onCommitFiberUnmount=="function")try{fe.onCommitFiberUnmount(ja,e)}catch{}switch(e.tag){case 26:Dt||qe(e,t),ni(i,t,e),e.memoizedState?e.memoizedState.count--:e.stateNode&&(e=e.stateNode,e.parentNode.removeChild(e));break;case 27:Dt||qe(e,t);var n=yt,s=ee;en(e.type)&&(yt=e.stateNode,ee=!1),ni(i,t,e),Ca(e.stateNode),yt=n,ee=s;break;case 5:Dt||qe(e,t);case 6:if(n=yt,s=ee,yt=null,ni(i,t,e),yt=n,ee=s,yt!==null)if(ee)try{(yt.nodeType===9?yt.body:yt.nodeName==="HTML"?yt.ownerDocument.body:yt).removeChild(e.stateNode)}catch(a){it(e,t,a)}else try{yt.removeChild(e.stateNode)}catch(a){it(e,t,a)}break;case 18:yt!==null&&(ee?(i=yt,_g(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,e.stateNode),Ts(i)):_g(yt,e.stateNode));break;case 4:n=yt,s=ee,yt=e.stateNode.containerInfo,ee=!0,ni(i,t,e),yt=n,ee=s;break;case 0:case 11:case 14:case 15:Zi(2,e,t),Dt||Zi(4,e,t),ni(i,t,e);break;case 1:Dt||(qe(e,t),n=e.stateNode,typeof n.componentWillUnmount=="function"&&M0(e,t,n)),ni(i,t,e);break;case 21:ni(i,t,e);break;case 22:Dt=(n=Dt)||e.memoizedState!==null,ni(i,t,e),Dt=n;break;default:ni(i,t,e)}}function B0(i,t){if(t.memoizedState===null&&(i=t.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Ts(i)}catch(e){it(t,t.return,e)}}}function z0(i,t){if(t.memoizedState===null&&(i=t.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Ts(i)}catch(e){it(t,t.return,e)}}function QA(i){switch(i.tag){case 31:case 13:case 19:var t=i.stateNode;return t===null&&(t=i.stateNode=new ug),t;case 22:return i=i.stateNode,t=i._retryCache,t===null&&(t=i._retryCache=new ug),t;default:throw Error(x(435,i.tag))}}function qr(i,t){var e=QA(i);t.forEach(function(n){if(!e.has(n)){e.add(n);var s=a1.bind(null,i,n);n.then(s,s)}})}function Jt(i,t){var e=t.deletions;if(e!==null)for(var n=0;n<e.length;n++){var s=e[n],a=i,r=t,o=r;t:for(;o!==null;){switch(o.tag){case 27:if(en(o.type)){yt=o.stateNode,ee=!1;break t}break;case 5:yt=o.stateNode,ee=!1;break t;case 3:case 4:yt=o.stateNode.containerInfo,ee=!0;break t}o=o.return}if(yt===null)throw Error(x(160));k0(a,r,s),yt=null,ee=!1,a=s.alternate,a!==null&&(a.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)P0(t,i),t=t.sibling}var Fe=null;function P0(i,t){var e=i.alternate,n=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:Jt(t,i),te(i),n&4&&(Zi(3,i,i.return),Qa(3,i),Zi(5,i,i.return));break;case 1:Jt(t,i),te(i),n&512&&(Dt||e===null||qe(e,e.return)),n&64&&oi&&(i=i.updateQueue,i!==null&&(n=i.callbacks,n!==null&&(e=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=e===null?n:e.concat(n))));break;case 26:var s=Fe;if(Jt(t,i),te(i),n&512&&(Dt||e===null||qe(e,e.return)),n&4){var a=e!==null?e.memoizedState:null;if(n=i.memoizedState,e===null)if(n===null)if(i.stateNode===null){t:{n=i.type,e=i.memoizedProps,s=s.ownerDocument||s;e:switch(n){case"title":a=s.getElementsByTagName("title")[0],(!a||a[Ya]||a[Gt]||a.namespaceURI==="http://www.w3.org/2000/svg"||a.hasAttribute("itemprop"))&&(a=s.createElement(n),s.head.insertBefore(a,s.querySelector("head > title"))),Xt(a,n,e),a[Gt]=i,Ft(a),n=a;break t;case"link":var r=Ng("link","href",s).get(n+(e.href||""));if(r){for(var o=0;o<r.length;o++)if(a=r[o],a.getAttribute("href")===(e.href==null||e.href===""?null:e.href)&&a.getAttribute("rel")===(e.rel==null?null:e.rel)&&a.getAttribute("title")===(e.title==null?null:e.title)&&a.getAttribute("crossorigin")===(e.crossOrigin==null?null:e.crossOrigin)){r.splice(o,1);break e}}a=s.createElement(n),Xt(a,n,e),s.head.appendChild(a);break;case"meta":if(r=Ng("meta","content",s).get(n+(e.content||""))){for(o=0;o<r.length;o++)if(a=r[o],a.getAttribute("content")===(e.content==null?null:""+e.content)&&a.getAttribute("name")===(e.name==null?null:e.name)&&a.getAttribute("property")===(e.property==null?null:e.property)&&a.getAttribute("http-equiv")===(e.httpEquiv==null?null:e.httpEquiv)&&a.getAttribute("charset")===(e.charSet==null?null:e.charSet)){r.splice(o,1);break e}}a=s.createElement(n),Xt(a,n,e),s.head.appendChild(a);break;default:throw Error(x(468,n))}a[Gt]=i,Ft(a),n=a}i.stateNode=n}else Lg(s,i.type,i.stateNode);else i.stateNode=Rg(s,n,i.memoizedProps);else a!==n?(a===null?e.stateNode!==null&&(e=e.stateNode,e.parentNode.removeChild(e)):a.count--,n===null?Lg(s,i.type,i.stateNode):Rg(s,n,i.memoizedProps)):n===null&&i.stateNode!==null&&qc(i,i.memoizedProps,e.memoizedProps)}break;case 27:Jt(t,i),te(i),n&512&&(Dt||e===null||qe(e,e.return)),e!==null&&n&4&&qc(i,i.memoizedProps,e.memoizedProps);break;case 5:if(Jt(t,i),te(i),n&512&&(Dt||e===null||qe(e,e.return)),i.flags&32){s=i.stateNode;try{gs(s,"")}catch(m){it(i,i.return,m)}}n&4&&i.stateNode!=null&&(s=i.memoizedProps,qc(i,s,e!==null?e.memoizedProps:s)),n&1024&&(Wc=!0);break;case 6:if(Jt(t,i),te(i),n&4){if(i.stateNode===null)throw Error(x(162));n=i.memoizedProps,e=i.stateNode;try{e.nodeValue=n}catch(m){it(i,i.return,m)}}break;case 3:if(ho=null,s=Fe,Fe=Fo(t.containerInfo),Jt(t,i),Fe=s,te(i),n&4&&e!==null&&e.memoizedState.isDehydrated)try{Ts(t.containerInfo)}catch(m){it(i,i.return,m)}Wc&&(Wc=!1,I0(i));break;case 4:n=Fe,Fe=Fo(i.stateNode.containerInfo),Jt(t,i),te(i),Fe=n;break;case 12:Jt(t,i),te(i);break;case 31:Jt(t,i),te(i),n&4&&(n=i.updateQueue,n!==null&&(i.updateQueue=null,qr(i,n)));break;case 13:Jt(t,i),te(i),i.child.flags&8192&&i.memoizedState!==null!=(e!==null&&e.memoizedState!==null)&&(el=de()),n&4&&(n=i.updateQueue,n!==null&&(i.updateQueue=null,qr(i,n)));break;case 22:s=i.memoizedState!==null;var l=e!==null&&e.memoizedState!==null,c=oi,u=Dt;if(oi=c||s,Dt=u||l,Jt(t,i),Dt=u,oi=c,te(i),n&8192)t:for(t=i.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(e===null||l||oi||Dt||hn(i)),e=null,t=i;;){if(t.tag===5||t.tag===26){if(e===null){l=e=t;try{if(a=l.stateNode,s)r=a.style,typeof r.setProperty=="function"?r.setProperty("display","none","important"):r.display="none";else{o=l.stateNode;var h=l.memoizedProps.style,d=h!=null&&h.hasOwnProperty("display")?h.display:null;o.style.display=d==null||typeof d=="boolean"?"":(""+d).trim()}}catch(m){it(l,l.return,m)}}}else if(t.tag===6){if(e===null){l=t;try{l.stateNode.nodeValue=s?"":l.memoizedProps}catch(m){it(l,l.return,m)}}}else if(t.tag===18){if(e===null){l=t;try{var f=l.stateNode;s?xg(f,!0):xg(l.stateNode,!1)}catch(m){it(l,l.return,m)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===i)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===i)break t;for(;t.sibling===null;){if(t.return===null||t.return===i)break t;e===t&&(e=null),t=t.return}e===t&&(e=null),t.sibling.return=t.return,t=t.sibling}n&4&&(n=i.updateQueue,n!==null&&(e=n.retryQueue,e!==null&&(n.retryQueue=null,qr(i,e))));break;case 19:Jt(t,i),te(i),n&4&&(n=i.updateQueue,n!==null&&(i.updateQueue=null,qr(i,n)));break;case 30:break;case 21:break;default:Jt(t,i),te(i)}}function te(i){var t=i.flags;if(t&2){try{for(var e,n=i.return;n!==null;){if(O0(n)){e=n;break}n=n.return}if(e==null)throw Error(x(160));switch(e.tag){case 27:var s=e.stateNode,a=Kc(i);Ro(i,a,s);break;case 5:var r=e.stateNode;e.flags&32&&(gs(r,""),e.flags&=-33);var o=Kc(i);Ro(i,o,r);break;case 3:case 4:var l=e.stateNode.containerInfo,c=Kc(i);zu(i,c,l);break;default:throw Error(x(161))}}catch(u){it(i,i.return,u)}i.flags&=-3}t&4096&&(i.flags&=-4097)}function I0(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var t=i;I0(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),i=i.sibling}}function si(i,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)N0(i,t.alternate,t),t=t.sibling}function hn(i){for(i=i.child;i!==null;){var t=i;switch(t.tag){case 0:case 11:case 14:case 15:Zi(4,t,t.return),hn(t);break;case 1:qe(t,t.return);var e=t.stateNode;typeof e.componentWillUnmount=="function"&&M0(t,t.return,e),hn(t);break;case 27:Ca(t.stateNode);case 26:case 5:qe(t,t.return),hn(t);break;case 22:t.memoizedState===null&&hn(t);break;case 30:hn(t);break;default:hn(t)}i=i.sibling}}function ai(i,t,e){for(e=e&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var n=t.alternate,s=i,a=t,r=a.flags;switch(a.tag){case 0:case 11:case 15:ai(s,a,e),Qa(4,a);break;case 1:if(ai(s,a,e),n=a,s=n.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(c){it(n,n.return,c)}if(n=a,s=n.updateQueue,s!==null){var o=n.stateNode;try{var l=s.shared.hiddenCallbacks;if(l!==null)for(s.shared.hiddenCallbacks=null,s=0;s<l.length;s++)Bm(l[s],o)}catch(c){it(n,n.return,c)}}e&&r&64&&C0(a),Ta(a,a.return);break;case 27:R0(a);case 26:case 5:ai(s,a,e),e&&n===null&&r&4&&D0(a),Ta(a,a.return);break;case 12:ai(s,a,e);break;case 31:ai(s,a,e),e&&r&4&&B0(s,a);break;case 13:ai(s,a,e),e&&r&4&&z0(s,a);break;case 22:a.memoizedState===null&&ai(s,a,e),Ta(a,a.return);break;case 30:break;default:ai(s,a,e)}t=t.sibling}}function Bh(i,t){var e=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(e=i.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==e&&(i!=null&&i.refCount++,e!=null&&Ka(e))}function zh(i,t){i=null,t.alternate!==null&&(i=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==i&&(t.refCount++,i!=null&&Ka(i))}function Ie(i,t,e,n){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)F0(i,t,e,n),t=t.sibling}function F0(i,t,e,n){var s=t.flags;switch(t.tag){case 0:case 11:case 15:Ie(i,t,e,n),s&2048&&Qa(9,t);break;case 1:Ie(i,t,e,n);break;case 3:Ie(i,t,e,n),s&2048&&(i=null,t.alternate!==null&&(i=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==i&&(t.refCount++,i!=null&&Ka(i)));break;case 12:if(s&2048){Ie(i,t,e,n),i=t.stateNode;try{var a=t.memoizedProps,r=a.id,o=a.onPostCommit;typeof o=="function"&&o(r,t.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(l){it(t,t.return,l)}}else Ie(i,t,e,n);break;case 31:Ie(i,t,e,n);break;case 13:Ie(i,t,e,n);break;case 23:break;case 22:a=t.stateNode,r=t.alternate,t.memoizedState!==null?a._visibility&2?Ie(i,t,e,n):wa(i,t):a._visibility&2?Ie(i,t,e,n):(a._visibility|=2,Yn(i,t,e,n,(t.subtreeFlags&10256)!==0||!1)),s&2048&&Bh(r,t);break;case 24:Ie(i,t,e,n),s&2048&&zh(t.alternate,t);break;default:Ie(i,t,e,n)}}function Yn(i,t,e,n,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var a=i,r=t,o=e,l=n,c=r.flags;switch(r.tag){case 0:case 11:case 15:Yn(a,r,o,l,s),Qa(8,r);break;case 23:break;case 22:var u=r.stateNode;r.memoizedState!==null?u._visibility&2?Yn(a,r,o,l,s):wa(a,r):(u._visibility|=2,Yn(a,r,o,l,s)),s&&c&2048&&Bh(r.alternate,r);break;case 24:Yn(a,r,o,l,s),s&&c&2048&&zh(r.alternate,r);break;default:Yn(a,r,o,l,s)}t=t.sibling}}function wa(i,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var e=i,n=t,s=n.flags;switch(n.tag){case 22:wa(e,n),s&2048&&Bh(n.alternate,n);break;case 24:wa(e,n),s&2048&&zh(n.alternate,n);break;default:wa(e,n)}t=t.sibling}}var pa=8192;function Xn(i,t,e){if(i.subtreeFlags&pa)for(i=i.child;i!==null;)H0(i,t,e),i=i.sibling}function H0(i,t,e){switch(i.tag){case 26:Xn(i,t,e),i.flags&pa&&i.memoizedState!==null&&k1(e,Fe,i.memoizedState,i.memoizedProps);break;case 5:Xn(i,t,e);break;case 3:case 4:var n=Fe;Fe=Fo(i.stateNode.containerInfo),Xn(i,t,e),Fe=n;break;case 22:i.memoizedState===null&&(n=i.alternate,n!==null&&n.memoizedState!==null?(n=pa,pa=16777216,Xn(i,t,e),pa=n):Xn(i,t,e));break;default:Xn(i,t,e)}}function U0(i){var t=i.alternate;if(t!==null&&(i=t.child,i!==null)){t.child=null;do t=i.sibling,i.sibling=null,i=t;while(i!==null)}}function oa(i){var t=i.deletions;if((i.flags&16)!==0){if(t!==null)for(var e=0;e<t.length;e++){var n=t[e];It=n,j0(n,i)}U0(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)G0(i),i=i.sibling}function G0(i){switch(i.tag){case 0:case 11:case 15:oa(i),i.flags&2048&&Zi(9,i,i.return);break;case 3:oa(i);break;case 12:oa(i);break;case 22:var t=i.stateNode;i.memoizedState!==null&&t._visibility&2&&(i.return===null||i.return.tag!==13)?(t._visibility&=-3,co(i)):oa(i);break;default:oa(i)}}function co(i){var t=i.deletions;if((i.flags&16)!==0){if(t!==null)for(var e=0;e<t.length;e++){var n=t[e];It=n,j0(n,i)}U0(i)}for(i=i.child;i!==null;){switch(t=i,t.tag){case 0:case 11:case 15:Zi(8,t,t.return),co(t);break;case 22:e=t.stateNode,e._visibility&2&&(e._visibility&=-3,co(t));break;default:co(t)}i=i.sibling}}function j0(i,t){for(;It!==null;){var e=It;switch(e.tag){case 0:case 11:case 15:Zi(8,e,t);break;case 23:case 22:if(e.memoizedState!==null&&e.memoizedState.cachePool!==null){var n=e.memoizedState.cachePool.pool;n!=null&&n.refCount++}break;case 24:Ka(e.memoizedState.cache)}if(n=e.child,n!==null)n.return=e,It=n;else t:for(e=i;It!==null;){n=It;var s=n.sibling,a=n.return;if(L0(n),n===e){It=null;break t}if(s!==null){s.return=a,It=s;break t}It=a}}}var $A={getCacheForType:function(i){var t=Vt(Ot),e=t.data.get(i);return e===void 0&&(e=i(),t.data.set(i,e)),e},cacheSignal:function(){return Vt(Ot).controller.signal}},ZA=typeof WeakMap=="function"?WeakMap:Map,$=0,ot=null,V=null,Y=0,et=0,le=null,Ii=!1,Ms=!1,Ph=!1,bi=0,wt=0,Ji=0,mn=0,Ih=0,he=0,vs=0,_a=null,ie=null,Pu=!1,el=0,V0=0,No=1/0,Lo=null,Xi=null,Bt=0,Yi=null,As=null,fi=0,Iu=0,Fu=null,X0=null,xa=0,Hu=null;function ge(){return($&2)!==0&&Y!==0?Y&-Y:k.T!==null?Hh():tm()}function Y0(){if(he===0)if((Y&536870912)===0||K){var i=Pr;Pr<<=1,(Pr&3932160)===0&&(Pr=262144),he=i}else he=536870912;return i=ye.current,i!==null&&(i.flags|=32),he}function ne(i,t,e){(i===ot&&(et===2||et===9)||i.cancelPendingCommit!==null)&&(Ss(i,0),Fi(i,Y,he,!1)),Xa(i,e),(($&2)===0||i!==ot)&&(i===ot&&(($&2)===0&&(mn|=e),wt===4&&Fi(i,Y,he,!1)),Qe(i))}function q0(i,t,e){if(($&6)!==0)throw Error(x(327));var n=!e&&(t&127)===0&&(t&i.expiredLanes)===0||Va(i,t),s=n?e1(i,t):Qc(i,t,!0),a=n;do{if(s===0){Ms&&!n&&Fi(i,t,0,!1);break}else{if(e=i.current.alternate,a&&!JA(e)){s=Qc(i,t,!1),a=!1;continue}if(s===2){if(a=t,i.errorRecoveryDisabledLanes&a)var r=0;else r=i.pendingLanes&-536870913,r=r!==0?r:r&536870912?536870912:0;if(r!==0){t=r;t:{var o=i;s=_a;var l=o.current.memoizedState.isDehydrated;if(l&&(Ss(o,r).flags|=256),r=Qc(o,r,!1),r!==2){if(Ph&&!l){o.errorRecoveryDisabledLanes|=a,mn|=a,s=4;break t}a=ie,ie=s,a!==null&&(ie===null?ie=a:ie.push.apply(ie,a))}s=r}if(a=!1,s!==2)continue}}if(s===1){Ss(i,0),Fi(i,t,0,!0);break}t:{switch(n=i,a=s,a){case 0:case 1:throw Error(x(345));case 4:if((t&4194048)!==t)break;case 6:Fi(n,t,he,!Ii);break t;case 2:ie=null;break;case 3:case 5:break;default:throw Error(x(329))}if((t&62914560)===t&&(s=el+300-de(),10<s)){if(Fi(n,t,he,!Ii),Vo(n,0,!0)!==0)break t;fi=t,n.timeoutHandle=fy(hg.bind(null,n,e,ie,Lo,Pu,t,he,mn,vs,Ii,a,"Throttled",-0,0),s);break t}hg(n,e,ie,Lo,Pu,t,he,mn,vs,Ii,a,null,-0,0)}}break}while(!0);Qe(i)}function hg(i,t,e,n,s,a,r,o,l,c,u,h,d,f){if(i.timeoutHandle=-1,h=t.subtreeFlags,h&8192||(h&16785408)===16785408){h={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ci},H0(t,a,h);var m=(a&62914560)===a?el-de():(a&4194048)===a?V0-de():0;if(m=B1(h,m),m!==null){fi=a,i.cancelPendingCommit=m(fg.bind(null,i,t,a,e,n,s,r,o,l,u,h,null,d,f)),Fi(i,a,r,!c);return}}fg(i,t,a,e,n,s,r,o,l)}function JA(i){for(var t=i;;){var e=t.tag;if((e===0||e===11||e===15)&&t.flags&16384&&(e=t.updateQueue,e!==null&&(e=e.stores,e!==null)))for(var n=0;n<e.length;n++){var s=e[n],a=s.getSnapshot;s=s.value;try{if(!me(a(),s))return!1}catch{return!1}}if(e=t.child,t.subtreeFlags&16384&&e!==null)e.return=t,t=e;else{if(t===i)break;for(;t.sibling===null;){if(t.return===null||t.return===i)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Fi(i,t,e,n){t&=~Ih,t&=~mn,i.suspendedLanes|=t,i.pingedLanes&=~t,n&&(i.warmLanes|=t),n=i.expirationTimes;for(var s=t;0<s;){var a=31-pe(s),r=1<<a;n[a]=-1,s&=~r}e!==0&&$g(i,e,t)}function il(){return($&6)===0?($a(0,!1),!1):!0}function Fh(){if(V!==null){if(et===0)var i=V.return;else i=V,ui=xn=null,wh(i),us=null,ka=0,i=V;for(;i!==null;)x0(i.alternate,i),i=i.return;V=null}}function Ss(i,t){var e=i.timeoutHandle;e!==-1&&(i.timeoutHandle=-1,y1(e)),e=i.cancelPendingCommit,e!==null&&(i.cancelPendingCommit=null,e()),fi=0,Fh(),ot=i,V=e=hi(i.current,null),Y=t,et=0,le=null,Ii=!1,Ms=Va(i,t),Ph=!1,vs=he=Ih=mn=Ji=wt=0,ie=_a=null,Pu=!1,(t&8)!==0&&(t|=t&32);var n=i.entangledLanes;if(n!==0)for(i=i.entanglements,n&=t;0<n;){var s=31-pe(n),a=1<<s;t|=i[s],n&=~a}return bi=t,Ko(),e}function K0(i,t){U=null,k.H=za,t===Cs||t===Qo?(t=jp(),et=3):t===yh?(t=jp(),et=4):et=t===Lh?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,le=t,V===null&&(wt=1,Do(i,Oe(t,i.current)))}function W0(){var i=ye.current;return i===null?!0:(Y&4194048)===Y?Ne===null:(Y&62914560)===Y||(Y&536870912)!==0?i===Ne:!1}function Q0(){var i=k.H;return k.H=za,i===null?za:i}function $0(){var i=k.A;return k.A=$A,i}function ko(){wt=4,Ii||(Y&4194048)!==Y&&ye.current!==null||(Ms=!0),(Ji&134217727)===0&&(mn&134217727)===0||ot===null||Fi(ot,Y,he,!1)}function Qc(i,t,e){var n=$;$|=2;var s=Q0(),a=$0();(ot!==i||Y!==t)&&(Lo=null,Ss(i,t)),t=!1;var r=wt;t:do try{if(et!==0&&V!==null){var o=V,l=le;switch(et){case 8:Fh(),r=6;break t;case 3:case 2:case 9:case 6:ye.current===null&&(t=!0);var c=et;if(et=0,le=null,as(i,o,l,c),e&&Ms){r=0;break t}break;default:c=et,et=0,le=null,as(i,o,l,c)}}t1(),r=wt;break}catch(u){K0(i,u)}while(!0);return t&&i.shellSuspendCounter++,ui=xn=null,$=n,k.H=s,k.A=a,V===null&&(ot=null,Y=0,Ko()),r}function t1(){for(;V!==null;)Z0(V)}function e1(i,t){var e=$;$|=2;var n=Q0(),s=$0();ot!==i||Y!==t?(Lo=null,No=de()+500,Ss(i,t)):Ms=Va(i,t);t:do try{if(et!==0&&V!==null){t=V;var a=le;e:switch(et){case 1:et=0,le=null,as(i,t,a,1);break;case 2:case 9:if(Gp(a)){et=0,le=null,dg(t);break}t=function(){et!==2&&et!==9||ot!==i||(et=7),Qe(i)},a.then(t,t);break t;case 3:et=7;break t;case 4:et=5;break t;case 7:Gp(a)?(et=0,le=null,dg(t)):(et=0,le=null,as(i,t,a,7));break;case 5:var r=null;switch(V.tag){case 26:r=V.memoizedState;case 5:case 27:var o=V;if(r?by(r):o.stateNode.complete){et=0,le=null;var l=o.sibling;if(l!==null)V=l;else{var c=o.return;c!==null?(V=c,nl(c)):V=null}break e}}et=0,le=null,as(i,t,a,5);break;case 6:et=0,le=null,as(i,t,a,6);break;case 8:Fh(),wt=6;break t;default:throw Error(x(462))}}i1();break}catch(u){K0(i,u)}while(!0);return ui=xn=null,k.H=n,k.A=s,$=e,V!==null?0:(ot=null,Y=0,Ko(),wt)}function i1(){for(;V!==null&&!_v();)Z0(V)}function Z0(i){var t=_0(i.alternate,i,bi);i.memoizedProps=i.pendingProps,t===null?nl(i):V=t}function dg(i){var t=i,e=t.alternate;switch(t.tag){case 15:case 0:t=ag(e,t,t.pendingProps,t.type,void 0,Y);break;case 11:t=ag(e,t,t.pendingProps,t.type.render,t.ref,Y);break;case 5:wh(t);default:x0(e,t),t=V=xm(t,bi),t=_0(e,t,bi)}i.memoizedProps=i.pendingProps,t===null?nl(i):V=t}function as(i,t,e,n){ui=xn=null,wh(t),us=null,ka=0;var s=t.return;try{if(VA(i,s,t,e,Y)){wt=1,Do(i,Oe(e,i.current)),V=null;return}}catch(a){if(s!==null)throw V=s,a;wt=1,Do(i,Oe(e,i.current)),V=null;return}t.flags&32768?(K||n===1?i=!0:Ms||(Y&536870912)!==0?i=!1:(Ii=i=!0,(n===2||n===9||n===3||n===6)&&(n=ye.current,n!==null&&n.tag===13&&(n.flags|=16384))),J0(t,i)):nl(t)}function nl(i){var t=i;do{if((t.flags&32768)!==0){J0(t,Ii);return}i=t.return;var e=qA(t.alternate,t,bi);if(e!==null){V=e;return}if(t=t.sibling,t!==null){V=t;return}V=t=i}while(t!==null);wt===0&&(wt=5)}function J0(i,t){do{var e=KA(i.alternate,i);if(e!==null){e.flags&=32767,V=e;return}if(e=i.return,e!==null&&(e.flags|=32768,e.subtreeFlags=0,e.deletions=null),!t&&(i=i.sibling,i!==null)){V=i;return}V=i=e}while(i!==null);wt=6,V=null}function fg(i,t,e,n,s,a,r,o,l){i.cancelPendingCommit=null;do sl();while(Bt!==0);if(($&6)!==0)throw Error(x(327));if(t!==null){if(t===i.current)throw Error(x(177));if(a=t.lanes|t.childLanes,a|=uh,Bv(i,e,a,r,o,l),i===ot&&(V=ot=null,Y=0),As=t,Yi=i,fi=e,Iu=a,Fu=s,X0=n,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,r1(bo,function(){return sy(),null})):(i.callbackNode=null,i.callbackPriority=0),n=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||n){n=k.T,k.T=null,s=Z.p,Z.p=2,r=$,$|=4;try{WA(i,t,e)}finally{$=r,Z.p=s,k.T=n}}Bt=1,ty(),ey(),iy()}}function ty(){if(Bt===1){Bt=0;var i=Yi,t=As,e=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||e){e=k.T,k.T=null;var n=Z.p;Z.p=2;var s=$;$|=4;try{P0(t,i);var a=Vu,r=bm(i.containerInfo),o=a.focusedElem,l=a.selectionRange;if(r!==o&&o&&o.ownerDocument&&ym(o.ownerDocument.documentElement,o)){if(l!==null&&ch(o)){var c=l.start,u=l.end;if(u===void 0&&(u=c),"selectionStart"in o)o.selectionStart=c,o.selectionEnd=Math.min(u,o.value.length);else{var h=o.ownerDocument||document,d=h&&h.defaultView||window;if(d.getSelection){var f=d.getSelection(),m=o.textContent.length,y=Math.min(l.start,m),v=l.end===void 0?y:Math.min(l.end,m);!f.extend&&y>v&&(r=v,v=y,y=r);var p=Bp(o,y),g=Bp(o,v);if(p&&g&&(f.rangeCount!==1||f.anchorNode!==p.node||f.anchorOffset!==p.offset||f.focusNode!==g.node||f.focusOffset!==g.offset)){var b=h.createRange();b.setStart(p.node,p.offset),f.removeAllRanges(),y>v?(f.addRange(b),f.extend(g.node,g.offset)):(b.setEnd(g.node,g.offset),f.addRange(b))}}}}for(h=[],f=o;f=f.parentNode;)f.nodeType===1&&h.push({element:f,left:f.scrollLeft,top:f.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<h.length;o++){var A=h[o];A.element.scrollLeft=A.left,A.element.scrollTop=A.top}}Go=!!ju,Vu=ju=null}finally{$=s,Z.p=n,k.T=e}}i.current=t,Bt=2}}function ey(){if(Bt===2){Bt=0;var i=Yi,t=As,e=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||e){e=k.T,k.T=null;var n=Z.p;Z.p=2;var s=$;$|=4;try{N0(i,t.alternate,t)}finally{$=s,Z.p=n,k.T=e}}Bt=3}}function iy(){if(Bt===4||Bt===3){Bt=0,xv();var i=Yi,t=As,e=fi,n=X0;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Bt=5:(Bt=0,As=Yi=null,ny(i,i.pendingLanes));var s=i.pendingLanes;if(s===0&&(Xi=null),ih(e),t=t.stateNode,fe&&typeof fe.onCommitFiberRoot=="function")try{fe.onCommitFiberRoot(ja,t,void 0,(t.current.flags&128)===128)}catch{}if(n!==null){t=k.T,s=Z.p,Z.p=2,k.T=null;try{for(var a=i.onRecoverableError,r=0;r<n.length;r++){var o=n[r];a(o.value,{componentStack:o.stack})}}finally{k.T=t,Z.p=s}}(fi&3)!==0&&sl(),Qe(i),s=i.pendingLanes,(e&261930)!==0&&(s&42)!==0?i===Hu?xa++:(xa=0,Hu=i):xa=0,$a(0,!1)}}function ny(i,t){(i.pooledCacheLanes&=t)===0&&(t=i.pooledCache,t!=null&&(i.pooledCache=null,Ka(t)))}function sl(){return ty(),ey(),iy(),sy()}function sy(){if(Bt!==5)return!1;var i=Yi,t=Iu;Iu=0;var e=ih(fi),n=k.T,s=Z.p;try{Z.p=32>e?32:e,k.T=null,e=Fu,Fu=null;var a=Yi,r=fi;if(Bt=0,As=Yi=null,fi=0,($&6)!==0)throw Error(x(331));var o=$;if($|=4,G0(a.current),F0(a,a.current,r,e),$=o,$a(0,!1),fe&&typeof fe.onPostCommitFiberRoot=="function")try{fe.onPostCommitFiberRoot(ja,a)}catch{}return!0}finally{Z.p=s,k.T=n,ny(i,t)}}function pg(i,t,e){t=Oe(e,t),t=Lu(i.stateNode,t,2),i=Vi(i,t,2),i!==null&&(Xa(i,2),Qe(i))}function it(i,t,e){if(i.tag===3)pg(i,i,e);else for(;t!==null;){if(t.tag===3){pg(t,i,e);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Xi===null||!Xi.has(n))){i=Oe(e,i),e=v0(2),n=Vi(t,e,2),n!==null&&(A0(e,n,t,i),Xa(n,2),Qe(n));break}}t=t.return}}function $c(i,t,e){var n=i.pingCache;if(n===null){n=i.pingCache=new ZA;var s=new Set;n.set(t,s)}else s=n.get(t),s===void 0&&(s=new Set,n.set(t,s));s.has(e)||(Ph=!0,s.add(e),i=n1.bind(null,i,t,e),t.then(i,i))}function n1(i,t,e){var n=i.pingCache;n!==null&&n.delete(t),i.pingedLanes|=i.suspendedLanes&e,i.warmLanes&=~e,ot===i&&(Y&e)===e&&(wt===4||wt===3&&(Y&62914560)===Y&&300>de()-el?($&2)===0&&Ss(i,0):Ih|=e,vs===Y&&(vs=0)),Qe(i)}function ay(i,t){t===0&&(t=Qg()),i=_n(i,t),i!==null&&(Xa(i,t),Qe(i))}function s1(i){var t=i.memoizedState,e=0;t!==null&&(e=t.retryLane),ay(i,e)}function a1(i,t){var e=0;switch(i.tag){case 31:case 13:var n=i.stateNode,s=i.memoizedState;s!==null&&(e=s.retryLane);break;case 19:n=i.stateNode;break;case 22:n=i.stateNode._retryCache;break;default:throw Error(x(314))}n!==null&&n.delete(t),ay(i,e)}function r1(i,t){return th(i,t)}var Bo=null,qn=null,Uu=!1,zo=!1,Zc=!1,Hi=0;function Qe(i){i!==qn&&i.next===null&&(qn===null?Bo=qn=i:qn=qn.next=i),zo=!0,Uu||(Uu=!0,l1())}function $a(i,t){if(!Zc&&zo){Zc=!0;do for(var e=!1,n=Bo;n!==null;){if(!t)if(i!==0){var s=n.pendingLanes;if(s===0)var a=0;else{var r=n.suspendedLanes,o=n.pingedLanes;a=(1<<31-pe(42|i)+1)-1,a&=s&~(r&~o),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(e=!0,gg(n,a))}else a=Y,a=Vo(n,n===ot?a:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(a&3)===0||Va(n,a)||(e=!0,gg(n,a));n=n.next}while(e);Zc=!1}}function o1(){ry()}function ry(){zo=Uu=!1;var i=0;Hi!==0&&m1()&&(i=Hi);for(var t=de(),e=null,n=Bo;n!==null;){var s=n.next,a=oy(n,t);a===0?(n.next=null,e===null?Bo=s:e.next=s,s===null&&(qn=e)):(e=n,(i!==0||(a&3)!==0)&&(zo=!0)),n=s}Bt!==0&&Bt!==5||$a(i,!1),Hi!==0&&(Hi=0)}function oy(i,t){for(var e=i.suspendedLanes,n=i.pingedLanes,s=i.expirationTimes,a=i.pendingLanes&-62914561;0<a;){var r=31-pe(a),o=1<<r,l=s[r];l===-1?((o&e)===0||(o&n)!==0)&&(s[r]=kv(o,t)):l<=t&&(i.expiredLanes|=o),a&=~o}if(t=ot,e=Y,e=Vo(i,i===t?e:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),n=i.callbackNode,e===0||i===t&&(et===2||et===9)||i.cancelPendingCommit!==null)return n!==null&&n!==null&&Cc(n),i.callbackNode=null,i.callbackPriority=0;if((e&3)===0||Va(i,e)){if(t=e&-e,t===i.callbackPriority)return t;switch(n!==null&&Cc(n),ih(e)){case 2:case 8:e=Kg;break;case 32:e=bo;break;case 268435456:e=Wg;break;default:e=bo}return n=ly.bind(null,i),e=th(e,n),i.callbackPriority=t,i.callbackNode=e,t}return n!==null&&n!==null&&Cc(n),i.callbackPriority=2,i.callbackNode=null,2}function ly(i,t){if(Bt!==0&&Bt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var e=i.callbackNode;if(sl()&&i.callbackNode!==e)return null;var n=Y;return n=Vo(i,i===ot?n:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),n===0?null:(q0(i,n,t),oy(i,de()),i.callbackNode!=null&&i.callbackNode===e?ly.bind(null,i):null)}function gg(i,t){if(sl())return null;q0(i,t,!0)}function l1(){b1(function(){($&6)!==0?th(qg,o1):ry()})}function Hh(){if(Hi===0){var i=ms;i===0&&(i=zr,zr<<=1,(zr&261888)===0&&(zr=256)),Hi=i}return Hi}function mg(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:to(""+i)}function yg(i,t){var e=t.ownerDocument.createElement("input");return e.name=t.name,e.value=t.value,i.id&&e.setAttribute("form",i.id),t.parentNode.insertBefore(e,t),i=new FormData(i),e.parentNode.removeChild(e),i}function c1(i,t,e,n,s){if(t==="submit"&&e&&e.stateNode===s){var a=mg((s[se]||null).action),r=n.submitter;r&&(t=(t=r[se]||null)?mg(t.formAction):r.getAttribute("formAction"),t!==null&&(a=t,r=null));var o=new Xo("action","action",null,n,s);i.push({event:o,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(Hi!==0){var l=r?yg(s,r):new FormData(s);Ru(e,{pending:!0,data:l,method:s.method,action:a},null,l)}}else typeof a=="function"&&(o.preventDefault(),l=r?yg(s,r):new FormData(s),Ru(e,{pending:!0,data:l,method:s.method,action:a},a,l))},currentTarget:s}]})}}for(Kr=0;Kr<vu.length;Kr++)Wr=vu[Kr],bg=Wr.toLowerCase(),vg=Wr[0].toUpperCase()+Wr.slice(1),He(bg,"on"+vg);var Wr,bg,vg,Kr;He(Am,"onAnimationEnd");He(Sm,"onAnimationIteration");He(Em,"onAnimationStart");He("dblclick","onDoubleClick");He("focusin","onFocus");He("focusout","onBlur");He(CA,"onTransitionRun");He(MA,"onTransitionStart");He(DA,"onTransitionCancel");He(Tm,"onTransitionEnd");ps("onMouseEnter",["mouseout","mouseover"]);ps("onMouseLeave",["mouseout","mouseover"]);ps("onPointerEnter",["pointerout","pointerover"]);ps("onPointerLeave",["pointerout","pointerover"]);En("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));En("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));En("onBeforeInput",["compositionend","keypress","textInput","paste"]);En("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));En("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));En("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Pa="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),u1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Pa));function cy(i,t){t=(t&4)!==0;for(var e=0;e<i.length;e++){var n=i[e],s=n.event;n=n.listeners;t:{var a=void 0;if(t)for(var r=n.length-1;0<=r;r--){var o=n[r],l=o.instance,c=o.currentTarget;if(o=o.listener,l!==a&&s.isPropagationStopped())break t;a=o,s.currentTarget=c;try{a(s)}catch(u){Ao(u)}s.currentTarget=null,a=l}else for(r=0;r<n.length;r++){if(o=n[r],l=o.instance,c=o.currentTarget,o=o.listener,l!==a&&s.isPropagationStopped())break t;a=o,s.currentTarget=c;try{a(s)}catch(u){Ao(u)}s.currentTarget=null,a=l}}}}function j(i,t){var e=t[hu];e===void 0&&(e=t[hu]=new Set);var n=i+"__bubble";e.has(n)||(uy(t,i,2,!1),e.add(n))}function Jc(i,t,e){var n=0;t&&(n|=4),uy(e,i,n,t)}var Qr="_reactListening"+Math.random().toString(36).slice(2);function Uh(i){if(!i[Qr]){i[Qr]=!0,em.forEach(function(e){e!=="selectionchange"&&(u1.has(e)||Jc(e,!1,i),Jc(e,!0,i))});var t=i.nodeType===9?i:i.ownerDocument;t===null||t[Qr]||(t[Qr]=!0,Jc("selectionchange",!1,t))}}function uy(i,t,e,n){switch(Ty(t)){case 2:var s=I1;break;case 8:s=F1;break;default:s=Xh}e=s.bind(null,t,e,i),s=void 0,!mu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),n?s!==void 0?i.addEventListener(t,e,{capture:!0,passive:s}):i.addEventListener(t,e,!0):s!==void 0?i.addEventListener(t,e,{passive:s}):i.addEventListener(t,e,!1)}function tu(i,t,e,n,s){var a=n;if((t&1)===0&&(t&2)===0&&n!==null)t:for(;;){if(n===null)return;var r=n.tag;if(r===3||r===4){var o=n.stateNode.containerInfo;if(o===s)break;if(r===4)for(r=n.return;r!==null;){var l=r.tag;if((l===3||l===4)&&r.stateNode.containerInfo===s)return;r=r.return}for(;o!==null;){if(r=Qn(o),r===null)return;if(l=r.tag,l===5||l===6||l===26||l===27){n=a=r;continue t}o=o.parentNode}}n=n.return}cm(function(){var c=a,u=ah(e),h=[];t:{var d=wm.get(i);if(d!==void 0){var f=Xo,m=i;switch(i){case"keypress":if(io(e)===0)break t;case"keydown":case"keyup":f=aA;break;case"focusin":m="focus",f=Nc;break;case"focusout":m="blur",f=Nc;break;case"beforeblur":case"afterblur":f=Nc;break;case"click":if(e.button===2)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=xp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=qv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=lA;break;case Am:case Sm:case Em:f=Qv;break;case Tm:f=uA;break;case"scroll":case"scrollend":f=Xv;break;case"wheel":f=dA;break;case"copy":case"cut":case"paste":f=Zv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=Mp;break;case"toggle":case"beforetoggle":f=pA}var y=(t&4)!==0,v=!y&&(i==="scroll"||i==="scrollend"),p=y?d!==null?d+"Capture":null:d;y=[];for(var g=c,b;g!==null;){var A=g;if(b=A.stateNode,A=A.tag,A!==5&&A!==26&&A!==27||b===null||p===null||(A=Da(g,p),A!=null&&y.push(Ia(g,A,b))),v)break;g=g.return}0<y.length&&(d=new f(d,m,null,e,u),h.push({event:d,listeners:y}))}}if((t&7)===0){t:{if(d=i==="mouseover"||i==="pointerover",f=i==="mouseout"||i==="pointerout",d&&e!==gu&&(m=e.relatedTarget||e.fromElement)&&(Qn(m)||m[ws]))break t;if((f||d)&&(d=u.window===u?u:(d=u.ownerDocument)?d.defaultView||d.parentWindow:window,f?(m=e.relatedTarget||e.toElement,f=c,m=m?Qn(m):null,m!==null&&(v=Ga(m),y=m.tag,m!==v||y!==5&&y!==27&&y!==6)&&(m=null)):(f=null,m=c),f!==m)){if(y=xp,A="onMouseLeave",p="onMouseEnter",g="mouse",(i==="pointerout"||i==="pointerover")&&(y=Mp,A="onPointerLeave",p="onPointerEnter",g="pointer"),v=f==null?d:da(f),b=m==null?d:da(m),d=new y(A,g+"leave",f,e,u),d.target=v,d.relatedTarget=b,A=null,Qn(u)===c&&(y=new y(p,g+"enter",m,e,u),y.target=b,y.relatedTarget=v,A=y),v=A,f&&m)e:{for(y=h1,p=f,g=m,b=0,A=p;A;A=y(A))b++;A=0;for(var S=g;S;S=y(S))A++;for(;0<b-A;)p=y(p),b--;for(;0<A-b;)g=y(g),A--;for(;b--;){if(p===g||g!==null&&p===g.alternate){y=p;break e}p=y(p),g=y(g)}y=null}else y=null;f!==null&&Ag(h,d,f,y,!1),m!==null&&v!==null&&Ag(h,v,m,y,!0)}}t:{if(d=c?da(c):window,f=d.nodeName&&d.nodeName.toLowerCase(),f==="select"||f==="input"&&d.type==="file")var E=Np;else if(Rp(d))if(gm)E=wA;else{E=EA;var T=SA}else f=d.nodeName,!f||f.toLowerCase()!=="input"||d.type!=="checkbox"&&d.type!=="radio"?c&&sh(c.elementType)&&(E=Np):E=TA;if(E&&(E=E(i,c))){pm(h,E,e,u);break t}T&&T(i,d,c),i==="focusout"&&c&&d.type==="number"&&c.memoizedProps.value!=null&&pu(d,"number",d.value)}switch(T=c?da(c):window,i){case"focusin":(Rp(T)||T.contentEditable==="true")&&(Jn=T,yu=c,ya=null);break;case"focusout":ya=yu=Jn=null;break;case"mousedown":bu=!0;break;case"contextmenu":case"mouseup":case"dragend":bu=!1,zp(h,e,u);break;case"selectionchange":if(xA)break;case"keydown":case"keyup":zp(h,e,u)}var w;if(lh)t:{switch(i){case"compositionstart":var _="onCompositionStart";break t;case"compositionend":_="onCompositionEnd";break t;case"compositionupdate":_="onCompositionUpdate";break t}_=void 0}else Zn?dm(i,e)&&(_="onCompositionEnd"):i==="keydown"&&e.keyCode===229&&(_="onCompositionStart");_&&(hm&&e.locale!=="ko"&&(Zn||_!=="onCompositionStart"?_==="onCompositionEnd"&&Zn&&(w=um()):(Pi=u,rh="value"in Pi?Pi.value:Pi.textContent,Zn=!0)),T=Po(c,_),0<T.length&&(_=new Cp(_,i,null,e,u),h.push({event:_,listeners:T}),w?_.data=w:(w=fm(e),w!==null&&(_.data=w)))),(w=mA?yA(i,e):bA(i,e))&&(_=Po(c,"onBeforeInput"),0<_.length&&(T=new Cp("onBeforeInput","beforeinput",null,e,u),h.push({event:T,listeners:_}),T.data=w)),c1(h,i,c,e,u)}cy(h,t)})}function Ia(i,t,e){return{instance:i,listener:t,currentTarget:e}}function Po(i,t){for(var e=t+"Capture",n=[];i!==null;){var s=i,a=s.stateNode;if(s=s.tag,s!==5&&s!==26&&s!==27||a===null||(s=Da(i,e),s!=null&&n.unshift(Ia(i,s,a)),s=Da(i,t),s!=null&&n.push(Ia(i,s,a))),i.tag===3)return n;i=i.return}return[]}function h1(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function Ag(i,t,e,n,s){for(var a=t._reactName,r=[];e!==null&&e!==n;){var o=e,l=o.alternate,c=o.stateNode;if(o=o.tag,l!==null&&l===n)break;o!==5&&o!==26&&o!==27||c===null||(l=c,s?(c=Da(e,a),c!=null&&r.unshift(Ia(e,c,l))):s||(c=Da(e,a),c!=null&&r.push(Ia(e,c,l)))),e=e.return}r.length!==0&&i.push({event:t,listeners:r})}var d1=/\r\n?/g,f1=/\u0000|\uFFFD/g;function Sg(i){return(typeof i=="string"?i:""+i).replace(d1,`
9
- `).replace(f1,"")}function hy(i,t){return t=Sg(t),Sg(i)===t}function nt(i,t,e,n,s,a){switch(e){case"children":typeof n=="string"?t==="body"||t==="textarea"&&n===""||gs(i,n):(typeof n=="number"||typeof n=="bigint")&&t!=="body"&&gs(i,""+n);break;case"className":Fr(i,"class",n);break;case"tabIndex":Fr(i,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":Fr(i,e,n);break;case"style":lm(i,n,a);break;case"data":if(t!=="object"){Fr(i,"data",n);break}case"src":case"href":if(n===""&&(t!=="a"||e!=="href")){i.removeAttribute(e);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){i.removeAttribute(e);break}n=to(""+n),i.setAttribute(e,n);break;case"action":case"formAction":if(typeof n=="function"){i.setAttribute(e,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof a=="function"&&(e==="formAction"?(t!=="input"&&nt(i,t,"name",s.name,s,null),nt(i,t,"formEncType",s.formEncType,s,null),nt(i,t,"formMethod",s.formMethod,s,null),nt(i,t,"formTarget",s.formTarget,s,null)):(nt(i,t,"encType",s.encType,s,null),nt(i,t,"method",s.method,s,null),nt(i,t,"target",s.target,s,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){i.removeAttribute(e);break}n=to(""+n),i.setAttribute(e,n);break;case"onClick":n!=null&&(i.onclick=ci);break;case"onScroll":n!=null&&j("scroll",i);break;case"onScrollEnd":n!=null&&j("scrollend",i);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(x(61));if(e=n.__html,e!=null){if(s.children!=null)throw Error(x(60));i.innerHTML=e}}break;case"multiple":i.multiple=n&&typeof n!="function"&&typeof n!="symbol";break;case"muted":i.muted=n&&typeof n!="function"&&typeof n!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(n==null||typeof n=="function"||typeof n=="boolean"||typeof n=="symbol"){i.removeAttribute("xlink:href");break}e=to(""+n),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":n!=null&&typeof n!="function"&&typeof n!="symbol"?i.setAttribute(e,""+n):i.removeAttribute(e);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":n&&typeof n!="function"&&typeof n!="symbol"?i.setAttribute(e,""):i.removeAttribute(e);break;case"capture":case"download":n===!0?i.setAttribute(e,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?i.setAttribute(e,n):i.removeAttribute(e);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?i.setAttribute(e,n):i.removeAttribute(e);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?i.removeAttribute(e):i.setAttribute(e,n);break;case"popover":j("beforetoggle",i),j("toggle",i),Jr(i,"popover",n);break;case"xlinkActuate":ei(i,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":ei(i,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":ei(i,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":ei(i,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":ei(i,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":ei(i,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":ei(i,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":ei(i,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":ei(i,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":Jr(i,"is",n);break;case"innerText":case"textContent":break;default:(!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(e=jv.get(e)||e,Jr(i,e,n))}}function Gu(i,t,e,n,s,a){switch(e){case"style":lm(i,n,a);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(x(61));if(e=n.__html,e!=null){if(s.children!=null)throw Error(x(60));i.innerHTML=e}}break;case"children":typeof n=="string"?gs(i,n):(typeof n=="number"||typeof n=="bigint")&&gs(i,""+n);break;case"onScroll":n!=null&&j("scroll",i);break;case"onScrollEnd":n!=null&&j("scrollend",i);break;case"onClick":n!=null&&(i.onclick=ci);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!im.hasOwnProperty(e))t:{if(e[0]==="o"&&e[1]==="n"&&(s=e.endsWith("Capture"),t=e.slice(2,s?e.length-7:void 0),a=i[se]||null,a=a!=null?a[e]:null,typeof a=="function"&&i.removeEventListener(t,a,s),typeof n=="function")){typeof a!="function"&&a!==null&&(e in i?i[e]=null:i.hasAttribute(e)&&i.removeAttribute(e)),i.addEventListener(t,n,s);break t}e in i?i[e]=n:n===!0?i.setAttribute(e,""):Jr(i,e,n)}}}function Xt(i,t,e){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":j("error",i),j("load",i);var n=!1,s=!1,a;for(a in e)if(e.hasOwnProperty(a)){var r=e[a];if(r!=null)switch(a){case"src":n=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(x(137,t));default:nt(i,t,a,r,e,null)}}s&&nt(i,t,"srcSet",e.srcSet,e,null),n&&nt(i,t,"src",e.src,e,null);return;case"input":j("invalid",i);var o=a=r=s=null,l=null,c=null;for(n in e)if(e.hasOwnProperty(n)){var u=e[n];if(u!=null)switch(n){case"name":s=u;break;case"type":r=u;break;case"checked":l=u;break;case"defaultChecked":c=u;break;case"value":a=u;break;case"defaultValue":o=u;break;case"children":case"dangerouslySetInnerHTML":if(u!=null)throw Error(x(137,t));break;default:nt(i,t,n,u,e,null)}}am(i,a,o,l,c,r,s,!1);return;case"select":j("invalid",i),n=r=a=null;for(s in e)if(e.hasOwnProperty(s)&&(o=e[s],o!=null))switch(s){case"value":a=o;break;case"defaultValue":r=o;break;case"multiple":n=o;default:nt(i,t,s,o,e,null)}t=a,e=r,i.multiple=!!n,t!=null?os(i,!!n,t,!1):e!=null&&os(i,!!n,e,!0);return;case"textarea":j("invalid",i),a=s=n=null;for(r in e)if(e.hasOwnProperty(r)&&(o=e[r],o!=null))switch(r){case"value":n=o;break;case"defaultValue":s=o;break;case"children":a=o;break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(x(91));break;default:nt(i,t,r,o,e,null)}om(i,n,s,a);return;case"option":for(l in e)e.hasOwnProperty(l)&&(n=e[l],n!=null)&&(l==="selected"?i.selected=n&&typeof n!="function"&&typeof n!="symbol":nt(i,t,l,n,e,null));return;case"dialog":j("beforetoggle",i),j("toggle",i),j("cancel",i),j("close",i);break;case"iframe":case"object":j("load",i);break;case"video":case"audio":for(n=0;n<Pa.length;n++)j(Pa[n],i);break;case"image":j("error",i),j("load",i);break;case"details":j("toggle",i);break;case"embed":case"source":case"link":j("error",i),j("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(c in e)if(e.hasOwnProperty(c)&&(n=e[c],n!=null))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(x(137,t));default:nt(i,t,c,n,e,null)}return;default:if(sh(t)){for(u in e)e.hasOwnProperty(u)&&(n=e[u],n!==void 0&&Gu(i,t,u,n,e,void 0));return}}for(o in e)e.hasOwnProperty(o)&&(n=e[o],n!=null&&nt(i,t,o,n,e,null))}function p1(i,t,e,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var s=null,a=null,r=null,o=null,l=null,c=null,u=null;for(f in e){var h=e[f];if(e.hasOwnProperty(f)&&h!=null)switch(f){case"checked":break;case"value":break;case"defaultValue":l=h;default:n.hasOwnProperty(f)||nt(i,t,f,null,n,h)}}for(var d in n){var f=n[d];if(h=e[d],n.hasOwnProperty(d)&&(f!=null||h!=null))switch(d){case"type":a=f;break;case"name":s=f;break;case"checked":c=f;break;case"defaultChecked":u=f;break;case"value":r=f;break;case"defaultValue":o=f;break;case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(x(137,t));break;default:f!==h&&nt(i,t,d,f,n,h)}}fu(i,r,o,l,c,u,a,s);return;case"select":f=r=o=d=null;for(a in e)if(l=e[a],e.hasOwnProperty(a)&&l!=null)switch(a){case"value":break;case"multiple":f=l;default:n.hasOwnProperty(a)||nt(i,t,a,null,n,l)}for(s in n)if(a=n[s],l=e[s],n.hasOwnProperty(s)&&(a!=null||l!=null))switch(s){case"value":d=a;break;case"defaultValue":o=a;break;case"multiple":r=a;default:a!==l&&nt(i,t,s,a,n,l)}t=o,e=r,n=f,d!=null?os(i,!!e,d,!1):!!n!=!!e&&(t!=null?os(i,!!e,t,!0):os(i,!!e,e?[]:"",!1));return;case"textarea":f=d=null;for(o in e)if(s=e[o],e.hasOwnProperty(o)&&s!=null&&!n.hasOwnProperty(o))switch(o){case"value":break;case"children":break;default:nt(i,t,o,null,n,s)}for(r in n)if(s=n[r],a=e[r],n.hasOwnProperty(r)&&(s!=null||a!=null))switch(r){case"value":d=s;break;case"defaultValue":f=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(x(91));break;default:s!==a&&nt(i,t,r,s,n,a)}rm(i,d,f);return;case"option":for(var m in e)d=e[m],e.hasOwnProperty(m)&&d!=null&&!n.hasOwnProperty(m)&&(m==="selected"?i.selected=!1:nt(i,t,m,null,n,d));for(l in n)d=n[l],f=e[l],n.hasOwnProperty(l)&&d!==f&&(d!=null||f!=null)&&(l==="selected"?i.selected=d&&typeof d!="function"&&typeof d!="symbol":nt(i,t,l,d,n,f));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var y in e)d=e[y],e.hasOwnProperty(y)&&d!=null&&!n.hasOwnProperty(y)&&nt(i,t,y,null,n,d);for(c in n)if(d=n[c],f=e[c],n.hasOwnProperty(c)&&d!==f&&(d!=null||f!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(x(137,t));break;default:nt(i,t,c,d,n,f)}return;default:if(sh(t)){for(var v in e)d=e[v],e.hasOwnProperty(v)&&d!==void 0&&!n.hasOwnProperty(v)&&Gu(i,t,v,void 0,n,d);for(u in n)d=n[u],f=e[u],!n.hasOwnProperty(u)||d===f||d===void 0&&f===void 0||Gu(i,t,u,d,n,f);return}}for(var p in e)d=e[p],e.hasOwnProperty(p)&&d!=null&&!n.hasOwnProperty(p)&&nt(i,t,p,null,n,d);for(h in n)d=n[h],f=e[h],!n.hasOwnProperty(h)||d===f||d==null&&f==null||nt(i,t,h,d,n,f)}function Eg(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function g1(){if(typeof performance.getEntriesByType=="function"){for(var i=0,t=0,e=performance.getEntriesByType("resource"),n=0;n<e.length;n++){var s=e[n],a=s.transferSize,r=s.initiatorType,o=s.duration;if(a&&o&&Eg(r)){for(r=0,o=s.responseEnd,n+=1;n<e.length;n++){var l=e[n],c=l.startTime;if(c>o)break;var u=l.transferSize,h=l.initiatorType;u&&Eg(h)&&(l=l.responseEnd,r+=u*(l<o?1:(o-c)/(l-c)))}if(--n,t+=8*(a+r)/(s.duration/1e3),i++,10<i)break}}if(0<i)return t/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var ju=null,Vu=null;function Io(i){return i.nodeType===9?i:i.ownerDocument}function Tg(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function dy(i,t){if(i===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&t==="foreignObject"?0:i}function Xu(i,t){return i==="textarea"||i==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var eu=null;function m1(){var i=window.event;return i&&i.type==="popstate"?i===eu?!1:(eu=i,!0):(eu=null,!1)}var fy=typeof setTimeout=="function"?setTimeout:void 0,y1=typeof clearTimeout=="function"?clearTimeout:void 0,wg=typeof Promise=="function"?Promise:void 0,b1=typeof queueMicrotask=="function"?queueMicrotask:typeof wg<"u"?function(i){return wg.resolve(null).then(i).catch(v1)}:fy;function v1(i){setTimeout(function(){throw i})}function en(i){return i==="head"}function _g(i,t){var e=t,n=0;do{var s=e.nextSibling;if(i.removeChild(e),s&&s.nodeType===8)if(e=s.data,e==="/$"||e==="/&"){if(n===0){i.removeChild(s),Ts(t);return}n--}else if(e==="$"||e==="$?"||e==="$~"||e==="$!"||e==="&")n++;else if(e==="html")Ca(i.ownerDocument.documentElement);else if(e==="head"){e=i.ownerDocument.head,Ca(e);for(var a=e.firstChild;a;){var r=a.nextSibling,o=a.nodeName;a[Ya]||o==="SCRIPT"||o==="STYLE"||o==="LINK"&&a.rel.toLowerCase()==="stylesheet"||e.removeChild(a),a=r}}else e==="body"&&Ca(i.ownerDocument.body);e=s}while(e);Ts(t)}function xg(i,t){var e=i;i=0;do{var n=e.nextSibling;if(e.nodeType===1?t?(e._stashedDisplay=e.style.display,e.style.display="none"):(e.style.display=e._stashedDisplay||"",e.getAttribute("style")===""&&e.removeAttribute("style")):e.nodeType===3&&(t?(e._stashedText=e.nodeValue,e.nodeValue=""):e.nodeValue=e._stashedText||""),n&&n.nodeType===8)if(e=n.data,e==="/$"){if(i===0)break;i--}else e!=="$"&&e!=="$?"&&e!=="$~"&&e!=="$!"||i++;e=n}while(e)}function Yu(i){var t=i.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var e=t;switch(t=t.nextSibling,e.nodeName){case"HTML":case"HEAD":case"BODY":Yu(e),nh(e);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(e.rel.toLowerCase()==="stylesheet")continue}i.removeChild(e)}}function A1(i,t,e,n){for(;i.nodeType===1;){var s=e;if(i.nodeName.toLowerCase()!==t.toLowerCase()){if(!n&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(n){if(!i[Ya])switch(t){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(a=i.getAttribute("rel"),a==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(a!==s.rel||i.getAttribute("href")!==(s.href==null||s.href===""?null:s.href)||i.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin)||i.getAttribute("title")!==(s.title==null?null:s.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(a=i.getAttribute("src"),(a!==(s.src==null?null:s.src)||i.getAttribute("type")!==(s.type==null?null:s.type)||i.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin))&&a&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(t==="input"&&i.type==="hidden"){var a=s.name==null?null:""+s.name;if(s.type==="hidden"&&i.getAttribute("name")===a)return i}else return i;if(i=Le(i.nextSibling),i===null)break}return null}function S1(i,t,e){if(t==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!e||(i=Le(i.nextSibling),i===null))return null;return i}function py(i,t){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!t||(i=Le(i.nextSibling),i===null))return null;return i}function qu(i){return i.data==="$?"||i.data==="$~"}function Ku(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function E1(i,t){var e=i.ownerDocument;if(i.data==="$~")i._reactRetry=t;else if(i.data!=="$?"||e.readyState!=="loading")t();else{var n=function(){t(),e.removeEventListener("DOMContentLoaded",n)};e.addEventListener("DOMContentLoaded",n),i._reactRetry=n}}function Le(i){for(;i!=null;i=i.nextSibling){var t=i.nodeType;if(t===1||t===3)break;if(t===8){if(t=i.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return i}var Wu=null;function Cg(i){i=i.nextSibling;for(var t=0;i;){if(i.nodeType===8){var e=i.data;if(e==="/$"||e==="/&"){if(t===0)return Le(i.nextSibling);t--}else e!=="$"&&e!=="$!"&&e!=="$?"&&e!=="$~"&&e!=="&"||t++}i=i.nextSibling}return null}function Mg(i){i=i.previousSibling;for(var t=0;i;){if(i.nodeType===8){var e=i.data;if(e==="$"||e==="$!"||e==="$?"||e==="$~"||e==="&"){if(t===0)return i;t--}else e!=="/$"&&e!=="/&"||t++}i=i.previousSibling}return null}function gy(i,t,e){switch(t=Io(e),i){case"html":if(i=t.documentElement,!i)throw Error(x(452));return i;case"head":if(i=t.head,!i)throw Error(x(453));return i;case"body":if(i=t.body,!i)throw Error(x(454));return i;default:throw Error(x(451))}}function Ca(i){for(var t=i.attributes;t.length;)i.removeAttributeNode(t[0]);nh(i)}var ke=new Map,Dg=new Set;function Fo(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var vi=Z.d;Z.d={f:T1,r:w1,D:_1,C:x1,L:C1,m:M1,X:O1,S:D1,M:R1};function T1(){var i=vi.f(),t=il();return i||t}function w1(i){var t=_s(i);t!==null&&t.tag===5&&t.type==="form"?l0(t):vi.r(i)}var Ds=typeof document>"u"?null:document;function my(i,t,e){var n=Ds;if(n&&typeof t=="string"&&t){var s=De(t);s='link[rel="'+i+'"][href="'+s+'"]',typeof e=="string"&&(s+='[crossorigin="'+e+'"]'),Dg.has(s)||(Dg.add(s),i={rel:i,crossOrigin:e,href:t},n.querySelector(s)===null&&(t=n.createElement("link"),Xt(t,"link",i),Ft(t),n.head.appendChild(t)))}}function _1(i){vi.D(i),my("dns-prefetch",i,null)}function x1(i,t){vi.C(i,t),my("preconnect",i,t)}function C1(i,t,e){vi.L(i,t,e);var n=Ds;if(n&&i&&t){var s='link[rel="preload"][as="'+De(t)+'"]';t==="image"&&e&&e.imageSrcSet?(s+='[imagesrcset="'+De(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(s+='[imagesizes="'+De(e.imageSizes)+'"]')):s+='[href="'+De(i)+'"]';var a=s;switch(t){case"style":a=Es(i);break;case"script":a=Os(i)}ke.has(a)||(i=gt({rel:"preload",href:t==="image"&&e&&e.imageSrcSet?void 0:i,as:t},e),ke.set(a,i),n.querySelector(s)!==null||t==="style"&&n.querySelector(Za(a))||t==="script"&&n.querySelector(Ja(a))||(t=n.createElement("link"),Xt(t,"link",i),Ft(t),n.head.appendChild(t)))}}function M1(i,t){vi.m(i,t);var e=Ds;if(e&&i){var n=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+De(n)+'"][href="'+De(i)+'"]',a=s;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":a=Os(i)}if(!ke.has(a)&&(i=gt({rel:"modulepreload",href:i},t),ke.set(a,i),e.querySelector(s)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(Ja(a)))return}n=e.createElement("link"),Xt(n,"link",i),Ft(n),e.head.appendChild(n)}}}function D1(i,t,e){vi.S(i,t,e);var n=Ds;if(n&&i){var s=rs(n).hoistableStyles,a=Es(i);t=t||"default";var r=s.get(a);if(!r){var o={loading:0,preload:null};if(r=n.querySelector(Za(a)))o.loading=5;else{i=gt({rel:"stylesheet",href:i,"data-precedence":t},e),(e=ke.get(a))&&Gh(i,e);var l=r=n.createElement("link");Ft(l),Xt(l,"link",i),l._p=new Promise(function(c,u){l.onload=c,l.onerror=u}),l.addEventListener("load",function(){o.loading|=1}),l.addEventListener("error",function(){o.loading|=2}),o.loading|=4,uo(r,t,n)}r={type:"stylesheet",instance:r,count:1,state:o},s.set(a,r)}}}function O1(i,t){vi.X(i,t);var e=Ds;if(e&&i){var n=rs(e).hoistableScripts,s=Os(i),a=n.get(s);a||(a=e.querySelector(Ja(s)),a||(i=gt({src:i,async:!0},t),(t=ke.get(s))&&jh(i,t),a=e.createElement("script"),Ft(a),Xt(a,"link",i),e.head.appendChild(a)),a={type:"script",instance:a,count:1,state:null},n.set(s,a))}}function R1(i,t){vi.M(i,t);var e=Ds;if(e&&i){var n=rs(e).hoistableScripts,s=Os(i),a=n.get(s);a||(a=e.querySelector(Ja(s)),a||(i=gt({src:i,async:!0,type:"module"},t),(t=ke.get(s))&&jh(i,t),a=e.createElement("script"),Ft(a),Xt(a,"link",i),e.head.appendChild(a)),a={type:"script",instance:a,count:1,state:null},n.set(s,a))}}function Og(i,t,e,n){var s=(s=Ui.current)?Fo(s):null;if(!s)throw Error(x(446));switch(i){case"meta":case"title":return null;case"style":return typeof e.precedence=="string"&&typeof e.href=="string"?(t=Es(e.href),e=rs(s).hoistableStyles,n=e.get(t),n||(n={type:"style",instance:null,count:0,state:null},e.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){i=Es(e.href);var a=rs(s).hoistableStyles,r=a.get(i);if(r||(s=s.ownerDocument||s,r={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},a.set(i,r),(a=s.querySelector(Za(i)))&&!a._p&&(r.instance=a,r.state.loading=5),ke.has(i)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},ke.set(i,e),a||N1(s,i,e,r.state))),t&&n===null)throw Error(x(528,""));return r}if(t&&n!==null)throw Error(x(529,""));return null;case"script":return t=e.async,e=e.src,typeof e=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Os(e),e=rs(s).hoistableScripts,n=e.get(t),n||(n={type:"script",instance:null,count:0,state:null},e.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(x(444,i))}}function Es(i){return'href="'+De(i)+'"'}function Za(i){return'link[rel="stylesheet"]['+i+"]"}function yy(i){return gt({},i,{"data-precedence":i.precedence,precedence:null})}function N1(i,t,e,n){i.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=i.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),Xt(t,"link",e),Ft(t),i.head.appendChild(t))}function Os(i){return'[src="'+De(i)+'"]'}function Ja(i){return"script[async]"+i}function Rg(i,t,e){if(t.count++,t.instance===null)switch(t.type){case"style":var n=i.querySelector('style[data-href~="'+De(e.href)+'"]');if(n)return t.instance=n,Ft(n),n;var s=gt({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return n=(i.ownerDocument||i).createElement("style"),Ft(n),Xt(n,"style",s),uo(n,e.precedence,i),t.instance=n;case"stylesheet":s=Es(e.href);var a=i.querySelector(Za(s));if(a)return t.state.loading|=4,t.instance=a,Ft(a),a;n=yy(e),(s=ke.get(s))&&Gh(n,s),a=(i.ownerDocument||i).createElement("link"),Ft(a);var r=a;return r._p=new Promise(function(o,l){r.onload=o,r.onerror=l}),Xt(a,"link",n),t.state.loading|=4,uo(a,e.precedence,i),t.instance=a;case"script":return a=Os(e.src),(s=i.querySelector(Ja(a)))?(t.instance=s,Ft(s),s):(n=e,(s=ke.get(a))&&(n=gt({},e),jh(n,s)),i=i.ownerDocument||i,s=i.createElement("script"),Ft(s),Xt(s,"link",n),i.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(x(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,uo(n,e.precedence,i));return t.instance}function uo(i,t,e){for(var n=e.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=n.length?n[n.length-1]:null,a=s,r=0;r<n.length;r++){var o=n[r];if(o.dataset.precedence===t)a=o;else if(a!==s)break}a?a.parentNode.insertBefore(i,a.nextSibling):(t=e.nodeType===9?e.head:e,t.insertBefore(i,t.firstChild))}function Gh(i,t){i.crossOrigin==null&&(i.crossOrigin=t.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=t.referrerPolicy),i.title==null&&(i.title=t.title)}function jh(i,t){i.crossOrigin==null&&(i.crossOrigin=t.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=t.referrerPolicy),i.integrity==null&&(i.integrity=t.integrity)}var ho=null;function Ng(i,t,e){if(ho===null){var n=new Map,s=ho=new Map;s.set(e,n)}else s=ho,n=s.get(e),n||(n=new Map,s.set(e,n));if(n.has(i))return n;for(n.set(i,null),e=e.getElementsByTagName(i),s=0;s<e.length;s++){var a=e[s];if(!(a[Ya]||a[Gt]||i==="link"&&a.getAttribute("rel")==="stylesheet")&&a.namespaceURI!=="http://www.w3.org/2000/svg"){var r=a.getAttribute(t)||"";r=i+r;var o=n.get(r);o?o.push(a):n.set(r,[a])}}return n}function Lg(i,t,e){i=i.ownerDocument||i,i.head.insertBefore(e,t==="title"?i.querySelector("head > title"):null)}function L1(i,t,e){if(e===1||t.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(i=t.disabled,typeof t.precedence=="string"&&i==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function by(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function k1(i,t,e,n){if(e.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(e.state.loading&4)===0){if(e.instance===null){var s=Es(n.href),a=t.querySelector(Za(s));if(a){t=a._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(i.count++,i=Ho.bind(i),t.then(i,i)),e.state.loading|=4,e.instance=a,Ft(a);return}a=t.ownerDocument||t,n=yy(n),(s=ke.get(s))&&Gh(n,s),a=a.createElement("link"),Ft(a);var r=a;r._p=new Promise(function(o,l){r.onload=o,r.onerror=l}),Xt(a,"link",n),e.instance=a}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(e,t),(t=e.state.preload)&&(e.state.loading&3)===0&&(i.count++,e=Ho.bind(i),t.addEventListener("load",e),t.addEventListener("error",e))}}var iu=0;function B1(i,t){return i.stylesheets&&i.count===0&&fo(i,i.stylesheets),0<i.count||0<i.imgCount?function(e){var n=setTimeout(function(){if(i.stylesheets&&fo(i,i.stylesheets),i.unsuspend){var a=i.unsuspend;i.unsuspend=null,a()}},6e4+t);0<i.imgBytes&&iu===0&&(iu=62500*g1());var s=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&fo(i,i.stylesheets),i.unsuspend)){var a=i.unsuspend;i.unsuspend=null,a()}},(i.imgBytes>iu?50:800)+t);return i.unsuspend=e,function(){i.unsuspend=null,clearTimeout(n),clearTimeout(s)}}:null}function Ho(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)fo(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Uo=null;function fo(i,t){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Uo=new Map,t.forEach(z1,i),Uo=null,Ho.call(i))}function z1(i,t){if(!(t.state.loading&4)){var e=Uo.get(i);if(e)var n=e.get(null);else{e=new Map,Uo.set(i,e);for(var s=i.querySelectorAll("link[data-precedence],style[data-precedence]"),a=0;a<s.length;a++){var r=s[a];(r.nodeName==="LINK"||r.getAttribute("media")!=="not all")&&(e.set(r.dataset.precedence,r),n=r)}n&&e.set(null,n)}s=t.instance,r=s.getAttribute("data-precedence"),a=e.get(r)||n,a===n&&e.set(null,s),e.set(r,s),this.count++,n=Ho.bind(this),s.addEventListener("load",n),s.addEventListener("error",n),a?a.parentNode.insertBefore(s,a.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(s,i.firstChild)),t.state.loading|=4}}var Fa={$$typeof:li,Provider:null,Consumer:null,_currentValue:dn,_currentValue2:dn,_threadCount:0};function P1(i,t,e,n,s,a,r,o,l){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Mc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mc(0),this.hiddenUpdates=Mc(null),this.identifierPrefix=n,this.onUncaughtError=s,this.onCaughtError=a,this.onRecoverableError=r,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function vy(i,t,e,n,s,a,r,o,l,c,u,h){return i=new P1(i,t,e,r,l,c,u,h,o),t=1,a===!0&&(t|=24),a=ue(3,null,null,t),i.current=a,a.stateNode=i,t=gh(),t.refCount++,i.pooledCache=t,t.refCount++,a.memoizedState={element:n,isDehydrated:e,cache:t},bh(a),i}function Ay(i){return i?(i=is,i):is}function Sy(i,t,e,n,s,a){s=Ay(s),n.context===null?n.context=s:n.pendingContext=s,n=ji(t),n.payload={element:e},a=a===void 0?null:a,a!==null&&(n.callback=a),e=Vi(i,n,t),e!==null&&(ne(e,i,t),va(e,i,t))}function kg(i,t){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var e=i.retryLane;i.retryLane=e!==0&&e<t?e:t}}function Vh(i,t){kg(i,t),(i=i.alternate)&&kg(i,t)}function Ey(i){if(i.tag===13||i.tag===31){var t=_n(i,67108864);t!==null&&ne(t,i,67108864),Vh(i,67108864)}}function Bg(i){if(i.tag===13||i.tag===31){var t=ge();t=eh(t);var e=_n(i,t);e!==null&&ne(e,i,t),Vh(i,t)}}var Go=!0;function I1(i,t,e,n){var s=k.T;k.T=null;var a=Z.p;try{Z.p=2,Xh(i,t,e,n)}finally{Z.p=a,k.T=s}}function F1(i,t,e,n){var s=k.T;k.T=null;var a=Z.p;try{Z.p=8,Xh(i,t,e,n)}finally{Z.p=a,k.T=s}}function Xh(i,t,e,n){if(Go){var s=Qu(n);if(s===null)tu(i,t,n,jo,e),zg(i,n);else if(U1(s,i,t,e,n))n.stopPropagation();else if(zg(i,n),t&4&&-1<H1.indexOf(i)){for(;s!==null;){var a=_s(s);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var r=cn(a.pendingLanes);if(r!==0){var o=a;for(o.pendingLanes|=2,o.entangledLanes|=2;r;){var l=1<<31-pe(r);o.entanglements[1]|=l,r&=~l}Qe(a),($&6)===0&&(No=de()+500,$a(0,!1))}}break;case 31:case 13:o=_n(a,2),o!==null&&ne(o,a,2),il(),Vh(a,2)}if(a=Qu(n),a===null&&tu(i,t,n,jo,e),a===s)break;s=a}s!==null&&n.stopPropagation()}else tu(i,t,n,null,e)}}function Qu(i){return i=ah(i),Yh(i)}var jo=null;function Yh(i){if(jo=null,i=Qn(i),i!==null){var t=Ga(i);if(t===null)i=null;else{var e=t.tag;if(e===13){if(i=Gg(t),i!==null)return i;i=null}else if(e===31){if(i=jg(t),i!==null)return i;i=null}else if(e===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;i=null}else t!==i&&(i=null)}}return jo=i,null}function Ty(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Cv()){case qg:return 2;case Kg:return 8;case bo:case Mv:return 32;case Wg:return 268435456;default:return 32}default:return 32}}var $u=!1,qi=null,Ki=null,Wi=null,Ha=new Map,Ua=new Map,Bi=[],H1="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function zg(i,t){switch(i){case"focusin":case"focusout":qi=null;break;case"dragenter":case"dragleave":Ki=null;break;case"mouseover":case"mouseout":Wi=null;break;case"pointerover":case"pointerout":Ha.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ua.delete(t.pointerId)}}function la(i,t,e,n,s,a){return i===null||i.nativeEvent!==a?(i={blockedOn:t,domEventName:e,eventSystemFlags:n,nativeEvent:a,targetContainers:[s]},t!==null&&(t=_s(t),t!==null&&Ey(t)),i):(i.eventSystemFlags|=n,t=i.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),i)}function U1(i,t,e,n,s){switch(t){case"focusin":return qi=la(qi,i,t,e,n,s),!0;case"dragenter":return Ki=la(Ki,i,t,e,n,s),!0;case"mouseover":return Wi=la(Wi,i,t,e,n,s),!0;case"pointerover":var a=s.pointerId;return Ha.set(a,la(Ha.get(a)||null,i,t,e,n,s)),!0;case"gotpointercapture":return a=s.pointerId,Ua.set(a,la(Ua.get(a)||null,i,t,e,n,s)),!0}return!1}function wy(i){var t=Qn(i.target);if(t!==null){var e=Ga(t);if(e!==null){if(t=e.tag,t===13){if(t=Gg(e),t!==null){i.blockedOn=t,vp(i.priority,function(){Bg(e)});return}}else if(t===31){if(t=jg(e),t!==null){i.blockedOn=t,vp(i.priority,function(){Bg(e)});return}}else if(t===3&&e.stateNode.current.memoizedState.isDehydrated){i.blockedOn=e.tag===3?e.stateNode.containerInfo:null;return}}}i.blockedOn=null}function po(i){if(i.blockedOn!==null)return!1;for(var t=i.targetContainers;0<t.length;){var e=Qu(i.nativeEvent);if(e===null){e=i.nativeEvent;var n=new e.constructor(e.type,e);gu=n,e.target.dispatchEvent(n),gu=null}else return t=_s(e),t!==null&&Ey(t),i.blockedOn=e,!1;t.shift()}return!0}function Pg(i,t,e){po(i)&&e.delete(t)}function G1(){$u=!1,qi!==null&&po(qi)&&(qi=null),Ki!==null&&po(Ki)&&(Ki=null),Wi!==null&&po(Wi)&&(Wi=null),Ha.forEach(Pg),Ua.forEach(Pg)}function $r(i,t){i.blockedOn===t&&(i.blockedOn=null,$u||($u=!0,zt.unstable_scheduleCallback(zt.unstable_NormalPriority,G1)))}var Zr=null;function Ig(i){Zr!==i&&(Zr=i,zt.unstable_scheduleCallback(zt.unstable_NormalPriority,function(){Zr===i&&(Zr=null);for(var t=0;t<i.length;t+=3){var e=i[t],n=i[t+1],s=i[t+2];if(typeof n!="function"){if(Yh(n||e)===null)continue;break}var a=_s(e);a!==null&&(i.splice(t,3),t-=3,Ru(a,{pending:!0,data:s,method:e.method,action:n},n,s))}}))}function Ts(i){function t(l){return $r(l,i)}qi!==null&&$r(qi,i),Ki!==null&&$r(Ki,i),Wi!==null&&$r(Wi,i),Ha.forEach(t),Ua.forEach(t);for(var e=0;e<Bi.length;e++){var n=Bi[e];n.blockedOn===i&&(n.blockedOn=null)}for(;0<Bi.length&&(e=Bi[0],e.blockedOn===null);)wy(e),e.blockedOn===null&&Bi.shift();if(e=(i.ownerDocument||i).$$reactFormReplay,e!=null)for(n=0;n<e.length;n+=3){var s=e[n],a=e[n+1],r=s[se]||null;if(typeof a=="function")r||Ig(e);else if(r){var o=null;if(a&&a.hasAttribute("formAction")){if(s=a,r=a[se]||null)o=r.formAction;else if(Yh(s)!==null)continue}else o=r.action;typeof o=="function"?e[n+1]=o:(e.splice(n,3),n-=3),Ig(e)}}}function _y(){function i(a){a.canIntercept&&a.info==="react-transition"&&a.intercept({handler:function(){return new Promise(function(r){return s=r})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),n||setTimeout(e,20)}function e(){if(!n&&!navigation.transition){var a=navigation.currentEntry;a&&a.url!=null&&navigation.navigate(a.url,{state:a.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var n=!1,s=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(e,100),function(){n=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),s!==null&&(s(),s=null)}}}function qh(i){this._internalRoot=i}al.prototype.render=qh.prototype.render=function(i){var t=this._internalRoot;if(t===null)throw Error(x(409));var e=t.current,n=ge();Sy(e,n,i,t,null,null)};al.prototype.unmount=qh.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var t=i.containerInfo;Sy(i.current,2,null,i,null,null),il(),t[ws]=null}};function al(i){this._internalRoot=i}al.prototype.unstable_scheduleHydration=function(i){if(i){var t=tm();i={blockedOn:null,target:i,priority:t};for(var e=0;e<Bi.length&&t!==0&&t<Bi[e].priority;e++);Bi.splice(e,0,i),e===0&&wy(i)}};var Fg=Hg.version;if(Fg!=="19.2.3")throw Error(x(527,Fg,"19.2.3"));Z.findDOMNode=function(i){var t=i._reactInternals;if(t===void 0)throw typeof i.render=="function"?Error(x(188)):(i=Object.keys(i).join(","),Error(x(268,i)));return i=Av(t),i=i!==null?Vg(i):null,i=i===null?null:i.stateNode,i};var j1={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:k,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(ca=__REACT_DEVTOOLS_GLOBAL_HOOK__,!ca.isDisabled&&ca.supportsFiber))try{ja=ca.inject(j1),fe=ca}catch{}var ca;rl.createRoot=function(i,t){if(!Ug(i))throw Error(x(299));var e=!1,n="",s=m0,a=y0,r=b0;return t!=null&&(t.unstable_strictMode===!0&&(e=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(r=t.onRecoverableError)),t=vy(i,1,!1,null,null,e,n,null,s,a,r,_y),i[ws]=t.current,Uh(i),new qh(t)};rl.hydrateRoot=function(i,t,e){if(!Ug(i))throw Error(x(299));var n=!1,s="",a=m0,r=y0,o=b0,l=null;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(s=e.identifierPrefix),e.onUncaughtError!==void 0&&(a=e.onUncaughtError),e.onCaughtError!==void 0&&(r=e.onCaughtError),e.onRecoverableError!==void 0&&(o=e.onRecoverableError),e.formState!==void 0&&(l=e.formState)),t=vy(i,1,!0,t,e??null,n,s,l,a,r,o,_y),t.context=Ay(null),e=t.current,n=ge(),n=eh(n),s=ji(n),s.callback=null,Vi(e,s,n),e=n,t.current.lanes=e,Xa(t,e),Qe(t),i[ws]=t.current,Uh(i),new al(t)};rl.version="19.2.3"});var Dy=je(($S,My)=>{"use strict";function Cy(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Cy)}catch(i){console.error(i)}}Cy(),My.exports=xy()});var Gy=je(ll=>{"use strict";var W1=Symbol.for("react.transitional.element"),Q1=Symbol.for("react.fragment");function Uy(i,t,e){var n=null;if(e!==void 0&&(n=""+e),t.key!==void 0&&(n=""+t.key),"key"in t){e={};for(var s in t)s!=="key"&&(e[s]=t[s])}else e=t;return t=e.ref,{$$typeof:W1,type:i,key:n,ref:t!==void 0?t:null,props:e}}ll.Fragment=Q1;ll.jsx=Uy;ll.jsxs=Uy});var tr=je((lE,jy)=>{"use strict";jy.exports=Gy()});var Bb={};$b(Bb,{AbortException:()=>Ge,AnnotationEditorLayer:()=>Xl,AnnotationEditorParamsType:()=>H,AnnotationEditorType:()=>P,AnnotationEditorUIManager:()=>rn,AnnotationLayer:()=>Il,AnnotationMode:()=>Si,AnnotationType:()=>St,CSSConstants:()=>El,ColorPicker:()=>Ar,DOMSVGFactory:()=>kn,DrawLayer:()=>Yl,FeatureTest:()=>J,GlobalWorkerOptions:()=>sn,ImageKind:()=>sr,InvalidPDFException:()=>Is,MathClamp:()=>ht,OPS:()=>Ue,OutputScale:()=>Je,PDFDataRangeTransport:()=>vr,PDFDateString:()=>Hs,PDFWorker:()=>Xs,PasswordException:()=>Ps,PasswordResponses:()=>gb,PermissionFlag:()=>pb,PixelsPerInch:()=>wi,RenderingCancelledException:()=>Fs,ResponseException:()=>Nn,SignatureExtractor:()=>Ei,SupportedImageMimeTypes:()=>Sl,TextLayer:()=>Vs,TextLayerImages:()=>ql,TouchManager:()=>fr,Util:()=>M,VerbosityLevel:()=>Cr,XfaLayer:()=>dr,applyOpacity:()=>vb,build:()=>kb,createValidAbsoluteUrl:()=>Bf,fetchData:()=>Zl,findContrastColor:()=>Ab,getDocument:()=>Nb,getFilenameFromUrl:()=>yb,getPdfFilenameFromUrl:()=>bb,getRGB:()=>Ks,getRGBA:()=>qs,getUuid:()=>Pf,isDataScheme:()=>Mr,isPdfFile:()=>Jl,isValidExplicitDest:()=>Tb,makeArr:()=>Ys,makeMap:()=>$l,makeObj:()=>vl,noContextMenu:()=>Te,normalizeUnicode:()=>mb,renderRichText:()=>If,setLayerDimensions:()=>an,shadow:()=>B,stopEvent:()=>bt,updateUrlHash:()=>zf,version:()=>Lb});function Z1(i){Number.isInteger(i)&&(Kl=i)}function J1(){return Kl}function Wl(i){Kl>=Cr.INFOS&&console.info(`Info: ${i}`)}function I(i){Kl>=Cr.WARNINGS&&console.warn(`Warning: ${i}`)}function Q(i){throw new Error(i)}function Et(i,t){i||Q(t)}function tS(i){switch(i?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Bf(i,t=null,e=null){if(!i)return null;if(e&&typeof i=="string"&&(e.addDefaultProtocol&&i.startsWith("www.")&&i.match(/\./g)?.length>=2&&(i=`http://${i}`),e.tryConvertEncoding))try{i=iS(i)}catch{}let n=t?URL.parse(i,t):URL.parse(i);return tS(n)?n:null}function zf(i,t,e=!1){let n=URL.parse(i);return n?(n.hash=t,n.href):e&&Bf(i,"http://example.com")?i.split("#",1)[0]+`${t?`#${t}`:""}`:""}function id(i){return i.substring(i.lastIndexOf("/")+1)}function B(i,t,e,n=!1){return Object.defineProperty(i,t,{value:e,enumerable:!n,configurable:!0,writable:!1}),e}function eS(i){(typeof i!="object"||i?.length===void 0)&&Q("Invalid argument for bytesToString");let t=i.length,e=8192;if(t<e)return String.fromCharCode.apply(null,i);let n=[];for(let s=0;s<t;s+=e){let a=Math.min(s+e,t),r=i.subarray(s,a);n.push(String.fromCharCode.apply(null,r))}return n.join("")}function Ql(i){typeof i!="string"&&Q("Invalid argument for stringToBytes");let t=i.length,e=new Uint8Array(t);for(let n=0;n<t;++n)e[n]=i.charCodeAt(n)&255;return e}function iS(i){return decodeURIComponent(escape(i))}function mb(i){return Qh||(Qh=/([\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,Vy=new Map([["\uFB05","\u017Ft"]])),i.replaceAll(Qh,(t,e,n)=>e?e.normalize("NFKC"):Vy.get(n))}function Pf(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();let i=new Uint8Array(32);return crypto.getRandomValues(i),eS(i)}function nS(i,t,e){if(!Array.isArray(e)||e.length<2)return!1;let[n,s,...a]=e;if(!i(n)&&!Number.isInteger(n)||!t(s))return!1;let r=a.length,o=!0;switch(s.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 a)if(!(typeof l=="number"||o&&l===null))return!1;return!0}function ht(i,t,e){return Math.min(Math.max(i,t),e)}async function Zl(i,t="text"){if(rr(i,document.baseURI)){let e=await fetch(i);if(!e.ok)throw new Error(e.statusText);switch(t){case"blob":return e.blob();case"bytes":return e.bytes();case"json":return e.json()}return e.text()}return new Promise((e,n)=>{let s=new XMLHttpRequest;s.open("GET",i,!0),s.responseType=t==="bytes"?"arraybuffer":t,s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE){if(s.status===200||s.status===0){switch(t){case"bytes":e(new Uint8Array(s.response));return;case"blob":case"json":e(s.response);return}e(s.responseText);return}n(new Error(s.statusText))}},s.send(null)})}function Mr(i){let t=i.length,e=0;for(;e<t&&i[e].trim()==="";)e++;return i.substring(e,e+5).toLowerCase()==="data:"}function Jl(i){return typeof i=="string"&&/\.pdf$/i.test(i)}function yb(i){return[i]=i.split(/[#?]/,1),id(i)}function bb(i,t="document.pdf"){if(typeof i!="string")return t;if(Mr(i))return I('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;let n=(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})(i);if(!n)return t;let s=o=>{try{let l=decodeURIComponent(o);return l.includes("/")&&(l=id(l),l.length===4&&a.test(l))?o:l}catch{return o}},a=/\.pdf$/i,r=id(n.pathname);if(a.test(r))return s(r);if(n.searchParams.size>0){let o=c=>[...c].findLast(u=>a.test(u)),l=o(n.searchParams.values())??o(n.searchParams.keys());if(l)return s(l)}if(n.hash){let l=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(n.hash);if(l)return s(l[0])}return t}function rr(i,t){let e=t?URL.parse(i,t):URL.parse(i);return/https?:/.test(e?.protocol??"")}function Te(i){i.preventDefault()}function bt(i){i.preventDefault(),i.stopPropagation()}function qs(i){if(i.startsWith("#")){let e=i.slice(1);return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16),e.length>=8?parseInt(e.slice(6,8),16)/255:1]}if(i.startsWith("rgb(")){let[e,n,s]=i.slice(4,-1).split(",").map(a=>parseInt(a,10));return[e,n,s,1]}if(i.startsWith("rgba(")){let e=i.slice(5,-1).split(",");return[parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10),parseFloat(e[3])]}let t=i.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);return t?[Math.round(parseFloat(t[1])*255),Math.round(parseFloat(t[2])*255),Math.round(parseFloat(t[3])*255),t[4]!==void 0&&t[4]!=="none"?parseFloat(t[4]):1]:null}function Ks(i){let t=qs(i);return t?t.slice(0,3):(I(`Not a valid color format: "${i}"`),[0,0,0])}function sS(i){let t=document.createElement("span");t.style.visibility="hidden",t.style.colorScheme="only light",document.body.append(t);for(let e of i.keys()){t.style.color=e;let n=window.getComputedStyle(t).color;i.set(e,Ks(n))}t.remove()}function ut(i){let{a:t,b:e,c:n,d:s,e:a,f:r}=i.getTransform();return[t,e,n,s,a,r]}function $e(i){let{a:t,b:e,c:n,d:s,e:a,f:r}=i.getTransform().invertSelf();return[t,e,n,s,a,r]}function an(i,t,e=!1,n=!0){if(t instanceof ur){let{pageWidth:s,pageHeight:a}=t.rawDims,{style:r}=i,o=`round(down, var(--total-scale-factor) * ${s}px, var(--scale-round-x))`,l=`round(down, var(--total-scale-factor) * ${a}px, var(--scale-round-y))`;!e||t.rotation%180===0?(r.width=o,r.height=l):(r.width=l,r.height=o)}n&&i.setAttribute("data-main-rotation",t.rotation)}function vb(i,t){t=ht(t??1,0,1);let e=255*(1-t);return i.map(n=>Math.round(n*t+e))}function Xy(i,t){let e=i[0]/255,n=i[1]/255,s=i[2]/255,a=Math.max(e,n,s),r=Math.min(e,n,s),o=(a+r)/2;if(a===r)t[0]=t[1]=0;else{let l=a-r;switch(t[1]=o<.5?l/(a+r):l/(2-a-r),a){case e:t[0]=((n-s)/l+(n<s?6:0))*60;break;case n:t[0]=((s-e)/l+2)*60;break;case s:t[0]=((e-n)/l+4)*60;break}}t[2]=o}function ad(i,t){let e=i[0],n=i[1],s=i[2],a=(1-Math.abs(2*s-1))*n,r=a*(1-Math.abs(e/60%2-1)),o=s-a/2;switch(Math.floor(e/60)){case 0:t[0]=a+o,t[1]=r+o,t[2]=o;break;case 1:t[0]=r+o,t[1]=a+o,t[2]=o;break;case 2:t[0]=o,t[1]=a+o,t[2]=r+o;break;case 3:t[0]=o,t[1]=r+o,t[2]=a+o;break;case 4:t[0]=r+o,t[1]=o,t[2]=a+o;break;case 5:case 6:t[0]=a+o,t[1]=o,t[2]=r+o;break}}function Yy(i){return i<=.03928?i/12.92:((i+.055)/1.055)**2.4}function qy(i,t,e){ad(i,e),e.map(Yy);let n=.2126*e[0]+.7152*e[1]+.0722*e[2];ad(t,e),e.map(Yy);let s=.2126*e[0]+.7152*e[1]+.0722*e[2];return n>s?(n+.05)/(s+.05):(s+.05)/(n+.05)}function Ab(i,t){let e=i[0]+i[1]*256+i[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776,n=Ky.get(e);if(n)return n;let s=new Float32Array(9),a=s.subarray(0,3),r=s.subarray(3,6);Xy(i,r);let o=s.subarray(6,9);Xy(t,o);let l=o[2]<.5,c=l?12:4.5;if(r[2]=l?Math.sqrt(r[2]):1-Math.sqrt(1-r[2]),qy(r,o,a)<c){let u,h;l?(u=r[2],h=1):(u=0,h=r[2]);let d=.005;for(;h-u>d;){let f=r[2]=(u+h)/2;l===qy(r,o,a)<c?u=f:h=f}r[2]=l?h:u}return ad(r,a),n=M.makeHexColor(Math.round(a[0]*255),Math.round(a[1]*255),Math.round(a[2]*255)),Ky.set(e,n),n}function If({html:i,dir:t,className:e},n){let s=document.createDocumentFragment();if(typeof i=="string"){let a=document.createElement("p");a.dir=t||"auto";let r=i.split(/\r\n?|\n/);for(let o=0,l=r.length;o<l;++o){let c=r[o];a.append(document.createTextNode(c)),o<l-1&&a.append(document.createElement("br"))}s.append(a)}else dr.render({xfaHtml:i,div:s,intent:"richText"});s.firstElementChild.classList.add("richText",e),n.append(s)}function Sb(i){let t=new Path2D;if(!i)return t;for(let e=0,n=i.length;e<n;)switch(i[e++]){case er.moveTo:t.moveTo(i[e++],i[e++]);break;case er.lineTo:t.lineTo(i[e++],i[e++]);break;case er.curveTo:t.bezierCurveTo(i[e++],i[e++],i[e++],i[e++],i[e++],i[e++]);break;case er.quadraticCurveTo:t.quadraticCurveTo(i[e++],i[e++],i[e++],i[e++]);break;case er.closePath:t.closePath();break;default:I(`Unrecognized drawing path operator: ${i[e-1]}`);break}return t}function Eb(i,t,e){for(let n of e)t.addEventListener(n,i[n].bind(i))}function Zy(i,t,e,n,s,a){i[t*4+0]=Math.min(i[t*4+0],e),i[t*4+1]=Math.min(i[t*4+1],n),i[t*4+2]=Math.max(i[t*4+2],s),i[t*4+3]=Math.max(i[t*4+3],a)}function rS(i,t,e,n,s){let a;i?(i<0&&(a=s[0],s[0]=s[2],s[2]=a),s[0]*=i,s[2]*=i,t<0&&(a=s[1],s[1]=s[3],s[3]=a),s[1]*=t,s[3]*=t):s.fill(0),s[0]+=e,s[1]+=n,s[2]+=e,s[3]+=n}function oS(i){if(i instanceof URL)return i;if(typeof i=="string"){if(Se){if(/^[a-z][a-z0-9\-+.]+:/i.test(i))return new URL(i);let e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(i))}let t=URL.parse(i,window.location);if(t)return t}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function lS(i){if(Se&&typeof Buffer<"u"&&i instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength)return i;if(typeof i=="string")return Ql(i);if(i instanceof ArrayBuffer||ArrayBuffer.isView(i)||typeof i=="object"&&!isNaN(i?.length))return new Uint8Array(i);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function cl(i){if(typeof i!="string")return null;if(i.endsWith("/"))return i;throw new Error(`Invalid factory url: "${i}" must include trailing slash.`)}function tb(){}function re(i){if(i instanceof Ge||i instanceof Is||i instanceof Ps||i instanceof Nn||i instanceof ar)return i;switch(i instanceof Error||typeof i=="object"&&i!==null||Q('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),i.name){case"AbortException":return new Ge(i.message);case"InvalidPDFException":return new Is(i.message);case"PasswordException":return new Ps(i.message,i.code);case"ResponseException":return new Nn(i.message,i.status,i.missing);case"UnknownErrorException":return new ar(i.message,i.details)}return new ar(i.message,i.toString())}function Zh(i,t,e){return Math.round(e*i+(1-e)*t)}async function uS(i){let e=await process.getBuiltinModule("fs/promises").readFile(i);return new Uint8Array(e)}function wb({src:i,srcPos:t=0,dest:e,width:n,height:s,nonBlackColor:a=4294967295,inverseDecode:r=!1}){let o=J.isLittleEndian?4278190080:255,[l,c]=r?[a,o]:[o,a],u=n>>3,h=n&7,d=l^c,f=i.length;e=new Uint32Array(e.buffer);let m=0;for(let y=0;y<s;++y){for(let p=t+u;t<p;++t,m+=8){let g=i[t];e[m]=l^-(g>>7&1)&d,e[m+1]=l^-(g>>6&1)&d,e[m+2]=l^-(g>>5&1)&d,e[m+3]=l^-(g>>4&1)&d,e[m+4]=l^-(g>>3&1)&d,e[m+5]=l^-(g>>2&1)&d,e[m+6]=l^-(g>>1&1)&d,e[m+7]=l^-(g&1)&d}if(h===0)continue;let v=t<f?i[t++]:255;for(let p=0;p<h;++p,++m)e[m]=l^-(v>>7-p&1)&d}return{srcPos:t,destPos:m}}function hS({src:i,srcPos:t=0,dest:e,destPos:n=0,width:s,height:a}){let r=0,o=s*a*3,l=o>>2,c=new Uint32Array(i.buffer,t,l),u=J.isLittleEndian?4278190080:255;if(J.isLittleEndian){for(;r<l-2;r+=3,n+=4){let h=c[r],d=c[r+1],f=c[r+2];e[n]=h|u,e[n+1]=h>>>24|d<<8|u,e[n+2]=d>>>16|f<<16|u,e[n+3]=f>>>8|u}for(let h=r*4,d=t+o;h<d;h+=3)e[n++]=i[h]|i[h+1]<<8|i[h+2]<<16|u}else{for(;r<l-2;r+=3,n+=4){let h=c[r],d=c[r+1],f=c[r+2];e[n]=h|u,e[n+1]=h<<24|d>>>8|u,e[n+2]=d<<16|f>>>16|u,e[n+3]=f<<8|u}for(let h=r*4,d=t+o;h<d;h+=3)e[n++]=i[h]<<24|i[h+1]<<16|i[h+2]<<8|u}return{srcPos:t+o,destPos:n}}function fS(){return tc.init()}function pS(){return tc.isReady}function gS(){tc.loadMeshShader()}function mS(i,t,e,n,s,a,r,o){return tc.draw(i,t,e,n,s,a,r,o)}function bl(i,t){if(!t)return;let e=t[2]-t[0],n=t[3]-t[1],s=new Path2D;s.rect(t[0],t[1],e,n),i.clip(s)}function yS(i,t,e,n,s,a,r,o){let l=t.coords,c=t.colors,u=i.data,h=i.width*4,d;l[e*2+1]>l[n*2+1]&&(d=e,e=n,n=d,d=a,a=r,r=d),l[n*2+1]>l[s*2+1]&&(d=n,n=s,s=d,d=r,r=o,o=d),l[e*2+1]>l[n*2+1]&&(d=e,e=n,n=d,d=a,a=r,r=d);let f=(l[e*2]+t.offsetX)*t.scaleX,m=(l[e*2+1]+t.offsetY)*t.scaleY,y=(l[n*2]+t.offsetX)*t.scaleX,v=(l[n*2+1]+t.offsetY)*t.scaleY,p=(l[s*2]+t.offsetX)*t.scaleX,g=(l[s*2+1]+t.offsetY)*t.scaleY;if(m>=g)return;let b=c[a*4],A=c[a*4+1],S=c[a*4+2],E=c[r*4],T=c[r*4+1],w=c[r*4+2],_=c[o*4],C=c[o*4+1],D=c[o*4+2],N=Math.round(m),z=Math.round(g),X,lt,L,R,Lt,kt,Pe,xi;for(let at=N;at<=z;at++){if(at<v){let At=at<m?0:(m-at)/(m-v);X=f-(f-y)*At,lt=b-(b-E)*At,L=A-(A-T)*At,R=S-(S-w)*At}else{let At;at>g?At=1:v===g?At=0:At=(v-at)/(v-g),X=y-(y-p)*At,lt=E-(E-_)*At,L=T-(T-C)*At,R=w-(w-D)*At}let rt;at<m?rt=0:at>g?rt=1:rt=(m-at)/(m-g),Lt=f-(f-p)*rt,kt=b-(b-_)*rt,Pe=A-(A-C)*rt,xi=S-(S-D)*rt;let G=Math.round(Math.min(X,Lt)),Wt=Math.round(Math.max(X,Lt)),Ct=h*at+G*4;for(let At=G;At<=Wt;At++)rt=(X-At)/(X-Lt),rt<0?rt=0:rt>1&&(rt=1),u[Ct++]=lt-(lt-kt)*rt|0,u[Ct++]=L-(L-Pe)*rt|0,u[Ct++]=R-(R-xi)*rt|0,u[Ct++]=255}}function bS(i){switch(i[0]){case"RadialAxial":return new Bd(i);case"Mesh":return new zd(i);case"Dummy":return new Pd}throw new Error(`Unknown IR type: ${i[0]}`)}function nb(i,t){if(i._removeMirroring)throw new Error("Context is already forwarding operations.");let e=new Map;for(let n of["save","restore","rotate","scale","translate","transform","setTransform","resetTransform","clip","moveTo","lineTo","bezierCurveTo","quadraticCurveTo","arc","arcTo","ellipse","rect","roundRect","closePath","beginPath"]){let s=i[n];typeof s!="function"||typeof t[n]!="function"||(e.set(n,s),i[n]=function(...a){return t[n](...a),s.apply(this,a)})}i._removeMirroring=()=>{for(let[n,s]of e)i[n]=s;delete i._removeMirroring}}function hl(i,t,e,n,s,a,r,o,l,c){let[u,h,d,f,m,y]=ut(i);if(h===0&&d===0){let g=r*u+m,b=Math.round(g),A=o*f+y,S=Math.round(A),E=(r+l)*u+m,T=Math.abs(Math.round(E)-b)||1,w=(o+c)*f+y,_=Math.abs(Math.round(w)-S)||1;return i.setTransform(Math.sign(u),0,0,Math.sign(f),b,S),i.drawImage(t,e,n,s,a,0,0,T,_),i.setTransform(u,h,d,f,m,y),[T,_]}if(u===0&&f===0){let g=o*d+m,b=Math.round(g),A=r*h+y,S=Math.round(A),E=(o+c)*d+m,T=Math.abs(Math.round(E)-b)||1,w=(r+l)*h+y,_=Math.abs(Math.round(w)-S)||1;return i.setTransform(0,Math.sign(h),Math.sign(d),0,b,S),i.drawImage(t,e,n,s,a,0,0,_,T),i.setTransform(u,h,d,f,m,y),[_,T]}i.drawImage(t,e,n,s,a,r,o,l,c);let v=Math.hypot(u,h),p=Math.hypot(d,f);return[v*l,p*c]}function sb(i,t){let{width:e,height:n,kind:s}=t,a=n%oe,r=(n-a)/oe,o=a===0?r:r+1,l=i.createImageData(e,oe),c=0,u=t.data,h=l.data,d;if(s===sr.GRAYSCALE_1BPP)for(d=0;d<o;d++)({srcPos:c}=wb({src:u,srcPos:c,dest:h,width:e,height:d<r?oe:a})),i.putImageData(l,0,d*oe);else if(s===sr.RGBA_32BPP){let f=0,m=e*oe*4;for(d=0;d<r;d++)h.set(u.subarray(c,c+m)),c+=m,i.putImageData(l,0,f),f+=oe;d<o&&(m=e*a*4,h.set(u.subarray(c,c+m)),i.putImageData(l,0,f))}else if(s===sr.RGB_24BPP)for(d=0;d<o;d++)({srcPos:c}=hS({src:u,srcPos:c,dest:new Uint32Array(h.buffer),width:e,height:d<r?oe:a})),i.putImageData(l,0,d*oe);else throw new Error(`bad image kind: ${s}`)}function ab(i,t){if(t.bitmap){i.drawImage(t.bitmap,0,0);return}let{width:e,height:n}=t,s=n%oe,a=(n-s)/oe,r=s===0?a:a+1,o=i.createImageData(e,oe),l=0,c=t.data,u=o.data;for(let h=0;h<r;h++)({srcPos:l}=wb({src:c,srcPos:l,dest:u,width:e,height:h<a?oe:s,nonBlackColor:0})),i.putImageData(o,0,h*oe)}function Mn(i,t){let e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(let n of e)i[n]!==void 0&&(t[n]=i[n]);i.setLineDash!==void 0&&(t.setLineDash(i.getLineDash()),t.lineDashOffset=i.lineDashOffset)}function dl(i){i.strokeStyle=i.fillStyle="#000000",i.fillRule="nonzero",i.globalAlpha=1,i.lineWidth=1,i.lineCap="butt",i.lineJoin="miter",i.miterLimit=10,i.globalCompositeOperation="source-over",i.font="10px sans-serif",i.setLineDash!==void 0&&(i.setLineDash([]),i.lineDashOffset=0);let{filter:t}=i;t!=="none"&&t!==""&&(i.filter="none")}function rb(i,t){if(t)return!0;M.singularValueDecompose2dScale(i,Ee);let e=Math.fround(Je.pixelRatio*wi.PDF_TO_CSS_UNITS);return Ee[0]<=e&&Ee[1]<=e}function _S(i){let t=!0,e=n("filename\\*","i").exec(i);if(e){e=e[1];let u=o(e);return u=unescape(u),u=l(u),u=c(u),a(u)}if(e=r(i),e){let u=c(e);return a(u)}if(e=n("filename","i").exec(i),e){e=e[1];let u=o(e);return u=c(u),a(u)}function n(u,h){return new RegExp("(?:^|;)\\s*"+u+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',h)}function s(u,h){if(u){if(!/^[\x00-\xFF]+$/.test(h))return h;try{let d=new TextDecoder(u,{fatal:!0}),f=Ql(h);h=d.decode(f),t=!1}catch{}}return h}function a(u){return t&&/[\x80-\xff]/.test(u)&&(u=s("utf-8",u),t&&(u=s("iso-8859-1",u))),u}function r(u){let h=[],d,f=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(d=f.exec(u))!==null;){let[,y,v,p]=d;if(y=parseInt(y,10),y in h){if(y===0)break;continue}h[y]=[v,p]}let m=[];for(let y=0;y<h.length&&y in h;++y){let[v,p]=h[y];p=o(p),v&&(p=unescape(p),y===0&&(p=l(p))),m.push(p)}return m.join("")}function o(u){if(u.startsWith('"')){let h=u.slice(1).split('\\"');for(let d=0;d<h.length;++d){let f=h[d].indexOf('"');f!==-1&&(h[d]=h[d].slice(0,f),h.length=d+1),h[d]=h[d].replaceAll(/\\(.)/g,"$1")}u=h.join('"')}return u}function l(u){let h=u.indexOf("'");if(h===-1)return u;let d=u.slice(0,h),m=u.slice(h+1).replace(/^[^']*'/,"");return s(d,m)}function c(u){return!u.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(u)?u:u.replaceAll(/=\?([\w-]*)\?([QB])\?((?:[^?]|\?(?!=))*)\?=/gi,function(h,d,f,m){if(f==="q"||f==="Q")return m=m.replaceAll("_"," "),m=m.replaceAll(/=([0-9a-f]{2})/gi,function(y,v){return String.fromCharCode(parseInt(v,16))}),s(d,m);try{m=atob(m)}catch{}return s(d,m)})}return""}function _b(i,t){let e=new Headers;if(!i||!t||typeof t!="object")return e;for(let n in t){let s=t[n];s!==void 0&&e.append(n,s)}return e}function ec(i){return URL.parse(i)?.origin??null}function xb({responseHeaders:i,isHttp:t,rangeChunkSize:e,disableRange:n}){let s={contentLength:0,isRangeSupported:!1},a=parseInt(i.get("Content-Length"),10);return!Number.isInteger(a)||(s.contentLength=a,a<=2*e)||n||!t||i.get("Accept-Ranges")!=="bytes"||(i.get("Content-Encoding")||"identity")==="identity"&&(s.isRangeSupported=!0),s}function Cb(i){let t=i.get("Content-Disposition");if(t){let e=_S(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(Jl(e))return e}return null}function ic(i,t){return new Nn(`Unexpected server response (${i}) while retrieving PDF "${t.href}".`,i,i===404||i===0&&t.protocol==="file:")}function Mb(i,t){if(i!==t)throw new Error(`Expected range response-origin "${i}" to match "${t}".`)}function Db(i,t,e,n){return fetch(i,{method:"GET",headers:t,signal:n.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"})}function Ob(i,t){if(i!==200&&i!==206)throw ic(i,t)}function nc(i){if(i instanceof Uint8Array)return i.buffer;if(i instanceof ArrayBuffer)return i;throw new Error(`getArrayBuffer - unexpected data: ${i}`)}function lb(i){return i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer}function sc(){for(let i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0}function xS(i){return typeof i!="string"?i:Ql(i).buffer}function Rb(i,t=null){let e=process.getBuiltinModule("fs"),{Readable:n}=process.getBuiltinModule("stream"),s=e.createReadStream(i,t);return n.toWeb(s)}function CS(i){return rr(i)?Id:Se?qd:Vd}function Nb(i={}){let t=new tf,{docId:e}=t,n=i.url?oS(i.url):null,s=i.data?lS(i.data):null,a=i.httpHeaders||null,r=i.withCredentials===!0,o=i.password??null,l=i.range instanceof vr?i.range:null,c=Number.isInteger(i.rangeChunkSize)&&i.rangeChunkSize>0?i.rangeChunkSize:2**16,u=i.worker instanceof Xs?i.worker:null,h=i.verbosity,d=typeof i.docBaseUrl=="string"&&!Mr(i.docBaseUrl)?i.docBaseUrl:null,f=cl(i.cMapUrl),m=i.cMapPacked!==!1,y=cl(i.iccUrl),v=cl(i.standardFontDataUrl),p=cl(i.wasmUrl),g=i.stopAtErrors!==!0,b=Number.isInteger(i.maxImageSize)&&i.maxImageSize>-1?i.maxImageSize:-1,A=typeof i.isOffscreenCanvasSupported=="boolean"?i.isOffscreenCanvasSupported:!Se,S=typeof i.isImageDecoderSupported=="boolean"?i.isImageDecoderSupported:!Se,E=Number.isInteger(i.canvasMaxAreaInBytes)?i.canvasMaxAreaInBytes:-1,T=typeof i.disableFontFace=="boolean"?i.disableFontFace:Se,w=i.fontExtraProperties===!0,_=i.enableXfa===!0,C=i.ownerDocument||globalThis.document,D=i.disableRange===!0,N=i.disableStream===!0,z=i.disableAutoFetch===!0,X=i.pdfBug===!0,lt=i.CanvasFactory||(Se?Nd:Dd),L=i.FilterFactory||(Se?Rd:Od),R=i.BinaryDataFactory||(Se?Ld:xl),Lt=i.enableHWA===!0,Pe=i.enableWebGPU===!0?fS():Promise.resolve(!1),xi=i.useWasm!==!1,at=i.pagesMapper||new Jd,rt=typeof i.useSystemFonts=="boolean"?i.useSystemFonts:!Se&&!T,G=typeof i.useWorkerFetch=="boolean"?i.useWorkerFetch:!!(R===xl&&f&&m&&v&&p&&rr(f,document.baseURI)&&rr(v,document.baseURI)&&rr(p,document.baseURI)),Wt=null;Z1(h);let Ct={canvasFactory:new lt({ownerDocument:C,enableHWA:Lt}),filterFactory:new L({docId:e,ownerDocument:C}),binaryDataFactory:G?null:new R({cMapUrl:f,standardFontDataUrl:v,wasmUrl:p})};u||(u=Xs.create({verbosity:h,port:sn.workerPort}),t._worker=u);let At={docId:e,apiVersion:"6.1.200",data:s,password:o,disableAutoFetch:z,rangeChunkSize:c,docBaseUrl:d,enableXfa:_,evaluatorOptions:{maxImageSize:b,disableFontFace:T,ignoreErrors:g,isOffscreenCanvasSupported:A,isImageDecoderSupported:S,canvasMaxAreaInBytes:E,fontExtraProperties:w,useSystemFonts:rt,useWasm:xi,useWorkerFetch:G,cMapUrl:f,cMapPacked:m,iccUrl:y,standardFontDataUrl:v,wasmUrl:p,hasGPU:!1}},In={ownerDocument:C,pdfBug:X,styleElement:Wt,enableHWA:Lt,loadingParams:{disableAutoFetch:z,enableXfa:_}};return Promise.all([u.promise,Pe]).then(function([,rc]){if(u.destroyed)throw new Error("Worker was destroyed");At.evaluatorOptions.hasGPU=rc;let Hf=u.messageHandler.sendWithPromise("GetDocRequest",At,s?[s.buffer]:null),Ws;if(!s)if(l)Ws=new Ud({pdfDataRangeTransport:l,disableRange:D,disableStream:N});else if(n){let Qs=CS(n);Ws=new Qs({url:n,httpHeaders:a,withCredentials:r,rangeChunkSize:c,disableRange:D,disableStream:N})}else throw new Error("getDocument - expected either `data`, `range`, or `url` parameter.");return Hf.then(Qs=>{if(u.destroyed)throw new Error("Worker was destroyed");let $s=new Rn(e,Qs,u.port),Vb=new sf($s,t,Ws,In,Ct,at);if(t._transport=Vb,t.destroyed)throw new Error("Loading aborted");$s.send("Ready",null)})}).catch(t._capability.reject).finally(t._setupCapability.resolve),t}function db(i){return Math.floor(ht(i,0,1)*255).toString(16).padStart(2,"0")}function ir(i){return ht(i,0,1)*255}function NS(i,t){return i===t?0:i.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function gl(i){return i?i.nodeType===Node.ELEMENT_NODE?i.closest(".textLayer"):i.parentElement?.closest(".textLayer")||null:null}function LS(i,t,e,n){if(i===e)return t<=n;let s=i.compareDocumentPosition(e);return s&Node.DOCUMENT_POSITION_FOLLOWING?!0:s&Node.DOCUMENT_POSITION_PRECEDING?!1:null}function fb(i,t,e){if(i.nodeType!==Node.ELEMENT_NODE||!i.classList.contains("textLayer")||t!==i.childNodes.length)return{container:i,offset:t};let n=i.lastChild;return n?.nodeType===Node.ELEMENT_NODE&&n.classList.contains("endOfContent")&&(n=n.previousSibling),!n||!e.contains(n)?null:n.nodeType===Node.TEXT_NODE?{container:n,offset:n.textContent.length}:{container:n,offset:n.childNodes.length}}function ml(i){return`${(i*100).toFixed(2)}%`}var kS,Se,Ti,On,ed,yl,$1,cE,ve,Ae,Si,ks,cr,P,H,pb,Pt,sr,St,Ns,Cr,Ue,er,gb,Kl,Pn,Ps,ar,Is,Nn,nd,Ge,J,M,Qh,Vy,Ys,$l,vl,ur,hr,dr,wi,Fs,Al,Hs,Je,Sl,sd,El,Ky,rd,od,aS,$h,Kt,ld,cd,ud,Ln,hd,rn,Tl,Bs,fr,tt,dd,Wy,Be,Ze,pr,gr,mr,wl,Rs,Qy,$y,fd,pd,Jy,gd,md,yr,ze,yd,bd,vd,Ad,Sd,be,Ai,Ed,Td,wd,_d,xd,Cd,cS,Tb,Md,ul,Nt,Rn,_l,xl,Cl,Dd,Ml,Od,Rd,Nd,Ld,dS,kd,tc,Yt,br,Bd,zd,Pd,eb,or,vS,AS,SS,ib,oe,Jh,Ee,Dl,ES,TS,wS,ob,zs,Us,Gs,js,Id,Fd,Hd,Ud,Gd,jd,td,cb,Vd,Xd,Yd,qd,Kd,Wd,sn,Qd,Dn,$d,Zd,Jd,Ls,ub,Ol,MS,hb,Vs,DS,tf,vr,ef,nf,Xs,sf,af,rf,Lb,kb,Ar,Rl,Nl,of,kn,OS,Bn,RS,lr,vt,lf,Sr,cf,_i,uf,hf,df,ff,pf,gf,Er,mf,Ll,yf,bf,vf,kl,Af,Sf,Tr,Bl,Ef,Tf,wf,zl,_f,Pl,Il,fl,xf,O,Fl,Hl,wr,Cf,_r,Mf,Ul,Gl,jl,Df,zn,Vl,Of,xr,pl,nr,Ei,Rf,Nf,Lf,kf,Xl,Yl,ql,zb=Qb(()=>{kS={},Se=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),Ti=[1/0,1/0,-1/0,-1/0],On=new Float32Array(Ti),ed=[.001,0,0,.001,0,0],yl=1.35,$1=.35,cE=$1/yl,ve="http://www.w3.org/2000/svg",Ae={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Si={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},ks="pdfjs_internal_id_",cr="pdfjs_internal_editor_",P={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},H={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,INK_COLOR_AND_OPACITY:24,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},pb={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Pt={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},sr={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},St={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26,RICHMEDIA:27},Ns={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Cr={ERRORS:0,WARNINGS:1,INFOS:5},Ue={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},er={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},gb={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},Kl=Cr.WARNINGS;Pn=(function(){function t(e,n){this.message=e,this.name=n}return t.prototype=new Error,t.constructor=t,t})(),Ps=class extends Pn{constructor(t,e){super(t,"PasswordException"),this.code=e}},ar=class extends Pn{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},Is=class extends Pn{constructor(t){super(t,"InvalidPDFException")}},Nn=class extends Pn{constructor(t,e,n){super(t,"ResponseException"),this.status=e,this.missing=n}},nd=class extends Pn{constructor(t){super(t,"FormatError")}},Ge=class extends Pn{constructor(t){super(t,"AbortException")}};J=class{static get isLittleEndian(){let t=new Uint8Array(4);t[0]=1;let e=new Uint32Array(t.buffer,0,1);return B(this,"isLittleEndian",e[0]===1)}static get isOffscreenCanvasSupported(){return B(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return B(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return B(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return B(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){let{platform:t,userAgent:e}=navigator;return B(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCanvasFilterSupported(){let t;return this.isOffscreenCanvasSupported?t=new OffscreenCanvas(1,1).getContext("2d"):typeof document<"u"&&(t=document.createElement("canvas").getContext("2d")),B(this,"isCanvasFilterSupported",t?.filter!==void 0)}static get isAlphaColorInputSupported(){if(typeof document>"u")return B(this,"isAlphaColorInputSupported",!1);let t=document.createElement("input");return t.type="color",t.setAttribute("alpha",""),t.value="#ff000080",B(this,"isAlphaColorInputSupported",t.value!=="#ff0000")}static get isBackdropFilterSupported(){return B(this,"isBackdropFilterSupported",typeof CSS<"u"&&CSS.supports("backdrop-filter","blur(1px)"))}},M=class{static get hexNums(){return B(this,"hexNums",Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0")))}static makeHexColor(t,e,n){return`#${this.hexNums[t]}${this.hexNums[e]}${this.hexNums[n]}`}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,n=0){let s=t[n],a=t[n+1];t[n]=s*e[0]+a*e[2]+e[4],t[n+1]=s*e[1]+a*e[3]+e[5]}static applyTransformToBezier(t,e,n=0){let s=e[0],a=e[1],r=e[2],o=e[3],l=e[4],c=e[5];for(let u=0;u<6;u+=2){let h=t[n+u],d=t[n+u+1];t[n+u]=h*s+d*r+l,t[n+u+1]=h*a+d*o+c}}static applyInverseTransform(t,e){let n=t[0],s=t[1],a=e[0]*e[3]-e[1]*e[2];t[0]=(n*e[3]-s*e[2]+e[2]*e[5]-e[4]*e[3])/a,t[1]=(-n*e[1]+s*e[0]+e[4]*e[1]-e[5]*e[0])/a}static axialAlignedBoundingBox(t,e,n){let s=e[0],a=e[1],r=e[2],o=e[3],l=e[4],c=e[5],u=t[0],h=t[1],d=t[2],f=t[3],m=s*u+l,y=m,v=s*d+l,p=v,g=o*h+c,b=g,A=o*f+c,S=A;if(a!==0||r!==0){let E=a*u,T=a*d,w=r*h,_=r*f;m+=w,p+=w,v+=_,y+=_,g+=E,S+=E,A+=T,b+=T}n[0]=Math.min(n[0],m,v,y,p),n[1]=Math.min(n[1],g,A,b,S),n[2]=Math.max(n[2],m,v,y,p),n[3]=Math.max(n[3],g,A,b,S)}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 n=t[0],s=t[1],a=t[2],r=t[3],o=n**2+s**2,l=n*a+s*r,c=a**2+r**2,u=(o+c)/2,h=Math.sqrt(u**2-(o*c-l**2));e[0]=Math.sqrt(u+h||1),e[1]=Math.sqrt(u-h||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 n=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),s=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(n>s)return null;let a=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 a>r?null:[n,a,s,r]}static pointBoundingBox(t,e,n){n[0]=Math.min(n[0],t),n[1]=Math.min(n[1],e),n[2]=Math.max(n[2],t),n[3]=Math.max(n[3],e)}static rectBoundingBox(t,e,n,s,a){a[0]=Math.min(a[0],t,n),a[1]=Math.min(a[1],e,s),a[2]=Math.max(a[2],t,n),a[3]=Math.max(a[3],e,s)}static#t(t,e,n,s,a,r,o,l,c,u){if(c<=0||c>=1)return;let h=1-c,d=c*c,f=d*c,m=h*(h*(h*t+3*c*e)+3*d*n)+f*s,y=h*(h*(h*a+3*c*r)+3*d*o)+f*l;u[0]=Math.min(u[0],m),u[1]=Math.min(u[1],y),u[2]=Math.max(u[2],m),u[3]=Math.max(u[3],y)}static#e(t,e,n,s,a,r,o,l,c,u,h,d){if(Math.abs(c)<1e-12){Math.abs(u)>=1e-12&&this.#t(t,e,n,s,a,r,o,l,-h/u,d);return}let f=u**2-4*h*c;if(f<0)return;let m=Math.sqrt(f),y=2*c;this.#t(t,e,n,s,a,r,o,l,(-u+m)/y,d),this.#t(t,e,n,s,a,r,o,l,(-u-m)/y,d)}static bezierBoundingBox(t,e,n,s,a,r,o,l,c){c[0]=Math.min(c[0],t,o),c[1]=Math.min(c[1],e,l),c[2]=Math.max(c[2],t,o),c[3]=Math.max(c[3],e,l),this.#e(t,n,a,o,e,s,r,l,3*(-t+3*(n-a)+o),6*(t-2*n+a),3*(n-t),c),this.#e(t,n,a,o,e,s,r,l,3*(-e+3*(s-r)+l),6*(e-2*s+r),3*(s-e),c)}};Qh=null,Vy=null;Ys=()=>[],$l=()=>new Map,vl=()=>Object.create(null);ur=class i{constructor({viewBox:t,userUnit:e,scale:n,rotation:s,offsetX:a=0,offsetY:r=0,dontFlip:o=!1}){this.viewBox=t,this.userUnit=e,this.scale=n,this.rotation=s,this.offsetX=a,this.offsetY=r,n*=e;let l=(t[2]+t[0])/2,c=(t[3]+t[1])/2,u,h,d,f;switch(s%=360,s<0&&(s+=360),s){case 180:u=-1,h=0,d=0,f=1;break;case 90:u=0,h=1,d=1,f=0;break;case 270:u=0,h=-1,d=-1,f=0;break;case 0:u=1,h=0,d=0,f=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(d=-d,f=-f);let m,y,v,p;u===0?(m=Math.abs(c-t[1])*n+a,y=Math.abs(l-t[0])*n+r,v=(t[3]-t[1])*n,p=(t[2]-t[0])*n):(m=Math.abs(l-t[0])*n+a,y=Math.abs(c-t[1])*n+r,v=(t[2]-t[0])*n,p=(t[3]-t[1])*n),this.transform=[u*n,h*n,d*n,f*n,m-u*n*l-d*n*c,y-h*n*l-f*n*c],this.width=v,this.height=p}get rawDims(){let t=this.viewBox;return B(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:n=this.offsetX,offsetY:s=this.offsetY,dontFlip:a=!1}={}){return new i({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:n,offsetY:s,dontFlip:a})}convertToViewportPoint(t,e){let n=[t,e];return M.applyTransform(n,this.transform),n}convertToPdfPoint(t,e){let n=[t,e];return M.applyInverseTransform(n,this.transform),n}},hr=class i{static textContent(t){let e=[],n={items:e,styles:Object.create(null)};function s(a){if(!a)return;let r=null,o=a.name;if(o==="#text")r=a.value;else if(i.shouldBuildText(o))a?.attributes?.textContent?r=a.attributes.textContent:a.value&&(r=a.value);else return;if(r!==null&&e.push({str:r}),!!a.children)for(let l of a.children)s(l)}return s(t),n}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}},dr=class{static setupStorage(t,e,n,s,a){let r=s.getValue(e,{value:null});switch(n.name){case"textarea":if(r.value!==null&&(t.textContent=r.value),a==="print")break;t.addEventListener("input",o=>{s.setValue(e,{value:o.target.value})});break;case"input":if(n.attributes.type==="radio"||n.attributes.type==="checkbox"){if(r.value===n.attributes.xfaOn?t.setAttribute("checked",!0):r.value===n.attributes.xfaOff&&t.removeAttribute("checked"),a==="print")break;t.addEventListener("change",o=>{s.setValue(e,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(r.value!==null&&t.setAttribute("value",r.value),a==="print")break;t.addEventListener("input",o=>{s.setValue(e,{value:o.target.value})})}break;case"select":if(r.value!==null){t.setAttribute("value",r.value);for(let o of n.children)o.attributes.value===r.value?o.attributes.selected=!0:Object.hasOwn(o.attributes,"selected")&&delete o.attributes.selected}t.addEventListener("input",o=>{let l=o.target.options,c=l.selectedIndex===-1?"":l[l.selectedIndex].value;s.setValue(e,{value:c})});break}}static setAttributes({html:t,element:e,storage:n=null,intent:s,linkService:a}){let{attributes:r}=e,o=t instanceof HTMLAnchorElement;r.type==="radio"&&(r.name=`${r.name}-${s}`);for(let[l,c]of Object.entries(r))if(c!=null)switch(l){case"class":c.length&&t.setAttribute(l,c.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",c);break;case"style":Object.assign(t.style,c);break;case"textContent":t.textContent=c;break;default:(!o||l!=="href"&&l!=="newWindow")&&t.setAttribute(l,c)}o&&a.addLinkAttributes(t,r.href,r.newWindow),n&&r.dataId&&this.setupStorage(t,r.dataId,e,n)}static render(t){let e=t.annotationStorage,n=t.linkService,s=t.xfaHtml,a=t.intent||"display",r=document.createElement(s.name);s.attributes&&this.setAttributes({html:r,element:s,intent:a,linkService:n});let o=a!=="richText",l=t.div;if(l.append(r),t.viewport){let h=`matrix(${t.viewport.transform.join(",")})`;l.style.transform=h}o&&l.setAttribute("class","xfaLayer xfaFont");let c=[];if(s.children.length===0){if(s.value){let h=document.createTextNode(s.value);r.append(h),o&&hr.shouldBuildText(s.name)&&c.push(h)}return{textDivs:c}}let u=[[s,-1,r]];for(;u.length>0;){let[h,d,f]=u.at(-1);if(d+1===h.children.length){u.pop();continue}let m=h.children[++u.at(-1)[1]];if(m===null)continue;let{name:y}=m;if(y==="#text"){let p=document.createTextNode(m.value);c.push(p),f.append(p);continue}let v=m?.attributes?.xmlns?document.createElementNS(m.attributes.xmlns,y):document.createElement(y);if(f.append(v),m.attributes&&this.setAttributes({html:v,element:m,storage:e,intent:a,linkService:n}),m.children?.length>0)u.push([m,-1,v]);else if(m.value){let p=document.createTextNode(m.value);o&&hr.shouldBuildText(y)&&c.push(p),v.append(p)}}for(let h of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))h.setAttribute("readOnly",!0);return{textDivs:c}}static update(t){let e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}static getPageViewport(t,{scale:e=1,rotation:n=0}){let{width:s,height:a}=t.attributes.style;return new ur({viewBox:[0,0,parseInt(s,10),parseInt(a,10)],userUnit:1,scale:e,rotation:n})}},wi=class{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF};Fs=class extends Pn{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}};Al=class{#t=new Map;times=[];time(t){this.#t.has(t)&&I(`Timer is already running for ${t}`),this.#t.set(t,Date.now())}timeEnd(t){this.#t.has(t)||I(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.#t.get(t),end:Date.now()}),this.#t.delete(t)}toString(){let t=Math.max(...this.times.map(e=>e.name.length));return this.times.map(e=>`${e.name.padEnd(t)} ${e.end-e.start}ms
10
- `).join("")}};Hs=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 n=parseInt(e[1],10),s=parseInt(e[2],10);s=s>=1&&s<=12?s-1:0;let a=parseInt(e[3],10);a=a>=1&&a<=31?a: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 c=e[7]||"Z",u=parseInt(e[8],10);u=u>=0&&u<=23?u:0;let h=parseInt(e[9],10)||0;return h=h>=0&&h<=59?h:0,c==="-"?(r+=u,o+=h):c==="+"&&(r-=u,o-=h),new Date(Date.UTC(n,s,a,r,o,l))}};Je=class i{constructor(){let{pixelRatio:t}=i;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,n,s,a=-1){let r=1/0,o=1/0,l=1/0;n=i.capPixels(n,a),n>0&&(r=Math.sqrt(n/(t*e))),s!==-1&&(o=s/t,l=s/e);let c=Math.min(r,o,l);return this.sx>c||this.sy>c?(this.sx=c,this.sy=c,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>=0){let n=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,n):n}return t}},Sl=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"],sd=class{static get isDarkMode(){return B(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}},El=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:n}=window.getComputedStyle(t);return t.remove(),B(this,"commentForegroundColor",Ks(n))}};Ky=new Map;rd=class i{#t=null;#e=null;#i;#n=null;#s=null;#r=null;#a=null;#o=null;static#c=null;constructor(t){this.#i=t,i.#c||=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",Te,{signal:e}),t.addEventListener("pointerdown",i.#l,{signal:e}));let n=this.#n=document.createElement("div");n.className="buttons",t.append(n);let s=this.#i.toolbarPosition;if(s){let{style:a}=t,r=this.#i._uiManager.direction==="ltr"?1-s[0]:s[0];a.insetInlineEnd=`${100*r}%`,a.top=`calc(${100*s[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return this.#t}static#l(t){t.stopPropagation()}#d(t){this.#i._focusEventsAllowed=!1,bt(t)}#h(t){this.#i._focusEventsAllowed=!0,bt(t)}#p(t){let e=this.#i._uiManager._signal;return!(e instanceof AbortSignal)||e.aborted?!1:(t.addEventListener("focusin",this.#d.bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",this.#h.bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Te,{signal:e}),!0)}hide(){this.#t.classList.add("hidden"),this.#e?.hideDropdown()}show(){this.#t.classList.remove("hidden"),this.#s?.shown(),this.#r?.shown()}addDeleteButton(){let{editorType:t,_uiManager:e}=this.#i,n=document.createElement("button");n.classList.add("basic","deleteButton"),n.tabIndex=0,n.setAttribute("data-l10n-id",i.#c[t]),this.#p(n)&&n.addEventListener("click",s=>{e.delete()},{signal:e._signal}),this.#n.append(n)}get#m(){let t=document.createElement("div");return t.className="divider",t}async addAltText(t){let e=await t.render();this.#p(e),this.#n.append(e,this.#m),this.#s=t}addComment(t,e=null){if(this.#r)return;let n=t.renderForToolbar();if(!n)return;this.#p(n);let s=this.#a=this.#m;e?(this.#n.insertBefore(n,e),this.#n.insertBefore(s,e)):this.#n.append(n,s),this.#r=t,t.toolbar=this}addColorPicker(t){if(this.#e)return;this.#e=t;let e=t.renderButton();this.#p(e),this.#n.append(e,this.#m)}async addEditSignatureButton(t){let e=this.#o=await t.renderEditButton(this.#i);this.#p(e),this.#n.append(e,this.#m)}removeButton(t){t==="comment"&&(this.#r?.removeToolbarCommentButton(),this.#r=null,this.#a?.remove(),this.#a=null)}async addButton(t,e){switch(t){case"colorPicker":e&&this.addColorPicker(e);break;case"altText":e&&await this.addAltText(e);break;case"editSignature":e&&await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break;case"comment":e&&this.addComment(e);break}}async addButtonBefore(t,e,n){if(!e&&t==="comment")return;let s=this.#n.querySelector(n);s&&t==="comment"&&this.addComment(e,s)}updateEditSignatureButton(t){this.#o&&(this.#o.title=t)}remove(){this.#t.remove(),this.#e?.destroy(),this.#e=null}},od=class{#t=null;#e=null;#i;constructor(t){this.#i=t}#n(){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",Te,{signal:e});let n=this.#t=document.createElement("div");return n.className="buttons",t.append(n),this.#i.hasCommentManager()&&this.#r("commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{this.#i.commentSelection("floating_button")}),this.#r("highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{this.#i.highlightSelection("floating_button")}),t}#s(t,e){let n=0,s=0;for(let a of t){let r=a.y+a.height;if(r<n)continue;let o=a.x+(e?a.width:0);if(r>n){s=o,n=r;continue}e?o>s&&(s=o):o<s&&(s=o)}return[e?1-s:s,n]}show(t,e,n){let[s,a]=this.#s(e,n),{style:r}=this.#e||=this.#n();t.append(this.#e),r.insetInlineEnd=`${100*s}%`,r.top=`calc(${100*a}% + var(--editor-toolbar-vert-offset))`}hide(){this.#e.remove()}#r(t,e,n,s){let a=document.createElement("button");a.classList.add("basic",t),a.tabIndex=0,a.setAttribute("data-l10n-id",e);let r=document.createElement("span");a.append(r),r.className="visuallyHidden",r.setAttribute("data-l10n-id",n);let o=this.#i._signal;o instanceof AbortSignal&&!o.aborted&&(a.addEventListener("contextmenu",Te,{signal:o}),a.addEventListener("click",s,{signal:o})),this.#t.append(a)}},aS="068f09d6-5b37-4f77-a97a-f8ff4f253b68",$h=Object.freeze({internal:aS});Kt=class i{static#t=NaN;static#e=null;static#i=NaN;static#n=null;static initializeAndAddPointerId(t){(i.#e||=new Set).add(t)}static setPointer(t,e){i.#t||=e,i.#n??=t}static setTimeStamp(t){i.#i=t}static isSamePointerId(t){return i.#t===t}static isSamePointerIdOrRemove(t){return i.#t===t?!0:(i.#e?.delete(t),!1)}static isSamePointerType(t){return i.#n===t}static isInitializedAndDifferentPointerType(t){return i.#n!==null&&!i.isSamePointerType(t)}static isSameTimeStamp(t){return i.#i===t}static isUsingMultiplePointers(){return i.#e?.size>=1}static clearPointerType(){i.#n=null}static clearPointerIds(){i.#t=NaN,i.#e=null}static clearTimeStamp(){i.#i=NaN}},ld=class{#t=0;get id(){return`${cr}${this.#t++}`}},cd=class i{#t=Pf();#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="${ve}"><rect width="1" height="1" style="fill:red;"/></svg>`,n=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),s=new Image;s.src=t;let a=s.decode().then(()=>(n.drawImage(s,0,0,1,1,0,0,1,3),new Uint32Array(n.getImageData(0,0,1,1).data.buffer)[0]===0));return B(this,"_isSVGFittingCanvas",a)}async#n(t,e){this.#i||=new Map;let n=this.#i.get(t);if(n===null)return null;if(n?.bitmap)return n.refCounter+=1,n;try{n||={bitmap:null,id:`image_${this.#t}_${this.#e++}`,refCounter:0,isSvg:!1};let s;if(typeof e=="string"?(n.url=e,s=await Zl(e,"blob")):e instanceof File?s=n.file=e:e instanceof Blob&&(s=e),s.type==="image/svg+xml"){let a=i._isSVGFittingCanvas,r=new FileReader,o=new Image,l=new Promise((c,u)=>{o.onload=()=>{n.bitmap=o,n.isSvg=!0,c()},r.onload=async()=>{let h=n.svgUrl=r.result;o.src=await a?`${h}#svgView(preserveAspectRatio(none))`:h},o.onerror=r.onerror=u});r.readAsDataURL(s),await l}else n.bitmap=await createImageBitmap(s);n.refCounter=1}catch(s){I(s),n=null}return this.#i.set(t,n),n&&this.#i.set(n.id,n),n}async getFromFile(t){let{lastModified:e,name:n,size:s,type:a}=t;return this.#n(`${e}_${n}_${s}_${a}`,t)}async getFromUrl(t){return this.#n(t,t)}async getFromBlob(t,e){let n=await e;return this.#n(t,n)}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:n}=e;return delete e.blobPromise,this.getFromBlob(e.id,n)}return this.getFromUrl(e.url)}getFromCanvas(t,e){this.#i||=new Map;let n=this.#i.get(t);if(n?.bitmap)return n.refCounter+=1,n;let s=new OffscreenCanvas(e.width,e.height);return s.getContext("2d").drawImage(e,0,0),n={bitmap:s.transferToImageBitmap(),id:`image_${this.#t}_${this.#e++}`,refCounter:1,isSvg:!1},this.#i.set(t,n),this.#i.set(n.id,n),n}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:n}=e;if(!e.url&&!e.file){let s=new OffscreenCanvas(n.width,n.height);s.getContext("bitmaprenderer").transferFromImageBitmap(n),e.blobPromise=s.convertToBlob()}n.close?.(),e.bitmap=null}isValidId(t){return t.startsWith(`image_${this.#t}_`)}},ud=class{#t=[];#e=!1;#i;#n=-1;constructor(t=128){this.#i=t}add({cmd:t,undo:e,post:n,mustExec:s,type:a=NaN,overwriteIfSameType:r=!1,keepUndo:o=!1}){if(s&&t(),this.#e)return;let l={cmd:t,undo:e,post:n,type:a};if(this.#n===-1){this.#t.length>0&&(this.#t.length=0),this.#n=0,this.#t.push(l);return}if(r&&this.#t[this.#n].type===a){o&&(l.undo=this.#t[this.#n].undo),this.#t[this.#n]=l;return}let c=this.#n+1;c===this.#i?this.#t.splice(0,1):(this.#n=c,c<this.#t.length&&this.#t.splice(c)),this.#t.push(l)}undo(){if(this.#n===-1)return;this.#e=!0;let{undo:t,post:e}=this.#t[this.#n];t(),e?.(),this.#e=!1,this.#n-=1}redo(){if(this.#n<this.#t.length-1){this.#n+=1,this.#e=!0;let{cmd:t,post:e}=this.#t[this.#n];t(),e?.(),this.#e=!1}}hasSomethingToUndo(){return this.#n!==-1}hasSomethingToRedo(){return this.#n<this.#t.length-1}cleanType(t){if(this.#n!==-1){for(let e=this.#n;e>=0;e--)if(this.#t[e].type!==t){this.#t.splice(e+1,this.#n-e),this.#n=e;return}this.#t.length=0,this.#n=-1}}destroy(){this.#t=null}},Ln=class i{static ALT=1;static CTRL=2;static META=4;static SHIFT=8;constructor(t){this.callbacks=new Map;let{isMac:e}=J.platform;for(let[n,s,a={}]of t){let r=n.some(o=>o.startsWith("mac+"));for(let o of n){let l=o;if(r){let h=o.startsWith("mac+");if(e!==h)continue;h&&(l=o.slice(4))}let[c,u]=i.#t(l);c!==null&&this.callbacks.getOrInsertComputed(c,Ys).push({callback:s,options:a,modifiers:u})}}}static#t(t){let e=null,n=0;for(let s of t.split("+")){if(s=s.trim(),!s)continue;let a=s.toUpperCase(),r=i[a];if(r){n|=r;continue}if(e!==null){I(`KeyboardManager: multiple keys in shortcut "${t}"`);break}e=a==="SPACE"?" ":s}return e===null&&I(`KeyboardManager: no key found in shortcut "${t}"`),[e,n]}static#e(t){let e=/^(?:Key([A-Z])|(?:Digit|Numpad)(\d))$/.exec(t);return e?e[1]?.toLowerCase()??e[2]:null}exec(t,e){let n=this.callbacks.get(e.key);if(!n){if(/^[a-z]$/i.test(e.key))return;let u=i.#e(e.code);if(u===null||u===e.key||(n=this.callbacks.get(u),!n))return}let s=(e.altKey?i.ALT:0)|(e.ctrlKey?i.CTRL:0)|(e.metaKey?i.META:0)|(e.shiftKey?i.SHIFT:0),a=n.find(u=>u.modifiers===s);if(!a)return;let{callback:r,options:{bubbles:o=!1,args:l=[],checker:c=null}}=a;c&&!c(t,e)||(r.bind(t,...l,e)(),o||bt(e))}},hd=class i{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){let t=new Map([["CanvasText",null],["Canvas",null]]);return sS(t),B(this,"_colors",t)}convert(t){let e=Ks(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(let[n,s]of this._colors)if(s.every((a,r)=>a===e[r]))return i._colorsMapping.get(n);return e}getHexCode(t){let e=this._colors.get(t);return e?M.makeHexColor(...e):t}},rn=class i{#t=new AbortController;#e=null;#i=null;#n=new Map;#s=new Map;#r=null;#a=null;#o=null;#c=null;#l=new ud;#d=null;#h=null;#p=null;#m=0;#g=new Set;#u=null;#f=null;#b=new Set;_editorUndoBar=null;#v=!1;#y=!1;#T=!1;#w=null;#A=null;#_=null;#E=null;#C=!1;#D=null;#O=new ld;#M=!1;#L=!1;#k=!1;#N=null;#B=null;#P=null;#F=null;#X=null;#x=P.NONE;#S=new Set;#z=null;#U=null;#j=null;#W=null;#q=null;#K={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#I=[0,0];#V=null;#Y=null;#J=null;#tt=null;#H=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let t=i.prototype,e=r=>r.#Y.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&r.hasSomethingToControl(),n=(r,{target:o})=>{if(o instanceof HTMLInputElement){let{type:l}=o;return l!=="text"&&l!=="number"}return!0},s=this.TRANSLATE_SMALL,a=this.TRANSLATE_BIG;return B(this,"_keyboardManager",new Ln([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:n}],[["ctrl+z","mac+meta+z"],t.undo,{checker:n}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:n}],[["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:n}],[["Enter"],t.addNewEditorFromKeyboard,{checker:(r,{target:o})=>!(o instanceof HTMLButtonElement)&&r.#Y.contains(o)&&!r.isEnterHandled}],[["Space"],t.addNewEditorFromKeyboard,{checker:(r,{target:o})=>!(o instanceof HTMLButtonElement)&&r.#Y.contains(document.activeElement)}],[["Escape"],t.unselectAll],[["ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-a,0],checker:e}],[["ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[a,0],checker:e}],[["ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-a],checker:e}],[["ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,a],checker:e}]]))}constructor(t,e,n,s,a,r,o,l,c,u,h,d,f,m,y,v){let p=this._signal=this.#t.signal;this.#Y=t,this.#J=e,this.#tt=n,this.#a=s,this.#d=a,this.#U=r,this.#q=l,this._eventBus=o;let g={signal:p,...$h};o.on("editingaction",this.onEditingAction.bind(this),g),o.on("pagechanging",this.onPageChanging.bind(this),g),o.on("scalechanging",this.onScaleChanging.bind(this),g),o.on("rotationchanging",this.onRotationChanging.bind(this),g),o.on("setpreference",this.onSetPreference.bind(this),g),o.on("switchannotationeditorparams",b=>this.updateParams(b.type,b.value),g),window.addEventListener("pointerdown",()=>{this.#L=!0},{capture:!0,signal:p}),window.addEventListener("pointerup",()=>{this.#L=!1},{capture:!0,signal:p}),window.addEventListener("beforeunload",this.#at.bind(this),{capture:!0,signal:p}),this.#lt(),this.#pt(),this.#it(),this.#o=l.annotationStorage,this.#w=l.filterFactory,this.#j=c,this.#E=u||null,this.#v=h,this.#y=d,this.#T=f,this.#X=m||null,this.viewParameters={realScale:wi.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=y||null,this._supportsPinchToZoom=v!==!1,a?.setSidebarUiManager(this)}destroy(){this.#H?.resolve(),this.#H=null,this.#t?.abort(),this.#t=null,this._signal=null;for(let t of this.#s.values())t.destroy();this.#s.clear(),this.#n.clear(),this.#b.clear(),this.#F?.clear(),this.#e=null,this.#S.clear(),this.#l.destroy(),this.#a?.destroy(),this.#d?.destroy(),this.#U?.destroy(),this.#D?.hide(),this.#D=null,this.#P?.destroy(),this.#P=null,this.#i=null,this.#A&&(clearTimeout(this.#A),this.#A=null),this.#V&&(clearTimeout(this.#V),this.#V=null),this._editorUndoBar?.destroy(),this.#q=null}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return this.#X}get useNewAltTextFlow(){return this.#y}get useNewAltTextWhenAddingImage(){return this.#T}get hcmFilter(){return B(this,"hcmFilter",this.#j?this.#w.addHCMFilter(this.#j.foreground,this.#j.background):"none")}get direction(){return B(this,"direction",getComputedStyle(this.#Y).direction)}get _highlightColors(){return B(this,"_highlightColors",this.#E?new Map(this.#E.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 B(this,"highlightColors",null);let e=new Map,n=!!this.#j;for(let[s,a]of t){let r=s.endsWith("_HCM");if(n&&r){e.set(s.replace("_HCM",""),a);continue}!n&&!r&&e.set(s,a)}return B(this,"highlightColors",e)}get highlightColorNames(){return B(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.#p=t}setMainHighlightColorPicker(t){this.#P=t}editAltText(t,e=!1){this.#a?.editAltText(this,t,e)}hasCommentManager(){return!!this.#d}editComment(t,e,n,s){this.#d?.showDialog(this,t,e,n,s)}selectComment(t,e){this.#s.get(t)?.getEditorByUID(e)?.toggleComment(!0,!0)}updateComment(t){this.#d?.updateComment(t.getData())}updatePopupColor(t){this.#d?.updatePopupColor(t)}removeComment(t){this.#d?.removeComments([t.uid])}deleteComment(t,e){let n=()=>{t.comment=e},s=()=>{this._editorUndoBar?.show(n,"comment"),this.toggleComment(null),t.comment=null};this.addCommands({cmd:s,undo:n,mustExec:!0})}toggleComment(t,e,n=void 0){this.#d?.toggleCommentPopup(t,e,n)}makeCommentColor(t,e){return t&&this.#d?.makeCommentColor(t,e)||null}getCommentDialogElement(){return this.#d?.dialogElement||null}async waitForEditorsRendered(t){if(this.#s.has(t-1))return;let{resolve:e,promise:n}=Promise.withResolvers(),s=a=>{a.pageNumber===t&&(this._eventBus.off("editorsrendered",s),e())};this._eventBus.on("editorsrendered",s,$h),await n}getSignature(t){this.#U?.getSignature({uiManager:this,editor:t})}get signatureManager(){return this.#U}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal,...$h}),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.#T=e)}onPageChanging({pageNumber:t}){this.#m=t-1}deletePage(t){for(let e of this.getEditors(t))e.remove();this.#s.delete(t),this.#m===t&&(this.#m=0)}focusMainContainer(){this.#Y.focus()}findParent(t,e){for(let n of this.#s.values()){let{x:s,y:a,width:r,height:o}=n.div.getBoundingClientRect();if(t>=s&&t<=s+r&&e>=a&&e<=a+o)return n}return null}disableUserSelect(t=!1){this.#J.classList.toggle("noUserSelect",t)}addShouldRescale(t){this.#b.add(t)}removeShouldRescale(t){this.#b.delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*wi.PDF_TO_CSS_UNITS;for(let e of this.#b)e.onScaleChanging();this.#p?.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}#Z({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t}#et(t){let{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(let n of this.#s.values())if(n.hasTextLayer(t))return n;return null}highlightSelection(t="",e=!1){let n=document.getSelection();if(!n||n.isCollapsed)return;let{anchorNode:s,anchorOffset:a,focusNode:r,focusOffset:o}=n,l=n.toString(),u=this.#Z(n).closest(".textLayer"),h=this.getSelectionBoxes(u);if(!h)return;n.empty();let d=this.#et(u),f=this.#x===P.NONE,m=()=>{let y=d?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:s,anchorOffset:a,focusNode:r,focusOffset:o,text:l});f&&this.showAllEditors("highlight",!0,!0),e&&y?.editComment()};if(f){this.switchToMode(P.HIGHLIGHT,m);return}m()}commentSelection(t=""){this.highlightSelection(t,!0)}#at(t){this.commitOrRemove(),this.currentLayer?.endDrawingSession(!1)}#rt(){let t=document.getSelection();if(!t||t.isCollapsed)return;let n=this.#Z(t).closest(".textLayer"),s=this.getSelectionBoxes(n);s&&(this.#D||=new od(this),this.#D.show(n,s,this.direction==="ltr"))}getAndRemoveDataFromAnnotationStorage(t){if(!this.#o)return null;let e=`${cr}${t}`,n=this.#o.getRawValue(e);return n&&this.#o.remove(e),n}addToAnnotationStorage(t){!t.isEmpty()&&this.#o&&!this.#o.has(t.id)&&this.#o.setValue(t.id,t)}a11yAlert(t,e=null){let n=this.#tt;n&&(n.setAttribute("data-l10n-id",t),e?n.setAttribute("data-l10n-args",JSON.stringify(e)):n.removeAttribute("data-l10n-args"))}#ot(){let t=document.getSelection();if(!t||t.isCollapsed){this.#z&&(this.#D?.hide(),this.#z=null,this.#R({hasSelectedText:!1}));return}let{anchorNode:e}=t;if(e===this.#z)return;let s=this.#Z(t).closest(".textLayer");if(!s){this.#z&&(this.#D?.hide(),this.#z=null,this.#R({hasSelectedText:!1}));return}if(this.#D?.hide(),this.#z=e,this.#R({hasSelectedText:!0}),!(this.#x!==P.HIGHLIGHT&&this.#x!==P.NONE)&&(this.#x===P.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#C=this.isShiftKeyDown,!this.isShiftKeyDown)){let a=this.#x===P.HIGHLIGHT?this.#et(s):null;if(a?.toggleDrawing(),this.#L){let r=new AbortController,o=this.combinedSignal(r),l=c=>{c.type==="pointerup"&&c.button!==0||(r.abort(),a?.toggleDrawing(!0),c.type==="pointerup"&&this.#Q("main_toolbar"))};window.addEventListener("pointerup",l,{signal:o}),window.addEventListener("blur",l,{signal:o})}else a?.toggleDrawing(!0),this.#Q("main_toolbar")}}#Q(t=""){this.#x===P.HIGHLIGHT?this.highlightSelection(t):this.#v&&this.#rt()}#lt(){document.addEventListener("selectionchange",this.#ot.bind(this),{signal:this._signal})}#ct(){if(this.#_)return;this.#_=new AbortController;let t=this.combinedSignal(this.#_);window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})}#ut(){this.#_?.abort(),this.#_=null}blur(){if(this.isShiftKeyDown=!1,this.#C&&(this.#C=!1,this.#Q("main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of this.#S)if(e.div.contains(t)){this.#B=[e,t],e._focusEventsAllowed=!1;break}}focus(){if(!this.#B)return;let[t,e]=this.#B;this.#B=null,e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}#it(){if(this.#N)return;this.#N=new AbortController;let t=this.combinedSignal(this.#N);window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})}#ht(){this.#N?.abort(),this.#N=null}#dt(){if(this.#h)return;this.#h=new AbortController;let t=this.combinedSignal(this.#h);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})}#ft(){this.#h?.abort(),this.#h=null}#pt(){let t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}addEditListeners(){this.#it(),this.setEditingState(!0)}removeEditListeners(){this.#ht(),this.setEditingState(!1)}dragOver(t){for(let{type:e}of t.dataTransfer.items)for(let n of this.#f)if(n.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(let e of t.dataTransfer.items)for(let n of this.#f)if(n.isHandlingMimeForPasting(e.type)){n.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),this.#e?.commitOrRemove(),!this.hasSelection)return;let e=[];for(let n of this.#S){let s=n.serialize(!0);s&&e.push(s)}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 a of e.items)for(let r of this.#f)if(r.isHandlingMimeForPasting(a.type)){r.paste(a,this.currentLayer);return}let n=e.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(a){I(`paste: "${a.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();let s=this.currentLayer;try{let a=[];for(let l of n){let c=await s.deserialize(l);if(!c)return;a.push(c)}let r=()=>{for(let l of a)this.#nt(l);this.#st(a)},o=()=>{for(let l of a)l.remove()};this.addCommands({cmd:r,undo:o,mustExec:!0})}catch(a){I(`paste: "${a.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),this.#x!==P.NONE&&!this.isEditorHandlingKeyboard&&i._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,this.#C&&(this.#C=!1,this.#Q("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}}updatePageIndex(t,e){for(let s of this.getEditors(t))s.pageIndex=e;let n=this.#r.get(t);n&&(n.pageIndex=e,this.#s.set(e,n),this.#M?n.enable():n.disable())}startUpdatePages(){this.#r=new Map(this.#s),this.#s.clear()}endUpdatePages(){this.#r=null}clonePage(t,e){for(let n of this.getEditors(t)){let s=n.serialize(n.mode!==P.HIGHLIGHT);s&&(s.pageIndex=e,s.id=this.getId(),s.isClone=!0,delete s.popupRef,this.#o.setValue(s.id,s))}}findClonesForPage(t){let e=[],{pageIndex:n}=t;for(let[s,a]of this.#o)a.pageIndex===n&&a.isClone&&(this.#o.remove(s),e.push(t.deserialize(a).then(r=>{r&&(r.isClone=!0,t.addOrRebuild(r))})));return Promise.all(e)}#R(t){Object.entries(t).some(([n,s])=>this.#K[n]!==s)&&(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(this.#K,t)}),this.#x===P.HIGHLIGHT&&t.hasSelectedEditor===!1&&this.#G([[H.HIGHLIGHT_FREE,!0]]))}#G(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#ct(),this.#dt(),this.#R({isEditing:this.#x!==P.NONE,isEmpty:this.#$(),hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:this.#l.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#ut(),this.#ft(),this.#R({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!this.#f){this.#f=t;for(let e of this.#f)this.#G(e.defaultPropertiesToUpdate)}}getId(){return this.#O.id}get currentLayer(){return this.#s.get(this.#m)}getLayer(t){return this.#s.get(t)}get currentPageIndex(){return this.#m}addLayer(t){this.#s.set(t.pageIndex,t),this.#M?t.enable():t.disable()}removeLayer(t){this.#s.delete(t.pageIndex)}async updateMode(t,e=null,n=!1,s=!1,a=!1,r=!1){if(this.#x!==t&&!(this.#H&&(await this.#H.promise,!this.#H))){if(this.#H=Promise.withResolvers(),this.#p?.commitOrRemove(),this.#x===P.POPUP&&this.#d?.hideSidebar(),this.#d?.destroyPopup(),this.#x=t,t===P.NONE){this.setEditingState(!1),this.#mt();for(let o of this.#n.values())o.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),this.#H.resolve();return}for(let o of this.#n.values())o.addStandaloneCommentButton();t===P.SIGNATURE&&await this.#U?.loadSignatures(),n&&Kt.clearPointerType(),this.setEditingState(!0),await this.#gt(),this.unselectAll();for(let o of this.#s.values())o.updateMode(t);if(t===P.POPUP){this.#i||=await this.#q.getAnnotationsByType(new Set(this.#f.map(c=>c._editorType)));let o=new Set,l=[];for(let c of this.#n.values()){let{annotationElementId:u,hasComment:h,deleted:d}=c;u&&o.add(u),h&&!d&&l.push(c.getData())}for(let c of this.#i){let{id:u,popupRef:h,contentsObj:d}=c;h&&d?.str&&!o.has(u)&&!this.#g.has(u)&&l.push(c)}this.#d?.showSidebar(l)}if(!e){s&&this.addNewEditorFromKeyboard(),this.#H.resolve();return}for(let o of this.#n.values())o.uid===e?(this.setSelected(o),r?o.editComment():a?o.enterInEditMode():o.focus()):o.unselect();this.#H.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==this.#x&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(this.#f){switch(t){case H.CREATE:this.currentLayer.addNewEditor(e);return;case H.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#W||=new Map).set(t,e),this.showAllEditors("highlight",e);break}if(this.hasSelection)for(let n of this.#S)n.updateParams(t,e);else for(let n of this.#f)n.updateDefaultParams(t,e)}}showAllEditors(t,e,n=!1){for(let a of this.#n.values())a.editorType===t&&a.show(e);(this.#W?.get(H.HIGHLIGHT_SHOW_ALL)??!0)!==e&&this.#G([[H.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(this.#k!==t){this.#k=t;for(let e of this.#s.values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}async#gt(){if(!this.#M){this.#M=!0;let t=[];for(let e of this.#s.values())t.push(e.enable());await Promise.all(t);for(let e of this.#n.values())e.enable()}}#mt(){if(this.unselectAll(),this.#M){this.#M=!1;for(let t of this.#s.values())t.disable();for(let t of this.#n.values())t.disable()}}*getEditors(t){for(let e of this.#n.values())e.pageIndex===t&&(yield e)}getEditor(t){return this.#n.get(t)}addEditor(t){this.#n.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#A&&clearTimeout(this.#A),this.#A=setTimeout(()=>{this.focusMainContainer(),this.#A=null},0)),this.#n.delete(t.id),t.annotationElementId&&this.#F?.delete(t.annotationElementId),this.unselect(t),(!t.annotationElementId||!this.#g.has(t.annotationElementId))&&this.#o?.remove(t.id)}addDeletedAnnotationElement(t){this.#g.add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return this.#g.has(t)}removeDeletedAnnotationElement(t){this.#g.delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}#nt(t){let e=this.#s.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#yt(){let t=null;for(t of this.#S);return t}updateUI(t){this.#yt===t&&this.#G(t.propertiesToUpdate)}updateUIForDefaultProperties(t){this.#G(t.defaultPropertiesToUpdate)}toggleSelected(t){if(this.#S.has(t)){this.#S.delete(t),t.unselect(),this.#R({hasSelectedEditor:this.hasSelection});return}this.#S.add(t),t.select(),this.#G(t.propertiesToUpdate),this.#R({hasSelectedEditor:!0})}setSelected(t){this.updateToolbar({mode:t.mode,editId:t.uid}),this.#p?.commitOrRemove();for(let e of this.#S)e!==t&&e.unselect();this.#d?.destroyPopup(),this.#S.clear(),this.#S.add(t),t.select(),this.#G(t.propertiesToUpdate),this.#R({hasSelectedEditor:!0})}get firstSelectedEditor(){return this.#S.values().next().value}unselect(t){t.unselect(),this.#S.delete(t),this.#R({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#S.size!==0}get isEnterHandled(){return this.#S.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#l.undo(),this.#R({hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#$()}),this._editorUndoBar?.hide()}redo(){this.#l.redo(),this.#R({hasSomethingToUndo:!0,hasSomethingToRedo:this.#l.hasSomethingToRedo(),isEmpty:this.#$()})}addCommands(t){this.#l.add(t),this.#R({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#$()})}cleanUndoStack(t){this.#l.cleanType(t)}#$(){if(this.#n.size===0)return!0;if(this.#n.size===1)for(let t of this.#n.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.#S],n=()=>{this._editorUndoBar?.show(s,e.length===1?e[0].editorType:e.length);for(let a of e)a.remove()},s=()=>{for(let a of e)this.#nt(a)};this.addCommands({cmd:n,undo:s,mustExec:!0})}commitOrRemove(){this.#e?.commitOrRemove()}hasSomethingToControl(){return this.#e||this.hasSelection}#st(t){for(let e of this.#S)e.unselect();this.#S.clear();for(let e of t)e.isEmpty()||(this.#S.add(e),e.select());this.#R({hasSelectedEditor:this.hasSelection})}selectAll(){for(let t of this.#S)t.commit();this.#st(this.#n.values())}unselectAll(){if(!(this.#e&&(this.#e.commitOrRemove(),this.#x!==P.NONE))&&!this.#p?.commitOrRemove()&&(this.#d?.destroyPopup(),!!this.hasSelection)){for(let t of this.#S)t.unselect();this.#S.clear(),this.#R({hasSelectedEditor:!1})}}translateSelectedEditors(t,e,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#I[0]+=t,this.#I[1]+=e;let[s,a]=this.#I,r=[...this.#S],o=1e3;this.#V&&clearTimeout(this.#V),this.#V=setTimeout(()=>{this.#V=null,this.#I[0]=this.#I[1]=0,this.addCommands({cmd:()=>{for(let l of r)this.#n.has(l.id)&&(l.translateInPage(s,a),l.translationDone())},undo:()=>{for(let l of r)this.#n.has(l.id)&&(l.translateInPage(-s,-a),l.translationDone())},mustExec:!1})},o);for(let l of r)l.translateInPage(t,e),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#u=new Map;for(let t of this.#S)this.#u.set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#u)return!1;this.disableUserSelect(!1);let t=this.#u;this.#u=null;let e=!1;for(let[{x:s,y:a,pageIndex:r},o]of t)o.newX=s,o.newY=a,o.newPageIndex=r,e||=s!==o.savedX||a!==o.savedY||r!==o.savedPageIndex;if(!e)return!1;let n=(s,a,r,o)=>{if(this.#n.has(s.id)){let l=this.#s.get(o);l?s._setParentAndPosition(l,a,r):(s.pageIndex=o,s.x=a,s.y=r)}};return this.addCommands({cmd:()=>{for(let[s,{newX:a,newY:r,newPageIndex:o}]of t)n(s,a,r,o)},undo:()=>{for(let[s,{savedX:a,savedY:r,savedPageIndex:o}]of t)n(s,a,r,o)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(this.#u)for(let n of this.#u.keys())n.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.#S.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return this.#e===t}getActive(){return this.#e}getMode(){return this.#x}isEditingMode(){return this.#x!==P.NONE}get imageManager(){return B(this,"imageManager",new cd)}getSelectionBoxes(t){if(!t)return null;let e=document.getSelection();for(let c=0,u=e.rangeCount;c<u;c++)if(!t.contains(e.getRangeAt(c).commonAncestorContainer))return null;let{x:n,y:s,width:a,height:r}=t.getBoundingClientRect(),o;switch(t.getAttribute("data-main-rotation")){case"90":o=(c,u,h,d)=>({x:(u-s)/r,y:1-(c+h-n)/a,width:d/r,height:h/a});break;case"180":o=(c,u,h,d)=>({x:1-(c+h-n)/a,y:1-(u+d-s)/r,width:h/a,height:d/r});break;case"270":o=(c,u,h,d)=>({x:1-(u+d-s)/r,y:(c-n)/a,width:d/r,height:h/a});break;default:o=(c,u,h,d)=>({x:(c-n)/a,y:(u-s)/r,width:h/a,height:d/r});break}let l=[];for(let c=0,u=e.rangeCount;c<u;c++){let h=e.getRangeAt(c);if(!h.collapsed)for(let{x:d,y:f,width:m,height:y}of h.getClientRects())m===0||y===0||l.push(o(d,f,m,y))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:t,id:e}){(this.#c||=new Map).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){this.#c?.delete(t)}renderAnnotationElement(t){let e=this.#c?.get(t.data.id);if(!e)return;let n=this.#o.getRawValue(e);n&&(this.#x===P.NONE&&!n.hasBeenModified||n.renderAnnotationElement(t))}setMissingCanvas(t,e,n){let s=this.#F?.get(t);s&&(s.setCanvas(e,n),this.#F.delete(t))}addMissingCanvas(t,e){(this.#F||=new Map).set(t,e)}},Tl=class i{#t=null;#e=!1;#i=null;#n=null;#s=null;#r=null;#a=!1;#o=null;#c=null;#l=null;#d=null;#h=!1;static#p=null;static _l10n=null;constructor(t){this.#c=t,this.#h=t._uiManager.useNewAltTextFlow,i.#p||=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){i._l10n??=t}async render(){let t=this.#i=document.createElement("button");t.className="altText",t.tabIndex="0";let e=this.#n=document.createElement("span");t.append(e),this.#h?(t.classList.add("new"),t.setAttribute("data-l10n-id",i.#p.missing),e.setAttribute("data-l10n-id",i.#p["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));let n=this.#c._uiManager._signal;t.addEventListener("contextmenu",Te,{signal:n}),t.addEventListener("pointerdown",a=>a.stopPropagation(),{signal:n});let s=a=>{a.preventDefault(),this.#c._uiManager.editAltText(this.#c),this.#h&&this.#c._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#m}})};return t.addEventListener("click",s,{capture:!0,signal:n}),t.addEventListener("keydown",a=>{a.target===t&&a.key==="Enter"&&(this.#a=!0,s(a))},{signal:n}),await this.#g(),t}get#m(){return this.#t&&"added"||this.#t===null&&this.guessedText&&"review"||"missing"}finish(){this.#i&&(this.#i.focus({focusVisible:this.#a}),this.#a=!1)}isEmpty(){return this.#h?this.#t===null:!this.#t&&!this.#e}hasData(){return this.#h?this.#t!==null||!!this.#l:this.isEmpty()}get guessedText(){return this.#l}async setGuessedText(t){this.#t===null&&(this.#l=t,this.#d=await i._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t}),this.#g())}toggleAltTextBadge(t=!1){if(!this.#h||this.#t){this.#o?.remove(),this.#o=null;return}if(!this.#o){let e=this.#o=document.createElement("div");e.className="noAltTextBadge",this.#c.div.append(e)}this.#o.classList.toggle("hidden",!t)}serialize(t){let e=this.#t;return!t&&this.#l===e&&(e=this.#d),{altText:e,decorative:this.#e,guessedText:this.#l,textWithDisclaimer:this.#d}}get data(){return{altText:this.#t,decorative:this.#e}}set data({altText:t,decorative:e,guessedText:n,textWithDisclaimer:s,cancel:a=!1}){n&&(this.#l=n,this.#d=s),!(this.#t===t&&this.#e===e)&&(a||(this.#t=t,this.#e=e),this.#g())}toggle(t=!1){this.#i&&(!t&&this.#r&&(clearTimeout(this.#r),this.#r=null),this.#i.disabled=!t)}shown(){this.#c._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#m}})}destroy(){this.#i?.remove(),this.#i=null,this.#n=null,this.#s=null,this.#o?.remove(),this.#o=null}async#g(){let t=this.#i;if(!t)return;if(this.#h){if(t.classList.toggle("done",!!this.#t),t.setAttribute("data-l10n-id",i.#p[this.#m]),this.#n?.setAttribute("data-l10n-id",i.#p[`${this.#m}-label`]),!this.#t){this.#s?.remove();return}}else{if(!this.#t&&!this.#e){t.classList.remove("done"),this.#s?.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=this.#s;if(!e){this.#s=e=document.createElement("span"),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${this.#c.id}`;let s=100,a=this.#c._uiManager._signal;a.addEventListener("abort",()=>{clearTimeout(this.#r),this.#r=null},{once:!0}),t.addEventListener("mouseenter",()=>{this.#r=setTimeout(()=>{this.#r=null,this.#s.classList.add("show"),this.#c._reportTelemetry({action:"alt_text_tooltip"})},s)},{signal:a}),t.addEventListener("mouseleave",()=>{this.#r&&(clearTimeout(this.#r),this.#r=null),this.#s?.classList.remove("show")},{signal:a})}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.#c.getElementForAltText()?.setAttribute("aria-describedby",e.id)}},Bs=class{#t=null;#e=null;#i=!1;#n=null;#s=null;#r=null;#a=null;#o=null;#c=!1;#l=null;constructor(t){this.#n=t}renderForToolbar(){let t=this.#e=document.createElement("button");return t.className="comment",this.#d(t,!1)}renderForStandalone(){let t=this.#t=document.createElement("button");t.className="annotationCommentButton";let e=this.#n.commentButtonPosition;if(e){let{style:n}=t;n.insetInlineEnd=`calc(${100*(this.#n._uiManager.direction==="ltr"?1-e[0]:e[0])}% - var(--comment-button-dim))`,n.top=`calc(${100*e[1]}% - var(--comment-button-dim))`;let s=this.#n.commentButtonColor;s&&(n.backgroundColor=s)}return this.#d(t,!0)}focusButton(){setTimeout(()=>{(this.#t??this.#e)?.focus()},0)}onUpdatedColor(){if(!this.#t)return;let t=this.#n.commentButtonColor;t&&(this.#t.style.backgroundColor=t),this.#n._uiManager.updatePopupColor(this.#n)}get commentButtonWidth(){return(this.#t?.getBoundingClientRect().width??0)/this.#n.parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(this.#l)return this.#l;if(!this.#t)return null;let{x:t,y:e,height:n}=this.#t.getBoundingClientRect(),{x:s,y:a,width:r,height:o}=this.#n.parent.boundingClientRect;return[(t-s)/r,(e+n-a)/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)}#d(t,e){if(!this.#n._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.#n._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));let n=this.#n._uiManager._signal;if(!(n instanceof AbortSignal)||n.aborted)return t;t.addEventListener("contextmenu",Te,{signal:n}),e&&(t.addEventListener("focusin",a=>{this.#n._focusEventsAllowed=!1,bt(a)},{capture:!0,signal:n}),t.addEventListener("focusout",a=>{this.#n._focusEventsAllowed=!0,bt(a)},{capture:!0,signal:n})),t.addEventListener("pointerdown",a=>a.stopPropagation(),{signal:n});let s=a=>{a.preventDefault(),t===this.#e?this.edit():this.#n.toggleComment(!0)};return t.addEventListener("click",s,{capture:!0,signal:n}),t.addEventListener("keydown",a=>{a.target===t&&a.key==="Enter"&&(this.#i=!0,s(a))},{signal:n}),t.addEventListener("pointerenter",()=>{this.#n.toggleComment(!1,!0)},{signal:n}),t.addEventListener("pointerleave",()=>{this.#n.toggleComment(!1,!1)},{signal:n}),t}edit(t){let e=this.commentPopupPositionInLayer,n,s;if(e)[n,s]=e;else{[n,s]=this.#n.commentButtonPosition;let{width:u,height:h,x:d,y:f}=this.#n;n=d+n*u,s=f+s*h}let a=this.#n.parent.boundingClientRect,{x:r,y:o,width:l,height:c}=a;this.#n._uiManager.editComment(this.#n,r+n*l,o+s*c,{...t,parentDimensions:a})}finish(){this.#e&&(this.#e.focus({focusVisible:this.#i}),this.#i=!1)}isDeleted(){return this.#c||this.#a===""}isEmpty(){return this.#a===null}hasBeenEdited(){return this.isDeleted()||this.#a!==this.#s}serialize(){return this.data}get data(){return{text:this.#a,richText:this.#r,date:this.#o,deleted:this.isDeleted()}}set data(t){if(t!==this.#a&&(this.#r=null),t===null){this.#a="",this.#c=!0;return}this.#a=t,this.#o=new Date,this.#c=!1}restoreData({text:t,richText:e,date:n}){this.#a=t,this.#r=e,this.#o=n,this.#c=!1}setInitialText(t,e=null){this.#s=t,this.data=t,this.#o=null,this.#r=e}shown(){}destroy(){this.#e?.remove(),this.#e=null,this.#t?.remove(),this.#t=null,this.#a="",this.#r=null,this.#o=null,this.#n=null,this.#i=!1,this.#c=!1}},fr=class i{#t;#e=!1;#i=null;#n;#s;#r;#a;#o=null;#c;#l=null;#d;#h=null;constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:n=null,onPinchStart:s=null,onPinching:a=null,onPinchEnd:r=null,signal:o}){this.#t=t,this.#i=n,this.#n=e,this.#s=s,this.#r=a,this.#a=r,this.#d=new AbortController,this.#c=AbortSignal.any([o,this.#d.signal]),t.addEventListener("touchstart",this.#p.bind(this),{passive:!1,signal:this.#c})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Je.pixelRatio}#p(t){if(this.#n?.())return;if(t.touches.length===1){if(this.#o)return;let s=this.#o=new AbortController,a=AbortSignal.any([this.#c,s.signal]),r=this.#t,o={capture:!0,signal:a,passive:!1},l=c=>{c.pointerType==="touch"&&(this.#o?.abort(),this.#o=null)};r.addEventListener("pointerdown",c=>{c.pointerType==="touch"&&(bt(c),l(c))},o),r.addEventListener("pointerup",l,o),r.addEventListener("pointercancel",l,o);return}if(!this.#h){this.#h=new AbortController;let s=AbortSignal.any([this.#c,this.#h.signal]),a=this.#t,r={signal:s,capture:!1,passive:!1};a.addEventListener("touchmove",this.#m.bind(this),r);let o=this.#g.bind(this);a.addEventListener("touchend",o,r),a.addEventListener("touchcancel",o,r),r.capture=!0,a.addEventListener("pointerdown",bt,r),a.addEventListener("pointermove",bt,r),a.addEventListener("pointercancel",bt,r),a.addEventListener("pointerup",bt,r),this.#s?.()}if(bt(t),t.touches.length!==2||this.#i?.()){this.#l=null;return}let[e,n]=t.touches;e.identifier>n.identifier&&([e,n]=[n,e]),this.#l={touch0X:e.screenX,touch0Y:e.screenY,touch1X:n.screenX,touch1Y:n.screenY}}#m(t){if(!this.#l||t.touches.length!==2)return;bt(t);let[e,n]=t.touches;e.identifier>n.identifier&&([e,n]=[n,e]);let{screenX:s,screenY:a}=e,{screenX:r,screenY:o}=n,l=this.#l,{touch0X:c,touch0Y:u,touch1X:h,touch1Y:d}=l,f=h-c,m=d-u,y=r-s,v=o-a,p=Math.hypot(y,v)||1,g=Math.hypot(f,m)||1;if(!this.#e&&Math.abs(g-p)<=i.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=s,l.touch0Y=a,l.touch1X=r,l.touch1Y=o,!this.#e){this.#e=!0;return}let b=[(s+r)/2,(a+o)/2];this.#r?.(b,g,p)}#g(t){t.touches.length>=2||(this.#h&&(this.#h.abort(),this.#h=null,this.#a?.()),this.#l&&(bt(t),this.#l=null,this.#e=!1))}destroy(){this.#d?.abort(),this.#d=null,this.#o?.abort(),this.#o=null}},tt=class i{#t=null;#e=null;#i=null;#n=null;#s=null;#r=!1;#a=null;#o="";#c=null;#l=null;#d=null;#h=null;#p=null;#m="";#g=!1;#u=null;#f=!1;#b=!1;#v=!1;#y=null;#T=0;#w=0;#A=null;#_=null;isSelected=!1;_isCopy=!1;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nAlert=null;static _l10nResizer=null;#E=!1;#C=i._zIndex++;static _borderLineWidth=-1;static _colorManager=new hd;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){let t=i.prototype._resizeWithKeyboard,e=rn.TRANSLATE_SMALL,n=rn.TRANSLATE_BIG;return B(this,"_resizerKeyboardManager",new Ln([[["ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-n,0]}],[["ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[n,0]}],[["ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-n]}],[["ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,n]}],[["Escape"],i.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,this.canAddComment=!0;let{rotation:e,rawDims:{pageWidth:n,pageHeight:s,pageX:a,pageY:r}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,s],this.pageTranslation=[a,r];let[o,l]=this.parentDimensions;this.x=t.x/o,this.y=t.y/l,this.isAttachedToDOM=!1,this.deleted=!1}updatePageIndex(t){this.pageIndex=t}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 B(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new dd({id:t._uiManager.getId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(i._l10n??=t,i._l10nAlert??=Object.freeze({highlight:"pdfjs-editor-highlight-added-alert",freetext:"pdfjs-editor-freetext-added-alert",ink:"pdfjs-editor-ink-added-alert",stamp:"pdfjs-editor-stamp-added-alert",signature:"pdfjs-editor-signature-added-alert"}),i._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"}),i._borderLineWidth!==-1)return;let n=getComputedStyle(document.documentElement);i._borderLineWidth=parseFloat(n.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.#C}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(this.#I(),this.#h?.remove(),this.#h=null),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#g?this.#g=!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,n,s){let[a,r]=this.parentDimensions;[n,s]=this.screenToPageTranslation(n,s),this.x=(t+n)/a,this.y=(e+s)/r,this.fixAndSetPosition()}_moveAfterPaste(t,e){if(this.isClone){delete this.isClone;return}let[n,s]=this.parentDimensions;this.setAt(t*n,e*s,this.width*n,this.height*s),this._onTranslated()}#D([t,e],n,s){[n,s]=this.screenToPageTranslation(n,s),this.x+=n/t,this.y+=s/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(t,e){this.#D(this.parentDimensions,t,e)}translateInPage(t,e){this.#u||=[this.x,this.y,this.width,this.height],this.#D(this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){this.#u||=[this.x,this.y,this.width,this.height];let{div:n,parentDimensions:[s,a]}=this;if(this.x+=t/s,this.y+=e/a,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:h,y:d}=this.div.getBoundingClientRect();this.parent.findNewParent(this,h,d)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:r,y:o}=this,[l,c]=this.getBaseTranslation();r+=l,o+=c;let{style:u}=n;u.left=`${(100*r).toFixed(2)}%`,u.top=`${(100*o).toFixed(2)}%`,this._onTranslating(r,o),n.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!this.#u&&(this.#u[0]!==this.x||this.#u[1]!==this.y)}get _hasBeenResized(){return!!this.#u&&(this.#u[2]!==this.width||this.#u[3]!==this.height)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:n}=i,s=n/t,a=n/e;switch(this.rotation){case 90:return[-s,a];case 180:return[s,a];case 270:return[s,-a];default:return[-s,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){let{div:{style:e},pageDimensions:[n,s]}=this,{x:a,y:r,width:o,height:l}=this;if(o*=n,l*=s,a*=n,r*=s,this._mustFixPosition)switch(t){case 0:a=ht(a,0,n-o),r=ht(r,0,s-l);break;case 90:a=ht(a,0,n-l),r=ht(r,o,s);break;case 180:a=ht(a,o,n),r=ht(r,l,s);break;case 270:a=ht(a,l,n),r=ht(r,0,s-o);break}this.x=a/=n,this.y=r/=s;let[c,u]=this.getBaseTranslation();a+=c,r+=u,e.left=`${(100*a).toFixed(2)}%`,e.top=`${(100*r).toFixed(2)}%`,this.moveInDOM()}static#O(t,e,n){switch(n){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}screenToPageTranslation(t,e){return i.#O(t,e,this.parentRotation)}pageTranslationToScreen(t,e){return i.#O(t,e,360-this.parentRotation)}#M(t){switch(t){case 90:{let[e,n]=this.pageDimensions;return[0,-e/n,n/e,0]}case 180:return[-1,0,0,-1];case 270:{let[e,n]=this.pageDimensions;return[0,e/n,-n/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,n]}=this;return[e*t,n*t]}setDims(){let{div:{style:t},width:e,height:n}=this;t.width=`${(100*e).toFixed(2)}%`,t.height=`${(100*n).toFixed(2)}%`}getInitialTranslation(){return[0,0]}#L(){if(this.#c)return;this.#c=document.createElement("div"),this.#c.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 n of t){let s=document.createElement("div");this.#c.append(s),s.classList.add("resizer",n),s.setAttribute("data-resizer-name",n),s.addEventListener("pointerdown",this.#k.bind(this,n),{signal:e}),s.addEventListener("contextmenu",Te,{signal:e}),s.tabIndex=-1}this.div.prepend(this.#c)}#k(t,e){e.preventDefault();let{isMac:n}=J.platform;if(e.button!==0||e.ctrlKey&&n)return;this.#i?.toggle(!1);let s=this._isDraggable;this._isDraggable=!1,this.#l=[e.screenX,e.screenY];let a=new AbortController,r=this._uiManager.combinedSignal(a);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#P.bind(this,t),{passive:!0,capture:!0,signal:r}),window.addEventListener("touchmove",bt,{passive:!1,signal:r}),window.addEventListener("contextmenu",Te,{signal:r}),this.#d={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 c=()=>{a.abort(),this.parent.togglePointerEvents(!0),this.#i?.toggle(!0),this._isDraggable=s,this.parent.div.style.cursor=o,this.div.style.cursor=l,this.#B()};window.addEventListener("pointerup",c,{signal:r}),window.addEventListener("blur",c,{signal:r})}#N(t,e,n,s){this.width=n,this.height=s,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()}_onResized(){}#B(){if(!this.#d)return;let{savedX:t,savedY:e,savedWidth:n,savedHeight:s}=this.#d;this.#d=null;let a=this.x,r=this.y,o=this.width,l=this.height;a===t&&r===e&&o===n&&l===s||this.addCommands({cmd:this.#N.bind(this,a,r,o,l),undo:this.#N.bind(this,t,e,n,s),mustExec:!0})}static _round(t){return Math.round(t*1e4)/1e4}#P(t,e){let[n,s]=this.parentDimensions,a=this.x,r=this.y,o=this.width,l=this.height,c=i.MIN_SIZE/n,u=i.MIN_SIZE/s,h=this.#M(this.rotation),d=(L,R)=>[h[0]*L+h[2]*R,h[1]*L+h[3]*R],f=this.#M(360-this.rotation),m=(L,R)=>[f[0]*L+f[2]*R,f[1]*L+f[3]*R],y,v,p=!1,g=!1;switch(t){case"topLeft":p=!0,y=(L,R)=>[0,0],v=(L,R)=>[L,R];break;case"topMiddle":y=(L,R)=>[L/2,0],v=(L,R)=>[L/2,R];break;case"topRight":p=!0,y=(L,R)=>[L,0],v=(L,R)=>[0,R];break;case"middleRight":g=!0,y=(L,R)=>[L,R/2],v=(L,R)=>[0,R/2];break;case"bottomRight":p=!0,y=(L,R)=>[L,R],v=(L,R)=>[0,0];break;case"bottomMiddle":y=(L,R)=>[L/2,R],v=(L,R)=>[L/2,0];break;case"bottomLeft":p=!0,y=(L,R)=>[0,R],v=(L,R)=>[L,0];break;case"middleLeft":g=!0,y=(L,R)=>[0,R/2],v=(L,R)=>[L,R/2];break}let b=y(o,l),A=v(o,l),S=d(...A),E=i._round(a+S[0]),T=i._round(r+S[1]),w=1,_=1,C,D;if(e.fromKeyboard)({deltaX:C,deltaY:D}=e);else{let{screenX:L,screenY:R}=e,[Lt,kt]=this.#l;[C,D]=this.screenToPageTranslation(L-Lt,R-kt),this.#l[0]=L,this.#l[1]=R}if([C,D]=m(C/n,D/s),p){let L=Math.hypot(o,l);w=_=Math.max(Math.min(Math.hypot(A[0]-b[0]-C,A[1]-b[1]-D)/L,1/o,1/l),c/o,u/l)}else g?w=ht(Math.abs(A[0]-b[0]-C),c,1)/o:_=ht(Math.abs(A[1]-b[1]-D),u,1)/l;let N=i._round(o*w),z=i._round(l*_);S=d(...v(N,z));let X=E-S[0],lt=T-S[1];this.#u||=[this.x,this.y,this.width,this.height],this.width=N,this.height=z,this.x=X,this.y=lt,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 rd(this),this.div.append(this._editToolbar.render());let{toolbarButtons:t}=this;if(t)for(let[e,n]of t)await this._editToolbar.addButton(e,n);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||(Tl.initialize(i._l10n),this.#i=new Tl(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.#n?.focusButton()}addCommentButton(){return this.canAddComment?this.#n||=new Bs(this):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(this.#s){this._uiManager.isEditingMode()&&this.#s.classList.remove("hidden");return}this.hasComment&&(this.#s=this.#n.renderForStandalone(),this.div.append(this.#s))}}removeStandaloneCommentButton(){this.#n.removeStandaloneCommentButton(),this.#s=null}hideStandaloneCommentButton(){this.#s?.classList.add("hidden")}get comment(){if(!this.#n)return null;let{data:{richText:t,text:e,date:n,deleted:s}}=this.#n;return{text:e,richText:t,date:n,deleted:s,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(t){this.#n||=new Bs(this),typeof t=="object"&&t!==null?this.#n.restoreData(t):this.#n.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:n}){if(!e||(this.#n||=new Bs(this),this.#n.setInitialText(t,n),!this.annotationElementId))return;let s=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);s&&this.updateFromAnnotationLayer(s)}get hasEditedComment(){return this.#n?.hasBeenEdited()}get hasDeletedComment(){return this.#n?.isDeleted()}get hasComment(){return!!this.#n&&!this.#n.isEmpty()&&!this.#n.isDeleted()}async editComment(t){this.#n||=new Bs(this),this.#n.edit(t)}toggleComment(t,e=void 0){this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){this.#n.setSelectedButton(t)}addComment(t){if(this.hasEditedComment){let[,,,s]=t.rect,[a]=this.pageDimensions,[r]=this.pageTranslation,o=r+a+1,l=s-100,c=o+180;t.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[o,l,c,s]}}}updateFromAnnotationLayer({popup:{contents:t,deleted:e}}){this.#n.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.#r?-1:0,t.setAttribute("role","application"),this.defaultL10nId&&t.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||t.classList.add("hidden"),this.setInForeground(),this.#U();let[e,n]=this.parentDimensions;this.parentRotation%180!==0&&(t.style.maxWidth=`${(100*n/e).toFixed(2)}%`,t.style.maxHeight=`${(100*e/n).toFixed(2)}%`);let[s,a]=this.getInitialTranslation();return this.translate(s,a),Eb(this,t,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(this.#_||=new fr({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#F.bind(this),onPinching:this.#X.bind(this),onPinchEnd:this.#x.bind(this),signal:this._uiManager._signal})),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),t}#F(){this.#d={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#i?.toggle(!1),this.parent.togglePointerEvents(!1)}#X(t,e,n){let a=.7*(n/e)+1-.7;if(a===1)return;let r=this.#M(this.rotation),o=(E,T)=>[r[0]*E+r[2]*T,r[1]*E+r[3]*T],[l,c]=this.parentDimensions,u=this.x,h=this.y,d=this.width,f=this.height,m=i.MIN_SIZE/l,y=i.MIN_SIZE/c;a=Math.max(Math.min(a,1/d,1/f),m/d,y/f);let v=i._round(d*a),p=i._round(f*a);if(v===d&&p===f)return;this.#u||=[u,h,d,f];let g=o(d/2,f/2),b=i._round(u+g[0]),A=i._round(h+g[1]),S=o(v/2,p/2);this.x=b-S[0],this.y=A-S[1],this.width=v,this.height=p,this.setDims(),this.fixAndSetPosition(),this._onResizing()}#x(){this.#i?.toggle(!0),this.parent.togglePointerEvents(!0),this.#B()}pointerdown(t){let{isMac:e}=J.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(this.#g=!0,this._isDraggable){this.#z(t);return}this.#S(t)}#S(t){let{isMac:e}=J.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}#z(t){let{isSelected:e}=this;this._uiManager.setUpDragSession();let n=!1,s=new AbortController,a=this._uiManager.combinedSignal(s),r={capture:!0,passive:!1,signal:a},o=c=>{s.abort(),this.#a=null,this.#g=!1,this._uiManager.endDragSession()||this.#S(c),n&&this._onStopDragging()};e&&(this.#T=t.clientX,this.#w=t.clientY,this.#a=t.pointerId,this.#o=t.pointerType,window.addEventListener("pointermove",c=>{n||(n=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());let{clientX:u,clientY:h,pointerId:d}=c;if(d!==this.#a){bt(c);return}let[f,m]=this.screenToPageTranslation(u-this.#T,h-this.#w);this.#T=u,this.#w=h,this._uiManager.dragSelectedEditors(f,m)},r),window.addEventListener("touchmove",bt,r),window.addEventListener("pointerdown",c=>{c.pointerType===this.#o&&(this.#_||c.isPrimary)&&o(c),bt(c)},r));let l=c=>{if(!this.#a||this.#a===c.pointerId){o(c);return}bt(c)};window.addEventListener("pointerup",l,{signal:a}),window.addEventListener("blur",l,{signal:a})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#y&&clearTimeout(this.#y),this.#y=setTimeout(()=>{this.#y=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(t,e,n){t.changeParent(this),this.x=e,this.y=n,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e,n=this.rotation){let s=this.parentScale,[a,r]=this.pageDimensions,[o,l]=this.pageTranslation,c=t/s,u=e/s,h=this.x*a,d=this.y*r,f=this.width*a,m=this.height*r;switch(n){case 0:return[h+c+o,r-d-u-m+l,h+c+f+o,r-d-u+l];case 90:return[h+u+o,r-d+c+l,h+u+m+o,r-d+c+f+l];case 180:return[h-c-f+o,r-d+u+l,h-c+o,r-d+u+m+l];case 270:return[h-u-m+o,r-d-c-f+l,h-u+o,r-d-c+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){let[n,s,a,r]=t,o=a-n,l=r-s;switch(this.rotation){case 0:return[n,e-r,o,l];case 90:return[n,e-s,l,o];case 180:return[a,e-s,o,l];case 270:return[a,e-r,l,o];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&i._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){this.#n?.onUpdatedColor()}getData(){let{comment:{text:t,color:e,date:n,opacity:s,deleted:a,richText:r},uid:o,pageIndex:l,creationDate:c,modificationDate:u}=this;return{id:o,pageIndex:l,rect:this.getPDFRect(),richText:r,contentsObj:{str:t},creationDate:c,modificationDate:n||u,popupRef:!a,color:e,opacity:s}}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.#v}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:t,left:e,bottom:n,right:s}=this.getClientDimensions(),{innerHeight:a,innerWidth:r}=window;return e<r&&s>0&&t<a&&n>0}#U(){if(this.#p||!this.div)return;this.#p=new AbortController;let t=this._uiManager.combinedSignal(this.#p);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}rebuild(){this.#U()}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,n){let s=new this.prototype.constructor({parent:e,id:n.getId(),uiManager:n,annotationElementId:t.annotationElementId,creationDate:t.creationDate,modificationDate:t.modificationDate});s.rotation=t.rotation,s.#t=t.accessibilityData,s._isCopy=t.isCopy||!1;let[a,r]=s.pageDimensions,[o,l,c,u]=s.getRectInCurrentCoords(t.rect,r);return s.x=o/a,s.y=l/r,s.width=c/a,s.height=u/r,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.#p?.abort(),this.#p=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),this.#y&&(clearTimeout(this.#y),this.#y=null),this.#I(),this.removeEditToolbar(),this.#A){for(let t of this.#A.values())clearTimeout(t);this.#A=null}this.parent=null,this.#_?.destroy(),this.#_=null,this.#h?.remove(),this.#h=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#L(),this.#c.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,[n,s,a,r]=this.getPDFRect();return[i._round(n+(a-n)*t),i._round(s+(r-s)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return this.#n.commentPopupPositionInLayer}set commentPopupPosition(t){this.#n.commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return this.#n.hasDefaultPopupPosition()}get commentButtonWidth(){return this.#n.commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){this.#n?.setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),this.#d={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let e=this.#c.children;if(!this.#e){this.#e=Array.from(e);let r=this.#j.bind(this),o=this.#W.bind(this),l=this._uiManager._signal;for(let c of this.#e){let u=c.getAttribute("data-resizer-name");c.setAttribute("role","spinbutton"),c.addEventListener("keydown",r,{signal:l}),c.addEventListener("blur",o,{signal:l}),c.addEventListener("focus",this.#q.bind(this,u),{signal:l}),c.setAttribute("data-l10n-id",i._l10nResizer[u])}}let n=this.#e[0],s=0;for(let r of e){if(r===n)break;s++}let a=(360-this.rotation+this.parentRotation)%360/90*(this.#e.length/4);if(a!==s){if(a<s)for(let o=0;o<s-a;o++)this.#c.append(this.#c.firstElementChild);else if(a>s)for(let o=0;o<a-s;o++)this.#c.firstElementChild.before(this.#c.lastElementChild);let r=0;for(let o of e){let c=this.#e[r++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",i._l10nResizer[c])}}this.#K(0),this.#v=!0,this.#c.firstElementChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#j(t){i._resizerKeyboardManager.exec(this,t)}#W(t){this.#v&&t.relatedTarget?.parentNode!==this.#c&&this.#I()}#q(t){this.#m=this.#v?t:""}#K(t){if(this.#e)for(let e of this.#e)e.tabIndex=t}_resizeWithKeyboard(t,e){this.#v&&this.#P(this.#m,{deltaX:t,deltaY:e,fromKeyboard:!0})}#I(){this.#v=!1,this.#K(-1),this.#B()}_stopResizingWithKeyboard(){this.#I(),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.#c?.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.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}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.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return this.#f}set isEditing(t){this.#f=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.#A||=new Map;let{action:n}=t,s=this.#A.get(n);s&&clearTimeout(s),s=setTimeout(()=>{this._reportTelemetry(t),this.#A.delete(n),this.#A.size===0&&(this.#A=null)},i._telemetryTimeout),this.#A.set(n,s);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.#r=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#r=!0}updateFakeAnnotationElement(t){if(!this.#h&&!this.deleted){this.#h=t.addFakeAnnotation(this);return}if(this.deleted){this.#h.remove(),this.#h=null;return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&this.#h.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 n=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),n.before(e)}return e}resetAnnotationElement(t){let{firstElementChild:e}=t.container;e?.nodeName==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}},dd=class extends tt{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},Wy=3285377520,Be=4294901760,Ze=65535,pr=class{constructor(t){this.h1=t?t&4294967295:Wy,this.h2=t?t&4294967295:Wy}update(t){let e,n;if(typeof t=="string"){e=new Uint8Array(t.length*2),n=0;for(let y=0,v=t.length;y<v;y++){let p=t.charCodeAt(y);p<=255?e[n++]=p:(e[n++]=p>>>8,e[n++]=p&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),n=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");let s=n>>2,a=n-s*4,r=new Uint32Array(e.buffer,0,s),o=0,l=0,c=this.h1,u=this.h2,h=3432918353,d=461845907,f=h&Ze,m=d&Ze;for(let y=0;y<s;y++)y&1?(o=r[y],o=o*h&Be|o*f&Ze,o=o<<15|o>>>17,o=o*d&Be|o*m&Ze,c^=o,c=c<<13|c>>>19,c=c*5+3864292196):(l=r[y],l=l*h&Be|l*f&Ze,l=l<<15|l>>>17,l=l*d&Be|l*m&Ze,u^=l,u=u<<13|u>>>19,u=u*5+3864292196);switch(o=0,a){case 3:o^=e[s*4+2]<<16;case 2:o^=e[s*4+1]<<8;case 1:o^=e[s*4],o=o*h&Be|o*f&Ze,o=o<<15|o>>>17,o=o*d&Be|o*m&Ze,s&1?c^=o:u^=o}this.h1=c,this.h2=u}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&Be|t*36045&Ze,e=e*4283543511&Be|((e<<16|t>>>16)*2950163797&Be)>>>16,t^=e>>>1,t=t*444984403&Be|t*60499&Ze,e=e*3301882366&Be|((e<<16|t>>>16)*3120437893&Be)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}},gr=Object.freeze({map:null,hash:"",transfer:void 0}),mr=class{#t=!1;#e=null;#i=null;#n=new Map;onSetModified=null;onResetModified=null;onAnnotationEditor=null;getValue(t,e){let n=this.#n.get(t);return n===void 0?e:Object.assign(e,n)}getRawValue(t){return this.#n.get(t)}remove(t){let e=this.#n.get(t);e!==void 0&&(e instanceof tt&&this.#i.delete(e.annotationElementId),this.#n.delete(t),this.#n.size===0&&this.resetModified(),!this.#n.values().some(n=>n instanceof tt)&&this.onAnnotationEditor?.(null))}setValue(t,e){let n=this.#n.get(t),s=!1;if(n!==void 0)for(let[a,r]of Object.entries(e))n[a]!==r&&(s=!0,n[a]=r);else s=!0,this.#n.set(t,e);s&&this.#s(),e instanceof tt&&((this.#i||=new Map).set(e.annotationElementId,e),this.onAnnotationEditor?.(e.constructor._type))}has(t){return this.#n.has(t)}get size(){return this.#n.size}#s(){this.#t||(this.#t=!0,this.onSetModified?.())}resetModified(){this.#t&&(this.#t=!1,this.onResetModified?.())}get print(){return new wl(this)}get serializable(){if(this.#n.size===0)return gr;let t=new Map,e=new pr,n=[],s=Object.create(null),a=!1;for(let[r,o]of this.#n){let l=o instanceof tt?o.serialize(!1,s):o;o.page&&(o.pageIndex=o.page._pageIndex,delete o.page),l&&(t.set(r,l),e.update(`${r}:${JSON.stringify(l)}`),a||=!!l.bitmap)}if(a)for(let r of t.values())r.bitmap&&n.push(r.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:n}:gr}get editorStats(){let t=null,e=new Map,n=0,s=0;for(let a of this.#n.values()){if(!(a instanceof tt)){a.popup&&(a.popup.deleted?s+=1:n+=1);continue}a.isCommentDeleted?s+=1:a.hasEditedComment&&(n+=1);let r=a.telemetryFinalData;if(!r)continue;let{type:o}=r;e.getOrInsertComputed(o,()=>Object.getPrototypeOf(a).constructor),t||=Object.create(null);let l=t[o]||=new Map;for(let[c,u]of Object.entries(r)){if(c==="type")continue;let h=l.getOrInsertComputed(c,$l);h.set(u,(h.get(u)??0)+1)}}if((s>0||n>0)&&(t||=Object.create(null),t.comments={deleted:s,edited:n}),!t)return null;for(let[a,r]of e)t[a]=r.computeTelemetryFinalData(t[a]);return t}resetModifiedIds(){this.#e=null}updateEditor(t,e){let n=this.#i?.get(t);return n?(n.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 n of this.#i.values())n.serialize()&&t.push(n.annotationElementId);let e="";if(t.length){let n=new pr;n.update(t.join(",")),e=n.hexdigest()}return this.#e={ids:new Set(t),hash:e}}[Symbol.iterator](){return this.#n.entries()}},wl=class extends mr{#t=gr;constructor(t){super();let{serializable:e}=t;if(e===gr)return;let{map:n,hash:s,transfer:a}=e,r=structuredClone(n,a?{transfer:a}:null);this.#t={map:r,hash:s,transfer:[]}}get print(){Q("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#t}get modifiedIds(){return B(this,"modifiedIds",{ids:new Set,hash:""})}},Rs="__forcedDependency",{floor:Qy,ceil:$y}=Math;fd=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],pd=class{#t;#e;constructor(t,e){this.#t=t,this.#e=e}get length(){return this.#t.length}isEmpty(t){return this.#t[t]===fd}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}},Jy=(i,t)=>i?.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1})),gd=class{#t=[[1,0,0,1,0,0]];#e=[-1/0,-1/0,1/0,1/0];#i=new Float64Array(Ti);_pendingBBoxIdx=-1;#n;#s;#r;#a;_savesStack=[];_markedContentStack=[];constructor(t,e){this.#n=t.width,this.#s=t.height,this.#o(e)}growOperationsCount(t){t>=this.#a.length&&this.#o(t,this.#a)}#o(t,e){let n=new ArrayBuffer(t*4);this.#r=new Uint8ClampedArray(n),this.#a=new Uint32Array(n),e&&e.length>0?(this.#a.set(e),this.#a.fill(fd,e.length)):this.#a.fill(fd)}get clipBox(){return this.#e}save(t){return this.#e={__proto__:this.#e},this._savesStack.push(t),this}restore(t,e){let n=Object.getPrototypeOf(this.#e);if(n===null)return this;this.#e=n;let s=this._savesStack.pop();return s!==void 0&&(e?.(s,t),this.#a[t]=this.#a[s]),this}recordOpenMarker(t){return this._savesStack.push(t),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(t,e){let n=this._savesStack.pop();return n!==void 0&&(e?.(n,t),this.#a[t]=this.#a[n]),this}beginMarkedContent(t){return this._markedContentStack.push(t),this}endMarkedContent(t,e){let n=this._markedContentStack.pop();return n!==void 0&&(e?.(n,t),this.#a[t]=this.#a[n]),this}pushBaseTransform(t){return this.#t.push(M.multiplyByDOMMatrix(this.#t.at(-1),t.getTransform())),this}popBaseTransform(){return this.#t.length>1&&this.#t.pop(),this}resetBBox(t){return this._pendingBBoxIdx!==t&&(this._pendingBBoxIdx=t,this.#i.set(Ti,0)),this}recordClipBox(t,e,n,s,a,r){let o=M.multiplyByDOMMatrix(this.#t.at(-1),e.getTransform()),l=Ti.slice();M.axialAlignedBoundingBox([n,a,s,r],o,l);let c=M.intersect(this.#e,l);return c?(this.#e[0]=c[0],this.#e[1]=c[1],this.#e[2]=c[2],this.#e[3]=c[3]):(this.#e[0]=this.#e[1]=1/0,this.#e[2]=this.#e[3]=-1/0),this}recordBBox(t,e,n,s,a,r){let o=this.#e;if(o[0]===1/0)return this;let l=M.multiplyByDOMMatrix(this.#t.at(-1),e.getTransform());if(o[0]===-1/0)return M.axialAlignedBoundingBox([n,a,s,r],l,this.#i),this;let c=Ti.slice();return M.axialAlignedBoundingBox([n,a,s,r],l,c),this.#i[0]=ht(c[0],o[0],this.#i[0]),this.#i[1]=ht(c[1],o[1],this.#i[1]),this.#i[2]=ht(c[2],this.#i[2],o[2]),this.#i[3]=ht(c[3],this.#i[3],o[3]),this}recordFullPageBBox(t){return this.#i[0]=Math.max(0,this.#e[0]),this.#i[1]=Math.max(0,this.#e[1]),this.#i[2]=Math.min(this.#n,this.#e[2]),this.#i[3]=Math.min(this.#s,this.#e[3]),this}recordOperation(t,e=!1,n){if(this._pendingBBoxIdx!==t)return this;let s=Qy(this.#i[0]*256/this.#n),a=Qy(this.#i[1]*256/this.#s),r=$y(this.#i[2]*256/this.#n),o=$y(this.#i[3]*256/this.#s);if(Zy(this.#r,t,s,a,r,o),n)for(let l of n)for(let c of l)c!==t&&Zy(this.#r,c,s,a,r,o);return e||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(t){return this._pendingBBoxIdx===t&&(this._pendingBBoxIdx=-1,this.#e[0]=Math.max(this.#e[0],this.#i[0]),this.#e[1]=Math.max(this.#e[1],this.#i[1]),this.#e[2]=Math.min(this.#e[2],this.#i[2]),this.#e[3]=Math.min(this.#e[3],this.#i[3])),this}take(){return new pd(this.#a,this.#r)}takeDebugMetadata(){throw new Error("Unreachable")}recordSimpleData(t,e){return this}recordIncrementalData(t,e){return this}resetIncrementalData(t,e){return this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,n){return this}recordFutureForcedDependency(t,e){return this}inheritSimpleDataAsFutureForcedDependencies(t){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(t,e,n,s=1,a=0,r=0,o){return this}getSimpleIndex(t){}recordDependencies(t,e){return this}recordNamedDependency(t,e){return this}recordShowTextOperation(t,e=!1){return this}},md=class{#t={__proto__:null};#e={__proto__:null,transform:[],moveText:[],sameLineText:[],[Rs]:[]};#i=new Map;#n=new Set;#s=new Map;#r;#a;#o;constructor(t,e=!1){this.#o=t,e&&(this.#r=new Map,this.#a=(n,s)=>{Jy(this.#r,s).dependencies.add(n)})}get clipBox(){return this.#o.clipBox}growOperationsCount(t){this.#o.growOperationsCount(t)}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},[Rs]:{__proto__:this.#e[Rs]}},this.#o.save(t),this}restore(t){this.#o.restore(t,this.#a);let e=Object.getPrototypeOf(this.#t);return e===null?this:(this.#t=e,this.#e=Object.getPrototypeOf(this.#e),this)}recordOpenMarker(t){return this.#o.recordOpenMarker(t,this.#a),this}getOpenMarker(){return this.#o.getOpenMarker()}recordCloseMarker(t){return this.#o.recordCloseMarker(t,this.#a),this}beginMarkedContent(t){return this.#o.beginMarkedContent(t),this}endMarkedContent(t){return this.#o.endMarkedContent(t,this.#a),this}pushBaseTransform(t){return this.#o.pushBaseTransform(t),this}popBaseTransform(){return this.#o.popBaseTransform(),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,n){this.#t[t]=this.#i.get(e)??n}recordFutureForcedDependency(t,e){return this.recordIncrementalData(Rs,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.#n)this.recordFutureForcedDependency(Rs,t);return this}resetBBox(t){return this.#o.resetBBox(t),this}recordClipBox(t,e,n,s,a,r){return this.#o.recordClipBox(t,e,n,s,a,r),this}recordBBox(t,e,n,s,a,r){return this.#o.recordBBox(t,e,n,s,a,r),this}recordCharacterBBox(t,e,n,s=1,a=0,r=0,o){let l=n.bbox,c,u;if(l&&(c=l[2]!==l[0]&&l[3]!==l[1]&&this.#s.get(n),c!==!1&&(u=[0,0,0,0],M.axialAlignedBoundingBox(l,n.fontMatrix,u),(s!==1||a!==0||r!==0)&&rS(s,-s,a,r,u),c)))return this.recordBBox(t,e,u[0],u[2],u[1],u[3]);if(!o)return this.recordFullPageBBox(t);let h=o();return l&&u&&c===void 0&&(c=u[0]<=a-h.actualBoundingBoxLeft&&u[2]>=a+h.actualBoundingBoxRight&&u[1]<=r-h.actualBoundingBoxAscent&&u[3]>=r+h.actualBoundingBoxDescent,this.#s.set(n,c),c)?this.recordBBox(t,e,u[0],u[2],u[1],u[3]):this.recordBBox(t,e,a-h.actualBoundingBoxLeft,a+h.actualBoundingBoxRight,r-h.actualBoundingBoxAscent,r+h.actualBoundingBoxDescent)}recordFullPageBBox(t){return this.#o.recordFullPageBBox(t),this}getSimpleIndex(t){return this.#t[t]}recordDependencies(t,e){let n=this.#n,s=this.#t,a=this.#e;for(let r of e)r in this.#t?n.add(s[r]):r in a&&a[r].forEach(n.add,n);return this}recordNamedDependency(t,e){return this.#i.has(e)&&this.#n.add(this.#i.get(e)),this}recordOperation(t,e=!1){if(this.recordDependencies(t,[Rs]),this.#r){let s=Jy(this.#r,t),{dependencies:a}=s;this.#n.forEach(a.add,a),this.#o._savesStack.forEach(a.add,a),this.#o._markedContentStack.forEach(a.add,a),a.delete(t),s.isRenderingOperation=!0}let n=!e&&t===this.#o._pendingBBoxIdx;return this.#o.recordOperation(t,e,[this.#n,this.#o._savesStack,this.#o._markedContentStack]),n&&this.#n.clear(),this}recordShowTextOperation(t,e=!1){let n=Array.from(this.#n);this.recordOperation(t,e),this.recordIncrementalData("sameLineText",t);for(let s of n)this.recordIncrementalData("sameLineText",s);return this}bboxToClipBoxDropOperation(t,e=!1){let n=!e&&t===this.#o._pendingBBoxIdx;return this.#o.bboxToClipBoxDropOperation(t),n&&this.#n.clear(),this}take(){return this.#s.clear(),this.#o.take()}takeDebugMetadata(){return this.#r}},yr=class i{#t;#e;#i;#n=0;#s=0;constructor(t,e,n){if(t instanceof i&&t.#i===!!n)return t;this.#t=t,this.#e=e,this.#i=!!n}get clipBox(){return this.#t.clipBox}growOperationsCount(){throw new Error("Unreachable")}save(t){return this.#s++,this.#t.save(this.#e),this}restore(t){return this.#s>0&&(this.#t.restore(this.#e),this.#s--),this}recordOpenMarker(t){return this.#n++,this}getOpenMarker(){return this.#n>0?this.#e:this.#t.getOpenMarker()}recordCloseMarker(t){return this.#n--,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,n){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,n,s,a,r){return this.#i||this.#t.recordClipBox(this.#e,e,n,s,a,r),this}recordBBox(t,e,n,s,a,r){return this.#i||this.#t.recordBBox(this.#e,e,n,s,a,r),this}recordCharacterBBox(t,e,n,s,a,r,o){return this.#i||this.#t.recordCharacterBBox(this.#e,e,n,s,a,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")}},ze={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"]},yd=class i{#t;#e;#i=4;#n=0;#s=new i.#r(this.#i*6);static#r=J.isFloat16ArraySupported?Float16Array:Float32Array;constructor(t){this.#t=t.width,this.#e=t.height}record(t,e,n,s){if(this.#n===this.#i){this.#i*=2;let o=new i.#r(this.#i*6);o.set(this.#s),this.#s=o}let a=ut(t),r;if(s[0]!==1/0){let o=Ti.slice();M.axialAlignedBoundingBox([0,-n,e,0],a,o);let l=M.intersect(s,o);if(!l)return;let[c,u,h,d]=l;if(c!==o[0]||u!==o[1]||h!==o[2]||d!==o[3]){let f=Math.atan2(a[1],a[0]),m=Math.abs(Math.sin(f)),y=Math.abs(Math.cos(f));if(m<1e-6||y<1e-6||Math.abs(m-y)<1e-6)r=[c,u,c,d,h,u];else{let v=h-c,p=d-u,g=m*m,b=y*y,A=y*m,S=b-g,E=(p*b-v*A)/S,T=(p*A-v*g)/S;r=[c+T,u,c,u+E,h,d-E]}}}r||(r=[0,-n,0,0,e,-n],M.applyTransform(r,a,0),M.applyTransform(r,a,2),M.applyTransform(r,a,4)),r[0]/=this.#t,r[1]/=this.#e,r[2]/=this.#t,r[3]/=this.#e,r[4]/=this.#t,r[5]/=this.#e,this.#s.set(r,this.#n*6),this.#n++}take(){return this.#s.subarray(0,this.#n*6)}},bd=class{#t=new Set;#e=null;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){let e=this.#i();e.insertRule(t,e.cssRules.length)}#i(){if(this.#e)return this.#e;let t=this._document.defaultView?.CSSStyleSheet||globalThis.CSSStyleSheet;if(!this.styleElement&&t){let{adoptedStyleSheets:e}=this._document;if(e){let n=new t;return e.push(n),this.#e=n}}return this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement)),this.#e=this.styleElement.sheet}clear(){for(let t of this.nativeFontFaces)this._document.fonts.delete(t);if(this.nativeFontFaces.clear(),this.#t.clear(),this.#e){let{adoptedStyleSheets:t}=this._document;t?.includes(this.#e)&&(this._document.adoptedStyleSheets=t.filter(e=>e!==this.#e)),this.#e=null}this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:n}){if(!(!t||this.#t.has(t.loadedName))){if(Et(!e,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:s,src:a,style:r}=t,o=new FontFace(s,a,r);this.addNativeFontFace(o);try{await o.load(),this.#t.add(s),n?.(t)}catch{I(`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 n=t.createNativeFontFace();if(n){this.addNativeFontFace(n);try{await n.loaded}catch(s){throw I(`Failed to load font '${n.family}': '${s}'.`),t.disableFontFace=!0,s}}return}let e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(n=>{let s=this._queueLoadingCallback(n);this._prepareFontLoadEvent(t,s)})}}get isFontLoadingAPISupported(){let t=!!this._document?.fonts;return B(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){return B(this,"isSyncFontLoadingSupported",Se||J.platform.isFirefox)}_queueLoadingCallback(t){function e(){for(Et(!s.done,"completeRequest() cannot be called twice."),s.done=!0;n.length>0&&n[0].done;){let a=n.shift();setTimeout(a.callback,0)}}let{loadingRequests:n}=this,s={done:!1,complete:e,callback:t};return n.push(s),s}get _loadTestFont(){let t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return B(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function n(S,E){return S.charCodeAt(E)<<24|S.charCodeAt(E+1)<<16|S.charCodeAt(E+2)<<8|S.charCodeAt(E+3)&255}function s(S){return String.fromCharCode(S>>24&255,S>>16&255,S>>8&255,S&255)}function a(S,E,T,w){let _=S.substring(0,E),C=S.substring(E+T);return _+w+C}let r,o,l=this._document.createElement("canvas");l.width=1,l.height=1;let c=l.getContext("2d"),u=0;function h(S,E){if(++u>30){I("Load test font never loaded."),E();return}if(c.font="30px "+S,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){E();return}setTimeout(h.bind(null,S,E))}let d=`lt${Date.now()}${this.loadTestFontId++}`,f=this._loadTestFont;f=a(f,976,d.length,d);let y=16,v=1482184792,p=n(f,y);for(r=0,o=d.length-3;r<o;r+=4)p=p-v+n(d,r)|0;r<d.length&&(p=p-v+n(d+"XXX",r)|0),f=a(f,y,4,s(p));let g=`url(data:font/opentype;base64,${btoa(f)});`,b=`@font-face {font-family:"${d}";src:${g}}`;this.insertRule(b);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 S of[t.loadedName,d]){let E=this._document.createElement("span");E.textContent="Hi",E.style.fontFamily=S,A.append(E)}this._document.body.append(A),h(d,()=>{A.remove(),e.complete()})}},vd=class{compiledGlyphs=Object.create(null);#t;constructor(t,e=null,n,s){this.#t=t,this._inspectFont=e,n&&(this.charProcOperatorList=n),s&&Object.assign(this,s)}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,${this.data.toBase64()});`,e;if(!this.cssFontInfo)e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let n=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(n+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${n}src:${t}}`}return this._inspectFont?.(this,t),e}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];let n=this.loadedName+"_path_"+e,s;try{s=t.get(n)}catch(r){I(`getPathGenerator - ignoring character: "${r}".`)}let a=Sb(s?.path);return this.fontExtraProperties||t.delete(n),this.compiledGlyphs[e]=a}get black(){return this.#t.black}get bold(){return this.#t.bold}get disableFontFace(){return this.#t.disableFontFace}set disableFontFace(t){B(this,"disableFontFace",!!t)}get fontExtraProperties(){return this.#t.fontExtraProperties}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}},Ad=class{static strings=["fontFamily","fontWeight","italicAngle"]},Sd=class{static strings=["css","loadedName","baseFontName","src"]},be=class{static bools=["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"];static numbers=["ascent","defaultWidth","descent"];static strings=["fallbackName","loadedName","mimetype","name"];static OFFSET_NUMBERS=Math.ceil(this.bools.length*2/8);static OFFSET_BBOX=this.OFFSET_NUMBERS+this.numbers.length*8;static OFFSET_FONT_MATRIX=this.OFFSET_BBOX+1+8;static OFFSET_DEFAULT_VMETRICS=this.OFFSET_FONT_MATRIX+1+48;static OFFSET_STRINGS=this.OFFSET_DEFAULT_VMETRICS+1+6},Ai=class{static KIND=0;static HAS_BBOX=1;static HAS_BACKGROUND=2;static SHADING_TYPE=3;static N_COORD=4;static N_COLOR=8;static N_STOP=12;static N_FIGURES=16},Ed=class{#t;#e=new TextDecoder;#i;constructor(t){this.#t=t,this.#i=new DataView(t)}#n(t){Et(t<Ad.strings.length,"Invalid string index");let e=0;for(let s=0;s<t;s++)e+=this.#i.getUint32(e)+4;let n=this.#i.getUint32(e);return this.#e.decode(new Uint8Array(this.#t,e+4,n))}get fontFamily(){return this.#n(0)}get fontWeight(){return this.#n(1)}get italicAngle(){return this.#n(2)}},Td=class{#t;#e=new TextDecoder;#i;constructor(t){this.#t=t,this.#i=new DataView(t)}get guessFallback(){return this.#i.getUint8(0)!==0}#n(t){Et(t<Sd.strings.length,"Invalid string index");let e=5;for(let s=0;s<t;s++)e+=this.#i.getUint32(e)+4;let n=this.#i.getUint32(e);return this.#e.decode(new Uint8Array(this.#t,e+4,n))}get css(){return this.#n(0)}get loadedName(){return this.#n(1)}get baseFontName(){return this.#n(2)}get src(){return this.#n(3)}get style(){let t=1;t+=4+this.#i.getUint32(t);let e=this.#i.getUint32(t),n=this.#e.decode(new Uint8Array(this.#t,t+4,e));t+=4+e;let s=this.#i.getUint32(t),a=this.#e.decode(new Uint8Array(this.#t,t+4,s));return{style:n,weight:a}}},wd=class{#t;#e=new TextDecoder;#i;constructor({buffer:t,extra:e}){this.#t=t,this.#i=new DataView(t),e&&Object.assign(this,e)}#n(t){Et(t<be.bools.length,"Invalid boolean index");let e=Math.floor(t/4),n=t*2%8,s=this.#i.getUint8(e)>>n&3;return s===0?void 0:s===2}get black(){return this.#n(0)}get bold(){return this.#n(1)}get disableFontFace(){return this.#n(2)}get fontExtraProperties(){return this.#n(3)}get isInvalidPDFjsFont(){return this.#n(4)}get isType3Font(){return this.#n(5)}get italic(){return this.#n(6)}get missingFile(){return this.#n(7)}get remeasure(){return this.#n(8)}get vertical(){return this.#n(9)}#s(t){return Et(t<be.numbers.length,"Invalid number index"),this.#i.getFloat64(be.OFFSET_NUMBERS+t*8)}get ascent(){return this.#s(0)}get defaultWidth(){return this.#s(1)}get descent(){return this.#s(2)}#r(t,e,n,s){let a=this.#i.getUint8(t);if(a===0)return;Et(a===e,"Invalid array length."),t+=1;let r=new Array(a);for(let o=0;o<a;o++)r[o]=this.#i[n](t,!0),t+=s;return r}get bbox(){return this.#r(be.OFFSET_BBOX,4,"getInt16",2)}get fontMatrix(){return this.#r(be.OFFSET_FONT_MATRIX,6,"getFloat64",8)}get defaultVMetrics(){return this.#r(be.OFFSET_DEFAULT_VMETRICS,3,"getInt16",2)}#a(t){Et(t<be.strings.length,"Invalid string index");let e=be.OFFSET_STRINGS+4;for(let s=0;s<t;s++)e+=this.#i.getUint32(e)+4;let n=this.#i.getUint32(e);return this.#e.decode(new Uint8Array(this.#t,e+4,n))}get fallbackName(){return this.#a(0)}get loadedName(){return this.#a(1)}get mimetype(){return this.#a(2)}get name(){return this.#a(3)}#o(){let t=be.OFFSET_STRINGS,e=this.#i.getUint32(t);t+=4+e;let n=this.#i.getUint32(t);t+=4+n;let s=this.#i.getUint32(t);t+=4+s;let a=this.#i.getUint32(t);return{offset:t,length:a}}get data(){let{offset:t,length:e}=this.#o();return e===0?void 0:new Uint8Array(this.#t,t+4,e)}clearData(){let{offset:t,length:e}=this.#o();e!==0&&(this.#i.setUint32(t,0),this.#t=new Uint8Array(this.#t,0,t+4).slice().buffer,this.#i=new DataView(this.#t))}get cssFontInfo(){let t=be.OFFSET_STRINGS,e=this.#i.getUint32(t);t+=4+e;let n=this.#i.getUint32(t);t+=4+n;let s=this.#i.getUint32(t);if(s===0)return null;let a=new Uint8Array(s);return a.set(new Uint8Array(this.#t,t+4,s)),new Ed(a.buffer)}get systemFontInfo(){let t=be.OFFSET_STRINGS,e=this.#i.getUint32(t);t+=4+e;let n=this.#i.getUint32(t);if(n===0)return null;let s=new Uint8Array(n);return s.set(new Uint8Array(this.#t,t+4,n)),new Td(s.buffer)}},_d=class{constructor(t){this.buffer=t,this.view=new DataView(t),this.data=new Uint8Array(t)}getIR(){let t=this.view,e=this.data[Ai.KIND],n=!!this.data[Ai.HAS_BBOX],s=!!this.data[Ai.HAS_BACKGROUND],a=t.getUint32(Ai.N_COORD,!0),r=t.getUint32(Ai.N_COLOR,!0),o=t.getUint32(Ai.N_STOP,!0),l=20,c=new Float32Array(this.buffer,l,a*2);l+=a*8;let u=new Uint8Array(this.buffer,l,r*4);l+=r*4;let h=[];for(let m=0;m<o;++m){let y=t.getFloat32(l,!0);l+=4;let v=t.getUint32(l,!0);l+=4,h.push([y,`#${v.toString(16).padStart(6,"0")}`])}let d=null;if(n){d=[];for(let m=0;m<4;++m)d.push(t.getFloat32(l,!0)),l+=4}let f=null;if(s&&(f=new Uint8Array(this.buffer,l,3),l+=3),e===1)return["RadialAxial","axial",d,h,Array.from(c.slice(0,2)),Array.from(c.slice(2,4)),null,null];if(e===2)return["RadialAxial","radial",d,h,[c[0],c[1]],[c[3],c[4]],c[2],c[5]];if(e===3){let m=this.data[Ai.SHADING_TYPE],y=null;if(c.length>0){y=Ti.slice();for(let v=0,p=c.length;v<p;v+=2)M.pointBoundingBox(c[v],c[v+1],y)}return["Mesh",m,c,u,a,y,d,f]}throw new Error(`Unsupported pattern kind: ${e}`)}},xd=class{#t;constructor(t){this.#t=t}get path(){return J.isFloat16ArraySupported?new Float16Array(this.#t):new Float32Array(this.#t)}};Cd=i=>typeof i=="object"&&Number.isInteger(i?.num)&&i.num>=0&&Number.isInteger(i?.gen)&&i.gen>=0,cS=i=>typeof i=="object"&&typeof i?.name=="string",Tb=nS.bind(null,Cd,cS),Md=class{#t=new Map;#e=Promise.resolve();postMessage(t,e){let n={data:structuredClone(t,e?{transfer:e}:null)};this.#e.then(()=>{for(let[s]of this.#t)s.call(this,n)})}addEventListener(t,e,n=null){let s=null;if(n?.signal instanceof AbortSignal){let{signal:a}=n;if(a.aborted){I("LoopbackPort - cannot use an `aborted` signal.");return}let r=()=>this.removeEventListener(t,e);s=()=>a.removeEventListener("abort",r),a.addEventListener("abort",r)}this.#t.set(e,s)}removeEventListener(t,e){this.#t.get(e)?.(),this.#t.delete(e)}terminate(){for(let[,t]of this.#t)t?.();this.#t.clear()}},ul={DATA:1,ERROR:2},Nt={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};Rn=class{#t=new AbortController;constructor(t,e,n){this.sourceName=t,this.targetName=e,this.comObj=n,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),n.addEventListener("message",this.#e.bind(this),{signal:this.#t.signal})}#e({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){this.#n(t);return}if(t.callback){let n=t.callbackId,s=this.callbackCapabilities[n];if(!s)throw new Error(`Cannot resolve callback ${n}`);if(delete this.callbackCapabilities[n],t.callback===ul.DATA)s.resolve(t.data);else if(t.callback===ul.ERROR)s.reject(re(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 n=this.sourceName,s=t.sourceName,a=this.comObj;Promise.try(e,t.data).then(function(r){a.postMessage({sourceName:n,targetName:s,callback:ul.DATA,callbackId:t.callbackId,data:r})},function(r){a.postMessage({sourceName:n,targetName:s,callback:ul.ERROR,callbackId:t.callbackId,reason:re(r)})});return}if(t.streamId){this.#i(t);return}e(t.data)}on(t,e){let n=this.actionHandler;if(n[t])throw new Error(`There is already an actionName called "${t}"`);n[t]=e}send(t,e,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},n)}sendWithPromise(t,e,n){let s=this.callbackId++,a=Promise.withResolvers();this.callbackCapabilities[s]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:s,data:e},n)}catch(r){a.reject(r)}return a.promise}sendWithStream(t,e,n,s){let a=this.streamId++,r=this.sourceName,o=this.targetName,l=this.comObj;return new ReadableStream({start:c=>{let u=Promise.withResolvers();return this.streamControllers[a]={controller:c,startCall:u,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:r,targetName:o,action:t,streamId:a,data:e,desiredSize:c.desiredSize},s),u.promise},pull:c=>{let u=Promise.withResolvers();return this.streamControllers[a].pullCall=u,l.postMessage({sourceName:r,targetName:o,stream:Nt.PULL,streamId:a,desiredSize:c.desiredSize}),u.promise},cancel:c=>{Et(c instanceof Error,"cancel must have a valid reason");let u=Promise.withResolvers();return this.streamControllers[a].cancelCall=u,this.streamControllers[a].isClosed=!0,l.postMessage({sourceName:r,targetName:o,stream:Nt.CANCEL,streamId:a,reason:re(c)}),u.promise}},n)}#i(t){let e=t.streamId,n=this.sourceName,s=t.sourceName,a=this.comObj,r=this,o=this.actionHandler[t.action],l={enqueue(c,u=1,h){if(this.isCancelled)return;let d=this.desiredSize;this.desiredSize-=u,d>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),a.postMessage({sourceName:n,targetName:s,stream:Nt.ENQUEUE,streamId:e,chunk:c},h)},close(){this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:n,targetName:s,stream:Nt.CLOSE,streamId:e}),delete r.streamSinks[e])},error(c){Et(c instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,a.postMessage({sourceName:n,targetName:s,stream:Nt.ERROR,streamId:e,reason:re(c)}))},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(){a.postMessage({sourceName:n,targetName:s,stream:Nt.START_COMPLETE,streamId:e,success:!0})},function(c){a.postMessage({sourceName:n,targetName:s,stream:Nt.START_COMPLETE,streamId:e,reason:re(c)})})}#n(t){let e=t.streamId,n=this.sourceName,s=t.sourceName,a=this.comObj,r=this.streamControllers[e],o=this.streamSinks[e];switch(t.stream){case Nt.START_COMPLETE:t.success?r.startCall.resolve():r.startCall.reject(re(t.reason));break;case Nt.PULL_COMPLETE:t.success?r.pullCall.resolve():r.pullCall.reject(re(t.reason));break;case Nt.PULL:if(!o){a.postMessage({sourceName:n,targetName:s,stream:Nt.PULL_COMPLETE,streamId:e,success:!0});break}o.desiredSize<=0&&t.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=t.desiredSize,Promise.try(o.onPull||tb).then(function(){a.postMessage({sourceName:n,targetName:s,stream:Nt.PULL_COMPLETE,streamId:e,success:!0})},function(c){a.postMessage({sourceName:n,targetName:s,stream:Nt.PULL_COMPLETE,streamId:e,reason:re(c)})});break;case Nt.ENQUEUE:if(Et(r,"enqueue should have stream controller"),r.isClosed)break;r.controller.enqueue(t.chunk);break;case Nt.CLOSE:if(Et(r,"close should have stream controller"),r.isClosed)break;r.isClosed=!0,r.controller.close(),this.#s(r,e);break;case Nt.ERROR:Et(r,"error should have stream controller"),r.controller.error(re(t.reason)),this.#s(r,e);break;case Nt.CANCEL_COMPLETE:t.success?r.cancelCall.resolve():r.cancelCall.reject(re(t.reason)),this.#s(r,e);break;case Nt.CANCEL:if(!o)break;let l=re(t.reason);Promise.try(o.onCancel||tb,l).then(function(){a.postMessage({sourceName:n,targetName:s,stream:Nt.CANCEL_COMPLETE,streamId:e,success:!0})},function(c){a.postMessage({sourceName:n,targetName:s,stream:Nt.CANCEL_COMPLETE,streamId:e,reason:re(c)})}),o.sinkCapability.reject(l),o.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async#s(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}},_l=class{#t=Object.freeze({cMapUrl:"CMap",standardFontDataUrl:"font",wasmUrl:"wasm"});constructor({cMapUrl:t=null,standardFontDataUrl:e=null,wasmUrl:n=null}){this.cMapUrl=t,this.standardFontDataUrl=e,this.wasmUrl=n}async fetch({kind:t,filename:e}){switch(t){case"cMapUrl":case"standardFontDataUrl":case"wasmUrl":break;default:Q(`Not implemented: ${t}`)}let n=this[t];if(!n)throw new Error(`Ensure that the \`${t}\` API parameter is provided.`);let s=`${n}${e}`;return this._fetch(s,t).catch(a=>{throw new Error(`Unable to load ${this.#t[t]} data at: ${s}`)})}async _fetch(t,e){Q("Abstract method `_fetch` called.")}},xl=class extends _l{async _fetch(t,e){let n=e==="cMapUrl"&&!t.endsWith(".bcmap")?"text":"bytes",s=await Zl(t,n);return s instanceof Uint8Array?s:Ql(s)}},Cl=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 n=this._createCanvas(t,e);return{canvas:n,context:n.getContext("2d",{willReadFrequently:!this.#t})}}reset({canvas:t},e,n){if(!t)throw new Error("Canvas is not specified");if(e<=0||n<=0)throw new Error("Invalid canvas size");t.width=e,t.height=n}destroy(t){let{canvas:e}=t;if(!e)throw new Error("Canvas is not specified");e.width=e.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){Q("Abstract method `_createCanvas` called.")}},Dd=class extends Cl{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){let n=this._document.createElement("canvas");return n.width=t,n.height=e,n}},Ml=class{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addKnockoutFilter(t=0){return"none"}addHighlightHCMFilter(t,e,n,s,a){return"none"}addSelectionHCMFilter(t,e){return"none"}addSelectionFilter(){return"none"}createSelectionStyle(t=null){return null}destroy(t=!1){}},Od=class extends Ml{#t;#e;#i;#n;#s;#r;#a=0;constructor({docId:t,ownerDocument:e=globalThis.document}){super(),this.#n=t,this.#s=e}get#o(){return this.#e||=new Map}get#c(){return this.#r||=new Map}get#l(){if(!this.#i){let t=this.#s.createElement("div"),{style:e}=t;e.colorScheme="only light",e.visibility="hidden",e.contain="strict",e.width=e.height=0,e.position="absolute",e.top=e.left=0,e.zIndex=-1;let n=this.#s.createElementNS(ve,"svg");n.setAttribute("width",0),n.setAttribute("height",0),this.#i=this.#s.createElementNS(ve,"defs"),t.append(n),n.append(this.#i),this.#s.body.append(t)}return this.#i}#d(t){if(t.length===1){let l=t[0],c=new Array(256);for(let h=0;h<256;h++)c[h]=l[h]/255;let u=c.join(",");return[u,u,u]}let[e,n,s]=t,a=new Array(256),r=new Array(256),o=new Array(256);for(let l=0;l<256;l++)a[l]=e[l]/255,r[l]=n[l]/255,o[l]=s[l]/255;return[a.join(","),r.join(","),o.join(",")]}#h(t){if(this.#t===void 0){this.#t="";let e=this.#s.URL;e!==this.#s.baseURI&&(Mr(e)?I('#createUrl: ignore "data:"-URL for performance reasons.'):this.#t=zf(e,""))}return`url(${this.#t}#${t})`}addFilter(t){if(!t)return"none";let e=this.#o.get(t);if(e)return e;let[n,s,a]=this.#d(t),r=t.length===1?n:`${n}${s}${a}`;if(e=this.#o.get(r),e)return this.#o.set(t,e),e;let o=`g_${this.#n}_transfer_map_${this.#a++}`,l=this.#h(o);this.#o.set(t,l),this.#o.set(r,l);let c=this.#g(o);return this.#f(n,s,a,c),l}addHCMFilter(t,e){let n=`${t}-${e}`,s="base",a=this.#c.get(s);if(a?.key===n||(a?(a.filter?.remove(),a.key=n,a.url="none",a.filter=null):(a={key:n,url:"none",filter:null},this.#c.set(s,a)),!t||!e))return a.url;let r=this.#v(t);t=M.makeHexColor(...r);let o=this.#v(e);if(e=M.makeHexColor(...o),this.#l.style.color="",t==="#000000"&&e==="#ffffff"||t===e)return a.url;let l=new Array(256);for(let f=0;f<=255;f++){let m=f/255;l[f]=m<=.03928?m/12.92:((m+.055)/1.055)**2.4}let c=l.join(","),u=`g_${this.#n}_hcm_filter`,h=a.filter=this.#g(u);this.#f(c,c,c,h),this.#m(h);let d=(f,m)=>{let y=r[f]/255,v=o[f]/255,p=new Array(m+1);for(let g=0;g<=m;g++)p[g]=y+g/m*(v-y);return p.join(",")};return this.#f(d(0,5),d(1,5),d(2,5),h),a.url=this.#h(u),a.url}addSelectionHCMFilter(t,e){return this.addHighlightHCMFilter("selection",t,e,"HighlightText","Highlight")}addSelectionFilter(){return this.addHighlightHCMFilter("selection_default","black","white","HighlightText","Highlight")}createSelectionStyle(t=null){let e=t?this.addSelectionHCMFilter(t.foreground,t.background):this.addSelectionFilter();return e==="none"||!J.platform.isFirefox?null:{"backdrop-filter":e,"background-color":"transparent"}}addAlphaFilter(t){let e=this.#o.get(t);if(e)return e;let[n]=this.#d([t]),s=`alpha_${n}`;if(e=this.#o.get(s),e)return this.#o.set(t,e),e;let a=`g_${this.#n}_alpha_map_${this.#a++}`,r=this.#h(a);this.#o.set(t,r),this.#o.set(s,r);let o=this.#g(a);return this.#b(n,o),r}addLuminosityFilter(t){let e=this.#o.get(t||"luminosity");if(e)return e;let n,s;if(t?([n]=this.#d([t]),s=`luminosity_${n}`):s="luminosity",e=this.#o.get(s),e)return this.#o.set(t,e),e;let a=`g_${this.#n}_luminosity_map_${this.#a++}`,r=this.#h(a);this.#o.set(t,r),this.#o.set(s,r);let o=this.#g(a);return this.#p(o),t&&this.#b(n,o),r}addKnockoutFilter(t=0){let e=t>0?Math.min(1/t,1e6):1e6,n=`knockout_${e}`,s=this.#o.get(n);if(s)return s;let a=`g_${this.#n}_knockout_filter_${this.#a++}`,r=this.#h(a);this.#o.set(n,r);let o=this.#g(a),l=this.#s.createElementNS(ve,"feComponentTransfer");o.append(l);let c=this.#s.createElementNS(ve,"feFuncA");return c.setAttribute("type","linear"),c.setAttribute("slope",`${e}`),c.setAttribute("intercept","0"),l.append(c),r}addHighlightHCMFilter(t,e,n,s,a){let r=`${e}-${n}-${s}-${a}`,o=this.#c.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.#c.set(t,o)),!e||!n))return o.url;let[l,c]=[e,n].map(this.#v.bind(this)),u=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),h=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[d,f]=[s,a].map(this.#T.bind(this));h<u&&([u,h,d,f]=[h,u,f,d]),this.#l.style.color="";let m=(p,g,b)=>{let A=new Array(256),S=(h-u)/b,E=p/255,T=(g-p)/(255*b),w=0;for(let _=0;_<=b;_++){let C=Math.round(u+_*S),D=E+_*T;for(let N=w;N<=C;N++)A[N]=D;w=C+1}for(let _=w;_<256;_++)A[_]=A[w-1];return A.join(",")},y=`g_${this.#n}_hcm_${t}_filter`,v=o.filter=this.#g(y);return this.#m(v),this.#f(m(d[0],f[0],5),m(d[1],f[1],5),m(d[2],f[2],5),v),o.url=this.#h(y),o.url}destroy(t=!1){t&&this.#r?.size||(this.#i?.parentNode.parentNode.remove(),this.#i=null,this.#e?.clear(),this.#e=null,this.#r?.clear(),this.#r=null,this.#a=0)}#p(t){let e=this.#s.createElementNS(ve,"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.#s.createElementNS(ve,"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)}#g(t){let e=this.#s.createElementNS(ve,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),this.#l.append(e),e}#u(t,e,n){let s=this.#s.createElementNS(ve,e);s.setAttribute("type","discrete"),s.setAttribute("tableValues",n),t.append(s)}#f(t,e,n,s){let a=this.#s.createElementNS(ve,"feComponentTransfer");s.append(a),this.#u(a,"feFuncR",t),this.#u(a,"feFuncG",e),this.#u(a,"feFuncB",n)}#b(t,e){let n=this.#s.createElementNS(ve,"feComponentTransfer");e.append(n),this.#u(n,"feFuncA",t)}#v(t){return this.#l.style.color=t,Ks(getComputedStyle(this.#l).getPropertyValue("color"))}#y(t){return this.#l.style.color=t,qs(getComputedStyle(this.#l).getPropertyValue("color"))}#T(t){let[e,n,s,a]=this.#y(t);if(a===1)return[e,n,s];let[r,o,l]=this.#v("Canvas");return[Zh(e,r,a),Zh(n,o,a),Zh(s,l,a)]}};Se&&I("Please use the `legacy` build in Node.js environments.");Rd=class extends Ml{},Nd=class extends Cl{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire(kS.url)("@napi-rs/canvas").createCanvas(t,e)}},Ld=class extends _l{async _fetch(t,e){return uS(t)}};dS=`
8
+ `+n.stack}}var cu=Object.prototype.hasOwnProperty,Ju=zt.unstable_scheduleCallback,xc=zt.unstable_cancelCallback,_v=zt.unstable_shouldYield,xv=zt.unstable_requestPaint,fe=zt.unstable_now,Cv=zt.unstable_getCurrentPriorityLevel,Yg=zt.unstable_ImmediatePriority,qg=zt.unstable_UserBlockingPriority,bo=zt.unstable_NormalPriority,Mv=zt.unstable_LowPriority,Kg=zt.unstable_IdlePriority,Dv=zt.log,Ov=zt.unstable_setDisableYieldValue,ja=null,pe=null;function zi(i){if(typeof Dv=="function"&&Ov(i),pe&&typeof pe.setStrictMode=="function")try{pe.setStrictMode(ja,i)}catch{}}var ge=Math.clz32?Math.clz32:kv,Rv=Math.log,Nv=Math.LN2;function kv(i){return i>>>=0,i===0?32:31-(Rv(i)/Nv|0)|0}var zr=256,Pr=262144,Ir=4194304;function cn(i){var t=i&42;if(t!==0)return t;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Vo(i,t,e){var n=i.pendingLanes;if(n===0)return 0;var s=0,a=i.suspendedLanes,r=i.pingedLanes;i=i.warmLanes;var o=n&134217727;return o!==0?(n=o&~a,n!==0?s=cn(n):(r&=o,r!==0?s=cn(r):e||(e=o&~i,e!==0&&(s=cn(e))))):(o=n&~a,o!==0?s=cn(o):r!==0?s=cn(r):e||(e=n&~i,e!==0&&(s=cn(e)))),s===0?0:t!==0&&t!==s&&(t&a)===0&&(a=s&-s,e=t&-t,a>=e||a===32&&(e&4194048)!==0)?t:s}function Va(i,t){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&t)===0}function Lv(i,t){switch(i){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Wg(){var i=Ir;return Ir<<=1,(Ir&62914560)===0&&(Ir=4194304),i}function Cc(i){for(var t=[],e=0;31>e;e++)t.push(i);return t}function Xa(i,t){i.pendingLanes|=t,t!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Bv(i,t,e,n,s,a){var r=i.pendingLanes;i.pendingLanes=e,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=e,i.entangledLanes&=e,i.errorRecoveryDisabledLanes&=e,i.shellSuspendCounter=0;var o=i.entanglements,l=i.expirationTimes,c=i.hiddenUpdates;for(e=r&~e;0<e;){var u=31-ge(e),h=1<<u;o[u]=0,l[u]=-1;var d=c[u];if(d!==null)for(c[u]=null,u=0;u<d.length;u++){var f=d[u];f!==null&&(f.lane&=-536870913)}e&=~h}n!==0&&Qg(i,n,0),a!==0&&s===0&&i.tag!==0&&(i.suspendedLanes|=a&~(r&~t))}function Qg(i,t,e){i.pendingLanes|=t,i.suspendedLanes&=~t;var n=31-ge(t);i.entangledLanes|=t,i.entanglements[n]=i.entanglements[n]|1073741824|e&261930}function $g(i,t){var e=i.entangledLanes|=t;for(i=i.entanglements;e;){var n=31-ge(e),s=1<<n;s&t|i[n]&t&&(i[n]|=t),e&=~s}}function Zg(i,t){var e=t&-t;return e=(e&42)!==0?1:th(e),(e&(i.suspendedLanes|t))!==0?0:e}function th(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function eh(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function Jg(){var i=Z.p;return i!==0?i:(i=window.event,i===void 0?32:Ey(i.type))}function bp(i,t){var e=Z.p;try{return Z.p=i,t()}finally{Z.p=e}}var tn=Math.random().toString(36).slice(2),Gt="__reactFiber$"+tn,ae="__reactProps$"+tn,ws="__reactContainer$"+tn,uu="__reactEvents$"+tn,zv="__reactListeners$"+tn,Pv="__reactHandles$"+tn,vp="__reactResources$"+tn,Ya="__reactMarker$"+tn;function ih(i){delete i[Gt],delete i[ae],delete i[uu],delete i[zv],delete i[Pv]}function Qn(i){var t=i[Gt];if(t)return t;for(var e=i.parentNode;e;){if(t=e[ws]||e[Gt]){if(e=t.alternate,t.child!==null||e!==null&&e.child!==null)for(i=Cg(i);i!==null;){if(e=i[Gt])return e;i=Cg(i)}return t}i=e,e=i.parentNode}return null}function _s(i){if(i=i[Gt]||i[ws]){var t=i.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return i}return null}function da(i){var t=i.tag;if(t===5||t===26||t===27||t===6)return i.stateNode;throw Error(x(33))}function rs(i){var t=i[vp];return t||(t=i[vp]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ft(i){i[Ya]=!0}var tm=new Set,em={};function En(i,t){ps(i,t),ps(i+"Capture",t)}function ps(i,t){for(em[i]=t,i=0;i<t.length;i++)tm.add(t[i])}var Iv=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Ap={},Sp={};function Fv(i){return cu.call(Sp,i)?!0:cu.call(Ap,i)?!1:Iv.test(i)?Sp[i]=!0:(Ap[i]=!0,!1)}function Jr(i,t,e){if(Fv(t))if(e===null)i.removeAttribute(t);else{switch(typeof e){case"undefined":case"function":case"symbol":i.removeAttribute(t);return;case"boolean":var n=t.toLowerCase().slice(0,5);if(n!=="data-"&&n!=="aria-"){i.removeAttribute(t);return}}i.setAttribute(t,""+e)}}function Fr(i,t,e){if(e===null)i.removeAttribute(t);else{switch(typeof e){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(t);return}i.setAttribute(t,""+e)}}function ei(i,t,e,n){if(n===null)i.removeAttribute(e);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(e);return}i.setAttributeNS(t,e,""+n)}}function xe(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function im(i){var t=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Hv(i,t,e){var n=Object.getOwnPropertyDescriptor(i.constructor.prototype,t);if(!i.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,a=n.set;return Object.defineProperty(i,t,{configurable:!0,get:function(){return s.call(this)},set:function(r){e=""+r,a.call(this,r)}}),Object.defineProperty(i,t,{enumerable:n.enumerable}),{getValue:function(){return e},setValue:function(r){e=""+r},stopTracking:function(){i._valueTracker=null,delete i[t]}}}}function hu(i){if(!i._valueTracker){var t=im(i)?"checked":"value";i._valueTracker=Hv(i,t,""+i[t])}}function nm(i){if(!i)return!1;var t=i._valueTracker;if(!t)return!0;var e=t.getValue(),n="";return i&&(n=im(i)?i.checked?"true":"false":i.value),i=n,i!==e?(t.setValue(i),!0):!1}function vo(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var Uv=/[\n"\\]/g;function De(i){return i.replace(Uv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function du(i,t,e,n,s,a,r,o){i.name="",r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"?i.type=r:i.removeAttribute("type"),t!=null?r==="number"?(t===0&&i.value===""||i.value!=t)&&(i.value=""+xe(t)):i.value!==""+xe(t)&&(i.value=""+xe(t)):r!=="submit"&&r!=="reset"||i.removeAttribute("value"),t!=null?fu(i,r,xe(t)):e!=null?fu(i,r,xe(e)):n!=null&&i.removeAttribute("value"),s==null&&a!=null&&(i.defaultChecked=!!a),s!=null&&(i.checked=s&&typeof s!="function"&&typeof s!="symbol"),o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?i.name=""+xe(o):i.removeAttribute("name")}function sm(i,t,e,n,s,a,r,o){if(a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"&&(i.type=a),t!=null||e!=null){if(!(a!=="submit"&&a!=="reset"||t!=null)){hu(i);return}e=e!=null?""+xe(e):"",t=t!=null?""+xe(t):e,o||t===i.value||(i.value=t),i.defaultValue=t}n=n??s,n=typeof n!="function"&&typeof n!="symbol"&&!!n,i.checked=o?i.checked:!!n,i.defaultChecked=!!n,r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(i.name=r),hu(i)}function fu(i,t,e){t==="number"&&vo(i.ownerDocument)===i||i.defaultValue===""+e||(i.defaultValue=""+e)}function os(i,t,e,n){if(i=i.options,t){t={};for(var s=0;s<e.length;s++)t["$"+e[s]]=!0;for(e=0;e<i.length;e++)s=t.hasOwnProperty("$"+i[e].value),i[e].selected!==s&&(i[e].selected=s),s&&n&&(i[e].defaultSelected=!0)}else{for(e=""+xe(e),t=null,s=0;s<i.length;s++){if(i[s].value===e){i[s].selected=!0,n&&(i[s].defaultSelected=!0);return}t!==null||i[s].disabled||(t=i[s])}t!==null&&(t.selected=!0)}}function am(i,t,e){if(t!=null&&(t=""+xe(t),t!==i.value&&(i.value=t),e==null)){i.defaultValue!==t&&(i.defaultValue=t);return}i.defaultValue=e!=null?""+xe(e):""}function rm(i,t,e,n){if(t==null){if(n!=null){if(e!=null)throw Error(x(92));if(ha(n)){if(1<n.length)throw Error(x(93));n=n[0]}e=n}e==null&&(e=""),t=e}e=xe(t),i.defaultValue=e,n=i.textContent,n===e&&n!==""&&n!==null&&(i.value=n),hu(i)}function gs(i,t){if(t){var e=i.firstChild;if(e&&e===i.lastChild&&e.nodeType===3){e.nodeValue=t;return}}i.textContent=t}var Gv=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Ep(i,t,e){var n=t.indexOf("--")===0;e==null||typeof e=="boolean"||e===""?n?i.setProperty(t,""):t==="float"?i.cssFloat="":i[t]="":n?i.setProperty(t,e):typeof e!="number"||e===0||Gv.has(t)?t==="float"?i.cssFloat=e:i[t]=(""+e).trim():i[t]=e+"px"}function om(i,t,e){if(t!=null&&typeof t!="object")throw Error(x(62));if(i=i.style,e!=null){for(var n in e)!e.hasOwnProperty(n)||t!=null&&t.hasOwnProperty(n)||(n.indexOf("--")===0?i.setProperty(n,""):n==="float"?i.cssFloat="":i[n]="");for(var s in t)n=t[s],t.hasOwnProperty(s)&&e[s]!==n&&Ep(i,s,n)}else for(var a in t)t.hasOwnProperty(a)&&Ep(i,a,t[a])}function nh(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var jv=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Vv=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function to(i){return Vv.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function ci(){}var pu=null;function sh(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var $n=null,ls=null;function Tp(i){var t=_s(i);if(t&&(i=t.stateNode)){var e=i[ae]||null;t:switch(i=t.stateNode,t.type){case"input":if(du(i,e.value,e.defaultValue,e.defaultValue,e.checked,e.defaultChecked,e.type,e.name),t=e.name,e.type==="radio"&&t!=null){for(e=i;e.parentNode;)e=e.parentNode;for(e=e.querySelectorAll('input[name="'+De(""+t)+'"][type="radio"]'),t=0;t<e.length;t++){var n=e[t];if(n!==i&&n.form===i.form){var s=n[ae]||null;if(!s)throw Error(x(90));du(n,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name)}}for(t=0;t<e.length;t++)n=e[t],n.form===i.form&&nm(n)}break t;case"textarea":am(i,e.value,e.defaultValue);break t;case"select":t=e.value,t!=null&&os(i,!!e.multiple,t,!1)}}}var Mc=!1;function lm(i,t,e){if(Mc)return i(t,e);Mc=!0;try{var n=i(t);return n}finally{if(Mc=!1,($n!==null||ls!==null)&&(il(),$n&&(t=$n,i=ls,ls=$n=null,Tp(t),i)))for(t=0;t<i.length;t++)Tp(i[t])}}function Da(i,t){var e=i.stateNode;if(e===null)return null;var n=e[ae]||null;if(n===null)return null;e=n[t];t:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(i=i.type,n=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!n;break t;default:i=!1}if(i)return null;if(e&&typeof e!="function")throw Error(x(231,t,typeof e));return e}var pi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gu=!1;if(pi)try{jn={},Object.defineProperty(jn,"passive",{get:function(){gu=!0}}),window.addEventListener("test",jn,jn),window.removeEventListener("test",jn,jn)}catch{gu=!1}var jn,Pi=null,ah=null,eo=null;function cm(){if(eo)return eo;var i,t=ah,e=t.length,n,s="value"in Pi?Pi.value:Pi.textContent,a=s.length;for(i=0;i<e&&t[i]===s[i];i++);var r=e-i;for(n=1;n<=r&&t[e-n]===s[a-n];n++);return eo=s.slice(i,1<n?1-n:void 0)}function io(i){var t=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&t===13&&(i=13)):i=t,i===10&&(i=13),32<=i||i===13?i:0}function Hr(){return!0}function wp(){return!1}function re(i){function t(e,n,s,a,r){this._reactName=e,this._targetInst=s,this.type=n,this.nativeEvent=a,this.target=r,this.currentTarget=null;for(var o in i)i.hasOwnProperty(o)&&(e=i[o],this[o]=e?e(a):a[o]);return this.isDefaultPrevented=(a.defaultPrevented!=null?a.defaultPrevented:a.returnValue===!1)?Hr:wp,this.isPropagationStopped=wp,this}return gt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!="unknown"&&(e.returnValue=!1),this.isDefaultPrevented=Hr)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!="unknown"&&(e.cancelBubble=!0),this.isPropagationStopped=Hr)},persist:function(){},isPersistent:Hr}),t}var Tn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xo=re(Tn),qa=gt({},Tn,{view:0,detail:0}),Xv=re(qa),Dc,Oc,sa,Yo=gt({},qa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:rh,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==sa&&(sa&&i.type==="mousemove"?(Dc=i.screenX-sa.screenX,Oc=i.screenY-sa.screenY):Oc=Dc=0,sa=i),Dc)},movementY:function(i){return"movementY"in i?i.movementY:Oc}}),_p=re(Yo),Yv=gt({},Yo,{dataTransfer:0}),qv=re(Yv),Kv=gt({},qa,{relatedTarget:0}),Rc=re(Kv),Wv=gt({},Tn,{animationName:0,elapsedTime:0,pseudoElement:0}),Qv=re(Wv),$v=gt({},Tn,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),Zv=re($v),Jv=gt({},Tn,{data:0}),xp=re(Jv),tA={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},eA={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},iA={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function nA(i){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(i):(i=iA[i])?!!t[i]:!1}function rh(){return nA}var sA=gt({},qa,{key:function(i){if(i.key){var t=tA[i.key]||i.key;if(t!=="Unidentified")return t}return i.type==="keypress"?(i=io(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?eA[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:rh,charCode:function(i){return i.type==="keypress"?io(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?io(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),aA=re(sA),rA=gt({},Yo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Cp=re(rA),oA=gt({},qa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:rh}),lA=re(oA),cA=gt({},Tn,{propertyName:0,elapsedTime:0,pseudoElement:0}),uA=re(cA),hA=gt({},Yo,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),dA=re(hA),fA=gt({},Tn,{newState:0,oldState:0}),pA=re(fA),gA=[9,13,27,32],oh=pi&&"CompositionEvent"in window,ga=null;pi&&"documentMode"in document&&(ga=document.documentMode);var mA=pi&&"TextEvent"in window&&!ga,um=pi&&(!oh||ga&&8<ga&&11>=ga),Mp=" ",Dp=!1;function hm(i,t){switch(i){case"keyup":return gA.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dm(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Zn=!1;function yA(i,t){switch(i){case"compositionend":return dm(t);case"keypress":return t.which!==32?null:(Dp=!0,Mp);case"textInput":return i=t.data,i===Mp&&Dp?null:i;default:return null}}function bA(i,t){if(Zn)return i==="compositionend"||!oh&&hm(i,t)?(i=cm(),eo=ah=Pi=null,Zn=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return um&&t.locale!=="ko"?null:t.data;default:return null}}var vA={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Op(i){var t=i&&i.nodeName&&i.nodeName.toLowerCase();return t==="input"?!!vA[i.type]:t==="textarea"}function fm(i,t,e,n){$n?ls?ls.push(n):ls=[n]:$n=n,t=Po(t,"onChange"),0<t.length&&(e=new Xo("onChange","change",null,e,n),i.push({event:e,listeners:t}))}var ma=null,Oa=null;function AA(i){ly(i,0)}function qo(i){var t=da(i);if(nm(t))return i}function Rp(i,t){if(i==="change")return t}var pm=!1;pi&&(pi?(Gr="oninput"in document,Gr||(Nc=document.createElement("div"),Nc.setAttribute("oninput","return;"),Gr=typeof Nc.oninput=="function"),Ur=Gr):Ur=!1,pm=Ur&&(!document.documentMode||9<document.documentMode));var Ur,Gr,Nc;function Np(){ma&&(ma.detachEvent("onpropertychange",gm),Oa=ma=null)}function gm(i){if(i.propertyName==="value"&&qo(Oa)){var t=[];fm(t,Oa,i,sh(i)),lm(AA,t)}}function SA(i,t,e){i==="focusin"?(Np(),ma=t,Oa=e,ma.attachEvent("onpropertychange",gm)):i==="focusout"&&Np()}function EA(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return qo(Oa)}function TA(i,t){if(i==="click")return qo(t)}function wA(i,t){if(i==="input"||i==="change")return qo(t)}function _A(i,t){return i===t&&(i!==0||1/i===1/t)||i!==i&&t!==t}var ye=typeof Object.is=="function"?Object.is:_A;function Ra(i,t){if(ye(i,t))return!0;if(typeof i!="object"||i===null||typeof t!="object"||t===null)return!1;var e=Object.keys(i),n=Object.keys(t);if(e.length!==n.length)return!1;for(n=0;n<e.length;n++){var s=e[n];if(!cu.call(t,s)||!ye(i[s],t[s]))return!1}return!0}function kp(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Lp(i,t){var e=kp(i);i=0;for(var n;e;){if(e.nodeType===3){if(n=i+e.textContent.length,i<=t&&n>=t)return{node:e,offset:t-i};i=n}t:{for(;e;){if(e.nextSibling){e=e.nextSibling;break t}e=e.parentNode}e=void 0}e=kp(e)}}function mm(i,t){return i&&t?i===t?!0:i&&i.nodeType===3?!1:t&&t.nodeType===3?mm(i,t.parentNode):"contains"in i?i.contains(t):i.compareDocumentPosition?!!(i.compareDocumentPosition(t)&16):!1:!1}function ym(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var t=vo(i.document);t instanceof i.HTMLIFrameElement;){try{var e=typeof t.contentWindow.location.href=="string"}catch{e=!1}if(e)i=t.contentWindow;else break;t=vo(i.document)}return t}function lh(i){var t=i&&i.nodeName&&i.nodeName.toLowerCase();return t&&(t==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||t==="textarea"||i.contentEditable==="true")}var xA=pi&&"documentMode"in document&&11>=document.documentMode,Jn=null,mu=null,ya=null,yu=!1;function Bp(i,t,e){var n=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;yu||Jn==null||Jn!==vo(n)||(n=Jn,"selectionStart"in n&&lh(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),ya&&Ra(ya,n)||(ya=n,n=Po(mu,"onSelect"),0<n.length&&(t=new Xo("onSelect","select",null,t,e),i.push({event:t,listeners:n}),t.target=Jn)))}function on(i,t){var e={};return e[i.toLowerCase()]=t.toLowerCase(),e["Webkit"+i]="webkit"+t,e["Moz"+i]="moz"+t,e}var ts={animationend:on("Animation","AnimationEnd"),animationiteration:on("Animation","AnimationIteration"),animationstart:on("Animation","AnimationStart"),transitionrun:on("Transition","TransitionRun"),transitionstart:on("Transition","TransitionStart"),transitioncancel:on("Transition","TransitionCancel"),transitionend:on("Transition","TransitionEnd")},kc={},bm={};pi&&(bm=document.createElement("div").style,"AnimationEvent"in window||(delete ts.animationend.animation,delete ts.animationiteration.animation,delete ts.animationstart.animation),"TransitionEvent"in window||delete ts.transitionend.transition);function wn(i){if(kc[i])return kc[i];if(!ts[i])return i;var t=ts[i],e;for(e in t)if(t.hasOwnProperty(e)&&e in bm)return kc[i]=t[e];return i}var vm=wn("animationend"),Am=wn("animationiteration"),Sm=wn("animationstart"),CA=wn("transitionrun"),MA=wn("transitionstart"),DA=wn("transitioncancel"),Em=wn("transitionend"),Tm=new Map,bu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");bu.push("scrollEnd");function He(i,t){Tm.set(i,t),En(t,[i])}var Ao=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},_e=[],es=0,ch=0;function Ko(){for(var i=es,t=ch=es=0;t<i;){var e=_e[t];_e[t++]=null;var n=_e[t];_e[t++]=null;var s=_e[t];_e[t++]=null;var a=_e[t];if(_e[t++]=null,n!==null&&s!==null){var r=n.pending;r===null?s.next=s:(s.next=r.next,r.next=s),n.pending=s}a!==0&&wm(e,s,a)}}function Wo(i,t,e,n){_e[es++]=i,_e[es++]=t,_e[es++]=e,_e[es++]=n,ch|=n,i.lanes|=n,i=i.alternate,i!==null&&(i.lanes|=n)}function uh(i,t,e,n){return Wo(i,t,e,n),So(i)}function _n(i,t){return Wo(i,null,null,t),So(i)}function wm(i,t,e){i.lanes|=e;var n=i.alternate;n!==null&&(n.lanes|=e);for(var s=!1,a=i.return;a!==null;)a.childLanes|=e,n=a.alternate,n!==null&&(n.childLanes|=e),a.tag===22&&(i=a.stateNode,i===null||i._visibility&1||(s=!0)),i=a,a=a.return;return i.tag===3?(a=i.stateNode,s&&t!==null&&(s=31-ge(e),i=a.hiddenUpdates,n=i[s],n===null?i[s]=[t]:n.push(t),t.lane=e|536870912),a):null}function So(i){if(50<xa)throw xa=0,Fu=null,Error(x(185));for(var t=i.return;t!==null;)i=t,t=i.return;return i.tag===3?i.stateNode:null}var is={};function OA(i,t,e,n){this.tag=i,this.key=e,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function he(i,t,e,n){return new OA(i,t,e,n)}function hh(i){return i=i.prototype,!(!i||!i.isReactComponent)}function hi(i,t){var e=i.alternate;return e===null?(e=he(i.tag,t,i.key,i.mode),e.elementType=i.elementType,e.type=i.type,e.stateNode=i.stateNode,e.alternate=i,i.alternate=e):(e.pendingProps=t,e.type=i.type,e.flags=0,e.subtreeFlags=0,e.deletions=null),e.flags=i.flags&65011712,e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},e.sibling=i.sibling,e.index=i.index,e.ref=i.ref,e.refCleanup=i.refCleanup,e}function _m(i,t){i.flags&=65011714;var e=i.alternate;return e===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,i.type=e.type,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),i}function no(i,t,e,n,s,a){var r=0;if(n=i,typeof i=="function")hh(i)&&(r=1);else if(typeof i=="string")r=k1(i,e,Ke.current)?26:i==="html"||i==="head"||i==="body"?27:5;else t:switch(i){case au:return i=he(31,e,t,s),i.elementType=au,i.lanes=a,i;case Kn:return fn(e.children,s,a,t);case Vg:r=8,s|=24;break;case iu:return i=he(12,e,t,s|2),i.elementType=iu,i.lanes=a,i;case nu:return i=he(13,e,t,s),i.elementType=nu,i.lanes=a,i;case su:return i=he(19,e,t,s),i.elementType=su,i.lanes=a,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case li:r=10;break t;case Xg:r=9;break t;case $u:r=11;break t;case Zu:r=14;break t;case Oi:r=16,n=null;break t}r=29,e=Error(x(130,i===null?"null":typeof i,"")),n=null}return t=he(r,e,t,s),t.elementType=i,t.type=n,t.lanes=a,t}function fn(i,t,e,n){return i=he(7,i,n,t),i.lanes=e,i}function Lc(i,t,e){return i=he(6,i,null,t),i.lanes=e,i}function xm(i){var t=he(18,null,null,0);return t.stateNode=i,t}function Bc(i,t,e){return t=he(4,i.children!==null?i.children:[],i.key,t),t.lanes=e,t.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},t}var zp=new WeakMap;function Oe(i,t){if(typeof i=="object"&&i!==null){var e=zp.get(i);return e!==void 0?e:(t={value:i,source:t,stack:yp(t)},zp.set(i,t),t)}return{value:i,source:t,stack:yp(t)}}var ns=[],ss=0,Eo=null,Na=0,Ce=[],Me=0,Qi=null,Xe=1,Ye="";function ri(i,t){ns[ss++]=Na,ns[ss++]=Eo,Eo=i,Na=t}function Cm(i,t,e){Ce[Me++]=Xe,Ce[Me++]=Ye,Ce[Me++]=Qi,Qi=i;var n=Xe;i=Ye;var s=32-ge(n)-1;n&=~(1<<s),e+=1;var a=32-ge(t)+s;if(30<a){var r=s-s%5;a=(n&(1<<r)-1).toString(32),n>>=r,s-=r,Xe=1<<32-ge(t)+s|e<<s|n,Ye=a+i}else Xe=1<<a|e<<s|n,Ye=i}function dh(i){i.return!==null&&(ri(i,1),Cm(i,1,0))}function fh(i){for(;i===Eo;)Eo=ns[--ss],ns[ss]=null,Na=ns[--ss],ns[ss]=null;for(;i===Qi;)Qi=Ce[--Me],Ce[Me]=null,Ye=Ce[--Me],Ce[Me]=null,Xe=Ce[--Me],Ce[Me]=null}function Mm(i,t){Ce[Me++]=Xe,Ce[Me++]=Ye,Ce[Me++]=Qi,Xe=t.id,Ye=t.overflow,Qi=i}var jt=null,pt=null,K=!1,Gi=null,Re=!1,vu=Error(x(519));function $i(i){var t=Error(x(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ka(Oe(t,i)),vu}function Pp(i){var t=i.stateNode,e=i.type,n=i.memoizedProps;switch(t[Gt]=i,t[ae]=n,e){case"dialog":j("cancel",t),j("close",t);break;case"iframe":case"object":case"embed":j("load",t);break;case"video":case"audio":for(e=0;e<Pa.length;e++)j(Pa[e],t);break;case"source":j("error",t);break;case"img":case"image":case"link":j("error",t),j("load",t);break;case"details":j("toggle",t);break;case"input":j("invalid",t),sm(t,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0);break;case"select":j("invalid",t);break;case"textarea":j("invalid",t),rm(t,n.value,n.defaultValue,n.children)}e=n.children,typeof e!="string"&&typeof e!="number"&&typeof e!="bigint"||t.textContent===""+e||n.suppressHydrationWarning===!0||uy(t.textContent,e)?(n.popover!=null&&(j("beforetoggle",t),j("toggle",t)),n.onScroll!=null&&j("scroll",t),n.onScrollEnd!=null&&j("scrollend",t),n.onClick!=null&&(t.onclick=ci),t=!0):t=!1,t||$i(i,!0)}function Ip(i){for(jt=i.return;jt;)switch(jt.tag){case 5:case 31:case 13:Re=!1;return;case 27:case 3:Re=!0;return;default:jt=jt.return}}function Vn(i){if(i!==jt)return!1;if(!K)return Ip(i),K=!0,!1;var t=i.tag,e;if((e=t!==3&&t!==27)&&((e=t===5)&&(e=i.type,e=!(e!=="form"&&e!=="button")||Vu(i.type,i.memoizedProps)),e=!e),e&&pt&&$i(i),Ip(i),t===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(x(317));pt=xg(i)}else if(t===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(x(317));pt=xg(i)}else t===27?(t=pt,en(i.type)?(i=Ku,Ku=null,pt=i):pt=t):pt=jt?ke(i.stateNode.nextSibling):null;return!0}function yn(){pt=jt=null,K=!1}function zc(){var i=Gi;return i!==null&&(ne===null?ne=i:ne.push.apply(ne,i),Gi=null),i}function ka(i){Gi===null?Gi=[i]:Gi.push(i)}var Au=We(null),xn=null,ui=null;function Ni(i,t,e){ct(Au,t._currentValue),t._currentValue=e}function di(i){i._currentValue=Au.current,Ht(Au)}function Su(i,t,e){for(;i!==null;){var n=i.alternate;if((i.childLanes&t)!==t?(i.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),i===e)break;i=i.return}}function Eu(i,t,e,n){var s=i.child;for(s!==null&&(s.return=i);s!==null;){var a=s.dependencies;if(a!==null){var r=s.child;a=a.firstContext;t:for(;a!==null;){var o=a;a=s;for(var l=0;l<t.length;l++)if(o.context===t[l]){a.lanes|=e,o=a.alternate,o!==null&&(o.lanes|=e),Su(a.return,e,i),n||(r=null);break t}a=o.next}}else if(s.tag===18){if(r=s.return,r===null)throw Error(x(341));r.lanes|=e,a=r.alternate,a!==null&&(a.lanes|=e),Su(r,e,i),r=null}else r=s.child;if(r!==null)r.return=s;else for(r=s;r!==null;){if(r===i){r=null;break}if(s=r.sibling,s!==null){s.return=r.return,r=s;break}r=r.return}s=r}}function xs(i,t,e,n){i=null;for(var s=t,a=!1;s!==null;){if(!a){if((s.flags&524288)!==0)a=!0;else if((s.flags&262144)!==0)break}if(s.tag===10){var r=s.alternate;if(r===null)throw Error(x(387));if(r=r.memoizedProps,r!==null){var o=s.type;ye(s.pendingProps.value,r.value)||(i!==null?i.push(o):i=[o])}}else if(s===go.current){if(r=s.alternate,r===null)throw Error(x(387));r.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(i!==null?i.push(Fa):i=[Fa])}s=s.return}i!==null&&Eu(t,i,e,n),t.flags|=262144}function To(i){for(i=i.firstContext;i!==null;){if(!ye(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function bn(i){xn=i,ui=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Vt(i){return Dm(xn,i)}function jr(i,t){return xn===null&&bn(i),Dm(i,t)}function Dm(i,t){var e=t._currentValue;if(t={context:t,memoizedValue:e,next:null},ui===null){if(i===null)throw Error(x(308));ui=t,i.dependencies={lanes:0,firstContext:t},i.flags|=524288}else ui=ui.next=t;return e}var RA=typeof AbortController<"u"?AbortController:function(){var i=[],t=this.signal={aborted:!1,addEventListener:function(e,n){i.push(n)}};this.abort=function(){t.aborted=!0,i.forEach(function(e){return e()})}},NA=zt.unstable_scheduleCallback,kA=zt.unstable_NormalPriority,Ot={$$typeof:li,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ph(){return{controller:new RA,data:new Map,refCount:0}}function Ka(i){i.refCount--,i.refCount===0&&NA(kA,function(){i.controller.abort()})}var ba=null,Tu=0,ms=0,cs=null;function LA(i,t){if(ba===null){var e=ba=[];Tu=0,ms=Fh(),cs={status:"pending",value:void 0,then:function(n){e.push(n)}}}return Tu++,t.then(Fp,Fp),t}function Fp(){if(--Tu===0&&ba!==null){cs!==null&&(cs.status="fulfilled");var i=ba;ba=null,ms=0,cs=null;for(var t=0;t<i.length;t++)(0,i[t])()}}function BA(i,t){var e=[],n={status:"pending",value:null,reason:null,then:function(s){e.push(s)}};return i.then(function(){n.status="fulfilled",n.value=t;for(var s=0;s<e.length;s++)(0,e[s])(t)},function(s){for(n.status="rejected",n.reason=s,s=0;s<e.length;s++)(0,e[s])(void 0)}),n}var Hp=B.S;B.S=function(i,t){j0=fe(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&LA(i,t),Hp!==null&&Hp(i,t)};var pn=We(null);function gh(){var i=pn.current;return i!==null?i:ot.pooledCache}function so(i,t){t===null?ct(pn,pn.current):ct(pn,t.pool)}function Om(){var i=gh();return i===null?null:{parent:Ot._currentValue,pool:i}}var Cs=Error(x(460)),mh=Error(x(474)),Qo=Error(x(542)),wo={then:function(){}};function Up(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Rm(i,t,e){switch(e=i[e],e===void 0?i.push(t):e!==t&&(t.then(ci,ci),t=e),t.status){case"fulfilled":return t.value;case"rejected":throw i=t.reason,jp(i),i;default:if(typeof t.status=="string")t.then(ci,ci);else{if(i=ot,i!==null&&100<i.shellSuspendCounter)throw Error(x(482));i=t,i.status="pending",i.then(function(n){if(t.status==="pending"){var s=t;s.status="fulfilled",s.value=n}},function(n){if(t.status==="pending"){var s=t;s.status="rejected",s.reason=n}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw i=t.reason,jp(i),i}throw gn=t,Cs}}function un(i){try{var t=i._init;return t(i._payload)}catch(e){throw e!==null&&typeof e=="object"&&typeof e.then=="function"?(gn=e,Cs):e}}var gn=null;function Gp(){if(gn===null)throw Error(x(459));var i=gn;return gn=null,i}function jp(i){if(i===Cs||i===Qo)throw Error(x(483))}var us=null,La=0;function Vr(i){var t=La;return La+=1,us===null&&(us=[]),Rm(us,i,t)}function aa(i,t){t=t.props.ref,i.ref=t!==void 0?t:null}function Xr(i,t){throw t.$$typeof===Sv?Error(x(525)):(i=Object.prototype.toString.call(t),Error(x(31,i==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":i)))}function Nm(i){function t(p,g){if(i){var b=p.deletions;b===null?(p.deletions=[g],p.flags|=16):b.push(g)}}function e(p,g){if(!i)return null;for(;g!==null;)t(p,g),g=g.sibling;return null}function n(p){for(var g=new Map;p!==null;)p.key!==null?g.set(p.key,p):g.set(p.index,p),p=p.sibling;return g}function s(p,g){return p=hi(p,g),p.index=0,p.sibling=null,p}function a(p,g,b){return p.index=b,i?(b=p.alternate,b!==null?(b=b.index,b<g?(p.flags|=67108866,g):b):(p.flags|=67108866,g)):(p.flags|=1048576,g)}function r(p){return i&&p.alternate===null&&(p.flags|=67108866),p}function o(p,g,b,A){return g===null||g.tag!==6?(g=Lc(b,p.mode,A),g.return=p,g):(g=s(g,b),g.return=p,g)}function l(p,g,b,A){var S=b.type;return S===Kn?u(p,g,b.props.children,A,b.key):g!==null&&(g.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Oi&&un(S)===g.type)?(g=s(g,b.props),aa(g,b),g.return=p,g):(g=no(b.type,b.key,b.props,null,p.mode,A),aa(g,b),g.return=p,g)}function c(p,g,b,A){return g===null||g.tag!==4||g.stateNode.containerInfo!==b.containerInfo||g.stateNode.implementation!==b.implementation?(g=Bc(b,p.mode,A),g.return=p,g):(g=s(g,b.children||[]),g.return=p,g)}function u(p,g,b,A,S){return g===null||g.tag!==7?(g=fn(b,p.mode,A,S),g.return=p,g):(g=s(g,b),g.return=p,g)}function h(p,g,b){if(typeof g=="string"&&g!==""||typeof g=="number"||typeof g=="bigint")return g=Lc(""+g,p.mode,b),g.return=p,g;if(typeof g=="object"&&g!==null){switch(g.$$typeof){case Br:return b=no(g.type,g.key,g.props,null,p.mode,b),aa(b,g),b.return=p,b;case ua:return g=Bc(g,p.mode,b),g.return=p,g;case Oi:return g=un(g),h(p,g,b)}if(ha(g)||na(g))return g=fn(g,p.mode,b,null),g.return=p,g;if(typeof g.then=="function")return h(p,Vr(g),b);if(g.$$typeof===li)return h(p,jr(p,g),b);Xr(p,g)}return null}function d(p,g,b,A){var S=g!==null?g.key:null;if(typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint")return S!==null?null:o(p,g,""+b,A);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Br:return b.key===S?l(p,g,b,A):null;case ua:return b.key===S?c(p,g,b,A):null;case Oi:return b=un(b),d(p,g,b,A)}if(ha(b)||na(b))return S!==null?null:u(p,g,b,A,null);if(typeof b.then=="function")return d(p,g,Vr(b),A);if(b.$$typeof===li)return d(p,g,jr(p,b),A);Xr(p,b)}return null}function f(p,g,b,A,S){if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return p=p.get(b)||null,o(g,p,""+A,S);if(typeof A=="object"&&A!==null){switch(A.$$typeof){case Br:return p=p.get(A.key===null?b:A.key)||null,l(g,p,A,S);case ua:return p=p.get(A.key===null?b:A.key)||null,c(g,p,A,S);case Oi:return A=un(A),f(p,g,b,A,S)}if(ha(A)||na(A))return p=p.get(b)||null,u(g,p,A,S,null);if(typeof A.then=="function")return f(p,g,b,Vr(A),S);if(A.$$typeof===li)return f(p,g,b,jr(g,A),S);Xr(g,A)}return null}function m(p,g,b,A){for(var S=null,E=null,T=g,w=g=0,_=null;T!==null&&w<b.length;w++){T.index>w?(_=T,T=null):_=T.sibling;var C=d(p,T,b[w],A);if(C===null){T===null&&(T=_);break}i&&T&&C.alternate===null&&t(p,T),g=a(C,g,w),E===null?S=C:E.sibling=C,E=C,T=_}if(w===b.length)return e(p,T),K&&ri(p,w),S;if(T===null){for(;w<b.length;w++)T=h(p,b[w],A),T!==null&&(g=a(T,g,w),E===null?S=T:E.sibling=T,E=T);return K&&ri(p,w),S}for(T=n(T);w<b.length;w++)_=f(T,p,w,b[w],A),_!==null&&(i&&_.alternate!==null&&T.delete(_.key===null?w:_.key),g=a(_,g,w),E===null?S=_:E.sibling=_,E=_);return i&&T.forEach(function(D){return t(p,D)}),K&&ri(p,w),S}function y(p,g,b,A){if(b==null)throw Error(x(151));for(var S=null,E=null,T=g,w=g=0,_=null,C=b.next();T!==null&&!C.done;w++,C=b.next()){T.index>w?(_=T,T=null):_=T.sibling;var D=d(p,T,C.value,A);if(D===null){T===null&&(T=_);break}i&&T&&D.alternate===null&&t(p,T),g=a(D,g,w),E===null?S=D:E.sibling=D,E=D,T=_}if(C.done)return e(p,T),K&&ri(p,w),S;if(T===null){for(;!C.done;w++,C=b.next())C=h(p,C.value,A),C!==null&&(g=a(C,g,w),E===null?S=C:E.sibling=C,E=C);return K&&ri(p,w),S}for(T=n(T);!C.done;w++,C=b.next())C=f(T,p,w,C.value,A),C!==null&&(i&&C.alternate!==null&&T.delete(C.key===null?w:C.key),g=a(C,g,w),E===null?S=C:E.sibling=C,E=C);return i&&T.forEach(function(N){return t(p,N)}),K&&ri(p,w),S}function v(p,g,b,A){if(typeof b=="object"&&b!==null&&b.type===Kn&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Br:t:{for(var S=b.key;g!==null;){if(g.key===S){if(S=b.type,S===Kn){if(g.tag===7){e(p,g.sibling),A=s(g,b.props.children),A.return=p,p=A;break t}}else if(g.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Oi&&un(S)===g.type){e(p,g.sibling),A=s(g,b.props),aa(A,b),A.return=p,p=A;break t}e(p,g);break}else t(p,g);g=g.sibling}b.type===Kn?(A=fn(b.props.children,p.mode,A,b.key),A.return=p,p=A):(A=no(b.type,b.key,b.props,null,p.mode,A),aa(A,b),A.return=p,p=A)}return r(p);case ua:t:{for(S=b.key;g!==null;){if(g.key===S)if(g.tag===4&&g.stateNode.containerInfo===b.containerInfo&&g.stateNode.implementation===b.implementation){e(p,g.sibling),A=s(g,b.children||[]),A.return=p,p=A;break t}else{e(p,g);break}else t(p,g);g=g.sibling}A=Bc(b,p.mode,A),A.return=p,p=A}return r(p);case Oi:return b=un(b),v(p,g,b,A)}if(ha(b))return m(p,g,b,A);if(na(b)){if(S=na(b),typeof S!="function")throw Error(x(150));return b=S.call(b),y(p,g,b,A)}if(typeof b.then=="function")return v(p,g,Vr(b),A);if(b.$$typeof===li)return v(p,g,jr(p,b),A);Xr(p,b)}return typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint"?(b=""+b,g!==null&&g.tag===6?(e(p,g.sibling),A=s(g,b),A.return=p,p=A):(e(p,g),A=Lc(b,p.mode,A),A.return=p,p=A),r(p)):e(p,g)}return function(p,g,b,A){try{La=0;var S=v(p,g,b,A);return us=null,S}catch(T){if(T===Cs||T===Qo)throw T;var E=he(29,T,null,p.mode);return E.lanes=A,E.return=p,E}}}var vn=Nm(!0),km=Nm(!1),Ri=!1;function yh(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wu(i,t){i=i.updateQueue,t.updateQueue===i&&(t.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function ji(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Vi(i,t,e){var n=i.updateQueue;if(n===null)return null;if(n=n.shared,($&2)!==0){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,t=So(i),wm(i,null,e),t}return Wo(i,n,t,e),So(i)}function va(i,t,e){if(t=t.updateQueue,t!==null&&(t=t.shared,(e&4194048)!==0)){var n=t.lanes;n&=i.pendingLanes,e|=n,t.lanes=e,$g(i,e)}}function Pc(i,t){var e=i.updateQueue,n=i.alternate;if(n!==null&&(n=n.updateQueue,e===n)){var s=null,a=null;if(e=e.firstBaseUpdate,e!==null){do{var r={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};a===null?s=a=r:a=a.next=r,e=e.next}while(e!==null);a===null?s=a=t:a=a.next=t}else s=a=t;e={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:a,shared:n.shared,callbacks:n.callbacks},i.updateQueue=e;return}i=e.lastBaseUpdate,i===null?e.firstBaseUpdate=t:i.next=t,e.lastBaseUpdate=t}var _u=!1;function Aa(){if(_u){var i=cs;if(i!==null)throw i}}function Sa(i,t,e,n){_u=!1;var s=i.updateQueue;Ri=!1;var a=s.firstBaseUpdate,r=s.lastBaseUpdate,o=s.shared.pending;if(o!==null){s.shared.pending=null;var l=o,c=l.next;l.next=null,r===null?a=c:r.next=c,r=l;var u=i.alternate;u!==null&&(u=u.updateQueue,o=u.lastBaseUpdate,o!==r&&(o===null?u.firstBaseUpdate=c:o.next=c,u.lastBaseUpdate=l))}if(a!==null){var h=s.baseState;r=0,u=c=l=null,o=a;do{var d=o.lane&-536870913,f=d!==o.lane;if(f?(Y&d)===d:(n&d)===d){d!==0&&d===ms&&(_u=!0),u!==null&&(u=u.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});t:{var m=i,y=o;d=t;var v=e;switch(y.tag){case 1:if(m=y.payload,typeof m=="function"){h=m.call(v,h,d);break t}h=m;break t;case 3:m.flags=m.flags&-65537|128;case 0:if(m=y.payload,d=typeof m=="function"?m.call(v,h,d):m,d==null)break t;h=gt({},h,d);break t;case 2:Ri=!0}}d=o.callback,d!==null&&(i.flags|=64,f&&(i.flags|=8192),f=s.callbacks,f===null?s.callbacks=[d]:f.push(d))}else f={lane:d,tag:o.tag,payload:o.payload,callback:o.callback,next:null},u===null?(c=u=f,l=h):u=u.next=f,r|=d;if(o=o.next,o===null){if(o=s.shared.pending,o===null)break;f=o,o=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);u===null&&(l=h),s.baseState=l,s.firstBaseUpdate=c,s.lastBaseUpdate=u,a===null&&(s.shared.lanes=0),Ji|=r,i.lanes=r,i.memoizedState=h}}function Lm(i,t){if(typeof i!="function")throw Error(x(191,i));i.call(t)}function Bm(i,t){var e=i.callbacks;if(e!==null)for(i.callbacks=null,i=0;i<e.length;i++)Lm(e[i],t)}var ys=We(null),_o=We(0);function Vp(i,t){i=bi,ct(_o,i),ct(ys,t),bi=i|t.baseLanes}function xu(){ct(_o,bi),ct(ys,ys.current)}function bh(){bi=_o.current,Ht(ys),Ht(_o)}var be=We(null),Ne=null;function ki(i){var t=i.alternate;ct(_t,_t.current&1),ct(be,i),Ne===null&&(t===null||ys.current!==null||t.memoizedState!==null)&&(Ne=i)}function Cu(i){ct(_t,_t.current),ct(be,i),Ne===null&&(Ne=i)}function zm(i){i.tag===22?(ct(_t,_t.current),ct(be,i),Ne===null&&(Ne=i)):Li(i)}function Li(){ct(_t,_t.current),ct(be,be.current)}function ue(i){Ht(be),Ne===i&&(Ne=null),Ht(_t)}var _t=We(0);function xo(i){for(var t=i;t!==null;){if(t.tag===13){var e=t.memoizedState;if(e!==null&&(e=e.dehydrated,e===null||Yu(e)||qu(e)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===i)break;for(;t.sibling===null;){if(t.return===null||t.return===i)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var gi=0,U=null,st=null,Mt=null,Co=!1,hs=!1,An=!1,Mo=0,Ba=0,ds=null,zA=0;function Tt(){throw Error(x(321))}function vh(i,t){if(t===null)return!1;for(var e=0;e<t.length&&e<i.length;e++)if(!ye(i[e],t[e]))return!1;return!0}function Ah(i,t,e,n,s,a){return gi=a,U=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,B.H=i===null||i.memoizedState===null?f0:Rh,An=!1,a=e(n,s),An=!1,hs&&(a=Im(t,e,n,s)),Pm(i),a}function Pm(i){B.H=za;var t=st!==null&&st.next!==null;if(gi=0,Mt=st=U=null,Co=!1,Ba=0,ds=null,t)throw Error(x(300));i===null||Rt||(i=i.dependencies,i!==null&&To(i)&&(Rt=!0))}function Im(i,t,e,n){U=i;var s=0;do{if(hs&&(ds=null),Ba=0,hs=!1,25<=s)throw Error(x(301));if(s+=1,Mt=st=null,i.updateQueue!=null){var a=i.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}B.H=p0,a=t(e,n)}while(hs);return a}function PA(){var i=B.H,t=i.useState()[0];return t=typeof t.then=="function"?Wa(t):t,i=i.useState()[0],(st!==null?st.memoizedState:null)!==i&&(U.flags|=1024),t}function Sh(){var i=Mo!==0;return Mo=0,i}function Eh(i,t,e){t.updateQueue=i.updateQueue,t.flags&=-2053,i.lanes&=~e}function Th(i){if(Co){for(i=i.memoizedState;i!==null;){var t=i.queue;t!==null&&(t.pending=null),i=i.next}Co=!1}gi=0,Mt=st=U=null,hs=!1,Ba=Mo=0,ds=null}function Zt(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?U.memoizedState=Mt=i:Mt=Mt.next=i,Mt}function xt(){if(st===null){var i=U.alternate;i=i!==null?i.memoizedState:null}else i=st.next;var t=Mt===null?U.memoizedState:Mt.next;if(t!==null)Mt=t,st=i;else{if(i===null)throw U.alternate===null?Error(x(467)):Error(x(310));st=i,i={memoizedState:st.memoizedState,baseState:st.baseState,baseQueue:st.baseQueue,queue:st.queue,next:null},Mt===null?U.memoizedState=Mt=i:Mt=Mt.next=i}return Mt}function $o(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Wa(i){var t=Ba;return Ba+=1,ds===null&&(ds=[]),i=Rm(ds,i,t),t=U,(Mt===null?t.memoizedState:Mt.next)===null&&(t=t.alternate,B.H=t===null||t.memoizedState===null?f0:Rh),i}function Zo(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Wa(i);if(i.$$typeof===li)return Vt(i)}throw Error(x(438,String(i)))}function wh(i){var t=null,e=U.updateQueue;if(e!==null&&(t=e.memoCache),t==null){var n=U.alternate;n!==null&&(n=n.updateQueue,n!==null&&(n=n.memoCache,n!=null&&(t={data:n.data.map(function(s){return s.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),e===null&&(e=$o(),U.updateQueue=e),e.memoCache=t,e=t.data[t.index],e===void 0)for(e=t.data[t.index]=Array(i),n=0;n<i;n++)e[n]=Ev;return t.index++,e}function mi(i,t){return typeof t=="function"?t(i):t}function ao(i){var t=xt();return _h(t,st,i)}function _h(i,t,e){var n=i.queue;if(n===null)throw Error(x(311));n.lastRenderedReducer=e;var s=i.baseQueue,a=n.pending;if(a!==null){if(s!==null){var r=s.next;s.next=a.next,a.next=r}t.baseQueue=s=a,n.pending=null}if(a=i.baseState,s===null)i.memoizedState=a;else{t=s.next;var o=r=null,l=null,c=t,u=!1;do{var h=c.lane&-536870913;if(h!==c.lane?(Y&h)===h:(gi&h)===h){var d=c.revertLane;if(d===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),h===ms&&(u=!0);else if((gi&d)===d){c=c.next,d===ms&&(u=!0);continue}else h={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(o=l=h,r=a):l=l.next=h,U.lanes|=d,Ji|=d;h=c.action,An&&e(a,h),a=c.hasEagerState?c.eagerState:e(a,h)}else d={lane:h,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(o=l=d,r=a):l=l.next=d,U.lanes|=h,Ji|=h;c=c.next}while(c!==null&&c!==t);if(l===null?r=a:l.next=o,!ye(a,i.memoizedState)&&(Rt=!0,u&&(e=cs,e!==null)))throw e;i.memoizedState=a,i.baseState=r,i.baseQueue=l,n.lastRenderedState=a}return s===null&&(n.lanes=0),[i.memoizedState,n.dispatch]}function Ic(i){var t=xt(),e=t.queue;if(e===null)throw Error(x(311));e.lastRenderedReducer=i;var n=e.dispatch,s=e.pending,a=t.memoizedState;if(s!==null){e.pending=null;var r=s=s.next;do a=i(a,r.action),r=r.next;while(r!==s);ye(a,t.memoizedState)||(Rt=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),e.lastRenderedState=a}return[a,n]}function Fm(i,t,e){var n=U,s=xt(),a=K;if(a){if(e===void 0)throw Error(x(407));e=e()}else e=t();var r=!ye((st||s).memoizedState,e);if(r&&(s.memoizedState=e,Rt=!0),s=s.queue,xh(Gm.bind(null,n,s,i),[i]),s.getSnapshot!==t||r||Mt!==null&&Mt.memoizedState.tag&1){if(n.flags|=2048,bs(9,{destroy:void 0},Um.bind(null,n,s,e,t),null),ot===null)throw Error(x(349));a||(gi&127)!==0||Hm(n,t,e)}return e}function Hm(i,t,e){i.flags|=16384,i={getSnapshot:t,value:e},t=U.updateQueue,t===null?(t=$o(),U.updateQueue=t,t.stores=[i]):(e=t.stores,e===null?t.stores=[i]:e.push(i))}function Um(i,t,e,n){t.value=e,t.getSnapshot=n,jm(t)&&Vm(i)}function Gm(i,t,e){return e(function(){jm(t)&&Vm(i)})}function jm(i){var t=i.getSnapshot;i=i.value;try{var e=t();return!ye(i,e)}catch{return!0}}function Vm(i){var t=_n(i,2);t!==null&&se(t,i,2)}function Mu(i){var t=Zt();if(typeof i=="function"){var e=i;if(i=e(),An){zi(!0);try{e()}finally{zi(!1)}}}return t.memoizedState=t.baseState=i,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mi,lastRenderedState:i},t}function Xm(i,t,e,n){return i.baseState=e,_h(i,st,typeof n=="function"?n:mi)}function IA(i,t,e,n,s){if(tl(i))throw Error(x(485));if(i=t.action,i!==null){var a={payload:s,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(r){a.listeners.push(r)}};B.T!==null?e(!0):a.isTransition=!1,n(a),e=t.pending,e===null?(a.next=t.pending=a,Ym(t,a)):(a.next=e.next,t.pending=e.next=a)}}function Ym(i,t){var e=t.action,n=t.payload,s=i.state;if(t.isTransition){var a=B.T,r={};B.T=r;try{var o=e(s,n),l=B.S;l!==null&&l(r,o),Xp(i,t,o)}catch(c){Du(i,t,c)}finally{a!==null&&r.types!==null&&(a.types=r.types),B.T=a}}else try{a=e(s,n),Xp(i,t,a)}catch(c){Du(i,t,c)}}function Xp(i,t,e){e!==null&&typeof e=="object"&&typeof e.then=="function"?e.then(function(n){Yp(i,t,n)},function(n){return Du(i,t,n)}):Yp(i,t,e)}function Yp(i,t,e){t.status="fulfilled",t.value=e,qm(t),i.state=e,t=i.pending,t!==null&&(e=t.next,e===t?i.pending=null:(e=e.next,t.next=e,Ym(i,e)))}function Du(i,t,e){var n=i.pending;if(i.pending=null,n!==null){n=n.next;do t.status="rejected",t.reason=e,qm(t),t=t.next;while(t!==n)}i.action=null}function qm(i){i=i.listeners;for(var t=0;t<i.length;t++)(0,i[t])()}function Km(i,t){return t}function qp(i,t){if(K){var e=ot.formState;if(e!==null){t:{var n=U;if(K){if(pt){e:{for(var s=pt,a=Re;s.nodeType!==8;){if(!a){s=null;break e}if(s=ke(s.nextSibling),s===null){s=null;break e}}a=s.data,s=a==="F!"||a==="F"?s:null}if(s){pt=ke(s.nextSibling),n=s.data==="F!";break t}}$i(n)}n=!1}n&&(t=e[0])}}return e=Zt(),e.memoizedState=e.baseState=t,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Km,lastRenderedState:t},e.queue=n,e=u0.bind(null,U,n),n.dispatch=e,n=Mu(!1),a=Oh.bind(null,U,!1,n.queue),n=Zt(),s={state:t,dispatch:null,action:i,pending:null},n.queue=s,e=IA.bind(null,U,s,a,e),s.dispatch=e,n.memoizedState=i,[t,e,!1]}function Kp(i){var t=xt();return Wm(t,st,i)}function Wm(i,t,e){if(t=_h(i,t,Km)[0],i=ao(mi)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var n=Wa(t)}catch(r){throw r===Cs?Qo:r}else n=t;t=xt();var s=t.queue,a=s.dispatch;return e!==t.memoizedState&&(U.flags|=2048,bs(9,{destroy:void 0},FA.bind(null,s,e),null)),[n,a,i]}function FA(i,t){i.action=t}function Wp(i){var t=xt(),e=st;if(e!==null)return Wm(t,e,i);xt(),t=t.memoizedState,e=xt();var n=e.queue.dispatch;return e.memoizedState=i,[t,n,!1]}function bs(i,t,e,n){return i={tag:i,create:e,deps:n,inst:t,next:null},t=U.updateQueue,t===null&&(t=$o(),U.updateQueue=t),e=t.lastEffect,e===null?t.lastEffect=i.next=i:(n=e.next,e.next=i,i.next=n,t.lastEffect=i),i}function Qm(){return xt().memoizedState}function ro(i,t,e,n){var s=Zt();U.flags|=i,s.memoizedState=bs(1|t,{destroy:void 0},e,n===void 0?null:n)}function Jo(i,t,e,n){var s=xt();n=n===void 0?null:n;var a=s.memoizedState.inst;st!==null&&n!==null&&vh(n,st.memoizedState.deps)?s.memoizedState=bs(t,a,e,n):(U.flags|=i,s.memoizedState=bs(1|t,a,e,n))}function Qp(i,t){ro(8390656,8,i,t)}function xh(i,t){Jo(2048,8,i,t)}function HA(i){U.flags|=4;var t=U.updateQueue;if(t===null)t=$o(),U.updateQueue=t,t.events=[i];else{var e=t.events;e===null?t.events=[i]:e.push(i)}}function $m(i){var t=xt().memoizedState;return HA({ref:t,nextImpl:i}),function(){if(($&2)!==0)throw Error(x(440));return t.impl.apply(void 0,arguments)}}function Zm(i,t){return Jo(4,2,i,t)}function Jm(i,t){return Jo(4,4,i,t)}function t0(i,t){if(typeof t=="function"){i=i();var e=t(i);return function(){typeof e=="function"?e():t(null)}}if(t!=null)return i=i(),t.current=i,function(){t.current=null}}function e0(i,t,e){e=e!=null?e.concat([i]):null,Jo(4,4,t0.bind(null,t,i),e)}function Ch(){}function i0(i,t){var e=xt();t=t===void 0?null:t;var n=e.memoizedState;return t!==null&&vh(t,n[1])?n[0]:(e.memoizedState=[i,t],i)}function n0(i,t){var e=xt();t=t===void 0?null:t;var n=e.memoizedState;if(t!==null&&vh(t,n[1]))return n[0];if(n=i(),An){zi(!0);try{i()}finally{zi(!1)}}return e.memoizedState=[n,t],n}function Mh(i,t,e){return e===void 0||(gi&1073741824)!==0&&(Y&261930)===0?i.memoizedState=t:(i.memoizedState=e,i=X0(),U.lanes|=i,Ji|=i,e)}function s0(i,t,e,n){return ye(e,t)?e:ys.current!==null?(i=Mh(i,e,n),ye(i,t)||(Rt=!0),i):(gi&42)===0||(gi&1073741824)!==0&&(Y&261930)===0?(Rt=!0,i.memoizedState=e):(i=X0(),U.lanes|=i,Ji|=i,t)}function a0(i,t,e,n,s){var a=Z.p;Z.p=a!==0&&8>a?a:8;var r=B.T,o={};B.T=o,Oh(i,!1,t,e);try{var l=s(),c=B.S;if(c!==null&&c(o,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=BA(l,n);Ea(i,t,u,me(i))}else Ea(i,t,n,me(i))}catch(h){Ea(i,t,{then:function(){},status:"rejected",reason:h},me())}finally{Z.p=a,r!==null&&o.types!==null&&(r.types=o.types),B.T=r}}function UA(){}function Ou(i,t,e,n){if(i.tag!==5)throw Error(x(476));var s=r0(i).queue;a0(i,s,t,dn,e===null?UA:function(){return o0(i),e(n)})}function r0(i){var t=i.memoizedState;if(t!==null)return t;t={memoizedState:dn,baseState:dn,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mi,lastRenderedState:dn},next:null};var e={};return t.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mi,lastRenderedState:e},next:null},i.memoizedState=t,i=i.alternate,i!==null&&(i.memoizedState=t),t}function o0(i){var t=r0(i);t.next===null&&(t=i.alternate.memoizedState),Ea(i,t.next.queue,{},me())}function Dh(){return Vt(Fa)}function l0(){return xt().memoizedState}function c0(){return xt().memoizedState}function GA(i){for(var t=i.return;t!==null;){switch(t.tag){case 24:case 3:var e=me();i=ji(e);var n=Vi(t,i,e);n!==null&&(se(n,t,e),va(n,t,e)),t={cache:ph()},i.payload=t;return}t=t.return}}function jA(i,t,e){var n=me();e={lane:n,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},tl(i)?h0(t,e):(e=uh(i,t,e,n),e!==null&&(se(e,i,n),d0(e,t,n)))}function u0(i,t,e){var n=me();Ea(i,t,e,n)}function Ea(i,t,e,n){var s={lane:n,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null};if(tl(i))h0(t,s);else{var a=i.alternate;if(i.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var r=t.lastRenderedState,o=a(r,e);if(s.hasEagerState=!0,s.eagerState=o,ye(o,r))return Wo(i,t,s,0),ot===null&&Ko(),!1}catch{}if(e=uh(i,t,s,n),e!==null)return se(e,i,n),d0(e,t,n),!0}return!1}function Oh(i,t,e,n){if(n={lane:2,revertLane:Fh(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},tl(i)){if(t)throw Error(x(479))}else t=uh(i,e,n,2),t!==null&&se(t,i,2)}function tl(i){var t=i.alternate;return i===U||t!==null&&t===U}function h0(i,t){hs=Co=!0;var e=i.pending;e===null?t.next=t:(t.next=e.next,e.next=t),i.pending=t}function d0(i,t,e){if((e&4194048)!==0){var n=t.lanes;n&=i.pendingLanes,e|=n,t.lanes=e,$g(i,e)}}var za={readContext:Vt,use:Zo,useCallback:Tt,useContext:Tt,useEffect:Tt,useImperativeHandle:Tt,useLayoutEffect:Tt,useInsertionEffect:Tt,useMemo:Tt,useReducer:Tt,useRef:Tt,useState:Tt,useDebugValue:Tt,useDeferredValue:Tt,useTransition:Tt,useSyncExternalStore:Tt,useId:Tt,useHostTransitionStatus:Tt,useFormState:Tt,useActionState:Tt,useOptimistic:Tt,useMemoCache:Tt,useCacheRefresh:Tt};za.useEffectEvent=Tt;var f0={readContext:Vt,use:Zo,useCallback:function(i,t){return Zt().memoizedState=[i,t===void 0?null:t],i},useContext:Vt,useEffect:Qp,useImperativeHandle:function(i,t,e){e=e!=null?e.concat([i]):null,ro(4194308,4,t0.bind(null,t,i),e)},useLayoutEffect:function(i,t){return ro(4194308,4,i,t)},useInsertionEffect:function(i,t){ro(4,2,i,t)},useMemo:function(i,t){var e=Zt();t=t===void 0?null:t;var n=i();if(An){zi(!0);try{i()}finally{zi(!1)}}return e.memoizedState=[n,t],n},useReducer:function(i,t,e){var n=Zt();if(e!==void 0){var s=e(t);if(An){zi(!0);try{e(t)}finally{zi(!1)}}}else s=t;return n.memoizedState=n.baseState=s,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:s},n.queue=i,i=i.dispatch=jA.bind(null,U,i),[n.memoizedState,i]},useRef:function(i){var t=Zt();return i={current:i},t.memoizedState=i},useState:function(i){i=Mu(i);var t=i.queue,e=u0.bind(null,U,t);return t.dispatch=e,[i.memoizedState,e]},useDebugValue:Ch,useDeferredValue:function(i,t){var e=Zt();return Mh(e,i,t)},useTransition:function(){var i=Mu(!1);return i=a0.bind(null,U,i.queue,!0,!1),Zt().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,t,e){var n=U,s=Zt();if(K){if(e===void 0)throw Error(x(407));e=e()}else{if(e=t(),ot===null)throw Error(x(349));(Y&127)!==0||Hm(n,t,e)}s.memoizedState=e;var a={value:e,getSnapshot:t};return s.queue=a,Qp(Gm.bind(null,n,a,i),[i]),n.flags|=2048,bs(9,{destroy:void 0},Um.bind(null,n,a,e,t),null),e},useId:function(){var i=Zt(),t=ot.identifierPrefix;if(K){var e=Ye,n=Xe;e=(n&~(1<<32-ge(n)-1)).toString(32)+e,t="_"+t+"R_"+e,e=Mo++,0<e&&(t+="H"+e.toString(32)),t+="_"}else e=zA++,t="_"+t+"r_"+e.toString(32)+"_";return i.memoizedState=t},useHostTransitionStatus:Dh,useFormState:qp,useActionState:qp,useOptimistic:function(i){var t=Zt();t.memoizedState=t.baseState=i;var e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=e,t=Oh.bind(null,U,!0,e),e.dispatch=t,[i,t]},useMemoCache:wh,useCacheRefresh:function(){return Zt().memoizedState=GA.bind(null,U)},useEffectEvent:function(i){var t=Zt(),e={impl:i};return t.memoizedState=e,function(){if(($&2)!==0)throw Error(x(440));return e.impl.apply(void 0,arguments)}}},Rh={readContext:Vt,use:Zo,useCallback:i0,useContext:Vt,useEffect:xh,useImperativeHandle:e0,useInsertionEffect:Zm,useLayoutEffect:Jm,useMemo:n0,useReducer:ao,useRef:Qm,useState:function(){return ao(mi)},useDebugValue:Ch,useDeferredValue:function(i,t){var e=xt();return s0(e,st.memoizedState,i,t)},useTransition:function(){var i=ao(mi)[0],t=xt().memoizedState;return[typeof i=="boolean"?i:Wa(i),t]},useSyncExternalStore:Fm,useId:l0,useHostTransitionStatus:Dh,useFormState:Kp,useActionState:Kp,useOptimistic:function(i,t){var e=xt();return Xm(e,st,i,t)},useMemoCache:wh,useCacheRefresh:c0};Rh.useEffectEvent=$m;var p0={readContext:Vt,use:Zo,useCallback:i0,useContext:Vt,useEffect:xh,useImperativeHandle:e0,useInsertionEffect:Zm,useLayoutEffect:Jm,useMemo:n0,useReducer:Ic,useRef:Qm,useState:function(){return Ic(mi)},useDebugValue:Ch,useDeferredValue:function(i,t){var e=xt();return st===null?Mh(e,i,t):s0(e,st.memoizedState,i,t)},useTransition:function(){var i=Ic(mi)[0],t=xt().memoizedState;return[typeof i=="boolean"?i:Wa(i),t]},useSyncExternalStore:Fm,useId:l0,useHostTransitionStatus:Dh,useFormState:Wp,useActionState:Wp,useOptimistic:function(i,t){var e=xt();return st!==null?Xm(e,st,i,t):(e.baseState=i,[i,e.queue.dispatch])},useMemoCache:wh,useCacheRefresh:c0};p0.useEffectEvent=$m;function Fc(i,t,e,n){t=i.memoizedState,e=e(n,t),e=e==null?t:gt({},t,e),i.memoizedState=e,i.lanes===0&&(i.updateQueue.baseState=e)}var Ru={enqueueSetState:function(i,t,e){i=i._reactInternals;var n=me(),s=ji(n);s.payload=t,e!=null&&(s.callback=e),t=Vi(i,s,n),t!==null&&(se(t,i,n),va(t,i,n))},enqueueReplaceState:function(i,t,e){i=i._reactInternals;var n=me(),s=ji(n);s.tag=1,s.payload=t,e!=null&&(s.callback=e),t=Vi(i,s,n),t!==null&&(se(t,i,n),va(t,i,n))},enqueueForceUpdate:function(i,t){i=i._reactInternals;var e=me(),n=ji(e);n.tag=2,t!=null&&(n.callback=t),t=Vi(i,n,e),t!==null&&(se(t,i,e),va(t,i,e))}};function $p(i,t,e,n,s,a,r){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(n,a,r):t.prototype&&t.prototype.isPureReactComponent?!Ra(e,n)||!Ra(s,a):!0}function Zp(i,t,e,n){i=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(e,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(e,n),t.state!==i&&Ru.enqueueReplaceState(t,t.state,null)}function Sn(i,t){var e=t;if("ref"in t){e={};for(var n in t)n!=="ref"&&(e[n]=t[n])}if(i=i.defaultProps){e===t&&(e=gt({},e));for(var s in i)e[s]===void 0&&(e[s]=i[s])}return e}function g0(i){Ao(i)}function m0(i){console.error(i)}function y0(i){Ao(i)}function Do(i,t){try{var e=i.onUncaughtError;e(t.value,{componentStack:t.stack})}catch(n){setTimeout(function(){throw n})}}function Jp(i,t,e){try{var n=i.onCaughtError;n(e.value,{componentStack:e.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(s){setTimeout(function(){throw s})}}function Nu(i,t,e){return e=ji(e),e.tag=3,e.payload={element:null},e.callback=function(){Do(i,t)},e}function b0(i){return i=ji(i),i.tag=3,i}function v0(i,t,e,n){var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var a=n.value;i.payload=function(){return s(a)},i.callback=function(){Jp(t,e,n)}}var r=e.stateNode;r!==null&&typeof r.componentDidCatch=="function"&&(i.callback=function(){Jp(t,e,n),typeof s!="function"&&(Xi===null?Xi=new Set([this]):Xi.add(this));var o=n.stack;this.componentDidCatch(n.value,{componentStack:o!==null?o:""})})}function VA(i,t,e,n,s){if(e.flags|=32768,n!==null&&typeof n=="object"&&typeof n.then=="function"){if(t=e.alternate,t!==null&&xs(t,e,s,!0),e=be.current,e!==null){switch(e.tag){case 31:case 13:return Ne===null?Lo():e.alternate===null&&wt===0&&(wt=3),e.flags&=-257,e.flags|=65536,e.lanes=s,n===wo?e.flags|=16384:(t=e.updateQueue,t===null?e.updateQueue=new Set([n]):t.add(n),Qc(i,n,s)),!1;case 22:return e.flags|=65536,n===wo?e.flags|=16384:(t=e.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([n])},e.updateQueue=t):(e=t.retryQueue,e===null?t.retryQueue=new Set([n]):e.add(n)),Qc(i,n,s)),!1}throw Error(x(435,e.tag))}return Qc(i,n,s),Lo(),!1}if(K)return t=be.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=s,n!==vu&&(i=Error(x(422),{cause:n}),ka(Oe(i,e)))):(n!==vu&&(t=Error(x(423),{cause:n}),ka(Oe(t,e))),i=i.current.alternate,i.flags|=65536,s&=-s,i.lanes|=s,n=Oe(n,e),s=Nu(i.stateNode,n,s),Pc(i,s),wt!==4&&(wt=2)),!1;var a=Error(x(520),{cause:n});if(a=Oe(a,e),_a===null?_a=[a]:_a.push(a),wt!==4&&(wt=2),t===null)return!0;n=Oe(n,e),e=t;do{switch(e.tag){case 3:return e.flags|=65536,i=s&-s,e.lanes|=i,i=Nu(e.stateNode,n,i),Pc(e,i),!1;case 1:if(t=e.type,a=e.stateNode,(e.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||a!==null&&typeof a.componentDidCatch=="function"&&(Xi===null||!Xi.has(a))))return e.flags|=65536,s&=-s,e.lanes|=s,s=b0(s),v0(s,i,e,n),Pc(e,s),!1}e=e.return}while(e!==null);return!1}var Nh=Error(x(461)),Rt=!1;function Ut(i,t,e,n){t.child=i===null?km(t,null,e,n):vn(t,i.child,e,n)}function tg(i,t,e,n,s){e=e.render;var a=t.ref;if("ref"in n){var r={};for(var o in n)o!=="ref"&&(r[o]=n[o])}else r=n;return bn(t),n=Ah(i,t,e,r,a,s),o=Sh(),i!==null&&!Rt?(Eh(i,t,s),yi(i,t,s)):(K&&o&&dh(t),t.flags|=1,Ut(i,t,n,s),t.child)}function eg(i,t,e,n,s){if(i===null){var a=e.type;return typeof a=="function"&&!hh(a)&&a.defaultProps===void 0&&e.compare===null?(t.tag=15,t.type=a,A0(i,t,a,n,s)):(i=no(e.type,null,n,t,t.mode,s),i.ref=t.ref,i.return=t,t.child=i)}if(a=i.child,!kh(i,s)){var r=a.memoizedProps;if(e=e.compare,e=e!==null?e:Ra,e(r,n)&&i.ref===t.ref)return yi(i,t,s)}return t.flags|=1,i=hi(a,n),i.ref=t.ref,i.return=t,t.child=i}function A0(i,t,e,n,s){if(i!==null){var a=i.memoizedProps;if(Ra(a,n)&&i.ref===t.ref)if(Rt=!1,t.pendingProps=n=a,kh(i,s))(i.flags&131072)!==0&&(Rt=!0);else return t.lanes=i.lanes,yi(i,t,s)}return ku(i,t,e,n,s)}function S0(i,t,e,n){var s=n.children,a=i!==null?i.memoizedState:null;if(i===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.mode==="hidden"){if((t.flags&128)!==0){if(a=a!==null?a.baseLanes|e:e,i!==null){for(n=t.child=i.child,s=0;n!==null;)s=s|n.lanes|n.childLanes,n=n.sibling;n=s&~a}else n=0,t.child=null;return ig(i,t,a,e,n)}if((e&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},i!==null&&so(t,a!==null?a.cachePool:null),a!==null?Vp(t,a):xu(),zm(t);else return n=t.lanes=536870912,ig(i,t,a!==null?a.baseLanes|e:e,e,n)}else a!==null?(so(t,a.cachePool),Vp(t,a),Li(t),t.memoizedState=null):(i!==null&&so(t,null),xu(),Li(t));return Ut(i,t,s,e),t.child}function fa(i,t){return i!==null&&i.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ig(i,t,e,n,s){var a=gh();return a=a===null?null:{parent:Ot._currentValue,pool:a},t.memoizedState={baseLanes:e,cachePool:a},i!==null&&so(t,null),xu(),zm(t),i!==null&&xs(i,t,n,!0),t.childLanes=s,null}function oo(i,t){return t=Oo({mode:t.mode,children:t.children},i.mode),t.ref=i.ref,i.child=t,t.return=i,t}function ng(i,t,e){return vn(t,i.child,null,e),i=oo(t,t.pendingProps),i.flags|=2,ue(t),t.memoizedState=null,i}function XA(i,t,e){var n=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,i===null){if(K){if(n.mode==="hidden")return i=oo(t,n),t.lanes=536870912,fa(null,i);if(Cu(t),(i=pt)?(i=fy(i,Re),i=i!==null&&i.data==="&"?i:null,i!==null&&(t.memoizedState={dehydrated:i,treeContext:Qi!==null?{id:Xe,overflow:Ye}:null,retryLane:536870912,hydrationErrors:null},e=xm(i),e.return=t,t.child=e,jt=t,pt=null)):i=null,i===null)throw $i(t);return t.lanes=536870912,null}return oo(t,n)}var a=i.memoizedState;if(a!==null){var r=a.dehydrated;if(Cu(t),s)if(t.flags&256)t.flags&=-257,t=ng(i,t,e);else if(t.memoizedState!==null)t.child=i.child,t.flags|=128,t=null;else throw Error(x(558));else if(Rt||xs(i,t,e,!1),s=(e&i.childLanes)!==0,Rt||s){if(n=ot,n!==null&&(r=Zg(n,e),r!==0&&r!==a.retryLane))throw a.retryLane=r,_n(i,r),se(n,i,r),Nh;Lo(),t=ng(i,t,e)}else i=a.treeContext,pt=ke(r.nextSibling),jt=t,K=!0,Gi=null,Re=!1,i!==null&&Mm(t,i),t=oo(t,n),t.flags|=4096;return t}return i=hi(i.child,{mode:n.mode,children:n.children}),i.ref=t.ref,t.child=i,i.return=t,i}function lo(i,t){var e=t.ref;if(e===null)i!==null&&i.ref!==null&&(t.flags|=4194816);else{if(typeof e!="function"&&typeof e!="object")throw Error(x(284));(i===null||i.ref!==e)&&(t.flags|=4194816)}}function ku(i,t,e,n,s){return bn(t),e=Ah(i,t,e,n,void 0,s),n=Sh(),i!==null&&!Rt?(Eh(i,t,s),yi(i,t,s)):(K&&n&&dh(t),t.flags|=1,Ut(i,t,e,s),t.child)}function sg(i,t,e,n,s,a){return bn(t),t.updateQueue=null,e=Im(t,n,e,s),Pm(i),n=Sh(),i!==null&&!Rt?(Eh(i,t,a),yi(i,t,a)):(K&&n&&dh(t),t.flags|=1,Ut(i,t,e,a),t.child)}function ag(i,t,e,n,s){if(bn(t),t.stateNode===null){var a=is,r=e.contextType;typeof r=="object"&&r!==null&&(a=Vt(r)),a=new e(n,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ru,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=n,a.state=t.memoizedState,a.refs={},yh(t),r=e.contextType,a.context=typeof r=="object"&&r!==null?Vt(r):is,a.state=t.memoizedState,r=e.getDerivedStateFromProps,typeof r=="function"&&(Fc(t,e,r,n),a.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof a.getSnapshotBeforeUpdate=="function"||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(r=a.state,typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount(),r!==a.state&&Ru.enqueueReplaceState(a,a.state,null),Sa(t,n,a,s),Aa(),a.state=t.memoizedState),typeof a.componentDidMount=="function"&&(t.flags|=4194308),n=!0}else if(i===null){a=t.stateNode;var o=t.memoizedProps,l=Sn(e,o);a.props=l;var c=a.context,u=e.contextType;r=is,typeof u=="object"&&u!==null&&(r=Vt(u));var h=e.getDerivedStateFromProps;u=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function",o=t.pendingProps!==o,u||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o||c!==r)&&Zp(t,a,n,r),Ri=!1;var d=t.memoizedState;a.state=d,Sa(t,n,a,s),Aa(),c=t.memoizedState,o||d!==c||Ri?(typeof h=="function"&&(Fc(t,e,h,n),c=t.memoizedState),(l=Ri||$p(t,e,l,n,d,c,r))?(u||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=c),a.props=n,a.state=c,a.context=r,n=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{a=t.stateNode,wu(i,t),r=t.memoizedProps,u=Sn(e,r),a.props=u,h=t.pendingProps,d=a.context,c=e.contextType,l=is,typeof c=="object"&&c!==null&&(l=Vt(c)),o=e.getDerivedStateFromProps,(c=typeof o=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(r!==h||d!==l)&&Zp(t,a,n,l),Ri=!1,d=t.memoizedState,a.state=d,Sa(t,n,a,s),Aa();var f=t.memoizedState;r!==h||d!==f||Ri||i!==null&&i.dependencies!==null&&To(i.dependencies)?(typeof o=="function"&&(Fc(t,e,o,n),f=t.memoizedState),(u=Ri||$p(t,e,u,n,d,f,l)||i!==null&&i.dependencies!==null&&To(i.dependencies))?(c||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,f,l),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,f,l)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||r===i.memoizedProps&&d===i.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||r===i.memoizedProps&&d===i.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=f),a.props=n,a.state=f,a.context=l,n=u):(typeof a.componentDidUpdate!="function"||r===i.memoizedProps&&d===i.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||r===i.memoizedProps&&d===i.memoizedState||(t.flags|=1024),n=!1)}return a=n,lo(i,t),n=(t.flags&128)!==0,a||n?(a=t.stateNode,e=n&&typeof e.getDerivedStateFromError!="function"?null:a.render(),t.flags|=1,i!==null&&n?(t.child=vn(t,i.child,null,s),t.child=vn(t,null,e,s)):Ut(i,t,e,s),t.memoizedState=a.state,i=t.child):i=yi(i,t,s),i}function rg(i,t,e,n){return yn(),t.flags|=256,Ut(i,t,e,n),t.child}var Hc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Uc(i){return{baseLanes:i,cachePool:Om()}}function Gc(i,t,e){return i=i!==null?i.childLanes&~e:0,t&&(i|=de),i}function E0(i,t,e){var n=t.pendingProps,s=!1,a=(t.flags&128)!==0,r;if((r=a)||(r=i!==null&&i.memoizedState===null?!1:(_t.current&2)!==0),r&&(s=!0,t.flags&=-129),r=(t.flags&32)!==0,t.flags&=-33,i===null){if(K){if(s?ki(t):Li(t),(i=pt)?(i=fy(i,Re),i=i!==null&&i.data!=="&"?i:null,i!==null&&(t.memoizedState={dehydrated:i,treeContext:Qi!==null?{id:Xe,overflow:Ye}:null,retryLane:536870912,hydrationErrors:null},e=xm(i),e.return=t,t.child=e,jt=t,pt=null)):i=null,i===null)throw $i(t);return qu(i)?t.lanes=32:t.lanes=536870912,null}var o=n.children;return n=n.fallback,s?(Li(t),s=t.mode,o=Oo({mode:"hidden",children:o},s),n=fn(n,s,e,null),o.return=t,n.return=t,o.sibling=n,t.child=o,n=t.child,n.memoizedState=Uc(e),n.childLanes=Gc(i,r,e),t.memoizedState=Hc,fa(null,n)):(ki(t),Lu(t,o))}var l=i.memoizedState;if(l!==null&&(o=l.dehydrated,o!==null)){if(a)t.flags&256?(ki(t),t.flags&=-257,t=jc(i,t,e)):t.memoizedState!==null?(Li(t),t.child=i.child,t.flags|=128,t=null):(Li(t),o=n.fallback,s=t.mode,n=Oo({mode:"visible",children:n.children},s),o=fn(o,s,e,null),o.flags|=2,n.return=t,o.return=t,n.sibling=o,t.child=n,vn(t,i.child,null,e),n=t.child,n.memoizedState=Uc(e),n.childLanes=Gc(i,r,e),t.memoizedState=Hc,t=fa(null,n));else if(ki(t),qu(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var c=r.dgst;r=c,n=Error(x(419)),n.stack="",n.digest=r,ka({value:n,source:null,stack:null}),t=jc(i,t,e)}else if(Rt||xs(i,t,e,!1),r=(e&i.childLanes)!==0,Rt||r){if(r=ot,r!==null&&(n=Zg(r,e),n!==0&&n!==l.retryLane))throw l.retryLane=n,_n(i,n),se(r,i,n),Nh;Yu(o)||Lo(),t=jc(i,t,e)}else Yu(o)?(t.flags|=192,t.child=i.child,t=null):(i=l.treeContext,pt=ke(o.nextSibling),jt=t,K=!0,Gi=null,Re=!1,i!==null&&Mm(t,i),t=Lu(t,n.children),t.flags|=4096);return t}return s?(Li(t),o=n.fallback,s=t.mode,l=i.child,c=l.sibling,n=hi(l,{mode:"hidden",children:n.children}),n.subtreeFlags=l.subtreeFlags&65011712,c!==null?o=hi(c,o):(o=fn(o,s,e,null),o.flags|=2),o.return=t,n.return=t,n.sibling=o,t.child=n,fa(null,n),n=t.child,o=i.child.memoizedState,o===null?o=Uc(e):(s=o.cachePool,s!==null?(l=Ot._currentValue,s=s.parent!==l?{parent:l,pool:l}:s):s=Om(),o={baseLanes:o.baseLanes|e,cachePool:s}),n.memoizedState=o,n.childLanes=Gc(i,r,e),t.memoizedState=Hc,fa(i.child,n)):(ki(t),e=i.child,i=e.sibling,e=hi(e,{mode:"visible",children:n.children}),e.return=t,e.sibling=null,i!==null&&(r=t.deletions,r===null?(t.deletions=[i],t.flags|=16):r.push(i)),t.child=e,t.memoizedState=null,e)}function Lu(i,t){return t=Oo({mode:"visible",children:t},i.mode),t.return=i,i.child=t}function Oo(i,t){return i=he(22,i,null,t),i.lanes=0,i}function jc(i,t,e){return vn(t,i.child,null,e),i=Lu(t,t.pendingProps.children),i.flags|=2,t.memoizedState=null,i}function og(i,t,e){i.lanes|=t;var n=i.alternate;n!==null&&(n.lanes|=t),Su(i.return,t,e)}function Vc(i,t,e,n,s,a){var r=i.memoizedState;r===null?i.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:e,tailMode:s,treeForkCount:a}:(r.isBackwards=t,r.rendering=null,r.renderingStartTime=0,r.last=n,r.tail=e,r.tailMode=s,r.treeForkCount=a)}function T0(i,t,e){var n=t.pendingProps,s=n.revealOrder,a=n.tail;n=n.children;var r=_t.current,o=(r&2)!==0;if(o?(r=r&1|2,t.flags|=128):r&=1,ct(_t,r),Ut(i,t,n,e),n=K?Na:0,!o&&i!==null&&(i.flags&128)!==0)t:for(i=t.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&og(i,e,t);else if(i.tag===19)og(i,e,t);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break t;for(;i.sibling===null;){if(i.return===null||i.return===t)break t;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(s){case"forwards":for(e=t.child,s=null;e!==null;)i=e.alternate,i!==null&&xo(i)===null&&(s=e),e=e.sibling;e=s,e===null?(s=t.child,t.child=null):(s=e.sibling,e.sibling=null),Vc(t,!1,s,e,a,n);break;case"backwards":case"unstable_legacy-backwards":for(e=null,s=t.child,t.child=null;s!==null;){if(i=s.alternate,i!==null&&xo(i)===null){t.child=s;break}i=s.sibling,s.sibling=e,e=s,s=i}Vc(t,!0,e,null,a,n);break;case"together":Vc(t,!1,null,null,void 0,n);break;default:t.memoizedState=null}return t.child}function yi(i,t,e){if(i!==null&&(t.dependencies=i.dependencies),Ji|=t.lanes,(e&t.childLanes)===0)if(i!==null){if(xs(i,t,e,!1),(e&t.childLanes)===0)return null}else return null;if(i!==null&&t.child!==i.child)throw Error(x(153));if(t.child!==null){for(i=t.child,e=hi(i,i.pendingProps),t.child=e,e.return=t;i.sibling!==null;)i=i.sibling,e=e.sibling=hi(i,i.pendingProps),e.return=t;e.sibling=null}return t.child}function kh(i,t){return(i.lanes&t)!==0?!0:(i=i.dependencies,!!(i!==null&&To(i)))}function YA(i,t,e){switch(t.tag){case 3:mo(t,t.stateNode.containerInfo),Ni(t,Ot,i.memoizedState.cache),yn();break;case 27:case 5:lu(t);break;case 4:mo(t,t.stateNode.containerInfo);break;case 10:Ni(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Cu(t),null;break;case 13:var n=t.memoizedState;if(n!==null)return n.dehydrated!==null?(ki(t),t.flags|=128,null):(e&t.child.childLanes)!==0?E0(i,t,e):(ki(t),i=yi(i,t,e),i!==null?i.sibling:null);ki(t);break;case 19:var s=(i.flags&128)!==0;if(n=(e&t.childLanes)!==0,n||(xs(i,t,e,!1),n=(e&t.childLanes)!==0),s){if(n)return T0(i,t,e);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),ct(_t,_t.current),n)break;return null;case 22:return t.lanes=0,S0(i,t,e,t.pendingProps);case 24:Ni(t,Ot,i.memoizedState.cache)}return yi(i,t,e)}function w0(i,t,e){if(i!==null)if(i.memoizedProps!==t.pendingProps)Rt=!0;else{if(!kh(i,e)&&(t.flags&128)===0)return Rt=!1,YA(i,t,e);Rt=(i.flags&131072)!==0}else Rt=!1,K&&(t.flags&1048576)!==0&&Cm(t,Na,t.index);switch(t.lanes=0,t.tag){case 16:t:{var n=t.pendingProps;if(i=un(t.elementType),t.type=i,typeof i=="function")hh(i)?(n=Sn(i,n),t.tag=1,t=ag(null,t,i,n,e)):(t.tag=0,t=ku(null,t,i,n,e));else{if(i!=null){var s=i.$$typeof;if(s===$u){t.tag=11,t=tg(null,t,i,n,e);break t}else if(s===Zu){t.tag=14,t=eg(null,t,i,n,e);break t}}throw t=ru(i)||i,Error(x(306,t,""))}}return t;case 0:return ku(i,t,t.type,t.pendingProps,e);case 1:return n=t.type,s=Sn(n,t.pendingProps),ag(i,t,n,s,e);case 3:t:{if(mo(t,t.stateNode.containerInfo),i===null)throw Error(x(387));n=t.pendingProps;var a=t.memoizedState;s=a.element,wu(i,t),Sa(t,n,null,e);var r=t.memoizedState;if(n=r.cache,Ni(t,Ot,n),n!==a.cache&&Eu(t,[Ot],e,!0),Aa(),n=r.element,a.isDehydrated)if(a={element:n,isDehydrated:!1,cache:r.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=rg(i,t,n,e);break t}else if(n!==s){s=Oe(Error(x(424)),t),ka(s),t=rg(i,t,n,e);break t}else for(i=t.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,pt=ke(i.firstChild),jt=t,K=!0,Gi=null,Re=!0,e=km(t,null,n,e),t.child=e;e;)e.flags=e.flags&-3|4096,e=e.sibling;else{if(yn(),n===s){t=yi(i,t,e);break t}Ut(i,t,n,e)}t=t.child}return t;case 26:return lo(i,t),i===null?(e=Dg(t.type,null,t.pendingProps,null))?t.memoizedState=e:K||(e=t.type,i=t.pendingProps,n=Io(Ui.current).createElement(e),n[Gt]=t,n[ae]=i,Xt(n,e,i),Ft(n),t.stateNode=n):t.memoizedState=Dg(t.type,i.memoizedProps,t.pendingProps,i.memoizedState),null;case 27:return lu(t),i===null&&K&&(n=t.stateNode=py(t.type,t.pendingProps,Ui.current),jt=t,Re=!0,s=pt,en(t.type)?(Ku=s,pt=ke(n.firstChild)):pt=s),Ut(i,t,t.pendingProps.children,e),lo(i,t),i===null&&(t.flags|=4194304),t.child;case 5:return i===null&&K&&((s=n=pt)&&(n=A1(n,t.type,t.pendingProps,Re),n!==null?(t.stateNode=n,jt=t,pt=ke(n.firstChild),Re=!1,s=!0):s=!1),s||$i(t)),lu(t),s=t.type,a=t.pendingProps,r=i!==null?i.memoizedProps:null,n=a.children,Vu(s,a)?n=null:r!==null&&Vu(s,r)&&(t.flags|=32),t.memoizedState!==null&&(s=Ah(i,t,PA,null,null,e),Fa._currentValue=s),lo(i,t),Ut(i,t,n,e),t.child;case 6:return i===null&&K&&((i=e=pt)&&(e=S1(e,t.pendingProps,Re),e!==null?(t.stateNode=e,jt=t,pt=null,i=!0):i=!1),i||$i(t)),null;case 13:return E0(i,t,e);case 4:return mo(t,t.stateNode.containerInfo),n=t.pendingProps,i===null?t.child=vn(t,null,n,e):Ut(i,t,n,e),t.child;case 11:return tg(i,t,t.type,t.pendingProps,e);case 7:return Ut(i,t,t.pendingProps,e),t.child;case 8:return Ut(i,t,t.pendingProps.children,e),t.child;case 12:return Ut(i,t,t.pendingProps.children,e),t.child;case 10:return n=t.pendingProps,Ni(t,t.type,n.value),Ut(i,t,n.children,e),t.child;case 9:return s=t.type._context,n=t.pendingProps.children,bn(t),s=Vt(s),n=n(s),t.flags|=1,Ut(i,t,n,e),t.child;case 14:return eg(i,t,t.type,t.pendingProps,e);case 15:return A0(i,t,t.type,t.pendingProps,e);case 19:return T0(i,t,e);case 31:return XA(i,t,e);case 22:return S0(i,t,e,t.pendingProps);case 24:return bn(t),n=Vt(Ot),i===null?(s=gh(),s===null&&(s=ot,a=ph(),s.pooledCache=a,a.refCount++,a!==null&&(s.pooledCacheLanes|=e),s=a),t.memoizedState={parent:n,cache:s},yh(t),Ni(t,Ot,s)):((i.lanes&e)!==0&&(wu(i,t),Sa(t,null,null,e),Aa()),s=i.memoizedState,a=t.memoizedState,s.parent!==n?(s={parent:n,cache:n},t.memoizedState=s,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=s),Ni(t,Ot,n)):(n=a.cache,Ni(t,Ot,n),n!==s.cache&&Eu(t,[Ot],e,!0))),Ut(i,t,t.pendingProps.children,e),t.child;case 29:throw t.pendingProps}throw Error(x(156,t.tag))}function ii(i){i.flags|=4}function Xc(i,t,e,n,s){if((t=(i.mode&32)!==0)&&(t=!1),t){if(i.flags|=16777216,(s&335544128)===s)if(i.stateNode.complete)i.flags|=8192;else if(K0())i.flags|=8192;else throw gn=wo,mh}else i.flags&=-16777217}function lg(i,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!yy(t))if(K0())i.flags|=8192;else throw gn=wo,mh}function Yr(i,t){t!==null&&(i.flags|=4),i.flags&16384&&(t=i.tag!==22?Wg():536870912,i.lanes|=t,vs|=t)}function ra(i,t){if(!K)switch(i.tailMode){case"hidden":t=i.tail;for(var e=null;t!==null;)t.alternate!==null&&(e=t),t=t.sibling;e===null?i.tail=null:e.sibling=null;break;case"collapsed":e=i.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t||i.tail===null?i.tail=null:i.tail.sibling=null:n.sibling=null}}function ft(i){var t=i.alternate!==null&&i.alternate.child===i.child,e=0,n=0;if(t)for(var s=i.child;s!==null;)e|=s.lanes|s.childLanes,n|=s.subtreeFlags&65011712,n|=s.flags&65011712,s.return=i,s=s.sibling;else for(s=i.child;s!==null;)e|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=i,s=s.sibling;return i.subtreeFlags|=n,i.childLanes=e,t}function qA(i,t,e){var n=t.pendingProps;switch(fh(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ft(t),null;case 1:return ft(t),null;case 3:return e=t.stateNode,n=null,i!==null&&(n=i.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),di(Ot),fs(),e.pendingContext&&(e.context=e.pendingContext,e.pendingContext=null),(i===null||i.child===null)&&(Vn(t)?ii(t):i===null||i.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,zc())),ft(t),null;case 26:var s=t.type,a=t.memoizedState;return i===null?(ii(t),a!==null?(ft(t),lg(t,a)):(ft(t),Xc(t,s,null,n,e))):a?a!==i.memoizedState?(ii(t),ft(t),lg(t,a)):(ft(t),t.flags&=-16777217):(i=i.memoizedProps,i!==n&&ii(t),ft(t),Xc(t,s,i,n,e)),null;case 27:if(yo(t),e=Ui.current,s=t.type,i!==null&&t.stateNode!=null)i.memoizedProps!==n&&ii(t);else{if(!n){if(t.stateNode===null)throw Error(x(166));return ft(t),null}i=Ke.current,Vn(t)?Pp(t,i):(i=py(s,n,e),t.stateNode=i,ii(t))}return ft(t),null;case 5:if(yo(t),s=t.type,i!==null&&t.stateNode!=null)i.memoizedProps!==n&&ii(t);else{if(!n){if(t.stateNode===null)throw Error(x(166));return ft(t),null}if(a=Ke.current,Vn(t))Pp(t,a);else{var r=Io(Ui.current);switch(a){case 1:a=r.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:a=r.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":a=r.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":a=r.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":a=r.createElement("div"),a.innerHTML="<script><\/script>",a=a.removeChild(a.firstChild);break;case"select":a=typeof n.is=="string"?r.createElement("select",{is:n.is}):r.createElement("select"),n.multiple?a.multiple=!0:n.size&&(a.size=n.size);break;default:a=typeof n.is=="string"?r.createElement(s,{is:n.is}):r.createElement(s)}}a[Gt]=t,a[ae]=n;t:for(r=t.child;r!==null;){if(r.tag===5||r.tag===6)a.appendChild(r.stateNode);else if(r.tag!==4&&r.tag!==27&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break t;for(;r.sibling===null;){if(r.return===null||r.return===t)break t;r=r.return}r.sibling.return=r.return,r=r.sibling}t.stateNode=a;t:switch(Xt(a,s,n),s){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break t;case"img":n=!0;break t;default:n=!1}n&&ii(t)}}return ft(t),Xc(t,t.type,i===null?null:i.memoizedProps,t.pendingProps,e),null;case 6:if(i&&t.stateNode!=null)i.memoizedProps!==n&&ii(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(x(166));if(i=Ui.current,Vn(t)){if(i=t.stateNode,e=t.memoizedProps,n=null,s=jt,s!==null)switch(s.tag){case 27:case 5:n=s.memoizedProps}i[Gt]=t,i=!!(i.nodeValue===e||n!==null&&n.suppressHydrationWarning===!0||uy(i.nodeValue,e)),i||$i(t,!0)}else i=Io(i).createTextNode(n),i[Gt]=t,t.stateNode=i}return ft(t),null;case 31:if(e=t.memoizedState,i===null||i.memoizedState!==null){if(n=Vn(t),e!==null){if(i===null){if(!n)throw Error(x(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(x(557));i[Gt]=t}else yn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ft(t),i=!1}else e=zc(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=e),i=!0;if(!i)return t.flags&256?(ue(t),t):(ue(t),null);if((t.flags&128)!==0)throw Error(x(558))}return ft(t),null;case 13:if(n=t.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(s=Vn(t),n!==null&&n.dehydrated!==null){if(i===null){if(!s)throw Error(x(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(x(317));s[Gt]=t}else yn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ft(t),s=!1}else s=zc(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(ue(t),t):(ue(t),null)}return ue(t),(t.flags&128)!==0?(t.lanes=e,t):(e=n!==null,i=i!==null&&i.memoizedState!==null,e&&(n=t.child,s=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(s=n.alternate.memoizedState.cachePool.pool),a=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(a=n.memoizedState.cachePool.pool),a!==s&&(n.flags|=2048)),e!==i&&e&&(t.child.flags|=8192),Yr(t,t.updateQueue),ft(t),null);case 4:return fs(),i===null&&Hh(t.stateNode.containerInfo),ft(t),null;case 10:return di(t.type),ft(t),null;case 19:if(Ht(_t),n=t.memoizedState,n===null)return ft(t),null;if(s=(t.flags&128)!==0,a=n.rendering,a===null)if(s)ra(n,!1);else{if(wt!==0||i!==null&&(i.flags&128)!==0)for(i=t.child;i!==null;){if(a=xo(i),a!==null){for(t.flags|=128,ra(n,!1),i=a.updateQueue,t.updateQueue=i,Yr(t,i),t.subtreeFlags=0,i=e,e=t.child;e!==null;)_m(e,i),e=e.sibling;return ct(_t,_t.current&1|2),K&&ri(t,n.treeForkCount),t.child}i=i.sibling}n.tail!==null&&fe()>No&&(t.flags|=128,s=!0,ra(n,!1),t.lanes=4194304)}else{if(!s)if(i=xo(a),i!==null){if(t.flags|=128,s=!0,i=i.updateQueue,t.updateQueue=i,Yr(t,i),ra(n,!0),n.tail===null&&n.tailMode==="hidden"&&!a.alternate&&!K)return ft(t),null}else 2*fe()-n.renderingStartTime>No&&e!==536870912&&(t.flags|=128,s=!0,ra(n,!1),t.lanes=4194304);n.isBackwards?(a.sibling=t.child,t.child=a):(i=n.last,i!==null?i.sibling=a:t.child=a,n.last=a)}return n.tail!==null?(i=n.tail,n.rendering=i,n.tail=i.sibling,n.renderingStartTime=fe(),i.sibling=null,e=_t.current,ct(_t,s?e&1|2:e&1),K&&ri(t,n.treeForkCount),i):(ft(t),null);case 22:case 23:return ue(t),bh(),n=t.memoizedState!==null,i!==null?i.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(e&536870912)!==0&&(t.flags&128)===0&&(ft(t),t.subtreeFlags&6&&(t.flags|=8192)):ft(t),e=t.updateQueue,e!==null&&Yr(t,e.retryQueue),e=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(e=i.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==e&&(t.flags|=2048),i!==null&&Ht(pn),null;case 24:return e=null,i!==null&&(e=i.memoizedState.cache),t.memoizedState.cache!==e&&(t.flags|=2048),di(Ot),ft(t),null;case 25:return null;case 30:return null}throw Error(x(156,t.tag))}function KA(i,t){switch(fh(t),t.tag){case 1:return i=t.flags,i&65536?(t.flags=i&-65537|128,t):null;case 3:return di(Ot),fs(),i=t.flags,(i&65536)!==0&&(i&128)===0?(t.flags=i&-65537|128,t):null;case 26:case 27:case 5:return yo(t),null;case 31:if(t.memoizedState!==null){if(ue(t),t.alternate===null)throw Error(x(340));yn()}return i=t.flags,i&65536?(t.flags=i&-65537|128,t):null;case 13:if(ue(t),i=t.memoizedState,i!==null&&i.dehydrated!==null){if(t.alternate===null)throw Error(x(340));yn()}return i=t.flags,i&65536?(t.flags=i&-65537|128,t):null;case 19:return Ht(_t),null;case 4:return fs(),null;case 10:return di(t.type),null;case 22:case 23:return ue(t),bh(),i!==null&&Ht(pn),i=t.flags,i&65536?(t.flags=i&-65537|128,t):null;case 24:return di(Ot),null;case 25:return null;default:return null}}function _0(i,t){switch(fh(t),t.tag){case 3:di(Ot),fs();break;case 26:case 27:case 5:yo(t);break;case 4:fs();break;case 31:t.memoizedState!==null&&ue(t);break;case 13:ue(t);break;case 19:Ht(_t);break;case 10:di(t.type);break;case 22:case 23:ue(t),bh(),i!==null&&Ht(pn);break;case 24:di(Ot)}}function Qa(i,t){try{var e=t.updateQueue,n=e!==null?e.lastEffect:null;if(n!==null){var s=n.next;e=s;do{if((e.tag&i)===i){n=void 0;var a=e.create,r=e.inst;n=a(),r.destroy=n}e=e.next}while(e!==s)}}catch(o){it(t,t.return,o)}}function Zi(i,t,e){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var a=s.next;n=a;do{if((n.tag&i)===i){var r=n.inst,o=r.destroy;if(o!==void 0){r.destroy=void 0,s=t;var l=e,c=o;try{c()}catch(u){it(s,l,u)}}}n=n.next}while(n!==a)}}catch(u){it(t,t.return,u)}}function x0(i){var t=i.updateQueue;if(t!==null){var e=i.stateNode;try{Bm(t,e)}catch(n){it(i,i.return,n)}}}function C0(i,t,e){e.props=Sn(i.type,i.memoizedProps),e.state=i.memoizedState;try{e.componentWillUnmount()}catch(n){it(i,t,n)}}function Ta(i,t){try{var e=i.ref;if(e!==null){switch(i.tag){case 26:case 27:case 5:var n=i.stateNode;break;case 30:n=i.stateNode;break;default:n=i.stateNode}typeof e=="function"?i.refCleanup=e(n):e.current=n}}catch(s){it(i,t,s)}}function qe(i,t){var e=i.ref,n=i.refCleanup;if(e!==null)if(typeof n=="function")try{n()}catch(s){it(i,t,s)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(s){it(i,t,s)}else e.current=null}function M0(i){var t=i.type,e=i.memoizedProps,n=i.stateNode;try{t:switch(t){case"button":case"input":case"select":case"textarea":e.autoFocus&&n.focus();break t;case"img":e.src?n.src=e.src:e.srcSet&&(n.srcset=e.srcSet)}}catch(s){it(i,i.return,s)}}function Yc(i,t,e){try{var n=i.stateNode;p1(n,i.type,e,t),n[ae]=t}catch(s){it(i,i.return,s)}}function D0(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&en(i.type)||i.tag===4}function qc(i){t:for(;;){for(;i.sibling===null;){if(i.return===null||D0(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&en(i.type)||i.flags&2||i.child===null||i.tag===4)continue t;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Bu(i,t,e){var n=i.tag;if(n===5||n===6)i=i.stateNode,t?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(i,t):(t=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,t.appendChild(i),e=e._reactRootContainer,e!=null||t.onclick!==null||(t.onclick=ci));else if(n!==4&&(n===27&&en(i.type)&&(e=i.stateNode,t=null),i=i.child,i!==null))for(Bu(i,t,e),i=i.sibling;i!==null;)Bu(i,t,e),i=i.sibling}function Ro(i,t,e){var n=i.tag;if(n===5||n===6)i=i.stateNode,t?e.insertBefore(i,t):e.appendChild(i);else if(n!==4&&(n===27&&en(i.type)&&(e=i.stateNode),i=i.child,i!==null))for(Ro(i,t,e),i=i.sibling;i!==null;)Ro(i,t,e),i=i.sibling}function O0(i){var t=i.stateNode,e=i.memoizedProps;try{for(var n=i.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);Xt(t,n,e),t[Gt]=i,t[ae]=e}catch(a){it(i,i.return,a)}}var oi=!1,Dt=!1,Kc=!1,cg=typeof WeakSet=="function"?WeakSet:Set,It=null;function WA(i,t){if(i=i.containerInfo,Gu=Go,i=ym(i),lh(i)){if("selectionStart"in i)var e={start:i.selectionStart,end:i.selectionEnd};else t:{e=(e=i.ownerDocument)&&e.defaultView||window;var n=e.getSelection&&e.getSelection();if(n&&n.rangeCount!==0){e=n.anchorNode;var s=n.anchorOffset,a=n.focusNode;n=n.focusOffset;try{e.nodeType,a.nodeType}catch{e=null;break t}var r=0,o=-1,l=-1,c=0,u=0,h=i,d=null;e:for(;;){for(var f;h!==e||s!==0&&h.nodeType!==3||(o=r+s),h!==a||n!==0&&h.nodeType!==3||(l=r+n),h.nodeType===3&&(r+=h.nodeValue.length),(f=h.firstChild)!==null;)d=h,h=f;for(;;){if(h===i)break e;if(d===e&&++c===s&&(o=r),d===a&&++u===n&&(l=r),(f=h.nextSibling)!==null)break;h=d,d=h.parentNode}h=f}e=o===-1||l===-1?null:{start:o,end:l}}else e=null}e=e||{start:0,end:0}}else e=null;for(ju={focusedElem:i,selectionRange:e},Go=!1,It=t;It!==null;)if(t=It,i=t.child,(t.subtreeFlags&1028)!==0&&i!==null)i.return=t,It=i;else for(;It!==null;){switch(t=It,a=t.alternate,i=t.flags,t.tag){case 0:if((i&4)!==0&&(i=t.updateQueue,i=i!==null?i.events:null,i!==null))for(e=0;e<i.length;e++)s=i[e],s.ref.impl=s.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&a!==null){i=void 0,e=t,s=a.memoizedProps,a=a.memoizedState,n=e.stateNode;try{var m=Sn(e.type,s);i=n.getSnapshotBeforeUpdate(m,a),n.__reactInternalSnapshotBeforeUpdate=i}catch(y){it(e,e.return,y)}}break;case 3:if((i&1024)!==0){if(i=t.stateNode.containerInfo,e=i.nodeType,e===9)Xu(i);else if(e===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Xu(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(x(163))}if(i=t.sibling,i!==null){i.return=t.return,It=i;break}It=t.return}}function R0(i,t,e){var n=e.flags;switch(e.tag){case 0:case 11:case 15:si(i,e),n&4&&Qa(5,e);break;case 1:if(si(i,e),n&4)if(i=e.stateNode,t===null)try{i.componentDidMount()}catch(r){it(e,e.return,r)}else{var s=Sn(e.type,t.memoizedProps);t=t.memoizedState;try{i.componentDidUpdate(s,t,i.__reactInternalSnapshotBeforeUpdate)}catch(r){it(e,e.return,r)}}n&64&&x0(e),n&512&&Ta(e,e.return);break;case 3:if(si(i,e),n&64&&(i=e.updateQueue,i!==null)){if(t=null,e.child!==null)switch(e.child.tag){case 27:case 5:t=e.child.stateNode;break;case 1:t=e.child.stateNode}try{Bm(i,t)}catch(r){it(e,e.return,r)}}break;case 27:t===null&&n&4&&O0(e);case 26:case 5:si(i,e),t===null&&n&4&&M0(e),n&512&&Ta(e,e.return);break;case 12:si(i,e);break;case 31:si(i,e),n&4&&L0(i,e);break;case 13:si(i,e),n&4&&B0(i,e),n&64&&(i=e.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(e=s1.bind(null,e),E1(i,e))));break;case 22:if(n=e.memoizedState!==null||oi,!n){t=t!==null&&t.memoizedState!==null||Dt,s=oi;var a=Dt;oi=n,(Dt=t)&&!a?ai(i,e,(e.subtreeFlags&8772)!==0):si(i,e),oi=s,Dt=a}break;case 30:break;default:si(i,e)}}function N0(i){var t=i.alternate;t!==null&&(i.alternate=null,N0(t)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(t=i.stateNode,t!==null&&ih(t)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var yt=null,ie=!1;function ni(i,t,e){for(e=e.child;e!==null;)k0(i,t,e),e=e.sibling}function k0(i,t,e){if(pe&&typeof pe.onCommitFiberUnmount=="function")try{pe.onCommitFiberUnmount(ja,e)}catch{}switch(e.tag){case 26:Dt||qe(e,t),ni(i,t,e),e.memoizedState?e.memoizedState.count--:e.stateNode&&(e=e.stateNode,e.parentNode.removeChild(e));break;case 27:Dt||qe(e,t);var n=yt,s=ie;en(e.type)&&(yt=e.stateNode,ie=!1),ni(i,t,e),Ca(e.stateNode),yt=n,ie=s;break;case 5:Dt||qe(e,t);case 6:if(n=yt,s=ie,yt=null,ni(i,t,e),yt=n,ie=s,yt!==null)if(ie)try{(yt.nodeType===9?yt.body:yt.nodeName==="HTML"?yt.ownerDocument.body:yt).removeChild(e.stateNode)}catch(a){it(e,t,a)}else try{yt.removeChild(e.stateNode)}catch(a){it(e,t,a)}break;case 18:yt!==null&&(ie?(i=yt,wg(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,e.stateNode),Ts(i)):wg(yt,e.stateNode));break;case 4:n=yt,s=ie,yt=e.stateNode.containerInfo,ie=!0,ni(i,t,e),yt=n,ie=s;break;case 0:case 11:case 14:case 15:Zi(2,e,t),Dt||Zi(4,e,t),ni(i,t,e);break;case 1:Dt||(qe(e,t),n=e.stateNode,typeof n.componentWillUnmount=="function"&&C0(e,t,n)),ni(i,t,e);break;case 21:ni(i,t,e);break;case 22:Dt=(n=Dt)||e.memoizedState!==null,ni(i,t,e),Dt=n;break;default:ni(i,t,e)}}function L0(i,t){if(t.memoizedState===null&&(i=t.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Ts(i)}catch(e){it(t,t.return,e)}}}function B0(i,t){if(t.memoizedState===null&&(i=t.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Ts(i)}catch(e){it(t,t.return,e)}}function QA(i){switch(i.tag){case 31:case 13:case 19:var t=i.stateNode;return t===null&&(t=i.stateNode=new cg),t;case 22:return i=i.stateNode,t=i._retryCache,t===null&&(t=i._retryCache=new cg),t;default:throw Error(x(435,i.tag))}}function qr(i,t){var e=QA(i);t.forEach(function(n){if(!e.has(n)){e.add(n);var s=a1.bind(null,i,n);n.then(s,s)}})}function te(i,t){var e=t.deletions;if(e!==null)for(var n=0;n<e.length;n++){var s=e[n],a=i,r=t,o=r;t:for(;o!==null;){switch(o.tag){case 27:if(en(o.type)){yt=o.stateNode,ie=!1;break t}break;case 5:yt=o.stateNode,ie=!1;break t;case 3:case 4:yt=o.stateNode.containerInfo,ie=!0;break t}o=o.return}if(yt===null)throw Error(x(160));k0(a,r,s),yt=null,ie=!1,a=s.alternate,a!==null&&(a.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)z0(t,i),t=t.sibling}var Fe=null;function z0(i,t){var e=i.alternate,n=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:te(t,i),ee(i),n&4&&(Zi(3,i,i.return),Qa(3,i),Zi(5,i,i.return));break;case 1:te(t,i),ee(i),n&512&&(Dt||e===null||qe(e,e.return)),n&64&&oi&&(i=i.updateQueue,i!==null&&(n=i.callbacks,n!==null&&(e=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=e===null?n:e.concat(n))));break;case 26:var s=Fe;if(te(t,i),ee(i),n&512&&(Dt||e===null||qe(e,e.return)),n&4){var a=e!==null?e.memoizedState:null;if(n=i.memoizedState,e===null)if(n===null)if(i.stateNode===null){t:{n=i.type,e=i.memoizedProps,s=s.ownerDocument||s;e:switch(n){case"title":a=s.getElementsByTagName("title")[0],(!a||a[Ya]||a[Gt]||a.namespaceURI==="http://www.w3.org/2000/svg"||a.hasAttribute("itemprop"))&&(a=s.createElement(n),s.head.insertBefore(a,s.querySelector("head > title"))),Xt(a,n,e),a[Gt]=i,Ft(a),n=a;break t;case"link":var r=Rg("link","href",s).get(n+(e.href||""));if(r){for(var o=0;o<r.length;o++)if(a=r[o],a.getAttribute("href")===(e.href==null||e.href===""?null:e.href)&&a.getAttribute("rel")===(e.rel==null?null:e.rel)&&a.getAttribute("title")===(e.title==null?null:e.title)&&a.getAttribute("crossorigin")===(e.crossOrigin==null?null:e.crossOrigin)){r.splice(o,1);break e}}a=s.createElement(n),Xt(a,n,e),s.head.appendChild(a);break;case"meta":if(r=Rg("meta","content",s).get(n+(e.content||""))){for(o=0;o<r.length;o++)if(a=r[o],a.getAttribute("content")===(e.content==null?null:""+e.content)&&a.getAttribute("name")===(e.name==null?null:e.name)&&a.getAttribute("property")===(e.property==null?null:e.property)&&a.getAttribute("http-equiv")===(e.httpEquiv==null?null:e.httpEquiv)&&a.getAttribute("charset")===(e.charSet==null?null:e.charSet)){r.splice(o,1);break e}}a=s.createElement(n),Xt(a,n,e),s.head.appendChild(a);break;default:throw Error(x(468,n))}a[Gt]=i,Ft(a),n=a}i.stateNode=n}else Ng(s,i.type,i.stateNode);else i.stateNode=Og(s,n,i.memoizedProps);else a!==n?(a===null?e.stateNode!==null&&(e=e.stateNode,e.parentNode.removeChild(e)):a.count--,n===null?Ng(s,i.type,i.stateNode):Og(s,n,i.memoizedProps)):n===null&&i.stateNode!==null&&Yc(i,i.memoizedProps,e.memoizedProps)}break;case 27:te(t,i),ee(i),n&512&&(Dt||e===null||qe(e,e.return)),e!==null&&n&4&&Yc(i,i.memoizedProps,e.memoizedProps);break;case 5:if(te(t,i),ee(i),n&512&&(Dt||e===null||qe(e,e.return)),i.flags&32){s=i.stateNode;try{gs(s,"")}catch(m){it(i,i.return,m)}}n&4&&i.stateNode!=null&&(s=i.memoizedProps,Yc(i,s,e!==null?e.memoizedProps:s)),n&1024&&(Kc=!0);break;case 6:if(te(t,i),ee(i),n&4){if(i.stateNode===null)throw Error(x(162));n=i.memoizedProps,e=i.stateNode;try{e.nodeValue=n}catch(m){it(i,i.return,m)}}break;case 3:if(ho=null,s=Fe,Fe=Fo(t.containerInfo),te(t,i),Fe=s,ee(i),n&4&&e!==null&&e.memoizedState.isDehydrated)try{Ts(t.containerInfo)}catch(m){it(i,i.return,m)}Kc&&(Kc=!1,P0(i));break;case 4:n=Fe,Fe=Fo(i.stateNode.containerInfo),te(t,i),ee(i),Fe=n;break;case 12:te(t,i),ee(i);break;case 31:te(t,i),ee(i),n&4&&(n=i.updateQueue,n!==null&&(i.updateQueue=null,qr(i,n)));break;case 13:te(t,i),ee(i),i.child.flags&8192&&i.memoizedState!==null!=(e!==null&&e.memoizedState!==null)&&(el=fe()),n&4&&(n=i.updateQueue,n!==null&&(i.updateQueue=null,qr(i,n)));break;case 22:s=i.memoizedState!==null;var l=e!==null&&e.memoizedState!==null,c=oi,u=Dt;if(oi=c||s,Dt=u||l,te(t,i),Dt=u,oi=c,ee(i),n&8192)t:for(t=i.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(e===null||l||oi||Dt||hn(i)),e=null,t=i;;){if(t.tag===5||t.tag===26){if(e===null){l=e=t;try{if(a=l.stateNode,s)r=a.style,typeof r.setProperty=="function"?r.setProperty("display","none","important"):r.display="none";else{o=l.stateNode;var h=l.memoizedProps.style,d=h!=null&&h.hasOwnProperty("display")?h.display:null;o.style.display=d==null||typeof d=="boolean"?"":(""+d).trim()}}catch(m){it(l,l.return,m)}}}else if(t.tag===6){if(e===null){l=t;try{l.stateNode.nodeValue=s?"":l.memoizedProps}catch(m){it(l,l.return,m)}}}else if(t.tag===18){if(e===null){l=t;try{var f=l.stateNode;s?_g(f,!0):_g(l.stateNode,!1)}catch(m){it(l,l.return,m)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===i)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===i)break t;for(;t.sibling===null;){if(t.return===null||t.return===i)break t;e===t&&(e=null),t=t.return}e===t&&(e=null),t.sibling.return=t.return,t=t.sibling}n&4&&(n=i.updateQueue,n!==null&&(e=n.retryQueue,e!==null&&(n.retryQueue=null,qr(i,e))));break;case 19:te(t,i),ee(i),n&4&&(n=i.updateQueue,n!==null&&(i.updateQueue=null,qr(i,n)));break;case 30:break;case 21:break;default:te(t,i),ee(i)}}function ee(i){var t=i.flags;if(t&2){try{for(var e,n=i.return;n!==null;){if(D0(n)){e=n;break}n=n.return}if(e==null)throw Error(x(160));switch(e.tag){case 27:var s=e.stateNode,a=qc(i);Ro(i,a,s);break;case 5:var r=e.stateNode;e.flags&32&&(gs(r,""),e.flags&=-33);var o=qc(i);Ro(i,o,r);break;case 3:case 4:var l=e.stateNode.containerInfo,c=qc(i);Bu(i,c,l);break;default:throw Error(x(161))}}catch(u){it(i,i.return,u)}i.flags&=-3}t&4096&&(i.flags&=-4097)}function P0(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var t=i;P0(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),i=i.sibling}}function si(i,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)R0(i,t.alternate,t),t=t.sibling}function hn(i){for(i=i.child;i!==null;){var t=i;switch(t.tag){case 0:case 11:case 14:case 15:Zi(4,t,t.return),hn(t);break;case 1:qe(t,t.return);var e=t.stateNode;typeof e.componentWillUnmount=="function"&&C0(t,t.return,e),hn(t);break;case 27:Ca(t.stateNode);case 26:case 5:qe(t,t.return),hn(t);break;case 22:t.memoizedState===null&&hn(t);break;case 30:hn(t);break;default:hn(t)}i=i.sibling}}function ai(i,t,e){for(e=e&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var n=t.alternate,s=i,a=t,r=a.flags;switch(a.tag){case 0:case 11:case 15:ai(s,a,e),Qa(4,a);break;case 1:if(ai(s,a,e),n=a,s=n.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(c){it(n,n.return,c)}if(n=a,s=n.updateQueue,s!==null){var o=n.stateNode;try{var l=s.shared.hiddenCallbacks;if(l!==null)for(s.shared.hiddenCallbacks=null,s=0;s<l.length;s++)Lm(l[s],o)}catch(c){it(n,n.return,c)}}e&&r&64&&x0(a),Ta(a,a.return);break;case 27:O0(a);case 26:case 5:ai(s,a,e),e&&n===null&&r&4&&M0(a),Ta(a,a.return);break;case 12:ai(s,a,e);break;case 31:ai(s,a,e),e&&r&4&&L0(s,a);break;case 13:ai(s,a,e),e&&r&4&&B0(s,a);break;case 22:a.memoizedState===null&&ai(s,a,e),Ta(a,a.return);break;case 30:break;default:ai(s,a,e)}t=t.sibling}}function Lh(i,t){var e=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(e=i.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==e&&(i!=null&&i.refCount++,e!=null&&Ka(e))}function Bh(i,t){i=null,t.alternate!==null&&(i=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==i&&(t.refCount++,i!=null&&Ka(i))}function Ie(i,t,e,n){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)I0(i,t,e,n),t=t.sibling}function I0(i,t,e,n){var s=t.flags;switch(t.tag){case 0:case 11:case 15:Ie(i,t,e,n),s&2048&&Qa(9,t);break;case 1:Ie(i,t,e,n);break;case 3:Ie(i,t,e,n),s&2048&&(i=null,t.alternate!==null&&(i=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==i&&(t.refCount++,i!=null&&Ka(i)));break;case 12:if(s&2048){Ie(i,t,e,n),i=t.stateNode;try{var a=t.memoizedProps,r=a.id,o=a.onPostCommit;typeof o=="function"&&o(r,t.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(l){it(t,t.return,l)}}else Ie(i,t,e,n);break;case 31:Ie(i,t,e,n);break;case 13:Ie(i,t,e,n);break;case 23:break;case 22:a=t.stateNode,r=t.alternate,t.memoizedState!==null?a._visibility&2?Ie(i,t,e,n):wa(i,t):a._visibility&2?Ie(i,t,e,n):(a._visibility|=2,Yn(i,t,e,n,(t.subtreeFlags&10256)!==0||!1)),s&2048&&Lh(r,t);break;case 24:Ie(i,t,e,n),s&2048&&Bh(t.alternate,t);break;default:Ie(i,t,e,n)}}function Yn(i,t,e,n,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var a=i,r=t,o=e,l=n,c=r.flags;switch(r.tag){case 0:case 11:case 15:Yn(a,r,o,l,s),Qa(8,r);break;case 23:break;case 22:var u=r.stateNode;r.memoizedState!==null?u._visibility&2?Yn(a,r,o,l,s):wa(a,r):(u._visibility|=2,Yn(a,r,o,l,s)),s&&c&2048&&Lh(r.alternate,r);break;case 24:Yn(a,r,o,l,s),s&&c&2048&&Bh(r.alternate,r);break;default:Yn(a,r,o,l,s)}t=t.sibling}}function wa(i,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var e=i,n=t,s=n.flags;switch(n.tag){case 22:wa(e,n),s&2048&&Lh(n.alternate,n);break;case 24:wa(e,n),s&2048&&Bh(n.alternate,n);break;default:wa(e,n)}t=t.sibling}}var pa=8192;function Xn(i,t,e){if(i.subtreeFlags&pa)for(i=i.child;i!==null;)F0(i,t,e),i=i.sibling}function F0(i,t,e){switch(i.tag){case 26:Xn(i,t,e),i.flags&pa&&i.memoizedState!==null&&L1(e,Fe,i.memoizedState,i.memoizedProps);break;case 5:Xn(i,t,e);break;case 3:case 4:var n=Fe;Fe=Fo(i.stateNode.containerInfo),Xn(i,t,e),Fe=n;break;case 22:i.memoizedState===null&&(n=i.alternate,n!==null&&n.memoizedState!==null?(n=pa,pa=16777216,Xn(i,t,e),pa=n):Xn(i,t,e));break;default:Xn(i,t,e)}}function H0(i){var t=i.alternate;if(t!==null&&(i=t.child,i!==null)){t.child=null;do t=i.sibling,i.sibling=null,i=t;while(i!==null)}}function oa(i){var t=i.deletions;if((i.flags&16)!==0){if(t!==null)for(var e=0;e<t.length;e++){var n=t[e];It=n,G0(n,i)}H0(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)U0(i),i=i.sibling}function U0(i){switch(i.tag){case 0:case 11:case 15:oa(i),i.flags&2048&&Zi(9,i,i.return);break;case 3:oa(i);break;case 12:oa(i);break;case 22:var t=i.stateNode;i.memoizedState!==null&&t._visibility&2&&(i.return===null||i.return.tag!==13)?(t._visibility&=-3,co(i)):oa(i);break;default:oa(i)}}function co(i){var t=i.deletions;if((i.flags&16)!==0){if(t!==null)for(var e=0;e<t.length;e++){var n=t[e];It=n,G0(n,i)}H0(i)}for(i=i.child;i!==null;){switch(t=i,t.tag){case 0:case 11:case 15:Zi(8,t,t.return),co(t);break;case 22:e=t.stateNode,e._visibility&2&&(e._visibility&=-3,co(t));break;default:co(t)}i=i.sibling}}function G0(i,t){for(;It!==null;){var e=It;switch(e.tag){case 0:case 11:case 15:Zi(8,e,t);break;case 23:case 22:if(e.memoizedState!==null&&e.memoizedState.cachePool!==null){var n=e.memoizedState.cachePool.pool;n!=null&&n.refCount++}break;case 24:Ka(e.memoizedState.cache)}if(n=e.child,n!==null)n.return=e,It=n;else t:for(e=i;It!==null;){n=It;var s=n.sibling,a=n.return;if(N0(n),n===e){It=null;break t}if(s!==null){s.return=a,It=s;break t}It=a}}}var $A={getCacheForType:function(i){var t=Vt(Ot),e=t.data.get(i);return e===void 0&&(e=i(),t.data.set(i,e)),e},cacheSignal:function(){return Vt(Ot).controller.signal}},ZA=typeof WeakMap=="function"?WeakMap:Map,$=0,ot=null,V=null,Y=0,et=0,ce=null,Ii=!1,Ms=!1,zh=!1,bi=0,wt=0,Ji=0,mn=0,Ph=0,de=0,vs=0,_a=null,ne=null,zu=!1,el=0,j0=0,No=1/0,ko=null,Xi=null,Bt=0,Yi=null,As=null,fi=0,Pu=0,Iu=null,V0=null,xa=0,Fu=null;function me(){return($&2)!==0&&Y!==0?Y&-Y:B.T!==null?Fh():Jg()}function X0(){if(de===0)if((Y&536870912)===0||K){var i=Pr;Pr<<=1,(Pr&3932160)===0&&(Pr=262144),de=i}else de=536870912;return i=be.current,i!==null&&(i.flags|=32),de}function se(i,t,e){(i===ot&&(et===2||et===9)||i.cancelPendingCommit!==null)&&(Ss(i,0),Fi(i,Y,de,!1)),Xa(i,e),(($&2)===0||i!==ot)&&(i===ot&&(($&2)===0&&(mn|=e),wt===4&&Fi(i,Y,de,!1)),Qe(i))}function Y0(i,t,e){if(($&6)!==0)throw Error(x(327));var n=!e&&(t&127)===0&&(t&i.expiredLanes)===0||Va(i,t),s=n?e1(i,t):Wc(i,t,!0),a=n;do{if(s===0){Ms&&!n&&Fi(i,t,0,!1);break}else{if(e=i.current.alternate,a&&!JA(e)){s=Wc(i,t,!1),a=!1;continue}if(s===2){if(a=t,i.errorRecoveryDisabledLanes&a)var r=0;else r=i.pendingLanes&-536870913,r=r!==0?r:r&536870912?536870912:0;if(r!==0){t=r;t:{var o=i;s=_a;var l=o.current.memoizedState.isDehydrated;if(l&&(Ss(o,r).flags|=256),r=Wc(o,r,!1),r!==2){if(zh&&!l){o.errorRecoveryDisabledLanes|=a,mn|=a,s=4;break t}a=ne,ne=s,a!==null&&(ne===null?ne=a:ne.push.apply(ne,a))}s=r}if(a=!1,s!==2)continue}}if(s===1){Ss(i,0),Fi(i,t,0,!0);break}t:{switch(n=i,a=s,a){case 0:case 1:throw Error(x(345));case 4:if((t&4194048)!==t)break;case 6:Fi(n,t,de,!Ii);break t;case 2:ne=null;break;case 3:case 5:break;default:throw Error(x(329))}if((t&62914560)===t&&(s=el+300-fe(),10<s)){if(Fi(n,t,de,!Ii),Vo(n,0,!0)!==0)break t;fi=t,n.timeoutHandle=dy(ug.bind(null,n,e,ne,ko,zu,t,de,mn,vs,Ii,a,"Throttled",-0,0),s);break t}ug(n,e,ne,ko,zu,t,de,mn,vs,Ii,a,null,-0,0)}}break}while(!0);Qe(i)}function ug(i,t,e,n,s,a,r,o,l,c,u,h,d,f){if(i.timeoutHandle=-1,h=t.subtreeFlags,h&8192||(h&16785408)===16785408){h={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ci},F0(t,a,h);var m=(a&62914560)===a?el-fe():(a&4194048)===a?j0-fe():0;if(m=B1(h,m),m!==null){fi=a,i.cancelPendingCommit=m(dg.bind(null,i,t,a,e,n,s,r,o,l,u,h,null,d,f)),Fi(i,a,r,!c);return}}dg(i,t,a,e,n,s,r,o,l)}function JA(i){for(var t=i;;){var e=t.tag;if((e===0||e===11||e===15)&&t.flags&16384&&(e=t.updateQueue,e!==null&&(e=e.stores,e!==null)))for(var n=0;n<e.length;n++){var s=e[n],a=s.getSnapshot;s=s.value;try{if(!ye(a(),s))return!1}catch{return!1}}if(e=t.child,t.subtreeFlags&16384&&e!==null)e.return=t,t=e;else{if(t===i)break;for(;t.sibling===null;){if(t.return===null||t.return===i)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Fi(i,t,e,n){t&=~Ph,t&=~mn,i.suspendedLanes|=t,i.pingedLanes&=~t,n&&(i.warmLanes|=t),n=i.expirationTimes;for(var s=t;0<s;){var a=31-ge(s),r=1<<a;n[a]=-1,s&=~r}e!==0&&Qg(i,e,t)}function il(){return($&6)===0?($a(0,!1),!1):!0}function Ih(){if(V!==null){if(et===0)var i=V.return;else i=V,ui=xn=null,Th(i),us=null,La=0,i=V;for(;i!==null;)_0(i.alternate,i),i=i.return;V=null}}function Ss(i,t){var e=i.timeoutHandle;e!==-1&&(i.timeoutHandle=-1,y1(e)),e=i.cancelPendingCommit,e!==null&&(i.cancelPendingCommit=null,e()),fi=0,Ih(),ot=i,V=e=hi(i.current,null),Y=t,et=0,ce=null,Ii=!1,Ms=Va(i,t),zh=!1,vs=de=Ph=mn=Ji=wt=0,ne=_a=null,zu=!1,(t&8)!==0&&(t|=t&32);var n=i.entangledLanes;if(n!==0)for(i=i.entanglements,n&=t;0<n;){var s=31-ge(n),a=1<<s;t|=i[s],n&=~a}return bi=t,Ko(),e}function q0(i,t){U=null,B.H=za,t===Cs||t===Qo?(t=Gp(),et=3):t===mh?(t=Gp(),et=4):et=t===Nh?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,ce=t,V===null&&(wt=1,Do(i,Oe(t,i.current)))}function K0(){var i=be.current;return i===null?!0:(Y&4194048)===Y?Ne===null:(Y&62914560)===Y||(Y&536870912)!==0?i===Ne:!1}function W0(){var i=B.H;return B.H=za,i===null?za:i}function Q0(){var i=B.A;return B.A=$A,i}function Lo(){wt=4,Ii||(Y&4194048)!==Y&&be.current!==null||(Ms=!0),(Ji&134217727)===0&&(mn&134217727)===0||ot===null||Fi(ot,Y,de,!1)}function Wc(i,t,e){var n=$;$|=2;var s=W0(),a=Q0();(ot!==i||Y!==t)&&(ko=null,Ss(i,t)),t=!1;var r=wt;t:do try{if(et!==0&&V!==null){var o=V,l=ce;switch(et){case 8:Ih(),r=6;break t;case 3:case 2:case 9:case 6:be.current===null&&(t=!0);var c=et;if(et=0,ce=null,as(i,o,l,c),e&&Ms){r=0;break t}break;default:c=et,et=0,ce=null,as(i,o,l,c)}}t1(),r=wt;break}catch(u){q0(i,u)}while(!0);return t&&i.shellSuspendCounter++,ui=xn=null,$=n,B.H=s,B.A=a,V===null&&(ot=null,Y=0,Ko()),r}function t1(){for(;V!==null;)$0(V)}function e1(i,t){var e=$;$|=2;var n=W0(),s=Q0();ot!==i||Y!==t?(ko=null,No=fe()+500,Ss(i,t)):Ms=Va(i,t);t:do try{if(et!==0&&V!==null){t=V;var a=ce;e:switch(et){case 1:et=0,ce=null,as(i,t,a,1);break;case 2:case 9:if(Up(a)){et=0,ce=null,hg(t);break}t=function(){et!==2&&et!==9||ot!==i||(et=7),Qe(i)},a.then(t,t);break t;case 3:et=7;break t;case 4:et=5;break t;case 7:Up(a)?(et=0,ce=null,hg(t)):(et=0,ce=null,as(i,t,a,7));break;case 5:var r=null;switch(V.tag){case 26:r=V.memoizedState;case 5:case 27:var o=V;if(r?yy(r):o.stateNode.complete){et=0,ce=null;var l=o.sibling;if(l!==null)V=l;else{var c=o.return;c!==null?(V=c,nl(c)):V=null}break e}}et=0,ce=null,as(i,t,a,5);break;case 6:et=0,ce=null,as(i,t,a,6);break;case 8:Ih(),wt=6;break t;default:throw Error(x(462))}}i1();break}catch(u){q0(i,u)}while(!0);return ui=xn=null,B.H=n,B.A=s,$=e,V!==null?0:(ot=null,Y=0,Ko(),wt)}function i1(){for(;V!==null&&!_v();)$0(V)}function $0(i){var t=w0(i.alternate,i,bi);i.memoizedProps=i.pendingProps,t===null?nl(i):V=t}function hg(i){var t=i,e=t.alternate;switch(t.tag){case 15:case 0:t=sg(e,t,t.pendingProps,t.type,void 0,Y);break;case 11:t=sg(e,t,t.pendingProps,t.type.render,t.ref,Y);break;case 5:Th(t);default:_0(e,t),t=V=_m(t,bi),t=w0(e,t,bi)}i.memoizedProps=i.pendingProps,t===null?nl(i):V=t}function as(i,t,e,n){ui=xn=null,Th(t),us=null,La=0;var s=t.return;try{if(VA(i,s,t,e,Y)){wt=1,Do(i,Oe(e,i.current)),V=null;return}}catch(a){if(s!==null)throw V=s,a;wt=1,Do(i,Oe(e,i.current)),V=null;return}t.flags&32768?(K||n===1?i=!0:Ms||(Y&536870912)!==0?i=!1:(Ii=i=!0,(n===2||n===9||n===3||n===6)&&(n=be.current,n!==null&&n.tag===13&&(n.flags|=16384))),Z0(t,i)):nl(t)}function nl(i){var t=i;do{if((t.flags&32768)!==0){Z0(t,Ii);return}i=t.return;var e=qA(t.alternate,t,bi);if(e!==null){V=e;return}if(t=t.sibling,t!==null){V=t;return}V=t=i}while(t!==null);wt===0&&(wt=5)}function Z0(i,t){do{var e=KA(i.alternate,i);if(e!==null){e.flags&=32767,V=e;return}if(e=i.return,e!==null&&(e.flags|=32768,e.subtreeFlags=0,e.deletions=null),!t&&(i=i.sibling,i!==null)){V=i;return}V=i=e}while(i!==null);wt=6,V=null}function dg(i,t,e,n,s,a,r,o,l){i.cancelPendingCommit=null;do sl();while(Bt!==0);if(($&6)!==0)throw Error(x(327));if(t!==null){if(t===i.current)throw Error(x(177));if(a=t.lanes|t.childLanes,a|=ch,Bv(i,e,a,r,o,l),i===ot&&(V=ot=null,Y=0),As=t,Yi=i,fi=e,Pu=a,Iu=s,V0=n,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,r1(bo,function(){return ny(),null})):(i.callbackNode=null,i.callbackPriority=0),n=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||n){n=B.T,B.T=null,s=Z.p,Z.p=2,r=$,$|=4;try{WA(i,t,e)}finally{$=r,Z.p=s,B.T=n}}Bt=1,J0(),ty(),ey()}}function J0(){if(Bt===1){Bt=0;var i=Yi,t=As,e=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||e){e=B.T,B.T=null;var n=Z.p;Z.p=2;var s=$;$|=4;try{z0(t,i);var a=ju,r=ym(i.containerInfo),o=a.focusedElem,l=a.selectionRange;if(r!==o&&o&&o.ownerDocument&&mm(o.ownerDocument.documentElement,o)){if(l!==null&&lh(o)){var c=l.start,u=l.end;if(u===void 0&&(u=c),"selectionStart"in o)o.selectionStart=c,o.selectionEnd=Math.min(u,o.value.length);else{var h=o.ownerDocument||document,d=h&&h.defaultView||window;if(d.getSelection){var f=d.getSelection(),m=o.textContent.length,y=Math.min(l.start,m),v=l.end===void 0?y:Math.min(l.end,m);!f.extend&&y>v&&(r=v,v=y,y=r);var p=Lp(o,y),g=Lp(o,v);if(p&&g&&(f.rangeCount!==1||f.anchorNode!==p.node||f.anchorOffset!==p.offset||f.focusNode!==g.node||f.focusOffset!==g.offset)){var b=h.createRange();b.setStart(p.node,p.offset),f.removeAllRanges(),y>v?(f.addRange(b),f.extend(g.node,g.offset)):(b.setEnd(g.node,g.offset),f.addRange(b))}}}}for(h=[],f=o;f=f.parentNode;)f.nodeType===1&&h.push({element:f,left:f.scrollLeft,top:f.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<h.length;o++){var A=h[o];A.element.scrollLeft=A.left,A.element.scrollTop=A.top}}Go=!!Gu,ju=Gu=null}finally{$=s,Z.p=n,B.T=e}}i.current=t,Bt=2}}function ty(){if(Bt===2){Bt=0;var i=Yi,t=As,e=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||e){e=B.T,B.T=null;var n=Z.p;Z.p=2;var s=$;$|=4;try{R0(i,t.alternate,t)}finally{$=s,Z.p=n,B.T=e}}Bt=3}}function ey(){if(Bt===4||Bt===3){Bt=0,xv();var i=Yi,t=As,e=fi,n=V0;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Bt=5:(Bt=0,As=Yi=null,iy(i,i.pendingLanes));var s=i.pendingLanes;if(s===0&&(Xi=null),eh(e),t=t.stateNode,pe&&typeof pe.onCommitFiberRoot=="function")try{pe.onCommitFiberRoot(ja,t,void 0,(t.current.flags&128)===128)}catch{}if(n!==null){t=B.T,s=Z.p,Z.p=2,B.T=null;try{for(var a=i.onRecoverableError,r=0;r<n.length;r++){var o=n[r];a(o.value,{componentStack:o.stack})}}finally{B.T=t,Z.p=s}}(fi&3)!==0&&sl(),Qe(i),s=i.pendingLanes,(e&261930)!==0&&(s&42)!==0?i===Fu?xa++:(xa=0,Fu=i):xa=0,$a(0,!1)}}function iy(i,t){(i.pooledCacheLanes&=t)===0&&(t=i.pooledCache,t!=null&&(i.pooledCache=null,Ka(t)))}function sl(){return J0(),ty(),ey(),ny()}function ny(){if(Bt!==5)return!1;var i=Yi,t=Pu;Pu=0;var e=eh(fi),n=B.T,s=Z.p;try{Z.p=32>e?32:e,B.T=null,e=Iu,Iu=null;var a=Yi,r=fi;if(Bt=0,As=Yi=null,fi=0,($&6)!==0)throw Error(x(331));var o=$;if($|=4,U0(a.current),I0(a,a.current,r,e),$=o,$a(0,!1),pe&&typeof pe.onPostCommitFiberRoot=="function")try{pe.onPostCommitFiberRoot(ja,a)}catch{}return!0}finally{Z.p=s,B.T=n,iy(i,t)}}function fg(i,t,e){t=Oe(e,t),t=Nu(i.stateNode,t,2),i=Vi(i,t,2),i!==null&&(Xa(i,2),Qe(i))}function it(i,t,e){if(i.tag===3)fg(i,i,e);else for(;t!==null;){if(t.tag===3){fg(t,i,e);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Xi===null||!Xi.has(n))){i=Oe(e,i),e=b0(2),n=Vi(t,e,2),n!==null&&(v0(e,n,t,i),Xa(n,2),Qe(n));break}}t=t.return}}function Qc(i,t,e){var n=i.pingCache;if(n===null){n=i.pingCache=new ZA;var s=new Set;n.set(t,s)}else s=n.get(t),s===void 0&&(s=new Set,n.set(t,s));s.has(e)||(zh=!0,s.add(e),i=n1.bind(null,i,t,e),t.then(i,i))}function n1(i,t,e){var n=i.pingCache;n!==null&&n.delete(t),i.pingedLanes|=i.suspendedLanes&e,i.warmLanes&=~e,ot===i&&(Y&e)===e&&(wt===4||wt===3&&(Y&62914560)===Y&&300>fe()-el?($&2)===0&&Ss(i,0):Ph|=e,vs===Y&&(vs=0)),Qe(i)}function sy(i,t){t===0&&(t=Wg()),i=_n(i,t),i!==null&&(Xa(i,t),Qe(i))}function s1(i){var t=i.memoizedState,e=0;t!==null&&(e=t.retryLane),sy(i,e)}function a1(i,t){var e=0;switch(i.tag){case 31:case 13:var n=i.stateNode,s=i.memoizedState;s!==null&&(e=s.retryLane);break;case 19:n=i.stateNode;break;case 22:n=i.stateNode._retryCache;break;default:throw Error(x(314))}n!==null&&n.delete(t),sy(i,e)}function r1(i,t){return Ju(i,t)}var Bo=null,qn=null,Hu=!1,zo=!1,$c=!1,Hi=0;function Qe(i){i!==qn&&i.next===null&&(qn===null?Bo=qn=i:qn=qn.next=i),zo=!0,Hu||(Hu=!0,l1())}function $a(i,t){if(!$c&&zo){$c=!0;do for(var e=!1,n=Bo;n!==null;){if(!t)if(i!==0){var s=n.pendingLanes;if(s===0)var a=0;else{var r=n.suspendedLanes,o=n.pingedLanes;a=(1<<31-ge(42|i)+1)-1,a&=s&~(r&~o),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(e=!0,pg(n,a))}else a=Y,a=Vo(n,n===ot?a:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(a&3)===0||Va(n,a)||(e=!0,pg(n,a));n=n.next}while(e);$c=!1}}function o1(){ay()}function ay(){zo=Hu=!1;var i=0;Hi!==0&&m1()&&(i=Hi);for(var t=fe(),e=null,n=Bo;n!==null;){var s=n.next,a=ry(n,t);a===0?(n.next=null,e===null?Bo=s:e.next=s,s===null&&(qn=e)):(e=n,(i!==0||(a&3)!==0)&&(zo=!0)),n=s}Bt!==0&&Bt!==5||$a(i,!1),Hi!==0&&(Hi=0)}function ry(i,t){for(var e=i.suspendedLanes,n=i.pingedLanes,s=i.expirationTimes,a=i.pendingLanes&-62914561;0<a;){var r=31-ge(a),o=1<<r,l=s[r];l===-1?((o&e)===0||(o&n)!==0)&&(s[r]=Lv(o,t)):l<=t&&(i.expiredLanes|=o),a&=~o}if(t=ot,e=Y,e=Vo(i,i===t?e:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),n=i.callbackNode,e===0||i===t&&(et===2||et===9)||i.cancelPendingCommit!==null)return n!==null&&n!==null&&xc(n),i.callbackNode=null,i.callbackPriority=0;if((e&3)===0||Va(i,e)){if(t=e&-e,t===i.callbackPriority)return t;switch(n!==null&&xc(n),eh(e)){case 2:case 8:e=qg;break;case 32:e=bo;break;case 268435456:e=Kg;break;default:e=bo}return n=oy.bind(null,i),e=Ju(e,n),i.callbackPriority=t,i.callbackNode=e,t}return n!==null&&n!==null&&xc(n),i.callbackPriority=2,i.callbackNode=null,2}function oy(i,t){if(Bt!==0&&Bt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var e=i.callbackNode;if(sl()&&i.callbackNode!==e)return null;var n=Y;return n=Vo(i,i===ot?n:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),n===0?null:(Y0(i,n,t),ry(i,fe()),i.callbackNode!=null&&i.callbackNode===e?oy.bind(null,i):null)}function pg(i,t){if(sl())return null;Y0(i,t,!0)}function l1(){b1(function(){($&6)!==0?Ju(Yg,o1):ay()})}function Fh(){if(Hi===0){var i=ms;i===0&&(i=zr,zr<<=1,(zr&261888)===0&&(zr=256)),Hi=i}return Hi}function gg(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:to(""+i)}function mg(i,t){var e=t.ownerDocument.createElement("input");return e.name=t.name,e.value=t.value,i.id&&e.setAttribute("form",i.id),t.parentNode.insertBefore(e,t),i=new FormData(i),e.parentNode.removeChild(e),i}function c1(i,t,e,n,s){if(t==="submit"&&e&&e.stateNode===s){var a=gg((s[ae]||null).action),r=n.submitter;r&&(t=(t=r[ae]||null)?gg(t.formAction):r.getAttribute("formAction"),t!==null&&(a=t,r=null));var o=new Xo("action","action",null,n,s);i.push({event:o,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(Hi!==0){var l=r?mg(s,r):new FormData(s);Ou(e,{pending:!0,data:l,method:s.method,action:a},null,l)}}else typeof a=="function"&&(o.preventDefault(),l=r?mg(s,r):new FormData(s),Ou(e,{pending:!0,data:l,method:s.method,action:a},a,l))},currentTarget:s}]})}}for(Kr=0;Kr<bu.length;Kr++)Wr=bu[Kr],yg=Wr.toLowerCase(),bg=Wr[0].toUpperCase()+Wr.slice(1),He(yg,"on"+bg);var Wr,yg,bg,Kr;He(vm,"onAnimationEnd");He(Am,"onAnimationIteration");He(Sm,"onAnimationStart");He("dblclick","onDoubleClick");He("focusin","onFocus");He("focusout","onBlur");He(CA,"onTransitionRun");He(MA,"onTransitionStart");He(DA,"onTransitionCancel");He(Em,"onTransitionEnd");ps("onMouseEnter",["mouseout","mouseover"]);ps("onMouseLeave",["mouseout","mouseover"]);ps("onPointerEnter",["pointerout","pointerover"]);ps("onPointerLeave",["pointerout","pointerover"]);En("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));En("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));En("onBeforeInput",["compositionend","keypress","textInput","paste"]);En("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));En("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));En("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Pa="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),u1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Pa));function ly(i,t){t=(t&4)!==0;for(var e=0;e<i.length;e++){var n=i[e],s=n.event;n=n.listeners;t:{var a=void 0;if(t)for(var r=n.length-1;0<=r;r--){var o=n[r],l=o.instance,c=o.currentTarget;if(o=o.listener,l!==a&&s.isPropagationStopped())break t;a=o,s.currentTarget=c;try{a(s)}catch(u){Ao(u)}s.currentTarget=null,a=l}else for(r=0;r<n.length;r++){if(o=n[r],l=o.instance,c=o.currentTarget,o=o.listener,l!==a&&s.isPropagationStopped())break t;a=o,s.currentTarget=c;try{a(s)}catch(u){Ao(u)}s.currentTarget=null,a=l}}}}function j(i,t){var e=t[uu];e===void 0&&(e=t[uu]=new Set);var n=i+"__bubble";e.has(n)||(cy(t,i,2,!1),e.add(n))}function Zc(i,t,e){var n=0;t&&(n|=4),cy(e,i,n,t)}var Qr="_reactListening"+Math.random().toString(36).slice(2);function Hh(i){if(!i[Qr]){i[Qr]=!0,tm.forEach(function(e){e!=="selectionchange"&&(u1.has(e)||Zc(e,!1,i),Zc(e,!0,i))});var t=i.nodeType===9?i:i.ownerDocument;t===null||t[Qr]||(t[Qr]=!0,Zc("selectionchange",!1,t))}}function cy(i,t,e,n){switch(Ey(t)){case 2:var s=I1;break;case 8:s=F1;break;default:s=Vh}e=s.bind(null,t,e,i),s=void 0,!gu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),n?s!==void 0?i.addEventListener(t,e,{capture:!0,passive:s}):i.addEventListener(t,e,!0):s!==void 0?i.addEventListener(t,e,{passive:s}):i.addEventListener(t,e,!1)}function Jc(i,t,e,n,s){var a=n;if((t&1)===0&&(t&2)===0&&n!==null)t:for(;;){if(n===null)return;var r=n.tag;if(r===3||r===4){var o=n.stateNode.containerInfo;if(o===s)break;if(r===4)for(r=n.return;r!==null;){var l=r.tag;if((l===3||l===4)&&r.stateNode.containerInfo===s)return;r=r.return}for(;o!==null;){if(r=Qn(o),r===null)return;if(l=r.tag,l===5||l===6||l===26||l===27){n=a=r;continue t}o=o.parentNode}}n=n.return}lm(function(){var c=a,u=sh(e),h=[];t:{var d=Tm.get(i);if(d!==void 0){var f=Xo,m=i;switch(i){case"keypress":if(io(e)===0)break t;case"keydown":case"keyup":f=aA;break;case"focusin":m="focus",f=Rc;break;case"focusout":m="blur",f=Rc;break;case"beforeblur":case"afterblur":f=Rc;break;case"click":if(e.button===2)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=_p;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=qv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=lA;break;case vm:case Am:case Sm:f=Qv;break;case Em:f=uA;break;case"scroll":case"scrollend":f=Xv;break;case"wheel":f=dA;break;case"copy":case"cut":case"paste":f=Zv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=Cp;break;case"toggle":case"beforetoggle":f=pA}var y=(t&4)!==0,v=!y&&(i==="scroll"||i==="scrollend"),p=y?d!==null?d+"Capture":null:d;y=[];for(var g=c,b;g!==null;){var A=g;if(b=A.stateNode,A=A.tag,A!==5&&A!==26&&A!==27||b===null||p===null||(A=Da(g,p),A!=null&&y.push(Ia(g,A,b))),v)break;g=g.return}0<y.length&&(d=new f(d,m,null,e,u),h.push({event:d,listeners:y}))}}if((t&7)===0){t:{if(d=i==="mouseover"||i==="pointerover",f=i==="mouseout"||i==="pointerout",d&&e!==pu&&(m=e.relatedTarget||e.fromElement)&&(Qn(m)||m[ws]))break t;if((f||d)&&(d=u.window===u?u:(d=u.ownerDocument)?d.defaultView||d.parentWindow:window,f?(m=e.relatedTarget||e.toElement,f=c,m=m?Qn(m):null,m!==null&&(v=Ga(m),y=m.tag,m!==v||y!==5&&y!==27&&y!==6)&&(m=null)):(f=null,m=c),f!==m)){if(y=_p,A="onMouseLeave",p="onMouseEnter",g="mouse",(i==="pointerout"||i==="pointerover")&&(y=Cp,A="onPointerLeave",p="onPointerEnter",g="pointer"),v=f==null?d:da(f),b=m==null?d:da(m),d=new y(A,g+"leave",f,e,u),d.target=v,d.relatedTarget=b,A=null,Qn(u)===c&&(y=new y(p,g+"enter",m,e,u),y.target=b,y.relatedTarget=v,A=y),v=A,f&&m)e:{for(y=h1,p=f,g=m,b=0,A=p;A;A=y(A))b++;A=0;for(var S=g;S;S=y(S))A++;for(;0<b-A;)p=y(p),b--;for(;0<A-b;)g=y(g),A--;for(;b--;){if(p===g||g!==null&&p===g.alternate){y=p;break e}p=y(p),g=y(g)}y=null}else y=null;f!==null&&vg(h,d,f,y,!1),m!==null&&v!==null&&vg(h,v,m,y,!0)}}t:{if(d=c?da(c):window,f=d.nodeName&&d.nodeName.toLowerCase(),f==="select"||f==="input"&&d.type==="file")var E=Rp;else if(Op(d))if(pm)E=wA;else{E=EA;var T=SA}else f=d.nodeName,!f||f.toLowerCase()!=="input"||d.type!=="checkbox"&&d.type!=="radio"?c&&nh(c.elementType)&&(E=Rp):E=TA;if(E&&(E=E(i,c))){fm(h,E,e,u);break t}T&&T(i,d,c),i==="focusout"&&c&&d.type==="number"&&c.memoizedProps.value!=null&&fu(d,"number",d.value)}switch(T=c?da(c):window,i){case"focusin":(Op(T)||T.contentEditable==="true")&&(Jn=T,mu=c,ya=null);break;case"focusout":ya=mu=Jn=null;break;case"mousedown":yu=!0;break;case"contextmenu":case"mouseup":case"dragend":yu=!1,Bp(h,e,u);break;case"selectionchange":if(xA)break;case"keydown":case"keyup":Bp(h,e,u)}var w;if(oh)t:{switch(i){case"compositionstart":var _="onCompositionStart";break t;case"compositionend":_="onCompositionEnd";break t;case"compositionupdate":_="onCompositionUpdate";break t}_=void 0}else Zn?hm(i,e)&&(_="onCompositionEnd"):i==="keydown"&&e.keyCode===229&&(_="onCompositionStart");_&&(um&&e.locale!=="ko"&&(Zn||_!=="onCompositionStart"?_==="onCompositionEnd"&&Zn&&(w=cm()):(Pi=u,ah="value"in Pi?Pi.value:Pi.textContent,Zn=!0)),T=Po(c,_),0<T.length&&(_=new xp(_,i,null,e,u),h.push({event:_,listeners:T}),w?_.data=w:(w=dm(e),w!==null&&(_.data=w)))),(w=mA?yA(i,e):bA(i,e))&&(_=Po(c,"onBeforeInput"),0<_.length&&(T=new xp("onBeforeInput","beforeinput",null,e,u),h.push({event:T,listeners:_}),T.data=w)),c1(h,i,c,e,u)}ly(h,t)})}function Ia(i,t,e){return{instance:i,listener:t,currentTarget:e}}function Po(i,t){for(var e=t+"Capture",n=[];i!==null;){var s=i,a=s.stateNode;if(s=s.tag,s!==5&&s!==26&&s!==27||a===null||(s=Da(i,e),s!=null&&n.unshift(Ia(i,s,a)),s=Da(i,t),s!=null&&n.push(Ia(i,s,a))),i.tag===3)return n;i=i.return}return[]}function h1(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function vg(i,t,e,n,s){for(var a=t._reactName,r=[];e!==null&&e!==n;){var o=e,l=o.alternate,c=o.stateNode;if(o=o.tag,l!==null&&l===n)break;o!==5&&o!==26&&o!==27||c===null||(l=c,s?(c=Da(e,a),c!=null&&r.unshift(Ia(e,c,l))):s||(c=Da(e,a),c!=null&&r.push(Ia(e,c,l)))),e=e.return}r.length!==0&&i.push({event:t,listeners:r})}var d1=/\r\n?/g,f1=/\u0000|\uFFFD/g;function Ag(i){return(typeof i=="string"?i:""+i).replace(d1,`
9
+ `).replace(f1,"")}function uy(i,t){return t=Ag(t),Ag(i)===t}function nt(i,t,e,n,s,a){switch(e){case"children":typeof n=="string"?t==="body"||t==="textarea"&&n===""||gs(i,n):(typeof n=="number"||typeof n=="bigint")&&t!=="body"&&gs(i,""+n);break;case"className":Fr(i,"class",n);break;case"tabIndex":Fr(i,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":Fr(i,e,n);break;case"style":om(i,n,a);break;case"data":if(t!=="object"){Fr(i,"data",n);break}case"src":case"href":if(n===""&&(t!=="a"||e!=="href")){i.removeAttribute(e);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){i.removeAttribute(e);break}n=to(""+n),i.setAttribute(e,n);break;case"action":case"formAction":if(typeof n=="function"){i.setAttribute(e,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof a=="function"&&(e==="formAction"?(t!=="input"&&nt(i,t,"name",s.name,s,null),nt(i,t,"formEncType",s.formEncType,s,null),nt(i,t,"formMethod",s.formMethod,s,null),nt(i,t,"formTarget",s.formTarget,s,null)):(nt(i,t,"encType",s.encType,s,null),nt(i,t,"method",s.method,s,null),nt(i,t,"target",s.target,s,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){i.removeAttribute(e);break}n=to(""+n),i.setAttribute(e,n);break;case"onClick":n!=null&&(i.onclick=ci);break;case"onScroll":n!=null&&j("scroll",i);break;case"onScrollEnd":n!=null&&j("scrollend",i);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(x(61));if(e=n.__html,e!=null){if(s.children!=null)throw Error(x(60));i.innerHTML=e}}break;case"multiple":i.multiple=n&&typeof n!="function"&&typeof n!="symbol";break;case"muted":i.muted=n&&typeof n!="function"&&typeof n!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(n==null||typeof n=="function"||typeof n=="boolean"||typeof n=="symbol"){i.removeAttribute("xlink:href");break}e=to(""+n),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":n!=null&&typeof n!="function"&&typeof n!="symbol"?i.setAttribute(e,""+n):i.removeAttribute(e);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":n&&typeof n!="function"&&typeof n!="symbol"?i.setAttribute(e,""):i.removeAttribute(e);break;case"capture":case"download":n===!0?i.setAttribute(e,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?i.setAttribute(e,n):i.removeAttribute(e);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?i.setAttribute(e,n):i.removeAttribute(e);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?i.removeAttribute(e):i.setAttribute(e,n);break;case"popover":j("beforetoggle",i),j("toggle",i),Jr(i,"popover",n);break;case"xlinkActuate":ei(i,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":ei(i,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":ei(i,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":ei(i,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":ei(i,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":ei(i,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":ei(i,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":ei(i,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":ei(i,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":Jr(i,"is",n);break;case"innerText":case"textContent":break;default:(!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(e=jv.get(e)||e,Jr(i,e,n))}}function Uu(i,t,e,n,s,a){switch(e){case"style":om(i,n,a);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(x(61));if(e=n.__html,e!=null){if(s.children!=null)throw Error(x(60));i.innerHTML=e}}break;case"children":typeof n=="string"?gs(i,n):(typeof n=="number"||typeof n=="bigint")&&gs(i,""+n);break;case"onScroll":n!=null&&j("scroll",i);break;case"onScrollEnd":n!=null&&j("scrollend",i);break;case"onClick":n!=null&&(i.onclick=ci);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!em.hasOwnProperty(e))t:{if(e[0]==="o"&&e[1]==="n"&&(s=e.endsWith("Capture"),t=e.slice(2,s?e.length-7:void 0),a=i[ae]||null,a=a!=null?a[e]:null,typeof a=="function"&&i.removeEventListener(t,a,s),typeof n=="function")){typeof a!="function"&&a!==null&&(e in i?i[e]=null:i.hasAttribute(e)&&i.removeAttribute(e)),i.addEventListener(t,n,s);break t}e in i?i[e]=n:n===!0?i.setAttribute(e,""):Jr(i,e,n)}}}function Xt(i,t,e){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":j("error",i),j("load",i);var n=!1,s=!1,a;for(a in e)if(e.hasOwnProperty(a)){var r=e[a];if(r!=null)switch(a){case"src":n=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(x(137,t));default:nt(i,t,a,r,e,null)}}s&&nt(i,t,"srcSet",e.srcSet,e,null),n&&nt(i,t,"src",e.src,e,null);return;case"input":j("invalid",i);var o=a=r=s=null,l=null,c=null;for(n in e)if(e.hasOwnProperty(n)){var u=e[n];if(u!=null)switch(n){case"name":s=u;break;case"type":r=u;break;case"checked":l=u;break;case"defaultChecked":c=u;break;case"value":a=u;break;case"defaultValue":o=u;break;case"children":case"dangerouslySetInnerHTML":if(u!=null)throw Error(x(137,t));break;default:nt(i,t,n,u,e,null)}}sm(i,a,o,l,c,r,s,!1);return;case"select":j("invalid",i),n=r=a=null;for(s in e)if(e.hasOwnProperty(s)&&(o=e[s],o!=null))switch(s){case"value":a=o;break;case"defaultValue":r=o;break;case"multiple":n=o;default:nt(i,t,s,o,e,null)}t=a,e=r,i.multiple=!!n,t!=null?os(i,!!n,t,!1):e!=null&&os(i,!!n,e,!0);return;case"textarea":j("invalid",i),a=s=n=null;for(r in e)if(e.hasOwnProperty(r)&&(o=e[r],o!=null))switch(r){case"value":n=o;break;case"defaultValue":s=o;break;case"children":a=o;break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(x(91));break;default:nt(i,t,r,o,e,null)}rm(i,n,s,a);return;case"option":for(l in e)e.hasOwnProperty(l)&&(n=e[l],n!=null)&&(l==="selected"?i.selected=n&&typeof n!="function"&&typeof n!="symbol":nt(i,t,l,n,e,null));return;case"dialog":j("beforetoggle",i),j("toggle",i),j("cancel",i),j("close",i);break;case"iframe":case"object":j("load",i);break;case"video":case"audio":for(n=0;n<Pa.length;n++)j(Pa[n],i);break;case"image":j("error",i),j("load",i);break;case"details":j("toggle",i);break;case"embed":case"source":case"link":j("error",i),j("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(c in e)if(e.hasOwnProperty(c)&&(n=e[c],n!=null))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(x(137,t));default:nt(i,t,c,n,e,null)}return;default:if(nh(t)){for(u in e)e.hasOwnProperty(u)&&(n=e[u],n!==void 0&&Uu(i,t,u,n,e,void 0));return}}for(o in e)e.hasOwnProperty(o)&&(n=e[o],n!=null&&nt(i,t,o,n,e,null))}function p1(i,t,e,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var s=null,a=null,r=null,o=null,l=null,c=null,u=null;for(f in e){var h=e[f];if(e.hasOwnProperty(f)&&h!=null)switch(f){case"checked":break;case"value":break;case"defaultValue":l=h;default:n.hasOwnProperty(f)||nt(i,t,f,null,n,h)}}for(var d in n){var f=n[d];if(h=e[d],n.hasOwnProperty(d)&&(f!=null||h!=null))switch(d){case"type":a=f;break;case"name":s=f;break;case"checked":c=f;break;case"defaultChecked":u=f;break;case"value":r=f;break;case"defaultValue":o=f;break;case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(x(137,t));break;default:f!==h&&nt(i,t,d,f,n,h)}}du(i,r,o,l,c,u,a,s);return;case"select":f=r=o=d=null;for(a in e)if(l=e[a],e.hasOwnProperty(a)&&l!=null)switch(a){case"value":break;case"multiple":f=l;default:n.hasOwnProperty(a)||nt(i,t,a,null,n,l)}for(s in n)if(a=n[s],l=e[s],n.hasOwnProperty(s)&&(a!=null||l!=null))switch(s){case"value":d=a;break;case"defaultValue":o=a;break;case"multiple":r=a;default:a!==l&&nt(i,t,s,a,n,l)}t=o,e=r,n=f,d!=null?os(i,!!e,d,!1):!!n!=!!e&&(t!=null?os(i,!!e,t,!0):os(i,!!e,e?[]:"",!1));return;case"textarea":f=d=null;for(o in e)if(s=e[o],e.hasOwnProperty(o)&&s!=null&&!n.hasOwnProperty(o))switch(o){case"value":break;case"children":break;default:nt(i,t,o,null,n,s)}for(r in n)if(s=n[r],a=e[r],n.hasOwnProperty(r)&&(s!=null||a!=null))switch(r){case"value":d=s;break;case"defaultValue":f=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(x(91));break;default:s!==a&&nt(i,t,r,s,n,a)}am(i,d,f);return;case"option":for(var m in e)d=e[m],e.hasOwnProperty(m)&&d!=null&&!n.hasOwnProperty(m)&&(m==="selected"?i.selected=!1:nt(i,t,m,null,n,d));for(l in n)d=n[l],f=e[l],n.hasOwnProperty(l)&&d!==f&&(d!=null||f!=null)&&(l==="selected"?i.selected=d&&typeof d!="function"&&typeof d!="symbol":nt(i,t,l,d,n,f));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var y in e)d=e[y],e.hasOwnProperty(y)&&d!=null&&!n.hasOwnProperty(y)&&nt(i,t,y,null,n,d);for(c in n)if(d=n[c],f=e[c],n.hasOwnProperty(c)&&d!==f&&(d!=null||f!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(x(137,t));break;default:nt(i,t,c,d,n,f)}return;default:if(nh(t)){for(var v in e)d=e[v],e.hasOwnProperty(v)&&d!==void 0&&!n.hasOwnProperty(v)&&Uu(i,t,v,void 0,n,d);for(u in n)d=n[u],f=e[u],!n.hasOwnProperty(u)||d===f||d===void 0&&f===void 0||Uu(i,t,u,d,n,f);return}}for(var p in e)d=e[p],e.hasOwnProperty(p)&&d!=null&&!n.hasOwnProperty(p)&&nt(i,t,p,null,n,d);for(h in n)d=n[h],f=e[h],!n.hasOwnProperty(h)||d===f||d==null&&f==null||nt(i,t,h,d,n,f)}function Sg(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function g1(){if(typeof performance.getEntriesByType=="function"){for(var i=0,t=0,e=performance.getEntriesByType("resource"),n=0;n<e.length;n++){var s=e[n],a=s.transferSize,r=s.initiatorType,o=s.duration;if(a&&o&&Sg(r)){for(r=0,o=s.responseEnd,n+=1;n<e.length;n++){var l=e[n],c=l.startTime;if(c>o)break;var u=l.transferSize,h=l.initiatorType;u&&Sg(h)&&(l=l.responseEnd,r+=u*(l<o?1:(o-c)/(l-c)))}if(--n,t+=8*(a+r)/(s.duration/1e3),i++,10<i)break}}if(0<i)return t/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var Gu=null,ju=null;function Io(i){return i.nodeType===9?i:i.ownerDocument}function Eg(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function hy(i,t){if(i===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&t==="foreignObject"?0:i}function Vu(i,t){return i==="textarea"||i==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var tu=null;function m1(){var i=window.event;return i&&i.type==="popstate"?i===tu?!1:(tu=i,!0):(tu=null,!1)}var dy=typeof setTimeout=="function"?setTimeout:void 0,y1=typeof clearTimeout=="function"?clearTimeout:void 0,Tg=typeof Promise=="function"?Promise:void 0,b1=typeof queueMicrotask=="function"?queueMicrotask:typeof Tg<"u"?function(i){return Tg.resolve(null).then(i).catch(v1)}:dy;function v1(i){setTimeout(function(){throw i})}function en(i){return i==="head"}function wg(i,t){var e=t,n=0;do{var s=e.nextSibling;if(i.removeChild(e),s&&s.nodeType===8)if(e=s.data,e==="/$"||e==="/&"){if(n===0){i.removeChild(s),Ts(t);return}n--}else if(e==="$"||e==="$?"||e==="$~"||e==="$!"||e==="&")n++;else if(e==="html")Ca(i.ownerDocument.documentElement);else if(e==="head"){e=i.ownerDocument.head,Ca(e);for(var a=e.firstChild;a;){var r=a.nextSibling,o=a.nodeName;a[Ya]||o==="SCRIPT"||o==="STYLE"||o==="LINK"&&a.rel.toLowerCase()==="stylesheet"||e.removeChild(a),a=r}}else e==="body"&&Ca(i.ownerDocument.body);e=s}while(e);Ts(t)}function _g(i,t){var e=i;i=0;do{var n=e.nextSibling;if(e.nodeType===1?t?(e._stashedDisplay=e.style.display,e.style.display="none"):(e.style.display=e._stashedDisplay||"",e.getAttribute("style")===""&&e.removeAttribute("style")):e.nodeType===3&&(t?(e._stashedText=e.nodeValue,e.nodeValue=""):e.nodeValue=e._stashedText||""),n&&n.nodeType===8)if(e=n.data,e==="/$"){if(i===0)break;i--}else e!=="$"&&e!=="$?"&&e!=="$~"&&e!=="$!"||i++;e=n}while(e)}function Xu(i){var t=i.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var e=t;switch(t=t.nextSibling,e.nodeName){case"HTML":case"HEAD":case"BODY":Xu(e),ih(e);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(e.rel.toLowerCase()==="stylesheet")continue}i.removeChild(e)}}function A1(i,t,e,n){for(;i.nodeType===1;){var s=e;if(i.nodeName.toLowerCase()!==t.toLowerCase()){if(!n&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(n){if(!i[Ya])switch(t){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(a=i.getAttribute("rel"),a==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(a!==s.rel||i.getAttribute("href")!==(s.href==null||s.href===""?null:s.href)||i.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin)||i.getAttribute("title")!==(s.title==null?null:s.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(a=i.getAttribute("src"),(a!==(s.src==null?null:s.src)||i.getAttribute("type")!==(s.type==null?null:s.type)||i.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin))&&a&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(t==="input"&&i.type==="hidden"){var a=s.name==null?null:""+s.name;if(s.type==="hidden"&&i.getAttribute("name")===a)return i}else return i;if(i=ke(i.nextSibling),i===null)break}return null}function S1(i,t,e){if(t==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!e||(i=ke(i.nextSibling),i===null))return null;return i}function fy(i,t){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!t||(i=ke(i.nextSibling),i===null))return null;return i}function Yu(i){return i.data==="$?"||i.data==="$~"}function qu(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function E1(i,t){var e=i.ownerDocument;if(i.data==="$~")i._reactRetry=t;else if(i.data!=="$?"||e.readyState!=="loading")t();else{var n=function(){t(),e.removeEventListener("DOMContentLoaded",n)};e.addEventListener("DOMContentLoaded",n),i._reactRetry=n}}function ke(i){for(;i!=null;i=i.nextSibling){var t=i.nodeType;if(t===1||t===3)break;if(t===8){if(t=i.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return i}var Ku=null;function xg(i){i=i.nextSibling;for(var t=0;i;){if(i.nodeType===8){var e=i.data;if(e==="/$"||e==="/&"){if(t===0)return ke(i.nextSibling);t--}else e!=="$"&&e!=="$!"&&e!=="$?"&&e!=="$~"&&e!=="&"||t++}i=i.nextSibling}return null}function Cg(i){i=i.previousSibling;for(var t=0;i;){if(i.nodeType===8){var e=i.data;if(e==="$"||e==="$!"||e==="$?"||e==="$~"||e==="&"){if(t===0)return i;t--}else e!=="/$"&&e!=="/&"||t++}i=i.previousSibling}return null}function py(i,t,e){switch(t=Io(e),i){case"html":if(i=t.documentElement,!i)throw Error(x(452));return i;case"head":if(i=t.head,!i)throw Error(x(453));return i;case"body":if(i=t.body,!i)throw Error(x(454));return i;default:throw Error(x(451))}}function Ca(i){for(var t=i.attributes;t.length;)i.removeAttributeNode(t[0]);ih(i)}var Le=new Map,Mg=new Set;function Fo(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var vi=Z.d;Z.d={f:T1,r:w1,D:_1,C:x1,L:C1,m:M1,X:O1,S:D1,M:R1};function T1(){var i=vi.f(),t=il();return i||t}function w1(i){var t=_s(i);t!==null&&t.tag===5&&t.type==="form"?o0(t):vi.r(i)}var Ds=typeof document>"u"?null:document;function gy(i,t,e){var n=Ds;if(n&&typeof t=="string"&&t){var s=De(t);s='link[rel="'+i+'"][href="'+s+'"]',typeof e=="string"&&(s+='[crossorigin="'+e+'"]'),Mg.has(s)||(Mg.add(s),i={rel:i,crossOrigin:e,href:t},n.querySelector(s)===null&&(t=n.createElement("link"),Xt(t,"link",i),Ft(t),n.head.appendChild(t)))}}function _1(i){vi.D(i),gy("dns-prefetch",i,null)}function x1(i,t){vi.C(i,t),gy("preconnect",i,t)}function C1(i,t,e){vi.L(i,t,e);var n=Ds;if(n&&i&&t){var s='link[rel="preload"][as="'+De(t)+'"]';t==="image"&&e&&e.imageSrcSet?(s+='[imagesrcset="'+De(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(s+='[imagesizes="'+De(e.imageSizes)+'"]')):s+='[href="'+De(i)+'"]';var a=s;switch(t){case"style":a=Es(i);break;case"script":a=Os(i)}Le.has(a)||(i=gt({rel:"preload",href:t==="image"&&e&&e.imageSrcSet?void 0:i,as:t},e),Le.set(a,i),n.querySelector(s)!==null||t==="style"&&n.querySelector(Za(a))||t==="script"&&n.querySelector(Ja(a))||(t=n.createElement("link"),Xt(t,"link",i),Ft(t),n.head.appendChild(t)))}}function M1(i,t){vi.m(i,t);var e=Ds;if(e&&i){var n=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+De(n)+'"][href="'+De(i)+'"]',a=s;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":a=Os(i)}if(!Le.has(a)&&(i=gt({rel:"modulepreload",href:i},t),Le.set(a,i),e.querySelector(s)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(Ja(a)))return}n=e.createElement("link"),Xt(n,"link",i),Ft(n),e.head.appendChild(n)}}}function D1(i,t,e){vi.S(i,t,e);var n=Ds;if(n&&i){var s=rs(n).hoistableStyles,a=Es(i);t=t||"default";var r=s.get(a);if(!r){var o={loading:0,preload:null};if(r=n.querySelector(Za(a)))o.loading=5;else{i=gt({rel:"stylesheet",href:i,"data-precedence":t},e),(e=Le.get(a))&&Uh(i,e);var l=r=n.createElement("link");Ft(l),Xt(l,"link",i),l._p=new Promise(function(c,u){l.onload=c,l.onerror=u}),l.addEventListener("load",function(){o.loading|=1}),l.addEventListener("error",function(){o.loading|=2}),o.loading|=4,uo(r,t,n)}r={type:"stylesheet",instance:r,count:1,state:o},s.set(a,r)}}}function O1(i,t){vi.X(i,t);var e=Ds;if(e&&i){var n=rs(e).hoistableScripts,s=Os(i),a=n.get(s);a||(a=e.querySelector(Ja(s)),a||(i=gt({src:i,async:!0},t),(t=Le.get(s))&&Gh(i,t),a=e.createElement("script"),Ft(a),Xt(a,"link",i),e.head.appendChild(a)),a={type:"script",instance:a,count:1,state:null},n.set(s,a))}}function R1(i,t){vi.M(i,t);var e=Ds;if(e&&i){var n=rs(e).hoistableScripts,s=Os(i),a=n.get(s);a||(a=e.querySelector(Ja(s)),a||(i=gt({src:i,async:!0,type:"module"},t),(t=Le.get(s))&&Gh(i,t),a=e.createElement("script"),Ft(a),Xt(a,"link",i),e.head.appendChild(a)),a={type:"script",instance:a,count:1,state:null},n.set(s,a))}}function Dg(i,t,e,n){var s=(s=Ui.current)?Fo(s):null;if(!s)throw Error(x(446));switch(i){case"meta":case"title":return null;case"style":return typeof e.precedence=="string"&&typeof e.href=="string"?(t=Es(e.href),e=rs(s).hoistableStyles,n=e.get(t),n||(n={type:"style",instance:null,count:0,state:null},e.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){i=Es(e.href);var a=rs(s).hoistableStyles,r=a.get(i);if(r||(s=s.ownerDocument||s,r={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},a.set(i,r),(a=s.querySelector(Za(i)))&&!a._p&&(r.instance=a,r.state.loading=5),Le.has(i)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},Le.set(i,e),a||N1(s,i,e,r.state))),t&&n===null)throw Error(x(528,""));return r}if(t&&n!==null)throw Error(x(529,""));return null;case"script":return t=e.async,e=e.src,typeof e=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Os(e),e=rs(s).hoistableScripts,n=e.get(t),n||(n={type:"script",instance:null,count:0,state:null},e.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(x(444,i))}}function Es(i){return'href="'+De(i)+'"'}function Za(i){return'link[rel="stylesheet"]['+i+"]"}function my(i){return gt({},i,{"data-precedence":i.precedence,precedence:null})}function N1(i,t,e,n){i.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=i.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),Xt(t,"link",e),Ft(t),i.head.appendChild(t))}function Os(i){return'[src="'+De(i)+'"]'}function Ja(i){return"script[async]"+i}function Og(i,t,e){if(t.count++,t.instance===null)switch(t.type){case"style":var n=i.querySelector('style[data-href~="'+De(e.href)+'"]');if(n)return t.instance=n,Ft(n),n;var s=gt({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return n=(i.ownerDocument||i).createElement("style"),Ft(n),Xt(n,"style",s),uo(n,e.precedence,i),t.instance=n;case"stylesheet":s=Es(e.href);var a=i.querySelector(Za(s));if(a)return t.state.loading|=4,t.instance=a,Ft(a),a;n=my(e),(s=Le.get(s))&&Uh(n,s),a=(i.ownerDocument||i).createElement("link"),Ft(a);var r=a;return r._p=new Promise(function(o,l){r.onload=o,r.onerror=l}),Xt(a,"link",n),t.state.loading|=4,uo(a,e.precedence,i),t.instance=a;case"script":return a=Os(e.src),(s=i.querySelector(Ja(a)))?(t.instance=s,Ft(s),s):(n=e,(s=Le.get(a))&&(n=gt({},e),Gh(n,s)),i=i.ownerDocument||i,s=i.createElement("script"),Ft(s),Xt(s,"link",n),i.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(x(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,uo(n,e.precedence,i));return t.instance}function uo(i,t,e){for(var n=e.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=n.length?n[n.length-1]:null,a=s,r=0;r<n.length;r++){var o=n[r];if(o.dataset.precedence===t)a=o;else if(a!==s)break}a?a.parentNode.insertBefore(i,a.nextSibling):(t=e.nodeType===9?e.head:e,t.insertBefore(i,t.firstChild))}function Uh(i,t){i.crossOrigin==null&&(i.crossOrigin=t.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=t.referrerPolicy),i.title==null&&(i.title=t.title)}function Gh(i,t){i.crossOrigin==null&&(i.crossOrigin=t.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=t.referrerPolicy),i.integrity==null&&(i.integrity=t.integrity)}var ho=null;function Rg(i,t,e){if(ho===null){var n=new Map,s=ho=new Map;s.set(e,n)}else s=ho,n=s.get(e),n||(n=new Map,s.set(e,n));if(n.has(i))return n;for(n.set(i,null),e=e.getElementsByTagName(i),s=0;s<e.length;s++){var a=e[s];if(!(a[Ya]||a[Gt]||i==="link"&&a.getAttribute("rel")==="stylesheet")&&a.namespaceURI!=="http://www.w3.org/2000/svg"){var r=a.getAttribute(t)||"";r=i+r;var o=n.get(r);o?o.push(a):n.set(r,[a])}}return n}function Ng(i,t,e){i=i.ownerDocument||i,i.head.insertBefore(e,t==="title"?i.querySelector("head > title"):null)}function k1(i,t,e){if(e===1||t.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(i=t.disabled,typeof t.precedence=="string"&&i==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function yy(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function L1(i,t,e,n){if(e.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(e.state.loading&4)===0){if(e.instance===null){var s=Es(n.href),a=t.querySelector(Za(s));if(a){t=a._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(i.count++,i=Ho.bind(i),t.then(i,i)),e.state.loading|=4,e.instance=a,Ft(a);return}a=t.ownerDocument||t,n=my(n),(s=Le.get(s))&&Uh(n,s),a=a.createElement("link"),Ft(a);var r=a;r._p=new Promise(function(o,l){r.onload=o,r.onerror=l}),Xt(a,"link",n),e.instance=a}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(e,t),(t=e.state.preload)&&(e.state.loading&3)===0&&(i.count++,e=Ho.bind(i),t.addEventListener("load",e),t.addEventListener("error",e))}}var eu=0;function B1(i,t){return i.stylesheets&&i.count===0&&fo(i,i.stylesheets),0<i.count||0<i.imgCount?function(e){var n=setTimeout(function(){if(i.stylesheets&&fo(i,i.stylesheets),i.unsuspend){var a=i.unsuspend;i.unsuspend=null,a()}},6e4+t);0<i.imgBytes&&eu===0&&(eu=62500*g1());var s=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&fo(i,i.stylesheets),i.unsuspend)){var a=i.unsuspend;i.unsuspend=null,a()}},(i.imgBytes>eu?50:800)+t);return i.unsuspend=e,function(){i.unsuspend=null,clearTimeout(n),clearTimeout(s)}}:null}function Ho(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)fo(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Uo=null;function fo(i,t){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Uo=new Map,t.forEach(z1,i),Uo=null,Ho.call(i))}function z1(i,t){if(!(t.state.loading&4)){var e=Uo.get(i);if(e)var n=e.get(null);else{e=new Map,Uo.set(i,e);for(var s=i.querySelectorAll("link[data-precedence],style[data-precedence]"),a=0;a<s.length;a++){var r=s[a];(r.nodeName==="LINK"||r.getAttribute("media")!=="not all")&&(e.set(r.dataset.precedence,r),n=r)}n&&e.set(null,n)}s=t.instance,r=s.getAttribute("data-precedence"),a=e.get(r)||n,a===n&&e.set(null,s),e.set(r,s),this.count++,n=Ho.bind(this),s.addEventListener("load",n),s.addEventListener("error",n),a?a.parentNode.insertBefore(s,a.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(s,i.firstChild)),t.state.loading|=4}}var Fa={$$typeof:li,Provider:null,Consumer:null,_currentValue:dn,_currentValue2:dn,_threadCount:0};function P1(i,t,e,n,s,a,r,o,l){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Cc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Cc(0),this.hiddenUpdates=Cc(null),this.identifierPrefix=n,this.onUncaughtError=s,this.onCaughtError=a,this.onRecoverableError=r,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function by(i,t,e,n,s,a,r,o,l,c,u,h){return i=new P1(i,t,e,r,l,c,u,h,o),t=1,a===!0&&(t|=24),a=he(3,null,null,t),i.current=a,a.stateNode=i,t=ph(),t.refCount++,i.pooledCache=t,t.refCount++,a.memoizedState={element:n,isDehydrated:e,cache:t},yh(a),i}function vy(i){return i?(i=is,i):is}function Ay(i,t,e,n,s,a){s=vy(s),n.context===null?n.context=s:n.pendingContext=s,n=ji(t),n.payload={element:e},a=a===void 0?null:a,a!==null&&(n.callback=a),e=Vi(i,n,t),e!==null&&(se(e,i,t),va(e,i,t))}function kg(i,t){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var e=i.retryLane;i.retryLane=e!==0&&e<t?e:t}}function jh(i,t){kg(i,t),(i=i.alternate)&&kg(i,t)}function Sy(i){if(i.tag===13||i.tag===31){var t=_n(i,67108864);t!==null&&se(t,i,67108864),jh(i,67108864)}}function Lg(i){if(i.tag===13||i.tag===31){var t=me();t=th(t);var e=_n(i,t);e!==null&&se(e,i,t),jh(i,t)}}var Go=!0;function I1(i,t,e,n){var s=B.T;B.T=null;var a=Z.p;try{Z.p=2,Vh(i,t,e,n)}finally{Z.p=a,B.T=s}}function F1(i,t,e,n){var s=B.T;B.T=null;var a=Z.p;try{Z.p=8,Vh(i,t,e,n)}finally{Z.p=a,B.T=s}}function Vh(i,t,e,n){if(Go){var s=Wu(n);if(s===null)Jc(i,t,n,jo,e),Bg(i,n);else if(U1(s,i,t,e,n))n.stopPropagation();else if(Bg(i,n),t&4&&-1<H1.indexOf(i)){for(;s!==null;){var a=_s(s);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var r=cn(a.pendingLanes);if(r!==0){var o=a;for(o.pendingLanes|=2,o.entangledLanes|=2;r;){var l=1<<31-ge(r);o.entanglements[1]|=l,r&=~l}Qe(a),($&6)===0&&(No=fe()+500,$a(0,!1))}}break;case 31:case 13:o=_n(a,2),o!==null&&se(o,a,2),il(),jh(a,2)}if(a=Wu(n),a===null&&Jc(i,t,n,jo,e),a===s)break;s=a}s!==null&&n.stopPropagation()}else Jc(i,t,n,null,e)}}function Wu(i){return i=sh(i),Xh(i)}var jo=null;function Xh(i){if(jo=null,i=Qn(i),i!==null){var t=Ga(i);if(t===null)i=null;else{var e=t.tag;if(e===13){if(i=Ug(t),i!==null)return i;i=null}else if(e===31){if(i=Gg(t),i!==null)return i;i=null}else if(e===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;i=null}else t!==i&&(i=null)}}return jo=i,null}function Ey(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Cv()){case Yg:return 2;case qg:return 8;case bo:case Mv:return 32;case Kg:return 268435456;default:return 32}default:return 32}}var Qu=!1,qi=null,Ki=null,Wi=null,Ha=new Map,Ua=new Map,Bi=[],H1="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Bg(i,t){switch(i){case"focusin":case"focusout":qi=null;break;case"dragenter":case"dragleave":Ki=null;break;case"mouseover":case"mouseout":Wi=null;break;case"pointerover":case"pointerout":Ha.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ua.delete(t.pointerId)}}function la(i,t,e,n,s,a){return i===null||i.nativeEvent!==a?(i={blockedOn:t,domEventName:e,eventSystemFlags:n,nativeEvent:a,targetContainers:[s]},t!==null&&(t=_s(t),t!==null&&Sy(t)),i):(i.eventSystemFlags|=n,t=i.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),i)}function U1(i,t,e,n,s){switch(t){case"focusin":return qi=la(qi,i,t,e,n,s),!0;case"dragenter":return Ki=la(Ki,i,t,e,n,s),!0;case"mouseover":return Wi=la(Wi,i,t,e,n,s),!0;case"pointerover":var a=s.pointerId;return Ha.set(a,la(Ha.get(a)||null,i,t,e,n,s)),!0;case"gotpointercapture":return a=s.pointerId,Ua.set(a,la(Ua.get(a)||null,i,t,e,n,s)),!0}return!1}function Ty(i){var t=Qn(i.target);if(t!==null){var e=Ga(t);if(e!==null){if(t=e.tag,t===13){if(t=Ug(e),t!==null){i.blockedOn=t,bp(i.priority,function(){Lg(e)});return}}else if(t===31){if(t=Gg(e),t!==null){i.blockedOn=t,bp(i.priority,function(){Lg(e)});return}}else if(t===3&&e.stateNode.current.memoizedState.isDehydrated){i.blockedOn=e.tag===3?e.stateNode.containerInfo:null;return}}}i.blockedOn=null}function po(i){if(i.blockedOn!==null)return!1;for(var t=i.targetContainers;0<t.length;){var e=Wu(i.nativeEvent);if(e===null){e=i.nativeEvent;var n=new e.constructor(e.type,e);pu=n,e.target.dispatchEvent(n),pu=null}else return t=_s(e),t!==null&&Sy(t),i.blockedOn=e,!1;t.shift()}return!0}function zg(i,t,e){po(i)&&e.delete(t)}function G1(){Qu=!1,qi!==null&&po(qi)&&(qi=null),Ki!==null&&po(Ki)&&(Ki=null),Wi!==null&&po(Wi)&&(Wi=null),Ha.forEach(zg),Ua.forEach(zg)}function $r(i,t){i.blockedOn===t&&(i.blockedOn=null,Qu||(Qu=!0,zt.unstable_scheduleCallback(zt.unstable_NormalPriority,G1)))}var Zr=null;function Pg(i){Zr!==i&&(Zr=i,zt.unstable_scheduleCallback(zt.unstable_NormalPriority,function(){Zr===i&&(Zr=null);for(var t=0;t<i.length;t+=3){var e=i[t],n=i[t+1],s=i[t+2];if(typeof n!="function"){if(Xh(n||e)===null)continue;break}var a=_s(e);a!==null&&(i.splice(t,3),t-=3,Ou(a,{pending:!0,data:s,method:e.method,action:n},n,s))}}))}function Ts(i){function t(l){return $r(l,i)}qi!==null&&$r(qi,i),Ki!==null&&$r(Ki,i),Wi!==null&&$r(Wi,i),Ha.forEach(t),Ua.forEach(t);for(var e=0;e<Bi.length;e++){var n=Bi[e];n.blockedOn===i&&(n.blockedOn=null)}for(;0<Bi.length&&(e=Bi[0],e.blockedOn===null);)Ty(e),e.blockedOn===null&&Bi.shift();if(e=(i.ownerDocument||i).$$reactFormReplay,e!=null)for(n=0;n<e.length;n+=3){var s=e[n],a=e[n+1],r=s[ae]||null;if(typeof a=="function")r||Pg(e);else if(r){var o=null;if(a&&a.hasAttribute("formAction")){if(s=a,r=a[ae]||null)o=r.formAction;else if(Xh(s)!==null)continue}else o=r.action;typeof o=="function"?e[n+1]=o:(e.splice(n,3),n-=3),Pg(e)}}}function wy(){function i(a){a.canIntercept&&a.info==="react-transition"&&a.intercept({handler:function(){return new Promise(function(r){return s=r})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),n||setTimeout(e,20)}function e(){if(!n&&!navigation.transition){var a=navigation.currentEntry;a&&a.url!=null&&navigation.navigate(a.url,{state:a.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var n=!1,s=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(e,100),function(){n=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),s!==null&&(s(),s=null)}}}function Yh(i){this._internalRoot=i}al.prototype.render=Yh.prototype.render=function(i){var t=this._internalRoot;if(t===null)throw Error(x(409));var e=t.current,n=me();Ay(e,n,i,t,null,null)};al.prototype.unmount=Yh.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var t=i.containerInfo;Ay(i.current,2,null,i,null,null),il(),t[ws]=null}};function al(i){this._internalRoot=i}al.prototype.unstable_scheduleHydration=function(i){if(i){var t=Jg();i={blockedOn:null,target:i,priority:t};for(var e=0;e<Bi.length&&t!==0&&t<Bi[e].priority;e++);Bi.splice(e,0,i),e===0&&Ty(i)}};var Ig=Fg.version;if(Ig!=="19.2.3")throw Error(x(527,Ig,"19.2.3"));Z.findDOMNode=function(i){var t=i._reactInternals;if(t===void 0)throw typeof i.render=="function"?Error(x(188)):(i=Object.keys(i).join(","),Error(x(268,i)));return i=Av(t),i=i!==null?jg(i):null,i=i===null?null:i.stateNode,i};var j1={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(ca=__REACT_DEVTOOLS_GLOBAL_HOOK__,!ca.isDisabled&&ca.supportsFiber))try{ja=ca.inject(j1),pe=ca}catch{}var ca;rl.createRoot=function(i,t){if(!Hg(i))throw Error(x(299));var e=!1,n="",s=g0,a=m0,r=y0;return t!=null&&(t.unstable_strictMode===!0&&(e=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(r=t.onRecoverableError)),t=by(i,1,!1,null,null,e,n,null,s,a,r,wy),i[ws]=t.current,Hh(i),new Yh(t)};rl.hydrateRoot=function(i,t,e){if(!Hg(i))throw Error(x(299));var n=!1,s="",a=g0,r=m0,o=y0,l=null;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(s=e.identifierPrefix),e.onUncaughtError!==void 0&&(a=e.onUncaughtError),e.onCaughtError!==void 0&&(r=e.onCaughtError),e.onRecoverableError!==void 0&&(o=e.onRecoverableError),e.formState!==void 0&&(l=e.formState)),t=by(i,1,!0,t,e??null,n,s,l,a,r,o,wy),t.context=vy(null),e=t.current,n=me(),n=th(n),s=ji(n),s.callback=null,Vi(e,s,n),e=n,t.current.lanes=e,Xa(t,e),Qe(t),i[ws]=t.current,Hh(i),new al(t)};rl.version="19.2.3"});var My=je((ZS,Cy)=>{"use strict";function xy(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(xy)}catch(i){console.error(i)}}xy(),Cy.exports=_y()});var Uy=je(ll=>{"use strict";var W1=Symbol.for("react.transitional.element"),Q1=Symbol.for("react.fragment");function Hy(i,t,e){var n=null;if(e!==void 0&&(n=""+e),t.key!==void 0&&(n=""+t.key),"key"in t){e={};for(var s in t)s!=="key"&&(e[s]=t[s])}else e=t;return t=e.ref,{$$typeof:W1,type:i,key:n,ref:t!==void 0?t:null,props:e}}ll.Fragment=Q1;ll.jsx=Hy;ll.jsxs=Hy});var tr=je((cE,Gy)=>{"use strict";Gy.exports=Uy()});var Bb={};$b(Bb,{AbortException:()=>Ge,AnnotationEditorLayer:()=>Vl,AnnotationEditorParamsType:()=>H,AnnotationEditorType:()=>P,AnnotationEditorUIManager:()=>rn,AnnotationLayer:()=>Pl,AnnotationMode:()=>Si,AnnotationType:()=>bt,CSSConstants:()=>Sl,ColorPicker:()=>Ar,DOMSVGFactory:()=>Ln,DrawLayer:()=>Xl,FeatureTest:()=>J,GlobalWorkerOptions:()=>sn,ImageKind:()=>sr,InvalidPDFException:()=>Is,MathClamp:()=>ht,OPS:()=>Ue,OutputScale:()=>Je,PDFDataRangeTransport:()=>vr,PDFDateString:()=>Hs,PDFWorker:()=>Xs,PasswordException:()=>Ps,PasswordResponses:()=>pb,PermissionFlag:()=>fb,PixelsPerInch:()=>wi,RenderingCancelledException:()=>Fs,ResponseException:()=>Nn,SignatureExtractor:()=>Ei,SupportedImageMimeTypes:()=>Al,TextLayer:()=>Vs,TextLayerImages:()=>Yl,TouchManager:()=>fr,Util:()=>M,VerbosityLevel:()=>Cr,XfaLayer:()=>dr,applyOpacity:()=>vb,build:()=>Lb,createValidAbsoluteUrl:()=>Lf,fetchData:()=>$l,findContrastColor:()=>Ab,getDocument:()=>Nb,getFilenameFromUrl:()=>yb,getPdfFilenameFromUrl:()=>bb,getRGB:()=>Ks,getRGBA:()=>qs,getUuid:()=>zf,isDataScheme:()=>Mr,isPdfFile:()=>Zl,isValidExplicitDest:()=>Tb,makeArr:()=>Ys,makeMap:()=>Ql,makeObj:()=>bl,makeSet:()=>mb,noContextMenu:()=>Te,normalizeUnicode:()=>gb,renderRichText:()=>Pf,setLayerDimensions:()=>an,shadow:()=>L,stopEvent:()=>vt,updateUrlHash:()=>Bf,version:()=>kb});function $1(i){Number.isInteger(i)&&(ql=i)}function Z1(){return ql}function Kl(i){ql>=Cr.INFOS&&console.info(`Info: ${i}`)}function I(i){ql>=Cr.WARNINGS&&console.warn(`Warning: ${i}`)}function Q(i){throw new Error(i)}function Et(i,t){i||Q(t)}function J1(i){switch(i?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Lf(i,t=null,e=null){if(!i)return null;if(e&&typeof i=="string"&&(e.addDefaultProtocol&&i.startsWith("www.")&&i.match(/\./g)?.length>=2&&(i=`http://${i}`),e.tryConvertEncoding))try{i=eS(i)}catch{}let n=t?URL.parse(i,t):URL.parse(i);return J1(n)?n:null}function Bf(i,t,e=!1){let n=URL.parse(i);return n?(n.hash=t,n.href):e&&Lf(i,"http://example.com")?i.split("#",1)[0]+`${t?`#${t}`:""}`:""}function ed(i){return i.substring(i.lastIndexOf("/")+1)}function L(i,t,e,n=!1){return Object.defineProperty(i,t,{value:e,enumerable:!n,configurable:!0,writable:!1}),e}function tS(i){(typeof i!="object"||i?.length===void 0)&&Q("Invalid argument for bytesToString");let t=i.length,e=8192;if(t<e)return String.fromCharCode.apply(null,i);let n=[];for(let s=0;s<t;s+=e){let a=Math.min(s+e,t),r=i.subarray(s,a);n.push(String.fromCharCode.apply(null,r))}return n.join("")}function Wl(i){typeof i!="string"&&Q("Invalid argument for stringToBytes");let t=i.length,e=new Uint8Array(t);for(let n=0;n<t;++n)e[n]=i.charCodeAt(n)&255;return e}function eS(i){return decodeURIComponent(escape(i))}function gb(i){return Wh||(Wh=/([\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,jy=new Map([["\uFB05","\u017Ft"]])),i.replaceAll(Wh,(t,e,n)=>e?e.normalize("NFKC"):jy.get(n))}function zf(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();let i=new Uint8Array(32);return crypto.getRandomValues(i),tS(i)}function iS(i,t,e){if(!Array.isArray(e)||e.length<2)return!1;let[n,s,...a]=e;if(!i(n)&&!Number.isInteger(n)||!t(s))return!1;let r=a.length,o=!0;switch(s.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 a)if(!(typeof l=="number"||o&&l===null))return!1;return!0}function ht(i,t,e){return Math.min(Math.max(i,t),e)}async function $l(i,t="text"){if(rr(i,document.baseURI)){let e=await fetch(i);if(!e.ok)throw new Error(e.statusText);switch(t){case"blob":return e.blob();case"bytes":return e.bytes();case"json":return e.json()}return e.text()}return new Promise((e,n)=>{let s=new XMLHttpRequest;s.open("GET",i,!0),s.responseType=t==="bytes"?"arraybuffer":t,s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE){if(s.status===200||s.status===0){switch(t){case"bytes":e(new Uint8Array(s.response));return;case"blob":case"json":e(s.response);return}e(s.responseText);return}n(new Error(s.statusText))}},s.send(null)})}function Mr(i){let t=i.length,e=0;for(;e<t&&i[e].trim()==="";)e++;return i.substring(e,e+5).toLowerCase()==="data:"}function Zl(i){return typeof i=="string"&&/\.pdf$/i.test(i)}function yb(i){return[i]=i.split(/[#?]/,1),ed(i)}function bb(i,t="document.pdf"){if(typeof i!="string")return t;if(Mr(i))return I('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;let n=(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})(i);if(!n)return t;let s=o=>{try{let l=decodeURIComponent(o);return l.includes("/")&&(l=ed(l),l.length===4&&a.test(l))?o:l}catch{return o}},a=/\.pdf$/i,r=ed(n.pathname);if(a.test(r))return s(r);if(n.searchParams.size>0){let o=c=>[...c].findLast(u=>a.test(u)),l=o(n.searchParams.values())??o(n.searchParams.keys());if(l)return s(l)}if(n.hash){let l=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(n.hash);if(l)return s(l[0])}return t}function rr(i,t){let e=t?URL.parse(i,t):URL.parse(i);return/https?:/.test(e?.protocol??"")}function Te(i){i.preventDefault()}function vt(i){i.preventDefault(),i.stopPropagation()}function qs(i){if(i.startsWith("#")){let e=i.slice(1);return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16),e.length>=8?parseInt(e.slice(6,8),16)/255:1]}if(i.startsWith("rgb(")){let[e,n,s]=i.slice(4,-1).split(",").map(a=>parseInt(a,10));return[e,n,s,1]}if(i.startsWith("rgba(")){let e=i.slice(5,-1).split(",");return[parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10),parseFloat(e[3])]}let t=i.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);return t?[Math.round(parseFloat(t[1])*255),Math.round(parseFloat(t[2])*255),Math.round(parseFloat(t[3])*255),t[4]!==void 0&&t[4]!=="none"?parseFloat(t[4]):1]:null}function Ks(i){let t=qs(i);return t?t.slice(0,3):(I(`Not a valid color format: "${i}"`),[0,0,0])}function aS(i){let t=document.createElement("span");t.style.visibility="hidden",t.style.colorScheme="only light",document.body.append(t);for(let e of i.keys()){t.style.color=e;let n=window.getComputedStyle(t).color;i.set(e,Ks(n))}t.remove()}function ut(i){let{a:t,b:e,c:n,d:s,e:a,f:r}=i.getTransform();return[t,e,n,s,a,r]}function $e(i){let{a:t,b:e,c:n,d:s,e:a,f:r}=i.getTransform().invertSelf();return[t,e,n,s,a,r]}function an(i,t,e=!1,n=!0){if(t instanceof ur){let{pageWidth:s,pageHeight:a}=t.rawDims,{style:r}=i,o=`round(down, var(--total-scale-factor) * ${s}px, var(--scale-round-x))`,l=`round(down, var(--total-scale-factor) * ${a}px, var(--scale-round-y))`;!e||t.rotation%180===0?(r.width=o,r.height=l):(r.width=l,r.height=o)}n&&i.setAttribute("data-main-rotation",t.rotation)}function vb(i,t){t=ht(t??1,0,1);let e=255*(1-t);return i.map(n=>Math.round(n*t+e))}function Vy(i,t){let e=i[0]/255,n=i[1]/255,s=i[2]/255,a=Math.max(e,n,s),r=Math.min(e,n,s),o=(a+r)/2;if(a===r)t[0]=t[1]=0;else{let l=a-r;switch(t[1]=o<.5?l/(a+r):l/(2-a-r),a){case e:t[0]=((n-s)/l+(n<s?6:0))*60;break;case n:t[0]=((s-e)/l+2)*60;break;case s:t[0]=((e-n)/l+4)*60;break}}t[2]=o}function sd(i,t){let e=i[0],n=i[1],s=i[2],a=(1-Math.abs(2*s-1))*n,r=a*(1-Math.abs(e/60%2-1)),o=s-a/2;switch(Math.floor(e/60)){case 0:t[0]=a+o,t[1]=r+o,t[2]=o;break;case 1:t[0]=r+o,t[1]=a+o,t[2]=o;break;case 2:t[0]=o,t[1]=a+o,t[2]=r+o;break;case 3:t[0]=o,t[1]=r+o,t[2]=a+o;break;case 4:t[0]=r+o,t[1]=o,t[2]=a+o;break;case 5:case 6:t[0]=a+o,t[1]=o,t[2]=r+o;break}}function Xy(i){return i<=.03928?i/12.92:((i+.055)/1.055)**2.4}function Yy(i,t,e){sd(i,e),e.map(Xy);let n=.2126*e[0]+.7152*e[1]+.0722*e[2];sd(t,e),e.map(Xy);let s=.2126*e[0]+.7152*e[1]+.0722*e[2];return n>s?(n+.05)/(s+.05):(s+.05)/(n+.05)}function Ab(i,t){let e=i[0]+i[1]*256+i[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776,n=qy.get(e);if(n)return n;let s=new Float32Array(9),a=s.subarray(0,3),r=s.subarray(3,6);Vy(i,r);let o=s.subarray(6,9);Vy(t,o);let l=o[2]<.5,c=l?12:4.5;if(r[2]=l?Math.sqrt(r[2]):1-Math.sqrt(1-r[2]),Yy(r,o,a)<c){let u,h;l?(u=r[2],h=1):(u=0,h=r[2]);let d=.005;for(;h-u>d;){let f=r[2]=(u+h)/2;l===Yy(r,o,a)<c?u=f:h=f}r[2]=l?h:u}return sd(r,a),n=M.makeHexColor(Math.round(a[0]*255),Math.round(a[1]*255),Math.round(a[2]*255)),qy.set(e,n),n}function Pf({html:i,dir:t,className:e},n){let s=document.createDocumentFragment();if(typeof i=="string"){let a=document.createElement("p");a.dir=t||"auto";let r=i.split(/\r\n?|\n/);for(let o=0,l=r.length;o<l;++o){let c=r[o];a.append(document.createTextNode(c)),o<l-1&&a.append(document.createElement("br"))}s.append(a)}else dr.render({xfaHtml:i,div:s,intent:"richText"});s.firstElementChild.classList.add("richText",e),n.append(s)}function Sb(i){let t=new Path2D;if(!i)return t;for(let e=0,n=i.length;e<n;)switch(i[e++]){case er.moveTo:t.moveTo(i[e++],i[e++]);break;case er.lineTo:t.lineTo(i[e++],i[e++]);break;case er.curveTo:t.bezierCurveTo(i[e++],i[e++],i[e++],i[e++],i[e++],i[e++]);break;case er.quadraticCurveTo:t.quadraticCurveTo(i[e++],i[e++],i[e++],i[e++]);break;case er.closePath:t.closePath();break;default:I(`Unrecognized drawing path operator: ${i[e-1]}`);break}return t}function Eb(i,t,e){for(let n of e)t.addEventListener(n,i[n].bind(i))}function $y(i,t,e,n,s,a){i[t*4+0]=Math.min(i[t*4+0],e),i[t*4+1]=Math.min(i[t*4+1],n),i[t*4+2]=Math.max(i[t*4+2],s),i[t*4+3]=Math.max(i[t*4+3],a)}function oS(i,t,e,n,s){let a;i?(i<0&&(a=s[0],s[0]=s[2],s[2]=a),s[0]*=i,s[2]*=i,t<0&&(a=s[1],s[1]=s[3],s[3]=a),s[1]*=t,s[3]*=t):s.fill(0),s[0]+=e,s[1]+=n,s[2]+=e,s[3]+=n}function lS(i){if(i instanceof URL)return i;if(typeof i=="string"){if(Se){if(/^[a-z][a-z0-9\-+.]+:/i.test(i))return new URL(i);let e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(i))}let t=URL.parse(i,window.location);if(t)return t}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function cS(i){if(Se&&typeof Buffer<"u"&&i instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength)return i;if(typeof i=="string")return Wl(i);if(i instanceof ArrayBuffer||ArrayBuffer.isView(i)||typeof i=="object"&&!isNaN(i?.length))return new Uint8Array(i);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function cl(i){if(typeof i!="string")return null;if(i.endsWith("/"))return i;throw new Error(`Invalid factory url: "${i}" must include trailing slash.`)}function Jy(){}function oe(i){if(i instanceof Ge||i instanceof Is||i instanceof Ps||i instanceof Nn||i instanceof ar)return i;switch(i instanceof Error||typeof i=="object"&&i!==null||Q('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),i.name){case"AbortException":return new Ge(i.message);case"InvalidPDFException":return new Is(i.message);case"PasswordException":return new Ps(i.message,i.code);case"ResponseException":return new Nn(i.message,i.status,i.missing);case"UnknownErrorException":return new ar(i.message,i.details)}return new ar(i.message,i.toString())}function $h(i,t,e){return Math.round(e*i+(1-e)*t)}async function hS(i){let e=await process.getBuiltinModule("fs/promises").readFile(i);return new Uint8Array(e)}function wb({src:i,srcPos:t=0,dest:e,width:n,height:s,nonBlackColor:a=4294967295,inverseDecode:r=!1}){let o=J.isLittleEndian?4278190080:255,[l,c]=r?[a,o]:[o,a],u=n>>3,h=n&7,d=l^c,f=i.length;e=new Uint32Array(e.buffer);let m=0;for(let y=0;y<s;++y){for(let p=t+u;t<p;++t,m+=8){let g=i[t];e[m]=l^-(g>>7&1)&d,e[m+1]=l^-(g>>6&1)&d,e[m+2]=l^-(g>>5&1)&d,e[m+3]=l^-(g>>4&1)&d,e[m+4]=l^-(g>>3&1)&d,e[m+5]=l^-(g>>2&1)&d,e[m+6]=l^-(g>>1&1)&d,e[m+7]=l^-(g&1)&d}if(h===0)continue;let v=t<f?i[t++]:255;for(let p=0;p<h;++p,++m)e[m]=l^-(v>>7-p&1)&d}return{srcPos:t,destPos:m}}function dS({src:i,srcPos:t=0,dest:e,destPos:n=0,width:s,height:a}){let r=0,o=s*a*3,l=o>>2,c=new Uint32Array(i.buffer,t,l),u=J.isLittleEndian?4278190080:255;if(J.isLittleEndian){for(;r<l-2;r+=3,n+=4){let h=c[r],d=c[r+1],f=c[r+2];e[n]=h|u,e[n+1]=h>>>24|d<<8|u,e[n+2]=d>>>16|f<<16|u,e[n+3]=f>>>8|u}for(let h=r*4,d=t+o;h<d;h+=3)e[n++]=i[h]|i[h+1]<<8|i[h+2]<<16|u}else{for(;r<l-2;r+=3,n+=4){let h=c[r],d=c[r+1],f=c[r+2];e[n]=h|u,e[n+1]=h<<24|d>>>8|u,e[n+2]=d<<16|f>>>16|u,e[n+3]=f<<8|u}for(let h=r*4,d=t+o;h<d;h+=3)e[n++]=i[h]<<24|i[h+1]<<16|i[h+2]<<8|u}return{srcPos:t+o,destPos:n}}function pS(){return Jl.init()}function gS(){return Jl.isReady}function mS(){Jl.loadMeshShader()}function yS(i,t,e,n,s,a,r,o){return Jl.draw(i,t,e,n,s,a,r,o)}function yl(i,t){if(!t)return;let e=t[2]-t[0],n=t[3]-t[1],s=new Path2D;s.rect(t[0],t[1],e,n),i.clip(s)}function bS(i,t,e,n,s,a,r,o){let l=t.coords,c=t.colors,u=i.data,h=i.width*4,d;l[e*2+1]>l[n*2+1]&&(d=e,e=n,n=d,d=a,a=r,r=d),l[n*2+1]>l[s*2+1]&&(d=n,n=s,s=d,d=r,r=o,o=d),l[e*2+1]>l[n*2+1]&&(d=e,e=n,n=d,d=a,a=r,r=d);let f=(l[e*2]+t.offsetX)*t.scaleX,m=(l[e*2+1]+t.offsetY)*t.scaleY,y=(l[n*2]+t.offsetX)*t.scaleX,v=(l[n*2+1]+t.offsetY)*t.scaleY,p=(l[s*2]+t.offsetX)*t.scaleX,g=(l[s*2+1]+t.offsetY)*t.scaleY;if(m>=g)return;let b=c[a*4],A=c[a*4+1],S=c[a*4+2],E=c[r*4],T=c[r*4+1],w=c[r*4+2],_=c[o*4],C=c[o*4+1],D=c[o*4+2],N=Math.round(m),z=Math.round(g),X,lt,k,R,kt,Lt,Pe,xi;for(let at=N;at<=z;at++){if(at<v){let St=at<m?0:(m-at)/(m-v);X=f-(f-y)*St,lt=b-(b-E)*St,k=A-(A-T)*St,R=S-(S-w)*St}else{let St;at>g?St=1:v===g?St=0:St=(v-at)/(v-g),X=y-(y-p)*St,lt=E-(E-_)*St,k=T-(T-C)*St,R=w-(w-D)*St}let rt;at<m?rt=0:at>g?rt=1:rt=(m-at)/(m-g),kt=f-(f-p)*rt,Lt=b-(b-_)*rt,Pe=A-(A-C)*rt,xi=S-(S-D)*rt;let G=Math.round(Math.min(X,kt)),Wt=Math.round(Math.max(X,kt)),Ct=h*at+G*4;for(let St=G;St<=Wt;St++)rt=(X-St)/(X-kt),rt<0?rt=0:rt>1&&(rt=1),u[Ct++]=lt-(lt-Lt)*rt|0,u[Ct++]=k-(k-Pe)*rt|0,u[Ct++]=R-(R-xi)*rt|0,u[Ct++]=255}}function vS(i){switch(i[0]){case"RadialAxial":return new Ld(i);case"Mesh":return new Bd(i);case"Dummy":return new zd}throw new Error(`Unknown IR type: ${i[0]}`)}function ib(i,t){if(i._removeMirroring)throw new Error("Context is already forwarding operations.");let e=new Map;for(let n of["save","restore","rotate","scale","translate","transform","setTransform","resetTransform","clip","moveTo","lineTo","bezierCurveTo","quadraticCurveTo","arc","arcTo","ellipse","rect","roundRect","closePath","beginPath"]){let s=i[n];typeof s!="function"||typeof t[n]!="function"||(e.set(n,s),i[n]=function(...a){return t[n](...a),s.apply(this,a)})}i._removeMirroring=()=>{for(let[n,s]of e)i[n]=s;delete i._removeMirroring}}function hl(i,t,e,n,s,a,r,o,l,c){let[u,h,d,f,m,y]=ut(i);if(h===0&&d===0){let g=r*u+m,b=Math.round(g),A=o*f+y,S=Math.round(A),E=(r+l)*u+m,T=Math.abs(Math.round(E)-b)||1,w=(o+c)*f+y,_=Math.abs(Math.round(w)-S)||1;return i.setTransform(Math.sign(u),0,0,Math.sign(f),b,S),i.drawImage(t,e,n,s,a,0,0,T,_),i.setTransform(u,h,d,f,m,y),[T,_]}if(u===0&&f===0){let g=o*d+m,b=Math.round(g),A=r*h+y,S=Math.round(A),E=(o+c)*d+m,T=Math.abs(Math.round(E)-b)||1,w=(r+l)*h+y,_=Math.abs(Math.round(w)-S)||1;return i.setTransform(0,Math.sign(h),Math.sign(d),0,b,S),i.drawImage(t,e,n,s,a,0,0,_,T),i.setTransform(u,h,d,f,m,y),[_,T]}i.drawImage(t,e,n,s,a,r,o,l,c);let v=Math.hypot(u,h),p=Math.hypot(d,f);return[v*l,p*c]}function nb(i,t){let{width:e,height:n,kind:s}=t,a=n%le,r=(n-a)/le,o=a===0?r:r+1,l=i.createImageData(e,le),c=0,u=t.data,h=l.data,d;if(s===sr.GRAYSCALE_1BPP)for(d=0;d<o;d++)({srcPos:c}=wb({src:u,srcPos:c,dest:h,width:e,height:d<r?le:a})),i.putImageData(l,0,d*le);else if(s===sr.RGBA_32BPP){let f=0,m=e*le*4;for(d=0;d<r;d++)h.set(u.subarray(c,c+m)),c+=m,i.putImageData(l,0,f),f+=le;d<o&&(m=e*a*4,h.set(u.subarray(c,c+m)),i.putImageData(l,0,f))}else if(s===sr.RGB_24BPP)for(d=0;d<o;d++)({srcPos:c}=dS({src:u,srcPos:c,dest:new Uint32Array(h.buffer),width:e,height:d<r?le:a})),i.putImageData(l,0,d*le);else throw new Error(`bad image kind: ${s}`)}function sb(i,t){if(t.bitmap){i.drawImage(t.bitmap,0,0);return}let{width:e,height:n}=t,s=n%le,a=(n-s)/le,r=s===0?a:a+1,o=i.createImageData(e,le),l=0,c=t.data,u=o.data;for(let h=0;h<r;h++)({srcPos:l}=wb({src:c,srcPos:l,dest:u,width:e,height:h<a?le:s,nonBlackColor:0})),i.putImageData(o,0,h*le)}function Mn(i,t){let e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(let n of e)i[n]!==void 0&&(t[n]=i[n]);i.setLineDash!==void 0&&(t.setLineDash(i.getLineDash()),t.lineDashOffset=i.lineDashOffset)}function dl(i){i.strokeStyle=i.fillStyle="#000000",i.fillRule="nonzero",i.globalAlpha=1,i.lineWidth=1,i.lineCap="butt",i.lineJoin="miter",i.miterLimit=10,i.globalCompositeOperation="source-over",i.font="10px sans-serif",i.setLineDash!==void 0&&(i.setLineDash([]),i.lineDashOffset=0);let{filter:t}=i;t!=="none"&&t!==""&&(i.filter="none")}function ab(i,t){if(t)return!0;M.singularValueDecompose2dScale(i,Ee);let e=Math.fround(Je.pixelRatio*wi.PDF_TO_CSS_UNITS);return Ee[0]<=e&&Ee[1]<=e}function xS(i){let t=!0,e=n("filename\\*","i").exec(i);if(e){e=e[1];let u=o(e);return u=unescape(u),u=l(u),u=c(u),a(u)}if(e=r(i),e){let u=c(e);return a(u)}if(e=n("filename","i").exec(i),e){e=e[1];let u=o(e);return u=c(u),a(u)}function n(u,h){return new RegExp("(?:^|;)\\s*"+u+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',h)}function s(u,h){if(u){if(!/^[\x00-\xFF]+$/.test(h))return h;try{let d=new TextDecoder(u,{fatal:!0}),f=Wl(h);h=d.decode(f),t=!1}catch{}}return h}function a(u){return t&&/[\x80-\xff]/.test(u)&&(u=s("utf-8",u),t&&(u=s("iso-8859-1",u))),u}function r(u){let h=[],d,f=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(d=f.exec(u))!==null;){let[,y,v,p]=d;if(y=parseInt(y,10),y in h){if(y===0)break;continue}h[y]=[v,p]}let m=[];for(let y=0;y<h.length&&y in h;++y){let[v,p]=h[y];p=o(p),v&&(p=unescape(p),y===0&&(p=l(p))),m.push(p)}return m.join("")}function o(u){if(u.startsWith('"')){let h=u.slice(1).split('\\"');for(let d=0;d<h.length;++d){let f=h[d].indexOf('"');f!==-1&&(h[d]=h[d].slice(0,f),h.length=d+1),h[d]=h[d].replaceAll(/\\(.)/g,"$1")}u=h.join('"')}return u}function l(u){let h=u.indexOf("'");if(h===-1)return u;let d=u.slice(0,h),m=u.slice(h+1).replace(/^[^']*'/,"");return s(d,m)}function c(u){return!u.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(u)?u:u.replaceAll(/=\?([\w-]*)\?([QB])\?((?:[^?]|\?(?!=))*)\?=/gi,function(h,d,f,m){if(f==="q"||f==="Q")return m=m.replaceAll("_"," "),m=m.replaceAll(/=([0-9a-f]{2})/gi,function(y,v){return String.fromCharCode(parseInt(v,16))}),s(d,m);try{m=atob(m)}catch{}return s(d,m)})}return""}function _b(i,t){let e=new Headers;if(!i||!t||typeof t!="object")return e;for(let n in t){let s=t[n];s!==void 0&&e.append(n,s)}return e}function tc(i){return URL.parse(i)?.origin??null}function xb({responseHeaders:i,isHttp:t,rangeChunkSize:e,disableRange:n}){let s={contentLength:0,isRangeSupported:!1},a=parseInt(i.get("Content-Length"),10);return!Number.isInteger(a)||(s.contentLength=a,a<=2*e)||n||!t||i.get("Accept-Ranges")!=="bytes"||(i.get("Content-Encoding")||"identity")==="identity"&&(s.isRangeSupported=!0),s}function Cb(i){let t=i.get("Content-Disposition");if(t){let e=xS(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(Zl(e))return e}return null}function ec(i,t){return new Nn(`Unexpected server response (${i}) while retrieving PDF "${t.href}".`,i,i===404||i===0&&t.protocol==="file:")}function Mb(i,t){if(i!==t)throw new Error(`Expected range response-origin "${i}" to match "${t}".`)}function Db(i,t,e,n){return fetch(i,{method:"GET",headers:t,signal:n.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"})}function Ob(i,t){if(i!==200&&i!==206)throw ec(i,t)}function ic(i){if(i instanceof Uint8Array)return i.buffer;if(i instanceof ArrayBuffer)return i;throw new Error(`getArrayBuffer - unexpected data: ${i}`)}function ob(i){return i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer}function nc(){for(let i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0}function CS(i){return typeof i!="string"?i:Wl(i).buffer}function Rb(i,t=null){let e=process.getBuiltinModule("fs"),{Readable:n}=process.getBuiltinModule("stream"),s=e.createReadStream(i,t);return n.toWeb(s)}function MS(i){return rr(i)?Pd:Se?Yd:jd}function Nb(i={}){let t=new Jd,{docId:e}=t,n=i.url?lS(i.url):null,s=i.data?cS(i.data):null,a=i.httpHeaders||null,r=i.withCredentials===!0,o=i.password??null,l=i.range instanceof vr?i.range:null,c=Number.isInteger(i.rangeChunkSize)&&i.rangeChunkSize>0?i.rangeChunkSize:2**16,u=i.worker instanceof Xs?i.worker:null,h=i.verbosity,d=typeof i.docBaseUrl=="string"&&!Mr(i.docBaseUrl)?i.docBaseUrl:null,f=cl(i.cMapUrl),m=i.cMapPacked!==!1,y=cl(i.iccUrl),v=cl(i.standardFontDataUrl),p=cl(i.wasmUrl),g=i.stopAtErrors!==!0,b=Number.isInteger(i.maxImageSize)&&i.maxImageSize>-1?i.maxImageSize:-1,A=typeof i.isOffscreenCanvasSupported=="boolean"?i.isOffscreenCanvasSupported:!Se,S=typeof i.isImageDecoderSupported=="boolean"?i.isImageDecoderSupported:!Se,E=Number.isInteger(i.canvasMaxAreaInBytes)?i.canvasMaxAreaInBytes:-1,T=typeof i.disableFontFace=="boolean"?i.disableFontFace:Se,w=i.fontExtraProperties===!0,_=i.enableXfa===!0,C=i.ownerDocument||globalThis.document,D=i.disableRange===!0,N=i.disableStream===!0,z=i.disableAutoFetch===!0,X=i.pdfBug===!0,lt=i.CanvasFactory||(Se?Rd:Md),k=i.FilterFactory||(Se?Od:Dd),R=i.BinaryDataFactory||(Se?Nd:_l),kt=i.enableHWA===!0,Pe=i.enableWebGPU===!0?pS():Promise.resolve(!1),xi=i.useWasm!==!1,at=i.pagesMapper||new Zd,rt=typeof i.useSystemFonts=="boolean"?i.useSystemFonts:!Se&&!T,G=typeof i.useWorkerFetch=="boolean"?i.useWorkerFetch:!!(R===_l&&f&&m&&v&&p&&rr(f,document.baseURI)&&rr(v,document.baseURI)&&rr(p,document.baseURI)),Wt=null;$1(h);let Ct={canvasFactory:new lt({ownerDocument:C,enableHWA:kt}),filterFactory:new k({docId:e,ownerDocument:C}),binaryDataFactory:G?null:new R({cMapUrl:f,standardFontDataUrl:v,wasmUrl:p})};u||(u=Xs.create({verbosity:h,port:sn.workerPort}),t._worker=u);let St={docId:e,apiVersion:"6.2.108",data:s,password:o,disableAutoFetch:z,rangeChunkSize:c,docBaseUrl:d,enableXfa:_,evaluatorOptions:{maxImageSize:b,disableFontFace:T,ignoreErrors:g,isOffscreenCanvasSupported:A,isImageDecoderSupported:S,canvasMaxAreaInBytes:E,fontExtraProperties:w,useSystemFonts:rt,useWasm:xi,useWorkerFetch:G,cMapUrl:f,cMapPacked:m,iccUrl:y,standardFontDataUrl:v,wasmUrl:p,hasGPU:!1}},In={ownerDocument:C,pdfBug:X,styleElement:Wt,enableHWA:kt,loadingParams:{disableAutoFetch:z,enableXfa:_}};return Promise.all([u.promise,Pe]).then(function([,ac]){if(u.destroyed)throw new Error("Worker was destroyed");St.evaluatorOptions.hasGPU=ac;let Ff=u.messageHandler.sendWithPromise("GetDocRequest",St,s?[s.buffer]:null),Ws;if(!s)if(l)Ws=new Hd({pdfDataRangeTransport:l,disableRange:D,disableStream:N});else if(n){let Qs=MS(n);Ws=new Qs({url:n,httpHeaders:a,withCredentials:r,rangeChunkSize:c,disableRange:D,disableStream:N})}else throw new Error("getDocument - expected either `data`, `range`, or `url` parameter.");return Ff.then(Qs=>{if(u.destroyed)throw new Error("Worker was destroyed");let $s=new Rn(e,Qs,u.port),Vb=new nf($s,t,Ws,In,Ct,at);if(t._transport=Vb,t.destroyed)throw new Error("Loading aborted");$s.send("Ready",null)})}).catch(t._capability.reject).finally(t._setupCapability.resolve),t}function hb(i){return Math.floor(ht(i,0,1)*255).toString(16).padStart(2,"0")}function ir(i){return ht(i,0,1)*255}function kS(i,t){return i===t?0:i.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function gl(i){return i?i.nodeType===Node.ELEMENT_NODE?i.closest(".textLayer"):i.parentElement?.closest(".textLayer")||null:null}function LS(i,t,e,n){if(i===e)return t<=n;let s=i.compareDocumentPosition(e);return s&Node.DOCUMENT_POSITION_FOLLOWING?!0:s&Node.DOCUMENT_POSITION_PRECEDING?!1:null}function db(i,t,e){if(i.nodeType!==Node.ELEMENT_NODE||!i.classList.contains("textLayer")||t!==i.childNodes.length)return{container:i,offset:t};let n=i.lastChild;return n?.nodeType===Node.ELEMENT_NODE&&n.classList.contains("endOfContent")&&(n=n.previousSibling),!n||!e.contains(n)?null:n.nodeType===Node.TEXT_NODE?{container:n,offset:n.textContent.length}:{container:n,offset:n.childNodes.length}}function ml(i){return`${(i*100).toFixed(2)}%`}var BS,Se,Ti,On,td,Jt,Ae,Si,Ls,cr,P,H,fb,Pt,sr,bt,Ns,Cr,Ue,er,pb,ql,Pn,Ps,ar,Is,Nn,id,Ge,J,M,Wh,jy,Ys,Ql,bl,mb,ur,hr,nS,sS,dr,wi,Fs,vl,Hs,Je,Al,nd,Sl,qy,ad,rd,rS,Qh,Kt,od,ld,cd,kn,ud,rn,El,Bs,fr,tt,hd,Ky,Be,Ze,pr,gr,mr,Tl,Rs,Wy,Qy,dd,fd,Zy,pd,gd,yr,ze,md,yd,bd,vd,Ad,ve,Ai,Sd,Ed,Td,wd,_d,xd,uS,Tb,Cd,ul,Nt,Rn,wl,_l,xl,Md,Cl,Dd,Od,Rd,Nd,fS,kd,Jl,Yt,br,Ld,Bd,zd,tb,or,AS,SS,ES,eb,le,Zh,Ee,Ml,TS,wS,_S,rb,zs,Us,Gs,js,Pd,Id,Fd,Hd,Ud,Gd,Jh,lb,jd,Vd,Xd,Yd,qd,Kd,sn,Wd,Dn,Qd,$d,Zd,ks,cb,Dl,DS,ub,Vs,OS,Jd,vr,tf,ef,Xs,nf,sf,af,kb,Lb,Ar,Ol,Rl,rf,Ln,RS,Bn,NS,lr,At,of,Sr,lf,_i,cf,uf,hf,df,ff,pf,Er,gf,Nl,mf,yf,bf,kl,vf,Af,Tr,Ll,Sf,Ef,Tf,Bl,wf,zl,Pl,fl,_f,O,Il,Fl,wr,xf,_r,Cf,Hl,Ul,Gl,Mf,zn,jl,Df,xr,pl,nr,Ei,Of,Rf,Nf,kf,Vl,Xl,Yl,zb=Qb(()=>{BS={},Se=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),Ti=[1/0,1/0,-1/0,-1/0],On=new Float32Array(Ti),td=[.001,0,0,.001,0,0],Jt="http://www.w3.org/2000/svg",Ae={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Si={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Ls="pdfjs_internal_id_",cr="pdfjs_internal_editor_",P={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},H={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,INK_COLOR_AND_OPACITY:24,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},fb={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Pt={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},sr={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},bt={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26,RICHMEDIA:27},Ns={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Cr={ERRORS:0,WARNINGS:1,INFOS:5},Ue={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},er={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},pb={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},ql=Cr.WARNINGS;Pn=(function(){function t(e,n){this.message=e,this.name=n}return t.prototype=new Error,t.constructor=t,t})(),Ps=class extends Pn{constructor(t,e){super(t,"PasswordException"),this.code=e}},ar=class extends Pn{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},Is=class extends Pn{constructor(t){super(t,"InvalidPDFException")}},Nn=class extends Pn{constructor(t,e,n){super(t,"ResponseException"),this.status=e,this.missing=n}},id=class extends Pn{constructor(t){super(t,"FormatError")}},Ge=class extends Pn{constructor(t){super(t,"AbortException")}};J=class{static get isLittleEndian(){let t=new Uint8Array(4);t[0]=1;let e=new Uint32Array(t.buffer,0,1);return L(this,"isLittleEndian",e[0]===1)}static get isOffscreenCanvasSupported(){return L(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return L(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return L(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return L(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){let{platform:t,userAgent:e}=navigator;return L(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCanvasFilterSupported(){let t;return this.isOffscreenCanvasSupported?t=new OffscreenCanvas(1,1).getContext("2d"):typeof document<"u"&&(t=document.createElement("canvas").getContext("2d")),L(this,"isCanvasFilterSupported",t?.filter!==void 0)}static get isAlphaColorInputSupported(){if(typeof document>"u")return L(this,"isAlphaColorInputSupported",!1);let t=document.createElement("input");return t.type="color",t.setAttribute("alpha",""),t.value="#ff000080",L(this,"isAlphaColorInputSupported",t.value!=="#ff0000")}static get isBackdropFilterSupported(){return L(this,"isBackdropFilterSupported",typeof CSS<"u"&&CSS.supports("backdrop-filter","blur(1px)"))}},M=class{static get hexNums(){return L(this,"hexNums",Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0")))}static makeHexColor(t,e,n){return`#${this.hexNums[t]}${this.hexNums[e]}${this.hexNums[n]}`}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,n=0){let s=t[n],a=t[n+1];t[n]=s*e[0]+a*e[2]+e[4],t[n+1]=s*e[1]+a*e[3]+e[5]}static applyTransformToBezier(t,e,n=0){let s=e[0],a=e[1],r=e[2],o=e[3],l=e[4],c=e[5];for(let u=0;u<6;u+=2){let h=t[n+u],d=t[n+u+1];t[n+u]=h*s+d*r+l,t[n+u+1]=h*a+d*o+c}}static applyInverseTransform(t,e){let n=t[0],s=t[1],a=e[0]*e[3]-e[1]*e[2];t[0]=(n*e[3]-s*e[2]+e[2]*e[5]-e[4]*e[3])/a,t[1]=(-n*e[1]+s*e[0]+e[4]*e[1]-e[5]*e[0])/a}static axialAlignedBoundingBox(t,e,n){let s=e[0],a=e[1],r=e[2],o=e[3],l=e[4],c=e[5],u=t[0],h=t[1],d=t[2],f=t[3],m=s*u+l,y=m,v=s*d+l,p=v,g=o*h+c,b=g,A=o*f+c,S=A;if(a!==0||r!==0){let E=a*u,T=a*d,w=r*h,_=r*f;m+=w,p+=w,v+=_,y+=_,g+=E,S+=E,A+=T,b+=T}n[0]=Math.min(n[0],m,v,y,p),n[1]=Math.min(n[1],g,A,b,S),n[2]=Math.max(n[2],m,v,y,p),n[3]=Math.max(n[3],g,A,b,S)}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 n=t[0],s=t[1],a=t[2],r=t[3],o=n**2+s**2,l=n*a+s*r,c=a**2+r**2,u=(o+c)/2,h=Math.sqrt(u**2-(o*c-l**2));e[0]=Math.sqrt(u+h||1),e[1]=Math.sqrt(u-h||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 n=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),s=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(n>s)return null;let a=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 a>r?null:[n,a,s,r]}static pointBoundingBox(t,e,n){n[0]=Math.min(n[0],t),n[1]=Math.min(n[1],e),n[2]=Math.max(n[2],t),n[3]=Math.max(n[3],e)}static rectBoundingBox(t,e,n,s,a){a[0]=Math.min(a[0],t,n),a[1]=Math.min(a[1],e,s),a[2]=Math.max(a[2],t,n),a[3]=Math.max(a[3],e,s)}static#t(t,e,n,s,a,r,o,l,c,u){if(c<=0||c>=1)return;let h=1-c,d=c*c,f=d*c,m=h*(h*(h*t+3*c*e)+3*d*n)+f*s,y=h*(h*(h*a+3*c*r)+3*d*o)+f*l;u[0]=Math.min(u[0],m),u[1]=Math.min(u[1],y),u[2]=Math.max(u[2],m),u[3]=Math.max(u[3],y)}static#e(t,e,n,s,a,r,o,l,c,u,h,d){if(Math.abs(c)<1e-12){Math.abs(u)>=1e-12&&this.#t(t,e,n,s,a,r,o,l,-h/u,d);return}let f=u**2-4*h*c;if(f<0)return;let m=Math.sqrt(f),y=2*c;this.#t(t,e,n,s,a,r,o,l,(-u+m)/y,d),this.#t(t,e,n,s,a,r,o,l,(-u-m)/y,d)}static bezierBoundingBox(t,e,n,s,a,r,o,l,c){c[0]=Math.min(c[0],t,o),c[1]=Math.min(c[1],e,l),c[2]=Math.max(c[2],t,o),c[3]=Math.max(c[3],e,l),this.#e(t,n,a,o,e,s,r,l,3*(-t+3*(n-a)+o),6*(t-2*n+a),3*(n-t),c),this.#e(t,n,a,o,e,s,r,l,3*(-e+3*(s-r)+l),6*(e-2*s+r),3*(s-e),c)}};Wh=null,jy=null;Ys=()=>[],Ql=()=>new Map,bl=()=>Object.create(null),mb=()=>new Set;typeof Iterator.prototype.join!="function"&&(Iterator.prototype.join=function(i){return[...this].join(i)});ur=class i{constructor({viewBox:t,userUnit:e,scale:n,rotation:s,offsetX:a=0,offsetY:r=0,dontFlip:o=!1}){this.viewBox=t,this.userUnit=e,this.scale=n,this.rotation=s,this.offsetX=a,this.offsetY=r,n*=e;let l=(t[2]+t[0])/2,c=(t[3]+t[1])/2,u,h,d,f;switch(s%=360,s<0&&(s+=360),s){case 180:u=-1,h=0,d=0,f=1;break;case 90:u=0,h=1,d=1,f=0;break;case 270:u=0,h=-1,d=-1,f=0;break;case 0:u=1,h=0,d=0,f=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(d=-d,f=-f);let m,y,v,p;u===0?(m=Math.abs(c-t[1])*n+a,y=Math.abs(l-t[0])*n+r,v=(t[3]-t[1])*n,p=(t[2]-t[0])*n):(m=Math.abs(l-t[0])*n+a,y=Math.abs(c-t[1])*n+r,v=(t[2]-t[0])*n,p=(t[3]-t[1])*n),this.transform=[u*n,h*n,d*n,f*n,m-u*n*l-d*n*c,y-h*n*l-f*n*c],this.width=v,this.height=p}get rawDims(){let t=this.viewBox;return L(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:n=this.offsetX,offsetY:s=this.offsetY,dontFlip:a=!1}={}){return new i({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:n,offsetY:s,dontFlip:a})}convertToViewportPoint(t,e){let n=[t,e];return M.applyTransform(n,this.transform),n}convertToPdfPoint(t,e){let n=[t,e];return M.applyInverseTransform(n,this.transform),n}},hr=class i{static textContent(t){let e=[],n={items:e,styles:Object.create(null)};function s(a){if(!a)return;let r=null,o=a.name;if(o==="#text")r=a.value;else if(i.shouldBuildText(o))a?.attributes?.textContent?r=a.attributes.textContent:a.value&&(r=a.value);else return;if(r!==null&&e.push({str:r}),!!a.children)for(let l of a.children)s(l)}return s(t),n}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}},nS=/url\(|image-set\(/i,sS=/^on/i,dr=class{static get _allowedHtmlElements(){return L(this,"_allowedHtmlElements",new Set(["a","b","br","button","div","i","img","input","label","li","ol","option","p","select","span","sub","sup","textarea","ul"]))}static get _allowedSvgElements(){return L(this,"_allowedSvgElements",new Set(["ellipse","line","path","rect","svg"]))}static get _allowedRichTextElements(){return L(this,"_allowedRichTextElements",new Set(["a","b","br","div","i","li","ol","p","span","sub","sup","ul"]))}static get _allowedRichTextAttributes(){return L(this,"_allowedRichTextAttributes",new Set(["class","dir","style"]))}static get _allowedRichTextStyles(){return L(this,"_allowedRichTextStyles",new Set(["color","font","fontFamily","fontSize","fontStretch","fontStyle","fontWeight","kerningMode","letterSpacing","lineHeight","margin","marginBottom","marginLeft","marginRight","marginTop","orphans","paddingLeft","paddingRight","breakAfter","breakBefore","breakInside","tabInterval","tabStop","textAlign","textDecoration","textIndent","transform","verticalAlign","widows"]))}static setupStorage(t,e,n,s,a){let r=s.getValue(e,{value:null});switch(n.name){case"textarea":if(r.value!==null&&(t.textContent=r.value),a==="print")break;t.addEventListener("input",o=>{s.setValue(e,{value:o.target.value})});break;case"input":if(n.attributes.type==="radio"||n.attributes.type==="checkbox"){if(r.value===n.attributes.xfaOn?t.setAttribute("checked",!0):r.value===n.attributes.xfaOff&&t.removeAttribute("checked"),a==="print")break;t.addEventListener("change",o=>{s.setValue(e,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(r.value!==null&&t.setAttribute("value",r.value),a==="print")break;t.addEventListener("input",o=>{s.setValue(e,{value:o.target.value})})}break;case"select":if(r.value!==null){t.setAttribute("value",r.value);for(let o of n.children)o.attributes.value===r.value?o.attributes.selected=!0:Object.hasOwn(o.attributes,"selected")&&delete o.attributes.selected}t.addEventListener("input",o=>{let l=o.target.options,c=l.selectedIndex===-1?"":l[l.selectedIndex].value;s.setValue(e,{value:c})});break}}static setAttributes({html:t,element:e,storage:n=null,intent:s,linkService:a}){let{attributes:r}=e,o=t instanceof HTMLAnchorElement;r.type==="radio"&&(r.name=`${r.name}-${s}`);for(let[l,c]of Object.entries(r))if(c!=null&&!sS.test(l)&&!(s==="richText"&&!this._allowedRichTextAttributes.has(l)))switch(l){case"class":c.length&&t.setAttribute(l,c.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",c);break;case"style":if(s==="richText"){let u=this._allowedRichTextStyles;for(let[h,d]of Object.entries(c))u.has(h)&&!nS.test(d)&&(t.style[h]=d)}else Object.assign(t.style,c);break;case"textContent":t.textContent=c;break;default:(!o||l!=="href"&&l!=="newWindow")&&t.setAttribute(l,c)}o&&a?.addLinkAttributes(t,r.href,r.newWindow),n&&r.dataId&&this.setupStorage(t,r.dataId,e,n)}static#t(t,e,n){return n==="richText"?!e&&this._allowedRichTextElements.has(t)?document.createElement(t):null:e?e===Jt&&this._allowedSvgElements.has(t)?document.createElementNS(Jt,t):null:this._allowedHtmlElements.has(t)?document.createElement(t):null}static render(t){let e=t.annotationStorage,n=t.linkService,s=t.xfaHtml,a=t.intent||"display",r=this.#t(s.name,s.attributes?.xmlns,a)??document.createElement("div");s.attributes&&this.setAttributes({html:r,element:s,intent:a,linkService:n});let o=a!=="richText",l=t.div;if(l.append(r),t.viewport){let h=`matrix(${t.viewport.transform.join(",")})`;l.style.transform=h}o&&l.setAttribute("class","xfaLayer xfaFont");let c=[];if(s.children.length===0){if(s.value){let h=document.createTextNode(s.value);r.append(h),o&&hr.shouldBuildText(s.name)&&c.push(h)}return{textDivs:c}}let u=[[s,-1,r]];for(;u.length>0;){let[h,d,f]=u.at(-1);if(d+1===h.children.length){u.pop();continue}let m=h.children[++u.at(-1)[1]];if(m===null)continue;let{name:y}=m;if(y==="#text"){let p=document.createTextNode(m.value);c.push(p),f.append(p);continue}let v=this.#t(y,m.attributes?.xmlns,a);if(v){if(f.append(v),m.attributes&&this.setAttributes({html:v,element:m,storage:e,intent:a,linkService:n}),m.children?.length>0)u.push([m,-1,v]);else if(m.value){let p=document.createTextNode(m.value);o&&hr.shouldBuildText(y)&&c.push(p),v.append(p)}}}for(let h of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))h.setAttribute("readOnly",!0);return{textDivs:c}}static update(t){let e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}static getPageViewport(t,{scale:e=1,rotation:n=0}){let{width:s,height:a}=t.attributes.style;return new ur({viewBox:[0,0,parseInt(s,10),parseInt(a,10)],userUnit:1,scale:e,rotation:n})}},wi=class{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF};Fs=class extends Pn{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}};vl=class{#t=new Map;times=[];time(t){this.#t.has(t)&&I(`Timer is already running for ${t}`),this.#t.set(t,Date.now())}timeEnd(t){this.#t.has(t)||I(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.#t.get(t),end:Date.now()}),this.#t.delete(t)}toString(){let t=Math.max(...this.times.map(e=>e.name.length));return this.times.map(e=>`${e.name.padEnd(t)} ${e.end-e.start}ms
10
+ `).join("")}};Hs=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 n=parseInt(e[1],10),s=parseInt(e[2],10);s=s>=1&&s<=12?s-1:0;let a=parseInt(e[3],10);a=a>=1&&a<=31?a: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 c=e[7]||"Z",u=parseInt(e[8],10);u=u>=0&&u<=23?u:0;let h=parseInt(e[9],10)||0;return h=h>=0&&h<=59?h:0,c==="-"?(r+=u,o+=h):c==="+"&&(r-=u,o-=h),new Date(Date.UTC(n,s,a,r,o,l))}};Je=class i{constructor(){let{pixelRatio:t}=i;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,n,s,a=-1){let r=1/0,o=1/0,l=1/0;n=i.capPixels(n,a),n>0&&(r=Math.sqrt(n/(t*e))),s!==-1&&(o=s/t,l=s/e);let c=Math.min(r,o,l);return this.sx>c||this.sy>c?(this.sx=c,this.sy=c,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>=0){let n=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,n):n}return t}},Al=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"],nd=class{static get isDarkMode(){return L(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}},Sl=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:n}=window.getComputedStyle(t);return t.remove(),L(this,"commentForegroundColor",Ks(n))}};qy=new Map;ad=class i{#t=null;#e=null;#i;#n=null;#s=null;#r=null;#a=null;#o=null;static#c=null;constructor(t){this.#i=t,i.#c||=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",Te,{signal:e}),t.addEventListener("pointerdown",i.#l,{signal:e}));let n=this.#n=document.createElement("div");n.className="buttons",t.append(n);let s=this.#i.toolbarPosition;if(s){let{style:a}=t,r=this.#i._uiManager.direction==="ltr"?1-s[0]:s[0];a.insetInlineEnd=`${100*r}%`,a.top=`calc(${100*s[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return this.#t}static#l(t){t.stopPropagation()}#d(t){this.#i._focusEventsAllowed=!1,vt(t)}#h(t){this.#i._focusEventsAllowed=!0,vt(t)}#p(t){let e=this.#i._uiManager._signal;return!(e instanceof AbortSignal)||e.aborted?!1:(t.addEventListener("focusin",this.#d.bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",this.#h.bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Te,{signal:e}),!0)}hide(){this.#t.classList.add("hidden"),this.#e?.hideDropdown()}show(){this.#t.classList.remove("hidden"),this.#s?.shown(),this.#r?.shown()}addDeleteButton(){let{editorType:t,_uiManager:e}=this.#i,n=document.createElement("button");n.classList.add("basic","deleteButton"),n.tabIndex=0,n.setAttribute("data-l10n-id",i.#c[t]),this.#p(n)&&n.addEventListener("click",s=>{e.delete()},{signal:e._signal}),this.#n.append(n)}get#m(){let t=document.createElement("div");return t.className="divider",t}async addAltText(t){let e=await t.render();this.#p(e),this.#n.append(e,this.#m),this.#s=t}addComment(t,e=null){if(this.#r)return;let n=t.renderForToolbar();if(!n)return;this.#p(n);let s=this.#a=this.#m;e?(this.#n.insertBefore(n,e),this.#n.insertBefore(s,e)):this.#n.append(n,s),this.#r=t,t.toolbar=this}addColorPicker(t){if(this.#e)return;this.#e=t;let e=t.renderButton();this.#p(e),this.#n.append(e,this.#m)}async addEditSignatureButton(t){let e=this.#o=await t.renderEditButton(this.#i);this.#p(e),this.#n.append(e,this.#m)}removeButton(t){t==="comment"&&(this.#r?.removeToolbarCommentButton(),this.#r=null,this.#a?.remove(),this.#a=null)}async addButton(t,e){switch(t){case"colorPicker":e&&this.addColorPicker(e);break;case"altText":e&&await this.addAltText(e);break;case"editSignature":e&&await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break;case"comment":e&&this.addComment(e);break}}async addButtonBefore(t,e,n){if(!e&&t==="comment")return;let s=this.#n.querySelector(n);s&&t==="comment"&&this.addComment(e,s)}updateEditSignatureButton(t){this.#o&&(this.#o.title=t)}remove(){this.#t.remove(),this.#e?.destroy(),this.#e=null}},rd=class{#t=null;#e=null;#i;constructor(t){this.#i=t}#n(){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",Te,{signal:e});let n=this.#t=document.createElement("div");return n.className="buttons",t.append(n),this.#i.hasCommentManager()&&this.#r("commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{this.#i.commentSelection("floating_button")}),this.#r("highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{this.#i.highlightSelection("floating_button")}),t}#s(t,e){let n=0,s=0;for(let a of t){let r=a.y+a.height;if(r<n)continue;let o=a.x+(e?a.width:0);if(r>n){s=o,n=r;continue}e?o>s&&(s=o):o<s&&(s=o)}return[e?1-s:s,n]}show(t,e,n){let[s,a]=this.#s(e,n),{style:r}=this.#e||=this.#n();t.append(this.#e),r.insetInlineEnd=`${100*s}%`,r.top=`calc(${100*a}% + var(--editor-toolbar-vert-offset))`}hide(){this.#e.remove()}#r(t,e,n,s){let a=document.createElement("button");a.classList.add("basic",t),a.tabIndex=0,a.setAttribute("data-l10n-id",e);let r=document.createElement("span");a.append(r),r.className="visuallyHidden",r.setAttribute("data-l10n-id",n);let o=this.#i._signal;o instanceof AbortSignal&&!o.aborted&&(a.addEventListener("contextmenu",Te,{signal:o}),a.addEventListener("click",s,{signal:o})),this.#t.append(a)}},rS="f63eb798-ea37-4556-98de-f8303ee5a694",Qh=Object.freeze({internal:rS});Kt=class i{static#t=NaN;static#e=null;static#i=NaN;static#n=null;static initializeAndAddPointerId(t){(i.#e||=new Set).add(t)}static setPointer(t,e){i.#t||=e,i.#n??=t}static setTimeStamp(t){i.#i=t}static isSamePointerId(t){return i.#t===t}static isSamePointerIdOrRemove(t){return i.#t===t?!0:(i.#e?.delete(t),!1)}static isSamePointerType(t){return i.#n===t}static isInitializedAndDifferentPointerType(t){return i.#n!==null&&!i.isSamePointerType(t)}static isSameTimeStamp(t){return i.#i===t}static isUsingMultiplePointers(){return i.#e?.size>=1}static clearPointerType(){i.#n=null}static clearPointerIds(){i.#t=NaN,i.#e=null}static clearTimeStamp(){i.#i=NaN}},od=class{#t=0;get id(){return`${cr}${this.#t++}`}},ld=class i{#t=zf();#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="${Jt}"><rect width="1" height="1" style="fill:red;"/></svg>`,n=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),s=new Image;s.src=t;let a=s.decode().then(()=>(n.drawImage(s,0,0,1,1,0,0,1,3),new Uint32Array(n.getImageData(0,0,1,1).data.buffer)[0]===0));return L(this,"_isSVGFittingCanvas",a)}async#n(t,e){this.#i||=new Map;let n=this.#i.get(t);if(n===null)return null;if(n?.bitmap)return n.refCounter+=1,n;try{n||={bitmap:null,id:`image_${this.#t}_${this.#e++}`,refCounter:0,isSvg:!1};let s;if(typeof e=="string"?(n.url=e,s=await $l(e,"blob")):e instanceof File?s=n.file=e:e instanceof Blob&&(s=e),s.type==="image/svg+xml"){let a=i._isSVGFittingCanvas,r=new FileReader,o=new Image,l=new Promise((c,u)=>{o.onload=()=>{n.bitmap=o,n.isSvg=!0,c()},r.onload=async()=>{let h=n.svgUrl=r.result;o.src=await a?`${h}#svgView(preserveAspectRatio(none))`:h},o.onerror=r.onerror=u});r.readAsDataURL(s),await l}else n.bitmap=await createImageBitmap(s);n.refCounter=1}catch(s){I(s),n=null}return this.#i.set(t,n),n&&this.#i.set(n.id,n),n}async getFromFile(t){let{lastModified:e,name:n,size:s,type:a}=t;return this.#n(`${e}_${n}_${s}_${a}`,t)}async getFromUrl(t){return this.#n(t,t)}async getFromBlob(t,e){let n=await e;return this.#n(t,n)}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:n}=e;return delete e.blobPromise,this.getFromBlob(e.id,n)}return this.getFromUrl(e.url)}getFromCanvas(t,e){this.#i||=new Map;let n=this.#i.get(t);if(n?.bitmap)return n.refCounter+=1,n;let s=new OffscreenCanvas(e.width,e.height);return s.getContext("2d").drawImage(e,0,0),n={bitmap:s.transferToImageBitmap(),id:`image_${this.#t}_${this.#e++}`,refCounter:1,isSvg:!1},this.#i.set(t,n),this.#i.set(n.id,n),n}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:n}=e;if(!e.url&&!e.file){let s=new OffscreenCanvas(n.width,n.height);s.getContext("bitmaprenderer").transferFromImageBitmap(n),e.blobPromise=s.convertToBlob()}n.close?.(),e.bitmap=null}isValidId(t){return t.startsWith(`image_${this.#t}_`)}},cd=class{#t=[];#e=!1;#i;#n=-1;constructor(t=128){this.#i=t}add({cmd:t,undo:e,post:n,mustExec:s,type:a=NaN,overwriteIfSameType:r=!1,keepUndo:o=!1}){if(s&&t(),this.#e)return;let l={cmd:t,undo:e,post:n,type:a};if(this.#n===-1){this.#t.length>0&&(this.#t.length=0),this.#n=0,this.#t.push(l);return}if(r&&this.#t[this.#n].type===a){o&&(l.undo=this.#t[this.#n].undo),this.#t[this.#n]=l;return}let c=this.#n+1;c===this.#i?this.#t.splice(0,1):(this.#n=c,c<this.#t.length&&this.#t.splice(c)),this.#t.push(l)}undo(){if(this.#n===-1)return;this.#e=!0;let{undo:t,post:e}=this.#t[this.#n];t(),e?.(),this.#e=!1,this.#n-=1}redo(){if(this.#n<this.#t.length-1){this.#n+=1,this.#e=!0;let{cmd:t,post:e}=this.#t[this.#n];t(),e?.(),this.#e=!1}}hasSomethingToUndo(){return this.#n!==-1}hasSomethingToRedo(){return this.#n<this.#t.length-1}cleanType(t){if(this.#n!==-1){for(let e=this.#n;e>=0;e--)if(this.#t[e].type!==t){this.#t.splice(e+1,this.#n-e),this.#n=e;return}this.#t.length=0,this.#n=-1}}destroy(){this.#t=null}},kn=class i{static ALT=1;static CTRL=2;static META=4;static SHIFT=8;constructor(t){this.callbacks=new Map;let{isMac:e}=J.platform;for(let[n,s,a={}]of t){let r=n.some(o=>o.startsWith("mac+"));for(let o of n){let l=o;if(r){let h=o.startsWith("mac+");if(e!==h)continue;h&&(l=o.slice(4))}let[c,u]=i.#t(l);c!==null&&this.callbacks.getOrInsertComputed(c,Ys).push({callback:s,options:a,modifiers:u})}}}static#t(t){let e=null,n=0;for(let s of t.split("+")){if(s=s.trim(),!s)continue;let a=s.toUpperCase(),r=i[a];if(r){n|=r;continue}if(e!==null){I(`KeyboardManager: multiple keys in shortcut "${t}"`);break}e=a==="SPACE"?" ":s}return e===null&&I(`KeyboardManager: no key found in shortcut "${t}"`),[e,n]}static#e(t){let e=/^(?:Key([A-Z])|(?:Digit|Numpad)(\d))$/.exec(t);return e?e[1]?.toLowerCase()??e[2]:null}exec(t,e){let n=this.callbacks.get(e.key);if(!n){if(/^[a-z]$/i.test(e.key))return;let u=i.#e(e.code);if(u===null||u===e.key||(n=this.callbacks.get(u),!n))return}let s=(e.altKey?i.ALT:0)|(e.ctrlKey?i.CTRL:0)|(e.metaKey?i.META:0)|(e.shiftKey?i.SHIFT:0),a=n.find(u=>u.modifiers===s);if(!a)return;let{callback:r,options:{bubbles:o=!1,args:l=[],checker:c=null}}=a;c&&!c(t,e)||(r.bind(t,...l,e)(),o||vt(e))}},ud=class i{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){let t=new Map([["CanvasText",null],["Canvas",null]]);return aS(t),L(this,"_colors",t)}convert(t){let e=Ks(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(let[n,s]of this._colors)if(s.every((a,r)=>a===e[r]))return i._colorsMapping.get(n);return e}getHexCode(t){let e=this._colors.get(t);return e?M.makeHexColor(...e):t}},rn=class i{#t=new AbortController;#e=null;#i=null;#n=new Map;#s=new Map;#r=null;#a=null;#o=null;#c=null;#l=new cd;#d=null;#h=null;#p=null;#m=0;#g=new Set;#u=null;#f=null;#b=new Set;_editorUndoBar=null;#v=!1;#y=!1;#E=!1;#w=null;#A=null;#_=null;#T=null;#C=!1;#D=null;#O=new od;#M=!1;#k=!1;#L=!1;#N=null;#B=null;#P=null;#F=null;#X=null;#x=P.NONE;#S=new Set;#z=null;#U=null;#j=null;#W=null;#q=null;#K={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#I=[0,0];#V=null;#Y=null;#J=null;#tt=null;#H=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let t=i.prototype,e=r=>r.#Y.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&r.hasSomethingToControl(),n=(r,{target:o})=>{if(o instanceof HTMLInputElement){let{type:l}=o;return l!=="text"&&l!=="number"}return!0},s=this.TRANSLATE_SMALL,a=this.TRANSLATE_BIG;return L(this,"_keyboardManager",new kn([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:n}],[["ctrl+z","mac+meta+z"],t.undo,{checker:n}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:n}],[["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:n}],[["Enter"],t.addNewEditorFromKeyboard,{checker:(r,{target:o})=>!(o instanceof HTMLButtonElement)&&r.#Y.contains(o)&&!r.isEnterHandled}],[["Space"],t.addNewEditorFromKeyboard,{checker:(r,{target:o})=>!(o instanceof HTMLButtonElement)&&r.#Y.contains(document.activeElement)}],[["Escape"],t.unselectAll],[["ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-a,0],checker:e}],[["ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[a,0],checker:e}],[["ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-a],checker:e}],[["ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,a],checker:e}]]))}constructor(t,e,n,s,a,r,o,l,c,u,h,d,f,m,y,v){let p=this._signal=this.#t.signal;this.#Y=t,this.#J=e,this.#tt=n,this.#a=s,this.#d=a,this.#U=r,this.#q=l,this._eventBus=o;let g={signal:p,...Qh};o.on("editingaction",this.onEditingAction.bind(this),g),o.on("pagechanging",this.onPageChanging.bind(this),g),o.on("scalechanging",this.onScaleChanging.bind(this),g),o.on("rotationchanging",this.onRotationChanging.bind(this),g),o.on("setpreference",this.onSetPreference.bind(this),g),o.on("switchannotationeditorparams",b=>this.updateParams(b.type,b.value),g),window.addEventListener("pointerdown",()=>{this.#k=!0},{capture:!0,signal:p}),window.addEventListener("pointerup",()=>{this.#k=!1},{capture:!0,signal:p}),window.addEventListener("beforeunload",this.endCurrentEditing.bind(this),{capture:!0,signal:p}),this.#ot(),this.#ft(),this.#it(),this.#o=l.annotationStorage,this.#w=l.filterFactory,this.#j=c,this.#T=u||null,this.#v=h,this.#y=d,this.#E=f,this.#X=m||null,this.viewParameters={realScale:wi.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=y||null,this._supportsPinchToZoom=v!==!1,a?.setSidebarUiManager(this)}destroy(){this.#H?.resolve(),this.#H=null,this.#t?.abort(),this.#t=null,this._signal=null;for(let t of this.#s.values())t.destroy();this.#s.clear(),this.#n.clear(),this.#b.clear(),this.#F?.clear(),this.#e=null,this.#S.clear(),this.#l.destroy(),this.#a?.destroy(),this.#d?.destroy(),this.#U?.destroy(),this.#D?.hide(),this.#D=null,this.#P?.destroy(),this.#P=null,this.#i=null,this.#A&&(clearTimeout(this.#A),this.#A=null),this.#V&&(clearTimeout(this.#V),this.#V=null),this._editorUndoBar?.destroy(),this.#q=null}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return this.#X}get useNewAltTextFlow(){return this.#y}get useNewAltTextWhenAddingImage(){return this.#E}get hcmFilter(){return L(this,"hcmFilter",this.#j?this.#w.addHCMFilter(this.#j.foreground,this.#j.background):"none")}get direction(){return L(this,"direction",getComputedStyle(this.#Y).direction)}get _highlightColors(){return L(this,"_highlightColors",this.#T?new Map(this.#T.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 L(this,"highlightColors",null);let e=new Map,n=!!this.#j;for(let[s,a]of t){let r=s.endsWith("_HCM");if(n&&r){e.set(s.replace("_HCM",""),a);continue}!n&&!r&&e.set(s,a)}return L(this,"highlightColors",e)}get highlightColorNames(){return L(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.#p=t}setMainHighlightColorPicker(t){this.#P=t}editAltText(t,e=!1){this.#a?.editAltText(this,t,e)}hasCommentManager(){return!!this.#d}editComment(t,e,n,s){this.#d?.showDialog(this,t,e,n,s)}selectComment(t,e){this.#s.get(t)?.getEditorByUID(e)?.toggleComment(!0,!0)}updateComment(t){this.#d?.updateComment(t.getData())}updatePopupColor(t){this.#d?.updatePopupColor(t)}removeComment(t){this.#d?.removeComments([t.uid])}deleteComment(t,e){let n=()=>{t.comment=e},s=()=>{this._editorUndoBar?.show(n,"comment"),this.toggleComment(null),t.comment=null};this.addCommands({cmd:s,undo:n,mustExec:!0})}toggleComment(t,e,n=void 0){this.#d?.toggleCommentPopup(t,e,n)}makeCommentColor(t,e){return t&&this.#d?.makeCommentColor(t,e)||null}getCommentDialogElement(){return this.#d?.dialogElement||null}async waitForEditorsRendered(t){if(this.#s.has(t-1))return;let{resolve:e,promise:n}=Promise.withResolvers(),s=a=>{a.pageNumber===t&&(this._eventBus.off("editorsrendered",s),e())};this._eventBus.on("editorsrendered",s,Qh),await n}getSignature(t){this.#U?.getSignature({uiManager:this,editor:t})}get signatureManager(){return this.#U}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal,...Qh}),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.#E=e)}onPageChanging({pageNumber:t}){this.#m=t-1}deletePage(t){for(let e of this.getEditors(t))e.remove();this.#s.delete(t),this.#m===t&&(this.#m=0)}focusMainContainer(){this.#Y.focus()}findParent(t,e){for(let n of this.#s.values()){let{x:s,y:a,width:r,height:o}=n.div.getBoundingClientRect();if(t>=s&&t<=s+r&&e>=a&&e<=a+o)return n}return null}disableUserSelect(t=!1){this.#J.classList.toggle("noUserSelect",t)}addShouldRescale(t){this.#b.add(t)}removeShouldRescale(t){this.#b.delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*wi.PDF_TO_CSS_UNITS;for(let e of this.#b)e.onScaleChanging();this.#p?.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}#Z({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t}#et(t){let{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(let n of this.#s.values())if(n.hasTextLayer(t))return n;return null}highlightSelection(t="",e=!1){let n=document.getSelection();if(!n||n.isCollapsed)return;let{anchorNode:s,anchorOffset:a,focusNode:r,focusOffset:o}=n,l=n.toString(),u=this.#Z(n).closest(".textLayer"),h=this.getSelectionBoxes(u);if(!h)return;n.empty();let d=this.#et(u),f=this.#x===P.NONE,m=()=>{let y=d?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:s,anchorOffset:a,focusNode:r,focusOffset:o,text:l});f&&this.showAllEditors("highlight",!0,!0),e&&y?.editComment()};if(f){this.switchToMode(P.HIGHLIGHT,m);return}m()}commentSelection(t=""){this.highlightSelection(t,!0)}endCurrentEditing(){this.commitOrRemove(),this.currentLayer?.endDrawingSession(!1)}#at(){let t=document.getSelection();if(!t||t.isCollapsed)return;let n=this.#Z(t).closest(".textLayer"),s=this.getSelectionBoxes(n);s&&(this.#D||=new rd(this),this.#D.show(n,s,this.direction==="ltr"))}getAndRemoveDataFromAnnotationStorage(t){if(!this.#o)return null;let e=`${cr}${t}`,n=this.#o.getRawValue(e);return n&&this.#o.remove(e),n}addToAnnotationStorage(t){!t.isEmpty()&&this.#o&&!this.#o.has(t.id)&&this.#o.setValue(t.id,t)}a11yAlert(t,e=null){let n=this.#tt;n&&(n.setAttribute("data-l10n-id",t),e?n.setAttribute("data-l10n-args",JSON.stringify(e)):n.removeAttribute("data-l10n-args"))}#rt(){let t=document.getSelection();if(!t||t.isCollapsed){this.#z&&(this.#D?.hide(),this.#z=null,this.#R({hasSelectedText:!1}));return}let{anchorNode:e}=t;if(e===this.#z)return;let s=this.#Z(t).closest(".textLayer");if(!s){this.#z&&(this.#D?.hide(),this.#z=null,this.#R({hasSelectedText:!1}));return}if(this.#D?.hide(),this.#z=e,this.#R({hasSelectedText:!0}),!(this.#x!==P.HIGHLIGHT&&this.#x!==P.NONE)&&(this.#x===P.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#C=this.isShiftKeyDown,!this.isShiftKeyDown)){let a=this.#x===P.HIGHLIGHT?this.#et(s):null;if(a?.toggleDrawing(),this.#k){let r=new AbortController,o=this.combinedSignal(r),l=c=>{c.type==="pointerup"&&c.button!==0||(r.abort(),a?.toggleDrawing(!0),c.type==="pointerup"&&this.#Q("main_toolbar"))};window.addEventListener("pointerup",l,{signal:o}),window.addEventListener("blur",l,{signal:o})}else a?.toggleDrawing(!0),this.#Q("main_toolbar")}}#Q(t=""){this.#x===P.HIGHLIGHT?this.highlightSelection(t):this.#v&&this.#at()}#ot(){document.addEventListener("selectionchange",this.#rt.bind(this),{signal:this._signal})}#lt(){if(this.#_)return;this.#_=new AbortController;let t=this.combinedSignal(this.#_);window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})}#ct(){this.#_?.abort(),this.#_=null}blur(){if(this.isShiftKeyDown=!1,this.#C&&(this.#C=!1,this.#Q("main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of this.#S)if(e.div.contains(t)){this.#B=[e,t],e._focusEventsAllowed=!1;break}}focus(){if(!this.#B)return;let[t,e]=this.#B;this.#B=null,e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}#it(){if(this.#N)return;this.#N=new AbortController;let t=this.combinedSignal(this.#N);window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})}#ut(){this.#N?.abort(),this.#N=null}#ht(){if(this.#h)return;this.#h=new AbortController;let t=this.combinedSignal(this.#h);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})}#dt(){this.#h?.abort(),this.#h=null}#ft(){let t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}addEditListeners(){this.#it(),this.setEditingState(!0)}removeEditListeners(){this.#ut(),this.setEditingState(!1)}dragOver(t){for(let{type:e}of t.dataTransfer.items)for(let n of this.#f)if(n.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(let e of t.dataTransfer.items)for(let n of this.#f)if(n.isHandlingMimeForPasting(e.type)){n.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),this.#e?.commitOrRemove(),!this.hasSelection)return;let e=[];for(let n of this.#S){let s=n.serialize(!0);s&&e.push(s)}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 a of e.items)for(let r of this.#f)if(r.isHandlingMimeForPasting(a.type)){r.paste(a,this.currentLayer);return}let n=e.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(a){I(`paste: "${a.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();let s=this.currentLayer;try{let a=[];for(let l of n){let c=await s.deserialize(l);if(!c)return;a.push(c)}let r=()=>{for(let l of a)this.#nt(l);this.#st(a)},o=()=>{for(let l of a)l.remove()};this.addCommands({cmd:r,undo:o,mustExec:!0})}catch(a){I(`paste: "${a.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),this.#x!==P.NONE&&!this.isEditorHandlingKeyboard&&i._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,this.#C&&(this.#C=!1,this.#Q("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}}updatePageIndex(t,e){for(let s of this.getEditors(t))s.pageIndex=e;let n=this.#r.get(t);n&&(n.pageIndex=e,this.#s.set(e,n),this.#M?n.enable():n.disable())}startUpdatePages(){this.#r=new Map(this.#s),this.#s.clear()}endUpdatePages(){this.#r=null}clonePage(t,e){for(let n of this.getEditors(t)){let s=n.serialize(n.mode!==P.HIGHLIGHT);s&&(s.pageIndex=e,s.id=this.getId(),s.isClone=!0,delete s.popupRef,this.#o.setValue(s.id,s))}}findClonesForPage(t){let e=[],{pageIndex:n}=t;for(let[s,a]of this.#o)a.pageIndex===n&&a.isClone&&(this.#o.remove(s),e.push(t.deserialize(a).then(r=>{r&&(r.isClone=!0,t.addOrRebuild(r))})));return Promise.all(e)}#R(t){Object.entries(t).some(([n,s])=>this.#K[n]!==s)&&(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(this.#K,t)}),this.#x===P.HIGHLIGHT&&t.hasSelectedEditor===!1&&this.#G([[H.HIGHLIGHT_FREE,!0]]))}#G(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#lt(),this.#ht(),this.#R({isEditing:this.#x!==P.NONE,isEmpty:this.#$(),hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:this.#l.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#ct(),this.#dt(),this.#R({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!this.#f){this.#f=t;for(let e of this.#f)this.#G(e.defaultPropertiesToUpdate)}}getId(){return this.#O.id}get currentLayer(){return this.#s.get(this.#m)}getLayer(t){return this.#s.get(t)}get currentPageIndex(){return this.#m}addLayer(t){this.#s.set(t.pageIndex,t),this.#M?t.enable():t.disable()}removeLayer(t){this.#s.delete(t.pageIndex)}async updateMode(t,e=null,n=!1,s=!1,a=!1,r=!1){if(this.#x!==t&&!(this.#H&&(await this.#H.promise,!this.#H))){if(this.#H=Promise.withResolvers(),this.#p?.commitOrRemove(),this.#x===P.POPUP&&this.#d?.hideSidebar(),this.#d?.destroyPopup(),this.#x=t,t===P.NONE){this.setEditingState(!1),this.#gt();for(let o of this.#n.values())o.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),this.#H.resolve();return}for(let o of this.#n.values())o.addStandaloneCommentButton();t===P.SIGNATURE&&await this.#U?.loadSignatures(),n&&Kt.clearPointerType(),this.setEditingState(!0),await this.#pt(),this.unselectAll();for(let o of this.#s.values())o.updateMode(t);if(t===P.POPUP){this.#i||=await this.#q.getAnnotationsByType(new Set(this.#f.map(c=>c._editorType)));let o=new Set,l=[];for(let c of this.#n.values()){let{annotationElementId:u,hasComment:h,deleted:d}=c;u&&o.add(u),h&&!d&&l.push(c.getData())}for(let c of this.#i){let{id:u,popupRef:h,contentsObj:d}=c;h&&d?.str&&!o.has(u)&&!this.#g.has(u)&&l.push(c)}this.#d?.showSidebar(l)}if(!e){s&&this.addNewEditorFromKeyboard(),this.#H.resolve();return}for(let o of this.#n.values())o.uid===e?(this.setSelected(o),r?o.editComment():a?o.enterInEditMode():o.focus()):o.unselect();this.#H.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==this.#x&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(this.#f){switch(t){case H.CREATE:this.currentLayer.addNewEditor(e);return;case H.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#W||=new Map).set(t,e),this.showAllEditors("highlight",e);break}if(this.hasSelection)for(let n of this.#S)n.updateParams(t,e);else for(let n of this.#f)n.updateDefaultParams(t,e)}}showAllEditors(t,e,n=!1){for(let a of this.#n.values())a.editorType===t&&a.show(e);(this.#W?.get(H.HIGHLIGHT_SHOW_ALL)??!0)!==e&&this.#G([[H.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(this.#L!==t){this.#L=t;for(let e of this.#s.values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}async#pt(){if(!this.#M){this.#M=!0;let t=[];for(let e of this.#s.values())t.push(e.enable());await Promise.all(t);for(let e of this.#n.values())e.enable()}}#gt(){if(this.unselectAll(),this.#M){this.#M=!1;for(let t of this.#s.values())t.disable();for(let t of this.#n.values())t.disable()}}*getEditors(t){for(let e of this.#n.values())e.pageIndex===t&&(yield e)}getEditor(t){return this.#n.get(t)}addEditor(t){this.#n.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#A&&clearTimeout(this.#A),this.#A=setTimeout(()=>{this.focusMainContainer(),this.#A=null},0)),this.#n.delete(t.id),t.annotationElementId&&this.#F?.delete(t.annotationElementId),this.unselect(t),(!t.annotationElementId||!this.#g.has(t.annotationElementId))&&this.#o?.remove(t.id)}addDeletedAnnotationElement(t){this.#g.add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return this.#g.has(t)}removeDeletedAnnotationElement(t){this.#g.delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}#nt(t){let e=this.#s.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#mt(){let t=null;for(t of this.#S);return t}updateUI(t){this.#mt===t&&this.#G(t.propertiesToUpdate)}updateUIForDefaultProperties(t){this.#G(t.defaultPropertiesToUpdate)}toggleSelected(t){if(this.#S.has(t)){this.#S.delete(t),t.unselect(),this.#R({hasSelectedEditor:this.hasSelection});return}this.#S.add(t),t.select(),this.#G(t.propertiesToUpdate),this.#R({hasSelectedEditor:!0})}setSelected(t){this.updateToolbar({mode:t.mode,editId:t.uid}),this.#p?.commitOrRemove();for(let e of this.#S)e!==t&&e.unselect();this.#d?.destroyPopup(),this.#S.clear(),this.#S.add(t),t.select(),this.#G(t.propertiesToUpdate),this.#R({hasSelectedEditor:!0})}get firstSelectedEditor(){return this.#S.values().next().value}unselect(t){t.unselect(),this.#S.delete(t),this.#R({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#S.size!==0}get isEnterHandled(){return this.#S.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#l.undo(),this.#R({hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#$()}),this._editorUndoBar?.hide()}redo(){this.#l.redo(),this.#R({hasSomethingToUndo:!0,hasSomethingToRedo:this.#l.hasSomethingToRedo(),isEmpty:this.#$()})}addCommands(t){this.#l.add(t),this.#R({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#$()})}cleanUndoStack(t){this.#l.cleanType(t)}#$(){if(this.#n.size===0)return!0;if(this.#n.size===1)for(let t of this.#n.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.#S],n=()=>{this._editorUndoBar?.show(s,e.length===1?e[0].editorType:e.length);for(let a of e)a.remove()},s=()=>{for(let a of e)this.#nt(a)};this.addCommands({cmd:n,undo:s,mustExec:!0})}commitOrRemove(){this.#e?.commitOrRemove()}hasSomethingToControl(){return this.#e||this.hasSelection}#st(t){for(let e of this.#S)e.unselect();this.#S.clear();for(let e of t)e.isEmpty()||(this.#S.add(e),e.select());this.#R({hasSelectedEditor:this.hasSelection})}selectAll(){for(let t of this.#S)t.commit();this.#st(this.#n.values())}unselectAll(){if(!(this.#e&&(this.#e.commitOrRemove(),this.#x!==P.NONE))&&!this.#p?.commitOrRemove()&&(this.#d?.destroyPopup(),!!this.hasSelection)){for(let t of this.#S)t.unselect();this.#S.clear(),this.#R({hasSelectedEditor:!1})}}translateSelectedEditors(t,e,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#I[0]+=t,this.#I[1]+=e;let[s,a]=this.#I,r=[...this.#S],o=1e3;this.#V&&clearTimeout(this.#V),this.#V=setTimeout(()=>{this.#V=null,this.#I[0]=this.#I[1]=0,this.addCommands({cmd:()=>{for(let l of r)this.#n.has(l.id)&&(l.translateInPage(s,a),l.translationDone())},undo:()=>{for(let l of r)this.#n.has(l.id)&&(l.translateInPage(-s,-a),l.translationDone())},mustExec:!1})},o);for(let l of r)l.translateInPage(t,e),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#u=new Map;for(let t of this.#S)this.#u.set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#u)return!1;this.disableUserSelect(!1);let t=this.#u;this.#u=null;let e=!1;for(let[{x:s,y:a,pageIndex:r},o]of t)o.newX=s,o.newY=a,o.newPageIndex=r,e||=s!==o.savedX||a!==o.savedY||r!==o.savedPageIndex;if(!e)return!1;let n=(s,a,r,o)=>{if(this.#n.has(s.id)){let l=this.#s.get(o);l?s._setParentAndPosition(l,a,r):(s.pageIndex=o,s.x=a,s.y=r)}};return this.addCommands({cmd:()=>{for(let[s,{newX:a,newY:r,newPageIndex:o}]of t)n(s,a,r,o)},undo:()=>{for(let[s,{savedX:a,savedY:r,savedPageIndex:o}]of t)n(s,a,r,o)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(this.#u)for(let n of this.#u.keys())n.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.#S.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return this.#e===t}getActive(){return this.#e}getMode(){return this.#x}isEditingMode(){return this.#x!==P.NONE}get imageManager(){return L(this,"imageManager",new ld)}getSelectionBoxes(t){if(!t)return null;let e=document.getSelection();for(let c=0,u=e.rangeCount;c<u;c++)if(!t.contains(e.getRangeAt(c).commonAncestorContainer))return null;let{x:n,y:s,width:a,height:r}=t.getBoundingClientRect(),o;switch(t.getAttribute("data-main-rotation")){case"90":o=(c,u,h,d)=>({x:(u-s)/r,y:1-(c+h-n)/a,width:d/r,height:h/a});break;case"180":o=(c,u,h,d)=>({x:1-(c+h-n)/a,y:1-(u+d-s)/r,width:h/a,height:d/r});break;case"270":o=(c,u,h,d)=>({x:1-(u+d-s)/r,y:(c-n)/a,width:d/r,height:h/a});break;default:o=(c,u,h,d)=>({x:(c-n)/a,y:(u-s)/r,width:h/a,height:d/r});break}let l=[];for(let c=0,u=e.rangeCount;c<u;c++){let h=e.getRangeAt(c);if(!h.collapsed)for(let{x:d,y:f,width:m,height:y}of h.getClientRects())m===0||y===0||l.push(o(d,f,m,y))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:t,id:e}){(this.#c||=new Map).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){this.#c?.delete(t)}renderAnnotationElement(t){let e=this.#c?.get(t.data.id);if(!e)return;let n=this.#o.getRawValue(e);n&&(this.#x===P.NONE&&!n.hasBeenModified||n.renderAnnotationElement(t))}setMissingCanvas(t,e,n){let s=this.#F?.get(t);s&&(s.setCanvas(e,n),this.#F.delete(t))}addMissingCanvas(t,e){(this.#F||=new Map).set(t,e)}},El=class i{#t=null;#e=!1;#i=null;#n=null;#s=null;#r=null;#a=!1;#o=null;#c=null;#l=null;#d=null;#h=!1;static#p=null;static _l10n=null;constructor(t){this.#c=t,this.#h=t._uiManager.useNewAltTextFlow,i.#p||=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){i._l10n??=t}async render(){let t=this.#i=document.createElement("button");t.className="altText",t.tabIndex="0";let e=this.#n=document.createElement("span");t.append(e),this.#h?(t.classList.add("new"),t.setAttribute("data-l10n-id",i.#p.missing),e.setAttribute("data-l10n-id",i.#p["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));let n=this.#c._uiManager._signal;t.addEventListener("contextmenu",Te,{signal:n}),t.addEventListener("pointerdown",a=>a.stopPropagation(),{signal:n});let s=a=>{a.preventDefault(),this.#c._uiManager.editAltText(this.#c),this.#h&&this.#c._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#m}})};return t.addEventListener("click",s,{capture:!0,signal:n}),t.addEventListener("keydown",a=>{a.target===t&&a.key==="Enter"&&(this.#a=!0,s(a))},{signal:n}),await this.#g(),t}get#m(){return this.#t&&"added"||this.#t===null&&this.guessedText&&"review"||"missing"}finish(){this.#i&&(this.#i.focus({focusVisible:this.#a}),this.#a=!1)}isEmpty(){return this.#h?this.#t===null:!this.#t&&!this.#e}hasData(){return this.#h?this.#t!==null||!!this.#l:this.isEmpty()}get guessedText(){return this.#l}async setGuessedText(t){this.#t===null&&(this.#l=t,this.#d=await i._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t}),this.#g())}toggleAltTextBadge(t=!1){if(!this.#h||this.#t){this.#o?.remove(),this.#o=null;return}if(!this.#o){let e=this.#o=document.createElement("div");e.className="noAltTextBadge",this.#c.div.append(e)}this.#o.classList.toggle("hidden",!t)}serialize(t){let e=this.#t;return!t&&this.#l===e&&(e=this.#d),{altText:e,decorative:this.#e,guessedText:this.#l,textWithDisclaimer:this.#d}}get data(){return{altText:this.#t,decorative:this.#e}}set data({altText:t,decorative:e,guessedText:n,textWithDisclaimer:s,cancel:a=!1}){n&&(this.#l=n,this.#d=s),!(this.#t===t&&this.#e===e)&&(a||(this.#t=t,this.#e=e),this.#g())}toggle(t=!1){this.#i&&(!t&&this.#r&&(clearTimeout(this.#r),this.#r=null),this.#i.disabled=!t)}shown(){this.#c._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#m}})}destroy(){this.#i?.remove(),this.#i=null,this.#n=null,this.#s=null,this.#o?.remove(),this.#o=null}async#g(){let t=this.#i;if(!t)return;if(this.#h){if(t.classList.toggle("done",!!this.#t),t.setAttribute("data-l10n-id",i.#p[this.#m]),this.#n?.setAttribute("data-l10n-id",i.#p[`${this.#m}-label`]),!this.#t){this.#s?.remove();return}}else{if(!this.#t&&!this.#e){t.classList.remove("done"),this.#s?.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=this.#s;if(!e){this.#s=e=document.createElement("span"),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${this.#c.id}`;let s=100,a=this.#c._uiManager._signal;a.addEventListener("abort",()=>{clearTimeout(this.#r),this.#r=null},{once:!0}),t.addEventListener("mouseenter",()=>{this.#r=setTimeout(()=>{this.#r=null,this.#s.classList.add("show"),this.#c._reportTelemetry({action:"alt_text_tooltip"})},s)},{signal:a}),t.addEventListener("mouseleave",()=>{this.#r&&(clearTimeout(this.#r),this.#r=null),this.#s?.classList.remove("show")},{signal:a})}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.#c.getElementForAltText()?.setAttribute("aria-describedby",e.id)}},Bs=class{#t=null;#e=null;#i=!1;#n=null;#s=null;#r=null;#a=null;#o=null;#c=!1;#l=null;constructor(t){this.#n=t}renderForToolbar(){let t=this.#e=document.createElement("button");return t.className="comment",this.#d(t,!1)}renderForStandalone(){let t=this.#t=document.createElement("button");t.className="annotationCommentButton";let e=this.#n.commentButtonPosition;if(e){let{style:n}=t;n.insetInlineEnd=`calc(${100*(this.#n._uiManager.direction==="ltr"?1-e[0]:e[0])}% - var(--comment-button-dim))`,n.top=`calc(${100*e[1]}% - var(--comment-button-dim))`;let s=this.#n.commentButtonColor;s&&(n.backgroundColor=s)}return this.#d(t,!0)}focusButton(){setTimeout(()=>{(this.#t??this.#e)?.focus()},0)}onUpdatedColor(){if(!this.#t)return;let t=this.#n.commentButtonColor;t&&(this.#t.style.backgroundColor=t),this.#n._uiManager.updatePopupColor(this.#n)}get commentButtonWidth(){return(this.#t?.getBoundingClientRect().width??0)/this.#n.parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(this.#l)return this.#l;if(!this.#t)return null;let{x:t,y:e,height:n}=this.#t.getBoundingClientRect(),{x:s,y:a,width:r,height:o}=this.#n.parent.boundingClientRect;return[(t-s)/r,(e+n-a)/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)}#d(t,e){if(!this.#n._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.#n._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));let n=this.#n._uiManager._signal;if(!(n instanceof AbortSignal)||n.aborted)return t;t.addEventListener("contextmenu",Te,{signal:n}),e&&(t.addEventListener("focusin",a=>{this.#n._focusEventsAllowed=!1,vt(a)},{capture:!0,signal:n}),t.addEventListener("focusout",a=>{this.#n._focusEventsAllowed=!0,vt(a)},{capture:!0,signal:n})),t.addEventListener("pointerdown",a=>a.stopPropagation(),{signal:n});let s=a=>{a.preventDefault(),t===this.#e?this.edit():this.#n.toggleComment(!0)};return t.addEventListener("click",s,{capture:!0,signal:n}),t.addEventListener("keydown",a=>{a.target===t&&a.key==="Enter"&&(this.#i=!0,s(a))},{signal:n}),t.addEventListener("pointerenter",()=>{this.#n.toggleComment(!1,!0)},{signal:n}),t.addEventListener("pointerleave",()=>{this.#n.toggleComment(!1,!1)},{signal:n}),t}edit(t){let e=this.commentPopupPositionInLayer,n,s;if(e)[n,s]=e;else{[n,s]=this.#n.commentButtonPosition;let{width:u,height:h,x:d,y:f}=this.#n;n=d+n*u,s=f+s*h}let a=this.#n.parent.boundingClientRect,{x:r,y:o,width:l,height:c}=a;this.#n._uiManager.editComment(this.#n,r+n*l,o+s*c,{...t,parentDimensions:a})}finish(){this.#e&&(this.#e.focus({focusVisible:this.#i}),this.#i=!1)}isDeleted(){return this.#c||this.#a===""}isEmpty(){return this.#a===null}hasBeenEdited(){return this.isDeleted()||this.#a!==this.#s}serialize(){return this.data}get data(){return{text:this.#a,richText:this.#r,date:this.#o,deleted:this.isDeleted()}}set data(t){if(t!==this.#a&&(this.#r=null),t===null){this.#a="",this.#c=!0;return}this.#a=t,this.#o=new Date,this.#c=!1}restoreData({text:t,richText:e,date:n}){this.#a=t,this.#r=e,this.#o=n,this.#c=!1}setInitialText(t,e=null){this.#s=t,this.data=t,this.#o=null,this.#r=e}shown(){}destroy(){this.#e?.remove(),this.#e=null,this.#t?.remove(),this.#t=null,this.#a="",this.#r=null,this.#o=null,this.#n=null,this.#i=!1,this.#c=!1}},fr=class i{#t;#e=!1;#i=null;#n;#s;#r;#a;#o=null;#c;#l=null;#d;#h=null;constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:n=null,onPinchStart:s=null,onPinching:a=null,onPinchEnd:r=null,signal:o}){this.#t=t,this.#i=n,this.#n=e,this.#s=s,this.#r=a,this.#a=r,this.#d=new AbortController,this.#c=AbortSignal.any([o,this.#d.signal]),t.addEventListener("touchstart",this.#p.bind(this),{passive:!1,signal:this.#c})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Je.pixelRatio}#p(t){if(this.#n?.())return;if(t.touches.length===1){if(this.#o)return;let s=this.#o=new AbortController,a=AbortSignal.any([this.#c,s.signal]),r=this.#t,o={capture:!0,signal:a,passive:!1},l=c=>{c.pointerType==="touch"&&(this.#o?.abort(),this.#o=null)};r.addEventListener("pointerdown",c=>{c.pointerType==="touch"&&(vt(c),l(c))},o),r.addEventListener("pointerup",l,o),r.addEventListener("pointercancel",l,o);return}if(!this.#h){this.#h=new AbortController;let s=AbortSignal.any([this.#c,this.#h.signal]),a=this.#t,r={signal:s,capture:!1,passive:!1};a.addEventListener("touchmove",this.#m.bind(this),r);let o=this.#g.bind(this);a.addEventListener("touchend",o,r),a.addEventListener("touchcancel",o,r),r.capture=!0,a.addEventListener("pointerdown",vt,r),a.addEventListener("pointermove",vt,r),a.addEventListener("pointercancel",vt,r),a.addEventListener("pointerup",vt,r),this.#s?.()}if(vt(t),t.touches.length!==2||this.#i?.()){this.#l=null;return}let[e,n]=t.touches;e.identifier>n.identifier&&([e,n]=[n,e]),this.#l={touch0X:e.screenX,touch0Y:e.screenY,touch1X:n.screenX,touch1Y:n.screenY}}#m(t){if(!this.#l||t.touches.length!==2)return;vt(t);let[e,n]=t.touches;e.identifier>n.identifier&&([e,n]=[n,e]);let{screenX:s,screenY:a}=e,{screenX:r,screenY:o}=n,l=this.#l,{touch0X:c,touch0Y:u,touch1X:h,touch1Y:d}=l,f=h-c,m=d-u,y=r-s,v=o-a,p=Math.hypot(y,v)||1,g=Math.hypot(f,m)||1;if(!this.#e&&Math.abs(g-p)<=i.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=s,l.touch0Y=a,l.touch1X=r,l.touch1Y=o,!this.#e){this.#e=!0;return}let b=[(s+r)/2,(a+o)/2];this.#r?.(b,g,p)}#g(t){t.touches.length>=2||(this.#h&&(this.#h.abort(),this.#h=null,this.#a?.()),this.#l&&(vt(t),this.#l=null,this.#e=!1))}destroy(){this.#d?.abort(),this.#d=null,this.#o?.abort(),this.#o=null}},tt=class i{#t=null;#e=null;#i=null;#n=null;#s=null;#r=!1;#a=null;#o="";#c=null;#l=null;#d=null;#h=null;#p=null;#m="";#g=!1;#u=null;#f=!1;#b=!1;#v=!1;#y=null;#E=0;#w=0;#A=null;#_=null;isSelected=!1;_isCopy=!1;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nAlert=null;static _l10nResizer=null;#T=!1;#C=i._zIndex++;static _borderLineWidth=-1;static _colorManager=new ud;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){let t=i.prototype._resizeWithKeyboard,e=rn.TRANSLATE_SMALL,n=rn.TRANSLATE_BIG;return L(this,"_resizerKeyboardManager",new kn([[["ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-n,0]}],[["ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[n,0]}],[["ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-n]}],[["ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,n]}],[["Escape"],i.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,this.canAddComment=!0;let{rotation:e,rawDims:{pageWidth:n,pageHeight:s,pageX:a,pageY:r}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,s],this.pageTranslation=[a,r];let[o,l]=this.parentDimensions;this.x=t.x/o,this.y=t.y/l,this.isAttachedToDOM=!1,this.deleted=!1}updatePageIndex(t){this.pageIndex=t}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 L(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new hd({id:t._uiManager.getId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(i._l10n??=t,i._l10nAlert??=Object.freeze({highlight:"pdfjs-editor-highlight-added-alert",freetext:"pdfjs-editor-freetext-added-alert",ink:"pdfjs-editor-ink-added-alert",stamp:"pdfjs-editor-stamp-added-alert",signature:"pdfjs-editor-signature-added-alert"}),i._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"}),i._borderLineWidth!==-1)return;let n=getComputedStyle(document.documentElement);i._borderLineWidth=parseFloat(n.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.#T}set _isDraggable(t){this.#T=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.#C}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(this.#I(),this.#h?.remove(),this.#h=null),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#g?this.#g=!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,n,s){let[a,r]=this.parentDimensions;[n,s]=this.screenToPageTranslation(n,s),this.x=(t+n)/a,this.y=(e+s)/r,this.fixAndSetPosition()}_moveAfterPaste(t,e){if(this.isClone){delete this.isClone;return}let[n,s]=this.parentDimensions;this.setAt(t*n,e*s,this.width*n,this.height*s),this._onTranslated()}#D([t,e],n,s){[n,s]=this.screenToPageTranslation(n,s),this.x+=n/t,this.y+=s/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(t,e){this.#D(this.parentDimensions,t,e)}translateInPage(t,e){this.#u||=[this.x,this.y,this.width,this.height],this.#D(this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){this.#u||=[this.x,this.y,this.width,this.height];let{div:n,parentDimensions:[s,a]}=this;if(this.x+=t/s,this.y+=e/a,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:h,y:d}=this.div.getBoundingClientRect();this.parent.findNewParent(this,h,d)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:r,y:o}=this,[l,c]=this.getBaseTranslation();r+=l,o+=c;let{style:u}=n;u.left=`${(100*r).toFixed(2)}%`,u.top=`${(100*o).toFixed(2)}%`,this._onTranslating(r,o),n.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!this.#u&&(this.#u[0]!==this.x||this.#u[1]!==this.y)}get _hasBeenResized(){return!!this.#u&&(this.#u[2]!==this.width||this.#u[3]!==this.height)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:n}=i,s=n/t,a=n/e;switch(this.rotation){case 90:return[-s,a];case 180:return[s,a];case 270:return[s,-a];default:return[-s,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){let{div:{style:e},pageDimensions:[n,s]}=this,{x:a,y:r,width:o,height:l}=this;if(o*=n,l*=s,a*=n,r*=s,this._mustFixPosition)switch(t){case 0:a=ht(a,0,n-o),r=ht(r,0,s-l);break;case 90:a=ht(a,0,n-l),r=ht(r,o,s);break;case 180:a=ht(a,o,n),r=ht(r,l,s);break;case 270:a=ht(a,l,n),r=ht(r,0,s-o);break}this.x=a/=n,this.y=r/=s;let[c,u]=this.getBaseTranslation();a+=c,r+=u,e.left=`${(100*a).toFixed(2)}%`,e.top=`${(100*r).toFixed(2)}%`,this.moveInDOM()}static#O(t,e,n){switch(n){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}screenToPageTranslation(t,e){return i.#O(t,e,this.parentRotation)}pageTranslationToScreen(t,e){return i.#O(t,e,360-this.parentRotation)}#M(t){switch(t){case 90:{let[e,n]=this.pageDimensions;return[0,-e/n,n/e,0]}case 180:return[-1,0,0,-1];case 270:{let[e,n]=this.pageDimensions;return[0,e/n,-n/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,n]}=this;return[e*t,n*t]}setDims(){let{div:{style:t},width:e,height:n}=this;t.width=`${(100*e).toFixed(2)}%`,t.height=`${(100*n).toFixed(2)}%`}getInitialTranslation(){return[0,0]}#k(){if(this.#c)return;this.#c=document.createElement("div"),this.#c.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 n of t){let s=document.createElement("div");this.#c.append(s),s.classList.add("resizer",n),s.setAttribute("data-resizer-name",n),s.addEventListener("pointerdown",this.#L.bind(this,n),{signal:e}),s.addEventListener("contextmenu",Te,{signal:e}),s.tabIndex=-1}this.div.prepend(this.#c)}#L(t,e){e.preventDefault();let{isMac:n}=J.platform;if(e.button!==0||e.ctrlKey&&n)return;this.#i?.toggle(!1);let s=this._isDraggable;this._isDraggable=!1,this.#l=[e.screenX,e.screenY];let a=new AbortController,r=this._uiManager.combinedSignal(a);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#P.bind(this,t),{passive:!0,capture:!0,signal:r}),window.addEventListener("touchmove",vt,{passive:!1,signal:r}),window.addEventListener("contextmenu",Te,{signal:r}),this.#d={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 c=()=>{a.abort(),this.parent.togglePointerEvents(!0),this.#i?.toggle(!0),this._isDraggable=s,this.parent.div.style.cursor=o,this.div.style.cursor=l,this.#B()};window.addEventListener("pointerup",c,{signal:r}),window.addEventListener("blur",c,{signal:r})}#N(t,e,n,s){this.width=n,this.height=s,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()}_onResized(){}#B(){if(!this.#d)return;let{savedX:t,savedY:e,savedWidth:n,savedHeight:s}=this.#d;this.#d=null;let a=this.x,r=this.y,o=this.width,l=this.height;a===t&&r===e&&o===n&&l===s||this.addCommands({cmd:this.#N.bind(this,a,r,o,l),undo:this.#N.bind(this,t,e,n,s),mustExec:!0})}static _round(t){return Math.round(t*1e4)/1e4}#P(t,e){let[n,s]=this.parentDimensions,a=this.x,r=this.y,o=this.width,l=this.height,c=i.MIN_SIZE/n,u=i.MIN_SIZE/s,h=this.#M(this.rotation),d=(k,R)=>[h[0]*k+h[2]*R,h[1]*k+h[3]*R],f=this.#M(360-this.rotation),m=(k,R)=>[f[0]*k+f[2]*R,f[1]*k+f[3]*R],y,v,p=!1,g=!1;switch(t){case"topLeft":p=!0,y=(k,R)=>[0,0],v=(k,R)=>[k,R];break;case"topMiddle":y=(k,R)=>[k/2,0],v=(k,R)=>[k/2,R];break;case"topRight":p=!0,y=(k,R)=>[k,0],v=(k,R)=>[0,R];break;case"middleRight":g=!0,y=(k,R)=>[k,R/2],v=(k,R)=>[0,R/2];break;case"bottomRight":p=!0,y=(k,R)=>[k,R],v=(k,R)=>[0,0];break;case"bottomMiddle":y=(k,R)=>[k/2,R],v=(k,R)=>[k/2,0];break;case"bottomLeft":p=!0,y=(k,R)=>[0,R],v=(k,R)=>[k,0];break;case"middleLeft":g=!0,y=(k,R)=>[0,R/2],v=(k,R)=>[k,R/2];break}let b=y(o,l),A=v(o,l),S=d(...A),E=i._round(a+S[0]),T=i._round(r+S[1]),w=1,_=1,C,D;if(e.fromKeyboard)({deltaX:C,deltaY:D}=e);else{let{screenX:k,screenY:R}=e,[kt,Lt]=this.#l;[C,D]=this.screenToPageTranslation(k-kt,R-Lt),this.#l[0]=k,this.#l[1]=R}if([C,D]=m(C/n,D/s),p){let k=Math.hypot(o,l);w=_=Math.max(Math.min(Math.hypot(A[0]-b[0]-C,A[1]-b[1]-D)/k,1/o,1/l),c/o,u/l)}else g?w=ht(Math.abs(A[0]-b[0]-C),c,1)/o:_=ht(Math.abs(A[1]-b[1]-D),u,1)/l;let N=i._round(o*w),z=i._round(l*_);S=d(...v(N,z));let X=E-S[0],lt=T-S[1];this.#u||=[this.x,this.y,this.width,this.height],this.width=N,this.height=z,this.x=X,this.y=lt,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 ad(this),this.div.append(this._editToolbar.render());let{toolbarButtons:t}=this;if(t)for(let[e,n]of t)await this._editToolbar.addButton(e,n);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||(El.initialize(i._l10n),this.#i=new El(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.#n?.focusButton()}addCommentButton(){return this.canAddComment?this.#n||=new Bs(this):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(this.#s){this._uiManager.isEditingMode()&&this.#s.classList.remove("hidden");return}this.hasComment&&(this.#s=this.#n.renderForStandalone(),this.div.append(this.#s))}}removeStandaloneCommentButton(){this.#n.removeStandaloneCommentButton(),this.#s=null}hideStandaloneCommentButton(){this.#s?.classList.add("hidden")}get comment(){if(!this.#n)return null;let{data:{richText:t,text:e,date:n,deleted:s}}=this.#n;return{text:e,richText:t,date:n,deleted:s,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(t){this.#n||=new Bs(this),typeof t=="object"&&t!==null?this.#n.restoreData(t):this.#n.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:n}){if(!e||(this.#n||=new Bs(this),this.#n.setInitialText(t,n),!this.annotationElementId))return;let s=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);s&&this.updateFromAnnotationLayer(s)}get hasEditedComment(){return this.#n?.hasBeenEdited()}get hasDeletedComment(){return this.#n?.isDeleted()}get hasComment(){return!!this.#n&&!this.#n.isEmpty()&&!this.#n.isDeleted()}async editComment(t){this.#n||=new Bs(this),this.#n.edit(t)}toggleComment(t,e=void 0){this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){this.#n.setSelectedButton(t)}addComment(t){if(this.hasEditedComment){let[,,,s]=t.rect,[a]=this.pageDimensions,[r]=this.pageTranslation,o=r+a+1,l=s-100,c=o+180;t.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[o,l,c,s]}}}updateFromAnnotationLayer({popup:{contents:t,deleted:e}}){this.#n.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.#r?-1:0,t.setAttribute("role","application"),this.defaultL10nId&&t.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||t.classList.add("hidden"),this.setInForeground(),this.#U();let[e,n]=this.parentDimensions;this.parentRotation%180!==0&&(t.style.maxWidth=`${(100*n/e).toFixed(2)}%`,t.style.maxHeight=`${(100*e/n).toFixed(2)}%`);let[s,a]=this.getInitialTranslation();return this.translate(s,a),Eb(this,t,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(this.#_||=new fr({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#F.bind(this),onPinching:this.#X.bind(this),onPinchEnd:this.#x.bind(this),signal:this._uiManager._signal})),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),t}#F(){this.#d={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#i?.toggle(!1),this.parent.togglePointerEvents(!1)}#X(t,e,n){let a=.7*(n/e)+1-.7;if(a===1)return;let r=this.#M(this.rotation),o=(E,T)=>[r[0]*E+r[2]*T,r[1]*E+r[3]*T],[l,c]=this.parentDimensions,u=this.x,h=this.y,d=this.width,f=this.height,m=i.MIN_SIZE/l,y=i.MIN_SIZE/c;a=Math.max(Math.min(a,1/d,1/f),m/d,y/f);let v=i._round(d*a),p=i._round(f*a);if(v===d&&p===f)return;this.#u||=[u,h,d,f];let g=o(d/2,f/2),b=i._round(u+g[0]),A=i._round(h+g[1]),S=o(v/2,p/2);this.x=b-S[0],this.y=A-S[1],this.width=v,this.height=p,this.setDims(),this.fixAndSetPosition(),this._onResizing()}#x(){this.#i?.toggle(!0),this.parent.togglePointerEvents(!0),this.#B()}pointerdown(t){let{isMac:e}=J.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(this.#g=!0,this._isDraggable){this.#z(t);return}this.#S(t)}#S(t){let{isMac:e}=J.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}#z(t){let{isSelected:e}=this;this._uiManager.setUpDragSession();let n=!1,s=new AbortController,a=this._uiManager.combinedSignal(s),r={capture:!0,passive:!1,signal:a},o=c=>{s.abort(),this.#a=null,this.#g=!1,this._uiManager.endDragSession()||this.#S(c),n&&this._onStopDragging()};e&&(this.#E=t.clientX,this.#w=t.clientY,this.#a=t.pointerId,this.#o=t.pointerType,window.addEventListener("pointermove",c=>{n||(n=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());let{clientX:u,clientY:h,pointerId:d}=c;if(d!==this.#a){vt(c);return}let[f,m]=this.screenToPageTranslation(u-this.#E,h-this.#w);this.#E=u,this.#w=h,this._uiManager.dragSelectedEditors(f,m)},r),window.addEventListener("touchmove",vt,r),window.addEventListener("pointerdown",c=>{c.pointerType===this.#o&&(this.#_||c.isPrimary)&&o(c),vt(c)},r));let l=c=>{if(!this.#a||this.#a===c.pointerId){o(c);return}vt(c)};window.addEventListener("pointerup",l,{signal:a}),window.addEventListener("blur",l,{signal:a})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#y&&clearTimeout(this.#y),this.#y=setTimeout(()=>{this.#y=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(t,e,n){t.changeParent(this),this.x=e,this.y=n,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e,n=this.rotation){let s=this.parentScale,[a,r]=this.pageDimensions,[o,l]=this.pageTranslation,c=t/s,u=e/s,h=this.x*a,d=this.y*r,f=this.width*a,m=this.height*r;switch(n){case 0:return[h+c+o,r-d-u-m+l,h+c+f+o,r-d-u+l];case 90:return[h+u+o,r-d+c+l,h+u+m+o,r-d+c+f+l];case 180:return[h-c-f+o,r-d+u+l,h-c+o,r-d+u+m+l];case 270:return[h-u-m+o,r-d-c-f+l,h-u+o,r-d-c+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){let[n,s,a,r]=t,o=a-n,l=r-s;switch(this.rotation){case 0:return[n,e-r,o,l];case 90:return[n,e-s,l,o];case 180:return[a,e-s,o,l];case 270:return[a,e-r,l,o];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&i._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){this.#n?.onUpdatedColor()}getData(){let{comment:{text:t,color:e,date:n,opacity:s,deleted:a,richText:r},uid:o,pageIndex:l,creationDate:c,modificationDate:u}=this;return{id:o,pageIndex:l,rect:this.getPDFRect(),richText:r,contentsObj:{str:t},creationDate:c,modificationDate:n||u,popupRef:!a,color:e,opacity:s}}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.#v}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:t,left:e,bottom:n,right:s}=this.getClientDimensions(),{innerHeight:a,innerWidth:r}=window;return e<r&&s>0&&t<a&&n>0}#U(){if(this.#p||!this.div)return;this.#p=new AbortController;let t=this._uiManager.combinedSignal(this.#p);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}rebuild(){this.#U()}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,n){let s=new this.prototype.constructor({parent:e,id:n.getId(),uiManager:n,annotationElementId:t.annotationElementId,creationDate:t.creationDate,modificationDate:t.modificationDate});s.rotation=t.rotation,s.#t=t.accessibilityData,s._isCopy=t.isCopy||!1;let[a,r]=s.pageDimensions,[o,l,c,u]=s.getRectInCurrentCoords(t.rect,r);return s.x=o/a,s.y=l/r,s.width=c/a,s.height=u/r,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.#p?.abort(),this.#p=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),this.#y&&(clearTimeout(this.#y),this.#y=null),this.#I(),this.removeEditToolbar(),this.#A){for(let t of this.#A.values())clearTimeout(t);this.#A=null}this.parent=null,this.#_?.destroy(),this.#_=null,this.#h?.remove(),this.#h=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#k(),this.#c.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,[n,s,a,r]=this.getPDFRect();return[i._round(n+(a-n)*t),i._round(s+(r-s)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return this.#n.commentPopupPositionInLayer}set commentPopupPosition(t){this.#n.commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return this.#n.hasDefaultPopupPosition()}get commentButtonWidth(){return this.#n.commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){this.#n?.setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),this.#d={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let e=this.#c.children;if(!this.#e){this.#e=Array.from(e);let r=this.#j.bind(this),o=this.#W.bind(this),l=this._uiManager._signal;for(let c of this.#e){let u=c.getAttribute("data-resizer-name");c.setAttribute("role","spinbutton"),c.addEventListener("keydown",r,{signal:l}),c.addEventListener("blur",o,{signal:l}),c.addEventListener("focus",this.#q.bind(this,u),{signal:l}),c.setAttribute("data-l10n-id",i._l10nResizer[u])}}let n=this.#e[0],s=0;for(let r of e){if(r===n)break;s++}let a=(360-this.rotation+this.parentRotation)%360/90*(this.#e.length/4);if(a!==s){if(a<s)for(let o=0;o<s-a;o++)this.#c.append(this.#c.firstElementChild);else if(a>s)for(let o=0;o<a-s;o++)this.#c.firstElementChild.before(this.#c.lastElementChild);let r=0;for(let o of e){let c=this.#e[r++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",i._l10nResizer[c])}}this.#K(0),this.#v=!0,this.#c.firstElementChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#j(t){i._resizerKeyboardManager.exec(this,t)}#W(t){this.#v&&t.relatedTarget?.parentNode!==this.#c&&this.#I()}#q(t){this.#m=this.#v?t:""}#K(t){if(this.#e)for(let e of this.#e)e.tabIndex=t}_resizeWithKeyboard(t,e){this.#v&&this.#P(this.#m,{deltaX:t,deltaY:e,fromKeyboard:!0})}#I(){this.#v=!1,this.#K(-1),this.#B()}_stopResizingWithKeyboard(){this.#I(),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.#c?.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.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}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.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return this.#f}set isEditing(t){this.#f=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.#A||=new Map;let{action:n}=t,s=this.#A.get(n);s&&clearTimeout(s),s=setTimeout(()=>{this._reportTelemetry(t),this.#A.delete(n),this.#A.size===0&&(this.#A=null)},i._telemetryTimeout),this.#A.set(n,s);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.#r=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#r=!0}updateFakeAnnotationElement(t){if(!this.#h&&!this.deleted){this.#h=t.addFakeAnnotation(this);return}if(this.deleted){this.#h.remove(),this.#h=null;return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&this.#h.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 n=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),n.before(e)}return e}resetAnnotationElement(t){let{firstElementChild:e}=t.container;e?.nodeName==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}},hd=class extends tt{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},Ky=3285377520,Be=4294901760,Ze=65535,pr=class{constructor(t){this.h1=t?t&4294967295:Ky,this.h2=t?t&4294967295:Ky}update(t){let e,n;if(typeof t=="string"){e=new Uint8Array(t.length*2),n=0;for(let y=0,v=t.length;y<v;y++){let p=t.charCodeAt(y);p<=255?e[n++]=p:(e[n++]=p>>>8,e[n++]=p&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),n=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");let s=n>>2,a=n-s*4,r=new Uint32Array(e.buffer,0,s),o=0,l=0,c=this.h1,u=this.h2,h=3432918353,d=461845907,f=h&Ze,m=d&Ze;for(let y=0;y<s;y++)y&1?(o=r[y],o=o*h&Be|o*f&Ze,o=o<<15|o>>>17,o=o*d&Be|o*m&Ze,c^=o,c=c<<13|c>>>19,c=c*5+3864292196):(l=r[y],l=l*h&Be|l*f&Ze,l=l<<15|l>>>17,l=l*d&Be|l*m&Ze,u^=l,u=u<<13|u>>>19,u=u*5+3864292196);switch(o=0,a){case 3:o^=e[s*4+2]<<16;case 2:o^=e[s*4+1]<<8;case 1:o^=e[s*4],o=o*h&Be|o*f&Ze,o=o<<15|o>>>17,o=o*d&Be|o*m&Ze,s&1?c^=o:u^=o}this.h1=c,this.h2=u}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&Be|t*36045&Ze,e=e*4283543511&Be|((e<<16|t>>>16)*2950163797&Be)>>>16,t^=e>>>1,t=t*444984403&Be|t*60499&Ze,e=e*3301882366&Be|((e<<16|t>>>16)*3120437893&Be)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}},gr=Object.freeze({map:null,hash:"",transfer:void 0}),mr=class{#t=!1;#e=null;#i=null;#n=new Map;onSetModified=null;onResetModified=null;onAnnotationEditor=null;getValue(t,e){let n=this.#n.get(t);return n===void 0?e:Object.assign(e,n)}getRawValue(t){return this.#n.get(t)}remove(t){let e=this.#n.get(t);e!==void 0&&(e instanceof tt&&this.#i.delete(e.annotationElementId),this.#n.delete(t),this.#n.size===0&&this.resetModified(),!this.#n.values().some(n=>n instanceof tt)&&this.onAnnotationEditor?.(null))}setValue(t,e){let n=this.#n.get(t),s=!1;if(n!==void 0)for(let[a,r]of Object.entries(e))n[a]!==r&&(s=!0,n[a]=r);else s=!0,this.#n.set(t,e);s&&this.#s(),e instanceof tt&&((this.#i||=new Map).set(e.annotationElementId,e),this.onAnnotationEditor?.(e.constructor._type))}has(t){return this.#n.has(t)}get size(){return this.#n.size}#s(){this.#t||(this.#t=!0,this.onSetModified?.())}resetModified(){this.#t&&(this.#t=!1,this.onResetModified?.())}get print(){return new Tl(this)}get serializable(){if(this.#n.size===0)return gr;let t=new Map,e=new pr,n=[],s=Object.create(null),a=!1;for(let[r,o]of this.#n){let l=o instanceof tt?o.serialize(!1,s):o;o.page&&(o.pageIndex=o.page._pageIndex,delete o.page),l&&(t.set(r,l),e.update(`${r}:${JSON.stringify(l)}`),a||=!!l.bitmap)}if(a)for(let r of t.values())r.bitmap&&n.push(r.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:n}:gr}get editorStats(){let t=null,e=new Map,n=0,s=0;for(let a of this.#n.values()){if(!(a instanceof tt)){a.popup&&(a.popup.deleted?s+=1:n+=1);continue}a.isCommentDeleted?s+=1:a.hasEditedComment&&(n+=1);let r=a.telemetryFinalData;if(!r)continue;let{type:o}=r;e.getOrInsertComputed(o,()=>Object.getPrototypeOf(a).constructor),t||=Object.create(null);let l=t[o]||=new Map;for(let[c,u]of Object.entries(r)){if(c==="type")continue;let h=l.getOrInsertComputed(c,Ql);h.set(u,(h.get(u)??0)+1)}}if((s>0||n>0)&&(t||=Object.create(null),t.comments={deleted:s,edited:n}),!t)return null;for(let[a,r]of e)t[a]=r.computeTelemetryFinalData(t[a]);return t}resetModifiedIds(){this.#e=null}updateEditor(t,e){let n=this.#i?.get(t);return n?(n.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 n of this.#i.values())n.serialize()&&t.push(n.annotationElementId);let e="";if(t.length){let n=new pr;n.update(t.join(",")),e=n.hexdigest()}return this.#e={ids:new Set(t),hash:e}}[Symbol.iterator](){return this.#n.entries()}},Tl=class extends mr{#t=gr;constructor(t){super();let{serializable:e}=t;if(e===gr)return;let{map:n,hash:s,transfer:a}=e,r=structuredClone(n,a?{transfer:a}:null);this.#t={map:r,hash:s,transfer:[]}}get print(){Q("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#t}get modifiedIds(){return L(this,"modifiedIds",{ids:new Set,hash:""})}},Rs="__forcedDependency",{floor:Wy,ceil:Qy}=Math;dd=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],fd=class{#t;#e;constructor(t,e){this.#t=t,this.#e=e}get length(){return this.#t.length}isEmpty(t){return this.#t[t]===dd}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}},Zy=(i,t)=>i?.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1})),pd=class{#t=[[1,0,0,1,0,0]];#e=[-1/0,-1/0,1/0,1/0];#i=new Float64Array(Ti);_pendingBBoxIdx=-1;#n;#s;#r;#a;_savesStack=[];_markedContentStack=[];constructor(t,e){this.#n=t.width,this.#s=t.height,this.#o(e)}growOperationsCount(t){t>=this.#a.length&&this.#o(t,this.#a)}#o(t,e){let n=new ArrayBuffer(t*4);this.#r=new Uint8ClampedArray(n),this.#a=new Uint32Array(n),e&&e.length>0?(this.#a.set(e),this.#a.fill(dd,e.length)):this.#a.fill(dd)}get clipBox(){return this.#e}save(t){return this.#e={__proto__:this.#e},this._savesStack.push(t),this}restore(t,e){let n=Object.getPrototypeOf(this.#e);if(n===null)return this;this.#e=n;let s=this._savesStack.pop();return s!==void 0&&(e?.(s,t),this.#a[t]=this.#a[s]),this}recordOpenMarker(t){return this._savesStack.push(t),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(t,e){let n=this._savesStack.pop();return n!==void 0&&(e?.(n,t),this.#a[t]=this.#a[n]),this}beginMarkedContent(t){return this._markedContentStack.push(t),this}endMarkedContent(t,e){let n=this._markedContentStack.pop();return n!==void 0&&(e?.(n,t),this.#a[t]=this.#a[n]),this}pushBaseTransform(t){return this.#t.push(M.multiplyByDOMMatrix(this.#t.at(-1),t.getTransform())),this}popBaseTransform(){return this.#t.length>1&&this.#t.pop(),this}resetBBox(t){return this._pendingBBoxIdx!==t&&(this._pendingBBoxIdx=t,this.#i.set(Ti,0)),this}recordClipBox(t,e,n,s,a,r){let o=M.multiplyByDOMMatrix(this.#t.at(-1),e.getTransform()),l=Ti.slice();M.axialAlignedBoundingBox([n,a,s,r],o,l);let c=M.intersect(this.#e,l);return c?(this.#e[0]=c[0],this.#e[1]=c[1],this.#e[2]=c[2],this.#e[3]=c[3]):(this.#e[0]=this.#e[1]=1/0,this.#e[2]=this.#e[3]=-1/0),this}recordBBox(t,e,n,s,a,r){let o=this.#e;if(o[0]===1/0)return this;let l=M.multiplyByDOMMatrix(this.#t.at(-1),e.getTransform());if(o[0]===-1/0)return M.axialAlignedBoundingBox([n,a,s,r],l,this.#i),this;let c=Ti.slice();return M.axialAlignedBoundingBox([n,a,s,r],l,c),this.#i[0]=ht(c[0],o[0],this.#i[0]),this.#i[1]=ht(c[1],o[1],this.#i[1]),this.#i[2]=ht(c[2],this.#i[2],o[2]),this.#i[3]=ht(c[3],this.#i[3],o[3]),this}recordFullPageBBox(t){return this.#i[0]=Math.max(0,this.#e[0]),this.#i[1]=Math.max(0,this.#e[1]),this.#i[2]=Math.min(this.#n,this.#e[2]),this.#i[3]=Math.min(this.#s,this.#e[3]),this}recordOperation(t,e=!1,n){if(this._pendingBBoxIdx!==t)return this;let s=Wy(this.#i[0]*256/this.#n),a=Wy(this.#i[1]*256/this.#s),r=Qy(this.#i[2]*256/this.#n),o=Qy(this.#i[3]*256/this.#s);if($y(this.#r,t,s,a,r,o),n)for(let l of n)for(let c of l)c!==t&&$y(this.#r,c,s,a,r,o);return e||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(t){return this._pendingBBoxIdx===t&&(this._pendingBBoxIdx=-1,this.#e[0]=Math.max(this.#e[0],this.#i[0]),this.#e[1]=Math.max(this.#e[1],this.#i[1]),this.#e[2]=Math.min(this.#e[2],this.#i[2]),this.#e[3]=Math.min(this.#e[3],this.#i[3])),this}take(){return new fd(this.#a,this.#r)}takeDebugMetadata(){throw new Error("Unreachable")}recordSimpleData(t,e){return this}recordIncrementalData(t,e){return this}resetIncrementalData(t,e){return this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,n){return this}recordFutureForcedDependency(t,e){return this}inheritSimpleDataAsFutureForcedDependencies(t){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(t,e,n,s=1,a=0,r=0,o){return this}getSimpleIndex(t){}recordDependencies(t,e){return this}recordNamedDependency(t,e){return this}recordShowTextOperation(t,e=!1){return this}},gd=class{#t={__proto__:null};#e={__proto__:null,transform:[],moveText:[],sameLineText:[],[Rs]:[]};#i=new Map;#n=new Set;#s=new Map;#r;#a;#o;constructor(t,e=!1){this.#o=t,e&&(this.#r=new Map,this.#a=(n,s)=>{Zy(this.#r,s).dependencies.add(n)})}get clipBox(){return this.#o.clipBox}growOperationsCount(t){this.#o.growOperationsCount(t)}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},[Rs]:{__proto__:this.#e[Rs]}},this.#o.save(t),this}restore(t){this.#o.restore(t,this.#a);let e=Object.getPrototypeOf(this.#t);return e===null?this:(this.#t=e,this.#e=Object.getPrototypeOf(this.#e),this)}recordOpenMarker(t){return this.#o.recordOpenMarker(t,this.#a),this}getOpenMarker(){return this.#o.getOpenMarker()}recordCloseMarker(t){return this.#o.recordCloseMarker(t,this.#a),this}beginMarkedContent(t){return this.#o.beginMarkedContent(t),this}endMarkedContent(t){return this.#o.endMarkedContent(t,this.#a),this}pushBaseTransform(t){return this.#o.pushBaseTransform(t),this}popBaseTransform(){return this.#o.popBaseTransform(),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,n){this.#t[t]=this.#i.get(e)??n}recordFutureForcedDependency(t,e){return this.recordIncrementalData(Rs,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.#n)this.recordFutureForcedDependency(Rs,t);return this}resetBBox(t){return this.#o.resetBBox(t),this}recordClipBox(t,e,n,s,a,r){return this.#o.recordClipBox(t,e,n,s,a,r),this}recordBBox(t,e,n,s,a,r){return this.#o.recordBBox(t,e,n,s,a,r),this}recordCharacterBBox(t,e,n,s=1,a=0,r=0,o){let l=n.bbox,c,u;if(l&&(c=l[2]!==l[0]&&l[3]!==l[1]&&this.#s.get(n),c!==!1&&(u=[0,0,0,0],M.axialAlignedBoundingBox(l,n.fontMatrix,u),(s!==1||a!==0||r!==0)&&oS(s,-s,a,r,u),c)))return this.recordBBox(t,e,u[0],u[2],u[1],u[3]);if(!o)return this.recordFullPageBBox(t);let h=o();return l&&u&&c===void 0&&(c=u[0]<=a-h.actualBoundingBoxLeft&&u[2]>=a+h.actualBoundingBoxRight&&u[1]<=r-h.actualBoundingBoxAscent&&u[3]>=r+h.actualBoundingBoxDescent,this.#s.set(n,c),c)?this.recordBBox(t,e,u[0],u[2],u[1],u[3]):this.recordBBox(t,e,a-h.actualBoundingBoxLeft,a+h.actualBoundingBoxRight,r-h.actualBoundingBoxAscent,r+h.actualBoundingBoxDescent)}recordFullPageBBox(t){return this.#o.recordFullPageBBox(t),this}getSimpleIndex(t){return this.#t[t]}recordDependencies(t,e){let n=this.#n,s=this.#t,a=this.#e;for(let r of e)r in this.#t?n.add(s[r]):r in a&&a[r].forEach(n.add,n);return this}recordNamedDependency(t,e){return this.#i.has(e)&&this.#n.add(this.#i.get(e)),this}recordOperation(t,e=!1){if(this.recordDependencies(t,[Rs]),this.#r){let s=Zy(this.#r,t),{dependencies:a}=s;this.#n.forEach(a.add,a),this.#o._savesStack.forEach(a.add,a),this.#o._markedContentStack.forEach(a.add,a),a.delete(t),s.isRenderingOperation=!0}let n=!e&&t===this.#o._pendingBBoxIdx;return this.#o.recordOperation(t,e,[this.#n,this.#o._savesStack,this.#o._markedContentStack]),n&&this.#n.clear(),this}recordShowTextOperation(t,e=!1){let n=Array.from(this.#n);this.recordOperation(t,e),this.recordIncrementalData("sameLineText",t);for(let s of n)this.recordIncrementalData("sameLineText",s);return this}bboxToClipBoxDropOperation(t,e=!1){let n=!e&&t===this.#o._pendingBBoxIdx;return this.#o.bboxToClipBoxDropOperation(t),n&&this.#n.clear(),this}take(){return this.#s.clear(),this.#o.take()}takeDebugMetadata(){return this.#r}},yr=class i{#t;#e;#i;#n=0;#s=0;constructor(t,e,n){if(t instanceof i&&t.#i===!!n)return t;this.#t=t,this.#e=e,this.#i=!!n}get clipBox(){return this.#t.clipBox}growOperationsCount(){throw new Error("Unreachable")}save(t){return this.#s++,this.#t.save(this.#e),this}restore(t){return this.#s>0&&(this.#t.restore(this.#e),this.#s--),this}recordOpenMarker(t){return this.#n++,this}getOpenMarker(){return this.#n>0?this.#e:this.#t.getOpenMarker()}recordCloseMarker(t){return this.#n--,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,n){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,n,s,a,r){return this.#i||this.#t.recordClipBox(this.#e,e,n,s,a,r),this}recordBBox(t,e,n,s,a,r){return this.#i||this.#t.recordBBox(this.#e,e,n,s,a,r),this}recordCharacterBBox(t,e,n,s,a,r,o){return this.#i||this.#t.recordCharacterBBox(this.#e,e,n,s,a,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")}},ze={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"]},md=class i{#t;#e;#i=4;#n=0;#s=new i.#r(this.#i*6);static#r=J.isFloat16ArraySupported?Float16Array:Float32Array;constructor(t){this.#t=t.width,this.#e=t.height}record(t,e,n,s){if(this.#n===this.#i){this.#i*=2;let o=new i.#r(this.#i*6);o.set(this.#s),this.#s=o}let a=ut(t),r;if(s[0]!==1/0){let o=Ti.slice();M.axialAlignedBoundingBox([0,-n,e,0],a,o);let l=M.intersect(s,o);if(!l)return;let[c,u,h,d]=l;if(c!==o[0]||u!==o[1]||h!==o[2]||d!==o[3]){let f=Math.atan2(a[1],a[0]),m=Math.abs(Math.sin(f)),y=Math.abs(Math.cos(f));if(m<1e-6||y<1e-6||Math.abs(m-y)<1e-6)r=[c,u,c,d,h,u];else{let v=h-c,p=d-u,g=m*m,b=y*y,A=y*m,S=b-g,E=(p*b-v*A)/S,T=(p*A-v*g)/S;r=[c+T,u,c,u+E,h,d-E]}}}r||(r=[0,-n,0,0,e,-n],M.applyTransform(r,a,0),M.applyTransform(r,a,2),M.applyTransform(r,a,4)),r[0]/=this.#t,r[1]/=this.#e,r[2]/=this.#t,r[3]/=this.#e,r[4]/=this.#t,r[5]/=this.#e,this.#s.set(r,this.#n*6),this.#n++}take(){return this.#s.subarray(0,this.#n*6)}},yd=class{#t=new Set;#e=null;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){let e=this.#i();e.insertRule(t,e.cssRules.length)}#i(){if(this.#e)return this.#e;let t=this._document.defaultView?.CSSStyleSheet||globalThis.CSSStyleSheet;if(!this.styleElement&&t){let{adoptedStyleSheets:e}=this._document;if(e){let n=new t;return e.push(n),this.#e=n}}return this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement)),this.#e=this.styleElement.sheet}clear(){for(let t of this.nativeFontFaces)this._document.fonts.delete(t);if(this.nativeFontFaces.clear(),this.#t.clear(),this.#e){let{adoptedStyleSheets:t}=this._document;t?.includes(this.#e)&&(this._document.adoptedStyleSheets=t.filter(e=>e!==this.#e)),this.#e=null}this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:n}){if(!(!t||this.#t.has(t.loadedName))){if(Et(!e,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:s,src:a,style:r}=t,o=new FontFace(s,a,r);this.addNativeFontFace(o);try{await o.load(),this.#t.add(s),n?.(t)}catch{I(`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 n=t.createNativeFontFace();if(n){this.addNativeFontFace(n);try{await n.loaded}catch(s){throw I(`Failed to load font '${n.family}': '${s}'.`),t.disableFontFace=!0,s}}return}let e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(n=>{let s=this._queueLoadingCallback(n);this._prepareFontLoadEvent(t,s)})}}get isFontLoadingAPISupported(){let t=!!this._document?.fonts;return L(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){return L(this,"isSyncFontLoadingSupported",Se||J.platform.isFirefox)}_queueLoadingCallback(t){function e(){for(Et(!s.done,"completeRequest() cannot be called twice."),s.done=!0;n.length>0&&n[0].done;){let a=n.shift();setTimeout(a.callback,0)}}let{loadingRequests:n}=this,s={done:!1,complete:e,callback:t};return n.push(s),s}get _loadTestFont(){let t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return L(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function n(S,E){return S.charCodeAt(E)<<24|S.charCodeAt(E+1)<<16|S.charCodeAt(E+2)<<8|S.charCodeAt(E+3)&255}function s(S){return String.fromCharCode(S>>24&255,S>>16&255,S>>8&255,S&255)}function a(S,E,T,w){let _=S.substring(0,E),C=S.substring(E+T);return _+w+C}let r,o,l=this._document.createElement("canvas");l.width=1,l.height=1;let c=l.getContext("2d"),u=0;function h(S,E){if(++u>30){I("Load test font never loaded."),E();return}if(c.font="30px "+S,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){E();return}setTimeout(h.bind(null,S,E))}let d=`lt${Date.now()}${this.loadTestFontId++}`,f=this._loadTestFont;f=a(f,976,d.length,d);let y=16,v=1482184792,p=n(f,y);for(r=0,o=d.length-3;r<o;r+=4)p=p-v+n(d,r)|0;r<d.length&&(p=p-v+n(d+"XXX",r)|0),f=a(f,y,4,s(p));let g=`url(data:font/opentype;base64,${btoa(f)});`,b=`@font-face {font-family:"${d}";src:${g}}`;this.insertRule(b);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 S of[t.loadedName,d]){let E=this._document.createElement("span");E.textContent="Hi",E.style.fontFamily=S,A.append(E)}this._document.body.append(A),h(d,()=>{A.remove(),e.complete()})}},bd=class{compiledGlyphs=Object.create(null);#t;constructor(t,e=null,n,s){this.#t=t,this._inspectFont=e,n&&(this.charProcOperatorList=n),s&&Object.assign(this,s)}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,${this.data.toBase64()});`,e;if(!this.cssFontInfo)e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let n=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(n+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${n}src:${t}}`}return this._inspectFont?.(this,t),e}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];let n=this.loadedName+"_path_"+e,s;try{s=t.get(n)}catch(r){I(`getPathGenerator - ignoring character: "${r}".`)}let a=Sb(s?.path);return this.fontExtraProperties||t.delete(n),this.compiledGlyphs[e]=a}get black(){return this.#t.black}get bold(){return this.#t.bold}get disableFontFace(){return this.#t.disableFontFace}set disableFontFace(t){L(this,"disableFontFace",!!t)}get fontExtraProperties(){return this.#t.fontExtraProperties}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}},vd=class{static strings=["fontFamily","fontWeight","italicAngle"]},Ad=class{static strings=["css","loadedName","baseFontName","src"]},ve=class{static bools=["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"];static numbers=["ascent","defaultWidth","descent"];static strings=["fallbackName","loadedName","mimetype","name"];static OFFSET_NUMBERS=Math.ceil(this.bools.length*2/8);static OFFSET_BBOX=this.OFFSET_NUMBERS+this.numbers.length*8;static OFFSET_FONT_MATRIX=this.OFFSET_BBOX+1+8;static OFFSET_DEFAULT_VMETRICS=this.OFFSET_FONT_MATRIX+1+48;static OFFSET_STRINGS=this.OFFSET_DEFAULT_VMETRICS+1+6},Ai=class{static KIND=0;static HAS_BBOX=1;static HAS_BACKGROUND=2;static SHADING_TYPE=3;static N_COORD=4;static N_COLOR=8;static N_STOP=12;static N_FIGURES=16},Sd=class{#t;#e=new TextDecoder;#i;constructor(t){this.#t=t,this.#i=new DataView(t)}#n(t){Et(t<vd.strings.length,"Invalid string index");let e=0;for(let s=0;s<t;s++)e+=this.#i.getUint32(e)+4;let n=this.#i.getUint32(e);return this.#e.decode(new Uint8Array(this.#t,e+4,n))}get fontFamily(){return this.#n(0)}get fontWeight(){return this.#n(1)}get italicAngle(){return this.#n(2)}},Ed=class{#t;#e=new TextDecoder;#i;constructor(t){this.#t=t,this.#i=new DataView(t)}get guessFallback(){return this.#i.getUint8(0)!==0}#n(t){Et(t<Ad.strings.length,"Invalid string index");let e=5;for(let s=0;s<t;s++)e+=this.#i.getUint32(e)+4;let n=this.#i.getUint32(e);return this.#e.decode(new Uint8Array(this.#t,e+4,n))}get css(){return this.#n(0)}get loadedName(){return this.#n(1)}get baseFontName(){return this.#n(2)}get src(){return this.#n(3)}get style(){let t=1;t+=4+this.#i.getUint32(t);let e=this.#i.getUint32(t),n=this.#e.decode(new Uint8Array(this.#t,t+4,e));t+=4+e;let s=this.#i.getUint32(t),a=this.#e.decode(new Uint8Array(this.#t,t+4,s));return{style:n,weight:a}}},Td=class{#t;#e=new TextDecoder;#i;constructor({buffer:t,extra:e}){this.#t=t,this.#i=new DataView(t),e&&Object.assign(this,e)}#n(t){Et(t<ve.bools.length,"Invalid boolean index");let e=Math.floor(t/4),n=t*2%8,s=this.#i.getUint8(e)>>n&3;return s===0?void 0:s===2}get black(){return this.#n(0)}get bold(){return this.#n(1)}get disableFontFace(){return this.#n(2)}get fontExtraProperties(){return this.#n(3)}get isInvalidPDFjsFont(){return this.#n(4)}get isType3Font(){return this.#n(5)}get italic(){return this.#n(6)}get missingFile(){return this.#n(7)}get remeasure(){return this.#n(8)}get vertical(){return this.#n(9)}#s(t){return Et(t<ve.numbers.length,"Invalid number index"),this.#i.getFloat64(ve.OFFSET_NUMBERS+t*8)}get ascent(){return this.#s(0)}get defaultWidth(){return this.#s(1)}get descent(){return this.#s(2)}#r(t,e,n,s){let a=this.#i.getUint8(t);if(a===0)return;Et(a===e,"Invalid array length."),t+=1;let r=new Array(a);for(let o=0;o<a;o++)r[o]=this.#i[n](t,!0),t+=s;return r}get bbox(){return this.#r(ve.OFFSET_BBOX,4,"getInt16",2)}get fontMatrix(){return this.#r(ve.OFFSET_FONT_MATRIX,6,"getFloat64",8)}get defaultVMetrics(){return this.#r(ve.OFFSET_DEFAULT_VMETRICS,3,"getInt16",2)}#a(t){Et(t<ve.strings.length,"Invalid string index");let e=ve.OFFSET_STRINGS+4;for(let s=0;s<t;s++)e+=this.#i.getUint32(e)+4;let n=this.#i.getUint32(e);return this.#e.decode(new Uint8Array(this.#t,e+4,n))}get fallbackName(){return this.#a(0)}get loadedName(){return this.#a(1)}get mimetype(){return this.#a(2)}get name(){return this.#a(3)}#o(){let t=ve.OFFSET_STRINGS,e=this.#i.getUint32(t);t+=4+e;let n=this.#i.getUint32(t);t+=4+n;let s=this.#i.getUint32(t);t+=4+s;let a=this.#i.getUint32(t);return{offset:t,length:a}}get data(){let{offset:t,length:e}=this.#o();return e===0?void 0:new Uint8Array(this.#t,t+4,e)}clearData(){let{offset:t,length:e}=this.#o();e!==0&&(this.#i.setUint32(t,0),this.#t=new Uint8Array(this.#t,0,t+4).slice().buffer,this.#i=new DataView(this.#t))}get cssFontInfo(){let t=ve.OFFSET_STRINGS,e=this.#i.getUint32(t);t+=4+e;let n=this.#i.getUint32(t);t+=4+n;let s=this.#i.getUint32(t);if(s===0)return null;let a=new Uint8Array(s);return a.set(new Uint8Array(this.#t,t+4,s)),new Sd(a.buffer)}get systemFontInfo(){let t=ve.OFFSET_STRINGS,e=this.#i.getUint32(t);t+=4+e;let n=this.#i.getUint32(t);if(n===0)return null;let s=new Uint8Array(n);return s.set(new Uint8Array(this.#t,t+4,n)),new Ed(s.buffer)}},wd=class{constructor(t){this.buffer=t,this.view=new DataView(t),this.data=new Uint8Array(t)}getIR(){let t=this.view,e=this.data[Ai.KIND],n=!!this.data[Ai.HAS_BBOX],s=!!this.data[Ai.HAS_BACKGROUND],a=t.getUint32(Ai.N_COORD,!0),r=t.getUint32(Ai.N_COLOR,!0),o=t.getUint32(Ai.N_STOP,!0),l=20,c=new Float32Array(this.buffer,l,a*2);l+=a*8;let u=new Uint8Array(this.buffer,l,r*4);l+=r*4;let h=[];for(let m=0;m<o;++m){let y=t.getFloat32(l,!0);l+=4;let v=t.getUint32(l,!0);l+=4,h.push([y,`#${v.toString(16).padStart(6,"0")}`])}let d=null;if(n){d=[];for(let m=0;m<4;++m)d.push(t.getFloat32(l,!0)),l+=4}let f=null;if(s&&(f=new Uint8Array(this.buffer,l,3),l+=3),e===1)return["RadialAxial","axial",d,h,Array.from(c.slice(0,2)),Array.from(c.slice(2,4)),null,null];if(e===2)return["RadialAxial","radial",d,h,[c[0],c[1]],[c[3],c[4]],c[2],c[5]];if(e===3){let m=this.data[Ai.SHADING_TYPE],y=null;if(c.length>0){y=Ti.slice();for(let v=0,p=c.length;v<p;v+=2)M.pointBoundingBox(c[v],c[v+1],y)}return["Mesh",m,c,u,a,y,d,f]}throw new Error(`Unsupported pattern kind: ${e}`)}},_d=class{#t;constructor(t){this.#t=t}get path(){return J.isFloat16ArraySupported?new Float16Array(this.#t):new Float32Array(this.#t)}};xd=i=>typeof i=="object"&&Number.isInteger(i?.num)&&i.num>=0&&Number.isInteger(i?.gen)&&i.gen>=0,uS=i=>typeof i=="object"&&typeof i?.name=="string",Tb=iS.bind(null,xd,uS),Cd=class{#t=new Map;#e=Promise.resolve();postMessage(t,e){let n={data:structuredClone(t,e?{transfer:e}:null)};this.#e.then(()=>{for(let[s]of this.#t)s.call(this,n)})}addEventListener(t,e,n=null){let s=null;if(n?.signal instanceof AbortSignal){let{signal:a}=n;if(a.aborted){I("LoopbackPort - cannot use an `aborted` signal.");return}let r=()=>this.removeEventListener(t,e);s=()=>a.removeEventListener("abort",r),a.addEventListener("abort",r)}this.#t.set(e,s)}removeEventListener(t,e){this.#t.get(e)?.(),this.#t.delete(e)}terminate(){for(let[,t]of this.#t)t?.();this.#t.clear()}},ul={DATA:1,ERROR:2},Nt={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};Rn=class{#t=new AbortController;constructor(t,e,n){this.sourceName=t,this.targetName=e,this.comObj=n,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),n.addEventListener("message",this.#e.bind(this),{signal:this.#t.signal})}#e({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){this.#n(t);return}if(t.callback){let n=t.callbackId,s=this.callbackCapabilities[n];if(!s)throw new Error(`Cannot resolve callback ${n}`);if(delete this.callbackCapabilities[n],t.callback===ul.DATA)s.resolve(t.data);else if(t.callback===ul.ERROR)s.reject(oe(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 n=this.sourceName,s=t.sourceName,a=this.comObj;Promise.try(e,t.data).then(function(r){a.postMessage({sourceName:n,targetName:s,callback:ul.DATA,callbackId:t.callbackId,data:r})},function(r){a.postMessage({sourceName:n,targetName:s,callback:ul.ERROR,callbackId:t.callbackId,reason:oe(r)})});return}if(t.streamId){this.#i(t);return}e(t.data)}on(t,e){let n=this.actionHandler;if(n[t])throw new Error(`There is already an actionName called "${t}"`);n[t]=e}send(t,e,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},n)}sendWithPromise(t,e,n){let s=this.callbackId++,a=Promise.withResolvers();this.callbackCapabilities[s]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:s,data:e},n)}catch(r){a.reject(r)}return a.promise}sendWithStream(t,e,n,s){let a=this.streamId++,r=this.sourceName,o=this.targetName,l=this.comObj;return new ReadableStream({start:c=>{let u=Promise.withResolvers();return this.streamControllers[a]={controller:c,startCall:u,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:r,targetName:o,action:t,streamId:a,data:e,desiredSize:c.desiredSize},s),u.promise},pull:c=>{let u=Promise.withResolvers();return this.streamControllers[a].pullCall=u,l.postMessage({sourceName:r,targetName:o,stream:Nt.PULL,streamId:a,desiredSize:c.desiredSize}),u.promise},cancel:c=>{Et(c instanceof Error,"cancel must have a valid reason");let u=Promise.withResolvers();return this.streamControllers[a].cancelCall=u,this.streamControllers[a].isClosed=!0,l.postMessage({sourceName:r,targetName:o,stream:Nt.CANCEL,streamId:a,reason:oe(c)}),u.promise}},n)}#i(t){let e=t.streamId,n=this.sourceName,s=t.sourceName,a=this.comObj,r=this,o=this.actionHandler[t.action],l={enqueue(c,u=1,h){if(this.isCancelled)return;let d=this.desiredSize;this.desiredSize-=u,d>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),a.postMessage({sourceName:n,targetName:s,stream:Nt.ENQUEUE,streamId:e,chunk:c},h)},close(){this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:n,targetName:s,stream:Nt.CLOSE,streamId:e}),delete r.streamSinks[e])},error(c){Et(c instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,a.postMessage({sourceName:n,targetName:s,stream:Nt.ERROR,streamId:e,reason:oe(c)}))},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(){a.postMessage({sourceName:n,targetName:s,stream:Nt.START_COMPLETE,streamId:e,success:!0})},function(c){a.postMessage({sourceName:n,targetName:s,stream:Nt.START_COMPLETE,streamId:e,reason:oe(c)})})}#n(t){let e=t.streamId,n=this.sourceName,s=t.sourceName,a=this.comObj,r=this.streamControllers[e],o=this.streamSinks[e];switch(t.stream){case Nt.START_COMPLETE:t.success?r.startCall.resolve():r.startCall.reject(oe(t.reason));break;case Nt.PULL_COMPLETE:t.success?r.pullCall.resolve():r.pullCall.reject(oe(t.reason));break;case Nt.PULL:if(!o){a.postMessage({sourceName:n,targetName:s,stream:Nt.PULL_COMPLETE,streamId:e,success:!0});break}o.desiredSize<=0&&t.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=t.desiredSize,Promise.try(o.onPull||Jy).then(function(){a.postMessage({sourceName:n,targetName:s,stream:Nt.PULL_COMPLETE,streamId:e,success:!0})},function(c){a.postMessage({sourceName:n,targetName:s,stream:Nt.PULL_COMPLETE,streamId:e,reason:oe(c)})});break;case Nt.ENQUEUE:if(Et(r,"enqueue should have stream controller"),r.isClosed)break;r.controller.enqueue(t.chunk);break;case Nt.CLOSE:if(Et(r,"close should have stream controller"),r.isClosed)break;r.isClosed=!0,r.controller.close(),this.#s(r,e);break;case Nt.ERROR:Et(r,"error should have stream controller"),r.controller.error(oe(t.reason)),this.#s(r,e);break;case Nt.CANCEL_COMPLETE:t.success?r.cancelCall.resolve():r.cancelCall.reject(oe(t.reason)),this.#s(r,e);break;case Nt.CANCEL:if(!o)break;let l=oe(t.reason);Promise.try(o.onCancel||Jy,l).then(function(){a.postMessage({sourceName:n,targetName:s,stream:Nt.CANCEL_COMPLETE,streamId:e,success:!0})},function(c){a.postMessage({sourceName:n,targetName:s,stream:Nt.CANCEL_COMPLETE,streamId:e,reason:oe(c)})}),o.sinkCapability.reject(l),o.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async#s(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}},wl=class{#t=Object.freeze({cMapUrl:"CMap",standardFontDataUrl:"font",wasmUrl:"wasm"});constructor({cMapUrl:t=null,standardFontDataUrl:e=null,wasmUrl:n=null}){this.cMapUrl=t,this.standardFontDataUrl=e,this.wasmUrl=n}async fetch({kind:t,filename:e}){switch(t){case"cMapUrl":case"standardFontDataUrl":case"wasmUrl":break;default:Q(`Not implemented: ${t}`)}let n=this[t];if(!n)throw new Error(`Ensure that the \`${t}\` API parameter is provided.`);let s=`${n}${e}`;return this._fetch(s,t).catch(a=>{throw new Error(`Unable to load ${this.#t[t]} data at: ${s}`)})}async _fetch(t,e){Q("Abstract method `_fetch` called.")}},_l=class extends wl{async _fetch(t,e){let n=e==="cMapUrl"&&!t.endsWith(".bcmap")?"text":"bytes",s=await $l(t,n);return s instanceof Uint8Array?s:Wl(s)}},xl=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 n=this._createCanvas(t,e);return{canvas:n,context:n.getContext("2d",{willReadFrequently:!this.#t})}}reset({canvas:t},e,n){if(!t)throw new Error("Canvas is not specified");if(e<=0||n<=0)throw new Error("Invalid canvas size");t.width=e,t.height=n}destroy(t){let{canvas:e}=t;if(!e)throw new Error("Canvas is not specified");e.width=e.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){Q("Abstract method `_createCanvas` called.")}},Md=class extends xl{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){let n=this._document.createElement("canvas");return n.width=t,n.height=e,n}},Cl=class{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addKnockoutFilter(t=0){return"none"}addHighlightHCMFilter(t,e,n,s,a){return"none"}addSelectionHCMFilter(t,e){return"none"}addSelectionFilter(){return"none"}createSelectionStyle(t=null){return null}destroy(t=!1){}},Dd=class extends Cl{#t;#e;#i;#n;#s;#r;#a=0;constructor({docId:t,ownerDocument:e=globalThis.document}){super(),this.#n=t,this.#s=e}get#o(){return this.#e||=new Map}get#c(){return this.#r||=new Map}get#l(){if(!this.#i){let t=this.#s.createElement("div"),{style:e}=t;e.colorScheme="only light",e.visibility="hidden",e.contain="strict",e.width=e.height=0,e.position="absolute",e.top=e.left=0,e.zIndex=-1;let n=this.#s.createElementNS(Jt,"svg");n.setAttribute("width",0),n.setAttribute("height",0),this.#i=this.#s.createElementNS(Jt,"defs"),t.append(n),n.append(this.#i),this.#s.body.append(t)}return this.#i}#d(t){if(t.length===1){let l=t[0],c=new Array(256);for(let h=0;h<256;h++)c[h]=l[h]/255;let u=c.join(",");return[u,u,u]}let[e,n,s]=t,a=new Array(256),r=new Array(256),o=new Array(256);for(let l=0;l<256;l++)a[l]=e[l]/255,r[l]=n[l]/255,o[l]=s[l]/255;return[a.join(","),r.join(","),o.join(",")]}#h(t){if(this.#t===void 0){this.#t="";let e=this.#s.URL;e!==this.#s.baseURI&&(Mr(e)?I('#createUrl: ignore "data:"-URL for performance reasons.'):this.#t=Bf(e,""))}return`url(${this.#t}#${t})`}addFilter(t){if(!t)return"none";let e=this.#o.get(t);if(e)return e;let[n,s,a]=this.#d(t),r=t.length===1?n:`${n}${s}${a}`;if(e=this.#o.get(r),e)return this.#o.set(t,e),e;let o=`g_${this.#n}_transfer_map_${this.#a++}`,l=this.#h(o);this.#o.set(t,l),this.#o.set(r,l);let c=this.#g(o);return this.#f(n,s,a,c),l}addHCMFilter(t,e){let n=`${t}-${e}`,s="base",a=this.#c.get(s);if(a?.key===n||(a?(a.filter?.remove(),a.key=n,a.url="none",a.filter=null):(a={key:n,url:"none",filter:null},this.#c.set(s,a)),!t||!e))return a.url;let r=this.#v(t);t=M.makeHexColor(...r);let o=this.#v(e);if(e=M.makeHexColor(...o),this.#E(),t==="#000000"&&e==="#ffffff"||t===e)return a.url;let l=new Array(256);for(let f=0;f<=255;f++){let m=f/255;l[f]=m<=.03928?m/12.92:((m+.055)/1.055)**2.4}let c=l.join(","),u=`g_${this.#n}_hcm_filter`,h=a.filter=this.#g(u);this.#f(c,c,c,h),this.#m(h);let d=(f,m)=>{let y=r[f]/255,v=o[f]/255,p=new Array(m+1);for(let g=0;g<=m;g++)p[g]=y+g/m*(v-y);return p.join(",")};return this.#f(d(0,5),d(1,5),d(2,5),h),a.url=this.#h(u),a.url}addSelectionHCMFilter(t,e){return this.addHighlightHCMFilter("selection",t,e,"HighlightText","Highlight")}addSelectionFilter(){return this.addHighlightHCMFilter("selection_default","black","white","HighlightText","Highlight")}createSelectionStyle(t=null){let e=t?this.addSelectionHCMFilter(t.foreground,t.background):this.addSelectionFilter();return e==="none"||!J.platform.isFirefox?null:{"backdrop-filter":e,"background-color":"transparent"}}addAlphaFilter(t){let e=this.#o.get(t);if(e)return e;let[n]=this.#d([t]),s=`alpha_${n}`;if(e=this.#o.get(s),e)return this.#o.set(t,e),e;let a=`g_${this.#n}_alpha_map_${this.#a++}`,r=this.#h(a);this.#o.set(t,r),this.#o.set(s,r);let o=this.#g(a);return this.#b(n,o),r}addLuminosityFilter(t){let e=this.#o.get(t||"luminosity");if(e)return e;let n,s;if(t?([n]=this.#d([t]),s=`luminosity_${n}`):s="luminosity",e=this.#o.get(s),e)return this.#o.set(t,e),e;let a=`g_${this.#n}_luminosity_map_${this.#a++}`,r=this.#h(a);this.#o.set(t,r),this.#o.set(s,r);let o=this.#g(a);return this.#p(o),t&&this.#b(n,o),r}addKnockoutFilter(t=0){let e=t>0?Math.min(1/t,1e6):1e6,n=`knockout_${e}`,s=this.#o.get(n);if(s)return s;let a=`g_${this.#n}_knockout_filter_${this.#a++}`,r=this.#h(a);this.#o.set(n,r);let o=this.#g(a),l=this.#s.createElementNS(Jt,"feComponentTransfer");o.append(l);let c=this.#s.createElementNS(Jt,"feFuncA");return c.setAttribute("type","linear"),c.setAttribute("slope",`${e}`),c.setAttribute("intercept","0"),l.append(c),r}addHighlightHCMFilter(t,e,n,s,a){let r=`${e}-${n}-${s}-${a}`,o=this.#c.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.#c.set(t,o)),!e||!n))return o.url;let[l,c]=[e,n].map(this.#v.bind(this)),u=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),h=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[d,f]=[s,a].map(this.#w.bind(this));h<u&&([u,h,d,f]=[h,u,f,d]),this.#E();let m=(p,g,b)=>{let A=new Array(256),S=(h-u)/b,E=p/255,T=(g-p)/(255*b),w=0;for(let _=0;_<=b;_++){let C=Math.round(u+_*S),D=E+_*T;for(let N=w;N<=C;N++)A[N]=D;w=C+1}for(let _=w;_<256;_++)A[_]=A[w-1];return A.join(",")},y=`g_${this.#n}_hcm_${t}_filter`,v=o.filter=this.#g(y);return this.#m(v),this.#f(m(d[0],f[0],5),m(d[1],f[1],5),m(d[2],f[2],5),v),o.url=this.#h(y),o.url}destroy(t=!1){t&&this.#r?.size||(this.#i?.parentNode.parentNode.remove(),this.#i=null,this.#e?.clear(),this.#e=null,this.#r?.clear(),this.#r=null,this.#a=0)}#p(t){let e=this.#s.createElementNS(Jt,"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.#s.createElementNS(Jt,"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)}#g(t){let e=this.#s.createElementNS(Jt,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),this.#l.append(e),e}#u(t,e,n){let s=this.#s.createElementNS(Jt,e);s.setAttribute("type","discrete"),s.setAttribute("tableValues",n),t.append(s)}#f(t,e,n,s){let a=this.#s.createElementNS(Jt,"feComponentTransfer");s.append(a),this.#u(a,"feFuncR",t),this.#u(a,"feFuncG",e),this.#u(a,"feFuncB",n)}#b(t,e){let n=this.#s.createElementNS(Jt,"feComponentTransfer");e.append(n),this.#u(n,"feFuncA",t)}#v(t){return this.#l.style.color="CanvasText",this.#l.style.backgroundColor=t,Ks(getComputedStyle(this.#l).getPropertyValue("background-color"))}#y(t){return this.#l.style.color="CanvasText",this.#l.style.backgroundColor=t,qs(getComputedStyle(this.#l).getPropertyValue("background-color"))}#E(){this.#l.style.color="",this.#l.style.backgroundColor=""}#w(t){let[e,n,s,a]=this.#y(t);if(a===1)return[e,n,s];let[r,o,l]=this.#v("Canvas");return[$h(e,r,a),$h(n,o,a),$h(s,l,a)]}};Se&&I("Please use the `legacy` build in Node.js environments.");Od=class extends Cl{},Rd=class extends xl{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire(BS.url)("@napi-rs/canvas").createCanvas(t,e)}},Nd=class extends wl{async _fetch(t,e){return hS(t)}};fS=`
11
11
  struct Uniforms {
12
12
  offsetX : f32,
13
13
  offsetY : f32,
@@ -50,20 +50,20 @@ fn vs_main(in : VertexInput) -> VertexOutput {
50
50
  fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
51
51
  return vec4<f32>(in.color, 1.0);
52
52
  }
53
- `,kd=class{#t=null;#e=null;#i=null;#n=null;async#s(){if(!globalThis.navigator?.gpu)return!1;try{let t=await navigator.gpu.requestAdapter();return t?(this.#n=navigator.gpu.getPreferredCanvasFormat(),this.#e=await t.requestDevice(),!0):!1}catch{return!1}}init(){return this.#t||=this.#s()}get isReady(){return this.#e!==null}loadMeshShader(){if(!this.#e||this.#i)return;let t=this.#e.createShaderModule({code:dS});this.#i=this.#e.createRenderPipeline({layout:"auto",vertex:{module:t,entryPoint:"vs_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:"unorm8x4"}]}]},fragment:{module:t,entryPoint:"fs_main",targets:[{format:this.#n}]},primitive:{topology:"triangle-list"}})}draw(t,e,n,s,a,r,o,l){this.loadMeshShader();let c=this.#e,{offsetX:u,offsetY:h,scaleX:d,scaleY:f}=s,m=c.createBuffer({size:Math.max(t.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});t.byteLength>0&&c.queue.writeBuffer(m,0,t);let y=c.createBuffer({size:Math.max(e.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});e.byteLength>0&&c.queue.writeBuffer(y,0,e);let v=c.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});c.queue.writeBuffer(v,0,new Float32Array([u,h,d,f,r,o,l,0]));let p=c.createBindGroup({layout:this.#i.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:v}}]}),g=new OffscreenCanvas(r,o),b=g.getContext("webgpu");b.configure({device:c,format:this.#n,alphaMode:a?"opaque":"premultiplied"});let A=a?{r:a[0]/255,g:a[1]/255,b:a[2]/255,a:1}:{r:0,g:0,b:0,a:0},S=c.createCommandEncoder(),E=S.beginRenderPass({colorAttachments:[{view:b.getCurrentTexture().createView(),clearValue:A,loadOp:"clear",storeOp:"store"}]});return n>0&&(E.setPipeline(this.#i),E.setBindGroup(0,p),E.setVertexBuffer(0,m),E.setVertexBuffer(1,y),E.draw(n)),E.end(),c.queue.submit([S.finish()]),m.destroy(),y.destroy(),v.destroy(),g.transferToImageBitmap()}},tc=new kd;Yt={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};br=class{isModifyingCurrentTransform(){return!1}getPattern(){Q("Abstract method `getPattern` called.")}},Bd=class extends br{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}isOriginBased(){return this._p0[0]===0&&this._p0[1]===0&&(!this.isRadial()||this._p1[0]===0&&this._p1[1]===0)}isRadial(){return this._type==="radial"}areConic(){if(!this.isRadial())return!1;let t=Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1]);return t+this._r1>this._r0&&t+this._r0>this._r1}_createGradient(t,e=null){let n,s=this._p0,a=this._p1;if(e&&(s=s.slice(),a=a.slice(),M.applyTransform(s,e),M.applyTransform(a,e)),this._type==="axial")n=t.createLinearGradient(s[0],s[1],a[0],a[1]);else if(this._type==="radial"){let r=this._r0,o=this._r1;if(e){let l=new Float32Array(2);M.singularValueDecompose2dScale(e,l),r*=l[0],o*=l[0]}n=t.createRadialGradient(s[0],s[1],r,a[0],a[1],o)}for(let r of this._colorStops)n.addColorStop(r[0],r[1]);return n}_createReversedGradient(t,e=null){let n=this._p1,s=this._p0;e&&(n=n.slice(),s=s.slice(),M.applyTransform(n,e),M.applyTransform(s,e));let a=this._r1,r=this._r0;if(e){let c=new Float32Array(2);M.singularValueDecompose2dScale(e,c),a*=c[0],r*=c[0]}let o=t.createRadialGradient(n[0],n[1],a,s[0],s[1],r),l=this._colorStops.map(([c,u])=>[1-c,u]).reverse();for(let[c,u]of l)o.addColorStop(c,u);return o}getPattern(t,e,n,s){let a;if(s===Yt.STROKE||s===Yt.FILL){if(this.isOriginBased()){let d=M.transform(n,e.baseTransform);this.matrix&&(d=M.transform(d,this.matrix));let f=.001,m=Math.hypot(d[0],d[1]),y=Math.hypot(d[2],d[3]),v=(d[0]*d[2]+d[1]*d[3])/(m*y);if(Math.abs(v)<f)if(this.isRadial()){if(Math.abs(m-y)<f)return this._createGradient(t,d)}else return this._createGradient(t,d)}let r=e.current.getClippedPathBoundingBox(s,ut(t))||[0,0,0,0],o=Math.ceil(r[2]-r[0])||1,l=Math.ceil(r[3]-r[1])||1,c=e.canvasFactory.create(o,l),u=c.context;u.clearRect(0,0,u.canvas.width,u.canvas.height),u.beginPath(),u.rect(0,0,u.canvas.width,u.canvas.height),u.translate(-r[0],-r[1]),n=M.transform(n,[1,0,0,1,r[0],r[1]]),u.transform(...e.baseTransform),this.matrix&&u.transform(...this.matrix),bl(u,this._bbox),this.areConic()&&(u.fillStyle=this._createReversedGradient(u),u.fill()),u.fillStyle=this._createGradient(u),u.fill(),a=t.createPattern(c.canvas,"no-repeat"),e.canvasFactory.destroy(c);let h=new DOMMatrix(n);a.setTransform(h)}else this.areConic()&&(t.save(),bl(t,this._bbox),t.fillStyle=this._createReversedGradient(t),t.fillRect(-1e10,-1e10,2e10,2e10),t.restore()),bl(t,this._bbox),a=this._createGradient(t);return a}};zd=class extends br{constructor(t){super(),this._posData=t[2],this._colData=t[3],this._vertexCount=t[4],this._bounds=t[5],this._bbox=t[6],this._background=t[7],this.matrix=null,gS()}_createMeshCanvas(t,e,n){let o=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),c=Math.ceil(this._bounds[2])-o,u=Math.ceil(this._bounds[3])-l,h=Math.min(Math.ceil(Math.abs(c*t[0]*1.1)),3e3)||1,d=Math.min(Math.ceil(Math.abs(u*t[1]*1.1)),3e3)||1,f=c?c/h:1,m=u?u/d:1,y={coords:this._posData,colors:this._colData,offsetX:-o,offsetY:-l,scaleX:1/f,scaleY:1/m},v=h+4,p=d+4,g=n.create(v,p);if(pS()&&this._vertexCount>48)g.context.drawImage(mS(this._posData,this._colData,this._vertexCount,y,e,v,p,2),0,0);else{let b=g.context.createImageData(h,d);if(e){let A=b.data;for(let S=0,E=A.length;S<E;S+=4)A[S]=e[0],A[S+1]=e[1],A[S+2]=e[2],A[S+3]=255}for(let A=0,S=this._vertexCount;A<S;A+=3)yS(b,y,A,A+1,A+2,A,A+1,A+2);g.context.putImageData(b,2,2)}return{canvas:g.canvas,offsetX:o-2*f,offsetY:l-2*m,scaleX:f,scaleY:m}}isModifyingCurrentTransform(){return!0}getPattern(t,e,n,s){bl(t,this._bbox);let a=new Float32Array(2);if(s===Yt.SHADING)M.singularValueDecompose2dScale(ut(t),a);else if(this.matrix){M.singularValueDecompose2dScale(this.matrix,a);let[l,c]=a;M.singularValueDecompose2dScale(e.baseTransform,a),a[0]*=l,a[1]*=c}else M.singularValueDecompose2dScale(e.baseTransform,a);let r=this._createMeshCanvas(a,s===Yt.SHADING?null:this._background,e.canvasFactory);s!==Yt.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(r.offsetX,r.offsetY),t.scale(r.scaleX,r.scaleY);let o=t.createPattern(r.canvas,"no-repeat");return e.canvasFactory.destroy(r),o}},Pd=class extends br{getPattern(){return"hotpink"}};eb={COLORED:1,UNCOLORED:2},or=class i{static MAX_PATTERN_SIZE=3e3;constructor(t,e,n,s){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.needsIsolation=t[9]??!0,this.ctx=e,this.canvasGraphicsFactory=n,this.baseTransform=s,this.patternBaseMatrix=this.matrix?M.transform(s,this.matrix):s}canSkipPatternCanvas([t,e,n,s]){let[a,r,o,l]=this.bbox,c=Math.abs(this.xstep),u=Math.abs(this.ystep);if(t>c+1e-6||e>u+1e-6)return null;let h=Math.floor((n-o)/c)+1,d=Math.ceil((n+t-a)/c)-1,f=Math.floor((s-l)/u)+1,m=Math.ceil((s+e-r)/u)-1;return d<=h&&m<=f?[h,f]:null}updatePatternDims(t,e){let n=M.inverseTransform(this.patternBaseMatrix),s=[t[0],t[1]],a=[t[2],t[3]];M.applyTransform(s,n),M.applyTransform(a,n),e[0]=Math.abs(a[0]-s[0]),e[1]=Math.abs(a[1]-s[1]),e[2]=Math.min(s[0],a[0]),e[3]=Math.min(s[1],a[1])}_renderTileCanvas(t,e,n,s){let[a,r,o,l]=this.bbox,c=t.canvasFactory.create(n.size,s.size),u=c.context,h=this.canvasGraphicsFactory.createCanvasGraphics(u,e);return h.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(h,this.paintType,this.color),u.translate(-n.scale*a,-s.scale*r),h.transform(0,n.scale,0,0,s.scale,0,0),u.save(),h.dependencyTracker?.save(),this.clipBbox(h,a,r,o,l),h.baseTransform=ut(h.ctx),h.executeOperatorList(this.operatorList),h.endDrawing(),h.dependencyTracker?.restore(),u.restore(),c}_getCombinedScales(){let t=new Float32Array(2);M.singularValueDecompose2dScale(this.matrix,t);let[e,n]=t;return M.singularValueDecompose2dScale(this.baseTransform,t),[e*t[0],n*t[1]]}drawPattern(t,e,n=!1,[s,a],r){let[o,l,c,u]=this.bbox,h=t.dependencyTracker;if(h&&(t.dependencyTracker=new yr(h,r)),t.save(),n?t.ctx.clip(e,"evenodd"):t.ctx.clip(e),t.ctx.setTransform(...this.patternBaseMatrix),t.ctx.translate(s*this.xstep,a*this.ystep),this.needsIsolation||t.ctx.globalAlpha!==1||t.ctx.globalCompositeOperation!=="source-over"||t.inSMaskMode){let d=c-o,f=u-l,[m,y]=this._getCombinedScales(),v=this.getSizeAndScale(d,this.ctx.canvas.width,m),p=this.getSizeAndScale(f,this.ctx.canvas.height,y),g=this._renderTileCanvas(t,r,v,p);t.ctx.drawImage(g.canvas,o,l,d,f),t.canvasFactory.destroy(g)}else this.setFillAndStrokeStyleToContext(t,this.paintType,this.color),this.clipBbox(t,o,l,c,u),t.baseTransformStack.push(t.baseTransform),t.baseTransform=ut(t.ctx),t.executeOperatorList(this.operatorList),t.baseTransform=t.baseTransformStack.pop();t.restore(),h&&(t.dependencyTracker=h)}createPatternCanvas(t,e){let[n,s,a,r]=this.bbox,o=a-n,l=r-s,{xstep:c,ystep:u}=this;c=Math.abs(c),u=Math.abs(u),Wl("TilingType: "+this.tilingType);let[h,d]=this._getCombinedScales(),f=o,m=l,y=!1,v=!1;Math.ceil(c*h)>=Math.ceil(o*h)?f=c:y=!0,Math.ceil(u*d)>=Math.ceil(l*d)?m=u:v=!0;let p=this.getSizeAndScale(f,this.ctx.canvas.width,h),g=this.getSizeAndScale(m,this.ctx.canvas.height,d),b=this._renderTileCanvas(t,e,p,g);if(y||v){let A=b.canvas;y&&(f=c),v&&(m=u);let S=this.getSizeAndScale(f,this.ctx.canvas.width,h),E=this.getSizeAndScale(m,this.ctx.canvas.height,d),T=S.size,w=E.size,_=t.canvasFactory.create(T,w),C=_.context,D=y?Math.floor(o/c):0,N=v?Math.floor(l/u):0;for(let z=0;z<=D;z++)for(let X=0;X<=N;X++)C.drawImage(A,T*z,w*X,T,w,0,0,T,w);return t.canvasFactory.destroy(b),{canvas:_.canvas,canvasEntry:_,scaleX:S.scale,scaleY:E.scale,offsetX:n,offsetY:s}}return{canvas:b.canvas,canvasEntry:b,scaleX:p.scale,scaleY:g.scale,offsetX:n,offsetY:s}}getSizeAndScale(t,e,n){let s=Math.max(i.MAX_PATTERN_SIZE,e),a=Math.ceil(t*n);return a>=s?a=s:n=a/t,{scale:n,size:a}}clipBbox(t,e,n,s,a){let r=s-e,o=a-n,l=new Path2D;l.rect(e,n,r,o),M.axialAlignedBoundingBox([e,n,s,a],ut(t.ctx),t.current.minMax),t.ctx.clip(l),t.current.updateClipFromPath()}setFillAndStrokeStyleToContext(t,e,n){let s=t.ctx,a=t.current;switch(a.patternFill=a.patternStroke=!1,e){case eb.COLORED:let{fillStyle:r,strokeStyle:o}=this.ctx;s.fillStyle=a.fillColor=r,s.strokeStyle=a.strokeColor=o;break;case eb.UNCOLORED:s.fillStyle=s.strokeStyle=n,a.fillColor=a.strokeColor=n;break;default:throw new nd(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,n,s,a){let r=s!==Yt.SHADING?M.transform(n,this.patternBaseMatrix):n,o=this.createPatternCanvas(e,a),l=new DOMMatrix(r);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);let c=t.createPattern(o.canvas,"repeat");return e.canvasFactory.destroy(o.canvasEntry),c.setTransform(l),c}},vS=16,AS=100,SS=15,ib=10,oe=16,Jh=new DOMMatrix,Ee=new Float32Array(2);Dl=class{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=ed;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=Pt.FILL;textRise=0;fillColor="#000000";strokeColor="#000000";tilingPatternDims=null;patternFill=!1;patternStroke=!1;fillAlpha=1;strokeAlpha=1;lineWidth=1;activeSMask=null;transferMaps="none";minMax=On.slice();constructor(t,e){this.clipBox=new Float32Array([0,0,t,e])}clone(){let t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t.tilingPatternDims=this.tilingPatternDims?.slice(),t}getPathBoundingBox(t=Yt.FILL,e=null){let n=this.minMax.slice();if(t===Yt.STROKE){e||Q("Stroke bounding box must include transform."),M.singularValueDecompose2dScale(e,Ee);let s=Ee[0]*this.lineWidth/2,a=Ee[1]*this.lineWidth/2;n[0]-=s,n[1]-=a,n[2]+=s,n[3]+=a}return n}updateClipFromPath(){let t=M.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(On,0)}getClippedPathBoundingBox(t=Yt.FILL,e=null){return M.intersect(this.clipBox,this.getPathBoundingBox(t,e))}};ES=["butt","round","square"],TS=["miter","round","bevel"],wS={},ob={},zs=class i{#t=0;#e=0;#i=null;#n=null;#s=null;#r=null;#a=1;#o;#c=null;#l=[];constructor(t,e,n,s,a,{optionalContentConfig:r,markedContentStack:o=null},l,c,u,h){this.ctx=t,this.current=new Dl(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.commonObjs=e,this.objs=n,this.canvasFactory=s,this.filterFactory=a,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.tempSMask=null,this.smaskGroupCanvases=[],this.smaskPreparedEntry=null,this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=r,this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=c,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=u??null,this.imagesTracker=h??null}getObject(t,e,n=null){return typeof e=="string"?(this.dependencyTracker?.recordNamedDependency(t,e),e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e)):n}beginDrawing({transform:t,viewport:e,transparency:n=!1,background:s=null}){let a=this.ctx.canvas.width,r=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,a,r),this.ctx.fillStyle=o,n){let l=this.transparentCanvasEntry=this.canvasFactory.create(a,r);this.compositeCtx=this.ctx,{canvas:this.transparentCanvas,context:this.ctx}=l,this.ctx.save(),this.ctx.transform(...ut(this.compositeCtx))}this.ctx.save(),dl(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[3]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=ut(this.ctx)}executeOperatorList(t,e,n,s,a){let r=t.argsArray,o=t.fnArray,l=e||0,c=r.length;if(c===l)return l;let u=c-l>ib&&typeof n=="function",h=u?Date.now()+SS:0,d=0,f=this.commonObjs,m=this.objs,y,v;for(;;){if(s!==void 0){if(l===s.nextBreakPoint)return s.breakIt(l,n),l;if(s.shouldSkip(l)){if(++l===c)return l;continue}}if(!a||a(l))if(y=o[l],v=r[l]??null,y!==Ue.dependency)v===null?this[y](l):this[y](l,...v);else for(let p of v){this.dependencyTracker?.recordNamedData(p,l);let g=p.startsWith("g_")?f:m;if(!g.has(p))return g.get(p,n),l}if(l++,l===c)return l;if(u&&++d>ib){if(Date.now()>h)return n(),l;d=0}}}#d(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(this.transparentCanvasEntry),this.transparentCanvas=null,this.transparentCanvasEntry=null)}endDrawing(){this.#d();for(let t of this.smaskGroupCanvases)this.canvasFactory.destroy(t);this.smaskGroupCanvases.length=0,this._clearPreparedSMask(),this.tempSMask=null,this.smaskStack.length=0;for(let t of this.#l)this.#y(t);this.#l.length=0,this.#i=null,this.#n=null,this.#s=null,this.#r=null,this.#a=1,this.#c=null,this.#e=0,this.#t=0,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.#h()}#h(){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 n=t.width??t.displayWidth,s=t.height??t.displayHeight,a=Math.max(Math.hypot(e[0],e[1]),1),r=Math.max(Math.hypot(e[2],e[3]),1),o=[],l=a,c=r,u=n,h=s;for(;l>2&&u>1||c>2&&h>1;){let p=u,g=h;l>2&&u>1&&(p=Math.ceil(u/2),l/=u/p),c>2&&h>1&&(g=Math.ceil(h/2),c/=h/g),o.push({newWidth:p,newHeight:g}),u=p,h=g}if(o.length===0)return{img:t,paintWidth:n,paintHeight:s,tmpCanvas:null};if(o.length===1){let{newWidth:p,newHeight:g}=o[0],b=this.canvasFactory.create(p,g);return b.context.drawImage(t,0,0,n,s,0,0,p,g),{img:b.canvas,paintWidth:p,paintHeight:g,tmpCanvas:b}}let d=this.canvasFactory.create(1,1),f=this.canvasFactory.create(1,1),m=n,y=s,v=t;for(let{newWidth:p,newHeight:g}of o)this.canvasFactory.reset(f,p,g),f.context.drawImage(v,0,0,m,y,0,0,p,g),[d,f]=[f,d],v=d.canvas,m=p,y=g;return this.canvasFactory.destroy(f),{img:d.canvas,paintWidth:m,paintHeight:y,tmpCanvas:d}}_createMaskCanvas(t,e){let n=this.ctx,{width:s,height:a}=e,r=this.current.fillColor,o=this.current.patternFill,l=ut(n),c,u,h,d;if((e.bitmap||e.data)&&e.count>1){let D=e.bitmap||e.data.buffer;u=JSON.stringify(o?l:[l.slice(0,4),r]),c=this._cachedBitmapsMap.getOrInsertComputed(D,$l);let N=c.get(u);if(N&&!o){let z=Math.round(Math.min(l[0],l[2])+l[4]),X=Math.round(Math.min(l[1],l[3])+l[5]);return this.dependencyTracker?.recordDependencies(t,ze.transformAndFill),{canvas:N,offsetX:z,offsetY:X}}h=N}h||(d=this.canvasFactory.create(s,a),ab(d.context,e));let f=M.transform(l,[1/s,0,0,-1/a,0,0]);f=M.transform(f,[1,0,0,1,0,-a]);let m=On.slice();M.axialAlignedBoundingBox([0,0,s,a],f,m);let[y,v,p,g]=m,b=Math.round(p-y)||1,A=Math.round(g-v)||1,S=this.canvasFactory.create(b,A),E=S.context,T=y,w=v;E.translate(-T,-w),E.transform(...f);let _=null;if(!h){let D=this._scaleImage(d.canvas,$e(E));h=D.img,_=D.tmpCanvas,h!==d.canvas&&(this.canvasFactory.destroy(d),d=null),c&&o&&(c.set(u,h),_=null,d=null)}E.imageSmoothingEnabled=rb(ut(E),e.interpolate),hl(E,h,0,0,h.width,h.height,0,0,s,a),_&&this.canvasFactory.destroy(_),d&&this.canvasFactory.destroy(d),E.globalCompositeOperation="source-in";let C=M.transform($e(E),[1,0,0,1,-T,-w]);return E.fillStyle=o?r.getPattern(n,this,C,Yt.FILL,t):r,E.fillRect(0,0,s,a),c&&!o&&c.set(u,S.canvas),this.dependencyTracker?.recordDependencies(t,ze.transformAndFill),{canvas:S.canvas,canvasEntry:c&&!o?null:S,offsetX:Math.round(T),offsetY:Math.round(w)}}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=ES[e]}setLineJoin(t,e){this.dependencyTracker?.recordSimpleData("lineJoin",t),this.ctx.lineJoin=TS[e]}setMiterLimit(t,e){this.dependencyTracker?.recordSimpleData("miterLimit",t),this.ctx.miterLimit=e}setDash(t,e,n){this.dependencyTracker?.recordSimpleData("dash",t);let s=this.ctx;s.setLineDash!==void 0&&(s.setLineDash(e),s.lineDashOffset=n)}setRenderingIntent(t,e){}setFlatness(t,e){}setGState(t,e){for(let[n,s]of e)switch(n){case"LW":this.setLineWidth(t,s);break;case"LC":this.setLineCap(t,s);break;case"LJ":this.setLineJoin(t,s);break;case"ML":this.setMiterLimit(t,s);break;case"D":this.setDash(t,s[0],s[1]);break;case"RI":this.setRenderingIntent(t,s);break;case"FL":this.setFlatness(t,s);break;case"Font":this.setFont(t,s[0],s[1]);break;case"CA":this.dependencyTracker?.recordSimpleData("strokeAlpha",t),this.current.strokeAlpha=s;break;case"ca":this.dependencyTracker?.recordSimpleData("fillAlpha",t),this.ctx.globalAlpha=this.current.fillAlpha=s;break;case"BM":this.dependencyTracker?.recordSimpleData("globalCompositeOperation",t),this.ctx.globalCompositeOperation=s;break;case"SMask":this.dependencyTracker?.recordSimpleData("SMask",t),this.current.activeSMask=s?this.tempSMask:null,this.current.activeSMask&&(this.current.activeSMask.blendMode=this.ctx.globalCompositeOperation),this.tempSMask=null,this.checkSMaskState(t);break;case"TR":this.dependencyTracker?.recordSimpleData("filter",t),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(s);break}}get inSMaskMode(){return!!this.suspendedCtx}_clearPreparedSMask(){this.smaskPreparedEntry&&(this.canvasFactory.destroy(this.smaskPreparedEntry),this.smaskPreparedEntry=null),this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null}_ensurePreparedSMask(t){t!==this.smaskPreparedFor&&(this._clearPreparedSMask(),this._prepareSMaskCanvas(t))}checkSMaskState(t){let e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode(t):!this.current.activeSMask&&e?this.endSMaskMode():this.current.activeSMask&&e&&this._ensurePreparedSMask(this.current.activeSMask)}_prepareSMaskCanvas(t){let{canvas:e,subtype:n,backdrop:s,transferMap:a}=t,r=n==="Luminosity"||n==="Alpha"&&a;if(!r&&!(n==="Luminosity"&&s)){this.smaskPreparedFor=t;return}let o;if(n==="Luminosity"&&s){let[g,b,A]=qs(s),S=Math.round(.3*g+.59*b+.11*A);o=a?.[S]??S}else o=a?.[0]??0;let l=4,{width:c,height:u}=this.ctx.canvas,h=e.width*e.height,d=c*u<l*h,f=r?{url:n==="Alpha"?this.filterFactory.addAlphaFilter(a):this.filterFactory.addLuminosityFilter(a),subtype:n,transferMap:a}:null,m=n==="Luminosity"?s:null,y,v,p;d?(y=this._bakeSMaskCanvas(e,t.offsetX,t.offsetY,c,u,m,f),v=0,p=0):(y=this._bakeSMaskCanvas(e,0,0,e.width,e.height,m,f),v=t.offsetX,p=t.offsetY),this.smaskPreparedEntry=y,this.smaskPreparedFor=t,this.smaskPreparedOffsetX=v,this.smaskPreparedOffsetY=p,this.smaskPreparedOOBAlpha=!d&&o!==0?o:null}_bakeSMaskCanvas(t,e,n,s,a,r,o){!r&&!o&&Q("_bakeSMaskCanvas with neither backdrop nor filter");let l=this.canvasFactory.create(s,a),c=l.context;if(c.drawImage(t,e,n),r&&(c.globalCompositeOperation="destination-atop",c.fillStyle=r,c.fillRect(0,0,s,a)),!o)return l;let u=this.canvasFactory.create(s,a),h=u.context;h.filter=o.url;let d=J.isCanvasFilterSupported&&h.filter!=="none"&&h.filter!=="";if(h.drawImage(l.canvas,0,0),J.isCanvasFilterSupported&&(h.filter="none"),!d){let f=h.getImageData(0,0,s,a),{data:m}=f,{transferMap:y}=o;if(o.subtype==="Luminosity")for(let v=0,p=m.length;v<p;v+=4){let g=.3*m[v]+.59*m[v+1]+.11*m[v+2]+.5|0;m[v]=m[v+1]=m[v+2]=0,m[v+3]=y?.[g]??g}else for(let v=3,p=m.length;v<p;v+=4)m[v]=y[m[v]];h.putImageData(f,0,0)}return this.canvasFactory.destroy(l),u}beginSMaskMode(t){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");let{width:e,height:n}=this.ctx.canvas,s=this.canvasFactory.create(e,n);this.smaskScratchCanvas=s,this.suspendedCtx=this.ctx;let a=this.ctx=s.context;a.setTransform(this.suspendedCtx.getTransform()),Mn(this.suspendedCtx,a),nb(a,this.suspendedCtx),this._ensurePreparedSMask(this.current.activeSMask),this.setGState(t,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Mn(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null,this.canvasFactory.destroy(this.smaskScratchCanvas),this.smaskScratchCanvas=null,this._clearPreparedSMask()}#p(t,e=null,n=1){let{width:s,height:a}=t,r=e??this.canvasFactory.create(s,a),o=r.context;n=Math.round(n*255)/255;let l=n<1;l&&this.#o===void 0&&(this.#o=J.isCanvasFilterSupported?new Map:"none");let c="none";if(l&&this.#o instanceof Map&&(c=this.#o.getOrInsertComputed(n,()=>this.filterFactory.addKnockoutFilter(n))),!l||c!=="none")return e&&(o.save(),o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,s,a),o.restore()),o.filter=c,o.drawImage(t,0,0),o.filter="none",r;let u=t.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,s,a),h=o.createImageData(s,a),d=u.data,f=h.data,m=n>0?1/n:1e6;for(let y=3,v=d.length;y<v;y+=4)f[y]=Math.min(Math.round(d[y]*m),255);return o.putImageData(h,0,0),r}#m(t,e,n,s){let a=t?.[e]??null;if(a&&(a.canvas.width!==n||a.canvas.height!==s)&&(this.canvasFactory.destroy(a),a=null),!a)return a=this.canvasFactory.create(n,s),t&&(t[e]=a),a;let r=a.context;return r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,n,s),r.restore(),a}#g(t,e,n={}){let{backdropCanvas:s=null,destTransform:a=[1,0,0,1,0,0],backdropOffset:r=[0,0],reuseMaskEntry:o=null,poolMeta:l=null,sourceAlpha:c=1,sourceFilter:u="none",knockoutAlpha:h=1}=n,{width:d,height:f}=e,m=this.#p(e,o,h),y=t.globalCompositeOperation;if(t.save(),t.setTransform(...a),t.globalAlpha=1,J.isCanvasFilterSupported&&(t.filter="none"),t.globalCompositeOperation="destination-out",t.drawImage(m.canvas,0,0),s){let[v,p]=r,g=this.#m(l,"knockoutBackdropEntry",d,f),b=g.context;b.drawImage(s,v,p,d,f,0,0,d,f),b.globalCompositeOperation="destination-in",b.drawImage(m.canvas,0,0),b.globalCompositeOperation="source-over",t.globalCompositeOperation="destination-over",t.drawImage(g.canvas,0,0),l||this.canvasFactory.destroy(g)}t.globalCompositeOperation=y,t.globalAlpha=c,J.isCanvasFilterSupported&&(t.filter=u??"none"),t.drawImage(e,0,0),t.restore(),o||this.canvasFactory.destroy(m)}#u(t=1){if(this.#t===0||this.#e>0||!this.contentVisible)return!1;this.#e++,this.#a=t;let e=this.#l.at(-1),{canvas:n}=this.ctx,s=this.#m(e,"knockoutTempEntry",n.width,n.height);this.#i=s;let a=s.context;return a.save(),a.setTransform(this.ctx.getTransform()),Mn(this.ctx,a),this.#r=a.globalCompositeOperation,a.globalCompositeOperation="source-over",nb(a,this.ctx),this.#c=e,this.#n=this.ctx,this.#s=this.suspendedCtx,this.ctx=a,this.inSMaskMode&&(this.suspendedCtx=a),!0}#f(t){if(!t)return;let e=this.#i,n=this.#n,s=this.#s,a=e.context;this.#i=null,this.#n=null,this.#s=null,this.inSMaskMode&&this.suspendedCtx===a&&this.ctx!==a&&this.endSMaskMode(),this.inSMaskMode&&(this.suspendedCtx=s),this.ctx._removeMirroring(),this.ctx.globalCompositeOperation=this.#r,this.#r=null,Mn(this.ctx,n),this.ctx=n;let r=this.#c;this.#c=null;let o=this.#a;this.#a=1;try{this.#g(s??n,e.canvas,{backdropCanvas:r?.backdropCtx?.canvas??null,backdropOffset:r?.backdropCtx?[r.offsetX,r.offsetY]:[0,0],reuseMaskEntry:r?.knockoutMaskEntry??null,poolMeta:r,knockoutAlpha:o})}finally{a.restore(),this.#e--,r||this.canvasFactory.destroy(e)}}compose(t){if(!this.current.activeSMask)return;t=t?[Math.floor(t[0]),Math.floor(t[1]),Math.ceil(t[2]),Math.ceil(t[3])]:[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let e=this.current.activeSMask,n=this.suspendedCtx,s=this.#e>0&&n===this.ctx;this.composeSMask(s?null:n,e,this.ctx,t),!s&&(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,n,s){let a=s[0],r=s[1],o=s[2]-a,l=s[3]-r;if(o===0||l===0)return;let c=this.smaskPreparedEntry;if(c){let u=a,h=r,d=o,f=l,m=this.smaskPreparedOOBAlpha,y=m!==null;if(y){u=Math.max(a,e.offsetX),h=Math.max(r,e.offsetY);let v=Math.min(a+o,e.offsetX+e.canvas.width),p=Math.min(r+l,e.offsetY+e.canvas.height);d=v-u,f=p-h}if(d>0&&f>0){let v=u-this.smaskPreparedOffsetX,p=h-this.smaskPreparedOffsetY;n.save(),n.globalAlpha=1,n.setTransform(1,0,0,1,0,0);let g=new Path2D;g.rect(u,h,d,f),n.clip(g),n.globalCompositeOperation="destination-in",n.drawImage(c.canvas,v,p,d,f,u,h,d,f),n.restore()}y&&m<255&&this._applySMaskOOBAlpha(n,a,r,o,l,u,h,u+d,h+f,m)}else this.genericComposeSMask(e,n,o,l,a,r);t&&(t.save(),t.globalAlpha=1,t.globalCompositeOperation=e.blendMode||"source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(n.canvas,a,r,o,l,a,r,o,l),t.restore())}_applySMaskOOBAlpha(t,e,n,s,a,r,o,l,c,u){let h=r<l&&o<c;if(h&&r===e&&o===n&&l===e+s&&c===n+a)return;let d=new Path2D;d.rect(e,n,s,a),h&&d.rect(r,o,l-r,c-o),t.save(),t.globalAlpha=u/255,t.setTransform(1,0,0,1,0,0),t.clip(d,"evenodd"),t.globalCompositeOperation="destination-in",t.fillStyle="#000000",t.fillRect(e,n,s,a),t.restore()}genericComposeSMask(t,e,n,s,a,r){let{context:o,offsetX:l,offsetY:c}=t;e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);let u=new Path2D;u.rect(a,r,n,s),e.clip(u),e.globalCompositeOperation="destination-in",e.drawImage(o.canvas,a-l,r-c,n,s,a,r,n,s),e.restore()}save(t){this.inSMaskMode&&Mn(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&&(Mn(this.suspendedCtx,this.ctx),this.ctx.setTransform(this.suspendedCtx.getTransform())),this.checkSMaskState(t),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(t,e,n,s,a,r,o){this.dependencyTracker?.recordIncrementalData("transform",t),this.ctx.transform(e,n,s,a,r,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,n,s){let[a]=n;if(!s){a||=n[0]=new Path2D,e!==Ue.stroke&&e!==Ue.closeStroke&&(this.current.tilingPatternDims=null),this[e](t,a);return}if(this.dependencyTracker!==null){let o=e===Ue.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(t).recordBBox(t,this.ctx,s[0]-o,s[2]+o,s[1]-o,s[3]+o).recordDependencies(t,["transform"])}a instanceof Path2D||(a=n[0]=Sb(a)),M.axialAlignedBoundingBox(s,ut(this.ctx),this.current.minMax);let r=this.current.tilingPatternDims;if(r&&e!==Ue.stroke&&e!==Ue.closeStroke&&this.current.fillColor instanceof or){let o=M.intersect(this.current.clipBox,this.current.minMax);o?this.current.fillColor.updatePatternDims(o,r):this.current.tilingPatternDims=null}this[e](t,a),this._pathStartIdx=t}closePath(t){this.ctx.closePath()}stroke(t,e,n=!0){let s=n&&this.#u(this.current.strokeAlpha),a=this.ctx,r=this.current.strokeColor;if(a.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof r=="object"&&r?.getPattern){let o=r.isModifyingCurrentTransform()?a.getTransform():null;if(a.save(),a.strokeStyle=r.getPattern(a,this,$e(a),Yt.STROKE,t),o){let l=new Path2D;l.addPath(e,a.getTransform().invertSelf().multiplySelf(o)),e=l}this.rescaleAndStroke(e,!1),a.restore()}else this.rescaleAndStroke(e,!0);this.dependencyTracker?.recordDependencies(t,ze.stroke),n&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(Yt.STROKE,ut(this.ctx))),a.globalAlpha=this.current.fillAlpha,this.#f(s)}closeStroke(t,e){this.stroke(t,e)}fill(t,e,n=!0){let s=n&&this.#u(this.current.fillAlpha),a=this.ctx,r=this.current.fillColor,o=this.current.patternFill,l=!1,c=this.current.getClippedPathBoundingBox();if(this.dependencyTracker?.recordDependencies(t,ze.fill),o){let u=this.current.tilingPatternDims,h=u&&r.canSkipPatternCanvas(u);if(h){r.drawPattern(this,e,this.pendingEOFill,h,t),this.pendingEOFill=!1,n&&this.consumePath(t,e,c),this.current.tilingPatternDims=null,this.#f(s);return}let d=r.isModifyingCurrentTransform()?a.getTransform():null;if(this.dependencyTracker?.save(t),a.save(),a.fillStyle=r.getPattern(a,this,$e(a),Yt.FILL,t),d){let f=new Path2D;f.addPath(e,a.getTransform().invertSelf().multiplySelf(d)),e=f}l=!0}this.contentVisible&&c!==null&&(this.pendingEOFill?(a.fill(e,"evenodd"),this.pendingEOFill=!1):a.fill(e)),l&&(a.restore(),this.dependencyTracker?.restore(t)),n&&this.consumePath(t,e,c),this.#f(s)}eoFill(t,e){this.pendingEOFill=!0,this.fill(t,e)}fillStroke(t,e){let n=this.#u(Math.min(this.current.fillAlpha,this.current.strokeAlpha));this.fill(t,e,!1),this.stroke(t,e,!1),this.consumePath(t,e),this.#f(n)}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){let n=this.#u(this.current.fillAlpha);this.ctx.fill(e),this.dependencyTracker?.recordDependencies(t,ze.rawFillPath).recordOperation(t),this.#f(n)}clip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=wS}eoClip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=ob}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,n=this.ctx;if(this.dependencyTracker){let{dependencyTracker:s}=this;e!==void 0&&s.recordFutureForcedDependency("textClip",s.getOpenMarker()).recordFutureForcedDependency("textClip",t),s.recordCloseMarker(t)}if(e!==void 0){let s=new Path2D,a=n.getTransform().invertSelf();for(let{transform:r,x:o,y:l,fontSize:c,path:u}of e)u&&s.addPath(u,new DOMMatrix(r).preMultiplySelf(a).translate(o,l).scale(c,-c));n.clip(s)}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,n){this.dependencyTracker?.recordSimpleData("font",t).recordSimpleDataFromNamed("fontObj",e,t);let s=this.commonObjs.get(e),a=this.current;if(!s)throw new Error(`Can't find font for ${e}`);if(a.fontMatrix=s.fontMatrix||ed,(a.fontMatrix[0]===0||a.fontMatrix[3]===0)&&I("Invalid font matrix for font "+e),n<0?(n=-n,a.fontDirection=-1):a.fontDirection=1,this.current.font=s,this.current.fontSize=n,s.isType3Font)return;let r=s.loadedName||"sans-serif",o=s.systemFontInfo?.css||`"${r}", ${s.fallbackName}`,l="normal";s.black?l="900":s.bold&&(l="bold");let c=s.italic?"italic":"normal",u=ht(n,vS,AS);this.current.fontSizeScale=n/u,this.ctx.font=`${c} ${l} ${u}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,n){this.dependencyTracker?.resetIncrementalData("sameLineText").recordIncrementalData("moveText",t),this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=n}setLeadingMoveText(t,e,n){this.setLeading(t,-n),this.moveText(t,e,n)}setTextMatrix(t,e){this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",t);let{current:n}=this;n.textMatrix=e,n.textMatrixScale=Math.hypot(e[0],e[1]),n.x=n.lineX=0,n.y=n.lineY=0}nextLine(t){this.moveText(t,0,this.current.leading),this.dependencyTracker?.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??t)}#b(t,e,n){let s=new Path2D;return s.addPath(t,new DOMMatrix(n).invertSelf().multiplySelf(e)),s}paintChar(t,e,n,s,a,r){let o=this.ctx,l=this.current,c=l.font,u=l.textRenderingMode,h=l.fontSize/l.fontSizeScale,d=u&Pt.FILL_STROKE_MASK,f=!!(u&Pt.ADD_TO_PATH_FLAG),m=l.patternFill&&!c.missingFile,y=l.patternStroke&&!c.missingFile,v;if((c.disableFontFace||f||m||y)&&!c.missingFile&&(v=c.getPathGenerator(this.commonObjs,e)),v&&(c.disableFontFace||m||y)){o.save(),o.translate(n,s),o.scale(h,-h),this.dependencyTracker?.recordCharacterBBox(t,o,c);let p;if(d===Pt.FILL||d===Pt.FILL_STROKE)if(a){p=o.getTransform(),o.setTransform(...a);let g=this.#b(v,p,a);o.fill(g)}else o.fill(v);if(d===Pt.STROKE||d===Pt.FILL_STROKE)if(r){p||=o.getTransform(),o.setTransform(...r);let{a:g,b,c:A,d:S}=p,E=M.inverseTransform(r),T=M.transform([g,b,A,S,0,0],E);M.singularValueDecompose2dScale(T,Ee),o.lineWidth*=Math.max(Ee[0],Ee[1])/h,o.stroke(this.#b(v,p,r))}else o.lineWidth/=h,o.stroke(v);o.restore()}else(d===Pt.FILL||d===Pt.FILL_STROKE)&&(o.fillText(e,n,s),this.dependencyTracker?.recordCharacterBBox(t,o,c,h,n,s,()=>o.measureText(e))),(d===Pt.STROKE||d===Pt.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(t,o,c,h,n,s,()=>o.measureText(e)).recordDependencies(t,ze.stroke),o.strokeText(e,n,s));f&&((this.pendingTextPaths||=[]).push({transform:ut(o),x:n,y:s,fontSize:h,path:v}),this.dependencyTracker?.recordCharacterBBox(t,o,c,h,n,s))}get isFontSubpixelAAEnabled(){let t=this.canvasFactory.create(10,10),e=t.context;e.scale(1.5,1),e.fillText("I",0,10);let n=e.getImageData(0,0,10,10).data;this.canvasFactory.destroy(t);let s=!1;for(let a=3;a<n.length;a+=4)if(n[a]>0&&n[a]<255){s=!0;break}return B(this,"isFontSubpixelAAEnabled",s)}showText(t,e){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,ze.showText).resetBBox(t),this.current.textRenderingMode&Pt.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",t).inheritPendingDependenciesAsFutureForcedDependencies());let n=this.current,s=n.font;if(s.isType3Font){let N=this.#u(n.fillAlpha);this.showType3Text(t,e),this.dependencyTracker?.recordShowTextOperation(t),this.#f(N);return}let a=n.fontSize;if(a===0){this.dependencyTracker?.recordOperation(t);return}let r=this.#u(n.fillAlpha),o=this.ctx,l=n.fontSizeScale,c=n.charSpacing,u=n.wordSpacing,h=n.fontDirection,d=n.textHScale*h,f=e.length,m=s.vertical,y=m?1:-1,v=s.defaultVMetrics,p=a*n.fontMatrix[0],g=n.textRenderingMode===Pt.FILL&&!s.disableFontFace&&!n.patternFill;o.save(),n.textMatrix&&o.transform(...n.textMatrix),o.translate(n.x,n.y+n.textRise),h>0?o.scale(d,-1):o.scale(d,1);let b,A,S=n.textRenderingMode&Pt.FILL_STROKE_MASK,E=S===Pt.FILL||S===Pt.FILL_STROKE,T=S===Pt.STROKE||S===Pt.FILL_STROKE,w=n.lineWidth,_=n.textMatrixScale;if(_===0||w===0?T&&(w=this.getSinglePixelWidth()):w/=_,l!==1&&(o.scale(l,l),w/=l),o.lineWidth=w,E&&n.patternFill){o.save();let N=n.fillColor.getPattern(o,this,$e(o),Yt.FILL,t);b=ut(o),o.restore(),o.fillStyle=N}if(T&&n.patternStroke){o.save();let N=n.strokeColor.getPattern(o,this,$e(o),Yt.STROKE,t);A=ut(o),o.restore(),o.strokeStyle=N}if(s.isInvalidPDFjsFont){let N=[],z=0;for(let lt of e)N.push(lt.unicode),z+=lt.width;let X=N.join("");if(o.fillText(X,0,0),this.dependencyTracker!==null){let lt=o.measureText(X);this.dependencyTracker.recordBBox(t,this.ctx,-lt.actualBoundingBoxLeft,lt.actualBoundingBoxRight,-lt.actualBoundingBoxAscent,lt.actualBoundingBoxDescent).recordShowTextOperation(t)}n.x+=z*p*d,o.restore(),this.compose(),this.#f(r);return}let C=0,D;for(D=0;D<f;++D){let N=e[D];if(typeof N=="number"){C+=y*N*a/1e3;continue}let z=!1,X=(N.isSpace?u:0)+c,lt=N.fontChar,L=N.accent,R,Lt,kt=N.width;if(m){let at=N.vmetric||v,rt=-(N.vmetric?at[1]:kt*.5)*p,G=at[2]*p;kt=at?-at[0]:kt,R=rt/l,Lt=(C+G)/l}else R=C/l,Lt=0;let Pe;if(s.remeasure&&kt>0){Pe=o.measureText(lt);let at=Pe.width*1e3/a*l;if(kt<at&&this.isFontSubpixelAAEnabled){let rt=kt/at;z=!0,o.save(),o.scale(rt,1),R/=rt}else kt!==at&&(R+=(kt-at)/2e3*a/l)}if(this.contentVisible&&(N.isInFont||s.missingFile)){if(g&&!L)o.fillText(lt,R,Lt),this.dependencyTracker?.recordCharacterBBox(t,o,Pe?{bbox:null}:s,a/l,R,Lt,()=>Pe??o.measureText(lt));else if(this.paintChar(t,lt,R,Lt,b,A),L){let at=R+a*L.offset.x/l,rt=Lt-a*L.offset.y/l;this.paintChar(t,L.fontChar,at,rt,b,A)}}let xi=m?kt*p-X*h:kt*p+X*h;C+=xi,z&&o.restore()}m?n.y-=C:n.x+=C*d,o.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(t),this.#f(r)}showType3Text(t,e){let n=this.ctx,s=this.current,a=s.font,r=s.fontSize,o=s.fontDirection,l=a.vertical?1:-1,c=s.charSpacing,u=s.wordSpacing,h=s.textHScale*o,d=s.fontMatrix||ed,f=e.length,m=s.textRenderingMode===Pt.INVISIBLE,y,v,p,g;if(m||r===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,n.save(),s.textMatrix&&n.transform(...s.textMatrix),n.translate(s.x,s.y+s.textRise),n.scale(h,o);let b=this.dependencyTracker;for(this.dependencyTracker=b?new yr(b,t):null,y=0;y<f;++y){if(v=e[y],typeof v=="number"){g=l*v*r/1e3,this.ctx.translate(g,0),s.x+=g*h;continue}let A=(v.isSpace?u:0)+c,S=a.charProcOperatorList[v.operatorListId];S?this.contentVisible&&(this.save(),S.fnArray[0]===Ue.setCharWidth&&(s.fillAlpha=s.strokeAlpha=1,n.globalAlpha=1),n.scale(r,r),n.transform(...d),this.executeOperatorList(S),this.restore()):I(`Type3 character "${v.operatorListId}" is not available.`);let E=[v.width,0];M.applyTransform(E,d),p=E[0]*r+A,n.translate(p,0),s.x+=p*h}n.restore(),b&&(this.dependencyTracker=b)}setCharWidth(t,e,n){}setCharWidthAndBounds(t,e,n,s,a,r,o){let l=new Path2D;l.rect(s,a,r-s,o-a),this.ctx.clip(l),this.dependencyTracker?.recordBBox(t,this.ctx,s,r,a,o).recordClipBox(t,this.ctx,s,r,a,o),this.endPath(t)}getColorN_Pattern(t,e){let n;if(e[0]==="TilingPattern"){let s=this.baseTransform||ut(this.ctx),a={createCanvasGraphics:(r,o)=>new i(r,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new yr(this.dependencyTracker,o,!0):null)};n=new or(e,this.ctx,a,s)}else n=this._getPattern(t,e[1],e[2]);return n}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);let n=this.current.fillColor=this.getColorN_Pattern(t,e);this.current.patternFill=!0,this.current.tilingPatternDims=n instanceof or?[0,0,0,0]:null}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,this.current.tilingPatternDims=null}setFillTransparent(t){this.dependencyTracker?.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1,this.current.tilingPatternDims=null}_getPattern(t,e,n=null){let s;return this.cachedPatterns.has(e)?s=this.cachedPatterns.get(e):(s=bS(this.getObject(t,e)),this.cachedPatterns.set(e,s)),n&&(s.matrix=n),s}shadingFill(t,e){if(!this.contentVisible)return;let n=this.#u(this.current.fillAlpha),s=this.ctx;this.save(t);let a=this._getPattern(t,e);s.fillStyle=a.getPattern(s,this,$e(s),Yt.SHADING,t);let r=$e(s);if(r){let{width:o,height:l}=s.canvas,c=On.slice();M.axialAlignedBoundingBox([0,0,o,l],r,c);let[u,h,d,f]=c;this.ctx.fillRect(u,h,d-u,f-h)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.dependencyTracker?.resetBBox(t).recordFullPageBBox(t).recordDependencies(t,ze.transform).recordDependencies(t,ze.fill).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t),this.#f(n)}beginInlineImage(){Q("Should not call beginInlineImage")}beginImageData(){Q("Should not call beginImageData")}paintFormXObjectBegin(t,e,n){if(this.contentVisible&&(this.save(t),this.baseTransformStack.push(this.baseTransform),e&&this.transform(t,...e),this.baseTransform=ut(this.ctx),n)){M.axialAlignedBoundingBox(n,this.baseTransform,this.current.minMax);let[s,a,r,o]=n,l=new Path2D;l.rect(s,a,r-s,o-a),this.ctx.clip(l),this.dependencyTracker?.recordClipBox(t,this.ctx,s,r,a,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);let{inSMaskMode:n}=this;n&&(this.endSMaskMode(),this.current.activeSMask=null);let s=this.ctx;if((!e.needsIsolation||!e.isolated&&!e.hasSoftMask)&&!e.knockout&&!e.isGray&&this.#t===0&&s.globalAlpha===1&&s.globalCompositeOperation==="source-over"&&!n){if(e.bbox){let g=new Path2D,[b,A,S,E]=e.bbox;if(g.rect(b,A,S-b,E-A),e.matrix){let T=new Path2D;T.addPath(g,new DOMMatrix(e.matrix)),g=T}s.clip(g)}this.groupStack.push(null),this.#l.push(null),this.groupLevel++;return}!e.isolated&&!e.knockout&&this.#t===0&&Wl("TODO: Fully support non-isolated non-knockout groups.");let a=ut(s);e.matrix&&s.transform(...e.matrix);let r=[0,0,s.canvas.width,s.canvas.height],o;e.bbox?(o=On.slice(),M.axialAlignedBoundingBox(e.bbox,ut(s),o),o=M.intersect(o,r)||[0,0,0,0]):o=r;let l=Math.floor(o[0]),c=Math.floor(o[1]),u=Math.max(Math.ceil(o[2])-l,1),h=Math.max(Math.ceil(o[3])-c,1);this.current.startNewPathAndClipBox([0,0,u,h]);let d=this.canvasFactory.create(u,h);e.smask&&this.smaskGroupCanvases.push(d);let f=d.context,m=e.knockout&&!e.isolated?s:null,y=!e.isolated&&!e.knockout&&!e.smask&&e.needsIsolation&&this.#t>0,v=e.knockout?this.canvasFactory.create(u,h):null,p=this.#t;if(e.knockout?this.#t++:this.#t=0,f.translate(-l,-c),f.transform(...a),!e.isolated&&!e.smask&&n&&e.needsIsolation&&(f.save(),f.setTransform(1,0,0,1,0,0),f.drawImage(s.canvas,-l,-c),f.restore()),e.bbox){let g=new Path2D,[b,A,S,E]=e.bbox;if(g.rect(b,A,S-b,E-A),e.matrix){let T=new Path2D;T.addPath(g,new DOMMatrix(e.matrix)),g=T}f.clip(g)}e.smask&&this.smaskStack.push({canvas:d.canvas,context:f,offsetX:l,offsetY:c,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null}),(!e.smask||this.dependencyTracker)&&(s.setTransform(1,0,0,1,0,0),s.translate(l,c),s.save()),Mn(s,f),this.ctx=f,this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(s),this.setGState(t,[["BM","source-over"],["ca",1],["CA",1],["TR",null]]),this.groupStack.push(s),this.#l.push({backdropCtx:m,savedKnockoutLevel:p,offsetX:l,offsetY:c,hasInnerBackdrop:y,knockoutMaskEntry:v,knockoutTempEntry:null,knockoutBackdropEntry:null}),this.groupLevel++}endGroup(t,e){if(!this.contentVisible)return;this.groupLevel--;let n=this.ctx,s=this.groupStack.pop(),a=this.#l.pop();if(a&&(this.#t=a.savedKnockoutLevel),s===null){this.restore(t);return}if(e.isGray&&this.#v(n),this.ctx=s,this.ctx.imageSmoothingEnabled=!1,this.dependencyTracker?.popBaseTransform(),e.smask)this.tempSMask=this.smaskStack.pop(),this.restore(t),this.dependencyTracker&&(this.ctx.restore(),this.inSMaskMode&&this.ctx.setTransform(this.suspendedCtx.getTransform())),this.#y(a);else{this.ctx.restore();let r=ut(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...r);let o=On.slice();M.axialAlignedBoundingBox([0,0,n.canvas.width,n.canvas.height],r,o);let l=this.#l.at(-1);if(this.#t>0)if(a.hasInnerBackdrop){let{width:c,height:u}=n.canvas,h=this.canvasFactory.create(c,u),d=h.context;d.drawImage(s.canvas,a.offsetX,a.offsetY,c,u,0,0,c,u),d.globalCompositeOperation="source-over",d.drawImage(n.canvas,0,0);let f=this.#p(n.canvas);d.globalCompositeOperation="destination-in",d.drawImage(f.canvas,0,0);let m=this.ctx.globalCompositeOperation,y=this.ctx.globalAlpha,v=this.ctx.filter;this.ctx.save(),this.ctx.setTransform(...r),this.ctx.globalAlpha=1,J.isCanvasFilterSupported&&(this.ctx.filter="none"),this.ctx.globalCompositeOperation="destination-out",this.ctx.drawImage(f.canvas,0,0),this.ctx.globalCompositeOperation=m,this.ctx.globalAlpha=y,J.isCanvasFilterSupported&&(this.ctx.filter=v??"none"),this.ctx.drawImage(h.canvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(f),this.canvasFactory.destroy(h)}else{let c=l?.backdropCtx??null;this.#g(this.ctx,n.canvas,{backdropCanvas:c?.canvas??null,destTransform:r,backdropOffset:c?[l.offsetX+a.offsetX,l.offsetY+a.offsetY]:[0,0],sourceAlpha:this.ctx.globalAlpha,sourceFilter:this.ctx.filter})}else this.ctx.drawImage(n.canvas,0,0);this.ctx.restore(),this.canvasFactory.destroy({canvas:n.canvas,context:n}),this.#y(a),this.compose(o)}}#v(t){let{canvas:e}=t,{width:n,height:s}=e;if(J.isCanvasFilterSupported){t.save(),t.setTransform(1,0,0,1,0,0),t.filter="grayscale(1)",t.globalAlpha=1,t.globalCompositeOperation="copy",t.drawImage(e,0,0),t.restore();return}let a=t.getImageData(0,0,n,s),{data:r}=a;for(let o=0,l=r.length;o<l;o+=4){let c=r[o]*.2126+r[o+1]*.7152+r[o+2]*.0722+.5|0;r[o]=r[o+1]=r[o+2]=c}t.putImageData(a,0,0)}#y(t){t&&(t.knockoutMaskEntry&&(this.canvasFactory.destroy(t.knockoutMaskEntry),t.knockoutMaskEntry=null),t.knockoutTempEntry&&(this.canvasFactory.destroy(t.knockoutTempEntry),t.knockoutTempEntry=null),t.knockoutBackdropEntry&&(this.canvasFactory.destroy(t.knockoutBackdropEntry),t.knockoutBackdropEntry=null))}beginAnnotation(t,e,n,s,a,r,o){if(this.#d(),dl(this.ctx),this.ctx.save(),this.save(t),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),n){let l=n[2]-n[0],c=n[3]-n[1];if(r&&this.annotationCanvasMap){s=s.slice(),s[4]-=n[0],s[5]-=n[1],n=n.slice(),n[0]=n[1]=0,n[2]=l,n[3]=c,M.singularValueDecompose2dScale(ut(this.ctx),Ee);let{viewportScale:u}=this,h=Math.ceil(l*this.outputScaleX*u),d=Math.ceil(c*this.outputScaleY*u);this.annotationCanvas=this.canvasFactory.create(h,d);let{canvas:f,context:m}=this.annotationCanvas;if(o){let y=this.annotationCanvasMap.getOrInsertComputed(e,Ys);f.setAttribute("data-canvas-name",o);let v=y.findIndex(p=>p.getAttribute("data-canvas-name")===o);v===-1?y.push(f):y[v]=f}else this.annotationCanvasMap.set(e,f);this.annotationCanvas.savedCtx=this.ctx,this.ctx=m,this.ctx.save(),this.ctx.setTransform(Ee[0],0,0,-Ee[1],0,c*Ee[1]),dl(this.ctx)}else{dl(this.ctx),this.endPath(t);let u=new Path2D;u.rect(n[0],n[1],l,c),this.ctx.clip(u)}}this.current=new Dl(this.ctx.canvas.width,this.ctx.canvas.height),this.baseTransformStack.push(this.baseTransform),this.transform(t,...s),this.transform(t,...a),this.baseTransform=ut(this.ctx)}endAnnotation(t){this.annotationCanvas&&(this.ctx.restore(),this.#h(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas),this.baseTransform=this.baseTransformStack.pop()}paintImageMaskXObject(t,e){if(!this.contentVisible)return;let n=e.count;e=this.getObject(t,e.data,e),e.count=n;let s=this.#u(this.current.fillAlpha),a=this.ctx,r=this._createMaskCanvas(t,e),o=r.canvas;a.save(),a.setTransform(1,0,0,1,0,0),a.drawImage(o,r.offsetX,r.offsetY),this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,r.offsetX,r.offsetX+o.width,r.offsetY,r.offsetY+o.height).recordOperation(t),a.restore(),r.canvasEntry&&this.canvasFactory.destroy(r.canvasEntry),this.compose(),this.#f(s)}paintImageMaskXObjectRepeat(t,e,n,s=0,a=0,r,o){if(!this.contentVisible)return;e=this.getObject(t,e.data,e);let l=this.#u(this.current.fillAlpha),c=this.ctx;c.save();let u=ut(c);c.transform(n,s,a,r,0,0);let h=this._createMaskCanvas(t,e);c.setTransform(1,0,0,1,h.offsetX-u[4],h.offsetY-u[5]),this.dependencyTracker?.resetBBox(t);for(let d=0,f=o.length;d<f;d+=2){let m=M.transform(u,[n,s,a,r,o[d],o[d+1]]);c.drawImage(h.canvas,m[4],m[5]),this.dependencyTracker?.recordBBox(t,this.ctx,m[4],m[4]+h.canvas.width,m[5],m[5]+h.canvas.height)}c.restore(),h.canvasEntry&&this.canvasFactory.destroy(h.canvasEntry),this.compose(),this.dependencyTracker?.recordOperation(t),this.#f(l)}paintImageMaskXObjectGroup(t,e){if(!this.contentVisible)return;let n=this.#u(this.current.fillAlpha),s=this.ctx,a=this.current.fillColor,r=this.current.patternFill;this.dependencyTracker?.resetBBox(t).recordDependencies(t,ze.transformAndFill);for(let o of e){let{data:l,width:c,height:u,transform:h}=o,d=this.canvasFactory.create(c,u),f=d.context;f.save();let m=this.getObject(t,l,o);ab(f,m),f.globalCompositeOperation="source-in",f.fillStyle=r?a.getPattern(f,this,$e(s),Yt.FILL,t):a,f.fillRect(0,0,c,u),f.restore(),s.save(),s.transform(...h),s.scale(1,-1),hl(s,d.canvas,0,0,c,u,0,-1,1,1),this.canvasFactory.destroy(d),this.dependencyTracker?.recordBBox(t,s,0,c,0,u),s.restore()}this.compose(),this.dependencyTracker?.recordOperation(t),this.#f(n)}paintImageXObject(t,e){if(!this.contentVisible)return;let n=this.getObject(t,e);if(!n){I("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t,n)}paintImageXObjectRepeat(t,e,n,s,a){if(!this.contentVisible)return;let r=this.getObject(t,e);if(!r){I("Dependent image isn't ready yet");return}let o=r.width,l=r.height,c=[];for(let u=0,h=a.length;u<h;u+=2)c.push({transform:[n,0,0,s,a[u],a[u+1]],x:0,y:0,w:o,h:l});this.paintInlineImageXObjectGroup(t,r,c)}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{img:t.bitmap,canvasEntry:null};let{bitmap:e,width:n,height:s}=t,a=this.canvasFactory.create(n,s),r=a.context;return r.filter=this.current.transferMaps,r.drawImage(e,0,0),r.filter="none",{img:a.canvas,canvasEntry:a}}paintInlineImageXObject(t,e){if(!this.contentVisible)return;let n=e.width,s=e.height,a=this.#u(this.current.fillAlpha),r=this.ctx;this.save(t);let{filter:o}=r;o!=="none"&&o!==""&&(r.filter="none"),r.scale(1/n,-1/s);let l,c=null;if(e.bitmap){let h=this.applyTransferMapsToBitmap(e);l=h.img,c=h.canvasEntry}else{let h=this.canvasFactory.create(n,s);sb(h.context,e),l=this.applyTransferMapsToCanvas(h.context),c=h}let u=this._scaleImage(l,$e(r));r.imageSmoothingEnabled=rb(ut(r),e.interpolate),this.dependencyTracker&&(this.dependencyTracker.resetBBox(t).recordBBox(t,r,0,n,-s,0).recordDependencies(t,ze.imageXObject).recordOperation(t),this.imagesTracker?.record(r,n,s,this.dependencyTracker.clipBox)),hl(r,u.img,0,0,u.paintWidth,u.paintHeight,0,-s,n,s),u.tmpCanvas&&this.canvasFactory.destroy(u.tmpCanvas),c&&this.canvasFactory.destroy(c),this.compose(),this.restore(t),this.#f(a)}paintInlineImageXObjectGroup(t,e,n){if(!this.contentVisible)return;let s=this.#u(this.current.fillAlpha),a=this.ctx,r,o=null;if(e.bitmap)r=e.bitmap;else{let l=e.width,c=e.height,u=this.canvasFactory.create(l,c);sb(u.context,e),r=this.applyTransferMapsToCanvas(u.context),o=u}this.dependencyTracker?.resetBBox(t);for(let l of n)a.save(),a.transform(...l.transform),a.scale(1,-1),hl(a,r,l.x,l.y,l.w,l.h,0,-1,1,1),this.dependencyTracker?.recordBBox(t,a,0,1,-1,0),a.restore();o&&this.canvasFactory.destroy(o),this.dependencyTracker?.recordOperation(t),this.compose(),this.#f(s)}paintSolidColorImageMask(t){if(!this.contentVisible)return;let e=this.#u(this.current.fillAlpha);this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,0,1,0,1).recordDependencies(t,ze.fill).recordOperation(t),this.ctx.fillRect(0,0,1,1),this.compose(),this.#f(e)}markPoint(t,e){}markPointProps(t,e,n){}beginMarkedContent(t,e){this.dependencyTracker?.beginMarkedContent(t),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e,n){this.dependencyTracker?.beginMarkedContent(t),e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(n)}):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,n){let s=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(n);let a=this.ctx;this.pendingClip?(s||(this.pendingClip===ob?a.clip(e,"evenodd"):a.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=ut(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]),n=Math.hypot(t[0],t[2]),s=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(n,s)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){let{lineWidth:t}=this.current,{a:e,b:n,c:s,d:a}=this.ctx.getTransform(),r,o;if(n===0&&s===0){let l=Math.abs(e),c=Math.abs(a);if(l===c)if(t===0)r=o=1/l;else{let u=l*t;r=o=u<1?1/u:1}else if(t===0)r=1/l,o=1/c;else{let u=l*t,h=c*t;r=u<1?1/u:1,o=h<1?1/h:1}}else{let l=Math.abs(e*a-n*s),c=Math.hypot(e,n),u=Math.hypot(s,a);if(t===0)r=u/l,o=c/l;else{let h=t*l;r=u>h?u/h:1,o=c>h?c/h:1}}this._cachedScaleForStroking[0]=r,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t,e){let{ctx:n,current:{lineWidth:s}}=this,[a,r]=this.getScaleForStroking();if(a===r){n.lineWidth=(s||1)*a,n.stroke(t);return}let o=n.getLineDash();e&&n.save(),n.scale(a,r),Jh.a=1/a,Jh.d=1/r;let l=new Path2D;if(l.addPath(t,Jh),o.length>0){let c=Math.max(a,r);n.setLineDash(o.map(u=>u/c)),n.lineDashOffset/=c}n.lineWidth=s||1,n.stroke(l),e&&n.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};for(let i in Ue)zs.prototype[i]!==void 0&&(zs.prototype[Ue[i]]=zs.prototype[i]);Us=class{#t=null;#e=null;_fullReader=null;_rangeReaders=new Set;_source=null;constructor(t,e,n){this._source=t,this.#t=e,this.#e=n}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return Et(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new this.#t(this)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let n=new this.#e(this,t,e);return this._rangeReaders.add(n),n}cancelAllRequests(t){this._fullReader?.cancel(t);for(let e of new Set(this._rangeReaders))e.cancel(t)}},Gs=class{onProgress=null;_contentLength=0;_filename=null;_headersCapability=Promise.withResolvers();_isRangeSupported=!1;_isStreamingSupported=!1;_loaded=0;_stream=null;constructor(t){this._stream=t}_callOnProgress(){this.onProgress?.({loaded:this._loaded,total:this._contentLength})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){Q("Abstract method `read` called")}cancel(t){Q("Abstract method `cancel` called")}},js=class{_stream=null;constructor(t,e,n){this._stream=t}async read(){Q("Abstract method `read` called")}cancel(t){Q("Abstract method `cancel` called")}};Id=class extends Us{_responseOrigin=null;constructor(t){super(t,Fd,Hd);let{httpHeaders:e,url:n}=t;Et(/https?:/.test(n.protocol),"PDFFetchStream only supports http(s):// URLs."),this.headers=_b(!0,e)}},Fd=class extends Gs{_abortController=new AbortController;_reader=null;constructor(t){super(t);let{disableRange:e,disableStream:n,rangeChunkSize:s,url:a,withCredentials:r}=t._source;this._isStreamingSupported=!n;let o=new Headers(t.headers);Db(a,o,r,this._abortController).then(l=>{t._responseOrigin=ec(l.url),Ob(l.status,a),this._reader=l.body.getReader();let c=l.headers,{contentLength:u,isRangeSupported:h}=xb({responseHeaders:c,isHttp:!0,rangeChunkSize:s,disableRange:e});this._contentLength=u,this._isRangeSupported=h,this._filename=Cb(c),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Ge("Streaming is disabled.")),this._headersCapability.resolve()}).catch(this._headersCapability.reject)}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._callOnProgress(),{value:nc(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}},Hd=class extends js{_abortController=new AbortController;_readCapability=Promise.withResolvers();_reader=null;constructor(t,e,n){super(t,e,n);let{url:s,withCredentials:a}=t._source,r=new Headers(t.headers);r.append("Range",`bytes=${e}-${n-1}`),Db(s,r,a,this._abortController).then(o=>{let l=ec(o.url);Mb(l,t._responseOrigin),Ob(o.status,s),this._reader=o.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:{value:nc(t),done:!1}}cancel(t){this._reader?.cancel(t),this._abortController.abort()}};Ud=class extends Us{_progressiveDone=!1;_queuedChunks=[];constructor(t){super(t,Gd,jd);let{pdfDataRangeTransport:e}=t,{initialData:n,progressiveDone:s}=e;if(n?.length>0){let r=lb(n);this._queuedChunks.push(r)}this._progressiveDone=s;let a=r=>{switch(r.type){case"range":case"progressiveRead":this.#t(r.begin,r.chunk);break;case"progressiveDone":this._fullReader?.progressiveDone(),this._progressiveDone=!0;break}};e.transportReady(a)}#t(t,e){let n=lb(e);if(t===void 0)this._fullReader?this._fullReader._enqueue(n):this._queuedChunks.push(n);else{let s=this._rangeReaders.keys().find(a=>a._begin===t);Et(s,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),s._enqueue(n)}}getFullReader(){let t=super.getFullReader();return this._queuedChunks=null,t}getRangeReader(t,e){let n=super.getRangeReader(t,e);return n&&(n.onDone=()=>this._rangeReaders.delete(n),this._source.pdfDataRangeTransport.requestDataRange(t,e)),n}cancelAllRequests(t){super.cancelAllRequests(t),this._source.pdfDataRangeTransport.abort()}},Gd=class extends Gs{#t=sc.bind(this);_done=!1;_queuedChunks=null;_requests=[];constructor(t){super(t);let{pdfDataRangeTransport:e,disableRange:n,disableStream:s}=t._source,{length:a,contentDispositionFilename:r}=e;this._queuedChunks=t._queuedChunks||[];for(let l of this._queuedChunks)this._loaded+=l.byteLength;this._done=t._progressiveDone,this._contentLength=a,this._isStreamingSupported=!s,this._isRangeSupported=!n,Jl(r)&&(this._filename=r),this._headersCapability.resolve();let o=this._loaded;Promise.resolve().then(()=>{o>0&&this._loaded===o&&this._callOnProgress()})}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength,this._callOnProgress())}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this.#t()}progressiveDone(){this._done||=!0,this._queuedChunks.length===0&&this.#t()}},jd=class extends js{#t=sc.bind(this);onDone=null;_begin=-1;_done=!1;_queuedChunk=null;_requests=[];constructor(t,e,n){super(t,e,n),this._begin=e}_enqueue(t){this._done||(this._requests.length===0?this._queuedChunk=t:(this._requests.shift().resolve({value:t,done:!1}),this.#t()),this._done=!0,this.onDone?.())}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,this.#t(),this.onDone?.()}},td=200,cb=206;Vd=class extends Us{#t=new WeakMap;_responseOrigin=null;constructor(t){super(t,Xd,Yd);let{httpHeaders:e,url:n}=t;this.url=n,this.isHttp=/https?:/.test(n.protocol),this.headers=_b(this.isHttp,e)}_request(t){let e=new XMLHttpRequest,n={validateStatus:null,onHeadersReceived:t.onHeadersReceived,onDone:t.onDone,onError:t.onError,onProgress:t.onProgress};this.#t.set(e,n),e.open("GET",this.url),e.withCredentials=this._source.withCredentials;for(let[s,a]of this.headers)e.setRequestHeader(s,a);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),n.validateStatus=s=>s===cb||s===td):n.validateStatus=s=>s===td,e.responseType="arraybuffer",Et(t.onError,"Expected `onError` callback to be provided."),e.onerror=()=>t.onError(e.status),e.onreadystatechange=this.#i.bind(this,e),e.onprogress=this.#e.bind(this,e),e.send(null),e}#e(t,e){this.#t.get(t)?.onProgress?.(e)}#i(t,e){let n=this.#t.get(t);if(!n||(t.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),t.readyState!==4)||!this.#t.has(t))return;if(this.#t.delete(t),t.status===0&&this.isHttp){n.onError(t.status);return}let s=t.status||td;if(!n.validateStatus(s)){n.onError(t.status);return}let a=xS(t.response);if(s===cb){let r=t.getResponseHeader("Content-Range");/bytes \d+-\d+\/\d+/.test(r)?n.onDone(a):(I('Missing or invalid "Content-Range" header.'),n.onError(0))}else a?n.onDone(a):n.onError(t.status)}_abortRequest(t){this.#t.has(t)&&(this.#t.delete(t),t.abort())}getRangeReader(t,e){let n=super.getRangeReader(t,e);return n&&(n.onClosed=()=>this._rangeReaders.delete(n)),n}},Xd=class extends Gs{#t=sc.bind(this);_cachedChunks=[];_done=!1;_requests=[];_storedError=null;constructor(t){super(t),this._fullRequestXhr=t._request({onHeadersReceived:this.#e.bind(this),onDone:this.#i.bind(this),onError:this.#n.bind(this),onProgress:this.#s.bind(this)})}#e(){let t=this._stream,{disableRange:e,rangeChunkSize:n}=t._source,s=this._fullRequestXhr;t._responseOrigin=ec(s.responseURL);let a=s.getAllResponseHeaders(),r=new Headers(a?a.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(c=>{let[u,...h]=c.split(": ");return[u,h.join(": ")]}):[]),{contentLength:o,isRangeSupported:l}=xb({responseHeaders:r,isHttp:t.isHttp,rangeChunkSize:n,disableRange:e});this._contentLength=o,this._isRangeSupported=l,this._filename=Cb(r),this._isRangeSupported&&t._abortRequest(s),this._headersCapability.resolve()}#i(t){this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._cachedChunks.push(t),this._done=!0,this._cachedChunks.length===0&&this.#t()}#n(t){this._storedError=ic(t,this._stream.url),this._headersCapability.reject(this._storedError);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}#s(t){this.onProgress?.({loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}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),this.#t(),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}},Yd=class extends js{#t=sc.bind(this);onClosed=null;_done=!1;_queuedChunk=null;_requests=[];_storedError=null;constructor(t,e,n){super(t,e,n),this._requestXhr=t._request({begin:e,end:n,onHeadersReceived:this.#e.bind(this),onDone:this.#i.bind(this),onError:this.#n.bind(this),onProgress:null})}#e(){let t=ec(this._requestXhr?.responseURL);try{Mb(t,this._stream._responseOrigin)}catch(e){this._storedError=e,this.#n(0)}}#i(t){this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0,this.#t(),this.onClosed?.()}#n(t){this._storedError??=ic(t,this._stream.url);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}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,this.#t(),this._stream._abortRequest(this._requestXhr),this.onClosed?.()}};qd=class extends Us{constructor(t){super(t,Kd,Wd);let{url:e}=t;Et(e.protocol==="file:","PDFNodeStream only supports file:// URLs.")}},Kd=class extends Gs{_reader=null;constructor(t){super(t);let{disableRange:e,disableStream:n,rangeChunkSize:s,url:a}=t._source;this._isStreamingSupported=!n,process.getBuiltinModule("fs/promises").lstat(a).then(o=>{let l=Rb(a);this._reader=l.getReader();let{size:c}=o;this._contentLength=c,this._isRangeSupported=!e&&c>2*s,!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Ge("Streaming is disabled.")),this._headersCapability.resolve()}).catch(o=>{o.code==="ENOENT"&&(o=ic(0,a)),this._headersCapability.reject(o)})}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._callOnProgress(),{value:nc(t),done:!1})}cancel(t){this._reader?.cancel(t)}},Wd=class extends js{_readCapability=Promise.withResolvers();_reader=null;constructor(t,e,n){super(t,e,n);let{url:s}=t._source;try{let a=Rb(s,{start:e,end:n-1});this._reader=a.getReader(),this._readCapability.resolve()}catch(a){this._readCapability.reject(a)}}async read(){await this._readCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:{value:nc(t),done:!1}}cancel(t){this._reader?.cancel(t)}};sn=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}},Qd=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()}},Dn=Symbol("INTERNAL"),$d=class{#t=!1;#e=!1;#i=!1;#n=!0;constructor(t,{name:e,intent:n,usage:s,rbGroups:a}){this.#t=!!(t&Ae.DISPLAY),this.#e=!!(t&Ae.PRINT),this.name=e,this.intent=n,this.usage=s,this.rbGroups=a}get visible(){if(this.#i)return this.#n;if(!this.#n)return!1;let{print:t,view:e}=this.usage;return this.#t?e?.viewState!=="OFF":this.#e?t?.printState!=="OFF":!0}_setVisible(t,e,n=!1){t!==Dn&&Q("Internal method `_setVisible` called."),this.#i=n,this.#n=e}get serializable(){return{userSet:this.#i,visible:this.#n}}},Zd=class i{#t=null;#e=new Map;#i=null;#n=null;#s;creator=null;name=null;constructor(t,e=Ae.DISPLAY,n=null){if(this.#s=t,this.renderingIntent=e,t!==null){this.name=t.name,this.creator=t.creator,this.#n=t.order;for(let s of t.groups)this.#e.set(s.id,new $d(e,s));if(n){n.size!==this.#e.size&&Q("Incorrect serialized groupState.");for(let[s,a]of n)this.#e.get(s)._setVisible(Dn,a.visible,a.userSet)}else{if(t.baseState==="OFF")for(let s of this.#e.values())s._setVisible(Dn,!1);for(let s of t.on)this.#e.get(s)._setVisible(Dn,!0);for(let s of t.off)this.#e.get(s)._setVisible(Dn,!1)}this.#i=this.getHash()}}#r(t){let e=t.length;if(e<2)return!0;let n=t[0];for(let s=1;s<e;s++){let a=t[s],r;if(Array.isArray(a))r=this.#r(a);else if(this.#e.has(a))r=this.#e.get(a).visible;else return I(`Optional content group not found: ${a}`),!0;switch(n){case"And":if(!r)return!1;break;case"Or":if(r)return!0;break;case"Not":return!r;default:return!0}}return n==="And"}isVisible(t){if(this.#e.size===0)return!0;if(!t)return Wl("Optional content group not defined."),!0;if(t.type==="OCG")return this.#e.has(t.id)?this.#e.get(t.id).visible:(I(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return this.#r(t.expression);if(!t.policy||t.policy==="AnyOn"){for(let e of t.ids){if(!this.#e.has(e))return I(`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 I(`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 I(`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 I(`Optional content group not found: ${e}`),!0;if(this.#e.get(e).visible)return!1}return!0}return I(`Unknown optional content policy ${t.policy}.`),!0}return I(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,n=!0){let s=this.#e.get(t);if(!s){I(`Optional content group not found: ${t}`);return}if(n&&e&&s.rbGroups.length)for(let a of s.rbGroups)for(let r of a)r!==t&&this.#e.get(r)?._setVisible(Dn,!1,!0);s._setVisible(Dn,!!e,!0),this.#t=null}setOCGState({state:t,preserveRB:e}){let n;for(let s of t){switch(s){case"ON":case"OFF":case"Toggle":n=s;continue}let a=this.#e.get(s);if(a)switch(n){case"ON":this.setVisibility(s,!0,e);break;case"OFF":this.setVisibility(s,!1,e);break;case"Toggle":this.setVisibility(s,!a.visible,e);break}}this.#t=null}get hasInitialVisibility(){return this.#i===null||this.getHash()===this.#i}getOrder(){return this.#e.size?this.#n?this.#n.slice():[...this.#e.keys()]:null}getGroup(t){return this.#e.get(t)||null}getHash(){if(this.#t!==null)return this.#t;let t=new pr;for(let[e,n]of this.#e)t.update(`${e}:${n.visible}`);return this.#t=t.hexdigest()}[Symbol.iterator](){return this.#e.entries()}get serializable(){let t=new Map;for(let[e,n]of this.#e)t.set(e,n.serializable);return{data:this.#s,renderingIntent:this.renderingIntent,groupState:t}}static fromSerializable({data:t,renderingIntent:e,groupState:n}){return new i(t,e,n)}},Jd=class{#t=null;#e=null;#i=0;#n=null;#s=null;get pagesNumber(){return this.#i}set pagesNumber(t){this.#i!==t&&(this.#i=t,this.#t=null,this.#e=null)}#r(){if(this.#t)return;let t=this.#i,e=this.#t=new Uint32Array(t);for(let n=0;n<t;n++)e[n]=n+1;this.#e=new Int32Array(e)}#a(){let t=new Map,e=this.#t;for(let n=0,s=this.#i;n<s;n++){let a=e[n],r=t.get(a);r?r.push(n+1):t.set(a,[n+1])}return t}movePages(t,e,n){this.#r();let s=this.#t,a=this.#a(),r=e.length,o=new Uint32Array(r),l=0;for(let d=0;d<r;d++){let f=e[d]-1;o[d]=s[f],f<n&&l++}let c=this.#i,u=c-r,h=ht(n-l,0,u);for(let d=0,f=0;d<c;d++)t.has(d+1)||(s[f++]=s[d]);s.copyWithin(h+r,h,u),s.set(o,h),this.#o(a),s.every((d,f)=>d===f+1)&&(this.#t=null)}deletePages(t){this.#r();let e=this.#t,n=this.#a();this.#s={pageNumberToId:e.slice(),pagesNumber:this.#i,prevPageNumbers:this.#e.slice()};let s=this.#i-t.length;this.#i=s;let a=this.#t=new Uint32Array(s);this.#e=new Int32Array(s);let r=0,o=0;for(let l of t){let c=l-1;c!==r&&(a.set(e.subarray(r,c),o),o+=c-r),r=c+1}r<e.length&&a.set(e.subarray(r),o),this.#o(n,new Set(t))}cancelDelete(){this.#s&&(this.#t=this.#s.pageNumberToId,this.#i=this.#s.pagesNumber,this.#e=this.#s.prevPageNumbers,this.#s=null)}cleanSavedData(){this.#s=null}copyPages(t){this.#r(),this.#n={pageNumbers:t,pageIds:t.map(e=>this.#t[e-1])}}cancelCopy(){this.#n=null}pastePages(t){this.#r();let e=this.#t,n=this.#a(),{pageNumbers:s,pageIds:a}=this.#n,r=this.#i+s.length;this.#i=r;let o=this.#t=new Uint32Array(r);this.#e=new Int32Array(r),o.set(e.subarray(0,t),0),o.set(a,t),o.set(e.subarray(t),t+s.length),this.#o(n,null,t,s),this.#n=null}#o(t,e=null,n=-1,s=null){let a=this.#e,r=this.#t,o=n+(s?.length??0),l=new Map;for(let c=0,u=this.#i;c<u;c++){if(c>=n&&c<o){a[c]=-s[c-n];continue}let h=r[c],d=t.get(h),f=l.get(h)||0;if(e&&d)for(;f<d.length&&e.has(d[f]);)f++;a[c]=d?.[f],l.set(h,f+1)}}hasBeenAltered(){return this.#t!==null}getPageMappingForSaving(t=null){t??=this.#a();let e=0;for(let s of t.values())e=Math.max(e,s.length);let n=new Array(e);for(let s=0;s<e;s++)n[s]={document:null,pageIndices:[],includePages:[]};for(let[s,a]of t)for(let r=0,o=a.length;r<o;r++)n[r].includePages.push([s-1,a[r]-1]);for(let{includePages:s,pageIndices:a}of n){s.sort((r,o)=>r[0]-o[0]);for(let r=0,o=s.length;r<o;r++)a.push(s[r][1]),s[r]=s[r][0]}return n}extractPages(t){t=Array.from(t).sort((n,s)=>n-s);let e=new Map;for(let n=0,s=t.length;n<s;n++){let a=this.getPageId(t[n]);e.getOrInsertComputed(a,Ys).push(n+1)}return this.getPageMappingForSaving(e)}getPrevPageNumber(t){return this.#e?.[t-1]??0}getPageNumber(t){if(!this.#t)return t;let e=this.#t;for(let n=0,s=this.#i;n<s;n++)if(e[n]===t)return n+1;return 0}getPageId(t){return this.#t?.[t-1]??t}getMapping(){return this.#t?.subarray(0,this.pagesNumber)}},Ls=Symbol("INITIAL_DATA"),ub=()=>({...Promise.withResolvers(),data:Ls}),Ol=class{#t=new Map;get(t,e=null){if(e){let s=this.#t.getOrInsertComputed(t,ub);return s.promise.then(()=>e(s.data)),null}let n=this.#t.get(t);if(!n||n.data===Ls)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return n.data}has(t){let e=this.#t.get(t);return!!e&&e.data!==Ls}delete(t){let e=this.#t.get(t);return!e||e.data===Ls?!1:(this.#t.delete(t),!0)}resolve(t,e=null){let n=this.#t.getOrInsertComputed(t,ub);if(n.data!==Ls)throw new Error(`Object already resolved ${t}.`);n.data=e,n.resolve()}clear(){for(let{data:t}of this.#t.values())t?.bitmap?.close();this.#t.clear()}*[Symbol.iterator](){for(let[t,{data:e}]of this.#t)e!==Ls&&(yield[t,e])}},MS=1e5,hb=30,Vs=class i{#t=Promise.withResolvers();#e=null;#i=!1;#n=!!globalThis.FontInspector?.enabled;#s=null;#r=null;#a=null;#o=0;#c=0;#l=null;#d=null;#h=0;#p=0;#m=Object.create(null);#g=[];#u=null;#f=[];#b=new WeakMap;#v=null;static#y=new Map;static#T=new Map;static#w=new WeakMap;static#A=null;static#_=new Set;constructor({textContentSource:t,images:e,container:n,viewport:s}){if(t instanceof ReadableStream)this.#u=t;else if(typeof t=="object")this.#u=new ReadableStream({start(c){c.enqueue(t),c.close()}});else throw new Error('No "textContentSource" parameter specified.');this.#e=this.#d=n,this.#s=e,this.#p=s.scale*Je.pixelRatio,this.#h=s.rotation,this.#a={div:null,properties:null,ctx:null};let{pageWidth:a,pageHeight:r,pageX:o,pageY:l}=s.rawDims;this.#v=[1,0,0,-1,-o,l+r],this.#c=a,this.#o=r,i.#L(),n.style.setProperty("--min-font-size",i.#A),an(n,s),this.#t.promise.finally(()=>{i.#_.delete(this),this.#a=null,this.#m=null}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:t,isFirefox:e}=J.platform;return B(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){this.#s&&this.#e.append(this.#s.render());let t=()=>{this.#l.read().then(({value:e,done:n})=>{if(n){this.#t.resolve();return}this.#r??=e.lang,Object.assign(this.#m,e.styles),this.#E(e.items),t()},this.#t.reject)};return this.#l=this.#u.getReader(),i.#_.add(this),t(),this.#t.promise}update({viewport:t,onBefore:e=null}){let n=t.scale*Je.pixelRatio,s=t.rotation;if(s!==this.#h&&(e?.(),this.#h=s,an(this.#d,{rotation:s})),n!==this.#p){e?.(),this.#p=n;let a={div:null,properties:null,ctx:i.#O(this.#r)};for(let r of this.#f)a.properties=this.#b.get(r),a.div=r,this.#D(a)}}cancel(){let t=new Ge("TextLayer task cancelled.");this.#l?.cancel(t).catch(()=>{}),this.#l=null,this.#t.reject(t)}get textDivs(){return this.#f}get textContentItemsStr(){return this.#g}#E(t){if(this.#i)return;this.#a.ctx??=i.#O(this.#r);let e=this.#f,n=this.#g;for(let s of t){if(e.length>MS){I("Ignoring additional textDivs for performance reasons."),this.#i=!0;return}if(s.str===void 0){if(s.type==="beginMarkedContentProps"||s.type==="beginMarkedContent"){let a=this.#e;this.#e=document.createElement("span"),this.#e.classList.add("markedContent"),s.id&&this.#e.setAttribute("id",`${s.id}`),s.tag==="Artifact"&&(this.#e.ariaHidden=!0),a.append(this.#e)}else s.type==="endMarkedContent"&&(this.#e=this.#e.parentNode);continue}n.push(s.str),this.#C(s)}}#C(t){let e=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};this.#f.push(e);let s=M.transform(this.#v,t.transform),a=Math.atan2(s[1],s[0]),r=this.#m[t.fontName];r.vertical&&(a+=Math.PI/2);let o=this.#n&&r.fontSubstitution||r.fontFamily;o=i.fontFamilyMap.get(o)||o;let l=Math.hypot(s[2],s[3]),c=l*i.#k(o,r,this.#r),u,h;a===0?(u=s[4],h=s[5]-c):(u=s[4]+c*Math.sin(a),h=s[5]-c*Math.cos(a));let d=e.style;d.left=`${(100*u/this.#c).toFixed(2)}%`,d.top=`${(100*h/this.#o).toFixed(2)}%`,d.setProperty("--font-height",`${l.toFixed(2)}px`),d.fontFamily=o,n.fontSize=l,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,this.#n&&(e.dataset.fontName=r.fontSubstitutionLoadedName||t.fontName),a!==0&&(n.angle=a*(180/Math.PI));let f=!1;if(t.str.length>1)f=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){let m=Math.abs(t.transform[0]),y=Math.abs(t.transform[3]);m!==y&&Math.max(m,y)/Math.min(m,y)>1.5&&(f=!0)}if(f&&(n.canvasWidth=r.vertical?t.height:t.width),this.#b.set(e,n),this.#a.div=e,this.#a.properties=n,this.#D(this.#a),n.hasText&&this.#e.append(e),n.hasEOL){let m=document.createElement("br");m.setAttribute("role","presentation"),this.#e.append(m)}}#D(t){let{div:e,properties:n,ctx:s}=t,{style:a}=e;if(n.canvasWidth!==0&&n.hasText){let{fontFamily:r}=a,{canvasWidth:o,fontSize:l}=n;i.#M(s,l*this.#p,r);let{width:c}=s.measureText(e.textContent);c>0&&a.setProperty("--scale-x",o*this.#p/c)}n.angle!==0&&a.setProperty("--rotate",`${n.angle}deg`)}static cleanup(){if(!(this.#_.size>0)){this.#y.clear();for(let{canvas:t}of this.#T.values())t.remove();this.#T.clear()}}static#O(t=null){let e=this.#T.get(t||="");if(!e){let n=document.createElement("canvas");n.style.cssText="position:absolute;top:0;left:0;width:0;height:0;display:none;letter-spacing:normal;word-spacing:normal",n.lang=t,document.body.append(n),e=n.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#T.set(t,e),this.#w.set(e,{size:0,family:""})}return e}static#M(t,e,n){let s=this.#w.get(t);e===s.size&&n===s.family||(t.font=`${e}px ${n}`,s.size=e,s.family=n)}static#L(){if(this.#A!==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.#A=t.getBoundingClientRect().height,t.remove()}static#k(t,e,n){let s=this.#y.get(t);if(s)return s;let a=this.#O(n);a.canvas.width=a.canvas.height=hb,this.#M(a,hb,t);let r=a.measureText(""),o=r.fontBoundingBoxAscent,l=Math.abs(r.fontBoundingBoxDescent);a.canvas.width=a.canvas.height=0;let c=.8;return o?c=o/(o+l):(J.platform.isFirefox&&I("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),e.ascent?c=e.ascent:e.descent&&(c=1+e.descent)),this.#y.set(t,c),c}},DS=100;tf=class i{static#t=0;_capability=Promise.withResolvers();_setupCapability=Promise.withResolvers();_transport=null;_worker=null;docId=`d${i.#t++}`;destroyed=!1;onPassword=null;onProgress=null;get promise(){return this._capability.promise}async destroy(){this.destroyed=!0,this._capability.promise.catch(()=>{});try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._setupCapability.promise,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()}},vr=class{#t=Promise.withResolvers();#e=null;constructor(t,e,n=!1,s=null){this.length=t,this.initialData=e,this.progressiveDone=n,this.contentDispositionFilename=s}onDataRange(t,e){this.#e({type:"range",begin:t,chunk:e})}onDataProgressiveRead(t){this.#t.promise.then(()=>{this.#e({type:"progressiveRead",chunk:t})})}onDataProgressiveDone(){this.#t.promise.then(()=>{this.#e({type:"progressiveDone"})})}transportReady(t){this.#e=t,this.#t.resolve()}requestDataRange(t,e){Q("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}},ef=class{constructor(t,e){this._pdfInfo=t,this._transport=e}get pagesMapper(){return this._transport.pagesMapper}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return B(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()}getAttachmentContent(t){return this._transport.getAttachmentContent(t)}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()}extractPages(t){return this._transport.extractPages(t)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}getRawData(t){return this._transport.getRawData(t)}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}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()}},nf=class i{#t=!1;#e=null;constructor(t,e,n,s,a=!1){this._pageIndex=t,this._pageInfo=e,this._transport=n,this._stats=a?new Al:null,this._pdfBug=a,this.commonObjs=n.commonObjs,this.objs=new Ol,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,this.#e=s,this.imageCoordinates=null}clone(t){let e=new i(t,this._pageInfo,this._transport,this.#e,this._pdfBug);return e.clonedFromIndex=this.clonedFromIndex??this._pageIndex,this._transport.updatePage(e),e}get pageNumber(){return this._pageIndex+1}set pageNumber(t){this._pageIndex=t-1,this._transport.updatePage(this)}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:n=0,offsetY:s=0,dontFlip:a=!1}={}){return new ur({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:n,offsetY:s,dontFlip:a})}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 B(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:t,canvas:e=t.canvas,viewport:n,intent:s="display",annotationMode:a=Si.ENABLE,transform:r=null,background:o=null,optionalContentConfigPromise:l=null,annotationCanvasMap:c=null,pageColors:u=null,printAnnotationStorage:h=null,isEditing:d=!1,recordImages:f=!1,recordOperations:m=!1,operationsFilter:y=null}){this._stats?.time("Overall");let v=this._transport.getRenderingIntent(s,a,h,d),{renderingIntent:p,cacheKey:g}=v;this.#t=!1,l||=this._transport.getOptionalContentConfig(p);let b=this._intentStates.getOrInsertComputed(g,vl);b.streamReaderCancelTimeout&&(clearTimeout(b.streamReaderCancelTimeout),b.streamReaderCancelTimeout=null);let A=!!(p&Ae.PRINT);b.displayReadyCapability||(b.displayReadyCapability=Promise.withResolvers(),b.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(v));let S=!!(this._pdfBug&&globalThis.StepperManager?.enabled),E=!!e&&!this.recordedBBoxes&&(m||S),T=!!e&&!this.imageCoordinates&&f,w=z=>{if(b.renderTasks.delete(D),E){let X=D.gfx?.dependencyTracker.take();X&&(D.stepper?.setOperatorBBoxes(X,D.gfx.dependencyTracker.takeDebugMetadata()),m&&(this.recordedBBoxes=X))}T&&!z&&(this.imageCoordinates=D.gfx?.imagesTracker.take()),A&&(this.#t=!0),this.#i(),z?(D.capability.reject(z),this._abortOperatorList({intentState:b,reason:z instanceof Error?z:new Error(z)})):D.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},_=null,C=null;(E||T)&&(C=new gd(e,b.operatorList.length)),E&&(_=new md(C,S));let D=new rf({callback:w,params:{canvas:e,canvasContext:t,dependencyTracker:_??C,imagesTracker:T?new yd(e):null,viewport:n,transform:r,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:b.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!A,pdfBug:this._pdfBug,pageColors:u,enableHWA:this._transport.enableHWA,operationsFilter:y});(b.renderTasks||=new Set).add(D);let N=D.task;return Promise.all([b.displayReadyCapability.promise,l]).then(([z,X])=>{if(this.destroyed){w();return}if(this._stats?.time("Rendering"),!(X.renderingIntent&p))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");D.initializeGraphics({transparency:z,optionalContentConfig:X}),D.operatorListChanged()}).catch(w),N}getOperatorList({intent:t="display",annotationMode:e=Si.ENABLE,printAnnotationStorage:n=null,isEditing:s=!1}={}){function a(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}let r=this._transport.getRenderingIntent(t,e,n,s,!0),o=this._intentStates.getOrInsertComputed(r.cacheKey,vl),l;return o.opListReadCapability||(l=Object.create(null),l.operatorListChanged=a,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",{pageId:this.#e.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:e===!0},{highWaterMark:100,size(s){return s.items.length}})}async getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(s=>hr.textContent(s));let e=this.streamTextContent(t),n={items:[],styles:Object.create(null),lang:null};for await(let s of e)n.lang??=s.lang,Object.assign(n.styles,s.styles),n.items.push(...s.items);return 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 n of e.renderTasks)t.push(n.completed),n.cancel();return this.objs.clear(),this.#t=!1,Promise.all(t)}cleanup(t=!1){this.#t=!0;let e=this.#i();return t&&e&&(this._stats&&=new Al),e}#i(){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 n=this._intentStates.get(e);n&&(this._stats?.timeEnd("Page Request"),n.displayReadyCapability?.resolve(t))}_renderPageChunk(t,e){for(let n=0,s=t.length;n<s;n++)e.operatorList.fnArray.push(t.fnArray[n]),e.operatorList.argsArray.push(t.argsArray[n]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(let n of e.renderTasks)n.operatorListChanged();t.lastChunk&&this.#i()}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:n,modifiedIds:s}){let{map:a,transfer:r}=n,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageId:this.#e.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:a,modifiedIds:s},void 0,r).getReader(),c=this._intentStates.get(e);c.streamReader=l;let u=()=>{l.read().then(({value:h,done:d})=>{if(d){c.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(h,c),u())},h=>{if(c.streamReader=null,!this._transport.destroyed){if(c.operatorList){c.operatorList.lastChunk=!0;for(let d of c.renderTasks)d.operatorListChanged();this.#i()}if(c.displayReadyCapability)c.displayReadyCapability.reject(h);else if(c.opListReadCapability)c.opListReadCapability.reject(h);else throw h}})};u()}_abortOperatorList({intentState:t,reason:e,force:n=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!n){if(t.renderTasks.size>0)return;if(e instanceof Fs){let s=DS;e.extraDelay>0&&e.extraDelay<1e3&&(s+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},s);return}}if(t.streamReader.cancel(new Ge(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(let[s,a]of this._intentStates)if(a===t){this._intentStates.delete(s);break}this.cleanup()}}}get stats(){return this._stats}},Xs=class i{#t=Promise.withResolvers();#e=null;#i=null;#n=null;static#s=0;static#r=!1;static#a=new WeakMap;static{Se&&(this.#r=!0,sn.workerSrc||="./pdf.worker.mjs"),this._isSameOrigin=(t,e)=>{let n=URL.parse(t);if(!n?.origin||n.origin==="null")return!1;let s=new URL(e,n);return n.origin===s.origin},this._createCDNWrapper=t=>{let e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))}}constructor({name:t=null,port:e=null,verbosity:n=J1()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=n,e){if(i.#a.has(e))throw new Error("Cannot use more than one PDFWorker per port.");i.#a.set(e,this),this.#c(e)}else this.#l()}get promise(){return this.#t.promise}#o(){this.#t.resolve(),this.#e.send("configure",{verbosity:this.verbosity})}get port(){return this.#i}get messageHandler(){return this.#e}#c(t){this.#i=t,this.#e=new Rn("main","worker",t),this.#e.on("ready",()=>{}),this.#o()}#l(){if(i.#r||i.#h){this.#d();return}let{workerSrc:t}=i;try{i._isSameOrigin(window.location,t)||(t=i._createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),n=new Rn("main","worker",e),s=()=>{a.abort(),n.destroy(),e.terminate(),this.destroyed?this.#t.reject(new Error("Worker was destroyed")):this.#d()},a=new AbortController;e.addEventListener("error",()=>{this.#n||s()},{signal:a.signal}),n.on("test",o=>{if(a.abort(),this.destroyed||!o){s();return}this.#e=n,this.#i=e,this.#n=e,this.#o()}),n.on("ready",o=>{if(a.abort(),this.destroyed){s();return}try{r()}catch{this.#d()}});let r=()=>{let o=new Uint8Array;n.send("test",o,[o.buffer])};r();return}catch{Wl("The worker has been disabled.")}this.#d()}#d(){i.#r||(I("Setting up fake worker."),i.#r=!0),i._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this.#t.reject(new Error("Worker was destroyed"));return}let e=new Md;this.#i=e;let n=`fake${i.#s++}`,s=new Rn(n+"_worker",n,e);t.setup(s,e),this.#e=new Rn(n,n+"_worker",e),this.#o()}).catch(t=>{this.#t.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this.#n?.terminate(),this.#n=null,i.#a.delete(this.#i),this.#i=null,this.#e?.destroy(),this.#e=null}static create(t){let e=this.#a.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 i(t)}static get workerSrc(){if(sn.workerSrc)return sn.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#h(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return B(this,"_setupFakeWorkerGlobal",(async()=>this.#h?this.#h:(await import(this.workerSrc)).WorkerMessageHandler)())}},sf=class{downloadInfoCapability=Promise.withResolvers();#t=null;#e=new Map;#i=null;#n=new Map;#s=new Map;#r=new Map;#a=null;constructor(t,e,n,s,a,r){this.messageHandler=t,this.loadingTask=e,this.#i=n,this.commonObjs=new Ol,this.fontLoader=new bd({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.enableHWA=s.enableHWA,this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=a.canvasFactory,this.filterFactory=a.filterFactory,this.binaryDataFactory=a.binaryDataFactory,this.pagesMapper=r,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(t){let{_pageIndex:e}=t;this.#n.set(e,t),this.#s.set(e,Promise.resolve(t))}#o(t,e=null){return this.#e.getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,e))}#c({loaded:t,total:e}){this.loadingTask.onProgress?.({loaded:t,total:e,percent:e?ht(Math.round(t/e*100),0,100):NaN})}get annotationStorage(){return B(this,"annotationStorage",new mr)}getRenderingIntent(t,e=Si.ENABLE,n=null,s=!1,a=!1){let r=Ae.DISPLAY,o=gr;switch(t){case"any":r=Ae.ANY;break;case"display":break;case"print":r=Ae.PRINT;break;default:I(`getRenderingIntent - invalid intent: ${t}`)}let l=r&Ae.PRINT&&n instanceof wl?n:this.annotationStorage;switch(e){case Si.DISABLE:r+=Ae.ANNOTATIONS_DISABLE;break;case Si.ENABLE:break;case Si.ENABLE_FORMS:r+=Ae.ANNOTATIONS_FORMS;break;case Si.ENABLE_STORAGE:r+=Ae.ANNOTATIONS_STORAGE,o=l.serializable;break;default:I(`getRenderingIntent - invalid annotationMode: ${e}`)}s&&(r+=Ae.IS_EDITING),a&&(r+=Ae.OPLIST);let{ids:c,hash:u}=l.modifiedIds,h=[r,o.hash,u];return{renderingIntent:r,cacheKey:h.join("_"),annotationStorageSerializable:o,modifiedIds:c}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#a?.reject(new Error("Worker was destroyed during onPassword callback"));let t=[];for(let n of this.#n.values())t.push(n._destroy());this.#n.clear(),this.#s.clear(),this.#r.clear(),Object.hasOwn(this,"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.#e.clear(),this.filterFactory.destroy(),Vs.cleanup(),this.#i?.cancelAllRequests(new Ge("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",(n,s)=>{Et(this.#i,"GetReader - no `BasePDFStream` instance available."),this.#t=this.#i.getFullReader(),this.#t.onProgress=a=>this.#c(a),s.onPull=()=>{this.#t.read().then(function({value:a,done:r}){if(r){s.close();return}Et(a instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{s.error(a)})},s.onCancel=a=>{this.#t.cancel(a),s.ready.catch(r=>{if(!this.destroyed)throw r})}}),t.on("ReaderHeadersReady",async n=>{await this.#t.headersReady;let{isStreamingSupported:s,isRangeSupported:a,contentLength:r}=this.#t;return s&&a&&(this.#t.onProgress=null),{isStreamingSupported:s,isRangeSupported:a,contentLength:r}}),t.on("GetRangeReader",(n,s)=>{Et(this.#i,"GetRangeReader - no `BasePDFStream` instance available.");let a=this.#i.getRangeReader(n.begin,n.end);if(!a){s.close();return}s.onPull=()=>{a.read().then(function({value:r,done:o}){if(o){s.close();return}Et(r instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(r),1,[r])}).catch(r=>{s.error(r)})},s.onCancel=r=>{a.cancel(r),s.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("GetDoc",({pdfInfo:n})=>{this.pagesMapper.pagesNumber=n.numPages,this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,e._capability.resolve(new ef(n,this))}),t.on("DocException",n=>{e._capability.reject(re(n))}),t.on("PasswordRequest",n=>{this.#a=Promise.withResolvers();try{if(!e.onPassword)throw re(n);let s=a=>{a instanceof Error?this.#a.reject(a):this.#a.resolve({password:a})};e.onPassword(s,n.code)}catch(s){this.#a.reject(s)}return this.#a.promise}),t.on("DataLoaded",n=>{this.#c({loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),t.on("StartRenderPage",n=>{if(this.destroyed)return;this.#n.get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),t.on("commonobj",([n,s,a])=>{if(this.destroyed||this.commonObjs.has(n))return null;switch(s){case"Font":if("error"in a){let h=a.error;I(`Error during font loading: ${h}`),this.commonObjs.resolve(n,h);break}let r=new wd(a),o=this._params.pdfBug&&globalThis.FontInspector?.enabled?(h,d)=>globalThis.FontInspector.fontAdded(h,d):null,l=new vd(r,o,a.charProcOperatorList,a.extra);this.fontLoader.bind(l).catch(()=>t.sendWithPromise("FontFallback",{id:n})).finally(()=>{l.fontExtraProperties||l.clearData(),this.commonObjs.resolve(n,l)});break;case"CopyLocalImage":let{imageRef:c}=a;Et(c,"The imageRef must be defined.");for(let h of this.#n.values())for(let[,d]of h.objs){if(d?.ref!==c)continue;if(!d.dataLen)return null;let f=structuredClone(d);return this.commonObjs.resolve(n,f),d.dataLen}break;case"FontPath":this.commonObjs.resolve(n,new xd(a));break;case"Image":this.commonObjs.resolve(n,a);break;case"Pattern":let u=new _d(a);this.commonObjs.resolve(n,u.getIR());break;default:throw new Error(`Got unknown common object type ${s}`)}return null}),t.on("obj",([n,s,a,r])=>{if(this.destroyed)return;let o=this.#n.get(s);if(!o.objs.has(n)){if(o._intentStates.size===0){r?.bitmap?.close();return}switch(a){case"Image":case"Pattern":o.objs.resolve(n,r);break;default:throw new Error(`Got unknown object type ${a}`)}}}),t.on("DocProgress",n=>{this.destroyed||this.#c(n)}),t.on("FetchBinaryData",async n=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.binaryDataFactory)throw new Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");return this.binaryDataFactory.fetch(n)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&I("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.#t?.filename??null},e).finally(()=>{this.annotationStorage.resetModified()})}extractPages(t){let e={pageInfos:t},n,s=globalThis.ImageBitmap;if(typeof s=="function"){let a=Array.isArray(t)?t:[t];for(let r of a)r?.image instanceof s&&(n||=[]).push(r.image)}if(this.annotationStorage.size>0){let a=this.annotationStorage.serializable,{map:r}=a;a.transfer?.length&&(n?n.push(...a.transfer):n=a.transfer);let o=this.pagesMapper.getMapping();if(o){let l=new Map;for(let[c,u]of r){if(u?.pageIndex!==void 0&&u.pageIndex>=0&&u.pageIndex<o.length){let h=o[u.pageIndex]-1;if(h!==u.pageIndex){l.set(c,{...u,pageIndex:h});continue}}l.set(c,u)}r=l}e.annotationStorage=r}return this.messageHandler.sendWithPromise("ExtractPages",e,n).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this.pagesMapper.pagesNumber)return Promise.reject(new Error("Invalid page request."));let e=t-1,n=this.pagesMapper.getPageId(t)-1,s=this.#s.get(e);if(s)return s;let a=this.messageHandler.sendWithPromise("GetPage",{pageIndex:n}).then(r=>{if(this.destroyed)throw new Error("Transport destroyed");r.refStr&&this.#r.set(r.refStr,n);let o=new nf(e,r,this,this.pagesMapper,this._params.pdfBug);return this.#n.set(e,o),o});return this.#s.set(e,a),a}async getPageIndex(t){if(!Cd(t))throw new Error("Invalid pageIndex request.");let e=await this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}),n=this.pagesMapper.getPageNumber(e+1);if(n===0)throw new Error("GetPageIndex: page has been removed.");return n-1}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:this.pagesMapper.getPageId(t+1)-1,intent:e})}getFieldObjects(){return this.#o("GetFieldObjects")}hasJSActions(){return this.#o("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)}getAttachmentContent(t){return this.messageHandler.sendWithPromise("GetAttachmentContent",t)}getAnnotationsByType(t,e){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:t,pageIndexesToSkip:e})}getDocJSActions(){return this.#o("GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:this.pagesMapper.getPageId(t+1)-1})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:this.pagesMapper.getPageId(t+1)-1})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return this.#o("GetOptionalContentConfig").then(e=>new Zd(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata";return this.#e.getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,null).then(e=>({info:e[0],metadata:e[1]?new Qd(e[1]):null,contentDispositionFilename:this.#t?.filename??null,contentLength:this.#t?.contentLength??null,hasStructTree:e[2]})))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}getRawData(t){return this.messageHandler.sendWithPromise("GetRawData",t)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(let e of this.#n.values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0),Vs.cleanup()}}cachedPageNumber(t){if(!Cd(t))return null;let e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`,n=this.#r.get(e);if(n>=0){let s=this.pagesMapper.getPageNumber(n+1);if(s!==0)return s}return null}},af=class{_internalRenderTask=null;onContinue=null;onError=null;constructor(t){this._internalRenderTask=t}get promise(){return this._internalRenderTask.capability.promise}cancel(t=0){this._internalRenderTask.cancel(null,t)}get separateAnnots(){let{separateAnnots:t}=this._internalRenderTask.operatorList;if(!t)return!1;let{annotationCanvasMap:e}=this._internalRenderTask;return t.form||t.canvas&&e?.size>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}},rf=class i{#t=null;static#e=new WeakSet;constructor({callback:t,params:e,objs:n,commonObjs:s,annotationCanvasMap:a,operatorList:r,pageIndex:o,canvasFactory:l,filterFactory:c,useRequestAnimationFrame:u=!1,pdfBug:h=!1,pageColors:d=null,enableHWA:f=!1,operationsFilter:m=null}){this.callback=t,this.params=e,this.objs=n,this.commonObjs=s,this.annotationCanvasMap=a,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=c,this._pdfBug=h,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=u===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new af(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._imagesTracker=e.imagesTracker,this._operationsFilter=m}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){if(this.cancelled)return;if(this._canvas){if(i.#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.");i.#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:n,transform:s,background:a,dependencyTracker:r,imagesTracker:o}=this.params,l=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new zs(l,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors,r,o),this.gfx.beginDrawing({transform:s,viewport:n,transparency:t,background:a}),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),i.#e.delete(this._canvas),t||=new Fs(`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(),i.#e.delete(this._canvas),this.callback())))}},Lb="6.1.200",kb="6353acefe",Ar=class i{#t=null;#e=null;#i;#n=null;#s=!1;#r=!1;#a=null;#o;#c=null;#l=null;static#d=null;static get _keyboardManager(){return B(this,"_keyboardManager",new Ln([[["Escape"],i.prototype._hideDropdownFromKeyboard],[["Space"],i.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight"],i.prototype._moveToNext],[["ArrowUp","ArrowLeft"],i.prototype._moveToPrevious],[["Home"],i.prototype._moveToBeginning],[["End"],i.prototype._moveToEnd]]))}constructor({editor:t=null,uiManager:e=null}){t?(this.#r=!1,this.#a=t):this.#r=!0,this.#l=t?._uiManager||e,this.#o=this.#l._eventBus,this.#i=t?.color?.toUpperCase()||this.#l?.highlightColors.values().next().value||"#FFFF98",i.#d||=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.#a&&(t.ariaControls=`${this.#a.id}_colorpicker_dropdown`);let e=this.#l._signal;t.addEventListener("click",this.#g.bind(this),{signal:e}),t.addEventListener("keydown",this.#m.bind(this),{signal:e});let n=this.#e=document.createElement("span");return n.className="swatch",n.ariaHidden="true",n.style.backgroundColor=this.#i,t.append(n),t}renderMainDropdown(){let t=this.#n=this.#h();return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}#h(){let t=document.createElement("div"),e=this.#l._signal;t.addEventListener("contextmenu",Te,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),this.#a&&(t.id=`${this.#a.id}_colorpicker_dropdown`);for(let[n,s]of this.#l.highlightColors){let a=document.createElement("button");a.tabIndex="0",a.role="option",a.setAttribute("data-color",s),a.title=n,a.setAttribute("data-l10n-id",i.#d[n]);let r=document.createElement("span");a.append(r),r.className="swatch",r.style.backgroundColor=s,a.ariaSelected=s===this.#i,a.addEventListener("click",this.#p.bind(this,s),{signal:e}),t.append(a)}return t.addEventListener("keydown",this.#m.bind(this),{signal:e}),t}#p(t,e){e.stopPropagation(),this.#o.dispatch("switchannotationeditorparams",{source:this,type:H.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)}_colorSelectFromKeyboard(t){if(t.target===this.#t){this.#g(t);return}let e=t.target.getAttribute("data-color");e&&this.#p(e,t)}_moveToNext(t){if(!this.#f){this.#g(t);return}if(t.target===this.#t){this.#n.firstElementChild?.focus();return}t.target.nextSibling?.focus()}_moveToPrevious(t){if(t.target===this.#n?.firstElementChild||t.target===this.#t){this.#f&&this._hideDropdownFromKeyboard();return}this.#f||this.#g(t),t.target.previousSibling?.focus()}_moveToBeginning(t){if(!this.#f){this.#g(t);return}this.#n.firstElementChild?.focus()}_moveToEnd(t){if(!this.#f){this.#g(t);return}this.#n.lastElementChild?.focus()}#m(t){i._keyboardManager.exec(this,t)}#g(t){if(this.#f){this.hideDropdown();return}if(this.#s=t.detail===0,this.#c||(this.#c=new AbortController,window.addEventListener("pointerdown",this.#u.bind(this),{signal:this.#l.combinedSignal(this.#c)})),this.#t.ariaExpanded="true",this.#n){this.#n.classList.remove("hidden");return}let e=this.#n=this.#h();this.#t.append(e)}#u(t){this.#n?.contains(t.target)||this.hideDropdown()}hideDropdown(){this.#n?.classList.add("hidden"),this.#t.ariaExpanded="false",this.#c?.abort(),this.#c=null}get#f(){return this.#n&&!this.#n.classList.contains("hidden")}_hideDropdownFromKeyboard(){if(!this.#r){if(!this.#f){this.#a?.unselect();return}this.hideDropdown(),this.#t.focus({preventScroll:!0,focusVisible:this.#s})}}updateColor(t){if(this.#e&&(this.#e.style.backgroundColor=t),!this.#n)return;let e=this.#l.highlightColors.values();for(let n of this.#n.children)n.ariaSelected=e.next().value===t.toUpperCase()}destroy(){this.#t?.remove(),this.#t=null,this.#e=null,this.#n?.remove(),this.#n=null}},Rl=class i{#t=null;#e=!1;#i=null;#n=null;static#s=null;constructor(t){this.#i=t,this.#n=t._uiManager,i.#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,colorAndOpacityType:n,opacityType:s,color:a,opacity:r}=this.#i,o=this.#e=J.isAlphaColorInputSupported&&s!==void 0,l=this.#t=document.createElement("input");if(l.type="color",o){l.setAttribute("alpha","");let c=M.hexNums[Math.round((r??1)*255)];l.value=(a||"#000000")+c}else l.value=a||"#000000";return l.className="basicColorPicker",l.tabIndex=0,l.setAttribute("data-l10n-id",i.#s[t]),l.addEventListener("input",()=>{if(o){let c=qs(l.value);if(!c)return;let[u,h,d,f]=c,m=M.makeHexColor(u,h,d);n!==void 0?this.#n.updateParams(n,{color:m,opacity:f}):(this.#n.updateParams(e,m),this.#n.updateParams(s,f))}else this.#n.updateParams(e,l.value)},{signal:this.#n._signal}),l}update(t){if(this.#t)if(this.#e){let e=M.hexNums[Math.round(this.#i.opacity*255)];this.#t.value=t+e}else this.#t.value=t}updateOpacity(t){if(!this.#t||!this.#e)return;let e=M.hexNums[Math.round(t*255)];this.#t.value=this.#i.color+e}destroy(){this.#t?.remove(),this.#t=null}hideDropdown(){}};Nl=class{static CMYK_G([t,e,n,s]){return["G",1-Math.min(1,.3*t+.59*n+.11*e+s)]}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=ir(t),[t,t,t]}static G_HTML([t]){let e=db(t);return`#${e}${e}${e}`}static RGB_G([t,e,n]){return["G",.3*t+.59*e+.11*n]}static RGB_rgb(t){return t.map(ir)}static RGB_HTML(t){return`#${t.map(db).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,n,s]){return["RGB",1-Math.min(1,t+s),1-Math.min(1,n+s),1-Math.min(1,e+s)]}static CMYK_rgb([t,e,n,s]){return[ir(1-Math.min(1,t+s)),ir(1-Math.min(1,n+s)),ir(1-Math.min(1,e+s))]}static CMYK_HTML(t){let e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,n]){let s=1-t,a=1-e,r=1-n,o=Math.min(s,a,r);return["CMYK",s,a,r,o]}},of=class{create(t,e,n=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");let s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),n||(s.setAttribute("width",`${t}px`),s.setAttribute("height",`${e}px`)),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox",`0 0 ${t} ${e}`),s}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){Q("Abstract method `_createSVG` called.")}},kn=class extends of{_createSVG(t){return document.createElementNS(ve,t)}},OS=9,Bn=new WeakSet,RS=new Date().getTimezoneOffset()*60*1e3,lr=class{static create(t){switch(t.data.annotationType){case St.LINK:return new Sr(t);case St.TEXT:return new cf(t);case St.WIDGET:switch(t.data.fieldType){case"Tx":return new uf(t);case"Btn":return t.data.radioButton?new ff(t):t.data.checkBox?new df(t):new pf(t);case"Ch":return new gf(t);case"Sig":return new hf(t)}return new _i(t);case St.POPUP:return new Er(t);case St.FREETEXT:return new Ll(t);case St.LINE:return new yf(t);case St.SQUARE:return new bf(t);case St.CIRCLE:return new vf(t);case St.POLYLINE:return new kl(t);case St.CARET:return new Sf(t);case St.INK:return new Tr(t);case St.POLYGON:return new Af(t);case St.HIGHLIGHT:return new Bl(t);case St.UNDERLINE:return new Ef(t);case St.SQUIGGLY:return new Tf(t);case St.STRIKEOUT:return new wf(t);case St.STAMP:return new zl(t);case St.FILEATTACHMENT:return new _f(t);case St.RICHMEDIA:case St.SCREEN:return new Pl(t);default:return new vt(t)}}},vt=class i{#t=null;#e=!1;#i=null;constructor(t,{isRenderable:e=!1,ignoreBorder:n=!1,createQuadrilaterals:s=!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,this.hasOwnCommentButton=!1,e&&(this.contentElement=this.container=this._createContainer(n)),s&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:t,richText:e}){return!!(t?.str||e?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return i._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:n,rect:s}=this.data,a=-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],a=e[o+2]):e[o+1]===r&&(a=Math.max(a,e[o+2]));return[a,r]}if(n?.length>=1){for(let o of n)for(let l=0,c=o.length;l<c;l+=2)o[l+1]>r?(r=o[l+1],a=o[l]):o[l+1]===r&&(a=Math.max(a,o[l]));if(a!==1/0)return[a,r]}return s?[s[2],s[3]]:null}_normalizePoint(t){let{page:{view:e},viewport:{rawDims:{pageWidth:n,pageHeight:s,pageX:a,pageY:r}}}=this.parent;return t[1]=e[3]-t[1]+e[1],t[0]=100*(t[0]-a)/n,t[1]=100*(t[1]-r)/s,t}get commentText(){let{data:t}=this;return this.annotationStorage.getRawValue(`${cr}${t.id}`)?.popup?.contents||t.contentsObj?.str||""}set commentText(t){let{data:e}=this,n={deleted:!t,contents:t||""};this.annotationStorage.updateEditor(e.id,{popup:n})||this.annotationStorage.setValue(`${cr}${e.id}`,{id:e.id,annotationType:e.annotationType,page:this.parent.page,popup:n,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:n}=t;e&&this.#n(e);let s=this.#i?.popup||this.popup;!s&&n?.text&&(this._createPopup(n),s=this.#i.popup),s&&(s.updateEdited(t),n?.deleted&&(s.remove(),this.#i=null,this.popup=null))}resetEdited(){this.#t&&(this.#n(this.#t.rect),this.#i?.popup.resetEdited(),this.#t=null)}#n(t){let{container:{style:e},data:{rect:n,rotation:s},parent:{viewport:{rawDims:{pageWidth:a,pageHeight:r,pageX:o,pageY:l}}}}=this;n?.splice(0,4,...t),e.left=`${100*(t[0]-o)/a}%`,e.top=`${100*(r-t[3]+l)/r}%`,s===0?(e.width=`${100*(t[2]-t[0])/a}%`,e.height=`${100*(t[3]-t[1])/r}%`):this.setRotation(s)}_createContainer(t){let{data:e,parent:{page:n,viewport:s}}=this,a=document.createElement("section");a.setAttribute("data-annotation-id",e.id),!(this instanceof _i)&&!(this instanceof Sr)&&!(this instanceof Pl)&&(a.tabIndex=0);let{style:r}=a;if(r.zIndex=this.parent.zIndex,this.parent.zIndex+=2,e.alternativeText&&(a.title=e.alternativeText),e.noRotate&&a.classList.add("norotate"),!e.rect||this instanceof Er){let{rotation:y}=e;return!e.hasOwnCanvas&&y!==0&&this.setRotation(y,a),a}let{width:o,height:l}=this;if(!t&&e.borderStyle.width>0){r.borderWidth=`${e.borderStyle.width}px`;let y=e.borderStyle.horizontalCornerRadius,v=e.borderStyle.verticalCornerRadius;if(y>0||v>0){let g=`calc(${y}px * var(--total-scale-factor)) / calc(${v}px * var(--total-scale-factor))`;r.borderRadius=g}switch(e.borderStyle.style){case Ns.SOLID:r.borderStyle="solid";break;case Ns.DASHED:r.borderStyle="dashed";break;case Ns.BEVELED:I("Unimplemented border style: beveled");break;case Ns.INSET:I("Unimplemented border style: inset");break;case Ns.UNDERLINE:r.borderBottomStyle="solid";break;default:break}let p=e.borderColor||null;p?(this.#e=!0,r.borderColor=M.makeHexColor(...p)):r.borderWidth=0}let c=M.normalizeRect([e.rect[0],n.view[3]-e.rect[1]+n.view[1],e.rect[2],n.view[3]-e.rect[3]+n.view[1]]),{pageWidth:u,pageHeight:h,pageX:d,pageY:f}=s.rawDims;r.left=`${100*(c[0]-d)/u}%`,r.top=`${100*(c[1]-f)/h}%`;let{rotation:m}=e;return e.hasOwnCanvas||m===0?(r.width=`${100*o/u}%`,r.height=`${100*l/h}%`):this.setRotation(m,a),a}setRotation(t,e=this.container){if(!this.data.rect)return;let{pageWidth:n,pageHeight:s}=this.parent.viewport.rawDims,{width:a,height:r}=this;t%180!==0&&([a,r]=[r,a]),e.style.width=`${100*a/n}%`,e.style.height=`${100*r/s}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){let t=(e,n,s)=>{let a=s.detail[e],r=a[0],o=a.slice(1);s.target.style[n]=Nl[`${r}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[n]:Nl[`${r}_rgb`](o)})};return B(this,"_commonActions",{display:e=>{let{display:n}=e.detail,s=n%2===1;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:s,noPrint:n===1||n===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{let{hidden:n}=e.detail;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:n,noView:n})},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 n=e.detail.rotation;this.setRotation(n),this.annotationStorage.setValue(this.data.id,{rotation:n})}})}_dispatchEventFromSandbox(t,e){let n=this._commonActions;for(let s of Object.keys(e.detail))(t[s]||n[s])?.(e)}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;let e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;let n=this._commonActions;for(let[s,a]of Object.entries(e)){let r=n[s];if(r){let o={detail:{[s]:a},target:t};r(o),delete e[s]}}}_createQuadrilaterals(){if(!this.container)return;let{quadPoints:t}=this.data;if(!t)return;let[e,n,s,a]=this.data.rect.map(y=>Math.fround(y));if(t.length===8){let[y,v,p,g]=t.subarray(2,6);if(s===y&&a===v&&e===p&&n===g)return}let{style:r}=this.container,o;if(this.#e){let{borderColor:y,borderWidth:v}=r;r.borderWidth=0,o=["url('data:image/svg+xml;utf8,",`<svg xmlns="${ve}" preserveAspectRatio="none" viewBox="0 0 1 1">`,`<g fill="transparent" stroke="${y}" stroke-width="${v}">`],this.container.classList.add("hasBorder")}let l=s-e,c=a-n,{svgFactory:u}=this,h=u.createElement("svg");h.classList.add("quadrilateralsContainer"),h.setAttribute("width",0),h.setAttribute("height",0),h.role="none";let d=u.createElement("defs");h.append(d);let f=u.createElement("clipPath"),m=`clippath_${this.data.id}`;f.setAttribute("id",m),f.setAttribute("clipPathUnits","objectBoundingBox"),d.append(f);for(let y=2,v=t.length;y<v;y+=8){let p=t[y],g=t[y+1],b=t[y+2],A=t[y+3],S=u.createElement("rect"),E=(b-e)/l,T=(a-g)/c,w=(p-b)/l,_=(g-A)/c;S.setAttribute("x",E),S.setAttribute("y",T),S.setAttribute("width",w),S.setAttribute("height",_),f.append(S),o?.push(`<rect vector-effect="non-scaling-stroke" x="${E}" y="${T}" width="${w}" height="${_}"/>`)}this.#e&&(o.push("</g></svg>')"),r.backgroundImage=o.join("")),this.container.append(h),this.container.style.clipPath=`url(#${m})`}_createPopup(t=null){let{data:e}=this,n,s;t?(n={str:t.text},s=t.date):(n=e.contentsObj,s=e.modificationDate),this.#i=new Er({data:{color:e.color,titleObj:e.titleObj,modificationDate:s,contentsObj:n,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]})}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 n=[];if(this._fieldObjects){let s=this._fieldObjects[t];if(s)for(let{page:a,id:r,exportValues:o}of s){if(a===-1||r===e)continue;let l=typeof o=="string"?o:null,c=document.querySelector(`[data-element-id="${r}"]`);if(c&&!Bn.has(c)){I(`_getElementsByName - element not allowed: ${r}`);continue}n.push({id:r,exportValue:l,domElement:c})}return n}for(let s of document.getElementsByName(t)){let{exportValue:a}=s,r=s.getAttribute("data-element-id");r!==e&&Bn.has(s)&&n.push({id:r,exportValue:a,domElement:s})}return n}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})})}updateOC(t){if(!this.data.oc||!t)return;t.isVisible(this.data.oc)?this.show():this.hide()}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}_setBackgroundColor(t){let e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":M.makeHexColor(...e)}},lf=class extends vt{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)}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.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}},Sr=class extends vt{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,n=document.createElement("a");n.setAttribute("data-element-id",t.id);let s=!1;return t.url?(e.addLinkAttributes(n,t.url,t.newWindow),s=!0):t.action?(this._bindNamedAction(n,t.action,t.overlaidText),s=!0):t.attachment?(this.#e(n,t.attachmentId,t.attachment,t.overlaidText,t.attachmentDest),s=!0):t.setOCGState?(this.#i(n,t.setOCGState,t.overlaidText),s=!0):t.dest?(this._bindLink(n,t.dest,t.overlaidText),s=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,t),s=!0),t.resetForm?(this._bindResetFormAction(n,t.resetForm),s=!0):this.isTooltipOnly&&!s&&(this._bindLink(n,""),s=!0)),this.container.classList.add("linkAnnotation"),s&&(this.contentElement=n,this.container.append(n)),this.container}#t(){this.container.setAttribute("data-internal-link","")}_bindLink(t,e,n=""){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||e==="")&&this.#t(),n&&(t.title=n)}_bindNamedAction(t,e,n=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),n&&(t.title=n),this.#t()}#e(t,e,n,s="",a=null){t.href=this.linkService.getAnchorUrl(""),n.description?t.title=n.description:s&&(t.title=s);let r=async()=>{let o=await this.linkService.getAttachmentContent(e);o&&this.downloadManager?.openOrDownloadData(o,n.filename,a)};t.onclick=()=>(r(),!1),this.#t()}#i(t,e,n=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),n&&(t.title=n),this.#t()}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");let n=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let s of Object.keys(e.actions)){let a=n.get(s);a&&(t[a]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:s}}),!1))}e.overlaidText&&(t.title=e.overlaidText),t.onclick||(t.onclick=()=>!1),this.#t()}_bindResetFormAction(t,e){let n=t.onclick;if(n||(t.href=this.linkService.getAnchorUrl("")),this.#t(),!this._fieldObjects){I('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(t.onclick=()=>!1);return}t.onclick=()=>{n?.();let{fields:s,refs:a,include:r}=e,o=[];if(s.length!==0||a.length!==0){let u=new Set(a);for(let h of s){let d=this._fieldObjects[h]||[];for(let{id:f}of d)u.add(f)}for(let h of Object.values(this._fieldObjects))for(let d of h)u.has(d.id)===r&&o.push(d)}else for(let u of Object.values(this._fieldObjects))o.push(...u);let l=this.annotationStorage,c=[];for(let u of o){let{id:h}=u;switch(c.push(h),u.type){case"text":{let f=u.defaultValue||"";l.setValue(h,{value:f});break}case"checkbox":case"radiobutton":{let f=u.defaultValue===u.exportValues;l.setValue(h,{value:f});break}case"combobox":case"listbox":{let f=u.defaultValue||"";l.setValue(h,{value:f});break}default:continue}let d=document.querySelector(`[data-element-id="${h}"]`);if(d){if(!Bn.has(d)){I(`_bindResetFormAction - element not allowed: ${h}`);continue}}else continue;d.dispatchEvent(new Event("resetform"))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:c,name:"ResetForm"}}),!1}}},cf=class extends vt{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.hasOwnCommentButton=!0,this._createPopup()),this.container.append(t),this.container}},_i=class extends vt{render(){return this.container}_getKeyModifier(t){return J.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,n,s,a){n.includes("mouse")?t.addEventListener(n,r=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:a(r),shift:r.shiftKey,modifier:this._getKeyModifier(r)}})}):t.addEventListener(n,r=>{if(n==="blur"){if(!e.focused||!r.relatedTarget)return;e.focused=!1}else if(n==="focus"){if(e.focused)return;e.focused=!0}a&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:a(r)}})})}_setEventListeners(t,e,n,s){for(let[a,r]of n)(r==="Action"||this.data.actions?.[r])&&((r==="Focus"||r==="Blur")&&(e||={focused:!1}),this._setEventListener(t,e,a,r,s),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))}_setTextStyle(t){let e=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||OS,a=t.style,r,o=2,l=c=>Math.round(10*c)/10;if(this.data.multiLine){let c=Math.abs(this.data.rect[3]-this.data.rect[1]-o),u=Math.round(c/(yl*s))||1,h=c/u;r=Math.min(s,l(h/yl))}else{let c=Math.abs(this.data.rect[3]-this.data.rect[1]-o);r=Math.min(s,l(c/yl))}a.fontSize=`calc(${r}px * var(--total-scale-factor))`,a.color=M.makeHexColor(...n),this.data.textAlignment!==null&&!this.data.comb&&(a.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}},uf=class extends _i{constructor(t){let e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,n,s){let a=this.annotationStorage;for(let r of this._getElementsByName(t.name,t.id))r.domElement&&(r.domElement[e]=n),a.setValue(r.id,{[s]:n})}render(){let t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){let s=t.getValue(e,{value:this.data.fieldValue}),a=s.value||"",r=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;r&&a.length>r&&(a=a.slice(0,r));let o=s.formattedValue||this.data.textContent?.join(`
54
- `)||null;o&&this.data.comb&&(o=o.replaceAll(/\s+/g,""));let l={userValue:a,formattedValue:o,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=o??a,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type=this.data.password?"password":"text",n.setAttribute("value",o??a),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(this.container.classList.add("hasOwnCanvas"),t.has(e)&&this.container.classList.add("sandboxModified")),Bn.add(n),this.contentElement=n,n.setAttribute("data-element-id",e),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=0;let{datetimeFormat:c,datetimeType:u,timeStep:h}=this.data,d=!!u&&this.enableScripting;c&&(n.title=c),this._setRequired(n,this.data.required),r&&(n.maxLength=r),n.addEventListener("input",m=>{t.setValue(e,{value:m.target.value}),this.setPropertyOnSiblings(n,"value",m.target.value,"value"),l.formattedValue=null}),n.addEventListener("resetform",m=>{let y=this.data.defaultFieldValue??"";n.value=l.userValue=y,l.formattedValue=null});let f=m=>{let{formattedValue:y}=l;y!=null&&(m.target.value=y),m.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",y=>{if(l.focused)return;let{target:v}=y;if(d&&(v.type=u,h&&(v.step=h)),l.userValue){let p=l.userValue;if(d)if(u==="time"){let g=new Date(p),b=[g.getHours(),g.getMinutes(),g.getSeconds()];v.value=b.map(A=>A.toString().padStart(2,"0")).join(":")}else v.value=new Date(p-RS).toISOString().split(u==="date"?"T":".",1)[0];else v.value=p}l.lastCommittedValue=v.value,l.commitKey=1,this.data.actions?.Focus||(l.focused=!0)}),n.addEventListener("updatefromsandbox",y=>{this.container.classList.add("sandboxModified");let v={value(p){l.userValue=p.detail.value??"",d||t.setValue(e,{value:l.userValue.toString()}),p.target.value=l.userValue},formattedValue(p){let{formattedValue:g}=p.detail;l.formattedValue=g,g!=null&&p.target!==document.activeElement&&(p.target.value=g);let b={formattedValue:g};d&&(b.value=g),t.setValue(e,b)},selRange(p){p.target.setSelectionRange(...p.detail.selRange)},charLimit:p=>{let{charLimit:g}=p.detail,{target:b}=p;if(g===0){b.removeAttribute("maxLength");return}b.setAttribute("maxLength",g);let A=l.userValue;!A||A.length<=g||(A=A.slice(0,g),b.value=l.userValue=A,t.setValue(e,{value:A}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:A,willCommit:!0,commitKey:1,selStart:b.selectionStart,selEnd:b.selectionEnd}}))}};this._dispatchEventFromSandbox(v,y)}),n.addEventListener("keydown",y=>{l.commitKey=1;let v=-1;if(y.key==="Escape"?v=0:y.key==="Enter"&&!this.data.multiLine?v=2:y.key==="Tab"&&(l.commitKey=3),v===-1)return;let{value:p}=y.target;l.lastCommittedValue!==p&&(l.lastCommittedValue=p,l.userValue=p,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:p,willCommit:!0,commitKey:v,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}))});let m=f;f=null,n.addEventListener("blur",y=>{if(!l.focused||!y.relatedTarget)return;this.data.actions?.Blur||(l.focused=!1);let{target:v}=y,{value:p}=v;if(d){if(p&&u==="time"){let g=p.split(":").map(b=>parseInt(b,10));p=new Date(2e3,0,1,g[0],g[1],g[2]||0).valueOf(),v.step=""}else p.includes("T")||(p=`${p}T00:00`),p=new Date(p).valueOf();v.type="text"}l.userValue=p,l.lastCommittedValue!==p&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:p,willCommit:!0,commitKey:l.commitKey,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}),m(y)}),this.data.actions?.Keystroke&&n.addEventListener("beforeinput",y=>{l.lastCommittedValue=null;let{data:v,target:p}=y,{value:g,selectionStart:b,selectionEnd:A}=p,S=b,E=A;switch(y.inputType){case"deleteWordBackward":{let T=g.substring(0,b).match(/\w*\W*$/);T&&(S-=T[0].length);break}case"deleteWordForward":{let T=g.substring(b).match(/^\W*\w*/);T&&(E+=T[0].length);break}case"deleteContentBackward":b===A&&(S-=1);break;case"deleteContentForward":b===A&&(E+=1);break}y.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:g,change:v||"",willCommit:!1,selStart:S,selEnd:E}})}),this._setEventListeners(n,l,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],y=>y.target.value)}if(f&&n.addEventListener("blur",f),this.data.comb){let y=(this.data.rect[2]-this.data.rect[0])/r;n.classList.add("comb"),n.style.setProperty("--comb-width",`calc(${y}px * var(--total-scale-factor))`);let v=this.data.textAlignment;if(v===1||v===2){let p=()=>{let g=r-n.value.length;n.style.setProperty("--comb-offset",`${v===1?g>>1:g}`)};p();for(let g of["input","blur","resetform","updatefromsandbox"])n.addEventListener(g,p)}}}else n=document.createElement("div"),n.textContent=this.data.fieldValue,n.style.verticalAlign="middle",n.style.display="table-cell",this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}},hf=class extends _i{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}},df=class extends _i{constructor(t){super(t,{isRenderable:t.renderForms})}render(){let t=this.annotationStorage,e=this.data,n=e.id,s=t.getValue(n,{value:e.exportValue===e.fieldValue}).value;typeof s=="string"&&(s=s!=="Off",t.setValue(n,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let a=document.createElement("input");return Bn.add(a),a.setAttribute("data-element-id",n),a.disabled=e.readOnly,this._setRequired(a,this.data.required),a.type="checkbox",a.name=e.fieldName,s&&a.setAttribute("checked",!0),a.setAttribute("exportValue",e.exportValue),a.tabIndex=0,a.addEventListener("change",r=>{let{name:o,checked:l}=r.target;for(let c of this._getElementsByName(o,n)){let u=l&&c.exportValue===e.exportValue;c.domElement&&(c.domElement.checked=u),t.setValue(c.id,{value:u})}t.setValue(n,{value:l})}),a.addEventListener("resetform",r=>{let o=e.defaultFieldValue||"Off";r.target.checked=o===e.exportValue}),this.enableScripting&&this.hasJSActions&&(a.addEventListener("updatefromsandbox",r=>{let o={value(l){l.target.checked=l.detail.value!=="Off",t.setValue(n,{value:l.target.checked})}};this._dispatchEventFromSandbox(o,r)}),this._setEventListeners(a,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._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}},ff=class extends _i{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let t=this.annotationStorage,e=this.data,n=e.id,s=t.getValue(n,{value:e.buttonValue!==null&&e.fieldValue===e.buttonValue}).value;if(typeof s=="string"&&(s=s!==e.buttonValue,t.setValue(n,{value:s})),s)for(let r of this._getElementsByName(e.fieldName,n))t.setValue(r.id,{value:!1});let a=document.createElement("input");if(Bn.add(a),a.setAttribute("data-element-id",n),a.disabled=e.readOnly,this._setRequired(a,this.data.required),a.type="radio",a.name=e.fieldName,s&&a.setAttribute("checked",!0),a.tabIndex=0,a.addEventListener("change",r=>{let{name:o,checked:l}=r.target;for(let c of this._getElementsByName(o,n))t.setValue(c.id,{value:!1});t.setValue(n,{value:l})}),a.addEventListener("resetform",r=>{let o=e.defaultFieldValue;r.target.checked=o!=null&&o===e.buttonValue}),this.enableScripting&&this.hasJSActions){let r=e.buttonValue;a.addEventListener("updatefromsandbox",o=>{let l={value:c=>{let u=r===c.detail.value;for(let h of this._getElementsByName(c.target.name)){let d=u&&h.id===n;h.domElement&&(h.domElement.checked=d),t.setValue(h.id,{value:d})}}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)}return this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}},pf=class extends Sr{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",n=>{this._dispatchEventFromSandbox({},n)})),t}},gf=class extends _i{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let t=this.annotationStorage,e=this.data.id,n=t.getValue(e,{value:this.data.fieldValue}),s=document.createElement("select");Bn.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=0;let a=this.data.combo&&this.data.options.length>0;this.data.combo||(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",h=>{let d=this.data.defaultFieldValue;for(let f of s.options)f.selected=f.value===d});let r=(h,d)=>{let f=d.replaceAll(" ","\xA0");h.textContent=f,f!==d&&h.setAttribute("display-value",d)};for(let h of this.data.options){let d=document.createElement("option");r(d,h.displayValue),d.value=h.exportValue,n.value.includes(h.exportValue)&&(d.setAttribute("selected",!0),a=!1),s.append(d)}let o=null;if(a){let h=document.createElement("option");h.value=" ",h.setAttribute("hidden",!0),h.setAttribute("selected",!0),s.prepend(h),o=()=>{h.remove(),s.removeEventListener("input",o),o=null},s.addEventListener("input",o)}let l=h=>{let d=h?"value":"textContent",{options:f,multiple:m}=s;return m?Array.prototype.filter.call(f,y=>y.selected).map(y=>y[d]):f.selectedIndex===-1?null:f[f.selectedIndex][d]},c=l(!1),u=h=>{let d=h.target.options;return Array.prototype.map.call(d,f=>({displayValue:f.getAttribute("display-value")||f.textContent,exportValue:f.value}))};return this.enableScripting&&this.hasJSActions?(s.addEventListener("updatefromsandbox",h=>{let d={value(f){o?.();let m=f.detail.value,y=new Set(Array.isArray(m)?m:[m]);for(let v of s.options)v.selected=y.has(v.value);t.setValue(e,{value:l(!0)}),c=l(!1)},multipleSelection(f){s.multiple=!0},remove(f){let m=s.options,y=f.detail.remove;m[y].selected=!1,s.remove(y),m.length>0&&Array.prototype.findIndex.call(m,p=>p.selected)===-1&&(m[0].selected=!0),t.setValue(e,{value:l(!0),items:u(f)}),c=l(!1)},clear(f){for(;s.length!==0;)s.remove(0);t.setValue(e,{value:null,items:[]}),c=l(!1)},insert(f){let{index:m,displayValue:y,exportValue:v}=f.detail.insert,p=s.children[m],g=document.createElement("option");r(g,y),g.value=v,p?p.before(g):s.append(g),t.setValue(e,{value:l(!0),items:u(f)}),c=l(!1)},items(f){let{items:m}=f.detail;for(;s.length!==0;)s.remove(0);for(let y of m){let{displayValue:v,exportValue:p}=y,g=document.createElement("option");r(g,v),g.value=p,s.append(g)}s.options.length>0&&(s.options[0].selected=!0),t.setValue(e,{value:l(!0),items:u(f)}),c=l(!1)},indices(f){let m=new Set(f.detail.indices);for(let y of f.target.options)y.selected=m.has(y.index);t.setValue(e,{value:l(!0)}),c=l(!1)},editable(f){f.target.disabled=!f.detail.editable}};this._dispatchEventFromSandbox(d,h)}),s.addEventListener("input",h=>{let d=l(!0),f=l(!1);t.setValue(e,{value:d}),h.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:c,change:f,changeEx:d,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(s,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],h=>h.target.value)):s.addEventListener("input",function(h){t.setValue(e,{value:l(!0)})}),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}},Er=class extends vt{constructor(t){let{data:e,elements:n,parent:s}=t,a=!!s._commentManager;if(super(t,{isRenderable:!a&&vt._hasPopupData(e)}),this.elements=n,a&&vt._hasPopupData(e)){let r=this.popup=this.#t();for(let o of n)o.popup=r}else this.popup=null}#t(){return new mf({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(),n=[];for(let s of this.elements)s.popup=e,s.container.ariaHasPopup="dialog",n.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",n.map(s=>`${ks}${s}`).join(",")),this.container}},mf=class{#t=null;#e=this.#F.bind(this);#i=this.#z.bind(this);#n=this.#S.bind(this);#s=this.#x.bind(this);#r=null;#a=null;#o=null;#c=null;#l=null;#d=null;#h=null;#p=!1;#m=null;#g=null;#u=null;#f=null;#b=null;#v=null;#y=null;#T=null;#w=null;#A=null;#_=!1;#E=null;#C=null;constructor({container:t,color:e,elements:n,titleObj:s,modificationDate:a,contentsObj:r,richText:o,parent:l,rect:c,parentRect:u,open:h,commentManager:d=null}){this.#a=t,this.#w=s,this.#o=r,this.#T=o,this.#d=l,this.#r=e,this.#y=c,this.#h=u,this.#l=n,this.#t=d,this.#E=n[0],this.#c=Hs.toDateObject(a),this.trigger=n.flatMap(f=>f.getElementsToTriggerPopup()),d||(this.#D(),this.#a.hidden=!0,h&&this.#x())}#D(){if(this.#g)return;this.#g=new AbortController;let{signal:t}=this.#g;for(let e of this.trigger)e.addEventListener("click",this.#s,{signal:t}),e.addEventListener("pointerenter",this.#n,{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})}#O(){let t=this.#l.find(e=>e.hasCommentButton);t&&(this.#b=t._normalizePoint(t.commentButtonPosition))}renderCommentButton(){if(this.#f){this.#f.parentNode||this.#E.container.after(this.#f);return}if(this.#b||this.#O(),!this.#b)return;let{signal:t}=this.#g=new AbortController,e=this.#E.hasOwnCommentButton,n=()=>{this.#t.toggleCommentPopup(this,!0,void 0,!e)},s=()=>{this.#t.toggleCommentPopup(this,!1,!0,!e)},a=()=>{this.#t.toggleCommentPopup(this,!1,!1)};if(e){this.#f=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",n,{signal:t}),r.addEventListener("pointerenter",s,{signal:t}),r.addEventListener("pointerleave",a,{signal:t}),r.classList.add("popupTriggerArea")}else{let r=this.#f=document.createElement("button");r.className="annotationCommentButton";let o=this.#E.container;r.style.zIndex=parseInt(o.style.zIndex,10)+1,r.tabIndex=0,r.ariaHasPopup="dialog",r.ariaControls="commentPopup",r.setAttribute("data-l10n-id","pdfjs-show-comment-button"),this.#L(),this.#M(),r.addEventListener("keydown",this.#e,{signal:t}),r.addEventListener("click",n,{signal:t}),r.addEventListener("pointerenter",s,{signal:t}),r.addEventListener("pointerleave",a,{signal:t}),o.after(r)}}#M(){if(this.#E.extraPopupElement&&!this.#E.editor)return;this.#f||this.renderCommentButton();let[t,e]=this.#b,{style:n}=this.#f;n.left=`calc(${t}%)`,n.top=`calc(${e}% - var(--comment-button-dim))`}#L(){this.#E.extraPopupElement||(this.#f||this.renderCommentButton(),this.#f.style.backgroundColor=this.commentButtonColor||"")}get commentButtonColor(){let{color:t,opacity:e}=this.#E.commentData;return t?this.#d._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{this.#f?.focus()},0)}getData(){let{richText:t,color:e,opacity:n,creationDate:s,modificationDate:a}=this.#E.commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:n,creationDate:s,modificationDate:a}}get elementBeforePopup(){return this.#f}get comment(){return this.#C||=this.#E.commentText,this.#C}set comment(t){t!==this.comment&&(this.#E.commentText=this.#C=t)}focus(){this.#E.container?.focus()}get parentBoundingClientRect(){return this.#E.layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){this.#f&&(this.#f.classList.toggle("selected",t),this.#f.ariaExpanded=e)}setSelectedCommentButton(t){this.#f.classList.toggle("selected",t)}get commentPopupPosition(){if(this.#v)return this.#v;let{x:t,y:e,height:n}=this.#f.getBoundingClientRect(),{x:s,y:a,width:r,height:o}=this.#E.layer.getBoundingClientRect();return[(t-s)/r,(e+n-a)/o]}set commentPopupPosition(t){this.#v=t}hasDefaultPopupPosition(){return this.#v===null}get commentButtonPosition(){return this.#b}get commentButtonWidth(){return this.#f.getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){let[e,n]=this.#v||this.commentButtonPosition.map(c=>c/100),s=this.parentBoundingClientRect,{x:a,y:r,width:o,height:l}=s;this.#t.showDialog(null,this,a+e*o,r+n*l,{...t,parentDimensions:s})}render(){if(this.#m)return;let t=this.#m=document.createElement("div");if(t.className="popup",this.#r){let n=t.style.outlineColor=M.makeHexColor(...this.#r);t.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`}let e=document.createElement("span");if(e.className="header",this.#w?.str){let n=document.createElement("span");n.className="title",e.append(n),{dir:n.dir,str:n.textContent}=this.#w}if(t.append(e),this.#c){let n=document.createElement("time");n.className="popupDate",n.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),n.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#c.valueOf()})),n.dateTime=this.#c.toISOString(),e.append(n)}If({html:this.#k||this.#o.str,dir:this.#o?.dir,className:"popupContent"},t),this.#a.append(t)}get#k(){let t=this.#T,e=this.#o;return t?.str&&(!e?.str||e.str===t.str)&&this.#T.html||null}get#N(){return this.#k?.attributes?.style?.fontSize||0}get#B(){return this.#k?.attributes?.style?.color||null}#P(t){let e=[],n={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},s={style:{color:this.#B,fontSize:this.#N?`calc(${this.#N}px * var(--total-scale-factor))`:""}};for(let a of t.split(`
55
- `))e.push({name:"span",value:a,attributes:s});return n}#F(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&this.#p)&&this.#x()}updateEdited({rect:t,popup:e,deleted:n}){if(this.#t){n?(this.remove(),this.#C=null):e&&(e.deleted?this.remove():(this.#L(),this.#C=e.text)),t&&(this.#b=null,this.#O(),this.#M());return}if(n||e?.deleted){this.remove();return}this.#D(),this.#A||={contentsObj:this.#o,richText:this.#T},t&&(this.#u=null),e&&e.text&&(this.#T=this.#P(e.text),this.#c=Hs.toDateObject(e.date),this.#o=null),this.#m?.remove(),this.#m=null}resetEdited(){this.#A&&({contentsObj:this.#o,richText:this.#T}=this.#A,this.#A=null,this.#m?.remove(),this.#m=null,this.#u=null)}remove(){if(this.#g?.abort(),this.#g=null,this.#m?.remove(),this.#m=null,this.#_=!1,this.#p=!1,this.#f?.remove(),this.#f=null,this.trigger)for(let t of this.trigger)t.classList.remove("popupTriggerArea")}#X(){if(this.#u!==null)return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:n,pageX:s,pageY:a}}}=this.#d,r=!!this.#h,o=r?this.#h:this.#y;for(let m of this.#l)if(!o||M.intersect(m.data.rect,o)!==null){o=m.data.rect,r=!0;break}let l=M.normalizeRect([o[0],t[3]-o[1]+t[1],o[2],t[3]-o[3]+t[1]]),u=r?o[2]-o[0]+5:0,h=l[0]+u,d=l[1];this.#u=[100*(h-s)/e,100*(d-a)/n];let{style:f}=this.#a;f.left=`${this.#u[0]}%`,f.top=`${this.#u[1]}%`}#x(){if(this.#t){this.#t.toggleCommentPopup(this,!1);return}this.#p=!this.#p,this.#p?(this.#S(),this.#a.addEventListener("click",this.#s),this.#a.addEventListener("keydown",this.#e)):(this.#z(),this.#a.removeEventListener("click",this.#s),this.#a.removeEventListener("keydown",this.#e))}#S(){this.#m||this.render(),this.isVisible?this.#p&&this.#a.classList.add("focused"):(this.#X(),this.#a.hidden=!1,this.#a.style.zIndex=parseInt(this.#a.style.zIndex,10)+1e3)}#z(){this.#a.classList.remove("focused"),!(this.#p||!this.isVisible)&&(this.#a.hidden=!0,this.#a.style.zIndex=parseInt(this.#a.style.zIndex,10)-1e3)}forceHide(){this.#_=this.isVisible,this.#_&&(this.#a.hidden=!0)}maybeShow(){this.#t||(this.#D(),this.#_&&(this.#m||this.#S(),this.#_=!1,this.#a.hidden=!1))}get isVisible(){return this.#t?!1:this.#a.hidden===!1}},Ll=class extends vt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=P.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let t=this.contentElement=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(let e of this.textContent){let n=document.createElement("span");n.textContent=e,t.append(n)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},yf=class extends vt{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");let{data:t,width:e,height:n}=this,s=this.svgFactory.create(e,n,!0),a=this.#t=this.svgFactory.createElement("svg:line");return a.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),a.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),a.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),a.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),a.setAttribute("stroke-width",t.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),s.append(a),this.container.append(s),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}},bf=class extends vt{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");let{data:t,width:e,height:n}=this,s=this.svgFactory.create(e,n,!0),a=t.borderStyle.width,r=this.#t=this.svgFactory.createElement("svg:rect");return r.setAttribute("x",a/2),r.setAttribute("y",a/2),r.setAttribute("width",e-a),r.setAttribute("height",n-a),r.setAttribute("stroke-width",a||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),s.append(r),this.container.append(s),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}},vf=class extends vt{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");let{data:t,width:e,height:n}=this,s=this.svgFactory.create(e,n,!0),a=t.borderStyle.width,r=this.#t=this.svgFactory.createElement("svg:ellipse");return r.setAttribute("cx",e/2),r.setAttribute("cy",n/2),r.setAttribute("rx",e/2-a/2),r.setAttribute("ry",n/2-a/2),r.setAttribute("stroke-width",a||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),s.append(r),this.container.append(s),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}},kl=class extends vt{#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:n,popupRef:s},width:a,height:r}=this;if(!e)return this.container;let o=this.svgFactory.create(a,r,!0),l=[];for(let u=0,h=e.length;u<h;u+=2){let d=e[u]-t[0],f=t[3]-e[u+1];l.push(`${d},${f}`)}l=l.join(" ");let c=this.#t=this.svgFactory.createElement(this.svgElementName);return c.setAttribute("points",l),c.setAttribute("stroke-width",n.width||1),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),o.append(c),this.container.append(o),!s&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}},Af=class extends kl{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}},Sf=class extends vt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}},Tr=class extends vt{#t=null;#e=[];constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?P.HIGHLIGHT:P.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:n,borderStyle:s,popupRef:a}}=this,{transform:r,width:o,height:l}=this.#i(e,t),c=this.svgFactory.create(o,l,!0),u=this.#t=this.svgFactory.createElement("svg:g");c.append(u),u.setAttribute("stroke-width",s.width||1),u.setAttribute("stroke-linecap","round"),u.setAttribute("stroke-linejoin","round"),u.setAttribute("stroke-miterlimit",10),u.setAttribute("stroke","transparent"),u.setAttribute("fill","transparent"),u.setAttribute("transform",r);for(let h=0,d=n.length;h<d;h++){let f=this.svgFactory.createElement(this.svgElementName);this.#e.push(f),f.setAttribute("points",n[h].join(",")),u.append(f)}return!a&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(c),this._editOnDoubleClick(),this.container}updateEdited(t){super.updateEdited(t);let{thickness:e,points:n,rect:s}=t,a=this.#t;if(e>=0&&a.setAttribute("stroke-width",e||1),n)for(let r=0,o=this.#e.length;r<o;r++)this.#e[r].setAttribute("points",n[r].join(","));if(s){let{transform:r,width:o,height:l}=this.#i(this.data.rotation,s);a.parentElement.setAttribute("viewBox",`0 0 ${o} ${l}`),a.setAttribute("transform",r)}}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}},Bl=class extends vt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=P.HIGHLIGHT}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){let n=document.createElement("mark");n.classList.add("overlaidText"),n.textContent=t,this.container.append(n)}return this.container}},Ef=class extends vt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("underlineAnnotation"),t){let n=document.createElement("u");n.classList.add("overlaidText"),n.textContent=t,this.container.append(n)}return this.container}},Tf=class extends vt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("squigglyAnnotation"),t){let n=document.createElement("u");n.classList.add("overlaidText"),n.textContent=t,this.container.append(n)}return this.container}},wf=class extends vt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("strikeoutAnnotation"),t){let n=document.createElement("s");n.classList.add("overlaidText"),n.textContent=t,this.container.append(n)}return this.container}},zl=class extends vt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=P.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},_f=class extends vt{#t=null;constructor(t){super(t,{isRenderable:!0});let{fileId:e,file:n}=this.data;this.filename=n.filename,this.content=n.content,this.fileId=e,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,attachmentId:this.fileId,...n})}render(){this.container.classList.add("fileAttachmentAnnotation");let{container:t,data:e}=this,n;e.hasAppearance||e.fillAlpha===0?n=document.createElement("div"):(n=document.createElement("img"),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(e.name)?"paperclip":"pushpin"}.svg`,e.fillAlpha&&e.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(e.fillAlpha*100)}%);`)),n.addEventListener("dblclick",this.#e.bind(this)),this.#t=n;let{isMac:s}=J.platform;return t.addEventListener("keydown",a=>{a.key==="Enter"&&(s?a.metaKey:a.ctrlKey)&&this.#e()}),!e.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):n.classList.add("popupTriggerArea"),t.append(n),t}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}async#e(){let{fileId:t,filename:e,content:n}=this,s=await this.linkService.getAttachmentContent(t)||n;s&&this.downloadManager?.openOrDownloadData(s,e)}},Pl=class extends vt{#t=new AbortController;#e=null;#i=null;constructor(t){super(t,{isRenderable:!!t.data.richMedia})}render(){this.container.classList.add("mediaAnnotation");let{filename:t}=this.data.richMedia,e=document.createElement("button");return e.className="mediaPlayButton",e.type="button",e.title=e.ariaLabel=t,e.addEventListener("click",()=>this.#n(e),{signal:this.#t.signal}),this.container.append(e),this.container}async#n(t){let{fileId:e,filename:n,contentType:s}=this.data.richMedia;t.disabled=!0;let a;try{a=await this.linkService.getAttachmentContent(e)}catch{return}finally{t.disabled=!1}if(!a||!t.isConnected)return;let{signal:r}=this.#t,o=URL.createObjectURL(new Blob([a],{type:s}));this.#e=o;let l=s.startsWith("audio/"),c=document.createElement(l?"audio":"video");if(this.#i=c,c.className="mediaContent",this._setBackgroundColor(c),c.src=o,c.title=n,c.controls=!0,c.autoplay=!0,c.tabIndex=0,l){let u=!1,h=!1,d=()=>{c.controls=u||h};this.container.addEventListener("pointerenter",()=>{u=!0,d()},{signal:r}),this.container.addEventListener("pointerleave",()=>{u=!1,d()},{signal:r}),this.container.addEventListener("focusin",()=>{h=!0,d()},{signal:r}),this.container.addEventListener("focusout",()=>{h=!1,d()},{signal:r})}c.addEventListener("emptied",()=>this.#s(o),{once:!0,signal:r}),t.replaceWith(c),c.play().catch(()=>{})}#s(t=this.#e){t&&t===this.#e&&(URL.revokeObjectURL(t),this.#e=null)}destroy(){this.#t.abort(),this.#i&&(this.#i.pause(),this.#i.removeAttribute("src"),this.#i.load(),this.#i=null),this.#s()}},Il=class i{#t=null;#e=null;#i=null;#n=new Map;#s=null;#r=null;#a=[];#o=!1;zIndex=0;constructor({div:t,accessibilityManager:e,annotationCanvasMap:n,annotationEditorUIManager:s,page:a,viewport:r,structTreeLayer:o,commentManager:l,linkService:c,annotationStorage:u}){this.div=t,this.#t=e,this.#e=n,this.#s=o||null,this.#r=c||null,this.#i=u||new mr,this.page=a,this.viewport=r,this._annotationEditorUIManager=s,this._commentManager=l||null}hasEditableAnnotations(){return this.#n.size>0}async render(t){let{annotations:e,optionalContentConfig:n}=t,s=this.div;an(s,this.viewport);let a=new Map,r=[],o={data:null,layer:s,linkService:this.#r,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new kn,annotationStorage:this.#i,enableComment:t.enableComment===!0,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(let l of e){if(l.noHTML)continue;let c=l.annotationType===St.POPUP;if(c){let d=a.get(l.id);if(!d)continue;if(!this._commentManager){r.push(l);continue}o.elements=d}else if(l.rect[2]===l.rect[0]||l.rect[3]===l.rect[1])continue;o.data=l;let u=lr.create(o);if(!u.isRenderable)continue;c||(this.#a.push(u),l.popupRef&&a.getOrInsertComputed(l.popupRef,Ys).push(u));let h=u.render();l.hidden&&(h.style.visibility="hidden"),u.updateOC(n),u._isEditable&&(this.#n.set(u.data.id,u),this._annotationEditorUIManager?.renderAnnotationElement(u))}await this.#c();for(let l of r){let c=o.elements=a.get(l.id);o.data=l;let u=lr.create(o);if(!u.isRenderable)continue;let h=u.render();u.contentElement.id=`${ks}${l.id}`,l.hidden&&(h.style.visibility="hidden"),c.at(-1).container.after(h)}this.#l()}async#c(){if(this.#a.length===0)return;this.div.replaceChildren();let t=[];if(!this.#o){this.#o=!0;for(let{contentElement:n,data:{id:s}}of this.#a){let a=n.id=`${ks}${s}`;t.push(this.#s?.getAriaAttributes(a).then(r=>{if(r)for(let[o,l]of r)n.setAttribute(o,l)}))}}this.#a.sort(({data:{rect:[n,s,a,r]}},{data:{rect:[o,l,c,u]}})=>{if(n===a&&s===r)return 1;if(o===c&&l===u)return-1;let h=r,d=s,f=(s+r)/2,m=u,y=l,v=(l+u)/2;if(f>=m&&v<=d)return-1;if(v>=h&&f<=y)return 1;let p=(n+a)/2,g=(o+c)/2;return p-g});let e=document.createDocumentFragment();for(let n of this.#a)e.append(n.container),this._commentManager?(n.extraPopupElement?.popup||n.popup)?.renderCommentButton():n.extraPopupElement&&e.append(n.extraPopupElement.render());if(this.div.append(e),await Promise.all(t),this.#t)for(let n of this.#a)this.#t.addPointerInTextLayer(n.contentElement,!1)}async addLinkAnnotations(t){let e={data:null,layer:this.div,linkService:this.#r,svgFactory:new kn,parent:this};for(let n of t){n.borderStyle||=i._defaultBorderStyle,e.data=n;let s=lr.create(e);s.isRenderable&&(s.render(),s.contentElement.id=`${ks}${n.id}`,this.#a.push(s))}await this.#c()}update({viewport:t,optionalContentConfig:e}){let n=this.div;this.viewport=t,an(n,{rotation:t.rotation});for(let s of this.#a)s.updateOC(e);this.#l(),n.hidden=!1}destroy(){for(let t of this.#a)t.destroy?.(),this.#t?.removePointerInTextLayer(t.contentElement);this.#a.length=0,this.#n.clear(),this.div.replaceChildren()}#l(){if(!this.#e)return;let t=this.div;for(let[e,n]of this.#e){let s=t.querySelector(`[data-annotation-id="${e}"]`);if(!s)continue;if(Array.isArray(n))for(let c of n)c.className="annotationContent",c.ariaHidden=!0;else n.className="annotationContent",n.ariaHidden=!0;let a=[];for(let c of s.children)c.nodeName==="CANVAS"&&a.push(c);for(let c of a)c.remove();let r=Array.isArray(n)?n[0]:n,{firstChild:o}=s;if(o?o.classList.contains("annotationContent")?o.after(r):o.before(r):s.append(r),Array.isArray(n)){let c=r;for(let u=1,h=n.length;u<h;u++)c.after(n[u]),c=n[u]}this.#e.delete(e);let l=this.#n.get(e);l&&(l._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(e,s.id,n),l._hasNoCanvas=!1):l.canvas=n)}}refreshCanvases(){this.#l()}getEditableAnnotations(){return this.#n.values()}getEditableAnnotation(t){return this.#n.get(t)}addFakeAnnotation(t){let{div:e}=this,{id:n,rotation:s}=t,a=new lf({data:{id:n,rect:t.getPDFRect(),rotation:s},editor:t,layer:e,parent:this,enableComment:!!this._commentManager,linkService:this.#r,annotationStorage:this.#i});return a.render(),a.contentElement.id=`${ks}${n}`,a.createOrUpdatePopup(),this.#a.push(a),a}removeAnnotation(t){let e=this.#a.findIndex(s=>s.data.id===t);if(e<0)return;let[n]=this.#a.splice(e,1);this.#t?.removePointerInTextLayer(n.contentElement)}updateFakeAnnotations(t){if(t.length!==0){for(let e of t)e.updateFakeAnnotationElement(this);this.#c()}}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}static get _defaultBorderStyle(){return B(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:Ns.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},fl=/\r\n?|\n/g,xf=class i extends tt{#t="";#e=`${this.id}-editor`;#i=null;#n;_colorPicker=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let t=i.prototype,e=a=>a.isEmpty(),n=rn.TRANSLATE_SMALL,s=rn.TRANSLATE_BIG;return B(this,"_keyboardManager",new Ln([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter"],t.commitOrRemove],[["Escape"],t.commitOrRemove],[["ArrowLeft"],t._translateEmpty,{args:[-n,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-s,0],checker:e}],[["ArrowRight"],t._translateEmpty,{args:[n,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[s,0],checker:e}],[["ArrowUp"],t._translateEmpty,{args:[0,-n],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-s],checker:e}],[["ArrowDown"],t._translateEmpty,{args:[0,n],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,s],checker:e}]]))}static _type="freetext";static _editorType=P.FREETEXT;constructor(t){super({...t,name:"freeTextEditor"}),this.color=t.color||i._defaultColor||tt._defaultLineColor,this.#n=t.fontSize||i._defaultFontSize,this.annotationElementId||this._uiManager.a11yAlert(tt._l10nAlert.freetext),this.canAddComment=!1}static initialize(t,e){tt.initialize(t,e);let n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case H.FREETEXT_SIZE:i._defaultFontSize=e;break;case H.FREETEXT_COLOR:i._defaultColor=e;break}}updateParams(t,e){switch(t){case H.FREETEXT_SIZE:this.#s(e);break;case H.FREETEXT_COLOR:this.#r(e);break}}static get defaultPropertiesToUpdate(){return[[H.FREETEXT_SIZE,i._defaultFontSize],[H.FREETEXT_COLOR,i._defaultColor||tt._defaultLineColor]]}get propertiesToUpdate(){return[[H.FREETEXT_SIZE,this.#n],[H.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||=new Rl(this),[["colorPicker",this._colorPicker]]}get colorType(){return H.FREETEXT_COLOR}#s(t){let e=s=>{this.editorDiv.style.fontSize=`calc(${s}px * var(--total-scale-factor))`,this.translate(0,-(s-this.#n)*this.parentScale),this.#n=s,this.#o()},n=this.#n;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:H.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}onUpdatedColor(){this.editorDiv.style.color=this.color,this._colorPicker?.update(this.color),super.onUpdatedColor()}#r(t){let e=s=>{this.color=s,this.onUpdatedColor()},n=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:H.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){let t=this.parentScale;return[-i._internalPadding*t,-(i._internalPadding+this.#n)*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()}#a(){let t=[];this.editorDiv.normalize();let e=null;for(let n of this.editorDiv.childNodes)e?.nodeType===Node.TEXT_NODE&&n.nodeName==="BR"||(t.push(i.#c(n)),e=n);return t.join(`
53
+ `,kd=class{#t=null;#e=null;#i=null;#n=null;async#s(){if(!globalThis.navigator?.gpu)return!1;try{let t=await navigator.gpu.requestAdapter();return t?(this.#n=navigator.gpu.getPreferredCanvasFormat(),this.#e=await t.requestDevice(),!0):!1}catch{return!1}}init(){return this.#t||=this.#s()}get isReady(){return this.#e!==null}loadMeshShader(){if(!this.#e||this.#i)return;let t=this.#e.createShaderModule({code:fS});this.#i=this.#e.createRenderPipeline({layout:"auto",vertex:{module:t,entryPoint:"vs_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:"unorm8x4"}]}]},fragment:{module:t,entryPoint:"fs_main",targets:[{format:this.#n}]},primitive:{topology:"triangle-list"}})}draw(t,e,n,s,a,r,o,l){this.loadMeshShader();let c=this.#e,{offsetX:u,offsetY:h,scaleX:d,scaleY:f}=s,m=c.createBuffer({size:Math.max(t.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});t.byteLength>0&&c.queue.writeBuffer(m,0,t);let y=c.createBuffer({size:Math.max(e.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});e.byteLength>0&&c.queue.writeBuffer(y,0,e);let v=c.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});c.queue.writeBuffer(v,0,new Float32Array([u,h,d,f,r,o,l,0]));let p=c.createBindGroup({layout:this.#i.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:v}}]}),g=new OffscreenCanvas(r,o),b=g.getContext("webgpu");b.configure({device:c,format:this.#n,alphaMode:a?"opaque":"premultiplied"});let A=a?{r:a[0]/255,g:a[1]/255,b:a[2]/255,a:1}:{r:0,g:0,b:0,a:0},S=c.createCommandEncoder(),E=S.beginRenderPass({colorAttachments:[{view:b.getCurrentTexture().createView(),clearValue:A,loadOp:"clear",storeOp:"store"}]});return n>0&&(E.setPipeline(this.#i),E.setBindGroup(0,p),E.setVertexBuffer(0,m),E.setVertexBuffer(1,y),E.draw(n)),E.end(),c.queue.submit([S.finish()]),m.destroy(),y.destroy(),v.destroy(),g.transferToImageBitmap()}},Jl=new kd;Yt={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};br=class{matrix=null;isModifyingCurrentTransform(){return!1}getPattern(){Q("Abstract method `getPattern` called.")}},Ld=class extends br{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]}isOriginBased(){return this._p0[0]===0&&this._p0[1]===0&&(!this.isRadial()||this._p1[0]===0&&this._p1[1]===0)}isRadial(){return this._type==="radial"}areConic(){if(!this.isRadial())return!1;let t=Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1]);return t+this._r1>this._r0&&t+this._r0>this._r1}_createGradient(t,e=null){let n,s=this._p0,a=this._p1;if(e&&(s=s.slice(),a=a.slice(),M.applyTransform(s,e),M.applyTransform(a,e)),this._type==="axial")n=t.createLinearGradient(s[0],s[1],a[0],a[1]);else if(this._type==="radial"){let r=this._r0,o=this._r1;if(e){let l=new Float32Array(2);M.singularValueDecompose2dScale(e,l),r*=l[0],o*=l[0]}n=t.createRadialGradient(s[0],s[1],r,a[0],a[1],o)}for(let r of this._colorStops)n.addColorStop(r[0],r[1]);return n}_createReversedGradient(t,e=null){let n=this._p1,s=this._p0;e&&(n=n.slice(),s=s.slice(),M.applyTransform(n,e),M.applyTransform(s,e));let a=this._r1,r=this._r0;if(e){let c=new Float32Array(2);M.singularValueDecompose2dScale(e,c),a*=c[0],r*=c[0]}let o=t.createRadialGradient(n[0],n[1],a,s[0],s[1],r),l=this._colorStops.map(([c,u])=>[1-c,u]).reverse();for(let[c,u]of l)o.addColorStop(c,u);return o}getPattern(t,e,n,s){let a;if(s===Yt.STROKE||s===Yt.FILL){if(this.isOriginBased()){let d=M.transform(n,e.baseTransform);this.matrix&&(d=M.transform(d,this.matrix));let f=.001,m=Math.hypot(d[0],d[1]),y=Math.hypot(d[2],d[3]),v=(d[0]*d[2]+d[1]*d[3])/(m*y);if(Math.abs(v)<f)if(this.isRadial()){if(Math.abs(m-y)<f)return this._createGradient(t,d)}else return this._createGradient(t,d)}let r=e.current.getClippedPathBoundingBox(s,ut(t))||[0,0,0,0],o=Math.ceil(r[2]-r[0])||1,l=Math.ceil(r[3]-r[1])||1,c=e.canvasFactory.create(o,l),u=c.context;u.clearRect(0,0,u.canvas.width,u.canvas.height),u.beginPath(),u.rect(0,0,u.canvas.width,u.canvas.height),u.translate(-r[0],-r[1]),n=M.transform(n,[1,0,0,1,r[0],r[1]]),u.transform(...e.baseTransform),this.matrix&&u.transform(...this.matrix),yl(u,this._bbox),this.areConic()&&(u.fillStyle=this._createReversedGradient(u),u.fill()),u.fillStyle=this._createGradient(u),u.fill(),a=t.createPattern(c.canvas,"no-repeat"),e.canvasFactory.destroy(c);let h=new DOMMatrix(n);a.setTransform(h)}else this.areConic()&&(t.save(),yl(t,this._bbox),t.fillStyle=this._createReversedGradient(t),t.fillRect(-1e10,-1e10,2e10,2e10),t.restore()),yl(t,this._bbox),a=this._createGradient(t);return a}};Bd=class extends br{constructor(t){super(),this._posData=t[2],this._colData=t[3],this._vertexCount=t[4],this._bounds=t[5],this._bbox=t[6],this._background=t[7],mS()}_createMeshCanvas(t,e,n){let o=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),c=Math.ceil(this._bounds[2])-o,u=Math.ceil(this._bounds[3])-l,h=Math.min(Math.ceil(Math.abs(c*t[0]*1.1)),3e3)||1,d=Math.min(Math.ceil(Math.abs(u*t[1]*1.1)),3e3)||1,f=c?c/h:1,m=u?u/d:1,y={coords:this._posData,colors:this._colData,offsetX:-o,offsetY:-l,scaleX:1/f,scaleY:1/m},v=h+4,p=d+4,g=n.create(v,p);if(gS()&&this._vertexCount>48)g.context.drawImage(yS(this._posData,this._colData,this._vertexCount,y,e,v,p,2),0,0);else{let b=g.context.createImageData(h,d);if(e){let A=b.data;for(let S=0,E=A.length;S<E;S+=4)A[S]=e[0],A[S+1]=e[1],A[S+2]=e[2],A[S+3]=255}for(let A=0,S=this._vertexCount;A<S;A+=3)bS(b,y,A,A+1,A+2,A,A+1,A+2);g.context.putImageData(b,2,2)}return{canvas:g.canvas,offsetX:o-2*f,offsetY:l-2*m,scaleX:f,scaleY:m}}isModifyingCurrentTransform(){return!0}getPattern(t,e,n,s){yl(t,this._bbox);let a=new Float32Array(2);if(s===Yt.SHADING)M.singularValueDecompose2dScale(ut(t),a);else if(this.matrix){M.singularValueDecompose2dScale(this.matrix,a);let[l,c]=a;M.singularValueDecompose2dScale(e.baseTransform,a),a[0]*=l,a[1]*=c}else M.singularValueDecompose2dScale(e.baseTransform,a);let r=this._createMeshCanvas(a,s===Yt.SHADING?null:this._background,e.canvasFactory);s!==Yt.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(r.offsetX,r.offsetY),t.scale(r.scaleX,r.scaleY);let o=t.createPattern(r.canvas,"no-repeat");return e.canvasFactory.destroy(r),o}},zd=class extends br{getPattern(){return"hotpink"}};tb={COLORED:1,UNCOLORED:2},or=class i{static MAX_PATTERN_SIZE=3e3;constructor(t,e,n,s){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.needsIsolation=t[9]??!0,this.ctx=e,this.canvasGraphicsFactory=n,this.baseTransform=s,this.patternBaseMatrix=this.matrix?M.transform(s,this.matrix):s}canSkipPatternCanvas([t,e,n,s]){let[a,r,o,l]=this.bbox,c=Math.abs(this.xstep),u=Math.abs(this.ystep);if(t>c+1e-6||e>u+1e-6)return null;let h=Math.floor((n-o)/c)+1,d=Math.ceil((n+t-a)/c)-1,f=Math.floor((s-l)/u)+1,m=Math.ceil((s+e-r)/u)-1;return d<=h&&m<=f?[h,f]:null}updatePatternDims(t,e){let n=M.inverseTransform(this.patternBaseMatrix),s=[t[0],t[1]],a=[t[2],t[3]];M.applyTransform(s,n),M.applyTransform(a,n),e[0]=Math.abs(a[0]-s[0]),e[1]=Math.abs(a[1]-s[1]),e[2]=Math.min(s[0],a[0]),e[3]=Math.min(s[1],a[1])}_renderTileCanvas(t,e,n,s){let[a,r,o,l]=this.bbox,c=t.canvasFactory.create(n.size,s.size),u=c.context,h=this.canvasGraphicsFactory.createCanvasGraphics(u,e);return h.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(h,this.paintType,this.color),u.translate(-n.scale*a,-s.scale*r),h.transform(0,n.scale,0,0,s.scale,0,0),u.save(),h.dependencyTracker?.save(),this.clipBbox(h,a,r,o,l),h.baseTransform=ut(h.ctx),h.executeOperatorList(this.operatorList),h.endDrawing(),h.dependencyTracker?.restore(),u.restore(),c}_getCombinedScales(){let t=new Float32Array(2);M.singularValueDecompose2dScale(this.matrix,t);let[e,n]=t;return M.singularValueDecompose2dScale(this.baseTransform,t),[e*t[0],n*t[1]]}drawPattern(t,e,n=!1,[s,a],r){let[o,l,c,u]=this.bbox,h=t.dependencyTracker;if(h&&(t.dependencyTracker=new yr(h,r)),t.save(),n?t.ctx.clip(e,"evenodd"):t.ctx.clip(e),t.ctx.setTransform(...this.patternBaseMatrix),t.ctx.translate(s*this.xstep,a*this.ystep),this.needsIsolation||t.ctx.globalAlpha!==1||t.ctx.globalCompositeOperation!=="source-over"||t.inSMaskMode){let d=c-o,f=u-l,[m,y]=this._getCombinedScales(),v=this.getSizeAndScale(d,this.ctx.canvas.width,m),p=this.getSizeAndScale(f,this.ctx.canvas.height,y),g=this._renderTileCanvas(t,r,v,p);t.ctx.drawImage(g.canvas,o,l,d,f),t.canvasFactory.destroy(g)}else this.setFillAndStrokeStyleToContext(t,this.paintType,this.color),this.clipBbox(t,o,l,c,u),t.baseTransformStack.push(t.baseTransform),t.baseTransform=ut(t.ctx),t.executeOperatorList(this.operatorList),t.baseTransform=t.baseTransformStack.pop();t.restore(),h&&(t.dependencyTracker=h)}createPatternCanvas(t,e){let[n,s,a,r]=this.bbox,o=a-n,l=r-s,{xstep:c,ystep:u}=this;c=Math.abs(c),u=Math.abs(u),Kl("TilingType: "+this.tilingType);let[h,d]=this._getCombinedScales(),f=o,m=l,y=!1,v=!1;Math.ceil(c*h)>=Math.ceil(o*h)?f=c:y=!0,Math.ceil(u*d)>=Math.ceil(l*d)?m=u:v=!0;let p=this.getSizeAndScale(f,this.ctx.canvas.width,h),g=this.getSizeAndScale(m,this.ctx.canvas.height,d),b=this._renderTileCanvas(t,e,p,g);if(y||v){let A=b.canvas;y&&(f=c),v&&(m=u);let S=this.getSizeAndScale(f,this.ctx.canvas.width,h),E=this.getSizeAndScale(m,this.ctx.canvas.height,d),T=S.size,w=E.size,_=t.canvasFactory.create(T,w),C=_.context,D=y?Math.floor(o/c):0,N=v?Math.floor(l/u):0;for(let z=0;z<=D;z++)for(let X=0;X<=N;X++)C.drawImage(A,T*z,w*X,T,w,0,0,T,w);return t.canvasFactory.destroy(b),{canvas:_.canvas,canvasEntry:_,scaleX:S.scale,scaleY:E.scale,offsetX:n,offsetY:s}}return{canvas:b.canvas,canvasEntry:b,scaleX:p.scale,scaleY:g.scale,offsetX:n,offsetY:s}}getSizeAndScale(t,e,n){let s=Math.max(i.MAX_PATTERN_SIZE,e),a=Math.ceil(t*n);return a>=s?a=s:n=a/t,{scale:n,size:a}}clipBbox(t,e,n,s,a){let r=s-e,o=a-n,l=new Path2D;l.rect(e,n,r,o),M.axialAlignedBoundingBox([e,n,s,a],ut(t.ctx),t.current.minMax),t.ctx.clip(l),t.current.updateClipFromPath()}setFillAndStrokeStyleToContext(t,e,n){let s=t.ctx,a=t.current;switch(a.patternFill=a.patternStroke=!1,e){case tb.COLORED:let{fillStyle:r,strokeStyle:o}=this.ctx;s.fillStyle=a.fillColor=r,s.strokeStyle=a.strokeColor=o;break;case tb.UNCOLORED:s.fillStyle=s.strokeStyle=n,a.fillColor=a.strokeColor=n;break;default:throw new id(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,n,s,a){let r=s!==Yt.SHADING?M.transform(n,this.patternBaseMatrix):n,o=this.createPatternCanvas(e,a),l=new DOMMatrix(r);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);let c=t.createPattern(o.canvas,"repeat");return e.canvasFactory.destroy(o.canvasEntry),c.setTransform(l),c}},AS=16,SS=100,ES=15,eb=10,le=16,Zh=new DOMMatrix,Ee=new Float32Array(2);Ml=class{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=td;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=Pt.FILL;textRise=0;fillColor="#000000";strokeColor="#000000";tilingPatternDims=null;patternFill=!1;patternStroke=!1;fillAlpha=1;strokeAlpha=1;lineWidth=1;activeSMask=null;transferMaps="none";minMax=On.slice();constructor(t,e){this.clipBox=new Float32Array([0,0,t,e])}clone(){let t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t.tilingPatternDims=this.tilingPatternDims?.slice(),t}getPathBoundingBox(t=Yt.FILL,e=null){let n=this.minMax.slice();if(t===Yt.STROKE){e||Q("Stroke bounding box must include transform."),M.singularValueDecompose2dScale(e,Ee);let s=Ee[0]*this.lineWidth/2,a=Ee[1]*this.lineWidth/2;n[0]-=s,n[1]-=a,n[2]+=s,n[3]+=a}return n}updateClipFromPath(){let t=M.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(On,0)}getClippedPathBoundingBox(t=Yt.FILL,e=null){return M.intersect(this.clipBox,this.getPathBoundingBox(t,e))}};TS=["butt","round","square"],wS=["miter","round","bevel"],_S={},rb={},zs=class i{#t=0;#e=0;#i=null;#n=null;#s=null;#r=null;#a=1;#o;#c=null;#l=[];constructor(t,e,n,s,a,{optionalContentConfig:r,markedContentStack:o=null},l,c,u,h){this.ctx=t,this.current=new Ml(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.commonObjs=e,this.objs=n,this.canvasFactory=s,this.filterFactory=a,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.tempSMask=null,this.smaskGroupCanvases=[],this.smaskPreparedEntry=null,this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=r,this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=c,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=u??null,this.imagesTracker=h??null}getObject(t,e,n=null){return typeof e=="string"?(this.dependencyTracker?.recordNamedDependency(t,e),e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e)):n}beginDrawing({transform:t,viewport:e,transparency:n=!1,background:s=null}){let a=this.ctx.canvas.width,r=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,a,r),this.ctx.fillStyle=o,n){let l=this.transparentCanvasEntry=this.canvasFactory.create(a,r);this.compositeCtx=this.ctx,{canvas:this.transparentCanvas,context:this.ctx}=l,this.ctx.save(),this.ctx.transform(...ut(this.compositeCtx))}this.ctx.save(),dl(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[3]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=ut(this.ctx)}executeOperatorList(t,e,n,s,a){let r=t.argsArray,o=t.fnArray,l=e||0,c=r.length;if(c===l)return l;let u=c-l>eb&&typeof n=="function",h=u?Date.now()+ES:0,d=0,f=this.commonObjs,m=this.objs,y,v;for(;;){if(s!==void 0){if(l===s.nextBreakPoint)return s.breakIt(l,n),l;if(s.shouldSkip(l)){if(++l===c)return l;continue}}if(!a||a(l))if(y=o[l],v=r[l]??null,y!==Ue.dependency)v===null?this[y](l):this[y](l,...v);else for(let p of v){this.dependencyTracker?.recordNamedData(p,l);let g=p.startsWith("g_")?f:m;if(!g.has(p))return g.get(p,n),l}if(l++,l===c)return l;if(u&&++d>eb){if(Date.now()>h)return n(),l;d=0}}}#d(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(this.transparentCanvasEntry),this.transparentCanvas=null,this.transparentCanvasEntry=null)}endDrawing(){this.#d();for(let t of this.smaskGroupCanvases)this.canvasFactory.destroy(t);this.smaskGroupCanvases.length=0,this._clearPreparedSMask(),this.tempSMask=null,this.smaskStack.length=0;for(let t of this.#l)this.#y(t);this.#l.length=0,this.#i=null,this.#n=null,this.#s=null,this.#r=null,this.#a=1,this.#c=null,this.#e=0,this.#t=0,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.#h()}#h(){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 n=t.width??t.displayWidth,s=t.height??t.displayHeight,a=Math.max(Math.hypot(e[0],e[1]),1),r=Math.max(Math.hypot(e[2],e[3]),1),o=[],l=a,c=r,u=n,h=s;for(;l>2&&u>1||c>2&&h>1;){let p=u,g=h;l>2&&u>1&&(p=Math.ceil(u/2),l/=u/p),c>2&&h>1&&(g=Math.ceil(h/2),c/=h/g),o.push({newWidth:p,newHeight:g}),u=p,h=g}if(o.length===0)return{img:t,paintWidth:n,paintHeight:s,tmpCanvas:null};if(o.length===1){let{newWidth:p,newHeight:g}=o[0],b=this.canvasFactory.create(p,g);return b.context.drawImage(t,0,0,n,s,0,0,p,g),{img:b.canvas,paintWidth:p,paintHeight:g,tmpCanvas:b}}let d=this.canvasFactory.create(1,1),f=this.canvasFactory.create(1,1),m=n,y=s,v=t;for(let{newWidth:p,newHeight:g}of o)this.canvasFactory.reset(f,p,g),f.context.drawImage(v,0,0,m,y,0,0,p,g),[d,f]=[f,d],v=d.canvas,m=p,y=g;return this.canvasFactory.destroy(f),{img:d.canvas,paintWidth:m,paintHeight:y,tmpCanvas:d}}_createMaskCanvas(t,e){let n=this.ctx,{width:s,height:a}=e,r=this.current.fillColor,o=this.current.patternFill,l=ut(n),c,u,h,d;if((e.bitmap||e.data)&&e.count>1){let D=e.bitmap||e.data.buffer;u=JSON.stringify(o?l:[l.slice(0,4),r]),c=this._cachedBitmapsMap.getOrInsertComputed(D,Ql);let N=c.get(u);if(N&&!o){let z=Math.round(Math.min(l[0],l[2])+l[4]),X=Math.round(Math.min(l[1],l[3])+l[5]);return this.dependencyTracker?.recordDependencies(t,ze.transformAndFill),{canvas:N,offsetX:z,offsetY:X}}h=N}h||(d=this.canvasFactory.create(s,a),sb(d.context,e));let f=M.transform(l,[1/s,0,0,-1/a,0,0]);f=M.transform(f,[1,0,0,1,0,-a]);let m=On.slice();M.axialAlignedBoundingBox([0,0,s,a],f,m);let[y,v,p,g]=m,b=Math.round(p-y)||1,A=Math.round(g-v)||1,S=this.canvasFactory.create(b,A),E=S.context,T=y,w=v;E.translate(-T,-w),E.transform(...f);let _=null;if(!h){let D=this._scaleImage(d.canvas,$e(E));h=D.img,_=D.tmpCanvas,h!==d.canvas&&(this.canvasFactory.destroy(d),d=null),c&&o&&(c.set(u,h),_=null,d=null)}E.imageSmoothingEnabled=ab(ut(E),e.interpolate),hl(E,h,0,0,h.width,h.height,0,0,s,a),_&&this.canvasFactory.destroy(_),d&&this.canvasFactory.destroy(d),E.globalCompositeOperation="source-in";let C=M.transform($e(E),[1,0,0,1,-T,-w]);return E.fillStyle=o?r.getPattern(n,this,C,Yt.FILL,t):r,E.fillRect(0,0,s,a),c&&!o&&c.set(u,S.canvas),this.dependencyTracker?.recordDependencies(t,ze.transformAndFill),{canvas:S.canvas,canvasEntry:c&&!o?null:S,offsetX:Math.round(T),offsetY:Math.round(w)}}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=TS[e]}setLineJoin(t,e){this.dependencyTracker?.recordSimpleData("lineJoin",t),this.ctx.lineJoin=wS[e]}setMiterLimit(t,e){this.dependencyTracker?.recordSimpleData("miterLimit",t),this.ctx.miterLimit=e}setDash(t,e,n){this.dependencyTracker?.recordSimpleData("dash",t);let s=this.ctx;s.setLineDash!==void 0&&(s.setLineDash(e),s.lineDashOffset=n)}setRenderingIntent(t,e){}setFlatness(t,e){}setGState(t,e){for(let[n,s]of e)switch(n){case"LW":this.setLineWidth(t,s);break;case"LC":this.setLineCap(t,s);break;case"LJ":this.setLineJoin(t,s);break;case"ML":this.setMiterLimit(t,s);break;case"D":this.setDash(t,s[0],s[1]);break;case"RI":this.setRenderingIntent(t,s);break;case"FL":this.setFlatness(t,s);break;case"Font":this.setFont(t,s[0],s[1]);break;case"CA":this.dependencyTracker?.recordSimpleData("strokeAlpha",t),this.current.strokeAlpha=s;break;case"ca":this.dependencyTracker?.recordSimpleData("fillAlpha",t),this.ctx.globalAlpha=this.current.fillAlpha=s;break;case"BM":this.dependencyTracker?.recordSimpleData("globalCompositeOperation",t),this.ctx.globalCompositeOperation=s;break;case"SMask":this.dependencyTracker?.recordSimpleData("SMask",t),this.current.activeSMask=s?this.tempSMask:null,this.current.activeSMask&&(this.current.activeSMask.blendMode=this.ctx.globalCompositeOperation),this.tempSMask=null,this.checkSMaskState(t);break;case"TR":this.dependencyTracker?.recordSimpleData("filter",t),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(s);break}}get inSMaskMode(){return!!this.suspendedCtx}_clearPreparedSMask(){this.smaskPreparedEntry&&(this.canvasFactory.destroy(this.smaskPreparedEntry),this.smaskPreparedEntry=null),this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null}_ensurePreparedSMask(t){t!==this.smaskPreparedFor&&(this._clearPreparedSMask(),this._prepareSMaskCanvas(t))}checkSMaskState(t){let e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode(t):!this.current.activeSMask&&e?this.endSMaskMode():this.current.activeSMask&&e&&this._ensurePreparedSMask(this.current.activeSMask)}_prepareSMaskCanvas(t){let{canvas:e,subtype:n,backdrop:s,transferMap:a}=t,r=n==="Luminosity"||n==="Alpha"&&a;if(!r&&!(n==="Luminosity"&&s)){this.smaskPreparedFor=t;return}let o;if(n==="Luminosity"&&s){let[g,b,A]=qs(s),S=Math.round(.3*g+.59*b+.11*A);o=a?.[S]??S}else o=a?.[0]??0;let l=4,{width:c,height:u}=this.ctx.canvas,h=e.width*e.height,d=c*u<l*h,f=r?{url:n==="Alpha"?this.filterFactory.addAlphaFilter(a):this.filterFactory.addLuminosityFilter(a),subtype:n,transferMap:a}:null,m=n==="Luminosity"?s:null,y,v,p;d?(y=this._bakeSMaskCanvas(e,t.offsetX,t.offsetY,c,u,m,f),v=0,p=0):(y=this._bakeSMaskCanvas(e,0,0,e.width,e.height,m,f),v=t.offsetX,p=t.offsetY),this.smaskPreparedEntry=y,this.smaskPreparedFor=t,this.smaskPreparedOffsetX=v,this.smaskPreparedOffsetY=p,this.smaskPreparedOOBAlpha=!d&&o!==0?o:null}_bakeSMaskCanvas(t,e,n,s,a,r,o){!r&&!o&&Q("_bakeSMaskCanvas with neither backdrop nor filter");let l=this.canvasFactory.create(s,a),c=l.context;if(c.drawImage(t,e,n),r&&(c.globalCompositeOperation="destination-atop",c.fillStyle=r,c.fillRect(0,0,s,a)),!o)return l;let u=this.canvasFactory.create(s,a),h=u.context;h.filter=o.url;let d=J.isCanvasFilterSupported&&h.filter!=="none"&&h.filter!=="";if(h.drawImage(l.canvas,0,0),J.isCanvasFilterSupported&&(h.filter="none"),!d){let f=h.getImageData(0,0,s,a),{data:m}=f,{transferMap:y}=o;if(o.subtype==="Luminosity")for(let v=0,p=m.length;v<p;v+=4){let g=.3*m[v]+.59*m[v+1]+.11*m[v+2]+.5|0;m[v]=m[v+1]=m[v+2]=0,m[v+3]=y?.[g]??g}else for(let v=3,p=m.length;v<p;v+=4)m[v]=y[m[v]];h.putImageData(f,0,0)}return this.canvasFactory.destroy(l),u}beginSMaskMode(t){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");let{width:e,height:n}=this.ctx.canvas,s=this.canvasFactory.create(e,n);this.smaskScratchCanvas=s,this.suspendedCtx=this.ctx;let a=this.ctx=s.context;a.setTransform(this.suspendedCtx.getTransform()),Mn(this.suspendedCtx,a),ib(a,this.suspendedCtx),this._ensurePreparedSMask(this.current.activeSMask),this.setGState(t,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Mn(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null,this.canvasFactory.destroy(this.smaskScratchCanvas),this.smaskScratchCanvas=null,this._clearPreparedSMask()}#p(t,e=null,n=1){let{width:s,height:a}=t,r=e??this.canvasFactory.create(s,a),o=r.context;n=Math.round(n*255)/255;let l=n<1;l&&this.#o===void 0&&(this.#o=J.isCanvasFilterSupported?new Map:"none");let c="none";if(l&&this.#o instanceof Map&&(c=this.#o.getOrInsertComputed(n,()=>this.filterFactory.addKnockoutFilter(n))),!l||c!=="none")return e&&(o.save(),o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,s,a),o.restore()),o.filter=c,o.drawImage(t,0,0),o.filter="none",r;let u=t.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,s,a),h=o.createImageData(s,a),d=u.data,f=h.data,m=n>0?1/n:1e6;for(let y=3,v=d.length;y<v;y+=4)f[y]=Math.min(Math.round(d[y]*m),255);return o.putImageData(h,0,0),r}#m(t,e,n,s){let a=t?.[e]??null;if(a&&(a.canvas.width!==n||a.canvas.height!==s)&&(this.canvasFactory.destroy(a),a=null),!a)return a=this.canvasFactory.create(n,s),t&&(t[e]=a),a;let r=a.context;return r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,n,s),r.restore(),a}#g(t,e,n={}){let{backdropCanvas:s=null,destTransform:a=[1,0,0,1,0,0],backdropOffset:r=[0,0],reuseMaskEntry:o=null,poolMeta:l=null,sourceAlpha:c=1,sourceFilter:u="none",knockoutAlpha:h=1}=n,{width:d,height:f}=e,m=this.#p(e,o,h),y=t.globalCompositeOperation;if(t.save(),t.setTransform(...a),t.globalAlpha=1,J.isCanvasFilterSupported&&(t.filter="none"),t.globalCompositeOperation="destination-out",t.drawImage(m.canvas,0,0),s){let[v,p]=r,g=this.#m(l,"knockoutBackdropEntry",d,f),b=g.context;b.drawImage(s,v,p,d,f,0,0,d,f),b.globalCompositeOperation="destination-in",b.drawImage(m.canvas,0,0),b.globalCompositeOperation="source-over",t.globalCompositeOperation="destination-over",t.drawImage(g.canvas,0,0),l||this.canvasFactory.destroy(g)}t.globalCompositeOperation=y,t.globalAlpha=c,J.isCanvasFilterSupported&&(t.filter=u??"none"),t.drawImage(e,0,0),t.restore(),o||this.canvasFactory.destroy(m)}#u(t=1){if(this.#t===0||this.#e>0||!this.contentVisible)return!1;this.#e++,this.#a=t;let e=this.#l.at(-1),{canvas:n}=this.ctx,s=this.#m(e,"knockoutTempEntry",n.width,n.height);this.#i=s;let a=s.context;return a.save(),a.setTransform(this.ctx.getTransform()),Mn(this.ctx,a),this.#r=a.globalCompositeOperation,a.globalCompositeOperation="source-over",ib(a,this.ctx),this.#c=e,this.#n=this.ctx,this.#s=this.suspendedCtx,this.ctx=a,this.inSMaskMode&&(this.suspendedCtx=a),!0}#f(t){if(!t)return;let e=this.#i,n=this.#n,s=this.#s,a=e.context;this.#i=null,this.#n=null,this.#s=null,this.inSMaskMode&&this.suspendedCtx===a&&this.ctx!==a&&this.endSMaskMode(),this.inSMaskMode&&(this.suspendedCtx=s),this.ctx._removeMirroring(),this.ctx.globalCompositeOperation=this.#r,this.#r=null,Mn(this.ctx,n),this.ctx=n;let r=this.#c;this.#c=null;let o=this.#a;this.#a=1;try{this.#g(s??n,e.canvas,{backdropCanvas:r?.backdropCtx?.canvas??null,backdropOffset:r?.backdropCtx?[r.offsetX,r.offsetY]:[0,0],reuseMaskEntry:r?.knockoutMaskEntry??null,poolMeta:r,knockoutAlpha:o})}finally{a.restore(),this.#e--,r||this.canvasFactory.destroy(e)}}compose(t){if(!this.current.activeSMask)return;t=t?[Math.floor(t[0]),Math.floor(t[1]),Math.ceil(t[2]),Math.ceil(t[3])]:[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let e=this.current.activeSMask,n=this.suspendedCtx,s=this.#e>0&&n===this.ctx;this.composeSMask(s?null:n,e,this.ctx,t),!s&&(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,n,s){let a=s[0],r=s[1],o=s[2]-a,l=s[3]-r;if(o===0||l===0)return;let c=this.smaskPreparedEntry;if(c){let u=a,h=r,d=o,f=l,m=this.smaskPreparedOOBAlpha,y=m!==null;if(y){u=Math.max(a,e.offsetX),h=Math.max(r,e.offsetY);let v=Math.min(a+o,e.offsetX+e.canvas.width),p=Math.min(r+l,e.offsetY+e.canvas.height);d=v-u,f=p-h}if(d>0&&f>0){let v=u-this.smaskPreparedOffsetX,p=h-this.smaskPreparedOffsetY;n.save(),n.globalAlpha=1,n.setTransform(1,0,0,1,0,0);let g=new Path2D;g.rect(u,h,d,f),n.clip(g),n.globalCompositeOperation="destination-in",n.drawImage(c.canvas,v,p,d,f,u,h,d,f),n.restore()}y&&m<255&&this._applySMaskOOBAlpha(n,a,r,o,l,u,h,u+d,h+f,m)}else this.genericComposeSMask(e,n,o,l,a,r);t&&(t.save(),t.globalAlpha=1,t.globalCompositeOperation=e.blendMode||"source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(n.canvas,a,r,o,l,a,r,o,l),t.restore())}_applySMaskOOBAlpha(t,e,n,s,a,r,o,l,c,u){let h=r<l&&o<c;if(h&&r===e&&o===n&&l===e+s&&c===n+a)return;let d=new Path2D;d.rect(e,n,s,a),h&&d.rect(r,o,l-r,c-o),t.save(),t.globalAlpha=u/255,t.setTransform(1,0,0,1,0,0),t.clip(d,"evenodd"),t.globalCompositeOperation="destination-in",t.fillStyle="#000000",t.fillRect(e,n,s,a),t.restore()}genericComposeSMask(t,e,n,s,a,r){let{context:o,offsetX:l,offsetY:c}=t;e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);let u=new Path2D;u.rect(a,r,n,s),e.clip(u),e.globalCompositeOperation="destination-in",e.drawImage(o.canvas,a-l,r-c,n,s,a,r,n,s),e.restore()}save(t){this.inSMaskMode&&Mn(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&&(Mn(this.suspendedCtx,this.ctx),this.ctx.setTransform(this.suspendedCtx.getTransform())),this.checkSMaskState(t),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(t,e,n,s,a,r,o){this.dependencyTracker?.recordIncrementalData("transform",t),this.ctx.transform(e,n,s,a,r,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,n,s){let[a]=n;if(!s){a||=n[0]=new Path2D,e!==Ue.stroke&&e!==Ue.closeStroke&&(this.current.tilingPatternDims=null),this[e](t,a);return}if(this.dependencyTracker!==null){let o=e===Ue.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(t).recordBBox(t,this.ctx,s[0]-o,s[2]+o,s[1]-o,s[3]+o).recordDependencies(t,["transform"])}a instanceof Path2D||(a=n[0]=Sb(a)),M.axialAlignedBoundingBox(s,ut(this.ctx),this.current.minMax);let r=this.current.tilingPatternDims;if(r&&e!==Ue.stroke&&e!==Ue.closeStroke&&this.current.fillColor instanceof or){let o=M.intersect(this.current.clipBox,this.current.minMax);o?this.current.fillColor.updatePatternDims(o,r):this.current.tilingPatternDims=null}this[e](t,a),this._pathStartIdx=t}closePath(t){this.ctx.closePath()}stroke(t,e,n=!0){let s=n&&this.#u(this.current.strokeAlpha),a=this.ctx,r=this.current.strokeColor;if(a.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof r=="object"&&r?.getPattern){let o=r.isModifyingCurrentTransform()?a.getTransform():null;if(a.save(),a.strokeStyle=r.getPattern(a,this,$e(a),Yt.STROKE,t),o){let l=new Path2D;l.addPath(e,a.getTransform().invertSelf().multiplySelf(o)),e=l}this.rescaleAndStroke(e,!1),a.restore()}else this.rescaleAndStroke(e,!0);this.dependencyTracker?.recordDependencies(t,ze.stroke),n&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(Yt.STROKE,ut(this.ctx))),a.globalAlpha=this.current.fillAlpha,this.#f(s)}closeStroke(t,e){this.stroke(t,e)}fill(t,e,n=!0){let s=n&&this.#u(this.current.fillAlpha),a=this.ctx,r=this.current.fillColor,o=this.current.patternFill,l=!1,c=this.current.getClippedPathBoundingBox();if(this.dependencyTracker?.recordDependencies(t,ze.fill),o){let u=this.current.tilingPatternDims,h=u&&r.canSkipPatternCanvas(u);if(h){r.drawPattern(this,e,this.pendingEOFill,h,t),this.pendingEOFill=!1,n&&this.consumePath(t,e,c),this.current.tilingPatternDims=null,this.#f(s);return}let d=r.isModifyingCurrentTransform()?a.getTransform():null;if(this.dependencyTracker?.save(t),a.save(),a.fillStyle=r.getPattern(a,this,$e(a),Yt.FILL,t),d){let f=new Path2D;f.addPath(e,a.getTransform().invertSelf().multiplySelf(d)),e=f}l=!0}this.contentVisible&&c!==null&&(this.pendingEOFill?(a.fill(e,"evenodd"),this.pendingEOFill=!1):a.fill(e)),l&&(a.restore(),this.dependencyTracker?.restore(t)),n&&this.consumePath(t,e,c),this.#f(s)}eoFill(t,e){this.pendingEOFill=!0,this.fill(t,e)}fillStroke(t,e){let n=this.#u(Math.min(this.current.fillAlpha,this.current.strokeAlpha));this.fill(t,e,!1),this.stroke(t,e,!1),this.consumePath(t,e),this.#f(n)}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){let n=this.#u(this.current.fillAlpha);this.ctx.fill(e),this.dependencyTracker?.recordDependencies(t,ze.rawFillPath).recordOperation(t),this.#f(n)}clip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=_S}eoClip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=rb}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,n=this.ctx;if(this.dependencyTracker){let{dependencyTracker:s}=this;e!==void 0&&s.recordFutureForcedDependency("textClip",s.getOpenMarker()).recordFutureForcedDependency("textClip",t),s.recordCloseMarker(t)}if(e!==void 0){let s=new Path2D,a=n.getTransform().invertSelf();for(let{transform:r,x:o,y:l,fontSize:c,path:u}of e)u&&s.addPath(u,new DOMMatrix(r).preMultiplySelf(a).translate(o,l).scale(c,-c));n.clip(s)}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,n){this.dependencyTracker?.recordSimpleData("font",t).recordSimpleDataFromNamed("fontObj",e,t);let s=this.commonObjs.get(e),a=this.current;if(!s)throw new Error(`Can't find font for ${e}`);if(a.fontMatrix=s.fontMatrix||td,(a.fontMatrix[0]===0||a.fontMatrix[3]===0)&&I("Invalid font matrix for font "+e),n<0?(n=-n,a.fontDirection=-1):a.fontDirection=1,this.current.font=s,this.current.fontSize=n,s.isType3Font)return;let r=s.loadedName||"sans-serif",o=s.systemFontInfo?.css||`"${r}", ${s.fallbackName}`,l="normal";s.black?l="900":s.bold&&(l="bold");let c=s.italic?"italic":"normal",u=ht(n,AS,SS);this.current.fontSizeScale=n/u,this.ctx.font=`${c} ${l} ${u}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,n){this.dependencyTracker?.resetIncrementalData("sameLineText").recordIncrementalData("moveText",t),this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=n}setLeadingMoveText(t,e,n){this.setLeading(t,-n),this.moveText(t,e,n)}setTextMatrix(t,e){this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",t);let{current:n}=this;n.textMatrix=e,n.textMatrixScale=Math.hypot(e[0],e[1]),n.x=n.lineX=0,n.y=n.lineY=0}nextLine(t){this.moveText(t,0,this.current.leading),this.dependencyTracker?.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??t)}#b(t,e,n){let s=new Path2D;return s.addPath(t,new DOMMatrix(n).invertSelf().multiplySelf(e)),s}paintChar(t,e,n,s,a,r){let o=this.ctx,l=this.current,c=l.font,u=l.textRenderingMode,h=l.fontSize/l.fontSizeScale,d=u&Pt.FILL_STROKE_MASK,f=!!(u&Pt.ADD_TO_PATH_FLAG),m=l.patternFill&&!c.missingFile,y=l.patternStroke&&!c.missingFile,v;if((c.disableFontFace||f||m||y)&&!c.missingFile&&(v=c.getPathGenerator(this.commonObjs,e)),v&&(c.disableFontFace||m||y)){o.save(),o.translate(n,s),o.scale(h,-h),this.dependencyTracker?.recordCharacterBBox(t,o,c);let p;if(d===Pt.FILL||d===Pt.FILL_STROKE)if(a){p=o.getTransform(),o.setTransform(...a);let g=this.#b(v,p,a);o.fill(g)}else o.fill(v);if(d===Pt.STROKE||d===Pt.FILL_STROKE)if(r){p||=o.getTransform(),o.setTransform(...r);let{a:g,b,c:A,d:S}=p,E=M.inverseTransform(r),T=M.transform([g,b,A,S,0,0],E);M.singularValueDecompose2dScale(T,Ee),o.lineWidth*=Math.max(Ee[0],Ee[1])/h,o.stroke(this.#b(v,p,r))}else o.lineWidth/=h,o.stroke(v);o.restore()}else(d===Pt.FILL||d===Pt.FILL_STROKE)&&(o.fillText(e,n,s),this.dependencyTracker?.recordCharacterBBox(t,o,c,h,n,s,()=>o.measureText(e))),(d===Pt.STROKE||d===Pt.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(t,o,c,h,n,s,()=>o.measureText(e)).recordDependencies(t,ze.stroke),o.strokeText(e,n,s));f&&((this.pendingTextPaths||=[]).push({transform:ut(o),x:n,y:s,fontSize:h,path:v}),this.dependencyTracker?.recordCharacterBBox(t,o,c,h,n,s))}get isFontSubpixelAAEnabled(){let t=this.canvasFactory.create(10,10),e=t.context;e.scale(1.5,1),e.fillText("I",0,10);let n=e.getImageData(0,0,10,10).data;this.canvasFactory.destroy(t);let s=!1;for(let a=3;a<n.length;a+=4)if(n[a]>0&&n[a]<255){s=!0;break}return L(this,"isFontSubpixelAAEnabled",s)}showText(t,e){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,ze.showText).resetBBox(t),this.current.textRenderingMode&Pt.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",t).inheritPendingDependenciesAsFutureForcedDependencies());let n=this.current,s=n.font;if(s.isType3Font){let N=this.#u(n.fillAlpha);this.showType3Text(t,e),this.dependencyTracker?.recordShowTextOperation(t),this.#f(N);return}let a=n.fontSize;if(a===0){this.dependencyTracker?.recordOperation(t);return}let r=this.#u(n.fillAlpha),o=this.ctx,l=n.fontSizeScale,c=n.charSpacing,u=n.wordSpacing,h=n.fontDirection,d=n.textHScale*h,f=e.length,m=s.vertical,y=m?1:-1,v=s.defaultVMetrics,p=a*n.fontMatrix[0],g=n.textRenderingMode===Pt.FILL&&!s.disableFontFace&&!n.patternFill;o.save(),n.textMatrix&&o.transform(...n.textMatrix),o.translate(n.x,n.y+n.textRise),h>0?o.scale(d,-1):o.scale(d,1);let b,A,S=n.textRenderingMode&Pt.FILL_STROKE_MASK,E=S===Pt.FILL||S===Pt.FILL_STROKE,T=S===Pt.STROKE||S===Pt.FILL_STROKE,w=n.lineWidth,_=n.textMatrixScale;if(_===0||w===0?T&&(w=this.getSinglePixelWidth()):w/=_,l!==1&&(o.scale(l,l),w/=l),o.lineWidth=w,E&&n.patternFill){o.save();let N=n.fillColor.getPattern(o,this,$e(o),Yt.FILL,t);b=ut(o),o.restore(),o.fillStyle=N}if(T&&n.patternStroke){o.save();let N=n.strokeColor.getPattern(o,this,$e(o),Yt.STROKE,t);A=ut(o),o.restore(),o.strokeStyle=N}if(s.isInvalidPDFjsFont){let N=[],z=0;for(let lt of e)N.push(lt.unicode),z+=lt.width;let X=N.join("");if(o.fillText(X,0,0),this.dependencyTracker!==null){let lt=o.measureText(X);this.dependencyTracker.recordBBox(t,this.ctx,-lt.actualBoundingBoxLeft,lt.actualBoundingBoxRight,-lt.actualBoundingBoxAscent,lt.actualBoundingBoxDescent).recordShowTextOperation(t)}n.x+=z*p*d,o.restore(),this.compose(),this.#f(r);return}let C=0,D;for(D=0;D<f;++D){let N=e[D];if(typeof N=="number"){C+=y*N*a/1e3;continue}let z=!1,X=(N.isSpace?u:0)+c,lt=N.fontChar,k=N.accent,R,kt,Lt=N.width;if(m){let at=N.vmetric||v,rt=-(N.vmetric?at[1]:Lt*.5)*p,G=at[2]*p;Lt=at?-at[0]:Lt,R=rt/l,kt=(C+G)/l}else R=C/l,kt=0;let Pe;if(s.remeasure&&Lt>0){Pe=o.measureText(lt);let at=Pe.width*1e3/a*l;if(Lt<at&&this.isFontSubpixelAAEnabled){let rt=Lt/at;z=!0,o.save(),o.scale(rt,1),R/=rt}else Lt!==at&&(R+=(Lt-at)/2e3*a/l)}if(this.contentVisible&&(N.isInFont||s.missingFile)){if(g&&!k)o.fillText(lt,R,kt),this.dependencyTracker?.recordCharacterBBox(t,o,Pe?{bbox:null}:s,a/l,R,kt,()=>Pe??o.measureText(lt));else if(this.paintChar(t,lt,R,kt,b,A),k){let at=R+a*k.offset.x/l,rt=kt-a*k.offset.y/l;this.paintChar(t,k.fontChar,at,rt,b,A)}}let xi=m?Lt*p-X*h:Lt*p+X*h;C+=xi,z&&o.restore()}m?n.y-=C:n.x+=C*d,o.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(t),this.#f(r)}showType3Text(t,e){let n=this.ctx,s=this.current,a=s.font,r=s.fontSize,o=s.fontDirection,l=a.vertical?1:-1,c=s.charSpacing,u=s.wordSpacing,h=s.textHScale*o,d=s.fontMatrix||td,f=e.length,m=s.textRenderingMode===Pt.INVISIBLE,y,v,p,g;if(m||r===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,n.save(),s.textMatrix&&n.transform(...s.textMatrix),n.translate(s.x,s.y+s.textRise),n.scale(h,o);let b=this.dependencyTracker;for(this.dependencyTracker=b?new yr(b,t):null,y=0;y<f;++y){if(v=e[y],typeof v=="number"){g=l*v*r/1e3,this.ctx.translate(g,0),s.x+=g*h;continue}let A=(v.isSpace?u:0)+c,S=a.charProcOperatorList[v.operatorListId];S?this.contentVisible&&(this.save(),S.fnArray[0]===Ue.setCharWidth&&(s.fillAlpha=s.strokeAlpha=1,n.globalAlpha=1),n.scale(r,r),n.transform(...d),this.executeOperatorList(S),this.restore()):I(`Type3 character "${v.operatorListId}" is not available.`);let E=[v.width,0];M.applyTransform(E,d),p=E[0]*r+A,n.translate(p,0),s.x+=p*h}n.restore(),b&&(this.dependencyTracker=b)}setCharWidth(t,e,n){}setCharWidthAndBounds(t,e,n,s,a,r,o){let l=new Path2D;l.rect(s,a,r-s,o-a),this.ctx.clip(l),this.dependencyTracker?.recordBBox(t,this.ctx,s,r,a,o).recordClipBox(t,this.ctx,s,r,a,o),this.endPath(t)}getColorN_Pattern(t,e){let n;if(e[0]==="TilingPattern"){let s=this.baseTransform||ut(this.ctx),a={createCanvasGraphics:(r,o)=>new i(r,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new yr(this.dependencyTracker,o,!0):null)};n=new or(e,this.ctx,a,s)}else n=this._getPattern(t,e[1],e[2]);return n}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);let n=this.current.fillColor=this.getColorN_Pattern(t,e);this.current.patternFill=!0,this.current.tilingPatternDims=n instanceof or?[0,0,0,0]:null}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,this.current.tilingPatternDims=null}setFillTransparent(t){this.dependencyTracker?.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1,this.current.tilingPatternDims=null}_getPattern(t,e,n=null){let s=this.cachedPatterns.getOrInsertComputed(e,()=>vS(this.getObject(t,e)));return n&&(s.matrix=n),s}shadingFill(t,e){if(!this.contentVisible)return;let n=this.#u(this.current.fillAlpha),s=this.ctx;this.save(t);let a=this._getPattern(t,e);s.fillStyle=a.getPattern(s,this,$e(s),Yt.SHADING,t);let r=$e(s);if(r){let{width:o,height:l}=s.canvas,c=On.slice();M.axialAlignedBoundingBox([0,0,o,l],r,c);let[u,h,d,f]=c;this.ctx.fillRect(u,h,d-u,f-h)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.dependencyTracker?.resetBBox(t).recordFullPageBBox(t).recordDependencies(t,ze.transform).recordDependencies(t,ze.fill).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t),this.#f(n)}beginInlineImage(){Q("Should not call beginInlineImage")}beginImageData(){Q("Should not call beginImageData")}paintFormXObjectBegin(t,e,n){if(this.contentVisible&&(this.save(t),this.baseTransformStack.push(this.baseTransform),e&&this.transform(t,...e),this.baseTransform=ut(this.ctx),n)){M.axialAlignedBoundingBox(n,this.baseTransform,this.current.minMax);let[s,a,r,o]=n,l=new Path2D;l.rect(s,a,r-s,o-a),this.ctx.clip(l),this.dependencyTracker?.recordClipBox(t,this.ctx,s,r,a,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);let{inSMaskMode:n}=this;n&&(this.endSMaskMode(),this.current.activeSMask=null);let s=this.ctx;if((!e.needsIsolation||!e.isolated&&!e.hasSoftMask)&&!e.knockout&&!e.isGray&&this.#t===0&&s.globalAlpha===1&&s.globalCompositeOperation==="source-over"&&!n){if(e.bbox){let A=new Path2D,[S,E,T,w]=e.bbox;if(A.rect(S,E,T-S,w-E),e.matrix){let _=new Path2D;_.addPath(A,new DOMMatrix(e.matrix)),A=_}s.clip(A)}this.groupStack.push(null),this.#l.push(null),this.groupLevel++;return}!e.isolated&&!e.knockout&&this.#t===0&&Kl("TODO: Fully support non-isolated non-knockout groups.");let a=ut(s);e.matrix&&s.transform(...e.matrix);let r=[0,0,s.canvas.width,s.canvas.height],o;e.bbox?(o=On.slice(),M.axialAlignedBoundingBox(e.bbox,ut(s),o),o=M.intersect(o,r)||[0,0,0,0]):o=r;let l=Math.floor(o[0]),c=Math.floor(o[1]),u=Math.max(Math.ceil(o[2])-l,1),h=Math.max(Math.ceil(o[3])-c,1);this.current.startNewPathAndClipBox([0,0,u,h]);let d=this.canvasFactory.create(u,h);e.smask&&this.smaskGroupCanvases.push(d);let f=d.context,m=e.knockout&&!e.isolated?s:null,y=!e.isolated&&!e.knockout&&!e.smask&&e.needsIsolation&&this.#t>0,v=e.knockout?this.canvasFactory.create(u,h):null,p=this.#t;e.knockout?this.#t++:this.#t=0,f.translate(-l,-c),f.transform(...a);let g=!e.isolated&&!e.smask&&e.needsIsolation,b=g&&!n&&p===0&&!e.knockout&&!e.isGray&&e.hasSoftMask&&s.globalAlpha===1&&s.globalCompositeOperation==="source-over"&&this.current.transferMaps==="none";if(g&&(n||b)&&(f.save(),f.setTransform(1,0,0,1,0,0),f.drawImage(s.canvas,-l,-c),f.restore()),e.bbox){let A=new Path2D,[S,E,T,w]=e.bbox;if(A.rect(S,E,T-S,w-E),e.matrix){let _=new Path2D;_.addPath(A,new DOMMatrix(e.matrix)),A=_}f.clip(A)}e.smask&&this.smaskStack.push({canvas:d.canvas,context:f,offsetX:l,offsetY:c,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null}),(!e.smask||this.dependencyTracker)&&(s.setTransform(1,0,0,1,0,0),s.translate(l,c),s.save()),Mn(s,f),this.ctx=f,this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(s),this.setGState(t,[["BM","source-over"],["ca",1],["CA",1],["TR",null]]),this.groupStack.push(s),this.#l.push({backdropCtx:m,savedKnockoutLevel:p,offsetX:l,offsetY:c,hasInnerBackdrop:y,replaceBackdrop:b,knockoutMaskEntry:v,knockoutTempEntry:null,knockoutBackdropEntry:null}),this.groupLevel++}endGroup(t,e){if(!this.contentVisible)return;this.groupLevel--;let n=this.ctx,s=this.groupStack.pop(),a=this.#l.pop();if(a&&(this.#t=a.savedKnockoutLevel),s===null){this.restore(t);return}if(e.isGray&&this.#v(n),this.ctx=s,this.ctx.imageSmoothingEnabled=!1,this.dependencyTracker?.popBaseTransform(),e.smask)this.tempSMask=this.smaskStack.pop(),this.restore(t),this.dependencyTracker&&(this.ctx.restore(),this.inSMaskMode&&this.ctx.setTransform(this.suspendedCtx.getTransform())),this.#y(a);else{this.ctx.restore();let r=ut(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...r);let o=On.slice();M.axialAlignedBoundingBox([0,0,n.canvas.width,n.canvas.height],r,o);let l=this.#l.at(-1);if(this.#t>0)if(a.hasInnerBackdrop){let{width:c,height:u}=n.canvas,h=this.canvasFactory.create(c,u),d=h.context;d.drawImage(s.canvas,a.offsetX,a.offsetY,c,u,0,0,c,u),d.globalCompositeOperation="source-over",d.drawImage(n.canvas,0,0);let f=this.#p(n.canvas);d.globalCompositeOperation="destination-in",d.drawImage(f.canvas,0,0);let m=this.ctx.globalCompositeOperation,y=this.ctx.globalAlpha,v=this.ctx.filter;this.ctx.save(),this.ctx.setTransform(...r),this.ctx.globalAlpha=1,J.isCanvasFilterSupported&&(this.ctx.filter="none"),this.ctx.globalCompositeOperation="destination-out",this.ctx.drawImage(f.canvas,0,0),this.ctx.globalCompositeOperation=m,this.ctx.globalAlpha=y,J.isCanvasFilterSupported&&(this.ctx.filter=v??"none"),this.ctx.drawImage(h.canvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(f),this.canvasFactory.destroy(h)}else{let c=l?.backdropCtx??null;this.#g(this.ctx,n.canvas,{backdropCanvas:c?.canvas??null,destTransform:r,backdropOffset:c?[l.offsetX+a.offsetX,l.offsetY+a.offsetY]:[0,0],sourceAlpha:this.ctx.globalAlpha,sourceFilter:this.ctx.filter})}else{if(a.replaceBackdrop){let c=new Path2D;c.rect(0,0,n.canvas.width,n.canvas.height),this.ctx.clip(c),this.ctx.globalCompositeOperation="copy"}this.ctx.drawImage(n.canvas,0,0)}this.ctx.restore(),this.canvasFactory.destroy({canvas:n.canvas,context:n}),this.#y(a),this.compose(o)}}#v(t){let{canvas:e}=t,{width:n,height:s}=e;if(J.isCanvasFilterSupported){t.save(),t.setTransform(1,0,0,1,0,0),t.filter="grayscale(1)",t.globalAlpha=1,t.globalCompositeOperation="copy",t.drawImage(e,0,0),t.restore();return}let a=t.getImageData(0,0,n,s),{data:r}=a;for(let o=0,l=r.length;o<l;o+=4){let c=r[o]*.2126+r[o+1]*.7152+r[o+2]*.0722+.5|0;r[o]=r[o+1]=r[o+2]=c}t.putImageData(a,0,0)}#y(t){t&&(t.knockoutMaskEntry&&(this.canvasFactory.destroy(t.knockoutMaskEntry),t.knockoutMaskEntry=null),t.knockoutTempEntry&&(this.canvasFactory.destroy(t.knockoutTempEntry),t.knockoutTempEntry=null),t.knockoutBackdropEntry&&(this.canvasFactory.destroy(t.knockoutBackdropEntry),t.knockoutBackdropEntry=null))}beginAnnotation(t,e,n,s,a,r,o){if(this.#d(),dl(this.ctx),this.ctx.save(),this.save(t),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),n){let l=n[2]-n[0],c=n[3]-n[1];if(r&&this.annotationCanvasMap){s=s.slice(),s[4]-=n[0],s[5]-=n[1],n=n.slice(),n[0]=n[1]=0,n[2]=l,n[3]=c,M.singularValueDecompose2dScale(ut(this.ctx),Ee);let{viewportScale:u}=this,h=Math.ceil(l*this.outputScaleX*u),d=Math.ceil(c*this.outputScaleY*u);this.annotationCanvas=this.canvasFactory.create(h,d);let{canvas:f,context:m}=this.annotationCanvas;if(o){let y=this.annotationCanvasMap.getOrInsertComputed(e,Ys);f.setAttribute("data-canvas-name",o);let v=y.findIndex(p=>p.getAttribute("data-canvas-name")===o);v===-1?y.push(f):y[v]=f}else this.annotationCanvasMap.set(e,f);this.annotationCanvas.savedCtx=this.ctx,this.ctx=m,this.ctx.save(),this.ctx.setTransform(Ee[0],0,0,-Ee[1],0,c*Ee[1]),dl(this.ctx)}else{dl(this.ctx),this.endPath(t);let u=new Path2D;u.rect(n[0],n[1],l,c),this.ctx.clip(u)}}this.current=new Ml(this.ctx.canvas.width,this.ctx.canvas.height),this.baseTransformStack.push(this.baseTransform),this.transform(t,...s),this.transform(t,...a),this.baseTransform=ut(this.ctx)}endAnnotation(t){this.annotationCanvas&&(this.ctx.restore(),this.#h(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas),this.baseTransform=this.baseTransformStack.pop()}paintImageMaskXObject(t,e){if(!this.contentVisible)return;let n=e.count;e=this.getObject(t,e.data,e),e.count=n;let s=this.#u(this.current.fillAlpha),a=this.ctx,r=this._createMaskCanvas(t,e),o=r.canvas;a.save(),a.setTransform(1,0,0,1,0,0),a.drawImage(o,r.offsetX,r.offsetY),this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,r.offsetX,r.offsetX+o.width,r.offsetY,r.offsetY+o.height).recordOperation(t),a.restore(),r.canvasEntry&&this.canvasFactory.destroy(r.canvasEntry),this.compose(),this.#f(s)}paintImageMaskXObjectRepeat(t,e,n,s=0,a=0,r,o){if(!this.contentVisible)return;e=this.getObject(t,e.data,e);let l=this.#u(this.current.fillAlpha),c=this.ctx;c.save();let u=ut(c);c.transform(n,s,a,r,0,0);let h=this._createMaskCanvas(t,e);c.setTransform(1,0,0,1,h.offsetX-u[4],h.offsetY-u[5]),this.dependencyTracker?.resetBBox(t);for(let d=0,f=o.length;d<f;d+=2){let m=M.transform(u,[n,s,a,r,o[d],o[d+1]]);c.drawImage(h.canvas,m[4],m[5]),this.dependencyTracker?.recordBBox(t,this.ctx,m[4],m[4]+h.canvas.width,m[5],m[5]+h.canvas.height)}c.restore(),h.canvasEntry&&this.canvasFactory.destroy(h.canvasEntry),this.compose(),this.dependencyTracker?.recordOperation(t),this.#f(l)}paintImageMaskXObjectGroup(t,e){if(!this.contentVisible)return;let n=this.#u(this.current.fillAlpha),s=this.ctx,a=this.current.fillColor,r=this.current.patternFill;this.dependencyTracker?.resetBBox(t).recordDependencies(t,ze.transformAndFill);for(let o of e){let{data:l,width:c,height:u,transform:h}=o,d=this.canvasFactory.create(c,u),f=d.context;f.save();let m=this.getObject(t,l,o);sb(f,m),f.globalCompositeOperation="source-in",f.fillStyle=r?a.getPattern(f,this,$e(s),Yt.FILL,t):a,f.fillRect(0,0,c,u),f.restore(),s.save(),s.transform(...h),s.scale(1,-1),hl(s,d.canvas,0,0,c,u,0,-1,1,1),this.canvasFactory.destroy(d),this.dependencyTracker?.recordBBox(t,s,0,c,0,u),s.restore()}this.compose(),this.dependencyTracker?.recordOperation(t),this.#f(n)}paintImageXObject(t,e){if(!this.contentVisible)return;let n=this.getObject(t,e);if(!n){I("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t,n)}paintImageXObjectRepeat(t,e,n,s,a){if(!this.contentVisible)return;let r=this.getObject(t,e);if(!r){I("Dependent image isn't ready yet");return}let o=r.width,l=r.height,c=[];for(let u=0,h=a.length;u<h;u+=2)c.push({transform:[n,0,0,s,a[u],a[u+1]],x:0,y:0,w:o,h:l});this.paintInlineImageXObjectGroup(t,r,c)}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{img:t.bitmap,canvasEntry:null};let{bitmap:e,width:n,height:s}=t,a=this.canvasFactory.create(n,s),r=a.context;return r.filter=this.current.transferMaps,r.drawImage(e,0,0),r.filter="none",{img:a.canvas,canvasEntry:a}}paintInlineImageXObject(t,e){if(!this.contentVisible)return;let n=e.width,s=e.height,a=this.#u(this.current.fillAlpha),r=this.ctx;this.save(t);let{filter:o}=r;o!=="none"&&o!==""&&(r.filter="none"),r.scale(1/n,-1/s);let l,c=null;if(e.bitmap){let h=this.applyTransferMapsToBitmap(e);l=h.img,c=h.canvasEntry}else{let h=this.canvasFactory.create(n,s);nb(h.context,e),l=this.applyTransferMapsToCanvas(h.context),c=h}let u=this._scaleImage(l,$e(r));r.imageSmoothingEnabled=ab(ut(r),e.interpolate),this.dependencyTracker&&(this.dependencyTracker.resetBBox(t).recordBBox(t,r,0,n,-s,0).recordDependencies(t,ze.imageXObject).recordOperation(t),this.imagesTracker?.record(r,n,s,this.dependencyTracker.clipBox)),hl(r,u.img,0,0,u.paintWidth,u.paintHeight,0,-s,n,s),u.tmpCanvas&&this.canvasFactory.destroy(u.tmpCanvas),c&&this.canvasFactory.destroy(c),this.compose(),this.restore(t),this.#f(a)}paintInlineImageXObjectGroup(t,e,n){if(!this.contentVisible)return;let s=this.#u(this.current.fillAlpha),a=this.ctx,r,o=null;if(e.bitmap)r=e.bitmap;else{let l=e.width,c=e.height,u=this.canvasFactory.create(l,c);nb(u.context,e),r=this.applyTransferMapsToCanvas(u.context),o=u}this.dependencyTracker?.resetBBox(t);for(let l of n)a.save(),a.transform(...l.transform),a.scale(1,-1),hl(a,r,l.x,l.y,l.w,l.h,0,-1,1,1),this.dependencyTracker?.recordBBox(t,a,0,1,-1,0),a.restore();o&&this.canvasFactory.destroy(o),this.dependencyTracker?.recordOperation(t),this.compose(),this.#f(s)}paintSolidColorImageMask(t){if(!this.contentVisible)return;let e=this.#u(this.current.fillAlpha);this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,0,1,0,1).recordDependencies(t,ze.fill).recordOperation(t),this.ctx.fillRect(0,0,1,1),this.compose(),this.#f(e)}markPoint(t,e){}markPointProps(t,e,n){}beginMarkedContent(t,e){this.dependencyTracker?.beginMarkedContent(t),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e,n){this.dependencyTracker?.beginMarkedContent(t),e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(n)}):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,n){let s=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(n);let a=this.ctx;this.pendingClip?(s||(this.pendingClip===rb?a.clip(e,"evenodd"):a.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=ut(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]),n=Math.hypot(t[0],t[2]),s=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(n,s)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){let{lineWidth:t}=this.current,{a:e,b:n,c:s,d:a}=this.ctx.getTransform(),r,o;if(n===0&&s===0){let l=Math.abs(e),c=Math.abs(a);if(l===c)if(t===0)r=o=1/l;else{let u=l*t;r=o=u<1?1/u:1}else if(t===0)r=1/l,o=1/c;else{let u=l*t,h=c*t;r=u<1?1/u:1,o=h<1?1/h:1}}else{let l=Math.abs(e*a-n*s),c=Math.hypot(e,n),u=Math.hypot(s,a);if(t===0)r=u/l,o=c/l;else{let h=t*l;r=u>h?u/h:1,o=c>h?c/h:1}}this._cachedScaleForStroking[0]=r,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t,e){let{ctx:n,current:{lineWidth:s}}=this,[a,r]=this.getScaleForStroking();if(a===r){n.lineWidth=(s||1)*a,n.stroke(t);return}let o=n.getLineDash();e&&n.save(),n.scale(a,r),Zh.a=1/a,Zh.d=1/r;let l=new Path2D;if(l.addPath(t,Zh),o.length>0){let c=Math.max(a,r);n.setLineDash(o.map(u=>u/c)),n.lineDashOffset/=c}n.lineWidth=s||1,n.stroke(l),e&&n.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};for(let i in Ue)zs.prototype[i]!==void 0&&(zs.prototype[Ue[i]]=zs.prototype[i]);Us=class{#t=null;#e=null;_fullReader=null;_rangeReaders=new Set;_source=null;constructor(t,e,n){this._source=t,this.#t=e,this.#e=n}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return Et(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new this.#t(this)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let n=new this.#e(this,t,e);return this._rangeReaders.add(n),n}cancelAllRequests(t){this._fullReader?.cancel(t);for(let e of new Set(this._rangeReaders))e.cancel(t)}},Gs=class{onProgress=null;_contentLength=0;_filename=null;_headersCapability=Promise.withResolvers();_isRangeSupported=!1;_isStreamingSupported=!1;_loaded=0;_stream=null;constructor(t){this._stream=t}_callOnProgress(){this.onProgress?.({loaded:this._loaded,total:this._contentLength})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){Q("Abstract method `read` called")}cancel(t){Q("Abstract method `cancel` called")}},js=class{_stream=null;constructor(t,e,n){this._stream=t}async read(){Q("Abstract method `read` called")}cancel(t){Q("Abstract method `cancel` called")}};Pd=class extends Us{_responseOrigin=null;constructor(t){super(t,Id,Fd);let{httpHeaders:e,url:n}=t;Et(/https?:/.test(n.protocol),"PDFFetchStream only supports http(s):// URLs."),this.headers=_b(!0,e)}},Id=class extends Gs{_abortController=new AbortController;_reader=null;constructor(t){super(t);let{disableRange:e,disableStream:n,rangeChunkSize:s,url:a,withCredentials:r}=t._source;this._isStreamingSupported=!n;let o=new Headers(t.headers);Db(a,o,r,this._abortController).then(l=>{t._responseOrigin=tc(l.url),Ob(l.status,a),this._reader=l.body.getReader();let c=l.headers,{contentLength:u,isRangeSupported:h}=xb({responseHeaders:c,isHttp:!0,rangeChunkSize:s,disableRange:e});this._contentLength=u,this._isRangeSupported=h,this._filename=Cb(c),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Ge("Streaming is disabled.")),this._headersCapability.resolve()}).catch(this._headersCapability.reject)}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._callOnProgress(),{value:ic(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}},Fd=class extends js{_abortController=new AbortController;_readCapability=Promise.withResolvers();_reader=null;constructor(t,e,n){super(t,e,n);let{url:s,withCredentials:a}=t._source,r=new Headers(t.headers);r.append("Range",`bytes=${e}-${n-1}`),Db(s,r,a,this._abortController).then(o=>{let l=tc(o.url);Mb(l,t._responseOrigin),Ob(o.status,s),this._reader=o.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:{value:ic(t),done:!1}}cancel(t){this._reader?.cancel(t),this._abortController.abort()}};Hd=class extends Us{_progressiveDone=!1;_queuedChunks=[];constructor(t){super(t,Ud,Gd);let{pdfDataRangeTransport:e}=t,{initialData:n,progressiveDone:s}=e;if(n?.length>0){let r=ob(n);this._queuedChunks.push(r)}this._progressiveDone=s;let a=r=>{switch(r.type){case"range":case"progressiveRead":this.#t(r.begin,r.chunk);break;case"progressiveDone":this._fullReader?.progressiveDone(),this._progressiveDone=!0;break}};e.transportReady(a)}#t(t,e){let n=ob(e);if(t===void 0)this._fullReader?this._fullReader._enqueue(n):this._queuedChunks.push(n);else{let s=this._rangeReaders.keys().find(a=>a._begin===t);Et(s,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),s._enqueue(n)}}getFullReader(){let t=super.getFullReader();return this._queuedChunks=null,t}getRangeReader(t,e){let n=super.getRangeReader(t,e);return n&&(n.onDone=()=>this._rangeReaders.delete(n),this._source.pdfDataRangeTransport.requestDataRange(t,e)),n}cancelAllRequests(t){super.cancelAllRequests(t),this._source.pdfDataRangeTransport.abort()}},Ud=class extends Gs{#t=nc.bind(this);_done=!1;_queuedChunks=null;_requests=[];constructor(t){super(t);let{pdfDataRangeTransport:e,disableRange:n,disableStream:s}=t._source,{length:a,contentDispositionFilename:r}=e;this._queuedChunks=t._queuedChunks||[];for(let l of this._queuedChunks)this._loaded+=l.byteLength;this._done=t._progressiveDone,this._contentLength=a,this._isStreamingSupported=!s,this._isRangeSupported=!n,Zl(r)&&(this._filename=r),this._headersCapability.resolve();let o=this._loaded;Promise.resolve().then(()=>{o>0&&this._loaded===o&&this._callOnProgress()})}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength,this._callOnProgress())}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this.#t()}progressiveDone(){this._done||=!0,this._queuedChunks.length===0&&this.#t()}},Gd=class extends js{#t=nc.bind(this);onDone=null;_begin=-1;_done=!1;_queuedChunk=null;_requests=[];constructor(t,e,n){super(t,e,n),this._begin=e}_enqueue(t){this._done||(this._requests.length===0?this._queuedChunk=t:(this._requests.shift().resolve({value:t,done:!1}),this.#t()),this._done=!0,this.onDone?.())}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,this.#t(),this.onDone?.()}},Jh=200,lb=206;jd=class extends Us{#t=new WeakMap;_responseOrigin=null;constructor(t){super(t,Vd,Xd);let{httpHeaders:e,url:n}=t;this.url=n,this.isHttp=/https?:/.test(n.protocol),this.headers=_b(this.isHttp,e)}_request(t){let e=new XMLHttpRequest,n={validateStatus:null,onHeadersReceived:t.onHeadersReceived,onDone:t.onDone,onError:t.onError,onProgress:t.onProgress};this.#t.set(e,n),e.open("GET",this.url),e.withCredentials=this._source.withCredentials;for(let[s,a]of this.headers)e.setRequestHeader(s,a);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),n.validateStatus=s=>s===lb||s===Jh):n.validateStatus=s=>s===Jh,e.responseType="arraybuffer",Et(t.onError,"Expected `onError` callback to be provided."),e.onerror=()=>t.onError(e.status),e.onreadystatechange=this.#i.bind(this,e),e.onprogress=this.#e.bind(this,e),e.send(null),e}#e(t,e){this.#t.get(t)?.onProgress?.(e)}#i(t,e){let n=this.#t.get(t);if(!n||(t.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),t.readyState!==4)||!this.#t.has(t))return;if(this.#t.delete(t),t.status===0&&this.isHttp){n.onError(t.status);return}let s=t.status||Jh;if(!n.validateStatus(s)){n.onError(t.status);return}let a=CS(t.response);if(s===lb){let r=t.getResponseHeader("Content-Range");/bytes \d+-\d+\/\d+/.test(r)?n.onDone(a):(I('Missing or invalid "Content-Range" header.'),n.onError(0))}else a?n.onDone(a):n.onError(t.status)}_abortRequest(t){this.#t.has(t)&&(this.#t.delete(t),t.abort())}getRangeReader(t,e){let n=super.getRangeReader(t,e);return n&&(n.onClosed=()=>this._rangeReaders.delete(n)),n}},Vd=class extends Gs{#t=nc.bind(this);_cachedChunks=[];_done=!1;_requests=[];_storedError=null;constructor(t){super(t),this._fullRequestXhr=t._request({onHeadersReceived:this.#e.bind(this),onDone:this.#i.bind(this),onError:this.#n.bind(this),onProgress:this.#s.bind(this)})}#e(){let t=this._stream,{disableRange:e,rangeChunkSize:n}=t._source,s=this._fullRequestXhr;t._responseOrigin=tc(s.responseURL);let a=s.getAllResponseHeaders(),r=new Headers(a?a.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(c=>{let[u,...h]=c.split(": ");return[u,h.join(": ")]}):[]),{contentLength:o,isRangeSupported:l}=xb({responseHeaders:r,isHttp:t.isHttp,rangeChunkSize:n,disableRange:e});this._contentLength=o,this._isRangeSupported=l,this._filename=Cb(r),this._isRangeSupported&&t._abortRequest(s),this._headersCapability.resolve()}#i(t){this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._cachedChunks.push(t),this._done=!0,this._cachedChunks.length===0&&this.#t()}#n(t){this._storedError=ec(t,this._stream.url),this._headersCapability.reject(this._storedError);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}#s(t){this.onProgress?.({loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}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),this.#t(),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}},Xd=class extends js{#t=nc.bind(this);onClosed=null;_done=!1;_queuedChunk=null;_requests=[];_storedError=null;constructor(t,e,n){super(t,e,n),this._requestXhr=t._request({begin:e,end:n,onHeadersReceived:this.#e.bind(this),onDone:this.#i.bind(this),onError:this.#n.bind(this),onProgress:null})}#e(){let t=tc(this._requestXhr?.responseURL);try{Mb(t,this._stream._responseOrigin)}catch(e){this._storedError=e,this.#n(0)}}#i(t){this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0,this.#t(),this.onClosed?.()}#n(t){this._storedError??=ec(t,this._stream.url);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}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,this.#t(),this._stream._abortRequest(this._requestXhr),this.onClosed?.()}};Yd=class extends Us{constructor(t){super(t,qd,Kd);let{url:e}=t;Et(e.protocol==="file:","PDFNodeStream only supports file:// URLs.")}},qd=class extends Gs{_reader=null;constructor(t){super(t);let{disableRange:e,disableStream:n,rangeChunkSize:s,url:a}=t._source;this._isStreamingSupported=!n,process.getBuiltinModule("fs/promises").lstat(a).then(o=>{let l=Rb(a);this._reader=l.getReader();let{size:c}=o;this._contentLength=c,this._isRangeSupported=!e&&c>2*s,!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Ge("Streaming is disabled.")),this._headersCapability.resolve()}).catch(o=>{o.code==="ENOENT"&&(o=ec(0,a)),this._headersCapability.reject(o)})}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._callOnProgress(),{value:ic(t),done:!1})}cancel(t){this._reader?.cancel(t)}},Kd=class extends js{_readCapability=Promise.withResolvers();_reader=null;constructor(t,e,n){super(t,e,n);let{url:s}=t._source;try{let a=Rb(s,{start:e,end:n-1});this._reader=a.getReader(),this._readCapability.resolve()}catch(a){this._readCapability.reject(a)}}async read(){await this._readCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:{value:ic(t),done:!1}}cancel(t){this._reader?.cancel(t)}};sn=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}},Wd=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()}},Dn=Symbol("INTERNAL"),Qd=class{#t=!1;#e=!1;#i=!1;#n=!0;constructor(t,{name:e,intent:n,usage:s,rbGroups:a}){this.#t=!!(t&Ae.DISPLAY),this.#e=!!(t&Ae.PRINT),this.name=e,this.intent=n,this.usage=s,this.rbGroups=a}get visible(){if(this.#i)return this.#n;if(!this.#n)return!1;let{print:t,view:e}=this.usage;return this.#t?e?.viewState!=="OFF":this.#e?t?.printState!=="OFF":!0}_setVisible(t,e,n=!1){t!==Dn&&Q("Internal method `_setVisible` called."),this.#i=n,this.#n=e}get serializable(){return{userSet:this.#i,visible:this.#n}}},$d=class i{#t=null;#e=new Map;#i=null;#n=null;#s;creator=null;name=null;constructor(t,e=Ae.DISPLAY,n=null){if(this.#s=t,this.renderingIntent=e,t!==null){this.name=t.name,this.creator=t.creator,this.#n=t.order;for(let s of t.groups)this.#e.set(s.id,new Qd(e,s));if(n){n.size!==this.#e.size&&Q("Incorrect serialized groupState.");for(let[s,a]of n)this.#e.get(s)._setVisible(Dn,a.visible,a.userSet)}else{if(t.baseState==="OFF")for(let s of this.#e.values())s._setVisible(Dn,!1);for(let s of t.on)this.#e.get(s)._setVisible(Dn,!0);for(let s of t.off)this.#e.get(s)._setVisible(Dn,!1)}this.#i=this.getHash()}}#r(t){let e=t.length;if(e<2)return!0;let n=t[0];for(let s=1;s<e;s++){let a=t[s],r;if(Array.isArray(a))r=this.#r(a);else if(this.#e.has(a))r=this.#e.get(a).visible;else return I(`Optional content group not found: ${a}`),!0;switch(n){case"And":if(!r)return!1;break;case"Or":if(r)return!0;break;case"Not":return!r;default:return!0}}return n==="And"}isVisible(t){if(this.#e.size===0)return!0;if(!t)return Kl("Optional content group not defined."),!0;if(t.type==="OCG")return this.#e.has(t.id)?this.#e.get(t.id).visible:(I(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return this.#r(t.expression);if(!t.policy||t.policy==="AnyOn"){for(let e of t.ids){if(!this.#e.has(e))return I(`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 I(`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 I(`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 I(`Optional content group not found: ${e}`),!0;if(this.#e.get(e).visible)return!1}return!0}return I(`Unknown optional content policy ${t.policy}.`),!0}return I(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,n=!0){let s=this.#e.get(t);if(!s){I(`Optional content group not found: ${t}`);return}if(n&&e&&s.rbGroups.length)for(let a of s.rbGroups)for(let r of a)r!==t&&this.#e.get(r)?._setVisible(Dn,!1,!0);s._setVisible(Dn,!!e,!0),this.#t=null}setOCGState({state:t,preserveRB:e}){let n;for(let s of t){switch(s){case"ON":case"OFF":case"Toggle":n=s;continue}let a=this.#e.get(s);if(a)switch(n){case"ON":this.setVisibility(s,!0,e);break;case"OFF":this.setVisibility(s,!1,e);break;case"Toggle":this.setVisibility(s,!a.visible,e);break}}this.#t=null}get hasInitialVisibility(){return this.#i===null||this.getHash()===this.#i}getOrder(){return this.#e.size?this.#n?this.#n.slice():[...this.#e.keys()]:null}getGroup(t){return this.#e.get(t)||null}getHash(){if(this.#t!==null)return this.#t;let t=new pr;for(let[e,n]of this.#e)t.update(`${e}:${n.visible}`);return this.#t=t.hexdigest()}[Symbol.iterator](){return this.#e.entries()}get serializable(){let t=new Map;for(let[e,n]of this.#e)t.set(e,n.serializable);return{data:this.#s,renderingIntent:this.renderingIntent,groupState:t}}static fromSerializable({data:t,renderingIntent:e,groupState:n}){return new i(t,e,n)}},Zd=class{#t=null;#e=null;#i=0;#n=null;#s=null;get pagesNumber(){return this.#i}set pagesNumber(t){this.#i!==t&&(this.#i=t,this.#t=null,this.#e=null)}#r(){if(this.#t)return;let t=this.#i,e=this.#t=new Uint32Array(t);for(let n=0;n<t;n++)e[n]=n+1;this.#e=new Int32Array(e)}#a(){let t=new Map,e=this.#t;for(let n=0,s=this.#i;n<s;n++){let a=e[n],r=t.get(a);r?r.push(n+1):t.set(a,[n+1])}return t}movePages(t,e,n){this.#r();let s=this.#t,a=this.#a(),r=e.length,o=new Uint32Array(r),l=0;for(let d=0;d<r;d++){let f=e[d]-1;o[d]=s[f],f<n&&l++}let c=this.#i,u=c-r,h=ht(n-l,0,u);for(let d=0,f=0;d<c;d++)t.has(d+1)||(s[f++]=s[d]);s.copyWithin(h+r,h,u),s.set(o,h),this.#o(a),s.every((d,f)=>d===f+1)&&(this.#t=null)}deletePages(t){this.#r();let e=this.#t,n=this.#a();this.#s={pageNumberToId:e.slice(),pagesNumber:this.#i,prevPageNumbers:this.#e.slice()};let s=this.#i-t.length;this.#i=s;let a=this.#t=new Uint32Array(s);this.#e=new Int32Array(s);let r=0,o=0;for(let l of t){let c=l-1;c!==r&&(a.set(e.subarray(r,c),o),o+=c-r),r=c+1}r<e.length&&a.set(e.subarray(r),o),this.#o(n,new Set(t))}cancelDelete(){this.#s&&(this.#t=this.#s.pageNumberToId,this.#i=this.#s.pagesNumber,this.#e=this.#s.prevPageNumbers,this.#s=null)}cleanSavedData(){this.#s=null}copyPages(t){this.#r(),this.#n={pageNumbers:t,pageIds:t.map(e=>this.#t[e-1])}}cancelCopy(){this.#n=null}pastePages(t){this.#r();let e=this.#t,n=this.#a(),{pageNumbers:s,pageIds:a}=this.#n,r=this.#i+s.length;this.#i=r;let o=this.#t=new Uint32Array(r);this.#e=new Int32Array(r),o.set(e.subarray(0,t),0),o.set(a,t),o.set(e.subarray(t),t+s.length),this.#o(n,null,t,s),this.#n=null}#o(t,e=null,n=-1,s=null){let a=this.#e,r=this.#t,o=n+(s?.length??0),l=new Map;for(let c=0,u=this.#i;c<u;c++){if(c>=n&&c<o){a[c]=-s[c-n];continue}let h=r[c],d=t.get(h),f=l.get(h)||0;if(e&&d)for(;f<d.length&&e.has(d[f]);)f++;a[c]=d?.[f],l.set(h,f+1)}}hasBeenAltered(){return this.#t!==null}getPageMappingForSaving(t=null){t??=this.#a();let e=0;for(let s of t.values())e=Math.max(e,s.length);let n=new Array(e);for(let s=0;s<e;s++)n[s]={document:null,pageIndices:[],includePages:[]};for(let[s,a]of t)for(let r=0,o=a.length;r<o;r++)n[r].includePages.push([s-1,a[r]-1]);for(let{includePages:s,pageIndices:a}of n){s.sort((r,o)=>r[0]-o[0]);for(let r=0,o=s.length;r<o;r++)a.push(s[r][1]),s[r]=s[r][0]}return n}extractPages(t){t=Array.from(t).sort((n,s)=>n-s);let e=new Map;for(let n=0,s=t.length;n<s;n++){let a=this.getPageId(t[n]);e.getOrInsertComputed(a,Ys).push(n+1)}return this.getPageMappingForSaving(e)}getPrevPageNumber(t){return this.#e?.[t-1]??0}getPageNumber(t){if(!this.#t)return t;let e=this.#t;for(let n=0,s=this.#i;n<s;n++)if(e[n]===t)return n+1;return 0}getPageId(t){return this.#t?.[t-1]??t}getMapping(){return this.#t?.subarray(0,this.pagesNumber)}},ks=Symbol("INITIAL_DATA"),cb=()=>({...Promise.withResolvers(),data:ks}),Dl=class{#t=new Map;get(t,e=null){if(e){let s=this.#t.getOrInsertComputed(t,cb);return s.promise.then(()=>e(s.data)),null}let n=this.#t.get(t);if(!n||n.data===ks)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return n.data}has(t){let e=this.#t.get(t);return!!e&&e.data!==ks}delete(t){let e=this.#t.get(t);return!e||e.data===ks?!1:(this.#t.delete(t),!0)}resolve(t,e=null){let n=this.#t.getOrInsertComputed(t,cb);if(n.data!==ks)throw new Error(`Object already resolved ${t}.`);n.data=e,n.resolve()}clear(){for(let{data:t}of this.#t.values())t?.bitmap?.close();this.#t.clear()}*[Symbol.iterator](){for(let[t,{data:e}]of this.#t)e!==ks&&(yield[t,e])}},DS=1e5,ub=30,Vs=class i{#t=Promise.withResolvers();#e=null;#i=!1;#n=!!globalThis.FontInspector?.enabled;#s=null;#r=null;#a=null;#o=0;#c=0;#l=null;#d=null;#h=0;#p=0;#m=Object.create(null);#g=[];#u=null;#f=[];#b=new WeakMap;#v=null;static#y=new Map;static#E=new Map;static#w=new WeakMap;static#A=null;static#_=new Set;constructor({textContentSource:t,images:e,container:n,viewport:s}){if(t instanceof ReadableStream)this.#u=t;else if(typeof t=="object")this.#u=new ReadableStream({start(c){c.enqueue(t),c.close()}});else throw new Error('No "textContentSource" parameter specified.');this.#e=this.#d=n,this.#s=e,this.#p=s.scale*Je.pixelRatio,this.#h=s.rotation,this.#a={div:null,properties:null,ctx:null};let{pageWidth:a,pageHeight:r,pageX:o,pageY:l}=s.rawDims;this.#v=[1,0,0,-1,-o,l+r],this.#c=a,this.#o=r,i.#k(),n.style.setProperty("--min-font-size",i.#A),an(n,s),this.#t.promise.finally(()=>{i.#_.delete(this),this.#a=null,this.#m=null}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:t,isFirefox:e}=J.platform;return L(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){this.#s&&this.#e.append(this.#s.render());let t=()=>{this.#l.read().then(({value:e,done:n})=>{if(n){this.#t.resolve();return}this.#r??=e.lang,Object.assign(this.#m,e.styles),this.#T(e.items),t()},this.#t.reject)};return this.#l=this.#u.getReader(),i.#_.add(this),t(),this.#t.promise}update({viewport:t,onBefore:e=null}){let n=t.scale*Je.pixelRatio,s=t.rotation;if(s!==this.#h&&(e?.(),this.#h=s,an(this.#d,{rotation:s})),n!==this.#p){e?.(),this.#p=n;let a={div:null,properties:null,ctx:i.#O(this.#r)};for(let r of this.#f)a.properties=this.#b.get(r),a.div=r,this.#D(a)}}cancel(){let t=new Ge("TextLayer task cancelled.");this.#l?.cancel(t).catch(()=>{}),this.#l=null,this.#t.reject(t)}get textDivs(){return this.#f}get textContentItemsStr(){return this.#g}#T(t){if(this.#i)return;this.#a.ctx??=i.#O(this.#r);let e=this.#f,n=this.#g;for(let s of t){if(e.length>DS){I("Ignoring additional textDivs for performance reasons."),this.#i=!0;return}if(s.str===void 0){if(s.type==="beginMarkedContentProps"||s.type==="beginMarkedContent"){let a=this.#e;this.#e=document.createElement("span"),this.#e.classList.add("markedContent"),s.id&&this.#e.setAttribute("id",s.id),s.tag==="Artifact"&&(this.#e.ariaHidden=!0),a.append(this.#e)}else s.type==="endMarkedContent"&&(this.#e=this.#e.parentNode);continue}n.push(s.str),this.#C(s)}}#C(t){let e=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};this.#f.push(e);let s=M.transform(this.#v,t.transform),a=Math.atan2(s[1],s[0]),r=this.#m[t.fontName];r.vertical&&(a+=Math.PI/2);let o=this.#n&&r.fontSubstitution||r.fontFamily;o=i.fontFamilyMap.get(o)||o;let l=Math.hypot(s[2],s[3]),c=l*i.#L(o,r,this.#r),u,h;a===0?(u=s[4],h=s[5]-c):(u=s[4]+c*Math.sin(a),h=s[5]-c*Math.cos(a));let d=e.style;d.left=`${(100*u/this.#c).toFixed(2)}%`,d.top=`${(100*h/this.#o).toFixed(2)}%`,d.setProperty("--font-height",`${l.toFixed(2)}px`),d.fontFamily=o,n.fontSize=l,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,this.#n&&(e.dataset.fontName=r.fontSubstitutionLoadedName||t.fontName),a!==0&&(n.angle=a*(180/Math.PI));let f=!1;if(t.str.length>1)f=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){let m=Math.abs(t.transform[0]),y=Math.abs(t.transform[3]);m!==y&&Math.max(m,y)/Math.min(m,y)>1.5&&(f=!0)}if(f&&(n.canvasWidth=r.vertical?t.height:t.width),this.#b.set(e,n),this.#a.div=e,this.#a.properties=n,this.#D(this.#a),n.hasText&&this.#e.append(e),n.hasEOL){let m=document.createElement("br");m.setAttribute("role","presentation"),this.#e.append(m)}}#D(t){let{div:e,properties:n,ctx:s}=t,{style:a}=e;if(n.canvasWidth!==0&&n.hasText){let{fontFamily:r}=a,{canvasWidth:o,fontSize:l}=n;i.#M(s,l*this.#p,r);let{width:c}=s.measureText(e.textContent);c>0&&a.setProperty("--scale-x",o*this.#p/c)}n.angle!==0&&a.setProperty("--rotate",`${n.angle}deg`)}static cleanup(){if(!(this.#_.size>0)){this.#y.clear();for(let{canvas:t}of this.#E.values())t.remove();this.#E.clear()}}static#O(t=null){let e=this.#E.get(t||="");if(!e){let n=document.createElement("canvas");n.style.cssText="position:absolute;top:0;left:0;width:0;height:0;display:none;letter-spacing:normal;word-spacing:normal",n.lang=t,document.body.append(n),e=n.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#E.set(t,e),this.#w.set(e,{size:0,family:""})}return e}static#M(t,e,n){let s=this.#w.get(t);e===s.size&&n===s.family||(t.font=`${e}px ${n}`,s.size=e,s.family=n)}static#k(){if(this.#A!==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.#A=t.getBoundingClientRect().height,t.remove()}static#L(t,e,n){let s=this.#y.get(t);if(s)return s;let a=this.#O(n);a.canvas.width=a.canvas.height=ub,this.#M(a,ub,t);let r=a.measureText(""),o=r.fontBoundingBoxAscent,l=Math.abs(r.fontBoundingBoxDescent);a.canvas.width=a.canvas.height=0;let c=.8;return o?c=o/(o+l):(J.platform.isFirefox&&I("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),e.ascent?c=e.ascent:e.descent&&(c=1+e.descent)),this.#y.set(t,c),c}},OS=100;Jd=class i{static#t=0;_capability=Promise.withResolvers();_setupCapability=Promise.withResolvers();_transport=null;_worker=null;docId=`d${i.#t++}`;destroyed=!1;onPassword=null;onProgress=null;get promise(){return this._capability.promise}async destroy(){this.destroyed=!0,this._capability.promise.catch(()=>{});try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._setupCapability.promise,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()}},vr=class{#t=Promise.withResolvers();#e=null;constructor(t,e,n=!1,s=null){this.length=t,this.initialData=e,this.progressiveDone=n,this.contentDispositionFilename=s}onDataRange(t,e){this.#e({type:"range",begin:t,chunk:e})}onDataProgressiveRead(t){this.#t.promise.then(()=>{this.#e({type:"progressiveRead",chunk:t})})}onDataProgressiveDone(){this.#t.promise.then(()=>{this.#e({type:"progressiveDone"})})}transportReady(t){this.#e=t,this.#t.resolve()}requestDataRange(t,e){Q("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}},tf=class{constructor(t,e){this._pdfInfo=t,this._transport=e}get pagesMapper(){return this._transport.pagesMapper}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return L(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()}getAttachmentContent(t){return this._transport.getAttachmentContent(t)}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()}extractPages(t){return this._transport.extractPages(t)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}getRawData(t){return this._transport.getRawData(t)}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}getSignatures(){return this._transport.getSignatures()}getSignatureData(t){return this._transport.getSignatureData(t)}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}},ef=class i{#t=!1;#e=null;constructor(t,e,n,s,a=!1){this._pageIndex=t,this._pageInfo=e,this._transport=n,this._stats=a?new vl:null,this._pdfBug=a,this.commonObjs=n.commonObjs,this.objs=new Dl,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,this.#e=s,this.imageCoordinates=null}clone(t){let e=new i(t,this._pageInfo,this._transport,this.#e,this._pdfBug);return e.clonedFromIndex=this.clonedFromIndex??this._pageIndex,this._transport.updatePage(e),e}get pageNumber(){return this._pageIndex+1}set pageNumber(t){this._pageIndex=t-1,this._transport.updatePage(this)}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:n=0,offsetY:s=0,dontFlip:a=!1}={}){return new ur({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:n,offsetY:s,dontFlip:a})}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 L(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:t,canvas:e=t.canvas,viewport:n,intent:s="display",annotationMode:a=Si.ENABLE,transform:r=null,background:o=null,optionalContentConfigPromise:l=null,annotationCanvasMap:c=null,pageColors:u=null,printAnnotationStorage:h=null,isEditing:d=!1,recordImages:f=!1,recordOperations:m=!1,operationsFilter:y=null}){this._stats?.time("Overall");let v=this._transport.getRenderingIntent(s,a,h,d),{renderingIntent:p,cacheKey:g}=v;this.#t=!1,l||=this._transport.getOptionalContentConfig(p);let b=this._intentStates.getOrInsertComputed(g,bl);b.streamReaderCancelTimeout&&(clearTimeout(b.streamReaderCancelTimeout),b.streamReaderCancelTimeout=null);let A=!!(p&Ae.PRINT);b.displayReadyCapability||(b.displayReadyCapability=Promise.withResolvers(),b.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(v));let S=!!(this._pdfBug&&globalThis.StepperManager?.enabled),E=!!e&&!this.recordedBBoxes&&(m||S),T=!!e&&!this.imageCoordinates&&f,w=z=>{if(b.renderTasks.delete(D),E){let X=D.gfx?.dependencyTracker.take();X&&(D.stepper?.setOperatorBBoxes(X,D.gfx.dependencyTracker.takeDebugMetadata()),m&&(this.recordedBBoxes=X))}T&&!z&&(this.imageCoordinates=D.gfx?.imagesTracker.take()),A&&(this.#t=!0),this.#i(),z?(D.capability.reject(z),this._abortOperatorList({intentState:b,reason:z instanceof Error?z:new Error(z)})):D.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},_=null,C=null;(E||T)&&(C=new pd(e,b.operatorList.length)),E&&(_=new gd(C,S));let D=new af({callback:w,params:{canvas:e,canvasContext:t,dependencyTracker:_??C,imagesTracker:T?new md(e):null,viewport:n,transform:r,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:b.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!A,pdfBug:this._pdfBug,pageColors:u,enableHWA:this._transport.enableHWA,operationsFilter:y});(b.renderTasks||=new Set).add(D);let N=D.task;return Promise.all([b.displayReadyCapability.promise,l]).then(([z,X])=>{if(this.destroyed){w();return}if(this._stats?.time("Rendering"),!(X.renderingIntent&p))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");D.initializeGraphics({transparency:z,optionalContentConfig:X}),D.operatorListChanged()}).catch(w),N}getOperatorList({intent:t="display",annotationMode:e=Si.ENABLE,printAnnotationStorage:n=null,isEditing:s=!1}={}){function a(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}let r=this._transport.getRenderingIntent(t,e,n,s,!0),o=this._intentStates.getOrInsertComputed(r.cacheKey,bl),l;return o.opListReadCapability||(l=Object.create(null),l.operatorListChanged=a,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",{pageId:this.#e.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:e===!0},{highWaterMark:100,size(s){return s.items.length}})}async getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(s=>hr.textContent(s));let e=this.streamTextContent(t),n={items:[],styles:Object.create(null),lang:null};for await(let s of e)n.lang??=s.lang,Object.assign(n.styles,s.styles),n.items.push(...s.items);return 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 n of e.renderTasks)t.push(n.completed),n.cancel();return this.objs.clear(),this.#t=!1,Promise.all(t)}cleanup(t=!1){this.#t=!0;let e=this.#i();return t&&e&&(this._stats&&=new vl),e}#i(){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 n=this._intentStates.get(e);n&&(this._stats?.timeEnd("Page Request"),n.displayReadyCapability?.resolve(t))}_renderPageChunk(t,e){for(let n=0,s=t.length;n<s;n++)e.operatorList.fnArray.push(t.fnArray[n]),e.operatorList.argsArray.push(t.argsArray[n]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(let n of e.renderTasks)n.operatorListChanged();t.lastChunk&&this.#i()}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:n,modifiedIds:s}){let{map:a,transfer:r}=n,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageId:this.#e.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:a,modifiedIds:s},void 0,r).getReader(),c=this._intentStates.get(e);c.streamReader=l;let u=()=>{l.read().then(({value:h,done:d})=>{if(d){c.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(h,c),u())},h=>{if(c.streamReader=null,!this._transport.destroyed){if(c.operatorList){c.operatorList.lastChunk=!0;for(let d of c.renderTasks)d.operatorListChanged();this.#i()}if(c.displayReadyCapability)c.displayReadyCapability.reject(h);else if(c.opListReadCapability)c.opListReadCapability.reject(h);else throw h}})};u()}_abortOperatorList({intentState:t,reason:e,force:n=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!n){if(t.renderTasks.size>0)return;if(e instanceof Fs){let s=OS;e.extraDelay>0&&e.extraDelay<1e3&&(s+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},s);return}}if(t.streamReader.cancel(new Ge(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(let[s,a]of this._intentStates)if(a===t){this._intentStates.delete(s);break}this.cleanup()}}}get stats(){return this._stats}},Xs=class i{#t=Promise.withResolvers();#e=null;#i=null;#n=null;static#s=0;static#r=!1;static#a=new WeakMap;static{Se&&(this.#r=!0,sn.workerSrc||="./pdf.worker.mjs"),this._isSameOrigin=(t,e)=>{let n=URL.parse(t);if(!n?.origin||n.origin==="null")return!1;let s=new URL(e,n);return n.origin===s.origin},this._createCDNWrapper=t=>{let e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))}}constructor({name:t=null,port:e=null,verbosity:n=Z1()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=n,e){if(i.#a.has(e))throw new Error("Cannot use more than one PDFWorker per port.");i.#a.set(e,this),this.#c(e)}else this.#l()}get promise(){return this.#t.promise}#o(){this.#t.resolve(),this.#e.send("configure",{verbosity:this.verbosity})}get port(){return this.#i}get messageHandler(){return this.#e}#c(t){this.#i=t,this.#e=new Rn("main","worker",t),this.#e.on("ready",()=>{}),this.#o()}#l(){if(i.#r||i.#h){this.#d();return}let{workerSrc:t}=i;try{i._isSameOrigin(window.location,t)||(t=i._createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),n=new Rn("main","worker",e),s=()=>{a.abort(),n.destroy(),e.terminate(),this.destroyed?this.#t.reject(new Error("Worker was destroyed")):this.#d()},a=new AbortController;e.addEventListener("error",()=>{this.#n||s()},{signal:a.signal}),n.on("test",o=>{if(a.abort(),this.destroyed||!o){s();return}this.#e=n,this.#i=e,this.#n=e,this.#o()}),n.on("ready",o=>{if(a.abort(),this.destroyed){s();return}try{r()}catch{this.#d()}});let r=()=>{let o=new Uint8Array;n.send("test",o,[o.buffer])};r();return}catch{Kl("The worker has been disabled.")}this.#d()}#d(){i.#r||(I("Setting up fake worker."),i.#r=!0),i._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this.#t.reject(new Error("Worker was destroyed"));return}let e=new Cd;this.#i=e;let n=`fake${i.#s++}`,s=new Rn(n+"_worker",n,e);t.setup(s,e),this.#e=new Rn(n,n+"_worker",e),this.#o()}).catch(t=>{this.#t.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this.#n?.terminate(),this.#n=null,i.#a.delete(this.#i),this.#i=null,this.#e?.destroy(),this.#e=null}static create(t){let e=this.#a.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 i(t)}static get workerSrc(){if(sn.workerSrc)return sn.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#h(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return L(this,"_setupFakeWorkerGlobal",(async()=>this.#h?this.#h:(await import(this.workerSrc)).WorkerMessageHandler)())}},nf=class{downloadInfoCapability=Promise.withResolvers();#t=null;#e=new Map;#i=null;#n=new Map;#s=new Map;#r=new Map;#a=null;constructor(t,e,n,s,a,r){this.messageHandler=t,this.loadingTask=e,this.#i=n,this.commonObjs=new Dl,this.fontLoader=new yd({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.enableHWA=s.enableHWA,this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=a.canvasFactory,this.filterFactory=a.filterFactory,this.binaryDataFactory=a.binaryDataFactory,this.pagesMapper=r,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(t){let{_pageIndex:e}=t;this.#n.set(e,t),this.#s.set(e,Promise.resolve(t))}#o(t,e=null){return this.#e.getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,e))}#c({loaded:t,total:e}){this.loadingTask.onProgress?.({loaded:t,total:e,percent:e?ht(Math.round(t/e*100),0,100):NaN})}get annotationStorage(){return L(this,"annotationStorage",new mr)}getRenderingIntent(t,e=Si.ENABLE,n=null,s=!1,a=!1){let r=Ae.DISPLAY,o=gr;switch(t){case"any":r=Ae.ANY;break;case"display":break;case"print":r=Ae.PRINT;break;default:I(`getRenderingIntent - invalid intent: ${t}`)}let l=r&Ae.PRINT&&n instanceof Tl?n:this.annotationStorage;switch(e){case Si.DISABLE:r+=Ae.ANNOTATIONS_DISABLE;break;case Si.ENABLE:break;case Si.ENABLE_FORMS:r+=Ae.ANNOTATIONS_FORMS;break;case Si.ENABLE_STORAGE:r+=Ae.ANNOTATIONS_STORAGE,o=l.serializable;break;default:I(`getRenderingIntent - invalid annotationMode: ${e}`)}s&&(r+=Ae.IS_EDITING),a&&(r+=Ae.OPLIST);let{ids:c,hash:u}=l.modifiedIds,h=[r,o.hash,u];return{renderingIntent:r,cacheKey:h.join("_"),annotationStorageSerializable:o,modifiedIds:c}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#a?.reject(new Error("Worker was destroyed during onPassword callback"));let t=[];for(let n of this.#n.values())t.push(n._destroy());this.#n.clear(),this.#s.clear(),this.#r.clear(),Object.hasOwn(this,"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.#e.clear(),this.filterFactory.destroy(),Vs.cleanup(),this.#i?.cancelAllRequests(new Ge("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",(n,s)=>{Et(this.#i,"GetReader - no `BasePDFStream` instance available."),this.#t=this.#i.getFullReader(),this.#t.onProgress=a=>this.#c(a),s.onPull=()=>{this.#t.read().then(function({value:a,done:r}){if(r){s.close();return}Et(a instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{s.error(a)})},s.onCancel=a=>{this.#t.cancel(a),s.ready.catch(r=>{if(!this.destroyed)throw r})}}),t.on("ReaderHeadersReady",async n=>{await this.#t.headersReady;let{isStreamingSupported:s,isRangeSupported:a,contentLength:r}=this.#t;return s&&a&&(this.#t.onProgress=null),{isStreamingSupported:s,isRangeSupported:a,contentLength:r}}),t.on("GetRangeReader",(n,s)=>{Et(this.#i,"GetRangeReader - no `BasePDFStream` instance available.");let a=this.#i.getRangeReader(n.begin,n.end);if(!a){s.close();return}s.onPull=()=>{a.read().then(function({value:r,done:o}){if(o){s.close();return}Et(r instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(r),1,[r])}).catch(r=>{s.error(r)})},s.onCancel=r=>{a.cancel(r),s.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("GetDoc",({pdfInfo:n})=>{this.pagesMapper.pagesNumber=n.numPages,this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,e._capability.resolve(new tf(n,this))}),t.on("DocException",n=>{e._capability.reject(oe(n))}),t.on("PasswordRequest",n=>{this.#a=Promise.withResolvers();try{if(!e.onPassword)throw oe(n);let s=a=>{a instanceof Error?this.#a.reject(a):this.#a.resolve({password:a})};e.onPassword(s,n.code)}catch(s){this.#a.reject(s)}return this.#a.promise}),t.on("DataLoaded",n=>{this.#c({loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),t.on("StartRenderPage",n=>{if(this.destroyed)return;this.#n.get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),t.on("commonobj",([n,s,a])=>{if(this.destroyed||this.commonObjs.has(n))return null;switch(s){case"Font":if("error"in a){let h=a.error;I(`Error during font loading: ${h}`),this.commonObjs.resolve(n,h);break}let r=new Td(a),o=this._params.pdfBug&&globalThis.FontInspector?.enabled?(h,d)=>globalThis.FontInspector.fontAdded(h,d):null,l=new bd(r,o,a.charProcOperatorList,a.extra);this.fontLoader.bind(l).catch(()=>t.sendWithPromise("FontFallback",{id:n})).finally(()=>{l.fontExtraProperties||l.clearData(),this.commonObjs.resolve(n,l)});break;case"CopyLocalImage":let{imageRef:c}=a;Et(c,"The imageRef must be defined.");for(let h of this.#n.values())for(let[,d]of h.objs){if(d?.ref!==c)continue;if(!d.dataLen)return null;let f=structuredClone(d);return this.commonObjs.resolve(n,f),d.dataLen}break;case"FontPath":this.commonObjs.resolve(n,new _d(a));break;case"Image":this.commonObjs.resolve(n,a);break;case"Pattern":let u=new wd(a);this.commonObjs.resolve(n,u.getIR());break;default:throw new Error(`Got unknown common object type ${s}`)}return null}),t.on("obj",([n,s,a,r])=>{if(this.destroyed)return;let o=this.#n.get(s);if(!o.objs.has(n)){if(o._intentStates.size===0){r?.bitmap?.close();return}switch(a){case"Image":case"Pattern":o.objs.resolve(n,r);break;default:throw new Error(`Got unknown object type ${a}`)}}}),t.on("DocProgress",n=>{this.destroyed||this.#c(n)}),t.on("FetchBinaryData",async n=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.binaryDataFactory)throw new Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");return this.binaryDataFactory.fetch(n)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&I("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.#t?.filename??null},e).finally(()=>{this.annotationStorage.resetModified()})}extractPages(t){let e={pageInfos:t},n,s=globalThis.ImageBitmap;if(typeof s=="function"){let a=Array.isArray(t)?t:[t];for(let r of a)r?.image instanceof s&&(n||=[]).push(r.image)}if(this.annotationStorage.size>0){let a=this.annotationStorage.serializable,{map:r}=a;a.transfer?.length&&(n?n.push(...a.transfer):n=a.transfer);let o=this.pagesMapper.getMapping();if(o){let l=new Map;for(let[c,u]of r){if(u?.pageIndex!==void 0&&u.pageIndex>=0&&u.pageIndex<o.length){let h=o[u.pageIndex]-1;if(h!==u.pageIndex){l.set(c,{...u,pageIndex:h});continue}}l.set(c,u)}r=l}e.annotationStorage=r}return this.messageHandler.sendWithPromise("ExtractPages",e,n).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this.pagesMapper.pagesNumber)return Promise.reject(new Error("Invalid page request."));let e=t-1,n=this.pagesMapper.getPageId(t)-1,s=this.#s.get(e);if(s)return s;let a=this.messageHandler.sendWithPromise("GetPage",{pageIndex:n}).then(r=>{if(this.destroyed)throw new Error("Transport destroyed");r.refStr&&this.#r.set(r.refStr,n);let o=new ef(e,r,this,this.pagesMapper,this._params.pdfBug);return this.#n.set(e,o),o});return this.#s.set(e,a),a}async getPageIndex(t){if(!xd(t))throw new Error("Invalid pageIndex request.");let e=await this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}),n=this.pagesMapper.getPageNumber(e+1);if(n===0)throw new Error("GetPageIndex: page has been removed.");return n-1}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:this.pagesMapper.getPageId(t+1)-1,intent:e})}getFieldObjects(){return this.#o("GetFieldObjects")}getSignatures(){return this.#o("GetSignatures")}getSignatureData(t){return this.messageHandler.sendWithPromise("GetSignatureData",t)}hasJSActions(){return this.#o("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)}getAttachmentContent(t){return this.messageHandler.sendWithPromise("GetAttachmentContent",t)}getAnnotationsByType(t,e){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:t,pageIndexesToSkip:e})}getDocJSActions(){return this.#o("GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:this.pagesMapper.getPageId(t+1)-1})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:this.pagesMapper.getPageId(t+1)-1})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return this.#o("GetOptionalContentConfig").then(e=>new $d(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata";return this.#e.getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,null).then(e=>({info:e[0],metadata:e[1]?new Wd(e[1]):null,contentDispositionFilename:this.#t?.filename??null,contentLength:this.#t?.contentLength??null,hasStructTree:e[2]})))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}getRawData(t){return this.messageHandler.sendWithPromise("GetRawData",t)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(let e of this.#n.values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0),Vs.cleanup()}}cachedPageNumber(t){if(!xd(t))return null;let e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`,n=this.#r.get(e);if(n>=0){let s=this.pagesMapper.getPageNumber(n+1);if(s!==0)return s}return null}},sf=class{_internalRenderTask=null;onContinue=null;onError=null;constructor(t){this._internalRenderTask=t}get promise(){return this._internalRenderTask.capability.promise}cancel(t=0){this._internalRenderTask.cancel(null,t)}get separateAnnots(){let{separateAnnots:t}=this._internalRenderTask.operatorList;if(!t)return!1;let{annotationCanvasMap:e}=this._internalRenderTask;return t.form||t.canvas&&e?.size>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}},af=class i{#t=null;static#e=new WeakSet;constructor({callback:t,params:e,objs:n,commonObjs:s,annotationCanvasMap:a,operatorList:r,pageIndex:o,canvasFactory:l,filterFactory:c,useRequestAnimationFrame:u=!1,pdfBug:h=!1,pageColors:d=null,enableHWA:f=!1,operationsFilter:m=null}){this.callback=t,this.params=e,this.objs=n,this.commonObjs=s,this.annotationCanvasMap=a,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=c,this._pdfBug=h,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=u===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new sf(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._imagesTracker=e.imagesTracker,this._operationsFilter=m}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){if(this.cancelled)return;if(this._canvas){if(i.#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.");i.#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:n,transform:s,background:a,dependencyTracker:r,imagesTracker:o}=this.params,l=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new zs(l,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors,r,o),this.gfx.beginDrawing({transform:s,viewport:n,transparency:t,background:a}),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),i.#e.delete(this._canvas),t||=new Fs(`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(),i.#e.delete(this._canvas),this.callback())))}},kb="6.2.108",Lb="0365cbde0",Ar=class i{#t=null;#e=null;#i;#n=null;#s=!1;#r=!1;#a=null;#o;#c=null;#l=null;static#d=null;static get _keyboardManager(){return L(this,"_keyboardManager",new kn([[["Escape"],i.prototype._hideDropdownFromKeyboard],[["Space"],i.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight"],i.prototype._moveToNext],[["ArrowUp","ArrowLeft"],i.prototype._moveToPrevious],[["Home"],i.prototype._moveToBeginning],[["End"],i.prototype._moveToEnd]]))}constructor({editor:t=null,uiManager:e=null}){t?(this.#r=!1,this.#a=t):this.#r=!0,this.#l=t?._uiManager||e,this.#o=this.#l._eventBus,this.#i=t?.color?.toUpperCase()||this.#l?.highlightColors.values().next().value||"#FFFF98",i.#d||=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.#a&&(t.ariaControls=`${this.#a.id}_colorpicker_dropdown`);let e=this.#l._signal;t.addEventListener("click",this.#g.bind(this),{signal:e}),t.addEventListener("keydown",this.#m.bind(this),{signal:e});let n=this.#e=document.createElement("span");return n.className="swatch",n.ariaHidden="true",n.style.backgroundColor=this.#i,t.append(n),t}renderMainDropdown(){let t=this.#n=this.#h();return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}#h(){let t=document.createElement("div"),e=this.#l._signal;t.addEventListener("contextmenu",Te,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),this.#a&&(t.id=`${this.#a.id}_colorpicker_dropdown`);for(let[n,s]of this.#l.highlightColors){let a=document.createElement("button");a.tabIndex="0",a.role="option",a.setAttribute("data-color",s),a.title=n,a.setAttribute("data-l10n-id",i.#d[n]);let r=document.createElement("span");a.append(r),r.className="swatch",r.style.backgroundColor=s,a.ariaSelected=s===this.#i,a.addEventListener("click",this.#p.bind(this,s),{signal:e}),t.append(a)}return t.addEventListener("keydown",this.#m.bind(this),{signal:e}),t}#p(t,e){e.stopPropagation(),this.#o.dispatch("switchannotationeditorparams",{source:this,type:H.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)}_colorSelectFromKeyboard(t){if(t.target===this.#t){this.#g(t);return}let e=t.target.getAttribute("data-color");e&&this.#p(e,t)}_moveToNext(t){if(!this.#f){this.#g(t);return}if(t.target===this.#t){this.#n.firstElementChild?.focus();return}t.target.nextSibling?.focus()}_moveToPrevious(t){if(t.target===this.#n?.firstElementChild||t.target===this.#t){this.#f&&this._hideDropdownFromKeyboard();return}this.#f||this.#g(t),t.target.previousSibling?.focus()}_moveToBeginning(t){if(!this.#f){this.#g(t);return}this.#n.firstElementChild?.focus()}_moveToEnd(t){if(!this.#f){this.#g(t);return}this.#n.lastElementChild?.focus()}#m(t){i._keyboardManager.exec(this,t)}#g(t){if(this.#f){this.hideDropdown();return}if(this.#s=t.detail===0,this.#c||(this.#c=new AbortController,window.addEventListener("pointerdown",this.#u.bind(this),{signal:this.#l.combinedSignal(this.#c)})),this.#t.ariaExpanded="true",this.#n){this.#n.classList.remove("hidden");return}let e=this.#n=this.#h();this.#t.append(e)}#u(t){this.#n?.contains(t.target)||this.hideDropdown()}hideDropdown(){this.#n?.classList.add("hidden"),this.#t.ariaExpanded="false",this.#c?.abort(),this.#c=null}get#f(){return this.#n&&!this.#n.classList.contains("hidden")}_hideDropdownFromKeyboard(){if(!this.#r){if(!this.#f){this.#a?.unselect();return}this.hideDropdown(),this.#t.focus({preventScroll:!0,focusVisible:this.#s})}}updateColor(t){if(this.#e&&(this.#e.style.backgroundColor=t),!this.#n)return;let e=this.#l.highlightColors.values();for(let n of this.#n.children)n.ariaSelected=e.next().value===t.toUpperCase()}destroy(){this.#t?.remove(),this.#t=null,this.#e=null,this.#n?.remove(),this.#n=null}},Ol=class i{#t=null;#e=!1;#i=null;#n=null;static#s=null;constructor(t){this.#i=t,this.#n=t._uiManager,i.#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,colorAndOpacityType:n,opacityType:s,color:a,opacity:r}=this.#i,o=this.#e=J.isAlphaColorInputSupported&&s!==void 0,l=this.#t=document.createElement("input");if(l.type="color",o){l.setAttribute("alpha","");let c=M.hexNums[Math.round((r??1)*255)];l.value=(a||"#000000")+c}else l.value=a||"#000000";return l.className="basicColorPicker",l.tabIndex=0,l.setAttribute("data-l10n-id",i.#s[t]),l.addEventListener("input",()=>{if(o){let c=qs(l.value);if(!c)return;let[u,h,d,f]=c,m=M.makeHexColor(u,h,d);n!==void 0?this.#n.updateParams(n,{color:m,opacity:f}):(this.#n.updateParams(e,m),this.#n.updateParams(s,f))}else this.#n.updateParams(e,l.value)},{signal:this.#n._signal}),l}update(t){if(this.#t)if(this.#e){let e=M.hexNums[Math.round(this.#i.opacity*255)];this.#t.value=t+e}else this.#t.value=t}updateOpacity(t){if(!this.#t||!this.#e)return;let e=M.hexNums[Math.round(t*255)];this.#t.value=this.#i.color+e}destroy(){this.#t?.remove(),this.#t=null}hideDropdown(){}};Rl=class{static CMYK_G([t,e,n,s]){return["G",1-Math.min(1,.3*t+.59*n+.11*e+s)]}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=ir(t),[t,t,t]}static G_HTML([t]){let e=hb(t);return`#${e}${e}${e}`}static RGB_G([t,e,n]){return["G",.3*t+.59*e+.11*n]}static RGB_rgb(t){return t.map(ir)}static RGB_HTML(t){return`#${t.map(hb).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,n,s]){return["RGB",1-Math.min(1,t+s),1-Math.min(1,n+s),1-Math.min(1,e+s)]}static CMYK_rgb([t,e,n,s]){return[ir(1-Math.min(1,t+s)),ir(1-Math.min(1,n+s)),ir(1-Math.min(1,e+s))]}static CMYK_HTML(t){let e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,n]){let s=1-t,a=1-e,r=1-n,o=Math.min(s,a,r);return["CMYK",s,a,r,o]}},rf=class{create(t,e,n=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");let s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),n||(s.setAttribute("width",`${t}px`),s.setAttribute("height",`${e}px`)),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox",`0 0 ${t} ${e}`),s}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){Q("Abstract method `_createSVG` called.")}},Ln=class extends rf{_createSVG(t){return document.createElementNS(Jt,t)}},RS=9,Bn=new WeakSet,NS=new Date().getTimezoneOffset()*60*1e3,lr=class{static create(t){switch(t.data.annotationType){case bt.LINK:return new Sr(t);case bt.TEXT:return new lf(t);case bt.WIDGET:switch(t.data.fieldType){case"Tx":return new cf(t);case"Btn":return t.data.radioButton?new df(t):t.data.checkBox?new hf(t):new ff(t);case"Ch":return new pf(t);case"Sig":return new uf(t)}return new _i(t);case bt.POPUP:return new Er(t);case bt.FREETEXT:return new Nl(t);case bt.LINE:return new mf(t);case bt.SQUARE:return new yf(t);case bt.CIRCLE:return new bf(t);case bt.POLYLINE:return new kl(t);case bt.CARET:return new Af(t);case bt.INK:return new Tr(t);case bt.POLYGON:return new vf(t);case bt.HIGHLIGHT:return new Ll(t);case bt.UNDERLINE:return new Sf(t);case bt.SQUIGGLY:return new Ef(t);case bt.STRIKEOUT:return new Tf(t);case bt.STAMP:return new Bl(t);case bt.FILEATTACHMENT:return new wf(t);case bt.RICHMEDIA:case bt.SCREEN:case bt.SOUND:return new zl(t);default:return new At(t)}}},At=class i{#t=null;#e=!1;#i=null;constructor(t,{isRenderable:e=!1,ignoreBorder:n=!1,createQuadrilaterals:s=!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,this.hasOwnCommentButton=!1,e&&(this.contentElement=this.container=this._createContainer(n)),s&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:t,richText:e}){return!!(t?.str||e?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return i._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:n,rect:s}=this.data,a=-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],a=e[o+2]):e[o+1]===r&&(a=Math.max(a,e[o+2]));return[a,r]}if(n?.length>=1){for(let o of n)for(let l=0,c=o.length;l<c;l+=2)o[l+1]>r?(r=o[l+1],a=o[l]):o[l+1]===r&&(a=Math.max(a,o[l]));if(a!==1/0)return[a,r]}return s?[s[2],s[3]]:null}_normalizePoint(t){let{page:{view:e},viewport:{rawDims:{pageWidth:n,pageHeight:s,pageX:a,pageY:r}}}=this.parent;return t[1]=e[3]-t[1]+e[1],t[0]=100*(t[0]-a)/n,t[1]=100*(t[1]-r)/s,t}get commentText(){let{data:t}=this;return this.annotationStorage.getRawValue(`${cr}${t.id}`)?.popup?.contents||t.contentsObj?.str||""}set commentText(t){let{data:e}=this,n={deleted:!t,contents:t||""};this.annotationStorage.updateEditor(e.id,{popup:n})||this.annotationStorage.setValue(`${cr}${e.id}`,{id:e.id,annotationType:e.annotationType,page:this.parent.page,popup:n,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:n}=t;e&&this.#n(e);let s=this.#i?.popup||this.popup;!s&&n?.text&&(this._createPopup(n),s=this.#i.popup),s&&(s.updateEdited(t),n?.deleted&&(s.remove(),this.#i=null,this.popup=null))}resetEdited(){this.#t&&(this.#n(this.#t.rect),this.#i?.popup.resetEdited(),this.#t=null)}#n(t){let{container:{style:e},data:{rect:n,rotation:s},parent:{viewport:{rawDims:{pageWidth:a,pageHeight:r,pageX:o,pageY:l}}}}=this;n?.splice(0,4,...t),e.left=`${100*(t[0]-o)/a}%`,e.top=`${100*(r-t[3]+l)/r}%`,s===0?(e.width=`${100*(t[2]-t[0])/a}%`,e.height=`${100*(t[3]-t[1])/r}%`):this.setRotation(s)}_createContainer(t){let{data:e,parent:{page:n,viewport:s}}=this,a=document.createElement("section");a.setAttribute("data-annotation-id",e.id),!(this instanceof _i)&&!(this instanceof Sr)&&!(this instanceof zl)&&(a.tabIndex=0);let{style:r}=a;if(r.zIndex=this.parent.zIndex,this.parent.zIndex+=2,e.alternativeText&&(a.title=e.alternativeText),e.noRotate&&a.classList.add("norotate"),!e.rect||this instanceof Er){let{rotation:y}=e;return!e.hasOwnCanvas&&y!==0&&this.setRotation(y,a),a}let{width:o,height:l}=this;if(!t&&e.borderStyle.width>0){r.borderWidth=`${e.borderStyle.width}px`;let y=e.borderStyle.horizontalCornerRadius,v=e.borderStyle.verticalCornerRadius;if(y>0||v>0){let g=`calc(${y}px * var(--total-scale-factor)) / calc(${v}px * var(--total-scale-factor))`;r.borderRadius=g}switch(e.borderStyle.style){case Ns.SOLID:r.borderStyle="solid";break;case Ns.DASHED:r.borderStyle="dashed";break;case Ns.BEVELED:I("Unimplemented border style: beveled");break;case Ns.INSET:I("Unimplemented border style: inset");break;case Ns.UNDERLINE:r.borderBottomStyle="solid";break;default:break}let p=e.borderColor||null;p?(this.#e=!0,r.borderColor=M.makeHexColor(...p)):r.borderWidth=0}let c=M.normalizeRect([e.rect[0],n.view[3]-e.rect[1]+n.view[1],e.rect[2],n.view[3]-e.rect[3]+n.view[1]]),{pageWidth:u,pageHeight:h,pageX:d,pageY:f}=s.rawDims;r.left=`${100*(c[0]-d)/u}%`,r.top=`${100*(c[1]-f)/h}%`;let{rotation:m}=e;return e.hasOwnCanvas||m===0?(r.width=`${100*o/u}%`,r.height=`${100*l/h}%`):this.setRotation(m,a),a}setRotation(t,e=this.container){if(!this.data.rect)return;let{pageWidth:n,pageHeight:s}=this.parent.viewport.rawDims,{width:a,height:r}=this;t%180!==0&&([a,r]=[r,a]),e.style.width=`${100*a/n}%`,e.style.height=`${100*r/s}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){let t=(e,n,s)=>{let a=s.detail[e],r=a[0],o=a.slice(1);s.target.style[n]=Rl[`${r}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[n]:Rl[`${r}_rgb`](o)})};return L(this,"_commonActions",{display:e=>{let{display:n}=e.detail,s=n%2===1;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:s,noPrint:n===1||n===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{let{hidden:n}=e.detail;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:n,noView:n})},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 n=e.detail.rotation;this.setRotation(n),this.annotationStorage.setValue(this.data.id,{rotation:n})}})}_dispatchEventFromSandbox(t,e){let n=this._commonActions;for(let s of Object.keys(e.detail))(t[s]||n[s])?.(e)}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;let e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;let n=this._commonActions;for(let[s,a]of Object.entries(e)){let r=n[s];if(r){let o={detail:{[s]:a},target:t};r(o),delete e[s]}}}_createQuadrilaterals(){if(!this.container)return;let{quadPoints:t}=this.data;if(!t)return;let[e,n,s,a]=this.data.rect.map(y=>Math.fround(y));if(t.length===8){let[y,v,p,g]=t.subarray(2,6);if(s===y&&a===v&&e===p&&n===g)return}let{style:r}=this.container,o;if(this.#e){let{borderColor:y,borderWidth:v}=r;r.borderWidth=0,o=["url('data:image/svg+xml;utf8,",`<svg xmlns="${Jt}" preserveAspectRatio="none" viewBox="0 0 1 1">`,`<g fill="transparent" stroke="${y}" stroke-width="${v}">`],this.container.classList.add("hasBorder")}let l=s-e,c=a-n,{svgFactory:u}=this,h=u.createElement("svg");h.classList.add("quadrilateralsContainer"),h.setAttribute("width",0),h.setAttribute("height",0),h.role="none";let d=u.createElement("defs");h.append(d);let f=u.createElement("clipPath"),m=`clippath_${this.data.id}`;f.setAttribute("id",m),f.setAttribute("clipPathUnits","objectBoundingBox"),d.append(f);for(let y=2,v=t.length;y<v;y+=8){let p=t[y],g=t[y+1],b=t[y+2],A=t[y+3],S=u.createElement("rect"),E=(b-e)/l,T=(a-g)/c,w=(p-b)/l,_=(g-A)/c;S.setAttribute("x",E),S.setAttribute("y",T),S.setAttribute("width",w),S.setAttribute("height",_),f.append(S),o?.push(`<rect vector-effect="non-scaling-stroke" x="${E}" y="${T}" width="${w}" height="${_}"/>`)}this.#e&&(o.push("</g></svg>')"),r.backgroundImage=o.join("")),this.container.append(h),this.container.style.clipPath=`url(#${m})`}_createPopup(t=null){let{data:e}=this,n,s;t?(n={str:t.text},s=t.date):(n=e.contentsObj,s=e.modificationDate),this.#i=new Er({data:{color:e.color,titleObj:e.titleObj,modificationDate:s,contentsObj:n,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]})}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 n=[];if(this._fieldObjects){let s=this._fieldObjects[t]||[];for(let{page:a,id:r,exportValues:o}of s){if(a===-1||r===e)continue;let l=typeof o=="string"?o:null,c=document.querySelector(`[data-element-id="${r}"]`);if(c&&!Bn.has(c)){I(`_getElementsByName - element not allowed: ${r}`);continue}n.push({id:r,exportValue:l,domElement:c})}return n}for(let s of document.getElementsByName(t)){let{exportValue:a}=s,r=s.getAttribute("data-element-id");r!==e&&Bn.has(s)&&n.push({id:r,exportValue:a,domElement:s})}return n}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})})}updateOC(t){if(!this.data.oc||!t)return;t.isVisible(this.data.oc)?this.show():this.hide()}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}_setBackgroundColor(t){let e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":M.makeHexColor(...e)}},of=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)}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.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}},Sr=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,n=document.createElement("a");n.setAttribute("data-element-id",t.id);let s=!1;return t.url?(e.addLinkAttributes(n,t.url,t.newWindow),s=!0):t.action?(this._bindNamedAction(n,t.action,t.overlaidText),s=!0):t.attachment?(this.#e(n,t.attachmentId,t.attachment,t.overlaidText,t.attachmentDest),s=!0):t.setOCGState?(this.#i(n,t.setOCGState,t.overlaidText),s=!0):t.dest?(this._bindLink(n,t.dest,t.overlaidText),s=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,t),s=!0),t.resetForm?(this._bindResetFormAction(n,t.resetForm),s=!0):this.isTooltipOnly&&!s&&(this._bindLink(n,""),s=!0)),this.container.classList.add("linkAnnotation"),s&&(this.contentElement=n,this.container.append(n)),this.container}#t(){this.container.setAttribute("data-internal-link","")}_bindLink(t,e,n=""){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||e==="")&&this.#t(),n&&(t.title=n)}_bindNamedAction(t,e,n=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),n&&(t.title=n),this.#t()}#e(t,e,n,s="",a=null){t.href=this.linkService.getAnchorUrl(""),n.description?t.title=n.description:s&&(t.title=s);let r=async()=>{let o=await this.linkService.getAttachmentContent(e);o&&this.downloadManager?.openOrDownloadData(o,n.filename,a)};t.onclick=()=>(r(),!1),this.#t()}#i(t,e,n=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),n&&(t.title=n),this.#t()}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");let n=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let s of Object.keys(e.actions)){let a=n.get(s);a&&(t[a]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:s}}),!1))}e.overlaidText&&(t.title=e.overlaidText),t.onclick||=()=>!1,this.#t()}_bindResetFormAction(t,e){let n=t.onclick;if(n||(t.href=this.linkService.getAnchorUrl("")),this.#t(),!this._fieldObjects){I('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(t.onclick=()=>!1);return}t.onclick=()=>{n?.();let{fields:s,refs:a,include:r}=e,o=[];if(s.length!==0||a.length!==0){let u=new Set(a);for(let h of s){let d=this._fieldObjects[h]||[];for(let{id:f}of d)u.add(f)}for(let h of Object.values(this._fieldObjects))for(let d of h)u.has(d.id)===r&&o.push(d)}else for(let u of Object.values(this._fieldObjects))o.push(...u);let l=this.annotationStorage,c=[];for(let u of o){let{id:h}=u;switch(c.push(h),u.type){case"text":{let f=u.defaultValue||"";l.setValue(h,{value:f});break}case"checkbox":case"radiobutton":{let f=u.defaultValue===u.exportValues;l.setValue(h,{value:f});break}case"combobox":case"listbox":{let f=u.defaultValue||"";l.setValue(h,{value:f});break}default:continue}let d=document.querySelector(`[data-element-id="${h}"]`);if(d){if(!Bn.has(d)){I(`_bindResetFormAction - element not allowed: ${h}`);continue}}else continue;d.dispatchEvent(new Event("resetform"))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:c,name:"ResetForm"}}),!1}}},lf=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.hasOwnCommentButton=!0,this._createPopup()),this.container.append(t),this.container}},_i=class extends At{render(){return this.container}_getKeyModifier(t){return J.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,n,s,a){n.includes("mouse")?t.addEventListener(n,r=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:a(r),shift:r.shiftKey,modifier:this._getKeyModifier(r)}})}):t.addEventListener(n,r=>{if(n==="blur"){if(!e.focused||!r.relatedTarget)return;e.focused=!1}else if(n==="focus"){if(e.focused)return;e.focused=!0}a&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:a(r)}})})}_setEventListeners(t,e,n,s){for(let[a,r]of n)(r==="Action"||this.data.actions?.[r])&&((r==="Focus"||r==="Blur")&&(e||={focused:!1}),this._setEventListener(t,e,a,r,s),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))}_setTextStyle(t){let e=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||RS,a=t.style,r,o=2,l=c=>Math.round(10*c)/10;if(this.data.multiLine){let c=Math.abs(this.data.rect[3]-this.data.rect[1]-o),u=Math.round(c/(1.35*s))||1,h=c/u;r=Math.min(s,l(h/1.35))}else{let c=Math.abs(this.data.rect[3]-this.data.rect[1]-o);r=Math.min(s,l(c/1.35))}a.fontSize=`calc(${r}px * var(--total-scale-factor))`,a.color=M.makeHexColor(...n),this.data.textAlignment!==null&&!this.data.comb&&(a.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}},cf=class extends _i{constructor(t){let e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,n,s){let a=this.annotationStorage;for(let r of this._getElementsByName(t.name,t.id))r.domElement&&(r.domElement[e]=n),a.setValue(r.id,{[s]:n})}render(){let t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){let s=t.getValue(e,{value:this.data.fieldValue}),a=s.value||"",r=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;r&&a.length>r&&(a=a.slice(0,r));let o=s.formattedValue||this.data.textContent?.join(`
54
+ `)||null;o&&this.data.comb&&(o=o.replaceAll(/\s+/g,""));let l={userValue:a,formattedValue:o,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=o??a,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type=this.data.password?"password":"text",n.setAttribute("value",o??a),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(this.container.classList.add("hasOwnCanvas"),t.has(e)&&this.container.classList.add("sandboxModified")),Bn.add(n),this.contentElement=n,n.setAttribute("data-element-id",e),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=0;let{datetimeFormat:c,datetimeType:u,timeStep:h}=this.data,d=!!u&&this.enableScripting;c&&(n.title=c),this._setRequired(n,this.data.required),r&&(n.maxLength=r),n.addEventListener("input",m=>{t.setValue(e,{value:m.target.value}),this.setPropertyOnSiblings(n,"value",m.target.value,"value"),l.formattedValue=null}),n.addEventListener("resetform",m=>{let y=this.data.defaultFieldValue??"";n.value=l.userValue=y,l.formattedValue=null});let f=m=>{let{formattedValue:y}=l;y!=null&&(m.target.value=y),m.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",y=>{if(l.focused)return;let{target:v}=y;if(d&&(v.type=u,h&&(v.step=h)),l.userValue){let p=l.userValue;if(d)if(u==="time"){let g=new Date(p),b=[g.getHours(),g.getMinutes(),g.getSeconds()];v.value=b.map(A=>A.toString().padStart(2,"0")).join(":")}else v.value=new Date(p-NS).toISOString().split(u==="date"?"T":".",1)[0];else v.value=p}l.lastCommittedValue=v.value,l.commitKey=1,this.data.actions?.Focus||(l.focused=!0)}),n.addEventListener("updatefromsandbox",y=>{this.container.classList.add("sandboxModified");let v={value(p){l.userValue=p.detail.value??"",d||t.setValue(e,{value:l.userValue.toString()}),p.target.value=l.userValue},formattedValue(p){let{formattedValue:g}=p.detail;l.formattedValue=g,g!=null&&p.target!==document.activeElement&&(p.target.value=g);let b={formattedValue:g};d&&(b.value=g),t.setValue(e,b)},selRange(p){p.target.setSelectionRange(...p.detail.selRange)},charLimit:p=>{let{charLimit:g}=p.detail,{target:b}=p;if(g===0){b.removeAttribute("maxLength");return}b.setAttribute("maxLength",g);let A=l.userValue;!A||A.length<=g||(A=A.slice(0,g),b.value=l.userValue=A,t.setValue(e,{value:A}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:A,willCommit:!0,commitKey:1,selStart:b.selectionStart,selEnd:b.selectionEnd}}))}};this._dispatchEventFromSandbox(v,y)}),n.addEventListener("keydown",y=>{l.commitKey=1;let v=-1;if(y.key==="Escape"?v=0:y.key==="Enter"&&!this.data.multiLine?v=2:y.key==="Tab"&&(l.commitKey=3),v===-1)return;let{value:p}=y.target;l.lastCommittedValue!==p&&(l.lastCommittedValue=p,l.userValue=p,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:p,willCommit:!0,commitKey:v,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}))});let m=f;f=null,n.addEventListener("blur",y=>{if(!l.focused||!y.relatedTarget)return;this.data.actions?.Blur||(l.focused=!1);let{target:v}=y,{value:p}=v;if(d){if(p&&u==="time"){let g=p.split(":").map(b=>parseInt(b,10));p=new Date(2e3,0,1,g[0],g[1],g[2]||0).valueOf(),v.step=""}else p.includes("T")||(p=`${p}T00:00`),p=new Date(p).valueOf();v.type="text"}l.userValue=p,l.lastCommittedValue!==p&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:p,willCommit:!0,commitKey:l.commitKey,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}),m(y)}),this.data.actions?.Keystroke&&n.addEventListener("beforeinput",y=>{l.lastCommittedValue=null;let{data:v,target:p}=y,{value:g,selectionStart:b,selectionEnd:A}=p,S=b,E=A;switch(y.inputType){case"deleteWordBackward":{let T=g.substring(0,b).match(/\w*\W*$/);T&&(S-=T[0].length);break}case"deleteWordForward":{let T=g.substring(b).match(/^\W*\w*/);T&&(E+=T[0].length);break}case"deleteContentBackward":b===A&&(S-=1);break;case"deleteContentForward":b===A&&(E+=1);break}y.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:g,change:v||"",willCommit:!1,selStart:S,selEnd:E}})}),this._setEventListeners(n,l,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],y=>y.target.value)}if(f&&n.addEventListener("blur",f),this.data.comb){let y=(this.data.rect[2]-this.data.rect[0])/r;n.classList.add("comb"),n.style.setProperty("--comb-width",`calc(${y}px * var(--total-scale-factor))`);let v=this.data.textAlignment;if(v===1||v===2){let p=()=>{let g=r-n.value.length;n.style.setProperty("--comb-offset",`${v===1?g>>1:g}`)};p();for(let g of["input","blur","resetform","updatefromsandbox"])n.addEventListener(g,p)}}}else n=document.createElement("div"),n.textContent=this.data.fieldValue,n.style.verticalAlign="middle",n.style.display="table-cell",this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}},uf=class extends _i{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}},hf=class extends _i{constructor(t){super(t,{isRenderable:t.renderForms})}render(){let t=this.annotationStorage,e=this.data,n=e.id,s=t.getValue(n,{value:e.exportValue===e.fieldValue}).value;typeof s=="string"&&(s=s!=="Off",t.setValue(n,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let a=document.createElement("input");return Bn.add(a),a.setAttribute("data-element-id",n),a.disabled=e.readOnly,this._setRequired(a,this.data.required),a.type="checkbox",a.name=e.fieldName,s&&a.setAttribute("checked",!0),a.setAttribute("exportValue",e.exportValue),a.tabIndex=0,a.addEventListener("change",r=>{let{name:o,checked:l}=r.target;for(let c of this._getElementsByName(o,n)){let u=l&&c.exportValue===e.exportValue;c.domElement&&(c.domElement.checked=u),t.setValue(c.id,{value:u})}t.setValue(n,{value:l})}),a.addEventListener("resetform",r=>{let o=e.defaultFieldValue||"Off";r.target.checked=o===e.exportValue}),this.enableScripting&&this.hasJSActions&&(a.addEventListener("updatefromsandbox",r=>{let o={value(l){l.target.checked=l.detail.value!=="Off",t.setValue(n,{value:l.target.checked})}};this._dispatchEventFromSandbox(o,r)}),this._setEventListeners(a,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._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}},df=class extends _i{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let t=this.annotationStorage,e=this.data,n=e.id,s=t.getValue(n,{value:e.buttonValue!==null&&e.fieldValue===e.buttonValue}).value;if(typeof s=="string"&&(s=s!==e.buttonValue,t.setValue(n,{value:s})),s)for(let r of this._getElementsByName(e.fieldName,n))t.setValue(r.id,{value:!1});let a=document.createElement("input");if(Bn.add(a),a.setAttribute("data-element-id",n),a.disabled=e.readOnly,this._setRequired(a,this.data.required),a.type="radio",a.name=e.fieldName,s&&a.setAttribute("checked",!0),a.tabIndex=0,a.addEventListener("change",r=>{let{name:o,checked:l}=r.target;for(let c of this._getElementsByName(o,n))t.setValue(c.id,{value:!1});t.setValue(n,{value:l})}),a.addEventListener("resetform",r=>{let o=e.defaultFieldValue;r.target.checked=o!=null&&o===e.buttonValue}),this.enableScripting&&this.hasJSActions){let r=e.buttonValue;a.addEventListener("updatefromsandbox",o=>{let l={value:c=>{let u=r===c.detail.value;for(let h of this._getElementsByName(c.target.name)){let d=u&&h.id===n;h.domElement&&(h.domElement.checked=d),t.setValue(h.id,{value:d})}}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)}return this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}},ff=class extends Sr{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",n=>{this._dispatchEventFromSandbox({},n)})),t}},pf=class extends _i{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let t=this.annotationStorage,e=this.data.id,n=t.getValue(e,{value:this.data.fieldValue}),s=document.createElement("select");Bn.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=0;let a=this.data.combo&&this.data.options.length>0;this.data.combo||(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",h=>{let d=this.data.defaultFieldValue;for(let f of s.options)f.selected=f.value===d});let r=(h,d)=>{let f=d.replaceAll(" ","\xA0");h.textContent=f,f!==d&&h.setAttribute("display-value",d)};for(let h of this.data.options){let d=document.createElement("option");r(d,h.displayValue),d.value=h.exportValue,n.value.includes(h.exportValue)&&(d.setAttribute("selected",!0),a=!1),s.append(d)}let o=null;if(a){let h=document.createElement("option");h.value=" ",h.setAttribute("hidden",!0),h.setAttribute("selected",!0),s.prepend(h),o=()=>{h.remove(),s.removeEventListener("input",o),o=null},s.addEventListener("input",o)}let l=h=>{let d=h?"value":"textContent",{options:f,multiple:m}=s;return m?Array.prototype.filter.call(f,y=>y.selected).map(y=>y[d]):f.selectedIndex===-1?null:f[f.selectedIndex][d]},c=l(!1),u=h=>{let d=h.target.options;return Array.prototype.map.call(d,f=>({displayValue:f.getAttribute("display-value")||f.textContent,exportValue:f.value}))};return this.enableScripting&&this.hasJSActions?(s.addEventListener("updatefromsandbox",h=>{let d={value(f){o?.();let m=f.detail.value,y=new Set(Array.isArray(m)?m:[m]);for(let v of s.options)v.selected=y.has(v.value);t.setValue(e,{value:l(!0)}),c=l(!1)},multipleSelection(f){s.multiple=!0},remove(f){let m=s.options,y=f.detail.remove;m[y].selected=!1,s.remove(y),m.length>0&&Array.prototype.findIndex.call(m,p=>p.selected)===-1&&(m[0].selected=!0),t.setValue(e,{value:l(!0),items:u(f)}),c=l(!1)},clear(f){for(;s.length!==0;)s.remove(0);t.setValue(e,{value:null,items:[]}),c=l(!1)},insert(f){let{index:m,displayValue:y,exportValue:v}=f.detail.insert,p=s.children[m],g=document.createElement("option");r(g,y),g.value=v,p?p.before(g):s.append(g),t.setValue(e,{value:l(!0),items:u(f)}),c=l(!1)},items(f){let{items:m}=f.detail;for(;s.length!==0;)s.remove(0);for(let y of m){let{displayValue:v,exportValue:p}=y,g=document.createElement("option");r(g,v),g.value=p,s.append(g)}s.options.length>0&&(s.options[0].selected=!0),t.setValue(e,{value:l(!0),items:u(f)}),c=l(!1)},indices(f){let m=new Set(f.detail.indices);for(let y of f.target.options)y.selected=m.has(y.index);t.setValue(e,{value:l(!0)}),c=l(!1)},editable(f){f.target.disabled=!f.detail.editable}};this._dispatchEventFromSandbox(d,h)}),s.addEventListener("input",h=>{let d=l(!0),f=l(!1);t.setValue(e,{value:d}),h.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:c,change:f,changeEx:d,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(s,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],h=>h.target.value)):s.addEventListener("input",function(h){t.setValue(e,{value:l(!0)})}),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}},Er=class extends At{constructor(t){let{data:e,elements:n,parent:s}=t,a=!!s._commentManager;if(super(t,{isRenderable:!a&&At._hasPopupData(e)}),this.elements=n,a&&At._hasPopupData(e)){let r=this.popup=this.#t();for(let o of n)o.popup=r}else this.popup=null}#t(){return new gf({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(),n=[];for(let s of this.elements)s.popup=e,s.container.ariaHasPopup="dialog",n.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",n.map(s=>`${Ls}${s}`).join(",")),this.container}},gf=class{#t=null;#e=this.#F.bind(this);#i=this.#z.bind(this);#n=this.#S.bind(this);#s=this.#x.bind(this);#r=null;#a=null;#o=null;#c=null;#l=null;#d=null;#h=null;#p=!1;#m=null;#g=null;#u=null;#f=null;#b=null;#v=null;#y=null;#E=null;#w=null;#A=null;#_=!1;#T=null;#C=null;constructor({container:t,color:e,elements:n,titleObj:s,modificationDate:a,contentsObj:r,richText:o,parent:l,rect:c,parentRect:u,open:h,commentManager:d=null}){this.#a=t,this.#w=s,this.#o=r,this.#E=o,this.#d=l,this.#r=e,this.#y=c,this.#h=u,this.#l=n,this.#t=d,this.#T=n[0],this.#c=Hs.toDateObject(a),this.trigger=n.flatMap(f=>f.getElementsToTriggerPopup()),d||(this.#D(),this.#a.hidden=!0,h&&this.#x())}#D(){if(this.#g)return;this.#g=new AbortController;let{signal:t}=this.#g;for(let e of this.trigger)e.addEventListener("click",this.#s,{signal:t}),e.addEventListener("pointerenter",this.#n,{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})}#O(){let t=this.#l.find(e=>e.hasCommentButton);t&&(this.#b=t._normalizePoint(t.commentButtonPosition))}renderCommentButton(){if(this.#f){this.#f.parentNode||this.#T.container.after(this.#f);return}if(this.#b||this.#O(),!this.#b)return;let{signal:t}=this.#g=new AbortController,e=this.#T.hasOwnCommentButton,n=()=>{this.#t.toggleCommentPopup(this,!0,void 0,!e)},s=()=>{this.#t.toggleCommentPopup(this,!1,!0,!e)},a=()=>{this.#t.toggleCommentPopup(this,!1,!1)};if(e){this.#f=this.#T.container;for(let r of this.trigger)r.ariaHasPopup="dialog",r.ariaControls="commentPopup",r.addEventListener("keydown",this.#e,{signal:t}),r.addEventListener("click",n,{signal:t}),r.addEventListener("pointerenter",s,{signal:t}),r.addEventListener("pointerleave",a,{signal:t}),r.classList.add("popupTriggerArea")}else{let r=this.#f=document.createElement("button");r.className="annotationCommentButton";let o=this.#T.container;r.style.zIndex=parseInt(o.style.zIndex,10)+1,r.tabIndex=0,r.ariaHasPopup="dialog",r.ariaControls="commentPopup",r.setAttribute("data-l10n-id","pdfjs-show-comment-button"),this.#k(),this.#M(),r.addEventListener("keydown",this.#e,{signal:t}),r.addEventListener("click",n,{signal:t}),r.addEventListener("pointerenter",s,{signal:t}),r.addEventListener("pointerleave",a,{signal:t}),o.after(r)}}#M(){if(this.#T.extraPopupElement&&!this.#T.editor)return;this.#f||this.renderCommentButton();let[t,e]=this.#b,{style:n}=this.#f;n.left=`calc(${t}%)`,n.top=`calc(${e}% - var(--comment-button-dim))`}#k(){this.#T.extraPopupElement||(this.#f||this.renderCommentButton(),this.#f.style.backgroundColor=this.commentButtonColor||"")}get commentButtonColor(){let{color:t,opacity:e}=this.#T.commentData;return t?this.#d._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{this.#f?.focus()},0)}getData(){let{richText:t,color:e,opacity:n,creationDate:s,modificationDate:a}=this.#T.commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:n,creationDate:s,modificationDate:a}}get elementBeforePopup(){return this.#f}get comment(){return this.#C||=this.#T.commentText,this.#C}set comment(t){t!==this.comment&&(this.#T.commentText=this.#C=t)}focus(){this.#T.container?.focus()}get parentBoundingClientRect(){return this.#T.layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){this.#f&&(this.#f.classList.toggle("selected",t),this.#f.ariaExpanded=e)}setSelectedCommentButton(t){this.#f.classList.toggle("selected",t)}get commentPopupPosition(){if(this.#v)return this.#v;let{x:t,y:e,height:n}=this.#f.getBoundingClientRect(),{x:s,y:a,width:r,height:o}=this.#T.layer.getBoundingClientRect();return[(t-s)/r,(e+n-a)/o]}set commentPopupPosition(t){this.#v=t}hasDefaultPopupPosition(){return this.#v===null}get commentButtonPosition(){return this.#b}get commentButtonWidth(){return this.#f.getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){let[e,n]=this.#v||this.commentButtonPosition.map(c=>c/100),s=this.parentBoundingClientRect,{x:a,y:r,width:o,height:l}=s;this.#t.showDialog(null,this,a+e*o,r+n*l,{...t,parentDimensions:s})}render(){if(this.#m)return;let t=this.#m=document.createElement("div");if(t.className="popup",this.#r){let n=t.style.outlineColor=M.makeHexColor(...this.#r);t.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`}let e=document.createElement("span");if(e.className="header",this.#w?.str){let n=document.createElement("span");n.className="title",e.append(n),{dir:n.dir,str:n.textContent}=this.#w}if(t.append(e),this.#c){let n=document.createElement("time");n.className="popupDate",n.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),n.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#c.valueOf()})),n.dateTime=this.#c.toISOString(),e.append(n)}Pf({html:this.#L||this.#o.str,dir:this.#o?.dir,className:"popupContent"},t),this.#a.append(t)}get#L(){let t=this.#E,e=this.#o;return t?.str&&(!e?.str||e.str===t.str)&&this.#E.html||null}get#N(){return this.#L?.attributes?.style?.fontSize||0}get#B(){return this.#L?.attributes?.style?.color||null}#P(t){let e=[],n={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},s={style:{color:this.#B,fontSize:this.#N?`calc(${this.#N}px * var(--total-scale-factor))`:""}};for(let a of t.split(`
55
+ `))e.push({name:"span",value:a,attributes:s});return n}#F(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&this.#p)&&this.#x()}updateEdited({rect:t,popup:e,deleted:n}){if(this.#t){n?(this.remove(),this.#C=null):e&&(e.deleted?this.remove():(this.#k(),this.#C=e.text)),t&&(this.#b=null,this.#O(),this.#M());return}if(n||e?.deleted){this.remove();return}this.#D(),this.#A||={contentsObj:this.#o,richText:this.#E},t&&(this.#u=null),e&&e.text&&(this.#E=this.#P(e.text),this.#c=Hs.toDateObject(e.date),this.#o=null),this.#m?.remove(),this.#m=null}resetEdited(){this.#A&&({contentsObj:this.#o,richText:this.#E}=this.#A,this.#A=null,this.#m?.remove(),this.#m=null,this.#u=null)}remove(){if(this.#g?.abort(),this.#g=null,this.#m?.remove(),this.#m=null,this.#_=!1,this.#p=!1,this.#f?.remove(),this.#f=null,this.trigger)for(let t of this.trigger)t.classList.remove("popupTriggerArea")}#X(){if(this.#u!==null)return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:n,pageX:s,pageY:a}}}=this.#d,r=!!this.#h,o=r?this.#h:this.#y;for(let m of this.#l)if(!o||M.intersect(m.data.rect,o)!==null){o=m.data.rect,r=!0;break}let l=M.normalizeRect([o[0],t[3]-o[1]+t[1],o[2],t[3]-o[3]+t[1]]),u=r?o[2]-o[0]+5:0,h=l[0]+u,d=l[1];this.#u=[100*(h-s)/e,100*(d-a)/n];let{style:f}=this.#a;f.left=`${this.#u[0]}%`,f.top=`${this.#u[1]}%`}#x(){if(this.#t){this.#t.toggleCommentPopup(this,!1);return}this.#p=!this.#p,this.#p?(this.#S(),this.#a.addEventListener("click",this.#s),this.#a.addEventListener("keydown",this.#e)):(this.#z(),this.#a.removeEventListener("click",this.#s),this.#a.removeEventListener("keydown",this.#e))}#S(){this.#m||this.render(),this.isVisible?this.#p&&this.#a.classList.add("focused"):(this.#X(),this.#a.hidden=!1,this.#a.style.zIndex=parseInt(this.#a.style.zIndex,10)+1e3)}#z(){this.#a.classList.remove("focused"),!(this.#p||!this.isVisible)&&(this.#a.hidden=!0,this.#a.style.zIndex=parseInt(this.#a.style.zIndex,10)-1e3)}forceHide(){this.#_=this.isVisible,this.#_&&(this.#a.hidden=!0)}maybeShow(){this.#t||(this.#D(),this.#_&&(this.#m||this.#S(),this.#_=!1,this.#a.hidden=!1))}get isVisible(){return this.#t?!1:this.#a.hidden===!1}},Nl=class extends At{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=P.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let t=this.contentElement=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(let e of this.textContent){let n=document.createElement("span");n.textContent=e,t.append(n)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},mf=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:n}=this,s=this.svgFactory.create(e,n,!0),a=this.#t=this.svgFactory.createElement("svg:line");return a.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),a.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),a.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),a.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),a.setAttribute("stroke-width",t.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),s.append(a),this.container.append(s),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}},yf=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:n}=this,s=this.svgFactory.create(e,n,!0),a=t.borderStyle.width,r=this.#t=this.svgFactory.createElement("svg:rect");return r.setAttribute("x",a/2),r.setAttribute("y",a/2),r.setAttribute("width",e-a),r.setAttribute("height",n-a),r.setAttribute("stroke-width",a||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),s.append(r),this.container.append(s),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}},bf=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:n}=this,s=this.svgFactory.create(e,n,!0),a=t.borderStyle.width,r=this.#t=this.svgFactory.createElement("svg:ellipse");return r.setAttribute("cx",e/2),r.setAttribute("cy",n/2),r.setAttribute("rx",e/2-a/2),r.setAttribute("ry",n/2-a/2),r.setAttribute("stroke-width",a||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),s.append(r),this.container.append(s),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}},kl=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:n,popupRef:s},width:a,height:r}=this;if(!e)return this.container;let o=this.svgFactory.create(a,r,!0),l=[];for(let u=0,h=e.length;u<h;u+=2){let d=e[u]-t[0],f=t[3]-e[u+1];l.push(`${d},${f}`)}l=l.join(" ");let c=this.#t=this.svgFactory.createElement(this.svgElementName);return c.setAttribute("points",l),c.setAttribute("stroke-width",n.width||1),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),o.append(c),this.container.append(o),!s&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}},vf=class extends kl{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}},Af=class extends At{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}},Tr=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"?P.HIGHLIGHT:P.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:n,borderStyle:s,popupRef:a}}=this,{transform:r,width:o,height:l}=this.#i(e,t),c=this.svgFactory.create(o,l,!0),u=this.#t=this.svgFactory.createElement("svg:g");c.append(u),u.setAttribute("stroke-width",s.width||1),u.setAttribute("stroke-linecap","round"),u.setAttribute("stroke-linejoin","round"),u.setAttribute("stroke-miterlimit",10),u.setAttribute("stroke","transparent"),u.setAttribute("fill","transparent"),u.setAttribute("transform",r);for(let h of n){let d=this.svgFactory.createElement(this.svgElementName);this.#e.push(d),d.setAttribute("points",h.join(",")),u.append(d)}return!a&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(c),this._editOnDoubleClick(),this.container}updateEdited(t){super.updateEdited(t);let{thickness:e,points:n,rect:s}=t,a=this.#t;if(e>=0&&a.setAttribute("stroke-width",e||1),n)for(let r=0,o=this.#e.length;r<o;r++)this.#e[r].setAttribute("points",n[r].join(","));if(s){let{transform:r,width:o,height:l}=this.#i(this.data.rotation,s);a.parentElement.setAttribute("viewBox",`0 0 ${o} ${l}`),a.setAttribute("transform",r)}}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}},Ll=class extends At{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=P.HIGHLIGHT}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){let n=document.createElement("mark");n.classList.add("overlaidText"),n.textContent=t,this.container.append(n)}return this.container}},Sf=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.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("underlineAnnotation"),t){let n=document.createElement("u");n.classList.add("overlaidText"),n.textContent=t,this.container.append(n)}return this.container}},Ef=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.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("squigglyAnnotation"),t){let n=document.createElement("u");n.classList.add("overlaidText"),n.textContent=t,this.container.append(n)}return this.container}},Tf=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.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("strikeoutAnnotation"),t){let n=document.createElement("s");n.classList.add("overlaidText"),n.textContent=t,this.container.append(n)}return this.container}},Bl=class extends At{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=P.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},wf=class extends At{#t=null;constructor(t){super(t,{isRenderable:!0});let{fileId:e,file:n}=this.data;this.filename=n.filename,this.content=n.content,this.fileId=e,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,attachmentId:this.fileId,...n})}render(){this.container.classList.add("fileAttachmentAnnotation");let{container:t,data:e}=this,n;e.hasAppearance||e.fillAlpha===0?n=document.createElement("div"):(n=document.createElement("img"),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(e.name)?"paperclip":"pushpin"}.svg`,e.fillAlpha&&e.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(e.fillAlpha*100)}%);`)),n.addEventListener("dblclick",this.#e.bind(this)),this.#t=n;let{isMac:s}=J.platform;return t.addEventListener("keydown",a=>{a.key==="Enter"&&(s?a.metaKey:a.ctrlKey)&&this.#e()}),!e.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):n.classList.add("popupTriggerArea"),t.append(n),t}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}async#e(){let{fileId:t,filename:e,content:n}=this,s=await this.linkService.getAttachmentContent(t)||n;s&&this.downloadManager?.openOrDownloadData(s,e)}},zl=class extends At{#t=new AbortController;#e=null;#i=null;constructor(t){super(t,{isRenderable:!!t.data.richMedia})}render(){this.container.classList.add("mediaAnnotation");let{filename:t}=this.data.richMedia,e=document.createElement("button");return e.className="mediaPlayButton",e.type="button",e.title=e.ariaLabel=t,e.addEventListener("click",()=>this.#n(e),{signal:this.#t.signal}),this.container.append(e),this.container}async#n(t){let{fileId:e,filename:n,contentType:s}=this.data.richMedia;t.disabled=!0;let a;try{a=await this.linkService.getAttachmentContent(e)}catch{return}finally{t.disabled=!1}if(!a||!t.isConnected)return;let{signal:r}=this.#t,o=URL.createObjectURL(new Blob([a],{type:s}));this.#e=o;let l=s.startsWith("audio/"),c=document.createElement(l?"audio":"video");if(this.#i=c,c.className="mediaContent",this._setBackgroundColor(c),c.src=o,c.title=n,c.controls=!0,c.autoplay=!0,c.tabIndex=0,l){let u=!1,h=!1,d=()=>{c.controls=u||h};this.container.addEventListener("pointerenter",()=>{u=!0,d()},{signal:r}),this.container.addEventListener("pointerleave",()=>{u=!1,d()},{signal:r}),this.container.addEventListener("focusin",()=>{h=!0,d()},{signal:r}),this.container.addEventListener("focusout",()=>{h=!1,d()},{signal:r})}c.addEventListener("emptied",()=>this.#s(o),{once:!0,signal:r}),t.replaceWith(c),c.play().catch(()=>{})}#s(t=this.#e){t&&t===this.#e&&(URL.revokeObjectURL(t),this.#e=null)}destroy(){this.#t.abort(),this.#i&&(this.#i.pause(),this.#i.removeAttribute("src"),this.#i.load(),this.#i=null),this.#s()}},Pl=class i{#t=null;#e=null;#i=null;#n=new Map;#s=null;#r=null;#a=[];#o=!1;zIndex=0;constructor({div:t,accessibilityManager:e,annotationCanvasMap:n,annotationEditorUIManager:s,page:a,viewport:r,structTreeLayer:o,commentManager:l,linkService:c,annotationStorage:u}){this.div=t,this.#t=e,this.#e=n,this.#s=o||null,this.#r=c||null,this.#i=u||new mr,this.page=a,this.viewport=r,this._annotationEditorUIManager=s,this._commentManager=l||null}hasEditableAnnotations(){return this.#n.size>0}async render(t){let{annotations:e,optionalContentConfig:n}=t,s=this.div;an(s,this.viewport);let a=new Map,r=[],o={data:null,layer:s,linkService:this.#r,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new Ln,annotationStorage:this.#i,enableComment:t.enableComment===!0,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(let l of e){if(l.noHTML)continue;let c=l.annotationType===bt.POPUP;if(c){let d=a.get(l.id);if(!d)continue;if(!this._commentManager){r.push(l);continue}o.elements=d}else if(l.rect[2]===l.rect[0]||l.rect[3]===l.rect[1])continue;o.data=l;let u=lr.create(o);if(!u.isRenderable)continue;c||(this.#a.push(u),l.popupRef&&a.getOrInsertComputed(l.popupRef,Ys).push(u));let h=u.render();l.hidden&&(h.style.visibility="hidden"),u.updateOC(n),u._isEditable&&(this.#n.set(u.data.id,u),this._annotationEditorUIManager?.renderAnnotationElement(u))}await this.#c();for(let l of r){let c=o.elements=a.get(l.id);o.data=l;let u=lr.create(o);if(!u.isRenderable)continue;let h=u.render();u.contentElement.id=`${Ls}${l.id}`,l.hidden&&(h.style.visibility="hidden"),c.at(-1).container.after(h)}this.#l()}async#c(){if(this.#a.length===0)return;this.div.replaceChildren();let t=[];if(!this.#o){this.#o=!0;for(let{contentElement:n,data:{id:s}}of this.#a){let a=n.id=`${Ls}${s}`;t.push(this.#s?.getAriaAttributes(a).then(r=>{if(r)for(let[o,l]of r)n.setAttribute(o,l)}))}}this.#a.sort(({data:{rect:[n,s,a,r]}},{data:{rect:[o,l,c,u]}})=>{if(n===a&&s===r)return 1;if(o===c&&l===u)return-1;let h=r,d=s,f=(s+r)/2,m=u,y=l,v=(l+u)/2;if(f>=m&&v<=d)return-1;if(v>=h&&f<=y)return 1;let p=(n+a)/2,g=(o+c)/2;return p-g});let e=document.createDocumentFragment();for(let n of this.#a)e.append(n.container),this._commentManager?(n.extraPopupElement?.popup||n.popup)?.renderCommentButton():n.extraPopupElement&&e.append(n.extraPopupElement.render());if(this.div.append(e),await Promise.all(t),this.#t)for(let n of this.#a)this.#t.addPointerInTextLayer(n.contentElement,!1)}async addLinkAnnotations(t){let e={data:null,layer:this.div,linkService:this.#r,svgFactory:new Ln,parent:this};for(let n of t){n.borderStyle||=i._defaultBorderStyle,e.data=n;let s=lr.create(e);s.isRenderable&&(s.render(),s.contentElement.id=`${Ls}${n.id}`,this.#a.push(s))}await this.#c()}update({viewport:t,optionalContentConfig:e}){let n=this.div;this.viewport=t,an(n,{rotation:t.rotation});for(let s of this.#a)s.updateOC(e);this.#l(),n.hidden=!1}destroy(){for(let t of this.#a)t.destroy?.(),this.#t?.removePointerInTextLayer(t.contentElement);this.#a.length=0,this.#n.clear(),this.div.replaceChildren()}#l(){if(!this.#e)return;let t=this.div;for(let[e,n]of this.#e){let s=t.querySelector(`[data-annotation-id="${e}"]`);if(!s)continue;if(Array.isArray(n))for(let c of n)c.className="annotationContent",c.ariaHidden=!0;else n.className="annotationContent",n.ariaHidden=!0;let a=[];for(let c of s.children)c.nodeName==="CANVAS"&&a.push(c);for(let c of a)c.remove();let r=Array.isArray(n)?n[0]:n,{firstChild:o}=s;if(o?o.classList.contains("annotationContent")?o.after(r):o.before(r):s.append(r),Array.isArray(n)){let c=r;for(let u=1,h=n.length;u<h;u++)c.after(n[u]),c=n[u]}this.#e.delete(e);let l=this.#n.get(e);l&&(l._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(e,s.id,n),l._hasNoCanvas=!1):l.canvas=n)}}refreshCanvases(){this.#l()}getEditableAnnotations(){return this.#n.values()}getEditableAnnotation(t){return this.#n.get(t)}addFakeAnnotation(t){let{div:e}=this,{id:n,rotation:s}=t,a=new of({data:{id:n,rect:t.getPDFRect(),rotation:s},editor:t,layer:e,parent:this,enableComment:!!this._commentManager,linkService:this.#r,annotationStorage:this.#i});return a.render(),a.contentElement.id=`${Ls}${n}`,a.createOrUpdatePopup(),this.#a.push(a),a}removeAnnotation(t){let e=this.#a.findIndex(s=>s.data.id===t);if(e<0)return;let[n]=this.#a.splice(e,1);this.#t?.removePointerInTextLayer(n.contentElement)}updateFakeAnnotations(t){if(t.length!==0){for(let e of t)e.updateFakeAnnotationElement(this);this.#c()}}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}static get _defaultBorderStyle(){return L(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:Ns.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},fl=/\r\n?|\n/g,_f=class i extends tt{#t="";#e=`${this.id}-editor`;#i=null;#n;_colorPicker=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let t=i.prototype,e=a=>a.isEmpty(),n=rn.TRANSLATE_SMALL,s=rn.TRANSLATE_BIG;return L(this,"_keyboardManager",new kn([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter"],t.commitOrRemove],[["Escape"],t.commitOrRemove],[["ArrowLeft"],t._translateEmpty,{args:[-n,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-s,0],checker:e}],[["ArrowRight"],t._translateEmpty,{args:[n,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[s,0],checker:e}],[["ArrowUp"],t._translateEmpty,{args:[0,-n],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-s],checker:e}],[["ArrowDown"],t._translateEmpty,{args:[0,n],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,s],checker:e}]]))}static _type="freetext";static _editorType=P.FREETEXT;constructor(t){super({...t,name:"freeTextEditor"}),this.color=t.color||i._defaultColor||tt._defaultLineColor,this.#n=t.fontSize||i._defaultFontSize,this.annotationElementId||this._uiManager.a11yAlert(tt._l10nAlert.freetext),this.canAddComment=!1}static initialize(t,e){tt.initialize(t,e);let n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case H.FREETEXT_SIZE:i._defaultFontSize=e;break;case H.FREETEXT_COLOR:i._defaultColor=e;break}}updateParams(t,e){switch(t){case H.FREETEXT_SIZE:this.#s(e);break;case H.FREETEXT_COLOR:this.#r(e);break}}static get defaultPropertiesToUpdate(){return[[H.FREETEXT_SIZE,i._defaultFontSize],[H.FREETEXT_COLOR,i._defaultColor||tt._defaultLineColor]]}get propertiesToUpdate(){return[[H.FREETEXT_SIZE,this.#n],[H.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||=new Ol(this),[["colorPicker",this._colorPicker]]}get colorType(){return H.FREETEXT_COLOR}#s(t){let e=s=>{this.editorDiv.style.fontSize=`calc(${s}px * var(--total-scale-factor))`,this.translate(0,-(s-this.#n)*this.parentScale),this.#n=s,this.#o()},n=this.#n;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:H.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}onUpdatedColor(){this.editorDiv.style.color=this.color,this._colorPicker?.update(this.color),super.onUpdatedColor()}#r(t){let e=s=>{this.color=s,this.onUpdatedColor()},n=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:H.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){let t=this.parentScale;return[-i._internalPadding*t,-(i._internalPadding+this.#n)*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()}#a(){let t=[];this.editorDiv.normalize();let e=null;for(let n of this.editorDiv.childNodes)e?.nodeType===Node.TEXT_NODE&&n.nodeName==="BR"||(t.push(i.#c(n)),e=n);return t.join(`
56
56
  `)}#o(){let[t,e]=this.parentDimensions,n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{let{currentLayer:s,div:a}=this,r=a.style.display,o=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",s.div.append(this.div),n=a.getBoundingClientRect(),a.remove(),a.style.display=r,a.classList.toggle("hidden",o)}this.rotation%180===this.parentRotation%180?(this.width=n.width/t,this.height=n.height/e):(this.width=n.height/t,this.height=n.width/e),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let t=this.#t,e=this.#t=this.#a().trimEnd();if(t===e)return;let n=s=>{if(this.#t=s,!s){this.remove();return}this.#l(),this._uiManager.rebuild(this),this.#o()};this.addCommands({cmd:()=>{n(e)},undo:()=>{n(t)},mustExec:!1}),this.#o()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(t){t.target===this.div&&t.key==="Enter"&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){i._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let t,e;(this._isCopy||this.annotationElementId)&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#e),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;let{style:n}=this.editorDiv;if(n.fontSize=`calc(${this.#n}px * var(--total-scale-factor))`,n.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){let[s,a]=this.parentDimensions;if(this.annotationElementId){let{position:r}=this._initialData,[o,l]=this.getInitialTranslation();[o,l]=this.pageTranslationToScreen(o,l);let[c,u]=this.pageDimensions,[h,d]=this.pageTranslation,f,m;switch(this.rotation){case 0:f=t+(r[0]-h)/c,m=e+this.height-(r[1]-d)/u;break;case 90:f=t+(r[0]-h)/c,m=e-(r[1]-d)/u,[o,l]=[l,-o];break;case 180:f=t-this.width+(r[0]-h)/c,m=e-(r[1]-d)/u,[o,l]=[-o,-l];break;case 270:f=t+(r[0]-h-this.height*u)/c,m=e+(r[1]-d-this.width*c)/u,[o,l]=[-l,o];break}this.setAt(f*s,m*a,o,l)}else this._moveAfterPaste(t,e);this.#l(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#c(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(fl,"")}editorDivPaste(t){let e=t.clipboardData||window.clipboardData,{types:n}=e;if(n.length===1&&n[0]==="text/plain")return;t.preventDefault();let s=i.#h(e.getData("text")||"").replaceAll(fl,`
57
57
  `);if(!s)return;let a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();let r=a.getRangeAt(0);if(!s.includes(`
58
58
  `)){r.insertNode(document.createTextNode(s)),this.editorDiv.normalize(),a.collapseToStart();return}let{startContainer:o,startOffset:l}=r,c=[],u=[];if(o.nodeType===Node.TEXT_NODE){let f=o.parentElement;if(u.push(o.nodeValue.slice(l).replaceAll(fl,"")),f!==this.editorDiv){let m=c;for(let y of this.editorDiv.childNodes){if(y===f){m=u;continue}m.push(i.#c(y))}}c.push(o.nodeValue.slice(0,l).replaceAll(fl,""))}else if(o===this.editorDiv){let f=c,m=0;for(let y of this.editorDiv.childNodes)m++===l&&(f=u),f.push(i.#c(y))}this.#t=`${c.join(`
59
59
  `)}${s}${u.join(`
60
60
  `)}`,this.#l();let h=new Range,d=Math.sumPrecise(c.map(f=>f.length));for(let{firstChild:f}of this.editorDiv.childNodes)if(f.nodeType===Node.TEXT_NODE){let m=f.nodeValue.length;if(d<=m){h.setStart(f,d),h.setEnd(f,d);break}d-=m}a.removeAllRanges(),a.addRange(h)}#l(){if(this.editorDiv.replaceChildren(),!!this.#t)for(let t of this.#t.split(`
61
- `)){let e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}#d(){return this.#t.replaceAll("\xA0"," ")}static#h(t){return t.replaceAll(" ","\xA0")}get contentDiv(){return this.editorDiv}getPDFRect(){let t=i._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,e,n){let s=null;if(t instanceof Ll){let{data:{defaultAppearanceData:{fontSize:r,fontColor:o},rect:l,rotation:c,id:u,popupRef:h,richText:d,contentsObj:f,creationDate:m,modificationDate:y},textContent:v,textPosition:p,parent:{page:{pageNumber:g}}}=t;if(!v?.length)return null;s=t={annotationType:P.FREETEXT,color:Array.from(o),fontSize:r,value:v.join(`
61
+ `)){let e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}#d(){return this.#t.replaceAll("\xA0"," ")}static#h(t){return t.replaceAll(" ","\xA0")}get contentDiv(){return this.editorDiv}getPDFRect(){let t=i._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,e,n){let s=null;if(t instanceof Nl){let{data:{defaultAppearanceData:{fontSize:r,fontColor:o},rect:l,rotation:c,id:u,popupRef:h,richText:d,contentsObj:f,creationDate:m,modificationDate:y},textContent:v,textPosition:p,parent:{page:{pageNumber:g}}}=t;if(!v?.length)return null;s=t={annotationType:P.FREETEXT,color:Array.from(o),fontSize:r,value:v.join(`
62
62
  `),position:p,pageIndex:g-1,rect:l.slice(0),rotation:c,annotationElementId:u,id:u,deleted:!1,popupRef:h,comment:f?.str||null,richText:d,creationDate:m,modificationDate:y}}let a=await super.deserialize(t,e,n);return a.#n=t.fontSize,a.color=M.makeHexColor(...t.color),a.#t=i.#h(t.value),a._initialData=s,t.comment&&a.setCommentData(t),a}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),n=Object.assign(super.serialize(t),{color:e,fontSize:this.#n,value:this.#d()});return this.addComment(n),t?(n.isCopy=!0,n):this.annotationElementId&&!this.#p(n)?null:(n.id=this.annotationElementId,n)}#p(t){let{value:e,fontSize:n,color:s,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||t.value!==e||t.fontSize!==n||t.color.some((r,o)=>r!==s[o])||t.pageIndex!==a}renderAnnotationElement(t){let e=super.renderAnnotationElement(t);if(!e)return null;let{style:n}=e;n.fontSize=`calc(${this.#n}px * var(--total-scale-factor))`,n.color=this.color,e.replaceChildren();for(let s of this.#t.split(`
63
- `)){let a=document.createElement("div");a.append(s?document.createTextNode(s):document.createElement("br")),e.append(a)}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()}},O=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,n,s,a,r){r||=new Float32Array(t.length);for(let o=0,l=t.length;o<l;o+=2)r[o]=e+t[o]*s,r[o+1]=n+t[o+1]*a;return r}static _rescaleAndSwap(t,e,n,s,a,r){r||=new Float32Array(t.length);for(let o=0,l=t.length;o<l;o+=2)r[o]=e+t[o+1]*s,r[o+1]=n+t[o]*a;return r}static _translate(t,e,n,s){s||=new Float32Array(t.length);for(let a=0,r=t.length;a<r;a+=2)s[a]=e+t[a],s[a+1]=n+t[a+1];return s}static svgRound(t){return Math.round(t*1e4)}static _normalizePoint(t,e,n,s,a){switch(a){case 90:return[1-e/n,t/s];case 180:return[1-t/n,1-e/s];case 270:return[e/n,1-t/s];default:return[t/n,e/s]}}static createBezierPoints(t,e,n,s,a,r){return[(t+5*n)/6,(e+5*s)/6,(5*n+a)/6,(5*s+r)/6,(n+a)/2,(s+r)/2]}},Fl=class i{#t;#e=[];#i;#n;#s=[];#r=new Float32Array(18);#a;#o;#c;#l;#d;#h;#p=[];static#m=8;static#g=2;static#u=i.#m+i.#g;constructor({x:t,y:e},n,s,a,r,o=0){this.#t=n,this.#h=a*s,this.#n=r,this.#r.set([NaN,NaN,NaN,NaN,t,e],6),this.#i=o,this.#l=i.#m*s,this.#c=i.#u*s,this.#d=s,this.#p.push(t,e)}isEmpty(){return isNaN(this.#r[8])}#f(){let t=this.#r.subarray(4,6),e=this.#r.subarray(16,18),[n,s,a,r]=this.#t;return[(this.#a+(t[0]-e[0])/2-n)/a,(this.#o+(t[1]-e[1])/2-s)/r,(this.#a+(e[0]-t[0])/2-n)/a,(this.#o+(e[1]-t[1])/2-s)/r]}add({x:t,y:e}){this.#a=t,this.#o=e;let[n,s,a,r]=this.#t,[o,l,c,u]=this.#r.subarray(8,12),h=t-c,d=e-u,f=Math.hypot(h,d);if(f<this.#c)return!1;let m=f-this.#l,y=m/f,v=y*h,p=y*d,g=o,b=l;o=c,l=u,c+=v,u+=p,this.#p?.push(t,e);let A=-p/m,S=v/m,E=A*this.#h,T=S*this.#h;return this.#r.set(this.#r.subarray(2,8),0),this.#r.set([c+E,u+T],4),this.#r.set(this.#r.subarray(14,18),12),this.#r.set([c-E,u-T],16),isNaN(this.#r[6])?(this.#s.length===0&&(this.#r.set([o+E,l+T],2),this.#s.push(NaN,NaN,NaN,NaN,(o+E-n)/a,(l+T-s)/r),this.#r.set([o-E,l-T],14),this.#e.push(NaN,NaN,NaN,NaN,(o-E-n)/a,(l-T-s)/r)),this.#r.set([g,b,o,l,c,u],6),!this.isEmpty()):(this.#r.set([g,b,o,l,c,u],6),Math.abs(Math.atan2(b-l,g-o)-Math.atan2(p,v))<Math.PI/2?([o,l,c,u]=this.#r.subarray(2,6),this.#s.push(NaN,NaN,NaN,NaN,((o+c)/2-n)/a,((l+u)/2-s)/r),[o,l,g,b]=this.#r.subarray(14,18),this.#e.push(NaN,NaN,NaN,NaN,((g+o)/2-n)/a,((b+l)/2-s)/r),!0):([g,b,o,l,c,u]=this.#r.subarray(0,6),this.#s.push(((g+5*o)/6-n)/a,((b+5*l)/6-s)/r,((5*o+c)/6-n)/a,((5*l+u)/6-s)/r,((o+c)/2-n)/a,((l+u)/2-s)/r),[c,u,o,l,g,b]=this.#r.subarray(12,18),this.#e.push(((g+5*o)/6-n)/a,((b+5*l)/6-s)/r,((5*o+c)/6-n)/a,((5*l+u)/6-s)/r,((o+c)/2-n)/a,((l+u)/2-s)/r),!0))}toSVGPath(){if(this.isEmpty())return"";let t=this.#s,e=this.#e;if(isNaN(this.#r[6])&&!this.isEmpty())return this.#b();let n=[];n.push(`M${t[4]} ${t[5]}`);for(let s=6;s<t.length;s+=6)isNaN(t[s])?n.push(`L${t[s+4]} ${t[s+5]}`):n.push(`C${t[s]} ${t[s+1]} ${t[s+2]} ${t[s+3]} ${t[s+4]} ${t[s+5]}`);this.#y(n);for(let s=e.length-6;s>=6;s-=6)isNaN(e[s])?n.push(`L${e[s+4]} ${e[s+5]}`):n.push(`C${e[s]} ${e[s+1]} ${e[s+2]} ${e[s+3]} ${e[s+4]} ${e[s+5]}`);return this.#v(n),n.join(" ")}#b(){let[t,e,n,s]=this.#t,[a,r,o,l]=this.#f();return`M${(this.#r[2]-t)/n} ${(this.#r[3]-e)/s} L${(this.#r[4]-t)/n} ${(this.#r[5]-e)/s} L${a} ${r} L${o} ${l} L${(this.#r[16]-t)/n} ${(this.#r[17]-e)/s} L${(this.#r[14]-t)/n} ${(this.#r[15]-e)/s} Z`}#v(t){let e=this.#e;t.push(`L${e[4]} ${e[5]} Z`)}#y(t){let[e,n,s,a]=this.#t,r=this.#r.subarray(4,6),o=this.#r.subarray(16,18),[l,c,u,h]=this.#f();t.push(`L${(r[0]-e)/s} ${(r[1]-n)/a} L${l} ${c} L${u} ${h} L${(o[0]-e)/s} ${(o[1]-n)/a}`)}newFreeDrawOutline(t,e,n,s,a,r){return new Hl(t,e,n,s,a,r)}getOutlines(){let t=this.#s,e=this.#e,n=this.#r,[s,a,r,o]=this.#t,l=new Float32Array((this.#p?.length??0)+2);for(let h=0,d=l.length-2;h<d;h+=2)l[h]=(this.#p[h]-s)/r,l[h+1]=(this.#p[h+1]-a)/o;if(l[l.length-2]=(this.#a-s)/r,l[l.length-1]=(this.#o-a)/o,isNaN(n[6])&&!this.isEmpty())return this.#T(l);let c=new Float32Array(this.#s.length+24+this.#e.length),u=t.length;for(let h=0;h<u;h+=2){if(isNaN(t[h])){c[h]=c[h+1]=NaN;continue}c[h]=t[h],c[h+1]=t[h+1]}u=this.#A(c,u);for(let h=e.length-6;h>=6;h-=6)for(let d=0;d<6;d+=2){if(isNaN(e[h+d])){c[u]=c[u+1]=NaN,u+=2;continue}c[u]=e[h+d],c[u+1]=e[h+d+1],u+=2}return this.#w(c,u),this.newFreeDrawOutline(c,l,this.#t,this.#d,this.#i,this.#n)}#T(t){let e=this.#r,[n,s,a,r]=this.#t,[o,l,c,u]=this.#f(),h=new Float32Array(36);return h.set([NaN,NaN,NaN,NaN,(e[2]-n)/a,(e[3]-s)/r,NaN,NaN,NaN,NaN,(e[4]-n)/a,(e[5]-s)/r,NaN,NaN,NaN,NaN,o,l,NaN,NaN,NaN,NaN,c,u,NaN,NaN,NaN,NaN,(e[16]-n)/a,(e[17]-s)/r,NaN,NaN,NaN,NaN,(e[14]-n)/a,(e[15]-s)/r],0),this.newFreeDrawOutline(h,t,this.#t,this.#d,this.#i,this.#n)}#w(t,e){let n=this.#e;return t.set([NaN,NaN,NaN,NaN,n[4],n[5]],e),e+=6}#A(t,e){let n=this.#r.subarray(4,6),s=this.#r.subarray(16,18),[a,r,o,l]=this.#t,[c,u,h,d]=this.#f();return t.set([NaN,NaN,NaN,NaN,(n[0]-a)/o,(n[1]-r)/l,NaN,NaN,NaN,NaN,c,u,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,(s[0]-a)/o,(s[1]-r)/l],e),e+=24}},Hl=class extends O{#t;#e=new Float32Array(4);#i;#n;#s;#r;#a;constructor(t,e,n,s,a,r){super(),this.#a=t,this.#s=e,this.#t=n,this.#r=s,this.#i=a,this.#n=r,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#o(r);let[o,l,c,u]=this.#e;for(let h=0,d=t.length;h<d;h+=2)t[h]=(t[h]-o)/c,t[h+1]=(t[h+1]-l)/u;for(let h=0,d=e.length;h<d;h+=2)e[h]=(e[h]-o)/c,e[h+1]=(e[h+1]-l)/u}toSVGPath(){let t=[`M${this.#a[4]} ${this.#a[5]}`];for(let e=6,n=this.#a.length;e<n;e+=6){if(isNaN(this.#a[e])){t.push(`L${this.#a[e+4]} ${this.#a[e+5]}`);continue}t.push(`C${this.#a[e]} ${this.#a[e+1]} ${this.#a[e+2]} ${this.#a[e+3]} ${this.#a[e+4]} ${this.#a[e+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,e,n,s],a){let r=n-t,o=s-e,l,c;switch(a){case 0:l=O._rescale(this.#a,t,s,r,-o),c=O._rescale(this.#s,t,s,r,-o);break;case 90:l=O._rescaleAndSwap(this.#a,t,e,r,o),c=O._rescaleAndSwap(this.#s,t,e,r,o);break;case 180:l=O._rescale(this.#a,n,e,-r,o),c=O._rescale(this.#s,n,e,-r,o);break;case 270:l=O._rescaleAndSwap(this.#a,n,s,-r,-o),c=O._rescaleAndSwap(this.#s,n,s,-r,-o);break}return{outline:Array.from(l),points:[Array.from(c)]}}#o(t){let e=this.#a,n=e[4],s=e[5],a=[n,s,n,s],r=n,o=s,l=n,c=s,u=t?Math.max:Math.min,h=new Float32Array(4);for(let f=6,m=e.length;f<m;f+=6){let y=e[f+4],v=e[f+5];isNaN(e[f])?(M.pointBoundingBox(y,v,a),o>v?(r=y,o=v):o===v&&(r=u(r,y)),c<v?(l=y,c=v):c===v&&(l=u(l,y))):(h.set(Ti,0),M.bezierBoundingBox(n,s,...e.slice(f,f+6),h),M.rectBoundingBox(...h,a),o>h[1]?(r=h[0],o=h[1]):o===h[1]&&(r=u(r,h[0])),c<h[3]?(l=h[2],c=h[3]):c===h[3]&&(l=u(l,h[2]))),n=y,s=v}let d=this.#e;d[0]=a[0]-this.#i,d[1]=a[1]-this.#i,d[2]=a[2]-a[0]+2*this.#i,d[3]=a[3]-a[1]+2*this.#i,this.firstPoint=[r,o],this.lastPoint=[l,c]}get box(){return this.#e}newOutliner(t,e,n,s,a,r=0){return new Fl(t,e,n,s,a,r)}getNewOutline(t,e){let[n,s,a,r]=this.#e,[o,l,c,u]=this.#t,h=a*c,d=r*u,f=n*c+o,m=s*u+l,y=this.newOutliner({x:this.#s[0]*h+f,y:this.#s[1]*d+m},this.#t,this.#r,t,this.#n,e??this.#i);for(let v=2;v<this.#s.length;v+=2)y.add({x:this.#s[v]*h+f,y:this.#s[v+1]*d+m});return y.getOutlines()}},wr=class{#t;#e;#i;#n=[];#s=[];constructor(t,e=0,n=0,s=!0){let a=Ti.slice(),o=10**-4;for(let{x:v,y:p,width:g,height:b}of t){let A=Math.floor((v-e)/o)*o,S=Math.ceil((v+g+e)/o)*o,E=Math.floor((p-e)/o)*o,T=Math.ceil((p+b+e)/o)*o,w=[A,E,T,!0],_=[S,E,T,!1];this.#n.push(w,_),M.rectBoundingBox(A,E,S,T,a)}let l=a[2]-a[0]+2*n,c=a[3]-a[1]+2*n,u=a[0]-n,h=a[1]-n,d=s?-1/0:1/0,f=1/0,m=this.#n.at(s?-1:-2),y=[m[0],m[2]];for(let v of this.#n){let[p,g,b,A]=v;!A&&s?g<f?(f=g,d=p):g===f&&(d=Math.max(d,p)):A&&!s&&(g<f?(f=g,d=p):g===f&&(d=Math.min(d,p))),v[0]=(p-u)/l,v[1]=(g-h)/c,v[2]=(b-h)/c}this.#t=new Float32Array([u,h,l,c]),this.#e=[d,f],this.#i=y}getOutlines(){this.#n.sort((e,n)=>e[0]-n[0]||e[1]-n[1]||e[2]-n[2]);let t=[];for(let e of this.#n)e[3]?(t.push(...this.#l(e)),this.#o(e)):(this.#c(e),t.push(...this.#l(e)));return this.#r(t)}#r(t){let e=[],n=new Set;for(let r of t){let[o,l,c]=r;e.push([o,l,r],[o,c,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],c=e[r+1][2];l.push(c),c.push(l),n.add(l),n.add(c)}let s=[],a;for(;n.size>0;){let r=n.values().next().value,[o,l,c,u,h]=r;n.delete(r);let d=o,f=l;for(a=[o,c],s.push(a);;){let m;if(n.has(u))m=u;else if(n.has(h))m=h;else break;n.delete(m),[o,l,c,u,h]=m,d!==o&&(a.push(d,f,o,f===l?l:c),d=o),f=f===l?c:l}a.push(d,f)}return new Cf(s,this.#t,this.#e,this.#i)}#a(t){let e=this.#s,n=0,s=e.length-1;for(;n<=s;){let a=n+s>>1,r=e[a][0];if(r===t)return a;r<t?n=a+1:s=a-1}return s+1}#o([,t,e]){let n=this.#a(t);this.#s.splice(n,0,[t,e])}#c([,t,e]){let n=this.#a(t);for(let s=n;s<this.#s.length;s++){let[a,r]=this.#s[s];if(a!==t)break;if(a===t&&r===e){this.#s.splice(s,1);return}}for(let s=n-1;s>=0;s--){let[a,r]=this.#s[s];if(a!==t)break;if(a===t&&r===e){this.#s.splice(s,1);return}}}#l(t){let[e,n,s]=t,a=[[e,n,s]],r=this.#a(s);for(let o=0;o<r;o++){let[l,c]=this.#s[o];for(let u=0,h=a.length;u<h;u++){let[,d,f]=a[u];if(!(c<=d||f<=l)){if(d>=l){if(f>c)a[u][1]=c;else{if(h===1)return[];a.splice(u,1),u--,h--}continue}a[u][2]=l,f>c&&a.push([e,c,f])}}}return a}},Cf=class extends O{#t;#e;constructor(t,e,n,s){super(),this.#e=t,this.#t=e,this.firstPoint=n,this.lastPoint=s}toSVGPath(){let t=[];for(let e of this.#e){let[n,s]=e;t.push(`M${n} ${s}`);for(let a=2;a<e.length;a+=2){let r=e[a],o=e[a+1];r===n?(t.push(`V${o}`),s=o):o===s&&(t.push(`H${r}`),n=r)}t.push("Z")}return t.join(" ")}serialize([t,e,n,s],a){let r=[],o=n-t,l=s-e;for(let c of this.#e){let u=new Array(c.length);for(let h=0;h<c.length;h+=2)u[h]=t+c[h]*o,u[h+1]=s-c[h+1]*l;r.push(u)}return r}get box(){return this.#t}},_r=class extends Fl{newFreeDrawOutline(t,e,n,s,a,r){return new Mf(t,e,n,s,a,r)}},Mf=class extends Hl{newOutliner(t,e,n,s,a,r=0){return new _r(t,e,n,s,a,r)}},Ul=class i extends tt{#t=null;#e=0;#i;#n=null;#s=null;#r=null;#a=null;#o=0;#c=null;#l=null;#d=null;#h=!1;#p=null;#m=null;#g=null;#u="";#f;#b="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=P.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){let t=i.prototype;return B(this,"_keyboardManager",new Ln([[["ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super({...t,name:"highlightEditor"}),this.color=t.color||i._defaultColor,this.#f=t.thickness||i._defaultThickness,this.opacity=t.opacity||i._defaultOpacity,this.#i=t.boxes||null,this.#b=t.methodOfCreation||"",this.#u=t.text||"",this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",t.highlightId>-1?(this.#h=!0,this.#y(t),this.#E()):this.#i&&(this.#t=t.anchorNode,this.#e=t.anchorOffset,this.#a=t.focusNode,this.#o=t.focusOffset,this.#v(),this.#E(),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert(tt._l10nAlert.highlight)}get telemetryInitialData(){return{action:"added",type:this.#h?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this.#f,methodOfCreation:this.#b}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#v(){let t=new wr(this.#i,.001);this.#l=t.getOutlines(),[this.x,this.y,this.width,this.height]=this.#l.box;let e=new wr(this.#i,.0025,.001,this._uiManager.direction==="ltr");this.#r=e.getOutlines();let{firstPoint:n}=this.#l;this.#p=[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height];let{lastPoint:s}=this.#r;this.#m=[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height]}#y({highlightOutlines:t,highlightId:e,clipPathId:n}){this.#l=t;let s=1.5;if(this.#r=t.getNewOutline(this.#f/2+s,.0025),e>=0)this.#d=e,this.#n=n,this.parent.drawLayer.finalizeDraw(e,{bbox:t.box,path:{d:t.toSVGPath()}}),this.#g=this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:this.#r.box,path:{d:this.#r.toSVGPath()}},!0);else if(this.parent){let h=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(this.#d,{bbox:i.#C(this.#l.box,(h-this.rotation+360)%360),path:{d:t.toSVGPath()}}),this.parent.drawLayer.updateProperties(this.#g,{bbox:i.#C(this.#r.box,h),path:{d:this.#r.toSVGPath()}})}let[a,r,o,l]=t.box;switch(this.rotation){case 0:this.x=a,this.y=r,this.width=o,this.height=l;break;case 90:{let[h,d]=this.parentDimensions;this.x=r,this.y=1-a,this.width=o*d/h,this.height=l*h/d;break}case 180:this.x=1-a,this.y=1-r,this.width=o,this.height=l;break;case 270:{let[h,d]=this.parentDimensions;this.x=1-r,this.y=a,this.width=o*d/h,this.height=l*h/d;break}}let{firstPoint:c}=t;this.#p=[(c[0]-a)/o,(c[1]-r)/l];let{lastPoint:u}=this.#r;this.#m=[(u[0]-a)/o,(u[1]-r)/l]}static initialize(t,e){tt.initialize(t,e),i._defaultColor||=e.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,e){switch(t){case H.HIGHLIGHT_COLOR:i._defaultColor=e;break;case H.HIGHLIGHT_THICKNESS:i._defaultThickness=e;break}}translateInPage(t,e){}get toolbarPosition(){return this.#m}get commentButtonPosition(){return this.#p}updateParams(t,e){switch(t){case H.HIGHLIGHT_COLOR:this.#T(e);break;case H.HIGHLIGHT_THICKNESS:this.#w(e);break}}static get defaultPropertiesToUpdate(){return[[H.HIGHLIGHT_COLOR,i._defaultColor],[H.HIGHLIGHT_THICKNESS,i._defaultThickness]]}get propertiesToUpdate(){return[[H.HIGHLIGHT_COLOR,this.color||i._defaultColor],[H.HIGHLIGHT_THICKNESS,this.#f||i._defaultThickness],[H.HIGHLIGHT_FREE,this.#h]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(this.#d,{root:{fill:this.color,"fill-opacity":this.opacity}}),this.#s?.updateColor(this.color),super.onUpdatedColor()}#T(t){let e=(a,r)=>{this.color=a,this.opacity=r,this.onUpdatedColor()},n=this.color,s=this.opacity;this.addCommands({cmd:e.bind(this,t,i._defaultOpacity),undo:e.bind(this,n,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:H.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(t)},!0)}#w(t){let e=this.#f,n=s=>{this.#f=s,this.#A(s)};this.addCommands({cmd:n.bind(this,t),undo:n.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:H.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",this.#s=new Ar({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.#M())}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,this.#M())}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){this.#_(),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.#_():t&&(this.#E(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),e&&this.select()}#A(t){this.#h&&(this.#y({highlightOutlines:this.#l.getNewOutline(t/2)}),this.fixAndSetPosition(),this.setDims())}#_(){this.#d===null||!this.parent||(this.parent.drawLayer.remove(this.#d),this.#d=null,this.parent.drawLayer.remove(this.#g),this.#g=null)}#E(t=this.parent){this.#d===null&&({id:this.#d,clipPathId:this.#n}=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.#h},path:{d:this.#l.toSVGPath()}},!1,!0),this.#g=t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:this.#h},bbox:this.#r.box,path:{d:this.#r.toSVGPath()}},this.#h),this.#c&&(this.#c.style.clipPath=this.#n))}static#C([t,e,n,s],a){switch(a){case 90:return[1-e-s,t,s,n];case 180:return[1-t-n,1-e-s,n,s];case 270:return[e,1-t-n,s,n]}return[t,e,n,s]}rotate(t){let{drawLayer:e}=this.parent,n;this.#h?(t=(t-this.rotation+360)%360,n=i.#C(this.#l.box,t)):n=i.#C([this.x,this.y,this.width,this.height],t),e.updateProperties(this.#d,{bbox:n,root:{"data-main-rotation":t}}),e.updateProperties(this.#g,{bbox:i.#C(this.#r.box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;let t=super.render();this.#u&&(t.setAttribute("aria-label",this.#u),t.setAttribute("role","mark")),this.#h?t.classList.add("free"):this.div.addEventListener("keydown",this.#D.bind(this),{signal:this._uiManager._signal});let e=this.#c=document.createElement("div");return t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=this.#n,this.setDims(),Eb(this,this.#c,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#g,{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#g,{rootClass:{hovered:!1}})}#D(t){i._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#O(!0);break;case 1:case 3:this.#O(!1);break}}#O(t){if(!this.#t)return;let e=window.getSelection();t?e.setPosition(this.#t,this.#e):e.setPosition(this.#a,this.#o)}select(){super.select(),this.#g&&this.parent?.drawLayer.updateProperties(this.#g,{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),this.#g&&(this.parent?.drawLayer.updateProperties(this.#g,{rootClass:{selected:!1}}),this.#h||this.#O(!1))}get _mustFixPosition(){return!this.#h}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.updateProperties(this.#d,{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties(this.#g,{rootClass:{hidden:!t}}))}#M(){return this.#h?this.rotation:0}#L(){if(this.#h)return null;let[t,e]=this.pageDimensions,[n,s]=this.pageTranslation,a=this.#i,r=new Float32Array(a.length*8),o=0;for(let{x:l,y:c,width:u,height:h}of a){let d=l*t+n,f=(1-c)*e+s;r[o]=r[o+4]=d,r[o+1]=r[o+3]=f,r[o+2]=r[o+6]=d+u*t,r[o+5]=r[o+7]=f-h*e,o+=8}return r}#k(t){return this.#l.serialize(t,this.#M())}static startHighlighting(t,e,{target:n,x:s,y:a}){let{x:r,y:o,width:l,height:c}=n.getBoundingClientRect(),u=new AbortController,h=t.combinedSignal(u),d=f=>{u.abort(),this.#B(t,f)};window.addEventListener("blur",d,{signal:h}),window.addEventListener("pointerup",d,{signal:h}),window.addEventListener("pointerdown",bt,{capture:!0,passive:!1,signal:h}),window.addEventListener("contextmenu",Te,{signal:h}),n.addEventListener("pointermove",this.#N.bind(this,t),{signal:h}),this._freeHighlight=new _r({x:s,y:a},[r,o,l,c],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#N(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,n){let s=null;if(t instanceof Bl){let{data:{quadPoints:y,rect:v,rotation:p,id:g,color:b,opacity:A,popupRef:S,richText:E,contentsObj:T,creationDate:w,modificationDate:_},parent:{page:{pageNumber:C}}}=t;s=t={annotationType:P.HIGHLIGHT,color:Array.from(b),opacity:A,quadPoints:y,boxes:null,pageIndex:C-1,rect:v.slice(0),rotation:p,annotationElementId:g,id:g,deleted:!1,popupRef:S,richText:E,comment:T?.str||null,creationDate:w,modificationDate:_}}else if(t instanceof Tr){let{data:{inkLists:y,rect:v,rotation:p,id:g,color:b,borderStyle:{rawWidth:A},popupRef:S,richText:E,contentsObj:T,creationDate:w,modificationDate:_},parent:{page:{pageNumber:C}}}=t;s=t={annotationType:P.HIGHLIGHT,color:Array.from(b),thickness:A,inkLists:y,boxes:null,pageIndex:C-1,rect:v.slice(0),rotation:p,annotationElementId:g,id:g,deleted:!1,popupRef:S,richText:E,comment:T?.str||null,creationDate:w,modificationDate:_}}let{color:a,quadPoints:r,inkLists:o,outlines:l,opacity:c}=t,u=await super.deserialize(t,e,n);u.color=M.makeHexColor(...a),u.opacity=c||1,o&&(u.#f=t.thickness),u._initialData=s,t.comment&&u.setCommentData(t);let[h,d]=u.pageDimensions,[f,m]=u.pageTranslation;if(r){let y=u.#i=[];for(let v=0;v<r.length;v+=8)y.push({x:(r[v]-f)/h,y:1-(r[v+1]-m)/d,width:(r[v+2]-r[v])/h,height:(r[v+1]-r[v+5])/d});u.#v(),u.#E(),u.rotate(u.rotation)}else if(o||l){u.#h=!0;let y=(o||l.points)[0],v={x:y[0]-f,y:d-(y[1]-m)},p=new _r(v,[0,0,h,d],1,u.#f/2,!0,.001);for(let A=0,S=y.length;A<S;A+=2)v.x=y[A]-f,v.y=d-(y[A+1]-m),p.add(v);let{id:g,clipPathId:b}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:u.color,"fill-opacity":u._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:p.toSVGPath()}},!0,!0);u.#y({highlightOutlines:p.getOutlines(),highlightId:g,clipPathId:b}),u.#E(),u.rotate(u.parentRotation)}return u}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)),n=super.serialize(t);return Object.assign(n,{color:e,opacity:this.opacity,thickness:this.#f,quadPoints:this.#L(),outlines:this.#k(n.rect)}),this.addComment(n),this.annotationElementId&&!this.#P(n)?null:(n.id=this.annotationElementId,n)}#P(t){let{color:e}=this._initialData;return this.hasEditedComment||t.color.some((n,s)=>n!==e[s])}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}},Gl=class{#t=Object.create(null);updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(let[e,n]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,n)}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")}},jl=class i extends tt{#t=null;#e;_colorPicker=null;_drawId=null;static _currentDrawId=-1;static _currentParent=null;static#i=null;static#n=null;static#s=null;static _INNER_MARGIN=3;constructor(t){super(t),this.#e=t.mustBeCommitted||!1,this._addOutlines(t)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){this._colorPicker?.updateOpacity?.(this.opacity)}_addOutlines(t){t.drawOutlines&&(this.#r(t),this.#c())}#r({drawOutlines:t,drawId:e,drawingOptions:n}){this.#t=t,this._drawingOptions||=n,this.annotationElementId||this._uiManager.a11yAlert(tt._l10nAlert[this.editorType]),e>=0?(this._drawId=e,this.parent.drawLayer.finalizeDraw(e,t.defaultProperties)):this._drawId=this.#a(t,this.parent),this.#h(t.box)}#a(t,e){let{id:n}=e.drawLayer.draw(i._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return n}static _mergeSVGProperties(t,e){let n=new Set(Object.keys(t));for(let[s,a]of Object.entries(e))n.has(s)?Object.assign(t[s],a):t[s]=a;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 n=this.typesMap.get(t);n&&this._defaultDrawingOptions.updateProperty(n,e),this._currentParent&&(i.#i.updateProperty(n,e),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,e){let n=this.constructor.typesMap.get(t);n&&this._updateProperty(t,n,e)}static get defaultPropertiesToUpdate(){let t=[],e=this._defaultDrawingOptions;for(let[n,s]of this.typesMap)t.push([n,e[s]]);return t}get propertiesToUpdate(){let t=[],{_drawingOptions:e}=this;for(let[n,s]of this.constructor.typesMap)t.push([n,e[s]]);return t}_updateProperty(t,e,n){let s=this._drawingOptions,a=s[e],r=o=>{s.updateProperty(e,o);let l=this.#t.updateProperty(e,o);l&&this.#h(l),this.parent?.drawLayer.updateProperties(this._drawId,s.toSVGProperties()),t===this.colorType?this.onUpdatedColor():t===this.opacityType&&this.onUpdatedOpacity()};this.addCommands({cmd:r.bind(this,n),undo:r.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(t,e){let n=this.constructor.typesMap.get(this.colorType),s=this.constructor.typesMap.get(this.opacityType),a=this._drawingOptions,r=a[n],o=a[s],l=(c,u)=>{a.updateProperty(n,c),a.updateProperty(s,u),this.#t.updateProperty(n,c),this.#t.updateProperty(s,u),this.parent?.drawLayer.updateProperties(this._drawId,a.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:l.bind(this,t,e),undo:l.bind(this,r,o),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:H.INK_COLOR_AND_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,i._mergeSVGProperties(this.#t.getPathResizingSVGProperties(this.#d()),{bbox:this.#p()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,i._mergeSVGProperties(this.#t.getPathResizedSVGProperties(this.#d()),{bbox:this.#p()}))}_onTranslating(t,e){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#p()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,i._mergeSVGProperties(this.#t.getPathTranslatedSVGProperties(this.#d(),this.parentDimensions),{bbox:this.#p()}))}_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.#o(),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#c(),this.#h(this.#t.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?(this._uiManager.removeShouldRescale(this),this.#o()):t&&(this._uiManager.addShouldRescale(this),this.#c(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),e&&this.select()}#o(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}#c(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.#a(this.#t,t)}}#l([t,e,n,s]){let{parentDimensions:[a,r],rotation:o}=this;switch(o){case 90:return[e,1-t,n*(r/a),s*(a/r)];case 180:return[1-t,1-e,n,s];case 270:return[1-e,t,n*(r/a),s*(a/r)];default:return[t,e,n,s]}}#d(){let{x:t,y:e,width:n,height:s,parentDimensions:[a,r],rotation:o}=this;switch(o){case 90:return[1-e,t,n*(a/r),s*(r/a)];case 180:return[1-t,1-e,n,s];case 270:return[e,1-t,n*(a/r),s*(r/a)];default:return[t,e,n,s]}}#h(t){[this.x,this.y,this.width,this.height]=this.#l(t),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}#p(){let{x:t,y:e,width:n,height:s,rotation:a,parentRotation:r,parentDimensions:[o,l]}=this;switch((a*4+r)/90){case 1:return[1-e-s,t,s,n];case 2:return[1-t-n,1-e-s,n,s];case 3:return[e,1-t-n,s,n];case 4:return[t,e-n*(o/l),s*(l/o),n*(o/l)];case 5:return[1-e,t,n*(o/l),s*(l/o)];case 6:return[1-t-s*(l/o),1-e,s*(l/o),n*(o/l)];case 7:return[e-n*(o/l),1-t-s*(l/o),n*(o/l),s*(l/o)];case 8:return[t-n,e-s,n,s];case 9:return[1-e,t-n,s,n];case 10:return[1-t,1-e,n,s];case 11:return[e-s,1-t,s,n];case 12:return[t-s*(l/o),e,s*(l/o),n*(o/l)];case 13:return[1-e-n*(o/l),t-s*(l/o),n*(o/l),s*(l/o)];case 14:return[1-t,1-e-n*(o/l),s*(l/o),n*(o/l)];case 15:return[e,1-t,n*(o/l),s*(l/o)];default:return[t,e,n,s]}}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,i._mergeSVGProperties({bbox:this.#p()},this.#t.updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&this.#h(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 n=super.render();n.classList.add("draw");let s=document.createElement("div");return n.append(s),s.setAttribute("aria-hidden","true"),s.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,e),n}static createDrawerInstance(t,e,n,s,a){Q("Not implemented")}static startDrawing(t,e,n,s){let{target:a,offsetX:r,offsetY:o,pointerId:l,pointerType:c}=s;if(Kt.isInitializedAndDifferentPointerType(c))return;let{viewport:{rotation:u}}=t,{width:h,height:d}=a.getBoundingClientRect(),f=i.#n=new AbortController,m=t.combinedSignal(f);if(Kt.setPointer(c,l),window.addEventListener("pointerup",y=>{Kt.isSamePointerIdOrRemove(y.pointerId)&&this._endDraw(y)},{signal:m}),window.addEventListener("pointercancel",y=>{Kt.isSamePointerIdOrRemove(y.pointerId)&&this._currentParent.endDrawingSession()},{signal:m}),window.addEventListener("pointerdown",y=>{Kt.isSamePointerType(y.pointerType)&&(Kt.initializeAndAddPointerId(y.pointerId),i.#i.isCancellable()&&(i.#i.removeLastElement(),i.#i.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:m}),window.addEventListener("contextmenu",Te,{signal:m}),a.addEventListener("pointermove",this._drawMove.bind(this),{signal:m}),a.addEventListener("touchmove",y=>{Kt.isSameTimeStamp(y.timeStamp)&&bt(y)},{signal:m}),t.toggleDrawing(),e._editorUndoBar?.hide(),i.#i){t.drawLayer.updateProperties(this._currentDrawId,i.#i.startNew(r,o,h,d,u));return}e.updateUIForDefaultProperties(this),i.#i=this.createDrawerInstance(r,o,h,d,u),i.#s=this.getDefaultDrawingOptions(),this._currentParent=t,{id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties(i.#s.toSVGProperties(),i.#i.defaultSVGProperties),!0,!1)}static _drawMove(t){if(Kt.isSameTimeStamp(t.timeStamp),!i.#i)return;let{offsetX:e,offsetY:n,pointerId:s}=t;if(Kt.isSamePointerId(s)){if(Kt.isUsingMultiplePointers()){this._endDraw(t);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,i.#i.add(e,n)),Kt.setTimeStamp(t.timeStamp),bt(t)}}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,i.#i=null,i.#s=null,Kt.clearTimeStamp()),i.#n&&(i.#n.abort(),i.#n=null,Kt.clearPointerIds())}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,i.#i.end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){let n=i.#i,s=this._currentDrawId,a=n.getLastElement();e.addCommands({cmd:()=>{e.drawLayer.updateProperties(s,n.setLastElement(a))},undo:()=>{e.drawLayer.updateProperties(s,n.removeLastElement())},mustExec:!1,type:H.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){let e=this._currentParent;if(!e)return null;if(e.toggleDrawing(!0),e.cleanUndoStack(H.DRAW_STEP),!i.#i.isEmpty()){let{pageDimensions:[n,s],scale:a}=e,r=e.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:i.#i.getOutlines(n*a,s*a,a,this._INNER_MARGIN),drawingOptions:i.#s,mustBeCommitted:!t});return this._cleanup(!0),r}return e.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,e,n,s,a,r){Q("Not implemented")}static async deserialize(t,e,n){let{rawDims:{pageWidth:s,pageHeight:a,pageX:r,pageY:o}}=e.viewport,l=this.deserializeDraw(r,o,s,a,this._INNER_MARGIN,t),c=await super.deserialize(t,e,n);return c.createDrawingOptions(t),c.#r({drawOutlines:l}),c.#c(),c.onScaleChanging(),c.rotate(),c}serializeDraw(t){let[e,n]=this.pageTranslation,[s,a]=this.pageDimensions;return this.#t.serialize([e,n,s,a],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}},Df=class{#t=new Float64Array(6);#e;#i;#n;#s;#r;#a="";#o=0;#c=new zn;#l;#d;constructor(t,e,n,s,a,r){this.#l=n,this.#d=s,this.#n=a,this.#s=r,[t,e]=this.#h(t,e);let o=this.#e=[NaN,NaN,NaN,NaN,t,e];this.#r=[t,e],this.#i=[{line:o,points:this.#r}],this.#t.set(o,0)}updateProperty(t,e){t==="stroke-width"&&(this.#s=e)}#h(t,e){return O._normalizePoint(t,e,this.#l,this.#d,this.#n)}isEmpty(){return!this.#i?.length}isCancellable(){return this.#r.length<=10}add(t,e){[t,e]=this.#h(t,e);let[n,s,a,r]=this.#t.subarray(2,6),o=t-a,l=e-r;return Math.hypot(this.#l*o,this.#d*l)<=2?null:(this.#r.push(t,e),isNaN(n)?(this.#t.set([a,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([n,s,a,r,t,e],0),this.#e.push(...O.createBezierPoints(n,s,a,r,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){let n=this.add(t,e);return n||(this.#r.length===2?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,n,s,a){this.#l=n,this.#d=s,this.#n=a,[t,e]=this.#h(t,e);let r=this.#e=[NaN,NaN,NaN,NaN,t,e];this.#r=[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.#r}),this.#t.set(r,0),this.#o=0,this.toSVGPath(),null}getLastElement(){return this.#i.at(-1)}setLastElement(t){return this.#i?(this.#i.push(t),this.#e=t.line,this.#r=t.points,this.#o=0,{path:{d:this.toSVGPath()}}):this.#c.setLastElement(t)}removeLastElement(){if(!this.#i)return this.#c.removeLastElement();this.#i.pop(),this.#a="";for(let t=0,e=this.#i.length;t<e;t++){let{line:n,points:s}=this.#i[t];this.#e=n,this.#r=s,this.#o=0,this.toSVGPath()}return{path:{d:this.#a}}}toSVGPath(){let t=O.svgRound(this.#e[4]),e=O.svgRound(this.#e[5]);if(this.#r.length===2)return this.#a=`${this.#a} M ${t} ${e} Z`,this.#a;if(this.#r.length<=6){let s=this.#a.lastIndexOf("M");this.#a=`${this.#a.slice(0,s)} M ${t} ${e}`,this.#o=6}if(this.#r.length===4){let s=O.svgRound(this.#e[10]),a=O.svgRound(this.#e[11]);return this.#a=`${this.#a} L ${s} ${a}`,this.#o=12,this.#a}let n=[];this.#o===0&&(n.push(`M ${t} ${e}`),this.#o=6);for(let s=this.#o,a=this.#e.length;s<a;s+=6){let[r,o,l,c,u,h]=this.#e.slice(s,s+6).map(O.svgRound);n.push(`C${r} ${o} ${l} ${c} ${u} ${h}`)}return this.#a+=n.join(" "),this.#o=this.#e.length,this.#a}getOutlines(t,e,n,s){let a=this.#i.at(-1);return a.line=new Float32Array(a.line),a.points=new Float32Array(a.points),this.#c.build(this.#i,t,e,n,this.#n,this.#s,s),this.#t=null,this.#e=null,this.#i=null,this.#a=null,this.#c}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}},zn=class extends O{#t;#e=0;#i;#n;#s;#r;#a;#o;#c;build(t,e,n,s,a,r,o){this.#s=e,this.#r=n,this.#a=s,this.#o=a,this.#c=r,this.#i=o??0,this.#n=t,this.#h()}get thickness(){return this.#c}setLastElement(t){return this.#n.push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#n.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let t=[];for(let{line:e}of this.#n){if(t.push(`M${O.svgRound(e[4])} ${O.svgRound(e[5])}`),e.length===6){t.push("Z");continue}if(e.length===12&&isNaN(e[6])){t.push(`L${O.svgRound(e[10])} ${O.svgRound(e[11])}`);continue}for(let n=6,s=e.length;n<s;n+=6){let[a,r,o,l,c,u]=e.subarray(n,n+6).map(O.svgRound);t.push(`C${a} ${r} ${o} ${l} ${c} ${u}`)}}return t.join("")}serialize([t,e,n,s],a){let r=[],o=[],[l,c,u,h]=this.#d(),d,f,m,y,v,p,g,b,A;switch(this.#o){case 0:A=O._rescale,d=t,f=e+s,m=n,y=-s,v=t+l*n,p=e+(1-c-h)*s,g=t+(l+u)*n,b=e+(1-c)*s;break;case 90:A=O._rescaleAndSwap,d=t,f=e,m=n,y=s,v=t+c*n,p=e+l*s,g=t+(c+h)*n,b=e+(l+u)*s;break;case 180:A=O._rescale,d=t+n,f=e,m=-n,y=s,v=t+(1-l-u)*n,p=e+c*s,g=t+(1-l)*n,b=e+(c+h)*s;break;case 270:A=O._rescaleAndSwap,d=t+n,f=e+s,m=-n,y=-s,v=t+(1-c-h)*n,p=e+(1-l-u)*s,g=t+(1-c)*n,b=e+(1-l)*s;break}for(let{line:S,points:E}of this.#n)r.push(A(S,d,f,m,y,a?new Array(S.length):null)),o.push(A(E,d,f,m,y,a?new Array(E.length):null));return{lines:r,points:o,rect:[v,p,g,b]}}static deserialize(t,e,n,s,a,{paths:{lines:r,points:o},rotation:l,thickness:c}){let u=[],h,d,f,m,y;switch(l){case 0:y=O._rescale,h=-t/n,d=e/s+1,f=1/n,m=-1/s;break;case 90:y=O._rescaleAndSwap,h=-e/s,d=-t/n,f=1/s,m=1/n;break;case 180:y=O._rescale,h=t/n+1,d=-e/s,f=-1/n,m=1/s;break;case 270:y=O._rescaleAndSwap,h=e/s+1,d=t/n+1,f=-1/s,m=-1/n;break}if(!r){r=[];for(let p of o){let g=p.length;if(g===2){r.push(new Float32Array([NaN,NaN,NaN,NaN,p[0],p[1]]));continue}if(g===4){r.push(new Float32Array([NaN,NaN,NaN,NaN,p[0],p[1],NaN,NaN,NaN,NaN,p[2],p[3]]));continue}let b=new Float32Array(3*(g-2));r.push(b);let[A,S,E,T]=p.subarray(0,4);b.set([NaN,NaN,NaN,NaN,A,S],0);for(let w=4;w<g;w+=2){let _=p[w],C=p[w+1];b.set(O.createBezierPoints(A,S,E,T,_,C),(w-2)*3),[A,S,E,T]=[E,T,_,C]}}}for(let p=0,g=r.length;p<g;p++)u.push({line:y(r[p].map(b=>b??NaN),h,d,f,m),points:y(o[p].map(b=>b??NaN),h,d,f,m)});let v=new this.prototype.constructor;return v.build(u,n,s,1,l,c,a),v}#l(t=this.#c){let e=this.#i+t/2*this.#a;return this.#o%180===0?[e/this.#s,e/this.#r]:[e/this.#r,e/this.#s]}#d(){let[t,e,n,s]=this.#t,[a,r]=this.#l(0);return[t+a,e+r,n-2*a,s-2*r]}#h(){let t=this.#t=On.slice();for(let{line:s}of this.#n){if(s.length<=12){for(let o=4,l=s.length;o<l;o+=6)M.pointBoundingBox(s[o],s[o+1],t);continue}let a=s[4],r=s[5];for(let o=6,l=s.length;o<l;o+=6){let[c,u,h,d,f,m]=s.subarray(o,o+6);M.bezierBoundingBox(a,r,c,u,h,d,f,m,t),a=f,r=m}}let[e,n]=this.#l();t[0]=ht(t[0]-e,0,1),t[1]=ht(t[1]-n,0,1),t[2]=ht(t[2]+e,0,1),t[3]=ht(t[3]+n,0,1),t[2]-=t[0],t[3]-=t[1]}get box(){return this.#t}updateProperty(t,e){return t==="stroke-width"?this.#p(e):null}#p(t){let[e,n]=this.#l();this.#c=t;let[s,a]=this.#l(),[r,o]=[s-e,a-n],l=this.#t;return l[0]-=r,l[1]-=o,l[2]+=2*r,l[3]+=2*o,l}updateParentDimensions([t,e],n){let[s,a]=this.#l();this.#s=t,this.#r=e,this.#a=n;let[r,o]=this.#l(),l=r-s,c=o-a,u=this.#t;return u[0]-=l,u[1]-=c,u[2]+=2*l,u[3]+=2*c,u}updateRotation(t){return this.#e=t,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#t.map(O.svgRound).join(" ")}get defaultProperties(){let[t,e]=this.#t;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${O.svgRound(t)} ${O.svgRound(e)}`}}}get rotationTransform(){let[,,t,e]=this.#t,n=0,s=0,a=0,r=0,o=0,l=0;switch(this.#e){case 90:s=e/t,a=-t/e,o=t;break;case 180:n=-1,r=-1,o=t,l=e;break;case 270:s=-e/t,a=t/e,l=e;break;default:return""}return`matrix(${n} ${s} ${a} ${r} ${O.svgRound(o)} ${O.svgRound(l)})`}getPathResizingSVGProperties([t,e,n,s]){let[a,r]=this.#l(),[o,l,c,u]=this.#t;if(Math.abs(c-a)<=O.PRECISION||Math.abs(u-r)<=O.PRECISION){let y=t+n/2-(o+c/2),v=e+s/2-(l+u/2);return{path:{"transform-origin":`${O.svgRound(t)} ${O.svgRound(e)}`,transform:`${this.rotationTransform} translate(${y} ${v})`}}}let h=(n-2*a)/(c-2*a),d=(s-2*r)/(u-2*r),f=c/n,m=u/s;return{path:{"transform-origin":`${O.svgRound(o)} ${O.svgRound(l)}`,transform:`${this.rotationTransform} scale(${f} ${m}) translate(${O.svgRound(a)} ${O.svgRound(r)}) scale(${h} ${d}) translate(${O.svgRound(-a)} ${O.svgRound(-r)})`}}}getPathResizedSVGProperties([t,e,n,s]){let[a,r]=this.#l(),o=this.#t,[l,c,u,h]=o;if(o[0]=t,o[1]=e,o[2]=n,o[3]=s,Math.abs(u-a)<=O.PRECISION||Math.abs(h-r)<=O.PRECISION){let v=t+n/2-(l+u/2),p=e+s/2-(c+h/2);for(let{line:g,points:b}of this.#n)O._translate(g,v,p,g),O._translate(b,v,p,b);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${O.svgRound(t)} ${O.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let d=(n-2*a)/(u-2*a),f=(s-2*r)/(h-2*r),m=-d*(l+a)+t+a,y=-f*(c+r)+e+r;if(d!==1||f!==1||m!==0||y!==0)for(let{line:v,points:p}of this.#n)O._rescale(v,m,y,d,f,v),O._rescale(p,m,y,d,f,p);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${O.svgRound(t)} ${O.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([t,e],n){let[s,a]=n,r=this.#t,o=t-r[0],l=e-r[1];if(this.#s===s&&this.#r===a)for(let{line:c,points:u}of this.#n)O._translate(c,o,l,c),O._translate(u,o,l,u);else{let c=this.#s/s,u=this.#r/a;this.#s=s,this.#r=a;for(let{line:h,points:d}of this.#n)O._rescale(h,o,l,c,u,h),O._rescale(d,o,l,c,u,d);r[2]*=c,r[3]*=u}return r[0]=t,r[1]=e,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${O.svgRound(t)} ${O.svgRound(e)}`}}}get defaultSVGProperties(){let t=this.#t;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${O.svgRound(t[0])} ${O.svgRound(t[1])}`,transform:this.rotationTransform||null},bbox:t}}},Vl=class i extends Gl{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 i(this._viewParameters);return t.updateAll(this),t}},Of=class i extends jl{static _type="ink";static _editorType=P.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 Vl(e.viewParameters)}static getDefaultDrawingOptions(t){let e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!0}static get typesMap(){return B(this,"typesMap",new Map([[H.INK_THICKNESS,"stroke-width"],[H.INK_COLOR,"stroke"],[H.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,e,n,s,a){return new Df(t,e,n,s,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,e,n,s,a,r){return zn.deserialize(t,e,n,s,a,r)}static async deserialize(t,e,n){let s=null;if(t instanceof Tr){let{data:{inkLists:r,rect:o,rotation:l,id:c,color:u,opacity:h,borderStyle:{rawWidth:d},popupRef:f,richText:m,contentsObj:y,creationDate:v,modificationDate:p},parent:{page:{pageNumber:g}}}=t;s=t={annotationType:P.INK,color:Array.from(u),thickness:d,opacity:h,paths:{points:r},boxes:null,pageIndex:g-1,rect:o.slice(0),rotation:l,annotationElementId:c,id:c,deleted:!1,popupRef:f,richText:m,comment:y?.str||null,creationDate:v,modificationDate:p}}let a=await super.deserialize(t,e,n);return a._initialData=s,t.comment&&a.setCommentData(t),a}get toolbarButtons(){return this._colorPicker||=new Rl(this),[["colorPicker",this._colorPicker]]}get colorType(){return H.INK_COLOR}get colorAndOpacityType(){return H.INK_COLOR_AND_OPACITY}get opacityType(){return H.INK_OPACITY}updateParams(t,e){if(t===H.INK_COLOR_AND_OPACITY){this._updateColorAndOpacity(e.color,e.opacity);return}super.updateParams(t,e)}static updateDefaultParams(t,e){if(t===H.INK_COLOR_AND_OPACITY){super.updateDefaultParams(H.INK_COLOR,e.color),super.updateDefaultParams(H.INK_OPACITY,e.opacity);return}super.updateDefaultParams(t,e)}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:n}=this;e.updateSVGProperty("stroke-width"),n.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:n}){this._drawingOptions=i.getDefaultDrawingOptions({stroke:M.makeHexColor(...t),"stroke-width":e,"stroke-opacity":n})}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:e,points:n}=this.serializeDraw(t),{_drawingOptions:{stroke:s,"stroke-opacity":a,"stroke-width":r}}=this,o=Object.assign(super.serialize(t),{color:tt._colorManager.convert(s),opacity:a,thickness:r,paths:{lines:e,points:n}});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:n,opacity:s,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||t.color.some((r,o)=>r!==e[o])||t.thickness!==n||t.opacity!==s||t.pageIndex!==a}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let{points:e,rect:n}=this.serializeDraw(!1);return t.updateEdited({rect:n,thickness:this._drawingOptions["stroke-width"],points:e,popup:this.comment}),null}},xr=class extends zn{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}},pl=8,nr=3,Ei=class{static#t={maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16};static#e(t,e,n,s){return n-=t,s-=e,n===0?s>0?0:4:n===1?s+6:2-s}static#i=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#n(t,e,n,s,a,r,o){let l=this.#e(n,s,a,r);for(let c=0;c<8;c++){let u=(-c+l-o+16)%8,h=this.#i[2*u],d=this.#i[2*u+1];if(t[(n+h)*e+(s+d)]!==0)return u}return-1}static#s(t,e,n,s,a,r,o){let l=this.#e(n,s,a,r);for(let c=0;c<8;c++){let u=(c+l+o+16)%8,h=this.#i[2*u],d=this.#i[2*u+1];if(t[(n+h)*e+(s+d)]!==0)return u}return-1}static#r(t,e,n,s){let a=t.length,r=new Int32Array(a);for(let u=0;u<a;u++)r[u]=t[u]<=s?1:0;for(let u=1;u<n-1;u++)r[u*e]=r[u*e+e-1]=0;for(let u=0;u<e;u++)r[u]=r[e*n-1-u]=0;let o=1,l,c=[];for(let u=1;u<n-1;u++){l=1;for(let h=1;h<e-1;h++){let d=u*e+h,f=r[d];if(f===0)continue;let m=u,y=h;if(f===1&&r[d-1]===0)o+=1,y-=1;else if(f>=1&&r[d+1]===0)o+=1,y+=1,f>1&&(l=f);else{f!==1&&(l=Math.abs(f));continue}let v=[h,u],p=y===h+1,g={isHole:p,points:v,id:o,parent:0};c.push(g);let b;for(let D of c)if(D.id===l){b=D;break}b?b.isHole?g.parent=p?b.parent:l:g.parent=p?l:b.parent:g.parent=p?l:0;let A=this.#n(r,e,u,h,m,y,0);if(A===-1){r[d]=-o,r[d]!==1&&(l=Math.abs(r[d]));continue}let S=this.#i[2*A],E=this.#i[2*A+1],T=u+S,w=h+E;m=T,y=w;let _=u,C=h;for(;;){let D=this.#s(r,e,_,C,m,y,1);S=this.#i[2*D],E=this.#i[2*D+1];let N=_+S,z=C+E;v.push(z,N);let X=_*e+C;if(r[X+1]===0?r[X]=-o:r[X]===1&&(r[X]=o),N===u&&z===h&&_===T&&C===w){r[d]!==1&&(l=Math.abs(r[d]));break}else m=_,y=C,_=N,C=z}}}return c}static#a(t,e,n,s){if(n-e<=4){for(let T=e;T<n-2;T+=2)s.push(t[T],t[T+1]);return}let a=t[e],r=t[e+1],o=t[n-4]-a,l=t[n-3]-r,c=Math.hypot(o,l),u=o/c,h=l/c,d=u*r-h*a,f=l/o,m=1/c,y=Math.atan(f),v=Math.cos(y),p=Math.sin(y),g=m*(Math.abs(v)+Math.abs(p)),b=m*(1-g+g**2),A=Math.max(Math.atan(Math.abs(p+v)*b),Math.atan(Math.abs(p-v)*b)),S=0,E=e;for(let T=e+2;T<n-2;T+=2){let w=Math.abs(d-u*t[T+1]+h*t[T]);w>S&&(E=T,S=w)}S>(c*A)**2?(this.#a(t,e,E+2,s),this.#a(t,E,n,s)):s.push(a,r)}static#o(t){let e=[],n=t.length;return this.#a(t,0,n,e),e.push(t[n-2],t[n-1]),e.length<=4?null:e}static#c(t,e,n,s,a,r){let o=new Float32Array(r**2),l=-2*s**2,c=r>>1;for(let y=0;y<r;y++){let v=(y-c)**2;for(let p=0;p<r;p++)o[y*r+p]=Math.exp((v+(p-c)**2)/l)}let u=new Float32Array(256),h=-2*a**2;for(let y=0;y<256;y++)u[y]=Math.exp(y**2/h);let d=t.length,f=new Uint8Array(d),m=new Uint32Array(256);for(let y=0;y<n;y++)for(let v=0;v<e;v++){let p=y*e+v,g=t[p],b=0,A=0;for(let E=0;E<r;E++){let T=y+E-c;if(!(T<0||T>=n))for(let w=0;w<r;w++){let _=v+w-c;if(_<0||_>=e)continue;let C=t[T*e+_],D=o[E*r+w]*u[Math.abs(C-g)];b+=C*D,A+=D}}let S=f[p]=Math.round(b/A);m[S]++}return[f,m]}static#l(t){let e=new Uint32Array(256);for(let n of t)e[n]++;return e}static#d(t){let e=t.length,n=new Uint8ClampedArray(e>>2),s=-1/0,a=1/0;for(let o=0,l=n.length;o<l;o++){let c=n[o]=t[o<<2];s=Math.max(s,c),a=Math.min(a,c)}let r=255/(s-a);for(let o=0,l=n.length;o<l;o++)n[o]=(n[o]-a)*r;return n}static#h(t){let e,n=-1/0,s=-1/0,a=t.findIndex(l=>l!==0),r=a,o=a;for(e=a;e<256;e++){let l=t[e];l>n&&(e-r>s&&(s=e-r,o=e-1),n=l,r=e)}for(e=o-1;e>=0&&!(t[e]>t[e+1]);e--);return e}static#p(t){let e=t,{width:n,height:s}=t,{maxDim:a}=this.#t,r=n,o=s;if(n>a||s>a){let d=n,f=s,m=Math.log2(Math.max(n,s)/a),y=Math.floor(m);m=m===y?y-1:y;for(let p=0;p<m;p++){r=Math.ceil(d/2),o=Math.ceil(f/2);let g=new OffscreenCanvas(r,o);g.getContext("2d").drawImage(t,0,0,d,f,0,0,r,o),d=r,f=o,t!==e&&t.close(),t=g.transferToImageBitmap()}let v=Math.min(a/r,a/o);r=Math.round(r*v),o=Math.round(o*v)}let c=new OffscreenCanvas(r,o).getContext("2d",{willReadFrequently:!0});c.fillStyle="white",c.fillRect(0,0,r,o),c.filter="grayscale(1)",c.drawImage(t,0,0,t.width,t.height,0,0,r,o);let u=c.getImageData(0,0,r,o).data;return[this.#d(u),r,o]}static extractContoursFromText(t,{fontFamily:e,fontStyle:n,fontWeight:s},a,r,o,l){let c=new OffscreenCanvas(1,1),u=c.getContext("2d",{alpha:!1}),h=200,d=u.font=`${n} ${s} ${h}px ${e}`,{actualBoundingBoxLeft:f,actualBoundingBoxRight:m,actualBoundingBoxAscent:y,actualBoundingBoxDescent:v,fontBoundingBoxAscent:p,fontBoundingBoxDescent:g,width:b}=u.measureText(t),A=1.5,S=Math.ceil(Math.max(Math.abs(f)+Math.abs(m)||0,b)*A),E=Math.ceil(Math.max(Math.abs(y)+Math.abs(v)||h,Math.abs(p)+Math.abs(g)||h)*A);c=new OffscreenCanvas(S,E),u=c.getContext("2d",{alpha:!0,willReadFrequently:!0}),u.font=d,u.filter="grayscale(1)",u.fillStyle="white",u.fillRect(0,0,S,E),u.fillStyle="black",u.fillText(t,S*(A-1)/2,E*(3-A)/2);let T=this.#d(u.getImageData(0,0,S,E).data),w=this.#l(T),_=this.#h(w),C=this.#r(T,S,E,_);return this.processDrawnLines({lines:{curves:C,width:S,height:E},pageWidth:a,pageHeight:r,rotation:o,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(t,e,n,s,a){let[r,o,l]=this.#p(t),[c,u]=this.#c(r,o,l,Math.hypot(o,l)*this.#t.sigmaSFactor,this.#t.sigmaR,this.#t.kernelSize),h=this.#h(u),d=this.#r(c,o,l,h);return this.processDrawnLines({lines:{curves:d,width:o,height:l},pageWidth:e,pageHeight:n,rotation:s,innerMargin:a,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:e,pageHeight:n,rotation:s,innerMargin:a,mustSmooth:r,areContours:o}){s%180!==0&&([e,n]=[n,e]);let{curves:l,width:c,height:u}=t,h=t.thickness??0,d=[],f=Math.min(e/c,n/u),m=f/e,y=f/n,v=[];for(let{points:g}of l){let b=r?this.#o(g):g;if(!b)continue;v.push(b);let A=b.length,S=new Float32Array(A),E=new Float32Array(3*(A===2?2:A-2));if(d.push({line:E,points:S}),A===2){S[0]=b[0]*m,S[1]=b[1]*y,E.set([NaN,NaN,NaN,NaN,S[0],S[1]],0);continue}let[T,w,_,C]=b;T*=m,w*=y,_*=m,C*=y,S.set([T,w,_,C],0),E.set([NaN,NaN,NaN,NaN,T,w],0);for(let D=4;D<A;D+=2){let N=S[D]=b[D]*m,z=S[D+1]=b[D+1]*y;E.set(O.createBezierPoints(T,w,_,C,N,z),(D-2)*3),[T,w,_,C]=[_,C,N,z]}}if(d.length===0)return null;let p=o?new xr:new zn;return p.build(d,e,n,1,s,o?0:h,a),{outline:p,newCurves:v,areContours:o,thickness:h,width:c,height:u}}static async compressSignature({outlines:t,areContours:e,thickness:n,width:s,height:a}){let r=1/0,o=-1/0,l=0;for(let g of t){l+=g.length;for(let b=2,A=g.length;b<A;b++){let S=g[b]-g[b-2];r=Math.min(r,S),o=Math.max(o,S)}}let c;r>=-128&&o<=127?c=Int8Array:r>=-32768&&o<=32767?c=Int16Array:c=Int32Array;let u=t.length,h=pl+nr*u,d=new Uint32Array(h),f=0;d[f++]=h*Uint32Array.BYTES_PER_ELEMENT+(l-2*u)*c.BYTES_PER_ELEMENT,d[f++]=0,d[f++]=s,d[f++]=a,d[f++]=e?0:1,d[f++]=Math.max(0,Math.floor(n??0)),d[f++]=u,d[f++]=c.BYTES_PER_ELEMENT;for(let g of t)d[f++]=g.length-2,d[f++]=g[0],d[f++]=g[1];let m=new CompressionStream("deflate-raw"),y=m.writable.getWriter();await y.ready,y.write(d);let v=c.prototype.constructor;for(let g of t){let b=new v(g.length-2);for(let A=2,S=g.length;A<S;A++)b[A-2]=g[A]-g[A-2];y.write(b)}return y.close(),(await new Response(m.readable).bytes()).toBase64()}static async decompressSignature(t){try{let e=Uint8Array.fromBase64(t),{readable:n,writable:s}=new DecompressionStream("deflate-raw"),a=s.getWriter();await a.ready,a.write(e).then(async()=>{await a.ready,await a.close()}).catch(()=>{});let r=null,o=0;for await(let b of n)r||=new Uint8Array(new Uint32Array(b.buffer,0,4)[0]),r.set(b,o),o+=b.length;let l=new Uint32Array(r.buffer,0,r.length>>2),c=l[1];if(c!==0)throw new Error(`Invalid version: ${c}`);let u=l[2],h=l[3],d=l[4]===0,f=l[5],m=l[6],y=l[7],v=[],p=(pl+nr*m)*Uint32Array.BYTES_PER_ELEMENT,g;switch(y){case Int8Array.BYTES_PER_ELEMENT:g=new Int8Array(r.buffer,p);break;case Int16Array.BYTES_PER_ELEMENT:g=new Int16Array(r.buffer,p);break;case Int32Array.BYTES_PER_ELEMENT:g=new Int32Array(r.buffer,p);break}o=0;for(let b=0;b<m;b++){let A=l[nr*b+pl],S=new Float32Array(A+2);v.push(S);for(let E=0;E<nr-1;E++)S[E]=l[nr*b+pl+E+1];for(let E=0;E<A;E++)S[E+2]=S[E]+g[o++]}return{areContours:d,thickness:f,outlines:v,width:u,height:h}}catch(e){return I(`decompressSignature: ${e}`),null}}},Rf=class i extends Gl{constructor(){super(),super.updateProperties({fill:tt._defaultLineColor,"stroke-width":0})}clone(){let t=new i;return t.updateAll(this),t}},Nf=class i extends Vl{constructor(t){super(t),super.updateProperties({stroke:tt._defaultLineColor,"stroke-width":1})}clone(){let t=new i(this._viewParameters);return t.updateAll(this),t}},Lf=class i extends jl{#t=!1;#e=null;#i=null;#n=null;static _type="signature";static _editorType=P.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 Rf,this._defaultDrawnSignatureOptions=new Nf(e.viewParameters)}static getDefaultDrawingOptions(t){let e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!1}static get typesMap(){return B(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:n}=this;if(n&&(this._isCopy=!1,t=this.x,e=this.y),super.render(),this._drawId===null)if(this.#i){let{lines:s,mustSmooth:a,areContours:r,description:o,uuid:l,heightInPage:c}=this.#i,{rawDims:{pageWidth:u,pageHeight:h},rotation:d}=this.parent.viewport,f=Ei.processDrawnLines({lines:s,pageWidth:u,pageHeight:h,rotation:d,innerMargin:i._INNER_MARGIN,mustSmooth:a,areContours:r});this.addSignature(f,c,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 n&&(this._isCopy=!0,this._moveAfterPaste(t,e)),this.div}setUuid(t){this.#n=t,this.addEditToolbar()}getUuid(){return this.#n}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:n,width:s,height:a}=this.#i,r=Math.max(s,a),o=Ei.processDrawnLines({lines:{curves:t.map(l=>({points:l})),thickness:n,width:s,height:a},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,n,s){let{x:a,y:r}=this,{outline:o}=this.#i=t;this.#t=o instanceof xr,this.description=n;let l;this.#t?l=i.getDefaultDrawingOptions():(l=i._defaultDrawnSignatureOptions.clone(),l.updateProperties({"stroke-width":o.thickness})),this._addOutlines({drawOutlines:o,drawingOptions:l});let[,c]=this.pageDimensions,u=e/c;u=u>=1?.5:u,this.width*=u/this.height,this.width>=1&&(u*=.9/this.width,this.width=.9),this.height=u,this.setDims(),this.x=a,this.y=r,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(s),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!s,hasDescription:!!n}}),this.div.hidden=!1}getFromImage(t){let{rawDims:{pageWidth:e,pageHeight:n},rotation:s}=this.parent.viewport;return Ei.process(t,e,n,s,i._INNER_MARGIN)}getFromText(t,e){let{rawDims:{pageWidth:n,pageHeight:s},rotation:a}=this.parent.viewport;return Ei.extractContoursFromText(t,e,n,s,a,i._INNER_MARGIN)}getDrawnSignature(t){let{rawDims:{pageWidth:e,pageHeight:n},rotation:s}=this.parent.viewport;return Ei.processDrawnLines({lines:t,pageWidth:e,pageHeight:n,rotation:s,innerMargin:i._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:e}){t?this._drawingOptions=i.getDefaultDrawingOptions():(this._drawingOptions=i._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":e}))}serialize(t=!1){if(this.isEmpty())return null;let{lines:e,points:n}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":s}}=this,a=Object.assign(super.serialize(t),{isSignature:!0,areContours:this.#t,color:[0,0,0],thickness:this.#t?0:s});return this.addComment(a),t?(a.paths={lines:e,points:n},a.uuid=this.#n,a.isCopy=!0):a.lines=e,this.#e&&(a.accessibilityData={type:"Figure",alt:this.#e}),a}static deserializeDraw(t,e,n,s,a,r){return r.areContours?xr.deserialize(t,e,n,s,a,r):zn.deserialize(t,e,n,s,a,r)}static async deserialize(t,e,n){let s=await super.deserialize(t,e,n);return s.#t=t.areContours,s.description=t.accessibilityData?.alt||"",s.#n=t.uuid,s}},kf=class extends tt{#t=null;#e=null;#i=null;#n=null;#s=null;#r="";#a=null;#o=!1;#c=null;#l=!1;#d=!1;static _type="stamp";static _editorType=P.STAMP;constructor(t){super({...t,name:"stampEditor"}),this.#n=t.bitmapUrl,this.#s=t.bitmapFile,this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,e){tt.initialize(t,e)}static isHandlingMimeForPasting(t){return Sl.includes(t)}static paste(t,e){e.pasteEditor({mode:P.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}}#h(t,e=!1){if(!t){this.remove();return}this.#t=t.bitmap,e||(this.#e=t.id,this.#l=t.isSvg),t.file&&(this.#r=t.file.name),this.#g()}#p(){if(this.#i=null,this._uiManager.enableWaiting(!1),!!this.#a){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:n}=this._uiManager;if(!n)throw new Error("No ML.");if(!await n.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");let{data:s,width:a,height:r}=t||this.copyCanvas(null,null,!0).imageData,o=await n.guess({name:"altText",request:{data:s,width:a,height:r,channels:s.length/(a*r)}});if(!o)throw new Error("No response from the AI service.");if(o.error)throw new Error("Error from the AI service.");if(o.cancel)return null;if(!o.output)throw new Error("No valid response from the AI service.");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(n=>this.#h(n,!0)).finally(()=>this.#p());return}if(this.#n){let n=this.#n;this.#n=null,this._uiManager.enableWaiting(!0),this.#i=this._uiManager.imageManager.getFromUrl(n).then(s=>this.#h(s)).finally(()=>this.#p());return}if(this.#s){let n=this.#s;this.#s=null,this._uiManager.enableWaiting(!0),this.#i=this._uiManager.imageManager.getFromFile(n).then(s=>this.#h(s)).finally(()=>this.#p());return}let t=document.createElement("input");t.type="file",t.accept=Sl.join(",");let e=this._uiManager._signal;this.#i=new Promise(n=>{t.addEventListener("change",async()=>{if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let s=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#h(s)}n()},{signal:e}),t.addEventListener("cancel",()=>{this.remove(),n()},{signal:e})}).finally(()=>this.#p()),t.click()}remove(){this.#e&&(this.#t=null,this._uiManager.imageManager.deleteId(this.#e),this.#a?.remove(),this.#a=null,this.#c&&(clearTimeout(this.#c),this.#c=null)),super.remove()}rebuild(){if(!this.parent){this.#e&&this.#m();return}super.rebuild(),this.div!==null&&(this.#e&&this.#a===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.#n||this.#s||this.#e||this.#o)}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.#o||(this.#t?this.#g():this.#m()),this._isCopy&&this._moveAfterPaste(t,e),this._uiManager.addShouldRescale(this),this.div}setCanvas(t,e){let{id:n,bitmap:s}=this._uiManager.imageManager.getFromCanvas(t,e);e.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(this.#e=n,s&&(this.#t=s),this.#o=!1,this.#g())}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;this.#c!==null&&clearTimeout(this.#c);let t=200;this.#c=setTimeout(()=>{this.#c=null,this.#f()},t)}#g(){let{div:t}=this,{width:e,height:n}=this.#t,[s,a]=this.pageDimensions,r=.75;if(this.width)e=this.width*s,n=this.height*a;else if(e>r*s||n>r*a){let l=Math.min(r*s/e,r*a/n);e*=l,n*=l}this._uiManager.enableWaiting(!1);let o=this.#a=document.createElement("canvas");o.setAttribute("role","img"),this.addContainer(o),this.width=e/s,this.height=n/a,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(t.hidden=!1),this.#f(),this.#d||(this.parent.addUndoableEditor(this),this.#d=!0),this._reportTelemetry({action:"inserted_image"}),this.#r&&this.div.setAttribute("aria-description",this.#r),this.annotationElementId||this._uiManager.a11yAlert(tt._l10nAlert.stamp)}copyCanvas(t,e,n=!1){t||(t=224);let{width:s,height:a}=this.#t,r=new Je,o=this.#t,l=s,c=a,u=null;if(e){if(s>e||a>e){let E=Math.min(e/s,e/a);l=Math.floor(s*E),c=Math.floor(a*E)}u=document.createElement("canvas");let d=u.width=Math.ceil(l*r.sx),f=u.height=Math.ceil(c*r.sy);this.#l||(o=this.#u(d,f));let m=u.getContext("2d");m.filter=this._uiManager.hcmFilter;let y="white",v="#cfcfd8";this._uiManager.hcmFilter!=="none"?v="black":sd.isDarkMode&&(y="#8f8f9d",v="#42414d");let p=15,g=p*r.sx,b=p*r.sy,A=new OffscreenCanvas(g*2,b*2),S=A.getContext("2d");S.fillStyle=y,S.fillRect(0,0,g*2,b*2),S.fillStyle=v,S.fillRect(0,0,g,b),S.fillRect(g,b,g,b),m.fillStyle=m.createPattern(A,"repeat"),m.fillRect(0,0,d,f),m.drawImage(o,0,0,o.width,o.height,0,0,d,f)}let h=null;if(n){let d,f;if(r.symmetric&&o.width<t&&o.height<t)d=o.width,f=o.height;else if(o=this.#t,s>t||a>t){let v=Math.min(t/s,t/a);d=Math.floor(s*v),f=Math.floor(a*v),this.#l||(o=this.#u(d,f))}let y=new OffscreenCanvas(d,f).getContext("2d",{willReadFrequently:!0});y.drawImage(o,0,0,o.width,o.height,0,0,d,f),h={width:d,height:f,data:y.getImageData(0,0,d,f).data}}return{canvas:u,width:l,height:c,imageData:h}}#u(t,e){let{width:n,height:s}=this.#t,a=n,r=s,o=this.#t;for(;a>2*t||r>2*e;){let l=a,c=r;a>2*t&&(a=Math.ceil(a/2)),r>2*e&&(r=Math.ceil(r/2));let u=new OffscreenCanvas(a,r);u.getContext("2d").drawImage(o,0,0,l,c,0,0,a,r),o=u.transferToImageBitmap()}return o}#f(){let[t,e]=this.parentDimensions,{width:n,height:s}=this,a=new Je,r=Math.ceil(n*t*a.sx),o=Math.ceil(s*e*a.sy),l=this.#a;if(!l||l.width===r&&l.height===o)return;l.width=r,l.height=o;let c=this.#l?this.#t:this.#u(r,o),u=l.getContext("2d");u.filter=this._uiManager.hcmFilter,u.drawImage(c,0,0,c.width,c.height,0,0,r,o)}#b(t){if(t){if(this.#l){let s=this._uiManager.imageManager.getSvgUrl(this.#e);if(s)return s}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,n]=this.pageDimensions,s=Math.round(this.width*e*wi.PDF_TO_CSS_UNITS),a=Math.round(this.height*n*wi.PDF_TO_CSS_UNITS),r=new OffscreenCanvas(s,a);return r.getContext("2d").drawImage(this.#t,0,0,this.#t.width,this.#t.height,0,0,s,a),r.transferToImageBitmap()}return structuredClone(this.#t)}static async deserialize(t,e,n){let s=null,a=!1;if(t instanceof zl){let{data:{rect:y,rotation:v,id:p,structParent:g,popupRef:b,richText:A,contentsObj:S,creationDate:E,modificationDate:T},container:w,parent:{page:{pageNumber:_}},canvas:C}=t,D,N;C?(delete t.canvas,{id:D,bitmap:N}=n.imageManager.getFromCanvas(w.id,C),C.remove()):(a=!0,t._hasNoCanvas=!0);let z=(await e._structTree.getAriaAttributes(`${ks}${p}`))?.get("aria-label")||"";s=t={annotationType:P.STAMP,bitmapId:D,bitmap:N,pageIndex:_-1,rect:y.slice(0),rotation:v,annotationElementId:p,id:p,deleted:!1,accessibilityData:{decorative:!1,altText:z},isSvg:!1,structParent:g,popupRef:b,richText:A,comment:S?.str||null,creationDate:E,modificationDate:T}}let r=await super.deserialize(t,e,n),{rect:o,bitmap:l,bitmapUrl:c,bitmapId:u,isSvg:h,accessibilityData:d}=t;a?(n.addMissingCanvas(t.id,r),r.#o=!0):u&&n.imageManager.isValidId(u)?(r.#e=u,l&&(r.#t=l)):r.#n=c,r.#l=h;let[f,m]=r.pageDimensions;return r.width=(o[2]-o[0])/f,r.height=(o[3]-o[1])/m,d&&(r.altTextData=d),r._initialData=s,t.comment&&r.setCommentData(t),r.#d=!!s,r}serialize(t=!1,e=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let n=Object.assign(super.serialize(t),{bitmapId:this.#e,isSvg:this.#l});if(this.addComment(n),t)return n.bitmapUrl=this.#b(!0),n.accessibilityData=this.serializeAltText(!0),n.isCopy=!0,n;let{decorative:s,altText:a}=this.serializeAltText(!1);if(!s&&a&&(n.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){let o=this.#v(n);return o.isSame?null:(o.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1,n.id=this.annotationElementId,delete n.bitmapId,n)}if(e===null)return n;e.stamps||=new Map;let r=this.#l?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!e.stamps.has(this.#e))e.stamps.set(this.#e,{area:r,serialized:n}),n.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 n}#v(t){let{pageIndex:e,accessibilityData:{altText:n}}=this._initialData,s=t.pageIndex===e,a=(t.accessibilityData?.alt||"")===n;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&s&&a,isSameAltText:a}}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}},Xl=class i{#t;#e=!1;#i=null;#n=null;#s=null;#r=new Map;#a=!1;#o=!1;#c=!1;#l=null;#d=null;#h=null;#p=null;#m=null;#g=-1;#u;static _initialized=!1;static#f=new Map([xf,Of,kf,Ul,Lf].map(t=>[t._editorType,t]));constructor({uiManager:t,pageIndex:e,div:n,structTreeLayer:s,accessibilityManager:a,annotationLayer:r,drawLayer:o,textLayer:l,viewport:c,l10n:u}){let h=[...i.#f.values()];if(!i._initialized){i._initialized=!0;for(let d of h)d.initialize(u,t)}t.registerEditorTypes(h),this.#u=t,this.pageIndex=e,this.div=n,this.#t=a,this.#i=r,this.viewport=c,this.#h=l,this.drawLayer=o,this._structTree=s,this.#u.addLayer(this)}get isEmpty(){return this.#r.size===0}get isInvisible(){return this.isEmpty&&this.#u.getMode()===P.NONE}updateToolbar(t){this.#u.updateToolbar(t)}updateMode(t=this.#u.getMode()){switch(this.#A(),t){case P.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case P.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case P.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===P.POPUP)e.toggle("commentEditing",!0);else{e.toggle("commentEditing",!1);for(let n of i.#f.values())e.toggle(`${n._type}Editing`,t===n._editorType)}this.div.hidden=!1}hasTextLayer(t){return t===this.#h?.div}setEditingState(t){this.#u.setEditingState(t)}addCommands(t){this.#u.addCommands(t)}cleanUndoStack(t){this.#u.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?.togglePointerEvents(t)}get#b(){return this.#r.size!==0?this.#r.values():this.#u.getEditors(this.pageIndex)}async enable(){this.#c=!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 n of this.#b)n.enableEditing(),n.show(!0),n.annotationElementId&&(this.#u.removeChangedExistingAnnotation(n),t.add(n.annotationElementId));let e=this.#i;if(e)for(let n of e.getEditableAnnotations()){if(n.hide(),this.#u.isDeletedAnnotationElement(n.data.id)||t.has(n.data.id))continue;let s=await this.deserialize(n);s&&(this.addOrRebuild(s),s.enableEditing())}this.#c=!1,this.#u._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#o=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),this.#h&&!this.#m){this.#m=new AbortController;let s=this.#u.combinedSignal(this.#m);this.#h.div.addEventListener("pointerdown",a=>{let{clientX:o,clientY:l,timeStamp:c}=a,u=this.#g;if(c-u>500){this.#g=c;return}this.#g=-1;let{classList:h}=this.div;h.toggle("getElements",!0);let d=document.elementsFromPoint(o,l);if(h.toggle("getElements",!1),!this.div.contains(d[0]))return;let f,m=new RegExp(`^${cr}[0-9]+$`);for(let v of d)if(m.test(v.id)){f=v.id;break}if(!f)return;let y=this.#r.get(f);y?.annotationElementId===null&&(bt(a),y.dblclick(a))},{signal:s,capture:!0})}let t=this.#i,e=[];if(t){let s=new Map,a=new Map;for(let r of this.#b){if(r.disableEditing(),!r.annotationElementId){e.push(r);continue}if(r.serialize()!==null){s.set(r.annotationElementId,r);continue}else a.set(r.annotationElementId,r);this.getEditableAnnotation(r.annotationElementId)?.show(),r.remove()}for(let r of t.getEditableAnnotations()){let{id:o}=r.data;if(this.#u.isDeletedAnnotationElement(o)){r.updateEdited({deleted:!0});continue}let l=a.get(o);if(l){l.resetAnnotationElement(r),l.show(!1),r.show();continue}l=s.get(o),l&&(this.#u.addChangedExistingAnnotation(l),l.renderAnnotationElement(r)&&l.show(!1)),r.show()}}this.#A(),this.isEmpty&&(this.div.hidden=!0);let{classList:n}=this.div;for(let s of i.#f.values())n.remove(`${s._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(e),this.#o=!1}getEditableAnnotation(t){return this.#i?.getEditableAnnotation(t)||null}setActiveEditor(t){this.#u.getActive()!==t&&this.#u.setActiveEditor(t)}enableTextSelection(){if(this.div.tabIndex=-1,this.#h?.div&&!this.#p){this.#p=new AbortController;let t=this.#u.combinedSignal(this.#p);this.#h.div.addEventListener("pointerdown",this.#v.bind(this),{signal:t}),this.#h.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#h?.div&&this.#p&&(this.#p.abort(),this.#p=null,this.#h.div.classList.remove("highlighting"))}#v(t){this.#u.unselectAll();let{target:e}=t;if(e===this.#h.div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent")||e.classList.contains("textLayerImages")||e.classList.contains("textLayerImagePlaceholder"))&&this.#h.div.contains(e)){let{isMac:n}=J.platform;if(t.button!==0||t.ctrlKey&&n)return;this.#u.showAllEditors("highlight",!0,!0),this.#h.div.classList.add("free"),this.toggleDrawing(),Ul.startHighlighting(this,this.#u.direction==="ltr",{target:this.#h.div,x:t.x,y:t.y}),this.#h.div.addEventListener("pointerup",()=>{this.#h.div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:this.#u._signal}),t.preventDefault()}}enableClick(){if(this.#n)return;this.#n=new AbortController;let t=this.#u.combinedSignal(this.#n);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.#n?.abort(),this.#n=null}attach(t){this.#r.set(t.id,t);let{annotationElementId:e}=t;e&&this.#u.isDeletedAnnotationElement(e)&&this.#u.removeDeletedAnnotationElement(t)}detach(t){this.#r.delete(t.id),this.#t?.removePointerInTextLayer(t.contentDiv),!this.#o&&t.annotationElementId&&this.#u.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#u.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(this.#u.addDeletedAnnotationElement(t),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.#u.addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!this.#c),this.#u.addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:e}=document;t.div.contains(e)&&!this.#s&&(t._focusEventsAllowed=!1,this.#s=setTimeout(()=>{this.#s=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this.#u._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),n=()=>{t.remove()};this.addCommands({cmd:e,undo:n,mustExec:!1})}getEditorByUID(t){for(let e of this.#r.values())if(e.uid===t)return e;return null}get#y(){return i.#f.get(this.#u.getMode())}combinedSignal(t){return this.#u.combinedSignal(t)}#T(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.#u.updateMode(t.mode);let{offsetX:n,offsetY:s}=this.#w(),a=this.#u.getId(),r=this.#T({parent:this,id:a,x:n,y:s,uiManager:this.#u,isCentered:!0,...e});r&&this.add(r)}async deserialize(t){return await i.#f.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#u)||null}createAndAddNewEditor(t,e,n={}){let s=this.#u.getId(),a=this.#T({parent:this,id:s,x:t.offsetX,y:t.offsetY,uiManager:this.#u,isCentered:e,...n});return a&&this.add(a),a}get boundingClientRect(){return this.div.getBoundingClientRect()}#w(){let{x:t,y:e,width:n,height:s}=this.boundingClientRect,a=Math.max(0,t),r=Math.max(0,e),o=Math.min(window.innerWidth,t+n),l=Math.min(window.innerHeight,e+s),c=(a+o)/2-t,u=(r+l)/2-e,[h,d]=this.viewport.rotation%180===0?[c,u]:[u,c];return{offsetX:h,offsetY:d}}addNewEditor(t={}){this.createAndAddNewEditor(this.#w(),!0,t)}setSelected(t){this.#u.setSelected(t)}toggleSelected(t){this.#u.toggleSelected(t)}unselect(t){this.#u.unselect(t)}pointerup(t){let{isMac:e}=J.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div||!this.#a||(this.#a=!1,this.#y?.isDrawer&&this.#y.supportMultipleDrawings))return;if(!this.#e){this.#e=!0;return}let n=this.#u.getMode();if(n===P.STAMP||n===P.POPUP||n===P.SIGNATURE){this.#u.unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){if(this.#u.getMode()===P.HIGHLIGHT&&this.enableTextSelection(),this.#a){this.#a=!1;return}let{isMac:e}=J.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;if(this.#a=!0,this.#y?.isDrawer){this.startDrawingSession(t);return}let n=this.#u.getActive();this.#e=!n||n.isEmpty()}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),this.#l){this.#y.startDrawing(this,this.#u,!1,t);return}this.#u.setCurrentDrawingSession(this),this.#l=new AbortController;let e=this.#u.combinedSignal(this.#l);this.div.addEventListener("blur",({relatedTarget:n})=>{n&&!this.div.contains(n)&&(this.#d=null,this.commitOrRemove())},{signal:e}),this.#y.startDrawing(this,this.#u,!1,t)}pause(t){if(t){let{activeElement:e}=document;this.div.contains(e)&&(this.#d=e);return}this.#d&&setTimeout(()=>{this.#d?.focus(),this.#d=null},0)}endDrawingSession(t=!1){return this.#l?(this.#u.setCurrentDrawingSession(null),this.#l.abort(),this.#l=null,this.#d=null,this.#y.endDrawing(t)):null}findNewParent(t,e,n){let s=this.#u.findParent(e,n);return s===null||s===this?!1:(s.changeParent(t),!0)}commitOrRemove(){return this.#l?(this.endDrawingSession(),!0):!1}onScaleChanging(){this.#l&&this.#y.onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),this.#u.getActive()?.parent===this&&(this.#u.commitOrRemove(),this.#u.setActiveEditor(null)),this.#s&&(clearTimeout(this.#s),this.#s=null);for(let t of this.#r.values())this.#t?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#r.clear(),this.#u.removeLayer(this)}#A(){for(let t of this.#r.values())t.isEmpty()&&t.remove()}async render({viewport:t}){this.viewport=t,an(this.div,t);for(let e of this.#u.getEditors(this.pageIndex))this.add(e),e.rebuild();await this.#u.findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:t}){this.#u.commitOrRemove(),this.#A();let e=this.viewport.rotation,n=t.rotation;if(this.viewport=t,an(this.div,{rotation:n}),e!==n)for(let s of this.#r.values())s.rotate(n)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return this.#u.viewParameters.realScale}};Yl=class i{#t=null;#e=new Map;#i=null;#n=null;#s=null;#r=null;#a=new Map;static#o=0;static#c=0;static#l=null;static#d=new Set;static#h=!1;static#p=new Set;static#m=new WeakMap;constructor({filterFactory:t=null,pageColors:e=null,pageIndex:n,textLayer:s=null}){if(this.pageIndex=n,this.#n=t,this.#s=e,s){let a=i.#m.get(s);if(a?.selectionDiv&&(a.selectionDiv.remove(),i.#d.delete(a.selectionDiv)),i.#m.set(s,{drawLayer:this}),i.#p.add(s),this.#i=s,this.#r=new MutationObserver(r=>{if(!(!this.#t||!this.#i?.isConnected||!i.#u())){for(let{addedNodes:o}of r)for(let l of o)if(l.nodeType===Node.ELEMENT_NODE&&l.classList.contains("endOfContent")){i.#b();return}}}),this.#r.observe(s,{childList:!0}),i.#l===null){i.#l=new AbortController;let{signal:r}=i.#l;document.addEventListener("selectionchange",i.#b.bind(i),{signal:r}),document.addEventListener("pointerdown",()=>{i.#h=!0},{signal:r}),document.addEventListener("pointerup",()=>{i.#h=!1},{signal:r}),window.addEventListener("blur",()=>{i.#h=!1},{signal:r})}}}setParent(t){if(!this.#t){this.#t=t,this.#i?.isConnected&&i.#u()&&i.#b();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#g(t){let e=this.#m.get(t);e?.selectionDiv&&(e.selectionDiv.remove(),this.#d.delete(e.selectionDiv),e.selectionDiv=null,e.path=null)}static#u(){let t=document.getSelection();return!!t&&!t.isCollapsed}static#f(){return[...this.#p].filter(t=>t.isConnected).sort(NS)}static#b(){let t=document.getSelection();if(!t||t.isCollapsed){for(let r of this.#d)r.remove();this.#d.clear();return}let e=new WeakMap,n=this.#f(),s=[];for(let r=0,o=t.rangeCount;r<o;r++){let l=t.getRangeAt(r);if(l.collapsed)continue;let{startContainer:c,startOffset:u,endContainer:h,endOffset:d}=l,f=gl(c),m=gl(h),y=f===null,v=m===null;if(this.#h&&y!==v)return;if(t.rangeCount===1){let{anchorNode:b,anchorOffset:A,focusNode:S,focusOffset:E}=t,T=gl(b),w=gl(S),_=LS(b,A,S,E);T&&w&&_!==null&&(_?(c=b,u=A,f=T,h=S,d=E,m=w):(c=S,u=E,f=w,h=b,d=A,m=T))}let p=n.filter(b=>l.intersectsNode(b));if(p.length===0)continue;let g=!1;if(f||(f=p[0],c=f,u=0,g=!0),m||(m=p.at(-1),h=m,d=m.childNodes.length,g=!0),h.nodeType===Node.ELEMENT_NODE){if(h.classList.contains("endOfContent")){let b=h.previousSibling;if(!b)continue;h=b,d=b.nodeType===Node.TEXT_NODE?b.textContent.length:b.childNodes.length}else if(h.classList.contains("textLayer")&&h.childNodes.length===d){let b=fb(h,d,m);if(!b)continue;h=b.container,d=b.offset}}if(c.nodeType===Node.ELEMENT_NODE){let b=fb(c,u,f);if(!b)continue;c=b.container,u=b.offset}if(f===m&&!g&&p.includes(f)){s.push([l,f]);continue}for(let b of p){let A=b.firstChild;if(!A)continue;let S=document.createRange();if(b===f?S.setStart(c,u):S.setStartBefore(A),b===m)S.setEnd(h,d);else{let E=b.lastChild;if(!E)continue;if(E.nodeType===Node.ELEMENT_NODE&&E.classList.contains("endOfContent")){let T=E.previousSibling;if(!T)continue;S.setEndAfter(T)}else S.setEndAfter(E)}S.collapsed||s.push([S,b])}}let a=new Set(s.map(r=>r[1]));for(let r of this.#p)a.has(r)||this.#g(r);for(let[r,o]of s){let l=i.#m.get(o);if(!l)continue;let c=e.get(o);if(!c){let m=o.getBoundingClientRect();c=(y,v,p,g)=>({x:(y-m.x)/m.width,y:(v-m.y)/m.height,width:p/m.width,height:g/m.height}),e.set(o,c)}let u=[];for(let{x:m,y,width:v,height:p}of r.getClientRects())v===0||p===0||({x:m,y,width:v,height:p}=c(m,y,v,p),!(v===1&&p===1)&&u.push(`M${m} ${y} h${v} v${p} h-${v} Z`));if(u.length===0)continue;let h=l.drawLayer,d=l.selectionDiv,f=l.path;if(!d){let m=`clip_selection_${i.#c++}`;d=document.createElement("div"),d.className="selection",d.style.clipPath=`url(#${m})`;let y=h.#n?.createSelectionStyle(h.#s);if(y)for(let[g,b]of Object.entries(y))d.style.setProperty(g,b);let v=i._svgFactory.create(1,1,!0);v.setAttribute("aria-hidden","true"),v.setAttribute("width","100%"),v.setAttribute("height","100%");let p=i._svgFactory.createElement("clipPath");p.setAttribute("id",m),p.setAttribute("clipPathUnits","objectBoundingBox"),f=i._svgFactory.createElement("path"),p.append(f),v.append(p),d.append(v),l.path=f,l.selectionDiv=d}!d.parentNode&&h.#t&&(h.#t.append(d),this.#d.add(d)),f.setAttribute("d",u.join(" "))}}static get _svgFactory(){return B(this,"_svgFactory",new kn)}static#v(t,[e,n,s,a]){let{style:r}=t;r.top=`${100*n}%`,r.left=`${100*e}%`,r.width=`${100*s}%`,r.height=`${100*a}%`}#y(){let t=i._svgFactory.create(1,1,!0);return this.#t.append(t),t.setAttribute("aria-hidden","true"),t}#T(t,e){let n=i._svgFactory.createElement("clipPath");t.append(n);let s=`clip_${e}`;n.setAttribute("id",s),n.setAttribute("clipPathUnits","objectBoundingBox");let a=i._svgFactory.createElement("use");return n.append(a),a.setAttribute("href",`#${e}`),a.classList.add("clip"),s}#w(t,e){for(let[n,s]of Object.entries(e))s===null?t.removeAttribute(n):t.setAttribute(n,s)}draw(t,e=!1,n=!1){let s=i.#o++,a=this.#y(),r=i._svgFactory.createElement("defs");a.append(r);let o=i._svgFactory.createElement("path");r.append(o);let l=`path_${s}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),e&&this.#a.set(s,o);let c=n?this.#T(r,l):null,u=i._svgFactory.createElement("use");return a.append(u),u.setAttribute("href",`#${l}`),this.updateProperties(a,t),this.#e.set(s,a),{id:s,clipPathId:`url(#${c})`}}drawOutline(t,e){let n=i.#o++,s=this.#y(),a=i._svgFactory.createElement("defs");s.append(a);let r=i._svgFactory.createElement("path");a.append(r);let o=`path_${n}`;r.setAttribute("id",o),r.setAttribute("vector-effect","non-scaling-stroke");let l;if(e){let h=i._svgFactory.createElement("mask");a.append(h),l=`mask_${n}`,h.setAttribute("id",l),h.setAttribute("maskUnits","objectBoundingBox");let d=i._svgFactory.createElement("rect");h.append(d),d.setAttribute("width","1"),d.setAttribute("height","1"),d.setAttribute("fill","white");let f=i._svgFactory.createElement("use");h.append(f),f.setAttribute("href",`#${o}`),f.setAttribute("stroke","none"),f.setAttribute("fill","black"),f.setAttribute("fill-rule","nonzero"),f.classList.add("mask")}let c=i._svgFactory.createElement("use");s.append(c),c.setAttribute("href",`#${o}`),l&&c.setAttribute("mask",`url(#${l})`);let u=c.cloneNode();return s.append(u),c.classList.add("mainOutline"),u.classList.add("secondaryOutline"),this.updateProperties(s,t),this.#e.set(n,s),n}finalizeDraw(t,e){this.#a.delete(t),this.updateProperties(t,e)}updateProperties(t,e){if(!e)return;let{root:n,bbox:s,rootClass:a,path:r}=e,o=typeof t=="number"?this.#e.get(t):t;if(o){if(n&&this.#w(o,n),s&&i.#v(o,s),a){let{classList:l}=o;for(let[c,u]of Object.entries(a))l.toggle(c,u)}if(r){let c=o.firstElementChild.firstElementChild;this.#w(c,r)}}}updateParent(t,e){if(e===this)return;let n=this.#e.get(t);n&&(e.#t.append(n),this.#e.delete(t),e.#e.set(t,n))}remove(t){this.#a.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.#a.clear(),this.#r?.disconnect(),this.#r=null,this.#i&&(i.#m.get(this.#i)?.drawLayer===this&&(i.#g(this.#i),i.#m.delete(this.#i),i.#p.delete(this.#i),i.#p.size===0&&(i.#l?.abort(),i.#l=null,i.#h=!1)),this.#i=null)}};ql=class i{#t=[];#e=new Map;#i=null;#n=0;#s=0;#r=0;static#a=null;constructor(t,e,n,s){this.#n=t,this.#t=e,this.#s=n.rawDims.pageWidth,this.#r=n.rawDims.pageHeight,this.#i=s}render(){let t=document.createElement("div");t.className="textLayerImages";for(let e=0;e<this.#t.length;e+=6){let n=this.#o(this.#t.subarray(e,e+6));n&&t.append(n)}return t.addEventListener("contextmenu",e=>{if(!(e.target instanceof HTMLCanvasElement))return;let n=e.target,s=this.#e.get(n);if(!s)return;let a=i.#a?.deref();if(a===n)return;a&&(a.width=0,a.height=0),i.#a=new WeakRef(n);let{inverseTransform:r,x1:o,y1:l,width:c,height:u}=s,h=this.#i(),d=Math.ceil(o*h.width),f=Math.ceil(l*h.height),m=Math.floor((o+c/this.#s)*h.width),y=Math.floor((l+u/this.#r)*h.height);n.width=m-d,n.height=y-f;let v=n.getContext("2d");v.setTransform(...r),v.translate(-d,-f),v.drawImage(h,0,0)}),t}#o([t,e,n,s,a,r]){let o=Math.hypot((a-t)*this.#s,(r-e)*this.#r),l=Math.hypot((n-t)*this.#s,(s-e)*this.#r);if(o<this.#n||l<this.#n)return null;let c=[(a-t)*this.#s/o,(r-e)*this.#r/o,(n-t)*this.#s/l,(s-e)*this.#r/l,0,0],u=M.inverseTransform(c),h=document.createElement("canvas");return h.className="textLayerImagePlaceholder",h.width=0,h.height=0,Object.assign(h.style,{opacity:0,position:"absolute",left:ml(t),top:ml(e),width:ml(o/this.#s),height:ml(l/this.#r),transformOrigin:"0% 0%",transform:`matrix(${c.join(",")})`}),this.#e.set(h,{inverseTransform:u,width:o,height:l,x1:t,y1:e}),h}};globalThis._pdfjsTestingUtils={HighlightOutliner:wr};globalThis.pdfjsLib={AbortException:Ge,AnnotationEditorLayer:Xl,AnnotationEditorParamsType:H,AnnotationEditorType:P,AnnotationEditorUIManager:rn,AnnotationLayer:Il,AnnotationMode:Si,AnnotationType:St,applyOpacity:vb,build:kb,ColorPicker:Ar,createValidAbsoluteUrl:Bf,CSSConstants:El,DOMSVGFactory:kn,DrawLayer:Yl,FeatureTest:J,fetchData:Zl,findContrastColor:Ab,getDocument:Nb,getFilenameFromUrl:yb,getPdfFilenameFromUrl:bb,getRGB:Ks,getRGBA:qs,getUuid:Pf,GlobalWorkerOptions:sn,ImageKind:sr,InvalidPDFException:Is,isDataScheme:Mr,isPdfFile:Jl,isValidExplicitDest:Tb,makeArr:Ys,makeMap:$l,makeObj:vl,MathClamp:ht,noContextMenu:Te,normalizeUnicode:mb,OPS:Ue,OutputScale:Je,PasswordException:Ps,PasswordResponses:gb,PDFDataRangeTransport:vr,PDFDateString:Hs,PDFWorker:Xs,PermissionFlag:pb,PixelsPerInch:wi,RenderingCancelledException:Fs,renderRichText:If,ResponseException:Nn,setLayerDimensions:an,shadow:B,SignatureExtractor:Ei,stopEvent:bt,SupportedImageMimeTypes:Sl,TextLayer:Vs,TextLayerImages:ql,TouchManager:fr,updateUrlHash:zf,Util:M,VerbosityLevel:Cr,version:Lb,XfaLayer:dr}});var jb=Ci(Dy());var q=Ci(ea());var nn=Ci(ea(),1),Hy=Ci(Tc(),1);function Cn(i,t,e){let n=e.initialDeps??[],s,a=!0;function r(){var o,l,c;let u;e.key&&((o=e.debug)!=null&&o.call(e))&&(u=Date.now());let h=i();if(!(h.length!==n.length||h.some((m,y)=>n[y]!==m)))return s;n=h;let f;if(e.key&&((l=e.debug)!=null&&l.call(e))&&(f=Date.now()),s=t(...h),e.key&&((c=e.debug)!=null&&c.call(e))){let m=Math.round((Date.now()-u)*100)/100,y=Math.round((Date.now()-f)*100)/100,v=y/16,p=(g,b)=>{for(g=String(g);g.length<b;)g=" "+g;return g};console.info(`%c\u23F1 ${p(y,5)} /${p(m,5)} ms`,`
63
+ `)){let a=document.createElement("div");a.append(s?document.createTextNode(s):document.createElement("br")),e.append(a)}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()}},O=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,n,s,a,r){r||=new Float32Array(t.length);for(let o=0,l=t.length;o<l;o+=2)r[o]=e+t[o]*s,r[o+1]=n+t[o+1]*a;return r}static _rescaleAndSwap(t,e,n,s,a,r){r||=new Float32Array(t.length);for(let o=0,l=t.length;o<l;o+=2)r[o]=e+t[o+1]*s,r[o+1]=n+t[o]*a;return r}static _translate(t,e,n,s){s||=new Float32Array(t.length);for(let a=0,r=t.length;a<r;a+=2)s[a]=e+t[a],s[a+1]=n+t[a+1];return s}static svgRound(t){return Math.round(t*1e4)}static _normalizePoint(t,e,n,s,a){switch(a){case 90:return[1-e/n,t/s];case 180:return[1-t/n,1-e/s];case 270:return[e/n,1-t/s];default:return[t/n,e/s]}}static createBezierPoints(t,e,n,s,a,r){return[(t+5*n)/6,(e+5*s)/6,(5*n+a)/6,(5*s+r)/6,(n+a)/2,(s+r)/2]}},Il=class i{#t;#e=[];#i;#n;#s=[];#r=new Float32Array(18);#a;#o;#c;#l;#d;#h;#p=[];static#m=8;static#g=2;static#u=i.#m+i.#g;constructor({x:t,y:e},n,s,a,r,o=0){this.#t=n,this.#h=a*s,this.#n=r,this.#r.set([NaN,NaN,NaN,NaN,t,e],6),this.#i=o,this.#l=i.#m*s,this.#c=i.#u*s,this.#d=s,this.#p.push(t,e)}isEmpty(){return isNaN(this.#r[8])}#f(){let t=this.#r.subarray(4,6),e=this.#r.subarray(16,18),[n,s,a,r]=this.#t;return[(this.#a+(t[0]-e[0])/2-n)/a,(this.#o+(t[1]-e[1])/2-s)/r,(this.#a+(e[0]-t[0])/2-n)/a,(this.#o+(e[1]-t[1])/2-s)/r]}add({x:t,y:e}){this.#a=t,this.#o=e;let[n,s,a,r]=this.#t,[o,l,c,u]=this.#r.subarray(8,12),h=t-c,d=e-u,f=Math.hypot(h,d);if(f<this.#c)return!1;let m=f-this.#l,y=m/f,v=y*h,p=y*d,g=o,b=l;o=c,l=u,c+=v,u+=p,this.#p?.push(t,e);let A=-p/m,S=v/m,E=A*this.#h,T=S*this.#h;return this.#r.set(this.#r.subarray(2,8),0),this.#r.set([c+E,u+T],4),this.#r.set(this.#r.subarray(14,18),12),this.#r.set([c-E,u-T],16),isNaN(this.#r[6])?(this.#s.length===0&&(this.#r.set([o+E,l+T],2),this.#s.push(NaN,NaN,NaN,NaN,(o+E-n)/a,(l+T-s)/r),this.#r.set([o-E,l-T],14),this.#e.push(NaN,NaN,NaN,NaN,(o-E-n)/a,(l-T-s)/r)),this.#r.set([g,b,o,l,c,u],6),!this.isEmpty()):(this.#r.set([g,b,o,l,c,u],6),Math.abs(Math.atan2(b-l,g-o)-Math.atan2(p,v))<Math.PI/2?([o,l,c,u]=this.#r.subarray(2,6),this.#s.push(NaN,NaN,NaN,NaN,((o+c)/2-n)/a,((l+u)/2-s)/r),[o,l,g,b]=this.#r.subarray(14,18),this.#e.push(NaN,NaN,NaN,NaN,((g+o)/2-n)/a,((b+l)/2-s)/r),!0):([g,b,o,l,c,u]=this.#r.subarray(0,6),this.#s.push(((g+5*o)/6-n)/a,((b+5*l)/6-s)/r,((5*o+c)/6-n)/a,((5*l+u)/6-s)/r,((o+c)/2-n)/a,((l+u)/2-s)/r),[c,u,o,l,g,b]=this.#r.subarray(12,18),this.#e.push(((g+5*o)/6-n)/a,((b+5*l)/6-s)/r,((5*o+c)/6-n)/a,((5*l+u)/6-s)/r,((o+c)/2-n)/a,((l+u)/2-s)/r),!0))}toSVGPath(){if(this.isEmpty())return"";let t=this.#s,e=this.#e;if(isNaN(this.#r[6])&&!this.isEmpty())return this.#b();let n=[];n.push(`M${t[4]} ${t[5]}`);for(let s=6;s<t.length;s+=6)isNaN(t[s])?n.push(`L${t[s+4]} ${t[s+5]}`):n.push(`C${t[s]} ${t[s+1]} ${t[s+2]} ${t[s+3]} ${t[s+4]} ${t[s+5]}`);this.#y(n);for(let s=e.length-6;s>=6;s-=6)isNaN(e[s])?n.push(`L${e[s+4]} ${e[s+5]}`):n.push(`C${e[s]} ${e[s+1]} ${e[s+2]} ${e[s+3]} ${e[s+4]} ${e[s+5]}`);return this.#v(n),n.join(" ")}#b(){let[t,e,n,s]=this.#t,[a,r,o,l]=this.#f();return`M${(this.#r[2]-t)/n} ${(this.#r[3]-e)/s} L${(this.#r[4]-t)/n} ${(this.#r[5]-e)/s} L${a} ${r} L${o} ${l} L${(this.#r[16]-t)/n} ${(this.#r[17]-e)/s} L${(this.#r[14]-t)/n} ${(this.#r[15]-e)/s} Z`}#v(t){let e=this.#e;t.push(`L${e[4]} ${e[5]} Z`)}#y(t){let[e,n,s,a]=this.#t,r=this.#r.subarray(4,6),o=this.#r.subarray(16,18),[l,c,u,h]=this.#f();t.push(`L${(r[0]-e)/s} ${(r[1]-n)/a} L${l} ${c} L${u} ${h} L${(o[0]-e)/s} ${(o[1]-n)/a}`)}newFreeDrawOutline(t,e,n,s,a,r){return new Fl(t,e,n,s,a,r)}getOutlines(){let t=this.#s,e=this.#e,n=this.#r,[s,a,r,o]=this.#t,l=new Float32Array((this.#p?.length??0)+2);for(let h=0,d=l.length-2;h<d;h+=2)l[h]=(this.#p[h]-s)/r,l[h+1]=(this.#p[h+1]-a)/o;if(l[l.length-2]=(this.#a-s)/r,l[l.length-1]=(this.#o-a)/o,isNaN(n[6])&&!this.isEmpty())return this.#E(l);let c=new Float32Array(this.#s.length+24+this.#e.length),u=t.length;for(let h=0;h<u;h+=2){if(isNaN(t[h])){c[h]=c[h+1]=NaN;continue}c[h]=t[h],c[h+1]=t[h+1]}u=this.#A(c,u);for(let h=e.length-6;h>=6;h-=6)for(let d=0;d<6;d+=2){if(isNaN(e[h+d])){c[u]=c[u+1]=NaN,u+=2;continue}c[u]=e[h+d],c[u+1]=e[h+d+1],u+=2}return this.#w(c,u),this.newFreeDrawOutline(c,l,this.#t,this.#d,this.#i,this.#n)}#E(t){let e=this.#r,[n,s,a,r]=this.#t,[o,l,c,u]=this.#f(),h=new Float32Array(36);return h.set([NaN,NaN,NaN,NaN,(e[2]-n)/a,(e[3]-s)/r,NaN,NaN,NaN,NaN,(e[4]-n)/a,(e[5]-s)/r,NaN,NaN,NaN,NaN,o,l,NaN,NaN,NaN,NaN,c,u,NaN,NaN,NaN,NaN,(e[16]-n)/a,(e[17]-s)/r,NaN,NaN,NaN,NaN,(e[14]-n)/a,(e[15]-s)/r],0),this.newFreeDrawOutline(h,t,this.#t,this.#d,this.#i,this.#n)}#w(t,e){let n=this.#e;return t.set([NaN,NaN,NaN,NaN,n[4],n[5]],e),e+=6}#A(t,e){let n=this.#r.subarray(4,6),s=this.#r.subarray(16,18),[a,r,o,l]=this.#t,[c,u,h,d]=this.#f();return t.set([NaN,NaN,NaN,NaN,(n[0]-a)/o,(n[1]-r)/l,NaN,NaN,NaN,NaN,c,u,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,(s[0]-a)/o,(s[1]-r)/l],e),e+=24}},Fl=class extends O{#t;#e=new Float32Array(4);#i;#n;#s;#r;#a;constructor(t,e,n,s,a,r){super(),this.#a=t,this.#s=e,this.#t=n,this.#r=s,this.#i=a,this.#n=r,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#o(r);let[o,l,c,u]=this.#e;for(let h=0,d=t.length;h<d;h+=2)t[h]=(t[h]-o)/c,t[h+1]=(t[h+1]-l)/u;for(let h=0,d=e.length;h<d;h+=2)e[h]=(e[h]-o)/c,e[h+1]=(e[h+1]-l)/u}toSVGPath(){let t=[`M${this.#a[4]} ${this.#a[5]}`];for(let e=6,n=this.#a.length;e<n;e+=6){if(isNaN(this.#a[e])){t.push(`L${this.#a[e+4]} ${this.#a[e+5]}`);continue}t.push(`C${this.#a[e]} ${this.#a[e+1]} ${this.#a[e+2]} ${this.#a[e+3]} ${this.#a[e+4]} ${this.#a[e+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,e,n,s],a){let r=n-t,o=s-e,l,c;switch(a){case 0:l=O._rescale(this.#a,t,s,r,-o),c=O._rescale(this.#s,t,s,r,-o);break;case 90:l=O._rescaleAndSwap(this.#a,t,e,r,o),c=O._rescaleAndSwap(this.#s,t,e,r,o);break;case 180:l=O._rescale(this.#a,n,e,-r,o),c=O._rescale(this.#s,n,e,-r,o);break;case 270:l=O._rescaleAndSwap(this.#a,n,s,-r,-o),c=O._rescaleAndSwap(this.#s,n,s,-r,-o);break}return{outline:Array.from(l),points:[Array.from(c)]}}#o(t){let e=this.#a,n=e[4],s=e[5],a=[n,s,n,s],r=n,o=s,l=n,c=s,u=t?Math.max:Math.min,h=new Float32Array(4);for(let f=6,m=e.length;f<m;f+=6){let y=e[f+4],v=e[f+5];isNaN(e[f])?(M.pointBoundingBox(y,v,a),o>v?(r=y,o=v):o===v&&(r=u(r,y)),c<v?(l=y,c=v):c===v&&(l=u(l,y))):(h.set(Ti,0),M.bezierBoundingBox(n,s,...e.slice(f,f+6),h),M.rectBoundingBox(...h,a),o>h[1]?(r=h[0],o=h[1]):o===h[1]&&(r=u(r,h[0])),c<h[3]?(l=h[2],c=h[3]):c===h[3]&&(l=u(l,h[2]))),n=y,s=v}let d=this.#e;d[0]=a[0]-this.#i,d[1]=a[1]-this.#i,d[2]=a[2]-a[0]+2*this.#i,d[3]=a[3]-a[1]+2*this.#i,this.firstPoint=[r,o],this.lastPoint=[l,c]}get box(){return this.#e}newOutliner(t,e,n,s,a,r=0){return new Il(t,e,n,s,a,r)}getNewOutline(t,e){let[n,s,a,r]=this.#e,[o,l,c,u]=this.#t,h=a*c,d=r*u,f=n*c+o,m=s*u+l,y=this.newOutliner({x:this.#s[0]*h+f,y:this.#s[1]*d+m},this.#t,this.#r,t,this.#n,e??this.#i);for(let v=2;v<this.#s.length;v+=2)y.add({x:this.#s[v]*h+f,y:this.#s[v+1]*d+m});return y.getOutlines()}},wr=class{#t;#e;#i;#n=[];#s=[];constructor(t,e=0,n=0,s=!0){let a=Ti.slice(),o=10**-4;for(let{x:v,y:p,width:g,height:b}of t){let A=Math.floor((v-e)/o)*o,S=Math.ceil((v+g+e)/o)*o,E=Math.floor((p-e)/o)*o,T=Math.ceil((p+b+e)/o)*o,w=[A,E,T,!0],_=[S,E,T,!1];this.#n.push(w,_),M.rectBoundingBox(A,E,S,T,a)}let l=a[2]-a[0]+2*n,c=a[3]-a[1]+2*n,u=a[0]-n,h=a[1]-n,d=s?-1/0:1/0,f=1/0,m=this.#n.at(s?-1:-2),y=[m[0],m[2]];for(let v of this.#n){let[p,g,b,A]=v;!A&&s?g<f?(f=g,d=p):g===f&&(d=Math.max(d,p)):A&&!s&&(g<f?(f=g,d=p):g===f&&(d=Math.min(d,p))),v[0]=(p-u)/l,v[1]=(g-h)/c,v[2]=(b-h)/c}this.#t=new Float32Array([u,h,l,c]),this.#e=[d,f],this.#i=y}getOutlines(){this.#n.sort((e,n)=>e[0]-n[0]||e[1]-n[1]||e[2]-n[2]);let t=[];for(let e of this.#n)e[3]?(t.push(...this.#l(e)),this.#o(e)):(this.#c(e),t.push(...this.#l(e)));return this.#r(t)}#r(t){let e=[],n=new Set;for(let r of t){let[o,l,c]=r;e.push([o,l,r],[o,c,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],c=e[r+1][2];l.push(c),c.push(l),n.add(l),n.add(c)}let s=[],a;for(;n.size>0;){let r=n.values().next().value,[o,l,c,u,h]=r;n.delete(r);let d=o,f=l;for(a=[o,c],s.push(a);;){let m;if(n.has(u))m=u;else if(n.has(h))m=h;else break;n.delete(m),[o,l,c,u,h]=m,d!==o&&(a.push(d,f,o,f===l?l:c),d=o),f=f===l?c:l}a.push(d,f)}return new xf(s,this.#t,this.#e,this.#i)}#a(t){let e=this.#s,n=0,s=e.length-1;for(;n<=s;){let a=n+s>>1,r=e[a][0];if(r===t)return a;r<t?n=a+1:s=a-1}return s+1}#o([,t,e]){let n=this.#a(t);this.#s.splice(n,0,[t,e])}#c([,t,e]){let n=this.#a(t);for(let s=n;s<this.#s.length;s++){let[a,r]=this.#s[s];if(a!==t)break;if(a===t&&r===e){this.#s.splice(s,1);return}}for(let s=n-1;s>=0;s--){let[a,r]=this.#s[s];if(a!==t)break;if(a===t&&r===e){this.#s.splice(s,1);return}}}#l(t){let[e,n,s]=t,a=[[e,n,s]],r=this.#a(s);for(let o=0;o<r;o++){let[l,c]=this.#s[o];for(let u=0,h=a.length;u<h;u++){let[,d,f]=a[u];if(!(c<=d||f<=l)){if(d>=l){if(f>c)a[u][1]=c;else{if(h===1)return[];a.splice(u,1),u--,h--}continue}a[u][2]=l,f>c&&a.push([e,c,f])}}}return a}},xf=class extends O{#t;#e;constructor(t,e,n,s){super(),this.#e=t,this.#t=e,this.firstPoint=n,this.lastPoint=s}toSVGPath(){let t=[];for(let e of this.#e){let[n,s]=e;t.push(`M${n} ${s}`);for(let a=2;a<e.length;a+=2){let r=e[a],o=e[a+1];r===n?(t.push(`V${o}`),s=o):o===s&&(t.push(`H${r}`),n=r)}t.push("Z")}return t.join(" ")}serialize([t,e,n,s],a){let r=[],o=n-t,l=s-e;for(let c of this.#e){let u=new Array(c.length);for(let h=0;h<c.length;h+=2)u[h]=t+c[h]*o,u[h+1]=s-c[h+1]*l;r.push(u)}return r}get box(){return this.#t}},_r=class extends Il{newFreeDrawOutline(t,e,n,s,a,r){return new Cf(t,e,n,s,a,r)}},Cf=class extends Fl{newOutliner(t,e,n,s,a,r=0){return new _r(t,e,n,s,a,r)}},Hl=class i extends tt{#t=null;#e=0;#i;#n=null;#s=null;#r=null;#a=null;#o=0;#c=null;#l=null;#d=null;#h=!1;#p=null;#m=null;#g=null;#u="";#f;#b="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=P.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){let t=i.prototype;return L(this,"_keyboardManager",new kn([[["ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super({...t,name:"highlightEditor"}),this.color=t.color||i._defaultColor,this.#f=t.thickness||i._defaultThickness,this.opacity=t.opacity||i._defaultOpacity,this.#i=t.boxes||null,this.#b=t.methodOfCreation||"",this.#u=t.text||"",this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",t.highlightId>-1?(this.#h=!0,this.#y(t),this.#T()):this.#i&&(this.#t=t.anchorNode,this.#e=t.anchorOffset,this.#a=t.focusNode,this.#o=t.focusOffset,this.#v(),this.#T(),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert(tt._l10nAlert.highlight)}get telemetryInitialData(){return{action:"added",type:this.#h?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this.#f,methodOfCreation:this.#b}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#v(){let t=new wr(this.#i,.001);this.#l=t.getOutlines(),[this.x,this.y,this.width,this.height]=this.#l.box;let e=new wr(this.#i,.0025,.001,this._uiManager.direction==="ltr");this.#r=e.getOutlines();let{firstPoint:n}=this.#l;this.#p=[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height];let{lastPoint:s}=this.#r;this.#m=[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height]}#y({highlightOutlines:t,highlightId:e,clipPathId:n}){this.#l=t;let s=1.5;if(this.#r=t.getNewOutline(this.#f/2+s,.0025),e>=0)this.#d=e,this.#n=n,this.parent.drawLayer.finalizeDraw(e,{bbox:t.box,path:{d:t.toSVGPath()}}),this.#g=this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:this.#r.box,path:{d:this.#r.toSVGPath()}},!0);else if(this.parent){let h=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(this.#d,{bbox:i.#C(this.#l.box,(h-this.rotation+360)%360),path:{d:t.toSVGPath()}}),this.parent.drawLayer.updateProperties(this.#g,{bbox:i.#C(this.#r.box,h),path:{d:this.#r.toSVGPath()}})}let[a,r,o,l]=t.box;switch(this.rotation){case 0:this.x=a,this.y=r,this.width=o,this.height=l;break;case 90:{let[h,d]=this.parentDimensions;this.x=r,this.y=1-a,this.width=o*d/h,this.height=l*h/d;break}case 180:this.x=1-a,this.y=1-r,this.width=o,this.height=l;break;case 270:{let[h,d]=this.parentDimensions;this.x=1-r,this.y=a,this.width=o*d/h,this.height=l*h/d;break}}let{firstPoint:c}=t;this.#p=[(c[0]-a)/o,(c[1]-r)/l];let{lastPoint:u}=this.#r;this.#m=[(u[0]-a)/o,(u[1]-r)/l]}static initialize(t,e){tt.initialize(t,e),i._defaultColor||=e.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,e){switch(t){case H.HIGHLIGHT_COLOR:i._defaultColor=e;break;case H.HIGHLIGHT_THICKNESS:i._defaultThickness=e;break}}translateInPage(t,e){}get toolbarPosition(){return this.#m}get commentButtonPosition(){return this.#p}updateParams(t,e){switch(t){case H.HIGHLIGHT_COLOR:this.#E(e);break;case H.HIGHLIGHT_THICKNESS:this.#w(e);break}}static get defaultPropertiesToUpdate(){return[[H.HIGHLIGHT_COLOR,i._defaultColor],[H.HIGHLIGHT_THICKNESS,i._defaultThickness]]}get propertiesToUpdate(){return[[H.HIGHLIGHT_COLOR,this.color||i._defaultColor],[H.HIGHLIGHT_THICKNESS,this.#f||i._defaultThickness],[H.HIGHLIGHT_FREE,this.#h]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(this.#d,{root:{fill:this.color,"fill-opacity":this.opacity}}),this.#s?.updateColor(this.color),super.onUpdatedColor()}#E(t){let e=(a,r)=>{this.color=a,this.opacity=r,this.onUpdatedColor()},n=this.color,s=this.opacity;this.addCommands({cmd:e.bind(this,t,i._defaultOpacity),undo:e.bind(this,n,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:H.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(t)},!0)}#w(t){let e=this.#f,n=s=>{this.#f=s,this.#A(s)};this.addCommands({cmd:n.bind(this,t),undo:n.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:H.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",this.#s=new Ar({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.#M())}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,this.#M())}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){this.#_(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#T(),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?this.#_():t&&(this.#T(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),e&&this.select()}#A(t){this.#h&&(this.#y({highlightOutlines:this.#l.getNewOutline(t/2)}),this.fixAndSetPosition(),this.setDims())}#_(){this.#d===null||!this.parent||(this.parent.drawLayer.remove(this.#d),this.#d=null,this.parent.drawLayer.remove(this.#g),this.#g=null)}#T(t=this.parent){this.#d===null&&({id:this.#d,clipPathId:this.#n}=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.#h},path:{d:this.#l.toSVGPath()}},!1,!0),this.#g=t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:this.#h},bbox:this.#r.box,path:{d:this.#r.toSVGPath()}},this.#h),this.#c&&(this.#c.style.clipPath=this.#n))}static#C([t,e,n,s],a){switch(a){case 90:return[1-e-s,t,s,n];case 180:return[1-t-n,1-e-s,n,s];case 270:return[e,1-t-n,s,n]}return[t,e,n,s]}rotate(t){let{drawLayer:e}=this.parent,n;this.#h?(t=(t-this.rotation+360)%360,n=i.#C(this.#l.box,t)):n=i.#C([this.x,this.y,this.width,this.height],t),e.updateProperties(this.#d,{bbox:n,root:{"data-main-rotation":t}}),e.updateProperties(this.#g,{bbox:i.#C(this.#r.box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;let t=super.render();this.#u&&(t.setAttribute("aria-label",this.#u),t.setAttribute("role","mark")),this.#h?t.classList.add("free"):this.div.addEventListener("keydown",this.#D.bind(this),{signal:this._uiManager._signal});let e=this.#c=document.createElement("div");return t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=this.#n,this.setDims(),Eb(this,this.#c,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#g,{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#g,{rootClass:{hovered:!1}})}#D(t){i._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#O(!0);break;case 1:case 3:this.#O(!1);break}}#O(t){if(!this.#t)return;let e=window.getSelection();t?e.setPosition(this.#t,this.#e):e.setPosition(this.#a,this.#o)}select(){super.select(),this.#g&&this.parent?.drawLayer.updateProperties(this.#g,{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),this.#g&&(this.parent?.drawLayer.updateProperties(this.#g,{rootClass:{selected:!1}}),this.#h||this.#O(!1))}get _mustFixPosition(){return!this.#h}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.updateProperties(this.#d,{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties(this.#g,{rootClass:{hidden:!t}}))}#M(){return this.#h?this.rotation:0}#k(){if(this.#h)return null;let[t,e]=this.pageDimensions,[n,s]=this.pageTranslation,a=this.#i,r=new Float32Array(a.length*8),o=0;for(let{x:l,y:c,width:u,height:h}of a){let d=l*t+n,f=(1-c)*e+s;r[o]=r[o+4]=d,r[o+1]=r[o+3]=f,r[o+2]=r[o+6]=d+u*t,r[o+5]=r[o+7]=f-h*e,o+=8}return r}#L(t){return this.#l.serialize(t,this.#M())}static startHighlighting(t,e,{target:n,x:s,y:a}){let{x:r,y:o,width:l,height:c}=n.getBoundingClientRect(),u=new AbortController,h=t.combinedSignal(u),d=f=>{u.abort(),this.#B(t,f)};window.addEventListener("blur",d,{signal:h}),window.addEventListener("pointerup",d,{signal:h}),window.addEventListener("pointerdown",vt,{capture:!0,passive:!1,signal:h}),window.addEventListener("contextmenu",Te,{signal:h}),n.addEventListener("pointermove",this.#N.bind(this,t),{signal:h}),this._freeHighlight=new _r({x:s,y:a},[r,o,l,c],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#N(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,n){let s=null;if(t instanceof Ll){let{data:{quadPoints:y,rect:v,rotation:p,id:g,color:b,opacity:A,popupRef:S,richText:E,contentsObj:T,creationDate:w,modificationDate:_},parent:{page:{pageNumber:C}}}=t;s=t={annotationType:P.HIGHLIGHT,color:Array.from(b),opacity:A,quadPoints:y,boxes:null,pageIndex:C-1,rect:v.slice(0),rotation:p,annotationElementId:g,id:g,deleted:!1,popupRef:S,richText:E,comment:T?.str||null,creationDate:w,modificationDate:_}}else if(t instanceof Tr){let{data:{inkLists:y,rect:v,rotation:p,id:g,color:b,borderStyle:{rawWidth:A},popupRef:S,richText:E,contentsObj:T,creationDate:w,modificationDate:_},parent:{page:{pageNumber:C}}}=t;s=t={annotationType:P.HIGHLIGHT,color:Array.from(b),thickness:A,inkLists:y,boxes:null,pageIndex:C-1,rect:v.slice(0),rotation:p,annotationElementId:g,id:g,deleted:!1,popupRef:S,richText:E,comment:T?.str||null,creationDate:w,modificationDate:_}}let{color:a,quadPoints:r,inkLists:o,outlines:l,opacity:c}=t,u=await super.deserialize(t,e,n);u.color=M.makeHexColor(...a),u.opacity=c||1,o&&(u.#f=t.thickness),u._initialData=s,t.comment&&u.setCommentData(t);let[h,d]=u.pageDimensions,[f,m]=u.pageTranslation;if(r){let y=u.#i=[];for(let v=0;v<r.length;v+=8)y.push({x:(r[v]-f)/h,y:1-(r[v+1]-m)/d,width:(r[v+2]-r[v])/h,height:(r[v+1]-r[v+5])/d});u.#v(),u.#T(),u.rotate(u.rotation)}else if(o||l){u.#h=!0;let y=(o||l.points)[0],v={x:y[0]-f,y:d-(y[1]-m)},p=new _r(v,[0,0,h,d],1,u.#f/2,!0,.001);for(let A=0,S=y.length;A<S;A+=2)v.x=y[A]-f,v.y=d-(y[A+1]-m),p.add(v);let{id:g,clipPathId:b}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:u.color,"fill-opacity":u._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:p.toSVGPath()}},!0,!0);u.#y({highlightOutlines:p.getOutlines(),highlightId:g,clipPathId:b}),u.#T(),u.rotate(u.parentRotation)}return u}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)),n=super.serialize(t);return Object.assign(n,{color:e,opacity:this.opacity,thickness:this.#f,quadPoints:this.#k(),outlines:this.#L(n.rect)}),this.addComment(n),this.annotationElementId&&!this.#P(n)?null:(n.id=this.annotationElementId,n)}#P(t){let{color:e}=this._initialData;return this.hasEditedComment||t.color.some((n,s)=>n!==e[s])}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}},Ul=class{#t=Object.create(null);updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(let[e,n]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,n)}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")}},Gl=class i extends tt{#t=null;#e;_colorPicker=null;_drawId=null;static _currentDrawId=-1;static _currentParent=null;static#i=null;static#n=null;static#s=null;static _INNER_MARGIN=3;constructor(t){super(t),this.#e=t.mustBeCommitted||!1,this._addOutlines(t)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){this._colorPicker?.updateOpacity?.(this.opacity)}_addOutlines(t){t.drawOutlines&&(this.#r(t),this.#c())}#r({drawOutlines:t,drawId:e,drawingOptions:n}){this.#t=t,this._drawingOptions||=n,this.annotationElementId||this._uiManager.a11yAlert(tt._l10nAlert[this.editorType]),e>=0?(this._drawId=e,this.parent.drawLayer.finalizeDraw(e,t.defaultProperties)):this._drawId=this.#a(t,this.parent),this.#h(t.box)}#a(t,e){let{id:n}=e.drawLayer.draw(i._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return n}static _mergeSVGProperties(t,e){let n=new Set(Object.keys(t));for(let[s,a]of Object.entries(e))n.has(s)?Object.assign(t[s],a):t[s]=a;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 n=this.typesMap.get(t);n&&this._defaultDrawingOptions.updateProperty(n,e),this._currentParent&&(i.#i.updateProperty(n,e),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,e){let n=this.constructor.typesMap.get(t);n&&this._updateProperty(t,n,e)}static get defaultPropertiesToUpdate(){let t=[],e=this._defaultDrawingOptions;for(let[n,s]of this.typesMap)t.push([n,e[s]]);return t}get propertiesToUpdate(){let t=[],{_drawingOptions:e}=this;for(let[n,s]of this.constructor.typesMap)t.push([n,e[s]]);return t}_updateProperty(t,e,n){let s=this._drawingOptions,a=s[e],r=o=>{s.updateProperty(e,o);let l=this.#t.updateProperty(e,o);l&&this.#h(l),this.parent?.drawLayer.updateProperties(this._drawId,s.toSVGProperties()),t===this.colorType?this.onUpdatedColor():t===this.opacityType&&this.onUpdatedOpacity()};this.addCommands({cmd:r.bind(this,n),undo:r.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(t,e){let n=this.constructor.typesMap.get(this.colorType),s=this.constructor.typesMap.get(this.opacityType),a=this._drawingOptions,r=a[n],o=a[s],l=(c,u)=>{a.updateProperty(n,c),a.updateProperty(s,u),this.#t.updateProperty(n,c),this.#t.updateProperty(s,u),this.parent?.drawLayer.updateProperties(this._drawId,a.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:l.bind(this,t,e),undo:l.bind(this,r,o),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:H.INK_COLOR_AND_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,i._mergeSVGProperties(this.#t.getPathResizingSVGProperties(this.#d()),{bbox:this.#p()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,i._mergeSVGProperties(this.#t.getPathResizedSVGProperties(this.#d()),{bbox:this.#p()}))}_onTranslating(t,e){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#p()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,i._mergeSVGProperties(this.#t.getPathTranslatedSVGProperties(this.#d(),this.parentDimensions),{bbox:this.#p()}))}_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.#o(),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#c(),this.#h(this.#t.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?(this._uiManager.removeShouldRescale(this),this.#o()):t&&(this._uiManager.addShouldRescale(this),this.#c(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),e&&this.select()}#o(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}#c(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.#a(this.#t,t)}}#l([t,e,n,s]){let{parentDimensions:[a,r],rotation:o}=this;switch(o){case 90:return[e,1-t,n*(r/a),s*(a/r)];case 180:return[1-t,1-e,n,s];case 270:return[1-e,t,n*(r/a),s*(a/r)];default:return[t,e,n,s]}}#d(){let{x:t,y:e,width:n,height:s,parentDimensions:[a,r],rotation:o}=this;switch(o){case 90:return[1-e,t,n*(a/r),s*(r/a)];case 180:return[1-t,1-e,n,s];case 270:return[e,1-t,n*(a/r),s*(r/a)];default:return[t,e,n,s]}}#h(t){[this.x,this.y,this.width,this.height]=this.#l(t),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}#p(){let{x:t,y:e,width:n,height:s,rotation:a,parentRotation:r,parentDimensions:[o,l]}=this;switch((a*4+r)/90){case 1:return[1-e-s,t,s,n];case 2:return[1-t-n,1-e-s,n,s];case 3:return[e,1-t-n,s,n];case 4:return[t,e-n*(o/l),s*(l/o),n*(o/l)];case 5:return[1-e,t,n*(o/l),s*(l/o)];case 6:return[1-t-s*(l/o),1-e,s*(l/o),n*(o/l)];case 7:return[e-n*(o/l),1-t-s*(l/o),n*(o/l),s*(l/o)];case 8:return[t-n,e-s,n,s];case 9:return[1-e,t-n,s,n];case 10:return[1-t,1-e,n,s];case 11:return[e-s,1-t,s,n];case 12:return[t-s*(l/o),e,s*(l/o),n*(o/l)];case 13:return[1-e-n*(o/l),t-s*(l/o),n*(o/l),s*(l/o)];case 14:return[1-t,1-e-n*(o/l),s*(l/o),n*(o/l)];case 15:return[e,1-t,n*(o/l),s*(l/o)];default:return[t,e,n,s]}}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,i._mergeSVGProperties({bbox:this.#p()},this.#t.updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&this.#h(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 n=super.render();n.classList.add("draw");let s=document.createElement("div");return n.append(s),s.setAttribute("aria-hidden","true"),s.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,e),n}static createDrawerInstance(t,e,n,s,a){Q("Not implemented")}static startDrawing(t,e,n,s){let{target:a,offsetX:r,offsetY:o,pointerId:l,pointerType:c}=s;if(Kt.isInitializedAndDifferentPointerType(c))return;let{viewport:{rotation:u}}=t,{width:h,height:d}=a.getBoundingClientRect(),f=i.#n=new AbortController,m=t.combinedSignal(f);if(Kt.setPointer(c,l),window.addEventListener("pointerup",y=>{Kt.isSamePointerIdOrRemove(y.pointerId)&&this._endDraw(y)},{signal:m}),window.addEventListener("pointercancel",y=>{Kt.isSamePointerIdOrRemove(y.pointerId)&&this._currentParent.endDrawingSession()},{signal:m}),window.addEventListener("pointerdown",y=>{Kt.isSamePointerType(y.pointerType)&&(Kt.initializeAndAddPointerId(y.pointerId),i.#i.isCancellable()&&(i.#i.removeLastElement(),i.#i.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:m}),window.addEventListener("contextmenu",Te,{signal:m}),a.addEventListener("pointermove",this._drawMove.bind(this),{signal:m}),a.addEventListener("touchmove",y=>{Kt.isSameTimeStamp(y.timeStamp)&&vt(y)},{signal:m}),t.toggleDrawing(),e._editorUndoBar?.hide(),i.#i){t.drawLayer.updateProperties(this._currentDrawId,i.#i.startNew(r,o,h,d,u));return}e.updateUIForDefaultProperties(this),i.#i=this.createDrawerInstance(r,o,h,d,u),i.#s=this.getDefaultDrawingOptions(),this._currentParent=t,{id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties(i.#s.toSVGProperties(),i.#i.defaultSVGProperties),!0,!1)}static _drawMove(t){if(Kt.isSameTimeStamp(t.timeStamp),!i.#i)return;let{offsetX:e,offsetY:n,pointerId:s}=t;if(Kt.isSamePointerId(s)){if(Kt.isUsingMultiplePointers()){this._endDraw(t);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,i.#i.add(e,n)),Kt.setTimeStamp(t.timeStamp),vt(t)}}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,i.#i=null,i.#s=null,Kt.clearTimeStamp()),i.#n&&(i.#n.abort(),i.#n=null,Kt.clearPointerIds())}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,i.#i.end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){let n=i.#i,s=this._currentDrawId,a=n.getLastElement();e.addCommands({cmd:()=>{e.drawLayer.updateProperties(s,n.setLastElement(a))},undo:()=>{e.drawLayer.updateProperties(s,n.removeLastElement())},mustExec:!1,type:H.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){let e=this._currentParent;if(!e)return null;if(e.toggleDrawing(!0),e.cleanUndoStack(H.DRAW_STEP),!i.#i.isEmpty()){let{pageDimensions:[n,s],scale:a}=e,r=e.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:i.#i.getOutlines(n*a,s*a,a,this._INNER_MARGIN),drawingOptions:i.#s,mustBeCommitted:!t});return this._cleanup(!0),r}return e.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,e,n,s,a,r){Q("Not implemented")}static async deserialize(t,e,n){let{rawDims:{pageWidth:s,pageHeight:a,pageX:r,pageY:o}}=e.viewport,l=this.deserializeDraw(r,o,s,a,this._INNER_MARGIN,t),c=await super.deserialize(t,e,n);return c.createDrawingOptions(t),c.#r({drawOutlines:l}),c.#c(),c.onScaleChanging(),c.rotate(),c}serializeDraw(t){let[e,n]=this.pageTranslation,[s,a]=this.pageDimensions;return this.#t.serialize([e,n,s,a],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}},Mf=class{#t=new Float64Array(6);#e;#i;#n;#s;#r;#a="";#o=0;#c=new zn;#l;#d;constructor(t,e,n,s,a,r){this.#l=n,this.#d=s,this.#n=a,this.#s=r,[t,e]=this.#h(t,e);let o=this.#e=[NaN,NaN,NaN,NaN,t,e];this.#r=[t,e],this.#i=[{line:o,points:this.#r}],this.#t.set(o,0)}updateProperty(t,e){t==="stroke-width"&&(this.#s=e)}#h(t,e){return O._normalizePoint(t,e,this.#l,this.#d,this.#n)}isEmpty(){return!this.#i?.length}isCancellable(){return this.#r.length<=10}add(t,e){[t,e]=this.#h(t,e);let[n,s,a,r]=this.#t.subarray(2,6),o=t-a,l=e-r;return Math.hypot(this.#l*o,this.#d*l)<=2?null:(this.#r.push(t,e),isNaN(n)?(this.#t.set([a,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([n,s,a,r,t,e],0),this.#e.push(...O.createBezierPoints(n,s,a,r,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){let n=this.add(t,e);return n||(this.#r.length===2?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,n,s,a){this.#l=n,this.#d=s,this.#n=a,[t,e]=this.#h(t,e);let r=this.#e=[NaN,NaN,NaN,NaN,t,e];this.#r=[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.#r}),this.#t.set(r,0),this.#o=0,this.toSVGPath(),null}getLastElement(){return this.#i.at(-1)}setLastElement(t){return this.#i?(this.#i.push(t),this.#e=t.line,this.#r=t.points,this.#o=0,{path:{d:this.toSVGPath()}}):this.#c.setLastElement(t)}removeLastElement(){if(!this.#i)return this.#c.removeLastElement();this.#i.pop(),this.#a="";for(let t=0,e=this.#i.length;t<e;t++){let{line:n,points:s}=this.#i[t];this.#e=n,this.#r=s,this.#o=0,this.toSVGPath()}return{path:{d:this.#a}}}toSVGPath(){let t=O.svgRound(this.#e[4]),e=O.svgRound(this.#e[5]);if(this.#r.length===2)return this.#a=`${this.#a} M ${t} ${e} Z`,this.#a;if(this.#r.length<=6){let s=this.#a.lastIndexOf("M");this.#a=`${this.#a.slice(0,s)} M ${t} ${e}`,this.#o=6}if(this.#r.length===4){let s=O.svgRound(this.#e[10]),a=O.svgRound(this.#e[11]);return this.#a=`${this.#a} L ${s} ${a}`,this.#o=12,this.#a}let n=[];this.#o===0&&(n.push(`M ${t} ${e}`),this.#o=6);for(let s=this.#o,a=this.#e.length;s<a;s+=6){let[r,o,l,c,u,h]=this.#e.slice(s,s+6).map(O.svgRound);n.push(`C${r} ${o} ${l} ${c} ${u} ${h}`)}return this.#a+=n.join(" "),this.#o=this.#e.length,this.#a}getOutlines(t,e,n,s){let a=this.#i.at(-1);return a.line=new Float32Array(a.line),a.points=new Float32Array(a.points),this.#c.build(this.#i,t,e,n,this.#n,this.#s,s),this.#t=null,this.#e=null,this.#i=null,this.#a=null,this.#c}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}},zn=class extends O{#t;#e=0;#i;#n;#s;#r;#a;#o;#c;build(t,e,n,s,a,r,o){this.#s=e,this.#r=n,this.#a=s,this.#o=a,this.#c=r,this.#i=o??0,this.#n=t,this.#h()}get thickness(){return this.#c}setLastElement(t){return this.#n.push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#n.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let t=[];for(let{line:e}of this.#n){if(t.push(`M${O.svgRound(e[4])} ${O.svgRound(e[5])}`),e.length===6){t.push("Z");continue}if(e.length===12&&isNaN(e[6])){t.push(`L${O.svgRound(e[10])} ${O.svgRound(e[11])}`);continue}for(let n=6,s=e.length;n<s;n+=6){let[a,r,o,l,c,u]=e.subarray(n,n+6).map(O.svgRound);t.push(`C${a} ${r} ${o} ${l} ${c} ${u}`)}}return t.join("")}serialize([t,e,n,s],a){let r=[],o=[],[l,c,u,h]=this.#d(),d,f,m,y,v,p,g,b,A;switch(this.#o){case 0:A=O._rescale,d=t,f=e+s,m=n,y=-s,v=t+l*n,p=e+(1-c-h)*s,g=t+(l+u)*n,b=e+(1-c)*s;break;case 90:A=O._rescaleAndSwap,d=t,f=e,m=n,y=s,v=t+c*n,p=e+l*s,g=t+(c+h)*n,b=e+(l+u)*s;break;case 180:A=O._rescale,d=t+n,f=e,m=-n,y=s,v=t+(1-l-u)*n,p=e+c*s,g=t+(1-l)*n,b=e+(c+h)*s;break;case 270:A=O._rescaleAndSwap,d=t+n,f=e+s,m=-n,y=-s,v=t+(1-c-h)*n,p=e+(1-l-u)*s,g=t+(1-c)*n,b=e+(1-l)*s;break}for(let{line:S,points:E}of this.#n)r.push(A(S,d,f,m,y,a?new Array(S.length):null)),o.push(A(E,d,f,m,y,a?new Array(E.length):null));return{lines:r,points:o,rect:[v,p,g,b]}}static deserialize(t,e,n,s,a,{paths:{lines:r,points:o},rotation:l,thickness:c}){let u=[],h,d,f,m,y;switch(l){case 0:y=O._rescale,h=-t/n,d=e/s+1,f=1/n,m=-1/s;break;case 90:y=O._rescaleAndSwap,h=-e/s,d=-t/n,f=1/s,m=1/n;break;case 180:y=O._rescale,h=t/n+1,d=-e/s,f=-1/n,m=1/s;break;case 270:y=O._rescaleAndSwap,h=e/s+1,d=t/n+1,f=-1/s,m=-1/n;break}if(!r){r=[];for(let p of o){let g=p.length;if(g===2){r.push(new Float32Array([NaN,NaN,NaN,NaN,p[0],p[1]]));continue}if(g===4){r.push(new Float32Array([NaN,NaN,NaN,NaN,p[0],p[1],NaN,NaN,NaN,NaN,p[2],p[3]]));continue}let b=new Float32Array(3*(g-2));r.push(b);let[A,S,E,T]=p.subarray(0,4);b.set([NaN,NaN,NaN,NaN,A,S],0);for(let w=4;w<g;w+=2){let _=p[w],C=p[w+1];b.set(O.createBezierPoints(A,S,E,T,_,C),(w-2)*3),[A,S,E,T]=[E,T,_,C]}}}for(let p=0,g=r.length;p<g;p++)u.push({line:y(r[p].map(b=>b??NaN),h,d,f,m),points:y(o[p].map(b=>b??NaN),h,d,f,m)});let v=new this.prototype.constructor;return v.build(u,n,s,1,l,c,a),v}#l(t=this.#c){let e=this.#i+t/2*this.#a;return this.#o%180===0?[e/this.#s,e/this.#r]:[e/this.#r,e/this.#s]}#d(){let[t,e,n,s]=this.#t,[a,r]=this.#l(0);return[t+a,e+r,n-2*a,s-2*r]}#h(){let t=this.#t=On.slice();for(let{line:s}of this.#n){if(s.length<=12){for(let o=4,l=s.length;o<l;o+=6)M.pointBoundingBox(s[o],s[o+1],t);continue}let a=s[4],r=s[5];for(let o=6,l=s.length;o<l;o+=6){let[c,u,h,d,f,m]=s.subarray(o,o+6);M.bezierBoundingBox(a,r,c,u,h,d,f,m,t),a=f,r=m}}let[e,n]=this.#l();t[0]=ht(t[0]-e,0,1),t[1]=ht(t[1]-n,0,1),t[2]=ht(t[2]+e,0,1),t[3]=ht(t[3]+n,0,1),t[2]-=t[0],t[3]-=t[1]}get box(){return this.#t}updateProperty(t,e){return t==="stroke-width"?this.#p(e):null}#p(t){let[e,n]=this.#l();this.#c=t;let[s,a]=this.#l(),[r,o]=[s-e,a-n],l=this.#t;return l[0]-=r,l[1]-=o,l[2]+=2*r,l[3]+=2*o,l}updateParentDimensions([t,e],n){let[s,a]=this.#l();this.#s=t,this.#r=e,this.#a=n;let[r,o]=this.#l(),l=r-s,c=o-a,u=this.#t;return u[0]-=l,u[1]-=c,u[2]+=2*l,u[3]+=2*c,u}updateRotation(t){return this.#e=t,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#t.map(O.svgRound).join(" ")}get defaultProperties(){let[t,e]=this.#t;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${O.svgRound(t)} ${O.svgRound(e)}`}}}get rotationTransform(){let[,,t,e]=this.#t,n=0,s=0,a=0,r=0,o=0,l=0;switch(this.#e){case 90:s=e/t,a=-t/e,o=t;break;case 180:n=-1,r=-1,o=t,l=e;break;case 270:s=-e/t,a=t/e,l=e;break;default:return""}return`matrix(${n} ${s} ${a} ${r} ${O.svgRound(o)} ${O.svgRound(l)})`}getPathResizingSVGProperties([t,e,n,s]){let[a,r]=this.#l(),[o,l,c,u]=this.#t;if(Math.abs(c-a)<=O.PRECISION||Math.abs(u-r)<=O.PRECISION){let y=t+n/2-(o+c/2),v=e+s/2-(l+u/2);return{path:{"transform-origin":`${O.svgRound(t)} ${O.svgRound(e)}`,transform:`${this.rotationTransform} translate(${y} ${v})`}}}let h=(n-2*a)/(c-2*a),d=(s-2*r)/(u-2*r),f=c/n,m=u/s;return{path:{"transform-origin":`${O.svgRound(o)} ${O.svgRound(l)}`,transform:`${this.rotationTransform} scale(${f} ${m}) translate(${O.svgRound(a)} ${O.svgRound(r)}) scale(${h} ${d}) translate(${O.svgRound(-a)} ${O.svgRound(-r)})`}}}getPathResizedSVGProperties([t,e,n,s]){let[a,r]=this.#l(),o=this.#t,[l,c,u,h]=o;if(o[0]=t,o[1]=e,o[2]=n,o[3]=s,Math.abs(u-a)<=O.PRECISION||Math.abs(h-r)<=O.PRECISION){let v=t+n/2-(l+u/2),p=e+s/2-(c+h/2);for(let{line:g,points:b}of this.#n)O._translate(g,v,p,g),O._translate(b,v,p,b);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${O.svgRound(t)} ${O.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let d=(n-2*a)/(u-2*a),f=(s-2*r)/(h-2*r),m=-d*(l+a)+t+a,y=-f*(c+r)+e+r;if(d!==1||f!==1||m!==0||y!==0)for(let{line:v,points:p}of this.#n)O._rescale(v,m,y,d,f,v),O._rescale(p,m,y,d,f,p);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${O.svgRound(t)} ${O.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([t,e],n){let[s,a]=n,r=this.#t,o=t-r[0],l=e-r[1];if(this.#s===s&&this.#r===a)for(let{line:c,points:u}of this.#n)O._translate(c,o,l,c),O._translate(u,o,l,u);else{let c=this.#s/s,u=this.#r/a;this.#s=s,this.#r=a;for(let{line:h,points:d}of this.#n)O._rescale(h,o,l,c,u,h),O._rescale(d,o,l,c,u,d);r[2]*=c,r[3]*=u}return r[0]=t,r[1]=e,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${O.svgRound(t)} ${O.svgRound(e)}`}}}get defaultSVGProperties(){let t=this.#t;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${O.svgRound(t[0])} ${O.svgRound(t[1])}`,transform:this.rotationTransform||null},bbox:t}}},jl=class i extends Ul{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 i(this._viewParameters);return t.updateAll(this),t}},Df=class i extends Gl{static _type="ink";static _editorType=P.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 jl(e.viewParameters)}static getDefaultDrawingOptions(t){let e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!0}static get typesMap(){return L(this,"typesMap",new Map([[H.INK_THICKNESS,"stroke-width"],[H.INK_COLOR,"stroke"],[H.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,e,n,s,a){return new Mf(t,e,n,s,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,e,n,s,a,r){return zn.deserialize(t,e,n,s,a,r)}static async deserialize(t,e,n){let s=null;if(t instanceof Tr){let{data:{inkLists:r,rect:o,rotation:l,id:c,color:u,opacity:h,borderStyle:{rawWidth:d},popupRef:f,richText:m,contentsObj:y,creationDate:v,modificationDate:p},parent:{page:{pageNumber:g}}}=t;s=t={annotationType:P.INK,color:Array.from(u),thickness:d,opacity:h,paths:{points:r},boxes:null,pageIndex:g-1,rect:o.slice(0),rotation:l,annotationElementId:c,id:c,deleted:!1,popupRef:f,richText:m,comment:y?.str||null,creationDate:v,modificationDate:p}}let a=await super.deserialize(t,e,n);return a._initialData=s,t.comment&&a.setCommentData(t),a}get toolbarButtons(){return this._colorPicker||=new Ol(this),[["colorPicker",this._colorPicker]]}get colorType(){return H.INK_COLOR}get colorAndOpacityType(){return H.INK_COLOR_AND_OPACITY}get opacityType(){return H.INK_OPACITY}updateParams(t,e){if(t===H.INK_COLOR_AND_OPACITY){this._updateColorAndOpacity(e.color,e.opacity);return}super.updateParams(t,e)}static updateDefaultParams(t,e){if(t===H.INK_COLOR_AND_OPACITY){super.updateDefaultParams(H.INK_COLOR,e.color),super.updateDefaultParams(H.INK_OPACITY,e.opacity);return}super.updateDefaultParams(t,e)}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:n}=this;e.updateSVGProperty("stroke-width"),n.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:n}){this._drawingOptions=i.getDefaultDrawingOptions({stroke:M.makeHexColor(...t),"stroke-width":e,"stroke-opacity":n})}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:e,points:n}=this.serializeDraw(t),{_drawingOptions:{stroke:s,"stroke-opacity":a,"stroke-width":r}}=this,o=Object.assign(super.serialize(t),{color:tt._colorManager.convert(s),opacity:a,thickness:r,paths:{lines:e,points:n}});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:n,opacity:s,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||t.color.some((r,o)=>r!==e[o])||t.thickness!==n||t.opacity!==s||t.pageIndex!==a}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let{points:e,rect:n}=this.serializeDraw(!1);return t.updateEdited({rect:n,thickness:this._drawingOptions["stroke-width"],points:e,popup:this.comment}),null}},xr=class extends zn{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}},pl=8,nr=3,Ei=class{static#t={maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16};static#e(t,e,n,s){return n-=t,s-=e,n===0?s>0?0:4:n===1?s+6:2-s}static#i=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#n(t,e,n,s,a,r,o){let l=this.#e(n,s,a,r);for(let c=0;c<8;c++){let u=(-c+l-o+16)%8,h=this.#i[2*u],d=this.#i[2*u+1];if(t[(n+h)*e+(s+d)]!==0)return u}return-1}static#s(t,e,n,s,a,r,o){let l=this.#e(n,s,a,r);for(let c=0;c<8;c++){let u=(c+l+o+16)%8,h=this.#i[2*u],d=this.#i[2*u+1];if(t[(n+h)*e+(s+d)]!==0)return u}return-1}static#r(t,e,n,s){let a=t.length,r=new Int32Array(a);for(let u=0;u<a;u++)r[u]=t[u]<=s?1:0;for(let u=1;u<n-1;u++)r[u*e]=r[u*e+e-1]=0;for(let u=0;u<e;u++)r[u]=r[e*n-1-u]=0;let o=1,l,c=[];for(let u=1;u<n-1;u++){l=1;for(let h=1;h<e-1;h++){let d=u*e+h,f=r[d];if(f===0)continue;let m=u,y=h;if(f===1&&r[d-1]===0)o+=1,y-=1;else if(f>=1&&r[d+1]===0)o+=1,y+=1,f>1&&(l=f);else{f!==1&&(l=Math.abs(f));continue}let v=[h,u],p=y===h+1,g={isHole:p,points:v,id:o,parent:0};c.push(g);let b;for(let D of c)if(D.id===l){b=D;break}b?b.isHole?g.parent=p?b.parent:l:g.parent=p?l:b.parent:g.parent=p?l:0;let A=this.#n(r,e,u,h,m,y,0);if(A===-1){r[d]=-o,r[d]!==1&&(l=Math.abs(r[d]));continue}let S=this.#i[2*A],E=this.#i[2*A+1],T=u+S,w=h+E;m=T,y=w;let _=u,C=h;for(;;){let D=this.#s(r,e,_,C,m,y,1);S=this.#i[2*D],E=this.#i[2*D+1];let N=_+S,z=C+E;v.push(z,N);let X=_*e+C;if(r[X+1]===0?r[X]=-o:r[X]===1&&(r[X]=o),N===u&&z===h&&_===T&&C===w){r[d]!==1&&(l=Math.abs(r[d]));break}else m=_,y=C,_=N,C=z}}}return c}static#a(t,e,n,s){if(n-e<=4){for(let T=e;T<n-2;T+=2)s.push(t[T],t[T+1]);return}let a=t[e],r=t[e+1],o=t[n-4]-a,l=t[n-3]-r,c=Math.hypot(o,l),u=o/c,h=l/c,d=u*r-h*a,f=l/o,m=1/c,y=Math.atan(f),v=Math.cos(y),p=Math.sin(y),g=m*(Math.abs(v)+Math.abs(p)),b=m*(1-g+g**2),A=Math.max(Math.atan(Math.abs(p+v)*b),Math.atan(Math.abs(p-v)*b)),S=0,E=e;for(let T=e+2;T<n-2;T+=2){let w=Math.abs(d-u*t[T+1]+h*t[T]);w>S&&(E=T,S=w)}S>(c*A)**2?(this.#a(t,e,E+2,s),this.#a(t,E,n,s)):s.push(a,r)}static#o(t){let e=[],n=t.length;return this.#a(t,0,n,e),e.push(t[n-2],t[n-1]),e.length<=4?null:e}static#c(t,e,n,s,a,r){let o=new Float32Array(r**2),l=-2*s**2,c=r>>1;for(let y=0;y<r;y++){let v=(y-c)**2;for(let p=0;p<r;p++)o[y*r+p]=Math.exp((v+(p-c)**2)/l)}let u=new Float32Array(256),h=-2*a**2;for(let y=0;y<256;y++)u[y]=Math.exp(y**2/h);let d=t.length,f=new Uint8Array(d),m=new Uint32Array(256);for(let y=0;y<n;y++)for(let v=0;v<e;v++){let p=y*e+v,g=t[p],b=0,A=0;for(let E=0;E<r;E++){let T=y+E-c;if(!(T<0||T>=n))for(let w=0;w<r;w++){let _=v+w-c;if(_<0||_>=e)continue;let C=t[T*e+_],D=o[E*r+w]*u[Math.abs(C-g)];b+=C*D,A+=D}}let S=f[p]=Math.round(b/A);m[S]++}return[f,m]}static#l(t){let e=new Uint32Array(256);for(let n of t)e[n]++;return e}static#d(t){let e=t.length,n=new Uint8ClampedArray(e>>2),s=-1/0,a=1/0;for(let o=0,l=n.length;o<l;o++){let c=n[o]=t[o<<2];s=Math.max(s,c),a=Math.min(a,c)}let r=255/(s-a);for(let o=0,l=n.length;o<l;o++)n[o]=(n[o]-a)*r;return n}static#h(t){let e,n=-1/0,s=-1/0,a=t.findIndex(l=>l!==0),r=a,o=a;for(e=a;e<256;e++){let l=t[e];l>n&&(e-r>s&&(s=e-r,o=e-1),n=l,r=e)}for(e=o-1;e>=0&&!(t[e]>t[e+1]);e--);return e}static#p(t){let e=t,{width:n,height:s}=t,{maxDim:a}=this.#t,r=n,o=s;if(n>a||s>a){let d=n,f=s,m=Math.log2(Math.max(n,s)/a),y=Math.floor(m);m=m===y?y-1:y;for(let p=0;p<m;p++){r=Math.ceil(d/2),o=Math.ceil(f/2);let g=new OffscreenCanvas(r,o);g.getContext("2d").drawImage(t,0,0,d,f,0,0,r,o),d=r,f=o,t!==e&&t.close(),t=g.transferToImageBitmap()}let v=Math.min(a/r,a/o);r=Math.round(r*v),o=Math.round(o*v)}let c=new OffscreenCanvas(r,o).getContext("2d",{willReadFrequently:!0});c.fillStyle="white",c.fillRect(0,0,r,o),c.filter="grayscale(1)",c.drawImage(t,0,0,t.width,t.height,0,0,r,o);let u=c.getImageData(0,0,r,o).data;return[this.#d(u),r,o]}static extractContoursFromText(t,{fontFamily:e,fontStyle:n,fontWeight:s},a,r,o,l){let c=new OffscreenCanvas(1,1),u=c.getContext("2d",{alpha:!1}),h=200,d=u.font=`${n} ${s} ${h}px ${e}`,{actualBoundingBoxLeft:f,actualBoundingBoxRight:m,actualBoundingBoxAscent:y,actualBoundingBoxDescent:v,fontBoundingBoxAscent:p,fontBoundingBoxDescent:g,width:b}=u.measureText(t),A=1.5,S=Math.ceil(Math.max(Math.abs(f)+Math.abs(m)||0,b)*A),E=Math.ceil(Math.max(Math.abs(y)+Math.abs(v)||h,Math.abs(p)+Math.abs(g)||h)*A);c=new OffscreenCanvas(S,E),u=c.getContext("2d",{alpha:!0,willReadFrequently:!0}),u.font=d,u.filter="grayscale(1)",u.fillStyle="white",u.fillRect(0,0,S,E),u.fillStyle="black",u.fillText(t,S*(A-1)/2,E*(3-A)/2);let T=this.#d(u.getImageData(0,0,S,E).data),w=this.#l(T),_=this.#h(w),C=this.#r(T,S,E,_);return this.processDrawnLines({lines:{curves:C,width:S,height:E},pageWidth:a,pageHeight:r,rotation:o,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(t,e,n,s,a){let[r,o,l]=this.#p(t),[c,u]=this.#c(r,o,l,Math.hypot(o,l)*this.#t.sigmaSFactor,this.#t.sigmaR,this.#t.kernelSize),h=this.#h(u),d=this.#r(c,o,l,h);return this.processDrawnLines({lines:{curves:d,width:o,height:l},pageWidth:e,pageHeight:n,rotation:s,innerMargin:a,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:e,pageHeight:n,rotation:s,innerMargin:a,mustSmooth:r,areContours:o}){s%180!==0&&([e,n]=[n,e]);let{curves:l,width:c,height:u}=t,h=t.thickness??0,d=[],f=Math.min(e/c,n/u),m=f/e,y=f/n,v=[];for(let{points:g}of l){let b=r?this.#o(g):g;if(!b)continue;v.push(b);let A=b.length,S=new Float32Array(A),E=new Float32Array(3*(A===2?2:A-2));if(d.push({line:E,points:S}),A===2){S[0]=b[0]*m,S[1]=b[1]*y,E.set([NaN,NaN,NaN,NaN,S[0],S[1]],0);continue}let[T,w,_,C]=b;T*=m,w*=y,_*=m,C*=y,S.set([T,w,_,C],0),E.set([NaN,NaN,NaN,NaN,T,w],0);for(let D=4;D<A;D+=2){let N=S[D]=b[D]*m,z=S[D+1]=b[D+1]*y;E.set(O.createBezierPoints(T,w,_,C,N,z),(D-2)*3),[T,w,_,C]=[_,C,N,z]}}if(d.length===0)return null;let p=o?new xr:new zn;return p.build(d,e,n,1,s,o?0:h,a),{outline:p,newCurves:v,areContours:o,thickness:h,width:c,height:u}}static async compressSignature({outlines:t,areContours:e,thickness:n,width:s,height:a}){let r=1/0,o=-1/0,l=0;for(let g of t){l+=g.length;for(let b=2,A=g.length;b<A;b++){let S=g[b]-g[b-2];r=Math.min(r,S),o=Math.max(o,S)}}let c;r>=-128&&o<=127?c=Int8Array:r>=-32768&&o<=32767?c=Int16Array:c=Int32Array;let u=t.length,h=pl+nr*u,d=new Uint32Array(h),f=0;d[f++]=h*Uint32Array.BYTES_PER_ELEMENT+(l-2*u)*c.BYTES_PER_ELEMENT,d[f++]=0,d[f++]=s,d[f++]=a,d[f++]=e?0:1,d[f++]=Math.max(0,Math.floor(n??0)),d[f++]=u,d[f++]=c.BYTES_PER_ELEMENT;for(let g of t)d[f++]=g.length-2,d[f++]=g[0],d[f++]=g[1];let m=new CompressionStream("deflate-raw"),y=m.writable.getWriter();await y.ready,y.write(d);let v=c.prototype.constructor;for(let g of t){let b=new v(g.length-2);for(let A=2,S=g.length;A<S;A++)b[A-2]=g[A]-g[A-2];y.write(b)}return y.close(),(await new Response(m.readable).bytes()).toBase64()}static async decompressSignature(t){try{let e=Uint8Array.fromBase64(t),{readable:n,writable:s}=new DecompressionStream("deflate-raw"),a=s.getWriter();await a.ready,a.write(e).then(async()=>{await a.ready,await a.close()}).catch(()=>{});let r=null,o=0;for await(let b of n)r||=new Uint8Array(new Uint32Array(b.buffer,0,4)[0]),r.set(b,o),o+=b.length;let l=new Uint32Array(r.buffer,0,r.length>>2),c=l[1];if(c!==0)throw new Error(`Invalid version: ${c}`);let u=l[2],h=l[3],d=l[4]===0,f=l[5],m=l[6],y=l[7],v=[],p=(pl+nr*m)*Uint32Array.BYTES_PER_ELEMENT,g;switch(y){case Int8Array.BYTES_PER_ELEMENT:g=new Int8Array(r.buffer,p);break;case Int16Array.BYTES_PER_ELEMENT:g=new Int16Array(r.buffer,p);break;case Int32Array.BYTES_PER_ELEMENT:g=new Int32Array(r.buffer,p);break}o=0;for(let b=0;b<m;b++){let A=l[nr*b+pl],S=new Float32Array(A+2);v.push(S);for(let E=0;E<nr-1;E++)S[E]=l[nr*b+pl+E+1];for(let E=0;E<A;E++)S[E+2]=S[E]+g[o++]}return{areContours:d,thickness:f,outlines:v,width:u,height:h}}catch(e){return I(`decompressSignature: ${e}`),null}}},Of=class i extends Ul{constructor(){super(),super.updateProperties({fill:tt._defaultLineColor,"stroke-width":0})}clone(){let t=new i;return t.updateAll(this),t}},Rf=class i extends jl{constructor(t){super(t),super.updateProperties({stroke:tt._defaultLineColor,"stroke-width":1})}clone(){let t=new i(this._viewParameters);return t.updateAll(this),t}},Nf=class i extends Gl{#t=!1;#e=null;#i=null;#n=null;static _type="signature";static _editorType=P.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 Of,this._defaultDrawnSignatureOptions=new Rf(e.viewParameters)}static getDefaultDrawingOptions(t){let e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!1}static get typesMap(){return L(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:n}=this;if(n&&(this._isCopy=!1,t=this.x,e=this.y),super.render(),this._drawId===null)if(this.#i){let{lines:s,mustSmooth:a,areContours:r,description:o,uuid:l,heightInPage:c}=this.#i,{rawDims:{pageWidth:u,pageHeight:h},rotation:d}=this.parent.viewport,f=Ei.processDrawnLines({lines:s,pageWidth:u,pageHeight:h,rotation:d,innerMargin:i._INNER_MARGIN,mustSmooth:a,areContours:r});this.addSignature(f,c,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 n&&(this._isCopy=!0,this._moveAfterPaste(t,e)),this.div}setUuid(t){this.#n=t,this.addEditToolbar()}getUuid(){return this.#n}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:n,width:s,height:a}=this.#i,r=Math.max(s,a),o=Ei.processDrawnLines({lines:{curves:t.map(l=>({points:l})),thickness:n,width:s,height:a},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,n,s){let{x:a,y:r}=this,{outline:o}=this.#i=t;this.#t=o instanceof xr,this.description=n;let l;this.#t?l=i.getDefaultDrawingOptions():(l=i._defaultDrawnSignatureOptions.clone(),l.updateProperties({"stroke-width":o.thickness})),this._addOutlines({drawOutlines:o,drawingOptions:l});let[,c]=this.pageDimensions,u=e/c;u=u>=1?.5:u,this.width*=u/this.height,this.width>=1&&(u*=.9/this.width,this.width=.9),this.height=u,this.setDims(),this.x=a,this.y=r,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(s),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!s,hasDescription:!!n}}),this.div.hidden=!1}getFromImage(t){let{rawDims:{pageWidth:e,pageHeight:n},rotation:s}=this.parent.viewport;return Ei.process(t,e,n,s,i._INNER_MARGIN)}getFromText(t,e){let{rawDims:{pageWidth:n,pageHeight:s},rotation:a}=this.parent.viewport;return Ei.extractContoursFromText(t,e,n,s,a,i._INNER_MARGIN)}getDrawnSignature(t){let{rawDims:{pageWidth:e,pageHeight:n},rotation:s}=this.parent.viewport;return Ei.processDrawnLines({lines:t,pageWidth:e,pageHeight:n,rotation:s,innerMargin:i._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:e}){t?this._drawingOptions=i.getDefaultDrawingOptions():(this._drawingOptions=i._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":e}))}serialize(t=!1){if(this.isEmpty())return null;let{lines:e,points:n}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":s}}=this,a=Object.assign(super.serialize(t),{isSignature:!0,areContours:this.#t,color:[0,0,0],thickness:this.#t?0:s});return this.addComment(a),t?(a.paths={lines:e,points:n},a.uuid=this.#n,a.isCopy=!0):a.lines=e,this.#e&&(a.accessibilityData={type:"Figure",alt:this.#e}),a}static deserializeDraw(t,e,n,s,a,r){return r.areContours?xr.deserialize(t,e,n,s,a,r):zn.deserialize(t,e,n,s,a,r)}static async deserialize(t,e,n){let s=await super.deserialize(t,e,n);return s.#t=t.areContours,s.description=t.accessibilityData?.alt||"",s.#n=t.uuid,s}},kf=class extends tt{#t=null;#e=null;#i=null;#n=null;#s=null;#r="";#a=null;#o=!1;#c=null;#l=!1;#d=!1;static _type="stamp";static _editorType=P.STAMP;constructor(t){super({...t,name:"stampEditor"}),this.#n=t.bitmapUrl,this.#s=t.bitmapFile,this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,e){tt.initialize(t,e)}static isHandlingMimeForPasting(t){return Al.includes(t)}static paste(t,e){e.pasteEditor({mode:P.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}}#h(t,e=!1){if(!t){this.remove();return}this.#t=t.bitmap,e||(this.#e=t.id,this.#l=t.isSvg),t.file&&(this.#r=t.file.name),this.#g()}#p(){if(this.#i=null,this._uiManager.enableWaiting(!1),!!this.#a){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:n}=this._uiManager;if(!n)throw new Error("No ML.");if(!await n.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");let{data:s,width:a,height:r}=t||this.copyCanvas(null,null,!0).imageData,o=await n.guess({name:"altText",request:{data:s,width:a,height:r,channels:s.length/(a*r)}});if(!o)throw new Error("No response from the AI service.");if(o.error)throw new Error("Error from the AI service.");if(o.cancel)return null;if(!o.output)throw new Error("No valid response from the AI service.");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(n=>this.#h(n,!0)).finally(()=>this.#p());return}if(this.#n){let n=this.#n;this.#n=null,this._uiManager.enableWaiting(!0),this.#i=this._uiManager.imageManager.getFromUrl(n).then(s=>this.#h(s)).finally(()=>this.#p());return}if(this.#s){let n=this.#s;this.#s=null,this._uiManager.enableWaiting(!0),this.#i=this._uiManager.imageManager.getFromFile(n).then(s=>this.#h(s)).finally(()=>this.#p());return}let t=document.createElement("input");t.type="file",t.accept=Al.join(",");let e=this._uiManager._signal;this.#i=new Promise(n=>{t.addEventListener("change",async()=>{if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let s=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#h(s)}n()},{signal:e}),t.addEventListener("cancel",()=>{this.remove(),n()},{signal:e})}).finally(()=>this.#p()),t.click()}remove(){this.#e&&(this.#t=null,this._uiManager.imageManager.deleteId(this.#e),this.#a?.remove(),this.#a=null,this.#c&&(clearTimeout(this.#c),this.#c=null)),super.remove()}rebuild(){if(!this.parent){this.#e&&this.#m();return}super.rebuild(),this.div!==null&&(this.#e&&this.#a===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.#n||this.#s||this.#e||this.#o)}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.#o||(this.#t?this.#g():this.#m()),this._isCopy&&this._moveAfterPaste(t,e),this._uiManager.addShouldRescale(this),this.div}setCanvas(t,e){let{id:n,bitmap:s}=this._uiManager.imageManager.getFromCanvas(t,e);e.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(this.#e=n,s&&(this.#t=s),this.#o=!1,this.#g())}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;this.#c!==null&&clearTimeout(this.#c);let t=200;this.#c=setTimeout(()=>{this.#c=null,this.#f()},t)}#g(){let{div:t}=this,{width:e,height:n}=this.#t,[s,a]=this.pageDimensions,r=.75;if(this.width)e=this.width*s,n=this.height*a;else if(e>r*s||n>r*a){let l=Math.min(r*s/e,r*a/n);e*=l,n*=l}this._uiManager.enableWaiting(!1);let o=this.#a=document.createElement("canvas");o.setAttribute("role","img"),this.addContainer(o),this.width=e/s,this.height=n/a,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(t.hidden=!1),this.#f(),this.#d||(this.parent.addUndoableEditor(this),this.#d=!0),this._reportTelemetry({action:"inserted_image"}),this.#r&&this.div.setAttribute("aria-description",this.#r),this.annotationElementId||this._uiManager.a11yAlert(tt._l10nAlert.stamp)}copyCanvas(t,e,n=!1){t||=224;let{width:s,height:a}=this.#t,r=new Je,o=this.#t,l=s,c=a,u=null;if(e){if(s>e||a>e){let E=Math.min(e/s,e/a);l=Math.floor(s*E),c=Math.floor(a*E)}u=document.createElement("canvas");let d=u.width=Math.ceil(l*r.sx),f=u.height=Math.ceil(c*r.sy);this.#l||(o=this.#u(d,f));let m=u.getContext("2d");m.filter=this._uiManager.hcmFilter;let y="white",v="#cfcfd8";this._uiManager.hcmFilter!=="none"?v="black":nd.isDarkMode&&(y="#8f8f9d",v="#42414d");let p=15,g=p*r.sx,b=p*r.sy,A=new OffscreenCanvas(g*2,b*2),S=A.getContext("2d");S.fillStyle=y,S.fillRect(0,0,g*2,b*2),S.fillStyle=v,S.fillRect(0,0,g,b),S.fillRect(g,b,g,b),m.fillStyle=m.createPattern(A,"repeat"),m.fillRect(0,0,d,f),m.drawImage(o,0,0,o.width,o.height,0,0,d,f)}let h=null;if(n){let d,f;if(r.symmetric&&o.width<t&&o.height<t)d=o.width,f=o.height;else if(o=this.#t,s>t||a>t){let v=Math.min(t/s,t/a);d=Math.floor(s*v),f=Math.floor(a*v),this.#l||(o=this.#u(d,f))}let y=new OffscreenCanvas(d,f).getContext("2d",{willReadFrequently:!0});y.drawImage(o,0,0,o.width,o.height,0,0,d,f),h={width:d,height:f,data:y.getImageData(0,0,d,f).data}}return{canvas:u,width:l,height:c,imageData:h}}#u(t,e){let{width:n,height:s}=this.#t,a=n,r=s,o=this.#t;for(;a>2*t||r>2*e;){let l=a,c=r;a>2*t&&(a=Math.ceil(a/2)),r>2*e&&(r=Math.ceil(r/2));let u=new OffscreenCanvas(a,r);u.getContext("2d").drawImage(o,0,0,l,c,0,0,a,r),o=u.transferToImageBitmap()}return o}#f(){let[t,e]=this.parentDimensions,{width:n,height:s}=this,a=new Je,r=Math.ceil(n*t*a.sx),o=Math.ceil(s*e*a.sy),l=this.#a;if(!l||l.width===r&&l.height===o)return;l.width=r,l.height=o;let c=this.#l?this.#t:this.#u(r,o),u=l.getContext("2d");u.filter=this._uiManager.hcmFilter,u.drawImage(c,0,0,c.width,c.height,0,0,r,o)}#b(t){if(t){if(this.#l){let s=this._uiManager.imageManager.getSvgUrl(this.#e);if(s)return s}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,n]=this.pageDimensions,s=Math.round(this.width*e*wi.PDF_TO_CSS_UNITS),a=Math.round(this.height*n*wi.PDF_TO_CSS_UNITS),r=new OffscreenCanvas(s,a);return r.getContext("2d").drawImage(this.#t,0,0,this.#t.width,this.#t.height,0,0,s,a),r.transferToImageBitmap()}return structuredClone(this.#t)}static async deserialize(t,e,n){let s=null,a=!1;if(t instanceof Bl){let{data:{rect:y,rotation:v,id:p,structParent:g,popupRef:b,richText:A,contentsObj:S,creationDate:E,modificationDate:T},container:w,parent:{page:{pageNumber:_}},canvas:C}=t,D,N;C?(delete t.canvas,{id:D,bitmap:N}=n.imageManager.getFromCanvas(w.id,C),C.remove()):(a=!0,t._hasNoCanvas=!0);let z=(await e._structTree.getAriaAttributes(`${Ls}${p}`))?.get("aria-label")||"";s=t={annotationType:P.STAMP,bitmapId:D,bitmap:N,pageIndex:_-1,rect:y.slice(0),rotation:v,annotationElementId:p,id:p,deleted:!1,accessibilityData:{decorative:!1,altText:z},isSvg:!1,structParent:g,popupRef:b,richText:A,comment:S?.str||null,creationDate:E,modificationDate:T}}let r=await super.deserialize(t,e,n),{rect:o,bitmap:l,bitmapUrl:c,bitmapId:u,isSvg:h,accessibilityData:d}=t;a?(n.addMissingCanvas(t.id,r),r.#o=!0):u&&n.imageManager.isValidId(u)?(r.#e=u,l&&(r.#t=l)):r.#n=c,r.#l=h;let[f,m]=r.pageDimensions;return r.width=(o[2]-o[0])/f,r.height=(o[3]-o[1])/m,d&&(r.altTextData=d),r._initialData=s,t.comment&&r.setCommentData(t),r.#d=!!s,r}serialize(t=!1,e=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let n=Object.assign(super.serialize(t),{bitmapId:this.#e,isSvg:this.#l});if(this.addComment(n),t)return n.bitmapUrl=this.#b(!0),n.accessibilityData=this.serializeAltText(!0),n.isCopy=!0,n;let{decorative:s,altText:a}=this.serializeAltText(!1);if(!s&&a&&(n.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){let o=this.#v(n);return o.isSame?null:(o.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1,n.id=this.annotationElementId,delete n.bitmapId,n)}if(e===null)return n;e.stamps||=new Map;let r=this.#l?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!e.stamps.has(this.#e))e.stamps.set(this.#e,{area:r,serialized:n}),n.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 n}#v(t){let{pageIndex:e,accessibilityData:{altText:n}}=this._initialData,s=t.pageIndex===e,a=(t.accessibilityData?.alt||"")===n;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&s&&a,isSameAltText:a}}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}},Vl=class i{#t;#e=!1;#i=null;#n=null;#s=null;#r=new Map;#a=!1;#o=!1;#c=!1;#l=null;#d=null;#h=null;#p=null;#m=null;#g=-1;#u;static _initialized=!1;static#f=new Map([_f,Df,kf,Hl,Nf].map(t=>[t._editorType,t]));constructor({uiManager:t,pageIndex:e,div:n,structTreeLayer:s,accessibilityManager:a,annotationLayer:r,drawLayer:o,textLayer:l,viewport:c,l10n:u}){let h=[...i.#f.values()];if(!i._initialized){i._initialized=!0;for(let d of h)d.initialize(u,t)}t.registerEditorTypes(h),this.#u=t,this.pageIndex=e,this.div=n,this.#t=a,this.#i=r,this.viewport=c,this.#h=l,this.drawLayer=o,this._structTree=s,this.#u.addLayer(this)}get isEmpty(){return this.#r.size===0}get isInvisible(){return this.isEmpty&&this.#u.getMode()===P.NONE}updateToolbar(t){this.#u.updateToolbar(t)}updateMode(t=this.#u.getMode()){switch(this.#A(),t){case P.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case P.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case P.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===P.POPUP)e.toggle("commentEditing",!0);else{e.toggle("commentEditing",!1);for(let n of i.#f.values())e.toggle(`${n._type}Editing`,t===n._editorType)}this.div.hidden=!1}hasTextLayer(t){return t===this.#h?.div}setEditingState(t){this.#u.setEditingState(t)}addCommands(t){this.#u.addCommands(t)}cleanUndoStack(t){this.#u.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?.togglePointerEvents(t)}get#b(){return this.#r.size!==0?this.#r.values():this.#u.getEditors(this.pageIndex)}async enable(){this.#c=!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 n of this.#b)n.enableEditing(),n.show(!0),n.annotationElementId&&(this.#u.removeChangedExistingAnnotation(n),t.add(n.annotationElementId));let e=this.#i;if(e)for(let n of e.getEditableAnnotations()){if(n.hide(),this.#u.isDeletedAnnotationElement(n.data.id)||t.has(n.data.id))continue;let s=await this.deserialize(n);s&&(this.addOrRebuild(s),s.enableEditing())}this.#c=!1,this.#u._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#o=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),this.#h&&!this.#m){this.#m=new AbortController;let s=this.#u.combinedSignal(this.#m);this.#h.div.addEventListener("pointerdown",a=>{let{clientX:o,clientY:l,timeStamp:c}=a,u=this.#g;if(c-u>500){this.#g=c;return}this.#g=-1;let{classList:h}=this.div;h.toggle("getElements",!0);let d=document.elementsFromPoint(o,l);if(h.toggle("getElements",!1),!this.div.contains(d[0]))return;let f,m=new RegExp(`^${cr}[0-9]+$`);for(let v of d)if(m.test(v.id)){f=v.id;break}if(!f)return;let y=this.#r.get(f);y?.annotationElementId===null&&(vt(a),y.dblclick(a))},{signal:s,capture:!0})}let t=this.#i,e=[];if(t){let s=new Map,a=new Map;for(let r of this.#b){if(r.disableEditing(),!r.annotationElementId){e.push(r);continue}if(r.serialize()!==null){s.set(r.annotationElementId,r);continue}else a.set(r.annotationElementId,r);this.getEditableAnnotation(r.annotationElementId)?.show(),r.remove()}for(let r of t.getEditableAnnotations()){let{id:o}=r.data;if(this.#u.isDeletedAnnotationElement(o)){r.updateEdited({deleted:!0});continue}let l=a.get(o);if(l){l.resetAnnotationElement(r),l.show(!1),r.show();continue}l=s.get(o),l&&(this.#u.addChangedExistingAnnotation(l),l.renderAnnotationElement(r)&&l.show(!1)),r.show()}}this.#A(),this.isEmpty&&(this.div.hidden=!0);let{classList:n}=this.div;for(let s of i.#f.values())n.remove(`${s._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(e),this.#o=!1}getEditableAnnotation(t){return this.#i?.getEditableAnnotation(t)||null}setActiveEditor(t){this.#u.getActive()!==t&&this.#u.setActiveEditor(t)}enableTextSelection(){if(this.div.tabIndex=-1,this.#h?.div&&!this.#p){this.#p=new AbortController;let t=this.#u.combinedSignal(this.#p);this.#h.div.addEventListener("pointerdown",this.#v.bind(this),{signal:t}),this.#h.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#h?.div&&this.#p&&(this.#p.abort(),this.#p=null,this.#h.div.classList.remove("highlighting"))}#v(t){this.#u.unselectAll();let{target:e}=t;if(e===this.#h.div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent")||e.classList.contains("textLayerImages")||e.classList.contains("textLayerImagePlaceholder"))&&this.#h.div.contains(e)){let{isMac:n}=J.platform;if(t.button!==0||t.ctrlKey&&n)return;this.#u.showAllEditors("highlight",!0,!0),this.#h.div.classList.add("free"),this.toggleDrawing(),Hl.startHighlighting(this,this.#u.direction==="ltr",{target:this.#h.div,x:t.x,y:t.y}),this.#h.div.addEventListener("pointerup",()=>{this.#h.div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:this.#u._signal}),t.preventDefault()}}enableClick(){if(this.#n)return;this.#n=new AbortController;let t=this.#u.combinedSignal(this.#n);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.#n?.abort(),this.#n=null}attach(t){this.#r.set(t.id,t);let{annotationElementId:e}=t;e&&this.#u.isDeletedAnnotationElement(e)&&this.#u.removeDeletedAnnotationElement(t)}detach(t){this.#r.delete(t.id),this.#t?.removePointerInTextLayer(t.contentDiv),!this.#o&&t.annotationElementId&&this.#u.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#u.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(this.#u.addDeletedAnnotationElement(t),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.#u.addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!this.#c),this.#u.addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:e}=document;t.div.contains(e)&&!this.#s&&(t._focusEventsAllowed=!1,this.#s=setTimeout(()=>{this.#s=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this.#u._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),n=()=>{t.remove()};this.addCommands({cmd:e,undo:n,mustExec:!1})}getEditorByUID(t){for(let e of this.#r.values())if(e.uid===t)return e;return null}get#y(){return i.#f.get(this.#u.getMode())}combinedSignal(t){return this.#u.combinedSignal(t)}#E(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.#u.updateMode(t.mode);let{offsetX:n,offsetY:s}=this.#w(),a=this.#u.getId(),r=this.#E({parent:this,id:a,x:n,y:s,uiManager:this.#u,isCentered:!0,...e});r&&this.add(r)}async deserialize(t){return await i.#f.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#u)||null}createAndAddNewEditor(t,e,n={}){let s=this.#u.getId(),a=this.#E({parent:this,id:s,x:t.offsetX,y:t.offsetY,uiManager:this.#u,isCentered:e,...n});return a&&this.add(a),a}get boundingClientRect(){return this.div.getBoundingClientRect()}#w(){let{x:t,y:e,width:n,height:s}=this.boundingClientRect,a=Math.max(0,t),r=Math.max(0,e),o=Math.min(window.innerWidth,t+n),l=Math.min(window.innerHeight,e+s),c=(a+o)/2-t,u=(r+l)/2-e,[h,d]=this.viewport.rotation%180===0?[c,u]:[u,c];return{offsetX:h,offsetY:d}}addNewEditor(t={}){this.createAndAddNewEditor(this.#w(),!0,t)}setSelected(t){this.#u.setSelected(t)}toggleSelected(t){this.#u.toggleSelected(t)}unselect(t){this.#u.unselect(t)}pointerup(t){let{isMac:e}=J.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div||!this.#a||(this.#a=!1,this.#y?.isDrawer&&this.#y.supportMultipleDrawings))return;if(!this.#e){this.#e=!0;return}let n=this.#u.getMode();if(n===P.STAMP||n===P.POPUP||n===P.SIGNATURE){this.#u.unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){if(this.#u.getMode()===P.HIGHLIGHT&&this.enableTextSelection(),this.#a){this.#a=!1;return}let{isMac:e}=J.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;if(this.#a=!0,this.#y?.isDrawer){this.startDrawingSession(t);return}let n=this.#u.getActive();this.#e=!n||n.isEmpty()}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),this.#l){this.#y.startDrawing(this,this.#u,!1,t);return}this.#u.setCurrentDrawingSession(this),this.#l=new AbortController;let e=this.#u.combinedSignal(this.#l);this.div.addEventListener("blur",({relatedTarget:n})=>{n&&!this.div.contains(n)&&(this.#d=null,this.commitOrRemove())},{signal:e}),this.#y.startDrawing(this,this.#u,!1,t)}pause(t){if(t){let{activeElement:e}=document;this.div.contains(e)&&(this.#d=e);return}this.#d&&setTimeout(()=>{this.#d?.focus(),this.#d=null},0)}endDrawingSession(t=!1){return this.#l?(this.#u.setCurrentDrawingSession(null),this.#l.abort(),this.#l=null,this.#d=null,this.#y.endDrawing(t)):null}findNewParent(t,e,n){let s=this.#u.findParent(e,n);return s===null||s===this?!1:(s.changeParent(t),!0)}commitOrRemove(){return this.#l?(this.endDrawingSession(),!0):!1}onScaleChanging(){this.#l&&this.#y.onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),this.#u.getActive()?.parent===this&&(this.#u.commitOrRemove(),this.#u.setActiveEditor(null)),this.#s&&(clearTimeout(this.#s),this.#s=null);for(let t of this.#r.values())this.#t?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#r.clear(),this.#u.removeLayer(this)}#A(){for(let t of this.#r.values())t.isEmpty()&&t.remove()}async render({viewport:t}){this.viewport=t,an(this.div,t);for(let e of this.#u.getEditors(this.pageIndex))this.add(e),e.rebuild();await this.#u.findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:t}){this.#u.commitOrRemove(),this.#A();let e=this.viewport.rotation,n=t.rotation;if(this.viewport=t,an(this.div,{rotation:n}),e!==n)for(let s of this.#r.values())s.rotate(n)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return this.#u.viewParameters.realScale}};Xl=class i{#t=null;#e=new Map;#i=null;#n=null;#s=null;#r=null;#a=new Map;static#o=0;static#c=0;static#l=null;static#d=new Set;static#h=!1;static#p=new Set;static#m=new WeakMap;constructor({filterFactory:t=null,pageColors:e=null,pageIndex:n,textLayer:s=null}){if(this.pageIndex=n,this.#n=t,this.#s=e,s){let a=i.#m.get(s);if(a?.selectionDiv&&(a.selectionDiv.remove(),i.#d.delete(a.selectionDiv)),i.#m.set(s,{drawLayer:this}),i.#p.add(s),this.#i=s,this.#r=new MutationObserver(r=>{if(!(!this.#t||!this.#i?.isConnected||!i.#u())){for(let{addedNodes:o}of r)for(let l of o)if(l.nodeType===Node.ELEMENT_NODE&&l.classList.contains("endOfContent")){i.#b();return}}}),this.#r.observe(s,{childList:!0}),i.#l===null){i.#l=new AbortController;let{signal:r}=i.#l;document.addEventListener("selectionchange",i.#b.bind(i),{signal:r}),document.addEventListener("pointerdown",()=>{i.#h=!0},{signal:r}),document.addEventListener("pointerup",()=>{i.#h=!1},{signal:r}),window.addEventListener("blur",()=>{i.#h=!1},{signal:r})}}}setParent(t){if(!this.#t){this.#t=t,this.#i?.isConnected&&i.#u()&&i.#b();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#g(t){let e=this.#m.get(t);e?.selectionDiv&&(e.selectionDiv.remove(),this.#d.delete(e.selectionDiv),e.selectionDiv=null,e.path=null)}static#u(){let t=document.getSelection();return!!t&&!t.isCollapsed}static#f(){return this.#p.keys().filter(t=>t.isConnected).toArray().sort(kS)}static#b(){let t=document.getSelection();if(!t||t.isCollapsed){for(let r of this.#d)r.remove();this.#d.clear();return}let e=new WeakMap,n=this.#f(),s=[];for(let r=0,o=t.rangeCount;r<o;r++){let l=t.getRangeAt(r);if(l.collapsed)continue;let{startContainer:c,startOffset:u,endContainer:h,endOffset:d}=l,f=gl(c),m=gl(h),y=f===null,v=m===null;if(this.#h&&y!==v)return;if(t.rangeCount===1){let{anchorNode:b,anchorOffset:A,focusNode:S,focusOffset:E}=t,T=gl(b),w=gl(S),_=LS(b,A,S,E);T&&w&&_!==null&&(_?(c=b,u=A,f=T,h=S,d=E,m=w):(c=S,u=E,f=w,h=b,d=A,m=T))}let p=n.filter(b=>l.intersectsNode(b));if(p.length===0)continue;let g=!1;if(f||(f=p[0],c=f,u=0,g=!0),m||(m=p.at(-1),h=m,d=m.childNodes.length,g=!0),h.nodeType===Node.ELEMENT_NODE){if(h.classList.contains("endOfContent")){let b=h.previousSibling;if(!b)continue;h=b,d=b.nodeType===Node.TEXT_NODE?b.textContent.length:b.childNodes.length}else if(h.classList.contains("textLayer")&&h.childNodes.length===d){let b=db(h,d,m);if(!b)continue;h=b.container,d=b.offset}}if(c.nodeType===Node.ELEMENT_NODE){let b=db(c,u,f);if(!b)continue;c=b.container,u=b.offset}if(f===m&&!g&&p.includes(f)){s.push([l,f]);continue}for(let b of p){let A=b.firstChild;if(!A)continue;let S=document.createRange();if(b===f?S.setStart(c,u):S.setStartBefore(A),b===m)S.setEnd(h,d);else{let E=b.lastChild;if(!E)continue;if(E.nodeType===Node.ELEMENT_NODE&&E.classList.contains("endOfContent")){let T=E.previousSibling;if(!T)continue;S.setEndAfter(T)}else S.setEndAfter(E)}S.collapsed||s.push([S,b])}}let a=new Set(s.map(r=>r[1]));for(let r of this.#p)a.has(r)||this.#g(r);for(let[r,o]of s){let l=i.#m.get(o);if(!l)continue;let c=e.get(o);if(!c){let m=o.getBoundingClientRect();c=(y,v,p,g)=>({x:(y-m.x)/m.width,y:(v-m.y)/m.height,width:p/m.width,height:g/m.height}),e.set(o,c)}let u=[];for(let{x:m,y,width:v,height:p}of r.getClientRects())v===0||p===0||({x:m,y,width:v,height:p}=c(m,y,v,p),!(v===1&&p===1)&&u.push(`M${m} ${y} h${v} v${p} h-${v} Z`));if(u.length===0)continue;let h=l.drawLayer,d=l.selectionDiv,f=l.path;if(!d){let m=`clip_selection_${i.#c++}`;d=document.createElement("div"),d.className="selection",d.style.clipPath=`url(#${m})`;let y=h.#n?.createSelectionStyle(h.#s);if(y)for(let[g,b]of Object.entries(y))d.style.setProperty(g,b);let v=i._svgFactory.create(1,1,!0);v.setAttribute("aria-hidden","true"),v.setAttribute("width","100%"),v.setAttribute("height","100%");let p=i._svgFactory.createElement("clipPath");p.setAttribute("id",m),p.setAttribute("clipPathUnits","objectBoundingBox"),f=i._svgFactory.createElement("path"),p.append(f),v.append(p),d.append(v),l.path=f,l.selectionDiv=d}!d.parentNode&&h.#t&&(h.#t.append(d),this.#d.add(d)),f.setAttribute("d",u.join(" "))}}static get _svgFactory(){return L(this,"_svgFactory",new Ln)}static#v(t,[e,n,s,a]){let{style:r}=t;r.top=`${100*n}%`,r.left=`${100*e}%`,r.width=`${100*s}%`,r.height=`${100*a}%`}#y(){let t=i._svgFactory.create(1,1,!0);return this.#t.append(t),t.setAttribute("aria-hidden","true"),t}#E(t,e){let n=i._svgFactory.createElement("clipPath");t.append(n);let s=`clip_${e}`;n.setAttribute("id",s),n.setAttribute("clipPathUnits","objectBoundingBox");let a=i._svgFactory.createElement("use");return n.append(a),a.setAttribute("href",`#${e}`),a.classList.add("clip"),s}#w(t,e){for(let[n,s]of Object.entries(e))s===null?t.removeAttribute(n):t.setAttribute(n,s)}draw(t,e=!1,n=!1){let s=i.#o++,a=this.#y(),r=i._svgFactory.createElement("defs");a.append(r);let o=i._svgFactory.createElement("path");r.append(o);let l=`path_${s}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),e&&this.#a.set(s,o);let c=n?this.#E(r,l):null,u=i._svgFactory.createElement("use");return a.append(u),u.setAttribute("href",`#${l}`),this.updateProperties(a,t),this.#e.set(s,a),{id:s,clipPathId:`url(#${c})`}}drawOutline(t,e){let n=i.#o++,s=this.#y(),a=i._svgFactory.createElement("defs");s.append(a);let r=i._svgFactory.createElement("path");a.append(r);let o=`path_${n}`;r.setAttribute("id",o),r.setAttribute("vector-effect","non-scaling-stroke");let l;if(e){let h=i._svgFactory.createElement("mask");a.append(h),l=`mask_${n}`,h.setAttribute("id",l),h.setAttribute("maskUnits","objectBoundingBox");let d=i._svgFactory.createElement("rect");h.append(d),d.setAttribute("width","1"),d.setAttribute("height","1"),d.setAttribute("fill","white");let f=i._svgFactory.createElement("use");h.append(f),f.setAttribute("href",`#${o}`),f.setAttribute("stroke","none"),f.setAttribute("fill","black"),f.setAttribute("fill-rule","nonzero"),f.classList.add("mask")}let c=i._svgFactory.createElement("use");s.append(c),c.setAttribute("href",`#${o}`),l&&c.setAttribute("mask",`url(#${l})`);let u=c.cloneNode();return s.append(u),c.classList.add("mainOutline"),u.classList.add("secondaryOutline"),this.updateProperties(s,t),this.#e.set(n,s),n}finalizeDraw(t,e){this.#a.delete(t),this.updateProperties(t,e)}updateProperties(t,e){if(!e)return;let{root:n,bbox:s,rootClass:a,path:r}=e,o=typeof t=="number"?this.#e.get(t):t;if(o){if(n&&this.#w(o,n),s&&i.#v(o,s),a){let{classList:l}=o;for(let[c,u]of Object.entries(a))l.toggle(c,u)}if(r){let c=o.firstElementChild.firstElementChild;this.#w(c,r)}}}updateParent(t,e){if(e===this)return;let n=this.#e.get(t);n&&(e.#t.append(n),this.#e.delete(t),e.#e.set(t,n))}remove(t){this.#a.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.#a.clear(),this.#r?.disconnect(),this.#r=null,this.#i&&(i.#m.get(this.#i)?.drawLayer===this&&(i.#g(this.#i),i.#m.delete(this.#i),i.#p.delete(this.#i),i.#p.size===0&&(i.#l?.abort(),i.#l=null,i.#h=!1)),this.#i=null)}};Yl=class i{#t=[];#e=new Map;#i=null;#n=0;#s=0;#r=0;static#a=null;constructor(t,e,n,s){this.#n=t,this.#t=e,this.#s=n.rawDims.pageWidth,this.#r=n.rawDims.pageHeight,this.#i=s}render(){let t=document.createElement("div");t.className="textLayerImages";for(let e=0;e<this.#t.length;e+=6){let n=this.#o(this.#t.subarray(e,e+6));n&&t.append(n)}return t.addEventListener("contextmenu",e=>{if(!(e.target instanceof HTMLCanvasElement))return;let n=e.target,s=this.#e.get(n);if(!s)return;let a=i.#a?.deref();if(a===n)return;a&&(a.width=0,a.height=0),i.#a=new WeakRef(n);let{inverseTransform:r,x1:o,y1:l,width:c,height:u}=s,h=this.#i(),d=Math.ceil(o*h.width),f=Math.ceil(l*h.height),m=Math.floor((o+c/this.#s)*h.width),y=Math.floor((l+u/this.#r)*h.height);n.width=m-d,n.height=y-f;let v=n.getContext("2d");v.setTransform(...r),v.translate(-d,-f),v.drawImage(h,0,0)}),t}#o([t,e,n,s,a,r]){let o=Math.hypot((a-t)*this.#s,(r-e)*this.#r),l=Math.hypot((n-t)*this.#s,(s-e)*this.#r);if(o<this.#n||l<this.#n)return null;let c=[(a-t)*this.#s/o,(r-e)*this.#r/o,(n-t)*this.#s/l,(s-e)*this.#r/l,0,0],u=M.inverseTransform(c),h=document.createElement("canvas");return h.className="textLayerImagePlaceholder",h.width=0,h.height=0,Object.assign(h.style,{opacity:0,position:"absolute",left:ml(t),top:ml(e),width:ml(o/this.#s),height:ml(l/this.#r),transformOrigin:"0% 0%",transform:`matrix(${c.join(",")})`}),this.#e.set(h,{inverseTransform:u,width:o,height:l,x1:t,y1:e}),h}};globalThis._pdfjsTestingUtils={HighlightOutliner:wr};globalThis.pdfjsLib={AbortException:Ge,AnnotationEditorLayer:Vl,AnnotationEditorParamsType:H,AnnotationEditorType:P,AnnotationEditorUIManager:rn,AnnotationLayer:Pl,AnnotationMode:Si,AnnotationType:bt,applyOpacity:vb,build:Lb,ColorPicker:Ar,createValidAbsoluteUrl:Lf,CSSConstants:Sl,DOMSVGFactory:Ln,DrawLayer:Xl,FeatureTest:J,fetchData:$l,findContrastColor:Ab,getDocument:Nb,getFilenameFromUrl:yb,getPdfFilenameFromUrl:bb,getRGB:Ks,getRGBA:qs,getUuid:zf,GlobalWorkerOptions:sn,ImageKind:sr,InvalidPDFException:Is,isDataScheme:Mr,isPdfFile:Zl,isValidExplicitDest:Tb,makeArr:Ys,makeMap:Ql,makeObj:bl,makeSet:mb,MathClamp:ht,noContextMenu:Te,normalizeUnicode:gb,OPS:Ue,OutputScale:Je,PasswordException:Ps,PasswordResponses:pb,PDFDataRangeTransport:vr,PDFDateString:Hs,PDFWorker:Xs,PermissionFlag:fb,PixelsPerInch:wi,RenderingCancelledException:Fs,renderRichText:Pf,ResponseException:Nn,setLayerDimensions:an,shadow:L,SignatureExtractor:Ei,stopEvent:vt,SupportedImageMimeTypes:Al,TextLayer:Vs,TextLayerImages:Yl,TouchManager:fr,updateUrlHash:Bf,Util:M,VerbosityLevel:Cr,version:kb,XfaLayer:dr}});var jb=Ci(My());var q=Ci(ea());var nn=Ci(ea(),1),Fy=Ci(Ec(),1);function Cn(i,t,e){let n=e.initialDeps??[],s,a=!0;function r(){var o,l,c;let u;e.key&&((o=e.debug)!=null&&o.call(e))&&(u=Date.now());let h=i();if(!(h.length!==n.length||h.some((m,y)=>n[y]!==m)))return s;n=h;let f;if(e.key&&((l=e.debug)!=null&&l.call(e))&&(f=Date.now()),s=t(...h),e.key&&((c=e.debug)!=null&&c.call(e))){let m=Math.round((Date.now()-u)*100)/100,y=Math.round((Date.now()-f)*100)/100,v=y/16,p=(g,b)=>{for(g=String(g);g.length<b;)g=" "+g;return g};console.info(`%c\u23F1 ${p(y,5)} /${p(m,5)} ms`,`
64
64
  font-size: .6rem;
65
65
  font-weight: bold;
66
- color: hsl(${Math.max(0,Math.min(120-120*v,120))}deg 100% 31%);`,e?.key)}return e?.onChange&&!(a&&e.skipInitialOnChange)&&e.onChange(s),a=!1,s}return r.updateDeps=o=>{n=o},r}function Kh(i,t){if(i===void 0)throw new Error(`Unexpected undefined${t?`: ${t}`:""}`);return i}var Oy=(i,t)=>Math.abs(i-t)<1.01,Ry=(i,t,e)=>{let n;return function(...s){i.clearTimeout(n),n=i.setTimeout(()=>t.apply(this,s),e)}};var Ny=i=>{let{offsetWidth:t,offsetHeight:e}=i;return{width:t,height:e}},V1=i=>i,X1=i=>{let t=Math.max(i.startIndex-i.overscan,0),e=Math.min(i.endIndex+i.overscan,i.count-1),n=[];for(let s=t;s<=e;s++)n.push(s);return n},By=(i,t)=>{let e=i.scrollElement;if(!e)return;let n=i.targetWindow;if(!n)return;let s=r=>{let{width:o,height:l}=r;t({width:Math.round(o),height:Math.round(l)})};if(s(Ny(e)),!n.ResizeObserver)return()=>{};let a=new n.ResizeObserver(r=>{let o=()=>{let l=r[0];if(l?.borderBoxSize){let c=l.borderBoxSize[0];if(c){s({width:c.inlineSize,height:c.blockSize});return}}s(Ny(e))};i.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return a.observe(e,{box:"border-box"}),()=>{a.unobserve(e)}},Ly={passive:!0};var ky=typeof window>"u"?!0:"onscrollend"in window,zy=(i,t)=>{let e=i.scrollElement;if(!e)return;let n=i.targetWindow;if(!n)return;let s=0,a=i.options.useScrollendEvent&&ky?()=>{}:Ry(n,()=>{t(s,!1)},i.options.isScrollingResetDelay),r=u=>()=>{let{horizontal:h,isRtl:d}=i.options;s=h?e.scrollLeft*(d&&-1||1):e.scrollTop,a(),t(s,u)},o=r(!0),l=r(!1);e.addEventListener("scroll",o,Ly);let c=i.options.useScrollendEvent&&ky;return c&&e.addEventListener("scrollend",l,Ly),()=>{e.removeEventListener("scroll",o),c&&e.removeEventListener("scrollend",l)}};var Y1=(i,t,e)=>{if(t?.borderBoxSize){let n=t.borderBoxSize[0];if(n)return Math.round(n[e.options.horizontal?"inlineSize":"blockSize"])}return i[e.options.horizontal?"offsetWidth":"offsetHeight"]};var Py=(i,{adjustments:t=0,behavior:e},n)=>{var s,a;let r=i+t;(a=(s=n.scrollElement)==null?void 0:s.scrollTo)==null||a.call(s,{[n.options.horizontal?"left":"top"]:r,behavior:e})},ol=class{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var e,n,s;return((s=(n=(e=this.targetWindow)==null?void 0:e.performance)==null?void 0:n.now)==null?void 0:s.call(n))??Date.now()},this.observer=(()=>{let e=null,n=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(s=>{s.forEach(a=>{let r=()=>{let o=a.target,l=this.indexFromElement(o);if(!o.isConnected){this.observer.unobserve(o);return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(o,a,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var s;(s=n())==null||s.disconnect(),e=null},observe:s=>{var a;return(a=n())==null?void 0:a.observe(s,{box:"border-box"})},unobserve:s=>{var a;return(a=n())==null?void 0:a.unobserve(s)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([n,s])=>{typeof s>"u"&&delete e[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:V1,rangeExtractor:X1,onChange:()=>{},measureElement:Y1,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...e}},this.notify=e=>{var n,s;(s=(n=this.options).onChange)==null||s.call(n,this,e)},this.maybeNotify=Cn(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;let n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,a)=>{this.scrollAdjustments=0,this.scrollDirection=a?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=a,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,n)=>{let s=new Map,a=new Map;for(let r=n-1;r>=0;r--){let o=e[r];if(s.has(o.lane))continue;let l=a.get(o.lane);if(l==null||o.end>l.end?a.set(o.lane,o):o.end<l.end&&s.set(o.lane,!0),s.size===this.options.lanes)break}return a.size===this.options.lanes?Array.from(a.values()).sort((r,o)=>r.end===o.end?r.index-o.index:r.end-o.end)[0]:void 0},this.getMeasurementOptions=Cn(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,n,s,a,r,o,l)=>(this.prevLanes!==void 0&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:n,scrollMargin:s,getItemKey:a,enabled:r,lanes:o,laneAssignmentMode:l}),{key:!1}),this.getMeasurements=Cn(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:n,scrollMargin:s,getItemKey:a,enabled:r,lanes:o,laneAssignmentMode:l},c)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let f of this.laneAssignments.keys())f>=e&&this.laneAssignments.delete(f);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));let u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);let h=this.measurementsCache.slice(0,u),d=new Array(o).fill(void 0);for(let f=0;f<u;f++){let m=h[f];m&&(d[m.lane]=f)}for(let f=u;f<e;f++){let m=a(f),y=this.laneAssignments.get(f),v,p,g=l==="estimate"||c.has(m);if(y!==void 0&&this.options.lanes>1){v=y;let E=d[v],T=E!==void 0?h[E]:void 0;p=T?T.end+this.options.gap:n+s}else{let E=this.options.lanes===1?h[f-1]:this.getFurthestMeasurement(h,f);p=E?E.end+this.options.gap:n+s,v=E?E.lane:f%this.options.lanes,this.options.lanes>1&&g&&this.laneAssignments.set(f,v)}let b=c.get(m),A=typeof b=="number"?b:this.options.estimateSize(f),S=p+A;h[f]={index:f,start:p,size:A,end:S,key:m,lane:v},d[v]=f}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Cn(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,n,s,a)=>this.range=e.length>0&&n>0?q1({measurements:e,outerSize:n,scrollOffset:s,lanes:a}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Cn(()=>{let e=null,n=null,s=this.calculateRange();return s&&(e=s.startIndex,n=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,n]},(e,n,s,a,r)=>a===null||r===null?[]:e({startIndex:a,endIndex:r,overscan:n,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let n=this.options.indexAttribute,s=e.getAttribute(n);return s?parseInt(s,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;let s=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(s!==void 0&&this.range){let a=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,s-a),o=Math.min(this.options.count-1,s+a);return e>=r&&e<=o}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((r,o)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(o))});return}let n=this.indexFromElement(e),s=this.options.getItemKey(n),a=this.elementsCache.get(s);a!==e&&(a&&this.observer.unobserve(a),this.observer.observe(e),this.elementsCache.set(s,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,n)=>{var s;let a=this.measurementsCache[e];if(!a)return;let r=this.itemSizeCache.get(a.key)??a.size,o=n-r;o!==0&&(((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(a,o,this):a.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(a.index),this.itemSizeCache=new Map(this.itemSizeCache.set(a.key,n)),this.notify(!1))},this.getVirtualItems=Cn(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,n)=>{let s=[];for(let a=0,r=e.length;a<r;a++){let o=e[a],l=n[o];s.push(l)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let n=this.getMeasurements();if(n.length!==0)return Kh(n[Iy(0,n.length-1,s=>Kh(n[s]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,n,s=0)=>{if(!this.scrollElement)return 0;let a=this.getSize(),r=this.getScrollOffset();n==="auto"&&(n=e>=r+a?"end":"start"),n==="center"?e+=(s-a)/2:n==="end"&&(e-=a);let o=this.getMaxScrollOffset();return Math.max(Math.min(o,e),0)},this.getOffsetForIndex=(e,n="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));let s=this.getSize(),a=this.getScrollOffset(),r=this.measurementsCache[e];if(!r)return;if(n==="auto")if(r.end>=a+s-this.options.scrollPaddingEnd)n="end";else if(r.start<=a+this.options.scrollPaddingStart)n="start";else return[a,n];if(n==="end"&&e===this.options.count-1)return[this.getMaxScrollOffset(),n];let o=n==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,n,r.size),n]},this.scrollToOffset=(e,{align:n="start",behavior:s="auto"}={})=>{let a=this.getOffsetForAlignment(e,n),r=this.now();this.scrollState={index:null,align:n,behavior:s,startedAt:r,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:n="auto",behavior:s="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let a=this.getOffsetForIndex(e,n);if(!a)return;let[r,o]=a,l=this.now();this.scrollState={index:e,align:o,behavior:s,startedAt:l,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:n="auto"}={})=>{let s=this.getScrollOffset()+e,a=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:a,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var e;let n=this.getMeasurements(),s;if(n.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((e=n[n.length-1])==null?void 0:e.end)??0;else{let a=Array(this.options.lanes).fill(null),r=n.length-1;for(;r>=0&&a.some(o=>o===null);){let o=n[r];a[o.lane]===null&&(a[o.lane]=o.end),r--}s=Math.max(...a.filter(o=>o!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:n,behavior:s})=>{this.options.scrollToFn(e,{behavior:s,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=n?n[0]:this.scrollState.lastTargetOffset,a=1,r=s!==this.scrollState.lastTargetOffset;if(!r&&Oy(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=a){this.scrollState=null;return}}else this.scrollState.stableFrames=0,r&&(this.scrollState.lastTargetOffset=s,this.scrollState.behavior="auto",this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}},Iy=(i,t,e,n)=>{for(;i<=t;){let s=(i+t)/2|0,a=e(s);if(a<n)i=s+1;else if(a>n)t=s-1;else return s}return i>0?i-1:0};function q1({measurements:i,outerSize:t,scrollOffset:e,lanes:n}){let s=i.length-1,a=l=>i[l].start;if(i.length<=n)return{startIndex:0,endIndex:s};let r=Iy(0,s,a,e),o=r;if(n===1)for(;o<s&&i[o].end<e+t;)o++;else if(n>1){let l=Array(n).fill(0);for(;o<s&&l.some(u=>u<e+t);){let u=i[o];l[u.lane]=u.end,o++}let c=Array(n).fill(e+t);for(;r>=0&&c.some(u=>u>=e);){let u=i[r];c[u.lane]=u.start,r--}r=Math.max(0,r-r%n),o=Math.min(s,o+(n-1-o%n))}return{startIndex:r,endIndex:o}}var Fy=typeof document<"u"?nn.useLayoutEffect:nn.useEffect;function K1({useFlushSync:i=!0,...t}){let e=nn.useReducer(()=>({}),{})[1],n={...t,onChange:(a,r)=>{var o;i&&r?(0,Hy.flushSync)(e):e(),(o=t.onChange)==null||o.call(t,a,r)}},[s]=nn.useState(()=>new ol(n));return s.setOptions(n),Fy(()=>s._didMount(),[]),Fy(()=>s._willUpdate()),s}function Wh(i){return K1({observeElementRect:By,observeElementOffset:zy,scrollToFn:Py,...i})}var W=Ci(tr()),Pb=16,BS=32,Dr=96/72,zS=.25,PS=4,Ib=1.2,IS=100,Fb=18,Hb=12,FS=132;function Ub({cwd:i,path:t,refreshKey:e}){let n=(0,q.useRef)(null),[s,a]=(0,q.useState)({kind:"loading"}),[r,o]=(0,q.useState)(null),[l,c]=(0,q.useState)(0),[u,h]=(0,q.useState)(null),[d,f]=(0,q.useState)(0),[m,y]=(0,q.useState)({kind:"auto"}),[v,p]=(0,q.useState)(1),[g,b]=(0,q.useState)(!0);(0,q.useEffect)(()=>{let G=!1;a({kind:"loading"}),o(null),c(0),h(null),p(1);let Wt=null;return(async()=>{try{let Ct=await Promise.resolve().then(()=>(zb(),Bb));Ct.GlobalWorkerOptions.workerSrc="/pdfjs/pdf.worker.min.mjs";let At=`/api/files/read?cwd=${encodeURIComponent(i)}&path=${encodeURIComponent(t)}&v=${encodeURIComponent(String(e??""))}`;Wt=Ct.getDocument({url:At});let In=await Wt.promise;if(G)return;let rc=await Promise.all(Array.from({length:In.numPages},(Hf,Ws)=>In.getPage(Ws+1).then(Qs=>{let $s=Qs.getViewport({scale:1});return{w:$s.width,h:$s.height}})));if(G)return;o(In),c(In.numPages),h(rc),a({kind:"ready"})}catch(Ct){G||a({kind:"error",message:Ct instanceof Error?Ct.message:"Failed to load PDF"})}})(),()=>{G=!0;try{Wt?.destroy()}catch{}}},[i,t,e]),(0,q.useEffect)(()=>{let G=n.current;if(!G)return;let Wt=()=>f(Math.max(0,G.clientWidth-BS));Wt();let Ct=new ResizeObserver(Wt);return Ct.observe(G),()=>Ct.disconnect()},[]);let A=(0,q.useMemo)(()=>u?.length?Math.max(...u.map(G=>G.w)):0,[u]),S=A>0&&d>0?d/A:Dr,E=Math.min(S,Dr),T=m.kind==="auto"?E:m.factor*Dr,w=Math.round(T/Dr*100),_=(0,q.useMemo)(()=>u?u.map(G=>G.h*T+Pb):[],[u,T]),C=A*T,D=(0,q.useRef)(1);D.current=E/Dr;let N=(0,q.useRef)(_);N.current=_;let z=Wh({count:l,getScrollElement:()=>n.current,estimateSize:G=>N.current[G]??0,overscan:2});(0,q.useEffect)(()=>{_.length>0&&z.measure()},[_,z]);let X=(0,q.useCallback)(()=>{let G=n.current;if(!G||l===0)return;let Wt=G.scrollTop,Ct=z.getVirtualItems().find(At=>At.end>Wt);p((Ct?Ct.index:l-1)+1)},[z,l]),lt=(0,q.useCallback)(G=>{y(Wt=>{let Ct=Wt.kind==="auto"?D.current:Wt.factor;return{kind:"fixed",factor:Math.min(PS,Math.max(zS,Ct*G))}})},[]),L=(0,q.useCallback)(()=>lt(Ib),[lt]),R=(0,q.useCallback)(()=>lt(1/Ib),[lt]),Lt=(0,q.useCallback)(()=>y({kind:"auto"}),[]),kt=(0,q.useCallback)(()=>b(G=>!G),[]),Pe=(0,q.useCallback)(G=>{z.scrollToIndex(G,{align:"start"}),p(G+1)},[z]),xi=z.getVirtualItems(),at=z.getTotalSize(),rt=(0,q.useMemo)(()=>(0,W.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border bg-secondary text-muted-foreground text-xs select-none",children:[(0,W.jsx)("button",{onClick:kt,className:`px-1.5 py-0.5 rounded hover:bg-accent transition-colors ${g?"text-foreground":""}`,title:g?"Hide thumbnails":"Show thumbnails","aria-label":"Toggle thumbnails",children:(0,W.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[(0,W.jsx)("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),(0,W.jsx)("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),(0,W.jsx)("line",{x1:"4",y1:"18",x2:"20",y2:"18"})]})}),(0,W.jsx)("span",{className:"tabular-nums",children:l>0?`${v} / ${l}`:"\u2014"}),(0,W.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,W.jsx)("button",{onClick:R,className:"px-1.5 py-0.5 rounded hover:bg-accent transition-colors",title:"Zoom out","aria-label":"Zoom out",children:"\u2212"}),(0,W.jsxs)("button",{onClick:Lt,className:`px-1.5 py-0.5 rounded hover:bg-accent transition-colors tabular-nums min-w-[3.5rem] ${m.kind==="auto"?"":"text-foreground"}`,title:"Reset to automatic zoom",children:[w,"%"]}),(0,W.jsx)("button",{onClick:L,className:"px-1.5 py-0.5 rounded hover:bg-accent transition-colors",title:"Zoom in","aria-label":"Zoom in",children:"+"})]})]}),[l,v,w,m.kind,L,R,Lt,g,kt]);return s.kind==="error"?(0,W.jsxs)("div",{className:"h-full flex flex-col bg-secondary",children:[rt,(0,W.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,W.jsx)("div",{className:"text-sm text-red-11",children:s.message})})]}):(0,W.jsxs)("div",{className:"h-full flex flex-col bg-secondary",children:[rt,(0,W.jsxs)("div",{className:"flex-1 flex min-h-0",children:[g&&r&&u&&(0,W.jsx)(HS,{doc:r,numPages:l,sizes:u,maxPageW:A,currentPage:v,onSelect:Pe}),(0,W.jsx)("div",{ref:n,onScroll:X,className:"flex-1 overflow-auto px-4 py-4",children:s.kind==="loading"||!r||!u||C<=0?(0,W.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,W.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):(0,W.jsx)("div",{style:{height:at,width:Math.max(C,d),position:"relative"},children:xi.map(G=>(0,W.jsx)("div",{"data-index":G.index,className:"absolute left-0 top-0 w-full flex justify-center",style:{transform:`translateY(${G.start}px)`,paddingBottom:Pb},children:(0,W.jsx)(Gb,{doc:r,pageNumber:G.index+1,scale:T,width:u[G.index].w*T,height:u[G.index].h*T})},G.key))})})]})]})}function HS({doc:i,numPages:t,sizes:e,maxPageW:n,currentPage:s,onSelect:a}){let r=(0,q.useRef)(null),o=n>0?IS/n:0,l=(0,q.useMemo)(()=>e.map(d=>d.h*o+Fb+Hb),[e,o]),c=(0,q.useRef)(l);c.current=l;let u=Wh({count:t,getScrollElement:()=>r.current,estimateSize:d=>c.current[d]??0,overscan:3});(0,q.useEffect)(()=>{l.length>0&&u.measure()},[l,u]),(0,q.useEffect)(()=>{t>0&&u.scrollToIndex(s-1,{align:"auto"})},[s]);let h=u.getVirtualItems();return(0,W.jsx)("div",{ref:r,className:"shrink-0 overflow-auto border-r border-border bg-secondary py-2",style:{width:FS},children:(0,W.jsx)("div",{style:{height:u.getTotalSize(),width:"100%",position:"relative"},children:h.map(d=>{let f=s===d.index+1;return(0,W.jsxs)("div",{className:"absolute left-0 top-0 w-full flex flex-col items-center",style:{transform:`translateY(${d.start}px)`,paddingBottom:Hb},children:[(0,W.jsx)("button",{onClick:()=>a(d.index),className:`rounded-sm overflow-hidden transition-shadow ${f?"ring-2 ring-brand":"ring-1 ring-border hover:ring-muted-foreground"}`,title:`Page ${d.index+1}`,"aria-label":`Go to page ${d.index+1}`,children:(0,W.jsx)(Gb,{doc:i,pageNumber:d.index+1,scale:o,width:e[d.index].w*o,height:e[d.index].h*o})}),(0,W.jsx)("span",{className:`mt-0.5 text-[11px] tabular-nums leading-none ${f?"text-foreground font-medium":"text-muted-foreground"}`,style:{height:Fb},children:d.index+1})]},d.key)})})})}function Gb({doc:i,pageNumber:t,scale:e,width:n,height:s}){let a=(0,q.useRef)(null);return(0,q.useEffect)(()=>{let r=!1,o=null;return(async()=>{let l=await i.getPage(t);if(r)return;let c=a.current;if(!c)return;let u=Math.min(typeof window<"u"&&window.devicePixelRatio||1,2),h=l.getViewport({scale:e*u});c.width=Math.floor(h.width),c.height=Math.floor(h.height),c.style.width=`${c.width/u}px`,c.style.height=`${c.height/u}px`,o=l.render({canvas:c,viewport:h});try{await o.promise}catch{}})(),()=>{r=!0;try{o?.cancel()}catch{}}},[i,t,e]),(0,W.jsx)("div",{className:"bg-white shadow-md",style:{width:n,height:s},children:(0,W.jsx)("canvas",{ref:a,className:"block"})})}var Ff=Ci(tr()),ac=new Map;function US(i,t){let e=ac.get(i);e||(e=(0,jb.createRoot)(i),ac.set(i,e)),e.render((0,Ff.jsx)("div",{className:"cockpit-pdf",style:{height:"100%"},children:(0,Ff.jsx)(Ub,{cwd:t.cwd,path:t.path})}))}function GS(i){let t=ac.get(i);t&&(t.unmount(),ac.delete(i))}window.CockpitPdf={render:US,unmount:GS};})();
66
+ color: hsl(${Math.max(0,Math.min(120-120*v,120))}deg 100% 31%);`,e?.key)}return e?.onChange&&!(a&&e.skipInitialOnChange)&&e.onChange(s),a=!1,s}return r.updateDeps=o=>{n=o},r}function qh(i,t){if(i===void 0)throw new Error(`Unexpected undefined${t?`: ${t}`:""}`);return i}var Dy=(i,t)=>Math.abs(i-t)<1.01,Oy=(i,t,e)=>{let n;return function(...s){i.clearTimeout(n),n=i.setTimeout(()=>t.apply(this,s),e)}};var Ry=i=>{let{offsetWidth:t,offsetHeight:e}=i;return{width:t,height:e}},V1=i=>i,X1=i=>{let t=Math.max(i.startIndex-i.overscan,0),e=Math.min(i.endIndex+i.overscan,i.count-1),n=[];for(let s=t;s<=e;s++)n.push(s);return n},Ly=(i,t)=>{let e=i.scrollElement;if(!e)return;let n=i.targetWindow;if(!n)return;let s=r=>{let{width:o,height:l}=r;t({width:Math.round(o),height:Math.round(l)})};if(s(Ry(e)),!n.ResizeObserver)return()=>{};let a=new n.ResizeObserver(r=>{let o=()=>{let l=r[0];if(l?.borderBoxSize){let c=l.borderBoxSize[0];if(c){s({width:c.inlineSize,height:c.blockSize});return}}s(Ry(e))};i.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return a.observe(e,{box:"border-box"}),()=>{a.unobserve(e)}},Ny={passive:!0};var ky=typeof window>"u"?!0:"onscrollend"in window,By=(i,t)=>{let e=i.scrollElement;if(!e)return;let n=i.targetWindow;if(!n)return;let s=0,a=i.options.useScrollendEvent&&ky?()=>{}:Oy(n,()=>{t(s,!1)},i.options.isScrollingResetDelay),r=u=>()=>{let{horizontal:h,isRtl:d}=i.options;s=h?e.scrollLeft*(d&&-1||1):e.scrollTop,a(),t(s,u)},o=r(!0),l=r(!1);e.addEventListener("scroll",o,Ny);let c=i.options.useScrollendEvent&&ky;return c&&e.addEventListener("scrollend",l,Ny),()=>{e.removeEventListener("scroll",o),c&&e.removeEventListener("scrollend",l)}};var Y1=(i,t,e)=>{if(t?.borderBoxSize){let n=t.borderBoxSize[0];if(n)return Math.round(n[e.options.horizontal?"inlineSize":"blockSize"])}return i[e.options.horizontal?"offsetWidth":"offsetHeight"]};var zy=(i,{adjustments:t=0,behavior:e},n)=>{var s,a;let r=i+t;(a=(s=n.scrollElement)==null?void 0:s.scrollTo)==null||a.call(s,{[n.options.horizontal?"left":"top"]:r,behavior:e})},ol=class{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var e,n,s;return((s=(n=(e=this.targetWindow)==null?void 0:e.performance)==null?void 0:n.now)==null?void 0:s.call(n))??Date.now()},this.observer=(()=>{let e=null,n=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(s=>{s.forEach(a=>{let r=()=>{let o=a.target,l=this.indexFromElement(o);if(!o.isConnected){this.observer.unobserve(o);return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(o,a,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var s;(s=n())==null||s.disconnect(),e=null},observe:s=>{var a;return(a=n())==null?void 0:a.observe(s,{box:"border-box"})},unobserve:s=>{var a;return(a=n())==null?void 0:a.unobserve(s)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([n,s])=>{typeof s>"u"&&delete e[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:V1,rangeExtractor:X1,onChange:()=>{},measureElement:Y1,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...e}},this.notify=e=>{var n,s;(s=(n=this.options).onChange)==null||s.call(n,this,e)},this.maybeNotify=Cn(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;let n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,a)=>{this.scrollAdjustments=0,this.scrollDirection=a?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=a,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,n)=>{let s=new Map,a=new Map;for(let r=n-1;r>=0;r--){let o=e[r];if(s.has(o.lane))continue;let l=a.get(o.lane);if(l==null||o.end>l.end?a.set(o.lane,o):o.end<l.end&&s.set(o.lane,!0),s.size===this.options.lanes)break}return a.size===this.options.lanes?Array.from(a.values()).sort((r,o)=>r.end===o.end?r.index-o.index:r.end-o.end)[0]:void 0},this.getMeasurementOptions=Cn(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,n,s,a,r,o,l)=>(this.prevLanes!==void 0&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:n,scrollMargin:s,getItemKey:a,enabled:r,lanes:o,laneAssignmentMode:l}),{key:!1}),this.getMeasurements=Cn(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:n,scrollMargin:s,getItemKey:a,enabled:r,lanes:o,laneAssignmentMode:l},c)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let f of this.laneAssignments.keys())f>=e&&this.laneAssignments.delete(f);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));let u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);let h=this.measurementsCache.slice(0,u),d=new Array(o).fill(void 0);for(let f=0;f<u;f++){let m=h[f];m&&(d[m.lane]=f)}for(let f=u;f<e;f++){let m=a(f),y=this.laneAssignments.get(f),v,p,g=l==="estimate"||c.has(m);if(y!==void 0&&this.options.lanes>1){v=y;let E=d[v],T=E!==void 0?h[E]:void 0;p=T?T.end+this.options.gap:n+s}else{let E=this.options.lanes===1?h[f-1]:this.getFurthestMeasurement(h,f);p=E?E.end+this.options.gap:n+s,v=E?E.lane:f%this.options.lanes,this.options.lanes>1&&g&&this.laneAssignments.set(f,v)}let b=c.get(m),A=typeof b=="number"?b:this.options.estimateSize(f),S=p+A;h[f]={index:f,start:p,size:A,end:S,key:m,lane:v},d[v]=f}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Cn(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,n,s,a)=>this.range=e.length>0&&n>0?q1({measurements:e,outerSize:n,scrollOffset:s,lanes:a}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Cn(()=>{let e=null,n=null,s=this.calculateRange();return s&&(e=s.startIndex,n=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,n]},(e,n,s,a,r)=>a===null||r===null?[]:e({startIndex:a,endIndex:r,overscan:n,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let n=this.options.indexAttribute,s=e.getAttribute(n);return s?parseInt(s,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;let s=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(s!==void 0&&this.range){let a=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,s-a),o=Math.min(this.options.count-1,s+a);return e>=r&&e<=o}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((r,o)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(o))});return}let n=this.indexFromElement(e),s=this.options.getItemKey(n),a=this.elementsCache.get(s);a!==e&&(a&&this.observer.unobserve(a),this.observer.observe(e),this.elementsCache.set(s,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,n)=>{var s;let a=this.measurementsCache[e];if(!a)return;let r=this.itemSizeCache.get(a.key)??a.size,o=n-r;o!==0&&(((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(a,o,this):a.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(a.index),this.itemSizeCache=new Map(this.itemSizeCache.set(a.key,n)),this.notify(!1))},this.getVirtualItems=Cn(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,n)=>{let s=[];for(let a=0,r=e.length;a<r;a++){let o=e[a],l=n[o];s.push(l)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let n=this.getMeasurements();if(n.length!==0)return qh(n[Py(0,n.length-1,s=>qh(n[s]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,n,s=0)=>{if(!this.scrollElement)return 0;let a=this.getSize(),r=this.getScrollOffset();n==="auto"&&(n=e>=r+a?"end":"start"),n==="center"?e+=(s-a)/2:n==="end"&&(e-=a);let o=this.getMaxScrollOffset();return Math.max(Math.min(o,e),0)},this.getOffsetForIndex=(e,n="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));let s=this.getSize(),a=this.getScrollOffset(),r=this.measurementsCache[e];if(!r)return;if(n==="auto")if(r.end>=a+s-this.options.scrollPaddingEnd)n="end";else if(r.start<=a+this.options.scrollPaddingStart)n="start";else return[a,n];if(n==="end"&&e===this.options.count-1)return[this.getMaxScrollOffset(),n];let o=n==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,n,r.size),n]},this.scrollToOffset=(e,{align:n="start",behavior:s="auto"}={})=>{let a=this.getOffsetForAlignment(e,n),r=this.now();this.scrollState={index:null,align:n,behavior:s,startedAt:r,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:n="auto",behavior:s="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let a=this.getOffsetForIndex(e,n);if(!a)return;let[r,o]=a,l=this.now();this.scrollState={index:e,align:o,behavior:s,startedAt:l,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:n="auto"}={})=>{let s=this.getScrollOffset()+e,a=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:a,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var e;let n=this.getMeasurements(),s;if(n.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((e=n[n.length-1])==null?void 0:e.end)??0;else{let a=Array(this.options.lanes).fill(null),r=n.length-1;for(;r>=0&&a.some(o=>o===null);){let o=n[r];a[o.lane]===null&&(a[o.lane]=o.end),r--}s=Math.max(...a.filter(o=>o!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:n,behavior:s})=>{this.options.scrollToFn(e,{behavior:s,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=n?n[0]:this.scrollState.lastTargetOffset,a=1,r=s!==this.scrollState.lastTargetOffset;if(!r&&Dy(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=a){this.scrollState=null;return}}else this.scrollState.stableFrames=0,r&&(this.scrollState.lastTargetOffset=s,this.scrollState.behavior="auto",this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}},Py=(i,t,e,n)=>{for(;i<=t;){let s=(i+t)/2|0,a=e(s);if(a<n)i=s+1;else if(a>n)t=s-1;else return s}return i>0?i-1:0};function q1({measurements:i,outerSize:t,scrollOffset:e,lanes:n}){let s=i.length-1,a=l=>i[l].start;if(i.length<=n)return{startIndex:0,endIndex:s};let r=Py(0,s,a,e),o=r;if(n===1)for(;o<s&&i[o].end<e+t;)o++;else if(n>1){let l=Array(n).fill(0);for(;o<s&&l.some(u=>u<e+t);){let u=i[o];l[u.lane]=u.end,o++}let c=Array(n).fill(e+t);for(;r>=0&&c.some(u=>u>=e);){let u=i[r];c[u.lane]=u.start,r--}r=Math.max(0,r-r%n),o=Math.min(s,o+(n-1-o%n))}return{startIndex:r,endIndex:o}}var Iy=typeof document<"u"?nn.useLayoutEffect:nn.useEffect;function K1({useFlushSync:i=!0,...t}){let e=nn.useReducer(()=>({}),{})[1],n={...t,onChange:(a,r)=>{var o;i&&r?(0,Fy.flushSync)(e):e(),(o=t.onChange)==null||o.call(t,a,r)}},[s]=nn.useState(()=>new ol(n));return s.setOptions(n),Iy(()=>s._didMount(),[]),Iy(()=>s._willUpdate()),s}function Kh(i){return K1({observeElementRect:Ly,observeElementOffset:By,scrollToFn:zy,...i})}var W=Ci(tr()),Pb=16,zS=32,Dr=96/72,PS=.25,IS=4,Ib=1.2,FS=100,Fb=18,Hb=12,HS=132;function Ub({cwd:i,path:t,refreshKey:e}){let n=(0,q.useRef)(null),[s,a]=(0,q.useState)({kind:"loading"}),[r,o]=(0,q.useState)(null),[l,c]=(0,q.useState)(0),[u,h]=(0,q.useState)(null),[d,f]=(0,q.useState)(0),[m,y]=(0,q.useState)({kind:"auto"}),[v,p]=(0,q.useState)(1),[g,b]=(0,q.useState)(!0);(0,q.useEffect)(()=>{let G=!1;a({kind:"loading"}),o(null),c(0),h(null),p(1);let Wt=null;return(async()=>{try{let Ct=await Promise.resolve().then(()=>(zb(),Bb));Ct.GlobalWorkerOptions.workerSrc="/pdfjs/pdf.worker.min.mjs";let St=`/api/files/read?cwd=${encodeURIComponent(i)}&path=${encodeURIComponent(t)}&v=${encodeURIComponent(String(e??""))}`;Wt=Ct.getDocument({url:St});let In=await Wt.promise;if(G)return;let ac=await Promise.all(Array.from({length:In.numPages},(Ff,Ws)=>In.getPage(Ws+1).then(Qs=>{let $s=Qs.getViewport({scale:1});return{w:$s.width,h:$s.height}})));if(G)return;o(In),c(In.numPages),h(ac),a({kind:"ready"})}catch(Ct){G||a({kind:"error",message:Ct instanceof Error?Ct.message:"Failed to load PDF"})}})(),()=>{G=!0;try{Wt?.destroy()}catch{}}},[i,t,e]),(0,q.useEffect)(()=>{let G=n.current;if(!G)return;let Wt=()=>f(Math.max(0,G.clientWidth-zS));Wt();let Ct=new ResizeObserver(Wt);return Ct.observe(G),()=>Ct.disconnect()},[]);let A=(0,q.useMemo)(()=>u?.length?Math.max(...u.map(G=>G.w)):0,[u]),S=A>0&&d>0?d/A:Dr,E=Math.min(S,Dr),T=m.kind==="auto"?E:m.factor*Dr,w=Math.round(T/Dr*100),_=(0,q.useMemo)(()=>u?u.map(G=>G.h*T+Pb):[],[u,T]),C=A*T,D=(0,q.useRef)(1);D.current=E/Dr;let N=(0,q.useRef)(_);N.current=_;let z=Kh({count:l,getScrollElement:()=>n.current,estimateSize:G=>N.current[G]??0,overscan:2});(0,q.useEffect)(()=>{_.length>0&&z.measure()},[_,z]);let X=(0,q.useCallback)(()=>{let G=n.current;if(!G||l===0)return;let Wt=G.scrollTop,Ct=z.getVirtualItems().find(St=>St.end>Wt);p((Ct?Ct.index:l-1)+1)},[z,l]),lt=(0,q.useCallback)(G=>{y(Wt=>{let Ct=Wt.kind==="auto"?D.current:Wt.factor;return{kind:"fixed",factor:Math.min(IS,Math.max(PS,Ct*G))}})},[]),k=(0,q.useCallback)(()=>lt(Ib),[lt]),R=(0,q.useCallback)(()=>lt(1/Ib),[lt]),kt=(0,q.useCallback)(()=>y({kind:"auto"}),[]),Lt=(0,q.useCallback)(()=>b(G=>!G),[]),Pe=(0,q.useCallback)(G=>{z.scrollToIndex(G,{align:"start"}),p(G+1)},[z]),xi=z.getVirtualItems(),at=z.getTotalSize(),rt=(0,q.useMemo)(()=>(0,W.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border bg-secondary text-muted-foreground text-xs select-none",children:[(0,W.jsx)("button",{onClick:Lt,className:`px-1.5 py-0.5 rounded hover:bg-accent transition-colors ${g?"text-foreground":""}`,title:g?"Hide thumbnails":"Show thumbnails","aria-label":"Toggle thumbnails",children:(0,W.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[(0,W.jsx)("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),(0,W.jsx)("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),(0,W.jsx)("line",{x1:"4",y1:"18",x2:"20",y2:"18"})]})}),(0,W.jsx)("span",{className:"tabular-nums",children:l>0?`${v} / ${l}`:"\u2014"}),(0,W.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,W.jsx)("button",{onClick:R,className:"px-1.5 py-0.5 rounded hover:bg-accent transition-colors",title:"Zoom out","aria-label":"Zoom out",children:"\u2212"}),(0,W.jsxs)("button",{onClick:kt,className:`px-1.5 py-0.5 rounded hover:bg-accent transition-colors tabular-nums min-w-[3.5rem] ${m.kind==="auto"?"":"text-foreground"}`,title:"Reset to automatic zoom",children:[w,"%"]}),(0,W.jsx)("button",{onClick:k,className:"px-1.5 py-0.5 rounded hover:bg-accent transition-colors",title:"Zoom in","aria-label":"Zoom in",children:"+"})]})]}),[l,v,w,m.kind,k,R,kt,g,Lt]);return s.kind==="error"?(0,W.jsxs)("div",{className:"h-full flex flex-col bg-secondary",children:[rt,(0,W.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,W.jsx)("div",{className:"text-sm text-red-11",children:s.message})})]}):(0,W.jsxs)("div",{className:"h-full flex flex-col bg-secondary",children:[rt,(0,W.jsxs)("div",{className:"flex-1 flex min-h-0",children:[g&&r&&u&&(0,W.jsx)(US,{doc:r,numPages:l,sizes:u,maxPageW:A,currentPage:v,onSelect:Pe}),(0,W.jsx)("div",{ref:n,onScroll:X,className:"flex-1 overflow-auto px-4 py-4",children:s.kind==="loading"||!r||!u||C<=0?(0,W.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,W.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):(0,W.jsx)("div",{style:{height:at,width:Math.max(C,d),position:"relative"},children:xi.map(G=>(0,W.jsx)("div",{"data-index":G.index,className:"absolute left-0 top-0 w-full flex justify-center",style:{transform:`translateY(${G.start}px)`,paddingBottom:Pb},children:(0,W.jsx)(Gb,{doc:r,pageNumber:G.index+1,scale:T,width:u[G.index].w*T,height:u[G.index].h*T})},G.key))})})]})]})}function US({doc:i,numPages:t,sizes:e,maxPageW:n,currentPage:s,onSelect:a}){let r=(0,q.useRef)(null),o=n>0?FS/n:0,l=(0,q.useMemo)(()=>e.map(d=>d.h*o+Fb+Hb),[e,o]),c=(0,q.useRef)(l);c.current=l;let u=Kh({count:t,getScrollElement:()=>r.current,estimateSize:d=>c.current[d]??0,overscan:3});(0,q.useEffect)(()=>{l.length>0&&u.measure()},[l,u]),(0,q.useEffect)(()=>{t>0&&u.scrollToIndex(s-1,{align:"auto"})},[s]);let h=u.getVirtualItems();return(0,W.jsx)("div",{ref:r,className:"shrink-0 overflow-auto border-r border-border bg-secondary py-2",style:{width:HS},children:(0,W.jsx)("div",{style:{height:u.getTotalSize(),width:"100%",position:"relative"},children:h.map(d=>{let f=s===d.index+1;return(0,W.jsxs)("div",{className:"absolute left-0 top-0 w-full flex flex-col items-center",style:{transform:`translateY(${d.start}px)`,paddingBottom:Hb},children:[(0,W.jsx)("button",{onClick:()=>a(d.index),className:`rounded-sm overflow-hidden transition-shadow ${f?"ring-2 ring-brand":"ring-1 ring-border hover:ring-muted-foreground"}`,title:`Page ${d.index+1}`,"aria-label":`Go to page ${d.index+1}`,children:(0,W.jsx)(Gb,{doc:i,pageNumber:d.index+1,scale:o,width:e[d.index].w*o,height:e[d.index].h*o})}),(0,W.jsx)("span",{className:`mt-0.5 text-[11px] tabular-nums leading-none ${f?"text-foreground font-medium":"text-muted-foreground"}`,style:{height:Fb},children:d.index+1})]},d.key)})})})}function Gb({doc:i,pageNumber:t,scale:e,width:n,height:s}){let a=(0,q.useRef)(null);return(0,q.useEffect)(()=>{let r=!1,o=null;return(async()=>{let l=await i.getPage(t);if(r)return;let c=a.current;if(!c)return;let u=Math.min(typeof window<"u"&&window.devicePixelRatio||1,2),h=l.getViewport({scale:e*u});c.width=Math.floor(h.width),c.height=Math.floor(h.height),c.style.width=`${c.width/u}px`,c.style.height=`${c.height/u}px`,o=l.render({canvas:c,viewport:h});try{await o.promise}catch{}})(),()=>{r=!0;try{o?.cancel()}catch{}}},[i,t,e]),(0,W.jsx)("div",{className:"bg-white shadow-md",style:{width:n,height:s},children:(0,W.jsx)("canvas",{ref:a,className:"block"})})}var If=Ci(tr()),sc=new Map;function GS(i,t){let e=sc.get(i);e||(e=(0,jb.createRoot)(i),sc.set(i,e)),e.render((0,If.jsx)("div",{className:"cockpit-pdf",style:{height:"100%"},children:(0,If.jsx)(Ub,{cwd:t.cwd,path:t.path})}))}function jS(i){let t=sc.get(i);t&&(t.unmount(),sc.delete(i))}window.CockpitPdf={render:GS,unmount:jS};})();
67
67
  /*! Bundled license information:
68
68
 
69
69
  scheduler/cjs/scheduler.production.js: