@xenon-device-management/xenon 2.14.0 → 2.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (335) hide show
  1. package/README.md +44 -29
  2. package/lib/package.json +6 -5
  3. package/lib/public/assets/{AnnotationOverlay-B_VNtKBH.js → AnnotationOverlay-2W4JvEyZ.js} +1 -1
  4. package/lib/public/assets/{ApiKeyGate-BwuaMjkX.js → ApiKeyGate-GmckX_7r.js} +1 -1
  5. package/lib/public/assets/DeviceMosaicView-DqODzkyo.js +2 -0
  6. package/lib/public/assets/{EmptyState-BSjhk_IV.js → EmptyState-7hETKEWb.js} +1 -1
  7. package/lib/public/assets/{FieldGroup-Cb5QZsE1.js → FieldGroup-GOgssFEP.js} +1 -1
  8. package/lib/public/assets/{FilterMenu-BAaSlWbW.js → FilterMenu-Yvf6RGMd.js} +1 -1
  9. package/lib/public/assets/{Menu-JGGYrSQQ.js → Menu-KrPnfdsf.js} +1 -1
  10. package/lib/public/assets/{Modal-CFCp3n9d.js → Modal-C6WjZFeI.js} +1 -1
  11. package/lib/public/assets/{RecordingPage-CbJj_EBT.js → RecordingPage-CSRIhZEh.js} +1 -1
  12. package/lib/public/assets/{RecordingsPage-BJeYnygR.js → RecordingsPage-CB8ST3nE.js} +1 -1
  13. package/lib/public/assets/{SegmentedControl-Bg42Atjy.js → SegmentedControl-C9o90KId.js} +1 -1
  14. package/lib/public/assets/{SettingCard-Njz1pUIJ.js → SettingCard-CPm3w9l2.js} +1 -1
  15. package/lib/public/assets/{Table-BcTm5xV2.js → Table-DwIgERRt.js} +1 -1
  16. package/lib/public/assets/{activity-DOVdsfMQ.js → activity-DrLbHifn.js} +1 -1
  17. package/lib/public/assets/ai-settings-DU_Ls06P.js +16 -0
  18. package/lib/public/assets/{api-keys-BKnNSTw9.js → api-keys-CWYdEzJ_.js} +1 -1
  19. package/lib/public/assets/{apps-D0SC6uw6.js → apps-BqNVdln7.js} +1 -1
  20. package/lib/public/assets/{arrow-left-MMbTmgoE.js → arrow-left-BtB0_Jg_.js} +1 -1
  21. package/lib/public/assets/{arrow-right-BMfnGmxW.js → arrow-right-C8NhdtyN.js} +1 -1
  22. package/lib/public/assets/{arrow-up-right-DuAftMWB.js → arrow-up-right-gMg0ffvv.js} +1 -1
  23. package/lib/public/assets/{auth-shell-nZC2JNDO.js → auth-shell-CiYZ3N4M.js} +2 -2
  24. package/lib/public/assets/{builds-page-hDCgTwkS.js → builds-page-EaaqDmLN.js} +1 -1
  25. package/lib/public/assets/{button-Dda4irn_.js → button-DDau4Axv.js} +1 -1
  26. package/lib/public/assets/{calendar-BMr0Q62v.js → calendar-DQ83B1ed.js} +1 -1
  27. package/lib/public/assets/{check-CZ9iw9-e.js → check-K1ovTQam.js} +1 -1
  28. package/lib/public/assets/{chevron-right-BRYJJVC9.js → chevron-right-Biq00pMt.js} +1 -1
  29. package/lib/public/assets/{circle-check-CqAJjQ5O.js → circle-check-CBv88cH7.js} +1 -1
  30. package/lib/public/assets/{circle-x-DlDJtnVz.js → circle-x-Bmltailn.js} +1 -1
  31. package/lib/public/assets/{clock-CpuDKysU.js → clock-BPrld-3h.js} +1 -1
  32. package/lib/public/assets/{copy-CAQydNFe.js → copy-t0QB14JI.js} +1 -1
  33. package/lib/public/assets/derive-UnLRp4r3.js +1 -0
  34. package/lib/public/assets/device-explorer-BgGZ8AvV.js +282 -0
  35. package/lib/public/assets/{download-C9XG6lLv.js → download-BroHxNOh.js} +1 -1
  36. package/lib/public/assets/forgot-password-Bjmf49i6.js +1 -0
  37. package/lib/public/assets/{h264Stream-VQBphYhg.js → h264Stream-DeD__6wa.js} +6 -6
  38. package/lib/public/assets/{index-DJGc1M2f.js → index-72oF89LJ.js} +1 -1
  39. package/lib/public/assets/index-B0JeuZbg.js +15 -0
  40. package/lib/public/assets/index-B0gQkEg0.js +219 -0
  41. package/lib/public/assets/{input-Cm0tmSoc.js → input-DIc4MSC7.js} +1 -1
  42. package/lib/public/assets/{line-chart-D2DyJCml.js → line-chart-BcWm2vW8.js} +1 -1
  43. package/lib/public/assets/{list-checks-UWf1GY99.js → list-checks-B06IJJad.js} +1 -1
  44. package/lib/public/assets/{lock-CCJv9m_I.js → lock-pVLvnN30.js} +1 -1
  45. package/lib/public/assets/{login-f8vOVW-U.js → login-CN77vy--.js} +1 -1
  46. package/lib/public/assets/{maintenance-settings-C1PrkuAH.js → maintenance-settings-CSdzQSkY.js} +1 -1
  47. package/lib/public/assets/{monitor-B2jDgwm7.js → monitor-BtrN5IkI.js} +1 -1
  48. package/lib/public/assets/{mouse-pointer-2-DLI1RtzU.js → mouse-pointer-2-CNsQfo6w.js} +1 -1
  49. package/lib/public/assets/{network-ebT86qoi.js → network-BSfA8ZxG.js} +1 -1
  50. package/lib/public/assets/{overview-C0aykVrd.js → overview-BfTebCK5.js} +1 -1
  51. package/lib/public/assets/{page-header-BjzgWz-T.js → page-header-D8KUX6Qg.js} +1 -1
  52. package/lib/public/assets/{play-DLG9t8FU.js → play-Cvc8xzic.js} +1 -1
  53. package/lib/public/assets/{plus-nBFSMu_X.js → plus-C9Zj84UF.js} +1 -1
  54. package/lib/public/assets/{profile-page-CSl0UYlv.js → profile-page-Bi27STgs.js} +1 -1
  55. package/lib/public/assets/{reset-password-LeOuHqmB.js → reset-password-CPsOuwSu.js} +1 -1
  56. package/lib/public/assets/runbook-page-DEQ-DBOX.js +304 -0
  57. package/lib/public/assets/{select-88jHcl-Z.js → select-BWpnhWXj.js} +1 -1
  58. package/lib/public/assets/{selector-detail-redirect-BbXKJjZM.js → selector-detail-redirect-BefSCSpe.js} +1 -1
  59. package/lib/public/assets/{selector-health-page-B4rA1Xkv.js → selector-health-page-MSk96Zz7.js} +1 -1
  60. package/lib/public/assets/session-detail-page-DPyBNef_.js +4 -0
  61. package/lib/public/assets/{settings-Dep_3kbA.css → settings-K8UHWMdI.css} +1 -1
  62. package/lib/public/assets/{settings-GF6ZMSQ6.js → settings-V6x-cXwy.js} +1 -1
  63. package/lib/public/assets/{stat-tile-BV98e_Sv.js → stat-tile-Duex-GZD.js} +1 -1
  64. package/lib/public/assets/{tablet-BiAsnFDj.js → tablet-BBcoqBmL.js} +1 -1
  65. package/lib/public/assets/{teams-B4-jrr-1.js → teams-ts8p5rEh.js} +1 -1
  66. package/lib/public/assets/{trash-2-C5RSuX0e.js → trash-2-CZ2ew6AZ.js} +1 -1
  67. package/lib/public/assets/{upload-BG7_rMXK.js → upload-Dv99y_le.js} +1 -1
  68. package/lib/public/assets/{use-builds-data-J-riQYyC.js → use-builds-data-DrYC8JCF.js} +1 -1
  69. package/lib/public/assets/{use-password-reset-mode-C8-eH-UG.js → use-password-reset-mode-C7QkBNkP.js} +1 -1
  70. package/lib/public/assets/{users-CFba5TSy.js → users-D7tKMESH.js} +1 -1
  71. package/lib/public/assets/{users-Cp0beJm3.js → users-gJ5Y01yo.js} +1 -1
  72. package/lib/public/assets/{video-off-DDsEISjV.js → video-off-CqZVuZGs.js} +1 -1
  73. package/lib/public/assets/{webhook-settings-BGu32vSB.js → webhook-settings-DI5DSW99.js} +1 -1
  74. package/lib/public/assets/{zap-l4VaXzq8.js → zap-ClcHFxfo.js} +1 -1
  75. package/lib/public/index.html +1 -1
  76. package/lib/schema.json +16 -12
  77. package/lib/src/InternalHttpClient.js +27 -5
  78. package/lib/src/XenonCapabilityManager.js +10 -3
  79. package/lib/src/app/dashboardPluginLink.js +117 -0
  80. package/lib/src/app/index.js +13 -34
  81. package/lib/src/app/openapi/control.yaml +6 -4
  82. package/lib/src/app/openapi/grid.yaml +8 -2
  83. package/lib/src/app/openapi/identity.yaml +103 -31
  84. package/lib/src/app/openapi/platform.yaml +33 -15
  85. package/lib/src/app/openapi/sessions.yaml +12 -3
  86. package/lib/src/app/routers/apikeys.js +14 -2
  87. package/lib/src/app/routers/auth.js +31 -6
  88. package/lib/src/app/routers/control.js +13 -5
  89. package/lib/src/app/routers/dashboard.js +42 -27
  90. package/lib/src/app/routers/grid.js +5 -3
  91. package/lib/src/app/routers/profile.js +21 -0
  92. package/lib/src/app/routers/users.js +12 -6
  93. package/lib/src/app/swagger.js +2 -0
  94. package/lib/src/app/ws/h264StreamWs.js +10 -1
  95. package/lib/src/app/ws/nodeSocketRelay.js +77 -11
  96. package/lib/src/config.js +1 -0
  97. package/lib/src/dashboard/commandLogFields.js +42 -0
  98. package/lib/src/dashboard/commands.js +5 -5
  99. package/lib/src/dashboard/event-manager.js +64 -204
  100. package/lib/src/dashboard/services/failure-analysis-service.js +118 -105
  101. package/lib/src/dashboard/services/failureCategories.js +264 -0
  102. package/lib/src/dashboard/sessionCommandSummary.js +39 -0
  103. package/lib/src/data-service/device-store.js +14 -1
  104. package/lib/src/data-service/prisma-store.js +19 -7
  105. package/lib/src/data-service/web-config-service.js +7 -0
  106. package/lib/src/device-managers/AndroidDeviceManager.js +61 -23
  107. package/lib/src/device-managers/IOSDeviceManager.js +10 -0
  108. package/lib/src/device-managers/android/AndroidH264StreamService.js +69 -20
  109. package/lib/src/device-managers/android/H264Multiplexer.js +38 -4
  110. package/lib/src/device-utils.js +29 -3
  111. package/lib/src/gateway/defaultGateway.js +1 -1
  112. package/lib/src/gateway/forwardToNode.js +6 -11
  113. package/lib/src/gateway/healReport.js +87 -0
  114. package/lib/src/gateway/hubSessionToken.js +27 -4
  115. package/lib/src/gateway/nodeWebDriverUrl.js +3 -5
  116. package/lib/src/gateway/sessionGateway.js +12 -2
  117. package/lib/src/generated/client/edge.js +4 -3
  118. package/lib/src/generated/client/index-browser.js +1 -0
  119. package/lib/src/generated/client/index.d.ts +32 -0
  120. package/lib/src/generated/client/index.js +4 -3
  121. package/lib/src/generated/client/package.json +1 -1
  122. package/lib/src/generated/client/schema.prisma +3 -0
  123. package/lib/src/generated/client/wasm.js +1 -0
  124. package/lib/src/helpers/outboundProxy.js +219 -0
  125. package/lib/src/index.js +21 -0
  126. package/lib/src/interceptors/CommandInterceptor.js +256 -196
  127. package/lib/src/interceptors/xenonScripts.js +28 -7
  128. package/lib/src/logger.js +3 -1
  129. package/lib/src/middleware/authMiddleware.js +15 -3
  130. package/lib/src/middleware/commandCaller.js +3 -3
  131. package/lib/src/middleware/verifyCredential.js +58 -1
  132. package/lib/src/plugin.js +16 -6
  133. package/lib/src/scripts/database-check.js +3 -3
  134. package/lib/src/scripts/initialize-database.js +35 -33
  135. package/lib/src/scripts/run-migrations.js +1079 -27
  136. package/lib/src/services/AICommandService.js +9 -2
  137. package/lib/src/services/AIService.js +192 -42
  138. package/lib/src/services/ApiKeyService.js +16 -5
  139. package/lib/src/services/EmailService.js +29 -0
  140. package/lib/src/services/InterceptorService.js +6 -2
  141. package/lib/src/services/OrphanSweeper.js +8 -0
  142. package/lib/src/services/SelectorStateService.js +11 -7
  143. package/lib/src/services/SelectorVerificationJob.js +21 -6
  144. package/lib/src/services/ServerManager.js +11 -1
  145. package/lib/src/services/SessionLifecycleService.js +118 -44
  146. package/lib/src/services/SocketClient.js +11 -0
  147. package/lib/src/services/SocketServer.js +380 -45
  148. package/lib/src/services/TeamService.js +5 -1
  149. package/lib/src/services/TracingService.js +171 -60
  150. package/lib/src/services/UserService.js +14 -3
  151. package/lib/src/services/UserSessionService.js +16 -4
  152. package/lib/src/services/bug-report/video-slice.js +4 -1
  153. package/lib/src/services/device-access/leaseOverride.js +7 -5
  154. package/lib/src/services/healing/FuzzyXmlHealingProvider.js +51 -0
  155. package/lib/src/services/healing/HealEtalonService.js +3 -2
  156. package/lib/src/services/healing/HealingOrchestrator.js +57 -72
  157. package/lib/src/services/healing/OcrHealingProvider.js +41 -64
  158. package/lib/src/services/healing/ResilioTreeHealingProvider.js +41 -50
  159. package/lib/src/services/healing/VisualAiHealingProvider.js +1 -1
  160. package/lib/src/services/healing/fingerprintIdentity.js +126 -0
  161. package/lib/src/services/healing/resilioPath.js +274 -0
  162. package/lib/src/services/identity/identityChanges.js +41 -0
  163. package/lib/src/services/logcat/SessionDeviceLogs.js +358 -0
  164. package/lib/src/services/logcat/deviceLogBook.js +164 -0
  165. package/lib/src/services/logcat/iosDriverLog.js +178 -0
  166. package/lib/src/services/ocr/ocrData.js +118 -0
  167. package/lib/src/services/ocr/vendor/LICENSE-tessdata.txt +202 -0
  168. package/lib/src/services/ocr/vendor/eng.traineddata.gz +0 -0
  169. package/lib/src/services/omni-vision/OmniVisionService.js +83 -56
  170. package/lib/src/services/passwordResetLink.js +50 -9
  171. package/lib/src/services/passwordResetMode.js +3 -1
  172. package/lib/src/services/publicUrl.js +45 -0
  173. package/lib/src/services/selector-health/SelectorVisibilityResolver.js +121 -0
  174. package/lib/src/services/session/sessionIdentity.js +5 -3
  175. package/lib/src/services/session/shutdownReason.js +26 -0
  176. package/lib/src/services/settings/aiEngineSettings.js +219 -0
  177. package/lib/src/services/token/JwtKeyService.js +8 -2
  178. package/lib/src/services/token/mcpTokenTtl.js +27 -0
  179. package/lib/src/services/token/mintedLifetime.js +51 -0
  180. package/lib/src/sessions/LocalSession.js +29 -1
  181. package/lib/src/sessions/RemoteSession.js +12 -2
  182. package/lib/src/sessions/SessionManager.js +4 -1
  183. package/lib/src/sessions/sessionMemory.js +25 -0
  184. package/lib/test/helpers/driver-log.js +38 -0
  185. package/lib/test/helpers/fake-ai-provider.js +188 -0
  186. package/lib/test/helpers/fake-http-proxy.js +106 -0
  187. package/lib/test/helpers/loki-stores.js +33 -0
  188. package/lib/test/helpers/otlp-probe.js +107 -0
  189. package/lib/test/helpers/page-sources.js +164 -0
  190. package/lib/test/helpers/scratch-database.js +57 -13
  191. package/lib/test/integration/androidDevices.spec.js +1 -1
  192. package/lib/test/integration/audit-ingest.spec.js +10 -10
  193. package/lib/test/integration/auth-flow.spec.js +9 -14
  194. package/lib/test/integration/auth-rate-limit.spec.js +6 -3
  195. package/lib/test/integration/bug-report-route.spec.js +22 -2
  196. package/lib/test/integration/forgot-password-rate-limit.spec.js +6 -3
  197. package/lib/test/integration/forgot-password.spec.js +17 -18
  198. package/lib/test/integration/ios/01iOSSimulator.spec.js +1 -1
  199. package/lib/test/integration/ios/02iOSDevices.spec.js +1 -1
  200. package/lib/test/integration/legacy-deprecation-headers.spec.js +5 -2
  201. package/lib/test/integration/migration.spec.js +6 -1
  202. package/lib/test/integration/node-pair-auth-rest.spec.js +5 -9
  203. package/lib/test/integration/ports-router.spec.js +4 -4
  204. package/lib/test/integration/prisma-device-store-add-devices.spec.js +2 -3
  205. package/lib/test/integration/prisma-device-store-team-filter.spec.js +2 -5
  206. package/lib/test/integration/profile-tokens.spec.js +10 -16
  207. package/lib/test/integration/recordings-router.spec.js +16 -16
  208. package/lib/test/integration/reset-revokes-sessions.spec.js +4 -9
  209. package/lib/test/integration/role-matrix.spec.js +4 -9
  210. package/lib/test/integration/sdk-leases-router.spec.js +9 -9
  211. package/lib/test/integration/sdk-version.spec.js +2 -2
  212. package/lib/test/integration/selector-health-endpoint.spec.js +5 -5
  213. package/lib/test/integration/selector-state-flow.spec.js +5 -5
  214. package/lib/test/integration/team-membership-migration.spec.js +73 -12
  215. package/lib/test/integration/team-visibility-apps.spec.js +15 -22
  216. package/lib/test/integration/team-visibility-control.spec.js +96 -69
  217. package/lib/test/integration/team-visibility-dashboard.spec.js +7 -23
  218. package/lib/test/integration/team-visibility-grid.spec.js +16 -15
  219. package/lib/test/integration/team-visibility-leases.spec.js +8 -11
  220. package/lib/test/integration/team-visibility-recordings.spec.js +6 -19
  221. package/lib/test/integration/team-visibility-sessions.spec.js +6 -19
  222. package/lib/test/integration/users-flow.spec.js +7 -12
  223. package/lib/test/integration/users-lockout.spec.js +5 -3
  224. package/lib/test/unit/EmailService.test.js +66 -0
  225. package/lib/test/unit/ResilioTreeHealingProvider.test.js +46 -19
  226. package/lib/test/unit/XenonCapabilityManager.spec.js +23 -0
  227. package/lib/test/unit/ai-call-time-limit.spec.js +130 -0
  228. package/lib/test/unit/ai-engine-settings.spec.js +338 -0
  229. package/lib/test/unit/ai-provider-switch.spec.js +130 -0
  230. package/lib/test/unit/ai-rate-limit.spec.js +126 -0
  231. package/lib/test/unit/android-adb-retry.spec.js +112 -0
  232. package/lib/test/unit/android-h264-viewers.spec.js +272 -0
  233. package/lib/test/unit/android-preview-hold.spec.js +3 -2
  234. package/lib/test/unit/apikeys-router.spec.js +84 -0
  235. package/lib/test/unit/authMiddleware.bearer.spec.js +9 -0
  236. package/lib/test/unit/authMiddleware.credentialLifetime.spec.js +149 -0
  237. package/lib/test/unit/bug-report/video-slice.spec.js +19 -0
  238. package/lib/test/unit/command-log-network-capture.spec.js +191 -0
  239. package/lib/test/unit/dashboard-events-device-logs.spec.js +255 -0
  240. package/lib/test/unit/dashboard-events-team-scope.spec.js +6 -3
  241. package/lib/test/unit/dashboard-plugin-link.spec.js +213 -0
  242. package/lib/test/unit/database-check.spec.js +1 -0
  243. package/lib/test/unit/device-log-book.spec.js +180 -0
  244. package/lib/test/unit/device-utils.spec.js +13 -4
  245. package/lib/test/unit/enable-dashboard-option.spec.js +57 -0
  246. package/lib/test/unit/event-log-session-data.spec.js +251 -0
  247. package/lib/test/unit/failure-analysis.spec.js +196 -0
  248. package/lib/test/unit/failure-categories.spec.js +130 -0
  249. package/lib/test/unit/failure-categorization.spec.js +393 -0
  250. package/lib/test/unit/fingerprint-identity.spec.js +433 -0
  251. package/lib/test/unit/h264-multiplexer.spec.js +46 -0
  252. package/lib/test/unit/heal-report.spec.js +71 -0
  253. package/lib/test/unit/healing-instrumentation.spec.js +6 -1
  254. package/lib/test/unit/healing-tier-gate.spec.js +74 -29
  255. package/lib/test/unit/healing-tiers-every-session.spec.js +219 -0
  256. package/lib/test/unit/hub-node-gateway-appium-server.spec.js +243 -1
  257. package/lib/test/unit/interceptor-visual-elements.spec.js +192 -0
  258. package/lib/test/unit/ios-driver-log.spec.js +168 -0
  259. package/lib/test/unit/ios-simulator-session-readiness.spec.js +187 -0
  260. package/lib/test/unit/ios-simulator-session-teardown.spec.js +158 -0
  261. package/lib/test/unit/lease/lease-override.spec.js +23 -6
  262. package/lib/test/unit/lease/session-lease-proof.spec.js +16 -4
  263. package/lib/test/unit/logcat-ws.spec.js +78 -37
  264. package/lib/test/unit/logger-json-levels.spec.js +44 -0
  265. package/lib/test/unit/mcp-token-ttl.spec.js +38 -0
  266. package/lib/test/unit/observability-example-loki.spec.js +25 -0
  267. package/lib/test/unit/ocr-healing-tier-real-ocr.spec.js +113 -0
  268. package/lib/test/unit/ocr-healing-tier.spec.js +122 -0
  269. package/lib/test/unit/ocr-offline.spec.js +213 -0
  270. package/lib/test/unit/omni-virtual-element-store.spec.js +301 -0
  271. package/lib/test/unit/omni-vision-ios-points.spec.js +0 -2
  272. package/lib/test/unit/omni-vision.spec.js +5 -7
  273. package/lib/test/unit/openapi-for-site.spec.js +80 -0
  274. package/lib/test/unit/outbound-proxy.spec.js +320 -0
  275. package/lib/test/unit/package-engines.spec.js +27 -0
  276. package/lib/test/unit/passwordResetMode.test.js +10 -2
  277. package/lib/test/unit/port-exhaustion.spec.js +2 -1
  278. package/lib/test/unit/profile-router.test.js +122 -1
  279. package/lib/test/unit/proxy-option.spec.js +358 -0
  280. package/lib/test/unit/queue-requester.spec.js +1 -1
  281. package/lib/test/unit/reset-link-address.spec.js +266 -0
  282. package/lib/test/unit/reset-link.test.js +10 -4
  283. package/lib/test/unit/resilio-path-healing.spec.js +270 -0
  284. package/lib/test/unit/run-migrations-database.spec.js +807 -0
  285. package/lib/test/unit/run-migrations-fail-fast.test.js +41 -27
  286. package/lib/test/unit/run-migrations.test.js +864 -0
  287. package/lib/test/unit/selector-health-actions.spec.js +3 -1
  288. package/lib/test/unit/selector-learning-every-session.spec.js +179 -0
  289. package/lib/test/unit/selector-state-service.spec.js +72 -23
  290. package/lib/test/unit/selector-verification-clean-build.spec.js +130 -0
  291. package/lib/test/unit/selector-verification-job.spec.js +28 -19
  292. package/lib/test/unit/selector-verification-missed-regression.spec.js +2 -2
  293. package/lib/test/unit/selector-visibility-resolver.spec.js +209 -0
  294. package/lib/test/unit/self-healing-boot.spec.js +10 -5
  295. package/lib/test/unit/self-healing-setting.spec.js +7 -6
  296. package/lib/test/unit/session-app-resolution.spec.js +5 -1
  297. package/lib/test/unit/session-attribution-wiring.spec.js +41 -13
  298. package/lib/test/unit/session-create-credential-owner.spec.js +242 -0
  299. package/lib/test/unit/session-credential-strip.spec.js +1 -1
  300. package/lib/test/unit/session-device-logs-ios.spec.js +180 -0
  301. package/lib/test/unit/session-device-logs.spec.js +356 -0
  302. package/lib/test/unit/session-end-failure-analysis.spec.js +133 -0
  303. package/lib/test/unit/session-log-indexes.spec.js +64 -3
  304. package/lib/test/unit/socket-team-scope.integration.spec.js +749 -0
  305. package/lib/test/unit/socketServer.scopedEmit.spec.js +237 -5
  306. package/lib/test/unit/socketServer.sessionCookie.spec.js +2 -1
  307. package/lib/test/unit/stream-start-pipelines.spec.js +72 -18
  308. package/lib/test/unit/token-mint-limits.spec.js +165 -0
  309. package/lib/test/unit/tracing-export-routing.spec.js +137 -0
  310. package/lib/test/unit/tracing-session-spans.spec.js +337 -0
  311. package/lib/test/unit/unexpected-shutdown-reason.spec.js +163 -0
  312. package/lib/test/unit/verify-credential.spec.js +33 -0
  313. package/lib/test/unit/vision-assertion.spec.js +3 -2
  314. package/lib/test/unit/web-config-service.spec.js +19 -0
  315. package/lib/tsconfig.tsbuildinfo +1 -1
  316. package/package.json +6 -5
  317. package/prisma/migrations/20261004174413_locator_etalon_path/migration.sql +2 -0
  318. package/prisma/schema.prisma +3 -0
  319. package/schema.json +16 -12
  320. package/scripts/dev/readme-screenshots.js +276 -23
  321. package/scripts/dev/screenshot-fixtures/logcat.js +157 -0
  322. package/scripts/dev/screenshot-fixtures/phone-screen.html +469 -0
  323. package/scripts/dev/screenshot-fixtures/session.js +242 -0
  324. package/scripts/export-openapi.js +32 -0
  325. package/scripts/lib/openapi-for-site.js +79 -0
  326. package/lib/public/assets/BugReportButton-BAt0_pzq.js +0 -15
  327. package/lib/public/assets/DeviceMosaicView-BYaQHhTf.js +0 -2
  328. package/lib/public/assets/ai-settings-CsuJroRf.js +0 -21
  329. package/lib/public/assets/device-explorer-CdO6_nrn.js +0 -282
  330. package/lib/public/assets/forgot-password-CGnkRgE9.js +0 -1
  331. package/lib/public/assets/index-BbKEXUFH.js +0 -219
  332. package/lib/public/assets/runbook-page-CMMeQml9.js +0 -124
  333. package/lib/public/assets/session-detail-page-COL_RZxw.js +0 -4
  334. package/lib/src/scripts/prepare-prisma.js +0 -89
  335. /package/lib/public/assets/{BugReportButton-CPBjfiv4.css → index-CPBjfiv4.css} +0 -0
