@shepai/cli 1.182.1 → 1.183.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 (519) hide show
  1. package/apis/json-schema/Application.yaml +7 -0
  2. package/dist/packages/core/src/application/ports/output/repositories/application-repository.interface.d.ts +1 -1
  3. package/dist/packages/core/src/application/ports/output/repositories/application-repository.interface.d.ts.map +1 -1
  4. package/dist/packages/core/src/application/use-cases/applications/create-application.use-case.d.ts +3 -3
  5. package/dist/packages/core/src/application/use-cases/applications/create-application.use-case.d.ts.map +1 -1
  6. package/dist/packages/core/src/application/use-cases/applications/create-application.use-case.js +13 -21
  7. package/dist/packages/core/src/application/use-cases/applications/list-applications.use-case.d.ts +19 -3
  8. package/dist/packages/core/src/application/use-cases/applications/list-applications.use-case.d.ts.map +1 -1
  9. package/dist/packages/core/src/application/use-cases/applications/list-applications.use-case.js +37 -4
  10. package/dist/packages/core/src/application/use-cases/applications/resume-application-workflow.use-case.d.ts +30 -0
  11. package/dist/packages/core/src/application/use-cases/applications/resume-application-workflow.use-case.d.ts.map +1 -0
  12. package/dist/packages/core/src/application/use-cases/applications/resume-application-workflow.use-case.js +122 -0
  13. package/dist/packages/core/src/domain/generated/output.d.ts +8 -0
  14. package/dist/packages/core/src/domain/generated/output.d.ts.map +1 -1
  15. package/dist/packages/core/src/infrastructure/di/container.d.ts.map +1 -1
  16. package/dist/packages/core/src/infrastructure/di/container.js +5 -0
  17. package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/application.mapper.d.ts +2 -0
  18. package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/application.mapper.d.ts.map +1 -1
  19. package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/application.mapper.js +4 -0
  20. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/058-add-setup-complete-to-applications.d.ts +5 -0
  21. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/058-add-setup-complete-to-applications.d.ts.map +1 -0
  22. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/058-add-setup-complete-to-applications.js +10 -0
  23. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/059-add-agent-session-id-to-applications.d.ts +5 -0
  24. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/059-add-agent-session-id-to-applications.d.ts.map +1 -0
  25. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/059-add-agent-session-id-to-applications.js +10 -0
  26. package/dist/packages/core/src/infrastructure/repositories/sqlite-application.repository.d.ts +1 -1
  27. package/dist/packages/core/src/infrastructure/repositories/sqlite-application.repository.d.ts.map +1 -1
  28. package/dist/packages/core/src/infrastructure/repositories/sqlite-application.repository.js +10 -2
  29. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.d.ts.map +1 -1
  30. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.js +4 -1
  31. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/fast-implement.prompt.d.ts.map +1 -1
  32. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/fast-implement.prompt.js +4 -1
  33. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/implement.prompt.d.ts.map +1 -1
  34. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/implement.prompt.js +4 -1
  35. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/merge-prompts.d.ts.map +1 -1
  36. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/merge-prompts.js +11 -6
  37. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/pr-branding.d.ts +2 -2
  38. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/pr-branding.d.ts.map +1 -1
  39. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/pr-branding.js +2 -2
  40. package/dist/packages/core/src/infrastructure/services/git/git-pr.service.d.ts.map +1 -1
  41. package/dist/packages/core/src/infrastructure/services/git/git-pr.service.js +3 -2
  42. package/dist/packages/core/src/infrastructure/services/git/pr-branding.d.ts +16 -5
  43. package/dist/packages/core/src/infrastructure/services/git/pr-branding.d.ts.map +1 -1
  44. package/dist/packages/core/src/infrastructure/services/git/pr-branding.js +38 -7
  45. package/dist/src/presentation/web/app/api/applications/[id]/resume/route.d.ts +20 -0
  46. package/dist/src/presentation/web/app/api/applications/[id]/resume/route.d.ts.map +1 -0
  47. package/dist/src/presentation/web/app/api/applications/[id]/resume/route.js +25 -0
  48. package/dist/src/presentation/web/app/api/applications/[id]/route.d.ts +19 -0
  49. package/dist/src/presentation/web/app/api/applications/[id]/route.d.ts.map +1 -0
  50. package/dist/src/presentation/web/app/api/applications/[id]/route.js +46 -0
  51. package/dist/src/presentation/web/app/api/applications/route.d.ts +9 -0
  52. package/dist/src/presentation/web/app/api/applications/route.d.ts.map +1 -0
  53. package/dist/src/presentation/web/app/api/applications/route.js +20 -0
  54. package/dist/src/presentation/web/app/application/[id]/page.d.ts +4 -4
  55. package/dist/src/presentation/web/app/application/[id]/page.d.ts.map +1 -1
  56. package/dist/src/presentation/web/app/application/[id]/page.js +2 -61
  57. package/dist/src/presentation/web/app/applications/page.d.ts +2 -0
  58. package/dist/src/presentation/web/app/applications/page.d.ts.map +1 -0
  59. package/dist/src/presentation/web/app/applications/page.js +5 -0
  60. package/dist/src/presentation/web/components/assistant-ui/thread.js +2 -2
  61. package/dist/src/presentation/web/components/common/application-node/application-node.d.ts.map +1 -1
  62. package/dist/src/presentation/web/components/common/application-node/application-node.js +3 -37
  63. package/dist/src/presentation/web/components/features/application-page/application-page-loader.d.ts +4 -0
  64. package/dist/src/presentation/web/components/features/application-page/application-page-loader.d.ts.map +1 -0
  65. package/dist/src/presentation/web/components/features/application-page/application-page-loader.js +47 -0
  66. package/dist/src/presentation/web/components/features/application-page/application-page.d.ts.map +1 -1
  67. package/dist/src/presentation/web/components/features/application-page/application-page.js +75 -54
  68. package/dist/src/presentation/web/components/features/application-page/application-page.stories.d.ts.map +1 -1
  69. package/dist/src/presentation/web/components/features/application-page/application-page.stories.js +1 -0
  70. package/dist/src/presentation/web/components/features/application-page/run-dev-button.d.ts +3 -1
  71. package/dist/src/presentation/web/components/features/application-page/run-dev-button.d.ts.map +1 -1
  72. package/dist/src/presentation/web/components/features/application-page/run-dev-button.js +6 -2
  73. package/dist/src/presentation/web/components/features/applications/application-card.d.ts +7 -0
  74. package/dist/src/presentation/web/components/features/applications/application-card.d.ts.map +1 -0
  75. package/dist/src/presentation/web/components/features/applications/application-card.js +82 -0
  76. package/dist/src/presentation/web/components/features/applications/application-card.stories.d.ts +13 -0
  77. package/dist/src/presentation/web/components/features/applications/application-card.stories.d.ts.map +1 -0
  78. package/dist/src/presentation/web/components/features/applications/application-card.stories.js +69 -0
  79. package/dist/src/presentation/web/components/features/applications/applications-page-client.d.ts +5 -0
  80. package/dist/src/presentation/web/components/features/applications/applications-page-client.d.ts.map +1 -0
  81. package/dist/src/presentation/web/components/features/applications/applications-page-client.js +28 -0
  82. package/dist/src/presentation/web/components/features/applications/applications-page-client.stories.d.ts +10 -0
  83. package/dist/src/presentation/web/components/features/applications/applications-page-client.stories.d.ts.map +1 -0
  84. package/dist/src/presentation/web/components/features/applications/applications-page-client.stories.js +93 -0
  85. package/dist/src/presentation/web/components/features/chat/ChatComposer.d.ts +3 -1
  86. package/dist/src/presentation/web/components/features/chat/ChatComposer.d.ts.map +1 -1
  87. package/dist/src/presentation/web/components/features/chat/ChatComposer.js +2 -2
  88. package/dist/src/presentation/web/components/features/chat/ChatTab.d.ts +3 -1
  89. package/dist/src/presentation/web/components/features/chat/ChatTab.d.ts.map +1 -1
  90. package/dist/src/presentation/web/components/features/chat/ChatTab.js +4 -3
  91. package/dist/src/presentation/web/components/features/chat/StepTracker.d.ts +6 -1
  92. package/dist/src/presentation/web/components/features/chat/StepTracker.d.ts.map +1 -1
  93. package/dist/src/presentation/web/components/features/chat/StepTracker.js +23 -20
  94. package/dist/src/presentation/web/components/features/control-center/control-center-inner.d.ts.map +1 -1
  95. package/dist/src/presentation/web/components/features/control-center/control-center-inner.js +3 -2
  96. package/dist/src/presentation/web/components/features/features-canvas/features-canvas.d.ts +3 -1
  97. package/dist/src/presentation/web/components/features/features-canvas/features-canvas.d.ts.map +1 -1
  98. package/dist/src/presentation/web/components/features/features-canvas/features-canvas.js +2 -2
  99. package/dist/src/presentation/web/components/features/settings/language-settings-section.d.ts.map +1 -1
  100. package/dist/src/presentation/web/components/features/settings/language-settings-section.js +1 -0
  101. package/dist/src/presentation/web/components/features/settings/language-settings-section.stories.d.ts +1 -0
  102. package/dist/src/presentation/web/components/features/settings/language-settings-section.stories.d.ts.map +1 -1
  103. package/dist/src/presentation/web/components/features/settings/language-settings-section.stories.js +5 -0
  104. package/dist/src/presentation/web/components/features/settings/settings-page-client.d.ts.map +1 -1
  105. package/dist/src/presentation/web/components/features/settings/settings-page-client.js +23 -3
  106. package/dist/src/presentation/web/components/layouts/app-sidebar/app-sidebar.d.ts.map +1 -1
  107. package/dist/src/presentation/web/components/layouts/app-sidebar/app-sidebar.js +2 -2
  108. package/dist/src/presentation/web/lib/derive-app-status.d.ts +23 -0
  109. package/dist/src/presentation/web/lib/derive-app-status.d.ts.map +1 -0
  110. package/dist/src/presentation/web/lib/derive-app-status.js +89 -0
  111. package/dist/src/presentation/web/lib/i18n.d.ts.map +1 -1
  112. package/dist/src/presentation/web/lib/i18n.js +3 -0
  113. package/dist/translations/ar/web.json +2 -1
  114. package/dist/translations/de/web.json +2 -1
  115. package/dist/translations/en/web.json +2 -1
  116. package/dist/translations/es/web.json +2 -1
  117. package/dist/translations/fr/web.json +2 -1
  118. package/dist/translations/he/web.json +2 -1
  119. package/dist/translations/pt/web.json +2 -1
  120. package/dist/translations/ru/web.json +2 -1
  121. package/dist/translations/uk/web.json +2 -1
  122. package/dist/tsconfig.build.tsbuildinfo +1 -1
  123. package/package.json +1 -1
  124. package/web/.next/BUILD_ID +1 -1
  125. package/web/.next/app-path-routes-manifest.json +4 -0
  126. package/web/.next/build-manifest.json +2 -2
  127. package/web/.next/fallback-build-manifest.json +2 -2
  128. package/web/.next/prerender-manifest.json +3 -3
  129. package/web/.next/required-server-files.js +2 -2
  130. package/web/.next/required-server-files.json +2 -2
  131. package/web/.next/routes-manifest.json +28 -0
  132. package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +32 -32
  133. package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js +5 -5
  134. package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
  135. package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
  136. package/web/.next/server/app/(dashboard)/@drawer/chat/page/server-reference-manifest.json +30 -30
  137. package/web/.next/server/app/(dashboard)/@drawer/chat/page.js +5 -5
  138. package/web/.next/server/app/(dashboard)/@drawer/chat/page.js.nft.json +1 -1
  139. package/web/.next/server/app/(dashboard)/@drawer/chat/page_client-reference-manifest.js +1 -1
  140. package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +33 -33
  141. package/web/.next/server/app/(dashboard)/@drawer/create/page.js +5 -5
  142. package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
  143. package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
  144. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +41 -41
  145. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js +5 -5
  146. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  147. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  148. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +41 -41
  149. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js +5 -5
  150. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
  151. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
  152. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +31 -31
  153. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page.js +5 -5
  154. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
  155. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
  156. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +31 -31
  157. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js +5 -5
  158. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
  159. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  160. package/web/.next/server/app/(dashboard)/chat/page/server-reference-manifest.json +30 -30
  161. package/web/.next/server/app/(dashboard)/chat/page.js +5 -5
  162. package/web/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
  163. package/web/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
  164. package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +33 -33
  165. package/web/.next/server/app/(dashboard)/create/page.js +5 -5
  166. package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
  167. package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
  168. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +41 -41
  169. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js +5 -5
  170. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  171. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  172. package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +41 -41
  173. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js +5 -5
  174. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
  175. package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
  176. package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +30 -30
  177. package/web/.next/server/app/(dashboard)/page.js +5 -5
  178. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  179. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  180. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +31 -31
  181. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page.js +5 -5
  182. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
  183. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
  184. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +31 -31
  185. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js +5 -5
  186. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
  187. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  188. package/web/.next/server/app/_global-error/page.js +1 -1
  189. package/web/.next/server/app/_global-error/page.js.nft.json +1 -1
  190. package/web/.next/server/app/_global-error.html +2 -2
  191. package/web/.next/server/app/_global-error.rsc +1 -1
  192. package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  193. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  194. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  195. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  196. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  197. package/web/.next/server/app/_not-found/page/server-reference-manifest.json +7 -7
  198. package/web/.next/server/app/_not-found/page.js +1 -1
  199. package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  200. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  201. package/web/.next/server/app/api/applications/[id]/resume/route/app-paths-manifest.json +3 -0
  202. package/web/.next/server/app/api/applications/[id]/resume/route/build-manifest.json +11 -0
  203. package/web/.next/server/app/api/applications/[id]/resume/route/server-reference-manifest.json +4 -0
  204. package/web/.next/server/app/api/applications/[id]/resume/route.js +7 -0
  205. package/web/.next/server/app/api/applications/[id]/resume/route.js.map +5 -0
  206. package/web/.next/server/app/api/applications/[id]/resume/route.js.nft.json +1 -0
  207. package/web/.next/server/app/api/applications/[id]/resume/route_client-reference-manifest.js +2 -0
  208. package/web/.next/server/app/api/applications/[id]/route/app-paths-manifest.json +3 -0
  209. package/web/.next/server/app/api/applications/[id]/route/build-manifest.json +11 -0
  210. package/web/.next/server/app/api/applications/[id]/route/server-reference-manifest.json +4 -0
  211. package/web/.next/server/app/api/applications/[id]/route.js +7 -0
  212. package/web/.next/server/app/api/applications/[id]/route.js.map +5 -0
  213. package/web/.next/server/app/api/applications/[id]/route.js.nft.json +1 -0
  214. package/web/.next/server/app/api/applications/[id]/route_client-reference-manifest.js +2 -0
  215. package/web/.next/server/app/api/applications/route/app-paths-manifest.json +3 -0
  216. package/web/.next/server/app/api/applications/route/build-manifest.json +11 -0
  217. package/web/.next/server/app/api/applications/route/server-reference-manifest.json +4 -0
  218. package/web/.next/server/app/api/applications/route.js +7 -0
  219. package/web/.next/server/app/api/applications/route.js.map +5 -0
  220. package/web/.next/server/app/api/applications/route.js.nft.json +1 -0
  221. package/web/.next/server/app/api/applications/route_client-reference-manifest.js +2 -0
  222. package/web/.next/server/app/api/attachments/preview/route.js.nft.json +1 -1
  223. package/web/.next/server/app/api/evidence/route.js.nft.json +1 -1
  224. package/web/.next/server/app/api/graph-data/route.js.nft.json +1 -1
  225. package/web/.next/server/app/api/interactive/chat/[featureId]/messages/route.js.nft.json +1 -1
  226. package/web/.next/server/app/application/[id]/page/server-reference-manifest.json +45 -30
  227. package/web/.next/server/app/application/[id]/page.js +3 -3
  228. package/web/.next/server/app/application/[id]/page.js.nft.json +1 -1
  229. package/web/.next/server/app/application/[id]/page_client-reference-manifest.js +1 -1
  230. package/web/.next/server/app/applications/page/app-paths-manifest.json +3 -0
  231. package/web/.next/server/app/applications/page/build-manifest.json +18 -0
  232. package/web/.next/server/app/applications/page/next-font-manifest.json +6 -0
  233. package/web/.next/server/app/applications/page/react-loadable-manifest.json +1 -0
  234. package/web/.next/server/app/applications/page/server-reference-manifest.json +230 -0
  235. package/web/.next/server/app/applications/page.js +19 -0
  236. package/web/.next/server/app/applications/page.js.map +5 -0
  237. package/web/.next/server/app/applications/page.js.nft.json +1 -0
  238. package/web/.next/server/app/applications/page_client-reference-manifest.js +2 -0
  239. package/web/.next/server/app/features/page/server-reference-manifest.json +7 -7
  240. package/web/.next/server/app/features/page.js +1 -1
  241. package/web/.next/server/app/features/page.js.nft.json +1 -1
  242. package/web/.next/server/app/features/page_client-reference-manifest.js +1 -1
  243. package/web/.next/server/app/settings/page/server-reference-manifest.json +10 -10
  244. package/web/.next/server/app/settings/page.js +1 -1
  245. package/web/.next/server/app/settings/page.js.nft.json +1 -1
  246. package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  247. package/web/.next/server/app/skills/page/server-reference-manifest.json +15 -15
  248. package/web/.next/server/app/skills/page.js +1 -1
  249. package/web/.next/server/app/skills/page.js.nft.json +1 -1
  250. package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  251. package/web/.next/server/app/tools/page/server-reference-manifest.json +13 -13
  252. package/web/.next/server/app/tools/page.js +1 -1
  253. package/web/.next/server/app/tools/page.js.nft.json +1 -1
  254. package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
  255. package/web/.next/server/app/version/page/server-reference-manifest.json +7 -7
  256. package/web/.next/server/app/version/page.js +1 -1
  257. package/web/.next/server/app/version/page.js.nft.json +1 -1
  258. package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
  259. package/web/.next/server/app-paths-manifest.json +4 -0
  260. package/web/.next/server/chunks/744ca_web__next-internal_server_app_api_applications_[id]_route_actions_e31b426d.js +3 -0
  261. package/web/.next/server/chunks/744ca_web__next-internal_server_app_api_applications_[id]_route_actions_e31b426d.js.map +1 -0
  262. package/web/.next/server/chunks/744ca_web__next-internal_server_app_api_applications_route_actions_2b7d20d0.js +3 -0
  263. package/web/.next/server/chunks/744ca_web__next-internal_server_app_api_applications_route_actions_2b7d20d0.js.map +1 -0
  264. package/web/.next/server/chunks/[root-of-the-server]__3bb635e8._.js +3 -0
  265. package/web/.next/server/chunks/[root-of-the-server]__3bb635e8._.js.map +1 -0
  266. package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
  267. package/web/.next/server/chunks/[root-of-the-server]__ac0027b4._.js +3 -0
  268. package/web/.next/server/chunks/[root-of-the-server]__ac0027b4._.js.map +1 -0
  269. package/web/.next/server/chunks/[root-of-the-server]__b2a4bfcc._.js.map +1 -1
  270. package/web/.next/server/chunks/[root-of-the-server]__c8f90b29._.js +1 -1
  271. package/web/.next/server/chunks/[root-of-the-server]__cd67a84c._.js.map +1 -1
  272. package/web/.next/server/chunks/[root-of-the-server]__ce82df38._.js +3 -0
  273. package/web/.next/server/chunks/[root-of-the-server]__ce82df38._.js.map +1 -0
  274. package/web/.next/server/chunks/f3a1f__next-internal_server_app_api_applications_[id]_resume_route_actions_3a66d646.js +3 -0
  275. package/web/.next/server/chunks/f3a1f__next-internal_server_app_api_applications_[id]_resume_route_actions_3a66d646.js.map +1 -0
  276. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_adopt_page_actions_4f9eef62.js +3 -0
  277. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_adopt_page_actions_4f9eef62.js.map +1 -0
  278. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_chat_page_actions_ffa16a22.js +3 -0
  279. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_chat_page_actions_ffa16a22.js.map +1 -0
  280. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_chat_page_actions_a1a998f9.js +3 -0
  281. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_chat_page_actions_a1a998f9.js.map +1 -0
  282. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
  283. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
  284. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js +2 -2
  285. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js.map +1 -1
  286. package/web/.next/server/chunks/ssr/744ca_web_components_features_applications_applications-page-client_tsx_d0db9938._.js +3 -0
  287. package/web/.next/server/chunks/ssr/744ca_web_components_features_applications_applications-page-client_tsx_d0db9938._.js.map +1 -0
  288. package/web/.next/server/chunks/ssr/[root-of-the-server]__04f4895b._.js +3 -0
  289. package/web/.next/server/chunks/ssr/[root-of-the-server]__04f4895b._.js.map +1 -0
  290. package/web/.next/server/chunks/ssr/[root-of-the-server]__17dadd08._.js +1 -1
  291. package/web/.next/server/chunks/ssr/[root-of-the-server]__17dadd08._.js.map +1 -1
  292. package/web/.next/server/chunks/ssr/[root-of-the-server]__1925bef0._.js +1 -1
  293. package/web/.next/server/chunks/ssr/[root-of-the-server]__1a9687c4._.js +1 -1
  294. package/web/.next/server/chunks/ssr/[root-of-the-server]__1a9687c4._.js.map +1 -1
  295. package/web/.next/server/chunks/ssr/[root-of-the-server]__347fd0f6._.js +3 -0
  296. package/web/.next/server/chunks/ssr/[root-of-the-server]__347fd0f6._.js.map +1 -0
  297. package/web/.next/server/chunks/ssr/[root-of-the-server]__46dd2baf._.js +3 -0
  298. package/web/.next/server/chunks/ssr/[root-of-the-server]__46dd2baf._.js.map +1 -0
  299. package/web/.next/server/chunks/ssr/[root-of-the-server]__4ee8be85._.js +1 -1
  300. package/web/.next/server/chunks/ssr/[root-of-the-server]__73cb4ff6._.js +3 -0
  301. package/web/.next/server/chunks/ssr/[root-of-the-server]__73cb4ff6._.js.map +1 -0
  302. package/web/.next/server/chunks/ssr/{[root-of-the-server]__87bc4dac._.js → [root-of-the-server]__86ff0bc5._.js} +3 -3
  303. package/web/.next/server/chunks/ssr/[root-of-the-server]__86ff0bc5._.js.map +1 -0
  304. package/web/.next/server/chunks/ssr/[root-of-the-server]__91c50abe._.js +3 -0
  305. package/web/.next/server/chunks/ssr/[root-of-the-server]__91c50abe._.js.map +1 -0
  306. package/web/.next/server/chunks/ssr/[root-of-the-server]__a48af49f._.js +3 -0
  307. package/web/.next/server/chunks/ssr/[root-of-the-server]__a48af49f._.js.map +1 -0
  308. package/web/.next/server/chunks/ssr/[root-of-the-server]__bb391c45._.js +1 -1
  309. package/web/.next/server/chunks/ssr/[root-of-the-server]__bb391c45._.js.map +1 -1
  310. package/web/.next/server/chunks/ssr/[root-of-the-server]__d5e22d1a._.js +3 -0
  311. package/web/.next/server/chunks/ssr/{[root-of-the-server]__7aa484f5._.js.map → [root-of-the-server]__d5e22d1a._.js.map} +1 -1
  312. package/web/.next/server/chunks/ssr/[root-of-the-server]__dd3e834e._.js +1 -1
  313. package/web/.next/server/chunks/ssr/[root-of-the-server]__dd3e834e._.js.map +1 -1
  314. package/web/.next/server/chunks/ssr/[root-of-the-server]__e0aa2bcb._.js +3 -0
  315. package/web/.next/server/chunks/ssr/[root-of-the-server]__e0aa2bcb._.js.map +1 -0
  316. package/web/.next/server/chunks/ssr/[root-of-the-server]__e265da61._.js +1 -1
  317. package/web/.next/server/chunks/ssr/[root-of-the-server]__ef0b8905._.js +12 -0
  318. package/web/.next/server/chunks/ssr/[root-of-the-server]__ef0b8905._.js.map +1 -0
  319. package/web/.next/server/chunks/ssr/[root-of-the-server]__f5614810._.js +3 -0
  320. package/web/.next/server/chunks/ssr/{[root-of-the-server]__090f24cb._.js.map → [root-of-the-server]__f5614810._.js.map} +1 -1
  321. package/web/.next/server/chunks/ssr/[root-of-the-server]__fe5db6b2._.js +3 -0
  322. package/web/.next/server/chunks/ssr/[root-of-the-server]__fe5db6b2._.js.map +1 -0
  323. package/web/.next/server/chunks/ssr/_037e85c7._.js +3 -0
  324. package/web/.next/server/chunks/ssr/_037e85c7._.js.map +1 -0
  325. package/web/.next/server/chunks/ssr/{_774cbf7d._.js → _133ae3de._.js} +2 -2
  326. package/web/.next/server/chunks/ssr/{_774cbf7d._.js.map → _133ae3de._.js.map} +1 -1
  327. package/web/.next/server/chunks/ssr/_1879404a._.js +1 -1
  328. package/web/.next/server/chunks/ssr/_1879404a._.js.map +1 -1
  329. package/web/.next/server/chunks/ssr/_295fffde._.js.map +1 -1
  330. package/web/.next/server/chunks/ssr/_29b8ed64._.js +3 -0
  331. package/web/.next/server/chunks/ssr/_29b8ed64._.js.map +1 -0
  332. package/web/.next/server/chunks/ssr/_2bc302d1._.js +3 -0
  333. package/web/.next/server/chunks/ssr/_2bc302d1._.js.map +1 -0
  334. package/web/.next/server/chunks/ssr/_35294e79._.js +3 -0
  335. package/web/.next/server/chunks/ssr/_35294e79._.js.map +1 -0
  336. package/web/.next/server/chunks/ssr/_3683083e._.js +3 -0
  337. package/web/.next/server/chunks/ssr/_3683083e._.js.map +1 -0
  338. package/web/.next/server/chunks/ssr/_45496654._.js.map +1 -1
  339. package/web/.next/server/chunks/ssr/_4b57bcc3._.js +9 -0
  340. package/web/.next/server/chunks/ssr/_4b57bcc3._.js.map +1 -0
  341. package/web/.next/server/chunks/ssr/_519d77a9._.js +3 -0
  342. package/web/.next/server/chunks/ssr/_519d77a9._.js.map +1 -0
  343. package/web/.next/server/chunks/ssr/_56b9d60f._.js +1 -1
  344. package/web/.next/server/chunks/ssr/_56b9d60f._.js.map +1 -1
  345. package/web/.next/server/chunks/ssr/_82db03fd._.js +3 -0
  346. package/web/.next/server/chunks/ssr/_82db03fd._.js.map +1 -0
  347. package/web/.next/server/chunks/ssr/_8c3086bf._.js +3 -0
  348. package/web/.next/server/chunks/ssr/_8c3086bf._.js.map +1 -0
  349. package/web/.next/server/chunks/ssr/_9173e475._.js +21 -0
  350. package/web/.next/server/chunks/ssr/_9173e475._.js.map +1 -0
  351. package/web/.next/server/chunks/ssr/_946a7fc6._.js +1 -1
  352. package/web/.next/server/chunks/ssr/_946a7fc6._.js.map +1 -1
  353. package/web/.next/server/chunks/ssr/{_81e7a131._.js → _a08047ef._.js} +2 -2
  354. package/web/.next/server/chunks/ssr/_a08047ef._.js.map +1 -0
  355. package/web/.next/server/chunks/ssr/_bc03ac82._.js +4 -0
  356. package/web/.next/server/chunks/ssr/_bc03ac82._.js.map +1 -0
  357. package/web/.next/server/chunks/ssr/_d4c0792b._.js +3 -0
  358. package/web/.next/server/chunks/ssr/_d4c0792b._.js.map +1 -0
  359. package/web/.next/server/chunks/ssr/_e61d032d._.js +3 -0
  360. package/web/.next/server/chunks/ssr/_e61d032d._.js.map +1 -0
  361. package/web/.next/server/chunks/ssr/_e65abbd1._.js +3 -0
  362. package/web/.next/server/chunks/ssr/_e65abbd1._.js.map +1 -0
  363. package/web/.next/server/chunks/ssr/_f86fc1bf._.js +1 -1
  364. package/web/.next/server/chunks/ssr/_f86fc1bf._.js.map +1 -1
  365. package/web/.next/server/chunks/ssr/_f8c55130._.js +1 -1
  366. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
  367. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
  368. package/web/.next/server/chunks/ssr/f3a1f_components_common_control-center-drawer_repository-drawer-client_tsx_39a00c03._.js +1 -1
  369. package/web/.next/server/chunks/ssr/node_modules__pnpm_28a53b5d._.js +3 -0
  370. package/web/.next/server/chunks/ssr/node_modules__pnpm_28a53b5d._.js.map +1 -0
  371. package/web/.next/server/chunks/ssr/src_presentation_web_47181610._.js +3 -0
  372. package/web/.next/server/chunks/ssr/src_presentation_web_47181610._.js.map +1 -0
  373. package/web/.next/server/chunks/ssr/src_presentation_web_5d3f4199._.js +3 -0
  374. package/web/.next/server/chunks/ssr/src_presentation_web_5d3f4199._.js.map +1 -0
  375. package/web/.next/server/chunks/ssr/src_presentation_web_6159fef8._.js +1 -1
  376. package/web/.next/server/chunks/ssr/src_presentation_web_6159fef8._.js.map +1 -1
  377. package/web/.next/server/chunks/ssr/src_presentation_web_61d96ba8._.js +3 -0
  378. package/web/.next/server/chunks/ssr/src_presentation_web_61d96ba8._.js.map +1 -0
  379. package/web/.next/server/chunks/ssr/src_presentation_web_6994959a._.js +3 -0
  380. package/web/.next/server/chunks/ssr/src_presentation_web_6994959a._.js.map +1 -0
  381. package/web/.next/server/chunks/ssr/src_presentation_web_77dadf68._.js +32 -0
  382. package/web/.next/server/chunks/ssr/src_presentation_web_77dadf68._.js.map +1 -0
  383. package/web/.next/server/chunks/ssr/src_presentation_web_9a543843._.js +3 -0
  384. package/web/.next/server/chunks/ssr/src_presentation_web_9a543843._.js.map +1 -0
  385. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_c3f6f57e.js +3 -0
  386. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_c3f6f57e.js.map +1 -0
  387. package/web/.next/server/chunks/ssr/src_presentation_web_ad42cc73._.js +1 -1
  388. package/web/.next/server/chunks/ssr/src_presentation_web_ad42cc73._.js.map +1 -1
  389. package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_8514dfcd._.js +32 -0
  390. package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_8514dfcd._.js.map +1 -0
  391. package/web/.next/server/chunks/ssr/src_presentation_web_b95ed206._.js +3 -0
  392. package/web/.next/server/chunks/ssr/src_presentation_web_b95ed206._.js.map +1 -0
  393. package/web/.next/server/chunks/ssr/src_presentation_web_bade80bd._.js +3 -0
  394. package/web/.next/server/chunks/ssr/src_presentation_web_bade80bd._.js.map +1 -0
  395. package/web/.next/server/chunks/ssr/src_presentation_web_c543cf3e._.js +3 -0
  396. package/web/.next/server/chunks/ssr/src_presentation_web_c543cf3e._.js.map +1 -0
  397. package/web/.next/server/chunks/ssr/src_presentation_web_components_895e5bfa._.js +1 -1
  398. package/web/.next/server/chunks/ssr/src_presentation_web_components_895e5bfa._.js.map +1 -1
  399. package/web/.next/server/chunks/ssr/src_presentation_web_components_common_base-drawer_base-drawer_tsx_97dfbbc8._.js +1 -1
  400. package/web/.next/server/chunks/ssr/src_presentation_web_components_common_base-drawer_base-drawer_tsx_97dfbbc8._.js.map +1 -1
  401. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_skills_8a174cac._.js +1 -1
  402. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_skills_8a174cac._.js.map +1 -1
  403. package/web/.next/server/chunks/ssr/src_presentation_web_components_ui_dropdown-menu_tsx_229332e3._.js +3 -0
  404. package/web/.next/server/chunks/ssr/src_presentation_web_components_ui_dropdown-menu_tsx_229332e3._.js.map +1 -0
  405. package/web/.next/server/chunks/ssr/translations_1562ae1a._.js +3 -0
  406. package/web/.next/server/chunks/ssr/translations_1562ae1a._.js.map +1 -0
  407. package/web/.next/server/pages/500.html +2 -2
  408. package/web/.next/server/server-reference-manifest.js +1 -1
  409. package/web/.next/server/server-reference-manifest.json +184 -72
  410. package/web/.next/static/chunks/019e71634c720ede.js +1 -0
  411. package/web/.next/static/chunks/040c5ff84a8ae1a3.js +7 -0
  412. package/web/.next/static/chunks/092ac28f5a4422a0.js +19 -0
  413. package/web/.next/static/chunks/0bd78b0cf1c1421f.js +1 -0
  414. package/web/.next/static/chunks/{996e4ea45364bf3c.js → 18c21c4f9f58b69a.js} +3 -3
  415. package/web/.next/static/chunks/2b5aea3575387b3a.js +1 -0
  416. package/web/.next/static/chunks/2cbe80f8e84d59a8.js +1 -0
  417. package/web/.next/static/chunks/{503d2e86f83285f9.js → 3219b06f6a34e573.js} +1 -1
  418. package/web/.next/static/chunks/37e434e579ecfa02.js +1 -0
  419. package/web/.next/static/chunks/4a7cf3b09e0495a4.js +1 -0
  420. package/web/.next/static/chunks/{83fc7ea32e18c9a5.js → 4ea617a22e21fb04.js} +1 -1
  421. package/web/.next/static/chunks/54d1d5a646a12d76.js +1 -0
  422. package/web/.next/static/chunks/{9e9b60f127270dfd.js → 553be530f22710a7.js} +1 -1
  423. package/web/.next/static/chunks/5795b9f399523c9e.js +1 -0
  424. package/web/.next/static/chunks/{d488e6b5cbbc6833.js → 6a88df64eaeb6322.js} +1 -1
  425. package/web/.next/static/chunks/{2fe20598e1b4793a.js → 6b2859ea368e7df3.js} +3 -3
  426. package/web/.next/static/chunks/6d8cae68371a845d.js +1 -0
  427. package/web/.next/static/chunks/{a2601dbbcb657c7d.js → 78607d521d916531.js} +1 -1
  428. package/web/.next/static/chunks/{7bf6ed16395220c4.js → 7d5a7551d452463d.js} +2 -2
  429. package/web/.next/static/chunks/80e778136b2f4c92.js +1 -0
  430. package/web/.next/static/chunks/a62fb058d660bea3.js +3 -0
  431. package/web/.next/static/chunks/adf16efe8bac05e9.css +1 -0
  432. package/web/.next/static/chunks/b0474319e5a50043.js +1 -0
  433. package/web/.next/static/chunks/b85532fb1545927c.js +5 -0
  434. package/web/.next/static/chunks/e0ae4dbd97b7af4c.js +1 -0
  435. package/web/.next/static/chunks/{2af89379fde6831d.js → f70998ac93012aef.js} +1 -1
  436. package/web/.next/server/chunks/ssr/[root-of-the-server]__013a0318._.js +0 -3
  437. package/web/.next/server/chunks/ssr/[root-of-the-server]__013a0318._.js.map +0 -1
  438. package/web/.next/server/chunks/ssr/[root-of-the-server]__090f24cb._.js +0 -3
  439. package/web/.next/server/chunks/ssr/[root-of-the-server]__24756fa9._.js +0 -12
  440. package/web/.next/server/chunks/ssr/[root-of-the-server]__24756fa9._.js.map +0 -1
  441. package/web/.next/server/chunks/ssr/[root-of-the-server]__70986695._.js +0 -3
  442. package/web/.next/server/chunks/ssr/[root-of-the-server]__70986695._.js.map +0 -1
  443. package/web/.next/server/chunks/ssr/[root-of-the-server]__7aa484f5._.js +0 -3
  444. package/web/.next/server/chunks/ssr/[root-of-the-server]__87bc4dac._.js.map +0 -1
  445. package/web/.next/server/chunks/ssr/[root-of-the-server]__a3a4ddef._.js +0 -3
  446. package/web/.next/server/chunks/ssr/[root-of-the-server]__a3a4ddef._.js.map +0 -1
  447. package/web/.next/server/chunks/ssr/[root-of-the-server]__a4222b95._.js +0 -3
  448. package/web/.next/server/chunks/ssr/[root-of-the-server]__a4222b95._.js.map +0 -1
  449. package/web/.next/server/chunks/ssr/[root-of-the-server]__a5ea76a6._.js +0 -3
  450. package/web/.next/server/chunks/ssr/[root-of-the-server]__a5ea76a6._.js.map +0 -1
  451. package/web/.next/server/chunks/ssr/[root-of-the-server]__a6f2b763._.js +0 -3
  452. package/web/.next/server/chunks/ssr/[root-of-the-server]__a6f2b763._.js.map +0 -1
  453. package/web/.next/server/chunks/ssr/[root-of-the-server]__f3ca7bea._.js +0 -3
  454. package/web/.next/server/chunks/ssr/[root-of-the-server]__f3ca7bea._.js.map +0 -1
  455. package/web/.next/server/chunks/ssr/_0277d3b5._.js +0 -21
  456. package/web/.next/server/chunks/ssr/_0277d3b5._.js.map +0 -1
  457. package/web/.next/server/chunks/ssr/_44531b76._.js +0 -9
  458. package/web/.next/server/chunks/ssr/_44531b76._.js.map +0 -1
  459. package/web/.next/server/chunks/ssr/_5dec4047._.js +0 -3
  460. package/web/.next/server/chunks/ssr/_5dec4047._.js.map +0 -1
  461. package/web/.next/server/chunks/ssr/_73aa3b20._.js +0 -3
  462. package/web/.next/server/chunks/ssr/_73aa3b20._.js.map +0 -1
  463. package/web/.next/server/chunks/ssr/_81e7a131._.js.map +0 -1
  464. package/web/.next/server/chunks/ssr/_869a3a15._.js +0 -3
  465. package/web/.next/server/chunks/ssr/_869a3a15._.js.map +0 -1
  466. package/web/.next/server/chunks/ssr/_b227ff50._.js +0 -3
  467. package/web/.next/server/chunks/ssr/_b227ff50._.js.map +0 -1
  468. package/web/.next/server/chunks/ssr/_d75dcb43._.js +0 -3
  469. package/web/.next/server/chunks/ssr/_d75dcb43._.js.map +0 -1
  470. package/web/.next/server/chunks/ssr/_e071ba48._.js +0 -3
  471. package/web/.next/server/chunks/ssr/_e071ba48._.js.map +0 -1
  472. package/web/.next/server/chunks/ssr/_eff1b518._.js +0 -3
  473. package/web/.next/server/chunks/ssr/_eff1b518._.js.map +0 -1
  474. package/web/.next/server/chunks/ssr/_f227429a._.js +0 -3
  475. package/web/.next/server/chunks/ssr/_f227429a._.js.map +0 -1
  476. package/web/.next/server/chunks/ssr/src_presentation_web_36f2bc45._.js +0 -3
  477. package/web/.next/server/chunks/ssr/src_presentation_web_36f2bc45._.js.map +0 -1
  478. package/web/.next/server/chunks/ssr/src_presentation_web_486908de._.js +0 -3
  479. package/web/.next/server/chunks/ssr/src_presentation_web_486908de._.js.map +0 -1
  480. package/web/.next/server/chunks/ssr/src_presentation_web_5c3596bc._.js +0 -3
  481. package/web/.next/server/chunks/ssr/src_presentation_web_5c3596bc._.js.map +0 -1
  482. package/web/.next/server/chunks/ssr/src_presentation_web_6326f81e._.js +0 -3
  483. package/web/.next/server/chunks/ssr/src_presentation_web_6326f81e._.js.map +0 -1
  484. package/web/.next/server/chunks/ssr/src_presentation_web_6b2fdcd8._.js +0 -3
  485. package/web/.next/server/chunks/ssr/src_presentation_web_6b2fdcd8._.js.map +0 -1
  486. package/web/.next/server/chunks/ssr/src_presentation_web_74703c9f._.js +0 -3
  487. package/web/.next/server/chunks/ssr/src_presentation_web_74703c9f._.js.map +0 -1
  488. package/web/.next/server/chunks/ssr/src_presentation_web_a8056dac._.js +0 -3
  489. package/web/.next/server/chunks/ssr/src_presentation_web_a8056dac._.js.map +0 -1
  490. package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js +0 -32
  491. package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js.map +0 -1
  492. package/web/.next/server/chunks/ssr/src_presentation_web_b00bfb08._.js +0 -3
  493. package/web/.next/server/chunks/ssr/src_presentation_web_b00bfb08._.js.map +0 -1
  494. package/web/.next/server/chunks/ssr/src_presentation_web_ca99d62d._.js +0 -3
  495. package/web/.next/server/chunks/ssr/src_presentation_web_ca99d62d._.js.map +0 -1
  496. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +0 -3
  497. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +0 -1
  498. package/web/.next/server/chunks/ssr/src_presentation_web_f1edcf5e._.js +0 -3
  499. package/web/.next/server/chunks/ssr/src_presentation_web_f1edcf5e._.js.map +0 -1
  500. package/web/.next/server/chunks/ssr/src_presentation_web_f9436804._.js +0 -3
  501. package/web/.next/server/chunks/ssr/src_presentation_web_f9436804._.js.map +0 -1
  502. package/web/.next/server/chunks/ssr/translations_23dd5e7e._.js +0 -3
  503. package/web/.next/server/chunks/ssr/translations_23dd5e7e._.js.map +0 -1
  504. package/web/.next/static/chunks/06b9d6dbf635c370.css +0 -1
  505. package/web/.next/static/chunks/1ae0cf5be30ef398.js +0 -1
  506. package/web/.next/static/chunks/3a71cab38909921e.js +0 -1
  507. package/web/.next/static/chunks/4e53adb5d07b7e3d.js +0 -1
  508. package/web/.next/static/chunks/5e7ac3508bef115f.js +0 -1
  509. package/web/.next/static/chunks/761a7c542b358739.js +0 -1
  510. package/web/.next/static/chunks/927442d2628f6e22.js +0 -1
  511. package/web/.next/static/chunks/a31f2264cedb23e9.js +0 -1
  512. package/web/.next/static/chunks/abf7d1b66555b758.js +0 -7
  513. package/web/.next/static/chunks/b99506a6f7bc2fa8.js +0 -1
  514. package/web/.next/static/chunks/d984d1d8d506291c.js +0 -7
  515. package/web/.next/static/chunks/e843a0d8e8c645c4.js +0 -1
  516. package/web/.next/static/chunks/f5ed0232d50b1ec8.js +0 -19
  517. /package/web/.next/static/{6GBQ7MHEYpZbJzqULwvXh → t-O8eMjJCUhhtd6CgtTXI}/_buildManifest.js +0 -0
  518. /package/web/.next/static/{6GBQ7MHEYpZbJzqULwvXh → t-O8eMjJCUhhtd6CgtTXI}/_clientMiddlewareManifest.json +0 -0
  519. /package/web/.next/static/{6GBQ7MHEYpZbJzqULwvXh → t-O8eMjJCUhhtd6CgtTXI}/_ssgManifest.js +0 -0
@@ -1,5 +1,5 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,87538,e=>{"use strict";let t=(0,e.i(3645).default)("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);e.s(["Maximize2",()=>t],87538)},7319,91379,28038,42888,38782,32527,12504,61163,88992,8624,38048,50147,51996,40165,21470,17367,e=>{"use strict";var t=e.i(44172),n=e.i(20314),r=e.i(79054);function i(e){let t=[];for(let n of e.effectTasks)try{n()}catch(e){t.push(e)}if(t.length>0)if(1===t.length)throw t[0];else{for(let e of t)console.error(e);throw AggregateError(t,"Errors during commit")}}function s(e){let t=[];for(let n of e.cells)if(n?.type==="effect"&&(n.deps=null,n.cleanup))try{n.cleanup?.()}catch(e){t.push(e)}finally{n.cleanup=void 0}if(t.length>0)if(1===t.length)throw t[0];else{for(let e of t)console.error(e);throw AggregateError(t,"Errors during cleanup")}}let o=void 0!==t.default&&!1,a=null;function l(){if(!a)throw Error("No resource fiber available");return a}let u=Symbol("fnSymbol");function c(e,t,n,r=function(e){return o?a?.devStrictMode?a.isFirstRender?"child":"root":e?"root":null:null}(!1)){return{type:e,root:t,markDirty:n,devStrictMode:r,cells:[],currentIndex:0,renderContext:void 0,isFirstRender:!0,isMounted:!1,isNeverMounted:!0}}function d(e){if(!e.isMounted)throw Error("Tried to unmount a fiber that is already unmounted");e.isMounted=!1,s(e)}function h(e,t){let n={effectTasks:[],props:t,output:void 0};e.currentIndex=0;let r=a;a=e;try{if((()=>{e.renderContext=n;try{n.output=function(e,t){let n=e[u];if(!n)throw Error("ResourceElement.type is not a valid Resource");return n(t)}(e.type,t)}finally{e.renderContext=void 0}})(),e.isFirstRender=!1,e.cells.length!==e.currentIndex)throw Error(`Rendered ${e.currentIndex} hooks but expected ${e.cells.length}. Hooks must be called in the exact same order in every render.`)}finally{a=r}return n}function p(e,t){e.isMounted=!0,o&&e.isNeverMounted&&"root"===e.devStrictMode&&(e.isNeverMounted=!1,i(t),s(e)),e.isNeverMounted=!1,i(t)}let f=e=>({version:0,committedVersion:0,dispatchUpdate:e,changelog:[],dirtyCells:[]}),m=e=>{for(let t of e.dirtyCells)t.dirty=!1,t.queue.clear(),t.current=t.workInProgress;e.committedVersion=e.version,e.changelog.length=0,e.dirtyCells.length=0},g=(e,t)=>{let n=e.version>t;if(e.version=t,n){for(let t of e.dirtyCells)t.dirty=!1,t.queue.clear(),t.workInProgress=t.current;if(e.dirtyCells.length=0,t===e.committedVersion)e.changelog.length=0;else{if(e.committedVersion>t)throw Error("Version is less than committed version");for(;e.committedVersion+e.changelog.length>t;)e.changelog.pop();e.changelog.forEach(e=>e()),m(e)}}},y=(e,t)=>{t.dirty||(t.dirty=!0,e.markDirty?.(),e.root.dirtyCells.push(t))};function b(e){let t=e=>({type:t,props:e});return t[u]=e,t}e.s(["resource",()=>b],91379);let x=(e,t)=>{let n=l(),r=n.currentIndex++;if(!n.isFirstRender&&r>=n.cells.length)throw Error("Rendered more hooks than during the previous render. Hooks must be called in the exact same order in every render.");let i=n.cells[r];if(i||(i=t(),n.cells[r]=i),i.type!==e)throw Error("Hook order changed between renders");return i};function v(e,t,n,r){let i=x("reducer",()=>{let t=l(),s=r?r(n):n;return o&&t.devStrictMode&&r&&r(n),{type:"reducer",queue:new Set,dirty:!1,workInProgress:s,current:s,reducer:e,dispatch:n=>{let r={action:n,hasEagerState:!1,eagerState:void 0};if(t.renderContext)throw Error("Resource updated during render");if(t.isNeverMounted)throw Error("Resource updated before mount");t.root.dispatchUpdate(()=>{let s=0===t.root.dirtyCells.length&&!r.hasEagerState&&(r.eagerState=e(i.workInProgress,n),r.hasEagerState=!0,Object.is(i.current,r.eagerState))?null:()=>{y(t,i),i.queue.add(r)};return!!s&&(s(),t.root.changelog.push(s),!0)})}}}),s=l(),a=e===i.reducer;for(let t of(i.reducer=e,i.queue))t.hasEagerState&&a||(t.eagerState=e(i.workInProgress,t.action),t.hasEagerState=!0),o&&s.devStrictMode&&e(i.workInProgress,t.action),i.workInProgress=t.eagerState;if(i.queue.clear(),t){let e=t(i.workInProgress);Object.is(e,i.workInProgress)||(y(s,i),i.workInProgress=e)}return[i.workInProgress,i.dispatch]}let w=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0},S=()=>{throw Error("Memo reducer should not be called")},k=(e,t)=>{let n=l(),[r]=v(S,r=>{if(r&&w(r.deps,t))return r;let i=e();return o&&n.devStrictMode&&e(),{value:i,deps:t}},null,void 0);return r.value};e.s(["tapMemo",0,k],28038);let _=()=>({type:"effect",cleanup:void 0,deps:null});function E(e,t){let n=x("effect",_);if(!(t&&n.deps&&w(n.deps,t))){if(null!==n.deps&&!!t!=!!n.deps)throw Error("tapEffect called with and without dependencies across re-renders");l().renderContext.effectTasks.push(()=>{let r=[];try{n.cleanup?.()}catch(e){r.push(e)}finally{n.cleanup=void 0}try{let t=e();if(void 0!==t&&"function"!=typeof t)throw Error(`An effect function must either return a cleanup function or nothing. Received: ${typeof t}`);n.cleanup=t}catch(e){r.push(e)}if(n.deps=t,r.length>0)if(1===r.length)throw r[0];else{for(let e of r)console.error(e);throw AggregateError(r,"Errors during commit")}})}}let C=(e,t)=>k(()=>e,t),T=(e,t)=>"function"==typeof t?t(e):t,I=e=>"function"==typeof e?e():e;function j(e){return v(T,void 0,e,I)}function A(e,t){let[n]=j(e);return n}function R(e){let[t]=j(()=>({current:e}));return t}function M(e,t){let n=R(0),r=n.current,i=A(l,[]),s=A(()=>()=>{n.current++,i.markDirty?.()},[]),o=A(()=>new Map,[]),a=t?C(e,t):e,u=k(()=>{let e=a(),t=new Set,n=[],r=0;for(let a=0;a<e.length;a++){let l=e[a],u=l.key;if(void 0===u)throw Error(`tapResources did not provide a key for array at index ${a}`);if(t.has(u))throw Error(`Duplicate key ${u} in tapResources`);t.add(u);let d=o.get(u);if(d)if(d.fiber.type!==l.type){let e=c(l.type,i.root,s),t=h(e,l.props);d.next=[e,t],n.push(t.output)}else d.next=h(d.fiber,l.props),n.push(d.next.output);else{let e=c(l.type,i.root,s),t=h(e,l.props);d={fiber:e,next:t},r++,o.set(u,d),n.push(t.output)}}if(o.size>n.length-r)for(let e of o.keys())t.has(e)||(o.get(e).next="delete");return n},[a,r]);return E(()=>()=>{for(let e of o.keys())d(o.get(e).fiber)},[]),E(()=>{for(let[e,t]of o.entries())"delete"===t.next?(t.fiber.isMounted&&d(t.fiber),o.delete(e)):Array.isArray(t.next)?(d(t.fiber),t.fiber=t.next[0],p(t.fiber,t.next[1])):p(t.fiber,t.next)},[u]),u}function N(e){let t=R(e);if(E(()=>{t.current=e}),o){let e=l();return C((...n)=>{if(e.renderContext)throw Error("tapEffectEvent cannot be called during render");return t.current(...n)},[e])}return t.current}function O(e,t){let n=l(),r=R(0),i=k(()=>(e.key,c(e.type,n.root,()=>{r.current++,n.markDirty?.()})),[e.type,e.key,n]),s=t?k(()=>h(i,e.props),[i,...t,r.current]):h(i,e.props);return E(()=>()=>d(i),[i]),E(()=>{p(i,s)},[i,s]),s.output}function P(e,t){return{...t,key:e}}e.s(["tapState",()=>j],42888);let D={schedulers:new Set([]),isScheduled:!1};class F{_task;_isDirty=!1;constructor(e){this._task=e}get isDirty(){return this._isDirty}markDirty(){this._isDirty=!0,D.schedulers.add(this),L()}runTask(){this._isDirty=!1,this._task()}}let L=()=>{D.isScheduled||(D.isScheduled=!0,z())},B=()=>{try{let e=[],t=0;for(let n of D.schedulers)if(D.schedulers.delete(n),n.isDirty){if(++t>50)throw Error("Maximum update depth exceeded. This can happen when a resource repeatedly calls setState inside tapEffect.");try{n.runTask()}catch(t){e.push(t)}}if(e.length>0)if(1===e.length)throw e[0];else{for(let t of e)console.error(t);throw AggregateError(e,"Errors occurred during flushSync")}}finally{D.schedulers.clear(),D.isScheduled=!1}},z=(()=>{if("u">typeof MessageChannel){let e=new MessageChannel;return e.port1.onmessage=B,()=>e.port2.postMessage(null)}return()=>setTimeout(B,0)})();e.s(["UpdateScheduler",()=>F,"flushResourcesSync",0,e=>{let t=D;D={schedulers:new Set([]),isScheduled:!0};try{let t=e();return B(),t}finally{D=t}}],38782);let U=Symbol("tap.Context"),q=e=>({[U]:e}),$=(e,t,n)=>{let r=e[U];e[U]=t;try{return n()}finally{e[U]=r}},H=e=>e[U],V=Symbol("assistant-ui.store.clientIndex"),Q=q([]),W=new Set(["$$typeof","nodeType","then"]),K=(e,t)=>e===Symbol.toStringTag?t:"symbol"==typeof e?void 0:"toJSON"===e?()=>t:!!W.has(e)&&void 0;class G{getOwnPropertyDescriptor(e,t){let n=this.get(e,t);if(void 0!==n)return{value:n,writable:!1,enumerable:!0,configurable:!1}}set(){return!1}setPrototypeOf(){return!1}defineProperty(){return!1}deleteProperty(){return!1}preventExtensions(){return!1}}let J=e=>{let t=b(e);return e=>{let n=t(e);return void 0===e.key?n:P(e.key,n)}},Y=Symbol("assistant-ui.store.getValue"),X=new Map;class Z extends G{outputRef;index;boundFns;cachedReceiver;constructor(e,t){super(),this.outputRef=e,this.index=t}get(e,t,n){if(t===Y)return this.outputRef.current;if(t===V)return this.index;let r=K(t,"ClientProxy");if(!1!==r)return r;let i=this.outputRef.current[t];if("function"==typeof i){this.cachedReceiver!==n&&(this.boundFns=new Map,this.cachedReceiver=n);let e=this.boundFns.get(t);if(!e){let r;e=(!(r=X.get(t))&&(r=function(...e){if(!this||"object"!=typeof this)throw Error(`Method "${String(t)}" called without proper context. This may indicate the function was called incorrectly.`);let n=this[Y];if(!n)throw Error(`Method "${String(t)}" called on invalid client proxy. Ensure you are calling this method on a valid client instance.`);let r=n[t];if(!r)throw Error(`Method "${String(t)}" is not implemented.`);if("function"!=typeof r)throw Error(`"${String(t)}" is not a function.`);return r(...e)},X.set(t,r)),r).bind(n),this.boundFns.set(t,e)}return e}return i}ownKeys(){return Object.keys(this.outputRef.current)}has(e,t){return t===Y||t===V||t in this.outputRef.current}}let ee=J(e=>{var t;let n,r=R(null),i=H(Q).length,s=k(()=>new Proxy({},new Z(r,i)),[i]),o=(t=()=>O(e),n=H(Q),$(Q,k(()=>[...n,s],[n,s]),t));return r.current||(r.current=o),E(()=>{r.current=o}),{methods:s,state:o.getState?.(),key:e.key}}),et=Symbol("assistant-ui.store.proxiedAssistantState"),en=e=>"on"===e||"subscribe"===e||"symbol"==typeof e,er=e=>new Proxy({},new class extends G{get(t,n){let r=K(n,"AssistantState");if(!1!==r)return r;if(!en(n)){let t=e[n]()[Y];if(!t)throw Error("Client scope contains a non-client resource. Ensure your Derived get() returns a client created with tapClientResource(), not a plain resource.");return t.getState?.()}}ownKeys(){return Object.keys(e).filter(e=>!en(e))}has(t,n){return!en(n)&&n in e}});e.s(["PROXIED_ASSISTANT_STATE_SYMBOL",0,et,"createProxiedAssistantState",0,er,"getProxiedAssistantState",0,e=>e[et]],32527);let ei=()=>()=>{},es=e=>{let t=()=>{throw Error(e)};return t.source=null,t.query=null,t},eo=new Proxy({},new class extends G{get(e,t){if("subscribe"===t||"on"===t)return ei;if(t===et)return ea;let n=K(t,"DefaultAssistantClient");return!1!==n?n:es("You are using a component or hook that requires an AuiProvider. Wrap your component in an <AuiProvider> component.")}ownKeys(){return["subscribe","on",et]}has(e,t){return"subscribe"===t||"on"===t||t===et}}),ea=er(eo),el=()=>new Proxy({},{get(e,t){let n=K(t,"AssistantClient");return!1!==n?n:es(`The current scope does not have a "${String(t)}" property.`)}}),eu=(0,r.createContext)(eo),ec=()=>(0,r.useContext)(eu),ed=({value:e,children:t})=>(0,n.jsx)(eu.Provider,{value:e,children:t});e.s(["AuiProvider",0,ed,"DefaultAssistantClient",0,eo,"createRootAssistantClient",0,el,"useAssistantContextValue",0,ec],12504);let eh=b(e=>null);e.s(["Derived",0,eh],61163);let ep=Symbol("assistant-ui.transform-scopes");function ef(e,t){if(e[ep])throw Error("transformScopes is already attached to this resource");e[ep]=t}let em=e=>k(()=>e,[...Object.entries(e).flat()]),eg=e=>"string"==typeof e?{scope:e.split(".")[0],event:e}:{scope:e.scope,event:e.event};e.s(["normalizeEventSelector",0,eg],88992);let ey=b(()=>A(()=>{let e=new Map,t=new Set,n=new Set;return{on(n,r){if("*"===n)return t.add(r),()=>t.delete(r);let i=e.get(n);return i||(i=new Set,e.set(n,i)),i.add(r),()=>{i.delete(r),0===i.size&&e.delete(n)}},emit(n,r,i){let s=e.get(n);(s||0!==t.size)&&queueMicrotask(()=>{let e=[];if(s)for(let t of s)try{t(r,i)}catch(t){e.push(t)}if(t.size>0){let s={event:n,payload:r};for(let n of t)try{n(s,i)}catch(t){e.push(t)}}if(e.length>0)if(1===e.length)throw e[0];else{for(let t of e)console.error(t);throw AggregateError(e,"Errors occurred during event emission")}})},subscribe:e=>(n.add(e),()=>n.delete(e)),notifySubscribers(){for(let e of n)try{e()}catch(e){console.error("NotificationManager: subscriber callback error",e)}}}},[])),eb=q(null),ex=()=>{let e=H(eb);if(!e)throw Error("AssistantTapContext is not available");return e},ev=()=>{let{emit:e}=ex(),t=H(Q);return N((n,r)=>{e(n,r,t)})},ew=e=>k(()=>e,e),eS=b(({element:e,emit:t,clientRef:n})=>{let{methods:r,state:i}=$(eb,{clientRef:n,emit:t},()=>O(ee(e)));return k(()=>({state:i,methods:r}),[r,i])}),ek=b(({element:e,notifications:t,clientRef:n,name:r})=>{var i;let s,a,l,u,y,b,x,v,w,S=(i=eS({element:e,emit:t.emit,clientRef:n}),s=A(()=>new F(()=>w(null)),[]),a=A(()=>[],[]),g((l=k(()=>(i.key,c(i.type,f(e=>{(s.isDirty||e())&&(a.push(e),s.markDirty())}))),[i.type,i.key])).root,l.root.committedVersion),u=h(l,i.props),y=R(!1),b=R(i.props),x=R(u.output),v=A(()=>new Set,[]),w=N(e=>{if(null===e&&(g(l.root,2),g(l.root,1),a.forEach(e=>{o&&l.devStrictMode&&e(),e()}),o&&l.devStrictMode&&h(l,b.current),e=h(l,b.current)),s.isDirty)throw Error("Scheduler is dirty, this should never happen");m(l.root),a.length=0,y.current&&p(l,e),s.isDirty||x.current===e.output||(x.current=e.output,v.forEach(e=>e()))}),E(()=>(y.current=!0,()=>{y.current=!1,d(l)}),[l]),E(()=>{b.current=u.props,m(l.root),p(l,u),s.isDirty||x.current===u.output||(x.current=u.output,v.forEach(e=>e()))}),k(()=>({getValue:()=>x.current,subscribe:e=>(v.add(e),()=>v.delete(e))}),[]));return E(()=>S.subscribe(t.notifySubscribers),[S,t]),k(()=>{let e=()=>S.getValue().methods;return Object.defineProperties(e,{source:{value:"root",writable:!1},query:{value:{},writable:!1},name:{value:r,configurable:!0}}),e},[S,r])}),e_=b(()=>k(()=>({clients:[],subscribe:void 0,on:void 0}),[])),eE=b(({clients:e,clientRef:t})=>{let n=O(ey());E(()=>t.parent.subscribe(n.notifySubscribers),[t,n]);let r=ew(M(()=>Object.keys(e).map(r=>P(r,ek({element:e[r],notifications:n,clientRef:t,name:r}))),[e,n,t]));return k(()=>({clients:r,subscribe:n.subscribe,on:function(e,r){if(!this)throw Error("const { on } = useAui() is not supported. Use aui.on() instead.");let{scope:i,event:s}=eg(e);if("*"!==i&&null===this[i].source)throw Error(`Scope "${i}" is not available. Use { scope: "*", event: "${s}" } to listen globally.`);let o=n.on(s,(e,t)=>{if("*"===i)return void r(e);let n=this[i](),s=n[V];n===t[s]&&r(e)});if("*"!==i&&null===t.parent[i].source)return o;let a=t.parent.on(e,r);return()=>{o(),a()}}}),[r,n,t])}),eC=(e,t,n)=>{if("source"in e&&"query"in e)return e;if(n.dep===e)return n.meta;let r=e.getMeta(t.current);return n.meta=r,n.dep=e,r},eT=b(({element:e,clientRef:t,name:n})=>{let r=N(()=>e.props);return k(()=>{let e=()=>r().get(t.current),i={};return Object.defineProperties(e,{source:{get:()=>eC(r(),t,i).source},query:{get:()=>eC(r(),t,i).query},name:{value:n,configurable:!0}}),e},[t,n])}),eI=b(({clients:e,clientRef:t})=>ew(M(()=>Object.keys(e).map(n=>P(n,eT({element:e[n],clientRef:t,name:n}))),[e,t]))),ej=b(({parent:e,clients:t})=>{let{rootClients:n,derivedClients:r}=((e,t)=>{let{rootClients:n,derivedClients:r}=function(e,t){let n={...e},r=new Set,i=!0;for(;i;)for(let e of(i=!1,Object.values(n))){if(e.type===eh||r.has(e.type))continue;r.add(e.type);let s=e.type[ep];if(s){n=s(n,t),i=!0;break}}let s={},o={};for(let[e,t]of Object.entries(n))t.type===eh?o[e]=t:s[e]=t;return{rootClients:s,derivedClients:o}}(e,t);return{rootClients:em(n),derivedClients:em(r)}})(t,e),i=R({parent:e,current:null}).current;E(()=>{i.current=a});let s=O(Object.keys(n).length>0?eE({clients:n,clientRef:i}):e_()),o=O(eI({clients:r,clientRef:i})),a=k(()=>{let t=Object.create(e===eo?el():e);for(let n of(Object.assign(t,{subscribe:s.subscribe??e.subscribe,on:s.on??e.on,[et]:er(t)}),s.clients))t[n.name]=n;for(let e of o)t[e.name]=e;return t},[e,s,o]);return null===i.current&&(i.current=a),a});function eA(e,{parent:t}={parent:ec()}){if(e)return function(e){let t=(0,r.useMemo)(()=>f(e=>i(e)),[]),[n,i]=(0,r.useReducer)((e,n)=>(g(t,e),e+ +!!n()),0);g(t,n);let s=(()=>{if(!o)return null;let e=(0,r.useRef)(0),t=0===e.current;return((0,r.useState)(()=>e.current++),2!==e.current)?null:t?"child":"root"})(),a=(0,r.useMemo)(()=>(e.key,c(e.type,t,void 0,s)),[e.type,e.key,t,s]),l=h(a,e.props);return(0,r.useLayoutEffect)(()=>()=>d(a),[a]),(0,r.useLayoutEffect)(()=>{m(t),p(a,l)}),l.output}(ej({parent:t??eo,clients:e}));if(null===t)throw Error("received null parent, this usage is not allowed");return t}e.s(["useAui",()=>eA],8624);let eR=J(e=>{if(void 0===e.key)throw Error("tapClientResource: Element has no key");return O(ee(e))});function eM(e,t){let n=M(()=>e().map(e=>eR(e)),t),r=k(()=>Object.keys(n),[n]),i=k(()=>n.reduce((e,t,n)=>(e[t.key]=n,e),{}),[n]);return{state:k(()=>n.map(e=>e.state),[n]),get:e=>{if("index"in e){if(e.index<0||e.index>=r.length)throw Error(`tapClientLookup: Index ${e.index} out of bounds (length: ${r.length})`);return n[e.index].methods}let t=i[e.key];if(void 0===t)throw Error(`tapClientLookup: Key "${e.key}" not found`);return n[t].methods}}}let eN=e=>{let[,t]=j(e.getState);return E(()=>(t(e.getState()),e.subscribe(()=>{t(e.getState())})),[e]),e.getState()},eO=b(({runtime:e})=>{let t=eN(e),n=ev();return E(()=>{let t=[];for(let r of["switchedTo","switchedAway"]){let i=e.unstable_on(r,()=>{n(`threadListItem.${r}`,{threadId:e.getState().id})});t.push(i)}return()=>{for(let e of t)e()}},[e,n]),{getState:()=>t,switchTo:e.switchTo,rename:e.rename,archive:e.archive,unarchive:e.unarchive,delete:e.delete,generateTitle:e.generateTitle,initialize:e.initialize,detach:e.detach,__internal_getRuntime:()=>e}}),eP=b(({runtime:e})=>{let t=eN(e);return{getState:()=>t,remove:e.remove,__internal_getRuntime:()=>e}}),eD=b(({runtime:e,index:t})=>O(eP({runtime:k(()=>e.getAttachmentByIndex(t),[e,t])}))),eF=b(({threadIdRef:e,messageIdRef:t,runtime:n})=>{let r=eN(n),i=ev();E(()=>{let r=[];for(let s of["send","attachmentAdd"]){let o=n.unstable_on(s,()=>{i(`composer.${s}`,{threadId:e.current,...t&&{messageId:t.current}})});r.push(o)}return()=>{for(let e of r)e()}},[n,i,e,t]);let s=eM(()=>r.attachments.map((e,t)=>P(e.id,eD({runtime:n,index:t}))),[r.attachments,n]),o=k(()=>({text:r.text,role:r.role,attachments:s.state,runConfig:r.runConfig,isEditing:r.isEditing,canCancel:r.canCancel,attachmentAccept:r.attachmentAccept,isEmpty:r.isEmpty,type:r.type??"thread",dictation:r.dictation,quote:r.quote}),[r,s.state]);return{getState:()=>o,setText:n.setText,setRole:n.setRole,setRunConfig:n.setRunConfig,addAttachment:n.addAttachment,reset:n.reset,clearAttachments:n.clearAttachments,send:n.send,cancel:n.cancel,beginEdit:n.beginEdit??(()=>{throw Error("beginEdit is not supported in this runtime")}),startDictation:n.startDictation,stopDictation:n.stopDictation,setQuote:n.setQuote,attachment:e=>"id"in e?s.get({key:e.id}):s.get(e),__internal_getRuntime:()=>n}}),eL=b(({runtime:e})=>{let t=eN(e);return{getState:()=>t,addToolResult:t=>e.addToolResult(t),resumeToolCall:t=>e.resumeToolCall(t),__internal_getRuntime:()=>e}}),eB=b(({runtime:e,index:t})=>O(eP({runtime:k(()=>e.getAttachmentByIndex(t),[e,t])}))),ez=b(({runtime:e,index:t})=>O(eL({runtime:k(()=>e.getMessagePartByIndex(t),[e,t])}))),eU=b(({runtime:e,threadIdRef:t})=>{let n=eN(e),[r,i]=j(!1),[s,o]=j(!1),a=k(()=>({get current(){return e.getState().id}}),[e]),l=O(ee(eF({runtime:e.composer,threadIdRef:t,messageIdRef:a}))),u=eM(()=>n.content.map((t,n)=>P("toolCallId"in t&&null!=t.toolCallId?`toolCallId-${t.toolCallId}`:`index-${n}`,ez({runtime:e,index:n}))),[n.content,e]),c=eM(()=>(n.attachments??[]).map((t,n)=>P(t.id,eB({runtime:e,index:n}))),[n.attachments,e]),d=k(()=>({...n,parts:u.state,composer:l.state,isCopied:r,isHovering:s}),[n,u.state,l.state,r,s]);return{getState:()=>d,composer:()=>l.methods,reload:t=>e.reload(t),speak:()=>e.speak(),stopSpeaking:()=>e.stopSpeaking(),submitFeedback:t=>e.submitFeedback(t),switchToBranch:t=>e.switchToBranch(t),getCopyText:()=>e.unstable_getCopyText(),part:e=>"index"in e?u.get({index:e.index}):u.get({key:`toolCallId-${e.toolCallId}`}),attachment:e=>"id"in e?c.get({key:e.id}):c.get(e),setIsCopied:i,setIsHovering:o,__internal_getRuntime:()=>e}}),eq=b(({runtime:e,id:t,threadIdRef:n})=>O(eU({runtime:k(()=>e.getMessageById(t),[e,t]),threadIdRef:n}))),e$=b(({runtime:e})=>{let t=eN(e),n=ev();E(()=>{let t=[];for(let r of["runStart","runEnd","initialize","modelContextUpdate"]){let i=e.unstable_on(r,()=>{n(`thread.${r}`,{threadId:e.getState()?.threadId||"unknown"})});t.push(i)}return()=>{for(let e of t)e()}},[e,n]);let r=k(()=>({get current(){return e.getState().threadId}}),[e]),i=O(ee(eF({runtime:e.composer,threadIdRef:r}))),s=eM(()=>t.messages.map(t=>P(t.id,eq({runtime:e,id:t.id,threadIdRef:r}))),[t.messages,e,r]),o=k(()=>({isEmpty:0===s.state.length&&!t.isLoading,isDisabled:t.isDisabled,isLoading:t.isLoading,isRunning:t.isRunning,capabilities:t.capabilities,state:t.state,suggestions:t.suggestions,extras:t.extras,speech:t.speech,composer:i.state,messages:s.state}),[t,s,i.state]);return{getState:()=>o,composer:()=>i.methods,append:e.append,startRun:e.startRun,resumeRun:e.resumeRun,unstable_resumeRun:e.resumeRun,cancelRun:e.cancelRun,getModelContext:e.getModelContext,export:e.export,import:e.import,reset:e.reset,stopSpeaking:e.stopSpeaking,startVoice:async()=>{throw Error("startVoice is not supported in this runtime")},stopVoice:async()=>{throw Error("stopVoice is not supported in this runtime")},message:e=>"id"in e?s.get({key:e.id}):s.get(e),__internal_getRuntime:()=>e}}),eH=b(({runtime:e,id:t})=>O(eO({runtime:k(()=>e.getItemById(t),[e,t])}))),eV=b(({runtime:e,__internal_assistantRuntime:t})=>{let n=eN(e),r=O(ee(e$({runtime:e.main}))),i=eM(()=>Object.keys(n.threadItems).map(t=>P(t,eH({runtime:e,id:t}))),[n.threadItems,e]),s=k(()=>({mainThreadId:n.mainThreadId,newThreadId:n.newThreadId??null,isLoading:n.isLoading,threadIds:n.threadIds,archivedThreadIds:n.archivedThreadIds,threadItems:i.state,main:r.state}),[n,i.state,r.state]);return{getState:()=>s,thread:()=>r.methods,item:e=>{if("main"===e)return i.get({key:s.mainThreadId});if("id"in e)return i.get({key:e.id});let{index:t,archived:n=!1}=e,r=n?s.archivedThreadIds[t]:s.threadIds[t];return i.get({key:r})},switchToThread:async t=>{await e.switchToThread(t)},switchToNewThread:async()=>{await e.switchToNewThread()},__internal_getAssistantRuntime:()=>t}});class eQ{_providers=new Set;getModelContext(){return Array.from(this._providers).map(e=>e.getModelContext()).sort((e,t)=>(t.priority??0)-(e.priority??0)).reduce((e,t)=>{if(t.system&&(e.system?e.system+=`
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,87538,e=>{"use strict";let t=(0,e.i(3645).default)("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);e.s(["Maximize2",()=>t],87538)},7319,91379,28038,42888,38782,32527,12504,61163,88992,8624,38048,50147,51996,40165,21470,17367,e=>{"use strict";var t=e.i(44172),n=e.i(20314),r=e.i(79054);function i(e){let t=[];for(let n of e.effectTasks)try{n()}catch(e){t.push(e)}if(t.length>0)if(1===t.length)throw t[0];else{for(let e of t)console.error(e);throw AggregateError(t,"Errors during commit")}}function s(e){let t=[];for(let n of e.cells)if(n?.type==="effect"&&(n.deps=null,n.cleanup))try{n.cleanup?.()}catch(e){t.push(e)}finally{n.cleanup=void 0}if(t.length>0)if(1===t.length)throw t[0];else{for(let e of t)console.error(e);throw AggregateError(t,"Errors during cleanup")}}let o=void 0!==t.default&&!1,a=null;function l(){if(!a)throw Error("No resource fiber available");return a}let u=Symbol("fnSymbol");function c(e,t,n,r=function(e){return o?a?.devStrictMode?a.isFirstRender?"child":"root":e?"root":null:null}(!1)){return{type:e,root:t,markDirty:n,devStrictMode:r,cells:[],currentIndex:0,renderContext:void 0,isFirstRender:!0,isMounted:!1,isNeverMounted:!0}}function d(e){if(!e.isMounted)throw Error("Tried to unmount a fiber that is already unmounted");e.isMounted=!1,s(e)}function h(e,t){let n={effectTasks:[],props:t,output:void 0};e.currentIndex=0;let r=a;a=e;try{if((()=>{e.renderContext=n;try{n.output=function(e,t){let n=e[u];if(!n)throw Error("ResourceElement.type is not a valid Resource");return n(t)}(e.type,t)}finally{e.renderContext=void 0}})(),e.isFirstRender=!1,e.cells.length!==e.currentIndex)throw Error(`Rendered ${e.currentIndex} hooks but expected ${e.cells.length}. Hooks must be called in the exact same order in every render.`)}finally{a=r}return n}function p(e,t){e.isMounted=!0,o&&e.isNeverMounted&&"root"===e.devStrictMode&&(e.isNeverMounted=!1,i(t),s(e)),e.isNeverMounted=!1,i(t)}let f=e=>({version:0,committedVersion:0,dispatchUpdate:e,changelog:[],dirtyCells:[]}),m=e=>{for(let t of e.dirtyCells)t.dirty=!1,t.queue.clear(),t.current=t.workInProgress;e.committedVersion=e.version,e.changelog.length=0,e.dirtyCells.length=0},g=(e,t)=>{let n=e.version>t;if(e.version=t,n){for(let t of e.dirtyCells)t.dirty=!1,t.queue.clear(),t.workInProgress=t.current;if(e.dirtyCells.length=0,t===e.committedVersion)e.changelog.length=0;else{if(e.committedVersion>t)throw Error("Version is less than committed version");for(;e.committedVersion+e.changelog.length>t;)e.changelog.pop();e.changelog.forEach(e=>e()),m(e)}}},x=(e,t)=>{t.dirty||(t.dirty=!0,e.markDirty?.(),e.root.dirtyCells.push(t))};function y(e){let t=e=>({type:t,props:e});return t[u]=e,t}e.s(["resource",()=>y],91379);let b=(e,t)=>{let n=l(),r=n.currentIndex++;if(!n.isFirstRender&&r>=n.cells.length)throw Error("Rendered more hooks than during the previous render. Hooks must be called in the exact same order in every render.");let i=n.cells[r];if(i||(i=t(),n.cells[r]=i),i.type!==e)throw Error("Hook order changed between renders");return i};function v(e,t,n,r){let i=b("reducer",()=>{let t=l(),s=r?r(n):n;return o&&t.devStrictMode&&r&&r(n),{type:"reducer",queue:new Set,dirty:!1,workInProgress:s,current:s,reducer:e,dispatch:n=>{let r={action:n,hasEagerState:!1,eagerState:void 0};if(t.renderContext)throw Error("Resource updated during render");if(t.isNeverMounted)throw Error("Resource updated before mount");t.root.dispatchUpdate(()=>{let s=0===t.root.dirtyCells.length&&!r.hasEagerState&&(r.eagerState=e(i.workInProgress,n),r.hasEagerState=!0,Object.is(i.current,r.eagerState))?null:()=>{x(t,i),i.queue.add(r)};return!!s&&(s(),t.root.changelog.push(s),!0)})}}}),s=l(),a=e===i.reducer;for(let t of(i.reducer=e,i.queue))t.hasEagerState&&a||(t.eagerState=e(i.workInProgress,t.action),t.hasEagerState=!0),o&&s.devStrictMode&&e(i.workInProgress,t.action),i.workInProgress=t.eagerState;if(i.queue.clear(),t){let e=t(i.workInProgress);Object.is(e,i.workInProgress)||(x(s,i),i.workInProgress=e)}return[i.workInProgress,i.dispatch]}let k=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0},w=()=>{throw Error("Memo reducer should not be called")},S=(e,t)=>{let n=l(),[r]=v(w,r=>{if(r&&k(r.deps,t))return r;let i=e();return o&&n.devStrictMode&&e(),{value:i,deps:t}},null,void 0);return r.value};e.s(["tapMemo",0,S],28038);let _=()=>({type:"effect",cleanup:void 0,deps:null});function E(e,t){let n=b("effect",_);if(!(t&&n.deps&&k(n.deps,t))){if(null!==n.deps&&!!t!=!!n.deps)throw Error("tapEffect called with and without dependencies across re-renders");l().renderContext.effectTasks.push(()=>{let r=[];try{n.cleanup?.()}catch(e){r.push(e)}finally{n.cleanup=void 0}try{let t=e();if(void 0!==t&&"function"!=typeof t)throw Error(`An effect function must either return a cleanup function or nothing. Received: ${typeof t}`);n.cleanup=t}catch(e){r.push(e)}if(n.deps=t,r.length>0)if(1===r.length)throw r[0];else{for(let e of r)console.error(e);throw AggregateError(r,"Errors during commit")}})}}let C=(e,t)=>S(()=>e,t),T=(e,t)=>"function"==typeof t?t(e):t,j=e=>"function"==typeof e?e():e;function I(e){return v(T,void 0,e,j)}function A(e,t){let[n]=I(e);return n}function R(e){let[t]=I(()=>({current:e}));return t}function M(e,t){let n=R(0),r=n.current,i=A(l,[]),s=A(()=>()=>{n.current++,i.markDirty?.()},[]),o=A(()=>new Map,[]),a=t?C(e,t):e,u=S(()=>{let e=a(),t=new Set,n=[],r=0;for(let a=0;a<e.length;a++){let l=e[a],u=l.key;if(void 0===u)throw Error(`tapResources did not provide a key for array at index ${a}`);if(t.has(u))throw Error(`Duplicate key ${u} in tapResources`);t.add(u);let d=o.get(u);if(d)if(d.fiber.type!==l.type){let e=c(l.type,i.root,s),t=h(e,l.props);d.next=[e,t],n.push(t.output)}else d.next=h(d.fiber,l.props),n.push(d.next.output);else{let e=c(l.type,i.root,s),t=h(e,l.props);d={fiber:e,next:t},r++,o.set(u,d),n.push(t.output)}}if(o.size>n.length-r)for(let e of o.keys())t.has(e)||(o.get(e).next="delete");return n},[a,r]);return E(()=>()=>{for(let e of o.keys())d(o.get(e).fiber)},[]),E(()=>{for(let[e,t]of o.entries())"delete"===t.next?(t.fiber.isMounted&&d(t.fiber),o.delete(e)):Array.isArray(t.next)?(d(t.fiber),t.fiber=t.next[0],p(t.fiber,t.next[1])):p(t.fiber,t.next)},[u]),u}function N(e){let t=R(e);if(E(()=>{t.current=e}),o){let e=l();return C((...n)=>{if(e.renderContext)throw Error("tapEffectEvent cannot be called during render");return t.current(...n)},[e])}return t.current}function P(e,t){let n=l(),r=R(0),i=S(()=>(e.key,c(e.type,n.root,()=>{r.current++,n.markDirty?.()})),[e.type,e.key,n]),s=t?S(()=>h(i,e.props),[i,...t,r.current]):h(i,e.props);return E(()=>()=>d(i),[i]),E(()=>{p(i,s)},[i,s]),s.output}function D(e,t){return{...t,key:e}}e.s(["tapState",()=>I],42888);let O={schedulers:new Set([]),isScheduled:!1};class B{_task;_isDirty=!1;constructor(e){this._task=e}get isDirty(){return this._isDirty}markDirty(){this._isDirty=!0,O.schedulers.add(this),L()}runTask(){this._isDirty=!1,this._task()}}let L=()=>{O.isScheduled||(O.isScheduled=!0,z())},F=()=>{try{let e=[],t=0;for(let n of O.schedulers)if(O.schedulers.delete(n),n.isDirty){if(++t>50)throw Error("Maximum update depth exceeded. This can happen when a resource repeatedly calls setState inside tapEffect.");try{n.runTask()}catch(t){e.push(t)}}if(e.length>0)if(1===e.length)throw e[0];else{for(let t of e)console.error(t);throw AggregateError(e,"Errors occurred during flushSync")}}finally{O.schedulers.clear(),O.isScheduled=!1}},z=(()=>{if("u">typeof MessageChannel){let e=new MessageChannel;return e.port1.onmessage=F,()=>e.port2.postMessage(null)}return()=>setTimeout(F,0)})();e.s(["UpdateScheduler",()=>B,"flushResourcesSync",0,e=>{let t=O;O={schedulers:new Set([]),isScheduled:!0};try{let t=e();return F(),t}finally{O=t}}],38782);let U=Symbol("tap.Context"),$=e=>({[U]:e}),q=(e,t,n)=>{let r=e[U];e[U]=t;try{return n()}finally{e[U]=r}},H=e=>e[U],V=Symbol("assistant-ui.store.clientIndex"),W=$([]),K=new Set(["$$typeof","nodeType","then"]),J=(e,t)=>e===Symbol.toStringTag?t:"symbol"==typeof e?void 0:"toJSON"===e?()=>t:!!K.has(e)&&void 0;class Q{getOwnPropertyDescriptor(e,t){let n=this.get(e,t);if(void 0!==n)return{value:n,writable:!1,enumerable:!0,configurable:!1}}set(){return!1}setPrototypeOf(){return!1}defineProperty(){return!1}deleteProperty(){return!1}preventExtensions(){return!1}}let G=e=>{let t=y(e);return e=>{let n=t(e);return void 0===e.key?n:D(e.key,n)}},Y=Symbol("assistant-ui.store.getValue"),X=new Map;class Z extends Q{outputRef;index;boundFns;cachedReceiver;constructor(e,t){super(),this.outputRef=e,this.index=t}get(e,t,n){if(t===Y)return this.outputRef.current;if(t===V)return this.index;let r=J(t,"ClientProxy");if(!1!==r)return r;let i=this.outputRef.current[t];if("function"==typeof i){this.cachedReceiver!==n&&(this.boundFns=new Map,this.cachedReceiver=n);let e=this.boundFns.get(t);if(!e){let r;e=(!(r=X.get(t))&&(r=function(...e){if(!this||"object"!=typeof this)throw Error(`Method "${String(t)}" called without proper context. This may indicate the function was called incorrectly.`);let n=this[Y];if(!n)throw Error(`Method "${String(t)}" called on invalid client proxy. Ensure you are calling this method on a valid client instance.`);let r=n[t];if(!r)throw Error(`Method "${String(t)}" is not implemented.`);if("function"!=typeof r)throw Error(`"${String(t)}" is not a function.`);return r(...e)},X.set(t,r)),r).bind(n),this.boundFns.set(t,e)}return e}return i}ownKeys(){return Object.keys(this.outputRef.current)}has(e,t){return t===Y||t===V||t in this.outputRef.current}}let ee=G(e=>{var t;let n,r=R(null),i=H(W).length,s=S(()=>new Proxy({},new Z(r,i)),[i]),o=(t=()=>P(e),n=H(W),q(W,S(()=>[...n,s],[n,s]),t));return r.current||(r.current=o),E(()=>{r.current=o}),{methods:s,state:o.getState?.(),key:e.key}}),et=Symbol("assistant-ui.store.proxiedAssistantState"),en=e=>"on"===e||"subscribe"===e||"symbol"==typeof e,er=e=>new Proxy({},new class extends Q{get(t,n){let r=J(n,"AssistantState");if(!1!==r)return r;if(!en(n)){let t=e[n]()[Y];if(!t)throw Error("Client scope contains a non-client resource. Ensure your Derived get() returns a client created with tapClientResource(), not a plain resource.");return t.getState?.()}}ownKeys(){return Object.keys(e).filter(e=>!en(e))}has(t,n){return!en(n)&&n in e}});e.s(["PROXIED_ASSISTANT_STATE_SYMBOL",0,et,"createProxiedAssistantState",0,er,"getProxiedAssistantState",0,e=>e[et]],32527);let ei=()=>()=>{},es=e=>{let t=()=>{throw Error(e)};return t.source=null,t.query=null,t},eo=new Proxy({},new class extends Q{get(e,t){if("subscribe"===t||"on"===t)return ei;if(t===et)return ea;let n=J(t,"DefaultAssistantClient");return!1!==n?n:es("You are using a component or hook that requires an AuiProvider. Wrap your component in an <AuiProvider> component.")}ownKeys(){return["subscribe","on",et]}has(e,t){return"subscribe"===t||"on"===t||t===et}}),ea=er(eo),el=()=>new Proxy({},{get(e,t){let n=J(t,"AssistantClient");return!1!==n?n:es(`The current scope does not have a "${String(t)}" property.`)}}),eu=(0,r.createContext)(eo),ec=()=>(0,r.useContext)(eu),ed=({value:e,children:t})=>(0,n.jsx)(eu.Provider,{value:e,children:t});e.s(["AuiProvider",0,ed,"DefaultAssistantClient",0,eo,"createRootAssistantClient",0,el,"useAssistantContextValue",0,ec],12504);let eh=y(e=>null);e.s(["Derived",0,eh],61163);let ep=Symbol("assistant-ui.transform-scopes");function ef(e,t){if(e[ep])throw Error("transformScopes is already attached to this resource");e[ep]=t}let em=e=>S(()=>e,[...Object.entries(e).flat()]),eg=e=>"string"==typeof e?{scope:e.split(".")[0],event:e}:{scope:e.scope,event:e.event};e.s(["normalizeEventSelector",0,eg],88992);let ex=y(()=>A(()=>{let e=new Map,t=new Set,n=new Set;return{on(n,r){if("*"===n)return t.add(r),()=>t.delete(r);let i=e.get(n);return i||(i=new Set,e.set(n,i)),i.add(r),()=>{i.delete(r),0===i.size&&e.delete(n)}},emit(n,r,i){let s=e.get(n);(s||0!==t.size)&&queueMicrotask(()=>{let e=[];if(s)for(let t of s)try{t(r,i)}catch(t){e.push(t)}if(t.size>0){let s={event:n,payload:r};for(let n of t)try{n(s,i)}catch(t){e.push(t)}}if(e.length>0)if(1===e.length)throw e[0];else{for(let t of e)console.error(t);throw AggregateError(e,"Errors occurred during event emission")}})},subscribe:e=>(n.add(e),()=>n.delete(e)),notifySubscribers(){for(let e of n)try{e()}catch(e){console.error("NotificationManager: subscriber callback error",e)}}}},[])),ey=$(null),eb=()=>{let e=H(ey);if(!e)throw Error("AssistantTapContext is not available");return e},ev=()=>{let{emit:e}=eb(),t=H(W);return N((n,r)=>{e(n,r,t)})},ek=e=>S(()=>e,e),ew=y(({element:e,emit:t,clientRef:n})=>{let{methods:r,state:i}=q(ey,{clientRef:n,emit:t},()=>P(ee(e)));return S(()=>({state:i,methods:r}),[r,i])}),eS=y(({element:e,notifications:t,clientRef:n,name:r})=>{var i;let s,a,l,u,x,y,b,v,k,w=(i=ew({element:e,emit:t.emit,clientRef:n}),s=A(()=>new B(()=>k(null)),[]),a=A(()=>[],[]),g((l=S(()=>(i.key,c(i.type,f(e=>{(s.isDirty||e())&&(a.push(e),s.markDirty())}))),[i.type,i.key])).root,l.root.committedVersion),u=h(l,i.props),x=R(!1),y=R(i.props),b=R(u.output),v=A(()=>new Set,[]),k=N(e=>{if(null===e&&(g(l.root,2),g(l.root,1),a.forEach(e=>{o&&l.devStrictMode&&e(),e()}),o&&l.devStrictMode&&h(l,y.current),e=h(l,y.current)),s.isDirty)throw Error("Scheduler is dirty, this should never happen");m(l.root),a.length=0,x.current&&p(l,e),s.isDirty||b.current===e.output||(b.current=e.output,v.forEach(e=>e()))}),E(()=>(x.current=!0,()=>{x.current=!1,d(l)}),[l]),E(()=>{y.current=u.props,m(l.root),p(l,u),s.isDirty||b.current===u.output||(b.current=u.output,v.forEach(e=>e()))}),S(()=>({getValue:()=>b.current,subscribe:e=>(v.add(e),()=>v.delete(e))}),[]));return E(()=>w.subscribe(t.notifySubscribers),[w,t]),S(()=>{let e=()=>w.getValue().methods;return Object.defineProperties(e,{source:{value:"root",writable:!1},query:{value:{},writable:!1},name:{value:r,configurable:!0}}),e},[w,r])}),e_=y(()=>S(()=>({clients:[],subscribe:void 0,on:void 0}),[])),eE=y(({clients:e,clientRef:t})=>{let n=P(ex());E(()=>t.parent.subscribe(n.notifySubscribers),[t,n]);let r=ek(M(()=>Object.keys(e).map(r=>D(r,eS({element:e[r],notifications:n,clientRef:t,name:r}))),[e,n,t]));return S(()=>({clients:r,subscribe:n.subscribe,on:function(e,r){if(!this)throw Error("const { on } = useAui() is not supported. Use aui.on() instead.");let{scope:i,event:s}=eg(e);if("*"!==i&&null===this[i].source)throw Error(`Scope "${i}" is not available. Use { scope: "*", event: "${s}" } to listen globally.`);let o=n.on(s,(e,t)=>{if("*"===i)return void r(e);let n=this[i](),s=n[V];n===t[s]&&r(e)});if("*"!==i&&null===t.parent[i].source)return o;let a=t.parent.on(e,r);return()=>{o(),a()}}}),[r,n,t])}),eC=(e,t,n)=>{if("source"in e&&"query"in e)return e;if(n.dep===e)return n.meta;let r=e.getMeta(t.current);return n.meta=r,n.dep=e,r},eT=y(({element:e,clientRef:t,name:n})=>{let r=N(()=>e.props);return S(()=>{let e=()=>r().get(t.current),i={};return Object.defineProperties(e,{source:{get:()=>eC(r(),t,i).source},query:{get:()=>eC(r(),t,i).query},name:{value:n,configurable:!0}}),e},[t,n])}),ej=y(({clients:e,clientRef:t})=>ek(M(()=>Object.keys(e).map(n=>D(n,eT({element:e[n],clientRef:t,name:n}))),[e,t]))),eI=y(({parent:e,clients:t})=>{let{rootClients:n,derivedClients:r}=((e,t)=>{let{rootClients:n,derivedClients:r}=function(e,t){let n={...e},r=new Set,i=!0;for(;i;)for(let e of(i=!1,Object.values(n))){if(e.type===eh||r.has(e.type))continue;r.add(e.type);let s=e.type[ep];if(s){n=s(n,t),i=!0;break}}let s={},o={};for(let[e,t]of Object.entries(n))t.type===eh?o[e]=t:s[e]=t;return{rootClients:s,derivedClients:o}}(e,t);return{rootClients:em(n),derivedClients:em(r)}})(t,e),i=R({parent:e,current:null}).current;E(()=>{i.current=a});let s=P(Object.keys(n).length>0?eE({clients:n,clientRef:i}):e_()),o=P(ej({clients:r,clientRef:i})),a=S(()=>{let t=Object.create(e===eo?el():e);for(let n of(Object.assign(t,{subscribe:s.subscribe??e.subscribe,on:s.on??e.on,[et]:er(t)}),s.clients))t[n.name]=n;for(let e of o)t[e.name]=e;return t},[e,s,o]);return null===i.current&&(i.current=a),a});function eA(e,{parent:t}={parent:ec()}){if(e)return function(e){let t=(0,r.useMemo)(()=>f(e=>i(e)),[]),[n,i]=(0,r.useReducer)((e,n)=>(g(t,e),e+ +!!n()),0);g(t,n);let s=(()=>{if(!o)return null;let e=(0,r.useRef)(0),t=0===e.current;return((0,r.useState)(()=>e.current++),2!==e.current)?null:t?"child":"root"})(),a=(0,r.useMemo)(()=>(e.key,c(e.type,t,void 0,s)),[e.type,e.key,t,s]),l=h(a,e.props);return(0,r.useLayoutEffect)(()=>()=>d(a),[a]),(0,r.useLayoutEffect)(()=>{m(t),p(a,l)}),l.output}(eI({parent:t??eo,clients:e}));if(null===t)throw Error("received null parent, this usage is not allowed");return t}e.s(["useAui",()=>eA],8624);let eR=G(e=>{if(void 0===e.key)throw Error("tapClientResource: Element has no key");return P(ee(e))});function eM(e,t){let n=M(()=>e().map(e=>eR(e)),t),r=S(()=>Object.keys(n),[n]),i=S(()=>n.reduce((e,t,n)=>(e[t.key]=n,e),{}),[n]);return{state:S(()=>n.map(e=>e.state),[n]),get:e=>{if("index"in e){if(e.index<0||e.index>=r.length)throw Error(`tapClientLookup: Index ${e.index} out of bounds (length: ${r.length})`);return n[e.index].methods}let t=i[e.key];if(void 0===t)throw Error(`tapClientLookup: Key "${e.key}" not found`);return n[t].methods}}}let eN=e=>{let[,t]=I(e.getState);return E(()=>(t(e.getState()),e.subscribe(()=>{t(e.getState())})),[e]),e.getState()},eP=y(({runtime:e})=>{let t=eN(e),n=ev();return E(()=>{let t=[];for(let r of["switchedTo","switchedAway"]){let i=e.unstable_on(r,()=>{n(`threadListItem.${r}`,{threadId:e.getState().id})});t.push(i)}return()=>{for(let e of t)e()}},[e,n]),{getState:()=>t,switchTo:e.switchTo,rename:e.rename,archive:e.archive,unarchive:e.unarchive,delete:e.delete,generateTitle:e.generateTitle,initialize:e.initialize,detach:e.detach,__internal_getRuntime:()=>e}}),eD=y(({runtime:e})=>{let t=eN(e);return{getState:()=>t,remove:e.remove,__internal_getRuntime:()=>e}}),eO=y(({runtime:e,index:t})=>P(eD({runtime:S(()=>e.getAttachmentByIndex(t),[e,t])}))),eB=y(({threadIdRef:e,messageIdRef:t,runtime:n})=>{let r=eN(n),i=ev();E(()=>{let r=[];for(let s of["send","attachmentAdd"]){let o=n.unstable_on(s,()=>{i(`composer.${s}`,{threadId:e.current,...t&&{messageId:t.current}})});r.push(o)}return()=>{for(let e of r)e()}},[n,i,e,t]);let s=eM(()=>r.attachments.map((e,t)=>D(e.id,eO({runtime:n,index:t}))),[r.attachments,n]),o=S(()=>({text:r.text,role:r.role,attachments:s.state,runConfig:r.runConfig,isEditing:r.isEditing,canCancel:r.canCancel,attachmentAccept:r.attachmentAccept,isEmpty:r.isEmpty,type:r.type??"thread",dictation:r.dictation,quote:r.quote}),[r,s.state]);return{getState:()=>o,setText:n.setText,setRole:n.setRole,setRunConfig:n.setRunConfig,addAttachment:n.addAttachment,reset:n.reset,clearAttachments:n.clearAttachments,send:n.send,cancel:n.cancel,beginEdit:n.beginEdit??(()=>{throw Error("beginEdit is not supported in this runtime")}),startDictation:n.startDictation,stopDictation:n.stopDictation,setQuote:n.setQuote,attachment:e=>"id"in e?s.get({key:e.id}):s.get(e),__internal_getRuntime:()=>n}}),eL=y(({runtime:e})=>{let t=eN(e);return{getState:()=>t,addToolResult:t=>e.addToolResult(t),resumeToolCall:t=>e.resumeToolCall(t),__internal_getRuntime:()=>e}}),eF=y(({runtime:e,index:t})=>P(eD({runtime:S(()=>e.getAttachmentByIndex(t),[e,t])}))),ez=y(({runtime:e,index:t})=>P(eL({runtime:S(()=>e.getMessagePartByIndex(t),[e,t])}))),eU=y(({runtime:e,threadIdRef:t})=>{let n=eN(e),[r,i]=I(!1),[s,o]=I(!1),a=S(()=>({get current(){return e.getState().id}}),[e]),l=P(ee(eB({runtime:e.composer,threadIdRef:t,messageIdRef:a}))),u=eM(()=>n.content.map((t,n)=>D("toolCallId"in t&&null!=t.toolCallId?`toolCallId-${t.toolCallId}`:`index-${n}`,ez({runtime:e,index:n}))),[n.content,e]),c=eM(()=>(n.attachments??[]).map((t,n)=>D(t.id,eF({runtime:e,index:n}))),[n.attachments,e]),d=S(()=>({...n,parts:u.state,composer:l.state,isCopied:r,isHovering:s}),[n,u.state,l.state,r,s]);return{getState:()=>d,composer:()=>l.methods,reload:t=>e.reload(t),speak:()=>e.speak(),stopSpeaking:()=>e.stopSpeaking(),submitFeedback:t=>e.submitFeedback(t),switchToBranch:t=>e.switchToBranch(t),getCopyText:()=>e.unstable_getCopyText(),part:e=>"index"in e?u.get({index:e.index}):u.get({key:`toolCallId-${e.toolCallId}`}),attachment:e=>"id"in e?c.get({key:e.id}):c.get(e),setIsCopied:i,setIsHovering:o,__internal_getRuntime:()=>e}}),e$=y(({runtime:e,id:t,threadIdRef:n})=>P(eU({runtime:S(()=>e.getMessageById(t),[e,t]),threadIdRef:n}))),eq=y(({runtime:e})=>{let t=eN(e),n=ev();E(()=>{let t=[];for(let r of["runStart","runEnd","initialize","modelContextUpdate"]){let i=e.unstable_on(r,()=>{n(`thread.${r}`,{threadId:e.getState()?.threadId||"unknown"})});t.push(i)}return()=>{for(let e of t)e()}},[e,n]);let r=S(()=>({get current(){return e.getState().threadId}}),[e]),i=P(ee(eB({runtime:e.composer,threadIdRef:r}))),s=eM(()=>t.messages.map(t=>D(t.id,e$({runtime:e,id:t.id,threadIdRef:r}))),[t.messages,e,r]),o=S(()=>({isEmpty:0===s.state.length&&!t.isLoading,isDisabled:t.isDisabled,isLoading:t.isLoading,isRunning:t.isRunning,capabilities:t.capabilities,state:t.state,suggestions:t.suggestions,extras:t.extras,speech:t.speech,composer:i.state,messages:s.state}),[t,s,i.state]);return{getState:()=>o,composer:()=>i.methods,append:e.append,startRun:e.startRun,resumeRun:e.resumeRun,unstable_resumeRun:e.resumeRun,cancelRun:e.cancelRun,getModelContext:e.getModelContext,export:e.export,import:e.import,reset:e.reset,stopSpeaking:e.stopSpeaking,startVoice:async()=>{throw Error("startVoice is not supported in this runtime")},stopVoice:async()=>{throw Error("stopVoice is not supported in this runtime")},message:e=>"id"in e?s.get({key:e.id}):s.get(e),__internal_getRuntime:()=>e}}),eH=y(({runtime:e,id:t})=>P(eP({runtime:S(()=>e.getItemById(t),[e,t])}))),eV=y(({runtime:e,__internal_assistantRuntime:t})=>{let n=eN(e),r=P(ee(eq({runtime:e.main}))),i=eM(()=>Object.keys(n.threadItems).map(t=>D(t,eH({runtime:e,id:t}))),[n.threadItems,e]),s=S(()=>({mainThreadId:n.mainThreadId,newThreadId:n.newThreadId??null,isLoading:n.isLoading,threadIds:n.threadIds,archivedThreadIds:n.archivedThreadIds,threadItems:i.state,main:r.state}),[n,i.state,r.state]);return{getState:()=>s,thread:()=>r.methods,item:e=>{if("main"===e)return i.get({key:s.mainThreadId});if("id"in e)return i.get({key:e.id});let{index:t,archived:n=!1}=e,r=n?s.archivedThreadIds[t]:s.threadIds[t];return i.get({key:r})},switchToThread:async t=>{await e.switchToThread(t)},switchToNewThread:async()=>{await e.switchToNewThread()},__internal_getAssistantRuntime:()=>t}});class eW{_providers=new Set;getModelContext(){return Array.from(this._providers).map(e=>e.getModelContext()).sort((e,t)=>(t.priority??0)-(e.priority??0)).reduce((e,t)=>{if(t.system&&(e.system?e.system+=`
2
2
 
3
- ${t.system}`:e.system=t.system),t.tools)for(let[n,r]of Object.entries(t.tools)){let t=e.tools?.[n];if(t&&t!==r)throw Error(`You tried to define a tool with the name ${n}, but it already exists.`);e.tools||(e.tools={}),e.tools[n]=r}return t.config&&(e.config={...e.config,...t.config}),t.callSettings&&(e.callSettings={...e.callSettings,...t.callSettings}),e},{})}registerModelContextProvider(e){this._providers.add(e);let t=e.subscribe?.(()=>{this.notifySubscribers()});return this.notifySubscribers(),()=>{this._providers.delete(e),t?.(),this.notifySubscribers()}}_subscribers=new Set;notifySubscribers(){for(let e of this._subscribers)e()}subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}}e.s(["CompositeContextProvider",()=>eQ],38048);let eW=b(()=>{let[e]=j(()=>({version:2})),t=k(()=>new eQ,[]);return{getState:()=>e,getModelContext:()=>t.getModelContext(),subscribe:e=>t.subscribe(e),register:e=>t.registerModelContextProvider(e)}}),eK=b(e=>({getState:()=>e})),eG=b(e=>{let[t]=j(()=>({suggestions:(e??[]).map(e=>"string"==typeof e?{title:e,label:"",prompt:e}:{title:e.title,label:e.label,prompt:e.prompt})})),n=eM(()=>t.suggestions.map((e,t)=>P(t,eK(e))),[t.suggestions]);return{getState:()=>t,suggestion:({index:e})=>n.get({index:e})}}),eJ=b(e=>{let t=ex().clientRef;return E(()=>e.registerModelContextProvider(t.current.modelContext()),[e,t]),O(eV({runtime:e.threads,__internal_assistantRuntime:e}))}),eY=b(()=>{let[e,t]=j(()=>({renderers:{}}));return{getState:()=>e,setDataUI:C((e,n)=>(t(t=>({...t,renderers:{...t.renderers,[e]:[...t.renderers[e]??[],n]}})),()=>{t(t=>({...t,renderers:{...t.renderers,[e]:t.renderers[e]?.filter(e=>e!==n)??[]}}))}),[])}}),eX=b(({toolkit:e})=>{let[t,n]=j(()=>({tools:{}})),r=ex().clientRef,i=C((e,t)=>(n(n=>({...n,tools:{...n.tools,[e]:[...n.tools[e]??[],t]}})),()=>{n(n=>({...n,tools:{...n.tools,[e]:n.tools[e]?.filter(e=>e!==t)??[]}}))}),[]);return E(()=>{if(!e)return;let t=[];for(let[n,r]of Object.entries(e))r.render&&t.push(i(n,r.render));let n=Object.entries(e).reduce((e,[t,n])=>{let{render:r,...i}=n;return e[t]=i,e},{});return t.push(r.current.modelContext().register({getModelContext:()=>({tools:n})})),()=>{t.forEach(e=>e())}},[e,i,r]),{getState:()=>t,setToolUI:i}});ef(eX,(e,t)=>({...e,...e.modelContext||null!==t.modelContext.source?{}:{modelContext:eW()}}));let eZ=b(e=>O(eJ(e)));ef(eZ,(e,t)=>{let n,r=((n={...e,thread:e.thread??eh({source:"threads",query:{type:"main"},get:e=>e.threads().thread("main")}),threadListItem:e.threadListItem??eh({source:"threads",query:{type:"main"},get:e=>e.threads().item("main")}),composer:e.composer??eh({source:"thread",query:{},get:e=>e.threads().thread("main").composer()})}).modelContext||null!==t.modelContext.source||(n.modelContext=eW()),n.suggestions||null!==t.suggestions.source||(n.suggestions=eG()),n);return r.tools||null!==t.tools.source||(r.tools=eX({})),r.dataRenderers||null!==t.dataRenderers.source||(r.dataRenderers=eY()),r});let e0=(0,r.memo)(({runtime:e,aui:t=null,children:r})=>{let i=eA({threads:eZ(e)},{parent:t}),s=e._core?.RenderComponent;return(0,n.jsxs)(ed,{value:i,children:[s&&(0,n.jsx)(s,{}),r]})}),e1=e=>{let t,n=new Set,r=(e,r)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=r?r:"object"!=typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,s={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,s);return s},e2=e=>{let t=e?e1(e):e1,n=e=>(function(e,t=e=>e){let n=r.default.useSyncExternalStore(e.subscribe,r.default.useCallback(()=>t(e.getState()),[e,t]),r.default.useCallback(()=>t(e.getInitialState()),[e,t]));return r.default.useDebugValue(n),n})(t,e);return Object.assign(n,t),n},e5=e=>e?e2(e):e2;e.s(["create",()=>e5],50147);let e3=e=>{let t=new Map,n=()=>{let n=0;for(let e of t.values())n+=e;e(n)};return{register:()=>{let e=Symbol();return t.set(e,0),{setHeight:r=>{t.get(e)!==r&&(t.set(e,r),n())},unregister:()=>{t.delete(e),n()}}}}};function e4(e,t){function n(n){let r=e(n);return r?r[t]:null}return{[t]:function(e){let t,r=!1;"function"==typeof e?t=e:e&&"object"==typeof e&&(r=!!e.optional,t=e.selector);let i=n({optional:r});return i?t?i(t):i():null},[`${t}Store`]:n}}e.s(["createContextStoreHook",()=>e4],51996);let e6=(0,r.createContext)(null),{useThreadViewport:e8,useThreadViewportStore:e9}=e4(function(e){let t=(0,r.useContext)(e6);if(!e?.optional&&!t)throw Error("This component must be used within ThreadPrimitive.Viewport.");return t},"useThreadViewport");e.s(["ThreadViewportContext",0,e6,"useThreadViewport",0,e8,"useThreadViewportStore",0,e9],40165);let e7=e=>e;e.s(["writableStore",0,e7],21470);let te=({children:e,options:t={}})=>{let i=(e=>{let t=e9({optional:!0}),[n]=(0,r.useState)(()=>((e={})=>{let t=new Set,n=e3(e=>{s.setState({height:{...s.getState().height,viewport:e}})}),r=e3(e=>{s.setState({height:{...s.getState().height,inset:e}})}),i=e3(e=>{s.setState({height:{...s.getState().height,userMessage:e}})}),s=e5(()=>({isAtBottom:!0,scrollToBottom:({behavior:e="auto"}={})=>{for(let n of t)n({behavior:e})},onScrollToBottom:e=>(t.add(e),()=>{t.delete(e)}),turnAnchor:e.turnAnchor??"bottom",height:{viewport:0,inset:0,userMessage:0},registerViewport:n.register,registerContentInset:r.register,registerUserMessageHeight:i.register}));return s})(e));return(0,r.useEffect)(()=>t?.getState().onScrollToBottom(()=>{n.getState().scrollToBottom()}),[t,n]),(0,r.useEffect)(()=>{if(t)return n.subscribe(e=>{t.getState().isAtBottom!==e.isAtBottom&&e7(t).setState({isAtBottom:e.isAtBottom})})},[n,t]),(0,r.useEffect)(()=>{let t={turnAnchor:e.turnAnchor??"bottom"};n.getState().turnAnchor!==t.turnAnchor&&e7(n).setState(t)},[n,e.turnAnchor]),n})(t),[s]=(0,r.useState)(()=>({useThreadViewport:i}));return(0,n.jsx)(e6.Provider,{value:s,children:e})};e.s(["ThreadPrimitiveViewportProvider",0,te],17367);let tt=()=>{let e=eA();return(0,r.useEffect)(()=>{},[e]),null},tn=(0,r.memo)(({children:e,aui:t,runtime:r})=>(0,n.jsxs)(e0,{runtime:r,aui:t??null,children:[(0,n.jsx)(tt,{}),(0,n.jsx)(te,{children:e})]}));e.s(["AssistantRuntimeProvider",0,tn],7319)},18532,e=>{"use strict";let t=(0,e.i(3645).default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);e.s(["Cpu",()=>t],18532)},63045,17466,61302,94875,30854,e=>{"use strict";e.s([],56307),e.i(56307);var t,n,r=e.i(20314),i=e.i(79054);e.i(26036);var s=e.i(5978),o=Symbol.for("react.lazy"),a=i[" use ".trim().toString()];function l(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===o&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var u=Symbol("radix.slottable");function c(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===u}var d=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var n,o;let u,d,h,p=(o=n=`Primitive.${t}`,(u=i.forwardRef((e,t)=>{let{children:n,...r}=e;if(l(n)&&"function"==typeof a&&(n=a(n._payload)),i.isValidElement(n)){var o;let e,a,l=(o=n,(a=(e=Object.getOwnPropertyDescriptor(o.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.ref:(a=(e=Object.getOwnPropertyDescriptor(o,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.props.ref:o.props.ref||o.ref),u=function(e,t){let n={...t};for(let r in t){let i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...s}:"className"===r&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==i.Fragment&&(u.ref=t?(0,s.composeRefs)(t,l):l),i.cloneElement(n,u)}return i.Children.count(n)>1?i.Children.only(null):null})).displayName=`${o}.SlotClone`,d=u,(h=i.forwardRef((e,t)=>{let{children:n,...s}=e;l(n)&&"function"==typeof a&&(n=a(n._payload));let o=i.Children.toArray(n),u=o.find(c);if(u){let e=u.props.children,n=o.map(t=>t!==u?t:i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null);return(0,r.jsx)(d,{...s,ref:t,children:i.isValidElement(e)?i.cloneElement(e,void 0,n):null})}return(0,r.jsx)(d,{...s,ref:t,children:n})})).displayName=`${n}.Slot`,h),f=i.forwardRef((e,n)=>{let{asChild:i,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,r.jsx)(i?p:t,{...s,ref:n})});return f.displayName=`Primitive.${t}`,{...e,[t]:f}},{}),h=e.i(8624),p=e.i(32527);let f=e=>{let t=(0,h.useAui)(),n=(0,p.getProxiedAssistantState)(t),r=(0,i.useSyncExternalStore)(t.subscribe,()=>e(n),()=>e(n));if(r===n)throw Error("You tried to return the entire AssistantState. This is not supported due to technical limitations.");return(0,i.useDebugValue)(r),r};(t=n||(n={})).Hidden="hidden",t.Floating="floating",t.Normal="normal";let m=(0,i.createContext)(null),g=(0,i.forwardRef)(({hideWhenRunning:e,autohide:t,autohideFloat:s,...o},a)=>{let[l,u]=(0,i.useState)(0),c=(0,i.useCallback)(()=>{let e=!1;return u(e=>e+1),()=>{e||(e=!0,u(e=>Math.max(0,e-1)))}},[]),h=(0,i.useMemo)(()=>({acquireInteractionLock:c}),[c]),p=(({hideWhenRunning:e,autohide:t,autohideFloat:r,forceVisible:i})=>f(s=>{if(e&&s.thread.isRunning)return n.Hidden;let o="always"===t||"not-last"===t&&!s.message.isLast,a=i||s.message.isHovering;return o?a?"always"===r||"single-branch"===r&&s.message.branchCount<=1?n.Floating:n.Normal:n.Hidden:n.Normal}))({hideWhenRunning:e,autohide:t,autohideFloat:s,forceVisible:l>0});return p===n.Hidden?null:(0,r.jsx)(m.Provider,{value:h,children:(0,r.jsx)(d.div,{...p===n.Floating?{"data-floating":"true"}:null,...o,ref:a})})});g.displayName="ActionBarPrimitive.Root";var y=e.i(91967);let b=(0,i.forwardRef)(({copiedDuration:e,onClick:t,disabled:n,...s},o)=>{let a=f(e=>e.message.isCopied),l=(({copiedDuration:e=3e3}={})=>{let{copy:t,disabled:n}=(({copiedDuration:e=3e3,copyToClipboard:t}={})=>{let n=(0,h.useAui)(),r=f(e=>!(("assistant"!==e.message.role||e.message.status?.type!=="running")&&e.message.parts.some(e=>"text"===e.type&&e.text.length>0))),s=f(e=>e.message.isCopied),o=f(e=>e.composer.isEditing),a=f(e=>e.composer.text);return{copy:(0,i.useCallback)(()=>{let r=o?a:n.message().getCopyText();r&&Promise.resolve((t??(()=>{}))(r)).then(()=>{n.message().setIsCopied(!0),setTimeout(()=>n.message().setIsCopied(!1),e)})},[n,o,a,e,t]),disabled:r,isCopied:s}})({copiedDuration:e,copyToClipboard:e=>navigator.clipboard.writeText(e)});return n?null:t})({copiedDuration:e});return(0,r.jsx)(d.button,{type:"button",...a?{"data-copied":"true"}:{},...s,ref:o,disabled:n||!l,onClick:(0,y.composeEventHandlers)(t,()=>{l?.()})})});b.displayName="ActionBarPrimitive.Copy";let x=(e,t,n=[])=>{let s=(0,i.forwardRef)((e,i)=>{let s={},o={};Object.keys(e).forEach(t=>{n.includes(t)?s[t]=e[t]:o[t]=e[t]});let a=t(s)??void 0;return(0,r.jsx)(d.button,{...o,type:"button",ref:i,disabled:o.disabled||!a,onClick:(0,y.composeEventHandlers)(o.onClick,a)})});return s.displayName=e,s},v=x("ActionBarPrimitive.Reload",()=>{let e,t,{disabled:n,reload:r}=(e=(0,h.useAui)(),t=f(e=>e.thread.isRunning||e.thread.isDisabled||"assistant"!==e.message.role),{reload:(0,i.useCallback)(()=>{e.message().reload()},[e]),disabled:t});return n?null:r}),w=x("ActionBarPrimitive.Edit",()=>{let e,t,{disabled:n,edit:r}=(e=(0,h.useAui)(),t=f(e=>e.composer.isEditing),{edit:(0,i.useCallback)(()=>{e.composer().beginEdit()},[e]),disabled:t});return n?null:r}),S=x("ActionBarPrimitive.Speak",()=>{let e,t,{disabled:n,speak:r}=(e=(0,h.useAui)(),t=f(e=>!(("assistant"!==e.message.role||e.message.status?.type!=="running")&&e.message.parts.some(e=>"text"===e.type&&e.text.length>0))),{speak:(0,i.useCallback)(async()=>{e.message().speak()},[e]),disabled:t});return n?null:r});var k=e.i(67384);let _=(0,i.forwardRef)((e,t)=>{let n=(()=>{let e,t,{disabled:n,stopSpeaking:r}=(e=(0,h.useAui)(),t=f(e=>null==e.message.speech),{stopSpeaking:(0,i.useCallback)(()=>{e.message().stopSpeaking()},[e]),disabled:t});return n?null:r})();return(0,k.useEscapeKeydown)(e=>{n&&(e.preventDefault(),n())}),(0,r.jsx)(d.button,{type:"button",disabled:!n,...e,ref:t,onClick:(0,y.composeEventHandlers)(e.onClick,()=>{n?.()})})});_.displayName="ActionBarPrimitive.StopSpeaking";let E=(0,i.forwardRef)(({onClick:e,disabled:t,...n},s)=>{let o=f(e=>e.message.metadata.submittedFeedback?.type==="positive"),a=(()=>{let e,t,{submit:n}=(e=(0,h.useAui)(),t=f(e=>e.message.metadata.submittedFeedback?.type==="positive"),{submit:(0,i.useCallback)(()=>{e.message().submitFeedback({type:"positive"})},[e]),isSubmitted:t});return n})();return(0,r.jsx)(d.button,{type:"button",...o?{"data-submitted":"true"}:{},...n,ref:s,disabled:t||!a,onClick:(0,y.composeEventHandlers)(e,()=>{a?.()})})});E.displayName="ActionBarPrimitive.FeedbackPositive";let C=(0,i.forwardRef)(({onClick:e,disabled:t,...n},s)=>{let o=f(e=>e.message.metadata.submittedFeedback?.type==="negative"),a=(()=>{let e,t,{submit:n}=(e=(0,h.useAui)(),t=f(e=>e.message.metadata.submittedFeedback?.type==="negative"),{submit:(0,i.useCallback)(()=>{e.message().submitFeedback({type:"negative"})},[e]),isSubmitted:t});return n})();return(0,r.jsx)(d.button,{type:"button",...o?{"data-submitted":"true"}:{},...n,ref:s,disabled:t||!a,onClick:(0,y.composeEventHandlers)(e,()=>{a?.()})})});C.displayName="ActionBarPrimitive.FeedbackNegative";let T=(0,i.forwardRef)(({filename:e,onExport:t,onClick:n,disabled:s,...o},a)=>{let l=(({filename:e,onExport:t}={})=>{let n=(0,h.useAui)(),r=f(e=>("assistant"!==e.message.role||e.message.status?.type!=="running")&&e.message.parts.some(e=>"text"===e.type&&e.text.length>0)),s=(0,i.useCallback)(async()=>{let r=n.message().getCopyText();if(!r)return;if(t)return void await t(r);let i=new Blob([r],{type:"text/markdown"}),s=URL.createObjectURL(i),o=document.createElement("a");o.href=s,o.download=e??`message-${Date.now()}.md`,o.click(),URL.revokeObjectURL(s)},[n,e,t]);return r?s:null})({filename:e,onExport:t});return(0,r.jsx)(d.button,{type:"button",...o,ref:a,disabled:s||!l,onClick:(0,y.composeEventHandlers)(n,()=>{l?.()})})});T.displayName="ActionBarPrimitive.ExportMarkdown",e.s(["Copy",0,b,"Edit",0,w,"ExportMarkdown",0,T,"FeedbackNegative",0,C,"FeedbackPositive",0,E,"Reload",0,v,"Root",0,g,"Speak",0,S,"StopSpeaking",0,_],5294);var I=e.i(5294);e.s(["ActionBarPrimitive",0,I],63045),e.s([],9574),e.i(9574);let j=()=>{let e,t,{disabled:n,send:r}=(e=(0,h.useAui)(),t=f(e=>e.thread.isRunning||!e.composer.isEditing||e.composer.isEmpty),{send:(0,i.useCallback)(()=>{e.composer().send()},[e]),disabled:t});return n?null:r},A=x("ComposerPrimitive.Send",j),R=(0,i.forwardRef)(({onSubmit:e,...t},n)=>{let i=j();return(0,r.jsx)(d.form,{...t,ref:n,onSubmit:(0,y.composeEventHandlers)(e,e=>{e.preventDefault(),i&&i()})})});R.displayName="ComposerPrimitive.Root";var M=e.i(5240);function N(){return(N=Object.assign.bind()).apply(null,arguments)}var O=i.useLayoutEffect,P=function(e){var t=i.default.useRef(e);return O(function(){t.current=e}),t},D=function(e,t){"function"==typeof e?e(t):e.current=t},F=function(e,t){var n=i.default.useRef();return i.default.useCallback(function(r){e.current=r,n.current&&D(n.current,null),n.current=t,t&&D(t,r)},[t])},L={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},B=function(e){Object.keys(L).forEach(function(t){e.style.setProperty(t,L[t],"important")})},z=null,U=function(e,t){var n=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?n+t.borderSize:n-t.paddingSize},q=function(){},$=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],H=!!document.documentElement.currentStyle,V=function(e){var t=window.getComputedStyle(e);if(null===t)return null;var n=$.reduce(function(e,n){return e[n]=t[n],e},{}),r=n.boxSizing;if(""===r)return null;H&&"border-box"===r&&(n.width=parseFloat(n.width)+parseFloat(n.borderRightWidth)+parseFloat(n.borderLeftWidth)+parseFloat(n.paddingRight)+parseFloat(n.paddingLeft)+"px");var i=parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),s=parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth);return{sizingStyle:n,paddingSize:i,borderSize:s}};function Q(e,t,n){var r=P(n);i.useLayoutEffect(function(){var n=function(e){return r.current(e)};if(e)return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}},[])}var W=function(e,t){Q(document.body,"reset",function(n){e.current.form===n.target&&t(n)})},K=function(e){Q(window,"resize",e)},G=function(e){Q(document.fonts,"loadingdone",e)},J=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],Y=i.forwardRef(function(e,t){var n=e.cacheMeasurements,r=e.maxRows,s=e.minRows,o=e.onChange,a=void 0===o?q:o,l=e.onHeightChange,u=void 0===l?q:l,c=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,J),d=void 0!==c.value,h=i.useRef(null),p=F(h,t),f=i.useRef(0),m=i.useRef(),g=function(){var e=h.current,t=n&&m.current?m.current:V(e);if(t){m.current=t;var i,o,a,l,c,d,p,g,y,b,x,v=(i=e.value||e.placeholder||"x",void 0===(o=s)&&(o=1),void 0===(a=r)&&(a=1/0),z||((z=document.createElement("textarea")).setAttribute("tabindex","-1"),z.setAttribute("aria-hidden","true"),B(z)),null===z.parentNode&&document.body.appendChild(z),l=t.paddingSize,c=t.borderSize,p=(d=t.sizingStyle).boxSizing,Object.keys(d).forEach(function(e){z.style[e]=d[e]}),B(z),z.value=i,g=U(z,t),z.value=i,g=U(z,t),z.value="x",b=(y=z.scrollHeight-l)*o,"border-box"===p&&(b=b+l+c),g=Math.max(b,g),x=y*a,"border-box"===p&&(x=x+l+c),[g=Math.min(x,g),y]),w=v[0],S=v[1];f.current!==w&&(f.current=w,e.style.setProperty("height",w+"px","important"),u(w,{rowHeight:S}))}};return i.useLayoutEffect(g),W(h,function(){if(!d){var e=h.current.value;requestAnimationFrame(function(){var t=h.current;t&&e!==t.value&&g()})}}),K(g),G(g),i.createElement("textarea",N({},c,{onChange:function(e){d||g(),a(e)},ref:p}))}),X=e.i(29297),Z=e.i(40165);let ee=e=>{let t=(0,X.useCallbackRef)(e),n=(0,Z.useThreadViewport)(e=>e.onScrollToBottom);(0,i.useEffect)(()=>n(t),[n,t])};var et=e.i(38782);let en=(0,i.forwardRef)(({autoFocus:e=!1,asChild:t,disabled:n,onChange:o,onKeyDown:a,onPaste:l,submitOnEnter:u,submitMode:c,cancelOnEscape:d=!0,unstable_focusOnRunStart:p=!0,unstable_focusOnScrollToBottom:m=!0,unstable_focusOnThreadSwitched:g=!0,addAttachmentOnPaste:b=!0,...x},v)=>{let w=(0,h.useAui)(),S=c??(!1===u?"none":"enter"),_=f(e=>e.composer.isEditing?e.composer.text:""),E=t?M.Slot.Root:Y,C=f(e=>e.thread.isDisabled||e.composer.dictation?.inputDisabled)||n,T=(0,i.useRef)(null),I=(0,s.useComposedRefs)(v,T);(0,k.useEscapeKeydown)(e=>{if(!d||!T.current?.contains(e.target))return;let t=w.composer();t.getState().canCancel&&(t.cancel(),e.preventDefault())});let j=async e=>{if(!b)return;let t=w.thread().getState().capabilities,n=Array.from(e.clipboardData?.files||[]);if(t.attachments&&n.length>0)try{e.preventDefault(),await Promise.all(n.map(e=>w.composer().addAttachment(e)))}catch(e){console.error("Error adding attachment:",e)}},A=e&&!C,R=(0,i.useCallback)(()=>{let e=T.current;e&&A&&(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length))},[A]);return(0,i.useEffect)(()=>R(),[R]),ee(()=>{"thread"===w.composer().getState().type&&m&&R()}),(0,i.useEffect)(()=>{if("thread"===w.composer().getState().type&&p)return w.on("thread.runStart",R)},[p,R,w]),(0,i.useEffect)(()=>{if("thread"===w.composer().getState().type&&g)return w.on("threadListItem.switchedTo",R)},[g,R,w]),(0,r.jsx)(E,{name:"input",value:_,...x,ref:I,disabled:C,onChange:(0,y.composeEventHandlers)(o,e=>{w.composer().getState().isEditing&&(0,et.flushResourcesSync)(()=>{w.composer().setText(e.target.value)})}),onKeyDown:(0,y.composeEventHandlers)(a,e=>{if(!C&&!e.nativeEvent.isComposing&&"Enter"===e.key&&!e.shiftKey){if(w.thread().getState().isRunning)return;let t=!1;"ctrlEnter"===S?t=e.ctrlKey||e.metaKey:"enter"===S&&(t=!0),t&&(e.preventDefault(),T.current?.closest("form")?.requestSubmit())}}),onPaste:(0,y.composeEventHandlers)(l,j)})});en.displayName="ComposerPrimitive.Input";let er=x("ComposerPrimitive.Cancel",()=>{let e,t,{disabled:n,cancel:r}=(e=(0,h.useAui)(),t=f(e=>!e.composer.canCancel),{cancel:(0,i.useCallback)(()=>{e.composer().cancel()},[e]),disabled:t});return n?null:r}),ei=x("ComposerPrimitive.AddAttachment",({multiple:e=!0}={})=>{let t,n,{disabled:r,addAttachment:s}=(t=(0,h.useAui)(),n=f(e=>!e.composer.isEditing),{addAttachment:(0,i.useCallback)(e=>t.composer().addAttachment(e),[t]),disabled:n}),o=(0,h.useAui)(),a=(0,i.useCallback)(()=>{let t=document.createElement("input");t.type="file",t.multiple=e,t.hidden=!0;let n=o.composer().getState().attachmentAccept;"*"!==n&&(t.accept=n),document.body.appendChild(t),t.onchange=e=>{let n=e.target.files;if(n){for(let e of n)s(e);document.body.removeChild(t)}},t.oncancel=()=>{t.files&&0!==t.files.length||document.body.removeChild(t)},t.click()},[o,e,s]);return r?null:a},["multiple"]),es=Object.freeze({});function eo({getItemState:e,children:t}){let n,r;return ea(t((n=(0,h.useAui)(),r=(0,i.useRef)(void 0),f(()=>(void 0===r.current&&(r.current=e(n)),r.current)),()=>(r.current=void 0,e(n)))))}let ea=e=>{let t="object"==typeof e&&null!=e&&"type"in e?e:null,n=t?.type,r=t?.key,s="object"==typeof t?.props&&null!=t.props&&0===Object.entries(t.props).length?es:t?.props;return(0,i.useMemo)(()=>t,[n,r,s])??e};var el=e.i(12504),eu=e.i(61163);let ec=({index:e,children:t})=>{let n=(0,h.useAui)({attachment:(0,eu.Derived)({source:"message",query:{type:"index",index:e},get:t=>t.message().attachment({index:e})})});return(0,r.jsx)(el.AuiProvider,{value:n,children:t})},ed=({index:e,children:t})=>{let n=(0,h.useAui)({attachment:(0,eu.Derived)({source:"composer",query:{type:"index",index:e},get:t=>t.composer().attachment({index:e})})});return(0,r.jsx)(el.AuiProvider,{value:n,children:t})},eh=(e,t)=>{switch(t.type){case"image":return e?.Image??e?.Attachment;case"document":return e?.Document??e?.Attachment;case"file":return e?.File??e?.Attachment;default:return e?.Attachment}},ep=({components:e})=>{let t=f(e=>e.attachment);if(!t)return null;let n=eh(e,t);return n?(0,r.jsx)(n,{}):null},ef=(0,i.memo)(({index:e,components:t})=>(0,r.jsx)(ed,{index:e,children:(0,r.jsx)(ep,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Image===t.components?.Image&&e.components?.Document===t.components?.Document&&e.components?.File===t.components?.File&&e.components?.Attachment===t.components?.Attachment);ef.displayName="ComposerPrimitive.AttachmentByIndex";let em=({children:e})=>{let t=f(e=>e.composer.attachments.length);return(0,i.useMemo)(()=>Array.from({length:t},(t,n)=>(0,r.jsx)(ed,{index:n,children:(0,r.jsx)(eo,{getItemState:e=>e.composer().attachment({index:n}).getState(),children:t=>e({get attachment(){return t()}})})},n)),[t,e])},eg=({components:e,children:t})=>e?(0,r.jsx)(em,{children:({attachment:t})=>{let n=eh(e,t);return n?(0,r.jsx)(n,{}):null}}):(0,r.jsx)(em,{children:t});eg.displayName="ComposerPrimitive.Attachments";let ey=(0,i.forwardRef)(({disabled:e,asChild:t=!1,children:n,...s},o)=>{let[a,l]=(0,i.useState)(!1),u=(0,h.useAui)(),c=(0,i.useCallback)(t=>{e||(t.preventDefault(),l(!0))},[e]),d=(0,i.useCallback)(t=>{!e&&(t.preventDefault(),a||l(!0))},[e,a]),p=(0,i.useCallback)(t=>{if(e)return;t.preventDefault();let n=t.relatedTarget;n&&t.currentTarget.contains(n)||l(!1)},[e]),f=(0,i.useCallback)(async t=>{if(!e)for(let e of(t.preventDefault(),l(!1),t.dataTransfer.files))try{await u.composer().addAttachment(e)}catch(e){console.error("Failed to add attachment:",e)}},[e,u]),m=t?M.Slot.Root:"div";return(0,r.jsx)(m,{...a?{"data-dragging":"true"}:null,ref:o,onDragEnterCapture:c,onDragOverCapture:d,onDragLeaveCapture:p,onDropCapture:f,...s,children:n})});ey.displayName="ComposerPrimitive.AttachmentDropzone";let eb=x("ComposerPrimitive.Dictate",()=>{let e,t,{disabled:n,startDictation:r}=(e=(0,h.useAui)(),t=f(e=>null!=e.composer.dictation||!e.thread.capabilities.dictation||!e.composer.isEditing),{startDictation:(0,i.useCallback)(()=>{e.composer().startDictation()},[e]),disabled:t});return n?null:r}),ex=x("ComposerPrimitive.StopDictation",()=>{let e=(0,h.useAui)(),t=f(e=>null!=e.composer.dictation),n=(0,i.useCallback)(()=>{e.composer().stopDictation()},[e]);return t?n:null}),ev=(0,i.forwardRef)(({children:e,...t},n)=>{let i=f(e=>e.composer.dictation?.transcript);return i?(0,r.jsx)(d.span,{...t,ref:n,children:e??i}):null});ev.displayName="ComposerPrimitive.DictationTranscript";let ew=({children:e,...t})=>f(e=>{if(!0===t.editing&&!e.composer.isEditing||!1===t.editing&&e.composer.isEditing)return!1;let n=null!=e.composer.dictation;return(!0!==t.dictation||!!n)&&(!1!==t.dictation||!n)})?e:null;ew.displayName="ComposerPrimitive.If";let eS=(0,i.forwardRef)((e,t)=>f(e=>e.composer.quote)?(0,r.jsx)(d.div,{...e,ref:t}):null);eS.displayName="ComposerPrimitive.Quote";let ek=(0,i.forwardRef)(({children:e,...t},n)=>{let i=f(e=>e.composer.quote?.text);return i?(0,r.jsx)(d.span,{...t,ref:n,children:e??i}):null});ek.displayName="ComposerPrimitive.QuoteText";let e_=(0,i.forwardRef)(({onClick:e,...t},n)=>{let s=(0,h.useAui)(),o=(0,i.useCallback)(()=>{s.composer().setQuote(void 0)},[s]);return(0,r.jsx)(d.button,{type:"button",...t,ref:n,onClick:(0,y.composeEventHandlers)(e,o)})});e_.displayName="ComposerPrimitive.QuoteDismiss",e.s(["AddAttachment",0,ei,"AttachmentByIndex",0,ef,"AttachmentDropzone",0,ey,"Attachments",0,eg,"Cancel",0,er,"Dictate",0,eb,"DictationTranscript",0,ev,"If",0,ew,"Input",0,en,"Quote",0,eS,"QuoteDismiss",0,e_,"QuoteText",0,ek,"Root",0,R,"Send",0,A,"StopDictation",0,ex],9108);var eE=e.i(9108);e.s(["ComposerPrimitive",0,eE],17466),e.s([],28203),e.i(28203);let eC=e=>{let t=(0,i.useRef)(void 0);return(0,i.useCallback)(n=>{t.current&&t.current(),n&&(t.current=e(n))},[e])},eT=(e,t)=>eC((0,i.useCallback)(n=>{if(!e)return;let r=e(),i=()=>{let e=t?t(n):n.offsetHeight;r.setHeight(e)},s=new ResizeObserver(i);return s.observe(n),i(),()=>{s.disconnect(),r.unregister()}},[e,t])),eI=(0,i.createContext)(!1),ej=(e,t)=>{let n=e.match(/^([\d.]+)(em|px|rem)$/);if(!n)return 0;let r=parseFloat(n[1]),i=n[2];return"px"===i?r:"em"===i?r*(parseFloat(getComputedStyle(t).fontSize)||16):"rem"===i?r*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16):0},eA=({children:e,fillClampThreshold:t="10em",fillClampOffset:n="6em"})=>{let s=f(e=>e.message.isLast&&"assistant"===e.message.role&&e.message.index>=1&&e.thread.messages.at(e.message.index-1)?.role==="user"),o=(0,Z.useThreadViewportStore)({optional:!0}),a=(0,i.useContext)(eI),l=eC((0,i.useCallback)(e=>{if(!o||a)return;let r=()=>{let r=o.getState();if("top"===r.turnAnchor&&s){let{viewport:i,inset:s,userMessage:o}=r.height,a=ej(t,e),l=ej(n,e),u=Math.max(0,i-s-(o<=a?o:l));e.style.minHeight=`${u}px`,e.style.flexShrink="0",e.style.transition="min-height 0s"}else e.style.minHeight="",e.style.flexShrink="",e.style.transition=""};return r(),o.subscribe(r)},[o,s,a,t,n]));return(0,r.jsx)(eI.Provider,{value:!0,children:(0,r.jsx)(M.Slot.Root,{ref:l,children:e})})};eA.displayName="ThreadPrimitive.ViewportSlack";let eR=(0,i.forwardRef)((e,t)=>{let n,o,a,l,u=(n=(0,h.useAui)(),o=f(()=>n.message()),eC((0,i.useCallback)(e=>{let t=()=>{o.setIsHovering(!0)},n=()=>{o.setIsHovering(!1)};return e.addEventListener("mouseenter",t),e.addEventListener("mouseleave",n),e.matches(":hover")&&queueMicrotask(()=>o.setIsHovering(!0)),()=>{e.removeEventListener("mouseenter",t),e.removeEventListener("mouseleave",n),o.setIsHovering(!1)}},[o]))),c=(a=(0,Z.useThreadViewport)(e=>e.turnAnchor),l=(0,Z.useThreadViewport)(e=>e.registerUserMessageHeight),eT(f(e=>"top"===a&&"user"===e.message.role&&e.message.index===e.thread.messages.length-2&&e.thread.messages.at(-1)?.role==="assistant")?l:null,(0,i.useCallback)(e=>e.offsetHeight,[]))),p=(0,s.useComposedRefs)(t,u,c),m=f(e=>e.message.id);return(0,r.jsx)(eA,{children:(0,r.jsx)(d.div,{...e,ref:p,"data-message-id":m})})});eR.displayName="MessagePrimitive.Root";let eM=({index:e,children:t})=>{let n=(0,h.useAui)({part:(0,eu.Derived)({source:"message",query:{type:"index",index:e},get:t=>t.message().part({index:e})})});return(0,r.jsx)(el.AuiProvider,{value:n,children:t})};var eN=e.i(91379),eO=e.i(28038);let eP=(0,eN.resource)(({text:e,isRunning:t})=>{let n=(0,eO.tapMemo)(()=>({type:"text",text:e,status:t?{type:"running"}:{type:"complete"}}),[e,t]);return{getState:()=>n,addToolResult:()=>{throw Error("Not supported")},resumeToolCall:()=>{throw Error("Not supported")}}}),eD=({text:e,isRunning:t=!1,children:n})=>{let i=(0,h.useAui)({part:eP({text:e,isRunning:t})});return(0,r.jsx)(el.AuiProvider,{value:i,children:n})};var eF=e.i(42888);let eL=Object.freeze({type:"complete"}),eB=(0,eN.resource)(({parts:e,getMessagePart:t})=>{let[n,r]=(0,eF.tapState)(!0),i=(0,eO.tapMemo)(()=>{let t=e[e.length-1];return t?.status??eL},[e]),s=(0,eO.tapMemo)(()=>({parts:e,collapsed:n,status:i}),[e,n,i]);return{getState:()=>s,setCollapsed:r,part:t}}),ez=({startIndex:e,endIndex:t,children:n})=>{let i=f(e=>e.message.parts).slice(e,t+1),s=(0,h.useAui)(),o=(0,h.useAui)({chainOfThought:eB({parts:i,getMessagePart:({index:t})=>{if(t<0||t>=i.length)throw Error(`ChainOfThought part index ${t} is out of bounds (0..${i.length-1})`);return s.message().part({index:e+t})}})});return(0,r.jsx)(el.AuiProvider,{value:o,children:n})},eU=e=>{let t=e.message.metadata;if(t&&"object"==typeof t)return t.custom?.quote},eq=(e,t)=>{let n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(let[e,t]of n)if(!r.has(e)||!Object.is(t,r.get(e)))return!1;return!0},e$=e=>{let t=-1;return{startGroup:e=>{-1===t&&(t=e)},endGroup:(n,r)=>{-1!==t&&(r.push({type:e,startIndex:t,endIndex:n}),t=-1)},finalize:(n,r)=>{-1!==t&&r.push({type:e,startIndex:t,endIndex:n})}}},eH=({Fallback:e,...t})=>{let n=f(n=>{let r=n.tools.tools[t.toolName]??e;return Array.isArray(r)?r[0]??e:r});return n?(0,r.jsx)(n,{...t}):null},eV=({Fallback:e,...t})=>{let n=f(n=>{let r=n.dataRenderers.renderers[t.name]??e;return Array.isArray(r)?r[0]??e:r});return n?(0,r.jsx)(n,{...t}):null},eQ={Text:()=>null,Reasoning:()=>null,Source:()=>null,Image:()=>null,File:()=>null,Unstable_Audio:()=>null,ToolGroup:({children:e})=>e,ReasoningGroup:({children:e})=>e},eW=({components:{Text:e=eQ.Text,Reasoning:t=eQ.Reasoning,Image:n=eQ.Image,Source:i=eQ.Source,File:s=eQ.File,Unstable_Audio:o=eQ.Unstable_Audio,tools:a={},data:l}={}})=>{let u=(0,h.useAui)(),c=f(e=>e.part),d=c.type;if("tool-call"===d){let e=u.part().addToolResult,t=u.part().resumeToolCall;if("Override"in a)return(0,r.jsx)(a.Override,{...c,addResult:e,resume:t});let n=a.by_name?.[c.toolName]??a.Fallback;return(0,r.jsx)(eH,{...c,Fallback:n,addResult:e,resume:t})}if(c.status?.type==="requires-action")throw Error("Encountered unexpected requires-action status");switch(d){case"text":return(0,r.jsx)(e,{...c});case"reasoning":return(0,r.jsx)(t,{...c});case"source":return(0,r.jsx)(i,{...c});case"image":return(0,r.jsx)(n,{...c});case"file":return(0,r.jsx)(s,{...c});case"audio":return(0,r.jsx)(o,{...c});case"data":{let e=l?.by_name?.[c.name]??l?.Fallback;return(0,r.jsx)(eV,{...c,Fallback:e})}default:return console.warn(`Unknown message part type: ${d}`),null}},eK=(0,i.memo)(({index:e,components:t})=>(0,r.jsx)(eM,{index:e,children:(0,r.jsx)(eW,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.ToolGroup===t.components?.ToolGroup&&e.components?.ReasoningGroup===t.components?.ReasoningGroup);eK.displayName="MessagePrimitive.PartByIndex";let eG=({status:e,component:t})=>(0,r.jsx)(eD,{text:"",isRunning:"running"===e.type,children:(0,r.jsx)(t,{type:"text",text:"",status:e})}),eJ=Object.freeze({type:"complete"}),eY=(0,i.memo)(({components:e})=>{let t=f(e=>e.message.status??eJ);return e?.Empty?(0,r.jsx)(e.Empty,{status:t}):(0,r.jsx)(eG,{status:t,component:e?.Text??eQ.Text})},(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),eX=(0,i.memo)(({components:e,enabled:t})=>f(e=>{if(!t||0===e.message.parts.length)return!1;let n=e.message.parts[e.message.parts.length-1];return n?.type!=="text"&&n?.type!=="reasoning"})?(0,r.jsx)(eY,{components:e}):null,(e,t)=>e.enabled===t.enabled&&e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),eZ=(0,i.memo)(({Quote:e})=>{let t=f(eU);return t?(0,r.jsx)(e,{text:t.text,messageId:t.messageId}):null}),e0=()=>{let e=(0,h.useAui)(),t=f(e=>e.part),n=f(e=>{if("tool-call"!==e.part.type)return null;let t=e.tools.tools[e.part.toolName];return Array.isArray(t)?t[0]??null:t??null});return n&&"tool-call"===t.type?(0,r.jsx)(n,{...t,addResult:e.part().addToolResult,resume:e.part().resumeToolCall}):null},e1=()=>{let e=f(e=>e.part),t=f(e=>{if("data"!==e.part.type)return null;let t=e.dataRenderers.renderers[e.part.name];return Array.isArray(t)?t[0]??null:t??null});return t&&"data"===e.type?(0,r.jsx)(t,{...e}):null},e2=()=>{let e=f(e=>e.part.type);return"tool-call"===e?(0,r.jsx)(e0,{}):"data"===e?(0,r.jsx)(e1,{}):null},e5=({children:e})=>{let t=(0,h.useAui)(),n=f(e=>e.message.parts.length);return(0,i.useMemo)(()=>Array.from({length:n},(n,i)=>(0,r.jsx)(eM,{index:i,children:(0,r.jsx)(eo,{getItemState:e=>e.message().part({index:i}).getState(),children:n=>{let s=e({get part(){let e=n();if("tool-call"===e.type){let n=t.tools().getState().tools[e.toolName],s=Array.isArray(n)?!!n[0]:!!n,o=t.message().part({index:i});return{...e,toolUI:s?(0,r.jsx)(e0,{}):null,addResult:o.addToolResult,resume:o.resumeToolCall}}if("data"===e.type){let n=t.dataRenderers().getState().renderers[e.name],i=Array.isArray(n)?!!n[0]:!!n;return{...e,dataRendererUI:i?(0,r.jsx)(e1,{}):null}}return e}});return null!==s?s:(0,r.jsx)(e2,{})}})},i)),[n,e])},e3=({components:e,unstable_showEmptyOnNonTextEnd:t=!0,children:n})=>n?(0,r.jsx)(e5,{children:n}):(0,r.jsx)(e4,{components:e,unstable_showEmptyOnNonTextEnd:t});e3.displayName="MessagePrimitive.Parts";let e4=({components:e,unstable_showEmptyOnNonTextEnd:t})=>{var n,s;let o,a,l=f(e=>e.message.parts.length),u=(n=!!e?.ChainOfThought,a=f((s=e=>e.message.parts.map(e=>e.type),o=i.default.useRef(void 0),e=>{let t=s(e);return!function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;if(Symbol.iterator in e&&Symbol.iterator in t){if("entries"in e&&"entries"in t)return eq(e,t);let n=e[Symbol.iterator](),r=t[Symbol.iterator](),i=n.next(),s=r.next();for(;!i.done&&!s.done;){if(!Object.is(i.value,s.value))return!1;i=n.next(),s=r.next()}return!!i.done&&!!s.done}return eq({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}(o.current,t)?o.current=t:o.current})),(0,i.useMemo)(()=>0===a.length?[]:((e,t)=>{let n=[];if(t){let t=e$("chainOfThoughtGroup");for(let r=0;r<e.length;r++){let i=e[r];"tool-call"===i||"reasoning"===i?t.startGroup(r):(t.endGroup(r-1,n),n.push({type:"single",index:r}))}t.finalize(e.length-1,n)}else{let t=e$("toolGroup"),r=e$("reasoningGroup");for(let i=0;i<e.length;i++){let s=e[i];"tool-call"===s?(r.endGroup(i-1,n),t.startGroup(i)):"reasoning"===s?(t.endGroup(i-1,n),r.startGroup(i)):(t.endGroup(i-1,n),r.endGroup(i-1,n),n.push({type:"single",index:i}))}t.finalize(e.length-1,n),r.finalize(e.length-1,n)}return n})(a,n),[a,n])),c=(0,i.useMemo)(()=>0===l?(0,r.jsx)(eY,{components:e}):u.map(t=>{if("single"===t.type)return(0,r.jsx)(eK,{index:t.index,components:e},t.index);if("chainOfThoughtGroup"===t.type){let n=e?.ChainOfThought;return n?(0,r.jsx)(ez,{startIndex:t.startIndex,endIndex:t.endIndex,children:(0,r.jsx)(n,{})},`chainOfThought-${t.startIndex}`):null}if("toolGroup"===t.type){let n=e?.ToolGroup??eQ.ToolGroup;return(0,r.jsx)(n,{startIndex:t.startIndex,endIndex:t.endIndex,children:Array.from({length:t.endIndex-t.startIndex+1},(n,i)=>(0,r.jsx)(eK,{index:t.startIndex+i,components:e},i))},`tool-${t.startIndex}`)}{let n=e?.ReasoningGroup??eQ.ReasoningGroup;return(0,r.jsx)(n,{startIndex:t.startIndex,endIndex:t.endIndex,children:Array.from({length:t.endIndex-t.startIndex+1},(n,i)=>(0,r.jsx)(eK,{index:t.startIndex+i,components:e},i))},`reasoning-${t.startIndex}`)}}),[u,e,l]);return(0,r.jsxs)(r.Fragment,{children:[e?.Quote&&(0,r.jsx)(eZ,{Quote:e.Quote}),c,(0,r.jsx)(eX,{components:e,enabled:t})]})};e.i(50147);var e6=e.i(51996);let e8=(0,i.createContext)(null),{useSmoothStatus:e9,useSmoothStatusStore:e7}=(0,e6.createContextStoreHook)(function(e){let t=(0,i.useContext)(e8);if(!e?.optional&&!t)throw Error("This component must be used within a SmoothContextProvider.");return t},"useSmoothStatus");var te=e.i(21470);class tt{currentText;setText;animationFrameId=null;lastUpdateTime=Date.now();targetText="";constructor(e,t){this.currentText=e,this.setText=t}start(){null===this.animationFrameId&&(this.lastUpdateTime=Date.now(),this.animate())}stop(){null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}animate=()=>{let e=Date.now(),t=e-this.lastUpdateTime,n=this.targetText.length-this.currentText.length,r=Math.min(5,250/n),i=0;for(;t>=r&&i<n;)i++,t-=r;i!==n?this.animationFrameId=requestAnimationFrame(this.animate):this.animationFrameId=null,0!==i&&(this.currentText=this.targetText.slice(0,this.currentText.length+i),this.lastUpdateTime=e-t,this.setText(this.currentText))}}let tn=Object.freeze({type:"running"}),tr=(0,i.forwardRef)(({smooth:e=!0,component:t="span",...n},s)=>{let{text:o,status:a}=((e,t=!1)=>{let{text:n}=e,r=f(e=>e.message.id),s=(0,i.useRef)(r),[o,a]=(0,i.useState)("running"===e.status.type?"":n),l=e7({optional:!0}),u=(0,X.useCallbackRef)(t=>{if(a(t),l){let n=o!==t||"running"===e.status.type?tn:e.status;(0,te.writableStore)(l).setState(n,!0)}});(0,i.useEffect)(()=>{if(l){let r=t&&(o!==n||"running"===e.status.type)?tn:e.status;(0,te.writableStore)(l).setState(r,!0)}},[l,t,n,o,e.status]);let[c]=(0,i.useState)(new tt(o,u));return(0,i.useEffect)(()=>{if(!t)return void c.stop();if(s.current!==r||!n.startsWith(c.targetText)){s.current=r,"running"===e.status.type?(u(""),c.currentText="",c.targetText=n,c.start()):(u(n),c.currentText=n,c.targetText=n,c.stop());return}c.targetText=n,c.start()},[u,c,r,t,n,e.status.type]),(0,i.useEffect)(()=>()=>{c.stop()},[c]),(0,i.useMemo)(()=>t?{type:"text",text:o,status:n===o?e.status:tn}:e,[t,o,e,n])})(f(e=>{if("text"!==e.part.type&&"reasoning"!==e.part.type)throw Error("MessagePartText can only be used inside text or reasoning message parts.");return e.part}),e);return(0,r.jsx)(t,{"data-status":a.type,...n,ref:s,children:o})});tr.displayName="MessagePartPrimitive.Text";let ti=(0,i.forwardRef)((e,t)=>{let{image:n}=f(e=>{if("image"!==e.part.type)throw Error("MessagePartImage can only be used inside image message parts.");return e.part});return(0,r.jsx)(d.img,{src:n,...e,ref:t})});ti.displayName="MessagePartPrimitive.Image";let ts=({children:e})=>f(e=>"running"===e.part.status.type)?e:null;ts.displayName="MessagePartPrimitive.InProgress";let to={...eQ,Text:()=>(0,r.jsxs)("p",{style:{whiteSpace:"pre-line"},children:[(0,r.jsx)(tr,{}),(0,r.jsx)(ts,{children:(0,r.jsx)("span",{style:{fontFamily:"revert"},children:" ●"})})]}),Image:()=>(0,r.jsx)(ti,{})},ta=e=>{if("children"in e)return(0,r.jsx)(e3,{children:e.children});let{components:t,...n}=e,i=t?{Text:t.Text??to.Text,Image:t.Image??to.Image,Reasoning:t.Reasoning??eQ.Reasoning,Source:t.Source??eQ.Source,File:t.File??eQ.File,Unstable_Audio:t.Unstable_Audio??eQ.Unstable_Audio,..."ChainOfThought"in t?{ChainOfThought:t.ChainOfThought}:{tools:t.tools,data:t.data,ToolGroup:t.ToolGroup??eQ.ToolGroup,ReasoningGroup:t.ReasoningGroup??eQ.ReasoningGroup},Empty:t.Empty,Quote:t.Quote}:to;return(0,r.jsx)(e3,{components:i,...n})};ta.displayName="MessagePrimitive.Parts";let tl=({children:e,...t})=>f(e=>{let{role:n,attachments:r,parts:i,branchCount:s,isLast:o,speech:a,isCopied:l,isHovering:u}=e.message;return!(!0===t.hasBranches&&s<2||t.user&&"user"!==n||t.assistant&&"assistant"!==n||t.system&&"system"!==n||!0===t.lastOrHover&&!u&&!o||void 0!==t.last&&t.last!==o||!0===t.copied&&!l||!1===t.copied&&l||!0===t.speaking&&null==a||!1===t.speaking&&null!=a||!0===t.hasAttachments&&("user"!==n||!r?.length)||!1===t.hasAttachments&&"user"===n&&r?.length)&&(!0!==t.hasContent||0!==i.length)&&(!1!==t.hasContent||!(i.length>0))&&(void 0===t.submittedFeedback||(e.message.metadata.submittedFeedback?.type??null)===t.submittedFeedback)})?e:null;tl.displayName="MessagePrimitive.If";let tu=(e,t)=>{switch(t.type){case"image":return e?.Image??e?.Attachment;case"document":return e?.Document??e?.Attachment;case"file":return e?.File??e?.Attachment;default:return e?.Attachment}},tc=({components:e})=>{let t=f(e=>e.attachment);if(!t)return null;let n=tu(e,t);return n?(0,r.jsx)(n,{}):null},td=(0,i.memo)(({index:e,components:t})=>(0,r.jsx)(ec,{index:e,children:(0,r.jsx)(tc,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Image===t.components?.Image&&e.components?.Document===t.components?.Document&&e.components?.File===t.components?.File&&e.components?.Attachment===t.components?.Attachment);td.displayName="MessagePrimitive.AttachmentByIndex";let th=({children:e})=>{let t=f(e=>"user"!==e.message.role?0:e.message.attachments.length);return(0,i.useMemo)(()=>Array.from({length:t},(t,n)=>(0,r.jsx)(ec,{index:n,children:(0,r.jsx)(eo,{getItemState:e=>e.message().attachment({index:n}).getState(),children:t=>e({get attachment(){return t()}})})},n)),[t,e])},tp=({components:e,children:t})=>e?(0,r.jsx)(th,{children:({attachment:t})=>{let n=tu(e,t);return n?(0,r.jsx)(n,{}):null}}):(0,r.jsx)(th,{children:t});tp.displayName="MessagePrimitive.Attachments";let tf=(0,i.memo)(({children:e})=>{let t=f(eU);return t?(0,r.jsx)(r.Fragment,{children:e(t)}):null});tf.displayName="MessagePrimitive.Quote";let tm=({children:e})=>void 0!==f(e=>e.message.status?.type==="incomplete"&&"error"===e.message.status.reason?e.message.status.error??"An error occurred":void 0)?e:null;tm.displayName="MessagePrimitive.Error";let tg=e=>{let t=new Map;for(let n=0;n<e.length;n++){let r=e[n],i=r?.parentId??`__ungrouped_${n}`,s=t.get(i)??[];s.push(n),t.set(i,s)}let n=[];for(let[e,r]of t){let t=e.startsWith("__ungrouped_")?void 0:e;n.push({groupKey:t,indices:r})}return n},ty=({Fallback:e,...t})=>{let n=f(n=>{let r=n.tools.tools[t.toolName]??e;return Array.isArray(r)?r[0]??e:r});return n?(0,r.jsx)(n,{...t}):null},tb=({Fallback:e,...t})=>{let n=f(n=>{let r=n.dataRenderers.renderers[t.name]??e;return Array.isArray(r)?r[0]??e:r});return n?(0,r.jsx)(n,{...t}):null},tx=()=>(0,r.jsxs)("p",{style:{whiteSpace:"pre-line"},children:[(0,r.jsx)(tr,{}),(0,r.jsx)(ts,{children:(0,r.jsx)("span",{style:{fontFamily:"revert"},children:" ●"})})]}),tv=()=>null,tw=()=>null,tS=()=>(0,r.jsx)(ti,{}),tk=()=>null,t_=()=>null,tE=({children:e})=>e,tC=({components:{Text:e=tx,Reasoning:t=tv,Image:n=tS,Source:i=tw,File:s=tk,Unstable_Audio:o=t_,tools:a={},data:l}={}})=>{let u=(0,h.useAui)(),c=f(e=>e.part),d=c.type;if("tool-call"===d){let e=u.part().addToolResult,t=u.part().resumeToolCall;if("Override"in a)return(0,r.jsx)(a.Override,{...c,addResult:e,resume:t});let n=a.by_name?.[c.toolName]??a.Fallback;return(0,r.jsx)(ty,{...c,Fallback:n,addResult:e,resume:t})}if(c.status?.type==="requires-action")throw Error("Encountered unexpected requires-action status");switch(d){case"text":return(0,r.jsx)(e,{...c});case"reasoning":return(0,r.jsx)(t,{...c});case"source":return(0,r.jsx)(i,{...c});case"image":return(0,r.jsx)(n,{...c});case"file":return(0,r.jsx)(s,{...c});case"audio":return(0,r.jsx)(o,{...c});case"data":{let e=l?.by_name?.[c.name]??l?.Fallback;return(0,r.jsx)(tb,{...c,Fallback:e})}default:return console.warn(`Unknown message part type: ${d}`),null}},tT=(0,i.memo)(({partIndex:e,components:t})=>(0,r.jsx)(eM,{index:e,children:(0,r.jsx)(tC,{components:t})}),(e,t)=>e.partIndex===t.partIndex&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.Group===t.components?.Group),tI=({status:e,component:t})=>(0,r.jsx)(eD,{text:"",isRunning:"running"===e.type,children:(0,r.jsx)(t,{type:"text",text:"",status:e})}),tj=Object.freeze({type:"complete"}),tA=(0,i.memo)(({components:e})=>{let t=f(e=>e.message.status??tj);return e?.Empty?(0,r.jsx)(e.Empty,{status:t}):(0,r.jsx)(tI,{status:t,component:e?.Text??tx})},(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),tR=({groupingFunction:e,components:t})=>{let n,s=f(e=>e.message.parts.length),o=(n=f(e=>e.message.parts),(0,i.useMemo)(()=>0===n.length?[]:e(n),[n,e])),a=(0,i.useMemo)(()=>0===s?(0,r.jsx)(tA,{components:t}):o.map((e,n)=>{let i=t?.Group??tE;return(0,r.jsx)(i,{groupKey:e.groupKey,indices:e.indices,children:e.indices.map(e=>(0,r.jsx)(tT,{partIndex:e,components:t},e))},`group-${n}-${e.groupKey??"ungrouped"}`)}),[o,t,s]);return(0,r.jsx)(r.Fragment,{children:a})};tR.displayName="MessagePrimitive.Unstable_PartsGrouped";let tM=({components:e,...t})=>(0,r.jsx)(tR,{...t,components:e,groupingFunction:tg});tM.displayName="MessagePrimitive.Unstable_PartsGroupedByParentId",e.s(["AttachmentByIndex",0,td,"Attachments",0,tp,"Content",0,ta,"Error",0,tm,"If",0,tl,"PartByIndex",0,eK,"Parts",0,ta,"Quote",0,tf,"Root",0,eR,"Unstable_PartsGrouped",0,tR,"Unstable_PartsGroupedByParentId",0,tM],76320);var tN=e.i(76320);e.s(["MessagePrimitive",0,tN],61302),e.s([],65643),e.i(65643);let tO=(0,i.forwardRef)((e,t)=>(0,r.jsx)(d.div,{...e,ref:t}));tO.displayName="ThreadPrimitive.Root";let tP=({children:e})=>f(e=>e.thread.isEmpty)?e:null;tP.displayName="ThreadPrimitive.Empty";let tD=({children:e,...t})=>f(e=>(!0!==t.empty||!!e.thread.isEmpty)&&(!1!==t.empty||!e.thread.isEmpty)&&(!0!==t.running||!!e.thread.isRunning)&&(!1!==t.running||!e.thread.isRunning)&&(!0!==t.disabled||!!e.thread.isDisabled)&&(!1!==t.disabled||!e.thread.isDisabled)&&!0)?e:null;tD.displayName="ThreadPrimitive.If";let tF=i.default.createContext(!0);function tL(){throw Error("A function wrapped in useEffectEvent can't be called during rendering.")}let tB="use"in i.default?()=>{try{return i.default.use(tF)}catch{return!1}}:()=>!1;var tz=e.i(88992);let tU=(e,t)=>{let n,r=(0,h.useAui)(),s=(n=i.default.useRef(tL),i.default.useInsertionEffect(()=>{n.current=t},[t]),(...e)=>(tB()&&tL(),(0,n.current)(...e))),{scope:o,event:a}=(0,tz.normalizeEventSelector)(e);(0,i.useEffect)(()=>r.on({scope:o,event:a},s),[r,o,a,s])};var tq=e.i(17367);let t$=(0,i.forwardRef)(({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:n,scrollToBottomOnThreadSwitch:o,children:a,...l},u)=>{let c=(({autoScroll:e,scrollToBottomOnRunStart:t=!0,scrollToBottomOnInitialize:n=!0,scrollToBottomOnThreadSwitch:r=!0})=>{var o;let a,l=(0,i.useRef)(null),u=(0,Z.useThreadViewportStore)();void 0===e&&(e="top"!==u.getState().turnAnchor);let c=(0,i.useRef)(0),d=(0,i.useRef)(null),h=(0,i.useCallback)(e=>{let t=l.current;t&&(d.current=e,t.scrollTo({top:t.scrollHeight,behavior:e}))},[]),p=()=>{let e=l.current;if(!e)return;let t=u.getState().isAtBottom,n=1>Math.abs(e.scrollHeight-e.scrollTop-e.clientHeight)||e.scrollHeight<=e.clientHeight;!n&&c.current<e.scrollTop||(n&&(d.current=null),(n||null===d.current)&&n!==t&&(0,te.writableStore)(u).setState({isAtBottom:n})),c.current=e.scrollTop},f=(o=()=>{let t=d.current;t?h(t):e&&u.getState().isAtBottom&&h("instant"),p()},a=(0,X.useCallbackRef)(o),eC((0,i.useCallback)(e=>{let t=new ResizeObserver(()=>{a()}),n=new MutationObserver(e=>{e.some(e=>"attributes"!==e.type||"style"!==e.attributeName)&&a()});return t.observe(e),n.observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>{t.disconnect(),n.disconnect()}},[a]))),m=eC(e=>(e.addEventListener("scroll",p),()=>{e.removeEventListener("scroll",p)}));return ee(({behavior:e})=>{h(e)}),tU("thread.runStart",()=>{t&&(d.current="auto",requestAnimationFrame(()=>{h("auto")}))}),tU("thread.initialize",()=>{n&&(d.current="instant",requestAnimationFrame(()=>{h("instant")}))}),tU("threadListItem.switchedTo",()=>{r&&(d.current="instant",requestAnimationFrame(()=>{h("instant")}))}),(0,s.useComposedRefs)(f,m,l)})({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:n,scrollToBottomOnThreadSwitch:o}),h=eT((0,Z.useThreadViewport)(e=>e.registerViewport),(0,i.useCallback)(e=>e.clientHeight,[])),p=(0,s.useComposedRefs)(u,c,h);return(0,r.jsx)(d.div,{...l,ref:p,children:a})});t$.displayName="ThreadPrimitive.ViewportScrollable";let tH=(0,i.forwardRef)(({turnAnchor:e,...t},n)=>(0,r.jsx)(tq.ThreadPrimitiveViewportProvider,{options:{turnAnchor:e},children:(0,r.jsx)(t$,{...t,ref:n})}));tH.displayName="ThreadPrimitive.Viewport";let tV=(0,i.forwardRef)((e,t)=>{let n=eT((0,Z.useThreadViewport)(e=>e.registerContentInset),(0,i.useCallback)(e=>{let t=parseFloat(getComputedStyle(e).marginTop)||0;return e.offsetHeight+t},[])),o=(0,s.useComposedRefs)(t,n);return(0,r.jsx)(d.div,{...e,ref:o})});tV.displayName="ThreadPrimitive.ViewportFooter";let tQ=({index:e,children:t})=>{let n=(0,h.useAui)({message:(0,eu.Derived)({source:"thread",query:{type:"index",index:e},get:t=>t.thread().message({index:e})}),composer:(0,eu.Derived)({source:"message",query:{},get:t=>t.thread().message({index:e}).composer()})});return(0,r.jsx)(el.AuiProvider,{value:n,children:t})},tW=(e,t)=>e.Message===t.Message&&e.EditComposer===t.EditComposer&&e.UserEditComposer===t.UserEditComposer&&e.AssistantEditComposer===t.AssistantEditComposer&&e.SystemEditComposer===t.SystemEditComposer&&e.UserMessage===t.UserMessage&&e.AssistantMessage===t.AssistantMessage&&e.SystemMessage===t.SystemMessage,tK=()=>null,tG=({components:e})=>{let t=((e,t,n)=>{switch(t){case"user":if(n)return e.UserEditComposer??e.EditComposer??e.UserMessage??e.Message;return e.UserMessage??e.Message;case"assistant":if(n)return e.AssistantEditComposer??e.EditComposer??e.AssistantMessage??e.Message;return e.AssistantMessage??e.Message;case"system":if(n)return e.SystemEditComposer??e.EditComposer??e.SystemMessage??e.Message;return e.SystemMessage??e.Message??tK;default:throw Error(`Unknown message role: ${t}`)}})(e,f(e=>e.message.role),f(e=>e.message.composer.isEditing));return(0,r.jsx)(t,{})},tJ=(0,i.memo)(({index:e,components:t})=>(0,r.jsx)(tQ,{index:e,children:(0,r.jsx)(tG,{components:t})}),(e,t)=>e.index===t.index&&tW(e.components,t.components));tJ.displayName="ThreadPrimitive.MessageByIndex";let tY=({children:e})=>{let t=f(e=>e.thread.messages.length);return(0,i.useMemo)(()=>0===t?null:Array.from({length:t},(t,n)=>(0,r.jsx)(tQ,{index:n,children:(0,r.jsx)(eo,{getItemState:e=>e.thread().message({index:n}).getState(),children:t=>e({get message(){return t()}})})},n)),[t,e])},tX=({components:e,children:t})=>e?(0,r.jsx)(tY,{children:()=>(0,r.jsx)(tG,{components:e})}):(0,r.jsx)(tY,{children:t});tX.displayName="ThreadPrimitive.Messages";let tZ=(0,i.memo)(tX,(e,t)=>e.children||t.children?e.children===t.children:tW(e.components,t.components)),t0=x("ThreadPrimitive.ScrollToBottom",({behavior:e}={})=>{let t=(0,Z.useThreadViewport)(e=>e.isAtBottom),n=(0,Z.useThreadViewportStore)(),r=(0,i.useCallback)(()=>{n.getState().scrollToBottom({behavior:e})},[n,e]);return t?null:r},["behavior"]),t1=x("ThreadPrimitive.Suggestion",({prompt:e,send:t,clearComposer:n,autoSend:r,method:s})=>{let{disabled:o,trigger:a}=(({prompt:e,send:t,clearComposer:n=!0})=>{let r=(0,h.useAui)(),s=f(e=>e.thread.isDisabled),o=t??!1;return{trigger:(0,i.useCallback)(()=>{let t=r.thread().getState().isRunning;if(o&&!t)r.thread().append({content:[{type:"text",text:e}],runConfig:r.composer().getState().runConfig}),n&&r.composer().setText("");else if(n)r.composer().setText(e);else{let t=r.composer().getState().text;r.composer().setText(t.trim()?`${t} ${e}`:e)}},[r,o,n,e]),disabled:s}})({prompt:e,send:t??r??!1,clearComposer:n});return o?null:a},["prompt","send","clearComposer","autoSend","method"]),t2=({index:e,children:t})=>{let n=(0,h.useAui)({suggestion:(0,eu.Derived)({source:"suggestions",query:{index:e},get:t=>t.suggestions().suggestion({index:e})})});return(0,r.jsx)(el.AuiProvider,{value:n,children:t})},t5=({components:e})=>{let t=e.Suggestion;return(0,r.jsx)(t,{})},t3=(0,i.memo)(({index:e,components:t})=>(0,r.jsx)(t2,{index:e,children:(0,r.jsx)(t5,{components:t})}),(e,t)=>e.index===t.index&&e.components.Suggestion===t.components.Suggestion);t3.displayName="ThreadPrimitive.SuggestionByIndex";let t4=({children:e})=>{let t=f(e=>e.suggestions.suggestions.length);return(0,i.useMemo)(()=>0===t?null:Array.from({length:t},(t,n)=>(0,r.jsx)(t2,{index:n,children:(0,r.jsx)(eo,{getItemState:e=>e.suggestions().suggestion({index:n}).getState(),children:t=>e({get suggestion(){return t()}})})},n)),[t,e])},t6=({components:e,children:t})=>e?(0,r.jsx)(t4,{children:()=>(0,r.jsx)(t5,{components:e})}):(0,r.jsx)(t4,{children:t});t6.displayName="ThreadPrimitive.Suggestions";let t8=(0,i.memo)(t6,(e,t)=>e.children||t.children?e.children===t.children:e.components.Suggestion===t.components.Suggestion);e.s(["Empty",0,tP,"If",0,tD,"MessageByIndex",0,tJ,"Messages",0,tZ,"Root",0,tO,"ScrollToBottom",0,t0,"Suggestion",0,t1,"SuggestionByIndex",0,t3,"Suggestions",0,t8,"Viewport",0,tH,"ViewportFooter",0,tV,"ViewportProvider",()=>tq.ThreadPrimitiveViewportProvider,"ViewportSlack",0,eA],16189);var t9=e.i(16189);e.s(["ThreadPrimitive",0,t9],94875),e.i(44172);function t7(e){return function(t){let n,r=!1;"function"==typeof t?n=t:t&&(r=!!t.optional,n=t.selector);let s=e({optional:r});return s?function(e,t=e=>e){e.__isBound||(e.__internal_bindMethods?.(),e.__isBound=!0);let n=(0,i.useSyncExternalStore)(e.subscribe,()=>t(e.getState()),()=>t(e.getState()));return(0,i.useDebugValue)(n),n}(s,n):null}}function ne(e){let t=(0,h.useAui)(),n=f(()=>t.message.source?t.message().__internal_getRuntime?.()??null:null);if(!n&&!e?.optional)throw Error("MessageRuntime is not available");return n}let nt=t7(ne);t7(e=>ne(e)?.composer??null),e.s(["useMessage",0,nt],30854)},69090,(e,t,n)=>{"use strict";var r=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,s=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,c=/^\s+|\s+$/g;function d(e){return e?e.replace(c,""):""}t.exports=function(e,t){if("string"!=typeof e)throw TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,c=1;function h(e){var t=e.match(i);t&&(n+=t.length);var r=e.lastIndexOf("\n");c=~r?e.length-r:c+e.length}function p(){var e={line:n,column:c};return function(t){return t.position=new f(e),g(s),t}}function f(e){this.start=e,this.end={line:n,column:c},this.source=t.source}function m(r){var i=Error(t.source+":"+n+":"+c+": "+r);if(i.reason=r,i.filename=t.source,i.line=n,i.column=c,i.source=e,t.silent);else throw i}function g(t){var n=t.exec(e);if(n){var r=n[0];return h(r),e=e.slice(r.length),n}}function y(e){var t;for(e=e||[];t=b();)!1!==t&&e.push(t);return e}function b(){var t=p();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;""!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return m("End of comment missing");var r=e.slice(2,n-2);return c+=2,h(r),e=e.slice(n),c+=2,t({type:"comment",comment:r})}}f.prototype.content=e,g(s);var x,v=[];for(y(v);x=function(){var e=p(),t=g(o);if(t){if(b(),!g(a))return m("property missing ':'");var n=g(l),i=e({type:"declaration",property:d(t[0].replace(r,"")),value:n?d(n[0].replace(r,"")):""});return g(u),i}}();)!1!==x&&(v.push(x),y(v));return v}},59596,(e,t,n)=>{"use strict";var r=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e,t){let n=null;if(!e||"string"!=typeof e)return n;let r=(0,i.default)(e),s="function"==typeof t;return r.forEach(e=>{if("declaration"!==e.type)return;let{property:r,value:i}=e;s?t(r,i,e):i&&((n=n||{})[r]=i)}),n};let i=r(e.r(69090))},51521,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.camelCase=void 0;var r=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,s=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,l=function(e,t){return t.toUpperCase()},u=function(e,t){return"".concat(t,"-")};n.camelCase=function(e,t){var n;return(void 0===t&&(t={}),!(n=e)||s.test(n)||r.test(n))?e:(e=e.toLowerCase(),(e=t.reactCompat?e.replace(a,u):e.replace(o,u)).replace(i,l))}},63185,(e,t,n)=>{"use strict";var r=(e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(e.r(59596)),i=e.r(51521);function s(e,t){var n={};return e&&"string"==typeof e&&(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}s.default=s,t.exports=s},75609,(e,t,n)=>{"use strict";var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,s=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===i.call(e)},l=function(e){if(!e||"[object Object]"!==i.call(e))return!1;var t,n=r.call(e,"constructor"),s=e.constructor&&e.constructor.prototype&&r.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!s)return!1;for(t in e);return void 0===t||r.call(e,t)},u=function(e,t){s&&"__proto__"===t.name?s(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},c=function(e,t){if("__proto__"===t){if(!r.call(e,t))return;else if(o)return o(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,s,o,d=arguments[0],h=1,p=arguments.length,f=!1;for("boolean"==typeof d&&(f=d,d=arguments[1]||{},h=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});h<p;++h)if(t=arguments[h],null!=t)for(n in t)r=c(d,n),d!==(i=c(t,n))&&(f&&i&&(l(i)||(s=a(i)))?(s?(s=!1,o=r&&a(r)?r:[]):o=r&&l(r)?r:{},u(d,{name:n,newValue:e(f,o,i)})):void 0!==i&&u(d,{name:n,newValue:i}));return d}},427,97802,12105,59245,44819,55470,33220,51256,27066,5568,84484,73119,2652,16920,e=>{"use strict";function t(){}function n(){}e.s(["ok",()=>t,"unreachable",()=>n],97802);let r=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,i=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,s={};function o(e,t){return((t||s).jsx?i:r).test(e)}let a=/[ \t\n\f\r]/g;function l(e){return""===e.replace(a,"")}class u{constructor(e,t){this.attribute=t,this.property=e}}u.prototype.attribute="",u.prototype.booleanish=!1,u.prototype.boolean=!1,u.prototype.commaOrSpaceSeparated=!1,u.prototype.commaSeparated=!1,u.prototype.defined=!1,u.prototype.mustUseProperty=!1,u.prototype.number=!1,u.prototype.overloadedBoolean=!1,u.prototype.property="",u.prototype.spaceSeparated=!1,u.prototype.space=void 0;let c=0,d=b(),h=b(),p=b(),f=b(),m=b(),g=b(),y=b();function b(){return 2**++c}e.s(["boolean",0,d,"booleanish",0,h,"commaOrSpaceSeparated",0,y,"commaSeparated",0,g,"number",0,f,"overloadedBoolean",0,p,"spaceSeparated",0,m],83954);var x=e.i(83954);let v=Object.keys(x);class w extends u{constructor(e,t,n,r){let i=-1;if(super(e,t),function(e,t,n){n&&(e[t]=n)}(this,"space",r),"number"==typeof n)for(;++i<v.length;){const e=v[i];!function(e,t,n){n&&(e[t]=n)}(this,v[i],(n&x[e])===x[e])}}}function S(e){return e.toLowerCase()}w.prototype.defined=!0;let k=/[A-Z]/g,_=/-[a-z]/g,E=/^data[-\w.:]+$/i;function C(e){return"-"+e.toLowerCase()}function T(e){return e.charAt(1).toUpperCase()}let I={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"};class j{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function A(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new j(n,r,t)}function R(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let s=new w(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[S(r)]=r,n[S(s.attribute)]=r}return new j(t,n,e.space)}j.prototype.normal={},j.prototype.property={},j.prototype.space=void 0;let M=R({properties:{ariaActiveDescendant:null,ariaAtomic:h,ariaAutoComplete:null,ariaBusy:h,ariaChecked:h,ariaColCount:f,ariaColIndex:f,ariaColSpan:f,ariaControls:m,ariaCurrent:null,ariaDescribedBy:m,ariaDetails:null,ariaDisabled:h,ariaDropEffect:m,ariaErrorMessage:null,ariaExpanded:h,ariaFlowTo:m,ariaGrabbed:h,ariaHasPopup:null,ariaHidden:h,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:m,ariaLevel:f,ariaLive:null,ariaModal:h,ariaMultiLine:h,ariaMultiSelectable:h,ariaOrientation:null,ariaOwns:m,ariaPlaceholder:null,ariaPosInSet:f,ariaPressed:h,ariaReadOnly:h,ariaRelevant:null,ariaRequired:h,ariaRoleDescription:m,ariaRowCount:f,ariaRowIndex:f,ariaRowSpan:f,ariaSelected:h,ariaSetSize:f,ariaSort:null,ariaValueMax:f,ariaValueMin:f,ariaValueNow:f,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function N(e,t){return t in e?e[t]:t}function O(e,t){return N(e,t.toLowerCase())}let P=R({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:g,acceptCharset:m,accessKey:m,action:null,allow:null,allowFullScreen:d,allowPaymentRequest:d,allowUserMedia:d,alt:null,as:null,async:d,autoCapitalize:null,autoComplete:m,autoFocus:d,autoPlay:d,blocking:m,capture:null,charSet:null,checked:d,cite:null,className:m,cols:f,colSpan:null,content:null,contentEditable:h,controls:d,controlsList:m,coords:f|g,crossOrigin:null,data:null,dateTime:null,decoding:null,default:d,defer:d,dir:null,dirName:null,disabled:d,download:p,draggable:h,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:d,formTarget:null,headers:m,height:f,hidden:p,high:f,href:null,hrefLang:null,htmlFor:m,httpEquiv:m,id:null,imageSizes:null,imageSrcSet:null,inert:d,inputMode:null,integrity:null,is:null,isMap:d,itemId:null,itemProp:m,itemRef:m,itemScope:d,itemType:m,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:d,low:f,manifest:null,max:null,maxLength:f,media:null,method:null,min:null,minLength:f,multiple:d,muted:d,name:null,nonce:null,noModule:d,noValidate:d,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:d,optimum:f,pattern:null,ping:m,placeholder:null,playsInline:d,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:d,referrerPolicy:null,rel:m,required:d,reversed:d,rows:f,rowSpan:f,sandbox:m,scope:null,scoped:d,seamless:d,selected:d,shadowRootClonable:d,shadowRootDelegatesFocus:d,shadowRootMode:null,shape:null,size:f,sizes:null,slot:null,span:f,spellCheck:h,src:null,srcDoc:null,srcLang:null,srcSet:null,start:f,step:null,style:null,tabIndex:f,target:null,title:null,translate:null,type:null,typeMustMatch:d,useMap:null,value:h,width:f,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:m,axis:null,background:null,bgColor:null,border:f,borderColor:null,bottomMargin:f,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:d,declare:d,event:null,face:null,frame:null,frameBorder:null,hSpace:f,leftMargin:f,link:null,longDesc:null,lowSrc:null,marginHeight:f,marginWidth:f,noResize:d,noHref:d,noShade:d,noWrap:d,object:null,profile:null,prompt:null,rev:null,rightMargin:f,rules:null,scheme:null,scrolling:h,standby:null,summary:null,text:null,topMargin:f,valueType:null,version:null,vAlign:null,vLink:null,vSpace:f,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:d,disableRemotePlayback:d,prefix:null,property:null,results:f,security:null,unselectable:null},space:"html",transform:O}),D=R({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"},properties:{about:y,accentHeight:f,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:f,amplitude:f,arabicForm:null,ascent:f,attributeName:null,attributeType:null,azimuth:f,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:f,by:null,calcMode:null,capHeight:f,className:m,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:f,diffuseConstant:f,direction:null,display:null,dur:null,divisor:f,dominantBaseline:null,download:d,dx:null,dy:null,edgeMode:null,editable:null,elevation:f,enableBackground:null,end:null,event:null,exponent:f,externalResourcesRequired:null,fill:null,fillOpacity:f,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:g,g2:g,glyphName:g,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:f,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:f,horizOriginX:f,horizOriginY:f,id:null,ideographic:f,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:f,k:f,k1:f,k2:f,k3:f,k4:f,kernelMatrix:y,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:f,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:f,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:f,overlineThickness:f,paintOrder:null,panose1:null,path:null,pathLength:f,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:m,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:f,pointsAtY:f,pointsAtZ:f,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:y,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:y,rev:y,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:y,requiredFeatures:y,requiredFonts:y,requiredFormats:y,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:f,specularExponent:f,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:f,strikethroughThickness:f,string:null,stroke:null,strokeDashArray:y,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:f,strokeOpacity:f,strokeWidth:null,style:null,surfaceScale:f,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:y,tabIndex:f,tableValues:null,target:null,targetX:f,targetY:f,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:y,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:f,underlineThickness:f,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:f,values:null,vAlphabetic:f,vMathematical:f,vectorEffect:null,vHanging:f,vIdeographic:f,version:null,vertAdvY:f,vertOriginX:f,vertOriginY:f,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:f,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:N}),F=R({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),L=R({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:O}),B=R({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),z=A([M,P,F,L,B],"html"),U=A([M,D,F,L,B],"svg");var q=e.i(63185);let $=V("end"),H=V("start");function V(e){return function(t){let n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function Q(e){return e&&"object"==typeof e?"position"in e||"type"in e?K(e.position):"start"in e||"end"in e?K(e):"line"in e||"column"in e?W(e):"":""}function W(e){return G(e&&e.line)+":"+G(e&&e.column)}function K(e){return W(e&&e.start)+"-"+W(e&&e.end)}function G(e){return e&&"number"==typeof e?e:1}class J extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",i={},s=!1;if(t&&(i="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!i.cause&&e&&(s=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=o?o.line:void 0,this.name=Q(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}J.prototype.file="",J.prototype.name="",J.prototype.reason="",J.prototype.message="",J.prototype.stack="",J.prototype.column=void 0,J.prototype.line=void 0,J.prototype.ancestors=void 0,J.prototype.cause=void 0,J.prototype.fatal=void 0,J.prototype.place=void 0,J.prototype.ruleId=void 0,J.prototype.source=void 0;let Y={}.hasOwnProperty,X=new Map,Z=/[A-Z]/g,ee=new Set(["table","tbody","thead","tfoot","tr"]),et=new Set(["td","th"]),en="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function er(e,n,r){var i,s,o,a,c,d,h,p,f;let m,g,y,b,x,v,j,A,R,M,N;return"element"===n.type?(i=e,s=n,o=r,g=m=i.schema,"svg"===s.tagName.toLowerCase()&&"html"===m.space&&(i.schema=U),i.ancestors.push(s),y=ea(i,s.tagName,!1),b=function(e,t){let n,r,i={};for(r in t.properties)if("children"!==r&&Y.call(t.properties,r)){let s=function(e,t,n){let r=function(e,t){let n=S(t),r=t,i=u;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&E.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(_,T);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!_.test(e)){let n=e.replace(k,C);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}i=w}return new i(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){var i;let t;if(Array.isArray(n)&&(n=r.commaSeparated?(t={},(""===(i=n)[i.length-1]?[...i,""]:i).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()):n.join(" ").trim()),"style"===r.property){let t="object"==typeof n?n:function(e,t){try{return(0,q.default)(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};let t=new J("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=en+"#cannot-parse-style-attribute",t}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){let t,n={};for(t in e)Y.call(e,t)&&(n[function(e){let t=e.replace(Z,eu);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return n}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?I[r.property]||r.property:r.attribute,n]}}(e,r,t.properties[r]);if(s){let[r,o]=s;e.tableCellAlignToStyle&&"align"===r&&"string"==typeof o&&et.has(t.tagName)?n=o:i[r]=o}}return n&&((i.style||(i.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=n),i}(i,s),x=eo(i,s),ee.has(s.tagName)&&(x=x.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&l(e.value):l(e))})),ei(i,b,y,s),es(b,x),i.ancestors.pop(),i.schema=m,i.create(s,y,b,o)):"mdxFlowExpression"===n.type||"mdxTextExpression"===n.type?function(e,n){if(n.data&&n.data.estree&&e.evaluater){let r=n.data.estree.body[0];return t("ExpressionStatement"===r.type),e.evaluater.evaluateExpression(r.expression)}el(e,n.position)}(e,n):"mdxJsxFlowElement"===n.type||"mdxJsxTextElement"===n.type?(a=e,c=n,d=r,j=v=a.schema,"svg"===c.name&&"html"===v.space&&(a.schema=U),a.ancestors.push(c),A=null===c.name?a.Fragment:ea(a,c.name,!0),R=function(e,n){let r={};for(let i of n.attributes)if("mdxJsxExpressionAttribute"===i.type)if(i.data&&i.data.estree&&e.evaluater){let n=i.data.estree.body[0];t("ExpressionStatement"===n.type);let s=n.expression;t("ObjectExpression"===s.type);let o=s.properties[0];t("SpreadElement"===o.type),Object.assign(r,e.evaluater.evaluateExpression(o.argument))}else el(e,n.position);else{let s,o=i.name;if(i.value&&"object"==typeof i.value)if(i.value.data&&i.value.data.estree&&e.evaluater){let n=i.value.data.estree.body[0];t("ExpressionStatement"===n.type),s=e.evaluater.evaluateExpression(n.expression)}else el(e,n.position);else s=null===i.value||i.value;r[o]=s}return r}(a,c),M=eo(a,c),ei(a,R,A,c),es(R,M),a.ancestors.pop(),a.schema=v,a.create(c,A,R,d)):"mdxjsEsm"===n.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);el(e,t.position)}(e,n):"root"===n.type?(h=e,p=n,f=r,es(N={},eo(h,p)),h.create(p,h.Fragment,N,f)):"text"===n.type?n.value:void 0}function ei(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function es(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function eo(e,t){let n=[],r=-1,i=e.passKeys?new Map:X;for(;++r<t.children.length;){let s,o=t.children[r];if(e.passKeys){let e="element"===o.type?o.tagName:"mdxJsxFlowElement"===o.type||"mdxJsxTextElement"===o.type?o.name:void 0;if(e){let t=i.get(e)||0;s=e+"-"+t,i.set(e,t+1)}}let a=er(e,o,s);void 0!==a&&n.push(a)}return n}function ea(e,n,r){let i;if(r)if(n.includes(".")){let e,r=n.split("."),s=-1;for(;++s<r.length;){let t=o(r[s])?{type:"Identifier",name:r[s]}:{type:"Literal",value:r[s]};e=e?{type:"MemberExpression",object:e,property:t,computed:!!(s&&"Literal"===t.type),optional:!1}:t}t(e,"always a result"),i=e}else i=o(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};else i={type:"Literal",value:n};if("Literal"===i.type){let t=i.value;return Y.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(i);el(e)}function el(e,t){let n=new J("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=en+"#cannot-handle-mdx-estrees-without-createevaluater",n}function eu(e){return"-"+e.toLowerCase()}let ec={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]};var ed=e.i(20314);e.i(79054);let eh={};function ep(e,t){let n=t||eh;return ef(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function ef(e,t,n){var r;if((r=e)&&"object"==typeof r){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return em(e.children,t,n)}return Array.isArray(e)?em(e,t,n):""}function em(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=ef(e[i],t,n);return r.join("")}function eg(e,t,n,r){let i,s=e.length,o=0;if(t=t<0?-t>s?0:s+t:t>s?s:t,n=n>0?n:0,r.length<1e4)(i=Array.from(r)).unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);o<r.length;)(i=r.slice(o,o+1e4)).unshift(t,0),e.splice(...i),o+=1e4,t+=1e4}function ey(e,t){return e.length>0?(eg(e,e.length,0,t),e):t}e.s(["toString",()=>ep],12105),e.s(["push",()=>ey,"splice",()=>eg],59245);let eb={}.hasOwnProperty;function ex(e){let t={},n=-1;for(;++n<e.length;)!function(e,t){let n;for(n in t){let r,i=(eb.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];if(s)for(r in s){eb.call(i,r)||(i[r]=[]);let e=s[r];!function(e,t){let n=-1,r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);eg(e,0,0,r)}(i[r],Array.isArray(e)?e:e?[e]:[])}}}(t,e[n]);return t}e.s(["combineExtensions",()=>ex],44819);let ev=eM(/[A-Za-z]/),ew=eM(/[\dA-Za-z]/),eS=eM(/[#-'*+\--9=?A-Z^-~]/);function ek(e){return null!==e&&(e<32||127===e)}let e_=eM(/\d/),eE=eM(/[\dA-Fa-f]/),eC=eM(/[!-/:-@[-`{-~]/);function eT(e){return null!==e&&e<-2}function eI(e){return null!==e&&(e<0||32===e)}function ej(e){return -2===e||-1===e||32===e}let eA=eM(/\p{P}|\p{S}/u),eR=eM(/\s/);function eM(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function eN(e,t,n,r){let i=r?r-1:1/0,s=0;return function(r){return ej(r)?(e.enter(n),function r(o){return ej(o)&&s++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}e.s(["asciiAlpha",0,ev,"asciiAlphanumeric",0,ew,"asciiAtext",0,eS,"asciiControl",()=>ek,"asciiDigit",0,e_,"asciiHexDigit",0,eE,"asciiPunctuation",0,eC,"markdownLineEnding",()=>eT,"markdownLineEndingOrSpace",()=>eI,"markdownSpace",()=>ej,"unicodePunctuation",0,eA,"unicodeWhitespace",0,eR],55470),e.s(["factorySpace",()=>eN],33220);let eO={tokenize:function(e){let t,n=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),eN(e,n,"linePrefix"))},function(n){return e.enter("paragraph"),function n(r){let i=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=i),t=i,function t(r){if(null===r){e.exit("chunkText"),e.exit("paragraph"),e.consume(r);return}return eT(r)?(e.consume(r),e.exit("chunkText"),n):(e.consume(r),t)}(r)}(n)});return n}},eP={tokenize:function(e){let t,n,r,i=this,s=[],o=0;return a;function a(t){if(o<s.length){let n=s[o];return i.containerState=n[1],e.attempt(n[0].continuation,l,u)(t)}return u(t)}function l(e){if(o++,i.containerState._closeFlow){let n;i.containerState._closeFlow=void 0,t&&y();let r=i.events.length,s=r;for(;s--;)if("exit"===i.events[s][0]&&"chunkFlow"===i.events[s][1].type){n=i.events[s][1].end;break}g(o);let a=r;for(;a<i.events.length;)i.events[a][1].end={...n},a++;return eg(i.events,s+1,0,i.events.slice(r)),i.events.length=a,u(e)}return a(e)}function u(n){if(o===s.length){if(!t)return h(n);if(t.currentConstruct&&t.currentConstruct.concrete)return f(n);i.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(eD,c,d)(n)}function c(e){return t&&y(),g(o),h(e)}function d(e){return i.parser.lazy[i.now().line]=o!==s.length,r=i.now().offset,f(e)}function h(t){return i.containerState={},e.attempt(eD,p,f)(t)}function p(e){return o++,s.push([i.currentConstruct,i.containerState]),h(e)}function f(r){if(null===r){t&&y(),g(0),e.consume(r);return}return t=t||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:n}),function t(n){if(null===n){m(e.exit("chunkFlow"),!0),g(0),e.consume(n);return}return eT(n)?(e.consume(n),m(e.exit("chunkFlow")),o=0,i.interrupt=void 0,a):(e.consume(n),t)}(r)}function m(e,s){let a=i.sliceStream(e);if(s&&a.push(null),e.previous=n,n&&(n.next=e),n=e,t.defineSkip(e.start),t.write(a),i.parser.lazy[e.start.line]){let e,n,s=t.events.length;for(;s--;)if(t.events[s][1].start.offset<r&&(!t.events[s][1].end||t.events[s][1].end.offset>r))return;let a=i.events.length,l=a;for(;l--;)if("exit"===i.events[l][0]&&"chunkFlow"===i.events[l][1].type){if(e){n=i.events[l][1].end;break}e=!0}for(g(o),s=a;s<i.events.length;)i.events[s][1].end={...n},s++;eg(i.events,l+1,0,i.events.slice(a)),i.events.length=s}}function g(t){let n=s.length;for(;n-- >t;){let t=s[n];i.containerState=t[1],t[0].exit.call(i,e)}s.length=t}function y(){t.write([null]),n=void 0,t=void 0,i.containerState._closeFlow=void 0}}},eD={tokenize:function(e,t,n){return eN(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},eF={partial:!0,tokenize:function(e,t,n){return function(t){return ej(t)?eN(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||eT(e)?t(e):n(e)}}};e.s(["blankLine",0,eF],51256);class eL{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=null==t?1/0:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){this.setCursor(Math.trunc(e));let r=this.right.splice(this.right.length-(t||0),1/0);return n&&eB(this.left,n),r.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),eB(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),eB(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);eB(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);eB(this.left,t.reverse())}}}function eB(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function ez(e){let t,n,r,i,s,o,a,l={},u=-1,c=new eL(e);for(;++u<c.length;){for(;u in l;)u=l[u];if(t=c.get(u),u&&"chunkFlow"===t[1].type&&"listItemPrefix"===c.get(u-1)[1].type&&((r=0)<(o=t[1]._tokenizer.events).length&&"lineEndingBlank"===o[r][1].type&&(r+=2),r<o.length&&"content"===o[r][1].type))for(;++r<o.length&&"content"!==o[r][1].type;)"chunkText"===o[r][1].type&&(o[r][1]._isInFirstContentOfListItem=!0,r++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let n,r,i=e.get(t)[1],s=e.get(t)[2],o=t-1,a=[],l=i._tokenizer;!l&&(l=s.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let u=l.events,c=[],d={},h=-1,p=i,f=0,m=0,g=[0];for(;p;){for(;e.get(++o)[1]!==p;);a.push(o),!p._tokenizer&&(n=s.sliceStream(p),p.next||n.push(null),r&&l.defineSkip(p.start),p._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(n),p._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),r=p,p=p.next}for(p=i;++h<u.length;)"exit"===u[h][0]&&"enter"===u[h-1][0]&&u[h][1].type===u[h-1][1].type&&u[h][1].start.line!==u[h][1].end.line&&(m=h+1,g.push(m),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(l.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),h=g.length;h--;){let t=u.slice(g[h],g[h+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),h=-1;++h<c.length;)d[f+c[h][0]]=f+c[h][1],f+=c[h][1]-c[h][0]-1;return d}(c,u)),u=l[u],a=!0);else if(t[1]._container){for(r=u,n=void 0;r--;)if("lineEnding"===(i=c.get(r))[1].type||"lineEndingBlank"===i[1].type)"enter"===i[0]&&(n&&(c.get(n)[1].type="lineEndingBlank"),i[1].type="lineEnding",n=r);else if("linePrefix"===i[1].type||"listItemIndent"===i[1].type);else break;n&&(t[1].end={...c.get(n)[1].start},(s=c.slice(n,u)).unshift(t),c.splice(n,u-n+1,s))}}return eg(e,0,1/0,c.slice(0)),!a}let eU={resolve:function(e){return ez(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?i(t):eT(t)?e.check(eq,s,i)(t):(e.consume(t),r)}function i(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function s(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},eq={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),eN(e,i,"linePrefix")};function i(i){if(null===i||eT(i))return n(i);let s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&"linePrefix"===s[1].type&&s[2].sliceSerialize(s[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}},e$={tokenize:function(e){let t=this,n=e.attempt(eF,function(r){return null===r?void e.consume(r):(e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n)},e.attempt(this.parser.constructs.flowInitial,r,eN(e,e.attempt(this.parser.constructs.flow,r,e.attempt(eU,r)),"linePrefix")));return n;function r(r){return null===r?void e.consume(r):(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n)}}},eH={resolveAll:eK()},eV=eW("string"),eQ=eW("text");function eW(e){return{resolveAll:eK("text"===e?eG:void 0),tokenize:function(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,s,o);return s;function s(e){return l(e)?i(e):o(e)}function o(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),a)}function a(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),a)}function l(e){if(null===e)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function eK(e){return function(t,n){let r,i=-1;for(;++i<=t.length;)void 0===r?t[i]&&"data"===t[i][1].type&&(r=i,i++):t[i]&&"data"===t[i][1].type||(i!==r+2&&(t[r][1].end=t[i-1][1].end,t.splice(r+2,i-r-2),i=r+2),r=void 0);return e?e(t,n):t}}function eG(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){let r,i=e[n-1][1],s=t.sliceStream(i),o=s.length,a=-1,l=0;for(;o--;){let e=s[o];if("string"==typeof e){for(a=e.length;32===e.charCodeAt(a-1);)l++,a--;if(a)break;a=-1}else if(-2===e)r=!0,l++;else if(-1===e);else{o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){let s={type:n===e.length||r||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?a:i.start._bufferIndex+a,_index:i.start._index+o,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...s.start},i.start.offset===i.end.offset?Object.assign(i,s):(e.splice(n,0,["enter",s,t],["exit",s,t]),n+=2)}n++}return e}function eJ(e){return null===e||eI(e)||eR(e)?1:eA(e)?2:void 0}function eY(e,t,n){let r=[],i=-1;for(;++i<e.length;){let s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}e.s(["classifyCharacter",()=>eJ],27066),e.s(["resolveAll",()=>eY],5568);let eX={name:"attention",resolveAll:function(e,t){let n,r,i,s,o,a,l,u,c=-1;for(;++c<e.length;)if("enter"===e[c][0]&&"attentionSequence"===e[c][1].type&&e[c][1]._close){for(n=c;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[c][1]).charCodeAt(0)){if((e[n][1]._close||e[c][1]._open)&&(e[c][1].end.offset-e[c][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[c][1].end.offset-e[c][1].start.offset)%3))continue;a=e[n][1].end.offset-e[n][1].start.offset>1&&e[c][1].end.offset-e[c][1].start.offset>1?2:1;let d={...e[n][1].end},h={...e[c][1].start};eZ(d,-a),eZ(h,a),s={type:a>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},o={type:a>1?"strongSequence":"emphasisSequence",start:{...e[c][1].start},end:h},i={type:a>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[c][1].start}},r={type:a>1?"strong":"emphasis",start:{...s.start},end:{...o.end}},e[n][1].end={...s.start},e[c][1].start={...o.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=ey(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=ey(l,[["enter",r,t],["enter",s,t],["exit",s,t],["enter",i,t]]),l=ey(l,eY(t.parser.constructs.insideSpan.null,e.slice(n+1,c),t)),l=ey(l,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",r,t]]),e[c][1].end.offset-e[c][1].start.offset?(u=2,l=ey(l,[["enter",e[c][1],t],["exit",e[c][1],t]])):u=0,eg(e,n-1,c-n+3,l),c=n+l.length-u-2;break}}for(c=-1;++c<e.length;)"attentionSequence"===e[c][1].type&&(e[c][1].type="data");return e},tokenize:function(e,t){let n,r=this.parser.constructs.attentionMarkers.null,i=this.previous,s=eJ(i);return function(o){return n=o,e.enter("attentionSequence"),function o(a){if(a===n)return e.consume(a),o;let l=e.exit("attentionSequence"),u=eJ(a),c=!u||2===u&&s||r.includes(a),d=!s||2===s&&u||r.includes(i);return l._open=!!(42===n?c:c&&(s||!d)),l._close=!!(42===n?d:d&&(u||!c)),t(a)}(o)}}};function eZ(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let e0={continuation:{tokenize:function(e,t,n){let r=this;return function(t){return ej(t)?eN(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(r){return e.attempt(e0,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){let r=this;return function(t){if(62===t){let n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return n(t)};function i(n){return ej(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}},e1={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return eC(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}},e2=document.createElement("i");function e5(e){let t="&"+e+";";e2.innerHTML=t;let n=e2.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}let e3={name:"characterReference",tokenize:function(e,t,n){let r,i,s=this,o=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),a};function a(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),r=31,i=ew,u(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),r=6,i=eE,u):(e.enter("characterReferenceValue"),r=7,i=e_,u(t))}function u(a){if(59===a&&o){let r=e.exit("characterReferenceValue");return i!==ew||e5(s.sliceSerialize(r))?(e.enter("characterReferenceMarker"),e.consume(a),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(a)}return i(a)&&o++<r?(e.consume(a),u):n(a)}}},e4={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},e6={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){let r,i=this,s={partial:!0,tokenize:function(e,t,n){let s=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o};function o(t){return e.enter("codeFencedFence"),ej(t)?eN(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===r?(e.enter("codeFencedFenceSequence"),function t(i){return i===r?(s++,e.consume(i),t):s>=a?(e.exit("codeFencedFenceSequence"),ej(i)?eN(e,u,"whitespace")(i):u(i)):n(i)}(t)):n(t)}function u(r){return null===r||eT(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}},o=0,a=0;return function(t){var s;let u;return s=t,o=(u=i.events[i.events.length-1])&&"linePrefix"===u[1].type?u[2].sliceSerialize(u[1],!0).length:0,r=s,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(i){return i===r?(a++,e.consume(i),t):a<3?n(i):(e.exit("codeFencedFenceSequence"),ej(i)?eN(e,l,"whitespace")(i):l(i))}(s)};function l(s){return null===s||eT(s)?(e.exit("codeFencedFence"),i.interrupt?t(s):e.check(e4,c,f)(s)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||eT(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(i)):ej(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),eN(e,u,"whitespace")(i)):96===i&&i===r?n(i):(e.consume(i),t)}(s))}function u(t){return null===t||eT(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||eT(i)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(i)):96===i&&i===r?n(i):(e.consume(i),t)}(t))}function c(t){return e.attempt(s,f,d)(t)}function d(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h}function h(t){return o>0&&ej(t)?eN(e,p,"linePrefix",o+1)(t):p(t)}function p(t){return null===t||eT(t)?e.check(e4,c,f)(t):(e.enter("codeFlowValue"),function t(n){return null===n||eT(n)?(e.exit("codeFlowValue"),p(n)):(e.consume(n),t)}(t))}function f(n){return e.exit("codeFenced"),t(n)}}},e8={name:"codeIndented",tokenize:function(e,t,n){let r=this;return function(t){return e.enter("codeIndented"),eN(e,i,"linePrefix",5)(t)};function i(t){let i=r.events[r.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?function t(n){return null===n?s(n):eT(n)?e.attempt(e9,t,s)(n):(e.enter("codeFlowValue"),function n(r){return null===r||eT(r)?(e.exit("codeFlowValue"),t(r)):(e.consume(r),n)}(n))}(t):n(t)}function s(n){return e.exit("codeIndented"),t(n)}}},e9={partial:!0,tokenize:function(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):eT(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):eN(e,s,"linePrefix",5)(t)}function s(e){let s=r.events[r.events.length-1];return s&&"linePrefix"===s[1].type&&s[2].sliceSerialize(s[1],!0).length>=4?t(e):eT(e)?i(e):n(e)}}};function e7(e,t,n,r,i,s,o,a,l){let u=l||1/0,c=0;return function(t){return 60===t?(e.enter(r),e.enter(i),e.enter(s),e.consume(t),e.exit(s),d):null===t||32===t||41===t||ek(t)?n(t):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),f(t))};function d(n){return 62===n?(e.enter(s),e.consume(n),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(n))}function h(t){return 62===t?(e.exit("chunkString"),e.exit(a),d(t)):null===t||60===t||eT(t)?n(t):(e.consume(t),92===t?p:h)}function p(t){return 60===t||62===t||92===t?(e.consume(t),h):h(t)}function f(i){return!c&&(null===i||41===i||eI(i))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(i)):c<u&&40===i?(e.consume(i),c++,f):41===i?(e.consume(i),c--,f):null===i||32===i||40===i||ek(i)?n(i):(e.consume(i),92===i?m:f)}function m(t){return 40===t||41===t||92===t?(e.consume(t),f):f(t)}}function te(e,t,n,r,i,s){let o,a=this,l=0;return function(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(s),u};function u(d){return l>999||null===d||91===d||93===d&&!o||94===d&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(d):93===d?(e.exit(s),e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):eT(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),c(d))}function c(t){return null===t||91===t||93===t||eT(t)||l++>999?(e.exit("chunkString"),u(t)):(e.consume(t),o||(o=!ej(t)),92===t?d:c)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,c):c(t)}}function tt(e,t,n,r,i,s){let o;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=40===t?41:t,a):n(t)};function a(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(s),l(n))}function l(t){return t===o?(e.exit(s),a(o)):null===t?n(t):eT(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),eN(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(t))}function u(t){return t===o||null===t||eT(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?c:u)}function c(t){return t===o||92===t?(e.consume(t),u):u(t)}}function tn(e,t){let n;return function r(i){return eT(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):ej(i)?eN(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}function tr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}e.s(["normalizeIdentifier",()=>tr],84484);let ti={partial:!0,tokenize:function(e,t,n){return function(t){return eI(t)?tn(e,r)(t):n(t)};function r(t){return tt(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return ej(t)?eN(e,s,"whitespace")(t):s(t)}function s(e){return null===e||eT(e)?t(e):n(e)}}},ts=["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"],to=["pre","script","style","textarea"],ta={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(eF,t,n)}}},tl={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return eT(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):n(t)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},tu={name:"labelEnd",resolveAll:function(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){let e="labelImage"===r.type?4:2;r.type="data",t+=e}}return e.length!==n.length&&eg(e,0,e.length,n),e},resolveTo:function(e,t){let n,r,i,s,o=e.length,a=0;for(;o--;)if(n=e[o][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[o][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(i){if("enter"===e[o][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=o,"labelLink"!==n.type)){a=2;break}}else"labelEnd"===n.type&&(i=o);let l={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[r][1].start},end:{...e[i][1].end}},c={type:"labelText",start:{...e[r+a+2][1].end},end:{...e[i-2][1].start}};return s=ey(s=[["enter",l,t],["enter",u,t]],e.slice(r+1,r+a+3)),s=ey(s,[["enter",c,t]]),s=ey(s,eY(t.parser.constructs.insideSpan.null,e.slice(r+a+4,i-3),t)),s=ey(s,[["exit",c,t],e[i-2],e[i-1],["exit",u,t]]),s=ey(s,e.slice(i+1)),s=ey(s,[["exit",l,t]]),eg(e,r,e.length,s),e},tokenize:function(e,t,n){let r,i,s=this,o=s.events.length;for(;o--;)if(("labelImage"===s.events[o][1].type||"labelLink"===s.events[o][1].type)&&!s.events[o][1]._balanced){r=s.events[o][1];break}return function(t){return r?r._inactive?c(t):(i=s.parser.defined.includes(tr(s.sliceSerialize({start:r.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),a):n(t)};function a(t){return 40===t?e.attempt(tc,u,i?u:c)(t):91===t?e.attempt(td,u,i?l:c)(t):i?u(t):c(t)}function l(t){return e.attempt(th,u,c)(t)}function u(e){return t(e)}function c(e){return r._balanced=!0,n(e)}}},tc={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return eI(t)?tn(e,i)(t):i(t)}function i(t){return 41===t?u(t):e7(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function s(t){return eI(t)?tn(e,a)(t):u(t)}function o(e){return n(e)}function a(t){return 34===t||39===t||40===t?tt(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):u(t)}function l(t){return eI(t)?tn(e,u)(t):u(t)}function u(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},td={tokenize:function(e,t,n){let r=this;return function(t){return te.call(r,e,i,s,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes(tr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function s(e){return n(e)}}},th={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}},tp={name:"labelStartImage",resolveAll:tu.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),s):n(t)}function s(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},tf={name:"labelStartLink",resolveAll:tu.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},tm={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),eN(e,t,"linePrefix")}}},tg={name:"thematicBreak",tokenize:function(e,t,n){let r,i=0;return function(s){var o;return e.enter("thematicBreak"),r=o=s,function s(o){return o===r?(e.enter("thematicBreakSequence"),function t(n){return n===r?(e.consume(n),i++,t):(e.exit("thematicBreakSequence"),ej(n)?eN(e,s,"whitespace")(n):s(n))}(o)):i>=3&&(null===o||eT(o))?(e.exit("thematicBreak"),t(o)):n(o)}(o)}}},ty={continuation:{tokenize:function(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(eF,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,eN(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!ej(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(tx,t,i)(n))});function i(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,eN(e,e.attempt(ty,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){let r=this,i=r.events[r.events.length-1],s=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,o=0;return function(t){let i=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!r.containerState.marker||t===r.containerState.marker:e_(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(tg,n,a)(t):a(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(i){return e_(i)&&++o<10?(e.consume(i),t):(!r.interrupt||o<2)&&(r.containerState.marker?i===r.containerState.marker:41===i||46===i)?(e.exit("listItemValue"),a(i)):n(i)}(t)}return n(t)};function a(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(eF,r.interrupt?n:l,e.attempt(tb,c,u))}function l(e){return r.containerState.initialBlankLine=!0,s++,c(e)}function u(t){return ej(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),c):n(t)}function c(n){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},tb={partial:!0,tokenize:function(e,t,n){let r=this;return eN(e,function(e){let i=r.events[r.events.length-1];return!ej(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},tx={partial:!0,tokenize:function(e,t,n){let r=this;return eN(e,function(e){let i=r.events[r.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}},tv={name:"setextUnderline",resolveTo:function(e,t){let n,r,i,s=e.length;for(;s--;)if("enter"===e[s][0]){if("content"===e[s][1].type){n=s;break}"paragraph"===e[s][1].type&&(r=s)}else"content"===e[s][1].type&&e.splice(s,1),i||"definition"!==e[s][1].type||(i=s);let o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",o,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=o,e.push(["exit",o,t]),e},tokenize:function(e,t,n){let r,i=this;return function(t){var o;let a,l=i.events.length;for(;l--;)if("lineEnding"!==i.events[l][1].type&&"linePrefix"!==i.events[l][1].type&&"content"!==i.events[l][1].type){a="paragraph"===i.events[l][1].type;break}return!i.parser.lazy[i.now().line]&&(i.interrupt||a)?(e.enter("setextHeadingLine"),r=t,o=t,e.enter("setextHeadingLineSequence"),function t(n){return n===r?(e.consume(n),t):(e.exit("setextHeadingLineSequence"),ej(n)?eN(e,s,"lineSuffix")(n):s(n))}(o)):n(t)};function s(r){return null===r||eT(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,t,n){let r,i=this;return function(t){var r;return e.enter("definition"),r=t,te.call(i,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(r)};function s(t){return(r=tr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o):n(t)}function o(t){return eI(t)?tn(e,a)(t):a(t)}function a(t){return e7(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(ti,u,u)(t)}function u(t){return ej(t)?eN(e,c,"whitespace")(t):c(t)}function c(s){return null===s||eT(s)?(e.exit("definition"),i.parser.defined.push(r),t(s)):n(s)}}}},"disable",0,{null:[]},"document",0,{42:ty,43:ty,45:ty,48:ty,49:ty,50:ty,51:ty,52:ty,53:ty,54:ty,55:ty,56:ty,57:ty,62:e0},"flow",0,{35:{name:"headingAtx",resolve:function(e,t){let n,r,i=e.length-2,s=3;return"whitespace"===e[3][1].type&&(s+=2),i-2>s&&"whitespace"===e[i][1].type&&(i-=2),"atxHeadingSequence"===e[i][1].type&&(s===i-1||i-4>s&&"whitespace"===e[i-2][1].type)&&(i-=s+1===i?2:4),i>s&&(n={type:"atxHeadingText",start:e[s][1].start,end:e[i][1].end},r={type:"chunkText",start:e[s][1].start,end:e[i][1].end,contentType:"text"},eg(e,s,i-s+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e},tokenize:function(e,t,n){let r=0;return function(i){var s;return e.enter("atxHeading"),s=i,e.enter("atxHeadingSequence"),function i(s){return 35===s&&r++<6?(e.consume(s),i):null===s||eI(s)?(e.exit("atxHeadingSequence"),function n(r){return 35===r?(e.enter("atxHeadingSequence"),function t(r){return 35===r?(e.consume(r),t):(e.exit("atxHeadingSequence"),n(r))}(r)):null===r||eT(r)?(e.exit("atxHeading"),t(r)):ej(r)?eN(e,n,"whitespace")(r):(e.enter("atxHeadingText"),function t(r){return null===r||35===r||eI(r)?(e.exit("atxHeadingText"),n(r)):(e.consume(r),t)}(r))}(s)):n(s)}(s)}}},42:tg,45:[tv,tg],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},tokenize:function(e,t,n){let r,i,s,o,a,l=this;return function(t){var n;return n=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(n),u};function u(o){return 33===o?(e.consume(o),c):47===o?(e.consume(o),i=!0,p):63===o?(e.consume(o),r=3,l.interrupt?t:M):ev(o)?(e.consume(o),s=String.fromCharCode(o),f):n(o)}function c(i){return 45===i?(e.consume(i),r=2,d):91===i?(e.consume(i),r=5,o=0,h):ev(i)?(e.consume(i),r=4,l.interrupt?t:M):n(i)}function d(r){return 45===r?(e.consume(r),l.interrupt?t:M):n(r)}function h(r){let i="CDATA[";return r===i.charCodeAt(o++)?(e.consume(r),o===i.length)?l.interrupt?t:_:h:n(r)}function p(t){return ev(t)?(e.consume(t),s=String.fromCharCode(t),f):n(t)}function f(o){if(null===o||47===o||62===o||eI(o)){let a=47===o,u=s.toLowerCase();return!a&&!i&&to.includes(u)?(r=1,l.interrupt?t(o):_(o)):ts.includes(s.toLowerCase())?(r=6,a)?(e.consume(o),m):l.interrupt?t(o):_(o):(r=7,l.interrupt&&!l.parser.lazy[l.now().line]?n(o):i?function t(n){return ej(n)?(e.consume(n),t):S(n)}(o):g(o))}return 45===o||ew(o)?(e.consume(o),s+=String.fromCharCode(o),f):n(o)}function m(r){return 62===r?(e.consume(r),l.interrupt?t:_):n(r)}function g(t){return 47===t?(e.consume(t),S):58===t||95===t||ev(t)?(e.consume(t),y):ej(t)?(e.consume(t),g):S(t)}function y(t){return 45===t||46===t||58===t||95===t||ew(t)?(e.consume(t),y):b(t)}function b(t){return 61===t?(e.consume(t),x):ej(t)?(e.consume(t),b):g(t)}function x(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),a=t,v):ej(t)?(e.consume(t),x):function t(n){return null===n||34===n||39===n||47===n||60===n||61===n||62===n||96===n||eI(n)?b(n):(e.consume(n),t)}(t)}function v(t){return t===a?(e.consume(t),a=null,w):null===t||eT(t)?n(t):(e.consume(t),v)}function w(e){return 47===e||62===e||ej(e)?g(e):n(e)}function S(t){return 62===t?(e.consume(t),k):n(t)}function k(t){return null===t||eT(t)?_(t):ej(t)?(e.consume(t),k):n(t)}function _(t){return 45===t&&2===r?(e.consume(t),I):60===t&&1===r?(e.consume(t),j):62===t&&4===r?(e.consume(t),N):63===t&&3===r?(e.consume(t),M):93===t&&5===r?(e.consume(t),R):eT(t)&&(6===r||7===r)?(e.exit("htmlFlowData"),e.check(ta,O,E)(t)):null===t||eT(t)?(e.exit("htmlFlowData"),E(t)):(e.consume(t),_)}function E(t){return e.check(tl,C,O)(t)}function C(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),T}function T(t){return null===t||eT(t)?E(t):(e.enter("htmlFlowData"),_(t))}function I(t){return 45===t?(e.consume(t),M):_(t)}function j(t){return 47===t?(e.consume(t),s="",A):_(t)}function A(t){if(62===t){let n=s.toLowerCase();return to.includes(n)?(e.consume(t),N):_(t)}return ev(t)&&s.length<8?(e.consume(t),s+=String.fromCharCode(t),A):_(t)}function R(t){return 93===t?(e.consume(t),M):_(t)}function M(t){return 62===t?(e.consume(t),N):45===t&&2===r?(e.consume(t),M):_(t)}function N(t){return null===t||eT(t)?(e.exit("htmlFlowData"),O(t)):(e.consume(t),N)}function O(n){return e.exit("htmlFlow"),t(n)}}},61:tv,95:tg,96:e6,126:e6},"flowInitial",0,{[-2]:e8,[-1]:e8,32:e8},"insideSpan",0,{null:[eX,eH]},"string",0,{38:e3,92:e1},"text",0,{[-5]:tm,[-4]:tm,[-3]:tm,33:tp,38:e3,42:eX,60:[{name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return ev(t)?(e.consume(t),s):64===t?n(t):a(t)}function s(t){return 43===t||45===t||46===t||ew(t)?(r=1,function t(n){return 58===n?(e.consume(n),r=0,o):(43===n||45===n||46===n||ew(n))&&r++<32?(e.consume(n),t):(r=0,a(n))}(t)):a(t)}function o(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||ek(r)?n(r):(e.consume(r),o)}function a(t){return 64===t?(e.consume(t),l):eS(t)?(e.consume(t),a):n(t)}function l(i){return ew(i)?function i(s){return 46===s?(e.consume(s),r=0,l):62===s?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(s),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(s){if((45===s||ew(s))&&r++<63){let n=45===s?t:i;return e.consume(s),n}return n(s)}(s)}(i):n(i)}}},{name:"htmlText",tokenize:function(e,t,n){let r,i,s,o=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),a};function a(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),v):63===t?(e.consume(t),b):ev(t)?(e.consume(t),S):n(t)}function l(t){return 45===t?(e.consume(t),u):91===t?(e.consume(t),i=0,p):ev(t)?(e.consume(t),y):n(t)}function u(t){return 45===t?(e.consume(t),h):n(t)}function c(t){return null===t?n(t):45===t?(e.consume(t),d):eT(t)?(s=c,A(t)):(e.consume(t),c)}function d(t){return 45===t?(e.consume(t),h):c(t)}function h(e){return 62===e?j(e):45===e?d(e):c(e)}function p(t){let r="CDATA[";return t===r.charCodeAt(i++)?(e.consume(t),i===r.length?f:p):n(t)}function f(t){return null===t?n(t):93===t?(e.consume(t),m):eT(t)?(s=f,A(t)):(e.consume(t),f)}function m(t){return 93===t?(e.consume(t),g):f(t)}function g(t){return 62===t?j(t):93===t?(e.consume(t),g):f(t)}function y(t){return null===t||62===t?j(t):eT(t)?(s=y,A(t)):(e.consume(t),y)}function b(t){return null===t?n(t):63===t?(e.consume(t),x):eT(t)?(s=b,A(t)):(e.consume(t),b)}function x(e){return 62===e?j(e):b(e)}function v(t){return ev(t)?(e.consume(t),w):n(t)}function w(t){return 45===t||ew(t)?(e.consume(t),w):function t(n){return eT(n)?(s=t,A(n)):ej(n)?(e.consume(n),t):j(n)}(t)}function S(t){return 45===t||ew(t)?(e.consume(t),S):47===t||62===t||eI(t)?k(t):n(t)}function k(t){return 47===t?(e.consume(t),j):58===t||95===t||ev(t)?(e.consume(t),_):eT(t)?(s=k,A(t)):ej(t)?(e.consume(t),k):j(t)}function _(t){return 45===t||46===t||58===t||95===t||ew(t)?(e.consume(t),_):function t(n){return 61===n?(e.consume(n),E):eT(n)?(s=t,A(n)):ej(n)?(e.consume(n),t):k(n)}(t)}function E(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),r=t,C):eT(t)?(s=E,A(t)):ej(t)?(e.consume(t),E):(e.consume(t),T)}function C(t){return t===r?(e.consume(t),r=void 0,I):null===t?n(t):eT(t)?(s=C,A(t)):(e.consume(t),C)}function T(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||eI(t)?k(t):(e.consume(t),T)}function I(e){return 47===e||62===e||eI(e)?k(e):n(e)}function j(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function A(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),R}function R(t){return ej(t)?eN(e,M,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):M(t)}function M(t){return e.enter("htmlTextData"),s(t)}}}],91:tf,92:[{name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return eT(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},e1],93:tu,95:eX,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[r][1].type||"space"===e[r][1].type)){for(t=i;++t<r;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(t=i-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):(t===r||"lineEnding"===e[t][1].type)&&(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,i,s=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(n){return 96===n?(e.consume(n),s++,t):(e.exit("codeTextSequence"),o(n))}(t)};function o(l){return null===l?n(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),o):96===l?(i=e.enter("codeTextSequence"),r=0,function n(o){return 96===o?(e.consume(o),r++,n):r===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(o)):(i.type="codeTextData",a(o))}(l)):eT(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):(e.enter("codeTextData"),a(l))}function a(t){return null===t||32===t||96===t||eT(t)?(e.exit("codeTextData"),o(t)):(e.consume(t),a)}}}}],19210);var tw=e.i(19210);let tS=/[\0\t\n\r]/g;function tk(e,t){let n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(65535&n)==65535||(65535&n)==65534||n>1114111?"�":String.fromCodePoint(n)}let t_=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function tE(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){let e=n.charCodeAt(1),t=120===e||88===e;return tk(n.slice(t?2:1),t?16:10)}return e5(n)||e}let tC={}.hasOwnProperty;function tT(e){return{line:e.line,column:e.column,offset:e.offset}}function tI(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+Q({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Q({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+Q({start:t.start,end:t.end})+") is still open")}function tj(e){let t=this;t.parser=function(n){var r,i;let s,o,a,l;return"object"==typeof(r={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(i=r,r=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:r(y),autolinkProtocol:u,autolinkEmail:u,atxHeading:r(f),blockQuote:r(function(){return{type:"blockquote",children:[]}}),characterEscape:u,characterReference:u,codeFenced:r(p),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:r(p,i),codeText:r(function(){return{type:"inlineCode",value:""}},i),codeTextData:u,data:u,codeFlowValue:u,definition:r(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:r(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:r(m),hardBreakTrailing:r(m),htmlFlow:r(g,i),htmlFlowData:u,htmlText:r(g,i),htmlTextData:u,image:r(function(){return{type:"image",title:null,url:"",alt:null}}),label:i,link:r(y),listItem:r(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:r(b,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:r(b),paragraph:r(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:r(f),strong:r(function(){return{type:"strong",children:[]}}),thematicBreak:r(function(){return{type:"thematicBreak"}})},exit:{atxHeading:o(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:o(),autolinkEmail:function(e){c.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){c.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:o(),characterEscapeValue:c,characterReferenceMarkerHexadecimal:h,characterReferenceMarkerNumeric:h,characterReferenceValue:function(e){let t,n=this.sliceSerialize(e),r=this.data.characterReferenceType;r?(t=tk(n,"characterReferenceMarkerNumeric"===r?10:16),this.data.characterReferenceType=void 0):t=e5(n);let i=this.stack[this.stack.length-1];i.value+=t},characterReference:function(e){this.stack.pop().position.end=tT(e.end)},codeFenced:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:c,codeIndented:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:c,data:c,definition:o(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=tr(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:o(),hardBreakEscape:o(d),hardBreakTrailing:o(d),htmlFlow:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:c,htmlText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:c,image:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===n.type?n.children=e.children:n.alt=t},labelText:function(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=t.replace(t_,tE),n.identifier=tr(t).toLowerCase()},lineEnding:function(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){n.children[n.children.length-1].position.end=tT(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(u.call(this,e),c.call(this,e))},link:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=tr(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:o(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:o(),thematicBreak:o()}};!function e(t,n){let r=-1;for(;++r<n.length;){let i=n[r];Array.isArray(i)?e(t,i):function(e,t){let n;for(n in t)if(tC.call(t,n))switch(n){case"canContainEols":{let r=t[n];r&&e[n].push(...r);break}case"transforms":{let r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{let r=t[n];r&&Object.assign(e[n],r)}}}(t,i)}}(t,(e||{}).mdastExtensions||[]);let n={};return function(e){let r={type:"root",children:[]},o={stack:[r],tokenStack:[],config:t,enter:s,exit:a,buffer:i,resume:l,data:n},u=[],c=-1;for(;++c<e.length;)("listOrdered"===e[c][1].type||"listUnordered"===e[c][1].type)&&("enter"===e[c][0]?u.push(c):c=function(e,t,n){let r,i,s,o,a=t-1,l=-1,u=!1;for(;++a<=n;){let t=e[a];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,o=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||o||l||s||(s=a),o=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:o=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let o=a;for(i=void 0;o--;){let t=e[o];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",u=!0),t[1].type="lineEnding",i=o}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}s&&(!i||s<i)&&(r._spread=!0),r.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||a,0,["exit",r,t[2]]),a++,n++}if("listItemPrefix"===t[1].type){let i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=i,e.splice(a,0,["enter",i,t[2]]),a++,n++,s=void 0,o=!0}}}return e[t][1]._spread=u,n}(e,u.pop(),c));for(c=-1;++c<e.length;){let n=t[e[c][0]];tC.call(n,e[c][1].type)&&n[e[c][1].type].call(Object.assign({sliceSerialize:e[c][2].sliceSerialize},o),e[c][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||tI).call(o,void 0,e[0])}for(r.position={start:tT(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:tT(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},c=-1;++c<t.transforms.length;)r=t.transforms[c](r)||r;return r};function r(e,t){return function(n){s.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:tT(t.start),end:void 0}}function o(e){return function(t){e&&e.call(this,t),a.call(this,t)}}function a(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||tI).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Q({start:e.start,end:e.end})+"): it’s not open");n.position.end=tT(e.end)}function l(){return ep(this.stack.pop())}function u(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&"text"===n.type||((n={type:"text",value:""}).position={start:tT(e.start),end:void 0},t.push(n)),this.stack.push(n)}function c(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=tT(e.end)}function d(){this.data.atHardBreak=!0}function h(e){this.data.characterReferenceType=e.type}function p(){return{type:"code",lang:null,meta:null,value:""}}function f(){return{type:"heading",depth:0,children:[]}}function m(){return{type:"break"}}function g(){return{type:"html",value:""}}function y(){return{type:"link",title:null,url:"",children:[]}}function b(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(i)(function(e){for(;!ez(e););return e}((function(e){let t={constructs:ex([tw,...(e||{}).extensions||[]]),content:n(eO),defined:[],document:n(eP),flow:n(e$),lazy:{},string:n(eV),text:n(eQ)};return t;function n(e){return function(n){return function(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},s=[],o=[],a=[],l={attempt:f(function(e,t){m(e,t.from)}),check:f(p),consume:function(e){eT(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,g()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=e},enter:function(e,t){let n=t||{};return n.type=e,n.start=h(),u.events.push(["enter",n,u]),a.push(n),n},exit:function(e){let t=a.pop();return t.end=h(),u.events.push(["exit",t,u]),t},interrupt:f(p,{interrupt:!0})},u={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,g()},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n,r=-1,i=[];for(;++r<e.length;){let s,o=e[r];if("string"==typeof o)s=o;else switch(o){case -5:s="\r";break;case -4:s="\n";break;case -3:s="\r\n";break;case -2:s=t?" ":" ";break;case -1:if(!t&&n)continue;s=" ";break;default:s=String.fromCharCode(o)}n=-2===o,i.push(s)}return i.join("")}(d(e),t)},sliceStream:d,write:function(e){return(o=ey(o,e),function(){let e;for(;r._index<o.length;){let n=o[r._index];if("string"==typeof n)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<n.length;){var t;t=n.charCodeAt(r._bufferIndex),c=c(t)}else c=c(n)}}(),null!==o[o.length-1])?[]:(m(t,0),u.events=eY(s,u.events,u),u.events)}},c=t.tokenize.call(u,l);return t.resolveAll&&s.push(t),u;function d(e){return function(e,t){let n,r=t.start._index,i=t.start._bufferIndex,s=t.end._index,o=t.end._bufferIndex;if(r===s)n=[e[r].slice(i,o)];else{if(n=e.slice(r,s),i>-1){let e=n[0];"string"==typeof e?n[0]=e.slice(i):n.shift()}o>0&&n.push(e[s].slice(0,o))}return n}(o,e)}function h(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:s}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:s}}function p(e,t){t.restore()}function f(e,t){return function(n,i,s){var o;let c,d,p,f;return Array.isArray(n)?m(n):"tokenize"in n?m([n]):(o=n,function(e){let t=null!==e&&o[e],n=null!==e&&o.null;return m([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});function m(e){return(c=e,d=0,0===e.length)?s:y(e[d])}function y(e){return function(n){let i,s,o,c,d;return(i=h(),s=u.previous,o=u.currentConstruct,c=u.events.length,d=Array.from(a),f={from:c,restore:function(){r=i,u.previous=s,u.currentConstruct=o,u.events.length=c,a=d,g()}},p=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name))?x(n):e.tokenize.call(t?Object.assign(Object.create(u),t):u,l,b,x)(n)}}function b(t){return e(p,f),i}function x(e){return(f.restore(),++d<c.length)?y(c[d]):s}}}function m(e,t){e.resolveAll&&!s.includes(e)&&s.push(e),e.resolve&&eg(u.events,t,u.events.length-t,e.resolve(u.events.slice(t),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function g(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}(t,e,n)}}})(i).document().write((o=1,a="",l=!0,function(e,t,n){let r,i,u,c,d,h=[];for(e=a+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),u=0,a="",l&&(65279===e.charCodeAt(0)&&u++,l=void 0);u<e.length;){if(tS.lastIndex=u,c=(r=tS.exec(e))&&void 0!==r.index?r.index:e.length,d=e.charCodeAt(c),!r){a=e.slice(u);break}if(10===d&&u===c&&s)h.push(-3),s=void 0;else switch(s&&(h.push(-5),s=void 0),u<c&&(h.push(e.slice(u,c)),o+=c-u),d){case 0:h.push(65533),o++;break;case 9:for(i=4*Math.ceil(o/4),h.push(-2);o++<i;)h.push(-1);break;case 10:h.push(-4),o=1;break;default:s=!0,o=1}u=c+1}return n&&(s&&h.push(-5),a&&h.push(a),h.push(null)),h})(n,r,!0))))}}let tA="object"==typeof self?self:globalThis,tR=e=>{var t;let n,r;return(t=new Map,n=(e,n)=>(t.set(n,e),e),r=i=>{if(t.has(i))return t.get(i);let[s,o]=e[i];switch(s){case 0:case -1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new tA[e](t),i)}case 8:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new tA[s](o),i)})(0)},{toString:tM}={},{keys:tN}=Object,tO=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let n=tM.call(e).slice(8,-1);switch(n){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},tP=([e,t])=>0===e&&("function"===t||"symbol"===t),tD=(e,{json:t,lossy:n}={})=>{var r,i,s;let o,a,l=[];return(r=!(t||n),i=!!t,s=new Map,o=(e,t)=>{let n=l.push(e)-1;return s.set(t,n),n},a=e=>{if(s.has(e))return s.get(e);let[t,n]=tO(e);switch(t){case 0:{let i=e;switch(n){case"bigint":t=8,i=e.toString();break;case"function":case"symbol":if(r)throw TypeError("unable to serialize "+n);i=null;break;case"undefined":return o([-1],e)}return o([t,i],e)}case 1:{if(n){let t=e;return"DataView"===n?t=new Uint8Array(e.buffer):"ArrayBuffer"===n&&(t=new Uint8Array(e)),o([n,[...t]],e)}let r=[],i=o([t,r],e);for(let t of e)r.push(a(t));return i}case 2:{if(n)switch(n){case"BigInt":return o([n,e.toString()],e);case"Boolean":case"Number":case"String":return o([n,e.valueOf()],e)}if(i&&"toJSON"in e)return a(e.toJSON());let s=[],l=o([t,s],e);for(let t of tN(e))(r||!tP(tO(e[t])))&&s.push([a(t),a(e[t])]);return l}case 3:return o([t,e.toISOString()],e);case 4:{let{source:n,flags:r}=e;return o([t,{source:n,flags:r}],e)}case 5:{let n=[],i=o([t,n],e);for(let[t,i]of e)(r||!(tP(tO(t))||tP(tO(i))))&&n.push([a(t),a(i)]);return i}case 6:{let n=[],i=o([t,n],e);for(let t of e)(r||!tP(tO(t)))&&n.push(a(t));return i}}let{message:l}=e;return o([t,{name:n,message:l}],e)})(e),l},tF="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?tR(tD(e,t)):structuredClone(e):(e,t)=>tR(tD(e,t));function tL(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let s=e.charCodeAt(n),o="";if(37===s&&ew(e.charCodeAt(n+1))&&ew(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){let t=e.charCodeAt(n+1);s<56320&&t>56319&&t<57344?(o=String.fromCharCode(s,t),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function tB(e,t){let n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function tz(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}let tU=function(e){var t,n;if(null==e)return t$;if("function"==typeof e)return tq(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],n=-1;for(;++n<e.length;)t[n]=tU(e[n]);return tq(function(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1})}(e):(t=e,tq(function(e){let n;for(n in t)if(e[n]!==t[n])return!1;return!0}))}if("string"==typeof e){return n=e,tq(function(e){return e&&e.type===n})}throw Error("Expected function, string, or object as test")};function tq(e){return function(t,n,r){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function t$(){return!0}e.s(["convert",0,tU],73119);let tH=[];function tV(e,t,n,r){let i;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):i=t;let s=tU(i),o=r?-1:1;(function e(i,a,l){let u=i&&"object"==typeof i?i:{};if("string"==typeof u.type){let e="string"==typeof u.tagName?u.tagName:"string"==typeof u.name?u.name:void 0;Object.defineProperty(c,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return c;function c(){var u;let c,d,h,p=tH;if((!t||s(i,a,l[l.length-1]||void 0))&&!1===(p=Array.isArray(u=n(i,l))?u:"number"==typeof u?[!0,u]:null==u?tH:[u])[0])return p;if("children"in i&&i.children&&i.children&&"skip"!==p[0])for(d=(r?i.children.length:-1)+o,h=l.concat(i);d>-1&&d<i.children.length;){if(!1===(c=e(i.children[d],d,h)())[0])return c;d="number"==typeof c[1]?c[1]:d+o}return p}})(e,void 0,[])()}function tQ(e,t,n,r){let i,s,o;"function"==typeof t&&"function"!=typeof n?(s=void 0,o=t,i=n):(s=t,o=n,i=r),tV(e,s,function(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)},i)}function tW(e,t){let n=t.referenceType,r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];let i=e.all(t),s=i[0];s&&"text"===s.type?s.value="["+s.value:i.unshift({type:"text",value:"["});let o=i[i.length-1];return o&&"text"===o.type?o.value+=r:i.push({type:"text",value:r}),i}function tK(e){let t=e.spread;return null==t?e.children.length>1:t}function tG(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;9===t||32===t;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}e.s(["EXIT",0,!1,"visitParents",()=>tV],2652),e.s(["visit",()=>tQ],16920);let tJ={blockquote:function(e,t){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){let n=t.value?t.value+"\n":"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s={type:"element",tagName:"pre",properties:{},children:[s=e.applyData(t,s)]},e.patch(t,s),s},delete:function(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){let n,r="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),s=tL(i.toLowerCase()),o=e.footnoteOrder.indexOf(i),a=e.footnoteCounts.get(i);void 0===a?(a=0,e.footnoteOrder.push(i),n=e.footnoteOrder.length):n=o+1,a+=1,e.footnoteCounts.set(i,a);let l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+s,id:r+"fnref-"+s+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(n)}]};e.patch(t,l);let u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)},heading:function(e,t){let n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return tW(e,t);let i={src:tL(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(i.title=r.title);let s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)},image:function(e,t){let n={src:tL(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){let n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return tW(e,t);let i={href:tL(r.url||"")};null!==r.title&&void 0!==r.title&&(i.title=r.title);let s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)},link:function(e,t){let n={href:tL(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){let r=e.all(t),i=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=tK(n[r])}return t}(n):tK(t),s={},o=[];if("boolean"==typeof t.checked){let e,n=r[0];n&&"element"===n.type&&"p"===n.tagName?e=n:(e={type:"element",tagName:"p",properties:{},children:[]},r.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){let e=r[a];(i||0!==a||"element"!==e.type||"p"!==e.tagName)&&o.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?o.push(e):o.push(...e.children)}let l=r[r.length-1];l&&(i||"element"!==l.type||"p"!==l.tagName)&&o.push({type:"text",value:"\n"});let u={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,u),e.applyData(t,u)},list:function(e,t){let n={},r=e.all(t),i=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++i<r.length;){let e=r[i];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}let s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)},paragraph:function(e,t){let n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){let n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){let n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},s=H(t.children[1]),o=$(t.children[t.children.length-1]);s&&o&&(r.position={start:s,end:o}),i.push(r)}let s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)},tableCell:function(e,t){let n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){let r=n?n.children:void 0,i=0===(r?r.indexOf(t):1)?"th":"td",s=n&&"table"===n.type?n.align:void 0,o=s?s.length:t.children.length,a=-1,l=[];for(;++a<o;){let n=t.children[a],r={},o=s?s[a]:void 0;o&&(r.align=o);let u={type:"element",tagName:i,properties:r,children:[]};n&&(u.children=e.all(n),e.patch(n,u),u=e.applyData(n,u)),l.push(u)}let u={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,u),e.applyData(t,u)},text:function(e,t){let n={type:"text",value:function(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,s=[];for(;r;)s.push(tG(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(tG(t.slice(i),i>0,!1)),s.join("")}(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:tY,yaml:tY,definition:tY,footnoteDefinition:tY};function tY(){}let tX={}.hasOwnProperty,tZ={};function t0(e,t){e.position&&(t.position=function(e){let t=H(e),n=$(e);if(t&&n)return{start:t,end:n}}(e))}function t1(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;"string"==typeof t&&("element"===n.type?n.tagName=t:n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}),"element"===n.type&&i&&Object.assign(n.properties,tF(i)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function t2(e,t){let n=[],r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function t5(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function t3(e,n){let r,i,s,o,a=(r=n||tZ,i=new Map,s=new Map,o={all:function(e){let t=[];if("children"in e){let n=e.children,r=-1;for(;++r<n.length;){let i=o.one(n[r],e);if(i){if(r&&"break"===n[r-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=t5(i.value)),!Array.isArray(i)&&"element"===i.type)){let e=i.children[0];e&&"text"===e.type&&(e.value=t5(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:t1,definitionById:i,footnoteById:s,footnoteCounts:new Map,footnoteOrder:[],handlers:{...tJ,...r.handlers},one:function(e,t){let n=e.type,r=o.handlers[n];if(tX.call(o.handlers,n)&&r)return r(o,e,t);if(o.options.passThrough&&o.options.passThrough.includes(n)){if("children"in e){let{children:t,...n}=e,r=tF(n);return r.children=o.all(e),r}return tF(e)}return(o.options.unknownHandler||function(e,t){let n=t.data||{},r="value"in t&&!(tX.call(n,"hProperties")||tX.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)})(o,e,t)},options:r,patch:t0,wrap:t2},tQ(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?i:s,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),o),l=a.one(e,void 0),u=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||tB,r=e.options.footnoteBackLabel||tz,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[],l=-1;for(;++l<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;let s=e.all(i),o=String(i.identifier).toUpperCase(),u=tL(o.toLowerCase()),c=0,d=[],h=e.footnoteCounts.get(o);for(;void 0!==h&&++c<=h;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof n?n:n(l,c);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+u+(c>1?"-"+c:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(l,c),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let p=s[s.length-1];if(p&&"element"===p.type&&"p"===p.tagName){let e=p.children[p.children.length-1];e&&"text"===e.type?e.value+=" ":p.children.push({type:"text",value:" "}),p.children.push(...d)}else s.push(...d);let f={type:"element",tagName:"li",properties:{id:t+"fn-"+u},children:e.wrap(s,!0)};e.patch(i,f),a.push(f)}if(0!==a.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...tF(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:"\n"}]}}(a),c=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return u&&(t("children"in c),c.children.push({type:"text",value:"\n"},u)),c}function t4(e,t){return e&&"run"in e?async function(n,r){let i=t3(n,{file:r,...t});await e.run(i,r)}:function(n,r){return t3(n,{file:r,...e||t})}}function t6(e){if(e)throw e}var t8=e.i(75609);function t9(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let t7=function(e,t){let n;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');nr(e);let r=0,i=-1,s=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;s--;)if(47===e.codePointAt(s)){if(n){r=s+1;break}}else i<0&&(n=!0,i=s+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let o=-1,a=t.length-1;for(;s--;)if(47===e.codePointAt(s)){if(n){r=s+1;break}}else o<0&&(n=!0,o=s+1),a>-1&&(e.codePointAt(s)===t.codePointAt(a--)?a<0&&(i=s):(a=-1,i=o));return r===i?i=o:i<0&&(i=e.length),e.slice(r,i)},ne=function(e){let t;if(nr(e),0===e.length)return".";let n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},nt=function(e){let t;nr(e);let n=e.length,r=-1,i=0,s=-1,o=0;for(;n--;){let a=e.codePointAt(n);if(47===a){if(t){i=n+1;break}continue}r<0&&(t=!0,r=n+1),46===a?s<0?s=n:1!==o&&(o=1):s>-1&&(o=-1)}return s<0||r<0||0===o||1===o&&s===r-1&&s===i+1?"":e.slice(s,r)},nn=function(...e){var t;let n,r,i,s=-1;for(;++s<e.length;)nr(e[s]),e[s]&&(i=void 0===i?e[s]:i+"/"+e[s]);return void 0===i?".":(nr(t=i),n=47===t.codePointAt(0),0!==(r=function(e,t){let n,r,i="",s=0,o=-1,a=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else if(47===n)break;else n=47;if(47===n){if(o===l-1||1===a);else if(o!==l-1&&2===a){if(i.length<2||2!==s||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2)){if(i.length>2){if((r=i.lastIndexOf("/"))!==i.length-1){r<0?(i="",s=0):s=(i=i.slice(0,r)).length-1-i.lastIndexOf("/"),o=l,a=0;continue}}else if(i.length>0){i="",s=0,o=l,a=0;continue}}t&&(i=i.length>0?i+"/..":"..",s=2)}else i.length>0?i+="/"+e.slice(o+1,l):i=e.slice(o+1,l),s=l-o-1;o=l,a=0}else 46===n&&a>-1?a++:a=-1}return i}(t,!n)).length||n||(r="."),r.length>0&&47===t.codePointAt(t.length-1)&&(r+="/"),n?"/"+r:r)};function nr(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function ni(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let ns=["history","path","basename","stem","extname","dirname"];class no{constructor(e){let t,n;t=e?ni(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<ns.length;){const e=ns[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)ns.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?t7(this.path):void 0}set basename(e){nl(e,"basename"),na(e,"basename"),this.path=nn(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?ne(this.path):void 0}set dirname(e){nu(this.basename,"dirname"),this.path=nn(e||"",this.basename)}get extname(){return"string"==typeof this.path?nt(this.path):void 0}set extname(e){if(na(e,"extname"),nu(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=nn(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){ni(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!ni(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){let e=t.codePointAt(n+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),nl(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?t7(this.path,this.extname):void 0}set stem(e){nl(e,"stem"),na(e,"stem"),this.path=nn(this.dirname||"",e+(this.extname||""))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new J(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function na(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function nl(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function nu(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let nc=function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},nd={}.hasOwnProperty;class nh extends nc{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let e=[],t={run:function(...t){let n=-1,r=t.pop();if("function"!=typeof r)throw TypeError("Expected function as last argument, not "+r);!function i(s,...o){let a=e[++n],l=-1;if(s)return void r(s);for(;++l<t.length;)(null===o[l]||void 0===o[l])&&(o[l]=t[l]);t=o,a?(function(e,t){let n;return function(...t){let s,o=e.length>t.length;o&&t.push(r);try{s=e.apply(this,t)}catch(e){if(o&&n)throw e;return r(e)}o||(s&&s.then&&"function"==typeof s.then?s.then(i,r):s instanceof Error?r(s):i(s))};function r(e,...i){n||(n=!0,t(e,...i))}function i(e){r(null,e)}})(a,i)(...o):r(null,...o)}(null,...t)},use:function(n){if("function"!=typeof n)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}()}copy(){let e=new nh,t=-1;for(;++t<this.attachers.length;){let n=this.attachers[t];e.use(...n)}return e.data((0,t8.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(ng("data",this.frozen),this.namespace[e]=t,this):nd.call(this.namespace,e)&&this.namespace[e]||void 0:e?(ng("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let n=e.call(this,...t);"function"==typeof n&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=nx(e),n=this.parser||this.Parser;return nf("parse",n),n(String(t),t)}process(e,n){let r=this;return this.freeze(),nf("process",this.parser||this.Parser),nm("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(i,s){let o=nx(e),a=r.parse(o);function l(e,r){e||!r?s(e):i?i(r):(t(n,"`done` is defined if `resolve` is not"),n(void 0,r))}r.run(a,o,function(e,t,n){var i,s;if(e||!t||!n)return l(e);let o=r.stringify(t,n);"string"==typeof(i=o)||(s=i)&&"object"==typeof s&&"byteLength"in s&&"byteOffset"in s?n.value=o:n.result=o,l(e,n)})}}processSync(e){let n,r=!1;return this.freeze(),nf("processSync",this.parser||this.Parser),nm("processSync",this.compiler||this.Compiler),this.process(e,function(e,t){r=!0,t6(e),n=t}),nb("processSync","process",r),t(n,"we either bailed on an error or have a tree"),n}run(e,n,r){ny(e),this.freeze();let i=this.transformers;return r||"function"!=typeof n||(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(s,o){t("function"!=typeof n,"`file` can’t be a `done` anymore, we checked");let a=nx(n);i.run(e,a,function(n,i,a){let l=i||e;n?o(n):s?s(l):(t(r,"`done` is defined if `resolve` is not"),r(void 0,l,a))})}}runSync(e,n){let r,i=!1;return this.run(e,n,function(e,t){t6(e),r=t,i=!0}),nb("runSync","run",i),t(r,"we either bailed on an error or have a tree"),r}stringify(e,t){this.freeze();let n=nx(t),r=this.compiler||this.Compiler;return nm("stringify",r),ny(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(ng("use",this.frozen),null==e);else if("function"==typeof e)o(e,t);else if("object"==typeof e)Array.isArray(e)?s(e):i(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(!("plugins"in e)&&!("settings"in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(e.plugins),e.settings&&(r.settings=(0,t8.default)(!0,r.settings,e.settings))}function s(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)o(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[t,...n]=e;o(t,n)}else i(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function o(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(-1===i)n.push([e,...t]);else if(t.length>0){let[r,...s]=t,o=n[i][1];t9(o)&&t9(r)&&(r=(0,t8.default)(!0,o,r)),n[i]=[e,r,...s]}}}}let np=new nh().freeze();function nf(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function nm(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function ng(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function ny(e){if(!t9(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function nb(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function nx(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new no(e)}let nv=[],nw={allowDangerousHtml:!0},nS=/^(https?|ircs?|mailto|xmpp)$/i,nk=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function n_(e){var t;let r,i,s,o,a,l=(r=(t=e).rehypePlugins||nv,i=t.remarkPlugins||nv,s=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...nw}:nw,np().use(tj).use(i).use(t4,s).use(r)),u=(o=e.children||"",a=new no,"string"==typeof o?a.value=o:n("Unexpected value `"+o+"` for `children` prop, expected `string`"),a);return function(e,t){let r=t.allowedElements,i=t.allowElement,s=t.components,o=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,u=t.urlTransform||nE;for(let e of nk)Object.hasOwn(t,e.from)&&n("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return r&&o&&n("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),tQ(e,function(e,t,n){if("raw"===e.type&&n&&"number"==typeof t)return a?n.children.splice(t,1):n.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in ec)if(Object.hasOwn(ec,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=ec[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=u(String(n||""),t,e))}}if("element"===e.type){let s=r?!r.includes(e.tagName):!!o&&o.includes(e.tagName);if(!s&&i&&"number"==typeof t&&(s=!i(e,t,n)),s&&n&&"number"==typeof t)return l&&e.children?n.children.splice(t,1,...e.children):n.children.splice(t,1),t}}),function(e,t){var n,r,i,s;let o;if(!t||void 0===t.Fragment)throw TypeError("Expected `Fragment` in options");let a=t.filePath||void 0;if(t.development){if("function"!=typeof t.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");n=a,r=t.jsxDEV,o=function(e,t,i,s){let o=Array.isArray(i.children),a=H(e);return r(t,i,s,o,{columnNumber:a?a.column-1:void 0,fileName:n,lineNumber:a?a.line:void 0},void 0)}}else{if("function"!=typeof t.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw TypeError("Expected `jsxs` in production options");i=t.jsx,s=t.jsxs,o=function(e,t,n,r){let o=Array.isArray(n.children)?s:i;return r?o(t,n,r):o(t,n)}}let l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:o,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?U:z,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},u=er(l,e,void 0);return u&&"string"!=typeof u?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}(e,{Fragment:ed.Fragment,components:s,ignoreInvalidStyle:!0,jsx:ed.jsx,jsxs:ed.jsxs,passKeys:!0,passNode:!0})}(l.runSync(l.parse(u),u),e)}function nE(e){let t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return -1===t||-1!==i&&t>i||-1!==n&&t>n||-1!==r&&t>r||nS.test(e.slice(0,t))?e:""}e.s(["default",()=>n_],427)},12878,90292,81835,49527,e=>{"use strict";function t(e,t){let n=String(e);if("string"!=typeof t)throw TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}var n=e.i(97802),r=e.i(55470),i=e.i(2652),s=e.i(73119);let o="phrasing",a=["autolink","link","image","label"];function l(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function u(e){this.config.enter.autolinkProtocol.call(this,e)}function c(e){this.config.exit.autolinkProtocol.call(this,e)}function d(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];(0,n.ok)("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function h(e){this.config.exit.autolinkEmail.call(this,e)}function p(e){this.exit(e)}function f(e){!function(e,t,n){let r=(0,s.convert)((n||{}).ignore||[]),o=function(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){var i;let e=n[r];t.push(["string"==typeof(i=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(i),"g"):i,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return t}(t),a=-1;for(;++a<o.length;)(0,i.visitParents)(e,"text",l);function l(e,t){let n,i=-1;for(;++i<t.length;){let e=t[i],s=n?n.children:void 0;if(r(e,s?s.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){let n=t[t.length-1],r=o[a][0],i=o[a][1],s=0,l=n.children.indexOf(e),u=!1,c=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,o={index:d.index,input:d.input,stack:[...t,e]},a=i(...d,o);if("string"==typeof a&&(a=a.length>0?{type:"text",value:a}:void 0),!1===a?r.lastIndex=n+1:(s!==n&&c.push({type:"text",value:e.value.slice(s,n)}),Array.isArray(a)?c.push(...a):a&&c.push(a),s=n+d[0].length,u=!0),!r.global)break;d=r.exec(e.value)}return u?(s<e.value.length&&c.push({type:"text",value:e.value.slice(s)}),n.children.splice(l,1,...c)):c=[e],l+c.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,m],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,g]],{ignore:["link","linkReference"]})}function m(e,n,r,i,s){let o,a="";if(!y(s))return!1;if(/^w/i.test(n)&&(r=n+r,n="",a="http://"),(o=r.split(".")).length<2||o[o.length-1]&&(/_/.test(o[o.length-1])||!/[a-zA-Z\d]/.test(o[o.length-1]))||o[o.length-2]&&(/_/.test(o[o.length-2])||!/[a-zA-Z\d]/.test(o[o.length-2])))return!1;let l=function(e){let n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],i=r.indexOf(")"),s=t(e,"("),o=t(e,")");for(;-1!==i&&s>o;)e+=r.slice(0,i+1),i=(r=r.slice(i+1)).indexOf(")"),o++;return[e,r]}(r+i);if(!l[0])return!1;let u={type:"link",title:null,url:a+n+l[0],children:[{type:"text",value:n+l[0]}]};return l[1]?[u,{type:"text",value:l[1]}]:u}function g(e,t,n,r){return!(!y(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function y(e,t){let n=e.input.charCodeAt(e.index-1);return(0===e.index||(0,r.unicodeWhitespace)(n)||(0,r.unicodePunctuation)(n))&&(!t||47!==n)}var b=e.i(84484);function x(){this.buffer()}function v(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function w(){this.buffer()}function S(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function k(e){let t=this.resume(),r=this.stack[this.stack.length-1];(0,n.ok)("footnoteReference"===r.type),r.identifier=(0,b.normalizeIdentifier)(this.sliceSerialize(e)).toLowerCase(),r.label=t}function _(e){this.exit(e)}function E(e){let t=this.resume(),r=this.stack[this.stack.length-1];(0,n.ok)("footnoteDefinition"===r.type),r.identifier=(0,b.normalizeIdentifier)(this.sliceSerialize(e)).toLowerCase(),r.label=t}function C(e){this.exit(e)}function T(e,t,n,r){let i=n.createTracker(r),s=i.move("[^"),o=n.enter("footnoteReference"),a=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),a(),o(),s+=i.move("]")}function I(e,t,n){return 0===t?e:j(e,t,n)}function j(e,t,n){return(n?"":" ")+e}T.peek=function(){return"["};let A=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function R(e){this.enter({type:"delete",children:[]},e)}function M(e){this.exit(e)}function N(e,t,n,r){let i=n.createTracker(r),s=n.enter("strikethrough"),o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function O(e){return e.length}function P(e){let t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:114*(82===t||114===t)}N.peek=function(){return"~"};var D=e.i(27066);e.i(16920);e.i(12105);function F(e,t,n){let r=e.value||"",i="`",s=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){let e,t=n.unsafe[s],i=n.compilePattern(t);if(t.atBreak)for(;e=i.exec(r);){let t=e.index;10===r.charCodeAt(t)&&13===r.charCodeAt(t-1)&&t--,r=r.slice(0,t)+" "+r.slice(e.index+1)}}return i+r+i}F.peek=function(){return"`"};(0,s.convert)(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let L=function(e,t,n,r){let i=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n),s=n.bulletCurrent||function(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(n);t&&"list"===t.type&&t.ordered&&(s=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+s);let o=s.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(o=4*Math.ceil(o/4));let a=n.createTracker(r);a.move(s+" ".repeat(o-s.length)),a.shift(o);let l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),function(e,t,n){return t?(n?"":" ".repeat(o))+e:(n?s:s+" ".repeat(o-s.length))+e});return l(),u};function B(e){let t=e._align;(0,n.ok)(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function z(e){this.exit(e),this.data.inTable=void 0}function U(e){this.enter({type:"tableRow",children:[]},e)}function q(e){this.exit(e)}function $(e){this.enter({type:"tableCell",children:[]},e)}function H(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,V));let r=this.stack[this.stack.length-1];(0,n.ok)("inlineCode"===r.type),r.value=t,this.exit(e)}function V(e,t){return"|"===t?t:e}function Q(e){let t=this.stack[this.stack.length-2];(0,n.ok)("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function W(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1];(0,n.ok)("paragraph"===e.type);let r=e.children[0];if(r&&"text"===r.type){let n,i=t.children,s=-1;for(;++s<i.length;){let e=i[s];if("paragraph"===e.type){n=e;break}}n===e&&(r.value=r.value.slice(1),0===r.value.length?e.children.shift():e.position&&r.position&&"number"==typeof r.position.start.offset&&(r.position.start.column++,r.position.start.offset++,e.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function K(e,t,n,r){let i=e.children[0],s="boolean"==typeof e.checked&&i&&"paragraph"===i.type,o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(o);let l=L(e,t,n,{...r,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}var G=e.i(44819);let J={tokenize:function(e,t,n){let r=0;return function t(s){return(87===s||119===s)&&r<3?(r++,e.consume(s),t):46===s&&3===r?(e.consume(s),i):n(s)};function i(e){return null===e?n(e):t(e)}},partial:!0},Y={tokenize:function(e,t,n){let i,s,o;return a;function a(t){return 46===t||95===t?e.check(Z,u,l)(t):null===t||(0,r.markdownLineEndingOrSpace)(t)||(0,r.unicodeWhitespace)(t)||45!==t&&(0,r.unicodePunctuation)(t)?u(t):(o=!0,e.consume(t),a)}function l(t){return 95===t?i=!0:(s=i,i=void 0),e.consume(t),a}function u(e){return s||i||!o?n(e):t(e)}},partial:!0},X={tokenize:function(e,t){let n=0,i=0;return s;function s(a){return 40===a?(n++,e.consume(a),s):41===a&&i<n?o(a):33===a||34===a||38===a||39===a||41===a||42===a||44===a||46===a||58===a||59===a||60===a||63===a||93===a||95===a||126===a?e.check(Z,t,o)(a):null===a||(0,r.markdownLineEndingOrSpace)(a)||(0,r.unicodeWhitespace)(a)?t(a):(e.consume(a),s)}function o(t){return 41===t&&i++,e.consume(t),s}},partial:!0},Z={tokenize:function(e,t,n){return i;function i(a){return 33===a||34===a||39===a||41===a||42===a||44===a||46===a||58===a||59===a||63===a||95===a||126===a?(e.consume(a),i):38===a?(e.consume(a),o):93===a?(e.consume(a),s):60===a||null===a||(0,r.markdownLineEndingOrSpace)(a)||(0,r.unicodeWhitespace)(a)?t(a):n(a)}function s(e){return null===e||40===e||91===e||(0,r.markdownLineEndingOrSpace)(e)||(0,r.unicodeWhitespace)(e)?t(e):i(e)}function o(t){return(0,r.asciiAlpha)(t)?function t(s){return 59===s?(e.consume(s),i):(0,r.asciiAlpha)(s)?(e.consume(s),t):n(s)}(t):n(t)}},partial:!0},ee={tokenize:function(e,t,n){return function(t){return e.consume(t),i};function i(e){return(0,r.asciiAlphanumeric)(e)?n(e):t(e)}},partial:!0},et={name:"wwwAutolink",tokenize:function(e,t,n){let r=this;return function(t){return 87!==t&&119!==t||!eo.call(r,r.previous)||ec(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(J,e.attempt(Y,e.attempt(X,i),n),n)(t))};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:eo},en={name:"protocolAutolink",tokenize:function(e,t,n){let i=this,s="",o=!1;return function(t){return(72===t||104===t)&&ea.call(i,i.previous)&&!ec(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(t),e.consume(t),a):n(t)};function a(t){if((0,r.asciiAlpha)(t)&&s.length<5)return s+=String.fromCodePoint(t),e.consume(t),a;if(58===t){let n=s.toLowerCase();if("http"===n||"https"===n)return e.consume(t),l}return n(t)}function l(t){return 47===t?(e.consume(t),o)?u:(o=!0,l):n(t)}function u(t){return null===t||(0,r.asciiControl)(t)||(0,r.markdownLineEndingOrSpace)(t)||(0,r.unicodeWhitespace)(t)||(0,r.unicodePunctuation)(t)?n(t):e.attempt(Y,e.attempt(X,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:ea},er={name:"emailAutolink",tokenize:function(e,t,n){let i,s,o=this;return function(t){return!eu(t)||!el.call(o,o.previous)||ec(o.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(r){return eu(r)?(e.consume(r),t):64===r?(e.consume(r),a):n(r)}(t))};function a(t){return 46===t?e.check(ee,u,l)(t):45===t||95===t||(0,r.asciiAlphanumeric)(t)?(s=!0,e.consume(t),a):u(t)}function l(t){return e.consume(t),i=!0,a}function u(a){return s&&i&&(0,r.asciiAlpha)(o.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(a)):n(a)}},previous:el},ei={},es=48;for(;es<123;)ei[es]=er,58==++es?es=65:91===es&&(es=97);function eo(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||(0,r.markdownLineEndingOrSpace)(e)}function ea(e){return!(0,r.asciiAlpha)(e)}function el(e){return!(47===e||eu(e))}function eu(e){return 43===e||45===e||46===e||95===e||(0,r.asciiAlphanumeric)(e)}function ec(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}ei[43]=er,ei[45]=er,ei[46]=er,ei[95]=er,ei[72]=[er,en],ei[104]=[er,en],ei[87]=[er,et],ei[119]=[er,et];var ed=e.i(51256),eh=e.i(33220);let ep={tokenize:function(e,t,n){let r=this;return(0,eh.factorySpace)(e,function(e){let i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function ef(e,t,n){let r,i=this,s=i.events.length,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);for(;s--;){let e=i.events[s][1];if("labelImage"===e.type){r=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(s){if(!r||!r._balanced)return n(s);let a=(0,b.normalizeIdentifier)(i.sliceSerialize({start:r.end,end:i.now()}));return 94===a.codePointAt(0)&&o.includes(a.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),t(s)):n(s)}}function em(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function eg(e,t,n){let i,s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]),a=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),l};function l(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(l){if(a>999||93===l&&!i||null===l||91===l||(0,r.markdownLineEndingOrSpace)(l))return n(l);if(93===l){e.exit("chunkString");let r=e.exit("gfmFootnoteCallString");return o.includes((0,b.normalizeIdentifier)(s.sliceSerialize(r)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(l)}return(0,r.markdownLineEndingOrSpace)(l)||(i=!0),a++,e.consume(l),92===l?c:u}function c(t){return 91===t||92===t||93===t?(e.consume(t),a++,u):u(t)}}function ey(e,t,n){let i,s,o=this,a=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),l=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),u};function u(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(l>999||93===t&&!s||null===t||91===t||(0,r.markdownLineEndingOrSpace)(t))return n(t);if(93===t){e.exit("chunkString");let n=e.exit("gfmFootnoteDefinitionLabelString");return i=(0,b.normalizeIdentifier)(o.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return(0,r.markdownLineEndingOrSpace)(t)||(s=!0),l++,e.consume(t),92===t?d:c}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,c):c(t)}function h(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),a.includes(i)||a.push(i),(0,eh.factorySpace)(e,p,"gfmFootnoteDefinitionWhitespace")):n(t)}function p(e){return t(e)}}function eb(e,t,n){return e.check(ed.blankLine,t,e.attempt(ep,t,n))}function ex(e){e.exit("gfmFootnoteDefinition")}var ev=e.i(59245),ew=e.i(5568);class eS{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0!==n||0!==r.length){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length,n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}}function ek(e,t,n){let i,s=this,o=0,a=0;return function(e){let t=s.events.length-1;for(;t>-1;){let e=s.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let r=t>-1?s.events[t][1].type:null,i="tableHead"===r||"tableRow"===r?x:l;return i===x&&s.parser.lazy[s.now().line]?n(e):i(e)};function l(t){var n;return e.enter("tableHead"),e.enter("tableRow"),124===(n=t)||(i=!0,a+=1),u(n)}function u(t){return null===t?n(t):(0,r.markdownLineEnding)(t)?a>1?(a=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h):n(t):(0,r.markdownSpace)(t)?(0,eh.factorySpace)(e,u,"whitespace")(t):(a+=1,i&&(i=!1,o+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),i=!0,u):(e.enter("data"),c(t))}function c(t){return null===t||124===t||(0,r.markdownLineEndingOrSpace)(t)?(e.exit("data"),u(t)):(e.consume(t),92===t?d:c)}function d(t){return 92===t||124===t?(e.consume(t),c):c(t)}function h(t){return(s.interrupt=!1,s.parser.lazy[s.now().line])?n(t):(e.enter("tableDelimiterRow"),i=!1,(0,r.markdownSpace)(t))?(0,eh.factorySpace)(e,p,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):p(t)}function p(t){return 45===t||58===t?m(t):124===t?(i=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),f):n(t)}function f(t){return(0,r.markdownSpace)(t)?(0,eh.factorySpace)(e,m,"whitespace")(t):m(t)}function m(t){return 58===t?(a+=1,i=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),g):45===t?(a+=1,g(t)):null===t||(0,r.markdownLineEnding)(t)?b(t):n(t)}function g(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(n){return 45===n?(e.consume(n),t):58===n?(i=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(n),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(n))}(t)):n(t)}function y(t){return(0,r.markdownSpace)(t)?(0,eh.factorySpace)(e,b,"whitespace")(t):b(t)}function b(s){if(124===s)return p(s);if(null===s||(0,r.markdownLineEnding)(s))return i&&o===a?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(s)):n(s);return n(s)}function x(t){return e.enter("tableRow"),v(t)}function v(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),v):null===n||(0,r.markdownLineEnding)(n)?(e.exit("tableRow"),t(n)):(0,r.markdownSpace)(n)?(0,eh.factorySpace)(e,v,"whitespace")(n):(e.enter("data"),w(n))}function w(t){return null===t||124===t||(0,r.markdownLineEndingOrSpace)(t)?(e.exit("data"),v(t)):(e.consume(t),92===t?S:w)}function S(t){return 92===t||124===t?(e.consume(t),w):w(t)}}function e_(e,t){let n,r,i,s=-1,o=!0,a=0,l=[0,0,0,0],u=[0,0,0,0],c=!1,d=0,h=new eS;for(;++s<e.length;){let p=e[s],f=p[1];"enter"===p[0]?"tableHead"===f.type?(c=!1,0!==d&&(eC(h,t,d,n,r),r=void 0,d=0),n={type:"table",start:Object.assign({},f.start),end:Object.assign({},f.end)},h.add(s,0,[["enter",n,t]])):"tableRow"===f.type||"tableDelimiterRow"===f.type?(o=!0,i=void 0,l=[0,0,0,0],u=[0,s+1,0,0],c&&(c=!1,r={type:"tableBody",start:Object.assign({},f.start),end:Object.assign({},f.end)},h.add(s,0,[["enter",r,t]])),a="tableDelimiterRow"===f.type?2:r?3:1):a&&("data"===f.type||"tableDelimiterMarker"===f.type||"tableDelimiterFiller"===f.type)?(o=!1,0===u[2]&&(0!==l[1]&&(u[0]=u[1],i=eE(h,t,l,a,void 0,i),l=[0,0,0,0]),u[2]=s)):"tableCellDivider"===f.type&&(o?o=!1:(0!==l[1]&&(u[0]=u[1],i=eE(h,t,l,a,void 0,i)),u=[(l=u)[1],s,0,0])):"tableHead"===f.type?(c=!0,d=s):"tableRow"===f.type||"tableDelimiterRow"===f.type?(d=s,0!==l[1]?(u[0]=u[1],i=eE(h,t,l,a,s,i)):0!==u[1]&&(i=eE(h,t,u,a,s,i)),a=0):a&&("data"===f.type||"tableDelimiterMarker"===f.type||"tableDelimiterFiller"===f.type)&&(u[3]=s)}for(0!==d&&eC(h,t,d,n,r),h.consume(t.events),s=-1;++s<t.events.length;){let e=t.events[s];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){let e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}(t.events,s))}return e}function eE(e,t,n,r,i,s){0!==n[0]&&(s.end=Object.assign({},eT(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));let o=eT(t.events,n[1]);if(s={type:1===r?"tableHeader":2===r?"tableDelimiter":"tableData",start:Object.assign({},o),end:Object.assign({},o)},e.add(n[1],0,[["enter",s,t]]),0!==n[2]){let i=eT(t.events,n[2]),s=eT(t.events,n[3]),o={type:"tableContent",start:Object.assign({},i),end:Object.assign({},s)};if(e.add(n[2],0,[["enter",o,t]]),2!==r){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",o,t]])}return void 0!==i&&(s.end=Object.assign({},eT(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function eC(e,t,n,r,i){let s=[],o=eT(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function eT(e,t){let n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}let eI={name:"tasklistCheck",tokenize:function(e,t,n){let i=this;return function(t){return null===i.previous&&i._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),s):n(t)};function s(t){return(0,r.markdownLineEndingOrSpace)(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),o):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),o):n(t)}function o(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(t)}function a(i){return(0,r.markdownLineEnding)(i)?t(i):(0,r.markdownSpace)(i)?e.check({tokenize:ej},t,n)(i):n(i)}}};function ej(e,t,n){return(0,eh.factorySpace)(e,function(e){return null===e?n(e):t(e)},"whitespace")}let eA={};function eR(e){var t;let n,r,i,s=e||eA,m=this.data(),g=m.micromarkExtensions||(m.micromarkExtensions=[]),y=m.fromMarkdownExtensions||(m.fromMarkdownExtensions=[]),b=m.toMarkdownExtensions||(m.toMarkdownExtensions=[]);g.push((t=s,(0,G.combineExtensions)([{text:ei},{document:{91:{name:"gfmFootnoteDefinition",tokenize:ey,continuation:{tokenize:eb},exit:ex}},text:{91:{name:"gfmFootnoteCall",tokenize:eg},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ef,resolveTo:em}}},(n=(t||{}).singleTilde,r={name:"strikethrough",tokenize:function(e,t,r){let i=this.previous,s=this.events,o=0;return function(a){return 126===i&&"characterEscape"!==s[s.length-1][1].type?r(a):(e.enter("strikethroughSequenceTemporary"),function s(a){let l=(0,D.classifyCharacter)(i);if(126===a)return o>1?r(a):(e.consume(a),o++,s);if(o<2&&!n)return r(a);let u=e.exit("strikethroughSequenceTemporary"),c=(0,D.classifyCharacter)(a);return u._open=!c||2===c&&!!l,u._close=!l||2===l&&!!c,t(a)}(a))}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset==e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";let i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},s={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",s,t]],a=t.parser.constructs.insideSpan.null;a&&(0,ev.splice)(o,o.length,0,(0,ew.resolveAll)(a,e.slice(r+1,n),t)),(0,ev.splice)(o,o.length,0,[["exit",s,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),(0,ev.splice)(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}},null==n&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:ek,resolveAll:e_}}},{text:{91:eI}}]))),y.push([{transforms:[f],enter:{literalAutolink:l,literalAutolinkEmail:u,literalAutolinkHttp:u,literalAutolinkWww:u},exit:{literalAutolink:p,literalAutolinkEmail:h,literalAutolinkHttp:c,literalAutolinkWww:d}},{enter:{gfmFootnoteCallString:x,gfmFootnoteCall:v,gfmFootnoteDefinitionLabelString:w,gfmFootnoteDefinition:S},exit:{gfmFootnoteCallString:k,gfmFootnoteCall:_,gfmFootnoteDefinitionLabelString:E,gfmFootnoteDefinition:C}},{canContainEols:["delete"],enter:{strikethrough:R},exit:{strikethrough:M}},{enter:{table:B,tableData:$,tableHeader:$,tableRow:U},exit:{codeText:H,table:z,tableData:q,tableHeader:q,tableRow:q}},{exit:{taskListCheckValueChecked:Q,taskListCheckValueUnchecked:Q,paragraph:W}}]),b.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:o,notInConstruct:a},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:o,notInConstruct:a},{character:":",before:"[ps]",after:"\\/",inConstruct:o,notInConstruct:a}]},(i=!1,s&&s.firstLineBlank&&(i=!0),{handlers:{footnoteDefinition:function(e,t,n,r){let s=n.createTracker(r),o=s.move("[^"),a=n.enter("footnoteDefinition"),l=n.enter("label");return o+=s.move(n.safe(n.associationId(e),{before:o,after:"]"})),l(),o+=s.move("]:"),e.children&&e.children.length>0&&(s.shift(4),o+=s.move((i?"\n":" ")+n.indentLines(n.containerFlow(e,s.current()),i?j:I))),a(),o},footnoteReference:T},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:A}],handlers:{delete:N}},function(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=F(e,t,n);return n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&")),r},table:function(e,t,n,r){return a(function(e,t,n){let r=e.children,i=-1,s=[],o=t.enter("table");for(;++i<r.length;)s[i]=l(r[i],t,n);return o(),s}(e,n,r),e.align)},tableCell:o,tableRow:function(e,t,n,r){let i=a([l(e,n,r)]);return i.slice(0,i.indexOf("\n"))}}};function o(e,t,n,r){let i=n.enter("tableCell"),o=n.enter("phrasing"),a=n.containerPhrasing(e,{...r,before:s,after:s});return o(),i(),a}function a(e,t){return function(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||O,s=[],o=[],a=[],l=[],u=0,c=-1;for(;++c<e.length;){let t=[],r=[],s=-1;for(e[c].length>u&&(u=e[c].length);++s<e[c].length;){var d;let o=null==(d=e[c][s])?"":String(d);if(!1!==n.alignDelimiters){let e=i(o);r[s]=e,(void 0===l[s]||e>l[s])&&(l[s]=e)}t.push(o)}o[c]=t,a[c]=r}let h=-1;if("object"==typeof r&&"length"in r)for(;++h<u;)s[h]=P(r[h]);else{let e=P(r);for(;++h<u;)s[h]=e}h=-1;let p=[],f=[];for(;++h<u;){let e=s[h],t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let i=!1===n.alignDelimiters?1:Math.max(1,l[h]-t.length-r.length),o=t+"-".repeat(i)+r;!1!==n.alignDelimiters&&((i=t.length+i+r.length)>l[h]&&(l[h]=i),f[h]=i),p[h]=o}o.splice(1,0,p),a.splice(1,0,f),c=-1;let m=[];for(;++c<o.length;){let e=o[c],t=a[c];h=-1;let r=[];for(;++h<u;){let i=e[h]||"",o="",a="";if(!1!==n.alignDelimiters){let e=l[h]-(t[h]||0),n=s[h];114===n?o=" ".repeat(e):99===n?e%2?(o=" ".repeat(e/2+.5),a=" ".repeat(e/2-.5)):a=o=" ".repeat(e/2):a=" ".repeat(e)}!1===n.delimiterStart||h||r.push("|"),!1!==n.padding&&(!1!==n.alignDelimiters||""!==i)&&(!1!==n.delimiterStart||h)&&r.push(" "),!1!==n.alignDelimiters&&r.push(o),r.push(i),!1!==n.alignDelimiters&&r.push(a),!1!==n.padding&&r.push(" "),(!1!==n.delimiterEnd||h!==u-1)&&r.push("|")}m.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return m.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function l(e,t,n){let r=e.children,i=-1,s=[],a=t.enter("tableRow");for(;++i<r.length;)s[i]=o(r[i],e,t,n);return a(),s}}(s),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:K}}]})}e.s(["default",()=>eR],12878);var eM=e.i(20314);let eN=/^\*\*(.+?)\*\*\s+`([\s\S]+)`\s*$/,eO=/^\*\*(.+?)\*\*\s*$/;function eP(e){let t=e.trim(),n=t.match(eN);if(n){let[,e,t]=n,r=null;try{let e=JSON.parse(t);e&&"object"==typeof e&&!Array.isArray(e)&&(r=e)}catch{}return{kind:"tool",name:e.trim(),detail:t,parsed:r}}let r=t.match(eO);return r?{kind:"label-only",name:r[1].trim()}:null}function eD(e){return/^(Write|Edit|MultiEdit|Update)$/i.test(e)}function eF(e){if(!e)return null;for(let t of[e.file_path,e.path,e.filePath,e.filepath])if("string"==typeof t&&t.length>0)return t;return null}function eL(e){if(!e)return null;for(let t of[e.content,e.new_string,e.newString,e.new_content,e.text])if("string"==typeof t)return t;return null}function eB(e,t,n=80){if(e)for(let t of["command","file_path","path","pattern","query","url"]){let r=e[t];if("string"==typeof r&&r.length>0)return ez(r,n)}return ez(t.replace(/\s+/g," ").trim(),n)}function ez(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}e.s(["extractFileContent",()=>eL,"extractFilePath",()=>eF,"isFileWriteTool",()=>eD,"parseToolEvent",()=>eP,"summarizeToolDetail",()=>eB],90292);var eU=e.i(79054),eq=e.i(99105),e$=e.i(76016),eH=e.i(81975),eV=e.i(31777);let eQ={default:"bg-muted/40 hover:bg-muted/70",green:"bg-emerald-500/8 hover:bg-emerald-500/15 border-emerald-500/20",blue:"bg-sky-500/8 hover:bg-sky-500/15 border-sky-500/20"};function eW({name:e,summary:t,expanded:n,onToggle:r,icon:i,tint:s="default"}){return(0,eM.jsxs)("button",{type:"button",onClick:r,className:(0,eV.cn)("border-border/60 text-foreground/90 group inline-flex max-w-full items-center gap-1.5 rounded-md border px-2 py-0.5 font-mono text-[11px] transition-colors",eQ[s],n&&"rounded-b-none border-b-0"),children:[n?(0,eM.jsx)(eq.ChevronDown,{className:"h-3 w-3 shrink-0 opacity-60"}):(0,eM.jsx)(e$.ChevronRight,{className:"h-3 w-3 shrink-0 opacity-60"}),i??(0,eM.jsx)(eH.Wrench,{className:"h-3 w-3 shrink-0 opacity-60"}),(0,eM.jsx)("span",{className:"shrink-0 font-medium",children:e}),t?(0,eM.jsx)("span",{className:"text-muted-foreground/70 max-w-[360px] truncate",children:t}):null]})}function eK({name:e,detail:t,parsed:n}){let[r,i]=(0,eU.useState)(!1),s=eB(n,t),o=n?JSON.stringify(n,null,2):t;return(0,eM.jsxs)("div",{className:"inline-flex max-w-full flex-col",children:[(0,eM.jsx)(eW,{name:e,summary:r?null:s,expanded:r,onToggle:()=>i(e=>!e)}),r?(0,eM.jsx)("pre",{className:"border-border/60 bg-background/40 text-foreground/70 max-h-[300px] max-w-full overflow-auto rounded-md rounded-tl-none border px-3 py-2 font-mono text-[10px] leading-relaxed",children:o}):null]})}var eG=e.i(11345),eJ=e.i(70471),eY=e.i(3645);let eX=(0,eY.default)("pencil-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);function eZ({toolName:e,filePath:t,content:n}){let[r,i]=(0,eU.useState)(!1),s=t.split(/[\\/]/).pop()??t,o=n?n.split("\n").length:0,a=e.toLowerCase(),l=/edit/i.test(e);return r?(0,eM.jsxs)("div",{className:"border-border/60 bg-background/50 flex max-w-full flex-col overflow-hidden rounded-lg border",children:[(0,eM.jsxs)("div",{className:"bg-muted/60 border-border/60 flex items-center justify-between gap-2 border-b px-3 py-1.5",children:[(0,eM.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[l?(0,eM.jsx)(eX,{className:"h-3.5 w-3.5 shrink-0 text-sky-500"}):(0,eM.jsx)(eJ.FileText,{className:"h-3.5 w-3.5 shrink-0 text-emerald-500"}),(0,eM.jsx)("span",{className:"truncate font-mono text-[11px] font-medium",title:t,children:s}),(0,eM.jsx)("span",{className:"text-muted-foreground/60 shrink-0 font-mono text-[9px] tracking-wide uppercase",children:a})]}),(0,eM.jsxs)("button",{type:"button",onClick:()=>i(!1),className:"text-muted-foreground hover:text-foreground inline-flex shrink-0 items-center gap-1 rounded px-1.5 py-0.5 text-[10px] transition-colors","aria-label":"Collapse file preview",children:[(0,eM.jsx)(eG.ChevronLeft,{className:"h-3 w-3"}),"Back"]})]}),(0,eM.jsx)("pre",{className:"max-h-[420px] overflow-auto px-3 py-2 font-mono text-[10px] leading-relaxed",children:n??"(no content available)"}),(0,eM.jsx)("div",{className:"text-muted-foreground/60 border-border/60 border-t px-3 py-1 font-mono text-[9px]",children:t})]}):(0,eM.jsxs)("button",{type:"button",onClick:()=>i(!0),title:t,className:(0,eV.cn)("group inline-flex max-w-full items-center gap-2 rounded-lg border px-3 py-1.5 text-xs transition-all",l?"border-sky-500/25 bg-sky-500/10 hover:border-sky-500/40 hover:bg-sky-500/15":"border-emerald-500/25 bg-emerald-500/10 hover:border-emerald-500/40 hover:bg-emerald-500/15"),children:[(0,eM.jsx)("div",{className:(0,eV.cn)("flex h-6 w-6 shrink-0 items-center justify-center rounded",l?"bg-sky-500/15 text-sky-500":"bg-emerald-500/15 text-emerald-500"),children:l?(0,eM.jsx)(eX,{className:"h-3.5 w-3.5"}):(0,eM.jsx)(eJ.FileText,{className:"h-3.5 w-3.5"})}),(0,eM.jsxs)("div",{className:"flex min-w-0 flex-col items-start",children:[(0,eM.jsx)("span",{className:"truncate font-mono text-[11px] font-medium",children:s}),(0,eM.jsxs)("span",{className:"text-muted-foreground/70 font-mono text-[9px] tracking-wide uppercase",children:[a,o?` \xb7 ${o} line${1===o?"":"s"}`:""]})]})]})}function e0({text:e}){let t=eP(e);if(!t)return null;if("label-only"===t.kind)return(0,eM.jsx)(eK,{name:t.name,detail:"",parsed:null});if(eD(t.name)){let e=eF(t.parsed);if(e)return(0,eM.jsx)(eZ,{toolName:t.name,filePath:e,content:eL(t.parsed)})}return(0,eM.jsx)(eK,{name:t.name,detail:t.detail,parsed:t.parsed})}e.s(["ToolBubble",()=>e0],81835);let e1=(0,eY.default)("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);e.s(["CircleStop",()=>e1],49527)},14515,(e,t,n)=>{var r={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),n=t[0],r=t[1];return(n+r)*3/4-r},t.toByteArray=function(e){var t,n,s=l(e),o=s[0],a=s[1],u=new i((o+a)*3/4-a),c=0,d=a>0?o-4:o;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===a&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[c++]=255&t),1===a&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,s=[],o=0,a=r-i;o<a;o+=16383)s.push(function(e,t,r){for(var i,s=[],o=t;o<r;o+=3)i=(e[o]<<16&0xff0000)+(e[o+1]<<8&65280)+(255&e[o+2]),s.push(n[i>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}(e,o,o+16383>a?a:o+16383));return 1===i?s.push(n[(t=e[r-1])>>2]+n[t<<4&63]+"=="):2===i&&s.push(n[(t=(e[r-2]<<8)+e[r-1])>>10]+n[t>>4&63]+n[t<<2&63]+"="),s.join("")};for(var n=[],r=[],i="u">typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=s.length;o<a;++o)n[o]=s[o],r[s.charCodeAt(o)]=o;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");-1===n&&(n=t);var r=n===t?0:4-n%4;return[n,r]}r[45]=62,r[95]=63},72:function(e,t,n){"use strict";var r=n(675),i=n(783),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,n){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return l(e,t,n)}function l(e,t,n){if("string"==typeof e){var r=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);var s=0|p(r,i),l=o(s),u=l.write(r,i);return u!==s&&(l=l.slice(0,u)),l}if(ArrayBuffer.isView(e))return d(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(j(e,ArrayBuffer)||e&&j(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(j(e,SharedArrayBuffer)||e&&j(e.buffer,SharedArrayBuffer)))return function(e,t,n){var r;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),a.prototype),r}(e,t,n);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var c=e.valueOf&&e.valueOf();if(null!=c&&c!==e)return a.from(c,t,n);var f=function(e){if(a.isBuffer(e)){var t=0|h(e.length),n=o(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?o(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(f)return f;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,n);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),o(e<0?0:0|h(e))}function d(e){for(var t=e.length<0?0:0|h(e.length),n=o(t),r=0;r<t;r+=1)n[r]=255&e[r];return n}t.Buffer=a,t.SlowBuffer=function(e){return+e!=e&&(e=0),a.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,a.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!a.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,n){return l(e,t,n)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,n){return(u(e),e<=0)?o(e):void 0!==t?"string"==typeof n?o(e).fill(t,n):o(e).fill(t):o(e)},a.allocUnsafe=function(e){return c(e)},a.allocUnsafeSlow=function(e){return c(e)};function h(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||j(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return E(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return T(e).length;default:if(i)return r?-1:E(e).length;t=(""+t).toLowerCase(),i=!0}}function f(e,t,n){var i,s,o,a=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0||(n>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",s=t;s<n;++s)i+=A[e[s]];return i}(this,t,n);case"utf8":case"utf-8":return b(this,t,n);case"ascii":return function(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}(this,t,n);case"latin1":case"binary":return function(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}(this,t,n);case"base64":return i=this,s=t,o=n,0===s&&o===i.length?r.fromByteArray(i):r.fromByteArray(i.slice(s,o));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,n){for(var r=e.slice(t,n),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+256*r[s+1]);return i}(this,t,n);default:if(a)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){var s;if(0===e.length)return -1;if("string"==typeof n?(r=n,n=0):n>0x7fffffff?n=0x7fffffff:n<-0x80000000&&(n=-0x80000000),(s=n*=1)!=s&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length)if(i)return -1;else n=e.length-1;else if(n<0)if(!i)return -1;else n=0;if("string"==typeof t&&(t=a.from(t,r)),a.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,n);else return Uint8Array.prototype.lastIndexOf.call(e,t,n);return y(e,[t],n,r,i)}throw TypeError("val must be string, number or Buffer")}function y(e,t,n,r,i){var s,o=1,a=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return -1;o=2,a/=2,l/=2,n/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(s=n;s<a;s++)if(u(e,s)===u(t,-1===c?0:s-c)){if(-1===c&&(c=s),s-c+1===l)return c*o}else -1!==c&&(s-=s-c),c=-1}else for(n+l>a&&(n=a-l),s=n;s>=0;s--){for(var d=!0,h=0;h<l;h++)if(u(e,s+h)!==u(t,h)){d=!1;break}if(d)return s}return -1}a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(j(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),j(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,r=t.length,i=0,s=Math.min(n,r);i<s;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);if(void 0===t)for(n=0,t=0;n<e.length;++n)t+=e[n].length;var n,r=a.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var s=e[n];if(j(s,Uint8Array)&&(s=a.from(s)),!a.isBuffer(s))throw TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},a.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?b(this,0,e):f.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,n,r,i){if(j(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var s=i-r,o=n-t,l=Math.min(s,o),u=this.slice(r,i),c=e.slice(t,n),d=0;d<l;++d)if(u[d]!==c[d]){s=u[d],o=c[d];break}return s<o?-1:+(o<s)},a.prototype.includes=function(e,t,n){return -1!==this.indexOf(e,t,n)},a.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},a.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)};function b(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var s,o,a,l,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:(192&(s=e[i+1]))==128&&(l=(31&u)<<6|63&s)>127&&(c=l);break;case 3:s=e[i+1],o=e[i+2],(192&s)==128&&(192&o)==128&&(l=(15&u)<<12|(63&s)<<6|63&o)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:s=e[i+1],o=e[i+2],a=e[i+3],(192&s)==128&&(192&o)==128&&(192&a)==128&&(l=(15&u)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=d}var h=r,p=h.length;if(p<=4096)return String.fromCharCode.apply(String,h);for(var f="",m=0;m<p;)f+=String.fromCharCode.apply(String,h.slice(m,m+=4096));return f}function x(e,t,n){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>n)throw RangeError("Trying to access beyond buffer length")}function v(e,t,n,r,i,s){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw RangeError('"value" argument is out of bounds');if(n+r>e.length)throw RangeError("Index out of range")}function w(e,t,n,r,i,s){if(n+r>e.length||n<0)throw RangeError("Index out of range")}function S(e,t,n,r,s){return t*=1,n>>>=0,s||w(e,t,n,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,n,r,23,4),n+4}function k(e,t,n,r,s){return t*=1,n>>>=0,s||w(e,t,n,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,n,r,52,8),n+8}a.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,s,o,a,l,u,c,d,h=this.length-t;if((void 0===n||n>h)&&(n=h),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var p=!1;;)switch(r){case"hex":return function(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var s=t.length;r>s/2&&(r=s/2);for(var o=0;o<r;++o){var a,l=parseInt(t.substr(2*o,2),16);if((a=l)!=a)break;e[n+o]=l}return o}(this,e,t,n);case"utf8":case"utf-8":return i=t,s=n,I(E(e,this.length-i),this,i,s);case"ascii":return o=t,a=n,I(C(e),this,o,a);case"latin1":case"binary":return function(e,t,n,r){return I(C(t),e,n,r)}(this,e,t,n);case"base64":return l=t,u=n,I(T(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,d=n,I(function(e,t){for(var n,r,i=[],s=0;s<e.length&&!((t-=2)<0);++s)r=(n=e.charCodeAt(s))>>8,i.push(n%256),i.push(r);return i}(e,this.length-c),this,c,d);default:if(p)throw TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),p=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);var r=this.subarray(e,t);return Object.setPrototypeOf(r,a.prototype),r},a.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||x(e,t,this.length);for(var r=this[e],i=1,s=0;++s<t&&(i*=256);)r+=this[e+s]*i;return r},a.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||x(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},a.prototype.readUInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||x(e,t,this.length);for(var r=this[e],i=1,s=0;++s<t&&(i*=256);)r+=this[e+s]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},a.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||x(e,t,this.length);for(var r=t,i=1,s=this[e+--r];r>0&&(i*=256);)s+=this[e+--r]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},a.prototype.readInt8=function(e,t){return(e>>>=0,t||x(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||x(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?0xffff0000|n:n},a.prototype.readInt16BE=function(e,t){e>>>=0,t||x(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?0xffff0000|n:n},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||x(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||x(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||x(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||x(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,n,r){if(e*=1,t>>>=0,n>>>=0,!r){var i=Math.pow(2,8*n)-1;v(this,e,t,n,i,0)}var s=1,o=0;for(this[t]=255&e;++o<n&&(s*=256);)this[t+o]=e/s&255;return t+n},a.prototype.writeUIntBE=function(e,t,n,r){if(e*=1,t>>>=0,n>>>=0,!r){var i=Math.pow(2,8*n)-1;v(this,e,t,n,i,0)}var s=n-1,o=1;for(this[t+s]=255&e;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+n},a.prototype.writeUInt8=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUInt16BE=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUInt32LE=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUInt32BE=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,n,r){if(e*=1,t>>>=0,!r){var i=Math.pow(2,8*n-1);v(this,e,t,n,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s<n&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+n},a.prototype.writeIntBE=function(e,t,n,r){if(e*=1,t>>>=0,!r){var i=Math.pow(2,8*n-1);v(this,e,t,n,i-1,-i)}var s=n-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,n){return S(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return S(this,e,t,!1,n)},a.prototype.writeDoubleLE=function(e,t,n){return k(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return k(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,r){if(!a.isBuffer(e))throw TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw RangeError("Index out of range");if(r<0)throw RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i=r-n;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,n,r);else if(this===e&&n<t&&t<r)for(var s=i-1;s>=0;--s)e[s+t]=this[s+n];else Uint8Array.prototype.set.call(e,this.subarray(n,r),t);return i},a.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw TypeError("encoding must be a string");if("string"==typeof r&&!a.isEncoding(r))throw TypeError("Unknown encoding: "+r);if(1===e.length){var i,s=e.charCodeAt(0);("utf8"===r&&s<128||"latin1"===r)&&(e=s)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError("Out of range index");if(n<=t)return this;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{var o=a.isBuffer(e)?e:a.from(e,r),l=o.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=o[i%l]}return this};var _=/[^+/0-9A-Za-z-_]/g;function E(e,t){t=t||1/0;for(var n,r=e.length,i=null,s=[],o=0;o<r;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319||o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else if(n<1114112){if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}else throw Error("Invalid code point")}return s}function C(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}function T(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(_,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function I(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length)&&!(i>=e.length);++i)t[i+n]=e[i];return i}function j(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var A=function(){for(var e="0123456789abcdef",t=Array(256),n=0;n<16;++n)for(var r=16*n,i=0;i<16;++i)t[r+i]=e[n]+e[i];return t}()},783:function(e,t){t.read=function(e,t,n,r,i){var s,o,a=8*i-r-1,l=(1<<a)-1,u=l>>1,c=-7,d=n?i-1:0,h=n?-1:1,p=e[t+d];for(d+=h,s=p&(1<<-c)-1,p>>=-c,c+=a;c>0;s=256*s+e[t+d],d+=h,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=r;c>0;o=256*o+e[t+d],d+=h,c-=8);if(0===s)s=1-u;else{if(s===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),s-=u}return(p?-1:1)*o*Math.pow(2,s-r)},t.write=function(e,t,n,r,i,s){var o,a,l,u=8*s-i-1,c=(1<<u)-1,d=c>>1,h=5960464477539062e-23*(23===i),p=r?0:s-1,f=r?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(a=+!!isNaN(t),o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+d>=1?t+=h/l:t+=h*Math.pow(2,1-d),t*l>=2&&(o++,l/=2),o+d>=c?(a=0,o=c):o+d>=1?(a=(t*l-1)*Math.pow(2,i),o+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[n+p]=255&a,p+=f,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;e[n+p]=255&o,p+=f,o/=256,u-=8);e[n+p-f]|=128*m}}},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}},o=!0;try{r[e](n,n.exports,s),o=!1}finally{o&&delete i[e]}return n.exports}s.ab="/ROOT/node_modules/.pnpm/next@16.1.6_@babel+core@7.29.0_@playwright+test@1.58.1_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/next/dist/compiled/buffer/",t.exports=s(72)},78598,(e,t,n)=>{"use strict";var r=e.i(14515);let i=void 0!==r.Buffer,s=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,o=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function a(e,t,n){null==n&&null!==t&&"object"==typeof t&&(n=t,t=void 0),i&&r.Buffer.isBuffer(e)&&(e=e.toString()),e&&65279===e.charCodeAt(0)&&(e=e.slice(1));let a=JSON.parse(e,t);if(null===a||"object"!=typeof a)return a;let u=n&&n.protoAction||"error",c=n&&n.constructorAction||"error";if("ignore"===u&&"ignore"===c)return a;if("ignore"!==u&&"ignore"!==c){if(!1===s.test(e)&&!1===o.test(e))return a}else if("ignore"!==u&&"ignore"===c){if(!1===s.test(e))return a}else if(!1===o.test(e))return a;return l(a,{protoAction:u,constructorAction:c,safe:n&&n.safe})}function l(e,{protoAction:t="error",constructorAction:n="error",safe:r}={}){let i=[e];for(;i.length;){let e=i;for(let s of(i=[],e)){if("ignore"!==t&&Object.prototype.hasOwnProperty.call(s,"__proto__")){if(!0===r)return null;if("error"===t)throw SyntaxError("Object contains forbidden prototype property");delete s.__proto__}if("ignore"!==n&&Object.prototype.hasOwnProperty.call(s,"constructor")&&null!==s.constructor&&"object"==typeof s.constructor&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype")){if(!0===r)return null;if("error"===n)throw SyntaxError("Object contains forbidden prototype property");delete s.constructor}for(let e in s){let t=s[e];t&&"object"==typeof t&&i.push(t)}}}return e}function u(e,t,n){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return a(e,t,n)}finally{Error.stackTraceLimit=r}}t.exports=u,t.exports.default=u,t.exports.parse=u,t.exports.safeParse=function(e,t){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return a(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=n}},t.exports.scan=l},15109,84408,62680,e=>{"use strict";var t=e.i(20314),n=e.i(26036),r=e.i(63045),i=e.i(17466),s=e.i(61302),o=e.i(94875),a=e.i(30854),l=e.i(427),u=e.i(12878);e.i(41001);var c=e.i(64780),d=e.i(31777),h=e.i(81835),p=e.i(90292),f=e.i(11719),m=e.i(49527),g=e.i(33548),y=e.i(35946),b=e.i(26370),x=e.i(94365),v=e.i(87538),w=e.i(60253),S=e.i(99105),k=e.i(48829),_=e.i(83428),E=e.i(23925),C=e.i(79054);let T={p:({children:e})=>(0,t.jsx)("p",{className:"mb-2 leading-relaxed last:mb-0",children:e}),strong:({children:e})=>(0,t.jsx)("strong",{className:"font-semibold",children:e}),em:({children:e})=>(0,t.jsx)("em",{className:"italic",children:e}),code:({children:e,className:n})=>n?(0,t.jsx)("code",{className:`${n} text-[11px]`,children:e}):(0,t.jsx)("code",{className:"bg-background/50 rounded-md px-1.5 py-0.5 font-mono text-xs",children:e}),pre:({children:e})=>{let n=e?.props?.className?.replace("language-","")??"",r="string"==typeof e?.props?.children?e.props.children:"";return["html","svg"].includes(n)&&r.length>0?(0,t.jsx)(D,{code:r,language:n}):(0,t.jsx)(P,{language:n,children:e})},ul:({children:e})=>(0,t.jsx)("ul",{className:"mb-2 list-disc ps-4 last:mb-0",children:e}),ol:({children:e})=>(0,t.jsx)("ol",{className:"mb-2 list-decimal ps-4 last:mb-0",children:e}),li:({children:e})=>(0,t.jsx)("li",{className:"mb-0.5",children:e}),h1:({children:e})=>(0,t.jsx)("h1",{className:"mb-1 text-base font-bold",children:e}),h2:({children:e})=>(0,t.jsx)("h2",{className:"mb-1 text-sm font-bold",children:e}),h3:({children:e})=>(0,t.jsx)("h3",{className:"mb-1 text-sm font-semibold",children:e}),a:({children:e,href:n})=>(0,t.jsx)("a",{href:n,className:"text-blue-500 underline",target:"_blank",rel:"noopener noreferrer",children:e}),blockquote:({children:e})=>(0,t.jsx)("blockquote",{className:"border-muted-foreground/30 my-1 border-s-2 ps-3 italic opacity-80",children:e}),table:({children:e})=>(0,t.jsx)("div",{className:"my-2 overflow-x-auto",children:(0,t.jsx)("table",{className:"min-w-full border-collapse text-xs",children:e})}),thead:({children:e})=>(0,t.jsx)("thead",{className:"bg-muted/50 border-b",children:e}),th:({children:e})=>(0,t.jsx)("th",{className:"px-2 py-1 text-start font-semibold",children:e}),td:({children:e})=>(0,t.jsx)("td",{className:"border-muted border-t px-2 py-1",children:e}),tr:({children:e})=>(0,t.jsx)("tr",{children:e}),hr:()=>(0,t.jsx)("hr",{className:"border-border/40 my-3 border-t"})};function I({className:e,beforeMessages:n,afterMessages:r,composer:i,hideEmpty:s}){return(0,t.jsxs)(o.ThreadPrimitive.Root,{className:(0,d.cn)("flex h-full flex-col",e),children:[(0,t.jsxs)(o.ThreadPrimitive.Viewport,{className:"flex flex-1 flex-col overflow-y-auto pt-4",children:[s?null:(0,t.jsx)(o.ThreadPrimitive.Empty,{children:(0,t.jsx)(j,{})}),n,(0,t.jsx)(o.ThreadPrimitive.Messages,{components:{UserMessage:R,AssistantMessage:O}}),r]}),i??(0,t.jsx)(V,{})]})}function j(){return(0,t.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 p-8 text-center",children:[(0,t.jsx)(b.Bot,{className:"text-muted-foreground/40 h-10 w-10"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:"Send a message to start chatting with the agent."})]})}let A="{{interaction}}",R=()=>{let e=(0,a.useMessage)(),n=e?.content?.[0],i=n&&"text"in n?n.text:"";return i.startsWith(A)?(0,t.jsx)(M,{text:i}):(0,t.jsxs)(s.MessagePrimitive.Root,{className:"group animate-in fade-in-0 slide-in-from-bottom-1 flex w-full items-start gap-2.5 px-4 py-0.5 duration-300 ease-out",children:[(0,t.jsx)("div",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-violet-500/15",children:(0,t.jsx)(x.User,{className:"h-3.5 w-3.5 text-violet-500"})}),(0,t.jsxs)("div",{className:"flex max-w-[85%] min-w-0 flex-col gap-0.5",children:[(0,t.jsx)("div",{className:"text-foreground mt-px overflow-hidden rounded-2xl rounded-tl-sm border border-violet-500/15 bg-violet-500/8 px-4 py-2 text-sm leading-relaxed break-words shadow-sm backdrop-blur-md",children:(0,t.jsx)(s.MessagePrimitive.Content,{components:{Text:N}})}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,t.jsx)($,{}),(0,t.jsx)(r.ActionBarPrimitive.Root,{className:"flex items-center gap-1",children:(0,t.jsx)(r.ActionBarPrimitive.Copy,{asChild:!0,children:(0,t.jsx)(H,{tooltip:"Copy",children:(0,t.jsx)(g.Copy,{})})})})]})]})]})};function M({text:e}){let n=(0,C.useMemo)(()=>{try{let t=e.slice(A.length);return JSON.parse(t)}catch{return null}},[e]);return n?(0,t.jsxs)(s.MessagePrimitive.Root,{className:"group animate-in fade-in-0 slide-in-from-bottom-1 flex w-full items-start gap-2.5 px-4 py-0.5 duration-300 ease-out",children:[(0,t.jsx)("div",{className:"bg-muted flex h-6 w-6 shrink-0 items-center justify-center rounded-full",children:(0,t.jsx)(E.Check,{className:"h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400"})}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,t.jsx)("div",{className:"text-foreground mt-px flex flex-wrap items-center gap-x-4 gap-y-1 rounded-2xl rounded-tl-sm border border-emerald-600/20 bg-emerald-50/50 px-4 py-2 text-sm shadow-sm dark:border-emerald-500/20 dark:bg-emerald-950/20",children:n.questions.map(e=>(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full bg-emerald-100 px-2 py-0.5 text-[10px] font-semibold tracking-wider text-emerald-700 uppercase dark:bg-emerald-900/50 dark:text-emerald-400",children:e.header}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:n.answers[e.question]||"No answer"})]},e.question))}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,t.jsx)($,{}),(0,t.jsx)(r.ActionBarPrimitive.Root,{className:"flex items-center gap-1",children:(0,t.jsx)(r.ActionBarPrimitive.Copy,{asChild:!0,children:(0,t.jsx)(H,{tooltip:"Copy",children:(0,t.jsx)(g.Copy,{})})})})]})]})]}):null}function N({text:e}){return(0,t.jsx)("span",{className:"whitespace-pre-wrap",children:e})}let O=()=>{let e=(0,a.useMessage)(),n=e?.content?.[0],i=n&&"text"in n?n.text:"";return(i?(0,p.parseToolEvent)(i):null)?(0,t.jsxs)(s.MessagePrimitive.Root,{className:"group animate-in fade-in-0 slide-in-from-bottom-1 flex w-full items-start gap-2.5 px-4 py-0.5 duration-300 ease-out",children:[(0,t.jsx)("div",{className:"text-muted-foreground/40 mt-1 flex h-6 w-6 shrink-0 items-center justify-center",children:(0,t.jsx)(b.Bot,{className:"h-3 w-3"})}),(0,t.jsx)("div",{className:"flex min-w-0 flex-1 items-center py-0.5",children:(0,t.jsx)(h.ToolBubble,{text:i})})]}):(0,t.jsxs)(s.MessagePrimitive.Root,{className:"group animate-in fade-in-0 slide-in-from-bottom-1 flex w-full items-start gap-2.5 px-4 py-0.5 duration-300 ease-out",children:[(0,t.jsx)("div",{className:"bg-muted flex h-6 w-6 shrink-0 items-center justify-center rounded-full",children:(0,t.jsx)(b.Bot,{className:"text-muted-foreground h-3.5 w-3.5"})}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,t.jsx)("div",{className:"bg-muted/50 text-foreground mt-px overflow-hidden rounded-2xl rounded-tl-sm border border-white/5 px-4 py-2 text-sm leading-relaxed break-words shadow-sm backdrop-blur-md",children:(0,t.jsx)(s.MessagePrimitive.Content,{components:{Text:L}})}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,t.jsx)($,{}),(0,t.jsx)(r.ActionBarPrimitive.Root,{className:"flex items-center gap-1",children:(0,t.jsx)(r.ActionBarPrimitive.Copy,{asChild:!0,children:(0,t.jsx)(H,{tooltip:"Copy",children:(0,t.jsx)(g.Copy,{})})})})]})]})]})};function P({children:e,language:n}){let{t:r}=(0,c.useTranslation)("web"),[i,s]=(0,C.useState)(!1),[o,a]=(0,C.useState)(!1),l=(0,C.useRef)(null);return(0,C.useEffect)(()=>{l.current&&l.current.scrollHeight>240&&a(!0)},[e]),(0,t.jsxs)("div",{className:"bg-background/50 relative my-2 overflow-hidden rounded-md",children:[n?(0,t.jsx)("div",{className:"text-muted-foreground/50 border-b border-white/5 px-3 py-1 font-mono text-[10px] uppercase",children:n}):null,(0,t.jsx)("pre",{ref:l,className:"overflow-x-auto p-3 font-mono text-xs leading-relaxed transition-[max-height] duration-300 ease-in-out",style:{maxHeight:i?"min(60vh, 500px)":o?"200px":"min(60vh, 500px)",overflow:i?"auto":void 0},children:e}),o&&!i?(0,t.jsx)("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center bg-gradient-to-t from-black/60 via-black/30 to-transparent pt-12 pb-3",children:(0,t.jsxs)("button",{type:"button",onClick:()=>s(!0),className:"inline-flex items-center gap-1 rounded-full border border-white/10 bg-white/10 px-3 py-1 text-[11px] font-medium text-white/80 shadow-lg backdrop-blur-md transition-all hover:bg-white/20 hover:text-white",children:[(0,t.jsx)(S.ChevronDown,{className:"h-3 w-3"}),r("chat.showMore")]})}):null,o&&i?(0,t.jsx)("div",{className:"flex justify-center border-t border-white/5 py-1.5",children:(0,t.jsxs)("button",{type:"button",onClick:()=>s(!1),className:"inline-flex items-center gap-1 rounded-full px-3 py-0.5 text-[11px] text-white/50 transition-colors hover:text-white/80",children:[(0,t.jsx)(k.ChevronUp,{className:"h-3 w-3"}),r("chat.showLess")]})}):null]})}function D({code:e,language:r}){let{t:i}=(0,c.useTranslation)("web"),[s,o]=(0,C.useState)(!1),[a,l]=(0,C.useState)(!1),[u,h]=(0,C.useState)(!1),p=e.split("\n").length,f=e.length;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"bg-background/50 my-2 overflow-hidden rounded-md border",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between border-b px-3 py-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground font-mono text-xs uppercase",children:r}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("button",{type:"button",onClick:()=>o(!1),className:(0,d.cn)("rounded px-2.5 py-0.5 text-xs font-medium transition-colors",s?"text-muted-foreground hover:text-foreground":"bg-muted text-foreground"),children:i("chat.code")}),(0,t.jsx)("button",{type:"button",onClick:()=>o(!0),className:(0,d.cn)("rounded px-2.5 py-0.5 text-xs font-medium transition-colors",s?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:i("chat.preview")}),(0,t.jsx)("button",{type:"button",onClick:()=>{h(!s),l(!0)},className:"text-muted-foreground hover:text-foreground ms-1 rounded p-0.5 transition-colors",title:i("chat.openFullscreen"),children:(0,t.jsx)(v.Maximize2,{className:"h-3 w-3"})})]})]}),(0,t.jsx)("div",{style:{height:"min(55vh, 450px)"},children:s?(0,t.jsx)("iframe",{srcDoc:e,sandbox:"allow-scripts",className:"h-full w-full border-0 bg-white",title:i("chat.htmlPreview")}):(0,t.jsx)("pre",{className:"h-full overflow-auto p-3 font-mono text-xs leading-relaxed",children:(0,t.jsx)("code",{children:e})})})]}),a&&"u">typeof document?(0,n.createPortal)((0,t.jsx)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/70 backdrop-blur-sm",onClick:()=>l(!1),children:(0,t.jsxs)("div",{className:"bg-background relative flex h-[95vh] w-[95vw] flex-col overflow-hidden rounded-xl border shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:"bg-muted/80 flex h-12 shrink-0 items-center justify-between border-b px-5",children:[(0,t.jsxs)("div",{className:"bg-muted flex items-center gap-0.5 rounded-lg p-1",children:[(0,t.jsx)("button",{type:"button",onClick:()=>h(!1),className:(0,d.cn)("rounded-md px-4 py-1.5 text-sm font-medium transition-all",u?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:i("chat.preview")}),(0,t.jsx)("button",{type:"button",onClick:()=>h(!0),className:(0,d.cn)("rounded-md px-4 py-1.5 text-sm font-medium transition-all",u?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:i("chat.code")})]}),(0,t.jsxs)("div",{className:"text-muted-foreground/60 flex items-center gap-4 text-xs",children:[(0,t.jsxs)("span",{children:[p," lines"]}),(0,t.jsxs)("span",{children:[f.toLocaleString()," chars"]}),(0,t.jsx)("span",{className:"font-mono uppercase",children:r})]}),(0,t.jsx)("button",{type:"button",onClick:()=>l(!1),className:"text-muted-foreground hover:bg-muted hover:text-foreground rounded-lg p-2 transition-colors",children:(0,t.jsx)(w.X,{className:"h-5 w-5"})})]}),u?(0,t.jsx)("pre",{className:"flex-1 overflow-auto p-4 font-mono text-xs leading-relaxed",children:(0,t.jsx)("code",{children:e})}):(0,t.jsx)("iframe",{srcDoc:e,sandbox:"allow-scripts",className:"flex-1 border-0 bg-white dark:bg-neutral-900",title:i("chat.htmlPreviewFullscreen")})]})}),document.body):null]})}let F=/^\*⏳ (.+)\*$/;function L({text:e}){if("*Thinking...*"===e||"*Agent is waking up...*"===e)return(0,t.jsx)(q,{booting:e.includes("waking")});let n=F.exec(e);return n?(0,t.jsx)(B,{label:n[1]}):(0,t.jsx)(l.default,{remarkPlugins:[u.default],components:T,children:e})}function B({label:e}){return(0,t.jsxs)("span",{className:"text-muted-foreground inline-flex items-center gap-2 text-sm italic",children:[(0,t.jsx)(_.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),(0,t.jsx)("span",{children:e})]})}let z=["Thinking","Reasoning","Analyzing","Processing","Evaluating","Considering","Reflecting","Pondering"],U=["Waking up","Initializing","Loading tools","Preparing","Connecting"];function q({booting:e}){let n=e?U:z,[r,i]=(0,C.useState)(0),[s,o]=(0,C.useState)(!0);return(0,C.useEffect)(()=>{let e=setInterval(()=>{o(!1),setTimeout(()=>{i(e=>(e+1)%n.length),o(!0)},200)},2e3);return()=>clearInterval(e)},[n]),(0,t.jsxs)("span",{className:"text-muted-foreground inline-flex w-32 items-center gap-1.5 text-sm italic",children:[(0,t.jsx)("span",{className:"inline-block transition-all duration-300 ease-in-out",style:{opacity:+!!s,transform:s?"translateY(0)":"translateY(-4px)"},children:n[r]}),(0,t.jsxs)("span",{className:"inline-flex gap-0.5",children:[(0,t.jsx)("span",{className:"bg-muted-foreground/60 h-1 w-1 animate-bounce rounded-full",style:{animationDelay:"0ms"}}),(0,t.jsx)("span",{className:"bg-muted-foreground/60 h-1 w-1 animate-bounce rounded-full",style:{animationDelay:"150ms"}}),(0,t.jsx)("span",{className:"bg-muted-foreground/60 h-1 w-1 animate-bounce rounded-full",style:{animationDelay:"300ms"}})]})]})}function $(){let e=(0,a.useMessage)(),[n,r]=(0,C.useState)(0);(0,C.useEffect)(()=>{let e=setInterval(()=>r(e=>e+1),3e4);return()=>clearInterval(e)},[]);let i=(0,C.useMemo)(()=>{if(!e?.createdAt)return null;let t=new Date(e.createdAt);return isNaN(t.getTime())?null:{time:t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),relative:function(e){let t=Date.now()-e.getTime();if(t<0||t<5e3)return"just now";let n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:e.toLocaleDateString()}(t)}},[e?.createdAt,n]);return i?(0,t.jsx)("span",{className:"text-muted-foreground/60 text-[10px]",title:i.time,children:i.relative}):null}let H=(0,C.forwardRef)(({tooltip:e,children:n,className:r,...i},s)=>(0,t.jsx)("button",{ref:s,type:"button",title:e,className:(0,d.cn)("text-muted-foreground hover:text-foreground hover:bg-muted inline-flex h-7 w-7 items-center justify-center rounded-md transition-colors","[&>svg]:h-3.5 [&>svg]:w-3.5",r),...i,children:n}));function V(){return(0,t.jsxs)(i.ComposerPrimitive.Root,{className:"flex items-end gap-2 border-t p-3",children:[(0,t.jsx)(i.ComposerPrimitive.AddAttachment,{asChild:!0,children:(0,t.jsx)(H,{tooltip:"Attach file",className:"mb-0.5",children:(0,t.jsx)(y.Paperclip,{})})}),(0,t.jsx)(i.ComposerPrimitive.Input,{rows:1,autoFocus:!0,placeholder:"Write a message...",className:(0,d.cn)("bg-muted min-h-[40px] flex-1 resize-none rounded-xl border-0 px-4 py-2.5 text-sm","focus:ring-ring/30 focus:ring-2 focus:outline-none","placeholder:text-muted-foreground/60","max-h-40 overflow-y-auto")}),(0,t.jsx)(Q,{})]})}function Q(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ThreadPrimitive.If,{running:!1,children:(0,t.jsx)(i.ComposerPrimitive.Send,{className:(0,d.cn)("bg-primary text-primary-foreground inline-flex h-[40px] w-[40px] shrink-0 items-center justify-center rounded-xl","hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-30","transition-colors"),children:(0,t.jsx)(f.SendHorizontal,{className:"size-4"})})}),(0,t.jsx)(o.ThreadPrimitive.If,{running:!0,children:(0,t.jsx)(i.ComposerPrimitive.Cancel,{className:(0,d.cn)("bg-destructive/10 text-destructive inline-flex h-[40px] w-[40px] shrink-0 items-center justify-center rounded-xl","hover:bg-destructive/20","transition-colors"),children:(0,t.jsx)(m.CircleStop,{className:"size-4"})})})]})}function W(e,t){if(!t||0===t.length)return e;let n=t.map(e=>e.notes?.trim()?`@${e.path} [Note: ${e.notes.trim()}]`:`@${e.path}`).join(" ");return`${e}
3
+ ${t.system}`:e.system=t.system),t.tools)for(let[n,r]of Object.entries(t.tools)){let t=e.tools?.[n];if(t&&t!==r)throw Error(`You tried to define a tool with the name ${n}, but it already exists.`);e.tools||(e.tools={}),e.tools[n]=r}return t.config&&(e.config={...e.config,...t.config}),t.callSettings&&(e.callSettings={...e.callSettings,...t.callSettings}),e},{})}registerModelContextProvider(e){this._providers.add(e);let t=e.subscribe?.(()=>{this.notifySubscribers()});return this.notifySubscribers(),()=>{this._providers.delete(e),t?.(),this.notifySubscribers()}}_subscribers=new Set;notifySubscribers(){for(let e of this._subscribers)e()}subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}}e.s(["CompositeContextProvider",()=>eW],38048);let eK=y(()=>{let[e]=I(()=>({version:2})),t=S(()=>new eW,[]);return{getState:()=>e,getModelContext:()=>t.getModelContext(),subscribe:e=>t.subscribe(e),register:e=>t.registerModelContextProvider(e)}}),eJ=y(e=>({getState:()=>e})),eQ=y(e=>{let[t]=I(()=>({suggestions:(e??[]).map(e=>"string"==typeof e?{title:e,label:"",prompt:e}:{title:e.title,label:e.label,prompt:e.prompt})})),n=eM(()=>t.suggestions.map((e,t)=>D(t,eJ(e))),[t.suggestions]);return{getState:()=>t,suggestion:({index:e})=>n.get({index:e})}}),eG=y(e=>{let t=eb().clientRef;return E(()=>e.registerModelContextProvider(t.current.modelContext()),[e,t]),P(eV({runtime:e.threads,__internal_assistantRuntime:e}))}),eY=y(()=>{let[e,t]=I(()=>({renderers:{}}));return{getState:()=>e,setDataUI:C((e,n)=>(t(t=>({...t,renderers:{...t.renderers,[e]:[...t.renderers[e]??[],n]}})),()=>{t(t=>({...t,renderers:{...t.renderers,[e]:t.renderers[e]?.filter(e=>e!==n)??[]}}))}),[])}}),eX=y(({toolkit:e})=>{let[t,n]=I(()=>({tools:{}})),r=eb().clientRef,i=C((e,t)=>(n(n=>({...n,tools:{...n.tools,[e]:[...n.tools[e]??[],t]}})),()=>{n(n=>({...n,tools:{...n.tools,[e]:n.tools[e]?.filter(e=>e!==t)??[]}}))}),[]);return E(()=>{if(!e)return;let t=[];for(let[n,r]of Object.entries(e))r.render&&t.push(i(n,r.render));let n=Object.entries(e).reduce((e,[t,n])=>{let{render:r,...i}=n;return e[t]=i,e},{});return t.push(r.current.modelContext().register({getModelContext:()=>({tools:n})})),()=>{t.forEach(e=>e())}},[e,i,r]),{getState:()=>t,setToolUI:i}});ef(eX,(e,t)=>({...e,...e.modelContext||null!==t.modelContext.source?{}:{modelContext:eK()}}));let eZ=y(e=>P(eG(e)));ef(eZ,(e,t)=>{let n,r=((n={...e,thread:e.thread??eh({source:"threads",query:{type:"main"},get:e=>e.threads().thread("main")}),threadListItem:e.threadListItem??eh({source:"threads",query:{type:"main"},get:e=>e.threads().item("main")}),composer:e.composer??eh({source:"thread",query:{},get:e=>e.threads().thread("main").composer()})}).modelContext||null!==t.modelContext.source||(n.modelContext=eK()),n.suggestions||null!==t.suggestions.source||(n.suggestions=eQ()),n);return r.tools||null!==t.tools.source||(r.tools=eX({})),r.dataRenderers||null!==t.dataRenderers.source||(r.dataRenderers=eY()),r});let e0=(0,r.memo)(({runtime:e,aui:t=null,children:r})=>{let i=eA({threads:eZ(e)},{parent:t}),s=e._core?.RenderComponent;return(0,n.jsxs)(ed,{value:i,children:[s&&(0,n.jsx)(s,{}),r]})}),e1=e=>{let t,n=new Set,r=(e,r)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=r?r:"object"!=typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,s={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,s);return s},e2=e=>{let t=e?e1(e):e1,n=e=>(function(e,t=e=>e){let n=r.default.useSyncExternalStore(e.subscribe,r.default.useCallback(()=>t(e.getState()),[e,t]),r.default.useCallback(()=>t(e.getInitialState()),[e,t]));return r.default.useDebugValue(n),n})(t,e);return Object.assign(n,t),n},e5=e=>e?e2(e):e2;e.s(["create",()=>e5],50147);let e3=e=>{let t=new Map,n=()=>{let n=0;for(let e of t.values())n+=e;e(n)};return{register:()=>{let e=Symbol();return t.set(e,0),{setHeight:r=>{t.get(e)!==r&&(t.set(e,r),n())},unregister:()=>{t.delete(e),n()}}}}};function e4(e,t){function n(n){let r=e(n);return r?r[t]:null}return{[t]:function(e){let t,r=!1;"function"==typeof e?t=e:e&&"object"==typeof e&&(r=!!e.optional,t=e.selector);let i=n({optional:r});return i?t?i(t):i():null},[`${t}Store`]:n}}e.s(["createContextStoreHook",()=>e4],51996);let e6=(0,r.createContext)(null),{useThreadViewport:e8,useThreadViewportStore:e9}=e4(function(e){let t=(0,r.useContext)(e6);if(!e?.optional&&!t)throw Error("This component must be used within ThreadPrimitive.Viewport.");return t},"useThreadViewport");e.s(["ThreadViewportContext",0,e6,"useThreadViewport",0,e8,"useThreadViewportStore",0,e9],40165);let e7=e=>e;e.s(["writableStore",0,e7],21470);let te=({children:e,options:t={}})=>{let i=(e=>{let t=e9({optional:!0}),[n]=(0,r.useState)(()=>((e={})=>{let t=new Set,n=e3(e=>{s.setState({height:{...s.getState().height,viewport:e}})}),r=e3(e=>{s.setState({height:{...s.getState().height,inset:e}})}),i=e3(e=>{s.setState({height:{...s.getState().height,userMessage:e}})}),s=e5(()=>({isAtBottom:!0,scrollToBottom:({behavior:e="auto"}={})=>{for(let n of t)n({behavior:e})},onScrollToBottom:e=>(t.add(e),()=>{t.delete(e)}),turnAnchor:e.turnAnchor??"bottom",height:{viewport:0,inset:0,userMessage:0},registerViewport:n.register,registerContentInset:r.register,registerUserMessageHeight:i.register}));return s})(e));return(0,r.useEffect)(()=>t?.getState().onScrollToBottom(()=>{n.getState().scrollToBottom()}),[t,n]),(0,r.useEffect)(()=>{if(t)return n.subscribe(e=>{t.getState().isAtBottom!==e.isAtBottom&&e7(t).setState({isAtBottom:e.isAtBottom})})},[n,t]),(0,r.useEffect)(()=>{let t={turnAnchor:e.turnAnchor??"bottom"};n.getState().turnAnchor!==t.turnAnchor&&e7(n).setState(t)},[n,e.turnAnchor]),n})(t),[s]=(0,r.useState)(()=>({useThreadViewport:i}));return(0,n.jsx)(e6.Provider,{value:s,children:e})};e.s(["ThreadPrimitiveViewportProvider",0,te],17367);let tt=()=>{let e=eA();return(0,r.useEffect)(()=>{},[e]),null},tn=(0,r.memo)(({children:e,aui:t,runtime:r})=>(0,n.jsxs)(e0,{runtime:r,aui:t??null,children:[(0,n.jsx)(tt,{}),(0,n.jsx)(te,{children:e})]}));e.s(["AssistantRuntimeProvider",0,tn],7319)},18532,e=>{"use strict";let t=(0,e.i(3645).default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);e.s(["Cpu",()=>t],18532)},63045,17466,61302,94875,30854,e=>{"use strict";e.s([],56307),e.i(56307);var t,n,r=e.i(20314),i=e.i(79054);e.i(26036);var s=e.i(5978),o=Symbol.for("react.lazy"),a=i[" use ".trim().toString()];function l(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===o&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var u=Symbol("radix.slottable");function c(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===u}var d=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var n,o;let u,d,h,p=(o=n=`Primitive.${t}`,(u=i.forwardRef((e,t)=>{let{children:n,...r}=e;if(l(n)&&"function"==typeof a&&(n=a(n._payload)),i.isValidElement(n)){var o;let e,a,l=(o=n,(a=(e=Object.getOwnPropertyDescriptor(o.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.ref:(a=(e=Object.getOwnPropertyDescriptor(o,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.props.ref:o.props.ref||o.ref),u=function(e,t){let n={...t};for(let r in t){let i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...s}:"className"===r&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==i.Fragment&&(u.ref=t?(0,s.composeRefs)(t,l):l),i.cloneElement(n,u)}return i.Children.count(n)>1?i.Children.only(null):null})).displayName=`${o}.SlotClone`,d=u,(h=i.forwardRef((e,t)=>{let{children:n,...s}=e;l(n)&&"function"==typeof a&&(n=a(n._payload));let o=i.Children.toArray(n),u=o.find(c);if(u){let e=u.props.children,n=o.map(t=>t!==u?t:i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null);return(0,r.jsx)(d,{...s,ref:t,children:i.isValidElement(e)?i.cloneElement(e,void 0,n):null})}return(0,r.jsx)(d,{...s,ref:t,children:n})})).displayName=`${n}.Slot`,h),f=i.forwardRef((e,n)=>{let{asChild:i,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,r.jsx)(i?p:t,{...s,ref:n})});return f.displayName=`Primitive.${t}`,{...e,[t]:f}},{}),h=e.i(8624),p=e.i(32527);let f=e=>{let t=(0,h.useAui)(),n=(0,p.getProxiedAssistantState)(t),r=(0,i.useSyncExternalStore)(t.subscribe,()=>e(n),()=>e(n));if(r===n)throw Error("You tried to return the entire AssistantState. This is not supported due to technical limitations.");return(0,i.useDebugValue)(r),r};(t=n||(n={})).Hidden="hidden",t.Floating="floating",t.Normal="normal";let m=(0,i.createContext)(null),g=(0,i.forwardRef)(({hideWhenRunning:e,autohide:t,autohideFloat:s,...o},a)=>{let[l,u]=(0,i.useState)(0),c=(0,i.useCallback)(()=>{let e=!1;return u(e=>e+1),()=>{e||(e=!0,u(e=>Math.max(0,e-1)))}},[]),h=(0,i.useMemo)(()=>({acquireInteractionLock:c}),[c]),p=(({hideWhenRunning:e,autohide:t,autohideFloat:r,forceVisible:i})=>f(s=>{if(e&&s.thread.isRunning)return n.Hidden;let o="always"===t||"not-last"===t&&!s.message.isLast,a=i||s.message.isHovering;return o?a?"always"===r||"single-branch"===r&&s.message.branchCount<=1?n.Floating:n.Normal:n.Hidden:n.Normal}))({hideWhenRunning:e,autohide:t,autohideFloat:s,forceVisible:l>0});return p===n.Hidden?null:(0,r.jsx)(m.Provider,{value:h,children:(0,r.jsx)(d.div,{...p===n.Floating?{"data-floating":"true"}:null,...o,ref:a})})});g.displayName="ActionBarPrimitive.Root";var x=e.i(91967);let y=(0,i.forwardRef)(({copiedDuration:e,onClick:t,disabled:n,...s},o)=>{let a=f(e=>e.message.isCopied),l=(({copiedDuration:e=3e3}={})=>{let{copy:t,disabled:n}=(({copiedDuration:e=3e3,copyToClipboard:t}={})=>{let n=(0,h.useAui)(),r=f(e=>!(("assistant"!==e.message.role||e.message.status?.type!=="running")&&e.message.parts.some(e=>"text"===e.type&&e.text.length>0))),s=f(e=>e.message.isCopied),o=f(e=>e.composer.isEditing),a=f(e=>e.composer.text);return{copy:(0,i.useCallback)(()=>{let r=o?a:n.message().getCopyText();r&&Promise.resolve((t??(()=>{}))(r)).then(()=>{n.message().setIsCopied(!0),setTimeout(()=>n.message().setIsCopied(!1),e)})},[n,o,a,e,t]),disabled:r,isCopied:s}})({copiedDuration:e,copyToClipboard:e=>navigator.clipboard.writeText(e)});return n?null:t})({copiedDuration:e});return(0,r.jsx)(d.button,{type:"button",...a?{"data-copied":"true"}:{},...s,ref:o,disabled:n||!l,onClick:(0,x.composeEventHandlers)(t,()=>{l?.()})})});y.displayName="ActionBarPrimitive.Copy";let b=(e,t,n=[])=>{let s=(0,i.forwardRef)((e,i)=>{let s={},o={};Object.keys(e).forEach(t=>{n.includes(t)?s[t]=e[t]:o[t]=e[t]});let a=t(s)??void 0;return(0,r.jsx)(d.button,{...o,type:"button",ref:i,disabled:o.disabled||!a,onClick:(0,x.composeEventHandlers)(o.onClick,a)})});return s.displayName=e,s},v=b("ActionBarPrimitive.Reload",()=>{let e,t,{disabled:n,reload:r}=(e=(0,h.useAui)(),t=f(e=>e.thread.isRunning||e.thread.isDisabled||"assistant"!==e.message.role),{reload:(0,i.useCallback)(()=>{e.message().reload()},[e]),disabled:t});return n?null:r}),k=b("ActionBarPrimitive.Edit",()=>{let e,t,{disabled:n,edit:r}=(e=(0,h.useAui)(),t=f(e=>e.composer.isEditing),{edit:(0,i.useCallback)(()=>{e.composer().beginEdit()},[e]),disabled:t});return n?null:r}),w=b("ActionBarPrimitive.Speak",()=>{let e,t,{disabled:n,speak:r}=(e=(0,h.useAui)(),t=f(e=>!(("assistant"!==e.message.role||e.message.status?.type!=="running")&&e.message.parts.some(e=>"text"===e.type&&e.text.length>0))),{speak:(0,i.useCallback)(async()=>{e.message().speak()},[e]),disabled:t});return n?null:r});var S=e.i(67384);let _=(0,i.forwardRef)((e,t)=>{let n=(()=>{let e,t,{disabled:n,stopSpeaking:r}=(e=(0,h.useAui)(),t=f(e=>null==e.message.speech),{stopSpeaking:(0,i.useCallback)(()=>{e.message().stopSpeaking()},[e]),disabled:t});return n?null:r})();return(0,S.useEscapeKeydown)(e=>{n&&(e.preventDefault(),n())}),(0,r.jsx)(d.button,{type:"button",disabled:!n,...e,ref:t,onClick:(0,x.composeEventHandlers)(e.onClick,()=>{n?.()})})});_.displayName="ActionBarPrimitive.StopSpeaking";let E=(0,i.forwardRef)(({onClick:e,disabled:t,...n},s)=>{let o=f(e=>e.message.metadata.submittedFeedback?.type==="positive"),a=(()=>{let e,t,{submit:n}=(e=(0,h.useAui)(),t=f(e=>e.message.metadata.submittedFeedback?.type==="positive"),{submit:(0,i.useCallback)(()=>{e.message().submitFeedback({type:"positive"})},[e]),isSubmitted:t});return n})();return(0,r.jsx)(d.button,{type:"button",...o?{"data-submitted":"true"}:{},...n,ref:s,disabled:t||!a,onClick:(0,x.composeEventHandlers)(e,()=>{a?.()})})});E.displayName="ActionBarPrimitive.FeedbackPositive";let C=(0,i.forwardRef)(({onClick:e,disabled:t,...n},s)=>{let o=f(e=>e.message.metadata.submittedFeedback?.type==="negative"),a=(()=>{let e,t,{submit:n}=(e=(0,h.useAui)(),t=f(e=>e.message.metadata.submittedFeedback?.type==="negative"),{submit:(0,i.useCallback)(()=>{e.message().submitFeedback({type:"negative"})},[e]),isSubmitted:t});return n})();return(0,r.jsx)(d.button,{type:"button",...o?{"data-submitted":"true"}:{},...n,ref:s,disabled:t||!a,onClick:(0,x.composeEventHandlers)(e,()=>{a?.()})})});C.displayName="ActionBarPrimitive.FeedbackNegative";let T=(0,i.forwardRef)(({filename:e,onExport:t,onClick:n,disabled:s,...o},a)=>{let l=(({filename:e,onExport:t}={})=>{let n=(0,h.useAui)(),r=f(e=>("assistant"!==e.message.role||e.message.status?.type!=="running")&&e.message.parts.some(e=>"text"===e.type&&e.text.length>0)),s=(0,i.useCallback)(async()=>{let r=n.message().getCopyText();if(!r)return;if(t)return void await t(r);let i=new Blob([r],{type:"text/markdown"}),s=URL.createObjectURL(i),o=document.createElement("a");o.href=s,o.download=e??`message-${Date.now()}.md`,o.click(),URL.revokeObjectURL(s)},[n,e,t]);return r?s:null})({filename:e,onExport:t});return(0,r.jsx)(d.button,{type:"button",...o,ref:a,disabled:s||!l,onClick:(0,x.composeEventHandlers)(n,()=>{l?.()})})});T.displayName="ActionBarPrimitive.ExportMarkdown",e.s(["Copy",0,y,"Edit",0,k,"ExportMarkdown",0,T,"FeedbackNegative",0,C,"FeedbackPositive",0,E,"Reload",0,v,"Root",0,g,"Speak",0,w,"StopSpeaking",0,_],5294);var j=e.i(5294);e.s(["ActionBarPrimitive",0,j],63045),e.s([],9574),e.i(9574);let I=()=>{let e,t,{disabled:n,send:r}=(e=(0,h.useAui)(),t=f(e=>e.thread.isRunning||!e.composer.isEditing||e.composer.isEmpty),{send:(0,i.useCallback)(()=>{e.composer().send()},[e]),disabled:t});return n?null:r},A=b("ComposerPrimitive.Send",I),R=(0,i.forwardRef)(({onSubmit:e,...t},n)=>{let i=I();return(0,r.jsx)(d.form,{...t,ref:n,onSubmit:(0,x.composeEventHandlers)(e,e=>{e.preventDefault(),i&&i()})})});R.displayName="ComposerPrimitive.Root";var M=e.i(5240);function N(){return(N=Object.assign.bind()).apply(null,arguments)}var P=i.useLayoutEffect,D=function(e){var t=i.default.useRef(e);return P(function(){t.current=e}),t},O=function(e,t){"function"==typeof e?e(t):e.current=t},B=function(e,t){var n=i.default.useRef();return i.default.useCallback(function(r){e.current=r,n.current&&O(n.current,null),n.current=t,t&&O(t,r)},[t])},L={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},F=function(e){Object.keys(L).forEach(function(t){e.style.setProperty(t,L[t],"important")})},z=null,U=function(e,t){var n=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?n+t.borderSize:n-t.paddingSize},$=function(){},q=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],H=!!document.documentElement.currentStyle,V=function(e){var t=window.getComputedStyle(e);if(null===t)return null;var n=q.reduce(function(e,n){return e[n]=t[n],e},{}),r=n.boxSizing;if(""===r)return null;H&&"border-box"===r&&(n.width=parseFloat(n.width)+parseFloat(n.borderRightWidth)+parseFloat(n.borderLeftWidth)+parseFloat(n.paddingRight)+parseFloat(n.paddingLeft)+"px");var i=parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),s=parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth);return{sizingStyle:n,paddingSize:i,borderSize:s}};function W(e,t,n){var r=D(n);i.useLayoutEffect(function(){var n=function(e){return r.current(e)};if(e)return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}},[])}var K=function(e,t){W(document.body,"reset",function(n){e.current.form===n.target&&t(n)})},J=function(e){W(window,"resize",e)},Q=function(e){W(document.fonts,"loadingdone",e)},G=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],Y=i.forwardRef(function(e,t){var n=e.cacheMeasurements,r=e.maxRows,s=e.minRows,o=e.onChange,a=void 0===o?$:o,l=e.onHeightChange,u=void 0===l?$:l,c=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,G),d=void 0!==c.value,h=i.useRef(null),p=B(h,t),f=i.useRef(0),m=i.useRef(),g=function(){var e=h.current,t=n&&m.current?m.current:V(e);if(t){m.current=t;var i,o,a,l,c,d,p,g,x,y,b,v=(i=e.value||e.placeholder||"x",void 0===(o=s)&&(o=1),void 0===(a=r)&&(a=1/0),z||((z=document.createElement("textarea")).setAttribute("tabindex","-1"),z.setAttribute("aria-hidden","true"),F(z)),null===z.parentNode&&document.body.appendChild(z),l=t.paddingSize,c=t.borderSize,p=(d=t.sizingStyle).boxSizing,Object.keys(d).forEach(function(e){z.style[e]=d[e]}),F(z),z.value=i,g=U(z,t),z.value=i,g=U(z,t),z.value="x",y=(x=z.scrollHeight-l)*o,"border-box"===p&&(y=y+l+c),g=Math.max(y,g),b=x*a,"border-box"===p&&(b=b+l+c),[g=Math.min(b,g),x]),k=v[0],w=v[1];f.current!==k&&(f.current=k,e.style.setProperty("height",k+"px","important"),u(k,{rowHeight:w}))}};return i.useLayoutEffect(g),K(h,function(){if(!d){var e=h.current.value;requestAnimationFrame(function(){var t=h.current;t&&e!==t.value&&g()})}}),J(g),Q(g),i.createElement("textarea",N({},c,{onChange:function(e){d||g(),a(e)},ref:p}))}),X=e.i(29297),Z=e.i(40165);let ee=e=>{let t=(0,X.useCallbackRef)(e),n=(0,Z.useThreadViewport)(e=>e.onScrollToBottom);(0,i.useEffect)(()=>n(t),[n,t])};var et=e.i(38782);let en=(0,i.forwardRef)(({autoFocus:e=!1,asChild:t,disabled:n,onChange:o,onKeyDown:a,onPaste:l,submitOnEnter:u,submitMode:c,cancelOnEscape:d=!0,unstable_focusOnRunStart:p=!0,unstable_focusOnScrollToBottom:m=!0,unstable_focusOnThreadSwitched:g=!0,addAttachmentOnPaste:y=!0,...b},v)=>{let k=(0,h.useAui)(),w=c??(!1===u?"none":"enter"),_=f(e=>e.composer.isEditing?e.composer.text:""),E=t?M.Slot.Root:Y,C=f(e=>e.thread.isDisabled||e.composer.dictation?.inputDisabled)||n,T=(0,i.useRef)(null),j=(0,s.useComposedRefs)(v,T);(0,S.useEscapeKeydown)(e=>{if(!d||!T.current?.contains(e.target))return;let t=k.composer();t.getState().canCancel&&(t.cancel(),e.preventDefault())});let I=async e=>{if(!y)return;let t=k.thread().getState().capabilities,n=Array.from(e.clipboardData?.files||[]);if(t.attachments&&n.length>0)try{e.preventDefault(),await Promise.all(n.map(e=>k.composer().addAttachment(e)))}catch(e){console.error("Error adding attachment:",e)}},A=e&&!C,R=(0,i.useCallback)(()=>{let e=T.current;e&&A&&(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length))},[A]);return(0,i.useEffect)(()=>R(),[R]),ee(()=>{"thread"===k.composer().getState().type&&m&&R()}),(0,i.useEffect)(()=>{if("thread"===k.composer().getState().type&&p)return k.on("thread.runStart",R)},[p,R,k]),(0,i.useEffect)(()=>{if("thread"===k.composer().getState().type&&g)return k.on("threadListItem.switchedTo",R)},[g,R,k]),(0,r.jsx)(E,{name:"input",value:_,...b,ref:j,disabled:C,onChange:(0,x.composeEventHandlers)(o,e=>{k.composer().getState().isEditing&&(0,et.flushResourcesSync)(()=>{k.composer().setText(e.target.value)})}),onKeyDown:(0,x.composeEventHandlers)(a,e=>{if(!C&&!e.nativeEvent.isComposing&&"Enter"===e.key&&!e.shiftKey){if(k.thread().getState().isRunning)return;let t=!1;"ctrlEnter"===w?t=e.ctrlKey||e.metaKey:"enter"===w&&(t=!0),t&&(e.preventDefault(),T.current?.closest("form")?.requestSubmit())}}),onPaste:(0,x.composeEventHandlers)(l,I)})});en.displayName="ComposerPrimitive.Input";let er=b("ComposerPrimitive.Cancel",()=>{let e,t,{disabled:n,cancel:r}=(e=(0,h.useAui)(),t=f(e=>!e.composer.canCancel),{cancel:(0,i.useCallback)(()=>{e.composer().cancel()},[e]),disabled:t});return n?null:r}),ei=b("ComposerPrimitive.AddAttachment",({multiple:e=!0}={})=>{let t,n,{disabled:r,addAttachment:s}=(t=(0,h.useAui)(),n=f(e=>!e.composer.isEditing),{addAttachment:(0,i.useCallback)(e=>t.composer().addAttachment(e),[t]),disabled:n}),o=(0,h.useAui)(),a=(0,i.useCallback)(()=>{let t=document.createElement("input");t.type="file",t.multiple=e,t.hidden=!0;let n=o.composer().getState().attachmentAccept;"*"!==n&&(t.accept=n),document.body.appendChild(t),t.onchange=e=>{let n=e.target.files;if(n){for(let e of n)s(e);document.body.removeChild(t)}},t.oncancel=()=>{t.files&&0!==t.files.length||document.body.removeChild(t)},t.click()},[o,e,s]);return r?null:a},["multiple"]),es=Object.freeze({});function eo({getItemState:e,children:t}){let n,r;return ea(t((n=(0,h.useAui)(),r=(0,i.useRef)(void 0),f(()=>(void 0===r.current&&(r.current=e(n)),r.current)),()=>(r.current=void 0,e(n)))))}let ea=e=>{let t="object"==typeof e&&null!=e&&"type"in e?e:null,n=t?.type,r=t?.key,s="object"==typeof t?.props&&null!=t.props&&0===Object.entries(t.props).length?es:t?.props;return(0,i.useMemo)(()=>t,[n,r,s])??e};var el=e.i(12504),eu=e.i(61163);let ec=({index:e,children:t})=>{let n=(0,h.useAui)({attachment:(0,eu.Derived)({source:"message",query:{type:"index",index:e},get:t=>t.message().attachment({index:e})})});return(0,r.jsx)(el.AuiProvider,{value:n,children:t})},ed=({index:e,children:t})=>{let n=(0,h.useAui)({attachment:(0,eu.Derived)({source:"composer",query:{type:"index",index:e},get:t=>t.composer().attachment({index:e})})});return(0,r.jsx)(el.AuiProvider,{value:n,children:t})},eh=(e,t)=>{switch(t.type){case"image":return e?.Image??e?.Attachment;case"document":return e?.Document??e?.Attachment;case"file":return e?.File??e?.Attachment;default:return e?.Attachment}},ep=({components:e})=>{let t=f(e=>e.attachment);if(!t)return null;let n=eh(e,t);return n?(0,r.jsx)(n,{}):null},ef=(0,i.memo)(({index:e,components:t})=>(0,r.jsx)(ed,{index:e,children:(0,r.jsx)(ep,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Image===t.components?.Image&&e.components?.Document===t.components?.Document&&e.components?.File===t.components?.File&&e.components?.Attachment===t.components?.Attachment);ef.displayName="ComposerPrimitive.AttachmentByIndex";let em=({children:e})=>{let t=f(e=>e.composer.attachments.length);return(0,i.useMemo)(()=>Array.from({length:t},(t,n)=>(0,r.jsx)(ed,{index:n,children:(0,r.jsx)(eo,{getItemState:e=>e.composer().attachment({index:n}).getState(),children:t=>e({get attachment(){return t()}})})},n)),[t,e])},eg=({components:e,children:t})=>e?(0,r.jsx)(em,{children:({attachment:t})=>{let n=eh(e,t);return n?(0,r.jsx)(n,{}):null}}):(0,r.jsx)(em,{children:t});eg.displayName="ComposerPrimitive.Attachments";let ex=(0,i.forwardRef)(({disabled:e,asChild:t=!1,children:n,...s},o)=>{let[a,l]=(0,i.useState)(!1),u=(0,h.useAui)(),c=(0,i.useCallback)(t=>{e||(t.preventDefault(),l(!0))},[e]),d=(0,i.useCallback)(t=>{!e&&(t.preventDefault(),a||l(!0))},[e,a]),p=(0,i.useCallback)(t=>{if(e)return;t.preventDefault();let n=t.relatedTarget;n&&t.currentTarget.contains(n)||l(!1)},[e]),f=(0,i.useCallback)(async t=>{if(!e)for(let e of(t.preventDefault(),l(!1),t.dataTransfer.files))try{await u.composer().addAttachment(e)}catch(e){console.error("Failed to add attachment:",e)}},[e,u]),m=t?M.Slot.Root:"div";return(0,r.jsx)(m,{...a?{"data-dragging":"true"}:null,ref:o,onDragEnterCapture:c,onDragOverCapture:d,onDragLeaveCapture:p,onDropCapture:f,...s,children:n})});ex.displayName="ComposerPrimitive.AttachmentDropzone";let ey=b("ComposerPrimitive.Dictate",()=>{let e,t,{disabled:n,startDictation:r}=(e=(0,h.useAui)(),t=f(e=>null!=e.composer.dictation||!e.thread.capabilities.dictation||!e.composer.isEditing),{startDictation:(0,i.useCallback)(()=>{e.composer().startDictation()},[e]),disabled:t});return n?null:r}),eb=b("ComposerPrimitive.StopDictation",()=>{let e=(0,h.useAui)(),t=f(e=>null!=e.composer.dictation),n=(0,i.useCallback)(()=>{e.composer().stopDictation()},[e]);return t?n:null}),ev=(0,i.forwardRef)(({children:e,...t},n)=>{let i=f(e=>e.composer.dictation?.transcript);return i?(0,r.jsx)(d.span,{...t,ref:n,children:e??i}):null});ev.displayName="ComposerPrimitive.DictationTranscript";let ek=({children:e,...t})=>f(e=>{if(!0===t.editing&&!e.composer.isEditing||!1===t.editing&&e.composer.isEditing)return!1;let n=null!=e.composer.dictation;return(!0!==t.dictation||!!n)&&(!1!==t.dictation||!n)})?e:null;ek.displayName="ComposerPrimitive.If";let ew=(0,i.forwardRef)((e,t)=>f(e=>e.composer.quote)?(0,r.jsx)(d.div,{...e,ref:t}):null);ew.displayName="ComposerPrimitive.Quote";let eS=(0,i.forwardRef)(({children:e,...t},n)=>{let i=f(e=>e.composer.quote?.text);return i?(0,r.jsx)(d.span,{...t,ref:n,children:e??i}):null});eS.displayName="ComposerPrimitive.QuoteText";let e_=(0,i.forwardRef)(({onClick:e,...t},n)=>{let s=(0,h.useAui)(),o=(0,i.useCallback)(()=>{s.composer().setQuote(void 0)},[s]);return(0,r.jsx)(d.button,{type:"button",...t,ref:n,onClick:(0,x.composeEventHandlers)(e,o)})});e_.displayName="ComposerPrimitive.QuoteDismiss",e.s(["AddAttachment",0,ei,"AttachmentByIndex",0,ef,"AttachmentDropzone",0,ex,"Attachments",0,eg,"Cancel",0,er,"Dictate",0,ey,"DictationTranscript",0,ev,"If",0,ek,"Input",0,en,"Quote",0,ew,"QuoteDismiss",0,e_,"QuoteText",0,eS,"Root",0,R,"Send",0,A,"StopDictation",0,eb],9108);var eE=e.i(9108);e.s(["ComposerPrimitive",0,eE],17466),e.s([],28203),e.i(28203);let eC=e=>{let t=(0,i.useRef)(void 0);return(0,i.useCallback)(n=>{t.current&&t.current(),n&&(t.current=e(n))},[e])},eT=(e,t)=>eC((0,i.useCallback)(n=>{if(!e)return;let r=e(),i=()=>{let e=t?t(n):n.offsetHeight;r.setHeight(e)},s=new ResizeObserver(i);return s.observe(n),i(),()=>{s.disconnect(),r.unregister()}},[e,t])),ej=(0,i.createContext)(!1),eI=(e,t)=>{let n=e.match(/^([\d.]+)(em|px|rem)$/);if(!n)return 0;let r=parseFloat(n[1]),i=n[2];return"px"===i?r:"em"===i?r*(parseFloat(getComputedStyle(t).fontSize)||16):"rem"===i?r*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16):0},eA=({children:e,fillClampThreshold:t="10em",fillClampOffset:n="6em"})=>{let s=f(e=>e.message.isLast&&"assistant"===e.message.role&&e.message.index>=1&&e.thread.messages.at(e.message.index-1)?.role==="user"),o=(0,Z.useThreadViewportStore)({optional:!0}),a=(0,i.useContext)(ej),l=eC((0,i.useCallback)(e=>{if(!o||a)return;let r=()=>{let r=o.getState();if("top"===r.turnAnchor&&s){let{viewport:i,inset:s,userMessage:o}=r.height,a=eI(t,e),l=eI(n,e),u=Math.max(0,i-s-(o<=a?o:l));e.style.minHeight=`${u}px`,e.style.flexShrink="0",e.style.transition="min-height 0s"}else e.style.minHeight="",e.style.flexShrink="",e.style.transition=""};return r(),o.subscribe(r)},[o,s,a,t,n]));return(0,r.jsx)(ej.Provider,{value:!0,children:(0,r.jsx)(M.Slot.Root,{ref:l,children:e})})};eA.displayName="ThreadPrimitive.ViewportSlack";let eR=(0,i.forwardRef)((e,t)=>{let n,o,a,l,u=(n=(0,h.useAui)(),o=f(()=>n.message()),eC((0,i.useCallback)(e=>{let t=()=>{o.setIsHovering(!0)},n=()=>{o.setIsHovering(!1)};return e.addEventListener("mouseenter",t),e.addEventListener("mouseleave",n),e.matches(":hover")&&queueMicrotask(()=>o.setIsHovering(!0)),()=>{e.removeEventListener("mouseenter",t),e.removeEventListener("mouseleave",n),o.setIsHovering(!1)}},[o]))),c=(a=(0,Z.useThreadViewport)(e=>e.turnAnchor),l=(0,Z.useThreadViewport)(e=>e.registerUserMessageHeight),eT(f(e=>"top"===a&&"user"===e.message.role&&e.message.index===e.thread.messages.length-2&&e.thread.messages.at(-1)?.role==="assistant")?l:null,(0,i.useCallback)(e=>e.offsetHeight,[]))),p=(0,s.useComposedRefs)(t,u,c),m=f(e=>e.message.id);return(0,r.jsx)(eA,{children:(0,r.jsx)(d.div,{...e,ref:p,"data-message-id":m})})});eR.displayName="MessagePrimitive.Root";let eM=({index:e,children:t})=>{let n=(0,h.useAui)({part:(0,eu.Derived)({source:"message",query:{type:"index",index:e},get:t=>t.message().part({index:e})})});return(0,r.jsx)(el.AuiProvider,{value:n,children:t})};var eN=e.i(91379),eP=e.i(28038);let eD=(0,eN.resource)(({text:e,isRunning:t})=>{let n=(0,eP.tapMemo)(()=>({type:"text",text:e,status:t?{type:"running"}:{type:"complete"}}),[e,t]);return{getState:()=>n,addToolResult:()=>{throw Error("Not supported")},resumeToolCall:()=>{throw Error("Not supported")}}}),eO=({text:e,isRunning:t=!1,children:n})=>{let i=(0,h.useAui)({part:eD({text:e,isRunning:t})});return(0,r.jsx)(el.AuiProvider,{value:i,children:n})};var eB=e.i(42888);let eL=Object.freeze({type:"complete"}),eF=(0,eN.resource)(({parts:e,getMessagePart:t})=>{let[n,r]=(0,eB.tapState)(!0),i=(0,eP.tapMemo)(()=>{let t=e[e.length-1];return t?.status??eL},[e]),s=(0,eP.tapMemo)(()=>({parts:e,collapsed:n,status:i}),[e,n,i]);return{getState:()=>s,setCollapsed:r,part:t}}),ez=({startIndex:e,endIndex:t,children:n})=>{let i=f(e=>e.message.parts).slice(e,t+1),s=(0,h.useAui)(),o=(0,h.useAui)({chainOfThought:eF({parts:i,getMessagePart:({index:t})=>{if(t<0||t>=i.length)throw Error(`ChainOfThought part index ${t} is out of bounds (0..${i.length-1})`);return s.message().part({index:e+t})}})});return(0,r.jsx)(el.AuiProvider,{value:o,children:n})},eU=e=>{let t=e.message.metadata;if(t&&"object"==typeof t)return t.custom?.quote},e$=(e,t)=>{let n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(let[e,t]of n)if(!r.has(e)||!Object.is(t,r.get(e)))return!1;return!0},eq=e=>{let t=-1;return{startGroup:e=>{-1===t&&(t=e)},endGroup:(n,r)=>{-1!==t&&(r.push({type:e,startIndex:t,endIndex:n}),t=-1)},finalize:(n,r)=>{-1!==t&&r.push({type:e,startIndex:t,endIndex:n})}}},eH=({Fallback:e,...t})=>{let n=f(n=>{let r=n.tools.tools[t.toolName]??e;return Array.isArray(r)?r[0]??e:r});return n?(0,r.jsx)(n,{...t}):null},eV=({Fallback:e,...t})=>{let n=f(n=>{let r=n.dataRenderers.renderers[t.name]??e;return Array.isArray(r)?r[0]??e:r});return n?(0,r.jsx)(n,{...t}):null},eW={Text:()=>null,Reasoning:()=>null,Source:()=>null,Image:()=>null,File:()=>null,Unstable_Audio:()=>null,ToolGroup:({children:e})=>e,ReasoningGroup:({children:e})=>e},eK=({components:{Text:e=eW.Text,Reasoning:t=eW.Reasoning,Image:n=eW.Image,Source:i=eW.Source,File:s=eW.File,Unstable_Audio:o=eW.Unstable_Audio,tools:a={},data:l}={}})=>{let u=(0,h.useAui)(),c=f(e=>e.part),d=c.type;if("tool-call"===d){let e=u.part().addToolResult,t=u.part().resumeToolCall;if("Override"in a)return(0,r.jsx)(a.Override,{...c,addResult:e,resume:t});let n=a.by_name?.[c.toolName]??a.Fallback;return(0,r.jsx)(eH,{...c,Fallback:n,addResult:e,resume:t})}if(c.status?.type==="requires-action")throw Error("Encountered unexpected requires-action status");switch(d){case"text":return(0,r.jsx)(e,{...c});case"reasoning":return(0,r.jsx)(t,{...c});case"source":return(0,r.jsx)(i,{...c});case"image":return(0,r.jsx)(n,{...c});case"file":return(0,r.jsx)(s,{...c});case"audio":return(0,r.jsx)(o,{...c});case"data":{let e=l?.by_name?.[c.name]??l?.Fallback;return(0,r.jsx)(eV,{...c,Fallback:e})}default:return console.warn(`Unknown message part type: ${d}`),null}},eJ=(0,i.memo)(({index:e,components:t})=>(0,r.jsx)(eM,{index:e,children:(0,r.jsx)(eK,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.ToolGroup===t.components?.ToolGroup&&e.components?.ReasoningGroup===t.components?.ReasoningGroup);eJ.displayName="MessagePrimitive.PartByIndex";let eQ=({status:e,component:t})=>(0,r.jsx)(eO,{text:"",isRunning:"running"===e.type,children:(0,r.jsx)(t,{type:"text",text:"",status:e})}),eG=Object.freeze({type:"complete"}),eY=(0,i.memo)(({components:e})=>{let t=f(e=>e.message.status??eG);return e?.Empty?(0,r.jsx)(e.Empty,{status:t}):(0,r.jsx)(eQ,{status:t,component:e?.Text??eW.Text})},(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),eX=(0,i.memo)(({components:e,enabled:t})=>f(e=>{if(!t||0===e.message.parts.length)return!1;let n=e.message.parts[e.message.parts.length-1];return n?.type!=="text"&&n?.type!=="reasoning"})?(0,r.jsx)(eY,{components:e}):null,(e,t)=>e.enabled===t.enabled&&e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),eZ=(0,i.memo)(({Quote:e})=>{let t=f(eU);return t?(0,r.jsx)(e,{text:t.text,messageId:t.messageId}):null}),e0=()=>{let e=(0,h.useAui)(),t=f(e=>e.part),n=f(e=>{if("tool-call"!==e.part.type)return null;let t=e.tools.tools[e.part.toolName];return Array.isArray(t)?t[0]??null:t??null});return n&&"tool-call"===t.type?(0,r.jsx)(n,{...t,addResult:e.part().addToolResult,resume:e.part().resumeToolCall}):null},e1=()=>{let e=f(e=>e.part),t=f(e=>{if("data"!==e.part.type)return null;let t=e.dataRenderers.renderers[e.part.name];return Array.isArray(t)?t[0]??null:t??null});return t&&"data"===e.type?(0,r.jsx)(t,{...e}):null},e2=()=>{let e=f(e=>e.part.type);return"tool-call"===e?(0,r.jsx)(e0,{}):"data"===e?(0,r.jsx)(e1,{}):null},e5=({children:e})=>{let t=(0,h.useAui)(),n=f(e=>e.message.parts.length);return(0,i.useMemo)(()=>Array.from({length:n},(n,i)=>(0,r.jsx)(eM,{index:i,children:(0,r.jsx)(eo,{getItemState:e=>e.message().part({index:i}).getState(),children:n=>{let s=e({get part(){let e=n();if("tool-call"===e.type){let n=t.tools().getState().tools[e.toolName],s=Array.isArray(n)?!!n[0]:!!n,o=t.message().part({index:i});return{...e,toolUI:s?(0,r.jsx)(e0,{}):null,addResult:o.addToolResult,resume:o.resumeToolCall}}if("data"===e.type){let n=t.dataRenderers().getState().renderers[e.name],i=Array.isArray(n)?!!n[0]:!!n;return{...e,dataRendererUI:i?(0,r.jsx)(e1,{}):null}}return e}});return null!==s?s:(0,r.jsx)(e2,{})}})},i)),[n,e])},e3=({components:e,unstable_showEmptyOnNonTextEnd:t=!0,children:n})=>n?(0,r.jsx)(e5,{children:n}):(0,r.jsx)(e4,{components:e,unstable_showEmptyOnNonTextEnd:t});e3.displayName="MessagePrimitive.Parts";let e4=({components:e,unstable_showEmptyOnNonTextEnd:t})=>{var n,s;let o,a,l=f(e=>e.message.parts.length),u=(n=!!e?.ChainOfThought,a=f((s=e=>e.message.parts.map(e=>e.type),o=i.default.useRef(void 0),e=>{let t=s(e);return!function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;if(Symbol.iterator in e&&Symbol.iterator in t){if("entries"in e&&"entries"in t)return e$(e,t);let n=e[Symbol.iterator](),r=t[Symbol.iterator](),i=n.next(),s=r.next();for(;!i.done&&!s.done;){if(!Object.is(i.value,s.value))return!1;i=n.next(),s=r.next()}return!!i.done&&!!s.done}return e$({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}(o.current,t)?o.current=t:o.current})),(0,i.useMemo)(()=>0===a.length?[]:((e,t)=>{let n=[];if(t){let t=eq("chainOfThoughtGroup");for(let r=0;r<e.length;r++){let i=e[r];"tool-call"===i||"reasoning"===i?t.startGroup(r):(t.endGroup(r-1,n),n.push({type:"single",index:r}))}t.finalize(e.length-1,n)}else{let t=eq("toolGroup"),r=eq("reasoningGroup");for(let i=0;i<e.length;i++){let s=e[i];"tool-call"===s?(r.endGroup(i-1,n),t.startGroup(i)):"reasoning"===s?(t.endGroup(i-1,n),r.startGroup(i)):(t.endGroup(i-1,n),r.endGroup(i-1,n),n.push({type:"single",index:i}))}t.finalize(e.length-1,n),r.finalize(e.length-1,n)}return n})(a,n),[a,n])),c=(0,i.useMemo)(()=>0===l?(0,r.jsx)(eY,{components:e}):u.map(t=>{if("single"===t.type)return(0,r.jsx)(eJ,{index:t.index,components:e},t.index);if("chainOfThoughtGroup"===t.type){let n=e?.ChainOfThought;return n?(0,r.jsx)(ez,{startIndex:t.startIndex,endIndex:t.endIndex,children:(0,r.jsx)(n,{})},`chainOfThought-${t.startIndex}`):null}if("toolGroup"===t.type){let n=e?.ToolGroup??eW.ToolGroup;return(0,r.jsx)(n,{startIndex:t.startIndex,endIndex:t.endIndex,children:Array.from({length:t.endIndex-t.startIndex+1},(n,i)=>(0,r.jsx)(eJ,{index:t.startIndex+i,components:e},i))},`tool-${t.startIndex}`)}{let n=e?.ReasoningGroup??eW.ReasoningGroup;return(0,r.jsx)(n,{startIndex:t.startIndex,endIndex:t.endIndex,children:Array.from({length:t.endIndex-t.startIndex+1},(n,i)=>(0,r.jsx)(eJ,{index:t.startIndex+i,components:e},i))},`reasoning-${t.startIndex}`)}}),[u,e,l]);return(0,r.jsxs)(r.Fragment,{children:[e?.Quote&&(0,r.jsx)(eZ,{Quote:e.Quote}),c,(0,r.jsx)(eX,{components:e,enabled:t})]})};e.i(50147);var e6=e.i(51996);let e8=(0,i.createContext)(null),{useSmoothStatus:e9,useSmoothStatusStore:e7}=(0,e6.createContextStoreHook)(function(e){let t=(0,i.useContext)(e8);if(!e?.optional&&!t)throw Error("This component must be used within a SmoothContextProvider.");return t},"useSmoothStatus");var te=e.i(21470);class tt{currentText;setText;animationFrameId=null;lastUpdateTime=Date.now();targetText="";constructor(e,t){this.currentText=e,this.setText=t}start(){null===this.animationFrameId&&(this.lastUpdateTime=Date.now(),this.animate())}stop(){null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}animate=()=>{let e=Date.now(),t=e-this.lastUpdateTime,n=this.targetText.length-this.currentText.length,r=Math.min(5,250/n),i=0;for(;t>=r&&i<n;)i++,t-=r;i!==n?this.animationFrameId=requestAnimationFrame(this.animate):this.animationFrameId=null,0!==i&&(this.currentText=this.targetText.slice(0,this.currentText.length+i),this.lastUpdateTime=e-t,this.setText(this.currentText))}}let tn=Object.freeze({type:"running"}),tr=(0,i.forwardRef)(({smooth:e=!0,component:t="span",...n},s)=>{let{text:o,status:a}=((e,t=!1)=>{let{text:n}=e,r=f(e=>e.message.id),s=(0,i.useRef)(r),[o,a]=(0,i.useState)("running"===e.status.type?"":n),l=e7({optional:!0}),u=(0,X.useCallbackRef)(t=>{if(a(t),l){let n=o!==t||"running"===e.status.type?tn:e.status;(0,te.writableStore)(l).setState(n,!0)}});(0,i.useEffect)(()=>{if(l){let r=t&&(o!==n||"running"===e.status.type)?tn:e.status;(0,te.writableStore)(l).setState(r,!0)}},[l,t,n,o,e.status]);let[c]=(0,i.useState)(new tt(o,u));return(0,i.useEffect)(()=>{if(!t)return void c.stop();if(s.current!==r||!n.startsWith(c.targetText)){s.current=r,"running"===e.status.type?(u(""),c.currentText="",c.targetText=n,c.start()):(u(n),c.currentText=n,c.targetText=n,c.stop());return}c.targetText=n,c.start()},[u,c,r,t,n,e.status.type]),(0,i.useEffect)(()=>()=>{c.stop()},[c]),(0,i.useMemo)(()=>t?{type:"text",text:o,status:n===o?e.status:tn}:e,[t,o,e,n])})(f(e=>{if("text"!==e.part.type&&"reasoning"!==e.part.type)throw Error("MessagePartText can only be used inside text or reasoning message parts.");return e.part}),e);return(0,r.jsx)(t,{"data-status":a.type,...n,ref:s,children:o})});tr.displayName="MessagePartPrimitive.Text";let ti=(0,i.forwardRef)((e,t)=>{let{image:n}=f(e=>{if("image"!==e.part.type)throw Error("MessagePartImage can only be used inside image message parts.");return e.part});return(0,r.jsx)(d.img,{src:n,...e,ref:t})});ti.displayName="MessagePartPrimitive.Image";let ts=({children:e})=>f(e=>"running"===e.part.status.type)?e:null;ts.displayName="MessagePartPrimitive.InProgress";let to={...eW,Text:()=>(0,r.jsxs)("p",{style:{whiteSpace:"pre-line"},children:[(0,r.jsx)(tr,{}),(0,r.jsx)(ts,{children:(0,r.jsx)("span",{style:{fontFamily:"revert"},children:" ●"})})]}),Image:()=>(0,r.jsx)(ti,{})},ta=e=>{if("children"in e)return(0,r.jsx)(e3,{children:e.children});let{components:t,...n}=e,i=t?{Text:t.Text??to.Text,Image:t.Image??to.Image,Reasoning:t.Reasoning??eW.Reasoning,Source:t.Source??eW.Source,File:t.File??eW.File,Unstable_Audio:t.Unstable_Audio??eW.Unstable_Audio,..."ChainOfThought"in t?{ChainOfThought:t.ChainOfThought}:{tools:t.tools,data:t.data,ToolGroup:t.ToolGroup??eW.ToolGroup,ReasoningGroup:t.ReasoningGroup??eW.ReasoningGroup},Empty:t.Empty,Quote:t.Quote}:to;return(0,r.jsx)(e3,{components:i,...n})};ta.displayName="MessagePrimitive.Parts";let tl=({children:e,...t})=>f(e=>{let{role:n,attachments:r,parts:i,branchCount:s,isLast:o,speech:a,isCopied:l,isHovering:u}=e.message;return!(!0===t.hasBranches&&s<2||t.user&&"user"!==n||t.assistant&&"assistant"!==n||t.system&&"system"!==n||!0===t.lastOrHover&&!u&&!o||void 0!==t.last&&t.last!==o||!0===t.copied&&!l||!1===t.copied&&l||!0===t.speaking&&null==a||!1===t.speaking&&null!=a||!0===t.hasAttachments&&("user"!==n||!r?.length)||!1===t.hasAttachments&&"user"===n&&r?.length)&&(!0!==t.hasContent||0!==i.length)&&(!1!==t.hasContent||!(i.length>0))&&(void 0===t.submittedFeedback||(e.message.metadata.submittedFeedback?.type??null)===t.submittedFeedback)})?e:null;tl.displayName="MessagePrimitive.If";let tu=(e,t)=>{switch(t.type){case"image":return e?.Image??e?.Attachment;case"document":return e?.Document??e?.Attachment;case"file":return e?.File??e?.Attachment;default:return e?.Attachment}},tc=({components:e})=>{let t=f(e=>e.attachment);if(!t)return null;let n=tu(e,t);return n?(0,r.jsx)(n,{}):null},td=(0,i.memo)(({index:e,components:t})=>(0,r.jsx)(ec,{index:e,children:(0,r.jsx)(tc,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Image===t.components?.Image&&e.components?.Document===t.components?.Document&&e.components?.File===t.components?.File&&e.components?.Attachment===t.components?.Attachment);td.displayName="MessagePrimitive.AttachmentByIndex";let th=({children:e})=>{let t=f(e=>"user"!==e.message.role?0:e.message.attachments.length);return(0,i.useMemo)(()=>Array.from({length:t},(t,n)=>(0,r.jsx)(ec,{index:n,children:(0,r.jsx)(eo,{getItemState:e=>e.message().attachment({index:n}).getState(),children:t=>e({get attachment(){return t()}})})},n)),[t,e])},tp=({components:e,children:t})=>e?(0,r.jsx)(th,{children:({attachment:t})=>{let n=tu(e,t);return n?(0,r.jsx)(n,{}):null}}):(0,r.jsx)(th,{children:t});tp.displayName="MessagePrimitive.Attachments";let tf=(0,i.memo)(({children:e})=>{let t=f(eU);return t?(0,r.jsx)(r.Fragment,{children:e(t)}):null});tf.displayName="MessagePrimitive.Quote";let tm=({children:e})=>void 0!==f(e=>e.message.status?.type==="incomplete"&&"error"===e.message.status.reason?e.message.status.error??"An error occurred":void 0)?e:null;tm.displayName="MessagePrimitive.Error";let tg=e=>{let t=new Map;for(let n=0;n<e.length;n++){let r=e[n],i=r?.parentId??`__ungrouped_${n}`,s=t.get(i)??[];s.push(n),t.set(i,s)}let n=[];for(let[e,r]of t){let t=e.startsWith("__ungrouped_")?void 0:e;n.push({groupKey:t,indices:r})}return n},tx=({Fallback:e,...t})=>{let n=f(n=>{let r=n.tools.tools[t.toolName]??e;return Array.isArray(r)?r[0]??e:r});return n?(0,r.jsx)(n,{...t}):null},ty=({Fallback:e,...t})=>{let n=f(n=>{let r=n.dataRenderers.renderers[t.name]??e;return Array.isArray(r)?r[0]??e:r});return n?(0,r.jsx)(n,{...t}):null},tb=()=>(0,r.jsxs)("p",{style:{whiteSpace:"pre-line"},children:[(0,r.jsx)(tr,{}),(0,r.jsx)(ts,{children:(0,r.jsx)("span",{style:{fontFamily:"revert"},children:" ●"})})]}),tv=()=>null,tk=()=>null,tw=()=>(0,r.jsx)(ti,{}),tS=()=>null,t_=()=>null,tE=({children:e})=>e,tC=({components:{Text:e=tb,Reasoning:t=tv,Image:n=tw,Source:i=tk,File:s=tS,Unstable_Audio:o=t_,tools:a={},data:l}={}})=>{let u=(0,h.useAui)(),c=f(e=>e.part),d=c.type;if("tool-call"===d){let e=u.part().addToolResult,t=u.part().resumeToolCall;if("Override"in a)return(0,r.jsx)(a.Override,{...c,addResult:e,resume:t});let n=a.by_name?.[c.toolName]??a.Fallback;return(0,r.jsx)(tx,{...c,Fallback:n,addResult:e,resume:t})}if(c.status?.type==="requires-action")throw Error("Encountered unexpected requires-action status");switch(d){case"text":return(0,r.jsx)(e,{...c});case"reasoning":return(0,r.jsx)(t,{...c});case"source":return(0,r.jsx)(i,{...c});case"image":return(0,r.jsx)(n,{...c});case"file":return(0,r.jsx)(s,{...c});case"audio":return(0,r.jsx)(o,{...c});case"data":{let e=l?.by_name?.[c.name]??l?.Fallback;return(0,r.jsx)(ty,{...c,Fallback:e})}default:return console.warn(`Unknown message part type: ${d}`),null}},tT=(0,i.memo)(({partIndex:e,components:t})=>(0,r.jsx)(eM,{index:e,children:(0,r.jsx)(tC,{components:t})}),(e,t)=>e.partIndex===t.partIndex&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.Group===t.components?.Group),tj=({status:e,component:t})=>(0,r.jsx)(eO,{text:"",isRunning:"running"===e.type,children:(0,r.jsx)(t,{type:"text",text:"",status:e})}),tI=Object.freeze({type:"complete"}),tA=(0,i.memo)(({components:e})=>{let t=f(e=>e.message.status??tI);return e?.Empty?(0,r.jsx)(e.Empty,{status:t}):(0,r.jsx)(tj,{status:t,component:e?.Text??tb})},(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),tR=({groupingFunction:e,components:t})=>{let n,s=f(e=>e.message.parts.length),o=(n=f(e=>e.message.parts),(0,i.useMemo)(()=>0===n.length?[]:e(n),[n,e])),a=(0,i.useMemo)(()=>0===s?(0,r.jsx)(tA,{components:t}):o.map((e,n)=>{let i=t?.Group??tE;return(0,r.jsx)(i,{groupKey:e.groupKey,indices:e.indices,children:e.indices.map(e=>(0,r.jsx)(tT,{partIndex:e,components:t},e))},`group-${n}-${e.groupKey??"ungrouped"}`)}),[o,t,s]);return(0,r.jsx)(r.Fragment,{children:a})};tR.displayName="MessagePrimitive.Unstable_PartsGrouped";let tM=({components:e,...t})=>(0,r.jsx)(tR,{...t,components:e,groupingFunction:tg});tM.displayName="MessagePrimitive.Unstable_PartsGroupedByParentId",e.s(["AttachmentByIndex",0,td,"Attachments",0,tp,"Content",0,ta,"Error",0,tm,"If",0,tl,"PartByIndex",0,eJ,"Parts",0,ta,"Quote",0,tf,"Root",0,eR,"Unstable_PartsGrouped",0,tR,"Unstable_PartsGroupedByParentId",0,tM],76320);var tN=e.i(76320);e.s(["MessagePrimitive",0,tN],61302),e.s([],65643),e.i(65643);let tP=(0,i.forwardRef)((e,t)=>(0,r.jsx)(d.div,{...e,ref:t}));tP.displayName="ThreadPrimitive.Root";let tD=({children:e})=>f(e=>e.thread.isEmpty)?e:null;tD.displayName="ThreadPrimitive.Empty";let tO=({children:e,...t})=>f(e=>(!0!==t.empty||!!e.thread.isEmpty)&&(!1!==t.empty||!e.thread.isEmpty)&&(!0!==t.running||!!e.thread.isRunning)&&(!1!==t.running||!e.thread.isRunning)&&(!0!==t.disabled||!!e.thread.isDisabled)&&(!1!==t.disabled||!e.thread.isDisabled)&&!0)?e:null;tO.displayName="ThreadPrimitive.If";let tB=i.default.createContext(!0);function tL(){throw Error("A function wrapped in useEffectEvent can't be called during rendering.")}let tF="use"in i.default?()=>{try{return i.default.use(tB)}catch{return!1}}:()=>!1;var tz=e.i(88992);let tU=(e,t)=>{let n,r=(0,h.useAui)(),s=(n=i.default.useRef(tL),i.default.useInsertionEffect(()=>{n.current=t},[t]),(...e)=>(tF()&&tL(),(0,n.current)(...e))),{scope:o,event:a}=(0,tz.normalizeEventSelector)(e);(0,i.useEffect)(()=>r.on({scope:o,event:a},s),[r,o,a,s])};var t$=e.i(17367);let tq=(0,i.forwardRef)(({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:n,scrollToBottomOnThreadSwitch:o,children:a,...l},u)=>{let c=(({autoScroll:e,scrollToBottomOnRunStart:t=!0,scrollToBottomOnInitialize:n=!0,scrollToBottomOnThreadSwitch:r=!0})=>{var o;let a,l=(0,i.useRef)(null),u=(0,Z.useThreadViewportStore)();void 0===e&&(e="top"!==u.getState().turnAnchor);let c=(0,i.useRef)(0),d=(0,i.useRef)(null),h=(0,i.useCallback)(e=>{let t=l.current;t&&(d.current=e,t.scrollTo({top:t.scrollHeight,behavior:e}))},[]),p=()=>{let e=l.current;if(!e)return;let t=u.getState().isAtBottom,n=1>Math.abs(e.scrollHeight-e.scrollTop-e.clientHeight)||e.scrollHeight<=e.clientHeight;!n&&c.current<e.scrollTop||(n&&(d.current=null),(n||null===d.current)&&n!==t&&(0,te.writableStore)(u).setState({isAtBottom:n})),c.current=e.scrollTop},f=(o=()=>{let t=d.current;t?h(t):e&&u.getState().isAtBottom&&h("instant"),p()},a=(0,X.useCallbackRef)(o),eC((0,i.useCallback)(e=>{let t=new ResizeObserver(()=>{a()}),n=new MutationObserver(e=>{e.some(e=>"attributes"!==e.type||"style"!==e.attributeName)&&a()});return t.observe(e),n.observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>{t.disconnect(),n.disconnect()}},[a]))),m=eC(e=>(e.addEventListener("scroll",p),()=>{e.removeEventListener("scroll",p)}));return ee(({behavior:e})=>{h(e)}),tU("thread.runStart",()=>{t&&(d.current="auto",requestAnimationFrame(()=>{h("auto")}))}),tU("thread.initialize",()=>{n&&(d.current="instant",requestAnimationFrame(()=>{h("instant")}))}),tU("threadListItem.switchedTo",()=>{r&&(d.current="instant",requestAnimationFrame(()=>{h("instant")}))}),(0,s.useComposedRefs)(f,m,l)})({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:n,scrollToBottomOnThreadSwitch:o}),h=eT((0,Z.useThreadViewport)(e=>e.registerViewport),(0,i.useCallback)(e=>e.clientHeight,[])),p=(0,s.useComposedRefs)(u,c,h);return(0,r.jsx)(d.div,{...l,ref:p,children:a})});tq.displayName="ThreadPrimitive.ViewportScrollable";let tH=(0,i.forwardRef)(({turnAnchor:e,...t},n)=>(0,r.jsx)(t$.ThreadPrimitiveViewportProvider,{options:{turnAnchor:e},children:(0,r.jsx)(tq,{...t,ref:n})}));tH.displayName="ThreadPrimitive.Viewport";let tV=(0,i.forwardRef)((e,t)=>{let n=eT((0,Z.useThreadViewport)(e=>e.registerContentInset),(0,i.useCallback)(e=>{let t=parseFloat(getComputedStyle(e).marginTop)||0;return e.offsetHeight+t},[])),o=(0,s.useComposedRefs)(t,n);return(0,r.jsx)(d.div,{...e,ref:o})});tV.displayName="ThreadPrimitive.ViewportFooter";let tW=({index:e,children:t})=>{let n=(0,h.useAui)({message:(0,eu.Derived)({source:"thread",query:{type:"index",index:e},get:t=>t.thread().message({index:e})}),composer:(0,eu.Derived)({source:"message",query:{},get:t=>t.thread().message({index:e}).composer()})});return(0,r.jsx)(el.AuiProvider,{value:n,children:t})},tK=(e,t)=>e.Message===t.Message&&e.EditComposer===t.EditComposer&&e.UserEditComposer===t.UserEditComposer&&e.AssistantEditComposer===t.AssistantEditComposer&&e.SystemEditComposer===t.SystemEditComposer&&e.UserMessage===t.UserMessage&&e.AssistantMessage===t.AssistantMessage&&e.SystemMessage===t.SystemMessage,tJ=()=>null,tQ=({components:e})=>{let t=((e,t,n)=>{switch(t){case"user":if(n)return e.UserEditComposer??e.EditComposer??e.UserMessage??e.Message;return e.UserMessage??e.Message;case"assistant":if(n)return e.AssistantEditComposer??e.EditComposer??e.AssistantMessage??e.Message;return e.AssistantMessage??e.Message;case"system":if(n)return e.SystemEditComposer??e.EditComposer??e.SystemMessage??e.Message;return e.SystemMessage??e.Message??tJ;default:throw Error(`Unknown message role: ${t}`)}})(e,f(e=>e.message.role),f(e=>e.message.composer.isEditing));return(0,r.jsx)(t,{})},tG=(0,i.memo)(({index:e,components:t})=>(0,r.jsx)(tW,{index:e,children:(0,r.jsx)(tQ,{components:t})}),(e,t)=>e.index===t.index&&tK(e.components,t.components));tG.displayName="ThreadPrimitive.MessageByIndex";let tY=({children:e})=>{let t=f(e=>e.thread.messages.length);return(0,i.useMemo)(()=>0===t?null:Array.from({length:t},(t,n)=>(0,r.jsx)(tW,{index:n,children:(0,r.jsx)(eo,{getItemState:e=>e.thread().message({index:n}).getState(),children:t=>e({get message(){return t()}})})},n)),[t,e])},tX=({components:e,children:t})=>e?(0,r.jsx)(tY,{children:()=>(0,r.jsx)(tQ,{components:e})}):(0,r.jsx)(tY,{children:t});tX.displayName="ThreadPrimitive.Messages";let tZ=(0,i.memo)(tX,(e,t)=>e.children||t.children?e.children===t.children:tK(e.components,t.components)),t0=b("ThreadPrimitive.ScrollToBottom",({behavior:e}={})=>{let t=(0,Z.useThreadViewport)(e=>e.isAtBottom),n=(0,Z.useThreadViewportStore)(),r=(0,i.useCallback)(()=>{n.getState().scrollToBottom({behavior:e})},[n,e]);return t?null:r},["behavior"]),t1=b("ThreadPrimitive.Suggestion",({prompt:e,send:t,clearComposer:n,autoSend:r,method:s})=>{let{disabled:o,trigger:a}=(({prompt:e,send:t,clearComposer:n=!0})=>{let r=(0,h.useAui)(),s=f(e=>e.thread.isDisabled),o=t??!1;return{trigger:(0,i.useCallback)(()=>{let t=r.thread().getState().isRunning;if(o&&!t)r.thread().append({content:[{type:"text",text:e}],runConfig:r.composer().getState().runConfig}),n&&r.composer().setText("");else if(n)r.composer().setText(e);else{let t=r.composer().getState().text;r.composer().setText(t.trim()?`${t} ${e}`:e)}},[r,o,n,e]),disabled:s}})({prompt:e,send:t??r??!1,clearComposer:n});return o?null:a},["prompt","send","clearComposer","autoSend","method"]),t2=({index:e,children:t})=>{let n=(0,h.useAui)({suggestion:(0,eu.Derived)({source:"suggestions",query:{index:e},get:t=>t.suggestions().suggestion({index:e})})});return(0,r.jsx)(el.AuiProvider,{value:n,children:t})},t5=({components:e})=>{let t=e.Suggestion;return(0,r.jsx)(t,{})},t3=(0,i.memo)(({index:e,components:t})=>(0,r.jsx)(t2,{index:e,children:(0,r.jsx)(t5,{components:t})}),(e,t)=>e.index===t.index&&e.components.Suggestion===t.components.Suggestion);t3.displayName="ThreadPrimitive.SuggestionByIndex";let t4=({children:e})=>{let t=f(e=>e.suggestions.suggestions.length);return(0,i.useMemo)(()=>0===t?null:Array.from({length:t},(t,n)=>(0,r.jsx)(t2,{index:n,children:(0,r.jsx)(eo,{getItemState:e=>e.suggestions().suggestion({index:n}).getState(),children:t=>e({get suggestion(){return t()}})})},n)),[t,e])},t6=({components:e,children:t})=>e?(0,r.jsx)(t4,{children:()=>(0,r.jsx)(t5,{components:e})}):(0,r.jsx)(t4,{children:t});t6.displayName="ThreadPrimitive.Suggestions";let t8=(0,i.memo)(t6,(e,t)=>e.children||t.children?e.children===t.children:e.components.Suggestion===t.components.Suggestion);e.s(["Empty",0,tD,"If",0,tO,"MessageByIndex",0,tG,"Messages",0,tZ,"Root",0,tP,"ScrollToBottom",0,t0,"Suggestion",0,t1,"SuggestionByIndex",0,t3,"Suggestions",0,t8,"Viewport",0,tH,"ViewportFooter",0,tV,"ViewportProvider",()=>t$.ThreadPrimitiveViewportProvider,"ViewportSlack",0,eA],16189);var t9=e.i(16189);e.s(["ThreadPrimitive",0,t9],94875),e.i(44172);function t7(e){return function(t){let n,r=!1;"function"==typeof t?n=t:t&&(r=!!t.optional,n=t.selector);let s=e({optional:r});return s?function(e,t=e=>e){e.__isBound||(e.__internal_bindMethods?.(),e.__isBound=!0);let n=(0,i.useSyncExternalStore)(e.subscribe,()=>t(e.getState()),()=>t(e.getState()));return(0,i.useDebugValue)(n),n}(s,n):null}}function ne(e){let t=(0,h.useAui)(),n=f(()=>t.message.source?t.message().__internal_getRuntime?.()??null:null);if(!n&&!e?.optional)throw Error("MessageRuntime is not available");return n}let nt=t7(ne);t7(e=>ne(e)?.composer??null),e.s(["useMessage",0,nt],30854)},69090,(e,t,n)=>{"use strict";var r=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,s=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,c=/^\s+|\s+$/g;function d(e){return e?e.replace(c,""):""}t.exports=function(e,t){if("string"!=typeof e)throw TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,c=1;function h(e){var t=e.match(i);t&&(n+=t.length);var r=e.lastIndexOf("\n");c=~r?e.length-r:c+e.length}function p(){var e={line:n,column:c};return function(t){return t.position=new f(e),g(s),t}}function f(e){this.start=e,this.end={line:n,column:c},this.source=t.source}function m(r){var i=Error(t.source+":"+n+":"+c+": "+r);if(i.reason=r,i.filename=t.source,i.line=n,i.column=c,i.source=e,t.silent);else throw i}function g(t){var n=t.exec(e);if(n){var r=n[0];return h(r),e=e.slice(r.length),n}}function x(e){var t;for(e=e||[];t=y();)!1!==t&&e.push(t);return e}function y(){var t=p();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;""!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return m("End of comment missing");var r=e.slice(2,n-2);return c+=2,h(r),e=e.slice(n),c+=2,t({type:"comment",comment:r})}}f.prototype.content=e,g(s);var b,v=[];for(x(v);b=function(){var e=p(),t=g(o);if(t){if(y(),!g(a))return m("property missing ':'");var n=g(l),i=e({type:"declaration",property:d(t[0].replace(r,"")),value:n?d(n[0].replace(r,"")):""});return g(u),i}}();)!1!==b&&(v.push(b),x(v));return v}},59596,(e,t,n)=>{"use strict";var r=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e,t){let n=null;if(!e||"string"!=typeof e)return n;let r=(0,i.default)(e),s="function"==typeof t;return r.forEach(e=>{if("declaration"!==e.type)return;let{property:r,value:i}=e;s?t(r,i,e):i&&((n=n||{})[r]=i)}),n};let i=r(e.r(69090))},51521,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.camelCase=void 0;var r=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,s=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,l=function(e,t){return t.toUpperCase()},u=function(e,t){return"".concat(t,"-")};n.camelCase=function(e,t){var n;return(void 0===t&&(t={}),!(n=e)||s.test(n)||r.test(n))?e:(e=e.toLowerCase(),(e=t.reactCompat?e.replace(a,u):e.replace(o,u)).replace(i,l))}},63185,(e,t,n)=>{"use strict";var r=(e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(e.r(59596)),i=e.r(51521);function s(e,t){var n={};return e&&"string"==typeof e&&(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}s.default=s,t.exports=s},75609,(e,t,n)=>{"use strict";var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,s=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===i.call(e)},l=function(e){if(!e||"[object Object]"!==i.call(e))return!1;var t,n=r.call(e,"constructor"),s=e.constructor&&e.constructor.prototype&&r.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!s)return!1;for(t in e);return void 0===t||r.call(e,t)},u=function(e,t){s&&"__proto__"===t.name?s(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},c=function(e,t){if("__proto__"===t){if(!r.call(e,t))return;else if(o)return o(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,s,o,d=arguments[0],h=1,p=arguments.length,f=!1;for("boolean"==typeof d&&(f=d,d=arguments[1]||{},h=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});h<p;++h)if(t=arguments[h],null!=t)for(n in t)r=c(d,n),d!==(i=c(t,n))&&(f&&i&&(l(i)||(s=a(i)))?(s?(s=!1,o=r&&a(r)?r:[]):o=r&&l(r)?r:{},u(d,{name:n,newValue:e(f,o,i)})):void 0!==i&&u(d,{name:n,newValue:i}));return d}},427,97802,12105,59245,44819,55470,33220,51256,27066,5568,84484,73119,2652,16920,e=>{"use strict";function t(){}function n(){}e.s(["ok",()=>t,"unreachable",()=>n],97802);let r=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,i=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,s={};function o(e,t){return((t||s).jsx?i:r).test(e)}let a=/[ \t\n\f\r]/g;function l(e){return""===e.replace(a,"")}class u{constructor(e,t){this.attribute=t,this.property=e}}u.prototype.attribute="",u.prototype.booleanish=!1,u.prototype.boolean=!1,u.prototype.commaOrSpaceSeparated=!1,u.prototype.commaSeparated=!1,u.prototype.defined=!1,u.prototype.mustUseProperty=!1,u.prototype.number=!1,u.prototype.overloadedBoolean=!1,u.prototype.property="",u.prototype.spaceSeparated=!1,u.prototype.space=void 0;let c=0,d=y(),h=y(),p=y(),f=y(),m=y(),g=y(),x=y();function y(){return 2**++c}e.s(["boolean",0,d,"booleanish",0,h,"commaOrSpaceSeparated",0,x,"commaSeparated",0,g,"number",0,f,"overloadedBoolean",0,p,"spaceSeparated",0,m],83954);var b=e.i(83954);let v=Object.keys(b);class k extends u{constructor(e,t,n,r){let i=-1;if(super(e,t),function(e,t,n){n&&(e[t]=n)}(this,"space",r),"number"==typeof n)for(;++i<v.length;){const e=v[i];!function(e,t,n){n&&(e[t]=n)}(this,v[i],(n&b[e])===b[e])}}}function w(e){return e.toLowerCase()}k.prototype.defined=!0;let S=/[A-Z]/g,_=/-[a-z]/g,E=/^data[-\w.:]+$/i;function C(e){return"-"+e.toLowerCase()}function T(e){return e.charAt(1).toUpperCase()}let j={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"};class I{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function A(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new I(n,r,t)}function R(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let s=new k(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[w(r)]=r,n[w(s.attribute)]=r}return new I(t,n,e.space)}I.prototype.normal={},I.prototype.property={},I.prototype.space=void 0;let M=R({properties:{ariaActiveDescendant:null,ariaAtomic:h,ariaAutoComplete:null,ariaBusy:h,ariaChecked:h,ariaColCount:f,ariaColIndex:f,ariaColSpan:f,ariaControls:m,ariaCurrent:null,ariaDescribedBy:m,ariaDetails:null,ariaDisabled:h,ariaDropEffect:m,ariaErrorMessage:null,ariaExpanded:h,ariaFlowTo:m,ariaGrabbed:h,ariaHasPopup:null,ariaHidden:h,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:m,ariaLevel:f,ariaLive:null,ariaModal:h,ariaMultiLine:h,ariaMultiSelectable:h,ariaOrientation:null,ariaOwns:m,ariaPlaceholder:null,ariaPosInSet:f,ariaPressed:h,ariaReadOnly:h,ariaRelevant:null,ariaRequired:h,ariaRoleDescription:m,ariaRowCount:f,ariaRowIndex:f,ariaRowSpan:f,ariaSelected:h,ariaSetSize:f,ariaSort:null,ariaValueMax:f,ariaValueMin:f,ariaValueNow:f,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function N(e,t){return t in e?e[t]:t}function P(e,t){return N(e,t.toLowerCase())}let D=R({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:g,acceptCharset:m,accessKey:m,action:null,allow:null,allowFullScreen:d,allowPaymentRequest:d,allowUserMedia:d,alt:null,as:null,async:d,autoCapitalize:null,autoComplete:m,autoFocus:d,autoPlay:d,blocking:m,capture:null,charSet:null,checked:d,cite:null,className:m,cols:f,colSpan:null,content:null,contentEditable:h,controls:d,controlsList:m,coords:f|g,crossOrigin:null,data:null,dateTime:null,decoding:null,default:d,defer:d,dir:null,dirName:null,disabled:d,download:p,draggable:h,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:d,formTarget:null,headers:m,height:f,hidden:p,high:f,href:null,hrefLang:null,htmlFor:m,httpEquiv:m,id:null,imageSizes:null,imageSrcSet:null,inert:d,inputMode:null,integrity:null,is:null,isMap:d,itemId:null,itemProp:m,itemRef:m,itemScope:d,itemType:m,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:d,low:f,manifest:null,max:null,maxLength:f,media:null,method:null,min:null,minLength:f,multiple:d,muted:d,name:null,nonce:null,noModule:d,noValidate:d,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:d,optimum:f,pattern:null,ping:m,placeholder:null,playsInline:d,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:d,referrerPolicy:null,rel:m,required:d,reversed:d,rows:f,rowSpan:f,sandbox:m,scope:null,scoped:d,seamless:d,selected:d,shadowRootClonable:d,shadowRootDelegatesFocus:d,shadowRootMode:null,shape:null,size:f,sizes:null,slot:null,span:f,spellCheck:h,src:null,srcDoc:null,srcLang:null,srcSet:null,start:f,step:null,style:null,tabIndex:f,target:null,title:null,translate:null,type:null,typeMustMatch:d,useMap:null,value:h,width:f,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:m,axis:null,background:null,bgColor:null,border:f,borderColor:null,bottomMargin:f,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:d,declare:d,event:null,face:null,frame:null,frameBorder:null,hSpace:f,leftMargin:f,link:null,longDesc:null,lowSrc:null,marginHeight:f,marginWidth:f,noResize:d,noHref:d,noShade:d,noWrap:d,object:null,profile:null,prompt:null,rev:null,rightMargin:f,rules:null,scheme:null,scrolling:h,standby:null,summary:null,text:null,topMargin:f,valueType:null,version:null,vAlign:null,vLink:null,vSpace:f,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:d,disableRemotePlayback:d,prefix:null,property:null,results:f,security:null,unselectable:null},space:"html",transform:P}),O=R({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"},properties:{about:x,accentHeight:f,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:f,amplitude:f,arabicForm:null,ascent:f,attributeName:null,attributeType:null,azimuth:f,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:f,by:null,calcMode:null,capHeight:f,className:m,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:f,diffuseConstant:f,direction:null,display:null,dur:null,divisor:f,dominantBaseline:null,download:d,dx:null,dy:null,edgeMode:null,editable:null,elevation:f,enableBackground:null,end:null,event:null,exponent:f,externalResourcesRequired:null,fill:null,fillOpacity:f,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:g,g2:g,glyphName:g,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:f,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:f,horizOriginX:f,horizOriginY:f,id:null,ideographic:f,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:f,k:f,k1:f,k2:f,k3:f,k4:f,kernelMatrix:x,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:f,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:f,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:f,overlineThickness:f,paintOrder:null,panose1:null,path:null,pathLength:f,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:m,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:f,pointsAtY:f,pointsAtZ:f,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:x,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:x,rev:x,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:x,requiredFeatures:x,requiredFonts:x,requiredFormats:x,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:f,specularExponent:f,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:f,strikethroughThickness:f,string:null,stroke:null,strokeDashArray:x,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:f,strokeOpacity:f,strokeWidth:null,style:null,surfaceScale:f,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:x,tabIndex:f,tableValues:null,target:null,targetX:f,targetY:f,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:x,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:f,underlineThickness:f,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:f,values:null,vAlphabetic:f,vMathematical:f,vectorEffect:null,vHanging:f,vIdeographic:f,version:null,vertAdvY:f,vertOriginX:f,vertOriginY:f,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:f,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:N}),B=R({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),L=R({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:P}),F=R({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),z=A([M,D,B,L,F],"html"),U=A([M,O,B,L,F],"svg");var $=e.i(63185);let q=V("end"),H=V("start");function V(e){return function(t){let n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function W(e){return e&&"object"==typeof e?"position"in e||"type"in e?J(e.position):"start"in e||"end"in e?J(e):"line"in e||"column"in e?K(e):"":""}function K(e){return Q(e&&e.line)+":"+Q(e&&e.column)}function J(e){return K(e&&e.start)+"-"+K(e&&e.end)}function Q(e){return e&&"number"==typeof e?e:1}class G extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",i={},s=!1;if(t&&(i="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!i.cause&&e&&(s=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=o?o.line:void 0,this.name=W(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}G.prototype.file="",G.prototype.name="",G.prototype.reason="",G.prototype.message="",G.prototype.stack="",G.prototype.column=void 0,G.prototype.line=void 0,G.prototype.ancestors=void 0,G.prototype.cause=void 0,G.prototype.fatal=void 0,G.prototype.place=void 0,G.prototype.ruleId=void 0,G.prototype.source=void 0;let Y={}.hasOwnProperty,X=new Map,Z=/[A-Z]/g,ee=new Set(["table","tbody","thead","tfoot","tr"]),et=new Set(["td","th"]),en="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function er(e,n,r){var i,s,o,a,c,d,h,p,f;let m,g,x,y,b,v,I,A,R,M,N;return"element"===n.type?(i=e,s=n,o=r,g=m=i.schema,"svg"===s.tagName.toLowerCase()&&"html"===m.space&&(i.schema=U),i.ancestors.push(s),x=ea(i,s.tagName,!1),y=function(e,t){let n,r,i={};for(r in t.properties)if("children"!==r&&Y.call(t.properties,r)){let s=function(e,t,n){let r=function(e,t){let n=w(t),r=t,i=u;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&E.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(_,T);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!_.test(e)){let n=e.replace(S,C);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}i=k}return new i(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){var i;let t;if(Array.isArray(n)&&(n=r.commaSeparated?(t={},(""===(i=n)[i.length-1]?[...i,""]:i).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()):n.join(" ").trim()),"style"===r.property){let t="object"==typeof n?n:function(e,t){try{return(0,$.default)(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};let t=new G("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=en+"#cannot-parse-style-attribute",t}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){let t,n={};for(t in e)Y.call(e,t)&&(n[function(e){let t=e.replace(Z,eu);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return n}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?j[r.property]||r.property:r.attribute,n]}}(e,r,t.properties[r]);if(s){let[r,o]=s;e.tableCellAlignToStyle&&"align"===r&&"string"==typeof o&&et.has(t.tagName)?n=o:i[r]=o}}return n&&((i.style||(i.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=n),i}(i,s),b=eo(i,s),ee.has(s.tagName)&&(b=b.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&l(e.value):l(e))})),ei(i,y,x,s),es(y,b),i.ancestors.pop(),i.schema=m,i.create(s,x,y,o)):"mdxFlowExpression"===n.type||"mdxTextExpression"===n.type?function(e,n){if(n.data&&n.data.estree&&e.evaluater){let r=n.data.estree.body[0];return t("ExpressionStatement"===r.type),e.evaluater.evaluateExpression(r.expression)}el(e,n.position)}(e,n):"mdxJsxFlowElement"===n.type||"mdxJsxTextElement"===n.type?(a=e,c=n,d=r,I=v=a.schema,"svg"===c.name&&"html"===v.space&&(a.schema=U),a.ancestors.push(c),A=null===c.name?a.Fragment:ea(a,c.name,!0),R=function(e,n){let r={};for(let i of n.attributes)if("mdxJsxExpressionAttribute"===i.type)if(i.data&&i.data.estree&&e.evaluater){let n=i.data.estree.body[0];t("ExpressionStatement"===n.type);let s=n.expression;t("ObjectExpression"===s.type);let o=s.properties[0];t("SpreadElement"===o.type),Object.assign(r,e.evaluater.evaluateExpression(o.argument))}else el(e,n.position);else{let s,o=i.name;if(i.value&&"object"==typeof i.value)if(i.value.data&&i.value.data.estree&&e.evaluater){let n=i.value.data.estree.body[0];t("ExpressionStatement"===n.type),s=e.evaluater.evaluateExpression(n.expression)}else el(e,n.position);else s=null===i.value||i.value;r[o]=s}return r}(a,c),M=eo(a,c),ei(a,R,A,c),es(R,M),a.ancestors.pop(),a.schema=v,a.create(c,A,R,d)):"mdxjsEsm"===n.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);el(e,t.position)}(e,n):"root"===n.type?(h=e,p=n,f=r,es(N={},eo(h,p)),h.create(p,h.Fragment,N,f)):"text"===n.type?n.value:void 0}function ei(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function es(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function eo(e,t){let n=[],r=-1,i=e.passKeys?new Map:X;for(;++r<t.children.length;){let s,o=t.children[r];if(e.passKeys){let e="element"===o.type?o.tagName:"mdxJsxFlowElement"===o.type||"mdxJsxTextElement"===o.type?o.name:void 0;if(e){let t=i.get(e)||0;s=e+"-"+t,i.set(e,t+1)}}let a=er(e,o,s);void 0!==a&&n.push(a)}return n}function ea(e,n,r){let i;if(r)if(n.includes(".")){let e,r=n.split("."),s=-1;for(;++s<r.length;){let t=o(r[s])?{type:"Identifier",name:r[s]}:{type:"Literal",value:r[s]};e=e?{type:"MemberExpression",object:e,property:t,computed:!!(s&&"Literal"===t.type),optional:!1}:t}t(e,"always a result"),i=e}else i=o(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};else i={type:"Literal",value:n};if("Literal"===i.type){let t=i.value;return Y.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(i);el(e)}function el(e,t){let n=new G("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=en+"#cannot-handle-mdx-estrees-without-createevaluater",n}function eu(e){return"-"+e.toLowerCase()}let ec={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]};var ed=e.i(20314);e.i(79054);let eh={};function ep(e,t){let n=t||eh;return ef(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function ef(e,t,n){var r;if((r=e)&&"object"==typeof r){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return em(e.children,t,n)}return Array.isArray(e)?em(e,t,n):""}function em(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=ef(e[i],t,n);return r.join("")}function eg(e,t,n,r){let i,s=e.length,o=0;if(t=t<0?-t>s?0:s+t:t>s?s:t,n=n>0?n:0,r.length<1e4)(i=Array.from(r)).unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);o<r.length;)(i=r.slice(o,o+1e4)).unshift(t,0),e.splice(...i),o+=1e4,t+=1e4}function ex(e,t){return e.length>0?(eg(e,e.length,0,t),e):t}e.s(["toString",()=>ep],12105),e.s(["push",()=>ex,"splice",()=>eg],59245);let ey={}.hasOwnProperty;function eb(e){let t={},n=-1;for(;++n<e.length;)!function(e,t){let n;for(n in t){let r,i=(ey.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];if(s)for(r in s){ey.call(i,r)||(i[r]=[]);let e=s[r];!function(e,t){let n=-1,r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);eg(e,0,0,r)}(i[r],Array.isArray(e)?e:e?[e]:[])}}}(t,e[n]);return t}e.s(["combineExtensions",()=>eb],44819);let ev=eM(/[A-Za-z]/),ek=eM(/[\dA-Za-z]/),ew=eM(/[#-'*+\--9=?A-Z^-~]/);function eS(e){return null!==e&&(e<32||127===e)}let e_=eM(/\d/),eE=eM(/[\dA-Fa-f]/),eC=eM(/[!-/:-@[-`{-~]/);function eT(e){return null!==e&&e<-2}function ej(e){return null!==e&&(e<0||32===e)}function eI(e){return -2===e||-1===e||32===e}let eA=eM(/\p{P}|\p{S}/u),eR=eM(/\s/);function eM(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function eN(e,t,n,r){let i=r?r-1:1/0,s=0;return function(r){return eI(r)?(e.enter(n),function r(o){return eI(o)&&s++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}e.s(["asciiAlpha",0,ev,"asciiAlphanumeric",0,ek,"asciiAtext",0,ew,"asciiControl",()=>eS,"asciiDigit",0,e_,"asciiHexDigit",0,eE,"asciiPunctuation",0,eC,"markdownLineEnding",()=>eT,"markdownLineEndingOrSpace",()=>ej,"markdownSpace",()=>eI,"unicodePunctuation",0,eA,"unicodeWhitespace",0,eR],55470),e.s(["factorySpace",()=>eN],33220);let eP={tokenize:function(e){let t,n=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),eN(e,n,"linePrefix"))},function(n){return e.enter("paragraph"),function n(r){let i=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=i),t=i,function t(r){if(null===r){e.exit("chunkText"),e.exit("paragraph"),e.consume(r);return}return eT(r)?(e.consume(r),e.exit("chunkText"),n):(e.consume(r),t)}(r)}(n)});return n}},eD={tokenize:function(e){let t,n,r,i=this,s=[],o=0;return a;function a(t){if(o<s.length){let n=s[o];return i.containerState=n[1],e.attempt(n[0].continuation,l,u)(t)}return u(t)}function l(e){if(o++,i.containerState._closeFlow){let n;i.containerState._closeFlow=void 0,t&&x();let r=i.events.length,s=r;for(;s--;)if("exit"===i.events[s][0]&&"chunkFlow"===i.events[s][1].type){n=i.events[s][1].end;break}g(o);let a=r;for(;a<i.events.length;)i.events[a][1].end={...n},a++;return eg(i.events,s+1,0,i.events.slice(r)),i.events.length=a,u(e)}return a(e)}function u(n){if(o===s.length){if(!t)return h(n);if(t.currentConstruct&&t.currentConstruct.concrete)return f(n);i.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(eO,c,d)(n)}function c(e){return t&&x(),g(o),h(e)}function d(e){return i.parser.lazy[i.now().line]=o!==s.length,r=i.now().offset,f(e)}function h(t){return i.containerState={},e.attempt(eO,p,f)(t)}function p(e){return o++,s.push([i.currentConstruct,i.containerState]),h(e)}function f(r){if(null===r){t&&x(),g(0),e.consume(r);return}return t=t||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:n}),function t(n){if(null===n){m(e.exit("chunkFlow"),!0),g(0),e.consume(n);return}return eT(n)?(e.consume(n),m(e.exit("chunkFlow")),o=0,i.interrupt=void 0,a):(e.consume(n),t)}(r)}function m(e,s){let a=i.sliceStream(e);if(s&&a.push(null),e.previous=n,n&&(n.next=e),n=e,t.defineSkip(e.start),t.write(a),i.parser.lazy[e.start.line]){let e,n,s=t.events.length;for(;s--;)if(t.events[s][1].start.offset<r&&(!t.events[s][1].end||t.events[s][1].end.offset>r))return;let a=i.events.length,l=a;for(;l--;)if("exit"===i.events[l][0]&&"chunkFlow"===i.events[l][1].type){if(e){n=i.events[l][1].end;break}e=!0}for(g(o),s=a;s<i.events.length;)i.events[s][1].end={...n},s++;eg(i.events,l+1,0,i.events.slice(a)),i.events.length=s}}function g(t){let n=s.length;for(;n-- >t;){let t=s[n];i.containerState=t[1],t[0].exit.call(i,e)}s.length=t}function x(){t.write([null]),n=void 0,t=void 0,i.containerState._closeFlow=void 0}}},eO={tokenize:function(e,t,n){return eN(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},eB={partial:!0,tokenize:function(e,t,n){return function(t){return eI(t)?eN(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||eT(e)?t(e):n(e)}}};e.s(["blankLine",0,eB],51256);class eL{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=null==t?1/0:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){this.setCursor(Math.trunc(e));let r=this.right.splice(this.right.length-(t||0),1/0);return n&&eF(this.left,n),r.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),eF(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),eF(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);eF(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);eF(this.left,t.reverse())}}}function eF(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function ez(e){let t,n,r,i,s,o,a,l={},u=-1,c=new eL(e);for(;++u<c.length;){for(;u in l;)u=l[u];if(t=c.get(u),u&&"chunkFlow"===t[1].type&&"listItemPrefix"===c.get(u-1)[1].type&&((r=0)<(o=t[1]._tokenizer.events).length&&"lineEndingBlank"===o[r][1].type&&(r+=2),r<o.length&&"content"===o[r][1].type))for(;++r<o.length&&"content"!==o[r][1].type;)"chunkText"===o[r][1].type&&(o[r][1]._isInFirstContentOfListItem=!0,r++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let n,r,i=e.get(t)[1],s=e.get(t)[2],o=t-1,a=[],l=i._tokenizer;!l&&(l=s.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let u=l.events,c=[],d={},h=-1,p=i,f=0,m=0,g=[0];for(;p;){for(;e.get(++o)[1]!==p;);a.push(o),!p._tokenizer&&(n=s.sliceStream(p),p.next||n.push(null),r&&l.defineSkip(p.start),p._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(n),p._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),r=p,p=p.next}for(p=i;++h<u.length;)"exit"===u[h][0]&&"enter"===u[h-1][0]&&u[h][1].type===u[h-1][1].type&&u[h][1].start.line!==u[h][1].end.line&&(m=h+1,g.push(m),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(l.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),h=g.length;h--;){let t=u.slice(g[h],g[h+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),h=-1;++h<c.length;)d[f+c[h][0]]=f+c[h][1],f+=c[h][1]-c[h][0]-1;return d}(c,u)),u=l[u],a=!0);else if(t[1]._container){for(r=u,n=void 0;r--;)if("lineEnding"===(i=c.get(r))[1].type||"lineEndingBlank"===i[1].type)"enter"===i[0]&&(n&&(c.get(n)[1].type="lineEndingBlank"),i[1].type="lineEnding",n=r);else if("linePrefix"===i[1].type||"listItemIndent"===i[1].type);else break;n&&(t[1].end={...c.get(n)[1].start},(s=c.slice(n,u)).unshift(t),c.splice(n,u-n+1,s))}}return eg(e,0,1/0,c.slice(0)),!a}let eU={resolve:function(e){return ez(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?i(t):eT(t)?e.check(e$,s,i)(t):(e.consume(t),r)}function i(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function s(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},e$={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),eN(e,i,"linePrefix")};function i(i){if(null===i||eT(i))return n(i);let s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&"linePrefix"===s[1].type&&s[2].sliceSerialize(s[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}},eq={tokenize:function(e){let t=this,n=e.attempt(eB,function(r){return null===r?void e.consume(r):(e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n)},e.attempt(this.parser.constructs.flowInitial,r,eN(e,e.attempt(this.parser.constructs.flow,r,e.attempt(eU,r)),"linePrefix")));return n;function r(r){return null===r?void e.consume(r):(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n)}}},eH={resolveAll:eJ()},eV=eK("string"),eW=eK("text");function eK(e){return{resolveAll:eJ("text"===e?eQ:void 0),tokenize:function(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,s,o);return s;function s(e){return l(e)?i(e):o(e)}function o(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),a)}function a(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),a)}function l(e){if(null===e)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function eJ(e){return function(t,n){let r,i=-1;for(;++i<=t.length;)void 0===r?t[i]&&"data"===t[i][1].type&&(r=i,i++):t[i]&&"data"===t[i][1].type||(i!==r+2&&(t[r][1].end=t[i-1][1].end,t.splice(r+2,i-r-2),i=r+2),r=void 0);return e?e(t,n):t}}function eQ(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){let r,i=e[n-1][1],s=t.sliceStream(i),o=s.length,a=-1,l=0;for(;o--;){let e=s[o];if("string"==typeof e){for(a=e.length;32===e.charCodeAt(a-1);)l++,a--;if(a)break;a=-1}else if(-2===e)r=!0,l++;else if(-1===e);else{o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){let s={type:n===e.length||r||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?a:i.start._bufferIndex+a,_index:i.start._index+o,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...s.start},i.start.offset===i.end.offset?Object.assign(i,s):(e.splice(n,0,["enter",s,t],["exit",s,t]),n+=2)}n++}return e}function eG(e){return null===e||ej(e)||eR(e)?1:eA(e)?2:void 0}function eY(e,t,n){let r=[],i=-1;for(;++i<e.length;){let s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}e.s(["classifyCharacter",()=>eG],27066),e.s(["resolveAll",()=>eY],5568);let eX={name:"attention",resolveAll:function(e,t){let n,r,i,s,o,a,l,u,c=-1;for(;++c<e.length;)if("enter"===e[c][0]&&"attentionSequence"===e[c][1].type&&e[c][1]._close){for(n=c;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[c][1]).charCodeAt(0)){if((e[n][1]._close||e[c][1]._open)&&(e[c][1].end.offset-e[c][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[c][1].end.offset-e[c][1].start.offset)%3))continue;a=e[n][1].end.offset-e[n][1].start.offset>1&&e[c][1].end.offset-e[c][1].start.offset>1?2:1;let d={...e[n][1].end},h={...e[c][1].start};eZ(d,-a),eZ(h,a),s={type:a>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},o={type:a>1?"strongSequence":"emphasisSequence",start:{...e[c][1].start},end:h},i={type:a>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[c][1].start}},r={type:a>1?"strong":"emphasis",start:{...s.start},end:{...o.end}},e[n][1].end={...s.start},e[c][1].start={...o.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=ex(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=ex(l,[["enter",r,t],["enter",s,t],["exit",s,t],["enter",i,t]]),l=ex(l,eY(t.parser.constructs.insideSpan.null,e.slice(n+1,c),t)),l=ex(l,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",r,t]]),e[c][1].end.offset-e[c][1].start.offset?(u=2,l=ex(l,[["enter",e[c][1],t],["exit",e[c][1],t]])):u=0,eg(e,n-1,c-n+3,l),c=n+l.length-u-2;break}}for(c=-1;++c<e.length;)"attentionSequence"===e[c][1].type&&(e[c][1].type="data");return e},tokenize:function(e,t){let n,r=this.parser.constructs.attentionMarkers.null,i=this.previous,s=eG(i);return function(o){return n=o,e.enter("attentionSequence"),function o(a){if(a===n)return e.consume(a),o;let l=e.exit("attentionSequence"),u=eG(a),c=!u||2===u&&s||r.includes(a),d=!s||2===s&&u||r.includes(i);return l._open=!!(42===n?c:c&&(s||!d)),l._close=!!(42===n?d:d&&(u||!c)),t(a)}(o)}}};function eZ(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let e0={continuation:{tokenize:function(e,t,n){let r=this;return function(t){return eI(t)?eN(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(r){return e.attempt(e0,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){let r=this;return function(t){if(62===t){let n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return n(t)};function i(n){return eI(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}},e1={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return eC(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}},e2=document.createElement("i");function e5(e){let t="&"+e+";";e2.innerHTML=t;let n=e2.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}let e3={name:"characterReference",tokenize:function(e,t,n){let r,i,s=this,o=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),a};function a(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),r=31,i=ek,u(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),r=6,i=eE,u):(e.enter("characterReferenceValue"),r=7,i=e_,u(t))}function u(a){if(59===a&&o){let r=e.exit("characterReferenceValue");return i!==ek||e5(s.sliceSerialize(r))?(e.enter("characterReferenceMarker"),e.consume(a),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(a)}return i(a)&&o++<r?(e.consume(a),u):n(a)}}},e4={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},e6={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){let r,i=this,s={partial:!0,tokenize:function(e,t,n){let s=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o};function o(t){return e.enter("codeFencedFence"),eI(t)?eN(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===r?(e.enter("codeFencedFenceSequence"),function t(i){return i===r?(s++,e.consume(i),t):s>=a?(e.exit("codeFencedFenceSequence"),eI(i)?eN(e,u,"whitespace")(i):u(i)):n(i)}(t)):n(t)}function u(r){return null===r||eT(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}},o=0,a=0;return function(t){var s;let u;return s=t,o=(u=i.events[i.events.length-1])&&"linePrefix"===u[1].type?u[2].sliceSerialize(u[1],!0).length:0,r=s,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(i){return i===r?(a++,e.consume(i),t):a<3?n(i):(e.exit("codeFencedFenceSequence"),eI(i)?eN(e,l,"whitespace")(i):l(i))}(s)};function l(s){return null===s||eT(s)?(e.exit("codeFencedFence"),i.interrupt?t(s):e.check(e4,c,f)(s)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||eT(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(i)):eI(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),eN(e,u,"whitespace")(i)):96===i&&i===r?n(i):(e.consume(i),t)}(s))}function u(t){return null===t||eT(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||eT(i)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(i)):96===i&&i===r?n(i):(e.consume(i),t)}(t))}function c(t){return e.attempt(s,f,d)(t)}function d(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h}function h(t){return o>0&&eI(t)?eN(e,p,"linePrefix",o+1)(t):p(t)}function p(t){return null===t||eT(t)?e.check(e4,c,f)(t):(e.enter("codeFlowValue"),function t(n){return null===n||eT(n)?(e.exit("codeFlowValue"),p(n)):(e.consume(n),t)}(t))}function f(n){return e.exit("codeFenced"),t(n)}}},e8={name:"codeIndented",tokenize:function(e,t,n){let r=this;return function(t){return e.enter("codeIndented"),eN(e,i,"linePrefix",5)(t)};function i(t){let i=r.events[r.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?function t(n){return null===n?s(n):eT(n)?e.attempt(e9,t,s)(n):(e.enter("codeFlowValue"),function n(r){return null===r||eT(r)?(e.exit("codeFlowValue"),t(r)):(e.consume(r),n)}(n))}(t):n(t)}function s(n){return e.exit("codeIndented"),t(n)}}},e9={partial:!0,tokenize:function(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):eT(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):eN(e,s,"linePrefix",5)(t)}function s(e){let s=r.events[r.events.length-1];return s&&"linePrefix"===s[1].type&&s[2].sliceSerialize(s[1],!0).length>=4?t(e):eT(e)?i(e):n(e)}}};function e7(e,t,n,r,i,s,o,a,l){let u=l||1/0,c=0;return function(t){return 60===t?(e.enter(r),e.enter(i),e.enter(s),e.consume(t),e.exit(s),d):null===t||32===t||41===t||eS(t)?n(t):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),f(t))};function d(n){return 62===n?(e.enter(s),e.consume(n),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(n))}function h(t){return 62===t?(e.exit("chunkString"),e.exit(a),d(t)):null===t||60===t||eT(t)?n(t):(e.consume(t),92===t?p:h)}function p(t){return 60===t||62===t||92===t?(e.consume(t),h):h(t)}function f(i){return!c&&(null===i||41===i||ej(i))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(i)):c<u&&40===i?(e.consume(i),c++,f):41===i?(e.consume(i),c--,f):null===i||32===i||40===i||eS(i)?n(i):(e.consume(i),92===i?m:f)}function m(t){return 40===t||41===t||92===t?(e.consume(t),f):f(t)}}function te(e,t,n,r,i,s){let o,a=this,l=0;return function(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(s),u};function u(d){return l>999||null===d||91===d||93===d&&!o||94===d&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(d):93===d?(e.exit(s),e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):eT(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),c(d))}function c(t){return null===t||91===t||93===t||eT(t)||l++>999?(e.exit("chunkString"),u(t)):(e.consume(t),o||(o=!eI(t)),92===t?d:c)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,c):c(t)}}function tt(e,t,n,r,i,s){let o;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=40===t?41:t,a):n(t)};function a(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(s),l(n))}function l(t){return t===o?(e.exit(s),a(o)):null===t?n(t):eT(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),eN(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(t))}function u(t){return t===o||null===t||eT(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?c:u)}function c(t){return t===o||92===t?(e.consume(t),u):u(t)}}function tn(e,t){let n;return function r(i){return eT(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):eI(i)?eN(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}function tr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}e.s(["normalizeIdentifier",()=>tr],84484);let ti={partial:!0,tokenize:function(e,t,n){return function(t){return ej(t)?tn(e,r)(t):n(t)};function r(t){return tt(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return eI(t)?eN(e,s,"whitespace")(t):s(t)}function s(e){return null===e||eT(e)?t(e):n(e)}}},ts=["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"],to=["pre","script","style","textarea"],ta={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(eB,t,n)}}},tl={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return eT(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):n(t)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},tu={name:"labelEnd",resolveAll:function(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){let e="labelImage"===r.type?4:2;r.type="data",t+=e}}return e.length!==n.length&&eg(e,0,e.length,n),e},resolveTo:function(e,t){let n,r,i,s,o=e.length,a=0;for(;o--;)if(n=e[o][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[o][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(i){if("enter"===e[o][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=o,"labelLink"!==n.type)){a=2;break}}else"labelEnd"===n.type&&(i=o);let l={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[r][1].start},end:{...e[i][1].end}},c={type:"labelText",start:{...e[r+a+2][1].end},end:{...e[i-2][1].start}};return s=ex(s=[["enter",l,t],["enter",u,t]],e.slice(r+1,r+a+3)),s=ex(s,[["enter",c,t]]),s=ex(s,eY(t.parser.constructs.insideSpan.null,e.slice(r+a+4,i-3),t)),s=ex(s,[["exit",c,t],e[i-2],e[i-1],["exit",u,t]]),s=ex(s,e.slice(i+1)),s=ex(s,[["exit",l,t]]),eg(e,r,e.length,s),e},tokenize:function(e,t,n){let r,i,s=this,o=s.events.length;for(;o--;)if(("labelImage"===s.events[o][1].type||"labelLink"===s.events[o][1].type)&&!s.events[o][1]._balanced){r=s.events[o][1];break}return function(t){return r?r._inactive?c(t):(i=s.parser.defined.includes(tr(s.sliceSerialize({start:r.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),a):n(t)};function a(t){return 40===t?e.attempt(tc,u,i?u:c)(t):91===t?e.attempt(td,u,i?l:c)(t):i?u(t):c(t)}function l(t){return e.attempt(th,u,c)(t)}function u(e){return t(e)}function c(e){return r._balanced=!0,n(e)}}},tc={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return ej(t)?tn(e,i)(t):i(t)}function i(t){return 41===t?u(t):e7(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function s(t){return ej(t)?tn(e,a)(t):u(t)}function o(e){return n(e)}function a(t){return 34===t||39===t||40===t?tt(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):u(t)}function l(t){return ej(t)?tn(e,u)(t):u(t)}function u(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},td={tokenize:function(e,t,n){let r=this;return function(t){return te.call(r,e,i,s,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes(tr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function s(e){return n(e)}}},th={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}},tp={name:"labelStartImage",resolveAll:tu.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),s):n(t)}function s(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},tf={name:"labelStartLink",resolveAll:tu.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},tm={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),eN(e,t,"linePrefix")}}},tg={name:"thematicBreak",tokenize:function(e,t,n){let r,i=0;return function(s){var o;return e.enter("thematicBreak"),r=o=s,function s(o){return o===r?(e.enter("thematicBreakSequence"),function t(n){return n===r?(e.consume(n),i++,t):(e.exit("thematicBreakSequence"),eI(n)?eN(e,s,"whitespace")(n):s(n))}(o)):i>=3&&(null===o||eT(o))?(e.exit("thematicBreak"),t(o)):n(o)}(o)}}},tx={continuation:{tokenize:function(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(eB,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,eN(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!eI(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(tb,t,i)(n))});function i(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,eN(e,e.attempt(tx,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){let r=this,i=r.events[r.events.length-1],s=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,o=0;return function(t){let i=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!r.containerState.marker||t===r.containerState.marker:e_(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(tg,n,a)(t):a(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(i){return e_(i)&&++o<10?(e.consume(i),t):(!r.interrupt||o<2)&&(r.containerState.marker?i===r.containerState.marker:41===i||46===i)?(e.exit("listItemValue"),a(i)):n(i)}(t)}return n(t)};function a(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(eB,r.interrupt?n:l,e.attempt(ty,c,u))}function l(e){return r.containerState.initialBlankLine=!0,s++,c(e)}function u(t){return eI(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),c):n(t)}function c(n){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},ty={partial:!0,tokenize:function(e,t,n){let r=this;return eN(e,function(e){let i=r.events[r.events.length-1];return!eI(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},tb={partial:!0,tokenize:function(e,t,n){let r=this;return eN(e,function(e){let i=r.events[r.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}},tv={name:"setextUnderline",resolveTo:function(e,t){let n,r,i,s=e.length;for(;s--;)if("enter"===e[s][0]){if("content"===e[s][1].type){n=s;break}"paragraph"===e[s][1].type&&(r=s)}else"content"===e[s][1].type&&e.splice(s,1),i||"definition"!==e[s][1].type||(i=s);let o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",o,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=o,e.push(["exit",o,t]),e},tokenize:function(e,t,n){let r,i=this;return function(t){var o;let a,l=i.events.length;for(;l--;)if("lineEnding"!==i.events[l][1].type&&"linePrefix"!==i.events[l][1].type&&"content"!==i.events[l][1].type){a="paragraph"===i.events[l][1].type;break}return!i.parser.lazy[i.now().line]&&(i.interrupt||a)?(e.enter("setextHeadingLine"),r=t,o=t,e.enter("setextHeadingLineSequence"),function t(n){return n===r?(e.consume(n),t):(e.exit("setextHeadingLineSequence"),eI(n)?eN(e,s,"lineSuffix")(n):s(n))}(o)):n(t)};function s(r){return null===r||eT(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,t,n){let r,i=this;return function(t){var r;return e.enter("definition"),r=t,te.call(i,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(r)};function s(t){return(r=tr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o):n(t)}function o(t){return ej(t)?tn(e,a)(t):a(t)}function a(t){return e7(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(ti,u,u)(t)}function u(t){return eI(t)?eN(e,c,"whitespace")(t):c(t)}function c(s){return null===s||eT(s)?(e.exit("definition"),i.parser.defined.push(r),t(s)):n(s)}}}},"disable",0,{null:[]},"document",0,{42:tx,43:tx,45:tx,48:tx,49:tx,50:tx,51:tx,52:tx,53:tx,54:tx,55:tx,56:tx,57:tx,62:e0},"flow",0,{35:{name:"headingAtx",resolve:function(e,t){let n,r,i=e.length-2,s=3;return"whitespace"===e[3][1].type&&(s+=2),i-2>s&&"whitespace"===e[i][1].type&&(i-=2),"atxHeadingSequence"===e[i][1].type&&(s===i-1||i-4>s&&"whitespace"===e[i-2][1].type)&&(i-=s+1===i?2:4),i>s&&(n={type:"atxHeadingText",start:e[s][1].start,end:e[i][1].end},r={type:"chunkText",start:e[s][1].start,end:e[i][1].end,contentType:"text"},eg(e,s,i-s+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e},tokenize:function(e,t,n){let r=0;return function(i){var s;return e.enter("atxHeading"),s=i,e.enter("atxHeadingSequence"),function i(s){return 35===s&&r++<6?(e.consume(s),i):null===s||ej(s)?(e.exit("atxHeadingSequence"),function n(r){return 35===r?(e.enter("atxHeadingSequence"),function t(r){return 35===r?(e.consume(r),t):(e.exit("atxHeadingSequence"),n(r))}(r)):null===r||eT(r)?(e.exit("atxHeading"),t(r)):eI(r)?eN(e,n,"whitespace")(r):(e.enter("atxHeadingText"),function t(r){return null===r||35===r||ej(r)?(e.exit("atxHeadingText"),n(r)):(e.consume(r),t)}(r))}(s)):n(s)}(s)}}},42:tg,45:[tv,tg],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},tokenize:function(e,t,n){let r,i,s,o,a,l=this;return function(t){var n;return n=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(n),u};function u(o){return 33===o?(e.consume(o),c):47===o?(e.consume(o),i=!0,p):63===o?(e.consume(o),r=3,l.interrupt?t:M):ev(o)?(e.consume(o),s=String.fromCharCode(o),f):n(o)}function c(i){return 45===i?(e.consume(i),r=2,d):91===i?(e.consume(i),r=5,o=0,h):ev(i)?(e.consume(i),r=4,l.interrupt?t:M):n(i)}function d(r){return 45===r?(e.consume(r),l.interrupt?t:M):n(r)}function h(r){let i="CDATA[";return r===i.charCodeAt(o++)?(e.consume(r),o===i.length)?l.interrupt?t:_:h:n(r)}function p(t){return ev(t)?(e.consume(t),s=String.fromCharCode(t),f):n(t)}function f(o){if(null===o||47===o||62===o||ej(o)){let a=47===o,u=s.toLowerCase();return!a&&!i&&to.includes(u)?(r=1,l.interrupt?t(o):_(o)):ts.includes(s.toLowerCase())?(r=6,a)?(e.consume(o),m):l.interrupt?t(o):_(o):(r=7,l.interrupt&&!l.parser.lazy[l.now().line]?n(o):i?function t(n){return eI(n)?(e.consume(n),t):w(n)}(o):g(o))}return 45===o||ek(o)?(e.consume(o),s+=String.fromCharCode(o),f):n(o)}function m(r){return 62===r?(e.consume(r),l.interrupt?t:_):n(r)}function g(t){return 47===t?(e.consume(t),w):58===t||95===t||ev(t)?(e.consume(t),x):eI(t)?(e.consume(t),g):w(t)}function x(t){return 45===t||46===t||58===t||95===t||ek(t)?(e.consume(t),x):y(t)}function y(t){return 61===t?(e.consume(t),b):eI(t)?(e.consume(t),y):g(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),a=t,v):eI(t)?(e.consume(t),b):function t(n){return null===n||34===n||39===n||47===n||60===n||61===n||62===n||96===n||ej(n)?y(n):(e.consume(n),t)}(t)}function v(t){return t===a?(e.consume(t),a=null,k):null===t||eT(t)?n(t):(e.consume(t),v)}function k(e){return 47===e||62===e||eI(e)?g(e):n(e)}function w(t){return 62===t?(e.consume(t),S):n(t)}function S(t){return null===t||eT(t)?_(t):eI(t)?(e.consume(t),S):n(t)}function _(t){return 45===t&&2===r?(e.consume(t),j):60===t&&1===r?(e.consume(t),I):62===t&&4===r?(e.consume(t),N):63===t&&3===r?(e.consume(t),M):93===t&&5===r?(e.consume(t),R):eT(t)&&(6===r||7===r)?(e.exit("htmlFlowData"),e.check(ta,P,E)(t)):null===t||eT(t)?(e.exit("htmlFlowData"),E(t)):(e.consume(t),_)}function E(t){return e.check(tl,C,P)(t)}function C(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),T}function T(t){return null===t||eT(t)?E(t):(e.enter("htmlFlowData"),_(t))}function j(t){return 45===t?(e.consume(t),M):_(t)}function I(t){return 47===t?(e.consume(t),s="",A):_(t)}function A(t){if(62===t){let n=s.toLowerCase();return to.includes(n)?(e.consume(t),N):_(t)}return ev(t)&&s.length<8?(e.consume(t),s+=String.fromCharCode(t),A):_(t)}function R(t){return 93===t?(e.consume(t),M):_(t)}function M(t){return 62===t?(e.consume(t),N):45===t&&2===r?(e.consume(t),M):_(t)}function N(t){return null===t||eT(t)?(e.exit("htmlFlowData"),P(t)):(e.consume(t),N)}function P(n){return e.exit("htmlFlow"),t(n)}}},61:tv,95:tg,96:e6,126:e6},"flowInitial",0,{[-2]:e8,[-1]:e8,32:e8},"insideSpan",0,{null:[eX,eH]},"string",0,{38:e3,92:e1},"text",0,{[-5]:tm,[-4]:tm,[-3]:tm,33:tp,38:e3,42:eX,60:[{name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return ev(t)?(e.consume(t),s):64===t?n(t):a(t)}function s(t){return 43===t||45===t||46===t||ek(t)?(r=1,function t(n){return 58===n?(e.consume(n),r=0,o):(43===n||45===n||46===n||ek(n))&&r++<32?(e.consume(n),t):(r=0,a(n))}(t)):a(t)}function o(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||eS(r)?n(r):(e.consume(r),o)}function a(t){return 64===t?(e.consume(t),l):ew(t)?(e.consume(t),a):n(t)}function l(i){return ek(i)?function i(s){return 46===s?(e.consume(s),r=0,l):62===s?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(s),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(s){if((45===s||ek(s))&&r++<63){let n=45===s?t:i;return e.consume(s),n}return n(s)}(s)}(i):n(i)}}},{name:"htmlText",tokenize:function(e,t,n){let r,i,s,o=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),a};function a(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),v):63===t?(e.consume(t),y):ev(t)?(e.consume(t),w):n(t)}function l(t){return 45===t?(e.consume(t),u):91===t?(e.consume(t),i=0,p):ev(t)?(e.consume(t),x):n(t)}function u(t){return 45===t?(e.consume(t),h):n(t)}function c(t){return null===t?n(t):45===t?(e.consume(t),d):eT(t)?(s=c,A(t)):(e.consume(t),c)}function d(t){return 45===t?(e.consume(t),h):c(t)}function h(e){return 62===e?I(e):45===e?d(e):c(e)}function p(t){let r="CDATA[";return t===r.charCodeAt(i++)?(e.consume(t),i===r.length?f:p):n(t)}function f(t){return null===t?n(t):93===t?(e.consume(t),m):eT(t)?(s=f,A(t)):(e.consume(t),f)}function m(t){return 93===t?(e.consume(t),g):f(t)}function g(t){return 62===t?I(t):93===t?(e.consume(t),g):f(t)}function x(t){return null===t||62===t?I(t):eT(t)?(s=x,A(t)):(e.consume(t),x)}function y(t){return null===t?n(t):63===t?(e.consume(t),b):eT(t)?(s=y,A(t)):(e.consume(t),y)}function b(e){return 62===e?I(e):y(e)}function v(t){return ev(t)?(e.consume(t),k):n(t)}function k(t){return 45===t||ek(t)?(e.consume(t),k):function t(n){return eT(n)?(s=t,A(n)):eI(n)?(e.consume(n),t):I(n)}(t)}function w(t){return 45===t||ek(t)?(e.consume(t),w):47===t||62===t||ej(t)?S(t):n(t)}function S(t){return 47===t?(e.consume(t),I):58===t||95===t||ev(t)?(e.consume(t),_):eT(t)?(s=S,A(t)):eI(t)?(e.consume(t),S):I(t)}function _(t){return 45===t||46===t||58===t||95===t||ek(t)?(e.consume(t),_):function t(n){return 61===n?(e.consume(n),E):eT(n)?(s=t,A(n)):eI(n)?(e.consume(n),t):S(n)}(t)}function E(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),r=t,C):eT(t)?(s=E,A(t)):eI(t)?(e.consume(t),E):(e.consume(t),T)}function C(t){return t===r?(e.consume(t),r=void 0,j):null===t?n(t):eT(t)?(s=C,A(t)):(e.consume(t),C)}function T(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||ej(t)?S(t):(e.consume(t),T)}function j(e){return 47===e||62===e||ej(e)?S(e):n(e)}function I(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function A(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),R}function R(t){return eI(t)?eN(e,M,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):M(t)}function M(t){return e.enter("htmlTextData"),s(t)}}}],91:tf,92:[{name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return eT(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},e1],93:tu,95:eX,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[r][1].type||"space"===e[r][1].type)){for(t=i;++t<r;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(t=i-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):(t===r||"lineEnding"===e[t][1].type)&&(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,i,s=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(n){return 96===n?(e.consume(n),s++,t):(e.exit("codeTextSequence"),o(n))}(t)};function o(l){return null===l?n(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),o):96===l?(i=e.enter("codeTextSequence"),r=0,function n(o){return 96===o?(e.consume(o),r++,n):r===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(o)):(i.type="codeTextData",a(o))}(l)):eT(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):(e.enter("codeTextData"),a(l))}function a(t){return null===t||32===t||96===t||eT(t)?(e.exit("codeTextData"),o(t)):(e.consume(t),a)}}}}],19210);var tk=e.i(19210);let tw=/[\0\t\n\r]/g;function tS(e,t){let n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(65535&n)==65535||(65535&n)==65534||n>1114111?"�":String.fromCodePoint(n)}let t_=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function tE(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){let e=n.charCodeAt(1),t=120===e||88===e;return tS(n.slice(t?2:1),t?16:10)}return e5(n)||e}let tC={}.hasOwnProperty;function tT(e){return{line:e.line,column:e.column,offset:e.offset}}function tj(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+W({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+W({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+W({start:t.start,end:t.end})+") is still open")}function tI(e){let t=this;t.parser=function(n){var r,i;let s,o,a,l;return"object"==typeof(r={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(i=r,r=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:r(x),autolinkProtocol:u,autolinkEmail:u,atxHeading:r(f),blockQuote:r(function(){return{type:"blockquote",children:[]}}),characterEscape:u,characterReference:u,codeFenced:r(p),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:r(p,i),codeText:r(function(){return{type:"inlineCode",value:""}},i),codeTextData:u,data:u,codeFlowValue:u,definition:r(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:r(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:r(m),hardBreakTrailing:r(m),htmlFlow:r(g,i),htmlFlowData:u,htmlText:r(g,i),htmlTextData:u,image:r(function(){return{type:"image",title:null,url:"",alt:null}}),label:i,link:r(x),listItem:r(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:r(y,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:r(y),paragraph:r(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:r(f),strong:r(function(){return{type:"strong",children:[]}}),thematicBreak:r(function(){return{type:"thematicBreak"}})},exit:{atxHeading:o(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:o(),autolinkEmail:function(e){c.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){c.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:o(),characterEscapeValue:c,characterReferenceMarkerHexadecimal:h,characterReferenceMarkerNumeric:h,characterReferenceValue:function(e){let t,n=this.sliceSerialize(e),r=this.data.characterReferenceType;r?(t=tS(n,"characterReferenceMarkerNumeric"===r?10:16),this.data.characterReferenceType=void 0):t=e5(n);let i=this.stack[this.stack.length-1];i.value+=t},characterReference:function(e){this.stack.pop().position.end=tT(e.end)},codeFenced:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:c,codeIndented:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:c,data:c,definition:o(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=tr(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:o(),hardBreakEscape:o(d),hardBreakTrailing:o(d),htmlFlow:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:c,htmlText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:c,image:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===n.type?n.children=e.children:n.alt=t},labelText:function(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=t.replace(t_,tE),n.identifier=tr(t).toLowerCase()},lineEnding:function(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){n.children[n.children.length-1].position.end=tT(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(u.call(this,e),c.call(this,e))},link:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=tr(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:o(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:o(),thematicBreak:o()}};!function e(t,n){let r=-1;for(;++r<n.length;){let i=n[r];Array.isArray(i)?e(t,i):function(e,t){let n;for(n in t)if(tC.call(t,n))switch(n){case"canContainEols":{let r=t[n];r&&e[n].push(...r);break}case"transforms":{let r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{let r=t[n];r&&Object.assign(e[n],r)}}}(t,i)}}(t,(e||{}).mdastExtensions||[]);let n={};return function(e){let r={type:"root",children:[]},o={stack:[r],tokenStack:[],config:t,enter:s,exit:a,buffer:i,resume:l,data:n},u=[],c=-1;for(;++c<e.length;)("listOrdered"===e[c][1].type||"listUnordered"===e[c][1].type)&&("enter"===e[c][0]?u.push(c):c=function(e,t,n){let r,i,s,o,a=t-1,l=-1,u=!1;for(;++a<=n;){let t=e[a];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,o=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||o||l||s||(s=a),o=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:o=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let o=a;for(i=void 0;o--;){let t=e[o];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",u=!0),t[1].type="lineEnding",i=o}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}s&&(!i||s<i)&&(r._spread=!0),r.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||a,0,["exit",r,t[2]]),a++,n++}if("listItemPrefix"===t[1].type){let i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=i,e.splice(a,0,["enter",i,t[2]]),a++,n++,s=void 0,o=!0}}}return e[t][1]._spread=u,n}(e,u.pop(),c));for(c=-1;++c<e.length;){let n=t[e[c][0]];tC.call(n,e[c][1].type)&&n[e[c][1].type].call(Object.assign({sliceSerialize:e[c][2].sliceSerialize},o),e[c][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||tj).call(o,void 0,e[0])}for(r.position={start:tT(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:tT(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},c=-1;++c<t.transforms.length;)r=t.transforms[c](r)||r;return r};function r(e,t){return function(n){s.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:tT(t.start),end:void 0}}function o(e){return function(t){e&&e.call(this,t),a.call(this,t)}}function a(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||tj).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+W({start:e.start,end:e.end})+"): it’s not open");n.position.end=tT(e.end)}function l(){return ep(this.stack.pop())}function u(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&"text"===n.type||((n={type:"text",value:""}).position={start:tT(e.start),end:void 0},t.push(n)),this.stack.push(n)}function c(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=tT(e.end)}function d(){this.data.atHardBreak=!0}function h(e){this.data.characterReferenceType=e.type}function p(){return{type:"code",lang:null,meta:null,value:""}}function f(){return{type:"heading",depth:0,children:[]}}function m(){return{type:"break"}}function g(){return{type:"html",value:""}}function x(){return{type:"link",title:null,url:"",children:[]}}function y(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(i)(function(e){for(;!ez(e););return e}((function(e){let t={constructs:eb([tk,...(e||{}).extensions||[]]),content:n(eP),defined:[],document:n(eD),flow:n(eq),lazy:{},string:n(eV),text:n(eW)};return t;function n(e){return function(n){return function(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},s=[],o=[],a=[],l={attempt:f(function(e,t){m(e,t.from)}),check:f(p),consume:function(e){eT(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,g()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=e},enter:function(e,t){let n=t||{};return n.type=e,n.start=h(),u.events.push(["enter",n,u]),a.push(n),n},exit:function(e){let t=a.pop();return t.end=h(),u.events.push(["exit",t,u]),t},interrupt:f(p,{interrupt:!0})},u={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,g()},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n,r=-1,i=[];for(;++r<e.length;){let s,o=e[r];if("string"==typeof o)s=o;else switch(o){case -5:s="\r";break;case -4:s="\n";break;case -3:s="\r\n";break;case -2:s=t?" ":" ";break;case -1:if(!t&&n)continue;s=" ";break;default:s=String.fromCharCode(o)}n=-2===o,i.push(s)}return i.join("")}(d(e),t)},sliceStream:d,write:function(e){return(o=ex(o,e),function(){let e;for(;r._index<o.length;){let n=o[r._index];if("string"==typeof n)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<n.length;){var t;t=n.charCodeAt(r._bufferIndex),c=c(t)}else c=c(n)}}(),null!==o[o.length-1])?[]:(m(t,0),u.events=eY(s,u.events,u),u.events)}},c=t.tokenize.call(u,l);return t.resolveAll&&s.push(t),u;function d(e){return function(e,t){let n,r=t.start._index,i=t.start._bufferIndex,s=t.end._index,o=t.end._bufferIndex;if(r===s)n=[e[r].slice(i,o)];else{if(n=e.slice(r,s),i>-1){let e=n[0];"string"==typeof e?n[0]=e.slice(i):n.shift()}o>0&&n.push(e[s].slice(0,o))}return n}(o,e)}function h(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:s}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:s}}function p(e,t){t.restore()}function f(e,t){return function(n,i,s){var o;let c,d,p,f;return Array.isArray(n)?m(n):"tokenize"in n?m([n]):(o=n,function(e){let t=null!==e&&o[e],n=null!==e&&o.null;return m([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});function m(e){return(c=e,d=0,0===e.length)?s:x(e[d])}function x(e){return function(n){let i,s,o,c,d;return(i=h(),s=u.previous,o=u.currentConstruct,c=u.events.length,d=Array.from(a),f={from:c,restore:function(){r=i,u.previous=s,u.currentConstruct=o,u.events.length=c,a=d,g()}},p=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name))?b(n):e.tokenize.call(t?Object.assign(Object.create(u),t):u,l,y,b)(n)}}function y(t){return e(p,f),i}function b(e){return(f.restore(),++d<c.length)?x(c[d]):s}}}function m(e,t){e.resolveAll&&!s.includes(e)&&s.push(e),e.resolve&&eg(u.events,t,u.events.length-t,e.resolve(u.events.slice(t),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function g(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}(t,e,n)}}})(i).document().write((o=1,a="",l=!0,function(e,t,n){let r,i,u,c,d,h=[];for(e=a+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),u=0,a="",l&&(65279===e.charCodeAt(0)&&u++,l=void 0);u<e.length;){if(tw.lastIndex=u,c=(r=tw.exec(e))&&void 0!==r.index?r.index:e.length,d=e.charCodeAt(c),!r){a=e.slice(u);break}if(10===d&&u===c&&s)h.push(-3),s=void 0;else switch(s&&(h.push(-5),s=void 0),u<c&&(h.push(e.slice(u,c)),o+=c-u),d){case 0:h.push(65533),o++;break;case 9:for(i=4*Math.ceil(o/4),h.push(-2);o++<i;)h.push(-1);break;case 10:h.push(-4),o=1;break;default:s=!0,o=1}u=c+1}return n&&(s&&h.push(-5),a&&h.push(a),h.push(null)),h})(n,r,!0))))}}let tA="object"==typeof self?self:globalThis,tR=e=>{var t;let n,r;return(t=new Map,n=(e,n)=>(t.set(n,e),e),r=i=>{if(t.has(i))return t.get(i);let[s,o]=e[i];switch(s){case 0:case -1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new tA[e](t),i)}case 8:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new tA[s](o),i)})(0)},{toString:tM}={},{keys:tN}=Object,tP=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let n=tM.call(e).slice(8,-1);switch(n){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},tD=([e,t])=>0===e&&("function"===t||"symbol"===t),tO=(e,{json:t,lossy:n}={})=>{var r,i,s;let o,a,l=[];return(r=!(t||n),i=!!t,s=new Map,o=(e,t)=>{let n=l.push(e)-1;return s.set(t,n),n},a=e=>{if(s.has(e))return s.get(e);let[t,n]=tP(e);switch(t){case 0:{let i=e;switch(n){case"bigint":t=8,i=e.toString();break;case"function":case"symbol":if(r)throw TypeError("unable to serialize "+n);i=null;break;case"undefined":return o([-1],e)}return o([t,i],e)}case 1:{if(n){let t=e;return"DataView"===n?t=new Uint8Array(e.buffer):"ArrayBuffer"===n&&(t=new Uint8Array(e)),o([n,[...t]],e)}let r=[],i=o([t,r],e);for(let t of e)r.push(a(t));return i}case 2:{if(n)switch(n){case"BigInt":return o([n,e.toString()],e);case"Boolean":case"Number":case"String":return o([n,e.valueOf()],e)}if(i&&"toJSON"in e)return a(e.toJSON());let s=[],l=o([t,s],e);for(let t of tN(e))(r||!tD(tP(e[t])))&&s.push([a(t),a(e[t])]);return l}case 3:return o([t,e.toISOString()],e);case 4:{let{source:n,flags:r}=e;return o([t,{source:n,flags:r}],e)}case 5:{let n=[],i=o([t,n],e);for(let[t,i]of e)(r||!(tD(tP(t))||tD(tP(i))))&&n.push([a(t),a(i)]);return i}case 6:{let n=[],i=o([t,n],e);for(let t of e)(r||!tD(tP(t)))&&n.push(a(t));return i}}let{message:l}=e;return o([t,{name:n,message:l}],e)})(e),l},tB="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?tR(tO(e,t)):structuredClone(e):(e,t)=>tR(tO(e,t));function tL(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let s=e.charCodeAt(n),o="";if(37===s&&ek(e.charCodeAt(n+1))&&ek(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){let t=e.charCodeAt(n+1);s<56320&&t>56319&&t<57344?(o=String.fromCharCode(s,t),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function tF(e,t){let n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function tz(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}let tU=function(e){var t,n;if(null==e)return tq;if("function"==typeof e)return t$(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],n=-1;for(;++n<e.length;)t[n]=tU(e[n]);return t$(function(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1})}(e):(t=e,t$(function(e){let n;for(n in t)if(e[n]!==t[n])return!1;return!0}))}if("string"==typeof e){return n=e,t$(function(e){return e&&e.type===n})}throw Error("Expected function, string, or object as test")};function t$(e){return function(t,n,r){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function tq(){return!0}e.s(["convert",0,tU],73119);let tH=[];function tV(e,t,n,r){let i;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):i=t;let s=tU(i),o=r?-1:1;(function e(i,a,l){let u=i&&"object"==typeof i?i:{};if("string"==typeof u.type){let e="string"==typeof u.tagName?u.tagName:"string"==typeof u.name?u.name:void 0;Object.defineProperty(c,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return c;function c(){var u;let c,d,h,p=tH;if((!t||s(i,a,l[l.length-1]||void 0))&&!1===(p=Array.isArray(u=n(i,l))?u:"number"==typeof u?[!0,u]:null==u?tH:[u])[0])return p;if("children"in i&&i.children&&i.children&&"skip"!==p[0])for(d=(r?i.children.length:-1)+o,h=l.concat(i);d>-1&&d<i.children.length;){if(!1===(c=e(i.children[d],d,h)())[0])return c;d="number"==typeof c[1]?c[1]:d+o}return p}})(e,void 0,[])()}function tW(e,t,n,r){let i,s,o;"function"==typeof t&&"function"!=typeof n?(s=void 0,o=t,i=n):(s=t,o=n,i=r),tV(e,s,function(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)},i)}function tK(e,t){let n=t.referenceType,r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];let i=e.all(t),s=i[0];s&&"text"===s.type?s.value="["+s.value:i.unshift({type:"text",value:"["});let o=i[i.length-1];return o&&"text"===o.type?o.value+=r:i.push({type:"text",value:r}),i}function tJ(e){let t=e.spread;return null==t?e.children.length>1:t}function tQ(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;9===t||32===t;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}e.s(["EXIT",0,!1,"visitParents",()=>tV],2652),e.s(["visit",()=>tW],16920);let tG={blockquote:function(e,t){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){let n=t.value?t.value+"\n":"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s={type:"element",tagName:"pre",properties:{},children:[s=e.applyData(t,s)]},e.patch(t,s),s},delete:function(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){let n,r="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),s=tL(i.toLowerCase()),o=e.footnoteOrder.indexOf(i),a=e.footnoteCounts.get(i);void 0===a?(a=0,e.footnoteOrder.push(i),n=e.footnoteOrder.length):n=o+1,a+=1,e.footnoteCounts.set(i,a);let l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+s,id:r+"fnref-"+s+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(n)}]};e.patch(t,l);let u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)},heading:function(e,t){let n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return tK(e,t);let i={src:tL(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(i.title=r.title);let s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)},image:function(e,t){let n={src:tL(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){let n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return tK(e,t);let i={href:tL(r.url||"")};null!==r.title&&void 0!==r.title&&(i.title=r.title);let s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)},link:function(e,t){let n={href:tL(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){let r=e.all(t),i=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=tJ(n[r])}return t}(n):tJ(t),s={},o=[];if("boolean"==typeof t.checked){let e,n=r[0];n&&"element"===n.type&&"p"===n.tagName?e=n:(e={type:"element",tagName:"p",properties:{},children:[]},r.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){let e=r[a];(i||0!==a||"element"!==e.type||"p"!==e.tagName)&&o.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?o.push(e):o.push(...e.children)}let l=r[r.length-1];l&&(i||"element"!==l.type||"p"!==l.tagName)&&o.push({type:"text",value:"\n"});let u={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,u),e.applyData(t,u)},list:function(e,t){let n={},r=e.all(t),i=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++i<r.length;){let e=r[i];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}let s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)},paragraph:function(e,t){let n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){let n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){let n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},s=H(t.children[1]),o=q(t.children[t.children.length-1]);s&&o&&(r.position={start:s,end:o}),i.push(r)}let s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)},tableCell:function(e,t){let n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){let r=n?n.children:void 0,i=0===(r?r.indexOf(t):1)?"th":"td",s=n&&"table"===n.type?n.align:void 0,o=s?s.length:t.children.length,a=-1,l=[];for(;++a<o;){let n=t.children[a],r={},o=s?s[a]:void 0;o&&(r.align=o);let u={type:"element",tagName:i,properties:r,children:[]};n&&(u.children=e.all(n),e.patch(n,u),u=e.applyData(n,u)),l.push(u)}let u={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,u),e.applyData(t,u)},text:function(e,t){let n={type:"text",value:function(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,s=[];for(;r;)s.push(tQ(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(tQ(t.slice(i),i>0,!1)),s.join("")}(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:tY,yaml:tY,definition:tY,footnoteDefinition:tY};function tY(){}let tX={}.hasOwnProperty,tZ={};function t0(e,t){e.position&&(t.position=function(e){let t=H(e),n=q(e);if(t&&n)return{start:t,end:n}}(e))}function t1(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;"string"==typeof t&&("element"===n.type?n.tagName=t:n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}),"element"===n.type&&i&&Object.assign(n.properties,tB(i)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function t2(e,t){let n=[],r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function t5(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function t3(e,n){let r,i,s,o,a=(r=n||tZ,i=new Map,s=new Map,o={all:function(e){let t=[];if("children"in e){let n=e.children,r=-1;for(;++r<n.length;){let i=o.one(n[r],e);if(i){if(r&&"break"===n[r-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=t5(i.value)),!Array.isArray(i)&&"element"===i.type)){let e=i.children[0];e&&"text"===e.type&&(e.value=t5(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:t1,definitionById:i,footnoteById:s,footnoteCounts:new Map,footnoteOrder:[],handlers:{...tG,...r.handlers},one:function(e,t){let n=e.type,r=o.handlers[n];if(tX.call(o.handlers,n)&&r)return r(o,e,t);if(o.options.passThrough&&o.options.passThrough.includes(n)){if("children"in e){let{children:t,...n}=e,r=tB(n);return r.children=o.all(e),r}return tB(e)}return(o.options.unknownHandler||function(e,t){let n=t.data||{},r="value"in t&&!(tX.call(n,"hProperties")||tX.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)})(o,e,t)},options:r,patch:t0,wrap:t2},tW(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?i:s,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),o),l=a.one(e,void 0),u=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||tF,r=e.options.footnoteBackLabel||tz,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[],l=-1;for(;++l<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;let s=e.all(i),o=String(i.identifier).toUpperCase(),u=tL(o.toLowerCase()),c=0,d=[],h=e.footnoteCounts.get(o);for(;void 0!==h&&++c<=h;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof n?n:n(l,c);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+u+(c>1?"-"+c:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(l,c),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let p=s[s.length-1];if(p&&"element"===p.type&&"p"===p.tagName){let e=p.children[p.children.length-1];e&&"text"===e.type?e.value+=" ":p.children.push({type:"text",value:" "}),p.children.push(...d)}else s.push(...d);let f={type:"element",tagName:"li",properties:{id:t+"fn-"+u},children:e.wrap(s,!0)};e.patch(i,f),a.push(f)}if(0!==a.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...tB(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:"\n"}]}}(a),c=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return u&&(t("children"in c),c.children.push({type:"text",value:"\n"},u)),c}function t4(e,t){return e&&"run"in e?async function(n,r){let i=t3(n,{file:r,...t});await e.run(i,r)}:function(n,r){return t3(n,{file:r,...e||t})}}function t6(e){if(e)throw e}var t8=e.i(75609);function t9(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let t7=function(e,t){let n;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');nr(e);let r=0,i=-1,s=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;s--;)if(47===e.codePointAt(s)){if(n){r=s+1;break}}else i<0&&(n=!0,i=s+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let o=-1,a=t.length-1;for(;s--;)if(47===e.codePointAt(s)){if(n){r=s+1;break}}else o<0&&(n=!0,o=s+1),a>-1&&(e.codePointAt(s)===t.codePointAt(a--)?a<0&&(i=s):(a=-1,i=o));return r===i?i=o:i<0&&(i=e.length),e.slice(r,i)},ne=function(e){let t;if(nr(e),0===e.length)return".";let n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},nt=function(e){let t;nr(e);let n=e.length,r=-1,i=0,s=-1,o=0;for(;n--;){let a=e.codePointAt(n);if(47===a){if(t){i=n+1;break}continue}r<0&&(t=!0,r=n+1),46===a?s<0?s=n:1!==o&&(o=1):s>-1&&(o=-1)}return s<0||r<0||0===o||1===o&&s===r-1&&s===i+1?"":e.slice(s,r)},nn=function(...e){var t;let n,r,i,s=-1;for(;++s<e.length;)nr(e[s]),e[s]&&(i=void 0===i?e[s]:i+"/"+e[s]);return void 0===i?".":(nr(t=i),n=47===t.codePointAt(0),0!==(r=function(e,t){let n,r,i="",s=0,o=-1,a=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else if(47===n)break;else n=47;if(47===n){if(o===l-1||1===a);else if(o!==l-1&&2===a){if(i.length<2||2!==s||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2)){if(i.length>2){if((r=i.lastIndexOf("/"))!==i.length-1){r<0?(i="",s=0):s=(i=i.slice(0,r)).length-1-i.lastIndexOf("/"),o=l,a=0;continue}}else if(i.length>0){i="",s=0,o=l,a=0;continue}}t&&(i=i.length>0?i+"/..":"..",s=2)}else i.length>0?i+="/"+e.slice(o+1,l):i=e.slice(o+1,l),s=l-o-1;o=l,a=0}else 46===n&&a>-1?a++:a=-1}return i}(t,!n)).length||n||(r="."),r.length>0&&47===t.codePointAt(t.length-1)&&(r+="/"),n?"/"+r:r)};function nr(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function ni(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let ns=["history","path","basename","stem","extname","dirname"];class no{constructor(e){let t,n;t=e?ni(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<ns.length;){const e=ns[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)ns.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?t7(this.path):void 0}set basename(e){nl(e,"basename"),na(e,"basename"),this.path=nn(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?ne(this.path):void 0}set dirname(e){nu(this.basename,"dirname"),this.path=nn(e||"",this.basename)}get extname(){return"string"==typeof this.path?nt(this.path):void 0}set extname(e){if(na(e,"extname"),nu(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=nn(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){ni(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!ni(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){let e=t.codePointAt(n+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),nl(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?t7(this.path,this.extname):void 0}set stem(e){nl(e,"stem"),na(e,"stem"),this.path=nn(this.dirname||"",e+(this.extname||""))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new G(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function na(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function nl(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function nu(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let nc=function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},nd={}.hasOwnProperty;class nh extends nc{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let e=[],t={run:function(...t){let n=-1,r=t.pop();if("function"!=typeof r)throw TypeError("Expected function as last argument, not "+r);!function i(s,...o){let a=e[++n],l=-1;if(s)return void r(s);for(;++l<t.length;)(null===o[l]||void 0===o[l])&&(o[l]=t[l]);t=o,a?(function(e,t){let n;return function(...t){let s,o=e.length>t.length;o&&t.push(r);try{s=e.apply(this,t)}catch(e){if(o&&n)throw e;return r(e)}o||(s&&s.then&&"function"==typeof s.then?s.then(i,r):s instanceof Error?r(s):i(s))};function r(e,...i){n||(n=!0,t(e,...i))}function i(e){r(null,e)}})(a,i)(...o):r(null,...o)}(null,...t)},use:function(n){if("function"!=typeof n)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}()}copy(){let e=new nh,t=-1;for(;++t<this.attachers.length;){let n=this.attachers[t];e.use(...n)}return e.data((0,t8.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(ng("data",this.frozen),this.namespace[e]=t,this):nd.call(this.namespace,e)&&this.namespace[e]||void 0:e?(ng("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let n=e.call(this,...t);"function"==typeof n&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=nb(e),n=this.parser||this.Parser;return nf("parse",n),n(String(t),t)}process(e,n){let r=this;return this.freeze(),nf("process",this.parser||this.Parser),nm("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(i,s){let o=nb(e),a=r.parse(o);function l(e,r){e||!r?s(e):i?i(r):(t(n,"`done` is defined if `resolve` is not"),n(void 0,r))}r.run(a,o,function(e,t,n){var i,s;if(e||!t||!n)return l(e);let o=r.stringify(t,n);"string"==typeof(i=o)||(s=i)&&"object"==typeof s&&"byteLength"in s&&"byteOffset"in s?n.value=o:n.result=o,l(e,n)})}}processSync(e){let n,r=!1;return this.freeze(),nf("processSync",this.parser||this.Parser),nm("processSync",this.compiler||this.Compiler),this.process(e,function(e,t){r=!0,t6(e),n=t}),ny("processSync","process",r),t(n,"we either bailed on an error or have a tree"),n}run(e,n,r){nx(e),this.freeze();let i=this.transformers;return r||"function"!=typeof n||(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(s,o){t("function"!=typeof n,"`file` can’t be a `done` anymore, we checked");let a=nb(n);i.run(e,a,function(n,i,a){let l=i||e;n?o(n):s?s(l):(t(r,"`done` is defined if `resolve` is not"),r(void 0,l,a))})}}runSync(e,n){let r,i=!1;return this.run(e,n,function(e,t){t6(e),r=t,i=!0}),ny("runSync","run",i),t(r,"we either bailed on an error or have a tree"),r}stringify(e,t){this.freeze();let n=nb(t),r=this.compiler||this.Compiler;return nm("stringify",r),nx(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(ng("use",this.frozen),null==e);else if("function"==typeof e)o(e,t);else if("object"==typeof e)Array.isArray(e)?s(e):i(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(!("plugins"in e)&&!("settings"in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(e.plugins),e.settings&&(r.settings=(0,t8.default)(!0,r.settings,e.settings))}function s(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)o(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[t,...n]=e;o(t,n)}else i(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function o(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(-1===i)n.push([e,...t]);else if(t.length>0){let[r,...s]=t,o=n[i][1];t9(o)&&t9(r)&&(r=(0,t8.default)(!0,o,r)),n[i]=[e,r,...s]}}}}let np=new nh().freeze();function nf(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function nm(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function ng(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function nx(e){if(!t9(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function ny(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function nb(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new no(e)}let nv=[],nk={allowDangerousHtml:!0},nw=/^(https?|ircs?|mailto|xmpp)$/i,nS=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function n_(e){var t;let r,i,s,o,a,l=(r=(t=e).rehypePlugins||nv,i=t.remarkPlugins||nv,s=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...nk}:nk,np().use(tI).use(i).use(t4,s).use(r)),u=(o=e.children||"",a=new no,"string"==typeof o?a.value=o:n("Unexpected value `"+o+"` for `children` prop, expected `string`"),a);return function(e,t){let r=t.allowedElements,i=t.allowElement,s=t.components,o=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,u=t.urlTransform||nE;for(let e of nS)Object.hasOwn(t,e.from)&&n("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return r&&o&&n("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),tW(e,function(e,t,n){if("raw"===e.type&&n&&"number"==typeof t)return a?n.children.splice(t,1):n.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in ec)if(Object.hasOwn(ec,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=ec[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=u(String(n||""),t,e))}}if("element"===e.type){let s=r?!r.includes(e.tagName):!!o&&o.includes(e.tagName);if(!s&&i&&"number"==typeof t&&(s=!i(e,t,n)),s&&n&&"number"==typeof t)return l&&e.children?n.children.splice(t,1,...e.children):n.children.splice(t,1),t}}),function(e,t){var n,r,i,s;let o;if(!t||void 0===t.Fragment)throw TypeError("Expected `Fragment` in options");let a=t.filePath||void 0;if(t.development){if("function"!=typeof t.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");n=a,r=t.jsxDEV,o=function(e,t,i,s){let o=Array.isArray(i.children),a=H(e);return r(t,i,s,o,{columnNumber:a?a.column-1:void 0,fileName:n,lineNumber:a?a.line:void 0},void 0)}}else{if("function"!=typeof t.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw TypeError("Expected `jsxs` in production options");i=t.jsx,s=t.jsxs,o=function(e,t,n,r){let o=Array.isArray(n.children)?s:i;return r?o(t,n,r):o(t,n)}}let l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:o,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?U:z,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},u=er(l,e,void 0);return u&&"string"!=typeof u?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}(e,{Fragment:ed.Fragment,components:s,ignoreInvalidStyle:!0,jsx:ed.jsx,jsxs:ed.jsxs,passKeys:!0,passNode:!0})}(l.runSync(l.parse(u),u),e)}function nE(e){let t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return -1===t||-1!==i&&t>i||-1!==n&&t>n||-1!==r&&t>r||nw.test(e.slice(0,t))?e:""}e.s(["default",()=>n_],427)},12878,90292,81835,49527,e=>{"use strict";function t(e,t){let n=String(e);if("string"!=typeof t)throw TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}var n=e.i(97802),r=e.i(55470),i=e.i(2652),s=e.i(73119);let o="phrasing",a=["autolink","link","image","label"];function l(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function u(e){this.config.enter.autolinkProtocol.call(this,e)}function c(e){this.config.exit.autolinkProtocol.call(this,e)}function d(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];(0,n.ok)("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function h(e){this.config.exit.autolinkEmail.call(this,e)}function p(e){this.exit(e)}function f(e){!function(e,t,n){let r=(0,s.convert)((n||{}).ignore||[]),o=function(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){var i;let e=n[r];t.push(["string"==typeof(i=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(i),"g"):i,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return t}(t),a=-1;for(;++a<o.length;)(0,i.visitParents)(e,"text",l);function l(e,t){let n,i=-1;for(;++i<t.length;){let e=t[i],s=n?n.children:void 0;if(r(e,s?s.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){let n=t[t.length-1],r=o[a][0],i=o[a][1],s=0,l=n.children.indexOf(e),u=!1,c=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,o={index:d.index,input:d.input,stack:[...t,e]},a=i(...d,o);if("string"==typeof a&&(a=a.length>0?{type:"text",value:a}:void 0),!1===a?r.lastIndex=n+1:(s!==n&&c.push({type:"text",value:e.value.slice(s,n)}),Array.isArray(a)?c.push(...a):a&&c.push(a),s=n+d[0].length,u=!0),!r.global)break;d=r.exec(e.value)}return u?(s<e.value.length&&c.push({type:"text",value:e.value.slice(s)}),n.children.splice(l,1,...c)):c=[e],l+c.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,m],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,g]],{ignore:["link","linkReference"]})}function m(e,n,r,i,s){let o,a="";if(!x(s))return!1;if(/^w/i.test(n)&&(r=n+r,n="",a="http://"),(o=r.split(".")).length<2||o[o.length-1]&&(/_/.test(o[o.length-1])||!/[a-zA-Z\d]/.test(o[o.length-1]))||o[o.length-2]&&(/_/.test(o[o.length-2])||!/[a-zA-Z\d]/.test(o[o.length-2])))return!1;let l=function(e){let n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],i=r.indexOf(")"),s=t(e,"("),o=t(e,")");for(;-1!==i&&s>o;)e+=r.slice(0,i+1),i=(r=r.slice(i+1)).indexOf(")"),o++;return[e,r]}(r+i);if(!l[0])return!1;let u={type:"link",title:null,url:a+n+l[0],children:[{type:"text",value:n+l[0]}]};return l[1]?[u,{type:"text",value:l[1]}]:u}function g(e,t,n,r){return!(!x(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function x(e,t){let n=e.input.charCodeAt(e.index-1);return(0===e.index||(0,r.unicodeWhitespace)(n)||(0,r.unicodePunctuation)(n))&&(!t||47!==n)}var y=e.i(84484);function b(){this.buffer()}function v(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function k(){this.buffer()}function w(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function S(e){let t=this.resume(),r=this.stack[this.stack.length-1];(0,n.ok)("footnoteReference"===r.type),r.identifier=(0,y.normalizeIdentifier)(this.sliceSerialize(e)).toLowerCase(),r.label=t}function _(e){this.exit(e)}function E(e){let t=this.resume(),r=this.stack[this.stack.length-1];(0,n.ok)("footnoteDefinition"===r.type),r.identifier=(0,y.normalizeIdentifier)(this.sliceSerialize(e)).toLowerCase(),r.label=t}function C(e){this.exit(e)}function T(e,t,n,r){let i=n.createTracker(r),s=i.move("[^"),o=n.enter("footnoteReference"),a=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),a(),o(),s+=i.move("]")}function j(e,t,n){return 0===t?e:I(e,t,n)}function I(e,t,n){return(n?"":" ")+e}T.peek=function(){return"["};let A=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function R(e){this.enter({type:"delete",children:[]},e)}function M(e){this.exit(e)}function N(e,t,n,r){let i=n.createTracker(r),s=n.enter("strikethrough"),o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function P(e){return e.length}function D(e){let t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:114*(82===t||114===t)}N.peek=function(){return"~"};var O=e.i(27066);e.i(16920);e.i(12105);function B(e,t,n){let r=e.value||"",i="`",s=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){let e,t=n.unsafe[s],i=n.compilePattern(t);if(t.atBreak)for(;e=i.exec(r);){let t=e.index;10===r.charCodeAt(t)&&13===r.charCodeAt(t-1)&&t--,r=r.slice(0,t)+" "+r.slice(e.index+1)}}return i+r+i}B.peek=function(){return"`"};(0,s.convert)(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let L=function(e,t,n,r){let i=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n),s=n.bulletCurrent||function(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(n);t&&"list"===t.type&&t.ordered&&(s=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+s);let o=s.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(o=4*Math.ceil(o/4));let a=n.createTracker(r);a.move(s+" ".repeat(o-s.length)),a.shift(o);let l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),function(e,t,n){return t?(n?"":" ".repeat(o))+e:(n?s:s+" ".repeat(o-s.length))+e});return l(),u};function F(e){let t=e._align;(0,n.ok)(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function z(e){this.exit(e),this.data.inTable=void 0}function U(e){this.enter({type:"tableRow",children:[]},e)}function $(e){this.exit(e)}function q(e){this.enter({type:"tableCell",children:[]},e)}function H(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,V));let r=this.stack[this.stack.length-1];(0,n.ok)("inlineCode"===r.type),r.value=t,this.exit(e)}function V(e,t){return"|"===t?t:e}function W(e){let t=this.stack[this.stack.length-2];(0,n.ok)("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function K(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1];(0,n.ok)("paragraph"===e.type);let r=e.children[0];if(r&&"text"===r.type){let n,i=t.children,s=-1;for(;++s<i.length;){let e=i[s];if("paragraph"===e.type){n=e;break}}n===e&&(r.value=r.value.slice(1),0===r.value.length?e.children.shift():e.position&&r.position&&"number"==typeof r.position.start.offset&&(r.position.start.column++,r.position.start.offset++,e.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function J(e,t,n,r){let i=e.children[0],s="boolean"==typeof e.checked&&i&&"paragraph"===i.type,o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(o);let l=L(e,t,n,{...r,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}var Q=e.i(44819);let G={tokenize:function(e,t,n){let r=0;return function t(s){return(87===s||119===s)&&r<3?(r++,e.consume(s),t):46===s&&3===r?(e.consume(s),i):n(s)};function i(e){return null===e?n(e):t(e)}},partial:!0},Y={tokenize:function(e,t,n){let i,s,o;return a;function a(t){return 46===t||95===t?e.check(Z,u,l)(t):null===t||(0,r.markdownLineEndingOrSpace)(t)||(0,r.unicodeWhitespace)(t)||45!==t&&(0,r.unicodePunctuation)(t)?u(t):(o=!0,e.consume(t),a)}function l(t){return 95===t?i=!0:(s=i,i=void 0),e.consume(t),a}function u(e){return s||i||!o?n(e):t(e)}},partial:!0},X={tokenize:function(e,t){let n=0,i=0;return s;function s(a){return 40===a?(n++,e.consume(a),s):41===a&&i<n?o(a):33===a||34===a||38===a||39===a||41===a||42===a||44===a||46===a||58===a||59===a||60===a||63===a||93===a||95===a||126===a?e.check(Z,t,o)(a):null===a||(0,r.markdownLineEndingOrSpace)(a)||(0,r.unicodeWhitespace)(a)?t(a):(e.consume(a),s)}function o(t){return 41===t&&i++,e.consume(t),s}},partial:!0},Z={tokenize:function(e,t,n){return i;function i(a){return 33===a||34===a||39===a||41===a||42===a||44===a||46===a||58===a||59===a||63===a||95===a||126===a?(e.consume(a),i):38===a?(e.consume(a),o):93===a?(e.consume(a),s):60===a||null===a||(0,r.markdownLineEndingOrSpace)(a)||(0,r.unicodeWhitespace)(a)?t(a):n(a)}function s(e){return null===e||40===e||91===e||(0,r.markdownLineEndingOrSpace)(e)||(0,r.unicodeWhitespace)(e)?t(e):i(e)}function o(t){return(0,r.asciiAlpha)(t)?function t(s){return 59===s?(e.consume(s),i):(0,r.asciiAlpha)(s)?(e.consume(s),t):n(s)}(t):n(t)}},partial:!0},ee={tokenize:function(e,t,n){return function(t){return e.consume(t),i};function i(e){return(0,r.asciiAlphanumeric)(e)?n(e):t(e)}},partial:!0},et={name:"wwwAutolink",tokenize:function(e,t,n){let r=this;return function(t){return 87!==t&&119!==t||!eo.call(r,r.previous)||ec(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(G,e.attempt(Y,e.attempt(X,i),n),n)(t))};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:eo},en={name:"protocolAutolink",tokenize:function(e,t,n){let i=this,s="",o=!1;return function(t){return(72===t||104===t)&&ea.call(i,i.previous)&&!ec(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(t),e.consume(t),a):n(t)};function a(t){if((0,r.asciiAlpha)(t)&&s.length<5)return s+=String.fromCodePoint(t),e.consume(t),a;if(58===t){let n=s.toLowerCase();if("http"===n||"https"===n)return e.consume(t),l}return n(t)}function l(t){return 47===t?(e.consume(t),o)?u:(o=!0,l):n(t)}function u(t){return null===t||(0,r.asciiControl)(t)||(0,r.markdownLineEndingOrSpace)(t)||(0,r.unicodeWhitespace)(t)||(0,r.unicodePunctuation)(t)?n(t):e.attempt(Y,e.attempt(X,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:ea},er={name:"emailAutolink",tokenize:function(e,t,n){let i,s,o=this;return function(t){return!eu(t)||!el.call(o,o.previous)||ec(o.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(r){return eu(r)?(e.consume(r),t):64===r?(e.consume(r),a):n(r)}(t))};function a(t){return 46===t?e.check(ee,u,l)(t):45===t||95===t||(0,r.asciiAlphanumeric)(t)?(s=!0,e.consume(t),a):u(t)}function l(t){return e.consume(t),i=!0,a}function u(a){return s&&i&&(0,r.asciiAlpha)(o.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(a)):n(a)}},previous:el},ei={},es=48;for(;es<123;)ei[es]=er,58==++es?es=65:91===es&&(es=97);function eo(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||(0,r.markdownLineEndingOrSpace)(e)}function ea(e){return!(0,r.asciiAlpha)(e)}function el(e){return!(47===e||eu(e))}function eu(e){return 43===e||45===e||46===e||95===e||(0,r.asciiAlphanumeric)(e)}function ec(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}ei[43]=er,ei[45]=er,ei[46]=er,ei[95]=er,ei[72]=[er,en],ei[104]=[er,en],ei[87]=[er,et],ei[119]=[er,et];var ed=e.i(51256),eh=e.i(33220);let ep={tokenize:function(e,t,n){let r=this;return(0,eh.factorySpace)(e,function(e){let i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function ef(e,t,n){let r,i=this,s=i.events.length,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);for(;s--;){let e=i.events[s][1];if("labelImage"===e.type){r=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(s){if(!r||!r._balanced)return n(s);let a=(0,y.normalizeIdentifier)(i.sliceSerialize({start:r.end,end:i.now()}));return 94===a.codePointAt(0)&&o.includes(a.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),t(s)):n(s)}}function em(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function eg(e,t,n){let i,s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]),a=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),l};function l(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(l){if(a>999||93===l&&!i||null===l||91===l||(0,r.markdownLineEndingOrSpace)(l))return n(l);if(93===l){e.exit("chunkString");let r=e.exit("gfmFootnoteCallString");return o.includes((0,y.normalizeIdentifier)(s.sliceSerialize(r)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(l)}return(0,r.markdownLineEndingOrSpace)(l)||(i=!0),a++,e.consume(l),92===l?c:u}function c(t){return 91===t||92===t||93===t?(e.consume(t),a++,u):u(t)}}function ex(e,t,n){let i,s,o=this,a=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),l=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),u};function u(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(l>999||93===t&&!s||null===t||91===t||(0,r.markdownLineEndingOrSpace)(t))return n(t);if(93===t){e.exit("chunkString");let n=e.exit("gfmFootnoteDefinitionLabelString");return i=(0,y.normalizeIdentifier)(o.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return(0,r.markdownLineEndingOrSpace)(t)||(s=!0),l++,e.consume(t),92===t?d:c}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,c):c(t)}function h(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),a.includes(i)||a.push(i),(0,eh.factorySpace)(e,p,"gfmFootnoteDefinitionWhitespace")):n(t)}function p(e){return t(e)}}function ey(e,t,n){return e.check(ed.blankLine,t,e.attempt(ep,t,n))}function eb(e){e.exit("gfmFootnoteDefinition")}var ev=e.i(59245),ek=e.i(5568);class ew{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0!==n||0!==r.length){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length,n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}}function eS(e,t,n){let i,s=this,o=0,a=0;return function(e){let t=s.events.length-1;for(;t>-1;){let e=s.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let r=t>-1?s.events[t][1].type:null,i="tableHead"===r||"tableRow"===r?b:l;return i===b&&s.parser.lazy[s.now().line]?n(e):i(e)};function l(t){var n;return e.enter("tableHead"),e.enter("tableRow"),124===(n=t)||(i=!0,a+=1),u(n)}function u(t){return null===t?n(t):(0,r.markdownLineEnding)(t)?a>1?(a=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h):n(t):(0,r.markdownSpace)(t)?(0,eh.factorySpace)(e,u,"whitespace")(t):(a+=1,i&&(i=!1,o+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),i=!0,u):(e.enter("data"),c(t))}function c(t){return null===t||124===t||(0,r.markdownLineEndingOrSpace)(t)?(e.exit("data"),u(t)):(e.consume(t),92===t?d:c)}function d(t){return 92===t||124===t?(e.consume(t),c):c(t)}function h(t){return(s.interrupt=!1,s.parser.lazy[s.now().line])?n(t):(e.enter("tableDelimiterRow"),i=!1,(0,r.markdownSpace)(t))?(0,eh.factorySpace)(e,p,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):p(t)}function p(t){return 45===t||58===t?m(t):124===t?(i=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),f):n(t)}function f(t){return(0,r.markdownSpace)(t)?(0,eh.factorySpace)(e,m,"whitespace")(t):m(t)}function m(t){return 58===t?(a+=1,i=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),g):45===t?(a+=1,g(t)):null===t||(0,r.markdownLineEnding)(t)?y(t):n(t)}function g(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(n){return 45===n?(e.consume(n),t):58===n?(i=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(n),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(n))}(t)):n(t)}function x(t){return(0,r.markdownSpace)(t)?(0,eh.factorySpace)(e,y,"whitespace")(t):y(t)}function y(s){if(124===s)return p(s);if(null===s||(0,r.markdownLineEnding)(s))return i&&o===a?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(s)):n(s);return n(s)}function b(t){return e.enter("tableRow"),v(t)}function v(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),v):null===n||(0,r.markdownLineEnding)(n)?(e.exit("tableRow"),t(n)):(0,r.markdownSpace)(n)?(0,eh.factorySpace)(e,v,"whitespace")(n):(e.enter("data"),k(n))}function k(t){return null===t||124===t||(0,r.markdownLineEndingOrSpace)(t)?(e.exit("data"),v(t)):(e.consume(t),92===t?w:k)}function w(t){return 92===t||124===t?(e.consume(t),k):k(t)}}function e_(e,t){let n,r,i,s=-1,o=!0,a=0,l=[0,0,0,0],u=[0,0,0,0],c=!1,d=0,h=new ew;for(;++s<e.length;){let p=e[s],f=p[1];"enter"===p[0]?"tableHead"===f.type?(c=!1,0!==d&&(eC(h,t,d,n,r),r=void 0,d=0),n={type:"table",start:Object.assign({},f.start),end:Object.assign({},f.end)},h.add(s,0,[["enter",n,t]])):"tableRow"===f.type||"tableDelimiterRow"===f.type?(o=!0,i=void 0,l=[0,0,0,0],u=[0,s+1,0,0],c&&(c=!1,r={type:"tableBody",start:Object.assign({},f.start),end:Object.assign({},f.end)},h.add(s,0,[["enter",r,t]])),a="tableDelimiterRow"===f.type?2:r?3:1):a&&("data"===f.type||"tableDelimiterMarker"===f.type||"tableDelimiterFiller"===f.type)?(o=!1,0===u[2]&&(0!==l[1]&&(u[0]=u[1],i=eE(h,t,l,a,void 0,i),l=[0,0,0,0]),u[2]=s)):"tableCellDivider"===f.type&&(o?o=!1:(0!==l[1]&&(u[0]=u[1],i=eE(h,t,l,a,void 0,i)),u=[(l=u)[1],s,0,0])):"tableHead"===f.type?(c=!0,d=s):"tableRow"===f.type||"tableDelimiterRow"===f.type?(d=s,0!==l[1]?(u[0]=u[1],i=eE(h,t,l,a,s,i)):0!==u[1]&&(i=eE(h,t,u,a,s,i)),a=0):a&&("data"===f.type||"tableDelimiterMarker"===f.type||"tableDelimiterFiller"===f.type)&&(u[3]=s)}for(0!==d&&eC(h,t,d,n,r),h.consume(t.events),s=-1;++s<t.events.length;){let e=t.events[s];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){let e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}(t.events,s))}return e}function eE(e,t,n,r,i,s){0!==n[0]&&(s.end=Object.assign({},eT(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));let o=eT(t.events,n[1]);if(s={type:1===r?"tableHeader":2===r?"tableDelimiter":"tableData",start:Object.assign({},o),end:Object.assign({},o)},e.add(n[1],0,[["enter",s,t]]),0!==n[2]){let i=eT(t.events,n[2]),s=eT(t.events,n[3]),o={type:"tableContent",start:Object.assign({},i),end:Object.assign({},s)};if(e.add(n[2],0,[["enter",o,t]]),2!==r){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",o,t]])}return void 0!==i&&(s.end=Object.assign({},eT(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function eC(e,t,n,r,i){let s=[],o=eT(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function eT(e,t){let n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}let ej={name:"tasklistCheck",tokenize:function(e,t,n){let i=this;return function(t){return null===i.previous&&i._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),s):n(t)};function s(t){return(0,r.markdownLineEndingOrSpace)(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),o):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),o):n(t)}function o(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(t)}function a(i){return(0,r.markdownLineEnding)(i)?t(i):(0,r.markdownSpace)(i)?e.check({tokenize:eI},t,n)(i):n(i)}}};function eI(e,t,n){return(0,eh.factorySpace)(e,function(e){return null===e?n(e):t(e)},"whitespace")}let eA={};function eR(e){var t;let n,r,i,s=e||eA,m=this.data(),g=m.micromarkExtensions||(m.micromarkExtensions=[]),x=m.fromMarkdownExtensions||(m.fromMarkdownExtensions=[]),y=m.toMarkdownExtensions||(m.toMarkdownExtensions=[]);g.push((t=s,(0,Q.combineExtensions)([{text:ei},{document:{91:{name:"gfmFootnoteDefinition",tokenize:ex,continuation:{tokenize:ey},exit:eb}},text:{91:{name:"gfmFootnoteCall",tokenize:eg},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ef,resolveTo:em}}},(n=(t||{}).singleTilde,r={name:"strikethrough",tokenize:function(e,t,r){let i=this.previous,s=this.events,o=0;return function(a){return 126===i&&"characterEscape"!==s[s.length-1][1].type?r(a):(e.enter("strikethroughSequenceTemporary"),function s(a){let l=(0,O.classifyCharacter)(i);if(126===a)return o>1?r(a):(e.consume(a),o++,s);if(o<2&&!n)return r(a);let u=e.exit("strikethroughSequenceTemporary"),c=(0,O.classifyCharacter)(a);return u._open=!c||2===c&&!!l,u._close=!l||2===l&&!!c,t(a)}(a))}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset==e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";let i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},s={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",s,t]],a=t.parser.constructs.insideSpan.null;a&&(0,ev.splice)(o,o.length,0,(0,ek.resolveAll)(a,e.slice(r+1,n),t)),(0,ev.splice)(o,o.length,0,[["exit",s,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),(0,ev.splice)(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}},null==n&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:eS,resolveAll:e_}}},{text:{91:ej}}]))),x.push([{transforms:[f],enter:{literalAutolink:l,literalAutolinkEmail:u,literalAutolinkHttp:u,literalAutolinkWww:u},exit:{literalAutolink:p,literalAutolinkEmail:h,literalAutolinkHttp:c,literalAutolinkWww:d}},{enter:{gfmFootnoteCallString:b,gfmFootnoteCall:v,gfmFootnoteDefinitionLabelString:k,gfmFootnoteDefinition:w},exit:{gfmFootnoteCallString:S,gfmFootnoteCall:_,gfmFootnoteDefinitionLabelString:E,gfmFootnoteDefinition:C}},{canContainEols:["delete"],enter:{strikethrough:R},exit:{strikethrough:M}},{enter:{table:F,tableData:q,tableHeader:q,tableRow:U},exit:{codeText:H,table:z,tableData:$,tableHeader:$,tableRow:$}},{exit:{taskListCheckValueChecked:W,taskListCheckValueUnchecked:W,paragraph:K}}]),y.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:o,notInConstruct:a},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:o,notInConstruct:a},{character:":",before:"[ps]",after:"\\/",inConstruct:o,notInConstruct:a}]},(i=!1,s&&s.firstLineBlank&&(i=!0),{handlers:{footnoteDefinition:function(e,t,n,r){let s=n.createTracker(r),o=s.move("[^"),a=n.enter("footnoteDefinition"),l=n.enter("label");return o+=s.move(n.safe(n.associationId(e),{before:o,after:"]"})),l(),o+=s.move("]:"),e.children&&e.children.length>0&&(s.shift(4),o+=s.move((i?"\n":" ")+n.indentLines(n.containerFlow(e,s.current()),i?I:j))),a(),o},footnoteReference:T},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:A}],handlers:{delete:N}},function(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=B(e,t,n);return n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&")),r},table:function(e,t,n,r){return a(function(e,t,n){let r=e.children,i=-1,s=[],o=t.enter("table");for(;++i<r.length;)s[i]=l(r[i],t,n);return o(),s}(e,n,r),e.align)},tableCell:o,tableRow:function(e,t,n,r){let i=a([l(e,n,r)]);return i.slice(0,i.indexOf("\n"))}}};function o(e,t,n,r){let i=n.enter("tableCell"),o=n.enter("phrasing"),a=n.containerPhrasing(e,{...r,before:s,after:s});return o(),i(),a}function a(e,t){return function(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||P,s=[],o=[],a=[],l=[],u=0,c=-1;for(;++c<e.length;){let t=[],r=[],s=-1;for(e[c].length>u&&(u=e[c].length);++s<e[c].length;){var d;let o=null==(d=e[c][s])?"":String(d);if(!1!==n.alignDelimiters){let e=i(o);r[s]=e,(void 0===l[s]||e>l[s])&&(l[s]=e)}t.push(o)}o[c]=t,a[c]=r}let h=-1;if("object"==typeof r&&"length"in r)for(;++h<u;)s[h]=D(r[h]);else{let e=D(r);for(;++h<u;)s[h]=e}h=-1;let p=[],f=[];for(;++h<u;){let e=s[h],t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let i=!1===n.alignDelimiters?1:Math.max(1,l[h]-t.length-r.length),o=t+"-".repeat(i)+r;!1!==n.alignDelimiters&&((i=t.length+i+r.length)>l[h]&&(l[h]=i),f[h]=i),p[h]=o}o.splice(1,0,p),a.splice(1,0,f),c=-1;let m=[];for(;++c<o.length;){let e=o[c],t=a[c];h=-1;let r=[];for(;++h<u;){let i=e[h]||"",o="",a="";if(!1!==n.alignDelimiters){let e=l[h]-(t[h]||0),n=s[h];114===n?o=" ".repeat(e):99===n?e%2?(o=" ".repeat(e/2+.5),a=" ".repeat(e/2-.5)):a=o=" ".repeat(e/2):a=" ".repeat(e)}!1===n.delimiterStart||h||r.push("|"),!1!==n.padding&&(!1!==n.alignDelimiters||""!==i)&&(!1!==n.delimiterStart||h)&&r.push(" "),!1!==n.alignDelimiters&&r.push(o),r.push(i),!1!==n.alignDelimiters&&r.push(a),!1!==n.padding&&r.push(" "),(!1!==n.delimiterEnd||h!==u-1)&&r.push("|")}m.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return m.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function l(e,t,n){let r=e.children,i=-1,s=[],a=t.enter("tableRow");for(;++i<r.length;)s[i]=o(r[i],e,t,n);return a(),s}}(s),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:J}}]})}e.s(["default",()=>eR],12878);var eM=e.i(20314);let eN=/^\*\*(.+?)\*\*\s+`([\s\S]+)`\s*$/,eP=/^\*\*(.+?)\*\*\s*$/;function eD(e){let t=e.trim(),n=t.match(eN);if(n){let[,e,t]=n,r=null;try{let e=JSON.parse(t);e&&"object"==typeof e&&!Array.isArray(e)&&(r=e)}catch{}return{kind:"tool",name:e.trim(),detail:t,parsed:r}}let r=t.match(eP);return r?{kind:"label-only",name:r[1].trim()}:null}function eO(e){return/^(Write|Edit|MultiEdit|Update)$/i.test(e)}function eB(e){if(!e)return null;for(let t of[e.file_path,e.path,e.filePath,e.filepath])if("string"==typeof t&&t.length>0)return t;return null}function eL(e){if(!e)return null;for(let t of[e.content,e.new_string,e.newString,e.new_content,e.text])if("string"==typeof t)return t;return null}function eF(e,t,n=80){if(e)for(let t of["command","file_path","path","pattern","query","url"]){let r=e[t];if("string"==typeof r&&r.length>0)return ez(r,n)}return ez(t.replace(/\s+/g," ").trim(),n)}function ez(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}e.s(["extractFileContent",()=>eL,"extractFilePath",()=>eB,"isFileWriteTool",()=>eO,"parseToolEvent",()=>eD,"summarizeToolDetail",()=>eF],90292);var eU=e.i(79054),e$=e.i(99105),eq=e.i(76016),eH=e.i(81975),eV=e.i(31777);let eW={default:"bg-muted/40 hover:bg-muted/70",green:"bg-emerald-500/8 hover:bg-emerald-500/15 border-emerald-500/20",blue:"bg-sky-500/8 hover:bg-sky-500/15 border-sky-500/20"};function eK({name:e,summary:t,expanded:n,onToggle:r,icon:i,tint:s="default"}){return(0,eM.jsxs)("button",{type:"button",onClick:r,className:(0,eV.cn)("border-border/60 text-foreground/90 group inline-flex max-w-full items-center gap-1.5 rounded-md border px-2 py-0.5 font-mono text-[11px] transition-colors",eW[s],n&&"rounded-b-none border-b-0"),children:[n?(0,eM.jsx)(e$.ChevronDown,{className:"h-3 w-3 shrink-0 opacity-60"}):(0,eM.jsx)(eq.ChevronRight,{className:"h-3 w-3 shrink-0 opacity-60"}),i??(0,eM.jsx)(eH.Wrench,{className:"h-3 w-3 shrink-0 opacity-60"}),(0,eM.jsx)("span",{className:"shrink-0 font-medium",children:e}),t?(0,eM.jsx)("span",{className:"text-muted-foreground/70 max-w-[360px] truncate",children:t}):null]})}function eJ({name:e,detail:t,parsed:n}){let[r,i]=(0,eU.useState)(!1),s=eF(n,t),o=n?JSON.stringify(n,null,2):t;return(0,eM.jsxs)("div",{className:"inline-flex max-w-full flex-col",children:[(0,eM.jsx)(eK,{name:e,summary:r?null:s,expanded:r,onToggle:()=>i(e=>!e)}),r?(0,eM.jsx)("pre",{className:"border-border/60 bg-background/40 text-foreground/70 max-h-[300px] max-w-full overflow-auto rounded-md rounded-tl-none border px-3 py-2 font-mono text-[10px] leading-relaxed",children:o}):null]})}var eQ=e.i(11345),eG=e.i(70471),eY=e.i(3645);let eX=(0,eY.default)("pencil-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);function eZ({toolName:e,filePath:t,content:n}){let[r,i]=(0,eU.useState)(!1),s=t.split(/[\\/]/).pop()??t,o=n?n.split("\n").length:0,a=e.toLowerCase(),l=/edit/i.test(e);return r?(0,eM.jsxs)("div",{className:"border-border/60 bg-background/50 flex max-w-full flex-col overflow-hidden rounded-lg border",children:[(0,eM.jsxs)("div",{className:"bg-muted/60 border-border/60 flex items-center justify-between gap-2 border-b px-3 py-1.5",children:[(0,eM.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[l?(0,eM.jsx)(eX,{className:"h-3.5 w-3.5 shrink-0 text-sky-500"}):(0,eM.jsx)(eG.FileText,{className:"h-3.5 w-3.5 shrink-0 text-emerald-500"}),(0,eM.jsx)("span",{className:"truncate font-mono text-[11px] font-medium",title:t,children:s}),(0,eM.jsx)("span",{className:"text-muted-foreground/60 shrink-0 font-mono text-[9px] tracking-wide uppercase",children:a})]}),(0,eM.jsxs)("button",{type:"button",onClick:()=>i(!1),className:"text-muted-foreground hover:text-foreground inline-flex shrink-0 items-center gap-1 rounded px-1.5 py-0.5 text-[10px] transition-colors","aria-label":"Collapse file preview",children:[(0,eM.jsx)(eQ.ChevronLeft,{className:"h-3 w-3"}),"Back"]})]}),(0,eM.jsx)("pre",{className:"max-h-[420px] overflow-auto px-3 py-2 font-mono text-[10px] leading-relaxed",children:n??"(no content available)"}),(0,eM.jsx)("div",{className:"text-muted-foreground/60 border-border/60 border-t px-3 py-1 font-mono text-[9px]",children:t})]}):(0,eM.jsxs)("button",{type:"button",onClick:()=>i(!0),title:t,className:(0,eV.cn)("group inline-flex max-w-full items-center gap-2 rounded-lg border px-3 py-1.5 text-xs transition-all",l?"border-sky-500/25 bg-sky-500/10 hover:border-sky-500/40 hover:bg-sky-500/15":"border-emerald-500/25 bg-emerald-500/10 hover:border-emerald-500/40 hover:bg-emerald-500/15"),children:[(0,eM.jsx)("div",{className:(0,eV.cn)("flex h-6 w-6 shrink-0 items-center justify-center rounded",l?"bg-sky-500/15 text-sky-500":"bg-emerald-500/15 text-emerald-500"),children:l?(0,eM.jsx)(eX,{className:"h-3.5 w-3.5"}):(0,eM.jsx)(eG.FileText,{className:"h-3.5 w-3.5"})}),(0,eM.jsxs)("div",{className:"flex min-w-0 flex-col items-start",children:[(0,eM.jsx)("span",{className:"truncate font-mono text-[11px] font-medium",children:s}),(0,eM.jsxs)("span",{className:"text-muted-foreground/70 font-mono text-[9px] tracking-wide uppercase",children:[a,o?` \xb7 ${o} line${1===o?"":"s"}`:""]})]})]})}function e0({text:e}){let t=eD(e);if(!t)return null;if("label-only"===t.kind)return(0,eM.jsx)(eJ,{name:t.name,detail:"",parsed:null});if(eO(t.name)){let e=eB(t.parsed);if(e)return(0,eM.jsx)(eZ,{toolName:t.name,filePath:e,content:eL(t.parsed)})}return(0,eM.jsx)(eJ,{name:t.name,detail:t.detail,parsed:t.parsed})}e.s(["ToolBubble",()=>e0],81835);let e1=(0,eY.default)("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);e.s(["CircleStop",()=>e1],49527)},14515,(e,t,n)=>{var r={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),n=t[0],r=t[1];return(n+r)*3/4-r},t.toByteArray=function(e){var t,n,s=l(e),o=s[0],a=s[1],u=new i((o+a)*3/4-a),c=0,d=a>0?o-4:o;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===a&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[c++]=255&t),1===a&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,s=[],o=0,a=r-i;o<a;o+=16383)s.push(function(e,t,r){for(var i,s=[],o=t;o<r;o+=3)i=(e[o]<<16&0xff0000)+(e[o+1]<<8&65280)+(255&e[o+2]),s.push(n[i>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}(e,o,o+16383>a?a:o+16383));return 1===i?s.push(n[(t=e[r-1])>>2]+n[t<<4&63]+"=="):2===i&&s.push(n[(t=(e[r-2]<<8)+e[r-1])>>10]+n[t>>4&63]+n[t<<2&63]+"="),s.join("")};for(var n=[],r=[],i="u">typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=s.length;o<a;++o)n[o]=s[o],r[s.charCodeAt(o)]=o;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");-1===n&&(n=t);var r=n===t?0:4-n%4;return[n,r]}r[45]=62,r[95]=63},72:function(e,t,n){"use strict";var r=n(675),i=n(783),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,n){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return l(e,t,n)}function l(e,t,n){if("string"==typeof e){var r=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);var s=0|p(r,i),l=o(s),u=l.write(r,i);return u!==s&&(l=l.slice(0,u)),l}if(ArrayBuffer.isView(e))return d(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(I(e,ArrayBuffer)||e&&I(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(I(e,SharedArrayBuffer)||e&&I(e.buffer,SharedArrayBuffer)))return function(e,t,n){var r;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),a.prototype),r}(e,t,n);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var c=e.valueOf&&e.valueOf();if(null!=c&&c!==e)return a.from(c,t,n);var f=function(e){if(a.isBuffer(e)){var t=0|h(e.length),n=o(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?o(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(f)return f;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,n);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),o(e<0?0:0|h(e))}function d(e){for(var t=e.length<0?0:0|h(e.length),n=o(t),r=0;r<t;r+=1)n[r]=255&e[r];return n}t.Buffer=a,t.SlowBuffer=function(e){return+e!=e&&(e=0),a.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,a.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!a.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,n){return l(e,t,n)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,n){return(u(e),e<=0)?o(e):void 0!==t?"string"==typeof n?o(e).fill(t,n):o(e).fill(t):o(e)},a.allocUnsafe=function(e){return c(e)},a.allocUnsafeSlow=function(e){return c(e)};function h(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||I(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return E(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return T(e).length;default:if(i)return r?-1:E(e).length;t=(""+t).toLowerCase(),i=!0}}function f(e,t,n){var i,s,o,a=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0||(n>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",s=t;s<n;++s)i+=A[e[s]];return i}(this,t,n);case"utf8":case"utf-8":return y(this,t,n);case"ascii":return function(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}(this,t,n);case"latin1":case"binary":return function(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}(this,t,n);case"base64":return i=this,s=t,o=n,0===s&&o===i.length?r.fromByteArray(i):r.fromByteArray(i.slice(s,o));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,n){for(var r=e.slice(t,n),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+256*r[s+1]);return i}(this,t,n);default:if(a)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){var s;if(0===e.length)return -1;if("string"==typeof n?(r=n,n=0):n>0x7fffffff?n=0x7fffffff:n<-0x80000000&&(n=-0x80000000),(s=n*=1)!=s&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length)if(i)return -1;else n=e.length-1;else if(n<0)if(!i)return -1;else n=0;if("string"==typeof t&&(t=a.from(t,r)),a.isBuffer(t))return 0===t.length?-1:x(e,t,n,r,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,n);else return Uint8Array.prototype.lastIndexOf.call(e,t,n);return x(e,[t],n,r,i)}throw TypeError("val must be string, number or Buffer")}function x(e,t,n,r,i){var s,o=1,a=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return -1;o=2,a/=2,l/=2,n/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(s=n;s<a;s++)if(u(e,s)===u(t,-1===c?0:s-c)){if(-1===c&&(c=s),s-c+1===l)return c*o}else -1!==c&&(s-=s-c),c=-1}else for(n+l>a&&(n=a-l),s=n;s>=0;s--){for(var d=!0,h=0;h<l;h++)if(u(e,s+h)!==u(t,h)){d=!1;break}if(d)return s}return -1}a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(I(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),I(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,r=t.length,i=0,s=Math.min(n,r);i<s;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);if(void 0===t)for(n=0,t=0;n<e.length;++n)t+=e[n].length;var n,r=a.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var s=e[n];if(I(s,Uint8Array)&&(s=a.from(s)),!a.isBuffer(s))throw TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},a.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?y(this,0,e):f.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,n,r,i){if(I(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var s=i-r,o=n-t,l=Math.min(s,o),u=this.slice(r,i),c=e.slice(t,n),d=0;d<l;++d)if(u[d]!==c[d]){s=u[d],o=c[d];break}return s<o?-1:+(o<s)},a.prototype.includes=function(e,t,n){return -1!==this.indexOf(e,t,n)},a.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},a.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)};function y(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var s,o,a,l,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:(192&(s=e[i+1]))==128&&(l=(31&u)<<6|63&s)>127&&(c=l);break;case 3:s=e[i+1],o=e[i+2],(192&s)==128&&(192&o)==128&&(l=(15&u)<<12|(63&s)<<6|63&o)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:s=e[i+1],o=e[i+2],a=e[i+3],(192&s)==128&&(192&o)==128&&(192&a)==128&&(l=(15&u)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=d}var h=r,p=h.length;if(p<=4096)return String.fromCharCode.apply(String,h);for(var f="",m=0;m<p;)f+=String.fromCharCode.apply(String,h.slice(m,m+=4096));return f}function b(e,t,n){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>n)throw RangeError("Trying to access beyond buffer length")}function v(e,t,n,r,i,s){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw RangeError('"value" argument is out of bounds');if(n+r>e.length)throw RangeError("Index out of range")}function k(e,t,n,r,i,s){if(n+r>e.length||n<0)throw RangeError("Index out of range")}function w(e,t,n,r,s){return t*=1,n>>>=0,s||k(e,t,n,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,n,r,23,4),n+4}function S(e,t,n,r,s){return t*=1,n>>>=0,s||k(e,t,n,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,n,r,52,8),n+8}a.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,s,o,a,l,u,c,d,h=this.length-t;if((void 0===n||n>h)&&(n=h),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var p=!1;;)switch(r){case"hex":return function(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var s=t.length;r>s/2&&(r=s/2);for(var o=0;o<r;++o){var a,l=parseInt(t.substr(2*o,2),16);if((a=l)!=a)break;e[n+o]=l}return o}(this,e,t,n);case"utf8":case"utf-8":return i=t,s=n,j(E(e,this.length-i),this,i,s);case"ascii":return o=t,a=n,j(C(e),this,o,a);case"latin1":case"binary":return function(e,t,n,r){return j(C(t),e,n,r)}(this,e,t,n);case"base64":return l=t,u=n,j(T(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,d=n,j(function(e,t){for(var n,r,i=[],s=0;s<e.length&&!((t-=2)<0);++s)r=(n=e.charCodeAt(s))>>8,i.push(n%256),i.push(r);return i}(e,this.length-c),this,c,d);default:if(p)throw TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),p=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);var r=this.subarray(e,t);return Object.setPrototypeOf(r,a.prototype),r},a.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||b(e,t,this.length);for(var r=this[e],i=1,s=0;++s<t&&(i*=256);)r+=this[e+s]*i;return r},a.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||b(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},a.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||b(e,t,this.length);for(var r=this[e],i=1,s=0;++s<t&&(i*=256);)r+=this[e+s]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},a.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||b(e,t,this.length);for(var r=t,i=1,s=this[e+--r];r>0&&(i*=256);)s+=this[e+--r]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},a.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?0xffff0000|n:n},a.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?0xffff0000|n:n},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,n,r){if(e*=1,t>>>=0,n>>>=0,!r){var i=Math.pow(2,8*n)-1;v(this,e,t,n,i,0)}var s=1,o=0;for(this[t]=255&e;++o<n&&(s*=256);)this[t+o]=e/s&255;return t+n},a.prototype.writeUIntBE=function(e,t,n,r){if(e*=1,t>>>=0,n>>>=0,!r){var i=Math.pow(2,8*n)-1;v(this,e,t,n,i,0)}var s=n-1,o=1;for(this[t+s]=255&e;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+n},a.prototype.writeUInt8=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUInt16BE=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUInt32LE=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUInt32BE=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,n,r){if(e*=1,t>>>=0,!r){var i=Math.pow(2,8*n-1);v(this,e,t,n,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s<n&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+n},a.prototype.writeIntBE=function(e,t,n,r){if(e*=1,t>>>=0,!r){var i=Math.pow(2,8*n-1);v(this,e,t,n,i-1,-i)}var s=n-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,n){return e*=1,t>>>=0,n||v(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,n){return w(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return w(this,e,t,!1,n)},a.prototype.writeDoubleLE=function(e,t,n){return S(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return S(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,r){if(!a.isBuffer(e))throw TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw RangeError("Index out of range");if(r<0)throw RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i=r-n;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,n,r);else if(this===e&&n<t&&t<r)for(var s=i-1;s>=0;--s)e[s+t]=this[s+n];else Uint8Array.prototype.set.call(e,this.subarray(n,r),t);return i},a.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw TypeError("encoding must be a string");if("string"==typeof r&&!a.isEncoding(r))throw TypeError("Unknown encoding: "+r);if(1===e.length){var i,s=e.charCodeAt(0);("utf8"===r&&s<128||"latin1"===r)&&(e=s)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError("Out of range index");if(n<=t)return this;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{var o=a.isBuffer(e)?e:a.from(e,r),l=o.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=o[i%l]}return this};var _=/[^+/0-9A-Za-z-_]/g;function E(e,t){t=t||1/0;for(var n,r=e.length,i=null,s=[],o=0;o<r;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319||o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else if(n<1114112){if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}else throw Error("Invalid code point")}return s}function C(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}function T(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(_,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function j(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length)&&!(i>=e.length);++i)t[i+n]=e[i];return i}function I(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var A=function(){for(var e="0123456789abcdef",t=Array(256),n=0;n<16;++n)for(var r=16*n,i=0;i<16;++i)t[r+i]=e[n]+e[i];return t}()},783:function(e,t){t.read=function(e,t,n,r,i){var s,o,a=8*i-r-1,l=(1<<a)-1,u=l>>1,c=-7,d=n?i-1:0,h=n?-1:1,p=e[t+d];for(d+=h,s=p&(1<<-c)-1,p>>=-c,c+=a;c>0;s=256*s+e[t+d],d+=h,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=r;c>0;o=256*o+e[t+d],d+=h,c-=8);if(0===s)s=1-u;else{if(s===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),s-=u}return(p?-1:1)*o*Math.pow(2,s-r)},t.write=function(e,t,n,r,i,s){var o,a,l,u=8*s-i-1,c=(1<<u)-1,d=c>>1,h=5960464477539062e-23*(23===i),p=r?0:s-1,f=r?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(a=+!!isNaN(t),o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+d>=1?t+=h/l:t+=h*Math.pow(2,1-d),t*l>=2&&(o++,l/=2),o+d>=c?(a=0,o=c):o+d>=1?(a=(t*l-1)*Math.pow(2,i),o+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[n+p]=255&a,p+=f,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;e[n+p]=255&o,p+=f,o/=256,u-=8);e[n+p-f]|=128*m}}},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}},o=!0;try{r[e](n,n.exports,s),o=!1}finally{o&&delete i[e]}return n.exports}s.ab="/ROOT/node_modules/.pnpm/next@16.1.6_@babel+core@7.29.0_@playwright+test@1.58.1_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/next/dist/compiled/buffer/",t.exports=s(72)},78598,(e,t,n)=>{"use strict";var r=e.i(14515);let i=void 0!==r.Buffer,s=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,o=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function a(e,t,n){null==n&&null!==t&&"object"==typeof t&&(n=t,t=void 0),i&&r.Buffer.isBuffer(e)&&(e=e.toString()),e&&65279===e.charCodeAt(0)&&(e=e.slice(1));let a=JSON.parse(e,t);if(null===a||"object"!=typeof a)return a;let u=n&&n.protoAction||"error",c=n&&n.constructorAction||"error";if("ignore"===u&&"ignore"===c)return a;if("ignore"!==u&&"ignore"!==c){if(!1===s.test(e)&&!1===o.test(e))return a}else if("ignore"!==u&&"ignore"===c){if(!1===s.test(e))return a}else if(!1===o.test(e))return a;return l(a,{protoAction:u,constructorAction:c,safe:n&&n.safe})}function l(e,{protoAction:t="error",constructorAction:n="error",safe:r}={}){let i=[e];for(;i.length;){let e=i;for(let s of(i=[],e)){if("ignore"!==t&&Object.prototype.hasOwnProperty.call(s,"__proto__")){if(!0===r)return null;if("error"===t)throw SyntaxError("Object contains forbidden prototype property");delete s.__proto__}if("ignore"!==n&&Object.prototype.hasOwnProperty.call(s,"constructor")&&null!==s.constructor&&"object"==typeof s.constructor&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype")){if(!0===r)return null;if("error"===n)throw SyntaxError("Object contains forbidden prototype property");delete s.constructor}for(let e in s){let t=s[e];t&&"object"==typeof t&&i.push(t)}}}return e}function u(e,t,n){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return a(e,t,n)}finally{Error.stackTraceLimit=r}}t.exports=u,t.exports.default=u,t.exports.parse=u,t.exports.safeParse=function(e,t){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return a(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=n}},t.exports.scan=l},87975,e=>{"use strict";var t=e.i(6786),n=e.i(19644),r=e.i(20979),i=class extends n.Removable{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||s(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=(0,r.createRetryer)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#i({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#i({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let i="pending"===this.state.status,s=!this.#r.canStart();try{if(i)t();else{this.#i({type:"pending",variables:e,isPaused:s}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:"pending",context:t,variables:e,isPaused:s})}let r=await this.#r.start();return await this.#n.config.onSuccess?.(r,e,this.state.context,this,n),await this.options.onSuccess?.(r,e,this.state.context,n),await this.#n.config.onSettled?.(r,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(r,null,e,this.state.context,n),this.#i({type:"success",data:r}),r}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:"error",error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),t.notifyManager.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function s(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}e.s(["Mutation",()=>i,"getDefaultState",()=>s])},28112,98440,e=>{"use strict";e.i(44172);var t=e.i(20314),n=e.i(79054);e.i(41001);var r=e.i(64780),i=e.i(7319),s=e.i(67669),o=e.i(18532),a=e.i(94365),l=e.i(31777),u=e.i(26036),c=e.i(63045),d=e.i(17466),h=e.i(61302),p=e.i(94875),f=e.i(30854),m=e.i(427),g=e.i(12878),x=e.i(81835),y=e.i(90292),b=e.i(11719),v=e.i(49527),k=e.i(33548),w=e.i(35946),S=e.i(26370),_=e.i(87538),E=e.i(60253),C=e.i(99105),T=e.i(48829),j=e.i(83428),I=e.i(23925);let A={p:({children:e})=>(0,t.jsx)("p",{className:"mb-2 leading-relaxed last:mb-0",children:e}),strong:({children:e})=>(0,t.jsx)("strong",{className:"font-semibold",children:e}),em:({children:e})=>(0,t.jsx)("em",{className:"italic",children:e}),code:({children:e,className:n})=>n?(0,t.jsx)("code",{className:`${n} text-[11px]`,children:e}):(0,t.jsx)("code",{className:"bg-background/50 rounded-md px-1.5 py-0.5 font-mono text-xs",children:e}),pre:({children:e})=>{let n=e?.props?.className?.replace("language-","")??"",r="string"==typeof e?.props?.children?e.props.children:"";return["html","svg"].includes(n)&&r.length>0?(0,t.jsx)(F,{code:r,language:n}):(0,t.jsx)(L,{language:n,children:e})},ul:({children:e})=>(0,t.jsx)("ul",{className:"mb-2 list-disc ps-4 last:mb-0",children:e}),ol:({children:e})=>(0,t.jsx)("ol",{className:"mb-2 list-decimal ps-4 last:mb-0",children:e}),li:({children:e})=>(0,t.jsx)("li",{className:"mb-0.5",children:e}),h1:({children:e})=>(0,t.jsx)("h1",{className:"mb-1 text-base font-bold",children:e}),h2:({children:e})=>(0,t.jsx)("h2",{className:"mb-1 text-sm font-bold",children:e}),h3:({children:e})=>(0,t.jsx)("h3",{className:"mb-1 text-sm font-semibold",children:e}),a:({children:e,href:n})=>(0,t.jsx)("a",{href:n,className:"text-blue-500 underline",target:"_blank",rel:"noopener noreferrer",children:e}),blockquote:({children:e})=>(0,t.jsx)("blockquote",{className:"border-muted-foreground/30 my-1 border-s-2 ps-3 italic opacity-80",children:e}),table:({children:e})=>(0,t.jsx)("div",{className:"my-2 overflow-x-auto",children:(0,t.jsx)("table",{className:"min-w-full border-collapse text-xs",children:e})}),thead:({children:e})=>(0,t.jsx)("thead",{className:"bg-muted/50 border-b",children:e}),th:({children:e})=>(0,t.jsx)("th",{className:"px-2 py-1 text-start font-semibold",children:e}),td:({children:e})=>(0,t.jsx)("td",{className:"border-muted border-t px-2 py-1",children:e}),tr:({children:e})=>(0,t.jsx)("tr",{children:e}),hr:()=>(0,t.jsx)("hr",{className:"border-border/40 my-3 border-t"})};function R({className:e,beforeMessages:n,afterMessages:r,composer:i,hideEmpty:s}){return(0,t.jsxs)(p.ThreadPrimitive.Root,{className:(0,l.cn)("flex h-full flex-col",e),children:[(0,t.jsxs)(p.ThreadPrimitive.Viewport,{className:"flex flex-1 flex-col overflow-y-auto pt-4",children:[s?null:(0,t.jsx)(p.ThreadPrimitive.Empty,{children:(0,t.jsx)(M,{})}),n,(0,t.jsx)(p.ThreadPrimitive.Messages,{components:{UserMessage:P,AssistantMessage:B}}),r]}),i??(0,t.jsx)(J,{})]})}function M(){return(0,t.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 p-8 text-center",children:[(0,t.jsx)(S.Bot,{className:"text-muted-foreground/40 h-10 w-10"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:"Send a message to start chatting with the agent."})]})}let N="{{interaction}}",P=()=>{let e=(0,f.useMessage)(),n=e?.content?.[0],r=n&&"text"in n?n.text:"";return r.startsWith(N)?(0,t.jsx)(D,{text:r}):(0,t.jsxs)(h.MessagePrimitive.Root,{className:"group animate-in fade-in-0 slide-in-from-bottom-1 flex w-full items-start gap-2.5 px-4 py-0.5 duration-300 ease-out",children:[(0,t.jsx)("div",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-violet-500/15",children:(0,t.jsx)(a.User,{className:"h-3.5 w-3.5 text-violet-500"})}),(0,t.jsxs)("div",{className:"flex max-w-[85%] min-w-0 flex-col gap-0.5",children:[(0,t.jsx)("div",{className:"text-foreground mt-px overflow-hidden rounded-2xl rounded-tl-sm border border-violet-500/15 bg-violet-500/8 px-4 py-2 text-sm leading-relaxed break-words shadow-sm backdrop-blur-md dark:bg-violet-500/15",children:(0,t.jsx)(h.MessagePrimitive.Content,{components:{Text:O}})}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,t.jsx)(W,{}),(0,t.jsx)(c.ActionBarPrimitive.Root,{className:"flex items-center gap-1",children:(0,t.jsx)(c.ActionBarPrimitive.Copy,{asChild:!0,children:(0,t.jsx)(K,{tooltip:"Copy",children:(0,t.jsx)(k.Copy,{})})})})]})]})]})};function D({text:e}){let r=(0,n.useMemo)(()=>{try{let t=e.slice(N.length);return JSON.parse(t)}catch{return null}},[e]);return r?(0,t.jsxs)(h.MessagePrimitive.Root,{className:"group animate-in fade-in-0 slide-in-from-bottom-1 flex w-full items-start gap-2.5 px-4 py-0.5 duration-300 ease-out",children:[(0,t.jsx)("div",{className:"bg-muted flex h-6 w-6 shrink-0 items-center justify-center rounded-full",children:(0,t.jsx)(I.Check,{className:"h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400"})}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,t.jsx)("div",{className:"text-foreground mt-px flex flex-wrap items-center gap-x-4 gap-y-1 rounded-2xl rounded-tl-sm border border-emerald-600/20 bg-emerald-50/50 px-4 py-2 text-sm shadow-sm dark:border-emerald-500/20 dark:bg-emerald-950/20",children:r.questions.map(e=>(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full bg-emerald-100 px-2 py-0.5 text-[10px] font-semibold tracking-wider text-emerald-700 uppercase dark:bg-emerald-900/50 dark:text-emerald-400",children:e.header}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:r.answers[e.question]||"No answer"})]},e.question))}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,t.jsx)(W,{}),(0,t.jsx)(c.ActionBarPrimitive.Root,{className:"flex items-center gap-1",children:(0,t.jsx)(c.ActionBarPrimitive.Copy,{asChild:!0,children:(0,t.jsx)(K,{tooltip:"Copy",children:(0,t.jsx)(k.Copy,{})})})})]})]})]}):null}function O({text:e}){return(0,t.jsx)("span",{className:"whitespace-pre-wrap",children:e})}let B=()=>{let e=(0,f.useMessage)(),n=e?.content?.[0],r=n&&"text"in n?n.text:"";return(r?(0,y.parseToolEvent)(r):null)?(0,t.jsxs)(h.MessagePrimitive.Root,{className:"group animate-in fade-in-0 slide-in-from-bottom-1 flex w-full items-start gap-2.5 px-4 py-0.5 duration-300 ease-out",children:[(0,t.jsx)("div",{className:"text-muted-foreground/40 mt-1 flex h-6 w-6 shrink-0 items-center justify-center",children:(0,t.jsx)(S.Bot,{className:"h-3 w-3"})}),(0,t.jsx)("div",{className:"flex min-w-0 flex-1 items-center py-0.5",children:(0,t.jsx)(x.ToolBubble,{text:r})})]}):(0,t.jsxs)(h.MessagePrimitive.Root,{className:"group animate-in fade-in-0 slide-in-from-bottom-1 flex w-full items-start gap-2.5 px-4 py-0.5 duration-300 ease-out",children:[(0,t.jsx)("div",{className:"bg-muted flex h-6 w-6 shrink-0 items-center justify-center rounded-full",children:(0,t.jsx)(S.Bot,{className:"text-muted-foreground h-3.5 w-3.5"})}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,t.jsx)("div",{className:"bg-muted/50 text-foreground mt-px overflow-hidden rounded-2xl rounded-tl-sm border border-white/5 px-4 py-2 text-sm leading-relaxed break-words shadow-sm backdrop-blur-md dark:bg-neutral-800/60",children:(0,t.jsx)(h.MessagePrimitive.Content,{components:{Text:U}})}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,t.jsx)(W,{}),(0,t.jsx)(c.ActionBarPrimitive.Root,{className:"flex items-center gap-1",children:(0,t.jsx)(c.ActionBarPrimitive.Copy,{asChild:!0,children:(0,t.jsx)(K,{tooltip:"Copy",children:(0,t.jsx)(k.Copy,{})})})})]})]})]})};function L({children:e,language:i}){let{t:s}=(0,r.useTranslation)("web"),[o,a]=(0,n.useState)(!1),[l,u]=(0,n.useState)(!1),c=(0,n.useRef)(null);return(0,n.useEffect)(()=>{c.current&&c.current.scrollHeight>240&&u(!0)},[e]),(0,t.jsxs)("div",{className:"bg-background/50 relative my-2 overflow-hidden rounded-md",children:[i?(0,t.jsx)("div",{className:"text-muted-foreground/50 border-b border-white/5 px-3 py-1 font-mono text-[10px] uppercase",children:i}):null,(0,t.jsx)("pre",{ref:c,className:"overflow-x-auto p-3 font-mono text-xs leading-relaxed transition-[max-height] duration-300 ease-in-out",style:{maxHeight:o?"min(60vh, 500px)":l?"200px":"min(60vh, 500px)",overflow:o?"auto":void 0},children:e}),l&&!o?(0,t.jsx)("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center bg-gradient-to-t from-black/60 via-black/30 to-transparent pt-12 pb-3",children:(0,t.jsxs)("button",{type:"button",onClick:()=>a(!0),className:"inline-flex items-center gap-1 rounded-full border border-white/10 bg-white/10 px-3 py-1 text-[11px] font-medium text-white/80 shadow-lg backdrop-blur-md transition-all hover:bg-white/20 hover:text-white",children:[(0,t.jsx)(C.ChevronDown,{className:"h-3 w-3"}),s("chat.showMore")]})}):null,l&&o?(0,t.jsx)("div",{className:"flex justify-center border-t border-white/5 py-1.5",children:(0,t.jsxs)("button",{type:"button",onClick:()=>a(!1),className:"inline-flex items-center gap-1 rounded-full px-3 py-0.5 text-[11px] text-white/50 transition-colors hover:text-white/80",children:[(0,t.jsx)(T.ChevronUp,{className:"h-3 w-3"}),s("chat.showLess")]})}):null]})}function F({code:e,language:i}){let{t:s}=(0,r.useTranslation)("web"),[o,a]=(0,n.useState)(!1),[c,d]=(0,n.useState)(!1),[h,p]=(0,n.useState)(!1),f=e.split("\n").length,m=e.length;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"bg-background/50 my-2 overflow-hidden rounded-md border",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between border-b px-3 py-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground font-mono text-xs uppercase",children:i}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("button",{type:"button",onClick:()=>a(!1),className:(0,l.cn)("rounded px-2.5 py-0.5 text-xs font-medium transition-colors",o?"text-muted-foreground hover:text-foreground":"bg-muted text-foreground"),children:s("chat.code")}),(0,t.jsx)("button",{type:"button",onClick:()=>a(!0),className:(0,l.cn)("rounded px-2.5 py-0.5 text-xs font-medium transition-colors",o?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:s("chat.preview")}),(0,t.jsx)("button",{type:"button",onClick:()=>{p(!o),d(!0)},className:"text-muted-foreground hover:text-foreground ms-1 rounded p-0.5 transition-colors",title:s("chat.openFullscreen"),children:(0,t.jsx)(_.Maximize2,{className:"h-3 w-3"})})]})]}),(0,t.jsx)("div",{style:{height:"min(55vh, 450px)"},children:o?(0,t.jsx)("iframe",{srcDoc:e,sandbox:"allow-scripts",className:"h-full w-full border-0 bg-white",title:s("chat.htmlPreview")}):(0,t.jsx)("pre",{className:"h-full overflow-auto p-3 font-mono text-xs leading-relaxed",children:(0,t.jsx)("code",{children:e})})})]}),c&&"u">typeof document?(0,u.createPortal)((0,t.jsx)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/70 backdrop-blur-sm",onClick:()=>d(!1),children:(0,t.jsxs)("div",{className:"bg-background relative flex h-[95vh] w-[95vw] flex-col overflow-hidden rounded-xl border shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:"bg-muted/80 flex h-12 shrink-0 items-center justify-between border-b px-5",children:[(0,t.jsxs)("div",{className:"bg-muted flex items-center gap-0.5 rounded-lg p-1",children:[(0,t.jsx)("button",{type:"button",onClick:()=>p(!1),className:(0,l.cn)("rounded-md px-4 py-1.5 text-sm font-medium transition-all",h?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:s("chat.preview")}),(0,t.jsx)("button",{type:"button",onClick:()=>p(!0),className:(0,l.cn)("rounded-md px-4 py-1.5 text-sm font-medium transition-all",h?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:s("chat.code")})]}),(0,t.jsxs)("div",{className:"text-muted-foreground/60 flex items-center gap-4 text-xs",children:[(0,t.jsxs)("span",{children:[f," lines"]}),(0,t.jsxs)("span",{children:[m.toLocaleString()," chars"]}),(0,t.jsx)("span",{className:"font-mono uppercase",children:i})]}),(0,t.jsx)("button",{type:"button",onClick:()=>d(!1),className:"text-muted-foreground hover:bg-muted hover:text-foreground rounded-lg p-2 transition-colors",children:(0,t.jsx)(E.X,{className:"h-5 w-5"})})]}),h?(0,t.jsx)("pre",{className:"flex-1 overflow-auto p-4 font-mono text-xs leading-relaxed",children:(0,t.jsx)("code",{children:e})}):(0,t.jsx)("iframe",{srcDoc:e,sandbox:"allow-scripts",className:"flex-1 border-0 bg-white dark:bg-neutral-900",title:s("chat.htmlPreviewFullscreen")})]})}),document.body):null]})}let z=/^\*⏳ (.+)\*$/;function U({text:e}){if("*Thinking...*"===e||"*Agent is waking up...*"===e)return(0,t.jsx)(V,{booting:e.includes("waking")});let n=z.exec(e);return n?(0,t.jsx)($,{label:n[1]}):(0,t.jsx)(m.default,{remarkPlugins:[g.default],components:A,children:e})}function $({label:e}){return(0,t.jsxs)("span",{className:"text-muted-foreground inline-flex items-center gap-2 text-sm italic",children:[(0,t.jsx)(j.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),(0,t.jsx)("span",{children:e})]})}let q=["Thinking","Reasoning","Analyzing","Processing","Evaluating","Considering","Reflecting","Pondering"],H=["Waking up","Initializing","Loading tools","Preparing","Connecting"];function V({booting:e}){let r=e?H:q,[i,s]=(0,n.useState)(0),[o,a]=(0,n.useState)(!0);return(0,n.useEffect)(()=>{let e=setInterval(()=>{a(!1),setTimeout(()=>{s(e=>(e+1)%r.length),a(!0)},200)},2e3);return()=>clearInterval(e)},[r]),(0,t.jsxs)("span",{className:"text-muted-foreground inline-flex w-32 items-center gap-1.5 text-sm italic",children:[(0,t.jsx)("span",{className:"inline-block transition-all duration-300 ease-in-out",style:{opacity:+!!o,transform:o?"translateY(0)":"translateY(-4px)"},children:r[i]}),(0,t.jsxs)("span",{className:"inline-flex gap-0.5",children:[(0,t.jsx)("span",{className:"bg-muted-foreground/60 h-1 w-1 animate-bounce rounded-full",style:{animationDelay:"0ms"}}),(0,t.jsx)("span",{className:"bg-muted-foreground/60 h-1 w-1 animate-bounce rounded-full",style:{animationDelay:"150ms"}}),(0,t.jsx)("span",{className:"bg-muted-foreground/60 h-1 w-1 animate-bounce rounded-full",style:{animationDelay:"300ms"}})]})]})}function W(){let e=(0,f.useMessage)(),[r,i]=(0,n.useState)(0);(0,n.useEffect)(()=>{let e=setInterval(()=>i(e=>e+1),3e4);return()=>clearInterval(e)},[]);let s=(0,n.useMemo)(()=>{if(!e?.createdAt)return null;let t=new Date(e.createdAt);return isNaN(t.getTime())?null:{time:t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),relative:function(e){let t=Date.now()-e.getTime();if(t<0||t<5e3)return"just now";let n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:e.toLocaleDateString()}(t)}},[e?.createdAt,r]);return s?(0,t.jsx)("span",{className:"text-muted-foreground/60 text-[10px]",title:s.time,children:s.relative}):null}let K=(0,n.forwardRef)(({tooltip:e,children:n,className:r,...i},s)=>(0,t.jsx)("button",{ref:s,type:"button",title:e,className:(0,l.cn)("text-muted-foreground hover:text-foreground hover:bg-muted inline-flex h-7 w-7 items-center justify-center rounded-md transition-colors","[&>svg]:h-3.5 [&>svg]:w-3.5",r),...i,children:n}));function J(){return(0,t.jsxs)(d.ComposerPrimitive.Root,{className:"flex items-end gap-2 border-t p-3",children:[(0,t.jsx)(d.ComposerPrimitive.AddAttachment,{asChild:!0,children:(0,t.jsx)(K,{tooltip:"Attach file",className:"mb-0.5",children:(0,t.jsx)(w.Paperclip,{})})}),(0,t.jsx)(d.ComposerPrimitive.Input,{rows:1,autoFocus:!0,placeholder:"Write a message...",className:(0,l.cn)("bg-muted min-h-[40px] flex-1 resize-none rounded-xl border-0 px-4 py-2.5 text-sm","focus:ring-ring/30 focus:ring-2 focus:outline-none","placeholder:text-muted-foreground/60","max-h-40 overflow-y-auto")}),(0,t.jsx)(Q,{})]})}function Q(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.ThreadPrimitive.If,{running:!1,children:(0,t.jsx)(d.ComposerPrimitive.Send,{className:(0,l.cn)("bg-primary text-primary-foreground inline-flex h-[40px] w-[40px] shrink-0 items-center justify-center rounded-xl","hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-30","transition-colors"),children:(0,t.jsx)(b.SendHorizontal,{className:"size-4"})})}),(0,t.jsx)(p.ThreadPrimitive.If,{running:!0,children:(0,t.jsx)(d.ComposerPrimitive.Cancel,{className:(0,l.cn)("bg-destructive/10 text-destructive inline-flex h-[40px] w-[40px] shrink-0 items-center justify-center rounded-xl","hover:bg-destructive/20","transition-colors"),children:(0,t.jsx)(v.CircleStop,{className:"size-4"})})})]})}K.displayName="IconButton";var G=e.i(31151),Y=e.i(41413),X=e.i(38048);class Z{_contextProvider=new X.CompositeContextProvider;registerModelContextProvider(e){return this._contextProvider.registerModelContextProvider(e)}getModelContextProvider(){return this._contextProvider}}let ee=Object.freeze([]),et="DEFAULT_THREAD_ID",en=Object.freeze([et]),er=Object.freeze({id:et,remoteId:void 0,externalId:void 0,status:"regular"}),ei=Promise.resolve(),es=Object.freeze({[et]:er});class eo{adapter;threadFactory;_mainThreadId=et;_threads=en;_archivedThreads=ee;_threadData=es;get isLoading(){return this.adapter.isLoading??!1}get newThreadId(){}get threadIds(){return this._threads}get archivedThreadIds(){return this._archivedThreads}get threadItems(){return this._threadData}getLoadThreadsPromise(){return ei}_mainThread;get mainThreadId(){return this._mainThreadId}constructor(e={},t){this.adapter=e,this.threadFactory=t,this._mainThread=this.threadFactory(),this.__internal_setAdapter(e,!0)}getMainThreadRuntimeCore(){return this._mainThread}getThreadRuntimeCore(){throw Error("Method not implemented.")}getItemById(e){for(let t of this.adapter.threads??[])if(t.id===e)return t;for(let t of this.adapter.archivedThreads??[])if(t.id===e)return t;if(e===et)return er}__internal_setAdapter(e,t=!1){let n=this.adapter;this.adapter=e;let r=e.threadId??et,i=e.threads??ee,s=e.archivedThreads??ee,o=n.threadId??et,a=n.threads??ee,l=n.archivedThreads??ee;(t||o!==r||a!==i||l!==s)&&(this._threadData={...es,...Object.fromEntries(e.threads?.map(e=>[e.id,{...e,remoteId:e.remoteId,externalId:e.externalId,status:"regular"}])??[]),...Object.fromEntries(e.archivedThreads?.map(e=>[e.id,{...e,remoteId:e.remoteId,externalId:e.externalId,status:"archived"}])??[])},a!==i&&(this._threads=this.adapter.threads?.map(e=>e.id)??ee),l!==s&&(this._archivedThreads=this.adapter.archivedThreads?.map(e=>e.id)??ee),o!==r&&(this._mainThreadId=r,this._mainThread=this.threadFactory()),this._notifySubscribers())}async switchToThread(e){if(this._mainThreadId===e)return;let t=this.adapter.onSwitchToThread;if(!t)throw Error("External store adapter does not support switching to thread");await t(e)}async switchToNewThread(){let e=this.adapter.onSwitchToNewThread;if(!e)throw Error("External store adapter does not support switching to new thread");await e()}async rename(e,t){let n=this.adapter.onRename;if(!n)throw Error("External store adapter does not support renaming");await n(e,t)}async detach(){}async archive(e){let t=this.adapter.onArchive;if(!t)throw Error("External store adapter does not support archiving");await t(e)}async unarchive(e){let t=this.adapter.onUnarchive;if(!t)throw Error("External store adapter does not support unarchiving");await t(e)}async delete(e){let t=this.adapter.onDelete;if(!t)throw Error("External store adapter does not support deleting");await t(e)}initialize(e){return Promise.resolve({remoteId:e,externalId:void 0})}generateTitle(){throw Error("Method not implemented.")}_subscriptions=new Set;subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}_notifySubscribers(){for(let e of this._subscriptions)e()}}let ea=Symbol("innerMessage"),el=Symbol("innerMessages"),eu=[],ec=e=>{let t="messages"in e?e.messages:e,n=t[el]||t[ea];return n?Array.isArray(n)?n:(t[el]=[n],t[el]):eu};class ed{cache=new WeakMap;convertMessages(e,t){return e.map((e,n)=>{let r=t(this.cache.get(e),e,n);return this.cache.set(e,r),r})}}let eh=Symbol("autoStatus"),ep=Object.freeze(Object.assign({type:"running"},{[eh]:!0})),ef=Object.freeze(Object.assign({type:"complete",reason:"unknown"},{[eh]:!0})),em=Object.freeze(Object.assign({type:"requires-action",reason:"tool-calls"},{[eh]:!0})),eg=Object.freeze(Object.assign({type:"requires-action",reason:"interrupt"},{[eh]:!0})),ex=(e,t,n,r,i)=>e&&i?Object.assign({type:"incomplete",reason:"error",error:i},{[eh]:!0}):e&&t?ep:n?eg:r?em:ef;var ey=e.i(78598);let eb=Symbol("aui.parse-partial-json-object.meta"),ev=((e,t=21)=>(n=t)=>{let r="",i=0|n;for(;i--;)r+=e[Math.random()*e.length|0];return r})("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7),ek=()=>`__optimistic__${ev()}`,ew=(e,t)=>{if(e.startsWith("data-"))return{type:"data",name:e.substring(5),data:t}},eS=(e,t,n)=>{let{role:r,id:i,createdAt:s,attachments:o,status:a,metadata:l}=e,u={id:i??t,createdAt:s??new Date},c="string"==typeof e.content?[{type:"text",text:e.content}]:e.content;if("user"!==r&&o?.length)throw Error("attachments are only supported for user messages");if("assistant"!==r&&a)throw Error("status is only supported for assistant messages");if("assistant"!==r&&l?.steps)throw Error("metadata.steps is only supported for assistant messages");switch(r){case"assistant":return{...u,role:r,content:c.map(e=>{let t=e.type;switch(t){case"text":case"reasoning":if(0===e.text.trim().length)return null;return e;case"file":case"source":case"data":return e;case"image":return(({image:e,...t})=>e.match(/^data:image\/(png|jpeg|jpg|gif|webp);base64,(.*)$/)?{...t,image:e}:(console.warn("Invalid image data format detected"),null))(e);case"tool-call":{let{parentId:t,messages:n,...r}=e,i={...r,toolCallId:e.toolCallId??`tool-${ev()}`,...void 0!==t&&{parentId:t},...void 0!==n&&{messages:n}};if(e.args)return{...i,args:e.args,argsText:e.argsText??JSON.stringify(e.args)};return{...i,args:(e=>{if(0===e.length)return{[eb]:{state:"partial",partialPath:[]}};try{let t=ey.default.parse(e);if("object"!=typeof t||null===t)throw Error("argsText is expected to be an object");return t[eb]={state:"complete",partialPath:[]},t}catch{try{let[t,n]=function(e){let t,n=["ROOT"],r=-1,i=null,s=[];function o(){void 0!==t&&(s.push(JSON.parse(`"${t}"`)),t=void 0)}function a(e,t,s){switch(e){case'"':r=t,n.pop(),n.push(s),n.push("INSIDE_STRING"),o();break;case"f":case"t":case"n":r=t,i=t,n.pop(),n.push(s),n.push("INSIDE_LITERAL");break;case"-":n.pop(),n.push(s),n.push("INSIDE_NUMBER"),o();break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r=t,n.pop(),n.push(s),n.push("INSIDE_NUMBER"),o();break;case"{":r=t,n.pop(),n.push(s),n.push("INSIDE_OBJECT_START"),o();break;case"[":r=t,n.pop(),n.push(s),n.push("INSIDE_ARRAY_START"),o()}}function l(e,i){switch(e){case",":n.pop(),n.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":r=i,n.pop(),t=s.pop()}}function u(e,i){switch(e){case",":n.pop(),n.push("INSIDE_ARRAY_AFTER_COMMA"),t=(Number(t)+1).toString();break;case"]":r=i,n.pop(),t=s.pop()}}for(let o=0;o<e.length;o++){let c=e[o];switch(n[n.length-1]){case"ROOT":a(c,o,"FINISH");break;case"INSIDE_OBJECT_START":switch(c){case'"':n.pop(),n.push("INSIDE_OBJECT_KEY"),t="";break;case"}":r=o,n.pop(),t=s.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":'"'===c&&(n.pop(),n.push("INSIDE_OBJECT_KEY"),t="");break;case"INSIDE_OBJECT_KEY":switch(c){case'"':n.pop(),n.push("INSIDE_OBJECT_AFTER_KEY");break;case"\\":n.push("INSIDE_STRING_ESCAPE"),t+=c;break;default:t+=c}break;case"INSIDE_OBJECT_AFTER_KEY":":"===c&&(n.pop(),n.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":a(c,o,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":l(c,o);break;case"INSIDE_STRING":switch(c){case'"':n.pop(),r=o,t=s.pop();break;case"\\":n.push("INSIDE_STRING_ESCAPE");break;default:r=o}break;case"INSIDE_ARRAY_START":"]"===c?(r=o,n.pop(),t=s.pop()):(r=o,t="0",a(c,o,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(c){case",":n.pop(),n.push("INSIDE_ARRAY_AFTER_COMMA"),t=(Number(t)+1).toString();break;case"]":r=o,n.pop(),t=s.pop();break;default:r=o}break;case"INSIDE_ARRAY_AFTER_COMMA":a(c,o,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":n.pop(),"INSIDE_STRING"===n[n.length-1]?r=o:"INSIDE_OBJECT_KEY"===n[n.length-1]&&(t+=c);break;case"INSIDE_NUMBER":switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r=o;break;case"e":case"E":case"-":case".":break;case",":n.pop(),t=s.pop(),"INSIDE_ARRAY_AFTER_VALUE"===n[n.length-1]&&u(c,o),"INSIDE_OBJECT_AFTER_VALUE"===n[n.length-1]&&l(c,o);break;case"}":n.pop(),t=s.pop(),"INSIDE_OBJECT_AFTER_VALUE"===n[n.length-1]&&l(c,o);break;case"]":n.pop(),t=s.pop(),"INSIDE_ARRAY_AFTER_VALUE"===n[n.length-1]&&u(c,o);break;default:n.pop(),t=s.pop()}break;case"INSIDE_LITERAL":{let t=e.substring(i,o+1);"false".startsWith(t)||"true".startsWith(t)||"null".startsWith(t)?r=o:(n.pop(),"INSIDE_OBJECT_AFTER_VALUE"===n[n.length-1]?l(c,o):"INSIDE_ARRAY_AFTER_VALUE"===n[n.length-1]&&u(c,o))}}}let c=e.slice(0,r+1);for(let t=n.length-1;t>=0;t--)switch(n[t]){case"INSIDE_STRING":c+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":c+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":c+="]";break;case"INSIDE_LITERAL":{let t=e.substring(i,e.length);"true".startsWith(t)?c+="true".slice(t.length):"false".startsWith(t)?c+="false".slice(t.length):"null".startsWith(t)&&(c+="null".slice(t.length))}}return[c,s]}(e),r=ey.default.parse(t);if("object"!=typeof r||null===r)throw Error("argsText is expected to be an object");return r[eb]={state:"partial",partialPath:n},r}catch{return}}})(e.argsText??"")??{},argsText:e.argsText??""}}default:{let n=ew(t,e.data);if(n)return n;throw Error(`Unsupported assistant message part type: ${t}`)}}}).filter(e=>!!e),status:a??n,metadata:{unstable_state:l?.unstable_state??null,unstable_annotations:l?.unstable_annotations??[],unstable_data:l?.unstable_data??[],custom:l?.custom??{},steps:l?.steps??[],...l?.timing&&{timing:l.timing},...l?.submittedFeedback&&{submittedFeedback:l.submittedFeedback}}};case"user":return{...u,role:r,content:c.map(e=>{let t=e.type;switch(t){case"text":case"image":case"audio":case"file":case"data":return e;default:{let n=ew(t,e.data);if(n)return n;throw Error(`Unsupported user message part type: ${t}`)}}}),attachments:(o??[]).map(e=>({...e,content:e.content.map(e=>ew(e.type,e.data)??e)})),metadata:{custom:l?.custom??{}}};case"system":if(1!==c.length||"text"!==c[0].type)throw Error("System messages must have exactly one text message part.");return{...u,role:r,content:c,metadata:{custom:l?.custom??{}}};default:throw Error(`Unknown message role: ${r}`)}},e_=e=>e.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n\n"),eE=e=>{let t=e.map(e=>eS(e,ev(),ex(!1,!1,!1,!1,void 0)));return{messages:t.map((e,n)=>({parentId:n>0?t[n-1].id:null,message:e}))}},eC=e=>e.next?eC(e.next):"current"in e?e:null;class eT{func;_value=null;constructor(e){this.func=e}get value(){return null===this._value&&(this._value=this.func()),this._value}dirty(){this._value=null}}class ej{messages=new Map;head=null;root={children:[],next:null};updateLevels(e,t){for(let n of(e.level=t,e.children)){let e=this.messages.get(n);e&&this.updateLevels(e,t+1)}}performOp(e,t,n){let r=t.prev??this.root,i=e??this.root;if("relink"!==n||r!==i){if("link"!==n&&(r.children=r.children.filter(e=>e!==t.current.id),r.next===t)){let e=r.children.at(-1),t=e?this.messages.get(e):null;if(void 0===t)throw Error("MessageRepository(performOp/cut): Fallback sibling message not found. This is likely an internal bug in assistant-ui.");r.next=t}if("cut"!==n){for(let n=e;n;n=n.prev)if(n.current.id===t.current.id)throw Error("MessageRepository(performOp/link): A message with the same id already exists in the parent tree. This error occurs if the same message id is found multiple times. This is likely an internal bug in assistant-ui.");i.children=[...i.children,t.current.id],(eC(t)===this.head||null===i.next)&&(i.next=t),t.prev=e;let n=e?e.level+1:0;this.updateLevels(t,n)}}}_messages=new eT(()=>{let e=Array((this.head?.level??-1)+1);for(let t=this.head;t;t=t.prev)e[t.level]=t.current;return e});get headId(){return this.head?.current.id??null}getMessages(e){if(void 0===e||e===this.head?.current.id)return this._messages.value;let t=this.messages.get(e);if(!t)throw Error("MessageRepository(getMessages): Head message not found. This is likely an internal bug in assistant-ui.");let n=Array(t.level+1);for(let e=t;e;e=e.prev)n[e.level]=e.current;return n}addOrUpdateMessage(e,t){let n=this.messages.get(t.id),r=e?this.messages.get(e):null;if(void 0===r)throw Error("MessageRepository(addOrUpdateMessage): Parent message not found. This is likely an internal bug in assistant-ui.");if(n){n.current=t,this.performOp(r,n,"relink"),this._messages.dirty();return}let i={prev:r,current:t,next:null,children:[],level:r?r.level+1:0};this.messages.set(t.id,i),this.performOp(r,i,"link"),this.head===r&&(this.head=i),this._messages.dirty()}getMessage(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui.");return{parentId:t.prev?.current.id??null,message:t.current,index:t.level}}appendOptimisticMessage(e,t){let n;do n=ek();while(this.messages.has(n))return this.addOrUpdateMessage(e,eS(t,n,{type:"running"})),n}deleteMessage(e,t){let n=this.messages.get(e);if(!n)throw Error("MessageRepository(deleteMessage): Message not found. This is likely an internal bug in assistant-ui.");let r=void 0===t?n.prev:null===t?null:this.messages.get(t);if(void 0===r)throw Error("MessageRepository(deleteMessage): Replacement not found. This is likely an internal bug in assistant-ui.");for(let e of n.children){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui.");this.performOp(r,t,"relink")}this.performOp(null,n,"cut"),this.messages.delete(e),this.head===n&&(this.head=eC(r??this.root)),this._messages.dirty()}getBranches(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(getBranches): Message not found. This is likely an internal bug in assistant-ui.");let{children:n}=t.prev??this.root;return n}switchToBranch(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(switchToBranch): Branch not found. This is likely an internal bug in assistant-ui.");(t.prev??this.root).next=t,this.head=eC(t),this._messages.dirty()}resetHead(e){if(null===e)return void this.clear();let t=this.messages.get(e);if(!t)throw Error("MessageRepository(resetHead): Branch not found. This is likely an internal bug in assistant-ui.");if(t.children.length>0){let e=t=>{for(let n of t.children){let t=this.messages.get(n);t&&(e(t),this.messages.delete(n))}};e(t),t.children=[],t.next=null}this.head=t;for(let e=t;e;e=e.prev)e.prev?e.prev.next=e:this.root.next=e;this._messages.dirty()}clear(){this.messages.clear(),this.head=null,this.root={children:[],next:null},this._messages.dirty()}export(){let e=[];for(let[,t]of this.messages)e.push({message:t.current,parentId:t.prev?.current.id??null});return{headId:this.head?.current.id??null,messages:e}}import({headId:e,messages:t}){for(let{message:e,parentId:n}of t)this.addOrUpdateMessage(n,e);this.resetHead(e??t.at(-1)?.message.id??null)}}let eI=Symbol("skip-update");class eA{_subscribers=new Set;subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}waitForUpdate(){return new Promise(e=>{let t=this.subscribe(()=>{t(),e()})})}_notifySubscribers(){let e=[];for(let t of this._subscribers)try{t()}catch(t){e.push(t)}if(e.length>0)if(1===e.length)throw e[0];else{for(let t of e)console.error(t);throw AggregateError(e)}}}class eR{_subscriptions=new Set;_connection;get isConnected(){return!!this._connection}notifySubscribers(){for(let e of this._subscriptions)e()}_updateConnection(){this._subscriptions.size>0?this._connection||(this._connection=this._connect()):(this._connection?.(),this._connection=void 0)}subscribe(e){return this._subscriptions.add(e),this._updateConnection(),()=>{this._subscriptions.delete(e),this._updateConnection()}}}class eM extends eR{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e;const t=e.getState();if(t===eI)throw Error("Entry not available in the store");this._previousState=t}_previousState;getState=()=>(this.isConnected||this._syncState(),this._previousState);_syncState(){let e=this.binding.getState();return!(e===eI||function(e,t){if(void 0===e&&void 0===t)return!0;if(void 0===e||void 0===t)return!1;for(let n of Object.keys(e))if(!Object.is(e[n],t[n]))return!1;return!0}(e,this._previousState))&&(this._previousState=e,!0)}_connect(){let e=()=>{this._syncState()&&this.notifySubscribers()};return this.binding.subscribe(e)}}class eN extends eR{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e}_previousStateDirty=!0;_previousState;getState=()=>{if(!this.isConnected||this._previousStateDirty){let e=this.binding.getState();e!==eI&&(this._previousState=e),this._previousStateDirty=!1}if(void 0===this._previousState)throw Error("Entry not available in the store");return this._previousState};_connect(){let e=()=>{this._previousStateDirty=!0,this.notifySubscribers()};return this.binding.subscribe(e)}}class eP extends eR{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e}getState(){return this.binding.getState()}outerSubscribe(e){return this.binding.subscribe(e)}_connect(){let e=()=>{this.notifySubscribers()},t=this.binding.getState(),n=t?.subscribe(e),r=()=>{let r=this.binding.getState();r!==t&&(t=r,n?.(),n=r?.subscribe(e),e())},i=this.outerSubscribe(r);return()=>{i?.(),n?.()}}}class eD extends eR{config;constructor(e){super(),this.config=e}getState(){return this.config.binding.getState()}outerSubscribe(e){return this.config.binding.subscribe(e)}_connect(){let e=()=>{this.notifySubscribers()},t=this.config.binding.getState(),n=t?.unstable_on(this.config.event,e),r=()=>{let r=this.config.binding.getState();r!==t&&(t=r,n?.(),n=r?.unstable_on(this.config.event,e))},i=this.outerSubscribe(r);return()=>{i?.(),n?.()}}}class eO extends eA{isEditing=!0;get attachmentAccept(){return this.getAttachmentAdapter()?.accept??"*"}_attachments=[];get attachments(){return this._attachments}setAttachments(e){this._attachments=e,this._notifySubscribers()}get isEmpty(){return!this.text.trim()&&!this.attachments.length}_text="";get text(){return this._text}_role="user";get role(){return this._role}_runConfig={};get runConfig(){return this._runConfig}_quote=void 0;get quote(){return this._quote}setQuote(e){this._quote!==e&&(this._quote=e,this._notifySubscribers())}setText(e){if(this._text!==e){if(this._text=e,this._dictation){this._dictationBaseText=e,this._currentInterimText="";let{status:t,inputDisabled:n}=this._dictation;this._dictation=n?{status:t,inputDisabled:n}:{status:t}}this._notifySubscribers()}}setRole(e){this._role!==e&&(this._role=e,this._notifySubscribers())}setRunConfig(e){this._runConfig!==e&&(this._runConfig=e,this._notifySubscribers())}_emptyTextAndAttachments(){this._attachments=[],this._text="",this._notifySubscribers()}async _onClearAttachments(){let e=this.getAttachmentAdapter();if(e){let t=this._attachments.filter(e=>"complete"!==e.status.type);await Promise.all(t.map(t=>e.remove(t)))}}async reset(){if(0===this._attachments.length&&""===this._text&&"user"===this._role&&0===Object.keys(this._runConfig).length&&void 0===this._quote)return;this._role="user",this._runConfig={},this._quote=void 0;let e=this._onClearAttachments();this._emptyTextAndAttachments(),await e}async clearAttachments(){let e=this._onClearAttachments();this.setAttachments([]),await e}async send(){if(this.isEmpty)return;this._dictationSession&&(this._dictationSession.cancel(),this._cleanupDictation());let e=this.getAttachmentAdapter(),t=this.attachments.length>0?Promise.all(this.attachments.map(async t=>{if("complete"===t.status.type)return t;if(!e)throw Error("Attachments are not supported");return await e.send(t)})):[],n=this.text,r=this._quote;this._quote=void 0,this._emptyTextAndAttachments();let i={createdAt:new Date,role:this.role,content:n?[{type:"text",text:n}]:[],attachments:await t,runConfig:this.runConfig,metadata:{custom:{...r?{quote:r}:{}}}};this.handleSend(i),this._notifyEventSubscribers("send")}cancel(){this.handleCancel()}async addAttachment(e){if(!(e instanceof File)){let t={id:e.id??ev(),type:e.type??"document",name:e.name,contentType:e.contentType,content:e.content,status:{type:"complete"}};this._attachments=[...this._attachments,t],this._notifyEventSubscribers("attachmentAdd"),this._notifySubscribers();return}let t=this.getAttachmentAdapter();if(!t)throw Error("Attachments are not supported");let n=e=>{let t=this._attachments.findIndex(t=>t.id===e.id);-1!==t?this._attachments=[...this._attachments.slice(0,t),e,...this._attachments.slice(t+1)]:this._attachments=[...this._attachments,e],this._notifySubscribers()},r=t.add({file:e});if(Symbol.asyncIterator in r)for await(let e of r)n(e);else n(await r);this._notifyEventSubscribers("attachmentAdd"),this._notifySubscribers()}async removeAttachment(e){let t=this._attachments.findIndex(t=>t.id===e);if(-1===t)throw Error("Attachment not found");let n=this._attachments[t];if("complete"!==n.status.type){let e=this.getAttachmentAdapter();if(!e)throw Error("Attachments are not supported");await e.remove(n)}this._attachments=this._attachments.filter(t=>t.id!==e),this._notifySubscribers()}_dictation;_dictationSession;_dictationUnsubscribes=[];_dictationBaseText="";_currentInterimText="";_dictationSessionIdCounter=0;_activeDictationSessionId;_isCleaningDictation=!1;get dictation(){return this._dictation}_isActiveSession(e,t){return this._activeDictationSessionId===e&&this._dictationSession===t}startDictation(){let e=this.getDictationAdapter();if(!e)throw Error("Dictation adapter not configured");if(this._dictationSession){for(let e of this._dictationUnsubscribes)e();this._dictationUnsubscribes=[],this._dictationSession.stop().catch(()=>{}),this._dictationSession=void 0}let t=e.disableInputDuringDictation??!1;this._dictationBaseText=this._text,this._currentInterimText="";let n=e.listen();this._dictationSession=n;let r=++this._dictationSessionIdCounter;this._activeDictationSessionId=r,this._dictation={status:n.status,inputDisabled:t},this._notifySubscribers();let i=n.onSpeech(e=>{if(!this._isActiveSession(r,n))return;let t=!1!==e.isFinal,i=this._dictationBaseText&&!this._dictationBaseText.endsWith(" ")&&e.transcript?" ":"";if(t){if(this._dictationBaseText=this._dictationBaseText+i+e.transcript,this._currentInterimText="",this._text=this._dictationBaseText,this._dictation){let{transcript:e,...t}=this._dictation;this._dictation=t}this._notifySubscribers()}else this._currentInterimText=i+e.transcript,this._text=this._dictationBaseText+this._currentInterimText,this._dictation&&(this._dictation={...this._dictation,transcript:e.transcript}),this._notifySubscribers()});this._dictationUnsubscribes.push(i);let s=n.onSpeechStart(()=>{this._isActiveSession(r,n)&&(this._dictation={status:{type:"running"},inputDisabled:t,...this._dictation?.transcript&&{transcript:this._dictation.transcript}},this._notifySubscribers())});this._dictationUnsubscribes.push(s);let o=n.onSpeechEnd(()=>{this._cleanupDictation({sessionId:r})});this._dictationUnsubscribes.push(o);let a=setInterval(()=>{this._isActiveSession(r,n)&&"ended"===n.status.type&&this._cleanupDictation({sessionId:r})},100);this._dictationUnsubscribes.push(()=>clearInterval(a))}stopDictation(){if(!this._dictationSession)return;let e=this._dictationSession,t=this._activeDictationSessionId;e.stop().finally(()=>{this._cleanupDictation({sessionId:t})})}_cleanupDictation(e){if((e?.sessionId===void 0||e.sessionId===this._activeDictationSessionId)&&!this._isCleaningDictation){this._isCleaningDictation=!0;try{for(let e of this._dictationUnsubscribes)e();this._dictationUnsubscribes=[],this._dictationSession=void 0,this._activeDictationSessionId=void 0,this._dictation=void 0,this._dictationBaseText="",this._currentInterimText="",this._notifySubscribers()}finally{this._isCleaningDictation=!1}}}_eventSubscribers=new Map;_notifyEventSubscribers(e){let t=this._eventSubscribers.get(e);if(t)for(let e of t)e()}unstable_on(e,t){let n=this._eventSubscribers.get(e);return n?n.add(t):this._eventSubscribers.set(e,new Set([t])),()=>{let n=this._eventSubscribers.get(e);n&&n.delete(t)}}}class eB extends eO{runtime;_canCancel=!1;get canCancel(){return this._canCancel}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}constructor(e){super(),this.runtime=e,this.connect()}connect(){return this.runtime.subscribe(()=>{this.canCancel!==this.runtime.capabilities.cancel&&(this._canCancel=this.runtime.capabilities.cancel,this._notifySubscribers())})}async handleSend(e){this.runtime.append({...e,parentId:this.runtime.messages.at(-1)?.id??null,sourceId:null})}async handleCancel(){this.runtime.cancelRun()}}class eL extends eO{runtime;endEditCallback;get canCancel(){return!0}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}_nonTextParts;_previousText;_parentId;_sourceId;constructor(e,t,{parentId:n,message:r}){super(),this.runtime=e,this.endEditCallback=t,this._parentId=n,this._sourceId=r.id,this._previousText=e_(r),this.setText(this._previousText),this.setRole(r.role),this.setAttachments(r.attachments??[]),this._nonTextParts=r.content.filter(e=>"text"!==e.type),this.setRunConfig({...e.composer.runConfig})}async handleSend(e){e_(e)!==this._previousText&&this.runtime.append({...e,content:[...e.content,...this._nonTextParts],parentId:this._parentId,sourceId:this._sourceId}),this.handleCancel()}handleCancel(){this.endEditCallback(),this._notifySubscribers()}}class eF{_contextProvider;_subscriptions=new Set;_isInitialized=!1;repository=new ej;get messages(){return this.repository.getMessages()}get state(){let e;for(let t of this.messages)"assistant"===t.role&&(e=t);return e?.metadata.unstable_state??null}composer=new eB(this);constructor(e){this._contextProvider=e}getModelContext(){return this._contextProvider.getModelContext()}_editComposers=new Map;getEditComposer(e){return this._editComposers.get(e)}beginEdit(e){if(this._editComposers.has(e))throw Error("Edit already in progress");this._editComposers.set(e,new eL(this,()=>this._editComposers.delete(e),this.repository.getMessage(e))),this._notifySubscribers()}getMessageById(e){try{return this.repository.getMessage(e)}catch{return}}getBranches(e){return this.repository.getBranches(e)}switchToBranch(e){this.repository.switchToBranch(e),this._notifySubscribers()}_notifySubscribers(){for(let e of this._subscriptions)e()}_notifyEventSubscribers(e){let t=this._eventSubscribers.get(e);if(t)for(let e of t)e()}subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}submitFeedback({messageId:e,type:t}){let n=this.adapters?.feedback;if(!n)throw Error("Feedback adapter not configured");let{message:r,parentId:i}=this.repository.getMessage(e);if(n.submit({message:r,type:t}),"assistant"===r.role){let e={...r,metadata:{...r.metadata,submittedFeedback:{type:t}}};this.repository.addOrUpdateMessage(i,e)}this._notifySubscribers()}_stopSpeaking;speech;speak(e){let t=this.adapters?.speech;if(!t)throw Error("Speech adapter not configured");let{message:n}=this.repository.getMessage(e);this._stopSpeaking?.();let r=t.speak(e_(n)),i=r.subscribe(()=>{"ended"===r.status.type?(this._stopSpeaking=void 0,this.speech=void 0):this.speech={messageId:e,status:r.status},this._notifySubscribers()});this.speech={messageId:e,status:r.status},this._notifySubscribers(),this._stopSpeaking=()=>{r.cancel(),i(),this.speech=void 0,this._stopSpeaking=void 0}}stopSpeaking(){if(!this._stopSpeaking)throw Error("No message is being spoken");this._stopSpeaking(),this._notifySubscribers()}ensureInitialized(){this._isInitialized||(this._isInitialized=!0,this._notifyEventSubscribers("initialize"))}export(){return this.repository.export()}import(e){this.ensureInitialized(),this.repository.clear(),this.repository.import(e),this._notifySubscribers()}reset(e){this.import(eE(e??[]))}_eventSubscribers=new Map;unstable_on(e,t){if("modelContextUpdate"===e)return this._contextProvider.subscribe?.(t)??(()=>{});let n=this._eventSubscribers.get(e);return n?n.add(t):this._eventSubscribers.set(e,new Set([t])),()=>{this._eventSubscribers.get(e).delete(t)}}}let ez=Object.freeze([]),eU=(e,t)=>{let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0};class e$ extends eF{_assistantOptimisticId=null;_capabilities={switchToBranch:!1,switchBranchDuringRun:!1,edit:!1,reload:!1,cancel:!1,unstable_copy:!1,speech:!1,dictation:!1,attachments:!1,feedback:!1};get capabilities(){return this._capabilities}_messages;isDisabled;get isLoading(){return this._store.isLoading??!1}get messages(){return this._messages}get state(){return this._store.state??super.state}get adapters(){return this._store.adapters}suggestions=[];extras=void 0;_converter=new ed;_store;beginEdit(e){if(!this._store.onEdit)throw Error("Runtime does not support editing.");super.beginEdit(e)}constructor(e,t){super(e),this.__internal_setAdapter(t)}__internal_setAdapter(e){let t,n;if(this._store===e)return;let r=e.isRunning??!1;this.isDisabled=e.isDisabled??!1;let i=this._store;this._store=e,this.extras!==e.extras&&(this.extras=e.extras);let s=e.suggestions??ez;eU(this.suggestions,s)||(this.suggestions=s);let o={switchToBranch:void 0!==this._store.setMessages,switchBranchDuringRun:!1,edit:void 0!==this._store.onEdit,reload:void 0!==this._store.onReload,cancel:void 0!==this._store.onCancel,speech:this._store.adapters?.speech!==void 0,dictation:this._store.adapters?.dictation!==void 0,unstable_copy:this._store.unstable_capabilities?.copy!==!1,attachments:!!this._store.adapters?.attachments,feedback:!!this._store.adapters?.feedback};if(eU(this._capabilities,o)||(this._capabilities=o),e.messageRepository){if(i&&i.isRunning===e.isRunning&&i.messageRepository===e.messageRepository)return void this._notifySubscribers();this.repository.clear(),this._assistantOptimisticId=null,this.repository.import(e.messageRepository),t=this.repository.getMessages()}else if(e.messages){if(i){if(i.convertMessage!==e.convertMessage)this._converter=new ed;else if(i.isRunning===e.isRunning&&i.messages===e.messages)return void this._notifySubscribers()}t=e.convertMessage?this._converter.convertMessages(e.messages,(t,n,i)=>{if(!e.convertMessage)return n;let s=ex(i===(e.messages?.length??0)-1,r,!1,!1,void 0);if(t&&("assistant"!==t.role||!0!==t.status[eh]||t.status===s))return t;let o=eS(e.convertMessage(n,i),i.toString(),s);return ea in o||(o[ea]=n),o}):e.messages;for(let e=0;e<t.length;e++){let n=t[e],r=t[e-1];this.repository.addOrUpdateMessage(r?.id??null,n)}}else throw Error("ExternalStoreAdapter must provide either 'messages' or 'messageRepository'");t.length>0&&this.ensureInitialized(),(i?.isRunning??!1)!==(e.isRunning??!1)&&(e.isRunning?this._notifyEventSubscribers("runStart"):this._notifyEventSubscribers("runEnd")),this._assistantOptimisticId&&(this.repository.deleteMessage(this._assistantOptimisticId),this._assistantOptimisticId=null),n=t,r&&n[n.length-1]?.role!=="assistant"&&(this._assistantOptimisticId=this.repository.appendOptimisticMessage(t.at(-1)?.id??null,{role:"assistant",content:[]})),this.repository.resetHead(this._assistantOptimisticId??t.at(-1)?.id??null),this._messages=this.repository.getMessages(),this._notifySubscribers()}switchToBranch(e){if(!this._store.setMessages)throw Error("Runtime does not support switching branches.");this._store.isRunning||(this.repository.switchToBranch(e),this.updateMessages(this.repository.getMessages()))}async append(e){if(e.parentId!==(this.messages.at(-1)?.id??null)){if(!this._store.onEdit)throw Error("Runtime does not support editing messages.");await this._store.onEdit(e)}else await this._store.onNew(e)}async startRun(e){if(!this._store.onReload)throw Error("Runtime does not support reloading messages.");await this._store.onReload(e.parentId,e)}async resumeRun(e){if(!this._store.onResume)throw Error("Runtime does not support resuming runs.");await this._store.onResume(e)}exportExternalState(){if(!this._store.onExportExternalState)throw Error("Runtime does not support exporting external states.");return this._store.onExportExternalState()}importExternalState(e){if(!this._store.onLoadExternalState)throw Error("Runtime does not support importing external states.");this._store.onLoadExternalState(e)}unstable_loadExternalState(e){this.importExternalState(e)}cancelRun(){if(!this._store.onCancel)throw Error("Runtime does not support cancelling runs.");this._store.onCancel(),this._assistantOptimisticId&&(this.repository.deleteMessage(this._assistantOptimisticId),this._assistantOptimisticId=null);let e=this.repository.getMessages(),t=e[e.length-1];t?.role==="user"&&t.id===e.at(-1)?.id?(this.repository.deleteMessage(t.id),this.composer.text.trim()||this.composer.setText(e_(t)),e=this.repository.getMessages()):this._notifySubscribers(),setTimeout(()=>{this.updateMessages(e)},0)}addToolResult(e){if(!this._store.onAddToolResult&&!this._store.onAddToolResult)throw Error("Runtime does not support tool results.");this._store.onAddToolResult?.(e)}resumeToolCall(e){if(!this._store.onResumeToolCall)throw Error("Runtime does not support resuming tool calls.");this._store.onResumeToolCall(e)}reset(e){let t=new ej;t.import(eE(e??[])),this.updateMessages(t.getMessages())}import(e){this._assistantOptimisticId=null,super.import(e),this._store.onImport&&this._store.onImport(this.repository.getMessages())}updateMessages=e=>{void 0!==this._store.convertMessage?this._store.setMessages?.(e.flatMap(ec)):this._store.setMessages?.(e)}}let eq=e=>e.adapters?.threadList??{};class eH extends Z{threads;constructor(e){super(),this.threads=new eo(eq(e),()=>new e$(this._contextProvider,e))}setAdapter(e){this.threads.__internal_setAdapter(eq(e)),this.threads.getMainThreadRuntimeCore().__internal_setAdapter(e)}}class eV{_core;_threadListBinding;get path(){return this._core.path}constructor(e,t){this._core=e,this._threadListBinding=t,this.__internal_bindMethods()}__internal_bindMethods(){this.switchTo=this.switchTo.bind(this),this.rename=this.rename.bind(this),this.archive=this.archive.bind(this),this.unarchive=this.unarchive.bind(this),this.delete=this.delete.bind(this),this.initialize=this.initialize.bind(this),this.generateTitle=this.generateTitle.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getState=this.getState.bind(this),this.detach=this.detach.bind(this)}getState(){return this._core.getState()}switchTo(){let e=this._core.getState();return this._threadListBinding.switchToThread(e.id)}rename(e){let t=this._core.getState();return this._threadListBinding.rename(t.id,e)}archive(){let e=this._core.getState();return this._threadListBinding.archive(e.id)}unarchive(){let e=this._core.getState();return this._threadListBinding.unarchive(e.id)}delete(){let e=this._core.getState();return this._threadListBinding.delete(e.id)}initialize(){let e=this._core.getState();return this._threadListBinding.initialize(e.id)}generateTitle(){let e=this._core.getState();return this._threadListBinding.generateTitle(e.id)}unstable_on(e,t){let n=this._core.getState().isMain,r=this._core.getState().id;return this.subscribe(()=>{let i=this._core.getState(),s=i.isMain,o=i.id;n===s&&r===o||(n=s,r=o,"switchedTo"===e&&!s||"switchedAway"===e&&s||t())})}subscribe(e){return this._core.subscribe(e)}detach(){let e=this._core.getState();this._threadListBinding.detach(e.id)}__internal_getRuntime(){return this}}class eW{_core;get path(){return this._core.path}constructor(e){this._core=e,this.__internal_bindMethods()}__internal_bindMethods(){this.getState=this.getState.bind(this),this.remove=this.remove.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this._core.getState()}subscribe(e){return this._core.subscribe(e)}}class eK extends eW{_composerApi;constructor(e,t){super(e),this._composerApi=t}remove(){let e=this._composerApi.getState();if(!e)throw Error("Composer is not available");return e.removeAttachment(this.getState().id)}}class eJ extends eK{get source(){return"thread-composer"}}class eQ extends eK{get source(){return"edit-composer"}}class eG extends eW{get source(){return"message"}constructor(e){super(e)}remove(){throw Error("Message attachments cannot be removed")}}let eY=Object.freeze([]),eX=Object.freeze({});class eZ{_core;get path(){return this._core.path}constructor(e){this._core=e}__internal_bindMethods(){this.setText=this.setText.bind(this),this.setRunConfig=this.setRunConfig.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.addAttachment=this.addAttachment.bind(this),this.reset=this.reset.bind(this),this.clearAttachments=this.clearAttachments.bind(this),this.send=this.send.bind(this),this.cancel=this.cancel.bind(this),this.setRole=this.setRole.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.startDictation=this.startDictation.bind(this),this.stopDictation=this.stopDictation.bind(this),this.setQuote=this.setQuote.bind(this),this.unstable_on=this.unstable_on.bind(this)}setText(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setText(e)}setRunConfig(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setRunConfig(e)}addAttachment(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");return t.addAttachment(e)}reset(){let e=this._core.getState();if(!e)throw Error("Composer is not available");return e.reset()}clearAttachments(){let e=this._core.getState();if(!e)throw Error("Composer is not available");return e.clearAttachments()}send(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.send()}cancel(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.cancel()}setRole(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setRole(e)}startDictation(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.startDictation()}stopDictation(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.stopDictation()}setQuote(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setQuote(e)}subscribe(e){return this._core.subscribe(e)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new eD({event:e,binding:this._core}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}}class e0 extends eZ{get path(){return this._core.path}get type(){return"thread"}_getState;constructor(e){const t=new eN({path:e.path,getState:()=>{let t;return t=e.getState(),Object.freeze({type:"thread",isEditing:t?.isEditing??!1,canCancel:t?.canCancel??!1,isEmpty:t?.isEmpty??!0,attachments:t?.attachments??eY,text:t?.text??"",role:t?.role??"user",runConfig:t?.runConfig??eX,attachmentAccept:t?.attachmentAccept??"",dictation:t?.dictation,quote:t?.quote,value:t?.text??""})},subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>t.subscribe(e)}),this._getState=t.getState.bind(t),this.__internal_bindMethods()}getState(){return this._getState()}getAttachmentByIndex(e){return new eJ(new eM({path:{...this.path,attachmentSource:"thread-composer",attachmentSelector:{type:"index",index:e},ref:`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:"thread-composer"}:eI},subscribe:e=>this._core.subscribe(e)}),this._core)}}class e1 extends eZ{_beginEdit;get path(){return this._core.path}get type(){return"edit"}_getState;constructor(e,t){const n=new eN({path:e.path,getState:()=>{let t;return t=e.getState(),Object.freeze({type:"edit",isEditing:t?.isEditing??!1,canCancel:t?.canCancel??!1,isEmpty:t?.isEmpty??!0,text:t?.text??"",role:t?.role??"user",attachments:t?.attachments??eY,runConfig:t?.runConfig??eX,attachmentAccept:t?.attachmentAccept??"",dictation:t?.dictation,quote:t?.quote,value:t?.text??""})},subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>n.subscribe(e)}),this._beginEdit=t,this._getState=n.getState.bind(n),this.__internal_bindMethods()}__internal_bindMethods(){super.__internal_bindMethods(),this.beginEdit=this.beginEdit.bind(this)}getState(){return this._getState()}beginEdit(){this._beginEdit()}getAttachmentByIndex(e){return new eQ(new eM({path:{...this.path,attachmentSource:"edit-composer",attachmentSelector:{type:"index",index:e},ref:`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:"edit-composer"}:eI},subscribe:e=>this._core.subscribe(e)}),this._core)}}let e2=Symbol.for("aui.tool-response");class e5{get[e2](){return!0}artifact;result;isError;messages;constructor(e){void 0!==e.artifact&&(this.artifact=e.artifact),this.result=e.result,this.isError=e.isError??!1,void 0!==e.messages&&(this.messages=e.messages)}static[Symbol.hasInstance](e){return"object"==typeof e&&null!==e&&e2 in e}static toResponse(e){return e instanceof e5?e:new e5({result:void 0===e?"<no result>":e})}}class e3{contentBinding;messageApi;threadApi;get path(){return this.contentBinding.path}constructor(e,t,n){this.contentBinding=e,this.messageApi=t,this.threadApi=n,this.__internal_bindMethods()}__internal_bindMethods(){this.addToolResult=this.addToolResult.bind(this),this.resumeToolCall=this.resumeToolCall.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this.contentBinding.getState()}addToolResult(e){let t=this.contentBinding.getState();if(!t)throw Error("Message part is not available");if("tool-call"!==t.type)throw Error("Tried to add tool result to non-tool message part");if(!this.messageApi)throw Error("Message API is not available. This is likely a bug in assistant-ui.");if(!this.threadApi)throw Error("Thread API is not available");let n=this.messageApi.getState();if(!n)throw Error("Message is not available");let r=t.toolName,i=t.toolCallId,s=e5.toResponse(e);this.threadApi.getState().addToolResult({messageId:n.id,toolName:r,toolCallId:i,result:s.result,artifact:s.artifact,isError:s.isError})}resumeToolCall(e){let t=this.contentBinding.getState();if(!t)throw Error("Message part is not available");if("tool-call"!==t.type)throw Error("Tried to resume tool call on non-tool message part");if(!this.threadApi)throw Error("Thread API is not available");let n=t.toolCallId;this.threadApi.getState().resumeToolCall({toolCallId:n,payload:e})}subscribe(e){return this.contentBinding.subscribe(e)}}let e4=Object.freeze({type:"complete"}),e6=(e,t)=>{let n=e.content[t];if(!n)return eI;let r=((e,t,n)=>{if("assistant"!==e.role)return e4;if("tool-call"===n.type)if(!n.result)return e.status;else return e4;let r=t===Math.max(0,e.content.length-1);return"requires-action"===e.status.type?e4:r?e.status:e4})(e,t,n);return Object.freeze({...n,...{[ea]:n[ea]},status:r})};class e8{_core;_threadBinding;get path(){return this._core.path}constructor(e,t){this._core=e,this._threadBinding=t,this.composer=new e1(new eP({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.composer`,composerSource:"edit"},getState:this._getEditComposerRuntimeCore,subscribe:e=>this._threadBinding.subscribe(e)}),()=>this._threadBinding.getState().beginEdit(this._core.getState().id)),this.__internal_bindMethods()}__internal_bindMethods(){this.reload=this.reload.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getMessagePartByIndex=this.getMessagePartByIndex.bind(this),this.getMessagePartByToolCallId=this.getMessagePartByToolCallId.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.unstable_getCopyText=this.unstable_getCopyText.bind(this),this.speak=this.speak.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.submitFeedback=this.submitFeedback.bind(this),this.switchToBranch=this.switchToBranch.bind(this)}composer;_getEditComposerRuntimeCore=()=>this._threadBinding.getState().getEditComposer(this._core.getState().id);getState(){return this._core.getState()}reload(e={}){let t=this._getEditComposerRuntimeCore(),n=t??this._threadBinding.getState().composer,{runConfig:r=(t??n).runConfig}=e,i=this._core.getState();if("assistant"!==i.role)throw Error("Can only reload assistant messages");this._threadBinding.getState().startRun({parentId:i.parentId,sourceId:i.id,runConfig:r})}speak(){let e=this._core.getState();return this._threadBinding.getState().speak(e.id)}stopSpeaking(){let e=this._core.getState(),t=this._threadBinding.getState();if(t.speech?.messageId===e.id)this._threadBinding.getState().stopSpeaking();else throw Error("Message is not being spoken")}submitFeedback({type:e}){let t=this._core.getState();this._threadBinding.getState().submitFeedback({messageId:t.id,type:e})}switchToBranch({position:e,branchId:t}){let n=this._core.getState();if(t&&e)throw Error("May not specify both branchId and position");if(!t&&!e)throw Error("Must specify either branchId or position");let r=this._threadBinding.getState().getBranches(n.id),i=t;if("previous"===e?i=r[n.branchNumber-2]:"next"===e&&(i=r[n.branchNumber]),!i)throw Error("Branch not found");this._threadBinding.getState().switchToBranch(i)}unstable_getCopyText(){return e_(this.getState())}subscribe(e){return this._core.subscribe(e)}getMessagePartByIndex(e){if(e<0)throw Error("Message part index must be >= 0");return new e3(new eM({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.content[${e}]`,messagePartSelector:{type:"index",index:e}},getState:()=>e6(this.getState(),e),subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getMessagePartByToolCallId(e){return new e3(new eM({path:{...this.path,ref:this.path.ref+`${this.path.ref}.content[toolCallId=${JSON.stringify(e)}]`,messagePartSelector:{type:"toolCallId",toolCallId:e}},getState:()=>{let t=this._core.getState(),n=t.content.findIndex(t=>"tool-call"===t.type&&t.toolCallId===e);return -1===n?eI:e6(t,n)},subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getAttachmentByIndex(e){return new eG(new eM({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.attachments[${e}]`,attachmentSource:"message",attachmentSelector:{type:"index",index:e}},getState:()=>{let t=this.getState().attachments,n=t?.[e];return n?{...n,source:"message"}:eI},subscribe:e=>this._core.subscribe(e)}))}}class e9{get path(){return this._threadBinding.path}get __internal_threadBinding(){return this._threadBinding}_threadBinding;constructor(e,t){const n=new eM({path:e.path,getState:()=>{var n,r;let i;return n=e.getState(),r=t.getState(),i=n.messages.at(-1),Object.freeze({threadId:r.id,metadata:r,capabilities:n.capabilities,isDisabled:n.isDisabled,isLoading:n.isLoading,isRunning:i?.role==="assistant"&&"running"===i.status.type,messages:n.messages,state:n.state,suggestions:n.suggestions,extras:n.extras,speech:n.speech})},subscribe:n=>{let r=e.subscribe(n),i=t.subscribe(n);return()=>{r(),i()}}});this._threadBinding={path:e.path,getState:()=>e.getState(),getStateState:()=>n.getState(),outerSubscribe:t=>e.outerSubscribe(t),subscribe:t=>e.subscribe(t)},this.composer=new e0(new eP({path:{...this.path,ref:`${this.path.ref}.composer`,composerSource:"thread"},getState:()=>this._threadBinding.getState().composer,subscribe:e=>this._threadBinding.subscribe(e)})),this.__internal_bindMethods()}__internal_bindMethods(){this.append=this.append.bind(this),this.resumeRun=this.resumeRun.bind(this),this.unstable_resumeRun=this.unstable_resumeRun.bind(this),this.unstable_loadExternalState=this.unstable_loadExternalState.bind(this),this.importExternalState=this.importExternalState.bind(this),this.exportExternalState=this.exportExternalState.bind(this),this.startRun=this.startRun.bind(this),this.cancelRun=this.cancelRun.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.export=this.export.bind(this),this.import=this.import.bind(this),this.reset=this.reset.bind(this),this.getMessageByIndex=this.getMessageByIndex.bind(this),this.getMessageById=this.getMessageById.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getModelContext=this.getModelContext.bind(this),this.getModelConfig=this.getModelConfig.bind(this),this.getState=this.getState.bind(this)}composer;getState(){return this._threadBinding.getStateState()}append(e){var t;this._threadBinding.getState().append((t=this._threadBinding.getState().messages,"string"==typeof e?{createdAt:new Date,parentId:t.at(-1)?.id??null,sourceId:null,runConfig:{},role:"user",content:[{type:"text",text:e}],attachments:[],metadata:{custom:{}}}:{createdAt:e.createdAt??new Date,parentId:e.parentId??t.at(-1)?.id??null,sourceId:e.sourceId??null,role:e.role??"user",content:e.content,attachments:e.attachments??[],metadata:e.metadata??{custom:{}},runConfig:e.runConfig??{},startRun:e.startRun}))}subscribe(e){return this._threadBinding.subscribe(e)}getModelContext(){return this._threadBinding.getState().getModelContext()}getModelConfig(){return this.getModelContext()}startRun(e){let t;return this._threadBinding.getState().startRun({parentId:(t=null===e||"string"==typeof e?{parentId:e}:e).parentId??null,sourceId:t.sourceId??null,runConfig:t.runConfig??{}})}resumeRun(e){return this._threadBinding.getState().resumeRun({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{},...e.stream?{stream:e.stream}:{}})}unstable_resumeRun(e){return this.resumeRun(e)}exportExternalState(){return this._threadBinding.getState().exportExternalState()}importExternalState(e){this._threadBinding.getState().importExternalState(e)}unstable_loadExternalState(e){this._threadBinding.getState().unstable_loadExternalState(e)}cancelRun(){this._threadBinding.getState().cancelRun()}stopSpeaking(){return this._threadBinding.getState().stopSpeaking()}export(){return this._threadBinding.getState().export()}import(e){this._threadBinding.getState().import(e)}reset(e){this._threadBinding.getState().reset(e)}getMessageByIndex(e){if(e<0)throw Error("Message index must be >= 0");return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[${e}]`,messageSelector:{type:"index",index:e}},()=>{let t=this._threadBinding.getState().messages,n=t[e];if(n)return{message:n,parentId:t[e-1]?.id??null,index:e}})}getMessageById(e){return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[messageId=${JSON.stringify(e)}]`,messageSelector:{type:"messageId",messageId:e}},()=>this._threadBinding.getState().getMessageById(e))}_getMessageRuntime(e,t){return new e8(new eM({path:e,getState:()=>{let{message:e,parentId:n,index:r}=t()??{},{messages:i,speech:s}=this._threadBinding.getState();if(!e||void 0===n||void 0===r)return eI;let o=this._threadBinding.getState().getBranches(e.id),a=e.metadata.submittedFeedback;return{...e,...{[ea]:e[ea]},index:r,isLast:i.at(-1)?.id===e.id,parentId:n,branchNumber:o.indexOf(e.id)+1,branchCount:o.length,speech:s?.messageId===e.id?s:void 0,submittedFeedback:a}},subscribe:e=>this._threadBinding.subscribe(e)}),this._threadBinding)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new eD({event:e,binding:this._threadBinding}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}}let e7=(e,t)=>{if(void 0===t)return eI;let n=e.getItemById(t);return n?{id:n.id,remoteId:n.remoteId,externalId:n.externalId,title:n.title,status:n.status,isMain:n.id===e.mainThreadId}:eI};class te{_core;_runtimeFactory;_getState;constructor(e,t=e9){this._core=e,this._runtimeFactory=t;const n=new eN({path:{},getState:()=>({mainThreadId:e.mainThreadId,newThreadId:e.newThreadId,threadIds:e.threadIds,archivedThreadIds:e.archivedThreadIds,isLoading:e.isLoading,threadItems:e.threadItems}),subscribe:t=>e.subscribe(t)});this._getState=n.getState.bind(n),this._mainThreadListItemRuntime=new eV(new eM({path:{ref:"threadItems[main]",threadSelector:{type:"main"}},getState:()=>e7(this._core,this._core.mainThreadId),subscribe:e=>this._core.subscribe(e)}),this._core),this.main=new t(new eP({path:{ref:"threads.main",threadSelector:{type:"main"}},getState:()=>e.getMainThreadRuntimeCore(),subscribe:t=>e.subscribe(t)}),this._mainThreadListItemRuntime),this.__internal_bindMethods()}__internal_bindMethods(){this.switchToThread=this.switchToThread.bind(this),this.switchToNewThread=this.switchToNewThread.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getById=this.getById.bind(this),this.getItemById=this.getItemById.bind(this),this.getItemByIndex=this.getItemByIndex.bind(this),this.getArchivedItemByIndex=this.getArchivedItemByIndex.bind(this)}switchToThread(e){return this._core.switchToThread(e)}switchToNewThread(){return this._core.switchToNewThread()}getState(){return this._getState()}subscribe(e){return this._core.subscribe(e)}_mainThreadListItemRuntime;main;get mainItem(){return this._mainThreadListItemRuntime}getById(e){return new this._runtimeFactory(new eP({path:{ref:`threads[threadId=${JSON.stringify(e)}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>this._core.getThreadRuntimeCore(e),subscribe:e=>this._core.subscribe(e)}),this.mainItem)}getItemByIndex(e){return new eV(new eM({path:{ref:`threadItems[${e}]`,threadSelector:{type:"index",index:e}},getState:()=>e7(this._core,this._core.threadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getArchivedItemByIndex(e){return new eV(new eM({path:{ref:`archivedThreadItems[${e}]`,threadSelector:{type:"archiveIndex",index:e}},getState:()=>e7(this._core,this._core.archivedThreadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getItemById(e){return new eV(new eM({path:{ref:`threadItems[threadId=${e}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>e7(this._core,e),subscribe:e=>this._core.subscribe(e)}),this._core)}}class tt{_core;threads;get threadList(){return this.threads}_thread;constructor(e){this._core=e,this.threads=new te(e.threads),this._thread=this.threads.main,this.__internal_bindMethods()}__internal_bindMethods(){this.switchToNewThread=this.switchToNewThread.bind(this),this.switchToThread=this.switchToThread.bind(this),this.registerModelContextProvider=this.registerModelContextProvider.bind(this),this.registerModelConfigProvider=this.registerModelConfigProvider.bind(this),this.reset=this.reset.bind(this)}get thread(){return this._thread}switchToNewThread(){return this._core.threads.switchToNewThread()}switchToThread(e){return this._core.threads.switchToThread(e)}registerModelContextProvider(e){return this._core.registerModelContextProvider(e)}registerModelConfigProvider(e){return this.registerModelContextProvider(e)}reset({initialMessages:e}={}){return this._core.threads.getMainThreadRuntimeCore().import(eE(e??[]))}}let tn=(0,n.createContext)(null);var tr=e.i(62885),ti=e.i(87975),ts=e.i(6786),to=e.i(77501),ta=e.i(3),tl=class extends to.Subscribable{#e;#s=void 0;#o;#a;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#l()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,ta.shallowEqualObjects)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#o,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,ta.hashKey)(t.mutationKey)!==(0,ta.hashKey)(this.options.mutationKey)?this.reset():this.#o?.state.status==="pending"&&this.#o.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#o?.removeObserver(this)}onMutationUpdate(e){this.#l(),this.#u(e)}getCurrentResult(){return this.#s}reset(){this.#o?.removeObserver(this),this.#o=void 0,this.#l(),this.#u()}mutate(e,t){return this.#a=t,this.#o?.removeObserver(this),this.#o=this.#e.getMutationCache().build(this.#e,this.options),this.#o.addObserver(this),this.#o.execute(e)}#l(){let e=this.#o?.state??(0,ti.getDefaultState)();this.#s={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#u(e){ts.notifyManager.batch(()=>{if(this.#a&&this.hasListeners()){let t=this.#s.variables,n=this.#s.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#a.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#a.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#a.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#a.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#s)})})}},tu=e.i(34682),tc=e.i(17406);function td(e){return["chat-messages",e]}async function th(e){let t=await fetch(`/api/interactive/chat/${e}/messages`);if(!t.ok)throw console.error(`[ChatState] fetch failed: ${t.status}`,await t.text().catch(()=>"")),Error(`Failed to fetch chat state: ${t.status}`);return t.json()}async function tp(e,t,n,r,i){let s=await fetch(`/api/interactive/chat/${e}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,worktreePath:n,model:r,agentType:i})});if(!s.ok)throw Error(`Failed to send message: ${s.status}`);return(await s.json()).message}function tf(e){return{id:e.id,role:e.role===tc.InteractiveMessageRole.user?"user":"assistant",content:[{type:"text",text:e.content}],createdAt:e.createdAt?new Date(e.createdAt):void 0}}e.s(["chatQueryKey",()=>td,"fetchChatState",()=>th],98440);var tm=e.i(2828);e.i(50032);var tg=e.i(86254);function tx({attachments:e,isDragOver:i,uploadError:s,onDragEnter:o,onDragLeave:a,onDragOver:u,onDrop:c,onPaste:h,onRemoveAttachment:p,onNotesChange:f,onPickFiles:m,agentPicker:g,disabled:x}){let{t:y}=(0,r.useTranslation)("web"),[b,v]=(0,n.useState)(!1),k=(0,n.useRef)(null);return(0,t.jsx)(d.ComposerPrimitive.Root,{className:(0,l.cn)("shrink-0 border-t p-3",x&&"pointer-events-none opacity-50"),children:(0,t.jsx)("div",{onDragEnter:o,onDragLeave:a,onDragOver:u,onDrop:c,className:(0,l.cn)("flex flex-col gap-1.5 rounded-md border-2 border-transparent p-1 transition-colors",i&&"border-primary/50 bg-primary/5"),children:(0,t.jsxs)("div",{ref:k,onFocus:()=>v(!0),onBlur:()=>v(!1),className:(0,l.cn)("border-input flex flex-col overflow-hidden rounded-md border shadow-xs transition-[color,box-shadow]",b&&"ring-ring/50 border-ring ring-[3px]"),children:[(0,t.jsx)(d.ComposerPrimitive.Input,{rows:1,autoFocus:!0,placeholder:y("chat.writeMessage"),onPaste:h,className:"max-h-[4.5rem] min-h-0 resize-none rounded-none border-0 px-3 py-2.5 text-sm shadow-none focus:outline-none focus-visible:ring-0"}),e.length>0?(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2",children:e.map(e=>(0,t.jsx)(tg.AttachmentChip,{name:e.name,size:e.size,mimeType:e.mimeType,path:e.path,onRemove:()=>p(e.id),loading:e.loading,notes:e.notes,onNotesChange:t=>f(e.id,t)},e.id))}):null,s?(0,t.jsx)("p",{className:"text-destructive px-3 pb-2 text-xs",children:s}):null,(0,t.jsxs)("div",{className:"border-input flex items-center gap-3 border-t px-3 py-1.5",children:[g,(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)(tm.Tooltip,{children:[(0,t.jsx)(tm.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:m,"aria-label":y("chat.attachFiles"),className:"text-muted-foreground hover:text-foreground cursor-pointer rounded p-1 transition-colors",children:(0,t.jsx)(w.Paperclip,{className:"h-4 w-4"})})}),(0,t.jsx)(tm.TooltipContent,{side:"top",children:y("chat.attachFiles")})]}),(0,t.jsx)(ty,{})]})]})})})}function ty(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.ThreadPrimitive.If,{running:!1,children:(0,t.jsx)(d.ComposerPrimitive.Send,{className:(0,l.cn)("bg-primary text-primary-foreground inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md","hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-30","transition-colors"),children:(0,t.jsx)(b.SendHorizontal,{className:"size-3.5"})})}),(0,t.jsx)(p.ThreadPrimitive.If,{running:!0,children:(0,t.jsx)(d.ComposerPrimitive.Cancel,{className:(0,l.cn)("bg-destructive/10 text-destructive inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md","hover:bg-destructive/20","transition-colors"),children:(0,t.jsx)(v.CircleStop,{className:"size-3.5"})})})]})}let tb=(0,e.i(3645).default)("message-circle-question-mark",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);function tv({interaction:e,onSubmit:n,className:r}){let i=e.questions.length>1;return(0,t.jsxs)("div",{className:(0,l.cn)("group flex w-full items-start gap-2.5 px-4 py-0.5",r),children:[(0,t.jsx)("div",{className:"bg-muted flex h-6 w-6 shrink-0 items-center justify-center rounded-full",children:(0,t.jsx)(tb,{className:"h-3.5 w-3.5 text-violet-600 dark:text-violet-400"})}),(0,t.jsx)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:(0,t.jsx)("div",{className:"text-foreground mt-px overflow-hidden rounded-2xl rounded-tl-sm border border-violet-200 bg-violet-50/50 text-sm leading-relaxed shadow-sm dark:border-violet-500/20 dark:bg-violet-950/20",children:i?(0,t.jsx)(tk,{questions:e.questions,onSubmit:n}):(0,t.jsx)("div",{className:"px-4 py-3",children:(0,t.jsx)(tS,{question:e.questions[0],onSubmit:n})})})})]})}function tk({questions:e,onSubmit:r}){let[i,s]=(0,n.useState)(0),[o,a]=(0,n.useState)(()=>{let t={};for(let n of e)t[n.question]={selectedOptions:new Set,otherText:"",isOtherSelected:!1};return t}),u=(0,n.useCallback)((e,t)=>{a(n=>({...n,[e]:t(n[e])}))},[]),c={};for(let t of e){let e=o[t.question];if(!e)continue;let n=[...e.selectedOptions];e.isOtherSelected&&e.otherText.trim()&&n.push(e.otherText.trim()),n.length>0&&(c[t.question]=n.join(", "))}let d=e.every(e=>c[e.question]),h=(0,n.useCallback)(()=>{d&&r(c)},[d,r,o]);return(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"flex border-b border-violet-200 dark:border-violet-500/20",children:e.map((e,n)=>{let r=n===i,o=!!c[e.question];return(0,t.jsxs)("button",{type:"button",onClick:()=>s(n),className:(0,l.cn)("relative flex items-center gap-1.5 px-4 py-2 text-xs font-medium transition-colors",r?"text-violet-700 dark:text-violet-300":"text-muted-foreground hover:text-foreground"),children:[o?(0,t.jsx)(I.Check,{className:"h-3 w-3 text-emerald-600 dark:text-emerald-400"}):(0,t.jsxs)("span",{className:"text-muted-foreground/50 text-[10px]",children:[n+1,"."]}),e.header,r?(0,t.jsx)("span",{className:"absolute inset-x-0 -bottom-px h-0.5 rounded-full bg-violet-600 dark:bg-violet-400"}):null]},e.question)})}),e.map((e,n)=>(0,t.jsx)("div",{className:"px-4 py-3",style:{display:n===i?void 0:"none"},children:(0,t.jsx)(tw,{question:e,selection:o[e.question],onSelectionChange:t=>u(e.question,t)})},e.question)),(0,t.jsxs)("div",{className:"flex items-center gap-3 border-t border-violet-200 px-4 py-2.5 dark:border-violet-500/20",children:[(0,t.jsxs)("button",{type:"button",onClick:h,disabled:!d,className:(0,l.cn)("inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium transition-all",d?"bg-violet-600 text-white shadow-sm hover:bg-violet-700 active:scale-[0.98] dark:bg-violet-600 dark:hover:bg-violet-500":"bg-muted text-muted-foreground cursor-not-allowed opacity-50"),children:[(0,t.jsx)(I.Check,{className:"h-3 w-3"}),"Submit all"]}),(0,t.jsxs)("span",{className:"text-muted-foreground text-[10px]",children:[Object.keys(c).length,"/",e.length," answered"]})]})]})}function tw({question:e,selection:r,onSelectionChange:i}){let s=(0,n.useCallback)(t=>{i(n=>{let r=new Set(n.selectedOptions);return e.multiSelect?(r.has(t)?r.delete(t):r.add(t),{...n,selectedOptions:r}):(r.clear(),r.add(t),{...n,selectedOptions:r,isOtherSelected:!1})})},[e.multiSelect,i]),o=(0,n.useCallback)(()=>{i(t=>e.multiSelect?{...t,isOtherSelected:!t.isOtherSelected}:{selectedOptions:new Set,otherText:t.otherText,isOtherSelected:!0})},[e.multiSelect,i]),a=(0,n.useCallback)(e=>{i(t=>({...t,otherText:e}))},[i]);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"text-foreground mb-2 text-xs font-medium",children:[e.question,e.multiSelect?(0,t.jsx)("span",{className:"text-muted-foreground ml-1 font-normal",children:"(select multiple)"}):null]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[e.options.map(n=>(0,t.jsx)(t_,{option:n,isSelected:r.selectedOptions.has(n.label),isMulti:e.multiSelect,onToggle:()=>s(n.label)},n.label)),(0,t.jsx)(tE,{isSelected:r.isOtherSelected,isMulti:e.multiSelect,text:r.otherText,onToggle:o,onTextChange:a})]})]})}function tS({question:e,onSubmit:r}){let[i,s]=(0,n.useState)(new Set),[o,a]=(0,n.useState)(""),[u,c]=(0,n.useState)(!1),d=(0,n.useCallback)(t=>{s(n=>{let r=new Set(n);return e.multiSelect?r.has(t)?r.delete(t):r.add(t):(r.clear(),r.add(t),c(!1)),r}),e.multiSelect||c(!1)},[e.multiSelect]),h=(0,n.useCallback)(()=>{e.multiSelect?c(e=>!e):(s(new Set),c(!0))},[e.multiSelect]),p=(0,n.useCallback)(()=>{let t=[...i];u&&o.trim()&&t.push(o.trim()),0!==t.length&&r({[e.question]:t.join(", ")})},[i,u,o,r,e.question]),f=i.size>0||u&&o.trim();return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"mb-2 flex items-start gap-2",children:[(0,t.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full bg-violet-100 px-2 py-0.5 text-[10px] font-semibold tracking-wider text-violet-700 uppercase dark:bg-violet-900/50 dark:text-violet-300",children:e.header}),(0,t.jsx)("span",{className:"font-medium",children:e.question})]}),(0,t.jsxs)("div",{className:"ml-0.5 flex flex-col gap-1.5",children:[e.options.map(n=>(0,t.jsx)(t_,{option:n,isSelected:i.has(n.label),isMulti:e.multiSelect,onToggle:()=>d(n.label)},n.label)),(0,t.jsx)(tE,{isSelected:u,isMulti:e.multiSelect,text:o,onToggle:h,onTextChange:a})]}),(0,t.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,t.jsxs)("button",{type:"button",onClick:p,disabled:!f,className:(0,l.cn)("inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium transition-all",f?"bg-violet-600 text-white shadow-sm hover:bg-violet-700 active:scale-[0.98] dark:bg-violet-600 dark:hover:bg-violet-500":"bg-muted text-muted-foreground cursor-not-allowed opacity-50"),children:[(0,t.jsx)(I.Check,{className:"h-3 w-3"}),"Submit"]}),e.multiSelect?(0,t.jsx)("span",{className:"text-muted-foreground text-[10px]",children:"Select one or more"}):null]})]})}function t_({option:e,isSelected:n,isMulti:r,onToggle:i}){return(0,t.jsxs)("button",{type:"button",onClick:i,className:(0,l.cn)("flex items-start gap-2.5 rounded-lg border px-3 py-2 text-left text-xs transition-all",n?"border-violet-300 bg-violet-100/60 shadow-sm dark:border-violet-500/40 dark:bg-violet-900/30":"border-border/50 hover:border-violet-300 hover:bg-violet-50 dark:hover:border-violet-500/30 dark:hover:bg-violet-900/10"),children:[(0,t.jsx)("span",{className:(0,l.cn)("mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center border transition-colors",r?"rounded":"rounded-full",n?"border-violet-600 bg-violet-600 dark:border-violet-500 dark:bg-violet-500":"border-muted-foreground/30"),children:n?(0,t.jsx)(I.Check,{className:"h-2.5 w-2.5 text-white",strokeWidth:3}):null}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,t.jsx)("span",{className:(0,l.cn)("font-medium",n&&"text-violet-700 dark:text-violet-300"),children:e.label}),(0,t.jsx)("span",{className:"text-muted-foreground text-[11px] leading-snug",children:e.description})]})]})}function tE({isSelected:e,isMulti:n,text:r,onToggle:i,onTextChange:s}){return(0,t.jsxs)("div",{className:(0,l.cn)("flex items-start gap-2.5 rounded-lg border px-3 py-2 text-xs transition-all",e?"border-violet-300 bg-violet-100/60 shadow-sm dark:border-violet-500/40 dark:bg-violet-900/30":"border-border/50 hover:border-violet-300 dark:hover:border-violet-500/30"),children:[(0,t.jsx)("button",{type:"button",onClick:i,className:"mt-0.5 shrink-0",children:(0,t.jsx)("span",{className:(0,l.cn)("flex h-4 w-4 items-center justify-center border transition-colors",n?"rounded":"rounded-full",e?"border-violet-600 bg-violet-600 dark:border-violet-500 dark:bg-violet-500":"border-muted-foreground/30"),children:e?(0,t.jsx)(I.Check,{className:"h-2.5 w-2.5 text-white",strokeWidth:3}):null})}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,t.jsx)("span",{className:(0,l.cn)("font-medium",e&&"text-violet-700 dark:text-violet-300"),children:"Other"}),e?(0,t.jsx)("input",{type:"text",value:r,onChange:e=>s(e.target.value),placeholder:"Type your answer...",className:"w-full rounded-md border border-violet-200 bg-white/80 px-2 py-1 text-xs outline-none focus:border-violet-400 focus:ring-1 focus:ring-violet-300/30 dark:border-violet-500/30 dark:bg-violet-950/30 dark:focus:border-violet-500/50 dark:focus:ring-violet-500/20",autoFocus:!0}):null]})]})}var tC=e.i(91967),tT=e.i(22528),tj=e.i(36589),tI=e.i(5192),tA=e.i(5978),tR=e.i(87620),tM=e.i(85995),tN=e.i(13123),tP="Collapsible",[tD,tO]=(0,tT.createContextScope)(tP),[tB,tL]=tD(tP),tF=n.forwardRef((e,r)=>{let{__scopeCollapsible:i,open:s,defaultOpen:o,disabled:a,onOpenChange:l,...u}=e,[c,d]=(0,tj.useControllableState)({prop:s,defaultProp:o??!1,onChange:l,caller:tP});return(0,t.jsx)(tB,{scope:i,disabled:a,contentId:(0,tN.useId)(),open:c,onOpenToggle:n.useCallback(()=>d(e=>!e),[d]),children:(0,t.jsx)(tR.Primitive.div,{"data-state":tV(c),"data-disabled":a?"":void 0,...u,ref:r})})});tF.displayName=tP;var tz="CollapsibleTrigger",tU=n.forwardRef((e,n)=>{let{__scopeCollapsible:r,...i}=e,s=tL(tz,r);return(0,t.jsx)(tR.Primitive.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":tV(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...i,ref:n,onClick:(0,tC.composeEventHandlers)(e.onClick,s.onOpenToggle)})});tU.displayName=tz;var t$="CollapsibleContent",tq=n.forwardRef((e,n)=>{let{forceMount:r,...i}=e,s=tL(t$,e.__scopeCollapsible);return(0,t.jsx)(tM.Presence,{present:r||s.open,children:({present:e})=>(0,t.jsx)(tH,{...i,ref:n,present:e})})});tq.displayName=t$;var tH=n.forwardRef((e,r)=>{let{__scopeCollapsible:i,present:s,children:o,...a}=e,l=tL(t$,i),[u,c]=n.useState(s),d=n.useRef(null),h=(0,tA.useComposedRefs)(r,d),p=n.useRef(0),f=p.current,m=n.useRef(0),g=m.current,x=l.open||u,y=n.useRef(x),b=n.useRef(void 0);return n.useEffect(()=>{let e=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,tI.useLayoutEffect)(()=>{let e=d.current;if(e){b.current=b.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();p.current=t.height,m.current=t.width,y.current||(e.style.transitionDuration=b.current.transitionDuration,e.style.animationName=b.current.animationName),c(s)}},[l.open,s]),(0,t.jsx)(tR.Primitive.div,{"data-state":tV(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!x,...a,ref:h,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:x&&o})});function tV(e){return e?"open":"closed"}e.s(["Collapsible",()=>tF,"CollapsibleContent",()=>tq,"CollapsibleTrigger",()=>tU,"Content",()=>tq,"Root",()=>tF,"Trigger",()=>tU,"createCollapsibleScope",()=>tO],75074);var tW=e.i(75074),tW=tW,tK=e.i(76016),tJ=e.i(95812),tQ=e.i(58481);let tG=(0,e.i(94237).cva)("animate-spinner inline-block rounded-full",{variants:{size:{sm:"size-4",md:"size-6",lg:"size-10"}},defaultVariants:{size:"md"}}),tY={sm:"3px",md:"4px",lg:"8px"};function tX({className:e,size:n="md",...r}){let i=tY[n??"md"];return(0,t.jsx)("div",{"data-slot":"spinner",role:"status","aria-label":"Loading",className:(0,l.cn)(tG({size:n}),e),style:{background:"conic-gradient(from 220deg, transparent 0%, currentColor 80%, transparent 100%)",WebkitMask:`radial-gradient(farthest-side, #0000 calc(100% - ${i}), #000 calc(100% - ${i} + 1px))`},...r})}let tZ={p:({children:e})=>(0,t.jsx)("p",{className:"mb-2 leading-relaxed last:mb-0",children:e}),strong:({children:e})=>(0,t.jsx)("strong",{className:"font-semibold",children:e}),em:({children:e})=>(0,t.jsx)("em",{className:"italic",children:e}),code:({children:e,className:n})=>n?(0,t.jsx)("code",{className:`${n} text-[11px]`,children:e}):(0,t.jsx)("code",{className:"bg-background/50 rounded-md px-1.5 py-0.5 font-mono text-[11px]",children:e}),pre:({children:e})=>(0,t.jsx)("pre",{className:"bg-background/50 my-2 overflow-x-auto rounded-md p-3 font-mono text-[11px] leading-relaxed",children:e}),ul:({children:e})=>(0,t.jsx)("ul",{className:"mb-2 list-disc ps-4 last:mb-0",children:e}),ol:({children:e})=>(0,t.jsx)("ol",{className:"mb-2 list-decimal ps-4 last:mb-0",children:e}),li:({children:e})=>(0,t.jsx)("li",{className:"mb-0.5",children:e}),h1:({children:e})=>(0,t.jsx)("h1",{className:"mb-1 text-sm font-bold",children:e}),h2:({children:e})=>(0,t.jsx)("h2",{className:"mb-1 text-sm font-bold",children:e}),h3:({children:e})=>(0,t.jsx)("h3",{className:"mb-1 text-xs font-semibold",children:e}),a:({children:e,href:n})=>(0,t.jsx)("a",{href:n,className:"text-blue-500 underline",target:"_blank",rel:"noopener noreferrer",children:e})};function t0({steps:e,className:r,collapsedSummary:i,activeStepId:s,liveStatus:o,onRetry:a}){let[u,c]=(0,n.useState)(!1);if(0===e.length)return null;if(i&&!u){let n=e.filter(e=>"done"===e.status).length;return(0,t.jsx)("div",{className:(0,l.cn)("p-4",r),children:(0,t.jsxs)("button",{type:"button",onClick:()=>c(!0),className:"hover:bg-muted/40 border-border bg-background flex w-full items-center gap-3 rounded-lg border px-3 py-2.5 text-left transition-colors dark:bg-neutral-800/50",children:[(0,t.jsx)("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-emerald-500 text-white",children:(0,t.jsx)(I.Check,{className:"h-4 w-4",strokeWidth:3})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:"Initial setup complete"}),(0,t.jsxs)("div",{className:"text-muted-foreground text-xs",children:[n," of ",e.length," steps finished — click to review"]})]}),(0,t.jsx)(tK.ChevronRight,{className:"text-muted-foreground h-4 w-4 shrink-0"})]})})}return(0,t.jsxs)("ol",{className:(0,l.cn)("flex flex-col gap-2 p-4",r),children:[i?(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",onClick:()=>c(!1),className:"text-muted-foreground hover:text-foreground mb-1 inline-flex items-center gap-1 text-[10px] tracking-wide uppercase",children:[(0,t.jsx)(C.ChevronDown,{className:"h-3 w-3"}),"Collapse setup"]})}):null,e.map((e,n)=>(0,t.jsx)(t1,{step:e,liveStatus:e.definition.id===s?o??null:null,mountIndex:n,onRetry:"interrupted"===e.status?a:void 0},e.definition.id))]})}function t1({step:e,liveStatus:r,mountIndex:i,onRetry:s}){let[o,a]=(0,n.useState)(!1);(0,n.useEffect)(()=>{"interrupted"!==e.status&&a(!1)},[e.status]);let u=o?"running":e.status,[c,d]=(0,n.useState)("interrupted"===e.status||"failed"===e.status),{definition:h,metadata:p,toolMessages:f}=e,g=function(e,t){if(!e)return[];let n=e[t];return Array.isArray(n)?n.filter(e=>"string"==typeof e):[]}(p,"details"),b=function(e,t){if(!e)return"";let n=e[t];return"string"==typeof n?n:""}(p,"error"),v=function(e){let t=[];for(let n of e){let e=n.content?.trim()??"";e&&((0,y.parseToolEvent)(e)?t.push({kind:"tool",message:n}):t.push({kind:"text",message:n}))}return t}(f),k=v.length>0||g.length>0||!!b||"interrupted"===u;return(0,t.jsx)(tW.Root,{asChild:!0,open:c,onOpenChange:d,children:(0,t.jsxs)("li",{className:(0,l.cn)("rounded-lg border transition-[background-color,border-color] duration-300 ease-out","animate-in fade-in-0 slide-in-from-top-2","running"===u&&"border-violet-500/40 bg-violet-500/5 dark:bg-violet-500/10","done"===u&&"border-border bg-background dark:bg-neutral-800/50","pending"===u&&"border-border/40 bg-muted/20 dark:bg-neutral-800/30","failed"===u&&"border-red-500/40 bg-red-500/5 dark:bg-red-500/10","interrupted"===u&&"border-amber-500/40 bg-amber-500/5 dark:bg-amber-500/10"),style:{animationDelay:`${40*Math.min(i,6)}ms`,animationDuration:"300ms"},children:[(0,t.jsx)(tW.Trigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",disabled:!k,className:(0,l.cn)("flex w-full items-center gap-3 px-3 py-1.5 text-left transition-colors duration-200",k&&"hover:bg-muted/40 cursor-pointer",!k&&"cursor-default"),children:[(0,t.jsx)(t2,{status:u}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-baseline gap-2",children:[(0,t.jsx)("span",{className:(0,l.cn)("shrink-0 truncate text-sm font-medium transition-colors duration-300","pending"===u&&"text-muted-foreground/60"),children:h.title}),"interrupted"===u?(0,t.jsx)("span",{className:"min-w-0 truncate text-xs font-medium text-amber-600 dark:text-amber-400",children:"Interrupted"}):r&&"running"===u?(0,t.jsxs)("span",{className:"flex min-w-0 items-baseline gap-1.5 text-xs text-violet-700 dark:text-violet-300",children:[(0,t.jsx)("span",{className:"inline-flex h-1 w-1 shrink-0 translate-y-[-1px] animate-pulse rounded-full bg-violet-500"}),(0,t.jsx)("span",{className:"animate-in fade-in-0 slide-in-from-left-1 truncate duration-300",children:r},r)]}):h.description?(0,t.jsx)("span",{className:(0,l.cn)("min-w-0 truncate text-xs font-normal","pending"===u?"text-muted-foreground/40":"text-muted-foreground/70"),children:h.description}):null]}),v.length>0?(0,t.jsx)("span",{className:"text-muted-foreground/60 animate-in fade-in-0 zoom-in-95 mr-1 shrink-0 text-[10px] tabular-nums duration-200",children:v.length},v.length):null,k?(0,t.jsx)(tK.ChevronRight,{className:(0,l.cn)("text-muted-foreground h-4 w-4 shrink-0 transition-transform duration-200 ease-out",c&&"rotate-90")}):null]})}),(0,t.jsx)(tW.Content,{className:(0,l.cn)("overflow-hidden","data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up"),children:(0,t.jsxs)("div",{className:"border-border/40 space-y-2 border-t px-3 py-2.5 text-xs",children:["interrupted"!==u||b?null:(0,t.jsxs)("div",{className:"flex items-center justify-between rounded bg-amber-500/10 p-2",children:[(0,t.jsx)("span",{className:"text-amber-700 dark:text-amber-400",children:"This step was interrupted before it could finish."}),s?(0,t.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),a(!0),d(!1),s()},className:"ms-3 shrink-0 cursor-pointer rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-1 text-[11px] font-medium text-amber-700 transition-colors hover:bg-amber-500/20 dark:text-amber-400",children:"Continue"}):null]}),b?(0,t.jsx)("p",{className:"rounded bg-red-500/10 p-2 text-red-600 dark:text-red-400",children:b}):null,g.length>0?(0,t.jsx)("ul",{className:"text-muted-foreground list-disc space-y-0.5 ps-4",children:g.map(e=>(0,t.jsx)("li",{children:e},e))}):null,v.length>0?(0,t.jsx)("div",{className:"-mx-1 flex flex-col gap-1",children:v.map((e,n)=>"tool"===e.kind?(0,t.jsx)("div",{className:"animate-in fade-in-0 slide-in-from-top-1 duration-200",style:{animationDelay:`${30*Math.min(n,6)}ms`},children:(0,t.jsx)(x.ToolBubble,{text:e.message.content})},e.message.id):(0,t.jsx)("div",{className:"text-foreground animate-in fade-in-0 slide-in-from-top-1 px-1 text-xs leading-relaxed duration-200",style:{animationDelay:`${30*Math.min(n,6)}ms`},children:(0,t.jsx)(m.default,{components:tZ,children:e.message.content})},e.message.id))}):null]})})]})})}function t2({status:e}){return"running"===e?(0,t.jsx)(tX,{size:"sm",className:"shrink-0 text-violet-500"}):"done"===e?(0,t.jsx)("div",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-emerald-500 text-white",children:(0,t.jsx)(I.Check,{className:"h-3 w-3",strokeWidth:3})}):"failed"===e?(0,t.jsx)("div",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-red-500 text-white",children:(0,t.jsx)(tQ.AlertTriangle,{className:"h-2.5 w-2.5",strokeWidth:3})}):"interrupted"===e?(0,t.jsx)("div",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-amber-500 text-white",children:(0,t.jsx)(tQ.AlertTriangle,{className:"h-2.5 w-2.5",strokeWidth:3})}):(0,t.jsx)(tJ.Circle,{className:"text-muted-foreground/30 h-4 w-4 shrink-0"})}function t5({featureId:e,worktreePath:r,initialAgent:s,initialModel:o,initialChatState:a,hideHeader:l,onAllStepsComplete:u,workflowPlaceholder:c,onResumeWorkflow:d}){let[h,p]=(0,n.useState)(s),[f,m]=(0,n.useState)(o),[g,x]=(0,n.useState)(!1),y=(0,G.useAttachments)(),{runtime:b,status:v,clearChat:k,sessionInfo:w,isChatLoading:S,pendingInteraction:_,respondToInteraction:E,stepProgress:C,initialRequestMessage:T}=function(e,t,r){let i=(0,tu.useQueryClient)(),s=(0,n.useRef)(r?.model),o=(0,n.useRef)(r?.agentType);s.current=r?.model,o.current=r?.agentType;let a=(0,n.useRef)(r?.debugMode??!1);a.current=r?.debugMode??!1;let[l,u]=(0,n.useState)([]),c=(0,n.useCallback)((e,t)=>{a.current&&u(n=>[...n,{id:`dbg-${Date.now()}-${Math.random()}`,timestamp:new Date,label:e,detail:t}])},[]),{data:d,isLoading:h}=(0,tr.useQuery)({queryKey:td(e),queryFn:()=>th(e),initialData:r?.initialChatState,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1});(0,n.useEffect)(()=>{d?.turnStatus==="unread"&&fetch(`/api/interactive/chat/${e}/mark-read`,{method:"POST"})},[d?.turnStatus,e]);let p=(0,n.useMemo)(()=>d?.messages??[],[d?.messages]),f=d?.sessionStatus??null,m=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(f&&f!==m.current){let e=d?.sessionInfo;c(`session_${f}`,e?`model=${e.model??"?"}, sid=${e.sessionId?.slice(0,8)??"?"}`:void 0)}m.current=f},[f,d?.sessionInfo,c]);let g=d?.streamingText??null,x=(0,n.useRef)(null);d?.sessionInfo&&(x.current=d.sessionInfo);let y=d?.sessionInfo??x.current,[b,v]=(0,n.useState)(""),[k,w]=(0,n.useState)(null),[S,_]=(0,n.useState)(!1),E=(0,n.useRef)(null),C=(0,n.useRef)(null),[T,j]=(0,n.useState)(null);(0,n.useEffect)(()=>{let e=d?.pendingInteraction??null;e?j(e):!e&&T&&j(null)},[d?.pendingInteraction,T]);let I=(0,n.useCallback)(()=>{E.current&&clearTimeout(E.current),E.current=setTimeout(()=>_(!0),600)},[]),A=(0,n.useCallback)(()=>{E.current&&(clearTimeout(E.current),E.current=null),_(!1)},[]),R=p.length>0?p[p.length-1].role:null;(0,n.useEffect)(()=>{R===tc.InteractiveMessageRole.assistant&&A()},[R,p.length,A]),(0,n.useEffect)(()=>{let t=new EventSource(`/api/interactive/chat/${e}/stream`);return C.current=t,t.addEventListener("delta",e=>{try{let t=JSON.parse(e.data);t.delta&&(A(),v(e=>e+t.delta),w(null))}catch{}}),t.addEventListener("activity",e=>{A();try{let t=JSON.parse(e.data);t.activity&&c(`[${t.activity.kind}] ${t.activity.label}`,t.activity.detail)}catch{}}),t.addEventListener("log",e=>{try{let t=JSON.parse(e.data);t.log&&(A(),w(t.log),c("log",t.log))}catch{}}),t.addEventListener("interaction",e=>{try{let t=JSON.parse(e.data);t.interaction&&(A(),j(t.interaction))}catch{}}),t.addEventListener("message",t=>{try{let r=JSON.parse(t.data);if(r.message){var n;n=r.message,i.setQueryData(td(e),e=>{let t=e??{messages:[],sessionStatus:null,streamingText:null,sessionInfo:null};if(t.messages.find(e=>e.id===n.id))return t;let r=t.messages.filter(e=>!(e.id.startsWith("optimistic-")&&e.role===n.role&&e.content===n.content));return{...t,messages:[...r,n]}}),r.message.role===tc.InteractiveMessageRole.assistant&&A()}}catch{}}),t.addEventListener("session_status",t=>{try{var n;let r=JSON.parse(t.data);r.sessionStatus&&(n=r.sessionStatus,i.setQueryData(td(e),e=>e?{...e,sessionStatus:n}:e))}catch{}}),t.addEventListener("turn_status",t=>{try{var n;let r=JSON.parse(t.data);r.turnStatus&&(n=r.turnStatus,i.setQueryData(td(e),e=>e?{...e,turnStatus:n}:e))}catch{}}),t.addEventListener("workflow_step",t=>{try{let n=JSON.parse(t.data);if(!n.step)return;i.setQueryData(td(e),e=>{let t;if(!e)return e;let r=e.workflow,i=r?.steps.findIndex(e=>e.id===n.step.id)??-1;r&&-1!==i?(t=r.steps.slice())[i]=n.step:t=[...r?.steps??[],n.step].sort((e,t)=>e.stepIndex-t.stepIndex);let s=t.find(e=>"running"===e.status);return{...e,workflow:{workflowId:n.step.workflowId,steps:t,currentStepId:s?.id??null}}})}catch{}}),t.addEventListener("done",()=>{w(null),A(),c("turn_done"),j(null),v("")}),t.addEventListener("open",()=>{i.invalidateQueries({queryKey:td(e)})}),t.onerror=()=>{},()=>{t.close(),C.current=null}},[e,i,A,c]);let M=function(e,t){let r=(0,tu.useQueryClient)(void 0),[i]=n.useState(()=>new tl(r,e));n.useEffect(()=>{i.setOptions(e)},[i,e]);let s=n.useSyncExternalStore(n.useCallback(e=>i.subscribe(ts.notifyManager.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),o=n.useCallback((e,t)=>{i.mutate(e,t).catch(ta.noop)},[i]);if(s.error&&(0,ta.shouldThrowError)(i.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}({mutationFn:n=>tp(e,n,t??"",s.current,o.current),onMutate:async t=>{c("send_message",`model=${s.current??"default"}, agent=${o.current??"default"}, len=${t.length}`),I(),await i.cancelQueries({queryKey:td(e)});let n=i.getQueryData(td(e));return i.setQueryData(td(e),n=>({...n??{sessionStatus:"booting",sessionInfo:null},messages:[...n?.messages??[],{id:`optimistic-${Date.now()}`,featureId:e,role:tc.InteractiveMessageRole.user,content:t,createdAt:new Date,updatedAt:new Date}],streamingText:null})),{previous:n}},onError:(t,n,r)=>{r?.previous&&i.setQueryData(td(e),r.previous)},onSettled:()=>{i.invalidateQueries({queryKey:td(e)})}}),N=d?.turnStatus,P=S||!!b||!!k||"booting"===f||"processing"===N,D=b??g??"",O=(0,n.useMemo)(()=>{let e=d?.workflow??null;if(!e||0===e.steps.length)return{hasPlan:!1,steps:[],activeStepId:null,allDone:!1,liveStatus:null};let t=new Map;for(let e of p){let n=e.stepId;if(!n||e.role!==tc.InteractiveMessageRole.assistant)continue;let r=t.get(n)??[];r.push(e),t.set(n,r)}let n=e.steps.map(e=>({definition:{id:e.id,stepKey:e.stepKey,title:e.title,description:e.description},status:function(e){switch(e){case"pending":case"running":case"done":case"failed":case"interrupted":return e;default:return"pending"}}(e.status),metadata:function(e){if(!e)return null;try{let t=JSON.parse(e);return t&&"object"==typeof t&&!Array.isArray(t)?t:null}catch{return null}}(e.metadata),toolMessages:t.get(e.id)??[]})),r=n.length>0&&n.every(e=>"done"===e.status),i=g?.trim()??"",s=b?.trim()??"",o=(s||i).split("\n")[0]?.slice(0,80)??"",a=null;return r?a=null:k?a=k:o?a=o:("processing"===N||S||"booting"===f)&&(a="booting"===f?"Waking up…":"Thinking…"),{hasPlan:!0,steps:n,activeStepId:e.currentStepId,allDone:r,liveStatus:a}},[d?.workflow,p,k,b,g,N,S,f]),B=(0,n.useMemo)(()=>O.hasPlan?p.find(e=>e.role===tc.InteractiveMessageRole.user&&!e.stepId)??null:null,[O.hasPlan,p]),L=(0,n.useMemo)(()=>{let e,t=O.hasPlan,n=t&&!O.allDone,i=(t?p.filter(e=>e.id!==B?.id&&!e.stepId&&(!n||e.role!==tc.InteractiveMessageRole.assistant)):p).map(tf);if(r?.debugMode&&l.length>0){let t=l.map(e=>({id:e.id,role:"assistant",content:[{type:"text",text:e.detail?`🔧 **${e.label}** — ${e.detail}`:`🔧 **${e.label}**`}],createdAt:e.timestamp}));e=[];let n=0,r=0;for(;n<i.length&&r<t.length;)(i[n].createdAt?new Date(i[n].createdAt).getTime():0)<=(t[r].createdAt?new Date(t[r].createdAt).getTime():0)?e.push(i[n++]):e.push(t[r++]);for(;n<i.length;)e.push(i[n++]);for(;r<t.length;)e.push(t[r++])}else e=i;if(t)return e;if(D.trim()){let t=[{type:"text",text:D}];k&&t.push({type:"text",text:`*⏳ ${k}*`}),e.push({id:"streaming",role:"assistant",content:t})}else k?e.push({id:"streaming",role:"assistant",content:[{type:"text",text:`*⏳ ${k}*`}]}):(S||"booting"===f)&&e.push({id:"streaming",role:"assistant",content:[{type:"text",text:"booting"===f?"*Agent is waking up...*":"*Thinking...*"}]});return e},[p,B?.id,D,S,f,k,r?.debugMode,l,O.hasPlan,O.allDone]),F=(0,n.useMemo)(()=>P?{isRunning:!0,statusText:k}:{isRunning:!1,statusText:null},[P,k]),z=(0,n.useCallback)(async e=>{let t=e.content.find(e=>"text"===e.type);if(t?.type!=="text"||!t.text.trim())return;let n=r?.contentTransform?r.contentTransform(t.text):t.text;M.mutate(n,{onSuccess:()=>r?.onMessageSent?.()})},[M,r]),U=(0,n.useCallback)(async()=>{let t=await fetch(`/api/interactive/chat/${e}/messages`,{method:"DELETE"});if(!t.ok)throw Error(`Failed to clear chat: ${t.status}`);v(""),u([]),w(null),A(),j(null),i.invalidateQueries({queryKey:td(e)})},[e,i,A]),$=(0,n.useCallback)(async()=>{let t=await fetch(`/api/interactive/chat/${e}/stop`,{method:"POST"});if(!t.ok)throw Error(`Failed to stop agent: ${t.status}`);v(""),w(null),A(),i.invalidateQueries({queryKey:td(e)})},[e,i,A]),q=(0,n.useCallback)(async t=>{j(null),w(null);try{let n=await fetch(`/api/interactive/chat/${e}/respond`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answers:t})});n.ok||console.error(`[respondToInteraction] failed: ${n.status}`)}catch(e){console.error("[respondToInteraction] error:",e)}i.invalidateQueries({queryKey:td(e)})},[e,i]),H=!(O.hasPlan&&!O.allDone)&&P;return{runtime:(e=>{let[t]=(0,n.useState)(()=>new eH(e));(0,n.useEffect)(()=>{t.setAdapter(e)});let{modelContext:r}=(0,n.useContext)(tn)??{};return(0,n.useEffect)(()=>{if(r)return t.registerModelContextProvider(r)},[r,t]),(0,n.useMemo)(()=>new tt(t),[t])})({messages:L,convertMessage:(0,n.useCallback)(e=>e,[]),isRunning:H,onNew:z,onCancel:(0,n.useCallback)(async()=>{v(""),w(null),A()},[A])}),status:F,clearChat:U,stopAgent:$,sessionInfo:y,isChatLoading:h,pendingInteraction:T,respondToInteraction:q,stepProgress:O,initialRequestMessage:B}}(e,r,{contentTransform:(0,n.useCallback)(e=>(function(e,t){if(!t||0===t.length)return e;let n=t.map(e=>e.notes?.trim()?`@${e.path} [Note: ${e.notes.trim()}]`:`@${e.path}`).join(" ");return`${e}
4
4
 
5
- ${n}`}H.displayName="IconButton",e.s(["Thread",()=>I],15109),e.s(["composeUserInput",()=>W],84408);var K=e.i(38048);class G{_contextProvider=new K.CompositeContextProvider;registerModelContextProvider(e){return this._contextProvider.registerModelContextProvider(e)}getModelContextProvider(){return this._contextProvider}}let J=Object.freeze([]),Y="DEFAULT_THREAD_ID",X=Object.freeze([Y]),Z=Object.freeze({id:Y,remoteId:void 0,externalId:void 0,status:"regular"}),ee=Promise.resolve(),et=Object.freeze({[Y]:Z});class en{adapter;threadFactory;_mainThreadId=Y;_threads=X;_archivedThreads=J;_threadData=et;get isLoading(){return this.adapter.isLoading??!1}get newThreadId(){}get threadIds(){return this._threads}get archivedThreadIds(){return this._archivedThreads}get threadItems(){return this._threadData}getLoadThreadsPromise(){return ee}_mainThread;get mainThreadId(){return this._mainThreadId}constructor(e={},t){this.adapter=e,this.threadFactory=t,this._mainThread=this.threadFactory(),this.__internal_setAdapter(e,!0)}getMainThreadRuntimeCore(){return this._mainThread}getThreadRuntimeCore(){throw Error("Method not implemented.")}getItemById(e){for(let t of this.adapter.threads??[])if(t.id===e)return t;for(let t of this.adapter.archivedThreads??[])if(t.id===e)return t;if(e===Y)return Z}__internal_setAdapter(e,t=!1){let n=this.adapter;this.adapter=e;let r=e.threadId??Y,i=e.threads??J,s=e.archivedThreads??J,o=n.threadId??Y,a=n.threads??J,l=n.archivedThreads??J;(t||o!==r||a!==i||l!==s)&&(this._threadData={...et,...Object.fromEntries(e.threads?.map(e=>[e.id,{...e,remoteId:e.remoteId,externalId:e.externalId,status:"regular"}])??[]),...Object.fromEntries(e.archivedThreads?.map(e=>[e.id,{...e,remoteId:e.remoteId,externalId:e.externalId,status:"archived"}])??[])},a!==i&&(this._threads=this.adapter.threads?.map(e=>e.id)??J),l!==s&&(this._archivedThreads=this.adapter.archivedThreads?.map(e=>e.id)??J),o!==r&&(this._mainThreadId=r,this._mainThread=this.threadFactory()),this._notifySubscribers())}async switchToThread(e){if(this._mainThreadId===e)return;let t=this.adapter.onSwitchToThread;if(!t)throw Error("External store adapter does not support switching to thread");await t(e)}async switchToNewThread(){let e=this.adapter.onSwitchToNewThread;if(!e)throw Error("External store adapter does not support switching to new thread");await e()}async rename(e,t){let n=this.adapter.onRename;if(!n)throw Error("External store adapter does not support renaming");await n(e,t)}async detach(){}async archive(e){let t=this.adapter.onArchive;if(!t)throw Error("External store adapter does not support archiving");await t(e)}async unarchive(e){let t=this.adapter.onUnarchive;if(!t)throw Error("External store adapter does not support unarchiving");await t(e)}async delete(e){let t=this.adapter.onDelete;if(!t)throw Error("External store adapter does not support deleting");await t(e)}initialize(e){return Promise.resolve({remoteId:e,externalId:void 0})}generateTitle(){throw Error("Method not implemented.")}_subscriptions=new Set;subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}_notifySubscribers(){for(let e of this._subscriptions)e()}}let er=Symbol("innerMessage"),ei=Symbol("innerMessages"),es=[],eo=e=>{let t="messages"in e?e.messages:e,n=t[ei]||t[er];return n?Array.isArray(n)?n:(t[ei]=[n],t[ei]):es};class ea{cache=new WeakMap;convertMessages(e,t){return e.map((e,n)=>{let r=t(this.cache.get(e),e,n);return this.cache.set(e,r),r})}}let el=Symbol("autoStatus"),eu=Object.freeze(Object.assign({type:"running"},{[el]:!0})),ec=Object.freeze(Object.assign({type:"complete",reason:"unknown"},{[el]:!0})),ed=Object.freeze(Object.assign({type:"requires-action",reason:"tool-calls"},{[el]:!0})),eh=Object.freeze(Object.assign({type:"requires-action",reason:"interrupt"},{[el]:!0})),ep=(e,t,n,r,i)=>e&&i?Object.assign({type:"incomplete",reason:"error",error:i},{[el]:!0}):e&&t?eu:n?eh:r?ed:ec;var ef=e.i(78598);let em=Symbol("aui.parse-partial-json-object.meta"),eg=((e,t=21)=>(n=t)=>{let r="",i=0|n;for(;i--;)r+=e[Math.random()*e.length|0];return r})("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7),ey=()=>`__optimistic__${eg()}`,eb=(e,t)=>{if(e.startsWith("data-"))return{type:"data",name:e.substring(5),data:t}},ex=(e,t,n)=>{let{role:r,id:i,createdAt:s,attachments:o,status:a,metadata:l}=e,u={id:i??t,createdAt:s??new Date},c="string"==typeof e.content?[{type:"text",text:e.content}]:e.content;if("user"!==r&&o?.length)throw Error("attachments are only supported for user messages");if("assistant"!==r&&a)throw Error("status is only supported for assistant messages");if("assistant"!==r&&l?.steps)throw Error("metadata.steps is only supported for assistant messages");switch(r){case"assistant":return{...u,role:r,content:c.map(e=>{let t=e.type;switch(t){case"text":case"reasoning":if(0===e.text.trim().length)return null;return e;case"file":case"source":case"data":return e;case"image":return(({image:e,...t})=>e.match(/^data:image\/(png|jpeg|jpg|gif|webp);base64,(.*)$/)?{...t,image:e}:(console.warn("Invalid image data format detected"),null))(e);case"tool-call":{let{parentId:t,messages:n,...r}=e,i={...r,toolCallId:e.toolCallId??`tool-${eg()}`,...void 0!==t&&{parentId:t},...void 0!==n&&{messages:n}};if(e.args)return{...i,args:e.args,argsText:e.argsText??JSON.stringify(e.args)};return{...i,args:(e=>{if(0===e.length)return{[em]:{state:"partial",partialPath:[]}};try{let t=ef.default.parse(e);if("object"!=typeof t||null===t)throw Error("argsText is expected to be an object");return t[em]={state:"complete",partialPath:[]},t}catch{try{let[t,n]=function(e){let t,n=["ROOT"],r=-1,i=null,s=[];function o(){void 0!==t&&(s.push(JSON.parse(`"${t}"`)),t=void 0)}function a(e,t,s){switch(e){case'"':r=t,n.pop(),n.push(s),n.push("INSIDE_STRING"),o();break;case"f":case"t":case"n":r=t,i=t,n.pop(),n.push(s),n.push("INSIDE_LITERAL");break;case"-":n.pop(),n.push(s),n.push("INSIDE_NUMBER"),o();break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r=t,n.pop(),n.push(s),n.push("INSIDE_NUMBER"),o();break;case"{":r=t,n.pop(),n.push(s),n.push("INSIDE_OBJECT_START"),o();break;case"[":r=t,n.pop(),n.push(s),n.push("INSIDE_ARRAY_START"),o()}}function l(e,i){switch(e){case",":n.pop(),n.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":r=i,n.pop(),t=s.pop()}}function u(e,i){switch(e){case",":n.pop(),n.push("INSIDE_ARRAY_AFTER_COMMA"),t=(Number(t)+1).toString();break;case"]":r=i,n.pop(),t=s.pop()}}for(let o=0;o<e.length;o++){let c=e[o];switch(n[n.length-1]){case"ROOT":a(c,o,"FINISH");break;case"INSIDE_OBJECT_START":switch(c){case'"':n.pop(),n.push("INSIDE_OBJECT_KEY"),t="";break;case"}":r=o,n.pop(),t=s.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":'"'===c&&(n.pop(),n.push("INSIDE_OBJECT_KEY"),t="");break;case"INSIDE_OBJECT_KEY":switch(c){case'"':n.pop(),n.push("INSIDE_OBJECT_AFTER_KEY");break;case"\\":n.push("INSIDE_STRING_ESCAPE"),t+=c;break;default:t+=c}break;case"INSIDE_OBJECT_AFTER_KEY":":"===c&&(n.pop(),n.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":a(c,o,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":l(c,o);break;case"INSIDE_STRING":switch(c){case'"':n.pop(),r=o,t=s.pop();break;case"\\":n.push("INSIDE_STRING_ESCAPE");break;default:r=o}break;case"INSIDE_ARRAY_START":"]"===c?(r=o,n.pop(),t=s.pop()):(r=o,t="0",a(c,o,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(c){case",":n.pop(),n.push("INSIDE_ARRAY_AFTER_COMMA"),t=(Number(t)+1).toString();break;case"]":r=o,n.pop(),t=s.pop();break;default:r=o}break;case"INSIDE_ARRAY_AFTER_COMMA":a(c,o,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":n.pop(),"INSIDE_STRING"===n[n.length-1]?r=o:"INSIDE_OBJECT_KEY"===n[n.length-1]&&(t+=c);break;case"INSIDE_NUMBER":switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r=o;break;case"e":case"E":case"-":case".":break;case",":n.pop(),t=s.pop(),"INSIDE_ARRAY_AFTER_VALUE"===n[n.length-1]&&u(c,o),"INSIDE_OBJECT_AFTER_VALUE"===n[n.length-1]&&l(c,o);break;case"}":n.pop(),t=s.pop(),"INSIDE_OBJECT_AFTER_VALUE"===n[n.length-1]&&l(c,o);break;case"]":n.pop(),t=s.pop(),"INSIDE_ARRAY_AFTER_VALUE"===n[n.length-1]&&u(c,o);break;default:n.pop(),t=s.pop()}break;case"INSIDE_LITERAL":{let t=e.substring(i,o+1);"false".startsWith(t)||"true".startsWith(t)||"null".startsWith(t)?r=o:(n.pop(),"INSIDE_OBJECT_AFTER_VALUE"===n[n.length-1]?l(c,o):"INSIDE_ARRAY_AFTER_VALUE"===n[n.length-1]&&u(c,o))}}}let c=e.slice(0,r+1);for(let t=n.length-1;t>=0;t--)switch(n[t]){case"INSIDE_STRING":c+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":c+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":c+="]";break;case"INSIDE_LITERAL":{let t=e.substring(i,e.length);"true".startsWith(t)?c+="true".slice(t.length):"false".startsWith(t)?c+="false".slice(t.length):"null".startsWith(t)&&(c+="null".slice(t.length))}}return[c,s]}(e),r=ef.default.parse(t);if("object"!=typeof r||null===r)throw Error("argsText is expected to be an object");return r[em]={state:"partial",partialPath:n},r}catch{return}}})(e.argsText??"")??{},argsText:e.argsText??""}}default:{let n=eb(t,e.data);if(n)return n;throw Error(`Unsupported assistant message part type: ${t}`)}}}).filter(e=>!!e),status:a??n,metadata:{unstable_state:l?.unstable_state??null,unstable_annotations:l?.unstable_annotations??[],unstable_data:l?.unstable_data??[],custom:l?.custom??{},steps:l?.steps??[],...l?.timing&&{timing:l.timing},...l?.submittedFeedback&&{submittedFeedback:l.submittedFeedback}}};case"user":return{...u,role:r,content:c.map(e=>{let t=e.type;switch(t){case"text":case"image":case"audio":case"file":case"data":return e;default:{let n=eb(t,e.data);if(n)return n;throw Error(`Unsupported user message part type: ${t}`)}}}),attachments:(o??[]).map(e=>({...e,content:e.content.map(e=>eb(e.type,e.data)??e)})),metadata:{custom:l?.custom??{}}};case"system":if(1!==c.length||"text"!==c[0].type)throw Error("System messages must have exactly one text message part.");return{...u,role:r,content:c,metadata:{custom:l?.custom??{}}};default:throw Error(`Unknown message role: ${r}`)}},ev=e=>e.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n\n"),ew=e=>{let t=e.map(e=>ex(e,eg(),ep(!1,!1,!1,!1,void 0)));return{messages:t.map((e,n)=>({parentId:n>0?t[n-1].id:null,message:e}))}},eS=e=>e.next?eS(e.next):"current"in e?e:null;class ek{func;_value=null;constructor(e){this.func=e}get value(){return null===this._value&&(this._value=this.func()),this._value}dirty(){this._value=null}}class e_{messages=new Map;head=null;root={children:[],next:null};updateLevels(e,t){for(let n of(e.level=t,e.children)){let e=this.messages.get(n);e&&this.updateLevels(e,t+1)}}performOp(e,t,n){let r=t.prev??this.root,i=e??this.root;if("relink"!==n||r!==i){if("link"!==n&&(r.children=r.children.filter(e=>e!==t.current.id),r.next===t)){let e=r.children.at(-1),t=e?this.messages.get(e):null;if(void 0===t)throw Error("MessageRepository(performOp/cut): Fallback sibling message not found. This is likely an internal bug in assistant-ui.");r.next=t}if("cut"!==n){for(let n=e;n;n=n.prev)if(n.current.id===t.current.id)throw Error("MessageRepository(performOp/link): A message with the same id already exists in the parent tree. This error occurs if the same message id is found multiple times. This is likely an internal bug in assistant-ui.");i.children=[...i.children,t.current.id],(eS(t)===this.head||null===i.next)&&(i.next=t),t.prev=e;let n=e?e.level+1:0;this.updateLevels(t,n)}}}_messages=new ek(()=>{let e=Array((this.head?.level??-1)+1);for(let t=this.head;t;t=t.prev)e[t.level]=t.current;return e});get headId(){return this.head?.current.id??null}getMessages(e){if(void 0===e||e===this.head?.current.id)return this._messages.value;let t=this.messages.get(e);if(!t)throw Error("MessageRepository(getMessages): Head message not found. This is likely an internal bug in assistant-ui.");let n=Array(t.level+1);for(let e=t;e;e=e.prev)n[e.level]=e.current;return n}addOrUpdateMessage(e,t){let n=this.messages.get(t.id),r=e?this.messages.get(e):null;if(void 0===r)throw Error("MessageRepository(addOrUpdateMessage): Parent message not found. This is likely an internal bug in assistant-ui.");if(n){n.current=t,this.performOp(r,n,"relink"),this._messages.dirty();return}let i={prev:r,current:t,next:null,children:[],level:r?r.level+1:0};this.messages.set(t.id,i),this.performOp(r,i,"link"),this.head===r&&(this.head=i),this._messages.dirty()}getMessage(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui.");return{parentId:t.prev?.current.id??null,message:t.current,index:t.level}}appendOptimisticMessage(e,t){let n;do n=ey();while(this.messages.has(n))return this.addOrUpdateMessage(e,ex(t,n,{type:"running"})),n}deleteMessage(e,t){let n=this.messages.get(e);if(!n)throw Error("MessageRepository(deleteMessage): Message not found. This is likely an internal bug in assistant-ui.");let r=void 0===t?n.prev:null===t?null:this.messages.get(t);if(void 0===r)throw Error("MessageRepository(deleteMessage): Replacement not found. This is likely an internal bug in assistant-ui.");for(let e of n.children){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui.");this.performOp(r,t,"relink")}this.performOp(null,n,"cut"),this.messages.delete(e),this.head===n&&(this.head=eS(r??this.root)),this._messages.dirty()}getBranches(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(getBranches): Message not found. This is likely an internal bug in assistant-ui.");let{children:n}=t.prev??this.root;return n}switchToBranch(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(switchToBranch): Branch not found. This is likely an internal bug in assistant-ui.");(t.prev??this.root).next=t,this.head=eS(t),this._messages.dirty()}resetHead(e){if(null===e)return void this.clear();let t=this.messages.get(e);if(!t)throw Error("MessageRepository(resetHead): Branch not found. This is likely an internal bug in assistant-ui.");if(t.children.length>0){let e=t=>{for(let n of t.children){let t=this.messages.get(n);t&&(e(t),this.messages.delete(n))}};e(t),t.children=[],t.next=null}this.head=t;for(let e=t;e;e=e.prev)e.prev?e.prev.next=e:this.root.next=e;this._messages.dirty()}clear(){this.messages.clear(),this.head=null,this.root={children:[],next:null},this._messages.dirty()}export(){let e=[];for(let[,t]of this.messages)e.push({message:t.current,parentId:t.prev?.current.id??null});return{headId:this.head?.current.id??null,messages:e}}import({headId:e,messages:t}){for(let{message:e,parentId:n}of t)this.addOrUpdateMessage(n,e);this.resetHead(e??t.at(-1)?.message.id??null)}}let eE=Symbol("skip-update");class eC{_subscribers=new Set;subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}waitForUpdate(){return new Promise(e=>{let t=this.subscribe(()=>{t(),e()})})}_notifySubscribers(){let e=[];for(let t of this._subscribers)try{t()}catch(t){e.push(t)}if(e.length>0)if(1===e.length)throw e[0];else{for(let t of e)console.error(t);throw AggregateError(e)}}}class eT{_subscriptions=new Set;_connection;get isConnected(){return!!this._connection}notifySubscribers(){for(let e of this._subscriptions)e()}_updateConnection(){this._subscriptions.size>0?this._connection||(this._connection=this._connect()):(this._connection?.(),this._connection=void 0)}subscribe(e){return this._subscriptions.add(e),this._updateConnection(),()=>{this._subscriptions.delete(e),this._updateConnection()}}}class eI extends eT{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e;const t=e.getState();if(t===eE)throw Error("Entry not available in the store");this._previousState=t}_previousState;getState=()=>(this.isConnected||this._syncState(),this._previousState);_syncState(){let e=this.binding.getState();return!(e===eE||function(e,t){if(void 0===e&&void 0===t)return!0;if(void 0===e||void 0===t)return!1;for(let n of Object.keys(e))if(!Object.is(e[n],t[n]))return!1;return!0}(e,this._previousState))&&(this._previousState=e,!0)}_connect(){let e=()=>{this._syncState()&&this.notifySubscribers()};return this.binding.subscribe(e)}}class ej extends eT{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e}_previousStateDirty=!0;_previousState;getState=()=>{if(!this.isConnected||this._previousStateDirty){let e=this.binding.getState();e!==eE&&(this._previousState=e),this._previousStateDirty=!1}if(void 0===this._previousState)throw Error("Entry not available in the store");return this._previousState};_connect(){let e=()=>{this._previousStateDirty=!0,this.notifySubscribers()};return this.binding.subscribe(e)}}class eA extends eT{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e}getState(){return this.binding.getState()}outerSubscribe(e){return this.binding.subscribe(e)}_connect(){let e=()=>{this.notifySubscribers()},t=this.binding.getState(),n=t?.subscribe(e),r=()=>{let r=this.binding.getState();r!==t&&(t=r,n?.(),n=r?.subscribe(e),e())},i=this.outerSubscribe(r);return()=>{i?.(),n?.()}}}class eR extends eT{config;constructor(e){super(),this.config=e}getState(){return this.config.binding.getState()}outerSubscribe(e){return this.config.binding.subscribe(e)}_connect(){let e=()=>{this.notifySubscribers()},t=this.config.binding.getState(),n=t?.unstable_on(this.config.event,e),r=()=>{let r=this.config.binding.getState();r!==t&&(t=r,n?.(),n=r?.unstable_on(this.config.event,e))},i=this.outerSubscribe(r);return()=>{i?.(),n?.()}}}class eM extends eC{isEditing=!0;get attachmentAccept(){return this.getAttachmentAdapter()?.accept??"*"}_attachments=[];get attachments(){return this._attachments}setAttachments(e){this._attachments=e,this._notifySubscribers()}get isEmpty(){return!this.text.trim()&&!this.attachments.length}_text="";get text(){return this._text}_role="user";get role(){return this._role}_runConfig={};get runConfig(){return this._runConfig}_quote=void 0;get quote(){return this._quote}setQuote(e){this._quote!==e&&(this._quote=e,this._notifySubscribers())}setText(e){if(this._text!==e){if(this._text=e,this._dictation){this._dictationBaseText=e,this._currentInterimText="";let{status:t,inputDisabled:n}=this._dictation;this._dictation=n?{status:t,inputDisabled:n}:{status:t}}this._notifySubscribers()}}setRole(e){this._role!==e&&(this._role=e,this._notifySubscribers())}setRunConfig(e){this._runConfig!==e&&(this._runConfig=e,this._notifySubscribers())}_emptyTextAndAttachments(){this._attachments=[],this._text="",this._notifySubscribers()}async _onClearAttachments(){let e=this.getAttachmentAdapter();if(e){let t=this._attachments.filter(e=>"complete"!==e.status.type);await Promise.all(t.map(t=>e.remove(t)))}}async reset(){if(0===this._attachments.length&&""===this._text&&"user"===this._role&&0===Object.keys(this._runConfig).length&&void 0===this._quote)return;this._role="user",this._runConfig={},this._quote=void 0;let e=this._onClearAttachments();this._emptyTextAndAttachments(),await e}async clearAttachments(){let e=this._onClearAttachments();this.setAttachments([]),await e}async send(){if(this.isEmpty)return;this._dictationSession&&(this._dictationSession.cancel(),this._cleanupDictation());let e=this.getAttachmentAdapter(),t=this.attachments.length>0?Promise.all(this.attachments.map(async t=>{if("complete"===t.status.type)return t;if(!e)throw Error("Attachments are not supported");return await e.send(t)})):[],n=this.text,r=this._quote;this._quote=void 0,this._emptyTextAndAttachments();let i={createdAt:new Date,role:this.role,content:n?[{type:"text",text:n}]:[],attachments:await t,runConfig:this.runConfig,metadata:{custom:{...r?{quote:r}:{}}}};this.handleSend(i),this._notifyEventSubscribers("send")}cancel(){this.handleCancel()}async addAttachment(e){if(!(e instanceof File)){let t={id:e.id??eg(),type:e.type??"document",name:e.name,contentType:e.contentType,content:e.content,status:{type:"complete"}};this._attachments=[...this._attachments,t],this._notifyEventSubscribers("attachmentAdd"),this._notifySubscribers();return}let t=this.getAttachmentAdapter();if(!t)throw Error("Attachments are not supported");let n=e=>{let t=this._attachments.findIndex(t=>t.id===e.id);-1!==t?this._attachments=[...this._attachments.slice(0,t),e,...this._attachments.slice(t+1)]:this._attachments=[...this._attachments,e],this._notifySubscribers()},r=t.add({file:e});if(Symbol.asyncIterator in r)for await(let e of r)n(e);else n(await r);this._notifyEventSubscribers("attachmentAdd"),this._notifySubscribers()}async removeAttachment(e){let t=this._attachments.findIndex(t=>t.id===e);if(-1===t)throw Error("Attachment not found");let n=this._attachments[t];if("complete"!==n.status.type){let e=this.getAttachmentAdapter();if(!e)throw Error("Attachments are not supported");await e.remove(n)}this._attachments=this._attachments.filter(t=>t.id!==e),this._notifySubscribers()}_dictation;_dictationSession;_dictationUnsubscribes=[];_dictationBaseText="";_currentInterimText="";_dictationSessionIdCounter=0;_activeDictationSessionId;_isCleaningDictation=!1;get dictation(){return this._dictation}_isActiveSession(e,t){return this._activeDictationSessionId===e&&this._dictationSession===t}startDictation(){let e=this.getDictationAdapter();if(!e)throw Error("Dictation adapter not configured");if(this._dictationSession){for(let e of this._dictationUnsubscribes)e();this._dictationUnsubscribes=[],this._dictationSession.stop().catch(()=>{}),this._dictationSession=void 0}let t=e.disableInputDuringDictation??!1;this._dictationBaseText=this._text,this._currentInterimText="";let n=e.listen();this._dictationSession=n;let r=++this._dictationSessionIdCounter;this._activeDictationSessionId=r,this._dictation={status:n.status,inputDisabled:t},this._notifySubscribers();let i=n.onSpeech(e=>{if(!this._isActiveSession(r,n))return;let t=!1!==e.isFinal,i=this._dictationBaseText&&!this._dictationBaseText.endsWith(" ")&&e.transcript?" ":"";if(t){if(this._dictationBaseText=this._dictationBaseText+i+e.transcript,this._currentInterimText="",this._text=this._dictationBaseText,this._dictation){let{transcript:e,...t}=this._dictation;this._dictation=t}this._notifySubscribers()}else this._currentInterimText=i+e.transcript,this._text=this._dictationBaseText+this._currentInterimText,this._dictation&&(this._dictation={...this._dictation,transcript:e.transcript}),this._notifySubscribers()});this._dictationUnsubscribes.push(i);let s=n.onSpeechStart(()=>{this._isActiveSession(r,n)&&(this._dictation={status:{type:"running"},inputDisabled:t,...this._dictation?.transcript&&{transcript:this._dictation.transcript}},this._notifySubscribers())});this._dictationUnsubscribes.push(s);let o=n.onSpeechEnd(()=>{this._cleanupDictation({sessionId:r})});this._dictationUnsubscribes.push(o);let a=setInterval(()=>{this._isActiveSession(r,n)&&"ended"===n.status.type&&this._cleanupDictation({sessionId:r})},100);this._dictationUnsubscribes.push(()=>clearInterval(a))}stopDictation(){if(!this._dictationSession)return;let e=this._dictationSession,t=this._activeDictationSessionId;e.stop().finally(()=>{this._cleanupDictation({sessionId:t})})}_cleanupDictation(e){if((e?.sessionId===void 0||e.sessionId===this._activeDictationSessionId)&&!this._isCleaningDictation){this._isCleaningDictation=!0;try{for(let e of this._dictationUnsubscribes)e();this._dictationUnsubscribes=[],this._dictationSession=void 0,this._activeDictationSessionId=void 0,this._dictation=void 0,this._dictationBaseText="",this._currentInterimText="",this._notifySubscribers()}finally{this._isCleaningDictation=!1}}}_eventSubscribers=new Map;_notifyEventSubscribers(e){let t=this._eventSubscribers.get(e);if(t)for(let e of t)e()}unstable_on(e,t){let n=this._eventSubscribers.get(e);return n?n.add(t):this._eventSubscribers.set(e,new Set([t])),()=>{let n=this._eventSubscribers.get(e);n&&n.delete(t)}}}class eN extends eM{runtime;_canCancel=!1;get canCancel(){return this._canCancel}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}constructor(e){super(),this.runtime=e,this.connect()}connect(){return this.runtime.subscribe(()=>{this.canCancel!==this.runtime.capabilities.cancel&&(this._canCancel=this.runtime.capabilities.cancel,this._notifySubscribers())})}async handleSend(e){this.runtime.append({...e,parentId:this.runtime.messages.at(-1)?.id??null,sourceId:null})}async handleCancel(){this.runtime.cancelRun()}}class eO extends eM{runtime;endEditCallback;get canCancel(){return!0}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}_nonTextParts;_previousText;_parentId;_sourceId;constructor(e,t,{parentId:n,message:r}){super(),this.runtime=e,this.endEditCallback=t,this._parentId=n,this._sourceId=r.id,this._previousText=ev(r),this.setText(this._previousText),this.setRole(r.role),this.setAttachments(r.attachments??[]),this._nonTextParts=r.content.filter(e=>"text"!==e.type),this.setRunConfig({...e.composer.runConfig})}async handleSend(e){ev(e)!==this._previousText&&this.runtime.append({...e,content:[...e.content,...this._nonTextParts],parentId:this._parentId,sourceId:this._sourceId}),this.handleCancel()}handleCancel(){this.endEditCallback(),this._notifySubscribers()}}class eP{_contextProvider;_subscriptions=new Set;_isInitialized=!1;repository=new e_;get messages(){return this.repository.getMessages()}get state(){let e;for(let t of this.messages)"assistant"===t.role&&(e=t);return e?.metadata.unstable_state??null}composer=new eN(this);constructor(e){this._contextProvider=e}getModelContext(){return this._contextProvider.getModelContext()}_editComposers=new Map;getEditComposer(e){return this._editComposers.get(e)}beginEdit(e){if(this._editComposers.has(e))throw Error("Edit already in progress");this._editComposers.set(e,new eO(this,()=>this._editComposers.delete(e),this.repository.getMessage(e))),this._notifySubscribers()}getMessageById(e){try{return this.repository.getMessage(e)}catch{return}}getBranches(e){return this.repository.getBranches(e)}switchToBranch(e){this.repository.switchToBranch(e),this._notifySubscribers()}_notifySubscribers(){for(let e of this._subscriptions)e()}_notifyEventSubscribers(e){let t=this._eventSubscribers.get(e);if(t)for(let e of t)e()}subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}submitFeedback({messageId:e,type:t}){let n=this.adapters?.feedback;if(!n)throw Error("Feedback adapter not configured");let{message:r,parentId:i}=this.repository.getMessage(e);if(n.submit({message:r,type:t}),"assistant"===r.role){let e={...r,metadata:{...r.metadata,submittedFeedback:{type:t}}};this.repository.addOrUpdateMessage(i,e)}this._notifySubscribers()}_stopSpeaking;speech;speak(e){let t=this.adapters?.speech;if(!t)throw Error("Speech adapter not configured");let{message:n}=this.repository.getMessage(e);this._stopSpeaking?.();let r=t.speak(ev(n)),i=r.subscribe(()=>{"ended"===r.status.type?(this._stopSpeaking=void 0,this.speech=void 0):this.speech={messageId:e,status:r.status},this._notifySubscribers()});this.speech={messageId:e,status:r.status},this._notifySubscribers(),this._stopSpeaking=()=>{r.cancel(),i(),this.speech=void 0,this._stopSpeaking=void 0}}stopSpeaking(){if(!this._stopSpeaking)throw Error("No message is being spoken");this._stopSpeaking(),this._notifySubscribers()}ensureInitialized(){this._isInitialized||(this._isInitialized=!0,this._notifyEventSubscribers("initialize"))}export(){return this.repository.export()}import(e){this.ensureInitialized(),this.repository.clear(),this.repository.import(e),this._notifySubscribers()}reset(e){this.import(ew(e??[]))}_eventSubscribers=new Map;unstable_on(e,t){if("modelContextUpdate"===e)return this._contextProvider.subscribe?.(t)??(()=>{});let n=this._eventSubscribers.get(e);return n?n.add(t):this._eventSubscribers.set(e,new Set([t])),()=>{this._eventSubscribers.get(e).delete(t)}}}let eD=Object.freeze([]),eF=(e,t)=>{let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0};class eL extends eP{_assistantOptimisticId=null;_capabilities={switchToBranch:!1,switchBranchDuringRun:!1,edit:!1,reload:!1,cancel:!1,unstable_copy:!1,speech:!1,dictation:!1,attachments:!1,feedback:!1};get capabilities(){return this._capabilities}_messages;isDisabled;get isLoading(){return this._store.isLoading??!1}get messages(){return this._messages}get state(){return this._store.state??super.state}get adapters(){return this._store.adapters}suggestions=[];extras=void 0;_converter=new ea;_store;beginEdit(e){if(!this._store.onEdit)throw Error("Runtime does not support editing.");super.beginEdit(e)}constructor(e,t){super(e),this.__internal_setAdapter(t)}__internal_setAdapter(e){let t,n;if(this._store===e)return;let r=e.isRunning??!1;this.isDisabled=e.isDisabled??!1;let i=this._store;this._store=e,this.extras!==e.extras&&(this.extras=e.extras);let s=e.suggestions??eD;eF(this.suggestions,s)||(this.suggestions=s);let o={switchToBranch:void 0!==this._store.setMessages,switchBranchDuringRun:!1,edit:void 0!==this._store.onEdit,reload:void 0!==this._store.onReload,cancel:void 0!==this._store.onCancel,speech:this._store.adapters?.speech!==void 0,dictation:this._store.adapters?.dictation!==void 0,unstable_copy:this._store.unstable_capabilities?.copy!==!1,attachments:!!this._store.adapters?.attachments,feedback:!!this._store.adapters?.feedback};if(eF(this._capabilities,o)||(this._capabilities=o),e.messageRepository){if(i&&i.isRunning===e.isRunning&&i.messageRepository===e.messageRepository)return void this._notifySubscribers();this.repository.clear(),this._assistantOptimisticId=null,this.repository.import(e.messageRepository),t=this.repository.getMessages()}else if(e.messages){if(i){if(i.convertMessage!==e.convertMessage)this._converter=new ea;else if(i.isRunning===e.isRunning&&i.messages===e.messages)return void this._notifySubscribers()}t=e.convertMessage?this._converter.convertMessages(e.messages,(t,n,i)=>{if(!e.convertMessage)return n;let s=ep(i===(e.messages?.length??0)-1,r,!1,!1,void 0);if(t&&("assistant"!==t.role||!0!==t.status[el]||t.status===s))return t;let o=ex(e.convertMessage(n,i),i.toString(),s);return er in o||(o[er]=n),o}):e.messages;for(let e=0;e<t.length;e++){let n=t[e],r=t[e-1];this.repository.addOrUpdateMessage(r?.id??null,n)}}else throw Error("ExternalStoreAdapter must provide either 'messages' or 'messageRepository'");t.length>0&&this.ensureInitialized(),(i?.isRunning??!1)!==(e.isRunning??!1)&&(e.isRunning?this._notifyEventSubscribers("runStart"):this._notifyEventSubscribers("runEnd")),this._assistantOptimisticId&&(this.repository.deleteMessage(this._assistantOptimisticId),this._assistantOptimisticId=null),n=t,r&&n[n.length-1]?.role!=="assistant"&&(this._assistantOptimisticId=this.repository.appendOptimisticMessage(t.at(-1)?.id??null,{role:"assistant",content:[]})),this.repository.resetHead(this._assistantOptimisticId??t.at(-1)?.id??null),this._messages=this.repository.getMessages(),this._notifySubscribers()}switchToBranch(e){if(!this._store.setMessages)throw Error("Runtime does not support switching branches.");this._store.isRunning||(this.repository.switchToBranch(e),this.updateMessages(this.repository.getMessages()))}async append(e){if(e.parentId!==(this.messages.at(-1)?.id??null)){if(!this._store.onEdit)throw Error("Runtime does not support editing messages.");await this._store.onEdit(e)}else await this._store.onNew(e)}async startRun(e){if(!this._store.onReload)throw Error("Runtime does not support reloading messages.");await this._store.onReload(e.parentId,e)}async resumeRun(e){if(!this._store.onResume)throw Error("Runtime does not support resuming runs.");await this._store.onResume(e)}exportExternalState(){if(!this._store.onExportExternalState)throw Error("Runtime does not support exporting external states.");return this._store.onExportExternalState()}importExternalState(e){if(!this._store.onLoadExternalState)throw Error("Runtime does not support importing external states.");this._store.onLoadExternalState(e)}unstable_loadExternalState(e){this.importExternalState(e)}cancelRun(){if(!this._store.onCancel)throw Error("Runtime does not support cancelling runs.");this._store.onCancel(),this._assistantOptimisticId&&(this.repository.deleteMessage(this._assistantOptimisticId),this._assistantOptimisticId=null);let e=this.repository.getMessages(),t=e[e.length-1];t?.role==="user"&&t.id===e.at(-1)?.id?(this.repository.deleteMessage(t.id),this.composer.text.trim()||this.composer.setText(ev(t)),e=this.repository.getMessages()):this._notifySubscribers(),setTimeout(()=>{this.updateMessages(e)},0)}addToolResult(e){if(!this._store.onAddToolResult&&!this._store.onAddToolResult)throw Error("Runtime does not support tool results.");this._store.onAddToolResult?.(e)}resumeToolCall(e){if(!this._store.onResumeToolCall)throw Error("Runtime does not support resuming tool calls.");this._store.onResumeToolCall(e)}reset(e){let t=new e_;t.import(ew(e??[])),this.updateMessages(t.getMessages())}import(e){this._assistantOptimisticId=null,super.import(e),this._store.onImport&&this._store.onImport(this.repository.getMessages())}updateMessages=e=>{void 0!==this._store.convertMessage?this._store.setMessages?.(e.flatMap(eo)):this._store.setMessages?.(e)}}let eB=e=>e.adapters?.threadList??{};class ez extends G{threads;constructor(e){super(),this.threads=new en(eB(e),()=>new eL(this._contextProvider,e))}setAdapter(e){this.threads.__internal_setAdapter(eB(e)),this.threads.getMainThreadRuntimeCore().__internal_setAdapter(e)}}class eU{_core;_threadListBinding;get path(){return this._core.path}constructor(e,t){this._core=e,this._threadListBinding=t,this.__internal_bindMethods()}__internal_bindMethods(){this.switchTo=this.switchTo.bind(this),this.rename=this.rename.bind(this),this.archive=this.archive.bind(this),this.unarchive=this.unarchive.bind(this),this.delete=this.delete.bind(this),this.initialize=this.initialize.bind(this),this.generateTitle=this.generateTitle.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getState=this.getState.bind(this),this.detach=this.detach.bind(this)}getState(){return this._core.getState()}switchTo(){let e=this._core.getState();return this._threadListBinding.switchToThread(e.id)}rename(e){let t=this._core.getState();return this._threadListBinding.rename(t.id,e)}archive(){let e=this._core.getState();return this._threadListBinding.archive(e.id)}unarchive(){let e=this._core.getState();return this._threadListBinding.unarchive(e.id)}delete(){let e=this._core.getState();return this._threadListBinding.delete(e.id)}initialize(){let e=this._core.getState();return this._threadListBinding.initialize(e.id)}generateTitle(){let e=this._core.getState();return this._threadListBinding.generateTitle(e.id)}unstable_on(e,t){let n=this._core.getState().isMain,r=this._core.getState().id;return this.subscribe(()=>{let i=this._core.getState(),s=i.isMain,o=i.id;n===s&&r===o||(n=s,r=o,"switchedTo"===e&&!s||"switchedAway"===e&&s||t())})}subscribe(e){return this._core.subscribe(e)}detach(){let e=this._core.getState();this._threadListBinding.detach(e.id)}__internal_getRuntime(){return this}}class eq{_core;get path(){return this._core.path}constructor(e){this._core=e,this.__internal_bindMethods()}__internal_bindMethods(){this.getState=this.getState.bind(this),this.remove=this.remove.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this._core.getState()}subscribe(e){return this._core.subscribe(e)}}class e$ extends eq{_composerApi;constructor(e,t){super(e),this._composerApi=t}remove(){let e=this._composerApi.getState();if(!e)throw Error("Composer is not available");return e.removeAttachment(this.getState().id)}}class eH extends e${get source(){return"thread-composer"}}class eV extends e${get source(){return"edit-composer"}}class eQ extends eq{get source(){return"message"}constructor(e){super(e)}remove(){throw Error("Message attachments cannot be removed")}}let eW=Object.freeze([]),eK=Object.freeze({});class eG{_core;get path(){return this._core.path}constructor(e){this._core=e}__internal_bindMethods(){this.setText=this.setText.bind(this),this.setRunConfig=this.setRunConfig.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.addAttachment=this.addAttachment.bind(this),this.reset=this.reset.bind(this),this.clearAttachments=this.clearAttachments.bind(this),this.send=this.send.bind(this),this.cancel=this.cancel.bind(this),this.setRole=this.setRole.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.startDictation=this.startDictation.bind(this),this.stopDictation=this.stopDictation.bind(this),this.setQuote=this.setQuote.bind(this),this.unstable_on=this.unstable_on.bind(this)}setText(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setText(e)}setRunConfig(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setRunConfig(e)}addAttachment(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");return t.addAttachment(e)}reset(){let e=this._core.getState();if(!e)throw Error("Composer is not available");return e.reset()}clearAttachments(){let e=this._core.getState();if(!e)throw Error("Composer is not available");return e.clearAttachments()}send(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.send()}cancel(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.cancel()}setRole(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setRole(e)}startDictation(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.startDictation()}stopDictation(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.stopDictation()}setQuote(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setQuote(e)}subscribe(e){return this._core.subscribe(e)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new eR({event:e,binding:this._core}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}}class eJ extends eG{get path(){return this._core.path}get type(){return"thread"}_getState;constructor(e){const t=new ej({path:e.path,getState:()=>{let t;return t=e.getState(),Object.freeze({type:"thread",isEditing:t?.isEditing??!1,canCancel:t?.canCancel??!1,isEmpty:t?.isEmpty??!0,attachments:t?.attachments??eW,text:t?.text??"",role:t?.role??"user",runConfig:t?.runConfig??eK,attachmentAccept:t?.attachmentAccept??"",dictation:t?.dictation,quote:t?.quote,value:t?.text??""})},subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>t.subscribe(e)}),this._getState=t.getState.bind(t),this.__internal_bindMethods()}getState(){return this._getState()}getAttachmentByIndex(e){return new eH(new eI({path:{...this.path,attachmentSource:"thread-composer",attachmentSelector:{type:"index",index:e},ref:`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:"thread-composer"}:eE},subscribe:e=>this._core.subscribe(e)}),this._core)}}class eY extends eG{_beginEdit;get path(){return this._core.path}get type(){return"edit"}_getState;constructor(e,t){const n=new ej({path:e.path,getState:()=>{let t;return t=e.getState(),Object.freeze({type:"edit",isEditing:t?.isEditing??!1,canCancel:t?.canCancel??!1,isEmpty:t?.isEmpty??!0,text:t?.text??"",role:t?.role??"user",attachments:t?.attachments??eW,runConfig:t?.runConfig??eK,attachmentAccept:t?.attachmentAccept??"",dictation:t?.dictation,quote:t?.quote,value:t?.text??""})},subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>n.subscribe(e)}),this._beginEdit=t,this._getState=n.getState.bind(n),this.__internal_bindMethods()}__internal_bindMethods(){super.__internal_bindMethods(),this.beginEdit=this.beginEdit.bind(this)}getState(){return this._getState()}beginEdit(){this._beginEdit()}getAttachmentByIndex(e){return new eV(new eI({path:{...this.path,attachmentSource:"edit-composer",attachmentSelector:{type:"index",index:e},ref:`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:"edit-composer"}:eE},subscribe:e=>this._core.subscribe(e)}),this._core)}}let eX=Symbol.for("aui.tool-response");class eZ{get[eX](){return!0}artifact;result;isError;messages;constructor(e){void 0!==e.artifact&&(this.artifact=e.artifact),this.result=e.result,this.isError=e.isError??!1,void 0!==e.messages&&(this.messages=e.messages)}static[Symbol.hasInstance](e){return"object"==typeof e&&null!==e&&eX in e}static toResponse(e){return e instanceof eZ?e:new eZ({result:void 0===e?"<no result>":e})}}class e0{contentBinding;messageApi;threadApi;get path(){return this.contentBinding.path}constructor(e,t,n){this.contentBinding=e,this.messageApi=t,this.threadApi=n,this.__internal_bindMethods()}__internal_bindMethods(){this.addToolResult=this.addToolResult.bind(this),this.resumeToolCall=this.resumeToolCall.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this.contentBinding.getState()}addToolResult(e){let t=this.contentBinding.getState();if(!t)throw Error("Message part is not available");if("tool-call"!==t.type)throw Error("Tried to add tool result to non-tool message part");if(!this.messageApi)throw Error("Message API is not available. This is likely a bug in assistant-ui.");if(!this.threadApi)throw Error("Thread API is not available");let n=this.messageApi.getState();if(!n)throw Error("Message is not available");let r=t.toolName,i=t.toolCallId,s=eZ.toResponse(e);this.threadApi.getState().addToolResult({messageId:n.id,toolName:r,toolCallId:i,result:s.result,artifact:s.artifact,isError:s.isError})}resumeToolCall(e){let t=this.contentBinding.getState();if(!t)throw Error("Message part is not available");if("tool-call"!==t.type)throw Error("Tried to resume tool call on non-tool message part");if(!this.threadApi)throw Error("Thread API is not available");let n=t.toolCallId;this.threadApi.getState().resumeToolCall({toolCallId:n,payload:e})}subscribe(e){return this.contentBinding.subscribe(e)}}let e1=Object.freeze({type:"complete"}),e2=(e,t)=>{let n=e.content[t];if(!n)return eE;let r=((e,t,n)=>{if("assistant"!==e.role)return e1;if("tool-call"===n.type)if(!n.result)return e.status;else return e1;let r=t===Math.max(0,e.content.length-1);return"requires-action"===e.status.type?e1:r?e.status:e1})(e,t,n);return Object.freeze({...n,...{[er]:n[er]},status:r})};class e5{_core;_threadBinding;get path(){return this._core.path}constructor(e,t){this._core=e,this._threadBinding=t,this.composer=new eY(new eA({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.composer`,composerSource:"edit"},getState:this._getEditComposerRuntimeCore,subscribe:e=>this._threadBinding.subscribe(e)}),()=>this._threadBinding.getState().beginEdit(this._core.getState().id)),this.__internal_bindMethods()}__internal_bindMethods(){this.reload=this.reload.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getMessagePartByIndex=this.getMessagePartByIndex.bind(this),this.getMessagePartByToolCallId=this.getMessagePartByToolCallId.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.unstable_getCopyText=this.unstable_getCopyText.bind(this),this.speak=this.speak.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.submitFeedback=this.submitFeedback.bind(this),this.switchToBranch=this.switchToBranch.bind(this)}composer;_getEditComposerRuntimeCore=()=>this._threadBinding.getState().getEditComposer(this._core.getState().id);getState(){return this._core.getState()}reload(e={}){let t=this._getEditComposerRuntimeCore(),n=t??this._threadBinding.getState().composer,{runConfig:r=(t??n).runConfig}=e,i=this._core.getState();if("assistant"!==i.role)throw Error("Can only reload assistant messages");this._threadBinding.getState().startRun({parentId:i.parentId,sourceId:i.id,runConfig:r})}speak(){let e=this._core.getState();return this._threadBinding.getState().speak(e.id)}stopSpeaking(){let e=this._core.getState(),t=this._threadBinding.getState();if(t.speech?.messageId===e.id)this._threadBinding.getState().stopSpeaking();else throw Error("Message is not being spoken")}submitFeedback({type:e}){let t=this._core.getState();this._threadBinding.getState().submitFeedback({messageId:t.id,type:e})}switchToBranch({position:e,branchId:t}){let n=this._core.getState();if(t&&e)throw Error("May not specify both branchId and position");if(!t&&!e)throw Error("Must specify either branchId or position");let r=this._threadBinding.getState().getBranches(n.id),i=t;if("previous"===e?i=r[n.branchNumber-2]:"next"===e&&(i=r[n.branchNumber]),!i)throw Error("Branch not found");this._threadBinding.getState().switchToBranch(i)}unstable_getCopyText(){return ev(this.getState())}subscribe(e){return this._core.subscribe(e)}getMessagePartByIndex(e){if(e<0)throw Error("Message part index must be >= 0");return new e0(new eI({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.content[${e}]`,messagePartSelector:{type:"index",index:e}},getState:()=>e2(this.getState(),e),subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getMessagePartByToolCallId(e){return new e0(new eI({path:{...this.path,ref:this.path.ref+`${this.path.ref}.content[toolCallId=${JSON.stringify(e)}]`,messagePartSelector:{type:"toolCallId",toolCallId:e}},getState:()=>{let t=this._core.getState(),n=t.content.findIndex(t=>"tool-call"===t.type&&t.toolCallId===e);return -1===n?eE:e2(t,n)},subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getAttachmentByIndex(e){return new eQ(new eI({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.attachments[${e}]`,attachmentSource:"message",attachmentSelector:{type:"index",index:e}},getState:()=>{let t=this.getState().attachments,n=t?.[e];return n?{...n,source:"message"}:eE},subscribe:e=>this._core.subscribe(e)}))}}class e3{get path(){return this._threadBinding.path}get __internal_threadBinding(){return this._threadBinding}_threadBinding;constructor(e,t){const n=new eI({path:e.path,getState:()=>{var n,r;let i;return n=e.getState(),r=t.getState(),i=n.messages.at(-1),Object.freeze({threadId:r.id,metadata:r,capabilities:n.capabilities,isDisabled:n.isDisabled,isLoading:n.isLoading,isRunning:i?.role==="assistant"&&"running"===i.status.type,messages:n.messages,state:n.state,suggestions:n.suggestions,extras:n.extras,speech:n.speech})},subscribe:n=>{let r=e.subscribe(n),i=t.subscribe(n);return()=>{r(),i()}}});this._threadBinding={path:e.path,getState:()=>e.getState(),getStateState:()=>n.getState(),outerSubscribe:t=>e.outerSubscribe(t),subscribe:t=>e.subscribe(t)},this.composer=new eJ(new eA({path:{...this.path,ref:`${this.path.ref}.composer`,composerSource:"thread"},getState:()=>this._threadBinding.getState().composer,subscribe:e=>this._threadBinding.subscribe(e)})),this.__internal_bindMethods()}__internal_bindMethods(){this.append=this.append.bind(this),this.resumeRun=this.resumeRun.bind(this),this.unstable_resumeRun=this.unstable_resumeRun.bind(this),this.unstable_loadExternalState=this.unstable_loadExternalState.bind(this),this.importExternalState=this.importExternalState.bind(this),this.exportExternalState=this.exportExternalState.bind(this),this.startRun=this.startRun.bind(this),this.cancelRun=this.cancelRun.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.export=this.export.bind(this),this.import=this.import.bind(this),this.reset=this.reset.bind(this),this.getMessageByIndex=this.getMessageByIndex.bind(this),this.getMessageById=this.getMessageById.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getModelContext=this.getModelContext.bind(this),this.getModelConfig=this.getModelConfig.bind(this),this.getState=this.getState.bind(this)}composer;getState(){return this._threadBinding.getStateState()}append(e){var t;this._threadBinding.getState().append((t=this._threadBinding.getState().messages,"string"==typeof e?{createdAt:new Date,parentId:t.at(-1)?.id??null,sourceId:null,runConfig:{},role:"user",content:[{type:"text",text:e}],attachments:[],metadata:{custom:{}}}:{createdAt:e.createdAt??new Date,parentId:e.parentId??t.at(-1)?.id??null,sourceId:e.sourceId??null,role:e.role??"user",content:e.content,attachments:e.attachments??[],metadata:e.metadata??{custom:{}},runConfig:e.runConfig??{},startRun:e.startRun}))}subscribe(e){return this._threadBinding.subscribe(e)}getModelContext(){return this._threadBinding.getState().getModelContext()}getModelConfig(){return this.getModelContext()}startRun(e){let t;return this._threadBinding.getState().startRun({parentId:(t=null===e||"string"==typeof e?{parentId:e}:e).parentId??null,sourceId:t.sourceId??null,runConfig:t.runConfig??{}})}resumeRun(e){return this._threadBinding.getState().resumeRun({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{},...e.stream?{stream:e.stream}:{}})}unstable_resumeRun(e){return this.resumeRun(e)}exportExternalState(){return this._threadBinding.getState().exportExternalState()}importExternalState(e){this._threadBinding.getState().importExternalState(e)}unstable_loadExternalState(e){this._threadBinding.getState().unstable_loadExternalState(e)}cancelRun(){this._threadBinding.getState().cancelRun()}stopSpeaking(){return this._threadBinding.getState().stopSpeaking()}export(){return this._threadBinding.getState().export()}import(e){this._threadBinding.getState().import(e)}reset(e){this._threadBinding.getState().reset(e)}getMessageByIndex(e){if(e<0)throw Error("Message index must be >= 0");return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[${e}]`,messageSelector:{type:"index",index:e}},()=>{let t=this._threadBinding.getState().messages,n=t[e];if(n)return{message:n,parentId:t[e-1]?.id??null,index:e}})}getMessageById(e){return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[messageId=${JSON.stringify(e)}]`,messageSelector:{type:"messageId",messageId:e}},()=>this._threadBinding.getState().getMessageById(e))}_getMessageRuntime(e,t){return new e5(new eI({path:e,getState:()=>{let{message:e,parentId:n,index:r}=t()??{},{messages:i,speech:s}=this._threadBinding.getState();if(!e||void 0===n||void 0===r)return eE;let o=this._threadBinding.getState().getBranches(e.id),a=e.metadata.submittedFeedback;return{...e,...{[er]:e[er]},index:r,isLast:i.at(-1)?.id===e.id,parentId:n,branchNumber:o.indexOf(e.id)+1,branchCount:o.length,speech:s?.messageId===e.id?s:void 0,submittedFeedback:a}},subscribe:e=>this._threadBinding.subscribe(e)}),this._threadBinding)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new eR({event:e,binding:this._threadBinding}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}}let e4=(e,t)=>{if(void 0===t)return eE;let n=e.getItemById(t);return n?{id:n.id,remoteId:n.remoteId,externalId:n.externalId,title:n.title,status:n.status,isMain:n.id===e.mainThreadId}:eE};class e6{_core;_runtimeFactory;_getState;constructor(e,t=e3){this._core=e,this._runtimeFactory=t;const n=new ej({path:{},getState:()=>({mainThreadId:e.mainThreadId,newThreadId:e.newThreadId,threadIds:e.threadIds,archivedThreadIds:e.archivedThreadIds,isLoading:e.isLoading,threadItems:e.threadItems}),subscribe:t=>e.subscribe(t)});this._getState=n.getState.bind(n),this._mainThreadListItemRuntime=new eU(new eI({path:{ref:"threadItems[main]",threadSelector:{type:"main"}},getState:()=>e4(this._core,this._core.mainThreadId),subscribe:e=>this._core.subscribe(e)}),this._core),this.main=new t(new eA({path:{ref:"threads.main",threadSelector:{type:"main"}},getState:()=>e.getMainThreadRuntimeCore(),subscribe:t=>e.subscribe(t)}),this._mainThreadListItemRuntime),this.__internal_bindMethods()}__internal_bindMethods(){this.switchToThread=this.switchToThread.bind(this),this.switchToNewThread=this.switchToNewThread.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getById=this.getById.bind(this),this.getItemById=this.getItemById.bind(this),this.getItemByIndex=this.getItemByIndex.bind(this),this.getArchivedItemByIndex=this.getArchivedItemByIndex.bind(this)}switchToThread(e){return this._core.switchToThread(e)}switchToNewThread(){return this._core.switchToNewThread()}getState(){return this._getState()}subscribe(e){return this._core.subscribe(e)}_mainThreadListItemRuntime;main;get mainItem(){return this._mainThreadListItemRuntime}getById(e){return new this._runtimeFactory(new eA({path:{ref:`threads[threadId=${JSON.stringify(e)}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>this._core.getThreadRuntimeCore(e),subscribe:e=>this._core.subscribe(e)}),this.mainItem)}getItemByIndex(e){return new eU(new eI({path:{ref:`threadItems[${e}]`,threadSelector:{type:"index",index:e}},getState:()=>e4(this._core,this._core.threadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getArchivedItemByIndex(e){return new eU(new eI({path:{ref:`archivedThreadItems[${e}]`,threadSelector:{type:"archiveIndex",index:e}},getState:()=>e4(this._core,this._core.archivedThreadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getItemById(e){return new eU(new eI({path:{ref:`threadItems[threadId=${e}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>e4(this._core,e),subscribe:e=>this._core.subscribe(e)}),this._core)}}class e8{_core;threads;get threadList(){return this.threads}_thread;constructor(e){this._core=e,this.threads=new e6(e.threads),this._thread=this.threads.main,this.__internal_bindMethods()}__internal_bindMethods(){this.switchToNewThread=this.switchToNewThread.bind(this),this.switchToThread=this.switchToThread.bind(this),this.registerModelContextProvider=this.registerModelContextProvider.bind(this),this.registerModelConfigProvider=this.registerModelConfigProvider.bind(this),this.reset=this.reset.bind(this)}get thread(){return this._thread}switchToNewThread(){return this._core.threads.switchToNewThread()}switchToThread(e){return this._core.threads.switchToThread(e)}registerModelContextProvider(e){return this._core.registerModelContextProvider(e)}registerModelConfigProvider(e){return this.registerModelContextProvider(e)}reset({initialMessages:e}={}){return this._core.threads.getMainThreadRuntimeCore().import(ew(e??[]))}}let e9=(0,C.createContext)(null);e.s(["useExternalStoreRuntime",0,e=>{let[t]=(0,C.useState)(()=>new ez(e));(0,C.useEffect)(()=>{t.setAdapter(e)});let{modelContext:n}=(0,C.useContext)(e9)??{};return(0,C.useEffect)(()=>{if(n)return t.registerModelContextProvider(n)},[n,t]),(0,C.useMemo)(()=>new e8(t),[t])}],62680)},4520,77501,e=>{"use strict";var t=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};e.s(["Subscribable",()=>t],77501);var n=new class extends t{#e;#t;#n;constructor(){super(),this.#n=e=>{if("u">typeof window&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#e?this.#e:globalThis.document?.visibilityState!=="hidden"}};e.s(["focusManager",()=>n],4520)},3,68911,e=>{"use strict";e.i(44172);var t={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},n=new class{#r=t;#i=!1;setTimeoutProvider(e){this.#r=e}setTimeout(e,t){return this.#r.setTimeout(e,t)}clearTimeout(e){this.#r.clearTimeout(e)}setInterval(e,t){return this.#r.setInterval(e,t)}clearInterval(e){this.#r.clearInterval(e)}};function r(e){setTimeout(e,0)}e.s(["systemSetTimeoutZero",()=>r,"timeoutManager",()=>n],68911);var i="u"<typeof window||"Deno"in globalThis;function s(){}function o(e,t){return"function"==typeof e?e(t):e}function a(e){return"number"==typeof e&&e>=0&&e!==1/0}function l(e,t){return Math.max(e+(t||0)-Date.now(),0)}function u(e,t){return"function"==typeof e?e(t):e}function c(e,t){return"function"==typeof e?e(t):e}function d(e,t){let{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==p(o,t.options))return!1}else if(!m(t.queryKey,o))return!1}if("all"!==n){let e=t.isActive();if("active"===n&&!e||"inactive"===n&&e)return!1}return("boolean"!=typeof a||t.isStale()===a)&&(!i||i===t.state.fetchStatus)&&(!s||!!s(t))}function h(e,t){let{exact:n,status:r,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(f(t.options.mutationKey)!==f(s))return!1}else if(!m(t.options.mutationKey,s))return!1}return(!r||t.state.status===r)&&(!i||!!i(t))}function p(e,t){return(t?.queryKeyHashFn||f)(e)}function f(e){return JSON.stringify(e,(e,t)=>x(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function m(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&Object.keys(t).every(n=>m(e[n],t[n]))}var g=Object.prototype.hasOwnProperty;function y(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function b(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function x(e){if(!v(e))return!1;let t=e.constructor;if(void 0===t)return!0;let n=t.prototype;return!!v(n)&&!!n.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function v(e){return"[object Object]"===Object.prototype.toString.call(e)}function w(e){return new Promise(t=>{n.setTimeout(t,e)})}function S(e,t,n){return"function"==typeof n.structuralSharing?n.structuralSharing(e,t):!1!==n.structuralSharing?function e(t,n,r=0){if(t===n)return t;if(r>500)return n;let i=b(t)&&b(n);if(!i&&!(x(t)&&x(n)))return n;let s=(i?t:Object.keys(t)).length,o=i?n:Object.keys(n),a=o.length,l=i?Array(a):{},u=0;for(let c=0;c<a;c++){let a=i?c:o[c],d=t[a],h=n[a];if(d===h){l[a]=d,(i?c<s:g.call(t,a))&&u++;continue}if(null===d||null===h||"object"!=typeof d||"object"!=typeof h){l[a]=h;continue}let p=e(d,h,r+1);l[a]=p,p===d&&u++}return s===a&&u===s?t:l}(e,t):t}function k(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function _(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var E=Symbol();function C(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==E?e.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`))}function T(e,t){return"function"==typeof e?e(...t):!!e}function I(e,t,n){let r,i=!1;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(r??=t(),i||(i=!0,r.aborted?n():r.addEventListener("abort",n,{once:!0})),r)}),e}e.s(["addConsumeAwareSignal",()=>I,"addToEnd",()=>k,"addToStart",()=>_,"ensureQueryFn",()=>C,"functionalUpdate",()=>o,"hashKey",()=>f,"hashQueryKeyByOptions",()=>p,"isServer",()=>i,"isValidTimeout",()=>a,"matchMutation",()=>h,"matchQuery",()=>d,"noop",()=>s,"partialMatchKey",()=>m,"replaceData",()=>S,"resolveEnabled",()=>c,"resolveStaleTime",()=>u,"shallowEqualObjects",()=>y,"shouldThrowError",()=>T,"skipToken",()=>E,"sleep",()=>w,"timeUntilStale",()=>l],3)},65617,e=>{"use strict";let t;var n=e.i(3),r=(t=()=>n.isServer,{isServer:()=>t(),setIsServer(e){t=e}});e.s(["environmentManager",()=>r])},6786,e=>{"use strict";let t,n,r,i,s,o;var a=e.i(68911).systemSetTimeoutZero,l=(t=[],n=0,r=e=>{e()},i=e=>{e()},s=a,{batch:e=>{let o;n++;try{o=e()}finally{let e;--n||(e=t,t=[],e.length&&s(()=>{i(()=>{e.forEach(e=>{r(e)})})}))}return o},batchCalls:e=>(...t)=>{o(()=>{e(...t)})},schedule:o=e=>{n?t.push(e):s(()=>{r(e)})},setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{i=e},setScheduler:e=>{s=e}});e.s(["notifyManager",()=>l])},13598,20820,e=>{"use strict";var t=e.i(77501),n=new class extends t.Subscribable{#s=!0;#t;#n;constructor(){super(),this.#n=e=>{if("u">typeof window&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#s!==e&&(this.#s=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#s}};function r(){let e,t,n=new Promise((n,r)=>{e=n,t=r});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.status="pending",n.catch(()=>{}),n.resolve=t=>{r({status:"fulfilled",value:t}),e(t)},n.reject=e=>{r({status:"rejected",reason:e}),t(e)},n}e.s(["onlineManager",()=>n],13598),e.i(3),e.s(["pendingThenable",()=>r],20820)},28574,20979,19644,e=>{"use strict";e.i(44172);var t=e.i(3),n=e.i(6786),r=e.i(4520),i=e.i(13598),s=e.i(20820),o=e.i(65617);function a(e){return Math.min(1e3*2**e,3e4)}function l(e){return(e??"online")!=="online"||i.onlineManager.isOnline()}var u=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function c(e){let n,c=!1,d=0,h=(0,s.pendingThenable)(),p=()=>r.focusManager.isFocused()&&("always"===e.networkMode||i.onlineManager.isOnline())&&e.canRun(),f=()=>l(e.networkMode)&&e.canRun(),m=e=>{"pending"===h.status&&(n?.(),h.resolve(e))},g=e=>{"pending"===h.status&&(n?.(),h.reject(e))},y=()=>new Promise(t=>{n=e=>{("pending"!==h.status||p())&&t(e)},e.onPause?.()}).then(()=>{n=void 0,"pending"===h.status&&e.onContinue?.()}),b=()=>{let n;if("pending"!==h.status)return;let r=0===d?e.initialPromise:void 0;try{n=r??e.fn()}catch(e){n=Promise.reject(e)}Promise.resolve(n).then(m).catch(n=>{if("pending"!==h.status)return;let r=e.retry??3*!o.environmentManager.isServer(),i=e.retryDelay??a,s="function"==typeof i?i(d,n):i,l=!0===r||"number"==typeof r&&d<r||"function"==typeof r&&r(d,n);c||!l?g(n):(d++,e.onFail?.(d,n),(0,t.sleep)(s).then(()=>p()?void 0:y()).then(()=>{c?g(n):b()}))})};return{promise:h,status:()=>h.status,cancel:t=>{if("pending"===h.status){let n=new u(t);g(n),e.onCancel?.(n)}},continue:()=>(n?.(),h),cancelRetry:()=>{c=!0},continueRetry:()=>{c=!1},canStart:f,start:()=>(f()?b():y().then(b),h)}}e.s(["CancelledError",()=>u,"canFetch",()=>l,"createRetryer",()=>c],20979);var d=e.i(68911),h=class{#o;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),(0,t.isValidTimeout)(this.gcTime)&&(this.#o=d.timeoutManager.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(o.environmentManager.isServer()?1/0:3e5))}clearGcTimeout(){this.#o&&(d.timeoutManager.clearTimeout(this.#o),this.#o=void 0)}};e.s(["Removable",()=>h],19644);var p=class extends h{#a;#l;#u;#c;#d;#h;#p;constructor(e){super(),this.#p=!1,this.#h=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#c=e.client,this.#u=this.#c.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#a=g(this.options),this.state=e.state??this.#a,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#d?.promise}setOptions(e){if(this.options={...this.#h,...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let e=g(this.options);void 0!==e.data&&(this.setState(m(e.data,e.dataUpdatedAt)),this.#a=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,n){let r=(0,t.replaceData)(this.state.data,e,this.options);return this.#f({data:r,type:"success",dataUpdatedAt:n?.updatedAt,manual:n?.manual}),r}setState(e,t){this.#f({type:"setState",state:e,setStateOptions:t})}cancel(e){let n=this.#d?.promise;return this.#d?.cancel(e),n?n.then(t.noop).catch(t.noop):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#a}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>!1!==(0,t.resolveEnabled)(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===t.skipToken||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===(0,t.resolveStaleTime)(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!(0,t.timeUntilStale)(this.state.dataUpdatedAt,e))}onFocus(){let e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#d?.continue()}onOnline(){let e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#d?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#d&&(this.#p||this.#m()?this.#d.cancel({revert:!0}):this.#d.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#m(){return"paused"===this.state.fetchStatus&&"pending"===this.state.status}invalidate(){this.state.isInvalidated||this.#f({type:"invalidate"})}async fetch(e,n){let r;if("idle"!==this.state.fetchStatus&&this.#d?.status()!=="rejected"){if(void 0!==this.state.data&&n?.cancelRefetch)this.cancel({silent:!0});else if(this.#d)return this.#d.continueRetry(),this.#d.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let i=new AbortController,s=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#p=!0,i.signal)})},o=()=>{let e,r=(0,t.ensureQueryFn)(this.options,n),i=(s(e={client:this.#c,queryKey:this.queryKey,meta:this.meta}),e);return(this.#p=!1,this.options.persister)?this.options.persister(r,i,this):r(i)},a=(s(r={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:this.#c,state:this.state,fetchFn:o}),r);this.options.behavior?.onFetch(a,this),this.#l=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#f({type:"fetch",meta:a.fetchOptions?.meta}),this.#d=c({initialPromise:n?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof u&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),i.abort()},onFail:(e,t)=>{this.#f({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#f({type:"pause"})},onContinue:()=>{this.#f({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#d.start();if(void 0===e)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#u.config.onSuccess?.(e,this),this.#u.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof u){if(e.silent)return this.#d.promise;else if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#f({type:"error",error:e}),this.#u.config.onError?.(e,this),this.#u.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#f(e){let t=t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...f(t.data,this.options),fetchMeta:e.meta??null};case"success":let n={...t,...m(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=e.manual?n:void 0,n;case"error":let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}};this.state=t(this.state),n.notifyManager.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function f(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:l(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function m(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function g(e){let t="function"==typeof e.initialData?e.initialData():e.initialData,n=void 0!==t,r=n?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}e.s(["Query",()=>p,"fetchState",()=>f],28574)},34682,e=>{"use strict";var t=e.i(79054),n=e.i(20314),r=t.createContext(void 0),i=e=>{let n=t.useContext(r);if(e)return e;if(!n)throw Error("No QueryClient set, use QueryClientProvider to set one");return n},s=({client:e,children:i})=>(t.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,n.jsx)(r.Provider,{value:e,children:i}));e.s(["QueryClientProvider",()=>s,"useQueryClient",()=>i])},62885,e=>{"use strict";let t;var n=e.i(4520),r=e.i(65617),i=e.i(6786),s=e.i(28574),o=e.i(77501),a=e.i(20820),l=e.i(3),u=e.i(68911),c=class extends o.Subscribable{constructor(e,t){super(),this.options=t,this.#c=e,this.#g=null,this.#y=(0,a.pendingThenable)(),this.bindMethods(),this.setOptions(t)}#c;#b=void 0;#x=void 0;#v=void 0;#w;#S;#y;#g;#k;#_;#E;#C;#T;#I;#j=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#b.addObserver(this),d(this.#b,this.options)?this.#A():this.updateResult(),this.#R())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return h(this.#b,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return h(this.#b,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#M(),this.#N(),this.#b.removeObserver(this)}setOptions(e){let t=this.options,n=this.#b;if(this.options=this.#c.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,l.resolveEnabled)(this.options.enabled,this.#b))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#O(),this.#b.setOptions(this.options),t._defaulted&&!(0,l.shallowEqualObjects)(this.options,t)&&this.#c.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#b,observer:this});let r=this.hasListeners();r&&p(this.#b,n,this.options,t)&&this.#A(),this.updateResult(),r&&(this.#b!==n||(0,l.resolveEnabled)(this.options.enabled,this.#b)!==(0,l.resolveEnabled)(t.enabled,this.#b)||(0,l.resolveStaleTime)(this.options.staleTime,this.#b)!==(0,l.resolveStaleTime)(t.staleTime,this.#b))&&this.#P();let i=this.#D();r&&(this.#b!==n||(0,l.resolveEnabled)(this.options.enabled,this.#b)!==(0,l.resolveEnabled)(t.enabled,this.#b)||i!==this.#I)&&this.#F(i)}getOptimisticResult(e){var t,n;let r=this.#c.getQueryCache().build(this.#c,e),i=this.createResult(r,e);return t=this,n=i,(0,l.shallowEqualObjects)(t.getCurrentResult(),n)||(this.#v=i,this.#S=this.options,this.#w=this.#b.state),i}getCurrentResult(){return this.#v}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),"promise"===n&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#y.status||this.#y.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,n))})}trackProp(e){this.#j.add(e)}getCurrentQuery(){return this.#b}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#c.defaultQueryOptions(e),n=this.#c.getQueryCache().build(this.#c,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#A({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#v))}#A(e){this.#O();let t=this.#b.fetch(this.options,e);return e?.throwOnError||(t=t.catch(l.noop)),t}#P(){this.#M();let e=(0,l.resolveStaleTime)(this.options.staleTime,this.#b);if(r.environmentManager.isServer()||this.#v.isStale||!(0,l.isValidTimeout)(e))return;let t=(0,l.timeUntilStale)(this.#v.dataUpdatedAt,e);this.#C=u.timeoutManager.setTimeout(()=>{this.#v.isStale||this.updateResult()},t+1)}#D(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#b):this.options.refetchInterval)??!1}#F(e){this.#N(),this.#I=e,!r.environmentManager.isServer()&&!1!==(0,l.resolveEnabled)(this.options.enabled,this.#b)&&(0,l.isValidTimeout)(this.#I)&&0!==this.#I&&(this.#T=u.timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||n.focusManager.isFocused())&&this.#A()},this.#I))}#R(){this.#P(),this.#F(this.#D())}#M(){this.#C&&(u.timeoutManager.clearTimeout(this.#C),this.#C=void 0)}#N(){this.#T&&(u.timeoutManager.clearInterval(this.#T),this.#T=void 0)}createResult(e,t){let n,r=this.#b,i=this.options,o=this.#v,u=this.#w,c=this.#S,h=e!==r?e.state:this.#x,{state:m}=e,g={...m},y=!1;if(t._optimisticResults){let n=this.hasListeners(),o=!n&&d(e,t),a=n&&p(e,r,t,i);(o||a)&&(g={...g,...(0,s.fetchState)(m.data,e.options)}),"isRestoring"===t._optimisticResults&&(g.fetchStatus="idle")}let{error:b,errorUpdatedAt:x,status:v}=g;n=g.data;let w=!1;if(void 0!==t.placeholderData&&void 0===n&&"pending"===v){let e;o?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=o.data,w=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#E?.state.data,this.#E):t.placeholderData,void 0!==e&&(v="success",n=(0,l.replaceData)(o?.data,e,t),y=!0)}if(t.select&&void 0!==n&&!w)if(o&&n===u?.data&&t.select===this.#k)n=this.#_;else try{this.#k=t.select,n=t.select(n),n=(0,l.replaceData)(o?.data,n,t),this.#_=n,this.#g=null}catch(e){this.#g=e}this.#g&&(b=this.#g,n=this.#_,x=Date.now(),v="error");let S="fetching"===g.fetchStatus,k="pending"===v,_="error"===v,E=k&&S,C=void 0!==n,T={status:v,fetchStatus:g.fetchStatus,isPending:k,isSuccess:"success"===v,isError:_,isInitialLoading:E,isLoading:E,data:n,dataUpdatedAt:g.dataUpdatedAt,error:b,errorUpdatedAt:x,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:g.dataUpdateCount>h.dataUpdateCount||g.errorUpdateCount>h.errorUpdateCount,isFetching:S,isRefetching:S&&!k,isLoadingError:_&&!C,isPaused:"paused"===g.fetchStatus,isPlaceholderData:y,isRefetchError:_&&C,isStale:f(e,t),refetch:this.refetch,promise:this.#y,isEnabled:!1!==(0,l.resolveEnabled)(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=void 0!==T.data,n="error"===T.status&&!t,i=e=>{n?e.reject(T.error):t&&e.resolve(T.data)},s=()=>{i(this.#y=T.promise=(0,a.pendingThenable)())},o=this.#y;switch(o.status){case"pending":e.queryHash===r.queryHash&&i(o);break;case"fulfilled":(n||T.data!==o.value)&&s();break;case"rejected":n&&T.error===o.reason||s()}}return T}updateResult(){let e=this.#v,t=this.createResult(this.#b,this.options);if(this.#w=this.#b.state,this.#S=this.options,void 0!==this.#w.data&&(this.#E=this.#b),(0,l.shallowEqualObjects)(t,e))return;this.#v=t;let n=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n="function"==typeof t?t():t;if("all"===n||!n&&!this.#j.size)return!0;let r=new Set(n??this.#j);return this.options.throwOnError&&r.add("error"),Object.keys(this.#v).some(t=>this.#v[t]!==e[t]&&r.has(t))};this.#L({listeners:n()})}#O(){let e=this.#c.getQueryCache().build(this.#c,this.options);if(e===this.#b)return;let t=this.#b;this.#b=e,this.#x=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#R()}#L(e){i.notifyManager.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#v)}),this.#c.getQueryCache().notify({query:this.#b,type:"observerResultsUpdated"})})}};function d(e,t){return!1!==(0,l.resolveEnabled)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&h(e,t,t.refetchOnMount)}function h(e,t,n){if(!1!==(0,l.resolveEnabled)(t.enabled,e)&&"static"!==(0,l.resolveStaleTime)(t.staleTime,e)){let r="function"==typeof n?n(e):n;return"always"===r||!1!==r&&f(e,t)}return!1}function p(e,t,n,r){return(e!==t||!1===(0,l.resolveEnabled)(r.enabled,e))&&(!n.suspense||"error"!==e.state.status)&&f(e,n)}function f(e,t){return!1!==(0,l.resolveEnabled)(t.enabled,e)&&e.isStaleByTime((0,l.resolveStaleTime)(t.staleTime,e))}e.i(44172);var m=e.i(79054),g=e.i(34682);e.i(20314);var y=m.createContext((t=!1,{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t})),b=m.createContext(!1);b.Provider;var x=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function v(e,t){return function(e,t,n){let s,o=m.useContext(b),a=m.useContext(y),u=(0,g.useQueryClient)(n),c=u.defaultQueryOptions(e);u.getDefaultOptions().queries?._experimental_beforeQuery?.(c);let d=u.getQueryCache().get(c.queryHash);if(c._optimisticResults=o?"isRestoring":"optimistic",c.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=c.staleTime;c.staleTime="function"==typeof t?(...n)=>e(t(...n)):e(t),"number"==typeof c.gcTime&&(c.gcTime=Math.max(c.gcTime,1e3))}s=d?.state.error&&"function"==typeof c.throwOnError?(0,l.shouldThrowError)(c.throwOnError,[d.state.error,d]):c.throwOnError,(c.suspense||c.experimental_prefetchInRender||s)&&!a.isReset()&&(c.retryOnMount=!1),m.useEffect(()=>{a.clearReset()},[a]);let h=!u.getQueryCache().get(c.queryHash),[p]=m.useState(()=>new t(u,c)),f=p.getOptimisticResult(c),v=!o&&!1!==e.subscribed;if(m.useSyncExternalStore(m.useCallback(e=>{let t=v?p.subscribe(i.notifyManager.batchCalls(e)):l.noop;return p.updateResult(),t},[p,v]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),m.useEffect(()=>{p.setOptions(c)},[c,p]),c?.suspense&&f.isPending)throw x(c,p,a);if((({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&void 0===e.data||(0,l.shouldThrowError)(n,[e.error,r])))({result:f,errorResetBoundary:a,throwOnError:c.throwOnError,query:d,suspense:c.suspense}))throw f.error;if(u.getDefaultOptions().queries?._experimental_afterQuery?.(c,f),c.experimental_prefetchInRender&&!r.environmentManager.isServer()&&f.isLoading&&f.isFetching&&!o){let e=h?x(c,p,a):d?.promise;e?.catch(l.noop).finally(()=>{p.updateResult()})}return c.notifyOnChangeProps?f:p.trackResult(f)}(e,c,t)}e.s(["useQuery",()=>v],62885)},87975,e=>{"use strict";var t=e.i(6786),n=e.i(19644),r=e.i(20979),i=class extends n.Removable{#c;#B;#z;#d;constructor(e){super(),this.#c=e.client,this.mutationId=e.mutationId,this.#z=e.mutationCache,this.#B=[],this.state=e.state||s(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#B.includes(e)||(this.#B.push(e),this.clearGcTimeout(),this.#z.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#B=this.#B.filter(t=>t!==e),this.scheduleGc(),this.#z.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#B.length||("pending"===this.state.status?this.scheduleGc():this.#z.remove(this))}continue(){return this.#d?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#f({type:"continue"})},n={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#d=(0,r.createRetryer)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#f({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#f({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#z.canRun(this)});let i="pending"===this.state.status,s=!this.#d.canStart();try{if(i)t();else{this.#f({type:"pending",variables:e,isPaused:s}),this.#z.config.onMutate&&await this.#z.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#f({type:"pending",context:t,variables:e,isPaused:s})}let r=await this.#d.start();return await this.#z.config.onSuccess?.(r,e,this.state.context,this,n),await this.options.onSuccess?.(r,e,this.state.context,n),await this.#z.config.onSettled?.(r,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(r,null,e,this.state.context,n),this.#f({type:"success",data:r}),r}catch(t){try{await this.#z.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#z.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#f({type:"error",error:t}),t}finally{this.#z.runNext(this)}}#f(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),t.notifyManager.batch(()=>{this.#B.forEach(t=>{t.onMutationUpdate(e)}),this.#z.notify({mutation:this,type:"updated",action:e})})}};function s(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}e.s(["Mutation",()=>i,"getDefaultState",()=>s])},23217,98440,61152,73138,6420,e=>{"use strict";var t=e.i(79054),n=e.i(62680),r=e.i(62885),i=e.i(87975),s=e.i(6786),o=e.i(77501),a=e.i(3),l=class extends o.Subscribable{#c;#v=void 0;#U;#q;constructor(e,t){super(),this.#c=e,this.setOptions(t),this.bindMethods(),this.#$()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#c.defaultMutationOptions(e),(0,a.shallowEqualObjects)(this.options,t)||this.#c.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#U,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,a.hashKey)(t.mutationKey)!==(0,a.hashKey)(this.options.mutationKey)?this.reset():this.#U?.state.status==="pending"&&this.#U.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#U?.removeObserver(this)}onMutationUpdate(e){this.#$(),this.#L(e)}getCurrentResult(){return this.#v}reset(){this.#U?.removeObserver(this),this.#U=void 0,this.#$(),this.#L()}mutate(e,t){return this.#q=t,this.#U?.removeObserver(this),this.#U=this.#c.getMutationCache().build(this.#c,this.options),this.#U.addObserver(this),this.#U.execute(e)}#$(){let e=this.#U?.state??(0,i.getDefaultState)();this.#v={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#L(e){s.notifyManager.batch(()=>{if(this.#q&&this.hasListeners()){let t=this.#v.variables,n=this.#v.context,r={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#q.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#q.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#q.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#q.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#v)})})}},u=e.i(34682),c=e.i(17406);function d(e){return["chat-messages",e]}async function h(e){let t=await fetch(`/api/interactive/chat/${e}/messages`);if(!t.ok)throw console.error(`[ChatState] fetch failed: ${t.status}`,await t.text().catch(()=>"")),Error(`Failed to fetch chat state: ${t.status}`);return t.json()}async function p(e,t,n,r,i){let s=await fetch(`/api/interactive/chat/${e}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,worktreePath:n,model:r,agentType:i})});if(!s.ok)throw Error(`Failed to send message: ${s.status}`);return(await s.json()).message}function f(e){return{id:e.id,role:e.role===c.InteractiveMessageRole.user?"user":"assistant",content:[{type:"text",text:e.content}],createdAt:e.createdAt?new Date(e.createdAt):void 0}}function m(e,i,o){let m=(0,u.useQueryClient)(),g=(0,t.useRef)(o?.model),y=(0,t.useRef)(o?.agentType);g.current=o?.model,y.current=o?.agentType;let b=(0,t.useRef)(o?.debugMode??!1);b.current=o?.debugMode??!1;let[x,v]=(0,t.useState)([]),w=(0,t.useCallback)((e,t)=>{b.current&&v(n=>[...n,{id:`dbg-${Date.now()}-${Math.random()}`,timestamp:new Date,label:e,detail:t}])},[]),{data:S,isLoading:k}=(0,r.useQuery)({queryKey:d(e),queryFn:()=>h(e),initialData:o?.initialChatState,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1});(0,t.useEffect)(()=>{S?.turnStatus==="unread"&&fetch(`/api/interactive/chat/${e}/mark-read`,{method:"POST"})},[S?.turnStatus,e]);let _=(0,t.useMemo)(()=>S?.messages??[],[S?.messages]),E=S?.sessionStatus??null,C=(0,t.useRef)(null);(0,t.useEffect)(()=>{if(E&&E!==C.current){let e=S?.sessionInfo;w(`session_${E}`,e?`model=${e.model??"?"}, sid=${e.sessionId?.slice(0,8)??"?"}`:void 0)}C.current=E},[E,S?.sessionInfo,w]);let T=S?.streamingText??null,I=(0,t.useRef)(null);S?.sessionInfo&&(I.current=S.sessionInfo);let j=S?.sessionInfo??I.current,[A,R]=(0,t.useState)(""),[M,N]=(0,t.useState)(null),[O,P]=(0,t.useState)(!1),D=(0,t.useRef)(null),F=(0,t.useRef)(null),[L,B]=(0,t.useState)(null);(0,t.useEffect)(()=>{let e=S?.pendingInteraction??null;e?B(e):!e&&L&&B(null)},[S?.pendingInteraction,L]);let z=(0,t.useCallback)(()=>{D.current&&clearTimeout(D.current),D.current=setTimeout(()=>P(!0),600)},[]),U=(0,t.useCallback)(()=>{D.current&&(clearTimeout(D.current),D.current=null),P(!1)},[]),q=_.length>0?_[_.length-1].role:null;(0,t.useEffect)(()=>{q===c.InteractiveMessageRole.assistant&&U()},[q,_.length,U]),(0,t.useEffect)(()=>{let t=new EventSource(`/api/interactive/chat/${e}/stream`);return F.current=t,t.addEventListener("delta",e=>{try{let t=JSON.parse(e.data);t.delta&&(U(),R(e=>e+t.delta),N(null))}catch{}}),t.addEventListener("activity",e=>{U();try{let t=JSON.parse(e.data);t.activity&&w(`[${t.activity.kind}] ${t.activity.label}`,t.activity.detail)}catch{}}),t.addEventListener("log",e=>{try{let t=JSON.parse(e.data);t.log&&(U(),N(t.log),w("log",t.log))}catch{}}),t.addEventListener("interaction",e=>{try{let t=JSON.parse(e.data);t.interaction&&(U(),B(t.interaction))}catch{}}),t.addEventListener("message",t=>{try{let r=JSON.parse(t.data);if(r.message){var n;n=r.message,m.setQueryData(d(e),e=>{let t=e??{messages:[],sessionStatus:null,streamingText:null,sessionInfo:null};if(t.messages.find(e=>e.id===n.id))return t;let r=t.messages.filter(e=>!(e.id.startsWith("optimistic-")&&e.role===n.role&&e.content===n.content));return{...t,messages:[...r,n]}}),r.message.role===c.InteractiveMessageRole.assistant&&U()}}catch{}}),t.addEventListener("session_status",t=>{try{var n;let r=JSON.parse(t.data);r.sessionStatus&&(n=r.sessionStatus,m.setQueryData(d(e),e=>e?{...e,sessionStatus:n}:e))}catch{}}),t.addEventListener("turn_status",t=>{try{var n;let r=JSON.parse(t.data);r.turnStatus&&(n=r.turnStatus,m.setQueryData(d(e),e=>e?{...e,turnStatus:n}:e))}catch{}}),t.addEventListener("workflow_step",t=>{try{let n=JSON.parse(t.data);if(!n.step)return;m.setQueryData(d(e),e=>{let t;if(!e)return e;let r=e.workflow,i=r?.steps.findIndex(e=>e.id===n.step.id)??-1;r&&-1!==i?(t=r.steps.slice())[i]=n.step:t=[...r?.steps??[],n.step].sort((e,t)=>e.stepIndex-t.stepIndex);let s=t.find(e=>"running"===e.status);return{...e,workflow:{workflowId:n.step.workflowId,steps:t,currentStepId:s?.id??null}}})}catch{}}),t.addEventListener("done",()=>{N(null),U(),w("turn_done"),B(null),R("")}),t.addEventListener("open",()=>{m.invalidateQueries({queryKey:d(e)})}),t.onerror=()=>{},()=>{t.close(),F.current=null}},[e,m,U,w]);let $=function(e,n){let r=(0,u.useQueryClient)(void 0),[i]=t.useState(()=>new l(r,e));t.useEffect(()=>{i.setOptions(e)},[i,e]);let o=t.useSyncExternalStore(t.useCallback(e=>i.subscribe(s.notifyManager.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),c=t.useCallback((e,t)=>{i.mutate(e,t).catch(a.noop)},[i]);if(o.error&&(0,a.shouldThrowError)(i.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:c,mutateAsync:o.mutate}}({mutationFn:t=>p(e,t,i??"",g.current,y.current),onMutate:async t=>{w("send_message",`model=${g.current??"default"}, agent=${y.current??"default"}, len=${t.length}`),z(),await m.cancelQueries({queryKey:d(e)});let n=m.getQueryData(d(e));return m.setQueryData(d(e),n=>({...n??{sessionStatus:"booting",sessionInfo:null},messages:[...n?.messages??[],{id:`optimistic-${Date.now()}`,featureId:e,role:c.InteractiveMessageRole.user,content:t,createdAt:new Date,updatedAt:new Date}],streamingText:null})),{previous:n}},onError:(t,n,r)=>{r?.previous&&m.setQueryData(d(e),r.previous)},onSettled:()=>{m.invalidateQueries({queryKey:d(e)})}}),H=S?.turnStatus,V=O||!!A||!!M||"booting"===E||"processing"===H,Q=A??T??"",W=(0,t.useMemo)(()=>{let e=S?.workflow??null;if(!e||0===e.steps.length)return{hasPlan:!1,steps:[],activeStepId:null,allDone:!1,liveStatus:null};let t=new Map;for(let e of _){let n=e.stepId;if(!n||e.role!==c.InteractiveMessageRole.assistant)continue;let r=t.get(n)??[];r.push(e),t.set(n,r)}let n=e.steps.map(e=>({definition:{id:e.id,stepKey:e.stepKey,title:e.title,description:e.description},status:function(e){switch(e){case"pending":case"running":case"done":case"failed":case"interrupted":return e;default:return"pending"}}(e.status),metadata:function(e){if(!e)return null;try{let t=JSON.parse(e);return t&&"object"==typeof t&&!Array.isArray(t)?t:null}catch{return null}}(e.metadata),toolMessages:t.get(e.id)??[]})),r=n.length>0&&n.every(e=>"done"===e.status),i=T?.trim()??"",s=A?.trim()??"",o=(s||i).split("\n")[0]?.slice(0,80)??"",a=null;return r?a=null:M?a=M:o?a=o:("processing"===H||O||"booting"===E)&&(a="booting"===E?"Waking up…":"Thinking…"),{hasPlan:!0,steps:n,activeStepId:e.currentStepId,allDone:r,liveStatus:a}},[S?.workflow,_,M,A,T,H,O,E]),K=(0,t.useMemo)(()=>W.hasPlan?_.find(e=>e.role===c.InteractiveMessageRole.user&&!e.stepId)??null:null,[W.hasPlan,_]),G=(0,t.useMemo)(()=>{let e,t=W.hasPlan,n=t&&!W.allDone,r=(t?_.filter(e=>e.id!==K?.id&&!e.stepId&&(!n||e.role!==c.InteractiveMessageRole.assistant)):_).map(f);if(o?.debugMode&&x.length>0){let t=x.map(e=>({id:e.id,role:"assistant",content:[{type:"text",text:e.detail?`🔧 **${e.label}** — ${e.detail}`:`🔧 **${e.label}**`}],createdAt:e.timestamp}));e=[];let n=0,i=0;for(;n<r.length&&i<t.length;)(r[n].createdAt?new Date(r[n].createdAt).getTime():0)<=(t[i].createdAt?new Date(t[i].createdAt).getTime():0)?e.push(r[n++]):e.push(t[i++]);for(;n<r.length;)e.push(r[n++]);for(;i<t.length;)e.push(t[i++])}else e=r;if(t)return e;if(Q.trim()){let t=[{type:"text",text:Q}];M&&t.push({type:"text",text:`*⏳ ${M}*`}),e.push({id:"streaming",role:"assistant",content:t})}else M?e.push({id:"streaming",role:"assistant",content:[{type:"text",text:`*⏳ ${M}*`}]}):(O||"booting"===E)&&e.push({id:"streaming",role:"assistant",content:[{type:"text",text:"booting"===E?"*Agent is waking up...*":"*Thinking...*"}]});return e},[_,K?.id,Q,O,E,M,o?.debugMode,x,W.hasPlan,W.allDone]),J=(0,t.useMemo)(()=>V?{isRunning:!0,statusText:M}:{isRunning:!1,statusText:null},[V,M]),Y=(0,t.useCallback)(async e=>{let t=e.content.find(e=>"text"===e.type);if(t?.type!=="text"||!t.text.trim())return;let n=o?.contentTransform?o.contentTransform(t.text):t.text;$.mutate(n,{onSuccess:()=>o?.onMessageSent?.()})},[$,o]),X=(0,t.useCallback)(async()=>{let t=await fetch(`/api/interactive/chat/${e}/messages`,{method:"DELETE"});if(!t.ok)throw Error(`Failed to clear chat: ${t.status}`);R(""),v([]),N(null),U(),B(null),m.invalidateQueries({queryKey:d(e)})},[e,m,U]),Z=(0,t.useCallback)(async()=>{let t=await fetch(`/api/interactive/chat/${e}/stop`,{method:"POST"});if(!t.ok)throw Error(`Failed to stop agent: ${t.status}`);R(""),N(null),U(),m.invalidateQueries({queryKey:d(e)})},[e,m,U]),ee=(0,t.useCallback)(async t=>{B(null),N(null);try{let n=await fetch(`/api/interactive/chat/${e}/respond`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answers:t})});n.ok||console.error(`[respondToInteraction] failed: ${n.status}`)}catch(e){console.error("[respondToInteraction] error:",e)}m.invalidateQueries({queryKey:d(e)})},[e,m]),et=!(W.hasPlan&&!W.allDone)&&V;return{runtime:(0,n.useExternalStoreRuntime)({messages:G,convertMessage:(0,t.useCallback)(e=>e,[]),isRunning:et,onNew:Y,onCancel:(0,t.useCallback)(async()=>{R(""),N(null),U()},[U])}),status:J,clearChat:X,stopAgent:Z,sessionInfo:j,isChatLoading:k,pendingInteraction:L,respondToInteraction:ee,stepProgress:W,initialRequestMessage:K}}e.s(["chatQueryKey",()=>d,"fetchChatState",()=>h],98440),e.s(["useChatRuntime",()=>m],23217);var g=e.i(20314);e.i(41001);var y=e.i(64780),b=e.i(17466),x=e.i(94875),v=e.i(11719),w=e.i(49527),S=e.i(35946),k=e.i(31777),_=e.i(2828);e.i(50032);var E=e.i(86254);function C({attachments:e,isDragOver:n,uploadError:r,onDragEnter:i,onDragLeave:s,onDragOver:o,onDrop:a,onPaste:l,onRemoveAttachment:u,onNotesChange:c,onPickFiles:d,agentPicker:h}){let{t:p}=(0,y.useTranslation)("web"),[f,m]=(0,t.useState)(!1),x=(0,t.useRef)(null);return(0,g.jsx)(b.ComposerPrimitive.Root,{className:"shrink-0 border-t p-3",children:(0,g.jsx)("div",{onDragEnter:i,onDragLeave:s,onDragOver:o,onDrop:a,className:(0,k.cn)("flex flex-col gap-1.5 rounded-md border-2 border-transparent p-1 transition-colors",n&&"border-primary/50 bg-primary/5"),children:(0,g.jsxs)("div",{ref:x,onFocus:()=>m(!0),onBlur:()=>m(!1),className:(0,k.cn)("border-input flex flex-col overflow-hidden rounded-md border shadow-xs transition-[color,box-shadow]",f&&"ring-ring/50 border-ring ring-[3px]"),children:[(0,g.jsx)(b.ComposerPrimitive.Input,{rows:1,autoFocus:!0,placeholder:p("chat.writeMessage"),onPaste:l,className:"max-h-[4.5rem] min-h-0 resize-none rounded-none border-0 px-3 py-2.5 text-sm shadow-none focus:outline-none focus-visible:ring-0"}),e.length>0?(0,g.jsx)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2",children:e.map(e=>(0,g.jsx)(E.AttachmentChip,{name:e.name,size:e.size,mimeType:e.mimeType,path:e.path,onRemove:()=>u(e.id),loading:e.loading,notes:e.notes,onNotesChange:t=>c(e.id,t)},e.id))}):null,r?(0,g.jsx)("p",{className:"text-destructive px-3 pb-2 text-xs",children:r}):null,(0,g.jsxs)("div",{className:"border-input flex items-center gap-3 border-t px-3 py-1.5",children:[h,(0,g.jsx)("div",{className:"flex-1"}),(0,g.jsxs)(_.Tooltip,{children:[(0,g.jsx)(_.TooltipTrigger,{asChild:!0,children:(0,g.jsx)("button",{type:"button",onClick:d,"aria-label":p("chat.attachFiles"),className:"text-muted-foreground hover:text-foreground cursor-pointer rounded p-1 transition-colors",children:(0,g.jsx)(S.Paperclip,{className:"h-4 w-4"})})}),(0,g.jsx)(_.TooltipContent,{side:"top",children:p("chat.attachFiles")})]}),(0,g.jsx)(T,{})]})]})})})}function T(){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(x.ThreadPrimitive.If,{running:!1,children:(0,g.jsx)(b.ComposerPrimitive.Send,{className:(0,k.cn)("bg-primary text-primary-foreground inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md","hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-30","transition-colors"),children:(0,g.jsx)(v.SendHorizontal,{className:"size-3.5"})})}),(0,g.jsx)(x.ThreadPrimitive.If,{running:!0,children:(0,g.jsx)(b.ComposerPrimitive.Cancel,{className:(0,k.cn)("bg-destructive/10 text-destructive inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md","hover:bg-destructive/20","transition-colors"),children:(0,g.jsx)(w.CircleStop,{className:"size-3.5"})})})]})}e.s(["ChatComposer",()=>C],61152);var I=e.i(23925);let j=(0,e.i(3645).default)("message-circle-question-mark",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);function A({interaction:e,onSubmit:t,className:n}){let r=e.questions.length>1;return(0,g.jsxs)("div",{className:(0,k.cn)("group flex w-full items-start gap-2.5 px-4 py-0.5",n),children:[(0,g.jsx)("div",{className:"bg-muted flex h-6 w-6 shrink-0 items-center justify-center rounded-full",children:(0,g.jsx)(j,{className:"h-3.5 w-3.5 text-violet-600 dark:text-violet-400"})}),(0,g.jsx)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:(0,g.jsx)("div",{className:"text-foreground mt-px overflow-hidden rounded-2xl rounded-tl-sm border border-violet-200 bg-violet-50/50 text-sm leading-relaxed shadow-sm dark:border-violet-500/20 dark:bg-violet-950/20",children:r?(0,g.jsx)(R,{questions:e.questions,onSubmit:t}):(0,g.jsx)("div",{className:"px-4 py-3",children:(0,g.jsx)(N,{question:e.questions[0],onSubmit:t})})})})]})}function R({questions:e,onSubmit:n}){let[r,i]=(0,t.useState)(0),[s,o]=(0,t.useState)(()=>{let t={};for(let n of e)t[n.question]={selectedOptions:new Set,otherText:"",isOtherSelected:!1};return t}),a=(0,t.useCallback)((e,t)=>{o(n=>({...n,[e]:t(n[e])}))},[]),l={};for(let t of e){let e=s[t.question];if(!e)continue;let n=[...e.selectedOptions];e.isOtherSelected&&e.otherText.trim()&&n.push(e.otherText.trim()),n.length>0&&(l[t.question]=n.join(", "))}let u=e.every(e=>l[e.question]),c=(0,t.useCallback)(()=>{u&&n(l)},[u,n,s]);return(0,g.jsxs)("div",{children:[(0,g.jsx)("div",{className:"flex border-b border-violet-200 dark:border-violet-500/20",children:e.map((e,t)=>{let n=t===r,s=!!l[e.question];return(0,g.jsxs)("button",{type:"button",onClick:()=>i(t),className:(0,k.cn)("relative flex items-center gap-1.5 px-4 py-2 text-xs font-medium transition-colors",n?"text-violet-700 dark:text-violet-300":"text-muted-foreground hover:text-foreground"),children:[s?(0,g.jsx)(I.Check,{className:"h-3 w-3 text-emerald-600 dark:text-emerald-400"}):(0,g.jsxs)("span",{className:"text-muted-foreground/50 text-[10px]",children:[t+1,"."]}),e.header,n?(0,g.jsx)("span",{className:"absolute inset-x-0 -bottom-px h-0.5 rounded-full bg-violet-600 dark:bg-violet-400"}):null]},e.question)})}),e.map((e,t)=>(0,g.jsx)("div",{className:"px-4 py-3",style:{display:t===r?void 0:"none"},children:(0,g.jsx)(M,{question:e,selection:s[e.question],onSelectionChange:t=>a(e.question,t)})},e.question)),(0,g.jsxs)("div",{className:"flex items-center gap-3 border-t border-violet-200 px-4 py-2.5 dark:border-violet-500/20",children:[(0,g.jsxs)("button",{type:"button",onClick:c,disabled:!u,className:(0,k.cn)("inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium transition-all",u?"bg-violet-600 text-white shadow-sm hover:bg-violet-700 active:scale-[0.98] dark:bg-violet-600 dark:hover:bg-violet-500":"bg-muted text-muted-foreground cursor-not-allowed opacity-50"),children:[(0,g.jsx)(I.Check,{className:"h-3 w-3"}),"Submit all"]}),(0,g.jsxs)("span",{className:"text-muted-foreground text-[10px]",children:[Object.keys(l).length,"/",e.length," answered"]})]})]})}function M({question:e,selection:n,onSelectionChange:r}){let i=(0,t.useCallback)(t=>{r(n=>{let r=new Set(n.selectedOptions);return e.multiSelect?(r.has(t)?r.delete(t):r.add(t),{...n,selectedOptions:r}):(r.clear(),r.add(t),{...n,selectedOptions:r,isOtherSelected:!1})})},[e.multiSelect,r]),s=(0,t.useCallback)(()=>{r(t=>e.multiSelect?{...t,isOtherSelected:!t.isOtherSelected}:{selectedOptions:new Set,otherText:t.otherText,isOtherSelected:!0})},[e.multiSelect,r]),o=(0,t.useCallback)(e=>{r(t=>({...t,otherText:e}))},[r]);return(0,g.jsxs)("div",{children:[(0,g.jsxs)("p",{className:"text-foreground mb-2 text-xs font-medium",children:[e.question,e.multiSelect?(0,g.jsx)("span",{className:"text-muted-foreground ml-1 font-normal",children:"(select multiple)"}):null]}),(0,g.jsxs)("div",{className:"flex flex-col gap-1.5",children:[e.options.map(t=>(0,g.jsx)(O,{option:t,isSelected:n.selectedOptions.has(t.label),isMulti:e.multiSelect,onToggle:()=>i(t.label)},t.label)),(0,g.jsx)(P,{isSelected:n.isOtherSelected,isMulti:e.multiSelect,text:n.otherText,onToggle:s,onTextChange:o})]})]})}function N({question:e,onSubmit:n}){let[r,i]=(0,t.useState)(new Set),[s,o]=(0,t.useState)(""),[a,l]=(0,t.useState)(!1),u=(0,t.useCallback)(t=>{i(n=>{let r=new Set(n);return e.multiSelect?r.has(t)?r.delete(t):r.add(t):(r.clear(),r.add(t),l(!1)),r}),e.multiSelect||l(!1)},[e.multiSelect]),c=(0,t.useCallback)(()=>{e.multiSelect?l(e=>!e):(i(new Set),l(!0))},[e.multiSelect]),d=(0,t.useCallback)(()=>{let t=[...r];a&&s.trim()&&t.push(s.trim()),0!==t.length&&n({[e.question]:t.join(", ")})},[r,a,s,n,e.question]),h=r.size>0||a&&s.trim();return(0,g.jsxs)("div",{children:[(0,g.jsxs)("div",{className:"mb-2 flex items-start gap-2",children:[(0,g.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full bg-violet-100 px-2 py-0.5 text-[10px] font-semibold tracking-wider text-violet-700 uppercase dark:bg-violet-900/50 dark:text-violet-300",children:e.header}),(0,g.jsx)("span",{className:"font-medium",children:e.question})]}),(0,g.jsxs)("div",{className:"ml-0.5 flex flex-col gap-1.5",children:[e.options.map(t=>(0,g.jsx)(O,{option:t,isSelected:r.has(t.label),isMulti:e.multiSelect,onToggle:()=>u(t.label)},t.label)),(0,g.jsx)(P,{isSelected:a,isMulti:e.multiSelect,text:s,onToggle:c,onTextChange:o})]}),(0,g.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,g.jsxs)("button",{type:"button",onClick:d,disabled:!h,className:(0,k.cn)("inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium transition-all",h?"bg-violet-600 text-white shadow-sm hover:bg-violet-700 active:scale-[0.98] dark:bg-violet-600 dark:hover:bg-violet-500":"bg-muted text-muted-foreground cursor-not-allowed opacity-50"),children:[(0,g.jsx)(I.Check,{className:"h-3 w-3"}),"Submit"]}),e.multiSelect?(0,g.jsx)("span",{className:"text-muted-foreground text-[10px]",children:"Select one or more"}):null]})]})}function O({option:e,isSelected:t,isMulti:n,onToggle:r}){return(0,g.jsxs)("button",{type:"button",onClick:r,className:(0,k.cn)("flex items-start gap-2.5 rounded-lg border px-3 py-2 text-left text-xs transition-all",t?"border-violet-300 bg-violet-100/60 shadow-sm dark:border-violet-500/40 dark:bg-violet-900/30":"border-border/50 hover:border-violet-300 hover:bg-violet-50 dark:hover:border-violet-500/30 dark:hover:bg-violet-900/10"),children:[(0,g.jsx)("span",{className:(0,k.cn)("mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center border transition-colors",n?"rounded":"rounded-full",t?"border-violet-600 bg-violet-600 dark:border-violet-500 dark:bg-violet-500":"border-muted-foreground/30"),children:t?(0,g.jsx)(I.Check,{className:"h-2.5 w-2.5 text-white",strokeWidth:3}):null}),(0,g.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,g.jsx)("span",{className:(0,k.cn)("font-medium",t&&"text-violet-700 dark:text-violet-300"),children:e.label}),(0,g.jsx)("span",{className:"text-muted-foreground text-[11px] leading-snug",children:e.description})]})]})}function P({isSelected:e,isMulti:t,text:n,onToggle:r,onTextChange:i}){return(0,g.jsxs)("div",{className:(0,k.cn)("flex items-start gap-2.5 rounded-lg border px-3 py-2 text-xs transition-all",e?"border-violet-300 bg-violet-100/60 shadow-sm dark:border-violet-500/40 dark:bg-violet-900/30":"border-border/50 hover:border-violet-300 dark:hover:border-violet-500/30"),children:[(0,g.jsx)("button",{type:"button",onClick:r,className:"mt-0.5 shrink-0",children:(0,g.jsx)("span",{className:(0,k.cn)("flex h-4 w-4 items-center justify-center border transition-colors",t?"rounded":"rounded-full",e?"border-violet-600 bg-violet-600 dark:border-violet-500 dark:bg-violet-500":"border-muted-foreground/30"),children:e?(0,g.jsx)(I.Check,{className:"h-2.5 w-2.5 text-white",strokeWidth:3}):null})}),(0,g.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,g.jsx)("span",{className:(0,k.cn)("font-medium",e&&"text-violet-700 dark:text-violet-300"),children:"Other"}),e?(0,g.jsx)("input",{type:"text",value:n,onChange:e=>i(e.target.value),placeholder:"Type your answer...",className:"w-full rounded-md border border-violet-200 bg-white/80 px-2 py-1 text-xs outline-none focus:border-violet-400 focus:ring-1 focus:ring-violet-300/30 dark:border-violet-500/30 dark:bg-violet-950/30 dark:focus:border-violet-500/50 dark:focus:ring-violet-500/20",autoFocus:!0}):null]})]})}e.s(["InteractionBubble",()=>A],73138);var D=e.i(91967),F=e.i(22528),L=e.i(36589),B=e.i(5192),z=e.i(5978),U=e.i(87620),q=e.i(85995),$=e.i(13123),H="Collapsible",[V,Q]=(0,F.createContextScope)(H),[W,K]=V(H),G=t.forwardRef((e,n)=>{let{__scopeCollapsible:r,open:i,defaultOpen:s,disabled:o,onOpenChange:a,...l}=e,[u,c]=(0,L.useControllableState)({prop:i,defaultProp:s??!1,onChange:a,caller:H});return(0,g.jsx)(W,{scope:r,disabled:o,contentId:(0,$.useId)(),open:u,onOpenToggle:t.useCallback(()=>c(e=>!e),[c]),children:(0,g.jsx)(U.Primitive.div,{"data-state":et(u),"data-disabled":o?"":void 0,...l,ref:n})})});G.displayName=H;var J="CollapsibleTrigger",Y=t.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=K(J,n);return(0,g.jsx)(U.Primitive.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":et(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:t,onClick:(0,D.composeEventHandlers)(e.onClick,i.onOpenToggle)})});Y.displayName=J;var X="CollapsibleContent",Z=t.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=K(X,e.__scopeCollapsible);return(0,g.jsx)(q.Presence,{present:n||i.open,children:({present:e})=>(0,g.jsx)(ee,{...r,ref:t,present:e})})});Z.displayName=X;var ee=t.forwardRef((e,n)=>{let{__scopeCollapsible:r,present:i,children:s,...o}=e,a=K(X,r),[l,u]=t.useState(i),c=t.useRef(null),d=(0,z.useComposedRefs)(n,c),h=t.useRef(0),p=h.current,f=t.useRef(0),m=f.current,y=a.open||l,b=t.useRef(y),x=t.useRef(void 0);return t.useEffect(()=>{let e=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,B.useLayoutEffect)(()=>{let e=c.current;if(e){x.current=x.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();h.current=t.height,f.current=t.width,b.current||(e.style.transitionDuration=x.current.transitionDuration,e.style.animationName=x.current.animationName),u(i)}},[a.open,i]),(0,g.jsx)(U.Primitive.div,{"data-state":et(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!y,...o,ref:d,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:y&&s})});function et(e){return e?"open":"closed"}e.s(["Collapsible",()=>G,"CollapsibleContent",()=>Z,"CollapsibleTrigger",()=>Y,"Content",()=>Z,"Root",()=>G,"Trigger",()=>Y,"createCollapsibleScope",()=>Q],75074);var en=e.i(75074);e.s(["Collapsible",0,en],6420)},58481,e=>{"use strict";var t=e.i(15131);e.s(["AlertTriangle",()=>t.default])},28112,e=>{"use strict";e.i(44172);var t=e.i(20314),n=e.i(79054);e.i(41001);var r=e.i(64780),i=e.i(7319),s=e.i(67669),o=e.i(18532),a=e.i(94365),l=e.i(31777),u=e.i(15109),c=e.i(31151),d=e.i(84408),h=e.i(41413),p=e.i(23217),f=e.i(61152),m=e.i(73138),g=e.i(6420),y=e.i(23925),b=e.i(99105),x=e.i(76016),v=e.i(95812),w=e.i(58481),S=e.i(427);let k=(0,e.i(94237).cva)("animate-spinner inline-block rounded-full",{variants:{size:{sm:"size-4",md:"size-6",lg:"size-10"}},defaultVariants:{size:"md"}}),_={sm:"3px",md:"4px",lg:"8px"};function E({className:e,size:n="md",...r}){let i=_[n??"md"];return(0,t.jsx)("div",{"data-slot":"spinner",role:"status","aria-label":"Loading",className:(0,l.cn)(k({size:n}),e),style:{background:"conic-gradient(from 220deg, transparent 0%, currentColor 80%, transparent 100%)",WebkitMask:`radial-gradient(farthest-side, #0000 calc(100% - ${i}), #000 calc(100% - ${i} + 1px))`},...r})}var C=e.i(81835),T=e.i(90292);let I={p:({children:e})=>(0,t.jsx)("p",{className:"mb-2 leading-relaxed last:mb-0",children:e}),strong:({children:e})=>(0,t.jsx)("strong",{className:"font-semibold",children:e}),em:({children:e})=>(0,t.jsx)("em",{className:"italic",children:e}),code:({children:e,className:n})=>n?(0,t.jsx)("code",{className:`${n} text-[11px]`,children:e}):(0,t.jsx)("code",{className:"bg-background/50 rounded-md px-1.5 py-0.5 font-mono text-[11px]",children:e}),pre:({children:e})=>(0,t.jsx)("pre",{className:"bg-background/50 my-2 overflow-x-auto rounded-md p-3 font-mono text-[11px] leading-relaxed",children:e}),ul:({children:e})=>(0,t.jsx)("ul",{className:"mb-2 list-disc ps-4 last:mb-0",children:e}),ol:({children:e})=>(0,t.jsx)("ol",{className:"mb-2 list-decimal ps-4 last:mb-0",children:e}),li:({children:e})=>(0,t.jsx)("li",{className:"mb-0.5",children:e}),h1:({children:e})=>(0,t.jsx)("h1",{className:"mb-1 text-sm font-bold",children:e}),h2:({children:e})=>(0,t.jsx)("h2",{className:"mb-1 text-sm font-bold",children:e}),h3:({children:e})=>(0,t.jsx)("h3",{className:"mb-1 text-xs font-semibold",children:e}),a:({children:e,href:n})=>(0,t.jsx)("a",{href:n,className:"text-blue-500 underline",target:"_blank",rel:"noopener noreferrer",children:e})};function j({steps:e,className:r,collapsedSummary:i,activeStepId:s,liveStatus:o}){let[a,u]=(0,n.useState)(!1);if(0===e.length)return null;if(i&&!a){let n=e.filter(e=>"done"===e.status).length;return(0,t.jsx)("div",{className:(0,l.cn)("p-4",r),children:(0,t.jsxs)("button",{type:"button",onClick:()=>u(!0),className:"hover:bg-muted/40 border-border bg-background flex w-full items-center gap-3 rounded-lg border px-3 py-2.5 text-left transition-colors",children:[(0,t.jsx)("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-emerald-500 text-white",children:(0,t.jsx)(y.Check,{className:"h-4 w-4",strokeWidth:3})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:"Initial setup complete"}),(0,t.jsxs)("div",{className:"text-muted-foreground text-xs",children:[n," of ",e.length," steps finished — click to review"]})]}),(0,t.jsx)(x.ChevronRight,{className:"text-muted-foreground h-4 w-4 shrink-0"})]})})}return(0,t.jsxs)("ol",{className:(0,l.cn)("flex flex-col gap-2 p-4",r),children:[i?(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",onClick:()=>u(!1),className:"text-muted-foreground hover:text-foreground mb-1 inline-flex items-center gap-1 text-[10px] tracking-wide uppercase",children:[(0,t.jsx)(b.ChevronDown,{className:"h-3 w-3"}),"Collapse setup"]})}):null,e.map((e,n)=>(0,t.jsx)(A,{step:e,liveStatus:e.definition.id===s?o??null:null,mountIndex:n},e.definition.id))]})}function A({step:e,liveStatus:r,mountIndex:i}){let[s,o]=(0,n.useState)(!1),{status:a,definition:u,metadata:c,toolMessages:d}=e,h=function(e,t){if(!e)return[];let n=e[t];return Array.isArray(n)?n.filter(e=>"string"==typeof e):[]}(c,"details"),p=function(e,t){if(!e)return"";let n=e[t];return"string"==typeof n?n:""}(c,"error"),f=function(e){let t=[];for(let n of e){let e=n.content?.trim()??"";e&&((0,T.parseToolEvent)(e)?t.push({kind:"tool",message:n}):t.push({kind:"text",message:n}))}return t}(d),m=f.length>0||h.length>0||!!p;return(0,t.jsx)(g.Collapsible.Root,{asChild:!0,open:s,onOpenChange:o,children:(0,t.jsxs)("li",{className:(0,l.cn)("rounded-lg border transition-[background-color,border-color] duration-300 ease-out","animate-in fade-in-0 slide-in-from-top-2","running"===a&&"border-violet-500/40 bg-violet-500/5","done"===a&&"border-border bg-background","pending"===a&&"border-border/40 bg-muted/20","failed"===a&&"border-red-500/40 bg-red-500/5","interrupted"===a&&"border-amber-500/40 bg-amber-500/5"),style:{animationDelay:`${40*Math.min(i,6)}ms`,animationDuration:"300ms"},children:[(0,t.jsx)(g.Collapsible.Trigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",disabled:!m,className:(0,l.cn)("flex w-full items-center gap-3 px-3 py-1.5 text-left transition-colors duration-200",m&&"hover:bg-muted/40 cursor-pointer",!m&&"cursor-default"),children:[(0,t.jsx)(R,{status:a}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-baseline gap-2",children:[(0,t.jsx)("span",{className:(0,l.cn)("shrink-0 truncate text-sm font-medium transition-colors duration-300","pending"===a&&"text-muted-foreground/60"),children:u.title}),r&&"running"===a?(0,t.jsxs)("span",{className:"flex min-w-0 items-baseline gap-1.5 text-xs text-violet-700 dark:text-violet-300",children:[(0,t.jsx)("span",{className:"inline-flex h-1 w-1 shrink-0 translate-y-[-1px] animate-pulse rounded-full bg-violet-500"}),(0,t.jsx)("span",{className:"animate-in fade-in-0 slide-in-from-left-1 truncate duration-300",children:r},r)]}):u.description?(0,t.jsx)("span",{className:(0,l.cn)("min-w-0 truncate text-xs font-normal","pending"===a?"text-muted-foreground/40":"text-muted-foreground/70"),children:u.description}):null]}),f.length>0?(0,t.jsx)("span",{className:"text-muted-foreground/60 animate-in fade-in-0 zoom-in-95 mr-1 shrink-0 text-[10px] tabular-nums duration-200",children:f.length},f.length):null,m?(0,t.jsx)(x.ChevronRight,{className:(0,l.cn)("text-muted-foreground h-4 w-4 shrink-0 transition-transform duration-200 ease-out",s&&"rotate-90")}):null]})}),(0,t.jsx)(g.Collapsible.Content,{className:(0,l.cn)("overflow-hidden","data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up"),children:(0,t.jsxs)("div",{className:"border-border/40 space-y-2 border-t px-3 py-2.5 text-xs",children:[p?(0,t.jsx)("p",{className:"rounded bg-red-500/10 p-2 text-red-600 dark:text-red-400",children:p}):null,h.length>0?(0,t.jsx)("ul",{className:"text-muted-foreground list-disc space-y-0.5 ps-4",children:h.map(e=>(0,t.jsx)("li",{children:e},e))}):null,f.length>0?(0,t.jsx)("div",{className:"-mx-1 flex flex-col gap-1",children:f.map((e,n)=>"tool"===e.kind?(0,t.jsx)("div",{className:"animate-in fade-in-0 slide-in-from-top-1 duration-200",style:{animationDelay:`${30*Math.min(n,6)}ms`},children:(0,t.jsx)(C.ToolBubble,{text:e.message.content})},e.message.id):(0,t.jsx)("div",{className:"text-foreground animate-in fade-in-0 slide-in-from-top-1 px-1 text-xs leading-relaxed duration-200",style:{animationDelay:`${30*Math.min(n,6)}ms`},children:(0,t.jsx)(S.default,{components:I,children:e.message.content})},e.message.id))}):null]})})]})})}function R({status:e}){return"running"===e?(0,t.jsx)(E,{size:"sm",className:"shrink-0 text-violet-500"}):"done"===e?(0,t.jsx)("div",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-emerald-500 text-white",children:(0,t.jsx)(y.Check,{className:"h-3 w-3",strokeWidth:3})}):"failed"===e?(0,t.jsx)("div",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-red-500 text-white",children:(0,t.jsx)(w.AlertTriangle,{className:"h-2.5 w-2.5",strokeWidth:3})}):"interrupted"===e?(0,t.jsx)(w.AlertTriangle,{className:"h-4 w-4 shrink-0 text-amber-500"}):(0,t.jsx)(v.Circle,{className:"text-muted-foreground/30 h-4 w-4 shrink-0"})}function M({featureId:e,worktreePath:r,initialAgent:s,initialModel:o,initialChatState:a,hideHeader:l,onAllStepsComplete:g,workflowPlaceholder:y}){let[b,x]=(0,n.useState)(s),[v,w]=(0,n.useState)(o),[S,k]=(0,n.useState)(!1),_=(0,c.useAttachments)(),E=(0,n.useCallback)(e=>(0,d.composeUserInput)(e,_.completedAttachments.map(e=>({path:e.path,name:e.name,notes:e.notes}))),[_.completedAttachments]),{runtime:C,status:T,clearChat:I,sessionInfo:A,isChatLoading:R,pendingInteraction:M,respondToInteraction:D,stepProgress:F,initialRequestMessage:L}=(0,p.useChatRuntime)(e,r,{contentTransform:E,onMessageSent:_.clearAttachments,model:v,agentType:b,debugMode:S,initialChatState:a}),B=(0,n.useRef)(!1),z=(0,n.useRef)(g);z.current=g,(0,n.useEffect)(()=>{F.allDone&&!B.current&&(B.current=!0,z.current?.())},[F.allDone]);let U=(0,n.useCallback)(async()=>{try{let t=await fetch("/api/dialog/pick-files");if(!t.ok)return;let n=await t.json();if(!n.paths?.length)return;for(let t of n.paths){let n=await fetch("/api/attachments/upload-from-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,sessionId:`chat-${e}`})});if(!n.ok)continue;let r=await n.json();_.addAttachment(r)}}catch{}},[e,_.addAttachment]),q=F.hasPlan?F.steps:(y??[]).map(e=>({definition:{id:`placeholder-${e.stepKey}`,stepKey:e.stepKey,title:e.title,description:e.description},status:"pending",metadata:null,toolMessages:[]})),$=q.length>0,H=(0,t.jsx)(f.ChatComposer,{attachments:_.attachments,isDragOver:_.isDragOver,uploadError:_.uploadError,onDragEnter:_.handleDragEnter,onDragLeave:_.handleDragLeave,onDragOver:_.handleDragOver,onDrop:_.handleDrop,onPaste:_.handlePaste,onRemoveAttachment:_.removeAttachment,onNotesChange:_.updateNotes,onPickFiles:U,agentPicker:(0,t.jsx)(h.AgentModelPicker,{initialAgentType:b??"claude-code",initialModel:v??"claude-sonnet-4-6",mode:"override",onAgentModelChange:(e,t)=>{x(e),w(t)},className:"w-55"})});return(0,t.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[l?null:(0,t.jsx)(P,{sessionInfo:A,isAgentActive:T.isRunning,onClear:I,debugMode:S,onDebugToggle:void 0}),(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:R?(0,t.jsx)(O,{}):(0,t.jsx)(i.AssistantRuntimeProvider,{runtime:C,children:(0,t.jsx)(u.Thread,{composer:H,hideEmpty:$,beforeMessages:$?(0,t.jsxs)(t.Fragment,{children:[L?(0,t.jsx)(N,{text:L.content}):null,(0,t.jsx)(j,{steps:q,collapsedSummary:!0===F.hasPlan&&!0===F.allDone,activeStepId:F.activeStepId,liveStatus:F.liveStatus})]}):void 0,afterMessages:M?(0,t.jsx)(m.InteractionBubble,{interaction:M,onSubmit:D}):void 0})})})]})}function N({text:e}){return(0,t.jsxs)("div",{className:"group animate-in fade-in-0 slide-in-from-top-1 flex w-full items-start gap-2.5 px-4 py-0.5 duration-300 ease-out",children:[(0,t.jsx)("div",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-violet-500/15",children:(0,t.jsx)(a.User,{className:"h-3.5 w-3.5 text-violet-500"})}),(0,t.jsx)("div",{className:"flex max-w-[85%] min-w-0 flex-col gap-0.5",children:(0,t.jsx)("div",{className:"text-foreground mt-px overflow-hidden rounded-2xl rounded-tl-sm border border-violet-500/15 bg-violet-500/8 px-4 py-2 text-sm leading-relaxed break-words whitespace-pre-wrap shadow-sm backdrop-blur-md",children:e})})]})}function O(){return(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-3 p-4 pt-6",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)("div",{className:"bg-muted h-4 w-48 animate-pulse rounded-lg"}),(0,t.jsx)("div",{className:"bg-muted h-4 w-72 animate-pulse rounded-lg"}),(0,t.jsx)("div",{className:"bg-muted h-4 w-36 animate-pulse rounded-lg"})]})]}),(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),(0,t.jsx)("div",{className:"bg-muted h-4 w-32 animate-pulse rounded-lg"})]}),(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)("div",{className:"bg-muted h-4 w-56 animate-pulse rounded-lg"}),(0,t.jsx)("div",{className:"bg-muted h-4 w-64 animate-pulse rounded-lg"})]})]})]})}function P({sessionInfo:e,isAgentActive:n,onClear:i,debugMode:a,onDebugToggle:l}){let{t:u}=(0,r.useTranslation)("web");return(0,t.jsxs)("div",{className:"flex h-8 shrink-0 items-center border-b px-3",children:[(0,t.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:e?(0,t.jsxs)(t.Fragment,{children:[n?(0,t.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-emerald-500"}):(0,t.jsx)(o.Cpu,{className:"text-muted-foreground/40 h-3 w-3 shrink-0"}),(0,t.jsxs)("span",{className:"text-muted-foreground font-mono text-[10px]",children:[e.model??"agent",e.sessionId?` \xb7 ${e.sessionId.slice(0,8)}`:""]})]}):(0,t.jsx)("span",{className:"text-muted-foreground/40 text-[11px]",children:u("chat.noSession")})}),(0,t.jsxs)("div",{className:"flex items-center gap-1 ps-2",children:[l?(0,t.jsxs)("label",{className:"text-muted-foreground/60 flex cursor-pointer items-center gap-1 text-[10px]",children:[(0,t.jsx)("input",{type:"checkbox",checked:a,onChange:e=>l(e.target.checked),className:"h-3 w-3 cursor-pointer rounded"}),"Debug"]}):null,(0,t.jsxs)(D,{onClick:()=>{i()},title:u("chat.clearChatHistory"),children:[(0,t.jsx)(s.Trash2,{className:"h-2.5 w-2.5"}),(0,t.jsx)("span",{children:u("chat.clear")})]})]})]})}function D({children:e,onClick:n,title:r,variant:i}){return(0,t.jsx)("button",{type:"button",onClick:n,title:r,className:(0,l.cn)("inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs transition-colors","danger"===i?"text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:e})}e.s(["ChatTab",()=>M],28112)}]);
5
+ ${n}`})(e,y.completedAttachments.map(e=>({path:e.path,name:e.name,notes:e.notes}))),[y.completedAttachments]),onMessageSent:y.clearAttachments,model:f,agentType:h,debugMode:g,initialChatState:a}),j=(0,n.useRef)(!1),I=(0,n.useRef)(u);I.current=u,(0,n.useEffect)(()=>{C.allDone&&!j.current&&(j.current=!0,I.current?.())},[C.allDone]);let A=(0,n.useCallback)(async()=>{try{let t=await fetch("/api/dialog/pick-files");if(!t.ok)return;let n=await t.json();if(!n.paths?.length)return;for(let t of n.paths){let n=await fetch("/api/attachments/upload-from-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,sessionId:`chat-${e}`})});if(!n.ok)continue;let r=await n.json();y.addAttachment(r)}}catch{}},[e,y.addAttachment]),M=C.hasPlan?C.steps:(c??[]).map(e=>({definition:{id:`placeholder-${e.stepKey}`,stepKey:e.stepKey,title:e.title,description:e.description},status:"pending",metadata:null,toolMessages:[]})),N=M.length>0,P=!0===C.hasPlan&&!0!==C.allDone,D=(0,t.jsx)(tx,{disabled:P,attachments:y.attachments,isDragOver:y.isDragOver,uploadError:y.uploadError,onDragEnter:y.handleDragEnter,onDragLeave:y.handleDragLeave,onDragOver:y.handleDragOver,onDrop:y.handleDrop,onPaste:y.handlePaste,onRemoveAttachment:y.removeAttachment,onNotesChange:y.updateNotes,onPickFiles:A,agentPicker:(0,t.jsx)(Y.AgentModelPicker,{initialAgentType:h??"claude-code",initialModel:f??"claude-sonnet-4-6",mode:"override",onAgentModelChange:(e,t)=>{p(e),m(t)},className:"w-55"})});return(0,t.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[l?null:(0,t.jsx)(t6,{sessionInfo:w,isAgentActive:v.isRunning,onClear:k,debugMode:g,onDebugToggle:void 0}),(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col dark:bg-neutral-900/40",children:S?(0,t.jsx)(t4,{}):(0,t.jsx)(i.AssistantRuntimeProvider,{runtime:b,children:(0,t.jsx)(R,{composer:D,hideEmpty:N,beforeMessages:N?(0,t.jsxs)(t.Fragment,{children:[T?(0,t.jsx)(t3,{text:T.content}):null,(0,t.jsx)(t0,{steps:M,collapsedSummary:!0===C.hasPlan&&!0===C.allDone,activeStepId:C.activeStepId,liveStatus:C.liveStatus,onRetry:d})]}):void 0,afterMessages:_?(0,t.jsx)(tv,{interaction:_,onSubmit:E}):void 0})})})]})}function t3({text:e}){return(0,t.jsxs)("div",{className:"group animate-in fade-in-0 slide-in-from-top-1 flex w-full items-start gap-2.5 px-4 py-0.5 duration-300 ease-out",children:[(0,t.jsx)("div",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-violet-500/15",children:(0,t.jsx)(a.User,{className:"h-3.5 w-3.5 text-violet-500"})}),(0,t.jsx)("div",{className:"flex max-w-[85%] min-w-0 flex-col gap-0.5",children:(0,t.jsx)("div",{className:"text-foreground mt-px overflow-hidden rounded-2xl rounded-tl-sm border border-violet-500/15 bg-violet-500/8 px-4 py-2 text-sm leading-relaxed break-words whitespace-pre-wrap shadow-sm backdrop-blur-md",children:e})})]})}function t4(){return(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-3 p-4 pt-6",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)("div",{className:"bg-muted h-4 w-48 animate-pulse rounded-lg"}),(0,t.jsx)("div",{className:"bg-muted h-4 w-72 animate-pulse rounded-lg"}),(0,t.jsx)("div",{className:"bg-muted h-4 w-36 animate-pulse rounded-lg"})]})]}),(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),(0,t.jsx)("div",{className:"bg-muted h-4 w-32 animate-pulse rounded-lg"})]}),(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)("div",{className:"bg-muted h-4 w-56 animate-pulse rounded-lg"}),(0,t.jsx)("div",{className:"bg-muted h-4 w-64 animate-pulse rounded-lg"})]})]})]})}function t6({sessionInfo:e,isAgentActive:n,onClear:i,debugMode:a,onDebugToggle:l}){let{t:u}=(0,r.useTranslation)("web");return(0,t.jsxs)("div",{className:"flex h-8 shrink-0 items-center border-b px-3",children:[(0,t.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:e?(0,t.jsxs)(t.Fragment,{children:[n?(0,t.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-emerald-500"}):(0,t.jsx)(o.Cpu,{className:"text-muted-foreground/40 h-3 w-3 shrink-0"}),(0,t.jsxs)("span",{className:"text-muted-foreground font-mono text-[10px]",children:[e.model??"agent",e.sessionId?` \xb7 ${e.sessionId.slice(0,8)}`:""]})]}):(0,t.jsx)("span",{className:"text-muted-foreground/40 text-[11px]",children:u("chat.noSession")})}),(0,t.jsxs)("div",{className:"flex items-center gap-1 ps-2",children:[l?(0,t.jsxs)("label",{className:"text-muted-foreground/60 flex cursor-pointer items-center gap-1 text-[10px]",children:[(0,t.jsx)("input",{type:"checkbox",checked:a,onChange:e=>l(e.target.checked),className:"h-3 w-3 cursor-pointer rounded"}),"Debug"]}):null,(0,t.jsxs)(t8,{onClick:()=>{i()},title:u("chat.clearChatHistory"),children:[(0,t.jsx)(s.Trash2,{className:"h-2.5 w-2.5"}),(0,t.jsx)("span",{children:u("chat.clear")})]})]})]})}function t8({children:e,onClick:n,title:r,variant:i}){return(0,t.jsx)("button",{type:"button",onClick:n,title:r,className:(0,l.cn)("inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs transition-colors","danger"===i?"text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:e})}e.s(["ChatTab",()=>t5],28112)}]);