@worktango/ai-assistant 0.0.97-alpha03 → 0.0.97-alpha05

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 (176) hide show
  1. package/dist/{Absenteeism-Cas4ITaZ.mjs → Absenteeism-BMGGoHrv.mjs} +1 -1
  2. package/dist/{ActivityFeed-B4XK12G8.mjs → ActivityFeed-D-xN76Gq.mjs} +1 -1
  3. package/dist/{AddUser-BR0m_gog.mjs → AddUser-UBT7AkJj.mjs} +1 -1
  4. package/dist/{Admin-DTnB1QlU.mjs → Admin-BTYsnB5A.mjs} +1 -1
  5. package/dist/{Admin-Bk7ucPOq.mjs → Admin-BssB-FZc.mjs} +1 -1
  6. package/dist/{AiGeneral-BU-6_Wn0.mjs → AiGeneral-DRxvx3ab.mjs} +1 -1
  7. package/dist/{AiScoring-Ci4ehoSY.mjs → AiScoring-CbTTxTKW.mjs} +1 -1
  8. package/dist/{AiText-Cf4wrvi0.mjs → AiText-veYkHeqN.mjs} +1 -1
  9. package/dist/{Anniversary-J623A9hp.mjs → Anniversary-CFPjxwYA.mjs} +1 -1
  10. package/dist/{Appreciation-5zP0WiZr.mjs → Appreciation-CnhvvLP-.mjs} +1 -1
  11. package/dist/{ArrowDown-CpNm_lqn.mjs → ArrowDown-7r8zRD7h.mjs} +1 -1
  12. package/dist/{ArrowLeft-DZPKKly1.mjs → ArrowLeft-BpC_01HD.mjs} +1 -1
  13. package/dist/{ArrowRight-Bfk-ljRT.mjs → ArrowRight-GtOHYTug.mjs} +1 -1
  14. package/dist/{ArrowUp-CZWAfujr.mjs → ArrowUp-DkWNq1Cu.mjs} +1 -1
  15. package/dist/{Attachment-DJVc_Wum.mjs → Attachment-D1mvxxKt.mjs} +1 -1
  16. package/dist/{BeQuickDontHurry-CvZnW49r.mjs → BeQuickDontHurry-uXNNJYVh.mjs} +1 -1
  17. package/dist/{Birthday-DRMs5ky5.mjs → Birthday-BYLZlPtw.mjs} +1 -1
  18. package/dist/{BrandPromise-Ctf8tBRq.mjs → BrandPromise-Bpa3Da-N.mjs} +1 -1
  19. package/dist/{BrandVision-CBQukXe1.mjs → BrandVision-82dB742B.mjs} +1 -1
  20. package/dist/{Calendar-CXCLz7OS.mjs → Calendar-BFkrXqQi.mjs} +1 -1
  21. package/dist/{CaretDn-BLWxnXdQ.mjs → CaretDn-wVKaXyvR.mjs} +1 -1
  22. package/dist/{CaretDown-BdN9lem3.mjs → CaretDown-B76te-q6.mjs} +1 -1
  23. package/dist/{CaretLeft-CSlJzFWn.mjs → CaretLeft-BXaLMKSn.mjs} +1 -1
  24. package/dist/{CaretRight-DMpm3tsq.mjs → CaretRight-BtohVgNR.mjs} +1 -1
  25. package/dist/{CaretUp-zn_vRVYW.mjs → CaretUp-DHRwK-2O.mjs} +1 -1
  26. package/dist/{ChallengeAccepted-DAOmX6nX.mjs → ChallengeAccepted-dlHoj-iY.mjs} +1 -1
  27. package/dist/{CheckIn-Dnofb2RA.mjs → CheckIn-CpbmezOu.mjs} +1 -1
  28. package/dist/{CheckIns-ChCPhm2E.mjs → CheckIns-C2-_CF8W.mjs} +1 -1
  29. package/dist/{CheckSeal-CL8ADxjG.mjs → CheckSeal-DP-Bu76i.mjs} +1 -1
  30. package/dist/{Checkmark-l7eHhC1b.mjs → Checkmark-pT3h775j.mjs} +1 -1
  31. package/dist/{Clock-Bdmkt88n.mjs → Clock-owkN34v1.mjs} +1 -1
  32. package/dist/{Close-CHH8OuEY.mjs → Close-I4-5WgU2.mjs} +1 -1
  33. package/dist/{CloudDownload-5JOGCGdY.mjs → CloudDownload-Cn9SDhln.mjs} +1 -1
  34. package/dist/{Comment-BnevgtpM.mjs → Comment-DNHk4tRN.mjs} +1 -1
  35. package/dist/{Comments-B5ctgLT7.mjs → Comments-D6NGehpH.mjs} +1 -1
  36. package/dist/{Connections-o6YNBy1v.mjs → Connections-UMxEAmYC.mjs} +1 -1
  37. package/dist/{Copy-CPsIA7t8.mjs → Copy-qbEh8-ST.mjs} +1 -1
  38. package/dist/{CustomQuestion-D6DsnC1d.mjs → CustomQuestion-DFDmtFB5.mjs} +1 -1
  39. package/dist/{CustomerSuccess-DSaDUV0v.mjs → CustomerSuccess-DnV5mvFW.mjs} +1 -1
  40. package/dist/{DatePicker-ywifNEzh.mjs → DatePicker-Dh0pdDXp.mjs} +1 -1
  41. package/dist/{Dot-CO9t6Su8.mjs → Dot-D8EcYKKN.mjs} +1 -1
  42. package/dist/{Download-CB1f3vCp.mjs → Download-DIkfgHko.mjs} +1 -1
  43. package/dist/{Drag-CDNuYMLA.mjs → Drag-BLOn_3vi.mjs} +1 -1
  44. package/dist/{Earn-BW612-nb.mjs → Earn-Brtd_i-3.mjs} +1 -1
  45. package/dist/{Email-CEt4gS8_.mjs → Email-nDx3OiPX.mjs} +1 -1
  46. package/dist/{EmojiDisplay-DOIyaKVV.mjs → EmojiDisplay-DZQJw9dY.mjs} +2 -2
  47. package/dist/{EmojiPicker-CKALo9cm.mjs → EmojiPicker-BAKMY3Zy.mjs} +2 -2
  48. package/dist/{EnpsSurvey-BJXuCSGd.mjs → EnpsSurvey-SWVtcg-E.mjs} +1 -1
  49. package/dist/{Expired-DZyLXfZ3.mjs → Expired-BEace1cp.mjs} +1 -1
  50. package/dist/{Eye-2iN9oWW1.mjs → Eye-QlIPfElV.mjs} +1 -1
  51. package/dist/{Feedback-Z2GvuM5f.mjs → Feedback-CzBRNbLx.mjs} +1 -1
  52. package/dist/{Feedback-D8x_EWhL.mjs → Feedback-DAtbJvk7.mjs} +1 -1
  53. package/dist/{Filter-DKQz_9ww.mjs → Filter-DShDOjuB.mjs} +1 -1
  54. package/dist/{Flag-Cy4PkZ76.mjs → Flag-BgLmOtZF.mjs} +1 -1
  55. package/dist/{Giphy-Yx71PB1H.mjs → Giphy-BRim96XX.mjs} +1 -1
  56. package/dist/{GoalCount-DymkQu5J.mjs → GoalCount-spEqCfR0.mjs} +1 -1
  57. package/dist/{GoalPercent-BkTWSxdB.mjs → GoalPercent-B8Y9FtDb.mjs} +1 -1
  58. package/dist/{GoalTask-CiSZpuze.mjs → GoalTask-BgQ7F2Ee.mjs} +1 -1
  59. package/dist/{GoalTask-BC3CgReZ.mjs → GoalTask-CvMZZNMC.mjs} +1 -1
  60. package/dist/{Goals-BoCzkncf.mjs → Goals-6HRPHM1D.mjs} +1 -1
  61. package/dist/{Goals-C2H5ChWx.mjs → Goals-DZprIJma.mjs} +1 -1
  62. package/dist/{Growth-Bjvc2zeI.mjs → Growth-DiqRrU4F.mjs} +1 -1
  63. package/dist/{Hamburger-Eq9baUbd.mjs → Hamburger-DqFa0Otb.mjs} +1 -1
  64. package/dist/{Help-C_GItq7B.mjs → Help-ChxbcY76.mjs} +1 -1
  65. package/dist/{HighFive-NJTys1s7.mjs → HighFive-BpcJRJ-S.mjs} +1 -1
  66. package/dist/{HighFive-CPVA3qMJ.mjs → HighFive-dz4MM6kL.mjs} +1 -1
  67. package/dist/{Home-WagkIoEI.mjs → Home-C10iK8l_.mjs} +1 -1
  68. package/dist/{Home-Ctk_GYOx.mjs → Home-DnR_fAyo.mjs} +1 -1
  69. package/dist/{HorizontalLine-R74XSGEA.mjs → HorizontalLine-BoQwzI_J.mjs} +1 -1
  70. package/dist/{Hourglass-BuefQdjd.mjs → Hourglass-ByESoLpR.mjs} +1 -1
  71. package/dist/{Image-CsZTOlEP.mjs → Image-C-l5vo4g.mjs} +1 -1
  72. package/dist/{ImageFile-DFzDF6Ex.mjs → ImageFile-4B70vlZA.mjs} +1 -1
  73. package/dist/{InGoodCompany-CkbL4MuD.mjs → InGoodCompany-Cf2Cy420.mjs} +1 -1
  74. package/dist/{Incentives-C9d_-DxV.mjs → Incentives-CE4aoyl4.mjs} +1 -1
  75. package/dist/{Info-GWn-oLar.mjs → Info-CV9Mi_8G.mjs} +1 -1
  76. package/dist/{Insights-CiKl1p4H.mjs → Insights-DwrpUIke.mjs} +1 -1
  77. package/dist/{Insights-BkwH43aG.mjs → Insights-VMYNeT7t.mjs} +1 -1
  78. package/dist/{Integrations-CFP2SVA5.mjs → Integrations-C5f1apD6.mjs} +1 -1
  79. package/dist/{KazooLogo-5twCrgpx.mjs → KazooLogo-BZCrIqi9.mjs} +1 -1
  80. package/dist/{KnowYourAudience-CRvhVJda.mjs → KnowYourAudience-DChzztvz.mjs} +1 -1
  81. package/dist/{Launch-CFjEXN3o.mjs → Launch-BTpfYgUU.mjs} +1 -1
  82. package/dist/{Link-BoHpHdQK.mjs → Link-DfN3OvCB.mjs} +1 -1
  83. package/dist/{LinkArrow-DTvJ_JOx.mjs → LinkArrow-CjJNNBL9.mjs} +1 -1
  84. package/dist/{Loading-BXpCaWvo.mjs → Loading-Au6RPy3R.mjs} +1 -1
  85. package/dist/{Lock-CCYkH-9r.mjs → Lock-DuDG9KIB.mjs} +1 -1
  86. package/dist/{Management-Ci1QzxCo.mjs → Management-Tnf8nAY7.mjs} +1 -1
  87. package/dist/{MeatballMenu-BQ7l--TX.mjs → MeatballMenu-DXVLNcoR.mjs} +1 -1
  88. package/dist/{Messages-DSAGyq-O.mjs → Messages-DzzTALV0.mjs} +1 -1
  89. package/dist/{Microphone-BSenWYgh.mjs → Microphone-Bhn16c7-.mjs} +1 -1
  90. package/dist/{Mobile-BBFdXiSp.mjs → Mobile-DmBqyj7B.mjs} +1 -1
  91. package/dist/{Nomination-D3uBEujq.mjs → Nomination-BnP6PugD.mjs} +1 -1
  92. package/dist/{NominationsAndAwards-DKfexhc_.mjs → NominationsAndAwards-D7c7OlF3.mjs} +1 -1
  93. package/dist/{Notification-ONVuwQ9O.mjs → Notification-D25Ykadm.mjs} +1 -1
  94. package/dist/{Okrs-CWvNlDC0.mjs → Okrs-DLeWBRcr.mjs} +1 -1
  95. package/dist/{Pause-BB4gh8K1.mjs → Pause-1rh2NZcs.mjs} +1 -1
  96. package/dist/{PeerToPeer-BCauRgOy.mjs → PeerToPeer-fYjGi7UB.mjs} +1 -1
  97. package/dist/{Pencil-Ylo62Pzf.mjs → Pencil-fCLCyG6W.mjs} +1 -1
  98. package/dist/{People-BwS3HY5h.mjs → People-Ct2hfgLp.mjs} +1 -1
  99. package/dist/{PerformanceManagement-C56ep9zv.mjs → PerformanceManagement-BWb-GrXm.mjs} +1 -1
  100. package/dist/{Pin-C0ry9FkP.mjs → Pin-Di_-3224.mjs} +1 -1
  101. package/dist/{PinnedIconAward-BrVIvuh0.mjs → PinnedIconAward-JoZxMtnh.mjs} +1 -1
  102. package/dist/{PinnedIconBrightIdea-qH2tNWOP.mjs → PinnedIconBrightIdea-D6ebJKGA.mjs} +1 -1
  103. package/dist/{PinnedIconBullseye-BgZCSCHu.mjs → PinnedIconBullseye-DSLEfH9Y.mjs} +1 -1
  104. package/dist/{PinnedIconChampagne-CUom7omQ.mjs → PinnedIconChampagne-ixl1R_fM.mjs} +1 -1
  105. package/dist/{PinnedIconCheer-B_8DVJ0p.mjs → PinnedIconCheer-BLouQ64L.mjs} +1 -1
  106. package/dist/{PinnedIconCrown-DPcu52xl.mjs → PinnedIconCrown-CaTmDjrM.mjs} +1 -1
  107. package/dist/{PinnedIconDiamond-DNKgKkSf.mjs → PinnedIconDiamond-BIW5THEJ.mjs} +1 -1
  108. package/dist/{PinnedIconHoleInOne-4QQPFRGA.mjs → PinnedIconHoleInOne--TjUiCzS.mjs} +1 -1
  109. package/dist/{PinnedIconMedal-DJfRNl7i.mjs → PinnedIconMedal-BS_qKs32.mjs} +1 -1
  110. package/dist/{PinnedIconMetrics-CrAigzDq.mjs → PinnedIconMetrics-iOSjcK5H.mjs} +1 -1
  111. package/dist/{PinnedIconPin-C7GdyOeB.mjs → PinnedIconPin-nPHNbAaS.mjs} +1 -1
  112. package/dist/{PinnedIconRockAndRoll-CtIi4WXP.mjs → PinnedIconRockAndRoll-D0mgs8aK.mjs} +1 -1
  113. package/dist/{PinnedIconRocket-DrRXydCT.mjs → PinnedIconRocket-CwWfmGFu.mjs} +1 -1
  114. package/dist/{PinnedIconStrength-CPZ63hEE.mjs → PinnedIconStrength-DUmlZ9Kk.mjs} +1 -1
  115. package/dist/{PinnedIconTeddyBear-B5jk9PlU.mjs → PinnedIconTeddyBear-BAy9B9xw.mjs} +1 -1
  116. package/dist/{PlatformLogo-C44UEFdX.mjs → PlatformLogo-BTswwOQA.mjs} +1 -1
  117. package/dist/{Plus-BfpthNLH.mjs → Plus-B2QiNLC-.mjs} +1 -1
  118. package/dist/{Popper-Cq9ATl0c.mjs → Popper-CDIlPgLD.mjs} +1 -1
  119. package/dist/{PrivateEye-DifB92xH.mjs → PrivateEye-BcnOqtNs.mjs} +1 -1
  120. package/dist/{PrivatePushPin-BzB5wGIP.mjs → PrivatePushPin-e0a8Y8Kj.mjs} +1 -1
  121. package/dist/{Processing-cPE3BESV.mjs → Processing-tY-ULWDJ.mjs} +1 -1
  122. package/dist/{Productivity-DIj6zw0h.mjs → Productivity-Bj2Rigzb.mjs} +1 -1
  123. package/dist/{ProgressCircle-oFcjhlAr.mjs → ProgressCircle-B3hEtcmO.mjs} +1 -1
  124. package/dist/{PulseSurvey-BZVfvZFO.mjs → PulseSurvey-BpO3R_qE.mjs} +1 -1
  125. package/dist/{PushPin-C_UsL0J2.mjs → PushPin-C-en_QQf.mjs} +1 -1
  126. package/dist/{Recognition-8d2qHhcn.mjs → Recognition-C5BEflu7.mjs} +1 -1
  127. package/dist/{Recognition-BGJUe7Tv.mjs → Recognition-DLOL0cPC.mjs} +1 -1
  128. package/dist/{Retention-BY83f0q4.mjs → Retention-DeDklo_k.mjs} +1 -1
  129. package/dist/{Rewards-BgUdIX3n.mjs → Rewards-BwgKjhMM.mjs} +1 -1
  130. package/dist/{Rewards-0uJQoGQ3.mjs → Rewards-f7Ln_IH4.mjs} +1 -1
  131. package/dist/{RewardsCatalog-Bq1u1kAe.mjs → RewardsCatalog-DO0f2OCe.mjs} +1 -1
  132. package/dist/{Roadmap-CIYeceC3.mjs → Roadmap-BzdhCwuK.mjs} +1 -1
  133. package/dist/{Search-C8sLL6FP.mjs → Search-DySf1A_T.mjs} +1 -1
  134. package/dist/{Security-BcTN7UGF.mjs → Security-CXIPGE-6.mjs} +1 -1
  135. package/dist/{SendRecognition-CknJ_oS3.mjs → SendRecognition-C0r_9vcz.mjs} +1 -1
  136. package/dist/{ShareLink-C4UJdaSv.mjs → ShareLink-BUtJh6-S.mjs} +1 -1
  137. package/dist/{SidebarCollapse-BrjenFP2.mjs → SidebarCollapse-IPoG3z4M.mjs} +1 -1
  138. package/dist/{Skill-Ci13EnDB.mjs → Skill-CLhjBA4h.mjs} +1 -1
  139. package/dist/{Skills-CAklVZ_K.mjs → Skills-DOy6-DMK.mjs} +1 -1
  140. package/dist/{Smiley-DwIQeYeK.mjs → Smiley-BWI-xsFK.mjs} +1 -1
  141. package/dist/{Stop-Dq0S0WoP.mjs → Stop-DPTYTIoo.mjs} +1 -1
  142. package/dist/{Survey-gA8vkbgM.mjs → Survey-DWo4LQtM.mjs} +1 -1
  143. package/dist/{Surveys-Dqd5mfK4.mjs → Surveys-C6sADdtk.mjs} +1 -1
  144. package/dist/{SyncUps-CeLNXMiP.mjs → SyncUps-CxUP7q8Z.mjs} +1 -1
  145. package/dist/{Syncs-BK0cqrjf.mjs → Syncs-B_MRZ7L8.mjs} +1 -1
  146. package/dist/{TalentReview-Co-t0g5U.mjs → TalentReview-BLWcaL6m.mjs} +1 -1
  147. package/dist/{TalentReview-CrXdIn3U.mjs → TalentReview-zPKlJZAV.mjs} +1 -1
  148. package/dist/{TalentReviewInsights-DudQ2wW9.mjs → TalentReviewInsights-Desl9ij2.mjs} +1 -1
  149. package/dist/{TaskCompleted-BQTP6EdU.mjs → TaskCompleted-r9sLbu39.mjs} +1 -1
  150. package/dist/{Team-BN4R8gZe.mjs → Team-lMudV6kv.mjs} +1 -1
  151. package/dist/{Teams-B9TEgI8c.mjs → Teams-CZ_VZuiU.mjs} +1 -1
  152. package/dist/{TextBold-B0m3C6DM.mjs → TextBold-Dq7A5_Il.mjs} +1 -1
  153. package/dist/{TextBulletList-CdDg92KU.mjs → TextBulletList-B6jIDAlX.mjs} +1 -1
  154. package/dist/{TextInput-BF3Huh_3.mjs → TextInput-DE5t0C7G.mjs} +1 -1
  155. package/dist/{TextItalic-CWnSP9lv.mjs → TextItalic-D-rxIONl.mjs} +1 -1
  156. package/dist/{TextNumberList-D5R6pzLe.mjs → TextNumberList-ClTDLlaH.mjs} +1 -1
  157. package/dist/{TextUnderline-BFyCHzuq.mjs → TextUnderline-Ch0VzDQn.mjs} +1 -1
  158. package/dist/{Toggle-8-CRhwRf.mjs → Toggle-DD1semaQ.mjs} +1 -1
  159. package/dist/{Translate-DpFYfzJ5.mjs → Translate-DepqeLBS.mjs} +1 -1
  160. package/dist/{Trash-C4ei5HJb.mjs → Trash-DwRlMrcj.mjs} +1 -1
  161. package/dist/{TrendDown-XXwbWdgg.mjs → TrendDown-BpXOjjaE.mjs} +1 -1
  162. package/dist/{TrendUp-DV-nNVVL.mjs → TrendUp-VJp0UPQZ.mjs} +1 -1
  163. package/dist/{Undo-Cl9dXrt9.mjs → Undo-BZL3j5PT.mjs} +1 -1
  164. package/dist/{Unplugged-BQpzIxAv.mjs → Unplugged-C-7n3xIA.mjs} +1 -1
  165. package/dist/{UpDownCaret-liY1suHR.mjs → UpDownCaret-BoiqMEET.mjs} +1 -1
  166. package/dist/{VerticalLine-s1ltCQWR.mjs → VerticalLine-Dojvh9Pd.mjs} +1 -1
  167. package/dist/{Warning-CUYeht-a.mjs → Warning-CT3U6LDq.mjs} +1 -1
  168. package/dist/{WarningNoOutline-C2A4ywqx.mjs → WarningNoOutline-Z6O5oCTK.mjs} +1 -1
  169. package/dist/{YesAnd-BaRoicij.mjs → YesAnd-fr5XKK4L.mjs} +1 -1
  170. package/dist/{emoji-eOb0anc3.mjs → emoji-DxEYeyv2.mjs} +1 -1
  171. package/dist/{react-apexcharts.min-aFDcx2hO.mjs → react-apexcharts.min-kV7rJgRc.mjs} +1 -1
  172. package/dist/react.es.js +1 -1
  173. package/dist/react.umd.js +1 -1
  174. package/dist/{reactComponent--n2dwAjt.mjs → reactComponent-CXbyBhUs.mjs} +191 -191
  175. package/package.json +1 -1
  176. package/react.d.ts +8 -0