@@ -1,124 +0,0 @@
1
- import{J as Me,R as Ie,i as Ir,u as Tr,j as J,K as Or}from"./index-BbKEXUFH.js";import{A as vr}from"./arrow-left-MMbTmgoE.js";const qn=["http","https","mailto","tel"];function Lr(e){const n=(e||"").trim(),t=n.charAt(0);if(t==="#"||t==="/")return n;const r=n.indexOf(":");if(r===-1)return n;let i=-1;for(;++i<qn.length;){const l=qn[i];if(r===l.length&&n.slice(0,l.length).toLowerCase()===l)return n}return i=n.indexOf("?"),i!==-1&&r>i||(i=n.indexOf("#"),i!==-1&&r>i)?n:"javascript:void(0)"}/*!
2
- * Determine if an object is a Buffer
3
- *
4
- * @author Feross Aboukhadijeh <https://feross.org>
5
- * @license MIT
6
- */var Dr=function(n){return n!=null&&n.constructor!=null&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)};const Lt=Me(Dr);function Re(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?$n(e.position):"start"in e||"end"in e?$n(e):"line"in e||"column"in e?xn(e):""}function xn(e){return Wn(e&&e.line)+":"+Wn(e&&e.column)}function $n(e){return xn(e&&e.start)+"-"+xn(e&&e.end)}function Wn(e){return e&&typeof e=="number"?e:1}class ie extends Error{constructor(n,t,r){const i=[null,null];let l={start:{line:null,column:null},end:{line:null,column:null}};if(super(),typeof t=="string"&&(r=t,t=void 0),typeof r=="string"){const o=r.indexOf(":");o===-1?i[1]=r:(i[0]=r.slice(0,o),i[1]=r.slice(o+1))}t&&("type"in t||"position"in t?t.position&&(l=t.position):"start"in t||"end"in t?l=t:("line"in t||"column"in t)&&(l.start=t)),this.name=Re(t)||"1:1",this.message=typeof n=="object"?n.message:n,this.stack="",typeof n=="object"&&n.stack&&(this.stack=n.stack),this.reason=this.message,this.fatal,this.line=l.start.line,this.column=l.start.column,this.position=l,this.source=i[0],this.ruleId=i[1],this.file,this.actual,this.expected,this.url,this.note}}ie.prototype.file="";ie.prototype.name="";ie.prototype.reason="";ie.prototype.message="";ie.prototype.stack="";ie.prototype.fatal=null;ie.prototype.column=null;ie.prototype.line=null;ie.prototype.source=null;ie.prototype.ruleId=null;ie.prototype.position=null;const pe={basename:zr,dirname:Br,extname:Rr,join:Nr,sep:"/"};function zr(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');_e(e);let t=0,r=-1,i=e.length,l;if(n===void 0||n.length===0||n.length>e.length){for(;i--;)if(e.charCodeAt(i)===47){if(l){t=i+1;break}}else r<0&&(l=!0,r=i+1);return r<0?"":e.slice(t,r)}if(n===e)return"";let o=-1,u=n.length-1;for(;i--;)if(e.charCodeAt(i)===47){if(l){t=i+1;break}}else o<0&&(l=!0,o=i+1),u>-1&&(e.charCodeAt(i)===n.charCodeAt(u--)?u<0&&(r=i):(u=-1,r=o));return t===r?r=o:r<0&&(r=e.length),e.slice(t,r)}function Br(e){if(_e(e),e.length===0)return".";let n=-1,t=e.length,r;for(;--t;)if(e.charCodeAt(t)===47){if(r){n=t;break}}else r||(r=!0);return n<0?e.charCodeAt(0)===47?"/":".":n===1&&e.charCodeAt(0)===47?"//":e.slice(0,n)}function Rr(e){_e(e);let n=e.length,t=-1,r=0,i=-1,l=0,o;for(;n--;){const u=e.charCodeAt(n);if(u===47){if(o){r=n+1;break}continue}t<0&&(o=!0,t=n+1),u===46?i<0?i=n:l!==1&&(l=1):i>-1&&(l=-1)}return i<0||t<0||l===0||l===1&&i===t-1&&i===r+1?"":e.slice(i,t)}function Nr(...e){let n=-1,t;for(;++n<e.length;)_e(e[n]),e[n]&&(t=t===void 0?e[n]:t+"/"+e[n]);return t===void 0?".":Mr(t)}function Mr(e){_e(e);const n=e.charCodeAt(0)===47;let t=_r(e,!n);return t.length===0&&!n&&(t="."),t.length>0&&e.charCodeAt(e.length-1)===47&&(t+="/"),n?"/"+t:t}function _r(e,n){let t="",r=0,i=-1,l=0,o=-1,u,s;for(;++o<=e.length;){if(o<e.length)u=e.charCodeAt(o);else{if(u===47)break;u=47}if(u===47){if(!(i===o-1||l===1))if(i!==o-1&&l===2){if(t.length<2||r!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){if(s=t.lastIndexOf("/"),s!==t.length-1){s<0?(t="",r=0):(t=t.slice(0,s),r=t.length-1-t.lastIndexOf("/")),i=o,l=0;continue}}else if(t.length>0){t="",r=0,i=o,l=0;continue}}n&&(t=t.length>0?t+"/..":"..",r=2)}else t.length>0?t+="/"+e.slice(i+1,o):t=e.slice(i+1,o),r=o-i-1;i=o,l=0}else u===46&&l>-1?l++:l=-1}return t}function _e(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const jr={cwd:Hr};function Hr(){return"/"}function kn(e){return e!==null&&typeof e=="object"&&e.href&&e.origin}function Ur(e){if(typeof e=="string")e=new URL(e);else if(!kn(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return Vr(e)}function Vr(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const n=e.pathname;let t=-1;for(;++t<n.length;)if(n.charCodeAt(t)===37&&n.charCodeAt(t+1)===50){const r=n.charCodeAt(t+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(n)}const un=["history","path","basename","stem","extname","dirname"];class Dt{constructor(n){let t;n?typeof n=="string"||qr(n)?t={value:n}:kn(n)?t={path:n}:t=n:t={},this.data={},this.messages=[],this.history=[],this.cwd=jr.cwd(),this.value,this.stored,this.result,this.map;let r=-1;for(;++r<un.length;){const l=un[r];l in t&&t[l]!==void 0&&t[l]!==null&&(this[l]=l==="history"?[...t[l]]:t[l])}let i;for(i in t)un.includes(i)||(this[i]=t[i])}get path(){return this.history[this.history.length-1]}set path(n){kn(n)&&(n=Ur(n)),sn(n,"path"),this.path!==n&&this.history.push(n)}get dirname(){return typeof this.path=="string"?pe.dirname(this.path):void 0}set dirname(n){Qn(this.basename,"dirname"),this.path=pe.join(n||"",this.basename)}get basename(){return typeof this.path=="string"?pe.basename(this.path):void 0}set basename(n){sn(n,"basename"),an(n,"basename"),this.path=pe.join(this.dirname||"",n)}get extname(){return typeof this.path=="string"?pe.extname(this.path):void 0}set extname(n){if(an(n,"extname"),Qn(this.dirname,"extname"),n){if(n.charCodeAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=pe.join(this.dirname,this.stem+(n||""))}get stem(){return typeof this.path=="string"?pe.basename(this.path,this.extname):void 0}set stem(n){sn(n,"stem"),an(n,"stem"),this.path=pe.join(this.dirname||"",n+(this.extname||""))}toString(n){return(this.value||"").toString(n||void 0)}message(n,t,r){const i=new ie(n,t,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}info(n,t,r){const i=this.message(n,t,r);return i.fatal=null,i}fail(n,t,r){const i=this.message(n,t,r);throw i.fatal=!0,i}}function an(e,n){if(e&&e.includes(pe.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+pe.sep+"`")}function sn(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function Qn(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function qr(e){return Lt(e)}function Xn(e){if(e)throw e}var Ve=Object.prototype.hasOwnProperty,zt=Object.prototype.toString,Yn=Object.defineProperty,Kn=Object.getOwnPropertyDescriptor,Gn=function(n){return typeof Array.isArray=="function"?Array.isArray(n):zt.call(n)==="[object Array]"},Zn=function(n){if(!n||zt.call(n)!=="[object Object]")return!1;var t=Ve.call(n,"constructor"),r=n.constructor&&n.constructor.prototype&&Ve.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!t&&!r)return!1;var i;for(i in n);return typeof i>"u"||Ve.call(n,i)},Jn=function(n,t){Yn&&t.name==="__proto__"?Yn(n,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):n[t.name]=t.newValue},et=function(n,t){if(t==="__proto__")if(Ve.call(n,t)){if(Kn)return Kn(n,t).value}else return;return n[t]},$r=function e(){var n,t,r,i,l,o,u=arguments[0],s=1,a=arguments.length,c=!1;for(typeof u=="boolean"&&(c=u,u=arguments[1]||{},s=2),(u==null||typeof u!="object"&&typeof u!="function")&&(u={});s<a;++s)if(n=arguments[s],n!=null)for(t in n)r=et(u,t),i=et(n,t),u!==i&&(c&&i&&(Zn(i)||(l=Gn(i)))?(l?(l=!1,o=r&&Gn(r)?r:[]):o=r&&Zn(r)?r:{},Jn(u,{name:t,newValue:e(c,o,i)})):typeof i<"u"&&Jn(u,{name:t,newValue:i}));return u};const nt=Me($r);function bn(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Wr(){const e=[],n={run:t,use:r};return n;function t(...i){let l=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);u(null,...i);function u(s,...a){const c=e[++l];let m=-1;if(s){o(s);return}for(;++m<i.length;)(a[m]===null||a[m]===void 0)&&(a[m]=i[m]);i=a,c?Qr(c,u)(...a):o(null,...a)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),n}}function Qr(e,n){let t;return r;function r(...o){const u=e.length>o.length;let s;u&&o.push(i);try{s=e.apply(this,o)}catch(a){const c=a;if(u&&t)throw c;return i(c)}u||(s&&s.then&&typeof s.then=="function"?s.then(l,i):s instanceof Error?i(s):l(s))}function i(o,...u){t||(t=!0,n(o,...u))}function l(o){i(null,o)}}const Xr=Rt().freeze(),Bt={}.hasOwnProperty;function Rt(){const e=Wr(),n=[];let t={},r,i=-1;return l.data=o,l.Parser=void 0,l.Compiler=void 0,l.freeze=u,l.attachers=n,l.use=s,l.parse=a,l.stringify=c,l.run=m,l.runSync=d,l.process=f,l.processSync=w,l;function l(){const x=Rt();let C=-1;for(;++C<n.length;)x.use(...n[C]);return x.data(nt(!0,{},t)),x}function o(x,C){return typeof x=="string"?arguments.length===2?(fn("data",r),t[x]=C,l):Bt.call(t,x)&&t[x]||null:x?(fn("data",r),t=x,l):t}function u(){if(r)return l;for(;++i<n.length;){const[x,...C]=n[i];if(C[0]===!1)continue;C[0]===!0&&(C[0]=void 0);const k=x.call(l,...C);typeof k=="function"&&e.use(k)}return r=!0,i=Number.POSITIVE_INFINITY,l}function s(x,...C){let k;if(fn("use",r),x!=null)if(typeof x=="function")B(x,...C);else if(typeof x=="object")Array.isArray(x)?z(x):E(x);else throw new TypeError("Expected usable value, not `"+x+"`");return k&&(t.settings=Object.assign(t.settings||{},k)),l;function L(g){if(typeof g=="function")B(g);else if(typeof g=="object")if(Array.isArray(g)){const[P,...D]=g;B(P,...D)}else E(g);else throw new TypeError("Expected usable value, not `"+g+"`")}function E(g){z(g.plugins),g.settings&&(k=Object.assign(k||{},g.settings))}function z(g){let P=-1;if(g!=null)if(Array.isArray(g))for(;++P<g.length;){const D=g[P];L(D)}else throw new TypeError("Expected a list of plugins, not `"+g+"`")}function B(g,P){let D=-1,M;for(;++D<n.length;)if(n[D][0]===g){M=n[D];break}M?(bn(M[1])&&bn(P)&&(P=nt(!0,M[1],P)),M[1]=P):n.push([...arguments])}}function a(x){l.freeze();const C=Be(x),k=l.Parser;return cn("parse",k),tt(k,"parse")?new k(String(C),C).parse():k(String(C),C)}function c(x,C){l.freeze();const k=Be(C),L=l.Compiler;return pn("stringify",L),rt(x),tt(L,"compile")?new L(x,k).compile():L(x,k)}function m(x,C,k){if(rt(x),l.freeze(),!k&&typeof C=="function"&&(k=C,C=void 0),!k)return new Promise(L);L(null,k);function L(E,z){e.run(x,Be(C),B);function B(g,P,D){P=P||x,g?z(g):E?E(P):k(null,P,D)}}}function d(x,C){let k,L;return l.run(x,C,E),it("runSync","run",L),k;function E(z,B){Xn(z),k=B,L=!0}}function f(x,C){if(l.freeze(),cn("process",l.Parser),pn("process",l.Compiler),!C)return new Promise(k);k(null,C);function k(L,E){const z=Be(x);l.run(l.parse(z),z,(g,P,D)=>{if(g||!P||!D)B(g);else{const M=l.stringify(P,D);M==null||(Gr(M)?D.value=M:D.result=M),B(g,D)}});function B(g,P){g||!P?E(g):L?L(P):C(null,P)}}}function w(x){let C;l.freeze(),cn("processSync",l.Parser),pn("processSync",l.Compiler);const k=Be(x);return l.process(k,L),it("processSync","process",C),k;function L(E){C=!0,Xn(E)}}}function tt(e,n){return typeof e=="function"&&e.prototype&&(Yr(e.prototype)||n in e.prototype)}function Yr(e){let n;for(n in e)if(Bt.call(e,n))return!0;return!1}function cn(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `Parser`")}function pn(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `Compiler`")}function fn(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function rt(e){if(!bn(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function it(e,n,t){if(!t)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function Be(e){return Kr(e)?e:new Dt(e)}function Kr(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Gr(e){return typeof e=="string"||Lt(e)}const Zr={};function Jr(e,n){const t=Zr,r=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,i=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return Nt(e,r,i)}function Nt(e,n,t){if(ei(e)){if("value"in e)return e.type==="html"&&!t?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return lt(e.children,n,t)}return Array.isArray(e)?lt(e,n,t):""}function lt(e,n,t){const r=[];let i=-1;for(;++i<e.length;)r[i]=Nt(e[i],n,t);return r.join("")}function ei(e){return!!(e&&typeof e=="object")}function he(e,n,t,r){const i=e.length;let l=0,o;if(n<0?n=-n>i?0:i+n:n=n>i?i:n,t=t>0?t:0,r.length<1e4)o=Array.from(r),o.unshift(n,t),e.splice(...o);else for(t&&e.splice(n,t);l<r.length;)o=r.slice(l,l+1e4),o.unshift(n,0),e.splice(...o),l+=1e4,n+=1e4}function re(e,n){return e.length>0?(he(e,e.length,0,n),e):n}const ot={}.hasOwnProperty;function ni(e){const n={};let t=-1;for(;++t<e.length;)ti(n,e[t]);return n}function ti(e,n){let t;for(t in n){const i=(ot.call(e,t)?e[t]:void 0)||(e[t]={}),l=n[t];let o;if(l)for(o in l){ot.call(i,o)||(i[o]=[]);const u=l[o];ri(i[o],Array.isArray(u)?u:u?[u]:[])}}}function ri(e,n){let t=-1;const r=[];for(;++t<n.length;)(n[t].add==="after"?e:r).push(n[t]);he(e,0,0,r)}const ii=/[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/,fe=we(/[A-Za-z]/),te=we(/[\dA-Za-z]/),li=we(/[#-'*+\--9=?A-Z^-~]/);function wn(e){return e!==null&&(e<32||e===127)}const Sn=we(/\d/),oi=we(/[\dA-Fa-f]/),ui=we(/[!-/:-@[-`{-~]/);function T(e){return e!==null&&e<-2}function ee(e){return e!==null&&(e<0||e===32)}function N(e){return e===-2||e===-1||e===32}const ai=we(ii),si=we(/\s/);function we(e){return n;function n(t){return t!==null&&e.test(String.fromCharCode(t))}}function V(e,n,t,r){const i=r?r-1:Number.POSITIVE_INFINITY;let l=0;return o;function o(s){return N(s)?(e.enter(t),u(s)):n(s)}function u(s){return N(s)&&l++<i?(e.consume(s),u):(e.exit(t),n(s))}}const ci={tokenize:pi};function pi(e){const n=e.attempt(this.parser.constructs.contentInitial,r,i);let t;return n;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),V(e,n,"linePrefix")}function i(u){return e.enter("paragraph"),l(u)}function l(u){const s=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=s),t=s,o(u)}function o(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return T(u)?(e.consume(u),e.exit("chunkText"),l):(e.consume(u),o)}}const fi={tokenize:hi},ut={tokenize:mi};function hi(e){const n=this,t=[];let r=0,i,l,o;return u;function u(E){if(r<t.length){const z=t[r];return n.containerState=z[1],e.attempt(z[0].continuation,s,a)(E)}return a(E)}function s(E){if(r++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,i&&L();const z=n.events.length;let B=z,g;for(;B--;)if(n.events[B][0]==="exit"&&n.events[B][1].type==="chunkFlow"){g=n.events[B][1].end;break}k(r);let P=z;for(;P<n.events.length;)n.events[P][1].end=Object.assign({},g),P++;return he(n.events,B+1,0,n.events.slice(z)),n.events.length=P,a(E)}return u(E)}function a(E){if(r===t.length){if(!i)return d(E);if(i.currentConstruct&&i.currentConstruct.concrete)return w(E);n.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(ut,c,m)(E)}function c(E){return i&&L(),k(r),d(E)}function m(E){return n.parser.lazy[n.now().line]=r!==t.length,o=n.now().offset,w(E)}function d(E){return n.containerState={},e.attempt(ut,f,w)(E)}function f(E){return r++,t.push([n.currentConstruct,n.containerState]),d(E)}function w(E){if(E===null){i&&L(),k(0),e.consume(E);return}return i=i||n.parser.flow(n.now()),e.enter("chunkFlow",{contentType:"flow",previous:l,_tokenizer:i}),x(E)}function x(E){if(E===null){C(e.exit("chunkFlow"),!0),k(0),e.consume(E);return}return T(E)?(e.consume(E),C(e.exit("chunkFlow")),r=0,n.interrupt=void 0,u):(e.consume(E),x)}function C(E,z){const B=n.sliceStream(E);if(z&&B.push(null),E.previous=l,l&&(l.next=E),l=E,i.defineSkip(E.start),i.write(B),n.parser.lazy[E.start.line]){let g=i.events.length;for(;g--;)if(i.events[g][1].start.offset<o&&(!i.events[g][1].end||i.events[g][1].end.offset>o))return;const P=n.events.length;let D=P,M,X;for(;D--;)if(n.events[D][0]==="exit"&&n.events[D][1].type==="chunkFlow"){if(M){X=n.events[D][1].end;break}M=!0}for(k(r),g=P;g<n.events.length;)n.events[g][1].end=Object.assign({},X),g++;he(n.events,D+1,0,n.events.slice(P)),n.events.length=g}}function k(E){let z=t.length;for(;z-- >E;){const B=t[z];n.containerState=B[1],B[0].exit.call(n,e)}t.length=E}function L(){i.write([null]),l=void 0,i=void 0,n.containerState._closeFlow=void 0}}function mi(e,n,t){return V(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function at(e){if(e===null||ee(e)||si(e))return 1;if(ai(e))return 2}function Pn(e,n,t){const r=[];let i=-1;for(;++i<e.length;){const l=e[i].resolveAll;l&&!r.includes(l)&&(n=l(n,t),r.push(l))}return n}const Cn={name:"attention",tokenize:gi,resolveAll:di};function di(e,n){let t=-1,r,i,l,o,u,s,a,c;for(;++t<e.length;)if(e[t][0]==="enter"&&e[t][1].type==="attentionSequence"&&e[t][1]._close){for(r=t;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&n.sliceSerialize(e[r][1]).charCodeAt(0)===n.sliceSerialize(e[t][1]).charCodeAt(0)){if((e[r][1]._close||e[t][1]._open)&&(e[t][1].end.offset-e[t][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[t][1].end.offset-e[t][1].start.offset)%3))continue;s=e[r][1].end.offset-e[r][1].start.offset>1&&e[t][1].end.offset-e[t][1].start.offset>1?2:1;const m=Object.assign({},e[r][1].end),d=Object.assign({},e[t][1].start);st(m,-s),st(d,s),o={type:s>1?"strongSequence":"emphasisSequence",start:m,end:Object.assign({},e[r][1].end)},u={type:s>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[t][1].start),end:d},l={type:s>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[t][1].start)},i={type:s>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},u.end)},e[r][1].end=Object.assign({},o.start),e[t][1].start=Object.assign({},u.end),a=[],e[r][1].end.offset-e[r][1].start.offset&&(a=re(a,[["enter",e[r][1],n],["exit",e[r][1],n]])),a=re(a,[["enter",i,n],["enter",o,n],["exit",o,n],["enter",l,n]]),a=re(a,Pn(n.parser.constructs.insideSpan.null,e.slice(r+1,t),n)),a=re(a,[["exit",l,n],["enter",u,n],["exit",u,n],["exit",i,n]]),e[t][1].end.offset-e[t][1].start.offset?(c=2,a=re(a,[["enter",e[t][1],n],["exit",e[t][1],n]])):c=0,he(e,r-1,t-r+3,a),t=r+a.length-c-2;break}}for(t=-1;++t<e.length;)e[t][1].type==="attentionSequence"&&(e[t][1].type="data");return e}function gi(e,n){const t=this.parser.constructs.attentionMarkers.null,r=this.previous,i=at(r);let l;return o;function o(s){return l=s,e.enter("attentionSequence"),u(s)}function u(s){if(s===l)return e.consume(s),u;const a=e.exit("attentionSequence"),c=at(s),m=!c||c===2&&i||t.includes(s),d=!i||i===2&&c||t.includes(r);return a._open=!!(l===42?m:m&&(i||!d)),a._close=!!(l===42?d:d&&(c||!m)),n(s)}}function st(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const yi={name:"autolink",tokenize:xi};function xi(e,n,t){let r=0;return i;function i(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(f){return fe(f)?(e.consume(f),o):a(f)}function o(f){return f===43||f===45||f===46||te(f)?(r=1,u(f)):a(f)}function u(f){return f===58?(e.consume(f),r=0,s):(f===43||f===45||f===46||te(f))&&r++<32?(e.consume(f),u):(r=0,a(f))}function s(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),n):f===null||f===32||f===60||wn(f)?t(f):(e.consume(f),s)}function a(f){return f===64?(e.consume(f),c):li(f)?(e.consume(f),a):t(f)}function c(f){return te(f)?m(f):t(f)}function m(f){return f===46?(e.consume(f),r=0,c):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),n):d(f)}function d(f){if((f===45||te(f))&&r++<63){const w=f===45?d:m;return e.consume(f),w}return t(f)}}const We={tokenize:ki,partial:!0};function ki(e,n,t){return r;function r(l){return N(l)?V(e,i,"linePrefix")(l):i(l)}function i(l){return l===null||T(l)?n(l):t(l)}}const Mt={name:"blockQuote",tokenize:bi,continuation:{tokenize:wi},exit:Si};function bi(e,n,t){const r=this;return i;function i(o){if(o===62){const u=r.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),l}return t(o)}function l(o){return N(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(o))}}function wi(e,n,t){const r=this;return i;function i(o){return N(o)?V(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):l(o)}function l(o){return e.attempt(Mt,n,t)(o)}}function Si(e){e.exit("blockQuote")}const _t={name:"characterEscape",tokenize:Ci};function Ci(e,n,t){return r;function r(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),i}function i(l){return ui(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):t(l)}}const ct=document.createElement("i");function In(e){const n="&"+e+";";ct.innerHTML=n;const t=ct.textContent;return t.charCodeAt(t.length-1)===59&&e!=="semi"||t===n?!1:t}const jt={name:"characterReference",tokenize:Ei};function Ei(e,n,t){const r=this;let i=0,l,o;return u;function u(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),s}function s(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),a):(e.enter("characterReferenceValue"),l=31,o=te,c(m))}function a(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,o=oi,c):(e.enter("characterReferenceValue"),l=7,o=Sn,c(m))}function c(m){if(m===59&&i){const d=e.exit("characterReferenceValue");return o===te&&!In(r.sliceSerialize(d))?t(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return o(m)&&i++<l?(e.consume(m),c):t(m)}}const pt={tokenize:Fi,partial:!0},ft={name:"codeFenced",tokenize:Ai,concrete:!0};function Ai(e,n,t){const r=this,i={tokenize:B,partial:!0};let l=0,o=0,u;return s;function s(g){return a(g)}function a(g){const P=r.events[r.events.length-1];return l=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,u=g,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(g)}function c(g){return g===u?(o++,e.consume(g),c):o<3?t(g):(e.exit("codeFencedFenceSequence"),N(g)?V(e,m,"whitespace")(g):m(g))}function m(g){return g===null||T(g)?(e.exit("codeFencedFence"),r.interrupt?n(g):e.check(pt,x,z)(g)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),d(g))}function d(g){return g===null||T(g)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(g)):N(g)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),V(e,f,"whitespace")(g)):g===96&&g===u?t(g):(e.consume(g),d)}function f(g){return g===null||T(g)?m(g):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(g))}function w(g){return g===null||T(g)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(g)):g===96&&g===u?t(g):(e.consume(g),w)}function x(g){return e.attempt(i,z,C)(g)}function C(g){return e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),k}function k(g){return l>0&&N(g)?V(e,L,"linePrefix",l+1)(g):L(g)}function L(g){return g===null||T(g)?e.check(pt,x,z)(g):(e.enter("codeFlowValue"),E(g))}function E(g){return g===null||T(g)?(e.exit("codeFlowValue"),L(g)):(e.consume(g),E)}function z(g){return e.exit("codeFenced"),n(g)}function B(g,P,D){let M=0;return X;function X(R){return g.enter("lineEnding"),g.consume(R),g.exit("lineEnding"),A}function A(R){return g.enter("codeFencedFence"),N(R)?V(g,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):F(R)}function F(R){return R===u?(g.enter("codeFencedFenceSequence"),q(R)):D(R)}function q(R){return R===u?(M++,g.consume(R),q):M>=o?(g.exit("codeFencedFenceSequence"),N(R)?V(g,$,"whitespace")(R):$(R)):D(R)}function $(R){return R===null||T(R)?(g.exit("codeFencedFence"),P(R)):D(R)}}}function Fi(e,n,t){const r=this;return i;function i(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l)}function l(o){return r.parser.lazy[r.now().line]?t(o):n(o)}}const hn={name:"codeIndented",tokenize:Ii},Pi={tokenize:Ti,partial:!0};function Ii(e,n,t){const r=this;return i;function i(a){return e.enter("codeIndented"),V(e,l,"linePrefix",5)(a)}function l(a){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?o(a):t(a)}function o(a){return a===null?s(a):T(a)?e.attempt(Pi,o,s)(a):(e.enter("codeFlowValue"),u(a))}function u(a){return a===null||T(a)?(e.exit("codeFlowValue"),o(a)):(e.consume(a),u)}function s(a){return e.exit("codeIndented"),n(a)}}function Ti(e,n,t){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?t(o):T(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):V(e,l,"linePrefix",5)(o)}function l(o){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?n(o):T(o)?i(o):t(o)}}const Oi={name:"codeText",tokenize:Di,resolve:vi,previous:Li};function vi(e){let n=e.length-4,t=3,r,i;if((e[t][1].type==="lineEnding"||e[t][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(r=t;++r<n;)if(e[r][1].type==="codeTextData"){e[t][1].type="codeTextPadding",e[n][1].type="codeTextPadding",t+=2,n-=2;break}}for(r=t-1,n++;++r<=n;)i===void 0?r!==n&&e[r][1].type!=="lineEnding"&&(i=r):(r===n||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),n-=r-i-2,r=i+2),i=void 0);return e}function Li(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Di(e,n,t){let r=0,i,l;return o;function o(m){return e.enter("codeText"),e.enter("codeTextSequence"),u(m)}function u(m){return m===96?(e.consume(m),r++,u):(e.exit("codeTextSequence"),s(m))}function s(m){return m===null?t(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),s):m===96?(l=e.enter("codeTextSequence"),i=0,c(m)):T(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),s):(e.enter("codeTextData"),a(m))}function a(m){return m===null||m===32||m===96||T(m)?(e.exit("codeTextData"),s(m)):(e.consume(m),a)}function c(m){return m===96?(e.consume(m),i++,c):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),n(m)):(l.type="codeTextData",a(m))}}function Ht(e){const n={};let t=-1,r,i,l,o,u,s,a;for(;++t<e.length;){for(;t in n;)t=n[t];if(r=e[t],t&&r[1].type==="chunkFlow"&&e[t-1][1].type==="listItemPrefix"&&(s=r[1]._tokenizer.events,l=0,l<s.length&&s[l][1].type==="lineEndingBlank"&&(l+=2),l<s.length&&s[l][1].type==="content"))for(;++l<s.length&&s[l][1].type!=="content";)s[l][1].type==="chunkText"&&(s[l][1]._isInFirstContentOfListItem=!0,l++);if(r[0]==="enter")r[1].contentType&&(Object.assign(n,zi(e,t)),t=n[t],a=!0);else if(r[1]._container){for(l=t,i=void 0;l--&&(o=e[l],o[1].type==="lineEnding"||o[1].type==="lineEndingBlank");)o[0]==="enter"&&(i&&(e[i][1].type="lineEndingBlank"),o[1].type="lineEnding",i=l);i&&(r[1].end=Object.assign({},e[i][1].start),u=e.slice(i,t),u.unshift(r),he(e,i,t-i+1,u))}}return!a}function zi(e,n){const t=e[n][1],r=e[n][2];let i=n-1;const l=[],o=t._tokenizer||r.parser[t.contentType](t.start),u=o.events,s=[],a={};let c,m,d=-1,f=t,w=0,x=0;const C=[x];for(;f;){for(;e[++i][1]!==f;);l.push(i),f._tokenizer||(c=r.sliceStream(f),f.next||c.push(null),m&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(c),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),m=f,f=f.next}for(f=t;++d<u.length;)u[d][0]==="exit"&&u[d-1][0]==="enter"&&u[d][1].type===u[d-1][1].type&&u[d][1].start.line!==u[d][1].end.line&&(x=d+1,C.push(x),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):C.pop(),d=C.length;d--;){const k=u.slice(C[d],C[d+1]),L=l.pop();s.unshift([L,L+k.length-1]),he(e,L,2,k)}for(d=-1;++d<s.length;)a[w+s[d][0]]=w+s[d][1],w+=s[d][1]-s[d][0]-1;return a}const Bi={tokenize:Mi,resolve:Ni},Ri={tokenize:_i,partial:!0};function Ni(e){return Ht(e),e}function Mi(e,n){let t;return r;function r(u){return e.enter("content"),t=e.enter("chunkContent",{contentType:"content"}),i(u)}function i(u){return u===null?l(u):T(u)?e.check(Ri,o,l)(u):(e.consume(u),i)}function l(u){return e.exit("chunkContent"),e.exit("content"),n(u)}function o(u){return e.consume(u),e.exit("chunkContent"),t.next=e.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,i}}function _i(e,n,t){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),V(e,l,"linePrefix")}function l(o){if(o===null||T(o))return t(o);const u=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?n(o):e.interrupt(r.parser.constructs.flow,t,n)(o)}}function Ut(e,n,t,r,i,l,o,u,s){const a=s||Number.POSITIVE_INFINITY;let c=0;return m;function m(k){return k===60?(e.enter(r),e.enter(i),e.enter(l),e.consume(k),e.exit(l),d):k===null||k===32||k===41||wn(k)?t(k):(e.enter(r),e.enter(o),e.enter(u),e.enter("chunkString",{contentType:"string"}),x(k))}function d(k){return k===62?(e.enter(l),e.consume(k),e.exit(l),e.exit(i),e.exit(r),n):(e.enter(u),e.enter("chunkString",{contentType:"string"}),f(k))}function f(k){return k===62?(e.exit("chunkString"),e.exit(u),d(k)):k===null||k===60||T(k)?t(k):(e.consume(k),k===92?w:f)}function w(k){return k===60||k===62||k===92?(e.consume(k),f):f(k)}function x(k){return!c&&(k===null||k===41||ee(k))?(e.exit("chunkString"),e.exit(u),e.exit(o),e.exit(r),n(k)):c<a&&k===40?(e.consume(k),c++,x):k===41?(e.consume(k),c--,x):k===null||k===32||k===40||wn(k)?t(k):(e.consume(k),k===92?C:x)}function C(k){return k===40||k===41||k===92?(e.consume(k),x):x(k)}}function Vt(e,n,t,r,i,l){const o=this;let u=0,s;return a;function a(f){return e.enter(r),e.enter(i),e.consume(f),e.exit(i),e.enter(l),c}function c(f){return u>999||f===null||f===91||f===93&&!s||f===94&&!u&&"_hiddenFootnoteSupport"in o.parser.constructs?t(f):f===93?(e.exit(l),e.enter(i),e.consume(f),e.exit(i),e.exit(r),n):T(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),m(f))}function m(f){return f===null||f===91||f===93||T(f)||u++>999?(e.exit("chunkString"),c(f)):(e.consume(f),s||(s=!N(f)),f===92?d:m)}function d(f){return f===91||f===92||f===93?(e.consume(f),u++,m):m(f)}}function qt(e,n,t,r,i,l){let o;return u;function u(d){return d===34||d===39||d===40?(e.enter(r),e.enter(i),e.consume(d),e.exit(i),o=d===40?41:d,s):t(d)}function s(d){return d===o?(e.enter(i),e.consume(d),e.exit(i),e.exit(r),n):(e.enter(l),a(d))}function a(d){return d===o?(e.exit(l),s(o)):d===null?t(d):T(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),V(e,a,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(d))}function c(d){return d===o||d===null||T(d)?(e.exit("chunkString"),a(d)):(e.consume(d),d===92?m:c)}function m(d){return d===o||d===92?(e.consume(d),c):c(d)}}function Ne(e,n){let t;return r;function r(i){return T(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t=!0,r):N(i)?V(e,r,t?"linePrefix":"lineSuffix")(i):n(i)}}function Te(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ji={name:"definition",tokenize:Ui},Hi={tokenize:Vi,partial:!0};function Ui(e,n,t){const r=this;let i;return l;function l(f){return e.enter("definition"),o(f)}function o(f){return Vt.call(r,e,u,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function u(f){return i=Te(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),s):t(f)}function s(f){return ee(f)?Ne(e,a)(f):a(f)}function a(f){return Ut(e,c,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function c(f){return e.attempt(Hi,m,m)(f)}function m(f){return N(f)?V(e,d,"whitespace")(f):d(f)}function d(f){return f===null||T(f)?(e.exit("definition"),r.parser.defined.push(i),n(f)):t(f)}}function Vi(e,n,t){return r;function r(u){return ee(u)?Ne(e,i)(u):t(u)}function i(u){return qt(e,l,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function l(u){return N(u)?V(e,o,"whitespace")(u):o(u)}function o(u){return u===null||T(u)?n(u):t(u)}}const qi={name:"hardBreakEscape",tokenize:$i};function $i(e,n,t){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),i}function i(l){return T(l)?(e.exit("hardBreakEscape"),n(l)):t(l)}}const Wi={name:"headingAtx",tokenize:Xi,resolve:Qi};function Qi(e,n){let t=e.length-2,r=3,i,l;return e[r][1].type==="whitespace"&&(r+=2),t-2>r&&e[t][1].type==="whitespace"&&(t-=2),e[t][1].type==="atxHeadingSequence"&&(r===t-1||t-4>r&&e[t-2][1].type==="whitespace")&&(t-=r+1===t?2:4),t>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[t][1].end},l={type:"chunkText",start:e[r][1].start,end:e[t][1].end,contentType:"text"},he(e,r,t-r+1,[["enter",i,n],["enter",l,n],["exit",l,n],["exit",i,n]])),e}function Xi(e,n,t){let r=0;return i;function i(c){return e.enter("atxHeading"),l(c)}function l(c){return e.enter("atxHeadingSequence"),o(c)}function o(c){return c===35&&r++<6?(e.consume(c),o):c===null||ee(c)?(e.exit("atxHeadingSequence"),u(c)):t(c)}function u(c){return c===35?(e.enter("atxHeadingSequence"),s(c)):c===null||T(c)?(e.exit("atxHeading"),n(c)):N(c)?V(e,u,"whitespace")(c):(e.enter("atxHeadingText"),a(c))}function s(c){return c===35?(e.consume(c),s):(e.exit("atxHeadingSequence"),u(c))}function a(c){return c===null||c===35||ee(c)?(e.exit("atxHeadingText"),u(c)):(e.consume(c),a)}}const Yi=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ht=["pre","script","style","textarea"],Ki={name:"htmlFlow",tokenize:el,resolveTo:Ji,concrete:!0},Gi={tokenize:tl,partial:!0},Zi={tokenize:nl,partial:!0};function Ji(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function el(e,n,t){const r=this;let i,l,o,u,s;return a;function a(h){return c(h)}function c(h){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(h),m}function m(h){return h===33?(e.consume(h),d):h===47?(e.consume(h),l=!0,x):h===63?(e.consume(h),i=3,r.interrupt?n:p):fe(h)?(e.consume(h),o=String.fromCharCode(h),C):t(h)}function d(h){return h===45?(e.consume(h),i=2,f):h===91?(e.consume(h),i=5,u=0,w):fe(h)?(e.consume(h),i=4,r.interrupt?n:p):t(h)}function f(h){return h===45?(e.consume(h),r.interrupt?n:p):t(h)}function w(h){const se="CDATA[";return h===se.charCodeAt(u++)?(e.consume(h),u===se.length?r.interrupt?n:F:w):t(h)}function x(h){return fe(h)?(e.consume(h),o=String.fromCharCode(h),C):t(h)}function C(h){if(h===null||h===47||h===62||ee(h)){const se=h===47,Ee=o.toLowerCase();return!se&&!l&&ht.includes(Ee)?(i=1,r.interrupt?n(h):F(h)):Yi.includes(o.toLowerCase())?(i=6,se?(e.consume(h),k):r.interrupt?n(h):F(h)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?t(h):l?L(h):E(h))}return h===45||te(h)?(e.consume(h),o+=String.fromCharCode(h),C):t(h)}function k(h){return h===62?(e.consume(h),r.interrupt?n:F):t(h)}function L(h){return N(h)?(e.consume(h),L):X(h)}function E(h){return h===47?(e.consume(h),X):h===58||h===95||fe(h)?(e.consume(h),z):N(h)?(e.consume(h),E):X(h)}function z(h){return h===45||h===46||h===58||h===95||te(h)?(e.consume(h),z):B(h)}function B(h){return h===61?(e.consume(h),g):N(h)?(e.consume(h),B):E(h)}function g(h){return h===null||h===60||h===61||h===62||h===96?t(h):h===34||h===39?(e.consume(h),s=h,P):N(h)?(e.consume(h),g):D(h)}function P(h){return h===s?(e.consume(h),s=null,M):h===null||T(h)?t(h):(e.consume(h),P)}function D(h){return h===null||h===34||h===39||h===47||h===60||h===61||h===62||h===96||ee(h)?B(h):(e.consume(h),D)}function M(h){return h===47||h===62||N(h)?E(h):t(h)}function X(h){return h===62?(e.consume(h),A):t(h)}function A(h){return h===null||T(h)?F(h):N(h)?(e.consume(h),A):t(h)}function F(h){return h===45&&i===2?(e.consume(h),G):h===60&&i===1?(e.consume(h),Y):h===62&&i===4?(e.consume(h),ae):h===63&&i===3?(e.consume(h),p):h===93&&i===5?(e.consume(h),me):T(h)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Gi,de,q)(h)):h===null||T(h)?(e.exit("htmlFlowData"),q(h)):(e.consume(h),F)}function q(h){return e.check(Zi,$,de)(h)}function $(h){return e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),R}function R(h){return h===null||T(h)?q(h):(e.enter("htmlFlowData"),F(h))}function G(h){return h===45?(e.consume(h),p):F(h)}function Y(h){return h===47?(e.consume(h),o="",ue):F(h)}function ue(h){if(h===62){const se=o.toLowerCase();return ht.includes(se)?(e.consume(h),ae):F(h)}return fe(h)&&o.length<8?(e.consume(h),o+=String.fromCharCode(h),ue):F(h)}function me(h){return h===93?(e.consume(h),p):F(h)}function p(h){return h===62?(e.consume(h),ae):h===45&&i===2?(e.consume(h),p):F(h)}function ae(h){return h===null||T(h)?(e.exit("htmlFlowData"),de(h)):(e.consume(h),ae)}function de(h){return e.exit("htmlFlow"),n(h)}}function nl(e,n,t){const r=this;return i;function i(o){return T(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l):t(o)}function l(o){return r.parser.lazy[r.now().line]?t(o):n(o)}}function tl(e,n,t){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(We,n,t)}}const rl={name:"htmlText",tokenize:il};function il(e,n,t){const r=this;let i,l,o;return u;function u(p){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(p),s}function s(p){return p===33?(e.consume(p),a):p===47?(e.consume(p),B):p===63?(e.consume(p),E):fe(p)?(e.consume(p),D):t(p)}function a(p){return p===45?(e.consume(p),c):p===91?(e.consume(p),l=0,w):fe(p)?(e.consume(p),L):t(p)}function c(p){return p===45?(e.consume(p),f):t(p)}function m(p){return p===null?t(p):p===45?(e.consume(p),d):T(p)?(o=m,Y(p)):(e.consume(p),m)}function d(p){return p===45?(e.consume(p),f):m(p)}function f(p){return p===62?G(p):p===45?d(p):m(p)}function w(p){const ae="CDATA[";return p===ae.charCodeAt(l++)?(e.consume(p),l===ae.length?x:w):t(p)}function x(p){return p===null?t(p):p===93?(e.consume(p),C):T(p)?(o=x,Y(p)):(e.consume(p),x)}function C(p){return p===93?(e.consume(p),k):x(p)}function k(p){return p===62?G(p):p===93?(e.consume(p),k):x(p)}function L(p){return p===null||p===62?G(p):T(p)?(o=L,Y(p)):(e.consume(p),L)}function E(p){return p===null?t(p):p===63?(e.consume(p),z):T(p)?(o=E,Y(p)):(e.consume(p),E)}function z(p){return p===62?G(p):E(p)}function B(p){return fe(p)?(e.consume(p),g):t(p)}function g(p){return p===45||te(p)?(e.consume(p),g):P(p)}function P(p){return T(p)?(o=P,Y(p)):N(p)?(e.consume(p),P):G(p)}function D(p){return p===45||te(p)?(e.consume(p),D):p===47||p===62||ee(p)?M(p):t(p)}function M(p){return p===47?(e.consume(p),G):p===58||p===95||fe(p)?(e.consume(p),X):T(p)?(o=M,Y(p)):N(p)?(e.consume(p),M):G(p)}function X(p){return p===45||p===46||p===58||p===95||te(p)?(e.consume(p),X):A(p)}function A(p){return p===61?(e.consume(p),F):T(p)?(o=A,Y(p)):N(p)?(e.consume(p),A):M(p)}function F(p){return p===null||p===60||p===61||p===62||p===96?t(p):p===34||p===39?(e.consume(p),i=p,q):T(p)?(o=F,Y(p)):N(p)?(e.consume(p),F):(e.consume(p),$)}function q(p){return p===i?(e.consume(p),i=void 0,R):p===null?t(p):T(p)?(o=q,Y(p)):(e.consume(p),q)}function $(p){return p===null||p===34||p===39||p===60||p===61||p===96?t(p):p===47||p===62||ee(p)?M(p):(e.consume(p),$)}function R(p){return p===47||p===62||ee(p)?M(p):t(p)}function G(p){return p===62?(e.consume(p),e.exit("htmlTextData"),e.exit("htmlText"),n):t(p)}function Y(p){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),ue}function ue(p){return N(p)?V(e,me,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(p):me(p)}function me(p){return e.enter("htmlTextData"),o(p)}}const Tn={name:"labelEnd",tokenize:cl,resolveTo:sl,resolveAll:al},ll={tokenize:pl},ol={tokenize:fl},ul={tokenize:hl};function al(e){let n=-1;for(;++n<e.length;){const t=e[n][1];(t.type==="labelImage"||t.type==="labelLink"||t.type==="labelEnd")&&(e.splice(n+1,t.type==="labelImage"?4:2),t.type="data",n++)}return e}function sl(e,n){let t=e.length,r=0,i,l,o,u;for(;t--;)if(i=e[t][1],l){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[t][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[t][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(l=t,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=t);const s={type:e[l][1].type==="labelLink"?"link":"image",start:Object.assign({},e[l][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"label",start:Object.assign({},e[l][1].start),end:Object.assign({},e[o][1].end)},c={type:"labelText",start:Object.assign({},e[l+r+2][1].end),end:Object.assign({},e[o-2][1].start)};return u=[["enter",s,n],["enter",a,n]],u=re(u,e.slice(l+1,l+r+3)),u=re(u,[["enter",c,n]]),u=re(u,Pn(n.parser.constructs.insideSpan.null,e.slice(l+r+4,o-3),n)),u=re(u,[["exit",c,n],e[o-2],e[o-1],["exit",a,n]]),u=re(u,e.slice(o+1)),u=re(u,[["exit",s,n]]),he(e,l,e.length,u),e}function cl(e,n,t){const r=this;let i=r.events.length,l,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){l=r.events[i][1];break}return u;function u(d){return l?l._inactive?m(d):(o=r.parser.defined.includes(Te(r.sliceSerialize({start:l.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelEnd"),s):t(d)}function s(d){return d===40?e.attempt(ll,c,o?c:m)(d):d===91?e.attempt(ol,c,o?a:m)(d):o?c(d):m(d)}function a(d){return e.attempt(ul,c,m)(d)}function c(d){return n(d)}function m(d){return l._balanced=!0,t(d)}}function pl(e,n,t){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),i}function i(m){return ee(m)?Ne(e,l)(m):l(m)}function l(m){return m===41?c(m):Ut(e,o,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function o(m){return ee(m)?Ne(e,s)(m):c(m)}function u(m){return t(m)}function s(m){return m===34||m===39||m===40?qt(e,a,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):c(m)}function a(m){return ee(m)?Ne(e,c)(m):c(m)}function c(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),n):t(m)}}function fl(e,n,t){const r=this;return i;function i(u){return Vt.call(r,e,l,o,"reference","referenceMarker","referenceString")(u)}function l(u){return r.parser.defined.includes(Te(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?n(u):t(u)}function o(u){return t(u)}}function hl(e,n,t){return r;function r(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),i}function i(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),n):t(l)}}const ml={name:"labelStartImage",tokenize:dl,resolveAll:Tn.resolveAll};function dl(e,n,t){const r=this;return i;function i(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),l}function l(u){return u===91?(e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelImage"),o):t(u)}function o(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(u):n(u)}}const gl={name:"labelStartLink",tokenize:yl,resolveAll:Tn.resolveAll};function yl(e,n,t){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),l}function l(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(o):n(o)}}const mn={name:"lineEnding",tokenize:xl};function xl(e,n){return t;function t(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),V(e,n,"linePrefix")}}const qe={name:"thematicBreak",tokenize:kl};function kl(e,n,t){let r=0,i;return l;function l(a){return e.enter("thematicBreak"),o(a)}function o(a){return i=a,u(a)}function u(a){return a===i?(e.enter("thematicBreakSequence"),s(a)):r>=3&&(a===null||T(a))?(e.exit("thematicBreak"),n(a)):t(a)}function s(a){return a===i?(e.consume(a),r++,s):(e.exit("thematicBreakSequence"),N(a)?V(e,u,"whitespace")(a):u(a))}}const Z={name:"list",tokenize:Sl,continuation:{tokenize:Cl},exit:Al},bl={tokenize:Fl,partial:!0},wl={tokenize:El,partial:!0};function Sl(e,n,t){const r=this,i=r.events[r.events.length-1];let l=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return u;function u(f){const w=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:Sn(f)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(qe,t,a)(f):a(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),s(f)}return t(f)}function s(f){return Sn(f)&&++o<10?(e.consume(f),s):(!r.interrupt||o<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),a(f)):t(f)}function a(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(We,r.interrupt?t:c,e.attempt(bl,d,m))}function c(f){return r.containerState.initialBlankLine=!0,l++,d(f)}function m(f){return N(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),d):t(f)}function d(f){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(f)}}function Cl(e,n,t){const r=this;return r.containerState._closeFlow=void 0,e.check(We,i,l);function i(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,V(e,n,"listItemIndent",r.containerState.size+1)(u)}function l(u){return r.containerState.furtherBlankLines||!N(u)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(u)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(wl,n,o)(u))}function o(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,V(e,e.attempt(Z,n,t),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function El(e,n,t){const r=this;return V(e,i,"listItemIndent",r.containerState.size+1);function i(l){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?n(l):t(l)}}function Al(e){e.exit(this.containerState.type)}function Fl(e,n,t){const r=this;return V(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(l){const o=r.events[r.events.length-1];return!N(l)&&o&&o[1].type==="listItemPrefixWhitespace"?n(l):t(l)}}const mt={name:"setextUnderline",tokenize:Il,resolveTo:Pl};function Pl(e,n){let t=e.length,r,i,l;for(;t--;)if(e[t][0]==="enter"){if(e[t][1].type==="content"){r=t;break}e[t][1].type==="paragraph"&&(i=t)}else e[t][1].type==="content"&&e.splice(t,1),!l&&e[t][1].type==="definition"&&(l=t);const o={type:"setextHeading",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[i][1].type="setextHeadingText",l?(e.splice(i,0,["enter",o,n]),e.splice(l+1,0,["exit",e[r][1],n]),e[r][1].end=Object.assign({},e[l][1].end)):e[r][1]=o,e.push(["exit",o,n]),e}function Il(e,n,t){const r=this;let i;return l;function l(a){let c=r.events.length,m;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){m=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(e.enter("setextHeadingLine"),i=a,o(a)):t(a)}function o(a){return e.enter("setextHeadingLineSequence"),u(a)}function u(a){return a===i?(e.consume(a),u):(e.exit("setextHeadingLineSequence"),N(a)?V(e,s,"lineSuffix")(a):s(a))}function s(a){return a===null||T(a)?(e.exit("setextHeadingLine"),n(a)):t(a)}}const Tl={tokenize:Ol};function Ol(e){const n=this,t=e.attempt(We,r,e.attempt(this.parser.constructs.flowInitial,i,V(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Bi,i)),"linePrefix")));return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t}function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),n.currentConstruct=void 0,t}}const vl={resolveAll:Wt()},Ll=$t("string"),Dl=$t("text");function $t(e){return{tokenize:n,resolveAll:Wt(e==="text"?zl:void 0)};function n(t){const r=this,i=this.parser.constructs[e],l=t.attempt(i,o,u);return o;function o(c){return a(c)?l(c):u(c)}function u(c){if(c===null){t.consume(c);return}return t.enter("data"),t.consume(c),s}function s(c){return a(c)?(t.exit("data"),l(c)):(t.consume(c),s)}function a(c){if(c===null)return!0;const m=i[c];let d=-1;if(m)for(;++d<m.length;){const f=m[d];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function Wt(e){return n;function n(t,r){let i=-1,l;for(;++i<=t.length;)l===void 0?t[i]&&t[i][1].type==="data"&&(l=i,i++):(!t[i]||t[i][1].type!=="data")&&(i!==l+2&&(t[l][1].end=t[i-1][1].end,t.splice(l+2,i-l-2),i=l+2),l=void 0);return e?e(t,r):t}}function zl(e,n){let t=0;for(;++t<=e.length;)if((t===e.length||e[t][1].type==="lineEnding")&&e[t-1][1].type==="data"){const r=e[t-1][1],i=n.sliceStream(r);let l=i.length,o=-1,u=0,s;for(;l--;){const a=i[l];if(typeof a=="string"){for(o=a.length;a.charCodeAt(o-1)===32;)u++,o--;if(o)break;o=-1}else if(a===-2)s=!0,u++;else if(a!==-1){l++;break}}if(u){const a={type:t===e.length||s||u<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-u,offset:r.end.offset-u,_index:r.start._index+l,_bufferIndex:l?o:r.start._bufferIndex+o},end:Object.assign({},r.end)};r.end=Object.assign({},a.start),r.start.offset===r.end.offset?Object.assign(r,a):(e.splice(t,0,["enter",a,n],["exit",a,n]),t+=2)}t++}return e}function Bl(e,n,t){let r=Object.assign(t?Object.assign({},t):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const i={},l=[];let o=[],u=[];const s={consume:L,enter:E,exit:z,attempt:P(B),check:P(g),interrupt:P(g,{interrupt:!0})},a={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:f,sliceSerialize:d,now:w,defineSkip:x,write:m};let c=n.tokenize.call(a,s);return n.resolveAll&&l.push(n),a;function m(A){return o=re(o,A),C(),o[o.length-1]!==null?[]:(D(n,0),a.events=Pn(l,a.events,a),a.events)}function d(A,F){return Nl(f(A),F)}function f(A){return Rl(o,A)}function w(){const{line:A,column:F,offset:q,_index:$,_bufferIndex:R}=r;return{line:A,column:F,offset:q,_index:$,_bufferIndex:R}}function x(A){i[A.line]=A.column,X()}function C(){let A;for(;r._index<o.length;){const F=o[r._index];if(typeof F=="string")for(A=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===A&&r._bufferIndex<F.length;)k(F.charCodeAt(r._bufferIndex));else k(F)}}function k(A){c=c(A)}function L(A){T(A)?(r.line++,r.column=1,r.offset+=A===-3?2:1,X()):A!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),a.previous=A}function E(A,F){const q=F||{};return q.type=A,q.start=w(),a.events.push(["enter",q,a]),u.push(q),q}function z(A){const F=u.pop();return F.end=w(),a.events.push(["exit",F,a]),F}function B(A,F){D(A,F.from)}function g(A,F){F.restore()}function P(A,F){return q;function q($,R,G){let Y,ue,me,p;return Array.isArray($)?de($):"tokenize"in $?de([$]):ae($);function ae(K){return Ae;function Ae(xe){const Fe=xe!==null&&K[xe],Pe=xe!==null&&K.null,ln=[...Array.isArray(Fe)?Fe:Fe?[Fe]:[],...Array.isArray(Pe)?Pe:Pe?[Pe]:[]];return de(ln)(xe)}}function de(K){return Y=K,ue=0,K.length===0?G:h(K[ue])}function h(K){return Ae;function Ae(xe){return p=M(),me=K,K.partial||(a.currentConstruct=K),K.name&&a.parser.constructs.disable.null.includes(K.name)?Ee():K.tokenize.call(F?Object.assign(Object.create(a),F):a,s,se,Ee)(xe)}}function se(K){return A(me,p),R}function Ee(K){return p.restore(),++ue<Y.length?h(Y[ue]):G}}}function D(A,F){A.resolveAll&&!l.includes(A)&&l.push(A),A.resolve&&he(a.events,F,a.events.length-F,A.resolve(a.events.slice(F),a)),A.resolveTo&&(a.events=A.resolveTo(a.events,a))}function M(){const A=w(),F=a.previous,q=a.currentConstruct,$=a.events.length,R=Array.from(u);return{restore:G,from:$};function G(){r=A,a.previous=F,a.currentConstruct=q,a.events.length=$,u=R,X()}}function X(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Rl(e,n){const t=n.start._index,r=n.start._bufferIndex,i=n.end._index,l=n.end._bufferIndex;let o;if(t===i)o=[e[t].slice(r,l)];else{if(o=e.slice(t,i),r>-1){const u=o[0];typeof u=="string"?o[0]=u.slice(r):o.shift()}l>0&&o.push(e[i].slice(0,l))}return o}function Nl(e,n){let t=-1;const r=[];let i;for(;++t<e.length;){const l=e[t];let o;if(typeof l=="string")o=l;else switch(l){case-5:{o="\r";break}case-4:{o=`
7
- `;break}case-3:{o=`\r
8
- `;break}case-2:{o=n?" ":" ";break}case-1:{if(!n&&i)continue;o=" ";break}default:o=String.fromCharCode(l)}i=l===-2,r.push(o)}return r.join("")}const Ml={42:Z,43:Z,45:Z,48:Z,49:Z,50:Z,51:Z,52:Z,53:Z,54:Z,55:Z,56:Z,57:Z,62:Mt},_l={91:ji},jl={[-2]:hn,[-1]:hn,32:hn},Hl={35:Wi,42:qe,45:[mt,qe],60:Ki,61:mt,95:qe,96:ft,126:ft},Ul={38:jt,92:_t},Vl={[-5]:mn,[-4]:mn,[-3]:mn,33:ml,38:jt,42:Cn,60:[yi,rl],91:gl,92:[qi,_t],93:Tn,95:Cn,96:Oi},ql={null:[Cn,vl]},$l={null:[42,95]},Wl={null:[]},Ql=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:$l,contentInitial:_l,disable:Wl,document:Ml,flow:Hl,flowInitial:jl,insideSpan:ql,string:Ul,text:Vl},Symbol.toStringTag,{value:"Module"}));function Xl(e){const t=ni([Ql,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:t,content:i(ci),document:i(fi),flow:i(Tl),string:i(Ll),text:i(Dl)};return r;function i(l){return o;function o(u){return Bl(r,l,u)}}}const dt=/[\0\t\n\r]/g;function Yl(){let e=1,n="",t=!0,r;return i;function i(l,o,u){const s=[];let a,c,m,d,f;for(l=n+l.toString(o),m=0,n="",t&&(l.charCodeAt(0)===65279&&m++,t=void 0);m<l.length;){if(dt.lastIndex=m,a=dt.exec(l),d=a&&a.index!==void 0?a.index:l.length,f=l.charCodeAt(d),!a){n=l.slice(m);break}if(f===10&&m===d&&r)s.push(-3),r=void 0;else switch(r&&(s.push(-5),r=void 0),m<d&&(s.push(l.slice(m,d)),e+=d-m),f){case 0:{s.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,s.push(-2);e++<c;)s.push(-1);break}case 10:{s.push(-4),e=1;break}default:r=!0,e=1}m=d+1}return u&&(r&&s.push(-5),n&&s.push(n),s.push(null)),s}}function Kl(e){for(;!Ht(e););return e}function Qt(e,n){const t=Number.parseInt(e,n);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCharCode(t)}const Gl=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Zl(e){return e.replace(Gl,Jl)}function Jl(e,n,t){if(n)return n;if(t.charCodeAt(0)===35){const i=t.charCodeAt(1),l=i===120||i===88;return Qt(t.slice(l?2:1),l?16:10)}return In(t)||e}const Xt={}.hasOwnProperty,eo=function(e,n,t){return typeof n!="string"&&(t=n,n=void 0),no(t)(Kl(Xl(t).document().write(Yl()(e,n,!0))))};function no(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Un),autolinkProtocol:A,autolinkEmail:A,atxHeading:u(_n),blockQuote:u(ln),characterEscape:A,characterReference:A,codeFenced:u(Mn),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:u(Mn,s),codeText:u(kr,s),codeTextData:A,data:A,codeFlowValue:A,definition:u(br),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:u(wr),hardBreakEscape:u(jn),hardBreakTrailing:u(jn),htmlFlow:u(Hn,s),htmlFlowData:A,htmlText:u(Hn,s),htmlTextData:A,image:u(Sr),label:s,link:u(Un),listItem:u(Cr),listItemValue:w,listOrdered:u(Vn,f),listUnordered:u(Vn),paragraph:u(Er),reference:Ee,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:u(_n),strong:u(Ar),thematicBreak:u(Pr)},exit:{atxHeading:c(),atxHeadingSequence:P,autolink:c(),autolinkEmail:Pe,autolinkProtocol:Fe,blockQuote:c(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:Ae,characterReferenceMarkerNumeric:Ae,characterReferenceValue:xe,codeFenced:c(L),codeFencedFence:k,codeFencedFenceInfo:x,codeFencedFenceMeta:C,codeFlowValue:F,codeIndented:c(E),codeText:c(Y),codeTextData:F,data:F,definition:c(),definitionDestinationString:g,definitionLabelString:z,definitionTitleString:B,emphasis:c(),hardBreakEscape:c($),hardBreakTrailing:c($),htmlFlow:c(R),htmlFlowData:F,htmlText:c(G),htmlTextData:F,image:c(me),label:ae,labelText:p,lineEnding:q,link:c(ue),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:K,resourceDestinationString:de,resourceTitleString:h,resource:se,setextHeading:c(X),setextHeadingLineSequence:M,setextHeadingText:D,strong:c(),thematicBreak:c()}};Yt(n,(e||{}).mdastExtensions||[]);const t={};return r;function r(y){let S={type:"root",children:[]};const I={stack:[S],tokenStack:[],config:n,enter:a,exit:m,buffer:s,resume:d,setData:l,getData:o},j=[];let H=-1;for(;++H<y.length;)if(y[H][1].type==="listOrdered"||y[H][1].type==="listUnordered")if(y[H][0]==="enter")j.push(H);else{const ce=j.pop();H=i(y,ce,H)}for(H=-1;++H<y.length;){const ce=n[y[H][0]];Xt.call(ce,y[H][1].type)&&ce[y[H][1].type].call(Object.assign({sliceSerialize:y[H][2].sliceSerialize},I),y[H][1])}if(I.tokenStack.length>0){const ce=I.tokenStack[I.tokenStack.length-1];(ce[1]||gt).call(I,void 0,ce[0])}for(S.position={start:be(y.length>0?y[0][1].start:{line:1,column:1,offset:0}),end:be(y.length>0?y[y.length-2][1].end:{line:1,column:1,offset:0})},H=-1;++H<n.transforms.length;)S=n.transforms[H](S)||S;return S}function i(y,S,I){let j=S-1,H=-1,ce=!1,ke,ge,De,ze;for(;++j<=I;){const W=y[j];if(W[1].type==="listUnordered"||W[1].type==="listOrdered"||W[1].type==="blockQuote"?(W[0]==="enter"?H++:H--,ze=void 0):W[1].type==="lineEndingBlank"?W[0]==="enter"&&(ke&&!ze&&!H&&!De&&(De=j),ze=void 0):W[1].type==="linePrefix"||W[1].type==="listItemValue"||W[1].type==="listItemMarker"||W[1].type==="listItemPrefix"||W[1].type==="listItemPrefixWhitespace"||(ze=void 0),!H&&W[0]==="enter"&&W[1].type==="listItemPrefix"||H===-1&&W[0]==="exit"&&(W[1].type==="listUnordered"||W[1].type==="listOrdered")){if(ke){let on=j;for(ge=void 0;on--;){const ye=y[on];if(ye[1].type==="lineEnding"||ye[1].type==="lineEndingBlank"){if(ye[0]==="exit")continue;ge&&(y[ge][1].type="lineEndingBlank",ce=!0),ye[1].type="lineEnding",ge=on}else if(!(ye[1].type==="linePrefix"||ye[1].type==="blockQuotePrefix"||ye[1].type==="blockQuotePrefixWhitespace"||ye[1].type==="blockQuoteMarker"||ye[1].type==="listItemIndent"))break}De&&(!ge||De<ge)&&(ke._spread=!0),ke.end=Object.assign({},ge?y[ge][1].start:W[1].end),y.splice(ge||j,0,["exit",ke,W[2]]),j++,I++}W[1].type==="listItemPrefix"&&(ke={type:"listItem",_spread:!1,start:Object.assign({},W[1].start),end:void 0},y.splice(j,0,["enter",ke,W[2]]),j++,I++,De=void 0,ze=!0)}}return y[S][1]._spread=ce,I}function l(y,S){t[y]=S}function o(y){return t[y]}function u(y,S){return I;function I(j){a.call(this,y(j),j),S&&S.call(this,j)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(y,S,I){return this.stack[this.stack.length-1].children.push(y),this.stack.push(y),this.tokenStack.push([S,I]),y.position={start:be(S.start)},y}function c(y){return S;function S(I){y&&y.call(this,I),m.call(this,I)}}function m(y,S){const I=this.stack.pop(),j=this.tokenStack.pop();if(j)j[0].type!==y.type&&(S?S.call(this,y,j[0]):(j[1]||gt).call(this,y,j[0]));else throw new Error("Cannot close `"+y.type+"` ("+Re({start:y.start,end:y.end})+"): it’s not open");return I.position.end=be(y.end),I}function d(){return Jr(this.stack.pop())}function f(){l("expectingFirstListItemValue",!0)}function w(y){if(o("expectingFirstListItemValue")){const S=this.stack[this.stack.length-2];S.start=Number.parseInt(this.sliceSerialize(y),10),l("expectingFirstListItemValue")}}function x(){const y=this.resume(),S=this.stack[this.stack.length-1];S.lang=y}function C(){const y=this.resume(),S=this.stack[this.stack.length-1];S.meta=y}function k(){o("flowCodeInside")||(this.buffer(),l("flowCodeInside",!0))}function L(){const y=this.resume(),S=this.stack[this.stack.length-1];S.value=y.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),l("flowCodeInside")}function E(){const y=this.resume(),S=this.stack[this.stack.length-1];S.value=y.replace(/(\r?\n|\r)$/g,"")}function z(y){const S=this.resume(),I=this.stack[this.stack.length-1];I.label=S,I.identifier=Te(this.sliceSerialize(y)).toLowerCase()}function B(){const y=this.resume(),S=this.stack[this.stack.length-1];S.title=y}function g(){const y=this.resume(),S=this.stack[this.stack.length-1];S.url=y}function P(y){const S=this.stack[this.stack.length-1];if(!S.depth){const I=this.sliceSerialize(y).length;S.depth=I}}function D(){l("setextHeadingSlurpLineEnding",!0)}function M(y){const S=this.stack[this.stack.length-1];S.depth=this.sliceSerialize(y).charCodeAt(0)===61?1:2}function X(){l("setextHeadingSlurpLineEnding")}function A(y){const S=this.stack[this.stack.length-1];let I=S.children[S.children.length-1];(!I||I.type!=="text")&&(I=Fr(),I.position={start:be(y.start)},S.children.push(I)),this.stack.push(I)}function F(y){const S=this.stack.pop();S.value+=this.sliceSerialize(y),S.position.end=be(y.end)}function q(y){const S=this.stack[this.stack.length-1];if(o("atHardBreak")){const I=S.children[S.children.length-1];I.position.end=be(y.end),l("atHardBreak");return}!o("setextHeadingSlurpLineEnding")&&n.canContainEols.includes(S.type)&&(A.call(this,y),F.call(this,y))}function $(){l("atHardBreak",!0)}function R(){const y=this.resume(),S=this.stack[this.stack.length-1];S.value=y}function G(){const y=this.resume(),S=this.stack[this.stack.length-1];S.value=y}function Y(){const y=this.resume(),S=this.stack[this.stack.length-1];S.value=y}function ue(){const y=this.stack[this.stack.length-1];if(o("inReference")){const S=o("referenceType")||"shortcut";y.type+="Reference",y.referenceType=S,delete y.url,delete y.title}else delete y.identifier,delete y.label;l("referenceType")}function me(){const y=this.stack[this.stack.length-1];if(o("inReference")){const S=o("referenceType")||"shortcut";y.type+="Reference",y.referenceType=S,delete y.url,delete y.title}else delete y.identifier,delete y.label;l("referenceType")}function p(y){const S=this.sliceSerialize(y),I=this.stack[this.stack.length-2];I.label=Zl(S),I.identifier=Te(S).toLowerCase()}function ae(){const y=this.stack[this.stack.length-1],S=this.resume(),I=this.stack[this.stack.length-1];if(l("inReference",!0),I.type==="link"){const j=y.children;I.children=j}else I.alt=S}function de(){const y=this.resume(),S=this.stack[this.stack.length-1];S.url=y}function h(){const y=this.resume(),S=this.stack[this.stack.length-1];S.title=y}function se(){l("inReference")}function Ee(){l("referenceType","collapsed")}function K(y){const S=this.resume(),I=this.stack[this.stack.length-1];I.label=S,I.identifier=Te(this.sliceSerialize(y)).toLowerCase(),l("referenceType","full")}function Ae(y){l("characterReferenceType",y.type)}function xe(y){const S=this.sliceSerialize(y),I=o("characterReferenceType");let j;I?(j=Qt(S,I==="characterReferenceMarkerNumeric"?10:16),l("characterReferenceType")):j=In(S);const H=this.stack.pop();H.value+=j,H.position.end=be(y.end)}function Fe(y){F.call(this,y);const S=this.stack[this.stack.length-1];S.url=this.sliceSerialize(y)}function Pe(y){F.call(this,y);const S=this.stack[this.stack.length-1];S.url="mailto:"+this.sliceSerialize(y)}function ln(){return{type:"blockquote",children:[]}}function Mn(){return{type:"code",lang:null,meta:null,value:""}}function kr(){return{type:"inlineCode",value:""}}function br(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function wr(){return{type:"emphasis",children:[]}}function _n(){return{type:"heading",depth:void 0,children:[]}}function jn(){return{type:"break"}}function Hn(){return{type:"html",value:""}}function Sr(){return{type:"image",title:null,url:"",alt:null}}function Un(){return{type:"link",title:null,url:"",children:[]}}function Vn(y){return{type:"list",ordered:y.type==="listOrdered",start:null,spread:y._spread,children:[]}}function Cr(y){return{type:"listItem",spread:y._spread,checked:null,children:[]}}function Er(){return{type:"paragraph",children:[]}}function Ar(){return{type:"strong",children:[]}}function Fr(){return{type:"text",value:""}}function Pr(){return{type:"thematicBreak"}}}function be(e){return{line:e.line,column:e.column,offset:e.offset}}function Yt(e,n){let t=-1;for(;++t<n.length;){const r=n[t];Array.isArray(r)?Yt(e,r):to(e,r)}}function to(e,n){let t;for(t in n)if(Xt.call(n,t)){if(t==="canContainEols"){const r=n[t];r&&e[t].push(...r)}else if(t==="transforms"){const r=n[t];r&&e[t].push(...r)}else if(t==="enter"||t==="exit"){const r=n[t];r&&Object.assign(e[t],r)}}}function gt(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+Re({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+Re({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+Re({start:n.start,end:n.end})+") is still open")}function ro(e){Object.assign(this,{Parser:t=>{const r=this.data("settings");return eo(t,Object.assign({},r,e,{extensions:this.data("micromarkExtensions")||[],mdastExtensions:this.data("fromMarkdownExtensions")||[]}))}})}function io(e,n){const t={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,t),e.applyData(n,t)}function lo(e,n){const t={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,t),[e.applyData(n,t),{type:"text",value:`
9
- `}]}function oo(e,n){const t=n.value?n.value+`
10
- `:"",r=n.lang?n.lang.match(/^[^ \t]+(?=[ \t]|$)/):null,i={};r&&(i.className=["language-"+r]);let l={type:"element",tagName:"code",properties:i,children:[{type:"text",value:t}]};return n.meta&&(l.data={meta:n.meta}),e.patch(n,l),l=e.applyData(n,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(n,l),l}function uo(e,n){const t={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function ao(e,n){const t={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function ve(e){const n=[];let t=-1,r=0,i=0;for(;++t<e.length;){const l=e.charCodeAt(t);let o="";if(l===37&&te(e.charCodeAt(t+1))&&te(e.charCodeAt(t+2)))i=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(o=String.fromCharCode(l));else if(l>55295&&l<57344){const u=e.charCodeAt(t+1);l<56320&&u>56319&&u<57344?(o=String.fromCharCode(l,u),i=1):o="�"}else o=String.fromCharCode(l);o&&(n.push(e.slice(r,t),encodeURIComponent(o)),r=t+i+1,o=""),i&&(t+=i,i=0)}return n.join("")+e.slice(r)}function Kt(e,n){const t=String(n.identifier).toUpperCase(),r=ve(t.toLowerCase()),i=e.footnoteOrder.indexOf(t);let l;i===-1?(e.footnoteOrder.push(t),e.footnoteCounts[t]=1,l=e.footnoteOrder.length):(e.footnoteCounts[t]++,l=i+1);const o=e.footnoteCounts[t],u={type:"element",tagName:"a",properties:{href:"#"+e.clobberPrefix+"fn-"+r,id:e.clobberPrefix+"fnref-"+r+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(n,u);const s={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(n,s),e.applyData(n,s)}function so(e,n){const t=e.footnoteById;let r=1;for(;r in t;)r++;const i=String(r);return t[i]={type:"footnoteDefinition",identifier:i,children:[{type:"paragraph",children:n.children}],position:n.position},Kt(e,{type:"footnoteReference",identifier:i,position:n.position})}function co(e,n){const t={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function po(e,n){if(e.dangerous){const t={type:"raw",value:n.value};return e.patch(n,t),e.applyData(n,t)}return null}function Gt(e,n){const t=n.referenceType;let r="]";if(t==="collapsed"?r+="[]":t==="full"&&(r+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return{type:"text",value:"!["+n.alt+r};const i=e.all(n),l=i[0];l&&l.type==="text"?l.value="["+l.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function fo(e,n){const t=e.definition(n.identifier);if(!t)return Gt(e,n);const r={src:ve(t.url||""),alt:n.alt};t.title!==null&&t.title!==void 0&&(r.title=t.title);const i={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,i),e.applyData(n,i)}function ho(e,n){const t={src:ve(n.url)};n.alt!==null&&n.alt!==void 0&&(t.alt=n.alt),n.title!==null&&n.title!==void 0&&(t.title=n.title);const r={type:"element",tagName:"img",properties:t,children:[]};return e.patch(n,r),e.applyData(n,r)}function mo(e,n){const t={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,t);const r={type:"element",tagName:"code",properties:{},children:[t]};return e.patch(n,r),e.applyData(n,r)}function go(e,n){const t=e.definition(n.identifier);if(!t)return Gt(e,n);const r={href:ve(t.url||"")};t.title!==null&&t.title!==void 0&&(r.title=t.title);const i={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function yo(e,n){const t={href:ve(n.url)};n.title!==null&&n.title!==void 0&&(t.title=n.title);const r={type:"element",tagName:"a",properties:t,children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function xo(e,n,t){const r=e.all(n),i=t?ko(t):Zt(n),l={},o=[];if(typeof n.checked=="boolean"){const c=r[0];let m;c&&c.type==="element"&&c.tagName==="p"?m=c:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let u=-1;for(;++u<r.length;){const c=r[u];(i||u!==0||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
11
- `}),c.type==="element"&&c.tagName==="p"&&!i?o.push(...c.children):o.push(c)}const s=r[r.length-1];s&&(i||s.type!=="element"||s.tagName!=="p")&&o.push({type:"text",value:`
12
- `});const a={type:"element",tagName:"li",properties:l,children:o};return e.patch(n,a),e.applyData(n,a)}function ko(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const t=e.children;let r=-1;for(;!n&&++r<t.length;)n=Zt(t[r])}return n}function Zt(e){const n=e.spread;return n??e.children.length>1}function bo(e,n){const t={},r=e.all(n);let i=-1;for(typeof n.start=="number"&&n.start!==1&&(t.start=n.start);++i<r.length;){const o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){t.className=["contains-task-list"];break}}const l={type:"element",tagName:n.ordered?"ol":"ul",properties:t,children:e.wrap(r,!0)};return e.patch(n,l),e.applyData(n,l)}function wo(e,n){const t={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function So(e,n){const t={type:"root",children:e.wrap(e.all(n))};return e.patch(n,t),e.applyData(n,t)}function Co(e,n){const t={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}const On=Jt("start"),vn=Jt("end");function Eo(e){return{start:On(e),end:vn(e)}}function Jt(e){return n;function n(t){const r=t&&t.position&&t.position[e]||{};return{line:r.line||null,column:r.column||null,offset:r.offset>-1?r.offset:null}}}function Ao(e,n){const t=e.all(n),r=t.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(n.children[0],o),i.push(o)}if(t.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(t,!0)},u=On(n.children[1]),s=vn(n.children[n.children.length-1]);u.line&&s.line&&(o.position={start:u,end:s}),i.push(o)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(n,l),e.applyData(n,l)}function Fo(e,n,t){const r=t?t.children:void 0,l=(r?r.indexOf(n):1)===0?"th":"td",o=t&&t.type==="table"?t.align:void 0,u=o?o.length:n.children.length;let s=-1;const a=[];for(;++s<u;){const m=n.children[s],d={},f=o?o[s]:void 0;f&&(d.align=f);let w={type:"element",tagName:l,properties:d,children:[]};m&&(w.children=e.all(m),e.patch(m,w),w=e.applyData(n,w)),a.push(w)}const c={type:"element",tagName:"tr",properties:{},children:e.wrap(a,!0)};return e.patch(n,c),e.applyData(n,c)}function Po(e,n){const t={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}const yt=9,xt=32;function Io(e){const n=String(e),t=/\r?\n|\r/g;let r=t.exec(n),i=0;const l=[];for(;r;)l.push(kt(n.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=t.exec(n);return l.push(kt(n.slice(i),i>0,!1)),l.join("")}function kt(e,n,t){let r=0,i=e.length;if(n){let l=e.codePointAt(r);for(;l===yt||l===xt;)r++,l=e.codePointAt(r)}if(t){let l=e.codePointAt(i-1);for(;l===yt||l===xt;)i--,l=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function To(e,n){const t={type:"text",value:Io(String(n.value))};return e.patch(n,t),e.applyData(n,t)}function Oo(e,n){const t={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,t),e.applyData(n,t)}const vo={blockquote:io,break:lo,code:oo,delete:uo,emphasis:ao,footnoteReference:Kt,footnote:so,heading:co,html:po,imageReference:fo,image:ho,inlineCode:mo,linkReference:go,link:yo,listItem:xo,list:bo,paragraph:wo,root:So,strong:Co,table:Ao,tableCell:Po,tableRow:Fo,text:To,thematicBreak:Oo,toml:He,yaml:He,definition:He,footnoteDefinition:He};function He(){return null}const er=function(e){if(e==null)return Bo;if(typeof e=="string")return zo(e);if(typeof e=="object")return Array.isArray(e)?Lo(e):Do(e);if(typeof e=="function")return Qe(e);throw new Error("Expected function, string, or object as test")};function Lo(e){const n=[];let t=-1;for(;++t<e.length;)n[t]=er(e[t]);return Qe(r);function r(...i){let l=-1;for(;++l<n.length;)if(n[l].call(this,...i))return!0;return!1}}function Do(e){return Qe(n);function n(t){let r;for(r in e)if(t[r]!==e[r])return!1;return!0}}function zo(e){return Qe(n);function n(t){return t&&t.type===e}}function Qe(e){return n;function n(t,...r){return!!(t&&typeof t=="object"&&"type"in t&&e.call(this,t,...r))}}function Bo(){return!0}const Ro=!0,bt=!1,No="skip",Mo=function(e,n,t,r){typeof n=="function"&&typeof t!="function"&&(r=t,t=n,n=null);const i=er(n),l=r?-1:1;o(e,void 0,[])();function o(u,s,a){const c=u&&typeof u=="object"?u:{};if(typeof c.type=="string"){const d=typeof c.tagName=="string"?c.tagName:typeof c.name=="string"?c.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(u.type+(d?"<"+d+">":""))+")"})}return m;function m(){let d=[],f,w,x;if((!n||i(u,s,a[a.length-1]||null))&&(d=_o(t(u,a)),d[0]===bt))return d;if(u.children&&d[0]!==No)for(w=(r?u.children.length:-1)+l,x=a.concat(u);w>-1&&w<u.children.length;){if(f=o(u.children[w],w,x)(),f[0]===bt)return f;w=typeof f[1]=="number"?f[1]:w+l}return d}}};function _o(e){return Array.isArray(e)?e:typeof e=="number"?[Ro,e]:[e]}const Ln=function(e,n,t,r){typeof n=="function"&&typeof t!="function"&&(r=t,t=n,n=null),Mo(e,n,i,r);function i(l,o){const u=o[o.length-1];return t(l,u?u.children.indexOf(l):null,u)}};function jo(e){return!e||!e.position||!e.position.start||!e.position.start.line||!e.position.start.column||!e.position.end||!e.position.end.line||!e.position.end.column}const wt={}.hasOwnProperty;function Ho(e){const n=Object.create(null);if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return Ln(e,"definition",r=>{const i=St(r.identifier);i&&!wt.call(n,i)&&(n[i]=r)}),t;function t(r){const i=St(r);return i&&wt.call(n,i)?n[i]:null}}function St(e){return String(e||"").toUpperCase()}const $e={}.hasOwnProperty;function Uo(e,n){const t=n||{},r=t.allowDangerousHtml||!1,i={};return o.dangerous=r,o.clobberPrefix=t.clobberPrefix===void 0||t.clobberPrefix===null?"user-content-":t.clobberPrefix,o.footnoteLabel=t.footnoteLabel||"Footnotes",o.footnoteLabelTagName=t.footnoteLabelTagName||"h2",o.footnoteLabelProperties=t.footnoteLabelProperties||{className:["sr-only"]},o.footnoteBackLabel=t.footnoteBackLabel||"Back to content",o.unknownHandler=t.unknownHandler,o.passThrough=t.passThrough,o.handlers={...vo,...t.handlers},o.definition=Ho(e),o.footnoteById=i,o.footnoteOrder=[],o.footnoteCounts={},o.patch=Vo,o.applyData=qo,o.one=u,o.all=s,o.wrap=Wo,o.augment=l,Ln(e,"footnoteDefinition",a=>{const c=String(a.identifier).toUpperCase();$e.call(i,c)||(i[c]=a)}),o;function l(a,c){if(a&&"data"in a&&a.data){const m=a.data;m.hName&&(c.type!=="element"&&(c={type:"element",tagName:"",properties:{},children:[]}),c.tagName=m.hName),c.type==="element"&&m.hProperties&&(c.properties={...c.properties,...m.hProperties}),"children"in c&&c.children&&m.hChildren&&(c.children=m.hChildren)}if(a){const m="type"in a?a:{position:a};jo(m)||(c.position={start:On(m),end:vn(m)})}return c}function o(a,c,m,d){return Array.isArray(m)&&(d=m,m={}),l(a,{type:"element",tagName:c,properties:m||{},children:d||[]})}function u(a,c){return nr(o,a,c)}function s(a){return Dn(o,a)}}function Vo(e,n){e.position&&(n.position=Eo(e))}function qo(e,n){let t=n;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,l=e.data.hProperties;typeof r=="string"&&(t.type==="element"?t.tagName=r:t={type:"element",tagName:r,properties:{},children:[]}),t.type==="element"&&l&&(t.properties={...t.properties,...l}),"children"in t&&t.children&&i!==null&&i!==void 0&&(t.children=i)}return t}function nr(e,n,t){const r=n&&n.type;if(!r)throw new Error("Expected node, got `"+n+"`");return $e.call(e.handlers,r)?e.handlers[r](e,n,t):e.passThrough&&e.passThrough.includes(r)?"children"in n?{...n,children:Dn(e,n)}:n:e.unknownHandler?e.unknownHandler(e,n,t):$o(e,n)}function Dn(e,n){const t=[];if("children"in n){const r=n.children;let i=-1;for(;++i<r.length;){const l=nr(e,r[i],n);if(l){if(i&&r[i-1].type==="break"&&(!Array.isArray(l)&&l.type==="text"&&(l.value=l.value.replace(/^\s+/,"")),!Array.isArray(l)&&l.type==="element")){const o=l.children[0];o&&o.type==="text"&&(o.value=o.value.replace(/^\s+/,""))}Array.isArray(l)?t.push(...l):t.push(l)}}}return t}function $o(e,n){const t=n.data||{},r="value"in n&&!($e.call(t,"hProperties")||$e.call(t,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:Dn(e,n)};return e.patch(n,r),e.applyData(n,r)}function Wo(e,n){const t=[];let r=-1;for(n&&t.push({type:"text",value:`
13
- `});++r<e.length;)r&&t.push({type:"text",value:`
14
- `}),t.push(e[r]);return n&&e.length>0&&t.push({type:"text",value:`
15
- `}),t}function Qo(e){const n=[];let t=-1;for(;++t<e.footnoteOrder.length;){const r=e.footnoteById[e.footnoteOrder[t]];if(!r)continue;const i=e.all(r),l=String(r.identifier).toUpperCase(),o=ve(l.toLowerCase());let u=0;const s=[];for(;++u<=e.footnoteCounts[l];){const m={type:"element",tagName:"a",properties:{href:"#"+e.clobberPrefix+"fnref-"+o+(u>1?"-"+u:""),dataFootnoteBackref:!0,className:["data-footnote-backref"],ariaLabel:e.footnoteBackLabel},children:[{type:"text",value:"↩"}]};u>1&&m.children.push({type:"element",tagName:"sup",children:[{type:"text",value:String(u)}]}),s.length>0&&s.push({type:"text",value:" "}),s.push(m)}const a=i[i.length-1];if(a&&a.type==="element"&&a.tagName==="p"){const m=a.children[a.children.length-1];m&&m.type==="text"?m.value+=" ":a.children.push({type:"text",value:" "}),a.children.push(...s)}else i.push(...s);const c={type:"element",tagName:"li",properties:{id:e.clobberPrefix+"fn-"+o},children:e.wrap(i,!0)};e.patch(r,c),n.push(c)}if(n.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:e.footnoteLabelTagName,properties:{...JSON.parse(JSON.stringify(e.footnoteLabelProperties)),id:"footnote-label"},children:[{type:"text",value:e.footnoteLabel}]},{type:"text",value:`
16
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(n,!0)},{type:"text",value:`
17
- `}]}}function tr(e,n){const t=Uo(e,n),r=t.one(e,null),i=Qo(t);return i&&r.children.push({type:"text",value:`
18
- `},i),Array.isArray(r)?{type:"root",children:r}:r}const Xo=function(e,n){return e&&"run"in e?Yo(e,n):Ko(e||n)};function Yo(e,n){return(t,r,i)=>{e.run(tr(t,n),r,l=>{i(l)})}}function Ko(e){return n=>tr(n,e)}var rr={exports:{}},Go="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Zo=Go,Jo=Zo;function ir(){}function lr(){}lr.resetWarningCache=ir;var eu=function(){function e(r,i,l,o,u,s){if(s!==Jo){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}e.isRequired=e;function n(){return e}var t={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:n,element:e,elementType:e,instanceOf:n,node:e,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n,checkPropTypes:lr,resetWarningCache:ir};return t.PropTypes=t,t};rr.exports=eu();var nu=rr.exports;const O=Me(nu);class je{constructor(n,t,r){this.property=n,this.normal=t,r&&(this.space=r)}}je.prototype.property={};je.prototype.normal={};je.prototype.space=null;function or(e,n){const t={},r={};let i=-1;for(;++i<e.length;)Object.assign(t,e[i].property),Object.assign(r,e[i].normal);return new je(t,r,n)}function En(e){return e.toLowerCase()}class le{constructor(n,t){this.property=n,this.attribute=t}}le.prototype.space=null;le.prototype.boolean=!1;le.prototype.booleanish=!1;le.prototype.overloadedBoolean=!1;le.prototype.number=!1;le.prototype.commaSeparated=!1;le.prototype.spaceSeparated=!1;le.prototype.commaOrSpaceSeparated=!1;le.prototype.mustUseProperty=!1;le.prototype.defined=!1;let tu=0;const v=Ce(),Q=Ce(),ur=Ce(),b=Ce(),U=Ce(),Oe=Ce(),ne=Ce();function Ce(){return 2**++tu}const An=Object.freeze(Object.defineProperty({__proto__:null,boolean:v,booleanish:Q,commaOrSpaceSeparated:ne,commaSeparated:Oe,number:b,overloadedBoolean:ur,spaceSeparated:U},Symbol.toStringTag,{value:"Module"})),dn=Object.keys(An);class zn extends le{constructor(n,t,r,i){let l=-1;if(super(n,t),Ct(this,"space",i),typeof r=="number")for(;++l<dn.length;){const o=dn[l];Ct(this,dn[l],(r&An[o])===An[o])}}}zn.prototype.defined=!0;function Ct(e,n,t){t&&(e[n]=t)}const ru={}.hasOwnProperty;function Le(e){const n={},t={};let r;for(r in e.properties)if(ru.call(e.properties,r)){const i=e.properties[r],l=new zn(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),n[r]=l,t[En(r)]=r,t[En(l.attribute)]=r}return new je(n,t,e.space)}const ar=Le({space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),sr=Le({space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function cr(e,n){return n in e?e[n]:n}function pr(e,n){return cr(e,n.toLowerCase())}const fr=Le({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:pr,properties:{xmlns:null,xmlnsXLink:null}}),hr=Le({transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:Q,ariaAutoComplete:null,ariaBusy:Q,ariaChecked:Q,ariaColCount:b,ariaColIndex:b,ariaColSpan:b,ariaControls:U,ariaCurrent:null,ariaDescribedBy:U,ariaDetails:null,ariaDisabled:Q,ariaDropEffect:U,ariaErrorMessage:null,ariaExpanded:Q,ariaFlowTo:U,ariaGrabbed:Q,ariaHasPopup:null,ariaHidden:Q,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:U,ariaLevel:b,ariaLive:null,ariaModal:Q,ariaMultiLine:Q,ariaMultiSelectable:Q,ariaOrientation:null,ariaOwns:U,ariaPlaceholder:null,ariaPosInSet:b,ariaPressed:Q,ariaReadOnly:Q,ariaRelevant:null,ariaRequired:Q,ariaRoleDescription:U,ariaRowCount:b,ariaRowIndex:b,ariaRowSpan:b,ariaSelected:Q,ariaSetSize:b,ariaSort:null,ariaValueMax:b,ariaValueMin:b,ariaValueNow:b,ariaValueText:null,role:null}}),iu=Le({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:pr,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Oe,acceptCharset:U,accessKey:U,action:null,allow:null,allowFullScreen:v,allowPaymentRequest:v,allowUserMedia:v,alt:null,as:null,async:v,autoCapitalize:null,autoComplete:U,autoFocus:v,autoPlay:v,blocking:U,capture:null,charSet:null,checked:v,cite:null,className:U,cols:b,colSpan:null,content:null,contentEditable:Q,controls:v,controlsList:U,coords:b|Oe,crossOrigin:null,data:null,dateTime:null,decoding:null,default:v,defer:v,dir:null,dirName:null,disabled:v,download:ur,draggable:Q,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:v,formTarget:null,headers:U,height:b,hidden:v,high:b,href:null,hrefLang:null,htmlFor:U,httpEquiv:U,id:null,imageSizes:null,imageSrcSet:null,inert:v,inputMode:null,integrity:null,is:null,isMap:v,itemId:null,itemProp:U,itemRef:U,itemScope:v,itemType:U,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:v,low:b,manifest:null,max:null,maxLength:b,media:null,method:null,min:null,minLength:b,multiple:v,muted:v,name:null,nonce:null,noModule:v,noValidate:v,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:v,optimum:b,pattern:null,ping:U,placeholder:null,playsInline:v,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:v,referrerPolicy:null,rel:U,required:v,reversed:v,rows:b,rowSpan:b,sandbox:U,scope:null,scoped:v,seamless:v,selected:v,shadowRootClonable:v,shadowRootDelegatesFocus:v,shadowRootMode:null,shape:null,size:b,sizes:null,slot:null,span:b,spellCheck:Q,src:null,srcDoc:null,srcLang:null,srcSet:null,start:b,step:null,style:null,tabIndex:b,target:null,title:null,translate:null,type:null,typeMustMatch:v,useMap:null,value:Q,width:b,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:U,axis:null,background:null,bgColor:null,border:b,borderColor:null,bottomMargin:b,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:v,declare:v,event:null,face:null,frame:null,frameBorder:null,hSpace:b,leftMargin:b,link:null,longDesc:null,lowSrc:null,marginHeight:b,marginWidth:b,noResize:v,noHref:v,noShade:v,noWrap:v,object:null,profile:null,prompt:null,rev:null,rightMargin:b,rules:null,scheme:null,scrolling:Q,standby:null,summary:null,text:null,topMargin:b,valueType:null,version:null,vAlign:null,vLink:null,vSpace:b,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:v,disableRemotePlayback:v,prefix:null,property:null,results:b,security:null,unselectable:null}}),lu=Le({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:cr,properties:{about:ne,accentHeight:b,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:b,amplitude:b,arabicForm:null,ascent:b,attributeName:null,attributeType:null,azimuth:b,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:b,by:null,calcMode:null,capHeight:b,className:U,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:b,diffuseConstant:b,direction:null,display:null,dur:null,divisor:b,dominantBaseline:null,download:v,dx:null,dy:null,edgeMode:null,editable:null,elevation:b,enableBackground:null,end:null,event:null,exponent:b,externalResourcesRequired:null,fill:null,fillOpacity:b,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Oe,g2:Oe,glyphName:Oe,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:b,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:b,horizOriginX:b,horizOriginY:b,id:null,ideographic:b,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:b,k:b,k1:b,k2:b,k3:b,k4:b,kernelMatrix:ne,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:b,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:b,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:b,overlineThickness:b,paintOrder:null,panose1:null,path:null,pathLength:b,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:U,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:b,pointsAtY:b,pointsAtZ:b,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ne,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ne,rev:ne,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ne,requiredFeatures:ne,requiredFonts:ne,requiredFormats:ne,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:b,specularExponent:b,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:b,strikethroughThickness:b,string:null,stroke:null,strokeDashArray:ne,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:b,strokeOpacity:b,strokeWidth:null,style:null,surfaceScale:b,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ne,tabIndex:b,tableValues:null,target:null,targetX:b,targetY:b,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ne,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:b,underlineThickness:b,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:b,values:null,vAlphabetic:b,vMathematical:b,vectorEffect:null,vHanging:b,vIdeographic:b,version:null,vertAdvY:b,vertOriginX:b,vertOriginY:b,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:b,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),ou=/^data[-\w.:]+$/i,Et=/-[a-z]/g,uu=/[A-Z]/g;function au(e,n){const t=En(n);let r=n,i=le;if(t in e.normal)return e.property[e.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&ou.test(n)){if(n.charAt(4)==="-"){const l=n.slice(5).replace(Et,cu);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=n.slice(4);if(!Et.test(l)){let o=l.replace(uu,su);o.charAt(0)!=="-"&&(o="-"+o),n="data"+o}}i=zn}return new i(r,n)}function su(e){return"-"+e.toLowerCase()}function cu(e){return e.charAt(1).toUpperCase()}const At={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},pu=or([sr,ar,fr,hr,iu],"html"),fu=or([sr,ar,fr,hr,lu],"svg");function hu(e){if(e.allowedElements&&e.disallowedElements)throw new TypeError("Only one of `allowedElements` and `disallowedElements` should be defined");if(e.allowedElements||e.disallowedElements||e.allowElement)return n=>{Ln(n,"element",(t,r,i)=>{const l=i;let o;if(e.allowedElements?o=!e.allowedElements.includes(t.tagName):e.disallowedElements&&(o=e.disallowedElements.includes(t.tagName)),!o&&e.allowElement&&typeof r=="number"&&(o=!e.allowElement(t,r,l)),o&&typeof r=="number")return e.unwrapDisallowed&&t.children?l.children.splice(r,1,...t.children):l.children.splice(r,1),r})}}var mr={exports:{}},_={};/**
19
- * @license React
20
- * react-is.production.min.js
21
- *
22
- * Copyright (c) Facebook, Inc. and its affiliates.
23
- *
24
- * This source code is licensed under the MIT license found in the
25
- * LICENSE file in the root directory of this source tree.
26
- */var Bn=Symbol.for("react.element"),Rn=Symbol.for("react.portal"),Xe=Symbol.for("react.fragment"),Ye=Symbol.for("react.strict_mode"),Ke=Symbol.for("react.profiler"),Ge=Symbol.for("react.provider"),Ze=Symbol.for("react.context"),mu=Symbol.for("react.server_context"),Je=Symbol.for("react.forward_ref"),en=Symbol.for("react.suspense"),nn=Symbol.for("react.suspense_list"),tn=Symbol.for("react.memo"),rn=Symbol.for("react.lazy"),du=Symbol.for("react.offscreen"),dr;dr=Symbol.for("react.module.reference");function oe(e){if(typeof e=="object"&&e!==null){var n=e.$$typeof;switch(n){case Bn:switch(e=e.type,e){case Xe:case Ke:case Ye:case en:case nn:return e;default:switch(e=e&&e.$$typeof,e){case mu:case Ze:case Je:case rn:case tn:case Ge:return e;default:return n}}case Rn:return n}}}_.ContextConsumer=Ze;_.ContextProvider=Ge;_.Element=Bn;_.ForwardRef=Je;_.Fragment=Xe;_.Lazy=rn;_.Memo=tn;_.Portal=Rn;_.Profiler=Ke;_.StrictMode=Ye;_.Suspense=en;_.SuspenseList=nn;_.isAsyncMode=function(){return!1};_.isConcurrentMode=function(){return!1};_.isContextConsumer=function(e){return oe(e)===Ze};_.isContextProvider=function(e){return oe(e)===Ge};_.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Bn};_.isForwardRef=function(e){return oe(e)===Je};_.isFragment=function(e){return oe(e)===Xe};_.isLazy=function(e){return oe(e)===rn};_.isMemo=function(e){return oe(e)===tn};_.isPortal=function(e){return oe(e)===Rn};_.isProfiler=function(e){return oe(e)===Ke};_.isStrictMode=function(e){return oe(e)===Ye};_.isSuspense=function(e){return oe(e)===en};_.isSuspenseList=function(e){return oe(e)===nn};_.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===Xe||e===Ke||e===Ye||e===en||e===nn||e===du||typeof e=="object"&&e!==null&&(e.$$typeof===rn||e.$$typeof===tn||e.$$typeof===Ge||e.$$typeof===Ze||e.$$typeof===Je||e.$$typeof===dr||e.getModuleId!==void 0)};_.typeOf=oe;mr.exports=_;var gu=mr.exports;const yu=Me(gu);function xu(e){const n=e&&typeof e=="object"&&e.type==="text"?e.value||"":e;return typeof n=="string"&&n.replace(/[ \t\n\f\r]/g,"")===""}function ku(e){return e.join(" ").trim()}function bu(e,n){const t={};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}var Nn={exports:{}},Ft=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,wu=/\n/g,Su=/^\s*/,Cu=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Eu=/^:\s*/,Au=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Fu=/^[;\s]*/,Pu=/^\s+|\s+$/g,Iu=`
27
- `,Pt="/",It="*",Se="",Tu="comment",Ou="declaration",vu=function(e,n){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];n=n||{};var t=1,r=1;function i(w){var x=w.match(wu);x&&(t+=x.length);var C=w.lastIndexOf(Iu);r=~C?w.length-C:r+w.length}function l(){var w={line:t,column:r};return function(x){return x.position=new o(w),a(),x}}function o(w){this.start=w,this.end={line:t,column:r},this.source=n.source}o.prototype.content=e;function u(w){var x=new Error(n.source+":"+t+":"+r+": "+w);if(x.reason=w,x.filename=n.source,x.line=t,x.column=r,x.source=e,!n.silent)throw x}function s(w){var x=w.exec(e);if(x){var C=x[0];return i(C),e=e.slice(C.length),x}}function a(){s(Su)}function c(w){var x;for(w=w||[];x=m();)x!==!1&&w.push(x);return w}function m(){var w=l();if(!(Pt!=e.charAt(0)||It!=e.charAt(1))){for(var x=2;Se!=e.charAt(x)&&(It!=e.charAt(x)||Pt!=e.charAt(x+1));)++x;if(x+=2,Se===e.charAt(x-1))return u("End of comment missing");var C=e.slice(2,x-2);return r+=2,i(C),e=e.slice(x),r+=2,w({type:Tu,comment:C})}}function d(){var w=l(),x=s(Cu);if(x){if(m(),!s(Eu))return u("property missing ':'");var C=s(Au),k=w({type:Ou,property:Tt(x[0].replace(Ft,Se)),value:C?Tt(C[0].replace(Ft,Se)):Se});return s(Fu),k}}function f(){var w=[];c(w);for(var x;x=d();)x!==!1&&(w.push(x),c(w));return w}return a(),f()};function Tt(e){return e?e.replace(Pu,Se):Se}var Lu=vu;function gr(e,n){var t=null;if(!e||typeof e!="string")return t;for(var r,i=Lu(e),l=typeof n=="function",o,u,s=0,a=i.length;s<a;s++)r=i[s],o=r.property,u=r.value,l?n(o,u,r):u&&(t||(t={}),t[o]=u);return t}Nn.exports=gr;Nn.exports.default=gr;var Du=Nn.exports;const zu=Me(Du),Fn={}.hasOwnProperty,Bu=new Set(["table","thead","tbody","tfoot","tr"]);function yr(e,n){const t=[];let r=-1,i;for(;++r<n.children.length;)i=n.children[r],i.type==="element"?t.push(Ru(e,i,r,n)):i.type==="text"?(n.type!=="element"||!Bu.has(n.tagName)||!xu(i))&&t.push(i.value):i.type==="raw"&&!e.options.skipHtml&&t.push(i.value);return t}function Ru(e,n,t,r){const i=e.options,l=i.transformLinkUri===void 0?Lr:i.transformLinkUri,o=e.schema,u=n.tagName,s={};let a=o,c;if(o.space==="html"&&u==="svg"&&(a=fu,e.schema=a),n.properties)for(c in n.properties)Fn.call(n.properties,c)&&Mu(s,c,n.properties[c],e);(u==="ol"||u==="ul")&&e.listDepth++;const m=yr(e,n);(u==="ol"||u==="ul")&&e.listDepth--,e.schema=o;const d=n.position||{start:{line:null,column:null,offset:null},end:{line:null,column:null,offset:null}},f=i.components&&Fn.call(i.components,u)?i.components[u]:u,w=typeof f=="string"||f===Ie.Fragment;if(!yu.isValidElementType(f))throw new TypeError(`Component for name \`${u}\` not defined or is not renderable`);if(s.key=t,u==="a"&&i.linkTarget&&(s.target=typeof i.linkTarget=="function"?i.linkTarget(String(s.href||""),n.children,typeof s.title=="string"?s.title:null):i.linkTarget),u==="a"&&l&&(s.href=l(String(s.href||""),n.children,typeof s.title=="string"?s.title:null)),!w&&u==="code"&&r.type==="element"&&r.tagName!=="pre"&&(s.inline=!0),!w&&(u==="h1"||u==="h2"||u==="h3"||u==="h4"||u==="h5"||u==="h6")&&(s.level=Number.parseInt(u.charAt(1),10)),u==="img"&&i.transformImageUri&&(s.src=i.transformImageUri(String(s.src||""),String(s.alt||""),typeof s.title=="string"?s.title:null)),!w&&u==="li"&&r.type==="element"){const x=Nu(n);s.checked=x&&x.properties?!!x.properties.checked:null,s.index=gn(r,n),s.ordered=r.tagName==="ol"}return!w&&(u==="ol"||u==="ul")&&(s.ordered=u==="ol",s.depth=e.listDepth),(u==="td"||u==="th")&&(s.align&&(s.style||(s.style={}),s.style.textAlign=s.align,delete s.align),w||(s.isHeader=u==="th")),!w&&u==="tr"&&r.type==="element"&&(s.isHeader=r.tagName==="thead"),i.sourcePos&&(s["data-sourcepos"]=Hu(d)),!w&&i.rawSourcePos&&(s.sourcePosition=n.position),!w&&i.includeElementIndex&&(s.index=gn(r,n),s.siblingCount=gn(r)),w||(s.node=n),m.length>0?Ie.createElement(f,s,m):Ie.createElement(f,s)}function Nu(e){let n=-1;for(;++n<e.children.length;){const t=e.children[n];if(t.type==="element"&&t.tagName==="input")return t}return null}function gn(e,n){let t=-1,r=0;for(;++t<e.children.length&&e.children[t]!==n;)e.children[t].type==="element"&&r++;return r}function Mu(e,n,t,r){const i=au(r.schema,n);let l=t;l==null||l!==l||(Array.isArray(l)&&(l=i.commaSeparated?bu(l):ku(l)),i.property==="style"&&typeof l=="string"&&(l=_u(l)),i.space&&i.property?e[Fn.call(At,i.property)?At[i.property]:i.property]=l:i.attribute&&(e[i.attribute]=l))}function _u(e){const n={};try{zu(e,t)}catch{}return n;function t(r,i){const l=r.slice(0,4)==="-ms-"?`ms-${r.slice(4)}`:r;n[l.replace(/-([a-z])/g,ju)]=i}}function ju(e,n){return n.toUpperCase()}function Hu(e){return[e.start.line,":",e.start.column,"-",e.end.line,":",e.end.column].map(String).join("")}const Ot={}.hasOwnProperty,Uu="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ue={plugins:{to:"remarkPlugins",id:"change-plugins-to-remarkplugins"},renderers:{to:"components",id:"change-renderers-to-components"},astPlugins:{id:"remove-buggy-html-in-markdown-parser"},allowDangerousHtml:{id:"remove-buggy-html-in-markdown-parser"},escapeHtml:{id:"remove-buggy-html-in-markdown-parser"},source:{to:"children",id:"change-source-to-children"},allowNode:{to:"allowElement",id:"replace-allownode-allowedtypes-and-disallowedtypes"},allowedTypes:{to:"allowedElements",id:"replace-allownode-allowedtypes-and-disallowedtypes"},disallowedTypes:{to:"disallowedElements",id:"replace-allownode-allowedtypes-and-disallowedtypes"},includeNodeIndex:{to:"includeElementIndex",id:"change-includenodeindex-to-includeelementindex"}};function xr(e){for(const l in Ue)if(Ot.call(Ue,l)&&Ot.call(e,l)){const o=Ue[l];console.warn(`[react-markdown] Warning: please ${o.to?`use \`${o.to}\` instead of`:"remove"} \`${l}\` (see <${Uu}#${o.id}> for more info)`),delete Ue[l]}const n=Xr().use(ro).use(e.remarkPlugins||[]).use(Xo,{...e.remarkRehypeOptions,allowDangerousHtml:!0}).use(e.rehypePlugins||[]).use(hu,e),t=new Dt;typeof e.children=="string"?t.value=e.children:e.children!==void 0&&e.children!==null&&console.warn(`[react-markdown] Warning: please pass a string as \`children\` (not: \`${e.children}\`)`);const r=n.runSync(n.parse(t),t);if(r.type!=="root")throw new TypeError("Expected a `root` node");let i=Ie.createElement(Ie.Fragment,{},yr({options:e,schema:pu,listDepth:0},r));return e.className&&(i=Ie.createElement("div",{className:e.className},i)),i}xr.propTypes={children:O.string,className:O.string,allowElement:O.func,allowedElements:O.arrayOf(O.string),disallowedElements:O.arrayOf(O.string),unwrapDisallowed:O.bool,remarkPlugins:O.arrayOf(O.oneOfType([O.object,O.func,O.arrayOf(O.oneOfType([O.bool,O.string,O.object,O.func,O.arrayOf(O.any)]))])),rehypePlugins:O.arrayOf(O.oneOfType([O.object,O.func,O.arrayOf(O.oneOfType([O.bool,O.string,O.object,O.func,O.arrayOf(O.any)]))])),sourcePos:O.bool,rawSourcePos:O.bool,skipHtml:O.bool,includeElementIndex:O.bool,transformLinkUri:O.oneOfType([O.func,O.bool]),linkTarget:O.oneOfType([O.func,O.string]),transformImageUri:O.func,components:O.object};const yn={hub_restart:{title:"Hub restart",markdown:`# Hub Restart
28
-
29
- A session was terminated because the Xenon hub restarted while the test was
30
- mid-flight. The agent's connection was lost and the session was reaped by the
31
- heartbeat watchdog.
32
-
33
- ## Likely causes
34
-
35
- - Operator triggered a manual restart from the dashboard.
36
- - Process supervisor restarted the hub after a crash or a deploy.
37
- - The host running the hub was rebooted or hibernated.
38
-
39
- ## Remediation
40
-
41
- 1. Re-trigger the affected sessions from your test runner — the device was
42
- released cleanly back into the pool, so a retry should land on a healthy
43
- hub.
44
- 2. Check \`/var/log/xenon-hub.log\` and the process supervisor's restart
45
- history around the failure timestamp to confirm whether this was a manual
46
- restart, a crash, or a deploy.
47
- 3. If restarts are frequent or unplanned, correlate them with recent deploys
48
- and coordinate a maintenance window — a clean restart or redeploy drains
49
- active sessions first (bounded grace period to archive video and release
50
- ports); drained sessions are marked failed with reason "Hub shutdown". A
51
- crash or forced host reboot skips the drain; orphaned sessions are reaped
52
- by the heartbeat watchdog and marked failed ("Session orphaned"). Orphaned
53
- live recordings are separately marked failed with \`fail_reason=server_restart\`
54
- on next boot.
55
-
56
- ## Related
57
-
58
- - Session lifecycle: see \`SessionLifecycleService.ts\`
59
- - Heartbeat watchdog: see \`SessionHeartbeatService\` / \`OrphanSweeper.sweep\`
60
- `},timeout:{title:"Timeout",markdown:`# Timeout
61
-
62
- The session hit a wall-clock timeout — either the per-command \`newCommandTimeout\`
63
- or the session-level deadline. Xenon force-killed the session so its device
64
- could be released back into the pool.
65
-
66
- ## Likely causes
67
-
68
- - Test step waited indefinitely on a missing element.
69
- - Slow device or flaky network.
70
- - A driver bug caused the WebDriver call to never return.
71
-
72
- ## Remediation
73
-
74
- Increase \`newCommandTimeout\` only if the app legitimately needs long idle
75
- gaps. Otherwise:
76
-
77
- 1. Check the last command in **Text Logs** — if it's a find, fix the selector
78
- or add an explicit wait.
79
- 2. Verify the device wasn't thermally throttled or offline during the run
80
- (**Device health** badges).
81
- 3. If the same command times out across runs, file a bug against the test —
82
- or against the driver if the call obviously stalled.
83
- `},infrastructure:{title:"Infrastructure",markdown:`# Infrastructure
84
-
85
- The session failed because of a problem outside the test code — typically the
86
- node, the device, or the network underneath them.
87
-
88
- ## Likely causes
89
-
90
- - Node lost its connection to the hub.
91
- - ADB / WDA daemon crashed on the node.
92
- - Device went offline mid-session.
93
- - Backing storage / Prisma DB hiccup.
94
-
95
- ## Remediation
96
-
97
- 1. Cross-reference the **Device Logs** tab on this session with the node's
98
- own process metrics around the failure timestamp to see which layer
99
- dropped — hub connection, daemon, device, or storage.
100
- 2. If the node's heartbeat is missing, restart its Xenon agent process; if
101
- ADB/WDA crashed, bounce the daemon first.
102
- 3. If the device shows offline in the device list, reseat or reconnect it
103
- (USB or Wi-Fi debugging) and confirm it re-enumerates before re-queuing
104
- sessions on it.
105
- 4. For repeated storage/DB hiccups, check disk space and the Prisma
106
- connection pool limits on the hub host.
107
- `},unknown:{title:"Unknown",markdown:`# Unknown failure category
108
-
109
- We weren't able to attribute this failure to a known bucket. The session has
110
- \`failure_category=null\` (or a category we don't have a runbook for yet).
111
-
112
- ## What to do
113
-
114
- 1. Open the **Failure summary** card for the raw \`failure_reason\` and the
115
- first error log entry.
116
- 2. If you can identify a clear category (timeout, hub restart, node outage,
117
- etc.), file a follow-up to add the right \`failure_category\` mapping in
118
- \`SessionLifecycleService\`.
119
- 3. For one-off oddities, re-run the session and watch for a pattern.
120
-
121
- If you keep landing on this fallback for the same kind of failure, that's a
122
- signal worth reporting — adding the right \`failure_category\` mapping
123
- upstream means future occurrences get a real runbook instead of this one.
124
- `}};function vt(e){if(!e)return yn.unknown;const n=e.toLowerCase().trim().replace(/[\s-]+/g,"_");return yn[n]??yn.unknown}const Vu={ul:({node:e,ordered:n,depth:t,className:r,...i})=>J.jsx("ul",{className:`list-disc space-y-1 ${r??""}`.trim(),...i}),ol:({node:e,ordered:n,depth:t,className:r,...i})=>J.jsx("ol",{className:`list-decimal space-y-1 ${r??""}`.trim(),...i})},Wu=()=>{const{category:e}=Ir(),n=Tr(),t=vt(e),r=!e||e&&vt(e).title==="Unknown"&&e.toLowerCase()!=="unknown",i=()=>{if(window.history.length<=1){n("/overview");return}n(-1)};return J.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[J.jsxs("header",{className:"flex items-center justify-between gap-4 px-4 py-3 border-b border-[var(--border)] bg-[var(--surface)]",children:[J.jsxs("button",{type:"button",onClick:i,className:"inline-flex items-center gap-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)] transition-colors",children:[J.jsx(vr,{className:"h-3.5 w-3.5"}),"Back"]}),J.jsxs("div",{className:"flex items-center gap-2 text-xs text-[var(--text-dim)]",children:[J.jsx(Or,{className:"h-3.5 w-3.5"}),J.jsx("span",{className:"",children:"Runbook"})]})]}),J.jsx("div",{className:"flex-1 overflow-y-auto",children:J.jsxs("article",{className:"max-w-3xl mx-auto px-6 py-8 prose prose-invert prose-sm runbook-prose",children:[r&&J.jsxs("div",{className:"mb-4 rounded-md border border-[var(--amber)]/30 bg-[var(--amber)]/5 px-3 py-2 text-xs text-[var(--amber)]",children:["No runbook for category ",J.jsx("code",{className:"font-mono",children:e})," — showing the fallback."]}),J.jsx(xr,{components:Vu,children:t.markdown})]})})]})};export{Wu as RunbookPage,Wu as default};
@@ -1,4 +0,0 @@
1
- import{r as x,X as S,j as t,e as te,f as $e,t as H,y as Ae,R as Ee,p as De,i as Le,u as Me}from"./index-BbKEXUFH.js";import{C as Oe,d as Fe,p as Ne,e as Pe,r as ye,f as Be,j as we,k as G,c as He,h as re,u as Ie,b as Ue,q as Ve}from"./use-builds-data-J-riQYyC.js";import{A as Je}from"./arrow-left-MMbTmgoE.js";import{C as K}from"./chevron-right-BRYJJVC9.js";import{s as We}from"./labels-C21SA4JG.js";import{B as ze,S as ke,P as $}from"./BugReportButton-BAt0_pzq.js";import{C as Ke}from"./circle-x-DlDJtnVz.js";import{C as qe}from"./circle-check-CqAJjQ5O.js";import{S as F}from"./stat-tile-BV98e_Sv.js";import{C as X}from"./copy-CAQydNFe.js";import{A as Ge}from"./arrow-up-right-DuAftMWB.js";import{A as Xe}from"./arrow-right-BMfnGmxW.js";import{f as Ye,a as se,C as Se,b as Qe,s as Ze,L as et,n as ae}from"./line-chart-D2DyJCml.js";import{E as M}from"./EmptyState-BSjhk_IV.js";import{A as tt}from"./activity-DOVdsfMQ.js";import{V as rt}from"./video-off-DDsEISjV.js";import{D as _e}from"./download-C9XG6lLv.js";import{T as st,a as at,b as ne,c as E,d as nt,e as D}from"./Table-BcTm5xV2.js";import{M as it}from"./Modal-CFCp3n9d.js";import{N as ot}from"./network-ebT86qoi.js";import"./time-D-gjmE1o.js";import"./index-DJGc1M2f.js";const lt=4e3,ie=e=>!!e&&typeof e=="object"&&typeof e.id=="string"&&typeof e.status=="string";function ct(e){const[r,s]=x.useState(null),[a,n]=x.useState([]),[o,l]=x.useState([]),[i,c]=x.useState([]),[u,b]=x.useState([]),[h,v]=x.useState(!0),[y,g]=x.useState(null),[N,w]=x.useState(!1),[T,A]=x.useState(0),_=x.useRef(null);x.useEffect(()=>{if(!e){s(null),n([]),l([]),c([]),b([]),w(!1),v(!1);return}let p=!0;return _.current!==e&&v(!0),Promise.all([S.getSession(e),S.getSessionLogs(e),S.getDeviceLogs(e),S.getDebugLogs(e),S.getProfilingData(e).catch(()=>[])]).then(([f,C,d,j,L])=>{if(!p)return;const O=ie(f);s(O?f:null),O?(_.current=e,w(!1),g(null)):(w(!!f&&typeof f=="object"&&(f.error===!0||typeof f.message=="string")),g(typeof(f==null?void 0:f.message)=="string"?f.message:"Session not found")),n(Array.isArray(C)?C:[]),l(Array.isArray(d)?d:[]),c(Array.isArray(j)?j:[]),b(Array.isArray(L)?L:[])}).catch(f=>{p&&g(f instanceof Error?f.message:String(f))}).finally(()=>{p&&v(!1)}),()=>{p=!1}},[e,T]);const m=(r==null?void 0:r.status)==="running";return x.useEffect(()=>{if(!e||!m)return;let p=!0;const f=setInterval(async()=>{try{const[C,d]=await Promise.all([S.getSession(e),S.getSessionLogs(e)]);if(!p||!ie(C))return;s(C),Array.isArray(d)&&n(d),C.status!=="running"&&A(j=>j+1)}catch{}},lt);return()=>{p=!1,clearInterval(f)}},[e,m]),{session:r,sessionLogs:a,deviceLogs:o,debugLogs:i,profiling:u,loading:h,error:y,notFound:N,refresh:()=>A(p=>p+1)}}const oe=({buildId:e,buildName:r,sessionId:s})=>t.jsxs("nav",{"aria-label":"Breadcrumb",className:"flex items-center gap-2 px-4 py-2 border-b border-[var(--border)] bg-[var(--surface)]",children:[t.jsxs(te,{to:"/builds",className:"inline-flex items-center gap-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)] transition-colors",children:[t.jsx(Je,{className:"h-3.5 w-3.5"}),"Sessions"]}),t.jsx(K,{className:"h-3 w-3 text-[var(--text-dim)]"}),r&&t.jsxs(t.Fragment,{children:[t.jsx(te,{to:`/builds/${e}`,className:"text-[11px] text-[var(--color-accent)] hover:underline",children:r}),t.jsx(K,{className:"h-3 w-3 text-[var(--text-dim)]"})]}),t.jsxs("span",{className:"font-mono text-[11px] text-[var(--text-muted)]",title:s,children:["#",s.slice(0,8)]})]}),dt={passed:{label:"Passed",Icon:qe,cls:"text-[var(--color-success)]"},failed:{label:"Failed",Icon:Ke,cls:"text-[var(--color-danger)]"},running:{label:"Running",Icon:$e,cls:"text-[var(--color-warning)]"},other:{Icon:Oe,cls:"text-[var(--text-dim)]"}};function Y(e){const r=He(e),s=dt[r];return{bucket:r,...s,label:s.label??We(e||"unknown")}}const xt=({session:e})=>{var o,l;const r=Y(e.status),s=Fe(e),a=[Ne(e),e.device_version].filter(i=>i&&i!=="—").join(" "),n=[[Pe(e),a].filter(Boolean).join(" · "),ye(e.ranOn),(o=e.owner)==null?void 0:o.name,Be(e.startTime),we(G(e))].filter(i=>i&&i!=="—");return t.jsxs("header",{className:"flex items-start justify-between gap-4 px-4 py-4 border-b border-[var(--border)] bg-[var(--surface)]",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsxs("span",{className:`inline-flex items-center gap-1.5 text-xs font-medium shrink-0 ${r.cls}`,children:[t.jsx(r.Icon,{className:`h-3.5 w-3.5 ${r.bucket==="running"?"animate-spin":""}`,"aria-hidden":"true"}),r.label]}),t.jsx("h1",{className:`text-lg font-semibold truncate ${s.source==="name"?"text-[var(--text)]":"text-[var(--text-muted)]"}`,title:s.source==="name"?s.text:`${s.text}
2
- Unnamed session. Set xe:options.name in its capabilities to name it.`,children:s.text})]}),t.jsx("p",{"data-testid":"outcome-meta",className:"mt-1 text-xs text-[var(--text-muted)] tabular-nums truncate",title:((l=e.owner)==null?void 0:l.email)??void 0,children:n.join(" · ")})]}),t.jsx("div",{className:"shrink-0",children:t.jsx(ze,{sessionId:e.id,mode:"full",variant:"inline"})})]})};function mt(e,r=8){if(!e)return[];const s=e.split(/\r?\n/),a=[];for(const n of s){const o=n.trim();if(/^at\s+/.test(o)&&(a.push(o),a.length>=r))break}return a}function Q(e){return e?e.split(/[_\s]+/).filter(Boolean).map(r=>r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join(" "):""}function le(e){if(!e)return{};try{const r=JSON.parse(e);return r&&typeof r=="object"&&!Array.isArray(r)?r:{}}catch{return{}}}function ce(e,r=200){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{const s=JSON.stringify(e);return s.length>r?s.slice(0,r)+"…":s}catch{return String(e)}}const I=e=>e.command_name||e.title||"command",q=e=>{const r=e.createdAt?Date.parse(e.createdAt):NaN;return Number.isFinite(r)?r:0},Z=e=>[...e].sort((r,s)=>q(r)-q(s));function U(e){return e.is_success===!1||e.is_error===!0}function Ce(e){const r=[];let s=null;for(const a of Z(e))a.is_healed&&a.healing_tier&&!r.includes(a.healing_tier)&&r.push(a.healing_tier),typeof a.duration=="number"&&(!s||a.duration>s.ms)&&(s={name:I(a),ms:a.duration});return{total:e.length,failed:e.filter(U).length,healed:e.filter(a=>a.is_healed).length,healedTiers:r,slowest:s,screenshots:e.filter(a=>a.screenshot).length}}const de=(e,r)=>r?e?`${e}=${r}`:r:null;function ut(e){return Z(e.filter(r=>r.is_healed)).map(r=>({id:r.id,command:I(r),original:de(r.original_strategy,r.original_selector),healed:de(r.healed_strategy,r.healed_selector),tier:r.healing_tier??null,confidence:typeof r.healing_confidence=="number"?Math.round(r.healing_confidence*100):null,at:r.createdAt}))}function ft(e){var r;if(!e.response)return null;try{const s=(r=JSON.parse(e.response))==null?void 0:r.value;if(!s||typeof s!="object")return null;const a=typeof s.message=="string"?s.message.trim():"";return a||(typeof s.error=="string"&&s.error?s.error:null)}catch{return null}}function ht(e){if(e.length===0)return{spanMs:0,bars:[]};const r=e.map(n=>{const o=q(n),l=typeof n.duration=="number"&&n.duration>0?n.duration:0;return{l:n,start:o-l,end:o,durationMs:l}}),s=Math.min(...r.map(n=>n.start)),a=Math.max(...r.map(n=>n.end));return{spanMs:Math.max(1,a-s),bars:r.sort((n,o)=>n.start-o.start).map(({l:n,start:o,durationMs:l})=>({id:n.id,label:I(n),startMs:o-s,durationMs:l,failed:U(n),healed:!!n.is_healed}))}}function pt(e){return Z(e.filter(r=>r.screenshot)).map(r=>({id:r.id,path:r.screenshot,command:I(r),at:r.createdAt,failed:U(r)}))}function B(e){if(e==null||!Number.isFinite(e)||e<0)return"—";if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const r=Math.round(e/1e3);return`${Math.floor(r/60)}m ${r%60}s`}const vt=({session:e,commands:r})=>{var l,i;const s=Y(e.status),a=Ce(r),n=we(G(e)),o=s.bucket==="failed"?Q(e.failure_category)||"No category recorded":s.bucket==="running"?`Running for ${n}`:`Ran ${n}`;return t.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[t.jsx(F,{label:"Result",value:s.label,valueCls:s.cls,note:o,noteTone:s.bucket==="failed"?"bad":"neutral"}),t.jsx(F,{label:"Commands",value:a.total,note:a.failed>0?`${a.failed} failed`:"None failed",noteTone:a.failed>0?"bad":"neutral"}),t.jsx(F,{label:"Self-healing",value:a.healed>0?`${a.healed} healed`:"None",note:a.healed>0?a.healedTiers.join(", ")||"Tier not recorded":"No selector needed healing"}),t.jsx(F,{label:"Slowest command",value:B((l=a.slowest)==null?void 0:l.ms),note:((i=a.slowest)==null?void 0:i.name)??"No timings recorded"})]})};function bt(e){const r=e.filter(U),s=r[r.length-1];return s?{command:s.command_name||s.title||"command",message:ft(s)}:null}function gt(e,r,s,a,n){var u;const o=Q(e.failure_category),l=((u=e.device_name)==null?void 0:u.trim())||"Unknown Device",i=e.device_version?` ${e.device_version}`:"",c=n?`${n.command}${n.message?`: ${n.message}`:""}`:"(no failed command recorded)";return[`**Session:** ${e.id}`,`**Build:** ${r} (#${s})`,`**Device:** ${l} (${e.node_id||"unknown-node"}) · ${e.device_platform||"unknown"}${i}`,`**Duration:** ${a}`,`**Failure category:** ${o||"(uncategorized)"}`,`**Failure reason:** ${e.failure_reason||"(not set)"}`,`**First failed command:** ${c}`,...e.ai_analysis?[`**AI analysis:** ${e.ai_analysis}`]:[]].join(`
3
- `)}function jt({text:e}){return t.jsx(t.Fragment,{children:e.split(/(\*\*[^*]+\*\*|`[^`]+`)/g).map((r,s)=>/^\*\*[^*]+\*\*$/.test(r)?t.jsx("strong",{children:r.slice(2,-2)},s):/^`[^`]+`$/.test(r)?t.jsx("code",{className:"font-mono text-[11px] px-1 rounded bg-[var(--surface-2)]",children:r.slice(1,-1)},s):t.jsx(Ee.Fragment,{children:r},s))})}const P=({children:e})=>t.jsx("div",{className:"text-[11px] font-semibold text-[var(--text-dim)] mb-1",children:e}),Nt=({session:e,buildName:r,buildId:s,commands:a,durationText:n})=>{var N;const{toast:o}=H(),[l,i]=x.useState(!1),c=Q(e.failure_category),u=bt(a),b=mt(e.failure_reason),h=(N=e.ai_analysis)==null?void 0:N.trim(),v=!!h&&h.length>480,y=async()=>{const w=gt(e,r,s,n,u);try{await navigator.clipboard.writeText(w),o("Failure report copied","success")}catch{o("Clipboard unavailable","error")}},g=e.failure_category?`/xenon/runbooks/${encodeURIComponent(e.failure_category.toLowerCase())}`:void 0;return t.jsxs("section",{className:"rounded-lg border border-[var(--red)]/30 bg-[var(--surface)] overflow-hidden",children:[t.jsxs("header",{className:"flex items-center justify-between gap-4 px-4 py-3 border-b border-[var(--border)] bg-[var(--red)]/5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ae,{className:"h-4 w-4 text-[var(--red)]","aria-hidden":"true"}),t.jsx("h2",{className:"text-sm font-semibold text-[var(--red)]",children:"Why it failed"}),c&&t.jsx("span",{className:"text-[11px] text-[var(--text-dim)] ml-2",children:c})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{type:"button",onClick:y,className:"inline-flex items-center gap-1.5 h-7 px-2.5 rounded-md border border-[var(--border)] text-xs text-[var(--text)] hover:border-[var(--border-strong)] hover:bg-[var(--surface-2)] transition-colors",children:[t.jsx(X,{className:"h-3 w-3"}),"Copy"]}),t.jsxs("a",{...g?{href:g,target:"_blank",rel:"noreferrer"}:{"aria-disabled":!0,onClick:w=>w.preventDefault()},className:`inline-flex items-center gap-1.5 h-7 px-2.5 rounded-md border border-[var(--border)] text-xs text-[var(--text)] hover:border-[var(--border-strong)] hover:bg-[var(--surface-2)] transition-colors ${g?"":"opacity-50 cursor-not-allowed"}`,title:g?"Open runbook in new tab":"No runbook — failure category not set",children:[t.jsx(Ge,{className:"h-3 w-3"}),"Open runbook"]})]})]}),t.jsxs("div",{className:"px-4 py-4 space-y-4",children:[t.jsxs("div",{children:[t.jsx(P,{children:"Reason"}),t.jsx("div",{className:"text-sm text-[var(--text)] break-words",children:e.failure_reason||t.jsx("span",{className:"text-[var(--text-dim)]",children:"(not set)"})})]}),t.jsxs("div",{children:[t.jsx(P,{children:"First failed command"}),u?t.jsxs("div",{className:"flex items-baseline gap-2 min-w-0 text-sm",children:[t.jsx("span",{className:"font-mono text-xs text-[var(--color-danger)] shrink-0",children:u.command}),u.message&&t.jsx("span",{className:"text-[var(--text-muted)] break-words min-w-0",children:u.message})]}):t.jsx("span",{className:"text-sm text-[var(--text-dim)]",children:"No failed command recorded."})]}),h&&t.jsxs("div",{"data-testid":"ai-analysis",children:[t.jsx(P,{children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(ke,{className:"h-3 w-3","aria-hidden":"true"}),"AI analysis"]})}),t.jsx("div",{className:`text-sm text-[var(--text)] whitespace-pre-wrap break-words ${v&&!l?"line-clamp-6":""}`,children:t.jsx(jt,{text:h})}),v&&t.jsx("button",{type:"button",onClick:()=>i(w=>!w),"aria-expanded":l,className:"mt-1 text-xs text-[var(--color-accent)] hover:underline",children:l?"Show less":"Show all"})]}),b.length>0&&t.jsxs("div",{children:[t.jsx(P,{children:"Stack trace"}),t.jsx("pre",{className:"rounded-md border border-[var(--border)] bg-[var(--bg)] p-3 font-mono text-[11px] leading-relaxed text-[var(--color-accent)] overflow-x-auto",children:b.join(`
4
- `)})]})]})]})};function yt(e){return e>=1e3?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:String(e)}function V(e){const r=e;return typeof r.message=="string"&&!r.command_name&&!r.title}const wt=/^\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}\.\d+\s+\d+\s+\d+\s+([VDIWEF])\s/,kt=/^([VDIWEF])\/[^(:]*[(:]/,St=/<(Error|Fault|Warning)>/;function Te(e){var a,n,o;const r=((a=wt.exec(e))==null?void 0:a[1])??((n=kt.exec(e))==null?void 0:n[1]);if(r)return r==="E"||r==="F"?"error":r==="W"?"warn":null;const s=(o=St.exec(e))==null?void 0:o[1];return s?s==="Warning"?"warn":"error":null}function J(e){const r=e.timestamp;if(!r){const l=e.createdAt;return l?J({timestamp:l}):"--:--:--"}const s=typeof r=="number"?new Date(r):new Date(String(r));if(Number.isNaN(s.getTime()))return"--:--:--";const a=String(s.getHours()).padStart(2,"0"),n=String(s.getMinutes()).padStart(2,"0"),o=String(s.getSeconds()).padStart(2,"0");return`${a}:${n}:${o}`}function _t(e){if(V(e)){const s=Te(e.message);return s==="error"?{label:"error",tone:"red"}:s==="warn"?{label:"warn",tone:"amber"}:{label:"",tone:"neutral"}}if(e.is_healed===!0)return{label:String(e.command_name||"healed"),tone:"amber"};if(e.is_success===!1||e.is_error===!0)return{label:String(e.command_name||e.title||"error"),tone:"red"};if(e.is_success===!0)return{label:String(e.command_name||e.title||"ok"),tone:"green"};const r=e.title||e.event||e.command_name;return typeof r=="string"?/stop|fail|error/i.test(r)?{label:r,tone:"red"}:/start|begin|init/i.test(r)?{label:r,tone:"green"}:{label:r,tone:"blue"}:{label:"log",tone:"neutral"}}function Ct(e){if(e==null)return"";if(typeof e=="string")try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Tt(e){if(!e||typeof e!="string")return[{text:String(e??""),kind:"plain"}];const r=[],s=/("(?:\\.|[^"\\])*")(\s*:)|("(?:\\.|[^"\\])*")|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|\b(true|false)\b|\b(null)\b|([{}[\],])/g;let a=0,n;for(;(n=s.exec(e))!==null;)n.index>a&&r.push({text:e.slice(a,n.index),kind:"plain"}),n[1]&&n[2]!==void 0?(r.push({text:n[1],kind:"key"}),r.push({text:n[2],kind:"punct"})):n[3]?r.push({text:n[3],kind:"string"}):n[4]?r.push({text:n[4],kind:"number"}):n[5]?r.push({text:n[5],kind:"boolean"}):n[6]?r.push({text:n[6],kind:"null"}):n[7]&&r.push({text:n[7],kind:"punct"}),a=s.lastIndex;return a<e.length&&r.push({text:e.slice(a),kind:"plain"}),r}function Rt(e){if(V(e))return e.message.split(/\r?\n/,1)[0].trimEnd();const r=e,s=typeof r.title=="string"&&r.title.trim()?r.title.trim():null,a=typeof r.command_name=="string"&&r.command_name.trim()?r.command_name.trim():null;return s??a??"Command"}function xe(e){const r=e.subtitle;return typeof r=="string"&&r.trim()?r.trim():null}function $t(e,r){return r?e.filter(s=>s.is_success===!1||s.is_error===!0||V(s)&&Te(s.message)==="error"):e}const At=({commands:e})=>{const r=ut(e);return r.length===0?null:t.jsxs("section",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface)] overflow-hidden",children:[t.jsxs("header",{className:"flex items-center gap-2 px-4 py-3 border-b border-[var(--border)]",children:[t.jsx(ke,{className:"h-4 w-4 text-[var(--color-warning)]","aria-hidden":"true"}),t.jsx("h2",{className:"text-sm font-semibold text-[var(--text)]",children:"Self-healing"}),t.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[r.length," selector",r.length===1?"":"s"," healed. Update the test so the next run doesn't need to."]})]}),t.jsxs("table",{className:"w-full table-fixed text-left",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] text-[var(--text-dim)]",children:[t.jsx("th",{className:"px-4 py-2 font-medium w-[88px]",children:"Time"}),t.jsx("th",{className:"px-3 py-2 font-medium w-[128px]",children:"Command"}),t.jsx("th",{className:"px-3 py-2 font-medium",children:"Asked for"}),t.jsx("th",{className:"w-[28px]",children:t.jsx("span",{className:"sr-only",children:"healed to"})}),t.jsx("th",{className:"px-3 py-2 font-medium",children:"Healed to"}),t.jsx("th",{className:"px-3 py-2 font-medium w-[112px]",children:"Tier"}),t.jsx("th",{className:"px-4 py-2 font-medium w-[96px] text-right",children:"Confidence"})]})}),t.jsx("tbody",{children:r.map((s,a)=>t.jsxs("tr",{className:"border-b border-[var(--border)] last:border-b-0 align-top",children:[t.jsx("td",{className:"px-4 py-2 text-xs text-[var(--text-muted)] tabular-nums",children:J({timestamp:s.at??null})}),t.jsx("td",{className:"px-3 py-2 text-xs text-[var(--text)] truncate",children:s.command}),t.jsx("td",{className:"px-3 py-2 font-mono text-[11px] text-[var(--text-muted)] break-all",children:s.original??"—"}),t.jsx("td",{className:"py-2 text-[var(--text-dim)]",children:t.jsx(Xe,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),t.jsx("td",{className:"px-3 py-2 font-mono text-[11px] text-[var(--text)] break-all",children:s.healed??"—"}),t.jsx("td",{className:"px-3 py-2 text-xs text-[var(--text)]",children:s.tier??"—"}),t.jsx("td",{className:"px-4 py-2 text-xs text-[var(--text)] tabular-nums text-right",children:s.confidence===null?"—":`${s.confidence}%`})]},s.id??a))})]})]})},Et=1e4,me="var(--color-info)",ue="var(--color-accent)",Dt="var(--border-strong)";function fe(e){return e>=1024?ae(e/1024)*1024:ae(e)}const he=e=>{let r=0;for(const s of e)for(const a of s.values)a!==null&&a>r&&(r=a);return r},z=({title:e,series:r,times:s,yMax:a,format:n,ariaLabel:o})=>t.jsxs("section",{"aria-label":e,children:[t.jsxs("div",{className:"mb-2 flex flex-wrap items-baseline gap-x-4 gap-y-1",children:[t.jsx("h3",{className:"text-xs font-semibold text-[var(--text)]",children:e}),r.map(l=>{const i=Ze(l.values);return t.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[11px] tabular-nums text-[var(--text-muted)]",children:[t.jsx("span",{className:"inline-block h-0.5 w-3 shrink-0",style:{background:l.color}}),t.jsx("span",{className:"max-w-[16rem] truncate",title:l.label,children:l.label}),i&&(l.dashed?t.jsx("span",{children:n(i.peak)}):t.jsxs("span",{children:["peak ",n(i.peak)," · avg ",n(i.average)]}))]},l.key)})]}),t.jsx(et,{times:s,series:r,yMax:a,formatValue:n,ariaLabel:o})]}),Lt=({sessionId:e,running:r,hasTrace:s})=>{const[a,n]=x.useState(null),[o,l]=x.useState(!1);x.useEffect(()=>{let m=!0;const p=()=>S.getSessionMetrics(e).then(C=>{m&&(n(Qe(C)),l(!0))}).catch(()=>{m&&l(!0)});if(p(),!r)return()=>{m=!1};const f=setInterval(()=>void p(),Et);return()=>{m=!1,clearInterval(f)}},[e,r]);const i=(a==null?void 0:a.samples)??[],c=x.useMemo(()=>i.map(m=>{var p;return m.t-(((p=i[0])==null?void 0:p.t)??0)}),[i]),u=new Set(i.map(m=>m.app).filter(m=>!!m)),b=u.size>1?"Foreground app":Array.from(u)[0]??(a==null?void 0:a.appId)??"App",h=i.map(m=>m.app??null),v=m=>m>0&&!!h[m]&&!!h[m-1]&&h[m]!==h[m-1],y=[],g=[],N=[];a&&(a.series.deviceCpu&&y.push({key:"deviceCpu",label:"Device",color:me,values:i.map(m=>m.deviceCpu)}),a.series.appCpu&&y.push({key:"appCpu",label:b,color:ue,values:i.map((m,p)=>v(p)?null:m.appCpu),pointLabels:h}),a.series.appMem&&g.push({key:"appMem",label:b,color:ue,values:i.map((m,p)=>v(p)?null:m.appMemMb),pointLabels:h}),a.series.deviceMem&&(N.push({key:"deviceMem",label:"Device used",color:me,values:i.map(m=>m.deviceMemMb)}),N.push({key:"deviceTotal",label:"Device total",color:Dt,values:i.map(m=>m.deviceMemTotalMb),dashed:!0})));const w=r&&(a==null?void 0:a.recording)==="off",T=(a==null?void 0:a.recording)==="stopped",A="Recording stopped: the device stopped responding.";let _;return o?w?_=t.jsx(M,{title:"Performance isn't recorded for this session",description:"CPU and memory are recorded for Android devices and iPhones. This session runs on an iOS simulator or on a machine that needs updating, or recording is turned off."}):i.length===0&&!r?_=t.jsx(M,{title:"No performance data for this session",description:"CPU and memory are recorded for Android devices and iPhones. This session ran on an iOS simulator or on a machine that needed updating, before recording was available, or with recording turned off."}):i.length<2?_=t.jsx("div",{className:"text-xs text-[var(--text-dim)]",children:T?A:r?"Collecting… The first figures appear within 10 seconds.":"Too few figures were recorded to draw a chart."}):_=t.jsxs("div",{className:"space-y-4",children:[T&&t.jsxs("p",{className:"text-xs text-[var(--color-warning)]",children:[A," The data ends there."]}),(a==null?void 0:a.platform)==="ios"&&t.jsxs("p",{className:"text-xs text-[var(--text-dim)]",children:["On iPhones, only the device's overall CPU is recorded.",s?" For more detail, download the Performance trace under Details.":""]}),y.length>0&&t.jsx(z,{title:"CPU",series:y,times:c,yMax:100,format:Ye,ariaLabel:"CPU over the session"}),g.length>0&&t.jsx(z,{title:"App memory",series:g,times:c,yMax:fe(he(g)),format:se,ariaLabel:"App memory over the session"}),N.length>0&&t.jsx(z,{title:"Device memory",series:N,times:c,yMax:fe(he(N)),format:se,ariaLabel:"Device memory over the session"})]}):_=t.jsx("div",{className:"text-xs text-[var(--text-dim)]",children:"Loading performance…"}),t.jsx(Se,{header:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(tt,{size:14})," Performance"]}),children:_})},Mt=({session:e})=>{const r=e.status==="running",s=!!e.video_recording;return t.jsxs("section",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface)] overflow-hidden",children:[t.jsxs("header",{className:"px-3 py-2 border-b border-[var(--border)] flex items-center justify-between",children:[t.jsx("span",{className:"text-[11px] font-semibold text-[var(--text-dim)]",children:"Recording"}),r&&t.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] text-[var(--red)]",children:[t.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[var(--red)] pulse-dot"}),"Live"]})]}),t.jsx("div",{className:"aspect-video bg-[var(--bg)] flex items-center justify-center",children:r&&e.has_live_video?t.jsx("img",{src:S.getSessionLiveVideoUrl(e.id),alt:`Live view of session ${e.id}`,className:"w-full h-full object-contain"}):s?t.jsx("video",{controls:!0,src:S.getAssetUrl(e.video_recording),className:"w-full h-full object-contain"}):t.jsxs("div",{className:"flex flex-col items-center text-center px-6 py-8 gap-2",children:[t.jsx("div",{className:"h-10 w-10 rounded-full bg-[var(--surface-2)] border border-[var(--border)] flex items-center justify-center",children:t.jsx(rt,{className:"h-5 w-5 text-[var(--text-dim)]"})}),t.jsx("div",{className:"text-sm text-[var(--text)] font-medium",children:"No video available"}),t.jsx("div",{className:"text-xs text-[var(--text-dim)] max-w-xs",children:e.status==="failed"?"Session failed before recording started.":e.video_recording_enabled===!1?"Recording was disabled for this session.":"No recording was captured."})]})})]})},R=({label:e,children:r,title:s,mono:a})=>t.jsxs("div",{className:"flex items-baseline justify-between gap-3 px-3 py-2",children:[t.jsx("dt",{className:"text-xs text-[var(--text-muted)] shrink-0",children:e}),t.jsx("dd",{className:`text-xs text-[var(--text)] text-right min-w-0 break-all ${a?"font-mono text-[11px]":""}`,title:s,children:r})]}),Ot=({session:e,buildName:r})=>{var l,i;const{toast:s}=H(),a=ye(e.ranOn),n=e.performance_trace?S.getAssetUrl(e.performance_trace):"",o=async()=>{try{await navigator.clipboard.writeText(e.id),s("Session ID copied","success")}catch{s("Clipboard unavailable","error")}};return t.jsxs("section",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface)] overflow-hidden",children:[t.jsx("header",{className:"px-3 py-2 border-b border-[var(--border)]",children:t.jsx("h2",{className:"text-[11px] font-semibold text-[var(--text-dim)]",children:"Details"})}),t.jsxs("dl",{className:"divide-y divide-[var(--border)]",children:[t.jsx(R,{label:"Session ID",mono:!0,children:t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx("span",{children:e.id}),t.jsx("button",{type:"button",onClick:o,"aria-label":"Copy session ID",className:"p-0.5 rounded text-[var(--text-dim)] hover:text-[var(--text)]",children:t.jsx(X,{className:"h-3 w-3"})})]})}),r&&t.jsx(R,{label:"Build",children:r}),t.jsx(R,{label:"Device UDID",mono:!0,children:e.device_udid||"—"}),t.jsx(R,{label:"Platform",children:[Ne(e),e.device_version].filter(c=>c&&c!=="—").join(" ")||"—"}),t.jsx(R,{label:"Ran on",title:e.node_id?`Node ${e.node_id}`:void 0,children:a??"Not known"}),t.jsx(R,{label:"Run by",title:(l=e.owner)==null?void 0:l.email,children:((i=e.owner)==null?void 0:i.name)??"Not recorded"}),t.jsx(R,{label:"Started",children:re(e.startTime)}),t.jsx(R,{label:"Ended",children:e.endTime?re(e.endTime):"—"}),e.tags&&t.jsx(R,{label:"Tags",children:e.tags}),n&&t.jsx(R,{label:"iOS trace",children:t.jsxs("a",{href:n,className:"inline-flex items-center gap-1 text-[var(--color-accent)] hover:underline",children:[t.jsx(_e,{className:"h-3 w-3","aria-hidden":"true"}),"Performance trace"]})})]})]})},pe={desired:"Requested",session:"Actual"},Ft=({session:e})=>{const[r,s]=x.useState("desired"),a=le(e.desired_capabilities),n=le(e.session_capabilities),l=Object.entries(r==="desired"?a:n);return t.jsxs("section",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface)] overflow-hidden",children:[t.jsx("header",{className:"flex items-center border-b border-[var(--border)]",children:["desired","session"].map(i=>t.jsx("button",{type:"button",onClick:()=>s(i),"aria-pressed":r===i,className:`flex-1 h-9 text-[11px] font-semibold transition-colors border-b-2 ${r===i?"border-[var(--color-accent)] text-[var(--text)]":"border-transparent text-[var(--text-muted)] hover:text-[var(--text)]"}`,children:pe[i]},i))}),l.length===0?t.jsxs("div",{className:"px-3 py-6 text-center text-xs text-[var(--text-dim)]",children:["No ",pe[r].toLowerCase()," capabilities recorded for this session."]}):t.jsx("dl",{className:"divide-y divide-[var(--border)]",children:l.map(([i,c])=>t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)] items-baseline gap-3 px-3 py-2",children:[t.jsx("dt",{className:"text-xs text-[var(--text-muted)] break-all",children:i}),t.jsx("dd",{className:"font-mono text-xs text-[var(--text)] truncate text-right min-w-0",title:ce(c,500),children:ce(c)})]},i))})]})},Pt=({tabs:e,active:r,onChange:s,errorsOnly:a,onErrorsOnlyChange:n,showErrorsOnly:o=!0})=>{const l=e.filter(i=>!(i.hideWhenEmpty&&i.count===0));return t.jsxs("div",{className:"flex items-center justify-between gap-4 px-3 border-b border-[var(--border)] bg-[var(--surface)]",children:[t.jsx("div",{className:"flex items-center gap-1 overflow-x-auto",children:l.map(i=>{const c=i.key===r;return t.jsxs("button",{type:"button",onClick:()=>s(i.key),"aria-pressed":c,"data-empty":i.count===0?"true":"false",className:`relative inline-flex items-center gap-1.5 h-9 px-3 text-xs whitespace-nowrap transition-colors ${c?"text-[var(--text)]":i.count===0?"text-[var(--text-dim)] hover:text-[var(--text-muted)]":"text-[var(--text-muted)] hover:text-[var(--text)]"}`,children:[t.jsx("span",{children:i.label}),i.count>0&&t.jsx("span",{className:`text-[10px] tabular-nums ${c?"text-[var(--text-muted)]":"text-[var(--text-dim)]"}`,children:yt(i.count)}),c&&t.jsx("span",{className:"absolute left-2 right-2 bottom-0 h-[2px] bg-[var(--color-accent)] rounded-t"})]},i.key)})}),o&&t.jsxs("label",{className:"inline-flex items-center gap-2 text-[11px] text-[var(--text-muted)] cursor-pointer select-none whitespace-nowrap",children:[t.jsx("input",{type:"checkbox",checked:a,onChange:i=>n(i.target.checked),"aria-label":"Show only error rows"}),"Errors only"]})]})},Bt={key:"text-[var(--blue)]",string:"text-[var(--color-accent)]",number:"text-[var(--amber)]",boolean:"text-[var(--amber)]",null:"text-[var(--text-dim)] italic",punct:"text-[var(--text-muted)]",plain:"text-[var(--text)]"},Ht=({value:e,maxHeightPx:r})=>{const s=Ct(e);if(!s)return t.jsx("span",{className:"text-[var(--text-dim)] text-xs",children:"(empty)"});let a;try{a=Tt(s)}catch{a=[{text:s,kind:"plain"}]}return t.jsx("pre",{className:"font-mono text-[11px] leading-relaxed bg-[var(--bg)] border border-[var(--border)] rounded-md p-3 overflow-x-auto whitespace-pre",style:r?{maxHeight:r,overflowY:"auto"}:void 0,children:a.map((n,o)=>t.jsx("span",{className:Bt[n.kind],children:n.text},o))})},It={green:"bg-[var(--color-success)]",red:"bg-[var(--red)]",amber:"bg-[var(--amber)]",blue:"bg-[var(--blue)]",neutral:"bg-[var(--text-dim)]"},Ut={green:"text-[var(--color-success)]",red:"text-[var(--red)]",amber:"text-[var(--amber)]",blue:"text-[var(--blue)]",neutral:"text-[var(--text-muted)]"},Vt=({log:e})=>{const[r,s]=x.useState(!1),{toast:a}=H(),n=J(e),o=_t(e),l=V(e),i=l?String(e.message):"",c=async u=>{u.stopPropagation();try{const b=l?i:e.body??e,h=typeof b=="string"?b:JSON.stringify(b,null,2);await navigator.clipboard.writeText(h),a("Log entry copied","success")}catch{a("Clipboard unavailable","error")}};return t.jsxs("div",{className:"border-b border-[var(--border)] last:border-b-0",children:[t.jsxs("button",{type:"button",onClick:()=>s(u=>!u),"aria-expanded":r,className:"group w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-[var(--surface-2)]/60 transition-colors",children:[t.jsx(K,{className:`h-3 w-3 text-[var(--text-dim)] transition-transform shrink-0 ${r?"rotate-90":""}`}),t.jsx("span",{className:"font-mono text-[11px] text-[var(--text-muted)] w-[64px] shrink-0",children:n}),t.jsx("span",{className:`h-1.5 w-1.5 rounded-full shrink-0 ${It[o.tone]}`}),o.label&&t.jsx("span",{className:`font-mono text-[11px] font-medium shrink-0 ${Ut[o.tone]}`,children:o.label}),t.jsxs("span",{className:"min-w-0 flex-1 flex items-baseline gap-2 truncate",children:[t.jsx("span",{className:l?"font-mono text-[11px] text-[var(--text)] truncate min-w-0":"text-[12px] text-[var(--text)] shrink-0",children:Rt(e)}),xe(e)&&t.jsx("span",{className:"font-mono text-[11px] text-[var(--text-dim)] truncate min-w-0",children:xe(e)})]}),typeof e.duration=="number"&&t.jsx("span",{className:"text-[11px] tabular-nums text-[var(--text-muted)] shrink-0",children:B(e.duration)}),t.jsx("span",{role:"button",tabIndex:0,onClick:c,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&c(u)},"aria-label":"Copy log entry",className:"opacity-0 group-hover:opacity-100 p-1 rounded text-[var(--text-dim)] hover:text-[var(--text)] transition-opacity shrink-0",children:t.jsx(X,{className:"h-3 w-3"})})]}),r&&t.jsx("div",{className:"px-3 pb-3 pl-9",children:l?t.jsx("pre",{className:"font-mono text-[11px] leading-relaxed text-[var(--text)] bg-[var(--bg)] border border-[var(--border)] rounded-md p-3 max-h-[400px] overflow-auto whitespace-pre-wrap break-words",children:i}):t.jsx(Ht,{value:e.body??e,maxHeightPx:400})})]})},Jt=(e,r)=>e?"bg-[var(--color-danger)]":r?"bg-[var(--color-warning)]":"bg-[var(--color-success)]",Wt=({commands:e})=>{const{spanMs:r,bars:s}=ht(e);return s.length===0?t.jsx("div",{className:"px-4 py-10 text-center text-xs text-[var(--text-dim)]",children:"No commands recorded for this session."}):t.jsxs("div",{className:"px-3 py-3",children:[t.jsxs("div",{className:"flex items-center justify-between pb-2 text-[11px] text-[var(--text-dim)] tabular-nums",children:[t.jsxs("span",{children:[s.length," command",s.length===1?"":"s"," over ",B(r)]}),t.jsxs("span",{className:"inline-flex items-center gap-3",children:[t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx("span",{className:"h-2 w-2 rounded-sm bg-[var(--color-danger)]"})," Failed"]}),t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx("span",{className:"h-2 w-2 rounded-sm bg-[var(--color-warning)]"})," Healed"]})]})]}),t.jsx("ol",{className:"space-y-1",children:s.map((a,n)=>t.jsxs("li",{"data-testid":"timeline-bar","data-command":a.label,"data-failed":a.failed?"true":"false",className:"grid grid-cols-[128px_minmax(0,1fr)_64px] items-center gap-2",children:[t.jsx("span",{className:"truncate text-[11px] font-mono text-[var(--text-muted)]",title:a.label,children:a.label}),t.jsx("span",{className:"relative h-3 rounded-sm bg-[rgb(var(--rgb-fg)/0.05)]",children:t.jsx("span",{className:`absolute inset-y-0 rounded-sm ${Jt(a.failed,a.healed)}`,style:{left:`${a.startMs/r*100}%`,width:`max(2px, ${a.durationMs/r*100}%)`}})}),t.jsx("span",{className:"text-right text-[11px] tabular-nums text-[var(--text-muted)]",children:a.durationMs>0?B(a.durationMs):"—"})]},a.id??n))})]})},zt=({commands:e})=>{const r=pt(e);return r.length===0?t.jsxs("div",{className:"px-4 py-10 text-center text-xs text-[var(--text-dim)]",children:["No screenshots were kept. A failed command keeps one unless"," ",t.jsx("code",{className:"font-mono",children:"xe:options.screenshotOnFailure"})," is false; set"," ",t.jsx("code",{className:"font-mono",children:"xe:options.screenshotOnEveryCommand"})," to keep one for every command."]}):t.jsx("ul",{className:"grid grid-cols-[repeat(auto-fill,minmax(140px,1fr))] gap-3 p-3",children:r.map((s,a)=>{const n=S.getAssetUrl(s.path),o=J({timestamp:s.at??null});return t.jsx("li",{children:t.jsxs("a",{href:n,target:"_blank",rel:"noreferrer",className:`block rounded-md border overflow-hidden hover:border-[var(--border-strong)] ${s.failed?"border-[var(--color-danger)]":"border-[var(--border)]"}`,children:[t.jsx("img",{src:n,alt:`${s.command} at ${o}`,loading:"lazy",className:"block w-full aspect-[9/16] object-contain bg-[rgb(var(--rgb-fg)/0.03)]"}),t.jsxs("span",{className:"flex items-center justify-between gap-2 px-2 py-1 text-[11px]",children:[t.jsx("span",{className:`truncate font-mono ${s.failed?"text-[var(--color-danger)]":"text-[var(--text)]"}`,children:s.command}),t.jsx("span",{className:"tabular-nums text-[var(--text-dim)] shrink-0",children:o})]})]})},s.id??a)})})},ve=["commands","device","debug","profiling"],Kt=({sessionLogs:e,deviceLogs:r,debugLogs:s,profiling:a})=>{const[n,o]=x.useState("commands"),[l,i]=x.useState(!1),c=e,u=x.useMemo(()=>Ce(c).screenshots,[c]),b=x.useMemo(()=>[{key:"commands",label:"Commands",count:e.length},{key:"timeline",label:"Timeline",count:e.length},{key:"screenshots",label:"Screenshots",count:u},{key:"device",label:"Device logs",count:r.length},{key:"debug",label:"Debug logs",count:s.length},{key:"profiling",label:"System profiling",count:a.length,hideWhenEmpty:!0}],[e.length,u,r.length,s.length,a.length]),h=x.useMemo(()=>{let v=[];return n==="commands"?v=e:n==="device"?v=r:n==="debug"?v=s:n==="profiling"&&(v=a),$t(v,l)},[n,e,r,s,a,l]);return t.jsxs("section",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface)] flex flex-col min-h-[280px] max-h-[640px]",children:[t.jsx(Pt,{tabs:b,active:n,onChange:o,errorsOnly:l,onErrorsOnlyChange:i,showErrorsOnly:ve.includes(n)}),t.jsxs("div",{className:"flex-1 overflow-y-auto",children:[n==="timeline"&&t.jsx(Wt,{commands:c}),n==="screenshots"&&t.jsx(zt,{commands:c}),ve.includes(n)&&(h.length===0?t.jsx("div",{className:"px-4 py-10 text-center text-xs text-[var(--text-dim)]",children:l?"No error rows in this tab.":"No log entries in this tab."}):h.map((v,y)=>t.jsx(Vt,{log:v},v.id??y)))]})]})};function Re(e){if(!e)return"failed";switch(e){case"HTTPS_CLIENT_ERROR":case"HTTPS_SERVER_ERROR":case"OPEN_HTTPS_SERVER_ERROR":case"ON_CONNECT_ERROR":return"tls";case"PROXY_TO_SERVER_REQUEST_ERROR":return"net";default:return"failed"}}const ee="/xenon/api/interceptor";async function be(e){const r=await fetch(`${ee}/sessions/${encodeURIComponent(e)}/requests`);if(r.status===403)return{active:!1,forbidden:!0};if(r.status===404){const a=await r.json().catch(()=>({}));return{active:!1,error:a==null?void 0:a.error}}return r.ok?{active:!0,requests:(await r.json()).requests||[]}:{active:!1,error:`request failed (${r.status})`}}async function qt(e,r){const s=await fetch(`${ee}/sessions/${encodeURIComponent(e)}/requests/${encodeURIComponent(r)}`);return s.ok?s.json():null}function Gt(e){return`${ee}/sessions/${encodeURIComponent(e)}/har`}function Xt(e){return e>=200&&e<300?"ready":e>=300&&e<400?"neutral":e>=400&&e<500?"busy":e>=500?"error":"neutral"}const ge=({headers:e})=>{const r=Object.entries(e||{});return r.length===0?t.jsx("div",{className:"text-xs text-[var(--text-dim)]",children:"No headers"}):t.jsx("div",{className:"space-y-0.5 font-mono text-xs",children:r.map(([s,a])=>t.jsxs("div",{className:"flex gap-2",children:[t.jsxs("span",{className:"text-[var(--text-dim)] shrink-0",children:[s,":"]}),t.jsx("span",{className:"break-all",children:a})]},s))})},je=({body:e})=>{if(e==null||e==="")return t.jsx("div",{className:"text-xs text-[var(--text-dim)]",children:"No body"});let r=e;try{r=JSON.stringify(JSON.parse(e),null,2)}catch{}return t.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all bg-[var(--surface-2,var(--surface))] rounded p-2 max-h-64 overflow-auto",children:r})},Yt=({request:e,onClose:r})=>{if(!e)return null;const s=t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx($,{tone:"accent",children:e.method}),e.failed?t.jsx($,{tone:"error",children:Re(e.failureKind)}):t.jsx($,{tone:Xt(e.resStatus),children:e.resStatus||"—"}),t.jsx("span",{className:"font-mono text-xs truncate",title:e.url,children:e.url})]});return t.jsx(it,{open:!!e,title:s,onClose:r,width:720,children:t.jsxs("div",{className:"space-y-4 text-xs",children:[e.failed&&t.jsxs("div",{className:"border border-[var(--red)] rounded p-2 bg-[rgb(var(--rgb-red-600)/0.08)]",children:[t.jsx("div",{className:"text-[var(--red)] text-[11px] mb-1",children:"Failure"}),t.jsx("div",{className:"text-xs",children:e.failureReason||"Request failed"}),e.failureKind&&t.jsx("div",{className:"font-mono text-[10px] text-[var(--text-dim)] mt-1",children:e.failureKind})]}),!e.failed&&t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("div",{className:"text-[var(--text-dim)] text-[11px] mb-1",children:"Duration"}),t.jsxs("div",{className:"font-mono",children:[e.durationMs," ms"]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-[var(--text-dim)] text-[11px] mb-1",children:"Flags"}),t.jsxs("div",{className:"flex gap-1",children:[e.mocked&&t.jsx($,{tone:"accent",children:"mocked"}),e.modified&&t.jsx($,{tone:"busy",children:"modified"}),!e.mocked&&!e.modified&&t.jsx("span",{className:"text-[var(--text-dim)]",children:"passthrough"})]})]})]}),e.commandHint&&t.jsxs("div",{children:[t.jsx("div",{className:"text-[var(--text-dim)] text-[11px] mb-1",children:"Triggered by"}),t.jsx("div",{className:"font-mono",children:e.commandHint.commandName})]}),!e.failed&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("div",{className:"text-[var(--text-dim)] text-[11px] mb-1",children:"Request Headers"}),t.jsx(ge,{headers:e.reqHeaders})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-[var(--text-dim)] text-[11px] mb-1",children:"Request Body"}),t.jsx(je,{body:e.reqBody})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-[var(--text-dim)] text-[11px] mb-1",children:"Response Headers"}),t.jsx(ge,{headers:e.resHeaders})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-[var(--text-dim)] text-[11px] mb-1",children:"Response Body"}),t.jsx(je,{body:e.resBody})]})]})]})})};function Qt(e){return e?new Date(e).toLocaleTimeString(void 0,{hour12:!1}):"—"}function Zt(e){return e>=200&&e<300?"ready":e>=300&&e<400?"neutral":e>=400&&e<500?"busy":e>=500?"error":"neutral"}const er=({sessionId:e,sessionEnded:r})=>{const[s,a]=x.useState(null),[n,o]=x.useState(!1),[l,i]=x.useState(null),[c,u]=x.useState([]),[b,h]=x.useState(!0),[v,y]=x.useState(null),g=x.useRef(new Set),{on:N,isConnected:w}=De(),T=x.useCallback(d=>{o(!!d.forbidden),a(d.active),i(d.error||null);const j=d.requests||[];u(j),g.current=new Set(j.map(L=>L.id))},[]);x.useEffect(()=>{let d=!0;return h(!0),be(e).then(j=>{d&&T(j)}).catch(()=>{d&&T({active:!1,error:"the server could not be reached"})}).finally(()=>{d&&h(!1)}),()=>{d=!1}},[e,T]),x.useEffect(()=>{if(r)return;let d=!0;const j=N("interceptor_request",k=>{!k||k.sessionId!==e||g.current.has(k.id)||(g.current.add(k.id),u(W=>[k,...W]),a(!0))}),L=N("interceptor_session_started",k=>{(k==null?void 0:k.sessionId)===e&&a(!0)}),O=N("interceptor_session_stopped",k=>{(k==null?void 0:k.sessionId)===e&&be(e).then(W=>{d&&T(W)}).catch(()=>{})});return()=>{d=!1,j(),L(),O()}},[N,e,r,w,T]);const A=x.useMemo(()=>[...c].sort((d,j)=>j.ts-d.ts),[c]),_=async d=>{if(y(d),s){const j=await qt(e,d.id);j&&y(j)}},m=s&&c.length>0?t.jsxs("a",{href:Gt(e),className:"inline-flex items-center gap-1 text-xs text-[var(--text-dim)] hover:text-[var(--text)]",title:"Download HAR",children:[t.jsx(_e,{className:"h-3 w-3"}),"HAR"]}):null,p=t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ot,{className:"h-3.5 w-3.5 text-[var(--text-dim)]"}),t.jsx("span",{children:"Network"}),s&&c.length>0&&t.jsxs("span",{className:"text-xs text-[var(--text-dim)]",children:["(",c.length,")"]})]});let f;const C=s===!1&&(!l||l==="interceptor inactive");return b?f=t.jsx("div",{className:"p-4 text-xs text-[var(--text-dim)]",children:"Loading…"}):n?f=t.jsx(M,{title:"Only admins can see network requests",description:"Captured requests can carry sign-in details and personal data, so only admins can open them. Ask an admin to look at this session's requests."}):C&&r?f=t.jsx(M,{title:"No network capture",description:"This session didn't capture its network requests."}):C?f=t.jsx(M,{title:"Network capture is off",description:"This session isn't capturing its network requests. Android sessions capture them when the test turns network capture on in its capabilities, or when it is on for every session in the server settings."}):l?f=t.jsxs("div",{className:"p-4 text-xs text-[var(--red)]",children:["Failed to load requests: ",l]}):A.length===0?f=t.jsx(M,{title:"Waiting for requests",description:r?"No HTTP traffic was captured during this session.":"Captured requests will appear here as the device makes calls."}):f=t.jsx("div",{className:"overflow-auto max-h-96",children:t.jsxs(st,{children:[t.jsx(at,{children:t.jsxs(ne,{children:[t.jsx(E,{style:{width:80},children:"Time"}),t.jsx(E,{style:{width:70},children:"Method"}),t.jsx(E,{style:{width:70},children:"Status"}),t.jsx(E,{children:"Host"}),t.jsx(E,{children:"Path"}),t.jsx(E,{style:{width:80},children:"Duration"}),t.jsx(E,{style:{width:90},children:"Flags"})]})}),t.jsx(nt,{children:A.map(d=>t.jsxs(ne,{onClick:()=>_(d),style:{cursor:"pointer"},title:d.failed?d.failureReason:void 0,children:[t.jsx(D,{className:"font-mono text-[11px]",children:Qt(d.ts)}),t.jsx(D,{children:t.jsx($,{tone:"accent",children:d.method})}),t.jsx(D,{children:d.failed?t.jsx($,{tone:"error",children:Re(d.failureKind)}):t.jsx($,{tone:Zt(d.resStatus),children:d.resStatus||"—"})}),t.jsx(D,{className:"font-mono text-[11px] truncate",title:d.host,children:d.host}),t.jsx(D,{className:"font-mono text-[11px] truncate",title:d.path,children:d.failed?"—":d.path}),t.jsx(D,{className:"font-mono text-[11px]",children:d.failed?"—":`${d.durationMs}ms`}),t.jsx(D,{children:t.jsxs("div",{className:"flex gap-1",children:[d.mocked&&t.jsx($,{tone:"accent",children:"mock"}),d.modified&&t.jsx($,{tone:"busy",children:"mod"})]})})]},d.id))})]})}),t.jsxs(t.Fragment,{children:[t.jsx(Se,{header:p,action:m,padded:!1,children:f}),t.jsx(Yt,{request:v,onClose:()=>y(null)})]})},wr=()=>{const{buildId:e="",sessionId:r=""}=Le(),{toast:s}=H(),a=Me(),n=Ie(),o=ct(r||null),l=x.useMemo(()=>n.builds.find(h=>h.id===e)??null,[n.builds,e]),i=l?Ue(l):"Build";if(x.useEffect(()=>{!o.loading&&o.notFound&&(s("Session not available — it may belong to a team you are not on.","info"),a("/builds",{replace:!0}))},[o.loading,o.notFound,a,s]),o.loading)return t.jsx("div",{className:"p-6 text-xs text-[var(--text-dim)]",children:"Loading session…"});if(o.error||!o.session)return t.jsxs("div",{className:"p-6 space-y-2",children:[t.jsx(oe,{buildId:e,buildName:l?i:null,sessionId:r}),t.jsx("div",{className:"mt-6 rounded-md border border-[var(--red)]/30 bg-[var(--surface)] p-4 text-xs text-[var(--red)]",children:o.error||"Session not found."})]});const c=o.session,u=o.sessionLogs,b=Y(c.status).bucket==="failed";return t.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[t.jsx(oe,{buildId:e,buildName:l?i:null,sessionId:c.id}),t.jsx(xt,{session:c}),t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden",children:t.jsxs("div",{className:"px-4 py-4 space-y-4",children:[t.jsx(vt,{session:c,commands:u}),b&&t.jsx(Nt,{session:c,buildName:i,buildId:e,commands:u,durationText:Ve(G(c))}),t.jsx(At,{commands:u}),t.jsx(Lt,{sessionId:c.id,running:c.status==="running",hasTrace:!!c.performance_trace}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[minmax(0,1fr)_340px] gap-4",children:[t.jsx("div",{className:"min-w-0",children:t.jsx(Kt,{sessionLogs:o.sessionLogs,deviceLogs:o.deviceLogs,debugLogs:o.debugLogs,profiling:o.profiling})}),t.jsxs("div",{className:"flex flex-col gap-4 min-w-0",children:[t.jsx(Mt,{session:c}),t.jsx(Ot,{session:c,buildName:l?i:null}),t.jsx(Ft,{session:c})]})]}),t.jsx(er,{sessionId:c.id,sessionEnded:c.status!=="running"})]})})]})};export{wr as SessionDetailPage,wr as default};