@@ -1,4 +1,4 @@
1
- import { j as r } from "./reactComponent--n2dwAjt.mjs";
1
+ import { j as r } from "./reactComponent-CXbyBhUs.mjs";
2
2
  const e = ({ color: t }) => /* @__PURE__ */ r.jsx("g", { children: /* @__PURE__ */ r.jsx(
3
3
  "path",
4
4
  {
@@ -1,4 +1,4 @@
1
- import { j as r } from "./reactComponent--n2dwAjt.mjs";
1
+ import { j as r } from "./reactComponent-CXbyBhUs.mjs";
2
2
  const i = ({ variant: s, color: t }) => {
3
3
  const e = {
4
4
  filled: void 0,
@@ -1,4 +1,4 @@
1
- import { j as t } from "./reactComponent--n2dwAjt.mjs";
1
+ import { j as t } from "./reactComponent-CXbyBhUs.mjs";
2
2
  const o = ({ variant: n, color: r }) => {
3
3
  const e = {
4
4
  thin: void 0,
@@ -1,4 +1,4 @@
1
- import { j as t } from "./reactComponent--n2dwAjt.mjs";
1
+ import { j as t } from "./reactComponent-CXbyBhUs.mjs";
2
2
  const o = ({ variant: i, color: r }) => {
3
3
  const n = {
4
4
  thin: void 0,
@@ -1,4 +1,4 @@
1
- import { j as C } from "./reactComponent--n2dwAjt.mjs";
1
+ import { j as C } from "./reactComponent-CXbyBhUs.mjs";
2
2
  function L({ illustrationColor: t }) {
3
3
  return /* @__PURE__ */ C.jsxs(C.Fragment, { children: [
4
4
  /* @__PURE__ */ C.jsx("title", { children: "Yes and illustration" }),
@@ -1,4 +1,4 @@
1
- import { _ as A, g as yt, r as _t, h as Et, i as Ct, k as he } from "./reactComponent--n2dwAjt.mjs";
1
+ import { _ as A, g as yt, r as _t, h as Et, i as Ct, k as he } from "./reactComponent-CXbyBhUs.mjs";
2
2
  import s from "react";
3
3
  function te(i) {
4
4
  "@babel/helpers - typeof";
@@ -1,4 +1,4 @@
1
- import { l as gs, r as ma, h as fs, i as ps } from "./reactComponent--n2dwAjt.mjs";
1
+ import { l as gs, r as ma, h as fs, i as ps } from "./reactComponent-CXbyBhUs.mjs";
2
2
  import xs from "react";
3
3
  function bs(o, e) {
4
4
  for (var t = 0; t < e.length; t++) {
package/dist/react.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as e, n as o, p as a, m as n, q as i, u as g, v as p, t as A, s as m } from "./reactComponent--n2dwAjt.mjs";
1
+ import { A as e, n as o, p as a, m as n, q as i, u as g, v as p, t as A, s as m } from "./reactComponent-CXbyBhUs.mjs";
2
2
  export {
3
3
  e as AiAssistant,
4
4
  o as AiAssistantSettingsComponent,
package/dist/react.umd.js CHANGED
@@ -279,7 +279,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
279
279
  }
280
280
  `;function uN(t){const e={...En,...t};return Du(lN,e)}function fN({originalSetMessages:t,propRefs:e}){return i=>{t(a=>{const r=typeof i=="function"?i(a):i;return e.current.messages=r,r})}}function dN({retry:t}){const e=()=>{window.location.reload()};return h.jsxs(ot,{direction:"column",gap:"24px",children:[h.jsx(s2,{}),h.jsx(Tt,{}),h.jsxs(ot,{direction:"row",gap:"8px",alignItems:"center",children:[h.jsx(Nt,{icon:"warning"}),h.jsxs(Ct,{children:["Error calling LLM API. If this persists, try"," ",h.jsx("a",{href:"#",onClick:e,"data-testid":"connection-error-refresh-page",children:"refreshing the page"}),"."]})]}),h.jsxs(ot,{justifyContent:"flex-end",gap:"8px",children:[h.jsx(Yi,{onClick:e,variant:"system",size:"small","data-testid":"connection-error-refresh-page-button",children:"Refresh Page"}),h.jsx(Yi,{onClick:t,variant:"primary","data-testid":"connection-error-retry-button",children:"Retry"})]})]})}class gN{static parse(e){return e.trim().split(`
281
281
  `).map(a=>JSON.parse(a))}static stringify(e){return e.map(i=>JSON.stringify(i)).join(`
282
- `)}}const Wa={kazooUrlStrategy:t=>t,pulseUrlStrategy:t=>t,llmCallUrlStrategy:()=>"/api/api-ai-assistant/v1/chat",pulseBearerTokenStrategy:()=>null,screenshotMainContentSelector:"#root",structuredResponseUrlStrategy:()=>"/api/api-ai-assistant/v1/structured-response",synthesizeUrlStrategy:()=>"/api/api-ai-assistant/v1/tts",transcribeUrlStrategy:()=>"/api/api-ai-assistant/v1/stt"};function m8(){return Wa.synthesizeUrlStrategy()}function A8(){return Wa.llmCallUrlStrategy()}function p8(){return Wa.llmCallUrlStrategy()}function b8(){return Wa.structuredResponseUrlStrategy()}function X3(t){return Wa.kazooUrlStrategy(t)}function hN(t){return Wa.pulseUrlStrategy(t)}function ll(){return Wa.pulseBearerTokenStrategy()}function y8(){return Wa.screenshotMainContentSelector}function _N(t){Wa.screenshotMainContentSelector=t}function cN(t){Wa.kazooUrlStrategy=t}function FN(t){Wa.llmCallUrlStrategy=t}function mN(t){Wa.pulseUrlStrategy=t}function AN(t){Wa.pulseBearerTokenStrategy=t}function pN(t){Wa.structuredResponseUrlStrategy=t}function bN(t){Wa.synthesizeUrlStrategy=t}function yN(t){Wa.transcribeUrlStrategy=t}const wN=Object.freeze(Object.defineProperty({__proto__:null,getKazooUrl:X3,getLlmCallUrl:p8,getPulseBearerToken:ll,getPulseUrl:hN,getScreenshotMainContentSelector:y8,getStructuredResponseUrl:b8,getSynthesizeUrl:m8,getTranscribeUrl:A8,setKazooUrlStrategy:cN,setLlmCallUrlStrategy:FN,setPulseBearerTokenStrategy:AN,setPulseUrlStrategy:mN,setScreenshotMainContentSelector:_N,setStructuredResponseUrlStrategy:pN,setSynthesizeUrlStrategy:bN,setTranscribeUrlStrategy:yN},Symbol.toStringTag,{value:"Module"}));async function Y3({model:t,temperature:e,stream:i,messages:a,tools:r,onChunk:n,onError:o,onComplete:s,systemInstruction:l}){var f;const u=ll();try{const d=await fetch(p8(),{method:"POST",body:JSON.stringify({model:t,temperature:e,stream:i,messages:a,tools:r,systemInstruction:l}),credentials:u?void 0:"include",headers:{"Content-Type":"application/json",Accept:i?"text/event-stream":"application/json",...u?{Authorization:`Bearer ${u}`}:{}}});if(!d||!d.ok)throw new Error("Unable to connect to LLM API. Please try again.");if(i){const _=(f=d.body)==null?void 0:f.getReader();if(!_)throw new Error("Unexpected client error. Response body reader not available.");const F=new TextDecoder,c=[],m=n||(p=>{c.push(p)}),A=1e4;for(;A>0;){const{done:p,value:w}=await _.read();if(p)break;const b=F.decode(w),y=gN.parse(b);for(const k of y)m(k)}return s==null||s(),c}return(await d.json()).parts}catch(d){const g=d instanceof Error?d:new Error("Unexpected error calling LLM API");throw o==null||o(g),g}}function kN(t){var i,a,r,n;const e=[];for(const o of t)o.role==="TOOL"?e.push({id:o.id,role:"user",parts:[{type:"toolCall",toolName:(i=o.metadata)==null?void 0:i.toolName,args:{args:(a=o.metadata)==null?void 0:a.toolArgs}}]},{id:o.id,role:"user",parts:[{type:"toolResult",result:o.messageText,toolName:(r=o.metadata)==null?void 0:r.toolName,args:{args:(n=o.metadata)==null?void 0:n.toolArgs}}]}):o.role==="USER"?e.push({id:o.id,role:"user",parts:[{type:"text",text:o.messageText}]}):o.role==="MODEL"&&e.push({id:o.id,role:"model",parts:[{type:"text",text:o.messageText}]});return e}async function w8({propRefs:t,conversationId:e}){var o;if(!t.current.getFollowUpSuggestions)return;const i=t.current.getConversationById(e);if(!i||!((o=i.messages)!=null&&o.length))return;const a=Date.now();k8.set(e,a),t.current.setFollowUpSuggestionsByConversationId(s=>({...s,[e]:[{type:"loading"}]}));const r=await t.current.getFollowUpSuggestions({conversation:i}).catch(s=>(console.log("Error getting follow up suggestions",s),[])),n=k8.get(e);n&&a!==n||t.current.setFollowUpSuggestionsByConversationId(s=>({...s,[e]:r.map(l=>({id:l.fullPrompt||l.title,title:l.title,onClick:()=>{!l.fullPrompt||l.fullPrompt===l.title?t.current.handleSendUserMessage({conversationId:e,messageText:l.title}):t.current.setPrompt(e,tt(l.fullPrompt,l.title))}}))}))}const k8=new Map;async function xN({toolCalls:t,propRefs:e,debugInfo:i,conversationId:a,appendMessageToConversation:r}){await sS(async n=>{var l,u,f;if(t.length===0||!e.current.isMounted)return n();const o=[];for(const d of t){const g=M1(),_=(l=e.current.tools)==null?void 0:l.find(A=>A.name===d.toolName);if(!_){(f=(u=e.current).onError)==null||f.call(u,new Error(`Tool ${d.toolName} not found`)),i.current.push({time:new Date,message:`Tool ${d.toolName} not found`,data:{toolCall:d,tools:e.current.tools},level:"error"});continue}let F=d.args;if(F!=null&&F.args)for(;F!=null&&F.args;)F=F.args;let c,m=new Promise(A=>A());try{m=new Promise(b=>{e.current.setMessages(y=>{const k={...y};return k[a]={...k[a]},k[a].messages=[...k[a].messages,{id:g,role:"TOOL",conversationId:a,messageText:d.toolName,metadata:{toolName:d.toolName,toolArgs:d.args,loading:!0}}],b(),k})}),i.current.push({time:new Date,level:"info",message:"Fulfilling tool call",data:{toolCall:d}});const A=Date.now(),p=await _.fulfill(F),w=Date.now();typeof p=="string"?(c=p,o.push({type:"toolResult",toolName:d.toolName,args:F,result:p}),i.current.push({time:new Date,level:"info",message:"Tool call fulfilled",data:{toolCall:d,durationMs:w-A,result:p}})):(o.push({type:"toolResult",toolName:d.toolName,result:`Tool ${d.toolName} returned the following file`,args:F}),o.push({type:"file",toolName:d.toolName,fileUri:p==null?void 0:p.fileUri,mimeType:p==null?void 0:p.mimeType,args:F}),i.current.push({time:new Date,level:"info",message:"Tool call fulfilled with file",data:{toolCall:d,durationMs:w-A,result:p}}))}catch(A){i.current.push({time:new Date,message:"Error calling tool",level:"error",data:{toolCall:d,error:{message:A.message,stack:A.stack}}}),o.push({type:"toolResult",toolName:d.toolName,result:{error:{message:A.message,stack:A.stack}},args:F})}finally{await m;const p={...tt(e.current.messages,{})};p[a].messages=p[a].messages.map(w=>w.id===g?{...w,messageText:tt(c,w.messageText),metadata:{...w.metadata,loading:!1}}:w),e.current.setMessages(p)}}if(!e.current.isMounted)return n();const s=o.map(d=>({id:M1(),role:"TOOL",conversationId:a,messageText:d.type==="toolResult"?d.result:"file",metadata:{toolName:d.toolName,toolArgs:d.args}}));await Promise.all(s.map(async d=>{await r({variables:{input:{conversationId:a,message:{id:d.id,role:"TOOL",messageText:d.messageText,metadata:d.metadata}}}})})),await e.current.sendMessages(a),n()})}function CN({setConnectionError:t,propRefs:e,debugInfo:i,appendMessageToConversation:a}){return async function r(n){var s,l,u,f,d;if(!e.current.isMounted)return!1;t(null),e.current.setMessages(g=>({...g,[n]:{...g[n],isLoading:!0}}));try{e.current.onBeforeLlmCall&&e.current.onBeforeLlmCall()}catch(g){i.current.push({time:new Date,message:"Error calling onBeforeLlmCall",data:g,level:"error"})}let o;try{e.current.systemInstruction&&(i.current.push({time:new Date,message:"Getting system instruction",level:"info"}),o=await e.current.systemInstruction(),i.current.push({time:new Date,message:"System instruction",data:o,level:"info"}))}catch(g){i.current.push({time:new Date,message:"Error getting system instruction",data:g,level:"error"}),(l=(s=e.current).onError)==null||l.call(s,g)}e.current.setFollowUpSuggestionsByConversationId(g=>({...g,[n]:[]}));try{const g={type:"text",text:""},_=[],F=M1();return await Y3({model:e.current.model,temperature:e.current.temperature,stream:!0,messages:kN(tt((u=e.current.getConversationById(n))==null?void 0:u.messages,[])),tools:e.current.tools,systemInstruction:o,onChunk:c=>{var m,A;c.type==="text"?g.text+=c.text:c.type==="toolCall"&&_.push(c),e.current.setMessages(p=>{const w=p[n];if(!w)return console.error(`Invariant violation: currentConversation is undefined for conversationId ${n}`,p),p;const b=tt(w.messages,[]),y=b[b.length-1];return(y==null?void 0:y.role)==="MODEL"?y.messageText=g.text:g.text&&b.push({id:F,role:"MODEL",conversationId:n,messageText:g.text}),w.messages=b,{...p,[n]:Bu(w)}}),(A=(m=e.current).onChunkAdded)==null||A.call(m)}}),g.text&&await a({variables:{input:{conversationId:n,message:{id:F,role:"MODEL",messageText:g.text}}}}),vN({condition:!!e.current.onAfterLlmCall,conversationId:n,callbackToInvoke:e.current.onAfterLlmCall,callbackName:"onAfterLlmCall",debugInfo:i,onError:e.current.onError,propRefs:e}),await xN({conversationId:n,toolCalls:_,propRefs:e,debugInfo:i,appendMessageToConversation:a}),await w8({propRefs:e,conversationId:n}),!0}catch(g){if(!e.current.isMounted)return!1;const _=Kl(bi(t,null),bi(r,n));return i.current.push({time:new Date,message:"Error calling LLM API",data:g,level:"error"}),t({message:h.jsx(dN,{retry:_}),retry:_}),(d=(f=e.current).onError)==null||d.call(f,g),!1}finally{e.current.setMessages(g=>({...g,[n]:{...g[n],isLoading:!1}}))}}}function vN({condition:t,conversationId:e,callbackToInvoke:i,callbackName:a,debugInfo:r,onError:n,propRefs:o}){if(!(!t||!i)){r.current.push({time:new Date,message:`Calling ${a}`,level:"info"});try{const s=o.current.messages;i(s[e].messages)}catch(s){r.current.push({time:new Date,message:`Error calling ${a}`,data:s,level:"error"}),n&&n(s)}finally{r.current.push({time:new Date,message:`Finished calling ${a}`,level:"info"})}}}async function x8(t,e){const i=ll(),a=await fetch(m8(),{method:"POST",body:JSON.stringify({text:t,voice:e}),credentials:i?void 0:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...i?{Authorization:`Bearer ${i}`}:{}}});if(!a||!a.ok)throw new Error("Unable to connect to LLM API. Please try again.");const r=await a.json();if(!r.synthesis)throw new Error("No synthesis data received.");return r.synthesis}async function DN(t){const e=ll(),i=await fetch(A8(),{method:"POST",body:JSON.stringify({audio:t}),credentials:e?void 0:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...e?{Authorization:`Bearer ${e}`}:{}}});if(!i||!i.ok)throw new Error("Unable to connect to LLM API. Please try again.");const a=await i.json();if(!a.transcription)throw new Error("No transcription data received.");return a.transcription}function EN({model:t,initialMessages:e,temperature:i,onAfterLlmCall:a,onBeforeLlmCall:r,onError:n,tools:o,onChunkAdded:s,systemInstruction:l,onSelectedConversationChange:u,onSelectedConversationLoaded:f,initialConversationId:d,getFollowUpSuggestions:g,getChatTitle:_,initialPrompt:F}){const[c,m]=M.useState(!1),[A,p]=M.useState(!1),[w,b]=M.useState("Aoede"),[y,k]=M.useState(null),[C,v]=M.useState(!1),[E,D]=M.useState(!1),[S,H]=M.useState(!1),[T,I]=M.useState(BN({initialConversationId:d})),[U,q]=M.useState(SN({initialMessages:e,selectedConversationId:T})),Q=M.useRef({onAfterLlmCall:a,onBeforeLlmCall:r,onError:n,tools:o,model:t,temperature:i,isMounted:!0,systemInstruction:l,onChunkAdded:s,getConversationById:Ei,setFollowUpSuggestionsByConversationId:Ei,getFollowUpSuggestions:g,handleSendUserMessage:Ei,setPrompt:Ei,selectedConversationId:T,onSelectedConversationLoaded:f,onSelectedConversationChange:u,messages:U,sendMessages:Ei,setMessages:Ei}),P=M.useCallback(fN({originalSetMessages:q,propRefs:Q}),[q]),[V,x]=M.useState(!1),[L,N]=M.useState(""),B=M.useRef(void 0);B.current=f;const[G,ee]=M.useState({}),[W,X]=M.useState(jN({initialPrompt:F,selectedConversationId:T})),J=M.useRef([]),[re]=WQ(),{refetch:O}=iN({fetchPolicy:"cache-and-network",onCompleted:LN({propRefs:Q})}),[ne]=sN();Q.current.getConversationById=nt=>Q.current.messages[nt],Q.current.setFollowUpSuggestionsByConversationId=ee,Q.current.setPrompt=IN({setPromptByConversationId:X,selectedConversationId:T}),Q.current.onAfterLlmCall=a,Q.current.onBeforeLlmCall=r,Q.current.onError=n,Q.current.tools=o,Q.current.model=t,Q.current.temperature=i,Q.current.systemInstruction=l,Q.current.onChunkAdded=s,Q.current.isMounted=!0,Q.current.onSelectedConversationChange=u,Q.current.selectedConversationId=T,Q.current.getFollowUpSuggestions=g,Q.current.setMessages=P;const{loading:z,data:de}=XQ({skip:T===void 0,variables:{input:{conversationId:tt(T,"")}},fetchPolicy:"cache-and-network",onCompleted:MN({selectedConversationId:T,propRefs:Q,setVoiceOutputPlaying:H}),onError:Ei});M.useEffect(()=>()=>{Q.current.isMounted=!1},[]),M.useEffect(PN({propRefs:Q,selectedConversationId:T,messages:U}),[T,de]);const Ae=M.useCallback(bi(I,void 0),[]),be=M.useCallback(TN({propRefs:Q,updateConversationTitle:ne}),[ne]),qe=M.useCallback(HN({setIsTranscribingSpeech:D}),[]),_e=M.useCallback(UN(),[]),je=M.useCallback(CN({propRefs:Q,debugInfo:J,setConnectionError:k,appendMessageToConversation:re}),[]);Q.current.sendMessages=je;const Oe=M.useCallback(qN({setSelectedConversationId:I,debugInfo:J,appendMessageToConversation:re,propRefs:Q}),[I,J,re,Q]),De=ON({selectedConversationId:T,setPromptByConversationId:X,getChatTitle:_,sendUserMessage:Oe,updateTitle:be});Q.current.handleSendUserMessage=De;const Ne=tt(G[tt(T,"")],[]),Ze=tt(W[tt(T,"")],"");return{messages:U,setMessages:P,isVoiceInputEnabled:c,setIsVoiceInputEnabled:m,isVoiceOutputEnabled:A,setIsVoiceOutputEnabled:p,voiceOutputVoice:w,setVoiceOutputVoice:b,getSpeech:_e,getTranscription:qe,debugInfo:J.current,sendUserMessage:Oe,connectionError:y,followUpSuggestions:Ne,voiceInputProcessing:C,setVoiceInputProcessing:v,voiceInputTranscribing:E,setVoiceInputTranscribing:D,voiceOutputPlaying:S,setVoiceOutputPlaying:H,promptByConversationId:W,prompt:Ze,setPromptByConversationId:X,setPrompt:Q.current.setPrompt,selectedConversationId:T,isSearching:V,searchQuery:L,setIsSearching:x,setSearchQuery:N,isLoadingConversation:z,selectedConversation:U[tt(T,"")],createNewConversation:Ae,setSelectedConversationId:I,updateTitle:be,refetchConversations:O,handleSendUserMessage:De}}function BN({initialConversationId:t}){if(t)return t}function SN({initialMessages:t,selectedConversationId:e=""}){return e?{[e]:{id:e,title:"",updatedAt:new Date,isLoading:!1,messages:tt(t,[])}}:{}}function jN({initialPrompt:t,selectedConversationId:e}){return e?{[e]:tt(t,"")}:{"":tt(t,"")}}function LN({propRefs:t}){return e=>{if(e!=null&&e.getConversations){const i=Date.now(),a=Bu(e.getConversations).map(r=>({id:r.id,title:r.title,updatedAt:new Date(tt(r.updatedAt,i))}));t.current.setMessages(r=>{const n=Bu(r);for(const o of a){const s=o.id,l=r[s],u=tt(a.find(f=>f.id===s),{});n[s]={...l,...u}}return n})}}}function MN({selectedConversationId:t,propRefs:e,setVoiceOutputPlaying:i}){return a=>{if(i(!1),!(a!=null&&a.aiAssistantConversation))return;const r=Bu(a.aiAssistantConversation.messages);e.current.setMessages(n=>{if(!t)return n;const o=n[t];if(!o)return console.error(`Invariant violation: conversation is undefined for conversationId ${t}`,n),n;o.messages=tt(o.messages,[]);let s;for(const l of r){const u=o.messages.findIndex(d=>d.id===l.id),f=o.messages[u];typeof f<"u"?f.messageText=l.messageText:o.messages.splice(o.messages.findIndex(d=>d.id===s)+1,0,l),s=l.id}return{...n,[t]:Bu(o)}}),setTimeout(()=>{var n,o;(o=(n=e.current).onSelectedConversationLoaded)==null||o.call(n,t,e.current.selectedConversationId,e.current.messages)},10)}}function ON({selectedConversationId:t,sendUserMessage:e,setPromptByConversationId:i,getChatTitle:a,updateTitle:r}){return async({conversationId:n=t,messageText:o})=>{if(!o)return;const s=n===void 0;try{const{id:l}=await e({message:o});if(i(u=>({...u,[l]:""})),s){const u=await a(o);u&&u!=="New Chat"&&await r(l,u)}}catch(l){console.error(l)}}}function qN({propRefs:t,setSelectedConversationId:e,debugInfo:i,appendMessageToConversation:a}){return async({message:r,skipAppendingUserMessageToConversation:n=!1})=>{const o=!t.current.selectedConversationId,s=t.current.selectedConversationId||M1();t.current.selectedConversationId=s;const l=t.current.getConversationById(s),u={id:M1(),role:"USER",messageText:r,conversationId:s},f=Bu(l||{id:s,title:"New Chat",updatedAt:new Date,isLoading:!0,messages:[]}),d={...f,messages:[...tt(l==null?void 0:l.messages,[]),u],isLoading:!0};t.current.setMessages(c=>({...c,[s]:d})),o&&(e(s),t.current.selectedConversationId=s);const g=[];!n&&g.push(a({variables:{input:{conversationId:s,message:{id:u.id,role:"USER",messageText:r}}}}));const _=t.current.sendMessages(s);return g.push(_),await Promise.all(g),!!await _||i.current.push({time:new Date,message:"Error sending message",data:{oldStateInCaseOfFailure:f},level:"error"}),{id:s}}}function TN({propRefs:t,updateConversationTitle:e}){return async(i,a)=>{t.current.setMessages(r=>({...r,[i]:{...r[i],title:a,isUpdatingTitle:!0}})),await e({variables:{input:{conversationId:i,title:a}}}),t.current.setMessages(r=>({...r,[i]:{...r[i],isUpdatingTitle:!1}}))}}function IN({setPromptByConversationId:t,selectedConversationId:e}){return(i=tt(e,""),a)=>{t(typeof a=="function"?r=>({...r,[i]:a(r[i])}):r=>({...r,[i]:a}))}}function PN({propRefs:t,selectedConversationId:e,messages:i}){return()=>{var r,n;if((n=(r=t.current)==null?void 0:r.onSelectedConversationChange)==null||n.call(r,e,i),!e)return;const a=setTimeout(()=>{w8({propRefs:t,conversationId:e})},500);return()=>clearTimeout(a)}}function HN({setIsTranscribingSpeech:t}){return async e=>{t(!0);const i=await DN(e);return t(!1),i}}function UN(){return async t=>await x8(t)}const pa={"ai-assistant-textarea":"AiAssistantComponent-module_ai-assistant-textarea_dJrtB","ai-assistant-popup-container":"AiAssistantComponent-module_ai-assistant-popup-container_OH04M","ai-assistant-chat-history-container":"AiAssistantComponent-module_ai-assistant-chat-history-container_mIJ3y","ai-assistant-chat-history-header":"AiAssistantComponent-module_ai-assistant-chat-history-header_aR6OI","ai-assistant-chat-history-button":"AiAssistantComponent-module_ai-assistant-chat-history-button_Q34D6","conversation-selected":"AiAssistantComponent-module_conversation-selected_-ijIe","ai-assistant-chat-history-button-text":"AiAssistantComponent-module_ai-assistant-chat-history-button-text_cAi5Q","textarea-container":"AiAssistantComponent-module_textarea-container_4eE9f","placeholder-content":"AiAssistantComponent-module_placeholder-content_8vmjp","placeholder-text":"AiAssistantComponent-module_placeholder-text_8edUF","loading-container":"AiAssistantComponent-module_loading-container_7BNjW","messages-scroll-container":"AiAssistantComponent-module_messages-scroll-container_8O6Kb","ai-assistant-send-btn":"AiAssistantComponent-module_ai-assistant-send-btn_h2wdX","ai-assistant-search-input-container":"AiAssistantComponent-module_ai-assistant-search-input-container_lUZKm","voice-input-processing":"AiAssistantComponent-module_voice-input-processing_2zY1J","voice-input-transcribing":"AiAssistantComponent-module_voice-input-transcribing_k6mLe"};function RN({messages:t,selectedConversationId:e,onConversationSelect:i,loading:a=!1}){const{recentConversations:r,olderConversations:n}=M.useMemo(()=>{const o=Object.values(t),s=new Date().getTime()-7*24*60*60*1e3,l=o.filter(f=>f.updatedAt.getTime()>s),u=o.filter(f=>f.updatedAt.getTime()<=s);return{recentConversations:l,olderConversations:u}},[t]);return a?h.jsx(Wn,{centered:!0,size:"small"}):h.jsxs(ot,{direction:"column",gap:"24px",testId:"chat-history",children:[h.jsx(ot,{direction:"column",gap:"8px",children:h.jsx(C8,{conversations:r,selectedConversationId:e,onConversationSelect:i,title:"Past 7 days"})}),h.jsx(C8,{conversations:n,selectedConversationId:e,onConversationSelect:i,title:"Past 30 days"})]})}function C8({conversations:t,selectedConversationId:e,onConversationSelect:i,title:a,loadMoreThreshold:r=10}){const[n,o]=M.useState(!1),s=Object.values(t),l=!n&&s.length>r,u=n?s.length:r,f=s.slice(0,u);return f.length===0?null:h.jsxs(ot,{direction:"column",gap:"8px",children:[h.jsx("span",{className:pa["ai-assistant-chat-history-header"],children:a}),f.map(d=>h.jsx(Yi,{variant:"transparent",size:"small",className:pe(pa["ai-assistant-chat-history-button"],e===d.id&&pa["conversation-selected"]),onClick:()=>i(d.id),children:d.isLoading?h.jsxs("span",{className:pe(pa["ai-assistant-chat-history-button-text"]),children:[h.jsx("div",{style:{display:"inline-block"},children:h.jsx(Wn,{size:"extraSmall"})}),"  ",d.title]}):h.jsx("span",{className:pa["ai-assistant-chat-history-button-text"],children:d.title})},d.id)),l&&h.jsx(Yi,{icon:"arrow_down",iconAlignment:"right",variant:"system",size:"small",onClick:()=>o(!0),"data-testid":"chat-history-load-more",children:"Load More"})]})}function QN(t){return t?"arrow_up":"arrow_down"}function NN(t){return t.level==="error"?"warning_no_outline":"info"}function $N(t){return t.level==="warn"?"yellow":"gray"}function zN(t){return t.level==="error"?"red":"transparent"}function WN({debugInfo:t}){const[,e]=M.useState(0),i=M.useCallback(()=>e(l=>l+1),[]),a=M.useRef([]),r=M.useCallback(l=>{a.current.push(l),i()},[]),n=M.useCallback(l=>{a.current=a.current.filter(u=>u!==l),i()},[]),o=M.useCallback(l=>{a.current.includes(l)?n(l):r(l)},[r,n]),s=M.useCallback(l=>a.current.includes(l),[]);return h.jsx(ot,{direction:"column",gap:"8px","test-id":"debug-data",children:t.map((l,u)=>h.jsx(Yl,{style:{borderTop:`1px solid ${zN(l)}`},children:h.jsxs(ot,{direction:"column",gap:"8px",children:[h.jsxs(ot,{gap:"12px",alignItems:"center",justifyContent:"space-between",children:[h.jsx("div",{children:h.jsx(Nt,{icon:NN(l),color:$N(l)})}),h.jsxs(T1,{grow:1,children:[h.jsx("div",{children:l.message}),l.time?h.jsx(U1,{size:"extraSmall",children:l.time.toLocaleString()}):null]}),h.jsx("div",{children:h.jsx(Yi,{variant:"primary_inverted",size:"small",icon:QN(s(u)),onClick:bi(o,u),children:s(u)?"Collapse":"Expand"})})]}),s(u)&&h.jsx("textarea",{value:JSON.stringify(l,null,2),readOnly:!0,"data-testid":"debug-textarea",style:{minWidth:"100%",height:"100%",minHeight:"200px",maxWidth:"100%"}})]})},u))})}const GN={"follow-up-suggestion-pill":"FollowUpSuggestions-module_follow-up-suggestion-pill_mkFc2"};function VN({followUpSuggestions:t}){return!t||t.length===0?null:h.jsx(ot,{gap:"5px",alignItems:"center",justifyContent:"flex-start",wrap:"wrap",style:{marginBottom:"10px"},children:t.map(e=>h.jsx(KN,{suggestion:e},`${e==null?void 0:e.id}-${e.type}`))})}function KN({suggestion:t}){const e=`follow-up-suggestion-pill-${t.id}`;if(t.type==="loading")return h.jsx(Wn,{size:"extraSmall"});const i=()=>{t.onClick()};return h.jsx(Wg,{onClick:i,size:"small",variant:"gray",text:t.title,className:GN["follow-up-suggestion-pill"],"data-testid":e},t.id)}const v8=document.createElement("i");function D8(t){const e="&"+t+";";v8.innerHTML=e;const i=v8.textContent;return i.charCodeAt(i.length-1)===59&&t!=="semi"||i===e?!1:i}function io(t,e,i,a){const r=t.length;let n=0,o;if(e<0?e=-e>r?0:r+e:e=e>r?r:e,i=i>0?i:0,a.length<1e4)o=Array.from(a),o.unshift(e,i),t.splice(...o);else for(i&&t.splice(e,i);n<a.length;)o=a.slice(n,n+1e4),o.unshift(e,0),t.splice(...o),n+=1e4,e+=1e4}function Ga(t,e){return t.length>0?(io(t,t.length,0,e),t):e}const Z3={}.hasOwnProperty;function XN(t){const e={};let i=-1;for(;++i<t.length;)YN(e,t[i]);return e}function YN(t,e){let i;for(i in e){const r=(Z3.call(t,i)?t[i]:void 0)||(t[i]={}),n=e[i];let o;if(n)for(o in n){Z3.call(r,o)||(r[o]=[]);const s=n[o];ZN(r[o],Array.isArray(s)?s:s?[s]:[])}}}function ZN(t,e){let i=-1;const a=[];for(;++i<e.length;)(e[i].add==="after"?t:a).push(e[i]);io(t,0,0,a)}function JN(t){const e={};let i=-1;for(;++i<t.length;)e$(e,t[i]);return e}function e$(t,e){let i;for(i in e){const r=(Z3.call(t,i)?t[i]:void 0)||(t[i]={}),n=e[i];let o;if(n)for(o in n)r[o]=n[o]}}function t$(t,e){const i=Number.parseInt(t,e);return i<9||i===11||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}const i$={'"':"quot","&":"amp","<":"lt",">":"gt"};function E8(t){return t.replace(/["&<>]/g,e);function e(i){return"&"+i$[i]+";"}}function Ef(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ao=ds(/[A-Za-z]/),Tr=ds(/[\dA-Za-z]/),a$=ds(/[#-'*+\--9=?A-Z^-~]/);function J3(t){return t!==null&&(t<32||t===127)}const eF=ds(/\d/),r$=ds(/[\dA-Fa-f]/),n$=ds(/[!-/:-@[-`{-~]/);function ut(t){return t!==null&&t<-2}function Va(t){return t!==null&&(t<0||t===32)}function Pt(t){return t===-2||t===-1||t===32}const o$=ds(new RegExp("\\p{P}|\\p{S}","u")),s$=ds(/\s/);function ds(t){return e;function e(i){return i!==null&&i>-1&&t.test(String.fromCharCode(i))}}function zh(t,e){const i=E8(l$(t||""));if(!e)return i;const a=i.indexOf(":"),r=i.indexOf("?"),n=i.indexOf("#"),o=i.indexOf("/");return a<0||o>-1&&a>o||r>-1&&a>r||n>-1&&a>n||e.test(i.slice(0,a))?i:""}function l$(t){const e=[];let i=-1,a=0,r=0;for(;++i<t.length;){const n=t.charCodeAt(i);let o="";if(n===37&&Tr(t.charCodeAt(i+1))&&Tr(t.charCodeAt(i+2)))r=2;else if(n<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(n))||(o=String.fromCharCode(n));else if(n>55295&&n<57344){const s=t.charCodeAt(i+1);n<56320&&s>56319&&s<57344?(o=String.fromCharCode(n,s),r=1):o="�"}else o=String.fromCharCode(n);o&&(e.push(t.slice(a,i),encodeURIComponent(o)),a=i+r+1,o=""),r&&(i+=r,r=0)}return e.join("")+t.slice(a)}const B8={}.hasOwnProperty,S8=/^(https?|ircs?|mailto|xmpp)$/i,u$=/^https?$/i;function f$(t){const e=t||{};let i=!0;const a={},r=[[]],n=[],o=[],l=JN([{enter:{blockQuote:U,codeFenced:V,codeFencedFenceInfo:m,codeFencedFenceMeta:m,codeIndented:N,codeText:he,content:De,definition:Ae,definitionDestinationString:qe,definitionLabelString:m,definitionTitleString:m,emphasis:ir,htmlFlow:Ti,htmlText:xa,image:G,label:m,link:ee,listItemMarker:S,listItemValue:D,listOrdered:v,listUnordered:E,paragraph:Q,reference:m,resource:re,resourceDestinationString:O,resourceTitleString:m,setextHeading:Ze,strong:wt},exit:{atxHeading:_t,atxHeadingSequence:Ne,autolinkEmail:K,autolinkProtocol:Ki,blockQuote:q,characterEscapeValue:Gt,characterReferenceMarkerHexadecimal:Bt,characterReferenceMarkerNumeric:Bt,characterReferenceValue:Vi,codeFenced:B,codeFencedFence:L,codeFencedFenceInfo:x,codeFencedFenceMeta:C,codeFlowValue:st,codeIndented:B,codeText:Ce,codeTextData:Gt,data:Gt,definition:Oe,definitionDestinationString:_e,definitionLabelString:be,definitionTitleString:je,emphasis:We,hardBreakEscape:Qt,hardBreakTrailing:Qt,htmlFlow:ia,htmlFlowData:Gt,htmlText:ia,htmlTextData:Gt,image:de,label:X,labelText:W,lineEnding:Ee,link:de,listOrdered:H,listUnordered:T,paragraph:P,reference:C,referenceString:J,resource:C,resourceDestinationString:ne,resourceTitleString:z,setextHeading:Di,setextHeadingLineSequence:Et,setextHeadingText:nt,strong:gt,thematicBreak:oi}},...e.htmlExtensions||[]]),u={definitions:a,tightStack:o},f={buffer:m,encode:k,getData:c,lineEndingIfNeeded:y,options:e,raw:w,resume:A,setData:F,tag:p};let d=e.defaultLineEnding;return g;function g($){let ae=-1,ge=0;const ve=[];let Be=[],Xe=[];for(;++ae<$.length;)!d&&($[ae][1].type==="lineEnding"||$[ae][1].type==="lineEndingBlank")&&(d=$[ae][2].sliceSerialize($[ae][1])),($[ae][1].type==="listOrdered"||$[ae][1].type==="listUnordered")&&($[ae][0]==="enter"?ve.push(ae):_($.slice(ve.pop(),ae))),$[ae][1].type==="definition"&&($[ae][0]==="enter"?(Xe=Ga(Xe,$.slice(ge,ae)),ge=ae):(Be=Ga(Be,$.slice(ge,ae+1)),ge=ae+1));Be=Ga(Be,Xe),Be=Ga(Be,$.slice(ge)),ae=-1;const me=Be;for(l.enter.null&&l.enter.null.call(f);++ae<$.length;){const Ye=l[me[ae][0]],Ie=me[ae][1].type,et=Ye[Ie];B8.call(Ye,Ie)&&et&&et.call({sliceSerialize:me[ae][2].sliceSerialize,...f},me[ae][1])}return l.exit.null&&l.exit.null.call(f),r[0].join("")}function _($){const ae=$.length;let ge=0,ve=0,Be=!1,Xe;for(;++ge<ae;){const me=$[ge];if(me[1]._container)Xe=void 0,me[0]==="enter"?ve++:ve--;else switch(me[1].type){case"listItemPrefix":{me[0]==="exit"&&(Xe=!0);break}case"linePrefix":break;case"lineEndingBlank":{me[0]==="enter"&&!ve&&(Xe?Xe=void 0:Be=!0);break}default:Xe=void 0}}$[0][1]._loose=Be}function F($,ae){u[$]=ae}function c($){return u[$]}function m(){r.push([])}function A(){return r.pop().join("")}function p($){i&&(F("lastWasTag",!0),r[r.length-1].push($))}function w($){F("lastWasTag"),r[r.length-1].push($)}function b(){w(d||`
282
+ `)}}const Wa={kazooUrlStrategy:t=>t,pulseUrlStrategy:t=>t,llmCallUrlStrategy:()=>"/api/api-ai-assistant/v1/chat",pulseBearerTokenStrategy:()=>null,screenshotMainContentSelector:"#root",structuredResponseUrlStrategy:()=>"/api/api-ai-assistant/v1/structured-response",synthesizeUrlStrategy:()=>"/api/api-ai-assistant/v1/tts",transcribeUrlStrategy:()=>"/api/api-ai-assistant/v1/stt"};function m8(){return Wa.synthesizeUrlStrategy()}function A8(){return Wa.transcribeUrlStrategy()}function p8(){return Wa.llmCallUrlStrategy()}function b8(){return Wa.structuredResponseUrlStrategy()}function X3(t){return Wa.kazooUrlStrategy(t)}function hN(t){return Wa.pulseUrlStrategy(t)}function ll(){return Wa.pulseBearerTokenStrategy()}function y8(){return Wa.screenshotMainContentSelector}function _N(t){Wa.screenshotMainContentSelector=t}function cN(t){Wa.kazooUrlStrategy=t}function FN(t){Wa.llmCallUrlStrategy=t}function mN(t){Wa.pulseUrlStrategy=t}function AN(t){Wa.pulseBearerTokenStrategy=t}function pN(t){Wa.structuredResponseUrlStrategy=t}function bN(t){Wa.synthesizeUrlStrategy=t}function yN(t){Wa.transcribeUrlStrategy=t}const wN=Object.freeze(Object.defineProperty({__proto__:null,getKazooUrl:X3,getLlmCallUrl:p8,getPulseBearerToken:ll,getPulseUrl:hN,getScreenshotMainContentSelector:y8,getStructuredResponseUrl:b8,getSynthesizeUrl:m8,getTranscribeUrl:A8,setKazooUrlStrategy:cN,setLlmCallUrlStrategy:FN,setPulseBearerTokenStrategy:AN,setPulseUrlStrategy:mN,setScreenshotMainContentSelector:_N,setStructuredResponseUrlStrategy:pN,setSynthesizeUrlStrategy:bN,setTranscribeUrlStrategy:yN},Symbol.toStringTag,{value:"Module"}));async function Y3({model:t,temperature:e,stream:i,messages:a,tools:r,onChunk:n,onError:o,onComplete:s,systemInstruction:l}){var f;const u=ll();try{const d=await fetch(p8(),{method:"POST",body:JSON.stringify({model:t,temperature:e,stream:i,messages:a,tools:r,systemInstruction:l}),credentials:u?void 0:"include",headers:{"Content-Type":"application/json",Accept:i?"text/event-stream":"application/json",...u?{Authorization:`Bearer ${u}`}:{}}});if(!d||!d.ok)throw new Error("Unable to connect to LLM API. Please try again.");if(i){const _=(f=d.body)==null?void 0:f.getReader();if(!_)throw new Error("Unexpected client error. Response body reader not available.");const F=new TextDecoder,c=[],m=n||(p=>{c.push(p)}),A=1e4;for(;A>0;){const{done:p,value:w}=await _.read();if(p)break;const b=F.decode(w),y=gN.parse(b);for(const k of y)m(k)}return s==null||s(),c}return(await d.json()).parts}catch(d){const g=d instanceof Error?d:new Error("Unexpected error calling LLM API");throw o==null||o(g),g}}function kN(t){var i,a,r,n;const e=[];for(const o of t)o.role==="TOOL"?e.push({id:o.id,role:"user",parts:[{type:"toolCall",toolName:(i=o.metadata)==null?void 0:i.toolName,args:{args:(a=o.metadata)==null?void 0:a.toolArgs}}]},{id:o.id,role:"user",parts:[{type:"toolResult",result:o.messageText,toolName:(r=o.metadata)==null?void 0:r.toolName,args:{args:(n=o.metadata)==null?void 0:n.toolArgs}}]}):o.role==="USER"?e.push({id:o.id,role:"user",parts:[{type:"text",text:o.messageText}]}):o.role==="MODEL"&&e.push({id:o.id,role:"model",parts:[{type:"text",text:o.messageText}]});return e}async function w8({propRefs:t,conversationId:e}){var o;if(!t.current.getFollowUpSuggestions)return;const i=t.current.getConversationById(e);if(!i||!((o=i.messages)!=null&&o.length))return;const a=Date.now();k8.set(e,a),t.current.setFollowUpSuggestionsByConversationId(s=>({...s,[e]:[{type:"loading"}]}));const r=await t.current.getFollowUpSuggestions({conversation:i}).catch(s=>(console.log("Error getting follow up suggestions",s),[])),n=k8.get(e);n&&a!==n||t.current.setFollowUpSuggestionsByConversationId(s=>({...s,[e]:r.map(l=>({id:l.fullPrompt||l.title,title:l.title,onClick:()=>{!l.fullPrompt||l.fullPrompt===l.title?t.current.handleSendUserMessage({conversationId:e,messageText:l.title}):t.current.setPrompt(e,tt(l.fullPrompt,l.title))}}))}))}const k8=new Map;async function xN({toolCalls:t,propRefs:e,debugInfo:i,conversationId:a,appendMessageToConversation:r}){await sS(async n=>{var l,u,f;if(t.length===0||!e.current.isMounted)return n();const o=[];for(const d of t){const g=M1(),_=(l=e.current.tools)==null?void 0:l.find(A=>A.name===d.toolName);if(!_){(f=(u=e.current).onError)==null||f.call(u,new Error(`Tool ${d.toolName} not found`)),i.current.push({time:new Date,message:`Tool ${d.toolName} not found`,data:{toolCall:d,tools:e.current.tools},level:"error"});continue}let F=d.args;if(F!=null&&F.args)for(;F!=null&&F.args;)F=F.args;let c,m=new Promise(A=>A());try{m=new Promise(b=>{e.current.setMessages(y=>{const k={...y};return k[a]={...k[a]},k[a].messages=[...k[a].messages,{id:g,role:"TOOL",conversationId:a,messageText:d.toolName,metadata:{toolName:d.toolName,toolArgs:d.args,loading:!0}}],b(),k})}),i.current.push({time:new Date,level:"info",message:"Fulfilling tool call",data:{toolCall:d}});const A=Date.now(),p=await _.fulfill(F),w=Date.now();typeof p=="string"?(c=p,o.push({type:"toolResult",toolName:d.toolName,args:F,result:p}),i.current.push({time:new Date,level:"info",message:"Tool call fulfilled",data:{toolCall:d,durationMs:w-A,result:p}})):(o.push({type:"toolResult",toolName:d.toolName,result:`Tool ${d.toolName} returned the following file`,args:F}),o.push({type:"file",toolName:d.toolName,fileUri:p==null?void 0:p.fileUri,mimeType:p==null?void 0:p.mimeType,args:F}),i.current.push({time:new Date,level:"info",message:"Tool call fulfilled with file",data:{toolCall:d,durationMs:w-A,result:p}}))}catch(A){i.current.push({time:new Date,message:"Error calling tool",level:"error",data:{toolCall:d,error:{message:A.message,stack:A.stack}}}),o.push({type:"toolResult",toolName:d.toolName,result:{error:{message:A.message,stack:A.stack}},args:F})}finally{await m;const p={...tt(e.current.messages,{})};p[a].messages=p[a].messages.map(w=>w.id===g?{...w,messageText:tt(c,w.messageText),metadata:{...w.metadata,loading:!1}}:w),e.current.setMessages(p)}}if(!e.current.isMounted)return n();const s=o.map(d=>({id:M1(),role:"TOOL",conversationId:a,messageText:d.type==="toolResult"?d.result:"file",metadata:{toolName:d.toolName,toolArgs:d.args}}));await Promise.all(s.map(async d=>{await r({variables:{input:{conversationId:a,message:{id:d.id,role:"TOOL",messageText:d.messageText,metadata:d.metadata}}}})})),await e.current.sendMessages(a),n()})}function CN({setConnectionError:t,propRefs:e,debugInfo:i,appendMessageToConversation:a}){return async function r(n){var s,l,u,f,d;if(!e.current.isMounted)return!1;t(null),e.current.setMessages(g=>({...g,[n]:{...g[n],isLoading:!0}}));try{e.current.onBeforeLlmCall&&e.current.onBeforeLlmCall()}catch(g){i.current.push({time:new Date,message:"Error calling onBeforeLlmCall",data:g,level:"error"})}let o;try{e.current.systemInstruction&&(i.current.push({time:new Date,message:"Getting system instruction",level:"info"}),o=await e.current.systemInstruction(),i.current.push({time:new Date,message:"System instruction",data:o,level:"info"}))}catch(g){i.current.push({time:new Date,message:"Error getting system instruction",data:g,level:"error"}),(l=(s=e.current).onError)==null||l.call(s,g)}e.current.setFollowUpSuggestionsByConversationId(g=>({...g,[n]:[]}));try{const g={type:"text",text:""},_=[],F=M1();return await Y3({model:e.current.model,temperature:e.current.temperature,stream:!0,messages:kN(tt((u=e.current.getConversationById(n))==null?void 0:u.messages,[])),tools:e.current.tools,systemInstruction:o,onChunk:c=>{var m,A;c.type==="text"?g.text+=c.text:c.type==="toolCall"&&_.push(c),e.current.setMessages(p=>{const w=p[n];if(!w)return console.error(`Invariant violation: currentConversation is undefined for conversationId ${n}`,p),p;const b=tt(w.messages,[]),y=b[b.length-1];return(y==null?void 0:y.role)==="MODEL"?y.messageText=g.text:g.text&&b.push({id:F,role:"MODEL",conversationId:n,messageText:g.text}),w.messages=b,{...p,[n]:Bu(w)}}),(A=(m=e.current).onChunkAdded)==null||A.call(m)}}),g.text&&await a({variables:{input:{conversationId:n,message:{id:F,role:"MODEL",messageText:g.text}}}}),vN({condition:!!e.current.onAfterLlmCall,conversationId:n,callbackToInvoke:e.current.onAfterLlmCall,callbackName:"onAfterLlmCall",debugInfo:i,onError:e.current.onError,propRefs:e}),await xN({conversationId:n,toolCalls:_,propRefs:e,debugInfo:i,appendMessageToConversation:a}),await w8({propRefs:e,conversationId:n}),!0}catch(g){if(!e.current.isMounted)return!1;const _=Kl(bi(t,null),bi(r,n));return i.current.push({time:new Date,message:"Error calling LLM API",data:g,level:"error"}),t({message:h.jsx(dN,{retry:_}),retry:_}),(d=(f=e.current).onError)==null||d.call(f,g),!1}finally{e.current.setMessages(g=>({...g,[n]:{...g[n],isLoading:!1}}))}}}function vN({condition:t,conversationId:e,callbackToInvoke:i,callbackName:a,debugInfo:r,onError:n,propRefs:o}){if(!(!t||!i)){r.current.push({time:new Date,message:`Calling ${a}`,level:"info"});try{const s=o.current.messages;i(s[e].messages)}catch(s){r.current.push({time:new Date,message:`Error calling ${a}`,data:s,level:"error"}),n&&n(s)}finally{r.current.push({time:new Date,message:`Finished calling ${a}`,level:"info"})}}}async function x8(t,e){const i=ll(),a=await fetch(m8(),{method:"POST",body:JSON.stringify({text:t,voice:e}),credentials:i?void 0:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...i?{Authorization:`Bearer ${i}`}:{}}});if(!a||!a.ok)throw new Error("Unable to connect to LLM API. Please try again.");const r=await a.json();if(!r.synthesis)throw new Error("No synthesis data received.");return r.synthesis}async function DN(t){const e=ll(),i=await fetch(A8(),{method:"POST",body:JSON.stringify({audio:t}),credentials:e?void 0:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...e?{Authorization:`Bearer ${e}`}:{}}});if(!i||!i.ok)throw new Error("Unable to connect to LLM API. Please try again.");const a=await i.json();if(!a.transcription)throw new Error("No transcription data received.");return a.transcription}function EN({model:t,initialMessages:e,temperature:i,onAfterLlmCall:a,onBeforeLlmCall:r,onError:n,tools:o,onChunkAdded:s,systemInstruction:l,onSelectedConversationChange:u,onSelectedConversationLoaded:f,initialConversationId:d,getFollowUpSuggestions:g,getChatTitle:_,initialPrompt:F}){const[c,m]=M.useState(!1),[A,p]=M.useState(!1),[w,b]=M.useState("Aoede"),[y,k]=M.useState(null),[C,v]=M.useState(!1),[E,D]=M.useState(!1),[S,H]=M.useState(!1),[T,I]=M.useState(BN({initialConversationId:d})),[U,q]=M.useState(SN({initialMessages:e,selectedConversationId:T})),Q=M.useRef({onAfterLlmCall:a,onBeforeLlmCall:r,onError:n,tools:o,model:t,temperature:i,isMounted:!0,systemInstruction:l,onChunkAdded:s,getConversationById:Ei,setFollowUpSuggestionsByConversationId:Ei,getFollowUpSuggestions:g,handleSendUserMessage:Ei,setPrompt:Ei,selectedConversationId:T,onSelectedConversationLoaded:f,onSelectedConversationChange:u,messages:U,sendMessages:Ei,setMessages:Ei}),P=M.useCallback(fN({originalSetMessages:q,propRefs:Q}),[q]),[V,x]=M.useState(!1),[L,N]=M.useState(""),B=M.useRef(void 0);B.current=f;const[G,ee]=M.useState({}),[W,X]=M.useState(jN({initialPrompt:F,selectedConversationId:T})),J=M.useRef([]),[re]=WQ(),{refetch:O}=iN({fetchPolicy:"cache-and-network",onCompleted:LN({propRefs:Q})}),[ne]=sN();Q.current.getConversationById=nt=>Q.current.messages[nt],Q.current.setFollowUpSuggestionsByConversationId=ee,Q.current.setPrompt=IN({setPromptByConversationId:X,selectedConversationId:T}),Q.current.onAfterLlmCall=a,Q.current.onBeforeLlmCall=r,Q.current.onError=n,Q.current.tools=o,Q.current.model=t,Q.current.temperature=i,Q.current.systemInstruction=l,Q.current.onChunkAdded=s,Q.current.isMounted=!0,Q.current.onSelectedConversationChange=u,Q.current.selectedConversationId=T,Q.current.getFollowUpSuggestions=g,Q.current.setMessages=P;const{loading:z,data:de}=XQ({skip:T===void 0,variables:{input:{conversationId:tt(T,"")}},fetchPolicy:"cache-and-network",onCompleted:MN({selectedConversationId:T,propRefs:Q,setVoiceOutputPlaying:H}),onError:Ei});M.useEffect(()=>()=>{Q.current.isMounted=!1},[]),M.useEffect(PN({propRefs:Q,selectedConversationId:T,messages:U}),[T,de]);const Ae=M.useCallback(bi(I,void 0),[]),be=M.useCallback(TN({propRefs:Q,updateConversationTitle:ne}),[ne]),qe=M.useCallback(HN({setIsTranscribingSpeech:D}),[]),_e=M.useCallback(UN(),[]),je=M.useCallback(CN({propRefs:Q,debugInfo:J,setConnectionError:k,appendMessageToConversation:re}),[]);Q.current.sendMessages=je;const Oe=M.useCallback(qN({setSelectedConversationId:I,debugInfo:J,appendMessageToConversation:re,propRefs:Q}),[I,J,re,Q]),De=ON({selectedConversationId:T,setPromptByConversationId:X,getChatTitle:_,sendUserMessage:Oe,updateTitle:be});Q.current.handleSendUserMessage=De;const Ne=tt(G[tt(T,"")],[]),Ze=tt(W[tt(T,"")],"");return{messages:U,setMessages:P,isVoiceInputEnabled:c,setIsVoiceInputEnabled:m,isVoiceOutputEnabled:A,setIsVoiceOutputEnabled:p,voiceOutputVoice:w,setVoiceOutputVoice:b,getSpeech:_e,getTranscription:qe,debugInfo:J.current,sendUserMessage:Oe,connectionError:y,followUpSuggestions:Ne,voiceInputProcessing:C,setVoiceInputProcessing:v,voiceInputTranscribing:E,setVoiceInputTranscribing:D,voiceOutputPlaying:S,setVoiceOutputPlaying:H,promptByConversationId:W,prompt:Ze,setPromptByConversationId:X,setPrompt:Q.current.setPrompt,selectedConversationId:T,isSearching:V,searchQuery:L,setIsSearching:x,setSearchQuery:N,isLoadingConversation:z,selectedConversation:U[tt(T,"")],createNewConversation:Ae,setSelectedConversationId:I,updateTitle:be,refetchConversations:O,handleSendUserMessage:De}}function BN({initialConversationId:t}){if(t)return t}function SN({initialMessages:t,selectedConversationId:e=""}){return e?{[e]:{id:e,title:"",updatedAt:new Date,isLoading:!1,messages:tt(t,[])}}:{}}function jN({initialPrompt:t,selectedConversationId:e}){return e?{[e]:tt(t,"")}:{"":tt(t,"")}}function LN({propRefs:t}){return e=>{if(e!=null&&e.getConversations){const i=Date.now(),a=Bu(e.getConversations).map(r=>({id:r.id,title:r.title,updatedAt:new Date(tt(r.updatedAt,i))}));t.current.setMessages(r=>{const n=Bu(r);for(const o of a){const s=o.id,l=r[s],u=tt(a.find(f=>f.id===s),{});n[s]={...l,...u}}return n})}}}function MN({selectedConversationId:t,propRefs:e,setVoiceOutputPlaying:i}){return a=>{if(i(!1),!(a!=null&&a.aiAssistantConversation))return;const r=Bu(a.aiAssistantConversation.messages);e.current.setMessages(n=>{if(!t)return n;const o=n[t];if(!o)return console.error(`Invariant violation: conversation is undefined for conversationId ${t}`,n),n;o.messages=tt(o.messages,[]);let s;for(const l of r){const u=o.messages.findIndex(d=>d.id===l.id),f=o.messages[u];typeof f<"u"?f.messageText=l.messageText:o.messages.splice(o.messages.findIndex(d=>d.id===s)+1,0,l),s=l.id}return{...n,[t]:Bu(o)}}),setTimeout(()=>{var n,o;(o=(n=e.current).onSelectedConversationLoaded)==null||o.call(n,t,e.current.selectedConversationId,e.current.messages)},10)}}function ON({selectedConversationId:t,sendUserMessage:e,setPromptByConversationId:i,getChatTitle:a,updateTitle:r}){return async({conversationId:n=t,messageText:o})=>{if(!o)return;const s=n===void 0;try{const{id:l}=await e({message:o});if(i(u=>({...u,[l]:""})),s){const u=await a(o);u&&u!=="New Chat"&&await r(l,u)}}catch(l){console.error(l)}}}function qN({propRefs:t,setSelectedConversationId:e,debugInfo:i,appendMessageToConversation:a}){return async({message:r,skipAppendingUserMessageToConversation:n=!1})=>{const o=!t.current.selectedConversationId,s=t.current.selectedConversationId||M1();t.current.selectedConversationId=s;const l=t.current.getConversationById(s),u={id:M1(),role:"USER",messageText:r,conversationId:s},f=Bu(l||{id:s,title:"New Chat",updatedAt:new Date,isLoading:!0,messages:[]}),d={...f,messages:[...tt(l==null?void 0:l.messages,[]),u],isLoading:!0};t.current.setMessages(c=>({...c,[s]:d})),o&&(e(s),t.current.selectedConversationId=s);const g=[];!n&&g.push(a({variables:{input:{conversationId:s,message:{id:u.id,role:"USER",messageText:r}}}}));const _=t.current.sendMessages(s);return g.push(_),await Promise.all(g),!!await _||i.current.push({time:new Date,message:"Error sending message",data:{oldStateInCaseOfFailure:f},level:"error"}),{id:s}}}function TN({propRefs:t,updateConversationTitle:e}){return async(i,a)=>{t.current.setMessages(r=>({...r,[i]:{...r[i],title:a,isUpdatingTitle:!0}})),await e({variables:{input:{conversationId:i,title:a}}}),t.current.setMessages(r=>({...r,[i]:{...r[i],isUpdatingTitle:!1}}))}}function IN({setPromptByConversationId:t,selectedConversationId:e}){return(i=tt(e,""),a)=>{t(typeof a=="function"?r=>({...r,[i]:a(r[i])}):r=>({...r,[i]:a}))}}function PN({propRefs:t,selectedConversationId:e,messages:i}){return()=>{var r,n;if((n=(r=t.current)==null?void 0:r.onSelectedConversationChange)==null||n.call(r,e,i),!e)return;const a=setTimeout(()=>{w8({propRefs:t,conversationId:e})},500);return()=>clearTimeout(a)}}function HN({setIsTranscribingSpeech:t}){return async e=>{t(!0);const i=await DN(e);return t(!1),i}}function UN(){return async t=>await x8(t)}const pa={"ai-assistant-textarea":"AiAssistantComponent-module_ai-assistant-textarea_dJrtB","ai-assistant-popup-container":"AiAssistantComponent-module_ai-assistant-popup-container_OH04M","ai-assistant-chat-history-container":"AiAssistantComponent-module_ai-assistant-chat-history-container_mIJ3y","ai-assistant-chat-history-header":"AiAssistantComponent-module_ai-assistant-chat-history-header_aR6OI","ai-assistant-chat-history-button":"AiAssistantComponent-module_ai-assistant-chat-history-button_Q34D6","conversation-selected":"AiAssistantComponent-module_conversation-selected_-ijIe","ai-assistant-chat-history-button-text":"AiAssistantComponent-module_ai-assistant-chat-history-button-text_cAi5Q","textarea-container":"AiAssistantComponent-module_textarea-container_4eE9f","placeholder-content":"AiAssistantComponent-module_placeholder-content_8vmjp","placeholder-text":"AiAssistantComponent-module_placeholder-text_8edUF","loading-container":"AiAssistantComponent-module_loading-container_7BNjW","messages-scroll-container":"AiAssistantComponent-module_messages-scroll-container_8O6Kb","ai-assistant-send-btn":"AiAssistantComponent-module_ai-assistant-send-btn_h2wdX","ai-assistant-search-input-container":"AiAssistantComponent-module_ai-assistant-search-input-container_lUZKm","voice-input-processing":"AiAssistantComponent-module_voice-input-processing_2zY1J","voice-input-transcribing":"AiAssistantComponent-module_voice-input-transcribing_k6mLe"};function RN({messages:t,selectedConversationId:e,onConversationSelect:i,loading:a=!1}){const{recentConversations:r,olderConversations:n}=M.useMemo(()=>{const o=Object.values(t),s=new Date().getTime()-7*24*60*60*1e3,l=o.filter(f=>f.updatedAt.getTime()>s),u=o.filter(f=>f.updatedAt.getTime()<=s);return{recentConversations:l,olderConversations:u}},[t]);return a?h.jsx(Wn,{centered:!0,size:"small"}):h.jsxs(ot,{direction:"column",gap:"24px",testId:"chat-history",children:[h.jsx(ot,{direction:"column",gap:"8px",children:h.jsx(C8,{conversations:r,selectedConversationId:e,onConversationSelect:i,title:"Past 7 days"})}),h.jsx(C8,{conversations:n,selectedConversationId:e,onConversationSelect:i,title:"Past 30 days"})]})}function C8({conversations:t,selectedConversationId:e,onConversationSelect:i,title:a,loadMoreThreshold:r=10}){const[n,o]=M.useState(!1),s=Object.values(t),l=!n&&s.length>r,u=n?s.length:r,f=s.slice(0,u);return f.length===0?null:h.jsxs(ot,{direction:"column",gap:"8px",children:[h.jsx("span",{className:pa["ai-assistant-chat-history-header"],children:a}),f.map(d=>h.jsx(Yi,{variant:"transparent",size:"small",className:pe(pa["ai-assistant-chat-history-button"],e===d.id&&pa["conversation-selected"]),onClick:()=>i(d.id),children:d.isLoading?h.jsxs("span",{className:pe(pa["ai-assistant-chat-history-button-text"]),children:[h.jsx("div",{style:{display:"inline-block"},children:h.jsx(Wn,{size:"extraSmall"})}),"  ",d.title]}):h.jsx("span",{className:pa["ai-assistant-chat-history-button-text"],children:d.title})},d.id)),l&&h.jsx(Yi,{icon:"arrow_down",iconAlignment:"right",variant:"system",size:"small",onClick:()=>o(!0),"data-testid":"chat-history-load-more",children:"Load More"})]})}function QN(t){return t?"arrow_up":"arrow_down"}function NN(t){return t.level==="error"?"warning_no_outline":"info"}function $N(t){return t.level==="warn"?"yellow":"gray"}function zN(t){return t.level==="error"?"red":"transparent"}function WN({debugInfo:t}){const[,e]=M.useState(0),i=M.useCallback(()=>e(l=>l+1),[]),a=M.useRef([]),r=M.useCallback(l=>{a.current.push(l),i()},[]),n=M.useCallback(l=>{a.current=a.current.filter(u=>u!==l),i()},[]),o=M.useCallback(l=>{a.current.includes(l)?n(l):r(l)},[r,n]),s=M.useCallback(l=>a.current.includes(l),[]);return h.jsx(ot,{direction:"column",gap:"8px","test-id":"debug-data",children:t.map((l,u)=>h.jsx(Yl,{style:{borderTop:`1px solid ${zN(l)}`},children:h.jsxs(ot,{direction:"column",gap:"8px",children:[h.jsxs(ot,{gap:"12px",alignItems:"center",justifyContent:"space-between",children:[h.jsx("div",{children:h.jsx(Nt,{icon:NN(l),color:$N(l)})}),h.jsxs(T1,{grow:1,children:[h.jsx("div",{children:l.message}),l.time?h.jsx(U1,{size:"extraSmall",children:l.time.toLocaleString()}):null]}),h.jsx("div",{children:h.jsx(Yi,{variant:"primary_inverted",size:"small",icon:QN(s(u)),onClick:bi(o,u),children:s(u)?"Collapse":"Expand"})})]}),s(u)&&h.jsx("textarea",{value:JSON.stringify(l,null,2),readOnly:!0,"data-testid":"debug-textarea",style:{minWidth:"100%",height:"100%",minHeight:"200px",maxWidth:"100%"}})]})},u))})}const GN={"follow-up-suggestion-pill":"FollowUpSuggestions-module_follow-up-suggestion-pill_mkFc2"};function VN({followUpSuggestions:t}){return!t||t.length===0?null:h.jsx(ot,{gap:"5px",alignItems:"center",justifyContent:"flex-start",wrap:"wrap",style:{marginBottom:"10px"},children:t.map(e=>h.jsx(KN,{suggestion:e},`${e==null?void 0:e.id}-${e.type}`))})}function KN({suggestion:t}){const e=`follow-up-suggestion-pill-${t.id}`;if(t.type==="loading")return h.jsx(Wn,{size:"extraSmall"});const i=()=>{t.onClick()};return h.jsx(Wg,{onClick:i,size:"small",variant:"gray",text:t.title,className:GN["follow-up-suggestion-pill"],"data-testid":e},t.id)}const v8=document.createElement("i");function D8(t){const e="&"+t+";";v8.innerHTML=e;const i=v8.textContent;return i.charCodeAt(i.length-1)===59&&t!=="semi"||i===e?!1:i}function io(t,e,i,a){const r=t.length;let n=0,o;if(e<0?e=-e>r?0:r+e:e=e>r?r:e,i=i>0?i:0,a.length<1e4)o=Array.from(a),o.unshift(e,i),t.splice(...o);else for(i&&t.splice(e,i);n<a.length;)o=a.slice(n,n+1e4),o.unshift(e,0),t.splice(...o),n+=1e4,e+=1e4}function Ga(t,e){return t.length>0?(io(t,t.length,0,e),t):e}const Z3={}.hasOwnProperty;function XN(t){const e={};let i=-1;for(;++i<t.length;)YN(e,t[i]);return e}function YN(t,e){let i;for(i in e){const r=(Z3.call(t,i)?t[i]:void 0)||(t[i]={}),n=e[i];let o;if(n)for(o in n){Z3.call(r,o)||(r[o]=[]);const s=n[o];ZN(r[o],Array.isArray(s)?s:s?[s]:[])}}}function ZN(t,e){let i=-1;const a=[];for(;++i<e.length;)(e[i].add==="after"?t:a).push(e[i]);io(t,0,0,a)}function JN(t){const e={};let i=-1;for(;++i<t.length;)e$(e,t[i]);return e}function e$(t,e){let i;for(i in e){const r=(Z3.call(t,i)?t[i]:void 0)||(t[i]={}),n=e[i];let o;if(n)for(o in n)r[o]=n[o]}}function t$(t,e){const i=Number.parseInt(t,e);return i<9||i===11||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}const i$={'"':"quot","&":"amp","<":"lt",">":"gt"};function E8(t){return t.replace(/["&<>]/g,e);function e(i){return"&"+i$[i]+";"}}function Ef(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ao=ds(/[A-Za-z]/),Tr=ds(/[\dA-Za-z]/),a$=ds(/[#-'*+\--9=?A-Z^-~]/);function J3(t){return t!==null&&(t<32||t===127)}const eF=ds(/\d/),r$=ds(/[\dA-Fa-f]/),n$=ds(/[!-/:-@[-`{-~]/);function ut(t){return t!==null&&t<-2}function Va(t){return t!==null&&(t<0||t===32)}function Pt(t){return t===-2||t===-1||t===32}const o$=ds(new RegExp("\\p{P}|\\p{S}","u")),s$=ds(/\s/);function ds(t){return e;function e(i){return i!==null&&i>-1&&t.test(String.fromCharCode(i))}}function zh(t,e){const i=E8(l$(t||""));if(!e)return i;const a=i.indexOf(":"),r=i.indexOf("?"),n=i.indexOf("#"),o=i.indexOf("/");return a<0||o>-1&&a>o||r>-1&&a>r||n>-1&&a>n||e.test(i.slice(0,a))?i:""}function l$(t){const e=[];let i=-1,a=0,r=0;for(;++i<t.length;){const n=t.charCodeAt(i);let o="";if(n===37&&Tr(t.charCodeAt(i+1))&&Tr(t.charCodeAt(i+2)))r=2;else if(n<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(n))||(o=String.fromCharCode(n));else if(n>55295&&n<57344){const s=t.charCodeAt(i+1);n<56320&&s>56319&&s<57344?(o=String.fromCharCode(n,s),r=1):o="�"}else o=String.fromCharCode(n);o&&(e.push(t.slice(a,i),encodeURIComponent(o)),a=i+r+1,o=""),r&&(i+=r,r=0)}return e.join("")+t.slice(a)}const B8={}.hasOwnProperty,S8=/^(https?|ircs?|mailto|xmpp)$/i,u$=/^https?$/i;function f$(t){const e=t||{};let i=!0;const a={},r=[[]],n=[],o=[],l=JN([{enter:{blockQuote:U,codeFenced:V,codeFencedFenceInfo:m,codeFencedFenceMeta:m,codeIndented:N,codeText:he,content:De,definition:Ae,definitionDestinationString:qe,definitionLabelString:m,definitionTitleString:m,emphasis:ir,htmlFlow:Ti,htmlText:xa,image:G,label:m,link:ee,listItemMarker:S,listItemValue:D,listOrdered:v,listUnordered:E,paragraph:Q,reference:m,resource:re,resourceDestinationString:O,resourceTitleString:m,setextHeading:Ze,strong:wt},exit:{atxHeading:_t,atxHeadingSequence:Ne,autolinkEmail:K,autolinkProtocol:Ki,blockQuote:q,characterEscapeValue:Gt,characterReferenceMarkerHexadecimal:Bt,characterReferenceMarkerNumeric:Bt,characterReferenceValue:Vi,codeFenced:B,codeFencedFence:L,codeFencedFenceInfo:x,codeFencedFenceMeta:C,codeFlowValue:st,codeIndented:B,codeText:Ce,codeTextData:Gt,data:Gt,definition:Oe,definitionDestinationString:_e,definitionLabelString:be,definitionTitleString:je,emphasis:We,hardBreakEscape:Qt,hardBreakTrailing:Qt,htmlFlow:ia,htmlFlowData:Gt,htmlText:ia,htmlTextData:Gt,image:de,label:X,labelText:W,lineEnding:Ee,link:de,listOrdered:H,listUnordered:T,paragraph:P,reference:C,referenceString:J,resource:C,resourceDestinationString:ne,resourceTitleString:z,setextHeading:Di,setextHeadingLineSequence:Et,setextHeadingText:nt,strong:gt,thematicBreak:oi}},...e.htmlExtensions||[]]),u={definitions:a,tightStack:o},f={buffer:m,encode:k,getData:c,lineEndingIfNeeded:y,options:e,raw:w,resume:A,setData:F,tag:p};let d=e.defaultLineEnding;return g;function g($){let ae=-1,ge=0;const ve=[];let Be=[],Xe=[];for(;++ae<$.length;)!d&&($[ae][1].type==="lineEnding"||$[ae][1].type==="lineEndingBlank")&&(d=$[ae][2].sliceSerialize($[ae][1])),($[ae][1].type==="listOrdered"||$[ae][1].type==="listUnordered")&&($[ae][0]==="enter"?ve.push(ae):_($.slice(ve.pop(),ae))),$[ae][1].type==="definition"&&($[ae][0]==="enter"?(Xe=Ga(Xe,$.slice(ge,ae)),ge=ae):(Be=Ga(Be,$.slice(ge,ae+1)),ge=ae+1));Be=Ga(Be,Xe),Be=Ga(Be,$.slice(ge)),ae=-1;const me=Be;for(l.enter.null&&l.enter.null.call(f);++ae<$.length;){const Ye=l[me[ae][0]],Ie=me[ae][1].type,et=Ye[Ie];B8.call(Ye,Ie)&&et&&et.call({sliceSerialize:me[ae][2].sliceSerialize,...f},me[ae][1])}return l.exit.null&&l.exit.null.call(f),r[0].join("")}function _($){const ae=$.length;let ge=0,ve=0,Be=!1,Xe;for(;++ge<ae;){const me=$[ge];if(me[1]._container)Xe=void 0,me[0]==="enter"?ve++:ve--;else switch(me[1].type){case"listItemPrefix":{me[0]==="exit"&&(Xe=!0);break}case"linePrefix":break;case"lineEndingBlank":{me[0]==="enter"&&!ve&&(Xe?Xe=void 0:Be=!0);break}default:Xe=void 0}}$[0][1]._loose=Be}function F($,ae){u[$]=ae}function c($){return u[$]}function m(){r.push([])}function A(){return r.pop().join("")}function p($){i&&(F("lastWasTag",!0),r[r.length-1].push($))}function w($){F("lastWasTag"),r[r.length-1].push($)}function b(){w(d||`
283
283
  `)}function y(){const $=r[r.length-1],ae=$[$.length-1],ge=ae?ae.charCodeAt(ae.length-1):null;ge===10||ge===13||ge===null||b()}function k($){return c("ignoreEncode")?$:E8($)}function C(){A()}function v($){o.push(!$._loose),y(),p("<ol"),F("expectFirstItem",!0)}function E($){o.push(!$._loose),y(),p("<ul"),F("expectFirstItem",!0)}function D($){if(c("expectFirstItem")){const ae=Number.parseInt(this.sliceSerialize($),10);ae!==1&&p(' start="'+k(String(ae))+'"')}}function S(){c("expectFirstItem")?p(">"):I(),y(),p("<li>"),F("expectFirstItem"),F("lastWasTag")}function H(){I(),o.pop(),b(),p("</ol>")}function T(){I(),o.pop(),b(),p("</ul>")}function I(){c("lastWasTag")&&!c("slurpAllLineEndings")&&y(),p("</li>"),F("slurpAllLineEndings")}function U(){o.push(!1),y(),p("<blockquote>")}function q(){o.pop(),y(),p("</blockquote>"),F("slurpAllLineEndings")}function Q(){o[o.length-1]||(y(),p("<p>")),F("slurpAllLineEndings")}function P(){o[o.length-1]?F("slurpAllLineEndings",!0):p("</p>")}function V(){y(),p("<pre><code"),F("fencesCount",0)}function x(){const $=A();p(' class="language-'+$+'"')}function L(){const $=c("fencesCount")||0;$||(p(">"),F("slurpOneLineEnding",!0)),F("fencesCount",$+1)}function N(){y(),p("<pre><code>")}function B(){const $=c("fencesCount");$!==void 0&&$<2&&u.tightStack.length>0&&!c("lastWasTag")&&b(),c("flowCodeSeenData")&&y(),p("</code></pre>"),$!==void 0&&$<2&&y(),F("flowCodeSeenData"),F("fencesCount"),F("slurpOneLineEnding")}function G(){n.push({image:!0}),i=void 0}function ee(){n.push({})}function W($){n[n.length-1].labelId=this.sliceSerialize($)}function X(){n[n.length-1].label=A()}function J($){n[n.length-1].referenceId=this.sliceSerialize($)}function re(){m(),n[n.length-1].destination=""}function O(){m(),F("ignoreEncode",!0)}function ne(){n[n.length-1].destination=A(),F("ignoreEncode")}function z(){n[n.length-1].title=A()}function de(){let $=n.length-1;const ae=n[$],ge=ae.referenceId||ae.labelId,ve=ae.destination===void 0?a[Ef(ge)]:ae;for(i=!0;$--;)if(n[$].image){i=void 0;break}ae.image?(p('<img src="'+zh(ve.destination,e.allowDangerousProtocol?void 0:u$)+'" alt="'),w(ae.label),p('"')):p('<a href="'+zh(ve.destination,e.allowDangerousProtocol?void 0:S8)+'"'),p(ve.title?' title="'+ve.title+'"':""),ae.image?p(" />"):(p(">"),w(ae.label),p("</a>")),n.pop()}function Ae(){m(),n.push({})}function be($){A(),n[n.length-1].labelId=this.sliceSerialize($)}function qe(){m(),F("ignoreEncode",!0)}function _e(){n[n.length-1].destination=A(),F("ignoreEncode")}function je(){n[n.length-1].title=A()}function Oe(){const $=n[n.length-1],ae=Ef($.labelId);A(),B8.call(a,ae)||(a[ae]=n[n.length-1]),n.pop()}function De(){F("slurpAllLineEndings",!0)}function Ne($){c("headingRank")||(F("headingRank",this.sliceSerialize($).length),y(),p("<h"+c("headingRank")+">"))}function Ze(){m(),F("slurpAllLineEndings")}function nt(){F("slurpAllLineEndings",!0)}function _t(){p("</h"+c("headingRank")+">"),F("headingRank")}function Et($){F("headingRank",this.sliceSerialize($).charCodeAt(0)===61?1:2)}function Di(){const $=A();y(),p("<h"+c("headingRank")+">"),w($),p("</h"+c("headingRank")+">"),F("slurpAllLineEndings"),F("headingRank")}function Gt($){w(k(this.sliceSerialize($)))}function Ee($){if(!c("slurpAllLineEndings")){if(c("slurpOneLineEnding")){F("slurpOneLineEnding");return}if(c("inCodeText")){w(" ");return}w(k(this.sliceSerialize($)))}}function st($){w(k(this.sliceSerialize($))),F("flowCodeSeenData",!0)}function Qt(){p("<br />")}function Ti(){y(),xa()}function ia(){F("ignoreEncode")}function xa(){e.allowDangerousHtml&&F("ignoreEncode",!0)}function ir(){p("<em>")}function wt(){p("<strong>")}function he(){F("inCodeText",!0),p("<code>")}function Ce(){F("inCodeText"),p("</code>")}function We(){p("</em>")}function gt(){p("</strong>")}function oi(){y(),p("<hr />")}function Bt($){F("characterReferenceType",$.type)}function Vi($){const ae=this.sliceSerialize($),ge=c("characterReferenceType")?t$(ae,c("characterReferenceType")==="characterReferenceMarkerNumeric"?10:16):D8(ae);w(k(ge)),F("characterReferenceType")}function Ki($){const ae=this.sliceSerialize($);p('<a href="'+zh(ae,e.allowDangerousProtocol?void 0:S8)+'">'),w(k(ae)),p("</a>")}function K($){const ae=this.sliceSerialize($);p('<a href="'+zh("mailto:"+ae)+'">'),w(k(ae)),p("</a>")}}function Jt(t,e,i,a){const r=a?a-1:Number.POSITIVE_INFINITY;let n=0;return o;function o(l){return Pt(l)?(t.enter(i),s(l)):e(l)}function s(l){return Pt(l)&&n++<r?(t.consume(l),s):(t.exit(i),e(l))}}const d$={tokenize:g$};function g$(t){const e=t.attempt(this.parser.constructs.contentInitial,a,r);let i;return e;function a(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),Jt(t,e,"linePrefix")}function r(s){return t.enter("paragraph"),n(s)}function n(s){const l=t.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=l),i=l,o(s)}function o(s){if(s===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(s);return}return ut(s)?(t.consume(s),t.exit("chunkText"),n):(t.consume(s),o)}}const h$={tokenize:_$},j8={tokenize:c$};function _$(t){const e=this,i=[];let a=0,r,n,o;return s;function s(w){if(a<i.length){const b=i[a];return e.containerState=b[1],t.attempt(b[0].continuation,l,u)(w)}return u(w)}function l(w){if(a++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,r&&p();const b=e.events.length;let y=b,k;for(;y--;)if(e.events[y][0]==="exit"&&e.events[y][1].type==="chunkFlow"){k=e.events[y][1].end;break}A(a);let C=b;for(;C<e.events.length;)e.events[C][1].end={...k},C++;return io(e.events,y+1,0,e.events.slice(b)),e.events.length=C,u(w)}return s(w)}function u(w){if(a===i.length){if(!r)return g(w);if(r.currentConstruct&&r.currentConstruct.concrete)return F(w);e.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(j8,f,d)(w)}function f(w){return r&&p(),A(a),g(w)}function d(w){return e.parser.lazy[e.now().line]=a!==i.length,o=e.now().offset,F(w)}function g(w){return e.containerState={},t.attempt(j8,_,F)(w)}function _(w){return a++,i.push([e.currentConstruct,e.containerState]),g(w)}function F(w){if(w===null){r&&p(),A(0),t.consume(w);return}return r=r||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:n}),c(w)}function c(w){if(w===null){m(t.exit("chunkFlow"),!0),A(0),t.consume(w);return}return ut(w)?(t.consume(w),m(t.exit("chunkFlow")),a=0,e.interrupt=void 0,s):(t.consume(w),c)}function m(w,b){const y=e.sliceStream(w);if(b&&y.push(null),w.previous=n,n&&(n.next=w),n=w,r.defineSkip(w.start),r.write(y),e.parser.lazy[w.start.line]){let k=r.events.length;for(;k--;)if(r.events[k][1].start.offset<o&&(!r.events[k][1].end||r.events[k][1].end.offset>o))return;const C=e.events.length;let v=C,E,D;for(;v--;)if(e.events[v][0]==="exit"&&e.events[v][1].type==="chunkFlow"){if(E){D=e.events[v][1].end;break}E=!0}for(A(a),k=C;k<e.events.length;)e.events[k][1].end={...D},k++;io(e.events,v+1,0,e.events.slice(C)),e.events.length=k}}function A(w){let b=i.length;for(;b-- >w;){const y=i[b];e.containerState=y[1],y[0].exit.call(e,t)}i.length=w}function p(){r.write([null]),n=void 0,r=void 0,e.containerState._closeFlow=void 0}}function c$(t,e,i){return Jt(t,t.attempt(this.parser.constructs.document,e,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function L8(t){if(t===null||Va(t)||s$(t))return 1;if(o$(t))return 2}function tF(t,e,i){const a=[];let r=-1;for(;++r<t.length;){const n=t[r].resolveAll;n&&!a.includes(n)&&(e=n(e,i),a.push(n))}return e}const iF={name:"attention",resolveAll:F$,tokenize:m$};function F$(t,e){let i=-1,a,r,n,o,s,l,u,f;for(;++i<t.length;)if(t[i][0]==="enter"&&t[i][1].type==="attentionSequence"&&t[i][1]._close){for(a=i;a--;)if(t[a][0]==="exit"&&t[a][1].type==="attentionSequence"&&t[a][1]._open&&e.sliceSerialize(t[a][1]).charCodeAt(0)===e.sliceSerialize(t[i][1]).charCodeAt(0)){if((t[a][1]._close||t[i][1]._open)&&(t[i][1].end.offset-t[i][1].start.offset)%3&&!((t[a][1].end.offset-t[a][1].start.offset+t[i][1].end.offset-t[i][1].start.offset)%3))continue;l=t[a][1].end.offset-t[a][1].start.offset>1&&t[i][1].end.offset-t[i][1].start.offset>1?2:1;const d={...t[a][1].end},g={...t[i][1].start};M8(d,-l),M8(g,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...t[a][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...t[i][1].start},end:g},n={type:l>1?"strongText":"emphasisText",start:{...t[a][1].end},end:{...t[i][1].start}},r={type:l>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},t[a][1].end={...o.start},t[i][1].start={...s.end},u=[],t[a][1].end.offset-t[a][1].start.offset&&(u=Ga(u,[["enter",t[a][1],e],["exit",t[a][1],e]])),u=Ga(u,[["enter",r,e],["enter",o,e],["exit",o,e],["enter",n,e]]),u=Ga(u,tF(e.parser.constructs.insideSpan.null,t.slice(a+1,i),e)),u=Ga(u,[["exit",n,e],["enter",s,e],["exit",s,e],["exit",r,e]]),t[i][1].end.offset-t[i][1].start.offset?(f=2,u=Ga(u,[["enter",t[i][1],e],["exit",t[i][1],e]])):f=0,io(t,a-1,i-a+3,u),i=a+u.length-f-2;break}}for(i=-1;++i<t.length;)t[i][1].type==="attentionSequence"&&(t[i][1].type="data");return t}function m$(t,e){const i=this.parser.constructs.attentionMarkers.null,a=this.previous,r=L8(a);let n;return o;function o(l){return n=l,t.enter("attentionSequence"),s(l)}function s(l){if(l===n)return t.consume(l),s;const u=t.exit("attentionSequence"),f=L8(l),d=!f||f===2&&r||i.includes(l),g=!r||r===2&&f||i.includes(a);return u._open=!!(n===42?d:d&&(r||!g)),u._close=!!(n===42?g:g&&(f||!d)),e(l)}}function M8(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const A$={name:"autolink",tokenize:p$};function p$(t,e,i){let a=0;return r;function r(_){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(_),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),n}function n(_){return ao(_)?(t.consume(_),o):_===64?i(_):u(_)}function o(_){return _===43||_===45||_===46||Tr(_)?(a=1,s(_)):u(_)}function s(_){return _===58?(t.consume(_),a=0,l):(_===43||_===45||_===46||Tr(_))&&a++<32?(t.consume(_),s):(a=0,u(_))}function l(_){return _===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(_),t.exit("autolinkMarker"),t.exit("autolink"),e):_===null||_===32||_===60||J3(_)?i(_):(t.consume(_),l)}function u(_){return _===64?(t.consume(_),f):a$(_)?(t.consume(_),u):i(_)}function f(_){return Tr(_)?d(_):i(_)}function d(_){return _===46?(t.consume(_),a=0,f):_===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(_),t.exit("autolinkMarker"),t.exit("autolink"),e):g(_)}function g(_){if((_===45||Tr(_))&&a++<63){const F=_===45?g:d;return t.consume(_),F}return i(_)}}const Wh={partial:!0,tokenize:b$};function b$(t,e,i){return a;function a(n){return Pt(n)?Jt(t,r,"linePrefix")(n):r(n)}function r(n){return n===null||ut(n)?e(n):i(n)}}const O8={continuation:{tokenize:w$},exit:k$,name:"blockQuote",tokenize:y$};function y$(t,e,i){const a=this;return r;function r(o){if(o===62){const s=a.containerState;return s.open||(t.enter("blockQuote",{_container:!0}),s.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),n}return i(o)}function n(o){return Pt(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function w$(t,e,i){const a=this;return r;function r(o){return Pt(o)?Jt(t,n,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):n(o)}function n(o){return t.attempt(O8,e,i)(o)}}function k$(t){t.exit("blockQuote")}const q8={name:"characterEscape",tokenize:x$};function x$(t,e,i){return a;function a(n){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(n),t.exit("escapeMarker"),r}function r(n){return n$(n)?(t.enter("characterEscapeValue"),t.consume(n),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):i(n)}}const T8={name:"characterReference",tokenize:C$};function C$(t,e,i){const a=this;let r=0,n,o;return s;function s(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),u):(t.enter("characterReferenceValue"),n=31,o=Tr,f(d))}function u(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),n=6,o=r$,f):(t.enter("characterReferenceValue"),n=7,o=eF,f(d))}function f(d){if(d===59&&r){const g=t.exit("characterReferenceValue");return o===Tr&&!D8(a.sliceSerialize(g))?i(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(d)&&r++<n?(t.consume(d),f):i(d)}}const I8={partial:!0,tokenize:D$},P8={concrete:!0,name:"codeFenced",tokenize:v$};function v$(t,e,i){const a=this,r={partial:!0,tokenize:y};let n=0,o=0,s;return l;function l(k){return u(k)}function u(k){const C=a.events[a.events.length-1];return n=C&&C[1].type==="linePrefix"?C[2].sliceSerialize(C[1],!0).length:0,s=k,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),f(k)}function f(k){return k===s?(o++,t.consume(k),f):o<3?i(k):(t.exit("codeFencedFenceSequence"),Pt(k)?Jt(t,d,"whitespace")(k):d(k))}function d(k){return k===null||ut(k)?(t.exit("codeFencedFence"),a.interrupt?e(k):t.check(I8,c,b)(k)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===null||ut(k)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(k)):Pt(k)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Jt(t,_,"whitespace")(k)):k===96&&k===s?i(k):(t.consume(k),g)}function _(k){return k===null||ut(k)?d(k):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),F(k))}function F(k){return k===null||ut(k)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(k)):k===96&&k===s?i(k):(t.consume(k),F)}function c(k){return t.attempt(r,b,m)(k)}function m(k){return t.enter("lineEnding"),t.consume(k),t.exit("lineEnding"),A}function A(k){return n>0&&Pt(k)?Jt(t,p,"linePrefix",n+1)(k):p(k)}function p(k){return k===null||ut(k)?t.check(I8,c,b)(k):(t.enter("codeFlowValue"),w(k))}function w(k){return k===null||ut(k)?(t.exit("codeFlowValue"),p(k)):(t.consume(k),w)}function b(k){return t.exit("codeFenced"),e(k)}function y(k,C,v){let E=0;return D;function D(U){return k.enter("lineEnding"),k.consume(U),k.exit("lineEnding"),S}function S(U){return k.enter("codeFencedFence"),Pt(U)?Jt(k,H,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):H(U)}function H(U){return U===s?(k.enter("codeFencedFenceSequence"),T(U)):v(U)}function T(U){return U===s?(E++,k.consume(U),T):E>=o?(k.exit("codeFencedFenceSequence"),Pt(U)?Jt(k,I,"whitespace")(U):I(U)):v(U)}function I(U){return U===null||ut(U)?(k.exit("codeFencedFence"),C(U)):v(U)}}}function D$(t,e,i){const a=this;return r;function r(o){return o===null?i(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),n)}function n(o){return a.parser.lazy[a.now().line]?i(o):e(o)}}const aF={name:"codeIndented",tokenize:B$},E$={partial:!0,tokenize:S$};function B$(t,e,i){const a=this;return r;function r(u){return t.enter("codeIndented"),Jt(t,n,"linePrefix",5)(u)}function n(u){const f=a.events[a.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?o(u):i(u)}function o(u){return u===null?l(u):ut(u)?t.attempt(E$,o,l)(u):(t.enter("codeFlowValue"),s(u))}function s(u){return u===null||ut(u)?(t.exit("codeFlowValue"),o(u)):(t.consume(u),s)}function l(u){return t.exit("codeIndented"),e(u)}}function S$(t,e,i){const a=this;return r;function r(o){return a.parser.lazy[a.now().line]?i(o):ut(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),r):Jt(t,n,"linePrefix",5)(o)}function n(o){const s=a.events[a.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(o):ut(o)?r(o):i(o)}}const j$={name:"codeText",previous:M$,resolve:L$,tokenize:O$};function L$(t){let e=t.length-4,i=3,a,r;if((t[i][1].type==="lineEnding"||t[i][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(a=i;++a<e;)if(t[a][1].type==="codeTextData"){t[i][1].type="codeTextPadding",t[e][1].type="codeTextPadding",i+=2,e-=2;break}}for(a=i-1,e++;++a<=e;)r===void 0?a!==e&&t[a][1].type!=="lineEnding"&&(r=a):(a===e||t[a][1].type==="lineEnding")&&(t[r][1].type="codeTextData",a!==r+2&&(t[r][1].end=t[a-1][1].end,t.splice(r+2,a-r-2),e-=a-r-2,a=r+2),r=void 0);return t}function M$(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function O$(t,e,i){let a=0,r,n;return o;function o(d){return t.enter("codeText"),t.enter("codeTextSequence"),s(d)}function s(d){return d===96?(t.consume(d),a++,s):(t.exit("codeTextSequence"),l(d))}function l(d){return d===null?i(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),l):d===96?(n=t.enter("codeTextSequence"),r=0,f(d)):ut(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),l):(t.enter("codeTextData"),u(d))}function u(d){return d===null||d===32||d===96||ut(d)?(t.exit("codeTextData"),l(d)):(t.consume(d),u)}function f(d){return d===96?(t.consume(d),r++,f):r===a?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(n.type="codeTextData",u(d))}}class q${constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new 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,i){const a=i??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(e,a):e>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(e,i,a){const r=i||0;this.setCursor(Math.trunc(e));const n=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return a&&Bf(this.left,a),n.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Bf(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Bf(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const i=this.left.splice(e,Number.POSITIVE_INFINITY);Bf(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Bf(this.left,i.reverse())}}}function Bf(t,e){let i=0;if(e.length<1e4)t.push(...e);else for(;i<e.length;)t.push(...e.slice(i,i+1e4)),i+=1e4}function H8(t){const e={};let i=-1,a,r,n,o,s,l,u;const f=new q$(t);for(;++i<f.length;){for(;i in e;)i=e[i];if(a=f.get(i),i&&a[1].type==="chunkFlow"&&f.get(i-1)[1].type==="listItemPrefix"&&(l=a[1]._tokenizer.events,n=0,n<l.length&&l[n][1].type==="lineEndingBlank"&&(n+=2),n<l.length&&l[n][1].type==="content"))for(;++n<l.length&&l[n][1].type!=="content";)l[n][1].type==="chunkText"&&(l[n][1]._isInFirstContentOfListItem=!0,n++);if(a[0]==="enter")a[1].contentType&&(Object.assign(e,T$(f,i)),i=e[i],u=!0);else if(a[1]._container){for(n=i,r=void 0;n--;)if(o=f.get(n),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(r&&(f.get(r)[1].type="lineEndingBlank"),o[1].type="lineEnding",r=n);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;r&&(a[1].end={...f.get(r)[1].start},s=f.slice(r,i),s.unshift(a),f.splice(r,i-r+1,s))}}return io(t,0,Number.POSITIVE_INFINITY,f.slice(0)),!u}function T$(t,e){const i=t.get(e)[1],a=t.get(e)[2];let r=e-1;const n=[];let o=i._tokenizer;o||(o=a.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const s=o.events,l=[],u={};let f,d,g=-1,_=i,F=0,c=0;const m=[c];for(;_;){for(;t.get(++r)[1]!==_;);n.push(r),_._tokenizer||(f=a.sliceStream(_),_.next||f.push(null),d&&o.defineSkip(_.start),_._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(f),_._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=_,_=_.next}for(_=i;++g<s.length;)s[g][0]==="exit"&&s[g-1][0]==="enter"&&s[g][1].type===s[g-1][1].type&&s[g][1].start.line!==s[g][1].end.line&&(c=g+1,m.push(c),_._tokenizer=void 0,_.previous=void 0,_=_.next);for(o.events=[],_?(_._tokenizer=void 0,_.previous=void 0):m.pop(),g=m.length;g--;){const A=s.slice(m[g],m[g+1]),p=n.pop();l.push([p,p+A.length-1]),t.splice(p,2,A)}for(l.reverse(),g=-1;++g<l.length;)u[F+l[g][0]]=F+l[g][1],F+=l[g][1]-l[g][0]-1;return u}const I$={resolve:H$,tokenize:U$},P$={partial:!0,tokenize:R$};function H$(t){return H8(t),t}function U$(t,e){let i;return a;function a(s){return t.enter("content"),i=t.enter("chunkContent",{contentType:"content"}),r(s)}function r(s){return s===null?n(s):ut(s)?t.check(P$,o,n)(s):(t.consume(s),r)}function n(s){return t.exit("chunkContent"),t.exit("content"),e(s)}function o(s){return t.consume(s),t.exit("chunkContent"),i.next=t.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,r}}function R$(t,e,i){const a=this;return r;function r(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Jt(t,n,"linePrefix")}function n(o){if(o===null||ut(o))return i(o);const s=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(o):t.interrupt(a.parser.constructs.flow,i,e)(o)}}function U8(t,e,i,a,r,n,o,s,l){const u=l||Number.POSITIVE_INFINITY;let f=0;return d;function d(A){return A===60?(t.enter(a),t.enter(r),t.enter(n),t.consume(A),t.exit(n),g):A===null||A===32||A===41||J3(A)?i(A):(t.enter(a),t.enter(o),t.enter(s),t.enter("chunkString",{contentType:"string"}),c(A))}function g(A){return A===62?(t.enter(n),t.consume(A),t.exit(n),t.exit(r),t.exit(a),e):(t.enter(s),t.enter("chunkString",{contentType:"string"}),_(A))}function _(A){return A===62?(t.exit("chunkString"),t.exit(s),g(A)):A===null||A===60||ut(A)?i(A):(t.consume(A),A===92?F:_)}function F(A){return A===60||A===62||A===92?(t.consume(A),_):_(A)}function c(A){return!f&&(A===null||A===41||Va(A))?(t.exit("chunkString"),t.exit(s),t.exit(o),t.exit(a),e(A)):f<u&&A===40?(t.consume(A),f++,c):A===41?(t.consume(A),f--,c):A===null||A===32||A===40||J3(A)?i(A):(t.consume(A),A===92?m:c)}function m(A){return A===40||A===41||A===92?(t.consume(A),c):c(A)}}function R8(t,e,i,a,r,n){const o=this;let s=0,l;return u;function u(_){return t.enter(a),t.enter(r),t.consume(_),t.exit(r),t.enter(n),f}function f(_){return s>999||_===null||_===91||_===93&&!l||_===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?i(_):_===93?(t.exit(n),t.enter(r),t.consume(_),t.exit(r),t.exit(a),e):ut(_)?(t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),f):(t.enter("chunkString",{contentType:"string"}),d(_))}function d(_){return _===null||_===91||_===93||ut(_)||s++>999?(t.exit("chunkString"),f(_)):(t.consume(_),l||(l=!Pt(_)),_===92?g:d)}function g(_){return _===91||_===92||_===93?(t.consume(_),s++,d):d(_)}}function Q8(t,e,i,a,r,n){let o;return s;function s(g){return g===34||g===39||g===40?(t.enter(a),t.enter(r),t.consume(g),t.exit(r),o=g===40?41:g,l):i(g)}function l(g){return g===o?(t.enter(r),t.consume(g),t.exit(r),t.exit(a),e):(t.enter(n),u(g))}function u(g){return g===o?(t.exit(n),l(o)):g===null?i(g):ut(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),Jt(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),f(g))}function f(g){return g===o||g===null||ut(g)?(t.exit("chunkString"),u(g)):(t.consume(g),g===92?d:f)}function d(g){return g===o||g===92?(t.consume(g),f):f(g)}}function Sf(t,e){let i;return a;function a(r){return ut(r)?(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),i=!0,a):Pt(r)?Jt(t,a,i?"linePrefix":"lineSuffix")(r):e(r)}}const Q$={name:"definition",tokenize:$$},N$={partial:!0,tokenize:z$};function $$(t,e,i){const a=this;let r;return n;function n(_){return t.enter("definition"),o(_)}function o(_){return R8.call(a,t,s,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(_)}function s(_){return r=Ef(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),_===58?(t.enter("definitionMarker"),t.consume(_),t.exit("definitionMarker"),l):i(_)}function l(_){return Va(_)?Sf(t,u)(_):u(_)}function u(_){return U8(t,f,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(_)}function f(_){return t.attempt(N$,d,d)(_)}function d(_){return Pt(_)?Jt(t,g,"whitespace")(_):g(_)}function g(_){return _===null||ut(_)?(t.exit("definition"),a.parser.defined.push(r),e(_)):i(_)}}function z$(t,e,i){return a;function a(s){return Va(s)?Sf(t,r)(s):i(s)}function r(s){return Q8(t,n,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function n(s){return Pt(s)?Jt(t,o,"whitespace")(s):o(s)}function o(s){return s===null||ut(s)?e(s):i(s)}}const W$={name:"hardBreakEscape",tokenize:G$};function G$(t,e,i){return a;function a(n){return t.enter("hardBreakEscape"),t.consume(n),r}function r(n){return ut(n)?(t.exit("hardBreakEscape"),e(n)):i(n)}}const V$={name:"headingAtx",resolve:K$,tokenize:X$};function K$(t,e){let i=t.length-2,a=3,r,n;return t[a][1].type==="whitespace"&&(a+=2),i-2>a&&t[i][1].type==="whitespace"&&(i-=2),t[i][1].type==="atxHeadingSequence"&&(a===i-1||i-4>a&&t[i-2][1].type==="whitespace")&&(i-=a+1===i?2:4),i>a&&(r={type:"atxHeadingText",start:t[a][1].start,end:t[i][1].end},n={type:"chunkText",start:t[a][1].start,end:t[i][1].end,contentType:"text"},io(t,a,i-a+1,[["enter",r,e],["enter",n,e],["exit",n,e],["exit",r,e]])),t}function X$(t,e,i){let a=0;return r;function r(f){return t.enter("atxHeading"),n(f)}function n(f){return t.enter("atxHeadingSequence"),o(f)}function o(f){return f===35&&a++<6?(t.consume(f),o):f===null||Va(f)?(t.exit("atxHeadingSequence"),s(f)):i(f)}function s(f){return f===35?(t.enter("atxHeadingSequence"),l(f)):f===null||ut(f)?(t.exit("atxHeading"),e(f)):Pt(f)?Jt(t,s,"whitespace")(f):(t.enter("atxHeadingText"),u(f))}function l(f){return f===35?(t.consume(f),l):(t.exit("atxHeadingSequence"),s(f))}function u(f){return f===null||f===35||Va(f)?(t.exit("atxHeadingText"),s(f)):(t.consume(f),u)}}const Y$=["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"],N8=["pre","script","style","textarea"],Z$={concrete:!0,name:"htmlFlow",resolveTo:tz,tokenize:iz},J$={partial:!0,tokenize:rz},ez={partial:!0,tokenize:az};function tz(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function iz(t,e,i){const a=this;let r,n,o,s,l;return u;function u(B){return f(B)}function f(B){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(B),d}function d(B){return B===33?(t.consume(B),g):B===47?(t.consume(B),n=!0,c):B===63?(t.consume(B),r=3,a.interrupt?e:x):ao(B)?(t.consume(B),o=String.fromCharCode(B),m):i(B)}function g(B){return B===45?(t.consume(B),r=2,_):B===91?(t.consume(B),r=5,s=0,F):ao(B)?(t.consume(B),r=4,a.interrupt?e:x):i(B)}function _(B){return B===45?(t.consume(B),a.interrupt?e:x):i(B)}function F(B){const G="CDATA[";return B===G.charCodeAt(s++)?(t.consume(B),s===G.length?a.interrupt?e:H:F):i(B)}function c(B){return ao(B)?(t.consume(B),o=String.fromCharCode(B),m):i(B)}function m(B){if(B===null||B===47||B===62||Va(B)){const G=B===47,ee=o.toLowerCase();return!G&&!n&&N8.includes(ee)?(r=1,a.interrupt?e(B):H(B)):Y$.includes(o.toLowerCase())?(r=6,G?(t.consume(B),A):a.interrupt?e(B):H(B)):(r=7,a.interrupt&&!a.parser.lazy[a.now().line]?i(B):n?p(B):w(B))}return B===45||Tr(B)?(t.consume(B),o+=String.fromCharCode(B),m):i(B)}function A(B){return B===62?(t.consume(B),a.interrupt?e:H):i(B)}function p(B){return Pt(B)?(t.consume(B),p):D(B)}function w(B){return B===47?(t.consume(B),D):B===58||B===95||ao(B)?(t.consume(B),b):Pt(B)?(t.consume(B),w):D(B)}function b(B){return B===45||B===46||B===58||B===95||Tr(B)?(t.consume(B),b):y(B)}function y(B){return B===61?(t.consume(B),k):Pt(B)?(t.consume(B),y):w(B)}function k(B){return B===null||B===60||B===61||B===62||B===96?i(B):B===34||B===39?(t.consume(B),l=B,C):Pt(B)?(t.consume(B),k):v(B)}function C(B){return B===l?(t.consume(B),l=null,E):B===null||ut(B)?i(B):(t.consume(B),C)}function v(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||Va(B)?y(B):(t.consume(B),v)}function E(B){return B===47||B===62||Pt(B)?w(B):i(B)}function D(B){return B===62?(t.consume(B),S):i(B)}function S(B){return B===null||ut(B)?H(B):Pt(B)?(t.consume(B),S):i(B)}function H(B){return B===45&&r===2?(t.consume(B),q):B===60&&r===1?(t.consume(B),Q):B===62&&r===4?(t.consume(B),L):B===63&&r===3?(t.consume(B),x):B===93&&r===5?(t.consume(B),V):ut(B)&&(r===6||r===7)?(t.exit("htmlFlowData"),t.check(J$,N,T)(B)):B===null||ut(B)?(t.exit("htmlFlowData"),T(B)):(t.consume(B),H)}function T(B){return t.check(ez,I,N)(B)}function I(B){return t.enter("lineEnding"),t.consume(B),t.exit("lineEnding"),U}function U(B){return B===null||ut(B)?T(B):(t.enter("htmlFlowData"),H(B))}function q(B){return B===45?(t.consume(B),x):H(B)}function Q(B){return B===47?(t.consume(B),o="",P):H(B)}function P(B){if(B===62){const G=o.toLowerCase();return N8.includes(G)?(t.consume(B),L):H(B)}return ao(B)&&o.length<8?(t.consume(B),o+=String.fromCharCode(B),P):H(B)}function V(B){return B===93?(t.consume(B),x):H(B)}function x(B){return B===62?(t.consume(B),L):B===45&&r===2?(t.consume(B),x):H(B)}function L(B){return B===null||ut(B)?(t.exit("htmlFlowData"),N(B)):(t.consume(B),L)}function N(B){return t.exit("htmlFlow"),e(B)}}function az(t,e,i){const a=this;return r;function r(o){return ut(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),n):i(o)}function n(o){return a.parser.lazy[a.now().line]?i(o):e(o)}}function rz(t,e,i){return a;function a(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),t.attempt(Wh,e,i)}}const nz={name:"htmlText",tokenize:oz};function oz(t,e,i){const a=this;let r,n,o;return s;function s(x){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(x),l}function l(x){return x===33?(t.consume(x),u):x===47?(t.consume(x),y):x===63?(t.consume(x),w):ao(x)?(t.consume(x),v):i(x)}function u(x){return x===45?(t.consume(x),f):x===91?(t.consume(x),n=0,F):ao(x)?(t.consume(x),p):i(x)}function f(x){return x===45?(t.consume(x),_):i(x)}function d(x){return x===null?i(x):x===45?(t.consume(x),g):ut(x)?(o=d,Q(x)):(t.consume(x),d)}function g(x){return x===45?(t.consume(x),_):d(x)}function _(x){return x===62?q(x):x===45?g(x):d(x)}function F(x){const L="CDATA[";return x===L.charCodeAt(n++)?(t.consume(x),n===L.length?c:F):i(x)}function c(x){return x===null?i(x):x===93?(t.consume(x),m):ut(x)?(o=c,Q(x)):(t.consume(x),c)}function m(x){return x===93?(t.consume(x),A):c(x)}function A(x){return x===62?q(x):x===93?(t.consume(x),A):c(x)}function p(x){return x===null||x===62?q(x):ut(x)?(o=p,Q(x)):(t.consume(x),p)}function w(x){return x===null?i(x):x===63?(t.consume(x),b):ut(x)?(o=w,Q(x)):(t.consume(x),w)}function b(x){return x===62?q(x):w(x)}function y(x){return ao(x)?(t.consume(x),k):i(x)}function k(x){return x===45||Tr(x)?(t.consume(x),k):C(x)}function C(x){return ut(x)?(o=C,Q(x)):Pt(x)?(t.consume(x),C):q(x)}function v(x){return x===45||Tr(x)?(t.consume(x),v):x===47||x===62||Va(x)?E(x):i(x)}function E(x){return x===47?(t.consume(x),q):x===58||x===95||ao(x)?(t.consume(x),D):ut(x)?(o=E,Q(x)):Pt(x)?(t.consume(x),E):q(x)}function D(x){return x===45||x===46||x===58||x===95||Tr(x)?(t.consume(x),D):S(x)}function S(x){return x===61?(t.consume(x),H):ut(x)?(o=S,Q(x)):Pt(x)?(t.consume(x),S):E(x)}function H(x){return x===null||x===60||x===61||x===62||x===96?i(x):x===34||x===39?(t.consume(x),r=x,T):ut(x)?(o=H,Q(x)):Pt(x)?(t.consume(x),H):(t.consume(x),I)}function T(x){return x===r?(t.consume(x),r=void 0,U):x===null?i(x):ut(x)?(o=T,Q(x)):(t.consume(x),T)}function I(x){return x===null||x===34||x===39||x===60||x===61||x===96?i(x):x===47||x===62||Va(x)?E(x):(t.consume(x),I)}function U(x){return x===47||x===62||Va(x)?E(x):i(x)}function q(x){return x===62?(t.consume(x),t.exit("htmlTextData"),t.exit("htmlText"),e):i(x)}function Q(x){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),P}function P(x){return Pt(x)?Jt(t,V,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(x):V(x)}function V(x){return t.enter("htmlTextData"),o(x)}}const rF={name:"labelEnd",resolveAll:fz,resolveTo:dz,tokenize:gz},sz={tokenize:hz},lz={tokenize:_z},uz={tokenize:cz};function fz(t){let e=-1;const i=[];for(;++e<t.length;){const a=t[e][1];if(i.push(t[e]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const r=a.type==="labelImage"?4:2;a.type="data",e+=r}}return t.length!==i.length&&io(t,0,t.length,i),t}function dz(t,e){let i=t.length,a=0,r,n,o,s;for(;i--;)if(r=t[i][1],n){if(r.type==="link"||r.type==="labelLink"&&r._inactive)break;t[i][0]==="enter"&&r.type==="labelLink"&&(r._inactive=!0)}else if(o){if(t[i][0]==="enter"&&(r.type==="labelImage"||r.type==="labelLink")&&!r._balanced&&(n=i,r.type!=="labelLink")){a=2;break}}else r.type==="labelEnd"&&(o=i);const l={type:t[n][1].type==="labelLink"?"link":"image",start:{...t[n][1].start},end:{...t[t.length-1][1].end}},u={type:"label",start:{...t[n][1].start},end:{...t[o][1].end}},f={type:"labelText",start:{...t[n+a+2][1].end},end:{...t[o-2][1].start}};return s=[["enter",l,e],["enter",u,e]],s=Ga(s,t.slice(n+1,n+a+3)),s=Ga(s,[["enter",f,e]]),s=Ga(s,tF(e.parser.constructs.insideSpan.null,t.slice(n+a+4,o-3),e)),s=Ga(s,[["exit",f,e],t[o-2],t[o-1],["exit",u,e]]),s=Ga(s,t.slice(o+1)),s=Ga(s,[["exit",l,e]]),io(t,n,t.length,s),t}function gz(t,e,i){const a=this;let r=a.events.length,n,o;for(;r--;)if((a.events[r][1].type==="labelImage"||a.events[r][1].type==="labelLink")&&!a.events[r][1]._balanced){n=a.events[r][1];break}return s;function s(g){return n?n._inactive?d(g):(o=a.parser.defined.includes(Ef(a.sliceSerialize({start:n.end,end:a.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(g),t.exit("labelMarker"),t.exit("labelEnd"),l):i(g)}function l(g){return g===40?t.attempt(sz,f,o?f:d)(g):g===91?t.attempt(lz,f,o?u:d)(g):o?f(g):d(g)}function u(g){return t.attempt(uz,f,d)(g)}function f(g){return e(g)}function d(g){return n._balanced=!0,i(g)}}function hz(t,e,i){return a;function a(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),r}function r(d){return Va(d)?Sf(t,n)(d):n(d)}function n(d){return d===41?f(d):U8(t,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return Va(d)?Sf(t,l)(d):f(d)}function s(d){return i(d)}function l(d){return d===34||d===39||d===40?Q8(t,u,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):f(d)}function u(d){return Va(d)?Sf(t,f)(d):f(d)}function f(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):i(d)}}function _z(t,e,i){const a=this;return r;function r(s){return R8.call(a,t,n,o,"reference","referenceMarker","referenceString")(s)}function n(s){return a.parser.defined.includes(Ef(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?e(s):i(s)}function o(s){return i(s)}}function cz(t,e,i){return a;function a(n){return t.enter("reference"),t.enter("referenceMarker"),t.consume(n),t.exit("referenceMarker"),r}function r(n){return n===93?(t.enter("referenceMarker"),t.consume(n),t.exit("referenceMarker"),t.exit("reference"),e):i(n)}}const Fz={name:"labelStartImage",resolveAll:rF.resolveAll,tokenize:mz};function mz(t,e,i){const a=this;return r;function r(s){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(s),t.exit("labelImageMarker"),n}function n(s){return s===91?(t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelImage"),o):i(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in a.parser.constructs?i(s):e(s)}}const Az={name:"labelStartLink",resolveAll:rF.resolveAll,tokenize:pz};function pz(t,e,i){const a=this;return r;function r(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),n}function n(o){return o===94&&"_hiddenFootnoteSupport"in a.parser.constructs?i(o):e(o)}}const nF={name:"lineEnding",tokenize:bz};function bz(t,e){return i;function i(a){return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Jt(t,e,"linePrefix")}}const Gh={name:"thematicBreak",tokenize:yz};function yz(t,e,i){let a=0,r;return n;function n(u){return t.enter("thematicBreak"),o(u)}function o(u){return r=u,s(u)}function s(u){return u===r?(t.enter("thematicBreakSequence"),l(u)):a>=3&&(u===null||ut(u))?(t.exit("thematicBreak"),e(u)):i(u)}function l(u){return u===r?(t.consume(u),a++,l):(t.exit("thematicBreakSequence"),Pt(u)?Jt(t,s,"whitespace")(u):s(u))}}const cr={continuation:{tokenize:Cz},exit:Dz,name:"list",tokenize:xz},wz={partial:!0,tokenize:Ez},kz={partial:!0,tokenize:vz};function xz(t,e,i){const a=this,r=a.events[a.events.length-1];let n=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,o=0;return s;function s(_){const F=a.containerState.type||(_===42||_===43||_===45?"listUnordered":"listOrdered");if(F==="listUnordered"?!a.containerState.marker||_===a.containerState.marker:eF(_)){if(a.containerState.type||(a.containerState.type=F,t.enter(F,{_container:!0})),F==="listUnordered")return t.enter("listItemPrefix"),_===42||_===45?t.check(Gh,i,u)(_):u(_);if(!a.interrupt||_===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(_)}return i(_)}function l(_){return eF(_)&&++o<10?(t.consume(_),l):(!a.interrupt||o<2)&&(a.containerState.marker?_===a.containerState.marker:_===41||_===46)?(t.exit("listItemValue"),u(_)):i(_)}function u(_){return t.enter("listItemMarker"),t.consume(_),t.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||_,t.check(Wh,a.interrupt?i:f,t.attempt(wz,g,d))}function f(_){return a.containerState.initialBlankLine=!0,n++,g(_)}function d(_){return Pt(_)?(t.enter("listItemPrefixWhitespace"),t.consume(_),t.exit("listItemPrefixWhitespace"),g):i(_)}function g(_){return a.containerState.size=n+a.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(_)}}function Cz(t,e,i){const a=this;return a.containerState._closeFlow=void 0,t.check(Wh,r,n);function r(s){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,Jt(t,e,"listItemIndent",a.containerState.size+1)(s)}function n(s){return a.containerState.furtherBlankLines||!Pt(s)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,o(s)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,t.attempt(kz,e,o)(s))}function o(s){return a.containerState._closeFlow=!0,a.interrupt=void 0,Jt(t,t.attempt(cr,e,i),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function vz(t,e,i){const a=this;return Jt(t,r,"listItemIndent",a.containerState.size+1);function r(n){const o=a.events[a.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===a.containerState.size?e(n):i(n)}}function Dz(t){t.exit(this.containerState.type)}function Ez(t,e,i){const a=this;return Jt(t,r,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(n){const o=a.events[a.events.length-1];return!Pt(n)&&o&&o[1].type==="listItemPrefixWhitespace"?e(n):i(n)}}const $8={name:"setextUnderline",resolveTo:Bz,tokenize:Sz};function Bz(t,e){let i=t.length,a,r,n;for(;i--;)if(t[i][0]==="enter"){if(t[i][1].type==="content"){a=i;break}t[i][1].type==="paragraph"&&(r=i)}else t[i][1].type==="content"&&t.splice(i,1),!n&&t[i][1].type==="definition"&&(n=i);const o={type:"setextHeading",start:{...t[a][1].start},end:{...t[t.length-1][1].end}};return t[r][1].type="setextHeadingText",n?(t.splice(r,0,["enter",o,e]),t.splice(n+1,0,["exit",t[a][1],e]),t[a][1].end={...t[n][1].end}):t[a][1]=o,t.push(["exit",o,e]),t}function Sz(t,e,i){const a=this;let r;return n;function n(u){let f=a.events.length,d;for(;f--;)if(a.events[f][1].type!=="lineEnding"&&a.events[f][1].type!=="linePrefix"&&a.events[f][1].type!=="content"){d=a.events[f][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||d)?(t.enter("setextHeadingLine"),r=u,o(u)):i(u)}function o(u){return t.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===r?(t.consume(u),s):(t.exit("setextHeadingLineSequence"),Pt(u)?Jt(t,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ut(u)?(t.exit("setextHeadingLine"),e(u)):i(u)}}const jz={tokenize:Lz};function Lz(t){const e=this,i=t.attempt(Wh,a,t.attempt(this.parser.constructs.flowInitial,r,Jt(t,t.attempt(this.parser.constructs.flow,r,t.attempt(I$,r)),"linePrefix")));return i;function a(n){if(n===null){t.consume(n);return}return t.enter("lineEndingBlank"),t.consume(n),t.exit("lineEndingBlank"),e.currentConstruct=void 0,i}function r(n){if(n===null){t.consume(n);return}return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),e.currentConstruct=void 0,i}}const Mz={resolveAll:W8()},Oz=z8("string"),qz=z8("text");function z8(t){return{resolveAll:W8(t==="text"?Tz:void 0),tokenize:e};function e(i){const a=this,r=this.parser.constructs[t],n=i.attempt(r,o,s);return o;function o(f){return u(f)?n(f):s(f)}function s(f){if(f===null){i.consume(f);return}return i.enter("data"),i.consume(f),l}function l(f){return u(f)?(i.exit("data"),n(f)):(i.consume(f),l)}function u(f){if(f===null)return!0;const d=r[f];let g=-1;if(d)for(;++g<d.length;){const _=d[g];if(!_.previous||_.previous.call(a,a.previous))return!0}return!1}}}function W8(t){return e;function e(i,a){let r=-1,n;for(;++r<=i.length;)n===void 0?i[r]&&i[r][1].type==="data"&&(n=r,r++):(!i[r]||i[r][1].type!=="data")&&(r!==n+2&&(i[n][1].end=i[r-1][1].end,i.splice(n+2,r-n-2),r=n+2),n=void 0);return t?t(i,a):i}}function Tz(t,e){let i=0;for(;++i<=t.length;)if((i===t.length||t[i][1].type==="lineEnding")&&t[i-1][1].type==="data"){const a=t[i-1][1],r=e.sliceStream(a);let n=r.length,o=-1,s=0,l;for(;n--;){const u=r[n];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(u===-2)l=!0,s++;else if(u!==-1){n++;break}}if(e._contentTypeTextTrailing&&i===t.length&&(s=0),s){const u={type:i===t.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:n?o:a.start._bufferIndex+o,_index:a.start._index+n,line:a.end.line,column:a.end.column-s,offset:a.end.offset-s},end:{...a.end}};a.end={...u.start},a.start.offset===a.end.offset?Object.assign(a,u):(t.splice(i,0,["enter",u,e],["exit",u,e]),i+=2)}i++}return t}const Iz=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:{91:Q$},disable:{null:[]},document:{42:cr,43:cr,45:cr,48:cr,49:cr,50:cr,51:cr,52:cr,53:cr,54:cr,55:cr,56:cr,57:cr,62:O8},flow:{35:V$,42:Gh,45:[$8,Gh],60:Z$,61:$8,95:Gh,96:P8,126:P8},flowInitial:{[-2]:aF,[-1]:aF,32:aF},insideSpan:{null:[iF,Mz]},string:{38:T8,92:q8},text:{[-5]:nF,[-4]:nF,[-3]:nF,33:Fz,38:T8,42:iF,60:[A$,nz],91:Az,92:[W$,q8],93:rF,95:iF,96:j$}},Symbol.toStringTag,{value:"Module"}));function Pz(t,e,i){let a={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const r={},n=[];let o=[],s=[];const l={attempt:C(y),check:C(k),consume:p,enter:w,exit:b,interrupt:C(k,{interrupt:!0})},u={code:null,containerState:{},defineSkip:c,events:[],now:F,parser:t,previous:null,sliceSerialize:g,sliceStream:_,write:d};let f=e.tokenize.call(u,l);return e.resolveAll&&n.push(e),u;function d(S){return o=Ga(o,S),m(),o[o.length-1]!==null?[]:(v(e,0),u.events=tF(n,u.events,u),u.events)}function g(S,H){return Uz(_(S),H)}function _(S){return Hz(o,S)}function F(){const{_bufferIndex:S,_index:H,line:T,column:I,offset:U}=a;return{_bufferIndex:S,_index:H,line:T,column:I,offset:U}}function c(S){r[S.line]=S.column,D()}function m(){let S;for(;a._index<o.length;){const H=o[a._index];if(typeof H=="string")for(S=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===S&&a._bufferIndex<H.length;)A(H.charCodeAt(a._bufferIndex));else A(H)}}function A(S){f=f(S)}function p(S){ut(S)?(a.line++,a.column=1,a.offset+=S===-3?2:1,D()):S!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===o[a._index].length&&(a._bufferIndex=-1,a._index++)),u.previous=S}function w(S,H){const T=H||{};return T.type=S,T.start=F(),u.events.push(["enter",T,u]),s.push(T),T}function b(S){const H=s.pop();return H.end=F(),u.events.push(["exit",H,u]),H}function y(S,H){v(S,H.from)}function k(S,H){H.restore()}function C(S,H){return T;function T(I,U,q){let Q,P,V,x;return Array.isArray(I)?N(I):"tokenize"in I?N([I]):L(I);function L(W){return X;function X(J){const re=J!==null&&W[J],O=J!==null&&W.null,ne=[...Array.isArray(re)?re:re?[re]:[],...Array.isArray(O)?O:O?[O]:[]];return N(ne)(J)}}function N(W){return Q=W,P=0,W.length===0?q:B(W[P])}function B(W){return X;function X(J){return x=E(),V=W,W.partial||(u.currentConstruct=W),W.name&&u.parser.constructs.disable.null.includes(W.name)?ee():W.tokenize.call(H?Object.assign(Object.create(u),H):u,l,G,ee)(J)}}function G(W){return S(V,x),U}function ee(W){return x.restore(),++P<Q.length?B(Q[P]):q}}}function v(S,H){S.resolveAll&&!n.includes(S)&&n.push(S),S.resolve&&io(u.events,H,u.events.length-H,S.resolve(u.events.slice(H),u)),S.resolveTo&&(u.events=S.resolveTo(u.events,u))}function E(){const S=F(),H=u.previous,T=u.currentConstruct,I=u.events.length,U=Array.from(s);return{from:I,restore:q};function q(){a=S,u.previous=H,u.currentConstruct=T,u.events.length=I,s=U,D()}}function D(){a.line in r&&a.column<2&&(a.column=r[a.line],a.offset+=r[a.line]-1)}}function Hz(t,e){const i=e.start._index,a=e.start._bufferIndex,r=e.end._index,n=e.end._bufferIndex;let o;if(i===r)o=[t[i].slice(a,n)];else{if(o=t.slice(i,r),a>-1){const s=o[0];typeof s=="string"?o[0]=s.slice(a):o.shift()}n>0&&o.push(t[r].slice(0,n))}return o}function Uz(t,e){let i=-1;const a=[];let r;for(;++i<t.length;){const n=t[i];let o;if(typeof n=="string")o=n;else switch(n){case-5:{o="\r";break}case-4:{o=`
284
284
  `;break}case-3:{o=`\r
285
285
  `;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&r)continue;o=" ";break}default:o=String.fromCharCode(n)}r=n===-2,a.push(o)}return a.join("")}function Rz(t){const a={constructs:XN([Iz,...(t||{}).extensions||[]]),content:r(d$),defined:[],document:r(h$),flow:r(jz),lazy:{},string:r(Oz),text:r(qz)};return a;function r(n){return o;function o(s){return Pz(a,n,s)}}}function Qz(t){for(;!H8(t););return t}const G8=/[\0\t\n\r]/g;function Nz(){let t=1,e="",i=!0,a;return r;function r(n,o,s){const l=[];let u,f,d,g,_;for(n=e+(typeof n=="string"?n.toString():new TextDecoder(o||void 0).decode(n)),d=0,e="",i&&(n.charCodeAt(0)===65279&&d++,i=void 0);d<n.length;){if(G8.lastIndex=d,u=G8.exec(n),g=u&&u.index!==void 0?u.index:n.length,_=n.charCodeAt(g),!u){e=n.slice(d);break}if(_===10&&d===g&&a)l.push(-3),a=void 0;else switch(a&&(l.push(-5),a=void 0),d<g&&(l.push(n.slice(d,g)),t+=g-d),_){case 0:{l.push(65533),t++;break}case 9:{for(f=Math.ceil(t/4)*4,l.push(-2);t++<f;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:a=!0,t=1}d=g+1}return s&&(a&&l.push(-5),e&&l.push(e),l.push(null)),l}}function $z(t,e,i){return typeof e!="string"&&(i=e,e=void 0),f$(i)(Qz(Rz(i).document().write(Nz()(t,e,!0))))}const oF={none:"",left:' align="left"',right:' align="right"',center:' align="center"'};function zz(){return{enter:{table(t){const e=t._align;this.lineEndingIfNeeded(),this.tag("<table>"),this.setData("tableAlign",e)},tableBody(){this.tag("<tbody>")},tableData(){const t=this.getData("tableAlign"),e=this.getData("tableColumn"),i=oF[t[e]];i===void 0?this.buffer():(this.lineEndingIfNeeded(),this.tag("<td"+i+">"))},tableHead(){this.lineEndingIfNeeded(),this.tag("<thead>")},tableHeader(){const t=this.getData("tableAlign"),e=this.getData("tableColumn"),i=oF[t[e]];this.lineEndingIfNeeded(),this.tag("<th"+i+">")},tableRow(){this.setData("tableColumn",0),this.lineEndingIfNeeded(),this.tag("<tr>")}},exit:{codeTextData(t){let e=this.sliceSerialize(t);this.getData("tableAlign")&&(e=e.replace(/\\([\\|])/g,Wz)),this.raw(this.encode(e))},table(){this.setData("tableAlign"),this.setData("slurpAllLineEndings"),this.lineEndingIfNeeded(),this.tag("</table>")},tableBody(){this.lineEndingIfNeeded(),this.tag("</tbody>")},tableData(){const t=this.getData("tableAlign"),e=this.getData("tableColumn");e in t?(this.tag("</td>"),this.setData("tableColumn",e+1)):this.resume()},tableHead(){this.lineEndingIfNeeded(),this.tag("</thead>")},tableHeader(){const t=this.getData("tableColumn");this.tag("</th>"),this.setData("tableColumn",t+1)},tableRow(){const t=this.getData("tableAlign");let e=this.getData("tableColumn");for(;e<t.length;)this.lineEndingIfNeeded(),this.tag("<td"+oF[t[e]]+"></td>"),e++;this.setData("tableColumn",e),this.lineEndingIfNeeded(),this.tag("</tr>")}}}}function Wz(t,e){return e==="|"?e:t}class Gz{constructor(){this.map=[]}add(e,i,a){Vz(this,e,i,a)}consume(e){if(this.map.sort(function(n,o){return n[0]-o[0]}),this.map.length===0)return;let i=this.map.length;const a=[];for(;i>0;)i-=1,a.push(e.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),e.length=this.map[i][0];a.push(e.slice()),e.length=0;let r=a.pop();for(;r;){for(const n of r)e.push(n);r=a.pop()}this.map.length=0}}function Vz(t,e,i,a){let r=0;if(!(i===0&&a.length===0)){for(;r<t.map.length;){if(t.map[r][0]===e){t.map[r][1]+=i,t.map[r][2].push(...a);return}r+=1}t.map.push([e,i,a])}}function Kz(t,e){let i=!1;const a=[];for(;e<t.length;){const r=t[e];if(i){if(r[0]==="enter")r[1].type==="tableContent"&&a.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(r[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const n=a.length-1;a[n]=a[n]==="left"?"center":"right"}}else if(r[1].type==="tableDelimiterRow")break}else r[0]==="enter"&&r[1].type==="tableDelimiterRow"&&(i=!0);e+=1}return a}function Xz(){return{flow:{null:{name:"table",tokenize:Yz,resolveAll:Zz}}}}function Yz(t,e,i){const a=this;let r=0,n=0,o;return s;function s(D){let S=a.events.length-1;for(;S>-1;){const I=a.events[S][1].type;if(I==="lineEnding"||I==="linePrefix")S--;else break}const H=S>-1?a.events[S][1].type:null,T=H==="tableHead"||H==="tableRow"?k:l;return T===k&&a.parser.lazy[a.now().line]?i(D):T(D)}function l(D){return t.enter("tableHead"),t.enter("tableRow"),u(D)}function u(D){return D===124||(o=!0,n+=1),f(D)}function f(D){return D===null?i(D):ut(D)?n>1?(n=0,a.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),_):i(D):Pt(D)?Jt(t,f,"whitespace")(D):(n+=1,o&&(o=!1,r+=1),D===124?(t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),o=!0,f):(t.enter("data"),d(D)))}function d(D){return D===null||D===124||Va(D)?(t.exit("data"),f(D)):(t.consume(D),D===92?g:d)}function g(D){return D===92||D===124?(t.consume(D),d):d(D)}function _(D){return a.interrupt=!1,a.parser.lazy[a.now().line]?i(D):(t.enter("tableDelimiterRow"),o=!1,Pt(D)?Jt(t,F,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):F(D))}function F(D){return D===45||D===58?m(D):D===124?(o=!0,t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),c):y(D)}function c(D){return Pt(D)?Jt(t,m,"whitespace")(D):m(D)}function m(D){return D===58?(n+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(D),t.exit("tableDelimiterMarker"),A):D===45?(n+=1,A(D)):D===null||ut(D)?b(D):y(D)}function A(D){return D===45?(t.enter("tableDelimiterFiller"),p(D)):y(D)}function p(D){return D===45?(t.consume(D),p):D===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(D),t.exit("tableDelimiterMarker"),w):(t.exit("tableDelimiterFiller"),w(D))}function w(D){return Pt(D)?Jt(t,b,"whitespace")(D):b(D)}function b(D){return D===124?F(D):D===null||ut(D)?!o||r!==n?y(D):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(D)):y(D)}function y(D){return i(D)}function k(D){return t.enter("tableRow"),C(D)}function C(D){return D===124?(t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),C):D===null||ut(D)?(t.exit("tableRow"),e(D)):Pt(D)?Jt(t,C,"whitespace")(D):(t.enter("data"),v(D))}function v(D){return D===null||D===124||Va(D)?(t.exit("data"),C(D)):(t.consume(D),D===92?E:v)}function E(D){return D===92||D===124?(t.consume(D),v):v(D)}}function Zz(t,e){let i=-1,a=!0,r=0,n=[0,0,0,0],o=[0,0,0,0],s=!1,l=0,u,f,d;const g=new Gz;for(;++i<t.length;){const _=t[i],F=_[1];_[0]==="enter"?F.type==="tableHead"?(s=!1,l!==0&&(V8(g,e,l,u,f),f=void 0,l=0),u={type:"table",start:Object.assign({},F.start),end:Object.assign({},F.end)},g.add(i,0,[["enter",u,e]])):F.type==="tableRow"||F.type==="tableDelimiterRow"?(a=!0,d=void 0,n=[0,0,0,0],o=[0,i+1,0,0],s&&(s=!1,f={type:"tableBody",start:Object.assign({},F.start),end:Object.assign({},F.end)},g.add(i,0,[["enter",f,e]])),r=F.type==="tableDelimiterRow"?2:f?3:1):r&&(F.type==="data"||F.type==="tableDelimiterMarker"||F.type==="tableDelimiterFiller")?(a=!1,o[2]===0&&(n[1]!==0&&(o[0]=o[1],d=Vh(g,e,n,r,void 0,d),n=[0,0,0,0]),o[2]=i)):F.type==="tableCellDivider"&&(a?a=!1:(n[1]!==0&&(o[0]=o[1],d=Vh(g,e,n,r,void 0,d)),n=o,o=[n[1],i,0,0])):F.type==="tableHead"?(s=!0,l=i):F.type==="tableRow"||F.type==="tableDelimiterRow"?(l=i,n[1]!==0?(o[0]=o[1],d=Vh(g,e,n,r,i,d)):o[1]!==0&&(d=Vh(g,e,o,r,i,d)),r=0):r&&(F.type==="data"||F.type==="tableDelimiterMarker"||F.type==="tableDelimiterFiller")&&(o[3]=i)}for(l!==0&&V8(g,e,l,u,f),g.consume(e.events),i=-1;++i<e.events.length;){const _=e.events[i];_[0]==="enter"&&_[1].type==="table"&&(_[1]._align=Kz(e.events,i))}return t}function Vh(t,e,i,a,r,n){const o=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",s="tableContent";i[0]!==0&&(n.end=Object.assign({},Su(e.events,i[0])),t.add(i[0],0,[["exit",n,e]]));const l=Su(e.events,i[1]);if(n={type:o,start:Object.assign({},l),end:Object.assign({},l)},t.add(i[1],0,[["enter",n,e]]),i[2]!==0){const u=Su(e.events,i[2]),f=Su(e.events,i[3]),d={type:s,start:Object.assign({},u),end:Object.assign({},f)};if(t.add(i[2],0,[["enter",d,e]]),a!==2){const g=e.events[i[2]],_=e.events[i[3]];if(g[1].end=Object.assign({},_[1].end),g[1].type="chunkText",g[1].contentType="text",i[3]>i[2]+1){const F=i[2]+1,c=i[3]-i[2]-1;t.add(F,c,[])}}t.add(i[3]+1,0,[["exit",d,e]])}return r!==void 0&&(n.end=Object.assign({},Su(e.events,r)),t.add(r,0,[["exit",n,e]]),n=void 0),n}function V8(t,e,i,a,r){const n=[],o=Su(e.events,i);r&&(r.end=Object.assign({},o),n.push(["exit",r,e])),a.end=Object.assign({},o),n.push(["exit",a,e]),t.add(i+1,0,n)}function Su(t,e){const i=t[e],a=i[0]==="enter"?"start":"end";return i[1][a]}function sF(t){return $z(t,{extensions:[Xz()],htmlExtensions:[zz()]})}function Jz(t){var r;const e=/\[([^\]]+)\]\((https?:\/\/[^")]+)\)(?:\s*\n\s*([^\n]+))?/g,i=[];let a;for(;(a=e.exec(t))!==null;)i.push({name:a[1],url:a[2],pageInfo:(r=a[3])==null?void 0:r.trim()});return i}function eW(t){return t.replace(/<?Source[s]*>?[:]?(\s*)((\[[^\]]+\]\([^)]+\)(?:\s*\n\s*[^\n]+)?[, ]*)+)(?:\s*<\/Source[s]*>)?/gi,"")}const ko={userMessageContainer:"MessageRenderers-module_userMessageContainer_t-c-z",assistantMessageContainer:"MessageRenderers-module_assistantMessageContainer_Q01NL",audioOutputButton:"MessageRenderers-module_audioOutputButton_31Doo",synthesizing:"MessageRenderers-module_synthesizing_PWwm0",playing:"MessageRenderers-module_playing_Qktyu",userMessage:"MessageRenderers-module_userMessage_hXgT1",assistantMessage:"MessageRenderers-module_assistantMessage_4H2Dy",iconWrapper:"MessageRenderers-module_iconWrapper_Ai6Pd"};function tW({message:t,isStreaming:e=!1,getSpeech:i=Ei,isVoiceOutputEnabled:a=!1,setVoiceOutputPlaying:r=Ei}){const n=t.messageText,o=M.useRef(e),[s,l]=M.useState(null),[u,f]=M.useState(n),d=Dg(),g=M.useRef(null);M.useEffect(()=>{const p=setTimeout(()=>{const w=eW(n);f(w);const b=Jz(n);if(!b.length){l(null);return}l(h.jsxs("div",{style:{marginTop:16},children:[h.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Sources:"}),h.jsx("div",{style:{border:"1px solid #e0e0e0",borderRadius:8,padding:8,background:"#fafbfc",fontSize:14,maxWidth:"fit-content"},children:b.map((y,k)=>h.jsxs("div",{style:{marginBottom:8},children:[h.jsx("a",{href:y.url,target:"_blank",rel:"noopener noreferrer",style:{color:"#2a5cdb",fontWeight:500,textDecoration:"underline",display:"block",marginBottom:2,padding:"4px",fontSize:12},children:y.name}),y.pageInfo&&h.jsx("div",{style:{fontSize:12,color:"#666",padding:"0 4px"},children:y.pageInfo})]},k))})]}))},50);return()=>clearTimeout(p)},[n]);const[_,F]=M.useState("idle"),c=M.useCallback(async()=>{F("synthesizing");const p=await nW(u,i);if(!p){r(!1),F("idle");return}const w=new AudioContext,b=p,y=new Uint8Array(b.data),k=y.buffer.slice(y.byteOffset,y.byteOffset+y.byteLength),C=await w.decodeAudioData(k),v=w.createBufferSource();v.buffer=C,v.connect(w.destination),g.current=v,v.start(),v.onended=()=>{d()&&(F("idle"),r(!1))},F("playing"),r(!0)},[i,u,d,r]),m=M.useCallback(async()=>{e||await c()},[e,c]),A=M.useCallback(()=>{g.current&&(g.current.stop(),g.current=null)},[]);return M.useEffect(()=>{if(o.current===!0&&e===!1&&a){const p=setTimeout(()=>c().then(Ei),10);return()=>clearTimeout(p)}o.current=e},[e,a,c]),M.useEffect(cS(A),[A]),n.trim()?h.jsx("div",{className:ko.assistantMessageContainer,children:h.jsx("div",{children:h.jsxs(ot,{alignItems:"flex-start",gap:"8px",children:[h.jsxs(ot,{gap:"12px",direction:"column",children:[h.jsx("div",{className:ko.iconWrapper,children:h.jsx(Nt,{icon:"ai_general",size:24,color:"#3094ED",variant:"filled"})}),a&&h.jsx(Yi,{onClick:_==="idle"?m:A,variant:"system",size:"small",title:pe({Play:_==="idle",Stop:_==="playing",Synthesizing:_==="synthesizing"}),"data-testid":"assistant-message-play-button",disabled:_==="synthesizing",className:pe(ko.audioOutputButton,{[ko.synthesizing]:_==="synthesizing",[ko.playing]:_==="playing"}),children:_==="synthesizing"?h.jsx(Wn,{size:"small"}):h.jsx("div",{style:{position:"absolute",display:"block",left:"50%",top:"50%",transform:"translate(-50%, -50%)",color:"#fff",fontSize:12},children:iW[_]})})]}),h.jsxs(jc,{className:ko.assistantMessage,children:[o.current?h.jsx(aW,{text:u}):h.jsx("div",{className:"markdown",dangerouslySetInnerHTML:{__html:sF(u)}}),s]})]})})},"text"):null}const iW={idle:h.jsxs(h.Fragment,{children:["⏵",h.jsx("span",{className:"screen-reader-only",children:"Play"})]}),playing:h.jsxs(h.Fragment,{children:["⏹",h.jsx("span",{className:"screen-reader-only",children:"Stop"})]})};function aW({text:t}){const[e,i]=M.useState(""),a=Dg(),r=M.useRef({text:t,textToRender:e});return r.current.text=t,r.current.textToRender=e,M.useEffect(()=>rW({isMounted:a,propRefs:r,setTextToRender:i}),[]),h.jsx("div",{className:"markdown",dangerouslySetInnerHTML:{__html:sF(e)}})}function rW({isMounted:t,propRefs:e,setTextToRender:i}){let a=null,r=null;function n(){a&&clearInterval(a),r&&cancelAnimationFrame(r),a=null,r=null}let o=!1;function s(){o||(o=!0,r=requestAnimationFrame(()=>{if(!t())return;const d=e.current.text.slice(e.current.textToRender.length,e.current.textToRender.length+8);d.length&&i(e.current.textToRender+d),o=!1}))}function l(){o||!t()||a||(e.current.textToRender!==e.current.text?a=setInterval(s,20):n())}const u=setInterval(l,100);return()=>{n(),clearInterval(u)}}const K8=new Map;async function nW(t,e){let i=K8.get(t);return i||(i=await e(t),i?(K8.set(t,i),i):null)}const oW=le({module:()=>Promise.resolve().then(()=>Ufe),component:t=>t.default}),sW={small:"150px",default:"300px",large:"560px",full:"560px"};function lW({message:t,chatSize:e}){var u,f;const i=[],a=t.messageText,r=(u=t.metadata)==null?void 0:u.toolName;if(typeof a!="string"||!(a!=null&&a.includes("###chart_data_end###")))return;const n=a.split(/###chart_data###|###chart_data_end###/);if(!(n.length===3))return;const s=JSON.parse(n[1].trim()),l=`${r}-${s.type}-${t.id}`;return i.push(h.jsx("div",{style:{width:sW[e]},children:h.jsx(oW,{type:s.type,options:{...s.options,chart:{...(f=s.options)==null?void 0:f.chart,id:l,animations:{enabled:!1},zoom:{enabled:!0},toolbar:{show:!0,tools:{download:!0,selection:!0,zoom:!0,zoomin:!0,zoomout:!0,pan:!0,reset:!0}}}},series:s.series})},l)),h.jsx(jc,{children:h.jsx(ot,{justifyContent:"flex-start",style:{marginLeft:"24px"},direction:"column",children:i})})}function uW({message:t,showDebugInfo:e=!1}){var o,s,l;const[i,a]=M.useState(!1),r=(o=t.metadata)==null?void 0:o.toolName,n=h.jsx(ot,{justifyContent:"flex-start",style:{marginLeft:"24px"},children:h.jsxs(ot,{gap:"8px",alignItems:"center",children:[(s=t.metadata)!=null&&s.loading?h.jsx(Nt,{icon:"loading"}):null,h.jsx(Wg,{icon:"info",size:"large",text:(l=t.metadata)!=null&&l.loading?"Coach is thinking...":"Coach was thinking",variant:"outline",onClick:Sr(a,!i)})]})});return h.jsx(jc,{children:h.jsx("div",{title:`Tool call: ${r}`,style:{display:"inline-block"},children:e?h.jsx(mo,{parent:n,isOpen:i,onSetOpen:a,popoverComponent:h.jsx("textarea",{value:JSON.stringify(t,null,2),readOnly:!0,style:{width:"300px",height:"100px",resize:"none"}})}):n},r)})}function fW({message:t,showDebugInfo:e=!1,chatSize:i="default"}){return h.jsxs("div",{className:ko.assistantMessageContainer,children:[h.jsx(uW,{message:t,showDebugInfo:e}),h.jsx(lW,{message:t,chatSize:i})]})}function dW({message:t}){const e=t.messageText,i=[];return e&&i.push(h.jsx(ot,{justifyContent:"flex-end",style:{width:"100%"},className:ko.userMessageContainer,children:h.jsx(Yl,{noShadow:!0,withBorder:!0,className:ko.userMessage,children:h.jsx("div",{className:"markdown",dangerouslySetInnerHTML:{__html:sF(e)}})})},"text")),i.length===0?null:h.jsx(h.Fragment,{children:i})}const gW=({onExitSearch:t,onSearch:e})=>h.jsxs(ot,{direction:"row",gap:"8px",testId:"search-conversations",className:pa["ai-assistant-search-input-container"],children:[h.jsx(K1,{id:"search-conversations",onChange:e,placeholder:"Find chat","data-testid":"search-conversations-input",fullWidth:!0,autoFocus:!0}),h.jsx(ca,{icon:"close",system:!0,size:"small",title:"Exit search","data-testid":"search-exit-button",onClick:t})]});function hW({onExit:t,isPlaying:e}){const i=`audio-bar ${e?"playing":"idle"}`;return h.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[h.jsx("style",{type:"text/css",children:_W}),h.jsxs("div",{className:"audio-visualizer",children:[h.jsx("div",{className:i,role:"presentation"}),h.jsx("div",{className:i,role:"presentation"}),h.jsx("div",{className:i,role:"presentation"}),h.jsx("div",{className:i,role:"presentation"}),h.jsx("div",{className:i,role:"presentation"})]}),h.jsx("div",{className:"exit-voice-mode",onClick:()=>t(!1),children:"✕ Exit voice mode"})]})}const _W=`