@tickernelz/wardmote-ui 2026.1114.0 → 2026.1114.2

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 (829) hide show
  1. package/dist/assets/AccessSelectIdentity-Dp--1kWe.js +1 -0
  2. package/dist/assets/ActiveAgentsPanel-Budj8e9v.js +1 -0
  3. package/dist/assets/AdapterManager-DhiW44Eo.js +1 -0
  4. package/dist/assets/AdvancedToolsRoute-CICI1XRd.js +39 -0
  5. package/dist/assets/AgentActionButtons-DIhpv51Y.js +1 -0
  6. package/dist/assets/AgentAvatar-DgGEobSY.js +1 -0
  7. package/dist/assets/AgentBubbleActionRow-DIr3TdR9.js +1 -0
  8. package/dist/assets/AgentCharacter-BTEn5MBu.js +2 -0
  9. package/dist/assets/AgentChat-CeuGtMXr.js +1 -0
  10. package/dist/assets/AgentChats-CmDtTrMa.js +1 -0
  11. package/dist/assets/AgentDefaults-DpYaMGkf.js +1 -0
  12. package/dist/assets/AgentDetail-DFTeFc4-.js +38 -0
  13. package/dist/assets/AgentIconPicker-D87bSkxE.js +1 -0
  14. package/dist/assets/AgentIdentity-I_kB4rMX.js +1 -0
  15. package/dist/assets/AgentMailCredentialField-L4T0REEW.js +1 -0
  16. package/dist/assets/AgentMultiSelect-DsJfZtR2.js +1 -0
  17. package/dist/assets/AgentRoleEditor-DTKNKZXs.js +1 -0
  18. package/dist/assets/AgentSetupPrompt-DYBB5Med.js +30 -0
  19. package/dist/assets/AgentTodoCard-DRXZ7hmU.js +1 -0
  20. package/dist/assets/Agents-CClUUMUq.js +3 -0
  21. package/dist/assets/AppDetail-DfHLFOtj.js +5 -0
  22. package/dist/assets/AppLogo-CZr1Y48O.js +1 -0
  23. package/dist/assets/AppNotConnected-CcmXbFtD.js +1 -0
  24. package/dist/assets/ApprovalCard-uT_9D_uH.js +1 -0
  25. package/dist/assets/ApprovalDetail-CE41WFbd.js +1 -0
  26. package/dist/assets/ApprovalPayload-_zU9bukt.js +1 -0
  27. package/dist/assets/Approvals-BXrjqpKc.js +1 -0
  28. package/dist/assets/AppsConnect-DH7aSjtS.js +1 -0
  29. package/dist/assets/AppsReview-C0Y3SxmZ.js +1 -0
  30. package/dist/assets/ArtifactCard-DKUUBZ0K.js +1 -0
  31. package/dist/assets/Artifacts-Bsv5m0aU.js +1 -0
  32. package/dist/assets/AssistantConnection-Dm2PaSeU.js +1 -0
  33. package/dist/assets/AttentionInteractionResolver-CBjNuhYo.js +1 -0
  34. package/dist/assets/AuditHub-DbUni0O_.js +1 -0
  35. package/dist/assets/Auth-_P9t1YSS.js +3 -0
  36. package/dist/assets/BoardChat-CgzCuFIL.js +18 -0
  37. package/dist/assets/BoardClaim-CsomHmd6.js +1 -0
  38. package/dist/assets/BootstrapSetupUxLab-D-niQCV5.js +1 -0
  39. package/dist/assets/BreadcrumbContext-BVZDZoC0.js +1 -0
  40. package/dist/assets/Browse-0bmB5mqw.js +1 -0
  41. package/dist/assets/BudgetPolicyCard-CqFUHqOj.js +1 -0
  42. package/dist/assets/CaseDetail-DakrB2jI.js +2 -0
  43. package/dist/assets/CaseIdentifierKey-D8Xi16PS.js +1 -0
  44. package/dist/assets/Cases-DXbr4HJt.js +2 -0
  45. package/dist/assets/ChatEndpointDetail-BdDKo-Gq.js +5 -0
  46. package/dist/assets/ChatEndpointSetup-BX3iDH7N.js +1 -0
  47. package/dist/assets/ChatIdentityConfirm-DCI5BnWo.js +1 -0
  48. package/dist/assets/ChoiceControls-Bu-fd6qI.js +1 -0
  49. package/dist/assets/CliAuth-CRG0c0EH.js +1 -0
  50. package/dist/assets/CommentAttributionChip-fz5Mn0RW.js +1 -0
  51. package/dist/assets/Companies-FcUNLIkt.js +1 -0
  52. package/dist/assets/CompanyAccess-BUcTNg7_.js +1 -0
  53. package/dist/assets/CompanyActivity-ScpRBz1G.js +1 -0
  54. package/dist/assets/CompanyConnections-DMEwbZv7.js +1 -0
  55. package/dist/assets/CompanyContext-CSrVsSze.js +1 -0
  56. package/dist/assets/CompanyEnvironments-EqXhVruZ.js +3 -0
  57. package/dist/assets/CompanyExport-DQ9ffuua.js +4 -0
  58. package/dist/assets/CompanyImport-BhuZu4oc.js +1 -0
  59. package/dist/assets/CompanySettings-BSkg4ahA.js +1 -0
  60. package/dist/assets/CompanySettingsPluginPage-BzZkZqh-.js +1 -0
  61. package/dist/assets/CompanySkills-BbA4RKIw.js +10 -0
  62. package/dist/assets/ComposerAddMenu-D9z2INup.js +3 -0
  63. package/dist/assets/ConfigureBuiltInAgentModal-BUJPbmWc.js +1 -0
  64. package/dist/assets/ConnectionSetupFlow-DKjP5RBZ.js +40 -0
  65. package/dist/assets/CopyText-Cr673_Kx.js +1 -0
  66. package/dist/assets/CopyableGatewayUrl-BZyE_jT9.js +1 -0
  67. package/dist/assets/CrossIssueCollaborationUxLab-CEh5B2iJ.js +1 -0
  68. package/dist/assets/Dashboard--lTwxjV-.js +2 -0
  69. package/dist/assets/DashboardLive-BYyTgF5d.js +1 -0
  70. package/dist/assets/DecisionDateChips-vXwAFdua.js +1 -0
  71. package/dist/assets/DecisionModelSettings-NrNERkaW.js +1 -0
  72. package/dist/assets/DecisionQueuePage-BaaKuZBi.js +1 -0
  73. package/dist/assets/DesignGuide-DS6MuXWY.js +23 -0
  74. package/dist/assets/DocumentFrameHeader-DTSqcw4Q.js +1 -0
  75. package/dist/assets/EmailConnectionAccess-DAFMofYX.js +1 -0
  76. package/dist/assets/EmailEndpointSetup-CJFYu2G0.js +1 -0
  77. package/dist/assets/EnforcementBanner-DWPluRU0.js +1 -0
  78. package/dist/assets/EntityRow-BIfupmlZ.js +1 -0
  79. package/dist/assets/ExecutionWorkspaceDetail-CuD5xWOB.js +19 -0
  80. package/dist/assets/FilterBar-5ta25FCb.js +1 -0
  81. package/dist/assets/FoldCurtain-DUAOdtCt.js +1 -0
  82. package/dist/assets/FolderControls-B7TWghGc.js +1 -0
  83. package/dist/assets/GatewayDetail-xNVOxSIs.js +2 -0
  84. package/dist/assets/GatewaysList-DsSKLm1h.js +1 -0
  85. package/dist/assets/GoalDetail-oN5pyUUY.js +1 -0
  86. package/dist/assets/GoalTree-DaFizciF.js +1 -0
  87. package/dist/assets/Goals-xgGKfQZi.js +1 -0
  88. package/dist/assets/Identity-Cv_2a9qJ.js +1 -0
  89. package/dist/assets/ImageGalleryModal-CjHED0Lb.js +1 -0
  90. package/dist/assets/Inbox-wHhHozfr.js +2 -0
  91. package/dist/assets/InlineBanner-VQ5mstsR.js +1 -0
  92. package/dist/assets/InlineEditor-BKBqNA21.js +1 -0
  93. package/dist/assets/InlineEntitySelector-v2Q4C8oT.js +1 -0
  94. package/dist/assets/InstanceAccess-Ns2rAmva.js +1 -0
  95. package/dist/assets/InstanceAdvanced-Bdf2a4c_.js +1 -0
  96. package/dist/assets/InstanceFeatures-DUQnBkxy.js +1 -0
  97. package/dist/assets/InviteLanding-McBYpNeW.js +1 -0
  98. package/dist/assets/IssueChatLongThreadPerf-DD3RLbBo.js +2 -0
  99. package/dist/assets/IssueChatThread-BN-_8hT8.js +40 -0
  100. package/dist/assets/IssueDetail-CsaD311l.js +9 -0
  101. package/dist/assets/IssueDocumentAnnotations-BVdH4RTa.js +2 -0
  102. package/dist/assets/IssueOutputSection-CDIMRaF0.js +1 -0
  103. package/dist/assets/IssueRecoveryActionCard-C9qJAHes.js +1 -0
  104. package/dist/assets/IssueReferenceActivitySummary-CbpSjmdV.js +1 -0
  105. package/dist/assets/IssueReferencePill-DAEplgLd.js +1 -0
  106. package/dist/assets/IssueThreadInteractionCard-BbigJB2U.js +9 -0
  107. package/dist/assets/IssueWriteDenialNotice-BCJ74Czu.js +1 -0
  108. package/dist/assets/Issues-BWoc80Y9.js +3 -0
  109. package/dist/assets/JoinRequestQueue-ZZq3jWW-.js +1 -0
  110. package/dist/assets/JsonSchemaForm-ixDd6e-N.js +1 -0
  111. package/dist/assets/LiveNowTodoLine-B9oTH2L0.js +1 -0
  112. package/dist/assets/ManagedAiConnectionDetails-B0aWUPkf.js +1 -0
  113. package/dist/assets/MarkdownBody-BTjuUgFa.js +16 -0
  114. package/dist/assets/MarkdownEditor-DXD-Cu3u.js +85 -0
  115. package/dist/assets/McpConnect-Dzf7W2K6.js +1 -0
  116. package/dist/assets/MembershipAction-oiLtxQm3.js +1 -0
  117. package/dist/assets/MetricCard-DaAh5x_N.js +1 -0
  118. package/dist/assets/MissingPluginTabPlaceholder-DT47WyQq.js +1 -0
  119. package/dist/assets/ModelsAndProviders-BEb4Z38S.js +1 -0
  120. package/dist/assets/MootMark-DZAfkwdv.js +1 -0
  121. package/dist/assets/NewAgent-C3MxIRJj.js +1 -0
  122. package/dist/assets/OmpAllSettings-DBtL1qDL.js +1 -0
  123. package/dist/assets/OpenwaGatewayManager-DH3bF7fa.js +2 -0
  124. package/dist/assets/PathInstructionsModal-D4GUYKIT.js +1 -0
  125. package/dist/assets/PipelineSettings-BcAtsehE.js +2 -0
  126. package/dist/assets/Pipelines-CkiYUQS-.js +1 -0
  127. package/dist/assets/PixelsOffice-BSlctoug.js +2 -0
  128. package/dist/assets/PluginManager-4rrrAOLG.js +1 -0
  129. package/dist/assets/PluginPage-C6Qnf9ka.js +1 -0
  130. package/dist/assets/PluginSettings-Do37r6Zu.js +1 -0
  131. package/dist/assets/ProfileDetailRoute-DRFQNId6.js +1 -0
  132. package/dist/assets/ProfileSettings-BMwLBQDB.js +1 -0
  133. package/dist/assets/ProfileWizardRoute-XnnvzH9S.js +1 -0
  134. package/dist/assets/ProjectDetail-BW6Lr4Iq.js +1 -0
  135. package/dist/assets/ProjectWorkspaceDetail-DR4JCa1b.js +29 -0
  136. package/dist/assets/ProjectWorkspacesContent-CadPZn0k.js +1 -0
  137. package/dist/assets/Projects-DLBFbxcj.js +1 -0
  138. package/dist/assets/PublicIssueSharePage-C9yRZOdP.js +1 -0
  139. package/dist/assets/QuestionForm-B8-PWz3B.js +7 -0
  140. package/dist/assets/QuotaBar-_ok6Pek4.js +1 -0
  141. package/dist/assets/RepositoryEditor-CFt-HPgf.js +1 -0
  142. package/dist/assets/ResponsibleUserDenialNotice-DKNk1-BK.js +1 -0
  143. package/dist/assets/ResponsibleUserDenialUxLab-Bt9vnHJz.js +1 -0
  144. package/dist/assets/ReviewQueueCard-CIkiY-Lm.js +1 -0
  145. package/dist/assets/RichWorkProductCard-JGHGU_RI.js +1 -0
  146. package/dist/assets/RoutineActivityRow-B69N6Hcy.js +1 -0
  147. package/dist/assets/RoutineDetail-izWzADvA.js +2 -0
  148. package/dist/assets/RoutineRunVariablesDialog-DiT_o5Dm.js +1 -0
  149. package/dist/assets/RoutineVariablesEditor-0dQ10yPY.js +1 -0
  150. package/dist/assets/Routines-CHtabiYj.js +1 -0
  151. package/dist/assets/ScrollToBottom-pyHLjOjY.js +1 -0
  152. package/dist/assets/Search-yNNB6kys.js +1 -0
  153. package/dist/assets/SearchableSelect-CIJ5K8ih.js +1 -0
  154. package/dist/assets/Secrets-BOyOk5BF.js +4 -0
  155. package/dist/assets/SetupWizard-C8qzkJn1.js +1 -0
  156. package/dist/assets/SidebarContext-CF3RWLxh.js +1 -0
  157. package/dist/assets/SidebarNavItem-DV9nmC7O.js +1 -0
  158. package/dist/assets/SkillBinaryFile-DNe-MmCv.js +1 -0
  159. package/dist/assets/SkillCardIcon-BTCafp8l.js +2 -0
  160. package/dist/assets/SkillSourceTree-M58QwBFF.js +2 -0
  161. package/dist/assets/SkillSources-Cw4PU-Bz.js +2 -0
  162. package/dist/assets/SkillStudio-Cj_M3ZJa.js +9 -0
  163. package/dist/assets/SourceTrustBadge-BZBQe5No.js +1 -0
  164. package/dist/assets/StatusCards-DaJdQUN5.js +1 -0
  165. package/dist/assets/StatusIcon-0GcYXDdN.js +1 -0
  166. package/dist/assets/SummarySlotCard-DlSmN6PL.js +1 -0
  167. package/dist/assets/TaskChatComposerTakeoverContext-BJAHPHve.js +1 -0
  168. package/dist/assets/TaskChatLab-CU5eA7nX.js +11 -0
  169. package/dist/assets/TaskChatMarker-wBVUFL3u.js +2 -0
  170. package/dist/assets/TaskChatProtocolCard-D-Dwy2EL.js +1 -0
  171. package/dist/assets/TaskChatThreadView-Crlf9I05.js +4 -0
  172. package/dist/assets/TaskDetailRelationsPanel-CkktN1EC.js +1 -0
  173. package/dist/assets/TaskTreeControls-B_ulMOi1.js +3 -0
  174. package/dist/assets/Terminal-Bo-WuezO.js +1 -0
  175. package/dist/assets/TerminalView-AkFY5bLC.js +58 -0
  176. package/dist/assets/ThemeContext-DYRUK81c.js +1 -0
  177. package/dist/assets/ThemeToggle-BWFlFnSX.js +1 -0
  178. package/dist/assets/ToastContext-DMdt9oTd.js +1 -0
  179. package/dist/assets/ToolsAdminGate-BI5-WYC3.js +1 -0
  180. package/dist/assets/TrustPresetSection-DTc1Rj4q.js +1 -0
  181. package/dist/assets/UserProfile-C6q55R0Q.js +1 -0
  182. package/dist/assets/WebhookUrlWarning-D0GLAS0A.js +1 -0
  183. package/dist/assets/WhatNeedsMe-1igJA4gL.js +1 -0
  184. package/dist/assets/WorkspaceRuntimeControls-T4YUoZvK.js +1 -0
  185. package/dist/assets/Workspaces-rtQKliW0.js +1 -0
  186. package/dist/assets/access-GAosX22P.js +1 -0
  187. package/dist/assets/activity-BVYJmFzR.js +1 -0
  188. package/dist/assets/activity-CB9AQzZO.js +1 -0
  189. package/dist/assets/activity-format-zP89NM00.js +1 -0
  190. package/dist/assets/adapter-display-registry-Bk0KWAHT.js +1 -0
  191. package/dist/assets/adapters-Dp0USyWg.js +1 -0
  192. package/dist/assets/agent-avatar-url-C-slYk2A.js +1 -0
  193. package/dist/assets/agent-config-primitives-BsZUnbf2.js +1 -0
  194. package/dist/assets/agentChats-CjHr739f.js +1 -0
  195. package/dist/assets/agents-DmlgUVso.js +1 -0
  196. package/dist/assets/alert-dialog-Blls2GnU.js +1 -0
  197. package/dist/assets/app-connect-policy-CUzbEnhU.js +1 -0
  198. package/dist/assets/archive-CTfe4zq5.js +1 -0
  199. package/dist/assets/archive-restore-DeLPtKS0.js +1 -0
  200. package/dist/assets/arrow-down-Dg4PKbmt.js +1 -0
  201. package/dist/assets/arrow-down-left-C8jhGqM0.js +1 -0
  202. package/dist/assets/arrow-left-Ce_LIut0.js +1 -0
  203. package/dist/assets/arrow-right-BL5kYtCZ.js +1 -0
  204. package/dist/assets/arrow-up-D_YoSnQD.js +1 -0
  205. package/dist/assets/arrow-up-down-Bpe9xqCo.js +1 -0
  206. package/dist/assets/arrow-up-right-BLYWl-we.js +1 -0
  207. package/dist/assets/artifacts-9HWeqVeB.js +1 -0
  208. package/dist/assets/assets-TRDkBfss.js +1 -0
  209. package/dist/assets/attachment-icon-4xDiQblX.js +1 -0
  210. package/dist/assets/avatar-UO226cef.js +1 -0
  211. package/dist/assets/badge-DuA2EgZC.js +1 -0
  212. package/dist/assets/badge-check-Bd7IYIB2.js +1 -0
  213. package/dist/assets/bot-C9arfJWx.js +1 -0
  214. package/dist/assets/boxes-fV98p9-r.js +1 -0
  215. package/dist/assets/braces-BEVhwPeU.js +1 -0
  216. package/dist/assets/browser-use-D2HTf8rD.js +1 -0
  217. package/dist/assets/budgets-DvML2uxG.js +1 -0
  218. package/dist/assets/button-CMwV3L1P.js +1 -0
  219. package/dist/assets/calendar-clock-BVFltraz.js +1 -0
  220. package/dist/assets/card-Bru3x_SJ.js +1 -0
  221. package/dist/assets/cases-m9RZ5Cym.js +1 -0
  222. package/dist/assets/chatEndpoints-BKsIHowE.js +1 -0
  223. package/dist/assets/check-Ctsrlfa-.js +1 -0
  224. package/dist/assets/checkbox-BHQhs41k.js +1 -0
  225. package/dist/assets/chevron-down-BCvxsWfI.js +1 -0
  226. package/dist/assets/chevron-left-DP4zwC0G.js +1 -0
  227. package/dist/assets/chevron-right-s7L6hXXq.js +1 -0
  228. package/dist/assets/chevron-up-rFDQGA-7.js +1 -0
  229. package/dist/assets/chip-DsDe6yck.js +1 -0
  230. package/dist/assets/circle-IAHLDvLO.js +1 -0
  231. package/dist/assets/circle-alert-C-L4OsHh.js +1 -0
  232. package/dist/assets/circle-dot-zr8GONq2.js +1 -0
  233. package/dist/assets/circle-question-mark-B1jR2is9.js +1 -0
  234. package/dist/assets/circle-slash-Bx5HrFMb.js +1 -0
  235. package/dist/assets/circle-x-CFlSbYzD.js +1 -0
  236. package/dist/assets/clipboard-paste-D9rNPVFj.js +1 -0
  237. package/dist/assets/clock-CzrJT_cP.js +1 -0
  238. package/dist/assets/cloud-BktKFMPI.js +1 -0
  239. package/dist/assets/code-xml-BWc3OvMt.js +1 -0
  240. package/dist/assets/coins-C6QoCoLN.js +1 -0
  241. package/dist/assets/collapsible-CqjPlqOa.js +1 -0
  242. package/dist/assets/columns-3-CqC5nP-p.js +1 -0
  243. package/dist/assets/command-Ca3v36Mu.js +5 -0
  244. package/dist/assets/companies-query-D9PxIiMT.js +1 -0
  245. package/dist/assets/connection-identity-YKZfppDS.js +1 -0
  246. package/dist/assets/connection-owner-CZwxTEuM.js +1 -0
  247. package/dist/assets/copy-_wvZOjTe.js +1 -0
  248. package/dist/assets/createLucideIcon-DJi9suAC.js +94 -0
  249. package/dist/assets/decision-models-CD2AFC2a.js +1 -0
  250. package/dist/assets/dialog-CKUblzlR.js +1 -0
  251. package/dist/assets/dist-BNOqBr2U.js +1 -0
  252. package/dist/assets/dist-Bm2igrAN.js +1 -0
  253. package/dist/assets/dist-BuHnL0GV.js +1 -0
  254. package/dist/assets/dist-CClcSLHe.js +1 -0
  255. package/dist/assets/dist-CtvMIwRC.js +1 -0
  256. package/dist/assets/dist-CvHBQVAC.js +1 -0
  257. package/dist/assets/dist-DC4EOH0g.js +1 -0
  258. package/dist/assets/dist-DMg_vOQs.js +1 -0
  259. package/dist/assets/dist-DOIzg2vq.js +1 -0
  260. package/dist/assets/dist-DTFX_1D6.js +1 -0
  261. package/dist/assets/dist-DcOFbG-W.js +1 -0
  262. package/dist/assets/dist-SzpVz8Pd.js +1 -0
  263. package/dist/assets/dropdown-menu-CqRAF7Oj.js +1 -0
  264. package/dist/assets/ellipsis-BTiLRUn4.js +1 -0
  265. package/dist/assets/ellipsis-vertical-DWXPf6Ow.js +1 -0
  266. package/dist/assets/email-BNu4jmOH.js +1 -0
  267. package/dist/assets/environment-variables-editor-CCxeFKKk.js +1 -0
  268. package/dist/assets/environments-BLQs1ScE.js +1 -0
  269. package/dist/assets/es2015-C3hhXnTu.js +41 -0
  270. package/dist/assets/external-link-nl1b263c.js +1 -0
  271. package/dist/assets/eye-DRS7RbEp.js +1 -0
  272. package/dist/assets/eye-off-CVVA-EWh.js +1 -0
  273. package/dist/assets/fast-responses-DZodQpLv.js +1 -0
  274. package/dist/assets/file-N19tC0jj.js +1 -0
  275. package/dist/assets/file-code-corner-CmZ_RihF.js +1 -0
  276. package/dist/assets/file-pen-line-DX6PZQXR.js +1 -0
  277. package/dist/assets/file-question-mark-CTomlKBX.js +1 -0
  278. package/dist/assets/file-search-DZpRLS-j.js +1 -0
  279. package/dist/assets/file-text-Cw7ntqRx.js +1 -0
  280. package/dist/assets/flag-R0AVTKGk.js +1 -0
  281. package/dist/assets/flask-conical-CEYKkO5k.js +1 -0
  282. package/dist/assets/folder-git-2-D2Hz-CeQ.js +1 -0
  283. package/dist/assets/folder-open-8WDYv4mw.js +1 -0
  284. package/dist/assets/folder-search-D0WkVTZt.js +1 -0
  285. package/dist/assets/funnel-DWwD2WCu.js +1 -0
  286. package/dist/assets/git-pull-request-CdCSG7CL.js +1 -0
  287. package/dist/assets/github-icon-Bbgf67tg.js +1 -0
  288. package/dist/assets/health-DF7yrggW.js +1 -0
  289. package/dist/assets/heartbeats-DOyojsaN.js +1 -0
  290. package/dist/assets/inbox-C08arfF_.js +1 -0
  291. package/dist/assets/inboxArchiveCache-D8QGdg49.js +1 -0
  292. package/dist/assets/index-DDoARkPG.js +67 -0
  293. package/dist/assets/info-DXpx_HA2.js +1 -0
  294. package/dist/assets/input-DobnTAyB.js +1 -0
  295. package/dist/assets/instanceSettings-D8g_QlS-.js +1 -0
  296. package/dist/assets/interaction-audience-BRS_4X7S.js +1 -0
  297. package/dist/assets/interaction-card-visibility-DcyO470L.js +1 -0
  298. package/dist/assets/issue-blockers-DLfa24KC.js +1 -0
  299. package/dist/assets/issue-output-CU3gasZ1.js +1 -0
  300. package/dist/assets/issue-properties-lmRBaUTG.js +4 -0
  301. package/dist/assets/issue-share-j9E_vLuf.js +1 -0
  302. package/dist/assets/issue-workspace-selection-4JI2Uh9p.js +1 -0
  303. package/dist/assets/key-round-0RqEOB_C.js +1 -0
  304. package/dist/assets/label-BPz3pg9_.js +1 -0
  305. package/dist/assets/layout-dashboard-DClZjSaR.js +1 -0
  306. package/dist/assets/link-2-CND-9QZ2.js +1 -0
  307. package/dist/assets/link-BITB8yRp.js +1 -0
  308. package/dist/assets/list-filter-h7_mdWEH.js +1 -0
  309. package/dist/assets/list-todo-BmObdeVq.js +1 -0
  310. package/dist/assets/log-in-nSyhNjrD.js +1 -0
  311. package/dist/assets/maximize-2-DgliXYEr.js +1 -0
  312. package/dist/assets/mention-chips-D8856Q0_.js +17 -0
  313. package/dist/assets/message-square-plus-yRlSBxPl.js +1 -0
  314. package/dist/assets/minus-WOgDAWiC.js +1 -0
  315. package/dist/assets/model-fallback-X_YvC3rj.js +1 -0
  316. package/dist/assets/model-picker-fields-235ien8Z.js +1 -0
  317. package/dist/assets/network-RCsafDTP.js +1 -0
  318. package/dist/assets/octagon-alert-CeNhknXC.js +1 -0
  319. package/dist/assets/octagon-x-CBcXy1zJ.js +1 -0
  320. package/dist/assets/omp-settings-model-uqWvMNr2.js +1 -0
  321. package/dist/assets/package-CYC5MDhY.js +1 -0
  322. package/dist/assets/pause-CJSwJvLv.js +1 -0
  323. package/dist/assets/pen-line-CxWwoiP_.js +1 -0
  324. package/dist/assets/pipeline-stage-presentation-BSuBql6K.js +2 -0
  325. package/dist/assets/pipelines-vN196fc4.js +1 -0
  326. package/dist/assets/play-CJNuUj69.js +1 -0
  327. package/dist/assets/plug-VjpaJcMq.js +1 -0
  328. package/dist/assets/plugins-CF2QITJB.js +1 -0
  329. package/dist/assets/plus-C6fnr28l.js +1 -0
  330. package/dist/assets/popover-BhYHYj7q.js +1 -0
  331. package/dist/assets/power-B3xsPeS4.js +1 -0
  332. package/dist/assets/presentation-mode-Bk6TnKr9.js +1 -0
  333. package/dist/assets/profile-summary-unutni_7.js +1 -0
  334. package/dist/assets/projects-mixWrT5q.js +1 -0
  335. package/dist/assets/proposal-review-kucrRJgS.js +1 -0
  336. package/dist/assets/queryClient-BOli2vjj.js +1 -0
  337. package/dist/assets/queryKeys-DYV5MhM_.js +1 -0
  338. package/dist/assets/radio-DnDOdgWd.js +1 -0
  339. package/dist/assets/radio-card-DVZaXlw0.js +1 -0
  340. package/dist/assets/recent-agent-chats-DIU_z_qg.js +1 -0
  341. package/dist/assets/refresh-cw-B_Oki9wZ.js +1 -0
  342. package/dist/assets/repeat-DGPKlc5I.js +1 -0
  343. package/dist/assets/resizable-panels-Qjbo0P05.js +1 -0
  344. package/dist/assets/review-policy-BL48kYvb.js +1 -0
  345. package/dist/assets/rotate-ccw-CQEJ4ewP.js +1 -0
  346. package/dist/assets/rotate-cw-DnCrcS38.js +1 -0
  347. package/dist/assets/router-2UfGeejU.js +1 -0
  348. package/dist/assets/routines-KPtwxuS7.js +1 -0
  349. package/dist/assets/runRetryState-BdjK4QQj.js +1 -0
  350. package/dist/assets/save-CJ1Iqyew.js +1 -0
  351. package/dist/assets/schema-config-fields-DggSrP5S.js +1 -0
  352. package/dist/assets/scroll-area-P1KpIQWe.js +1 -0
  353. package/dist/assets/scroll-text-BpkOrME3.js +1 -0
  354. package/dist/assets/search-04O7m-IF.js +1 -0
  355. package/dist/assets/secrets-CZifgF0J.js +1 -0
  356. package/dist/assets/select-V0Hm_q4f.js +1 -0
  357. package/dist/assets/send-mNwfi_F1.js +1 -0
  358. package/dist/assets/separator-B2LFqBpM.js +1 -0
  359. package/dist/assets/server-DIhG4RDC.js +1 -0
  360. package/dist/assets/server-cog-DV4ua9lY.js +1 -0
  361. package/dist/assets/settings-DuZndeX2.js +1 -0
  362. package/dist/assets/shared-DDwmHbeD.js +1 -0
  363. package/dist/assets/sheet-jd7y5x4-.js +1 -0
  364. package/dist/assets/shield-BhaVQdWV.js +1 -0
  365. package/dist/assets/shield-alert-Be9GuMrS.js +1 -0
  366. package/dist/assets/shield-check-B0HVjzM_.js +1 -0
  367. package/dist/assets/shield-question-mark-D1_en6pn.js +1 -0
  368. package/dist/assets/shield-x-D-Ice3nf.js +1 -0
  369. package/dist/assets/sidebarPreferences-vEHBC54I.js +1 -0
  370. package/dist/assets/skeleton-Bv_lQagE.js +1 -0
  371. package/dist/assets/slots-Dw517dxP.js +49 -0
  372. package/dist/assets/smoke-lab-matrix-0BhnGQeo.js +1 -0
  373. package/dist/assets/square-B2aH51tE.js +1 -0
  374. package/dist/assets/star-BZgQbzhV.js +15 -0
  375. package/dist/assets/sun-_NIddwh7.js +1 -0
  376. package/dist/assets/system-notice-comment-CL_SWj_f.js +1 -0
  377. package/dist/assets/tabs-B2Os_leL.js +1 -0
  378. package/dist/assets/task-chat-attachments-jZNCAKd4.js +10 -0
  379. package/dist/assets/terminal-C0CKe_Zz.js +1 -0
  380. package/dist/assets/textarea-BRPEfJ-g.js +1 -0
  381. package/dist/assets/thumbs-down-C2BkjZOy.js +1 -0
  382. package/dist/assets/thumbs-up-OW2IsTL7.js +1 -0
  383. package/dist/assets/toggle-switch-BHxNtSq9.js +1 -0
  384. package/dist/assets/tool-taxonomy-DR7Q8sVs.js +1 -0
  385. package/dist/assets/tools-B-L_sU_9.js +1 -0
  386. package/dist/assets/tooltip-B5WQ3lq5.js +1 -0
  387. package/dist/assets/transcript-adapter-wiFIjKfq.js +5 -0
  388. package/dist/assets/trash-D7zTaHTj.js +1 -0
  389. package/dist/assets/triangle-alert-CBVKiaXB.js +1 -0
  390. package/dist/assets/use-adapter-capabilities-Bu8XkVZ9.js +1 -0
  391. package/dist/assets/use-copy-action-D5dEzo6L.js +1 -0
  392. package/dist/assets/useAgentChatEnabled-Chi_JXJj.js +1 -0
  393. package/dist/assets/useAutosaveIndicator-DttGFwx7.js +1 -0
  394. package/dist/assets/useHiddenSettings-CcaZfHLD.js +1 -0
  395. package/dist/assets/useInfiniteQuery-B28xptxn.js +1 -0
  396. package/dist/assets/useInstanceFeatureSettings-CEK6Xn3o.js +1 -0
  397. package/dist/assets/useManagedSandboxOnly-CO01cDK4.js +1 -0
  398. package/dist/assets/useMobileEntityPickerViewportStyle-C3R37KtS.js +1 -0
  399. package/dist/assets/usePrefersReducedMotion-Dw81-akd.js +1 -0
  400. package/dist/assets/useProfilesData-2L3_71Ql.js +1 -0
  401. package/dist/assets/useQueries-BIJ7zVTy.js +1 -0
  402. package/dist/assets/useSecondTick-Gige2l0t.js +1 -0
  403. package/dist/assets/useSharedPolling-D4Xn8mY2.js +1 -0
  404. package/dist/assets/useSummaryDraftStream-CWOQt25o.js +3 -0
  405. package/dist/assets/user-Ccom_Ph0.js +1 -0
  406. package/dist/assets/user-check-BoBa1Xs_.js +1 -0
  407. package/dist/assets/user-minus-B4F-9ccK.js +1 -0
  408. package/dist/assets/user-round-CGxsJ0K8.js +1 -0
  409. package/dist/assets/user-x-CRO9YVVi.js +1 -0
  410. package/dist/assets/users-DyKzwIh4.js +1 -0
  411. package/dist/assets/wand-sparkles-BqnbLKl3.js +1 -0
  412. package/dist/assets/webhook-BVBCKjlU.js +1 -0
  413. package/dist/assets/x-DRDFdlYE.js +1 -0
  414. package/dist/index.html +188 -188
  415. package/dist/sw.js +1 -1
  416. package/package.json +1 -1
  417. package/dist/assets/AccessSelectIdentity-F-2a6ecS.js +0 -1
  418. package/dist/assets/ActiveAgentsPanel-fPDwbNXe.js +0 -1
  419. package/dist/assets/AdapterManager-Cy72qmLl.js +0 -1
  420. package/dist/assets/AdvancedToolsRoute-Dea4M5XG.js +0 -39
  421. package/dist/assets/AgentActionButtons-TU3K865m.js +0 -1
  422. package/dist/assets/AgentAvatar-U9UbHZ2I.js +0 -1
  423. package/dist/assets/AgentBubbleActionRow-BgJXUcNP.js +0 -1
  424. package/dist/assets/AgentCharacter-CdZutGwJ.js +0 -2
  425. package/dist/assets/AgentChat-DY8t6jev.js +0 -1
  426. package/dist/assets/AgentChats-CgTNSgGW.js +0 -1
  427. package/dist/assets/AgentDefaults-B-jLf0OE.js +0 -1
  428. package/dist/assets/AgentDetail-C69A3j_f.js +0 -38
  429. package/dist/assets/AgentIconPicker-DOHQ2j-5.js +0 -1
  430. package/dist/assets/AgentIdentity-88zCb3Go.js +0 -1
  431. package/dist/assets/AgentMailCredentialField-BVybfhaF.js +0 -1
  432. package/dist/assets/AgentMultiSelect-DNCWXCnt.js +0 -1
  433. package/dist/assets/AgentRoleEditor-Day_Xajj.js +0 -1
  434. package/dist/assets/AgentSetupPrompt-DDYX89-9.js +0 -30
  435. package/dist/assets/AgentTodoCard-CfAun_uT.js +0 -1
  436. package/dist/assets/Agents-VdVlPzrq.js +0 -3
  437. package/dist/assets/AppDetail-BrUELV4l.js +0 -5
  438. package/dist/assets/AppLogo-BHz1JwFg.js +0 -1
  439. package/dist/assets/AppNotConnected-CjOPZ48p.js +0 -1
  440. package/dist/assets/ApprovalCard-ZnAF8kCp.js +0 -1
  441. package/dist/assets/ApprovalDetail-DPj_0Fkw.js +0 -1
  442. package/dist/assets/ApprovalPayload-jOfmARC1.js +0 -1
  443. package/dist/assets/Approvals-DwPcMIwc.js +0 -1
  444. package/dist/assets/AppsConnect-CZ1lSH2v.js +0 -1
  445. package/dist/assets/AppsReview-BkXh21w4.js +0 -1
  446. package/dist/assets/ArtifactCard-DMOLBDhg.js +0 -1
  447. package/dist/assets/Artifacts-1dMu5Khy.js +0 -1
  448. package/dist/assets/AssistantConnection-7YkxQoSX.js +0 -1
  449. package/dist/assets/AttentionInteractionResolver-CWNTB5PG.js +0 -1
  450. package/dist/assets/AuditHub-CduZGUr8.js +0 -1
  451. package/dist/assets/Auth-BvXFSqt1.js +0 -3
  452. package/dist/assets/BoardChat-Cx1qWaPf.js +0 -18
  453. package/dist/assets/BoardClaim-DSGJlQ5x.js +0 -1
  454. package/dist/assets/BootstrapSetupUxLab-Ddrh81el.js +0 -1
  455. package/dist/assets/BreadcrumbContext-DRZhs-5i.js +0 -1
  456. package/dist/assets/Browse-CWSUY8Ym.js +0 -1
  457. package/dist/assets/BudgetPolicyCard-D-xGhM9e.js +0 -1
  458. package/dist/assets/CaseDetail-BlQP0bNO.js +0 -2
  459. package/dist/assets/CaseIdentifierKey-DoadL0-N.js +0 -1
  460. package/dist/assets/Cases-CJMhZCTb.js +0 -2
  461. package/dist/assets/ChatEndpointDetail-DwkMt8Wq.js +0 -5
  462. package/dist/assets/ChatEndpointSetup-C-Nm12S8.js +0 -1
  463. package/dist/assets/ChatIdentityConfirm-W-48mshE.js +0 -1
  464. package/dist/assets/ChoiceControls-D1i7GepN.js +0 -1
  465. package/dist/assets/CliAuth-C6qylJ0n.js +0 -1
  466. package/dist/assets/CommentAttributionChip-BgxQOzqr.js +0 -1
  467. package/dist/assets/Companies-CPzB9-xt.js +0 -1
  468. package/dist/assets/CompanyAccess-CMc_gWhQ.js +0 -1
  469. package/dist/assets/CompanyActivity-Cj_EUdBm.js +0 -1
  470. package/dist/assets/CompanyConnections-BCBCavN8.js +0 -1
  471. package/dist/assets/CompanyContext-CPlpA2lb.js +0 -1
  472. package/dist/assets/CompanyEnvironments-NF7NDS0o.js +0 -3
  473. package/dist/assets/CompanyExport-BuRYJE3L.js +0 -4
  474. package/dist/assets/CompanyImport-BBIXQMUw.js +0 -1
  475. package/dist/assets/CompanySettings-OFHr6IRG.js +0 -1
  476. package/dist/assets/CompanySettingsPluginPage-CCZEpq82.js +0 -1
  477. package/dist/assets/CompanySkills-CSY9bF2z.js +0 -10
  478. package/dist/assets/ComposerAddMenu-DvacZ4GQ.js +0 -3
  479. package/dist/assets/ConfigureBuiltInAgentModal-BrM5oO3Y.js +0 -1
  480. package/dist/assets/ConnectionSetupFlow-CXPACouF.js +0 -40
  481. package/dist/assets/CopyText-D_Zgivv6.js +0 -1
  482. package/dist/assets/CopyableGatewayUrl-D5vz4PC5.js +0 -1
  483. package/dist/assets/CrossIssueCollaborationUxLab-BCnuyG3D.js +0 -1
  484. package/dist/assets/Dashboard-C0zfFWOE.js +0 -2
  485. package/dist/assets/DashboardLive-QIC_XaBZ.js +0 -1
  486. package/dist/assets/DecisionDateChips-LW_i7O1w.js +0 -1
  487. package/dist/assets/DecisionModelSettings-B-0DKQnv.js +0 -1
  488. package/dist/assets/DecisionQueuePage-CMjEZipC.js +0 -1
  489. package/dist/assets/DesignGuide-D_mymPmJ.js +0 -23
  490. package/dist/assets/DocumentFrameHeader-CwSlVbS_.js +0 -1
  491. package/dist/assets/EmailConnectionAccess-CHOe1NbR.js +0 -1
  492. package/dist/assets/EmailEndpointSetup-D53SnoCl.js +0 -1
  493. package/dist/assets/EnforcementBanner-Afwo2-lQ.js +0 -1
  494. package/dist/assets/EntityRow-Cnr0342e.js +0 -1
  495. package/dist/assets/ExecutionWorkspaceDetail-_2PziEsW.js +0 -19
  496. package/dist/assets/FilterBar-CZKam-LD.js +0 -1
  497. package/dist/assets/FoldCurtain-bbm-UBWP.js +0 -1
  498. package/dist/assets/FolderControls-Dg6pcOhR.js +0 -1
  499. package/dist/assets/GatewayDetail-KQfj7nv0.js +0 -2
  500. package/dist/assets/GatewaysList-QFrL2biI.js +0 -1
  501. package/dist/assets/GoalDetail-BTaMMKjs.js +0 -1
  502. package/dist/assets/GoalTree-BQNAEW30.js +0 -1
  503. package/dist/assets/Goals-Lb6_wdxB.js +0 -1
  504. package/dist/assets/Identity-8QZumPfI.js +0 -1
  505. package/dist/assets/ImageGalleryModal-DLsKxA2R.js +0 -1
  506. package/dist/assets/Inbox-BrInYS5S.js +0 -2
  507. package/dist/assets/InlineBanner-CoJqbItc.js +0 -1
  508. package/dist/assets/InlineEditor-CA8kcvA_.js +0 -1
  509. package/dist/assets/InlineEntitySelector-D-qeOeyL.js +0 -1
  510. package/dist/assets/InstanceAccess-C1e3jqC7.js +0 -1
  511. package/dist/assets/InstanceAdvanced-CDd3fZ0P.js +0 -1
  512. package/dist/assets/InstanceFeatures-CYqCDTw8.js +0 -1
  513. package/dist/assets/InviteLanding-BkL6BOm5.js +0 -1
  514. package/dist/assets/IssueChatLongThreadPerf-mk4miG24.js +0 -2
  515. package/dist/assets/IssueChatThread-D2VF_U0u.js +0 -40
  516. package/dist/assets/IssueDetail-nhRhGyxw.js +0 -9
  517. package/dist/assets/IssueDocumentAnnotations-CemZBdYS.js +0 -2
  518. package/dist/assets/IssueOutputSection-DCAtdLYt.js +0 -1
  519. package/dist/assets/IssueRecoveryActionCard-KN_UxqFa.js +0 -1
  520. package/dist/assets/IssueReferenceActivitySummary-Dp70EOc2.js +0 -1
  521. package/dist/assets/IssueReferencePill-BEVp1Js5.js +0 -1
  522. package/dist/assets/IssueThreadInteractionCard-ChD6Vc9B.js +0 -9
  523. package/dist/assets/IssueWriteDenialNotice-CRBGsued.js +0 -1
  524. package/dist/assets/Issues-B8y2ucca.js +0 -3
  525. package/dist/assets/JoinRequestQueue-C4W-2FBh.js +0 -1
  526. package/dist/assets/JsonSchemaForm-BEfBha0-.js +0 -1
  527. package/dist/assets/LiveNowTodoLine-6INiigWn.js +0 -1
  528. package/dist/assets/ManagedAiConnectionDetails-pjWPNQpl.js +0 -1
  529. package/dist/assets/MarkdownBody-B_RYK9iU.js +0 -16
  530. package/dist/assets/MarkdownEditor-CT3CtHAj.js +0 -85
  531. package/dist/assets/McpConnect-D4Iyr1ff.js +0 -1
  532. package/dist/assets/MembershipAction-CujgJyD4.js +0 -1
  533. package/dist/assets/MetricCard-DG2O-prC.js +0 -1
  534. package/dist/assets/MissingPluginTabPlaceholder-DgohdTaD.js +0 -1
  535. package/dist/assets/ModelsAndProviders-P7hcMDxR.js +0 -1
  536. package/dist/assets/MootMark-BtKQGR6r.js +0 -1
  537. package/dist/assets/NewAgent-BpFB_Fmh.js +0 -1
  538. package/dist/assets/OmpAllSettings-RJ-rlnXL.js +0 -1
  539. package/dist/assets/OpenwaGatewayManager-bhI49yii.js +0 -2
  540. package/dist/assets/PathInstructionsModal-BUCL02kU.js +0 -1
  541. package/dist/assets/PipelineSettings-Bf74pEoa.js +0 -2
  542. package/dist/assets/Pipelines-C9YVDX3a.js +0 -1
  543. package/dist/assets/PixelsOffice-a6NwZFpn.js +0 -2
  544. package/dist/assets/PluginManager-BlATaJtd.js +0 -1
  545. package/dist/assets/PluginPage-CX1Bsbez.js +0 -1
  546. package/dist/assets/PluginSettings-BB1ML576.js +0 -1
  547. package/dist/assets/ProfileDetailRoute-DpklWMHU.js +0 -1
  548. package/dist/assets/ProfileSettings-BefN3hG3.js +0 -1
  549. package/dist/assets/ProfileWizardRoute-DAiCxAXs.js +0 -1
  550. package/dist/assets/ProjectDetail-CNoJA4R7.js +0 -1
  551. package/dist/assets/ProjectWorkspaceDetail-Bmqa3L7z.js +0 -29
  552. package/dist/assets/ProjectWorkspacesContent-tXfXERlK.js +0 -1
  553. package/dist/assets/Projects-DgXUf7fs.js +0 -1
  554. package/dist/assets/PublicIssueSharePage-DeUCrjCO.js +0 -1
  555. package/dist/assets/QuestionForm-CaOUlqsp.js +0 -7
  556. package/dist/assets/QuotaBar-BSZ05HlD.js +0 -1
  557. package/dist/assets/RepositoryEditor-B4F3WCYM.js +0 -1
  558. package/dist/assets/ResponsibleUserDenialNotice-B3ogb0RX.js +0 -1
  559. package/dist/assets/ResponsibleUserDenialUxLab-R05mXHUA.js +0 -1
  560. package/dist/assets/ReviewQueueCard-PSx8OKVe.js +0 -1
  561. package/dist/assets/RichWorkProductCard-C5d3O8x2.js +0 -1
  562. package/dist/assets/RoutineActivityRow-DJPqSghi.js +0 -1
  563. package/dist/assets/RoutineDetail-CW38wUMn.js +0 -2
  564. package/dist/assets/RoutineRunVariablesDialog-Bwx3NcZP.js +0 -1
  565. package/dist/assets/RoutineVariablesEditor-BlIqaHD7.js +0 -1
  566. package/dist/assets/Routines-BtgI64OC.js +0 -1
  567. package/dist/assets/ScrollToBottom-DXR8Kf8r.js +0 -1
  568. package/dist/assets/Search-qvbr2i0v.js +0 -1
  569. package/dist/assets/SearchableSelect-DAxMwf7p.js +0 -1
  570. package/dist/assets/Secrets-DsNbH2aU.js +0 -4
  571. package/dist/assets/SetupWizard-CyX1SOfj.js +0 -1
  572. package/dist/assets/SidebarContext-DM8yeAqZ.js +0 -1
  573. package/dist/assets/SidebarNavItem-CJfTKpVR.js +0 -1
  574. package/dist/assets/SkillBinaryFile-ChklNbjJ.js +0 -1
  575. package/dist/assets/SkillCardIcon-CBiYctTu.js +0 -2
  576. package/dist/assets/SkillSourceTree-B658V6hQ.js +0 -2
  577. package/dist/assets/SkillSources-CSPpd3N5.js +0 -2
  578. package/dist/assets/SkillStudio-D4VqFe2L.js +0 -9
  579. package/dist/assets/SourceTrustBadge-DPHntkgj.js +0 -1
  580. package/dist/assets/StatusCards-C8MwOQwi.js +0 -1
  581. package/dist/assets/StatusIcon-CsDhn7kH.js +0 -1
  582. package/dist/assets/SummarySlotCard-BmhW7fBt.js +0 -1
  583. package/dist/assets/TaskChatComposerTakeoverContext-BM0nPI_N.js +0 -1
  584. package/dist/assets/TaskChatLab-CIKyw9HK.js +0 -11
  585. package/dist/assets/TaskChatMarker-Vs1DipiY.js +0 -2
  586. package/dist/assets/TaskChatProtocolCard-Cha-CaFw.js +0 -1
  587. package/dist/assets/TaskChatThreadView-BwnkoMCu.js +0 -4
  588. package/dist/assets/TaskDetailRelationsPanel-BQYB-r_n.js +0 -1
  589. package/dist/assets/TaskTreeControls-DPQW-7CE.js +0 -3
  590. package/dist/assets/Terminal-BKrgCKkV.js +0 -1
  591. package/dist/assets/TerminalView-Cp_JlT5m.js +0 -58
  592. package/dist/assets/ThemeContext-DkIKyApz.js +0 -1
  593. package/dist/assets/ThemeToggle-B5pGLVBk.js +0 -1
  594. package/dist/assets/ToastContext-pc_NSDO8.js +0 -1
  595. package/dist/assets/ToolsAdminGate-DvKJJkYK.js +0 -1
  596. package/dist/assets/TrustPresetSection-DfqMdmaU.js +0 -1
  597. package/dist/assets/UserProfile-C3LmtKXG.js +0 -1
  598. package/dist/assets/WebhookUrlWarning-D5QqIOm5.js +0 -1
  599. package/dist/assets/WhatNeedsMe-DlqmV2_9.js +0 -1
  600. package/dist/assets/WorkspaceRuntimeControls-DrJU_LOR.js +0 -1
  601. package/dist/assets/Workspaces-B-qktWpk.js +0 -1
  602. package/dist/assets/access-Bcz_4BVJ.js +0 -1
  603. package/dist/assets/activity-Bc5YbOoF.js +0 -1
  604. package/dist/assets/activity-NKpSxizv.js +0 -1
  605. package/dist/assets/activity-format-DKP90biT.js +0 -1
  606. package/dist/assets/adapter-display-registry-BkHKgkyV.js +0 -1
  607. package/dist/assets/adapters-CWe3iLLC.js +0 -1
  608. package/dist/assets/agent-avatar-url-DudwzgFd.js +0 -1
  609. package/dist/assets/agent-config-primitives-DjmKcW83.js +0 -1
  610. package/dist/assets/agentChats-B-qVpG-j.js +0 -1
  611. package/dist/assets/agents-BusZWz59.js +0 -1
  612. package/dist/assets/alert-dialog-BQFOD0AR.js +0 -1
  613. package/dist/assets/app-connect-policy-CT1M7cxG.js +0 -1
  614. package/dist/assets/archive-BqFccWd4.js +0 -1
  615. package/dist/assets/archive-restore-BBGn1s-I.js +0 -1
  616. package/dist/assets/arrow-down-BRkMrP1R.js +0 -1
  617. package/dist/assets/arrow-down-left-D9BZPYo2.js +0 -1
  618. package/dist/assets/arrow-left-BVSmSuVw.js +0 -1
  619. package/dist/assets/arrow-right-DyLbbrYf.js +0 -1
  620. package/dist/assets/arrow-up-D_ylw6qE.js +0 -1
  621. package/dist/assets/arrow-up-down-DfMUkSUq.js +0 -1
  622. package/dist/assets/arrow-up-right-Csy74riS.js +0 -1
  623. package/dist/assets/artifacts-Bp8NM8Dh.js +0 -1
  624. package/dist/assets/assets-C3CFw8uT.js +0 -1
  625. package/dist/assets/attachment-icon-0pZ1MbWy.js +0 -1
  626. package/dist/assets/avatar-Cnzd7y-e.js +0 -1
  627. package/dist/assets/badge-D6gWCBB2.js +0 -1
  628. package/dist/assets/badge-check-7kcDeVo4.js +0 -1
  629. package/dist/assets/bot-DCth3dbg.js +0 -1
  630. package/dist/assets/boxes-Rm5Dpfew.js +0 -1
  631. package/dist/assets/braces-DsHvsWtt.js +0 -1
  632. package/dist/assets/browser-use-C_xA8ZFx.js +0 -1
  633. package/dist/assets/budgets-Dlh3sft0.js +0 -1
  634. package/dist/assets/button-Cjm24aCl.js +0 -1
  635. package/dist/assets/calendar-clock-BxumFXR5.js +0 -1
  636. package/dist/assets/card-C0pWNeqJ.js +0 -1
  637. package/dist/assets/cases-BEgzG8fb.js +0 -1
  638. package/dist/assets/chatEndpoints-BvFp31Wp.js +0 -1
  639. package/dist/assets/check-D25gbkia.js +0 -1
  640. package/dist/assets/checkbox-BtBVaRcF.js +0 -1
  641. package/dist/assets/chevron-down-DRTtaJaL.js +0 -1
  642. package/dist/assets/chevron-left-DyWGebtA.js +0 -1
  643. package/dist/assets/chevron-right-DRPBYcaQ.js +0 -1
  644. package/dist/assets/chevron-up-C1CThLD8.js +0 -1
  645. package/dist/assets/chip-DEksAzpZ.js +0 -1
  646. package/dist/assets/circle-5aGwoChc.js +0 -1
  647. package/dist/assets/circle-alert-Dr23_HXm.js +0 -1
  648. package/dist/assets/circle-dot-Cq_grJwm.js +0 -1
  649. package/dist/assets/circle-question-mark-C61IbV2j.js +0 -1
  650. package/dist/assets/circle-slash-BCT_vPHg.js +0 -1
  651. package/dist/assets/circle-x-BgZC9NRa.js +0 -1
  652. package/dist/assets/clipboard-paste-CD9XARY6.js +0 -1
  653. package/dist/assets/clock-CzExhPDZ.js +0 -1
  654. package/dist/assets/cloud-B6Bj5ET-.js +0 -1
  655. package/dist/assets/code-xml-CZORJ1t6.js +0 -1
  656. package/dist/assets/coins-Dp99swNO.js +0 -1
  657. package/dist/assets/collapsible-w0Gm1Duf.js +0 -1
  658. package/dist/assets/columns-3-Dwg6adEi.js +0 -1
  659. package/dist/assets/command-DRxd9M5m.js +0 -5
  660. package/dist/assets/companies-query-C5h0ehWr.js +0 -1
  661. package/dist/assets/connection-identity-B77zUDMx.js +0 -1
  662. package/dist/assets/connection-owner-D60xEDD7.js +0 -1
  663. package/dist/assets/copy-Ck432-6W.js +0 -1
  664. package/dist/assets/createLucideIcon-DFq0_SD5.js +0 -94
  665. package/dist/assets/decision-models-DAJNV6Ek.js +0 -1
  666. package/dist/assets/dialog-B6knjPRK.js +0 -1
  667. package/dist/assets/dist-2G1d7V9E.js +0 -1
  668. package/dist/assets/dist-BtpC6E52.js +0 -1
  669. package/dist/assets/dist-BvVm60ff.js +0 -1
  670. package/dist/assets/dist-CPW84eg0.js +0 -1
  671. package/dist/assets/dist-Ci-ZUfuY.js +0 -1
  672. package/dist/assets/dist-CqQt0BcD.js +0 -1
  673. package/dist/assets/dist-D2VtrOy3.js +0 -1
  674. package/dist/assets/dist-DVnvJXCY.js +0 -1
  675. package/dist/assets/dist-Dr85F8WW.js +0 -1
  676. package/dist/assets/dist-Dz_zv-7l.js +0 -1
  677. package/dist/assets/dist-oPspc6b7.js +0 -1
  678. package/dist/assets/dist-wgLSyHIr.js +0 -1
  679. package/dist/assets/dropdown-menu-Bv-5gi4Z.js +0 -1
  680. package/dist/assets/ellipsis-6pUps2JA.js +0 -1
  681. package/dist/assets/ellipsis-vertical-DtmCS_6d.js +0 -1
  682. package/dist/assets/email-CQEe4aNP.js +0 -1
  683. package/dist/assets/environment-variables-editor-BkIHpy42.js +0 -1
  684. package/dist/assets/environments-Dp21mS4n.js +0 -1
  685. package/dist/assets/es2015-B8GsGeCN.js +0 -41
  686. package/dist/assets/external-link-BYT2N-qd.js +0 -1
  687. package/dist/assets/eye-DePHXY9S.js +0 -1
  688. package/dist/assets/eye-off-BzaGKr4m.js +0 -1
  689. package/dist/assets/fast-responses-Cbsfq8Ak.js +0 -1
  690. package/dist/assets/file-CwO10jsS.js +0 -1
  691. package/dist/assets/file-code-corner-B1hGvhlD.js +0 -1
  692. package/dist/assets/file-pen-line-DBwntZqZ.js +0 -1
  693. package/dist/assets/file-question-mark-ByNkGqZU.js +0 -1
  694. package/dist/assets/file-search-KdZuJEu_.js +0 -1
  695. package/dist/assets/file-text-CPjqXxv9.js +0 -1
  696. package/dist/assets/flag-BWH3doOS.js +0 -1
  697. package/dist/assets/flask-conical-DmYAU0jU.js +0 -1
  698. package/dist/assets/folder-git-2-BDX-z73H.js +0 -1
  699. package/dist/assets/folder-open-DdGngi3h.js +0 -1
  700. package/dist/assets/folder-search-BnlPfb8E.js +0 -1
  701. package/dist/assets/funnel-qTFYznMQ.js +0 -1
  702. package/dist/assets/git-pull-request-Bxg55kum.js +0 -1
  703. package/dist/assets/github-icon-DzdzHvWa.js +0 -1
  704. package/dist/assets/health-_oZheFQS.js +0 -1
  705. package/dist/assets/heartbeats-Dn7f2jm7.js +0 -1
  706. package/dist/assets/inbox-BYzFop55.js +0 -1
  707. package/dist/assets/inboxArchiveCache-DadMmOlk.js +0 -1
  708. package/dist/assets/index-CturclrK.js +0 -67
  709. package/dist/assets/info-CXAQLLHF.js +0 -1
  710. package/dist/assets/input-OyH1le9F.js +0 -1
  711. package/dist/assets/instanceSettings-C68LkOh1.js +0 -1
  712. package/dist/assets/interaction-audience-DSnAFJS-.js +0 -1
  713. package/dist/assets/interaction-card-visibility-hAotQiNj.js +0 -1
  714. package/dist/assets/issue-blockers-BfUep25r.js +0 -1
  715. package/dist/assets/issue-output-D6f2QAoO.js +0 -1
  716. package/dist/assets/issue-properties-Bq80d68i.js +0 -4
  717. package/dist/assets/issue-share-CEVooWcy.js +0 -1
  718. package/dist/assets/issue-workspace-selection-BjDuxgu4.js +0 -1
  719. package/dist/assets/key-round-Dz2RdZt-.js +0 -1
  720. package/dist/assets/label-DkXqkneE.js +0 -1
  721. package/dist/assets/layout-dashboard-K9mAnWo1.js +0 -1
  722. package/dist/assets/link-2-CqoCP9d2.js +0 -1
  723. package/dist/assets/link-BeX_9YF4.js +0 -1
  724. package/dist/assets/list-filter-BO6nka6p.js +0 -1
  725. package/dist/assets/list-todo-BRs14Knm.js +0 -1
  726. package/dist/assets/log-in-CDfTjtDB.js +0 -1
  727. package/dist/assets/maximize-2-CqdFeZg_.js +0 -1
  728. package/dist/assets/mention-chips-XGBWyjfr.js +0 -17
  729. package/dist/assets/message-square-plus-DivlmIBl.js +0 -1
  730. package/dist/assets/minus-DBeRgFHz.js +0 -1
  731. package/dist/assets/model-fallback-CARdABIB.js +0 -1
  732. package/dist/assets/model-picker-fields-DyrF_pml.js +0 -1
  733. package/dist/assets/network-Dn0XzCEV.js +0 -1
  734. package/dist/assets/octagon-alert-BSE2kxYA.js +0 -1
  735. package/dist/assets/octagon-x-DeLWIK-1.js +0 -1
  736. package/dist/assets/omp-settings-model-CKEwCMG9.js +0 -1
  737. package/dist/assets/package-BXDmAhqA.js +0 -1
  738. package/dist/assets/pause-BFubuTGL.js +0 -1
  739. package/dist/assets/pen-line-MixC8OAX.js +0 -1
  740. package/dist/assets/pipeline-stage-presentation-BlMUfYSm.js +0 -2
  741. package/dist/assets/pipelines-DGHN_ZDl.js +0 -1
  742. package/dist/assets/play-BxobhMNN.js +0 -1
  743. package/dist/assets/plug-B9LpcqxX.js +0 -1
  744. package/dist/assets/plugins-C1CBwZxr.js +0 -1
  745. package/dist/assets/plus-3grZEc6D.js +0 -1
  746. package/dist/assets/popover-Dboikzj7.js +0 -1
  747. package/dist/assets/power-BwAEcXE3.js +0 -1
  748. package/dist/assets/presentation-mode-zPteD84U.js +0 -1
  749. package/dist/assets/profile-summary-Bx6NntA0.js +0 -1
  750. package/dist/assets/projects-Dhg0tJ68.js +0 -1
  751. package/dist/assets/proposal-review-CTbLGzM1.js +0 -1
  752. package/dist/assets/queryClient-ew36hKeJ.js +0 -1
  753. package/dist/assets/queryKeys-BjE39RB_.js +0 -1
  754. package/dist/assets/radio-92dOg5hV.js +0 -1
  755. package/dist/assets/radio-card-BZzGx1bj.js +0 -1
  756. package/dist/assets/recent-agent-chats-DL_CkTww.js +0 -1
  757. package/dist/assets/refresh-cw-DRrmw-ua.js +0 -1
  758. package/dist/assets/repeat-BK1ZQ6UR.js +0 -1
  759. package/dist/assets/resizable-panels-BGrsZhXV.js +0 -1
  760. package/dist/assets/review-policy-DddwYdrf.js +0 -1
  761. package/dist/assets/rotate-ccw-3dpBz4_v.js +0 -1
  762. package/dist/assets/rotate-cw-BlbJ5W3e.js +0 -1
  763. package/dist/assets/router-DxxHzV7q.js +0 -1
  764. package/dist/assets/routines-Czc76kli.js +0 -1
  765. package/dist/assets/runRetryState-MbpWYOmV.js +0 -1
  766. package/dist/assets/save-BPGfeNy8.js +0 -1
  767. package/dist/assets/schema-config-fields-B36htqHz.js +0 -1
  768. package/dist/assets/scroll-area-vPDcONOE.js +0 -1
  769. package/dist/assets/scroll-text-D4bbPQHV.js +0 -1
  770. package/dist/assets/search-DI6_pp-D.js +0 -1
  771. package/dist/assets/secrets-BbGN8H56.js +0 -1
  772. package/dist/assets/select-C2DC5rk6.js +0 -1
  773. package/dist/assets/send-CB6g5rI-.js +0 -1
  774. package/dist/assets/separator-GuwKN0ly.js +0 -1
  775. package/dist/assets/server-DvecsSaC.js +0 -1
  776. package/dist/assets/server-cog-BNds_biT.js +0 -1
  777. package/dist/assets/settings-COk8eOW7.js +0 -1
  778. package/dist/assets/shared-C4wh4A72.js +0 -1
  779. package/dist/assets/sheet-BGB1wcjf.js +0 -1
  780. package/dist/assets/shield-Da7znhbq.js +0 -1
  781. package/dist/assets/shield-alert-400pYbWO.js +0 -1
  782. package/dist/assets/shield-check-rK8cawGy.js +0 -1
  783. package/dist/assets/shield-question-mark-Bu8HUTd_.js +0 -1
  784. package/dist/assets/shield-x-DgETIg3u.js +0 -1
  785. package/dist/assets/sidebarPreferences-C-DSpjIP.js +0 -1
  786. package/dist/assets/skeleton-6hT0ziyj.js +0 -1
  787. package/dist/assets/slots-B1jHPd4d.js +0 -49
  788. package/dist/assets/smoke-lab-matrix-Cc8gF-EO.js +0 -1
  789. package/dist/assets/square-BcgffFXM.js +0 -1
  790. package/dist/assets/star-1UakmInq.js +0 -15
  791. package/dist/assets/sun-BdXf3WK7.js +0 -1
  792. package/dist/assets/system-notice-comment-yjZiXPNH.js +0 -1
  793. package/dist/assets/tabs-8fOwp9Wd.js +0 -1
  794. package/dist/assets/task-chat-attachments-DY3I4nBN.js +0 -10
  795. package/dist/assets/terminal-9waEsp12.js +0 -1
  796. package/dist/assets/textarea-yxs96L-d.js +0 -1
  797. package/dist/assets/thumbs-down-DWl2i7Ea.js +0 -1
  798. package/dist/assets/thumbs-up-Caxf3HRW.js +0 -1
  799. package/dist/assets/toggle-switch-C5IT4laE.js +0 -1
  800. package/dist/assets/tool-taxonomy-4oizLIC4.js +0 -1
  801. package/dist/assets/tools-XWaOXIHQ.js +0 -1
  802. package/dist/assets/tooltip-CrjeF5Py.js +0 -1
  803. package/dist/assets/transcript-adapter-ByJVfKL8.js +0 -5
  804. package/dist/assets/trash-CEP6t-OK.js +0 -1
  805. package/dist/assets/triangle-alert-8W9BE8a7.js +0 -1
  806. package/dist/assets/use-adapter-capabilities-sembMmIT.js +0 -1
  807. package/dist/assets/use-copy-action-CFzqHTsL.js +0 -1
  808. package/dist/assets/useAgentChatEnabled-8Pnx26s0.js +0 -1
  809. package/dist/assets/useAutosaveIndicator-cVaZS2nh.js +0 -1
  810. package/dist/assets/useHiddenSettings-zU4NvLoR.js +0 -1
  811. package/dist/assets/useInfiniteQuery-Wx2UMo1u.js +0 -1
  812. package/dist/assets/useInstanceFeatureSettings-C4g8yZ-P.js +0 -1
  813. package/dist/assets/useManagedSandboxOnly-DLQ6H9fl.js +0 -1
  814. package/dist/assets/useMobileEntityPickerViewportStyle-B_Xv_WNu.js +0 -1
  815. package/dist/assets/usePrefersReducedMotion-DNg4ExJc.js +0 -1
  816. package/dist/assets/useProfilesData-BfbgbFMa.js +0 -1
  817. package/dist/assets/useQueries-c0fWgj-2.js +0 -1
  818. package/dist/assets/useSecondTick-BZz9TShK.js +0 -1
  819. package/dist/assets/useSharedPolling-DZrr45g8.js +0 -1
  820. package/dist/assets/useSummaryDraftStream-CyhKO1CH.js +0 -3
  821. package/dist/assets/user-C_uFK2oS.js +0 -1
  822. package/dist/assets/user-check-CG1rKDBr.js +0 -1
  823. package/dist/assets/user-minus-fYGjtB62.js +0 -1
  824. package/dist/assets/user-round-D1ny1Q1J.js +0 -1
  825. package/dist/assets/user-x-BhQvIXbB.js +0 -1
  826. package/dist/assets/users-DpHy-NzY.js +0 -1
  827. package/dist/assets/wand-sparkles-DOYDAffy.js +0 -1
  828. package/dist/assets/webhook-Bb869qRq.js +0 -1
  829. package/dist/assets/x-DezUz_Fi.js +0 -1
@@ -1,40 +0,0 @@
1
- var Tu=Object.defineProperty;var i=(t,e)=>Tu(t,"name",{value:e,configurable:!0});import{i as ui,t as Cu}from"./rolldown-runtime-ZpX3ckPj.js";import{b as ku,h as Yn,l as te,na as Au,ta as Eu}from"./createLucideIcon-DFq0_SD5.js";import{a as Pa,h as Ru}from"./star-1UakmInq.js";import{d as ju,g as Mu,n as Nu,t as Du,u as Ou,v as Pu}from"./queryKeys-BjE39RB_.js";import{C as Ba,E as Bu,S as $u,w as Lu}from"./ConnectionSetupFlow-CXPACouF.js";import{X as Vu}from"./mention-chips-XGBWyjfr.js";import{r as Fu}from"./responsible-user-denial-Dyl0BwU5.js";import{Bt as Uu,I as qu,Ut as $a,_t as La,an as Ln,at as Va,b as zu,it as Hu,m as Fa,t as Is}from"./router-DxxHzV7q.js";import{a as Wu,c as Ku,i as Ju,n as Qu,o as Yu,r as Gu,s as Xu,t as Zu}from"./alert-dialog-BQFOD0AR.js";import{a as ed,n as di,t as hi}from"./avatar-Cnzd7y-e.js";import{i as On,p as Ua,r as qa,t as za}from"./dropdown-menu-Bv-5gi4Z.js";import{a as td,s as sd,t as nd}from"./MarkdownEditor-CT3CtHAj.js";import{o as rd,r as id,t as od}from"./popover-Dboikzj7.js";import{t as wr}from"./arrow-right-DyLbbrYf.js";import{t as Ts}from"./check-D25gbkia.js";import{t as ts}from"./chevron-down-DRTtaJaL.js";import{t as ad}from"./circle-5aGwoChc.js";import{a as cd,c as ld,d as ud,f as dd,i as hd,n as fd,o as md,p as fi,t as pd}from"./ComposerAddMenu-DvacZ4GQ.js";import{_ as gd,b as bd,d as xd,p as vd,t as Gn,x as Co}from"./MarkdownBody-B_RYK9iU.js";import{t as en}from"./copy-Ck432-6W.js";import{t as Ha}from"./ellipsis-6pUps2JA.js";import{t as yd}from"./eye-off-BzaGKr4m.js";import{t as mi}from"./flag-BWH3doOS.js";import{r as pt,t as Ee}from"./button-Cjm24aCl.js";import{h as _d,p as wd,s as Wa,t as Ka}from"./IssueThreadInteractionCard-ChD6Vc9B.js";import{t as Sd}from"./rotate-ccw-3dpBz4_v.js";import{t as Id}from"./search-DI6_pp-D.js";import{t as Ja}from"./square-BcgffFXM.js";import{t as Td}from"./thumbs-down-DWl2i7Ea.js";import{t as Cd}from"./thumbs-up-Caxf3HRW.js";import{t as Qa}from"./trash-CEP6t-OK.js";import{t as Xn}from"./triangle-alert-8W9BE8a7.js";import{t as kd}from"./x-DezUz_Fi.js";import{i as pi,n as gi,t as bi}from"./tooltip-CrjeF5Py.js";import{t as Jt}from"./badge-D6gWCBB2.js";import{t as rt}from"./AgentAvatar-U9UbHZ2I.js";import{n as Zn}from"./ToastContext-pc_NSDO8.js";import{t as Ad}from"./heartbeats-Dn7f2jm7.js";import{t as Ed}from"./instanceSettings-C68LkOh1.js";import{a as Ya,i as Ga,n as Xa,r as Za,s as ec,t as tc}from"./dialog-B6knjPRK.js";import{r as Qt}from"./assignees-DkQNbPzi.js";import{t as Rd}from"./textarea-yxs96L-d.js";import{t as sc}from"./attachment-icon-0pZ1MbWy.js";import{a as jd,c as Sr,d as Ft,g as Sn,h as ko,l as Md,m as Ut,o as Nd,p as Dd,s as Ao,u as Od,v as Eo}from"./TaskChatComposerTakeoverContext-BM0nPI_N.js";import{t as Pd}from"./InlineEntitySelector-D-qeOeyL.js";import{t as Bd}from"./InlineBanner-CoJqbItc.js";import{t as Cs}from"./clipboard-CTLKYvRL.js";import{t as $r}from"./card-C0pWNeqJ.js";import{_ as $d,a as Ld,d as Vd,i as Fd,l as Ud,n as qd,r as zd,s as Hd}from"./issue-blockers-BfUep25r.js";import{Et as Wd,Ha as nc,P as Vn,Tt as Kd,h as Jd,m as Qd,p as rc}from"./index-CturclrK.js";import{_ as Yd,a as xi,d as Gd,h as Xd,i as Zd,n as eh,p as th,r as sh,s as nh,t as rh}from"./system-notice-comment-yjZiXPNH.js";import{n as ih,r as oh,t as ah}from"./run-log-chunks-ZnzOvrXs.js";import{t as ch}from"./useSecondTick-BZz9TShK.js";import{a as Ro,c as lh,d as uh,f as dh,g as vi,h as hh,i as fh,l as mh,m as ph,r as gh,s as bh,t as Pn}from"./SourceTrustBadge-DPHntkgj.js";import{t as xh}from"./IssueRecoveryActionCard-KN_UxqFa.js";import{t as vh}from"./CommentAttributionChip-BgxQOzqr.js";var x=ui(Au(),1),c=ui(Eu(),1);function jo(t){const e=t.executionWorkspaceId??t.projectWorkspaceId;return t.label??(e?e.slice(0,8):"None")}i(jo,"formatTimelineWorkspaceLabel");function ks(t){return typeof t!="object"||t===null||Array.isArray(t)?null:t}i(ks,"asRecord$2");function Ht(t,e){return Object.prototype.hasOwnProperty.call(t,e)}i(Ht,"hasOwn");function Me(t){return typeof t=="string"&&t.length>0?t:null}i(Me,"nullableString");function Mo(t){return new Date(t).getTime()}i(Mo,"toTimestamp$2");function yh(t,e){return t.agentId===e.agentId&&t.userId===e.userId}i(yh,"sameAssignee");function _h(t,e){return t.projectWorkspaceId===e.projectWorkspaceId&&t.executionWorkspaceId===e.executionWorkspaceId&&t.mode===e.mode&&t.label===e.label}i(_h,"sameWorkspace");function No(t){const e=ks(t);return e?{label:Me(e.label),projectWorkspaceId:Me(e.projectWorkspaceId),executionWorkspaceId:Me(e.executionWorkspaceId),mode:Me(e.mode)}:null}i(No,"workspaceFromRecord");function wh(t){const e=ks(t.workspaceChange);if(!e)return null;const s=No(e.from),n=No(e.to);return!s||!n||_h(s,n)?null:{from:s,to:n}}i(wh,"workspaceChangeFromDetails");function ic(t){return[...t].sort((e,s)=>{const n=Mo(e.createdAt)-Mo(s.createdAt);return n!==0?n:e.id.localeCompare(s.id)})}i(ic,"sortTimelineEvents");function r_(t){const e=[];for(const s of t??[]){if(s.action!=="issue.updated")continue;const n=ks(s.details);if(!n||!Ht(n,"workMode"))continue;const r=ks(n._previous);!r||!Ht(r,"workMode")||e.push({id:s.id,createdAt:s.createdAt,from:Me(r.workMode),to:Me(n.workMode)})}return ic(e)}i(r_,"extractIssueWorkModeChanges");function i_(t){const e=[];for(const s of t??[]){const n=ks(s.details);if(!n)continue;if(s.action==="issue.comment_added"){if(n.followUpRequested!==!0&&n.resumeIntent!==!0||n.reopened===!0)continue;const l=Me(n.commentId);e.push({id:s.id,createdAt:s.createdAt,actorType:s.actorType,actorId:s.actorId,runId:s.runId??null,commentId:l,followUpRequested:!0});continue}if(s.action!=="issue.updated")continue;const r=ks(n._previous),o={id:s.id,createdAt:s.createdAt,actorType:s.actorType,actorId:s.actorId,runId:s.runId??null};if((n.followUpRequested===!0||n.resumeIntent===!0)&&(o.followUpRequested=!0,o.commentId=Me(n.commentId)),Ht(n,"status")){const l=Me(r?.status)??Me(n.reopenedFrom),u=Me(n.status);l!==u&&(o.statusChange={from:l,to:u})}if(Ht(n,"assigneeAgentId")||Ht(n,"assigneeUserId")){const l={agentId:Me(r?.assigneeAgentId),userId:Me(r?.assigneeUserId)},u={agentId:Ht(n,"assigneeAgentId")?Me(n.assigneeAgentId):l.agentId,userId:Ht(n,"assigneeUserId")?Me(n.assigneeUserId):l.userId};yh(l,u)||(o.assigneeChange={from:l,to:u})}const a=wh(n);a&&(o.workspaceChange=a),(o.statusChange||o.assigneeChange||o.workspaceChange||o.followUpRequested)&&e.push(o)}return ic(e)}i(i_,"extractIssueTimelineEvents");var vs=null;function Sh(t,e){t.currentIndex=0,t.wipContextDeps=null,t.wipCommitCallbacks=[];const s=vs;vs=t;try{if(e(),t.isFirstRender=!1,t.cells.length!==t.currentIndex)throw new Error(`Rendered ${t.currentIndex} hooks but expected ${t.cells.length}. Hooks must be called in the exact same order in every render.`)}finally{vs=s}}i(Sh,"withResourceFiber");function et(){if(!vs)throw new Error("No resource fiber available");return vs}i(et,"getCurrentResourceFiber");function Tt(){return vs}i(Tt,"peekResourceFiber");var De=typeof process<"u"&&!1,oc=i(t=>({version:0,committedVersion:0,dispatchUpdate:t,changelog:[],committedLog:[],unsettledCount:0,rollbackCallbacks:[]}),"createResourceFiberRoot"),yi=i(t=>{t.committedVersion=t.version;for(const e of t.changelog)e.logged=!1,e.settled||(e.settled=!0,t.unsettledCount--),t.committedLog.push(e);t.changelog.length=0,t.unsettledCount===0&&(t.committedLog.length=0),t.rollbackCallbacks.length=0},"commitRoot"),Gs=i((t,e)=>{const s=t.version>e;if(t.version=e,s){for(let n=0;n<t.rollbackCallbacks.length;n++)t.rollbackCallbacks[n]();if(t.rollbackCallbacks.length=0,e<=t.committedVersion){const n=[];for(;t.committedVersion-n.length>e;){const r=t.committedLog.pop();if(r===void 0){if(De)throw new Error("tap: committed history is shorter than the replay base.");break}_i(r.fiber,r.cell),r.cell.workInProgress=r.prevState,n.push({record:r,prevState:r.prevState,eagerState:r.eagerState,hasEagerState:r.hasEagerState})}if(n.length>0){const r=t.committedVersion;er(t,()=>{for(let o=n.length-1;o>=0;o--){const a=n[o];a.record.prevState=a.prevState,a.record.eagerState=a.eagerState,a.record.hasEagerState=a.hasEagerState,t.committedLog.push(a.record)}t.committedVersion=r})}t.committedVersion=e;for(const r of t.changelog)r.logged=!1;t.changelog.length=0}else{for(;t.committedVersion+t.changelog.length>e;)t.changelog.pop().logged=!1;for(let n=0;n<t.changelog.length;n++)ac(t.changelog[n]);yi(t)}}},"setRootVersion"),ac=i(t=>{_i(t.fiber,t.cell),t.queued||(t.queued=!0,(t.cell.queue??=[]).push(t))},"applyChangelogRecord"),an=i((t,e)=>{t.wipCommitCallbacks.push(e)},"addCommit"),er=i((t,e)=>{t.rollbackCallbacks.push(e)},"addRollback"),_i=i((t,e)=>{e.isDirty||(e.isDirty=!0,t.markDirty?.(),er(t.root,()=>{if(e.queue!==null){for(const s of e.queue)s.queued=!1;e.queue=null}e.workInProgress=e.current,e.isDirty=!1}))},"markReducerDirty"),cc=Symbol.for("react.memo_cache_sentinel"),lc=i(t=>new Array(t).fill(cc),"createMemoCache"),Ih=i((t,e)=>{const s=t.memoCache;let n=s.workInProgress;if(n===null){const a=s.current;n=a===null?[]:a.map(l=>l.slice()),s.workInProgress=n,er(t.root,()=>{s.workInProgress=null})}const r=s.index++;let o=n[r];return o===void 0?(o=lc(e),n[r]=o):De&&o.length,o},"nextFiberMemoCache"),uc=i(t=>Ih(et(),t),"useMemoCache"),Th=x.default,Ch=i(t=>(0,x.useMemo)(()=>{const e=lc(t);return e[cc]=!0,e},[]),"useReactMemoCacheShim"),kh=Th.__COMPILER_RUNTIME?.c??Ch,Ah=i(()=>Tt()!==null,"inTap$1"),se=i(t=>Ah()?uc(t):kh(t),"c"),Je=i((t,...e)=>Object.assign(Object.create(null),t,...e),"nullProtoRecord"),tr=i(()=>{throw new Error("Rendered more hooks than during the previous render. Hooks must be called in the exact same order in every render.")},"throwRenderedMoreHooks"),sr=i(()=>{throw new Error("Hook order changed between renders")},"throwHookOrderChanged"),Eh=i(t=>({type:t,setup:void 0,setupDeps:void 0,cleanup:void 0,deps:null,generation:0}),"newEffect");function dc(t,e,s){const n=et(),r=n.currentIndex++,o=n.cells[r],a=o===void 0?Eh(s):o.type===s?o:sr();if(o===void 0&&(n.isFirstRender||tr(),n.cells[r]=a,s==="insertion"?(n.insertionCells??=[]).push(a):n.effectCells.push(a)),a.deps!==null&&!!e!=!!a.deps)throw new Error("useEffect called with and without dependencies across re-renders");an(n,()=>{a.setup=t,a.setupDeps=e,a.generation++})}i(dc,"useEffectImpl");function gt(t,e){dc(t,e,"effect")}i(gt,"useEffect$3");var cn=i((t,e)=>{De&&(t.length,e.length);for(let s=0;s<t.length&&s<e.length;s++)if(!Object.is(t[s],e[s]))return!1;return!0},"depsShallowEqual"),Do=i((t,e)=>{an(t,()=>{e.current=e.wip,e.currentDeps=e.wipDeps,e.isDirty=!1})},"addMemoCommit"),nr=i((t,e)=>{const s=et(),n=s.currentIndex++;let r=s.cells[n];if(r===void 0){s.isFirstRender||tr();const l=t();return De&&s.devStrictMode&&t(),r={type:"memo",current:l,currentDeps:e,wip:l,wipDeps:e,isDirty:!1},s.cells[n]=r,l}r.type!=="memo"&&sr();const o=r;if(cn(o.wipDeps,e))return o.isDirty&&Do(s,o),o.wip;const a=t();return De&&s.devStrictMode&&t(),o.wip=a,o.wipDeps=e,o.isDirty||(o.isDirty=!0,er(s.root,()=>{o.wip=o.current,o.wipDeps=o.currentDeps,o.isDirty=!1})),Do(s,o),a},"useMemo$5");function Ds(t){return nr(()=>({current:t}),[])}i(Ds,"useRef$5");var wi=Symbol("tap.Context.defaultValue"),Rh=i(t=>t,"asTap"),st=new Map,Wt=new Set,jh=i(()=>new Map(st),"cloneCurrentTapContext"),Lr=i((t,e)=>{const s=st;st=t;try{return e()}finally{st=s}},"withTapContextRoot"),hc=i((t,e)=>{t[wi]=e},"attachDefaultValueToContext"),fc=i(t=>typeof t=="object"&&t!==null&&wi in t,"isTapContext"),mc=i(t=>typeof t=="object"&&t!==null&&"$$typeof"in t&&t.$$typeof===Symbol.for("react.context"),"isReactContext"),pc=i(t=>fc(t)||mc(t),"isReadableTapContext"),gc=i(t=>{if(!fc(t)){if(mc(t)){hc(t,t._currentValue??t._currentValue2);return}throw new Error("A tap resource's `use()` only accepts a tap context.")}},"assertTapContext"),rr=i((t,e,s)=>{if(typeof t!="object"||t===null)throw new Error("useContextProvider only accepts a React context.");gc(t);const n=t,r=et(),o=Ds(void 0),a=o.current===void 0||!Object.is(o.current.value,e);gt(()=>{o.current={value:e}},[e]);const l=st.get(n),u=l!==void 0||st.has(n);st.set(n,{value:e,source:r});try{return Mh(n,a,s)}finally{u?st.set(n,l):st.delete(n)}},"useContextProvider"),Mh=i((t,e,s)=>{const n=Wt.has(t);e?Wt.add(t):Wt.delete(t);try{return s()}finally{n?Wt.add(t):Wt.delete(t)}},"withChangedContext"),bc=i(t=>{gc(t);const e=t,s=Nh(e,t),n=et();return(n.wipContextDeps??=new Map).set(e,s.source),s.value},"useContext$2"),Nh=i((t,e)=>st.get(t)??{value:Rh(e)[wi],source:null},"getCurrentContextValue"),Dh=i((t,e,s,n)=>{if(!n)return s;let r=s;for(const[o,a]of n)a===e||a===t||(r??=new Map).set(o,a);return r},"mergeContextDeps"),xc=i((t,e=t.wipContextDeps)=>{const s=Tt();!s||!e||(s.wipContextDeps=Dh(s,t,s.wipContextDeps,e))},"bubbleContextDeps"),vc=i(()=>Wt.size>0,"hasChangedContexts"),Si=i(t=>{if(!t.contextDeps||!vc())return!1;for(const e of Wt.keys())if(t.contextDeps.has(e))return!0;return!1},"hasContextDepsChanged"),Oh=i((t,e,s)=>{if(t.isNeverMounted)throw new Error("Resource updated before mount");let n=!1,r=!0;t.root.unsettledCount++,t.root.dispatchUpdate(()=>(n||(n=!0,s&&t.root.changelog.length===0&&!e.cell.isDirty&&!e.hasEagerState&&(e.prevState=e.cell.workInProgress,e.eagerState=s(e.cell.workInProgress,e.action),e.hasEagerState=!0,r=!Object.is(e.cell.current,e.eagerState),!r&&!e.settled&&(e.settled=!0,t.root.unsettledCount--))),r),()=>(n=!0,r=!0,ac(e),e.logged||(e.logged=!0,t.root.changelog.push(e)),!0))},"dispatchOnFiber"),Ph=i((t,e,s,n,r)=>{const o=n?n(s):s;De&&t.devStrictMode&&n&&n(s);const a={type:"reducer",workInProgress:o,current:o,isDirty:!1,queue:null,renderQueue:null,reducer:e,dispatch:i(l=>{const u=Tt();if(u!==null){if(u!==t)throw new Error("Cannot update a resource while rendering a different resource.");(t.renderPendingCells??=new Set).add(a),(a.renderQueue??=[]).push(l)}else{const d={fiber:t,cell:a,action:l,hasEagerState:!1,eagerState:void 0,prevState:a.current,settled:!1,queued:!1,logged:!1};Oh(t,d,r?e:void 0)}},"dispatch")};return a},"createReducerCell");function yc(t,e,s,n){const r=et(),o=r.currentIndex++,a=r.cells[o],l=(()=>{if(a!==void 0)return a.type==="reducer"?a:sr();r.isFirstRender||tr();const d=Ph(r,t,e,s,n);return r.cells[o]=d,d})(),u=l.queue;if(u!==null){const d=t===l.reducer;for(let h=0;h<u.length;h++){const f=u[h];!f.hasEagerState||!d||!Object.is(f.prevState,l.workInProgress)?(f.prevState=l.workInProgress,f.eagerState=t(l.workInProgress,f.action),f.hasEagerState=!0,De&&r.devStrictMode&&(f.eagerState=t(l.workInProgress,f.action))):De&&r.devStrictMode&&t(l.workInProgress,f.action),f.queued=!1,l.workInProgress=f.eagerState}l.queue=null}if(l.reducer=t,l.renderQueue!==null){let d=l.workInProgress;for(const h of l.renderQueue)d=t(d,h);l.renderQueue=null,r.renderPendingCells?.delete(l),Object.is(d,l.workInProgress)||(_i(r,l),l.workInProgress=d)}return l.isDirty&&an(r,()=>{l.current=l.workInProgress,l.isDirty=!1}),[l.workInProgress,l.dispatch]}i(yc,"useReducerImpl");function Ii(t,e,s){return yc(t,e,s,!1)}i(Ii,"useReducer$1");var Bh=i((t,e)=>typeof e=="function"?e(t):e,"stateReducer"),$h=i(t=>t===void 0?void 0:typeof t=="function"?t():t,"stateInit");function _c(t){return yc(Bh,t,$h,!0)}i(_c,"useState$3");var Ti=i((t,e)=>nr(()=>t,e),"useCallback$4");function wc(t,e){dc(t,e,"insertion")}i(wc,"useInsertionEffect$2");function Ci(t){const e=et(),s=Ds(t);return s.current!==t&&an(e,()=>{s.current=t}),Ti(((...n)=>{if(De&&Tt())throw new Error("useEffectEvent cannot be called during render");return s.current(...n)}),[])}i(Ci,"useEffectEvent$1");var Sc=i(t=>t!==null&&typeof t=="object"&&typeof t.then=="function","isThenable$1"),Oo=i(()=>{},"noop"),Lh=i(t=>{const e=t;switch(typeof e.status!="string"?(e.status="pending",t.then(s=>{e.status==="pending"&&(e.status="fulfilled",e.value=s)},s=>{e.status==="pending"&&(e.status="rejected",e.reason=s)})):e.status!=="fulfilled"&&e.status!=="rejected"&&t.then(Oo,Oo),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw t}},"trackThenable"),ki=i(t=>Sc(t)?Lh(t):bc(t),"use$1"),Po=!1,Ic=i((t,e,s=e)=>{const n=et().isNeverMounted,r=n?s():e();De&&!Po&&(!n||s===e)&&(Object.is(r,e())||(Po=!0));const[,o]=Ii(u=>u+1,0),a=Ds(0),l=Ci(()=>{try{if(Object.is(r,e()))return a.current=0,!1}catch{}return!0});return gt(()=>t(()=>{l()&&o()}),[t]),gt(()=>{if(l()){if(++a.current>50)throw a.current=0,new Error("Maximum update depth exceeded. The result of getSnapshot should be cached to avoid an infinite loop.");o()}},[t,r,e]),r},"useSyncExternalStore$1"),Tc=i((t,e)=>{},"useDebugValue$1"),Vh=0,Fh=i(()=>{const t=Ds(null);return t.current??=`:tap${Vh++}:`,t.current},"useId$1"),Cc=i((t,e,s)=>{const n=i(()=>{if(!t)return;const r=e();if(typeof t=="function"){const o=t(r);return typeof o=="function"?o:()=>t(null)}return t.current=r,()=>{t.current=null}},"attach");s==null?gt(n):gt(n,[...s,t])},"useImperativeHandle$2"),Uh=x.default;function qh(t){const e=(0,x.useRef)(t);return(0,x.useInsertionEffect)(()=>{e.current=t}),(0,x.useCallback)(((...s)=>e.current(...s)),[])}i(qh,"useReactEffectEventShim");var zh=Uh.useEffectEvent??qh,Le=i(()=>Tt()!==null,"inTap"),ke=x.default,ye=i(t=>Le()?_c(t):ke.useState(t),"useState$2"),Hh=i((t,e,s)=>Le()?Ii(t,e,s):ke.useReducer(t,e,s),"useReducer"),$e=i(t=>Le()?Ds(t):ke.useRef(t),"useRef$3"),qe=i((t,e)=>Le()?nr(t,e):ke.useMemo(t,e),"useMemo$4"),Wh=i((t,e)=>Le()?Ti(t,e):ke.useCallback(t,e),"useCallback$2"),be=i((t,e)=>Le()?gt(t,e):ke.useEffect(t,e),"useEffect$2"),Kh=i((t,e)=>Le()?gt(t,e):ke.useLayoutEffect(t,e),"useLayoutEffect$1"),Jh=i(t=>Le()?Ci(t):zh(t),"useEffectEvent"),ir=i((t,e,s)=>Le()?Ic(t,e,s):ke.useSyncExternalStore(t,e,s),"useSyncExternalStore"),Qh=i((t,e)=>Le()?Tc(t,e):ke.useDebugValue(t,e),"useDebugValue"),Os=i((t,e)=>Le()?wc(t,e):ke.useInsertionEffect(t,e),"useInsertionEffect"),Yh=i((t,e,s)=>Le()?Cc(t,e,s):ke.useImperativeHandle(t,e,s),"useImperativeHandle$1"),Gh=i(t=>ke.forwardRef(t),"forwardRef$1"),kc=i((t,e)=>ke.memo(t,e),"memo$1"),o_=ke.Fragment,a_=ke.Children,c_=ke.Suspense,ss=i(t=>{const e=ke.createContext(t);return hc(e,t),e},"createContext$1"),Ai=i(t=>Le()&&pc(t)?ki(t):ke.use(t),"use"),or=i(t=>Le()&&pc(t)?ki(t):ke.useContext(t),"useContext$1"),Ct=i((t,e)=>{if(t.length!==0){if(t.length===1)throw t[0];for(const s of t);throw new AggregateError(t,e)}},"throwAggregated"),Xh=50,Ke={schedulers:new Set,isScheduled:!1},nt=null,Vr=[],Ac=class{static{i(this,"UpdateScheduler")}_isDirty=!1;_task;constructor(t){this._task=t}get isDirty(){return this._isDirty}markDirty(){if(nt&&(nt.get(this)??0)>=Xh)throw new Error("Maximum update depth exceeded. This can happen when a resource repeatedly calls setState inside useEffect.");this._isDirty=!0,Ke.schedulers.add(this),Ec()}runTask(){nt?.set(this,(nt.get(this)??0)+1),this._isDirty=!1,this._task()}settle(){this._isDirty=!1}},Zh=[],l_=new Ac(()=>{const t=Zh.splice(0),e=[];for(const s of t)try{s()}catch(n){e.push(n)}Ct(e,"Errors occurred while running scheduled tasks")}),ef=i(t=>{if(nt!==null){Vr.push(t);return}t()},"scheduleNotify"),Ec=i(()=>{Ke.isScheduled||(Ke.isScheduled=!0,tf())},"scheduleFlush"),Fr=i(()=>{const t=nt;nt=new Map;const e=[];try{for(const s of Ke.schedulers)if(Ke.schedulers.delete(s),!!s.isDirty)try{s.runTask()}catch(n){e.push(n)}}finally{if(nt=t,Ke.schedulers.clear(),Ke.isScheduled=!1,nt===null)for(;Vr.length>0;)try{Vr.shift()()}catch(s){e.push(s)}}Ct(e,"Errors occurred during flushSync")},"flushScheduled"),tf=(()=>{if(typeof MessageChannel<"u"){let t=null,e;return()=>{if(!t){const s=new MessageChannel;s.port1.onmessage=()=>{t?.unref?.(),Fr()},t=s.port1,e=s.port2}t.ref?.(),e.postMessage(null)}}return()=>setTimeout(Fr,0)})(),sf=i(t=>{if(nt!==null)return t();const e=Ke;Ke={schedulers:new Set,isScheduled:!0};try{const s=t();return Fr(),s}finally{const s=Ke.schedulers;if(Ke=e,s.size>0){for(const n of s)Ke.schedulers.add(n);Ec()}}},"flushTapSync");function nf(t){if(t.length===0)return;let e;for(let s=0;s<t.length;s++)try{t[s]()}catch(n){(e??=[]).push(n)}e!==void 0&&Ct(e,"Errors during commit")}i(nf,"commitAllCallbacks");function rf(t){const e=t.setup,s=t.setupDeps,n=t.generation;let r;try{const o=e();if(o!==void 0&&typeof o!="function")throw new Error(`An effect function must either return a cleanup function or nothing. Received: ${typeof o}`);r=o}finally{t.generation===n?(t.cleanup=r,t.deps=s):r?.()}}i(rf,"setupEffect");var of=i(t=>t.setup===void 0?!1:t.deps===null||t.setupDeps===void 0?!0:!cn(t.deps,t.setupDeps),"effectNeedsRun");function Bo(t,e){let s;for(const n of t)of(n)&&(s??=[]).push(n);if(s===void 0)return e;for(const n of s)if(n.deps=null,n.cleanup!==void 0)try{n.cleanup()}catch(r){(e??=[]).push(r)}finally{n.cleanup=void 0}for(const n of s)try{rf(n)}catch(r){(e??=[]).push(r)}return e}i(Bo,"reconcileCells");function $o(t,e=!0){let s;t.insertionCells!==null&&e&&(s=Bo(t.insertionCells,s)),s=Bo(t.effectCells,s),s!==void 0&&Ct(s,"Errors during commit")}i($o,"reconcileEffects");function Lo(t){let e;for(const s of t)if(s.deps=null,s.cleanup)try{s.cleanup?.()}catch(n){(e??=[]).push(n)}finally{s.cleanup=void 0}e!==void 0&&Ct(e,"Errors during cleanup")}i(Lo,"cleanupCells");var af={useState:_c,useReducer:Ii,useRef:Ds,useMemo:nr,useCallback:Ti,useEffect:gt,useLayoutEffect:gt,useInsertionEffect:wc,useEffectEvent:Ci,useContext:bc,use:ki,useSyncExternalStore:Ic,useDebugValue:Tc,useId:Fh,useImperativeHandle:Cc,useMemoCache:uc},Vo=x.default,qt=Vo.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE??Vo.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,In=qt==null?null:"H"in qt?{get current(){return qt.H},set current(t){qt.H=t}}:"ReactCurrentDispatcher"in qt?{get current(){return qt.ReactCurrentDispatcher.current},set current(t){qt.ReactCurrentDispatcher.current=t}}:null;function cf(t){if(!In)return t();const e=In.current;In.current=af;try{return t()}finally{In.current=e}}i(cf,"withReactDispatcher");function Rc(t,e,s=void 0,n){return{hook:t,root:e,markDirty:s,devStrictMode:n,cells:[],effectCells:[],insertionCells:null,hostCells:null,contextDeps:null,wipContextDeps:null,wipCommitCallbacks:null,memoCache:{current:null,workInProgress:null,index:0},renderPendingCells:null,currentIndex:0,isFirstRender:!0,isMounted:!1,isReleased:!1,isNeverMounted:!0}}i(Rc,"createResourceFiber");function jc(t){t.wipCommitCallbacks=null,t.wipContextDeps=null,t.memoCache.workInProgress=null}i(jc,"discardWipRender");function As(t,e,s){try{e?(t.isReleased=!0,t.insertionCells!==null&&Lo(t.insertionCells)):t.isMounted&&(t.isMounted=!1,Lo(t.effectCells))}catch(n){(s??=[]).push(n)}if(t.hostCells!==null){for(const n of t.hostCells)if(n.fiber!==null&&(s=As(n.fiber,e,s)),n.fibers!==null)for(const{fiber:r}of n.fibers.values())s=As(r,e,s)}return s}i(As,"cleanupResourceFiber");function Ei(t,e=!0){let s;e&&(s=As(t,!0,s)),s=As(t,!1,s),s!==void 0&&Ct(s,"Errors during cleanup")}i(Ei,"unmountResourceFiber");function Mc(t){let e;for(const s of t)s.isReleased&&(e=As(s,!0,e));for(const s of t)e=As(s,!1,e);e!==void 0&&Ct(e,"Errors during cleanup")}i(Mc,"unmountResourceFibers");function St(t,e){if(t.renderPendingCells!==null){for(const r of t.renderPendingCells)r.renderQueue=null;t.renderPendingCells.clear()}let s=0,n;try{do{if(++s>25)throw new Error("Too many re-renders. tap limits the number of renders to prevent an infinite loop.");t.memoCache.index=0,Sh(t,()=>{n=cf(()=>t.hook(...e))})}while((t.renderPendingCells?.size??0)>0)}catch(r){throw jc(t),r}return xc(t),n}i(St,"renderResourceFiber");function Yt(t){const e=t.wipCommitCallbacks;t.wipCommitCallbacks=null;const s=De&&!t.isMounted&&t.devStrictMode==="root";t.isMounted=!0,t.isNeverMounted=!1,e!==null&&(t.contextDeps=t.wipContextDeps,yi(t.root),t.memoCache.workInProgress!==null&&(t.memoCache.current=t.memoCache.workInProgress,t.memoCache.workInProgress=null),nf(e)),s&&($o(t,e!==null),Ei(t,!1),t.isMounted=!0),$o(t,!s&&e!==null)}i(Yt,"commitResourceFiber");var lf=i(()=>{const t=et();return t.devStrictMode?t.isFirstRender?"child":"root":null},"getTapDevMode"),uf=i(()=>"child","child"),Fo=i(()=>null,"notDevMode"),df=i(()=>{if(!De)return Fo;const t=$e(0);return ye(()=>t.current++),t.current!==2?Fo:uf},"useDevStrictModeReact"),Nc=i(()=>Tt()?lf:df(),"useDevStrictMode"),hf=i(t=>{const e=et(),s=e.currentIndex++,n=e.cells[s];let r;if(n===void 0){e.isFirstRender||tr();const o=t instanceof Map;r={type:"host",fiber:o?null:t,fibers:o?t:null},e.cells[s]=r,(e.hostCells??=[]).push(r)}else n.type!=="host"&&sr(),r=n;return r.fibers===null&&r.fiber!==t&&an(e,()=>{r.fiber=t}),r},"useHostCell"),Uo=i((t,e)=>{if(!(t instanceof Map))return e(t);for(const{fiber:s}of t.values())e(s)},"forEachHostedFiber"),ff=i(t=>{t.isReleased=!1},"acquire"),mf=i(t=>{t.isReleased=!0,t.isMounted||queueMicrotask(()=>{t.isReleased&&Ei(t,!0)})},"release"),pf=i(t=>{Os(()=>(Uo(t,ff),()=>Uo(t,mf)),[t]),be(()=>()=>{Mc(t instanceof Map?Array.from(t.values(),({fiber:e})=>e):[t])},[t])},"useHostLifecycleReact"),ar=i(t=>Tt()?hf(t):(pf(t),null),"useHostLifecycle"),gf=i(()=>{const t=$e(0),e=t.current,s=et();return{version:e,markDirty:qe(()=>()=>{t.current++,s.markDirty?.()},[s]),root:s.root}},"useResourceFiberHostUtilsTap"),bf=i(()=>{const[t]=ye(()=>oc((r,o)=>{let a=!1;n(l=>(a=!r(),a?l:l+1)),a||s(()=>r()&&o())})),[e,s]=Hh((r,o)=>(Gs(t,r),r+(o()?1:0)),0),[,n]=ye(0);return Gs(t,e),{root:t,version:e,markDirty:void 0}},"useResourceFiberHostUtilsReact"),Ri=i(()=>{const t=Nc(),{root:e,version:s,markDirty:n}=Tt()?gf():bf();return{version:s,createFiber:Wh((r,o,a)=>Rc(r,e,a?()=>{a(),n?.()}:n,t()),[])}},"useResourceFiberHost"),xf=i(t=>t(),"useHostRoot"),vf=i(t=>{const e=[];for(const s of t)try{s()}catch(n){e.push(n)}Ct(e,"Errors occurred while notifying Tap root subscribers")},"notifySubscribers$1"),yf=i((t,e,s)=>{const n=new Ac(()=>l.handleUpdate()),r=[],o=oc((u,d)=>{r.length===0&&!u()||(r.push(d),n.markDirty())}),a=Rc(xf,o,void 0,e),l={scheduler:n,queue:r,fiber:a,subscribers:new Set,pendingHostRender:!1,isMounted:!1,hasRendered:!1,committedRender:t,context:new Map,value:void 0,applyQueue:i(()=>{Gs(o,o.committedVersion);for(const u of r)De&&a.devStrictMode&&u(),u();return Gs(o,o.committedVersion+o.changelog.length),r.length},"applyQueue"),publish:i((u,d)=>{n.isDirty||o.committedVersion!==d||l.value===u||(l.value=u,ef(()=>vf(l.subscribers)))},"publish"),finishFlush:i((u,d,h)=>{yi(o),r.splice(0,h),l.pendingHostRender=!1,r.length===0&&n.settle(),l.isMounted&&Yt(a),l.publish(u,d)},"finishFlush"),handleUpdate:i(()=>{const u=l.applyQueue();let d;try{De&&a.devStrictMode&&Lr(l.context,()=>St(a,[l.committedRender])),d=Lr(l.context,()=>St(a,[l.committedRender]))}catch(h){if(Gs(o,o.committedVersion),Sc(h)){const f=i(()=>{l.isMounted&&n.markDirty()},"retry");h.then(f,f);return}if(l.isMounted){l.pendingHostRender=!0,s(f=>f+1);return}throw h}if(n.isDirty)throw new Error("Scheduler is dirty, this should never happen");l.finishFlush(d,o.version,u)},"handleUpdate")};return l},"createInstance"),_f=i(t=>{const[,e]=ye(0),s=Nc(),n=$e(null),r=n.current??=yf(t,s(),e),o=jh(),a=r.scheduler.isDirty||r.pendingHostRender?r.applyQueue():0,l=Lr(o,()=>St(r.fiber,[t])),u={render:t,context:o,value:l,drained:a,wip:r.fiber.wipCommitCallbacks,version:r.fiber.root.version,processed:!1};return r.hasRendered||(r.hasRendered=!0,r.committedRender=t,r.context=o,r.value=l),be(()=>(r.isMounted=!0,()=>{r.isMounted=!1}),[r]),ar(r.fiber),be(()=>{if(u.processed){r.fiber.isMounted||(Yt(r.fiber),r.queue.length&&!r.scheduler.isDirty&&r.scheduler.markDirty());return}if(u.processed=!0,r.committedRender=u.render,r.context=u.context,r.fiber.wipCommitCallbacks!==u.wip){r.scheduler.isDirty||r.handleUpdate();return}if(u.drained>0&&r.fiber.root.version===u.version){r.finishFlush(u.value,u.version,u.drained);return}Yt(r.fiber),r.publish(u.value,u.version)}),qe(()=>({getValue:i(()=>r.value,"getValue"),subscribe:i(d=>(r.subscribers.add(d),()=>r.subscribers.delete(d)),"subscribe")}),[r])},"useTapRoot");function he(t){return(...e)=>({hook:t,args:e})}i(he,"resource");function Oe(t,e,s){return typeof e=="function"?(...n)=>Oe(t,e(...n)):s?{...e,key:t,deps:s}:{...e,key:t}}i(Oe,"withKey");var wf=i((t,e)=>({fiber:t,key:e,currentDeps:null,current:null,wipDeps:null,wip:null}),"createHostState");function kt(t){const{version:e,createFiber:s}=Ri(),n=$e(null),r=n.current??=wf(s(t.hook,t.key),t.key),o=qe(()=>r.fiber.hook===t.hook&&r.key===t.key&&!r.fiber.isReleased?r.fiber:s(t.hook,t.key),[r,t.hook,t.key,s]);r.wipDeps=r.currentDeps,r.wip=r.current;const a=[o,e,t.args];(Si(o)||r.currentDeps===null||!cn(r.currentDeps,a))&&(r.wipDeps=a,r.wip={value:St(o,t.args)});const l=r.wip,u=ar(o);return be(()=>{if(r.currentDeps=r.wipDeps,r.current=r.wip,r.fiber=o,r.key=t.key,Yt(o),u!==null)return()=>{u.fiber!==o&&Ei(o,!0)}},[r,u,o,t.key,l]),l.value}i(kt,"useResource");var Sf=i((t,e,s)=>{const n=$e(null),r=n.current??(n.current={wipDeps:null,wip:null,currentDeps:null,current:null});return r.wipDeps=r.currentDeps,r.wip=r.current,be(()=>{r.currentDeps=r.wipDeps,r.current=r.wip}),!s&&r.currentDeps&&cn(r.currentDeps,e)?r.current:(r.wipDeps=e,r.wip=t(),r.wip)},"useRenderMemo"),qo=i((t,e)=>{const s=t.get(e);s&&(s.isDirty=!0)},"markChildDirty"),If=i((t,e)=>!t.isDirty&&!Si(t.fiber)&&e!==void 0&&t.committedDeps!==void 0&&cn(t.committedDeps,e),"canReuse"),Tf=i(t=>{if(!vc())return!1;for(const{fiber:e}of t.values())if(Si(e))return!0;return!1},"hasAnyChildContextDepsChanged");function ji(t){const[e]=ye(()=>new Map),{version:s,createFiber:n}=Ri(),r=Tf(e);let o=!1;const a=Sf(()=>{const l=new Set,u=[];let d=0;for(let h=0;h<t.length;h++){const f=t[h],p=f.key;if(p===void 0)throw new Error(`useResources did not provide a key for array at index ${h}`);if(l.has(p))throw new Error(`Duplicate key ${p} in useResources`);l.add(p);let m=e.get(p);if(m)if(m.fiber.hook!==f.hook){const g=n(f.hook,f.key,()=>qo(e,p)),b=St(g,f.args);m.next={value:b,deps:f.deps,remount:g},o=!0}else if(If(m,f.deps))typeof m.next=="object"&&jc(m.fiber),m.fiber.contextDeps&&xc(m.fiber,m.fiber.contextDeps),m.next="skip";else{const g=St(m.fiber,f.args);m.next={value:g,deps:f.deps}}else{const g=n(f.hook,f.key,()=>qo(e,p));m={fiber:g,next:{value:St(g,f.args),deps:f.deps},isDirty:!1,committedDeps:void 0,committedValue:void 0},d++,e.set(p,m)}u.push(typeof m.next=="object"?m.next.value:m.committedValue)}if(e.size>u.length-d)for(const h of e.keys())l.has(h)||(e.get(h).next="delete",o=!0);return u},[t,e,n,s],r);return ar(e),be(()=>{if(o){const l=[];for(const[u,d]of e.entries()){const h=d.next;h==="delete"?(l.push(d.fiber),e.delete(u)):h!=="skip"&&h.remount&&(l.push(d.fiber),d.fiber=h.remount)}for(const u of l)u.isReleased=!0;Mc(l)}for(const l of e.values()){const u=l.next;u==="skip"?!l.fiber.isNeverMounted&&!l.fiber.isMounted&&Yt(l.fiber):u!=="delete"&&(Yt(l.fiber),l.committedDeps=u.deps,l.committedValue=u.value,l.isDirty=!1,l.next="skip")}},[a,e,o]),a}i(ji,"useResources");var Cf=i(t=>t(),"useHostRender"),Dc=i(t=>{const{createFiber:e}=Ri(),[s]=ye(()=>e(Cf,void 0)),n=St(s,[t]);ar(s);let r=!1;const o=i(()=>{r&&s.isMounted||(r=!0,Yt(s))},"effects");return be(o),{value:n,effects:o}},"useTapHost"),kf=i(()=>{const t=se(4),[e,s]=ye(Ef);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=i((u,d)=>(s(h=>{const f=Je(h.renderers);return f[u]=[...f[u]??[],d],{...h,renderers:f}}),()=>{s(h=>{const f=Je(h.renderers),p=f[u]?.filter(m=>m!==d)??[];return p.length>0?f[u]=p:delete f[u],{...h,renderers:f}})}),"t0"),t[0]=n):n=t[0];const r=n;let o;t[1]===Symbol.for("react.memo_cache_sentinel")?(o=i(u=>(s(d=>({...d,fallbacks:[...d.fallbacks,u]})),()=>{s(d=>({...d,fallbacks:d.fallbacks.filter(h=>h!==u)}))}),"t1"),t[1]=o):o=t[1];const a=o;let l;return t[2]!==e?(l={getState:i(()=>e,"getState"),setDataUI:r,setFallbackDataUI:a},t[2]=e,t[3]=l):l=t[3],l},"useDataRenderers"),Af=he(kf);function Ef(){return{renderers:Je(),fallbacks:[]}}i(Ef,"_temp$8");var dt=i((t,e,s)=>{const n=i(r=>{},"reportError");for(const r of t)try{const o=r(typeof e=="function"?e():e);o!==null&&(typeof o=="object"||typeof o=="function")&&"then"in o&&typeof o.then=="function"&&Promise.resolve(o).catch(n)}catch(o){n(o)}},"notifyEventListeners"),Oc=i(t=>t,"AuiConfig"),Rf=new Set(["$$typeof","nodeType","then","__v_raw","__v_isRef","__v_isReactive","__v_isReadonly","__v_isShallow","__v_skip"]),Gt=i((t,e)=>{if(t===Symbol.toStringTag)return e;if(typeof t!="symbol"){if(t==="toJSON")return()=>e;if(!Rf.has(t))return!1}},"handleIntrospectionProp"),tn=class{static{i(this,"BaseProxyHandler")}getOwnPropertyDescriptor(t,e){const s=this.get(t,e);if(s!==void 0)return{value:s,writable:!1,enumerable:!0,configurable:!0}}set(){return!1}setPrototypeOf(){return!1}defineProperty(){return!1}deleteProperty(){return!1}preventExtensions(){return!1}},Es=Symbol("assistant-ui.store.clientId"),Ur=Symbol("assistant-ui.store.instanceTag"),Pc=i((t,e)=>{const s=new Proxy((()=>{}),{apply:i(()=>(e(),s),"apply"),get:i((n,r)=>r==="source"?t.source:r==="query"?t.query:r==="name"?t.name:r===Es?Mi(e()):e()[r],"get"),has:i((n,r)=>r==="source"||r==="query"||r==="name"||r===Es||r in e(),"has"),ownKeys:i(()=>Reflect.ownKeys(e()),"ownKeys"),getOwnPropertyDescriptor:i((n,r)=>{if(!(typeof r=="symbol"||!(r in e())))return{value:e()[r],writable:!1,enumerable:!0,configurable:!0}},"getOwnPropertyDescriptor")});return s},"createClientAccessor"),Bc=i((t,e)=>{const s=i(()=>{throw new Error(t)},"fail");return new Proxy((()=>{}),{apply:s,get:i((n,r)=>{if(r==="source"||r==="query")return null;if(r==="name")return e;if(r===Es)return s();const o=Gt(r,"AssistantClientAccessor");return o!==!1?o:s()},"get"),has:i((n,r)=>r==="source"||r==="query"||r==="name","has"),ownKeys:i(()=>[],"ownKeys"),getOwnPropertyDescriptor:i(()=>{},"getOwnPropertyDescriptor")})},"createErrorClientAccessor"),cr=i(t=>t?.source!=null,"isScopeAvailable"),qr=i(t=>t?.source===null,"isScopeUnavailable"),Mi=i(t=>t[Es]??t,"getClientId"),jf=i(t=>t[Ur]??Mi(t),"getClientInstanceId"),Kt=i(t=>t==="optional"||t==="subscribe"||t==="on"||t==="__proto__"||typeof t=="symbol","isIgnoredClientKey"),zr=i(t=>{const e=[];for(const s in t)Kt(s)||e.push(s);return e},"clientScopeKeys"),Mf=class extends tn{static{i(this,"OptionalClientViewProxyHandler")}#e;constructor(t){super(),this.#e=t}get(t,e){const s=Gt(e,"OptionalAssistantClient");if(s!==!1)return s;if(Kt(e))return;const n=this.#e[e];return cr(n)?n:void 0}ownKeys(){return zr(this.#e)}has(t,e){return!Kt(e)&&e in this.#e}},$c=i(t=>new Proxy({},new Mf(t)),"createOptionalClientView"),zo=i(()=>()=>{},"NO_OP_SUBSCRIBE"),Nf="You are using a component or hook that requires an AuiProvider. Wrap your component in an <AuiProvider> component.",Df=class extends tn{static{i(this,"EmptyAssistantClientProxyHandler")}#e;#t;#s;#n;constructor(t,e,s){super(),this.#e=t,this.#t=e,this.#s=s}get(t,e){if(e==="subscribe"||e==="on")return zo;if(e==="optional")return this.#n??=$c(this.#s());const s=Gt(e,this.#e);return s!==!1?s:Bc(this.#t(String(e)),String(e))}ownKeys(){return["subscribe","on","optional"]}getOwnPropertyDescriptor(t,e){if(e!=="optional")return super.getOwnPropertyDescriptor(t,e);const s=this.get(t,e);if(s!==void 0)return{value:s,writable:!1,enumerable:!1,configurable:!0}}has(t,e){return e==="subscribe"||e==="on"||e==="optional"}},Of=i((t,e)=>{const s=new Proxy({},new Df(t,e,()=>s));return s},"createEmptyAssistantClient"),ys=Of("DefaultAssistantClient",()=>Nf),Pf=i(()=>new Proxy({},{get(t,e){const s=Gt(e,"AssistantClient");return s!==!1?s:Bc(`The current scope does not have a "${String(e)}" property.`,String(e))}}),"createRootAssistantClient"),Ni=ss(ys),Bf=i(()=>{},"NOOP_EFFECT"),Lc=new WeakMap,$f=i(t=>Lc.get(t)??Bf,"getTapEffects"),Lf=i((t,e)=>{Lc.set(t,e)},"setTapEffects"),Di=i(()=>or(Ni),"useAssistantContextValue"),Vf=i((t,e)=>rr(Ni,t,e),"useAssistantContextProvider"),Hr=Symbol("assistant-ui.transform-scopes");function Vc(t,e){const s=t;if(s[Hr])throw new Error("transformScopes is already attached to this resource");s[Hr]=e}i(Vc,"attachTransformScopes");function Ff(t){return t[Hr]}i(Ff,"getTransformScopes");var Fc=i(t=>typeof t=="string"?{scope:t.split(".")[0],event:t}:{scope:t.scope,event:t.event},"normalizeEventSelector"),Wr=Symbol("assistant-ui.store.clientIndex"),Uf=i(t=>t[Wr],"getClientIndex"),Uc=ss([]),Oi=i(()=>Ai(Uc),"useClientStack"),qf=i((t,e)=>{const s=se(3),n=Oi();let r;return s[0]!==t||s[1]!==n?(r=[...n,t],s[0]=t,s[1]=n,s[2]=r):r=s[2],rr(Uc,r,e)},"useClientStackProvider"),Fn=Symbol("assistant-ui.store.getValue"),Ho=i(t=>{const e=t[Fn];if(!e)throw new Error("Client scope contains a non-client resource. Ensure your Derived get() returns a client created with useClientResource(), not a plain resource.");return e.getState?.()},"getClientState"),Wo=new Map;function zf(t){let e=Wo.get(t);return e||(e=i(function(...s){if(!this||typeof this!="object")throw new Error(`Method "${String(t)}" called without proper context. This may indicate the function was called incorrectly.`);const n=this[Fn];if(!n)throw new Error(`Method "${String(t)}" called on invalid client proxy. Ensure you are calling this method on a valid client instance.`);const r=n[t];if(!r)throw new Error(`Method "${String(t)}" is not implemented.`);if(typeof r!="function")throw new Error(`"${String(t)}" is not a function.`);return r(...s)},"template"),Wo.set(t,e)),e}i(zf,"getOrCreateProxyFn");var Hf=class extends tn{static{i(this,"ClientProxyHandler")}boundFns;cachedReceiver;outputRef;tagRef;index;self;constructor(t,e,s){super(),this.outputRef=t,this.tagRef=e,this.index=s}get(t,e,s){if(e===Fn)return this.outputRef.current;if(e===Wr)return this.index;if(e===Es)return this.self;if(e===Ur)return this.tagRef.current;const n=Gt(e,"ClientProxy");if(n!==!1)return n;const r=this.outputRef.current[e];if(typeof r=="function"){if(s===void 0)return r;(!this.boundFns||this.cachedReceiver!==s)&&(this.boundFns=new Map,this.cachedReceiver=s);let o=this.boundFns.get(e);return o||(o=zf(e).bind(s),this.boundFns.set(e,o)),o}return r}ownKeys(){return Object.keys(this.outputRef.current)}has(t,e){return e===Fn||e===Wr||e===Es||e===Ur?!0:e in this.outputRef.current}},Rs=i(t=>{const e=$e(null),s=$e(null),n=qe(()=>({}),[t.hook,t.key]),r=Oi().length,o=qe(()=>{const l=new Hf(e,s,r),u=new Proxy({},l);return l.self=u,u},[r]),a=qf(o,i(function(){return kt(t)},"WithClientStack"));return e.current||(e.current=a,s.current=n),be(()=>{e.current=a,s.current=n}),{methods:o,state:a.getState?.(),key:t.key}},"useClientResource"),qc=he(Rs),Un=0,Kr=0,Wf=i(t=>{Un++,Kr++;try{return t()}finally{Kr--,Un++}},"withBatchedStateReads"),Kf=i(t=>{let e;const s=new Map;let n=-1;const r=i(l=>{if(Kr===0)return Ho(t[l]());if(n!==Un)s.clear(),n=Un;else if(s.has(l))return s.get(l);const u=Ho(t[l]());return s.set(l,u),u},"readScopeState");class o extends tn{static{i(this,"OptionalAssistantStateProxyHandler")}get(u,d){const h=Gt(d,"OptionalAssistantState");if(h!==!1)return h;const f=d;if(!Kt(f)&&cr(t[f]))return r(f)}ownKeys(){return zr(t)}has(u,d){return!Kt(d)&&d in t}}class a extends tn{static{i(this,"ProxiedAssistantStateProxyHandler")}get(u,d){const h=Gt(d,"AssistantState");if(h!==!1)return h;if(d==="optional")return e??=new Proxy({},new o);const f=d;if(!Kt(f))return r(f)}ownKeys(){return[...zr(t),"optional"]}has(u,d){return d==="optional"||!Kt(d)&&d in t}}return new Proxy({},new a)},"createProxiedAssistantState"),Ko=new WeakMap,Jf=i(t=>{let e=Ko.get(t);return e||(e=Kf(t),Ko.set(t,e)),e},"getProxiedAssistantState"),zc=ss(null),Jo=Symbol("aui.scope-effect-unapplied"),Qf=i((t,e)=>rr(zc,t,e),"useAssistantTapContextProvider"),Pi=i(()=>{const t=Ai(zc);if(!t)throw new Error("AssistantTapContext is not available");return t},"useAssistantTapContext"),Hc=i(()=>Pi().clientRef,"useAssistantClientRef"),Wc=i((t,e,s)=>{const n=se(8),{clientRef:r}=Pi();let o;n[0]!==r||n[1]!==e||n[2]!==t?(o=i(()=>{const l=r.current;if(l===null)throw new Error("useAssistantScopeEffect ran before the client was committed. This is likely an internal bug in assistant-ui.");const u=i(()=>{const m=r.current?.[t];return m!==void 0&&cr(m)?jf(m):void 0},"identityOf");let d=Jo,h;const f=i(m=>{if(h?.(),h=void 0,d=Jo,m!==void 0){const g=e();h=typeof g=="function"?g:void 0}d=m},"apply");f(u());const p=l.subscribe(()=>{const m=u();m!==d&&f(m)});return()=>{p(),h?.()}},"t0"),n[0]=r,n[1]=e,n[2]=t,n[3]=o):o=n[3];let a;n[4]!==r||n[5]!==s||n[6]!==t?(a=[r,t,...s],n[4]=r,n[5]=s,n[6]=t,n[7]=a):a=n[7],be(o,a)},"useAssistantScopeEffect"),Ps=i(()=>{const t=se(3),{emit:e}=Pi(),s=Oi();let n;return t[0]!==s||t[1]!==e?(n=i((r,o)=>{e(r,o,s)},"t0"),t[0]=s,t[1]=e,t[2]=n):n=t[2],Jh(n)},"useAssistantEmit"),Jr=ss(void 0),Kc=i((t,e)=>{const s=Ai(Jr);return rr(Jr,t??s,e)},"useDestroySignalProvider"),Xt=i((t,e)=>{if(Array.isArray(t)!==Array.isArray(e))return!1;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Object.is(t[n],e[n]))return!1;return!0}const s=Object.keys(t);return s.length===Object.keys(e).length&&s.every(n=>Object.hasOwn(e,n)&&Object.is(t[n],e[n]))},"shallowEqual"),Jc=Symbol("assistant-ui.derived-hook"),Yf=i(t=>{t[Jc]=!0},"markDerivedHook"),Gf=i(t=>t[Jc]===!0,"isDerivedHook"),Qo=i(t=>{},"reportListenerError"),Yo=i((t,e,s)=>{try{const n=t(e,s);n!==null&&(typeof n=="object"||typeof n=="function")&&typeof n.then=="function"&&Promise.resolve(n).catch(Qo)}catch(n){Qo(n)}},"invokeListener"),Xf=i(()=>{const t=new Map,e=new Set,s=new Set;return{on(n,r){const o=r;if(n==="*")return e.add(o),()=>e.delete(o);let a=t.get(n);return a||(a=new Set,t.set(n,a)),a.add(o),()=>{a.delete(o),a.size===0&&t.get(n)===a&&t.delete(n)}},emit(n,r,o){!t.has(n)&&e.size===0||queueMicrotask(()=>{const a=t.get(n);if(a)for(const l of a)Yo(l,r,o);if(e.size>0){const l={event:n,payload:r};for(const u of e)Yo(u,l,o)}})},subscribe(n){return s.add(n),()=>s.delete(n)},notifySubscribers(){Wf(()=>{for(const n of s)try{n()}catch{}})}}},"createNotificationManager"),Qc=i(()=>ye(Xf)[0],"useNotificationManager"),Yc=i(()=>{const[t]=ye(()=>({controller:new AbortController,generation:0}));return Os(()=>{const e=++t.generation;return()=>queueMicrotask(()=>{t.generation===e&&t.controller.abort()})},[t]),t.controller.signal},"useHostDestroySignal"),Qr=i(t=>{const e=qe(()=>({}),[]);return e.v!==void 0&&Xt(e.v,t)?e.v:(e.v=t,t)},"useShallowStable"),Gc=(()=>{try{return!1}catch{return!1}})(),Zf=i((t,e)=>{const s={...t},n=new Set;let r=!0;for(;r;){r=!1;for(const o of Object.values(s)){if(n.has(o.hook))continue;n.add(o.hook);const a=Ff(o.hook);if(a){a(s,e),r=!0;break}}}return s},"applyTransformScopes"),lr=i(t=>Gf(t.hook),"isDerivedElement"),em=i(t=>{if(!lr(t))return{source:"root",query:{}};const e=t.args[0];return{source:e.source,query:e.query??{}}},"metaOf"),Yr=Symbol.for("aui.event-receiver-ref"),Xc=i((t,e)=>{const s=t===ys?Pf():t,n=Object.create(s);Object.assign(n,e);let r;return Object.defineProperty(n,"optional",{get:i(()=>r??=$c(n),"get"),enumerable:!1}),n},"createClientObject"),tm=i(({notifications:t,clientRef:e})=>qe(()=>({subscribe:t.subscribe,on:i(function(s,n){if(!this)throw new Error("const { on } = useAui() is not supported. Use aui.on() instead.");const{scope:r,event:o}=Fc(s),a=s[Yr];if(r!=="*"&&!a&&qr(this[r]))throw new Error(`Scope "${r}" is not available. Use { scope: "*", event: "${o}" } to listen globally.`);const l=t.on(o,(d,h)=>{if(r==="*")return n(d);const f=((a??e).current??this)[r];if(!cr(f))return;const p=Mi(f);if(p===h[Uf(p)])return n(d)});if(r!=="*"){if(a){if(e.parent===ys)return l}else if(qr(e.parent[r]))return l}const u=e.parent.on(s,n);return()=>{l(),u()}},"on")}),[t,e]),"useClientFields"),Zc=i(t=>{const e=se(5);let s;e[0]!==t?(s=em(t),e[0]=t,e[1]=s):s=e[1];const{source:n,query:r}=s,o=Qr(r);let a;return e[2]!==n||e[3]!==o?(a={source:n,query:o},e[2]=n,e[3]=o,e[4]=a):a=e[4],Qr(a)},"useScopeMeta"),sm=i((t,e)=>{const s=se(3);let n;return s[0]!==e||s[1]!==t?(n=e?t:qc(t),s[0]=e,s[1]=t,s[2]=n):n=s[2],kt(n)},"useScopeValue"),nm=i((t,e)=>{const s=Di(),n=lr(e),r=sm(e,n),o=n?r:r.methods,a=Zc(e),l=qe(()=>Pc({name:t,...a},()=>o),[t,a,o]);return s[t]=l,l},"useScopeMount"),rm=he(nm),im=i(t=>{const e=se(2);let s;return e[0]!==t?(s=t.map(hm),e[0]=t,e[1]=s):s=e[1],ji(s)},"useScopeMounts"),el=i((t,e)=>{const s=Qr(e),n=qe(()=>({}),[]);return n.deps!==s&&(n.deps=s,n.client=t),n.client},"useCommittedClient"),tl=i(({parent:t,entries:e,clientRef:s,notifications:n})=>{const r=tm({notifications:n,clientRef:s}),o=Xc(t,r),a=qe(()=>({clientRef:s,emit:n.emit}),[s,n.emit]),l=Qf(a,i(function(){return Vf(o,i(function(){return im(e)},"WithBuildingClient"))},"WithTapContext"));return{client:el(o,[t,...l])}},"useAuiRoot"),om=i(({parent:t,entries:e,destroySignal:s})=>{const n=$e({parent:t,current:null}).current,{value:r,effects:o}=Dc(i(function(){const l=Qc(),{client:u}=Kc(s,i(function(){return tl({parent:t,entries:e,clientRef:n,notifications:l})},"useOwnedRoot"));return be(()=>t.subscribe(l.notifySubscribers),[t,l]),be(()=>l.notifySubscribers()),u},"AssistantClientHost"));return Os(()=>{n.parent=t,n.current=r},[r,t,n]),{client:r,effects:o}},"useHostedAssistantClient"),am=i(({parent:t,entries:e,destroySignal:s})=>{const n=$e({parent:t,current:null}).current,{value:r,effects:o}=Dc(i(function(){const l=Qc(),u=_f(i(function(){return Kc(s,i(function(){return tl({parent:t,entries:e,clientRef:n,notifications:l})},"useOwnedRoot"))},"AuiRoot")),d=ir(u.subscribe,()=>u.getValue().client,()=>u.getValue().client);return be(()=>{const h=i(()=>sf(()=>{n.current=u.getValue().client,l.notifySubscribers()}),"notify"),f=u.subscribe(h),p=t.subscribe(h);return()=>{f(),p()}},[u,t,l]),d},"LegacyAssistantClientHost"));return Os(()=>{n.parent=t,n.current=r},[r,t,n]),{client:r,effects:o}},"useTapRootAssistantClient"),cm=i((t,e,s,n)=>{const{get:r}=n.args[0],o=ir(t.subscribe,()=>r(t),()=>r(t)),a=Zc(n),l=qe(()=>Pc({name:s,...a},()=>o),[s,a,o]);return e[s]=l,l},"useDerivedScopeMount"),lm=i((t,e)=>{if(Gc){const[l]=ye(()=>e.map(([h])=>h).join(",")),u=e.find(([,h])=>!lr(h));if(u)throw new Error(`Scope "${u[0]}" is a root scope but this useAui mounted derived-only; remount with a new key to change scope kinds.`);const d=e.map(([h])=>h).join(",");if(d!==l)throw new Error(`A derived-only config mounted scopes [${l}] but now has [${d}]; remount with a new key to change the scope set.`)}const s=$e({parent:t,current:null}).current,n=i(function(l,u){if(!this)throw new Error("const { on } = useAui() is not supported. Use aui.on() instead.");const{scope:d,event:h}=Fc(l);if(d==="*")return t.on(l,u);const f=l[Yr];if(!f&&qr(this[d]))throw new Error(`Scope "${d}" is not available. Use { scope: "*", event: "${h}" } to listen globally.`);return t.on({scope:d,event:h,[Yr]:f??s},u)},"on"),r=Xc(t,{subscribe:t.subscribe,on:n}),o=e.map(([l,u])=>cm(t,r,l,u)),a=el(r,[t,...o]);return Os(()=>{s.parent=t,s.current=a},[a,t,s]),a},"useDerivedOnlyClient"),um=i((t,e)=>{const s=se(8);let n;s[0]!==e||s[1]!==t?(n=Object.entries(Zf(e,t)),s[0]=e,s[1]=t,s[2]=n):n=s[2];const r=n;let o;s[3]!==r?(o=i(()=>r.length===0||r.some(fm),"t1"),s[3]=r,s[4]=o):o=s[4];const[a]=ye(o);let l;return s[5]!==r||s[6]!==a?(l={entries:r,rooted:a},s[5]=r,s[6]=a,s[7]=l):l=s[7],l},"useScopeEntries"),sl=i((t,e,s,n)=>{const{entries:r,rooted:o}=um(t,e);return o?s({parent:t,entries:r,destroySignal:n}):{client:lm(t,r)}},"useConfiguredAuiImpl"),dm=i((t,e,s)=>sl(t,e,om,s),"useConfiguredAui");function Bi(t){const e=Di();if(t){const s=Yc(),{client:n,effects:r}=sl(e,t,am,s);return r&&Lf(n,r),n}return e}i(Bi,"useAui");function hm(t){const[e,s]=t;return Oe(e,rm(e,s))}i(hm,"_temp$7");function fm(t){const[,e]=t;return!lr(e)}i(fm,"_temp2$6");var mm=i(t=>{const e=se(6),s=Bi();let n;e[0]!==s?(n=Jf(s),e[0]=s,e[1]=n):n=e[1];const r=n;let o,a;e[2]!==r||e[3]!==t?(o=i(()=>t(r),"t1"),a=i(()=>t(r),"t2"),e[2]=r,e[3]=t,e[4]=o,e[5]=a):(o=e[4],a=e[5]);const l=ir(s.subscribe,o,a);if(typeof l=="object"&&l!==null&&(l===r||l===r.optional))throw new Error("You tried to return the entire AssistantState. This is not supported due to technical limitations.");return Qh(l),l},"useAuiState"),nl=i(t=>{const e=se(3),{get:s}=t,n=Bi();let r;return e[0]!==n||e[1]!==s?(r=i(()=>s(n),"t1"),e[0]=n,e[1]=s,e[2]=r):r=e[2],mm(r)},"useDerived");Yf(nl);var Tn=he(nl),rl=i(t=>{if(t.key===void 0)throw new Error("useClientLookup: Element has no key");return t.key},"getElementKey");function it(t){const e=se(12);let s;e[0]!==t?(s=t.map(bm),e[0]=t,e[1]=s):s=e[1];const n=ji(s);let r;e[2]!==t?(r=t.reduce(gm,Object.create(null)),e[2]=t,e[3]=r):r=e[3];const o=r;let a;e[4]!==n?(a=n.map(pm),e[4]=n,e[5]=a):a=e[5];const l=a;let u;e[6]!==o||e[7]!==n?(u=i(h=>{if("index"in h){if(h.index<0||h.index>=n.length)throw new Error(`useClientLookup: index ${h.index} out of bounds (length: ${n.length}) (ignore if recovered)`);return n[h.index].methods}const f=o[h.key];if(f===void 0)throw new Error(`useClientLookup: key "${h.key}" not found (ignore if recovered)`);return n[f].methods},"t3"),e[6]=o,e[7]=n,e[8]=u):u=e[8];let d;return e[9]!==l||e[10]!==u?(d={state:l,get:u},e[9]=l,e[10]=u,e[11]=d):d=e[11],d}i(it,"useClientLookup");function pm(t){return t.state}i(pm,"_temp3$3");function gm(t,e,s){return t[rl(e)]=s,t}i(gm,"_temp2$5");function bm(t){return Oe(rl(t),qc(t),t.deps)}i(bm,"_temp$6");var Xe=Symbol("skip-update"),ht=i((t,...e)=>{const s=[];for(const n of t)try{n(...e)}catch(r){s.push(r)}if(s.length===1)throw s[0];if(s.length>1){for(const n of s);throw new AggregateError(s)}},"notifySubscribers"),Bs=i(t=>{ht(t)},"runCleanups"),$i=i((t,e)=>{try{t()}catch{}throw e},"rollbackSubscription"),il=i((t,e)=>t===void 0||e===void 0?t===e:Xt(t,e),"shallowEqualOrUndefined"),Li=class{static{i(this,"BaseSubscribable")}_subscribers=new Set;subscribe(t){return this._subscribers.add(t),()=>this._subscribers.delete(t)}waitForUpdate(){return new Promise(t=>{const e=this.subscribe(()=>{e(),t()})})}_notifySubscribers(){ht(this._subscribers)}},ur=class{static{i(this,"BaseSubject")}_subscriptions=new Set;_connection;get isConnected(){return!!this._connection}notifySubscribers(t,e){if(e){dt(this._subscriptions,t,e);return}ht(this._subscriptions,t)}_updateConnection(){if(this._subscriptions.size>0){if(this._connection)return;this._connection=this._connect()}else{const t=this._connection;this._connection=void 0,t?.()}}subscribe(t){this._subscriptions.add(t);try{this._updateConnection()}catch(e){throw this._subscriptions.delete(t),e}return()=>{this._subscriptions.delete(t),this._updateConnection()}}},Ge=class extends ur{static{i(this,"ShallowMemoizeSubject")}get path(){return this.binding.path}binding;constructor(t){super(),this.binding=t;const e=t.getState();if(e===Xe)throw new Error("Entry not available in the store");this._previousState=e}_previousState;getState=i(()=>(this.isConnected||this._syncState(),this._previousState),"getState");_syncState(){const t=this.binding.getState();return t===Xe||il(t,this._previousState)?!1:(this._previousState=t,!0)}_connect(){const t=i(()=>{this._syncState()&&this.notifySubscribers()},"callback"),e=this.binding.subscribe(t);try{return this._syncState(),e}catch(s){throw $i(e,s)}}},Vi=class extends ur{static{i(this,"LazyMemoizeSubject")}get path(){return this.binding.path}binding;constructor(t){super(),this.binding=t}_previousStateDirty=!0;_previousState;getState=i(()=>{if(!this.isConnected||this._previousStateDirty){const t=this.binding.getState();t!==Xe&&(this._previousState===void 0||!il(t,this._previousState))&&(this._previousState=t),this._previousStateDirty=!1}if(this._previousState===void 0)throw new Error("Entry not available in the store");return this._previousState},"getState");_connect(){const t=i(()=>{this._previousStateDirty=!0,this.notifySubscribers()},"callback"),e=this.binding.subscribe(t);return this._previousStateDirty=!0,e}},qn=class extends ur{static{i(this,"NestedSubscriptionSubject")}get path(){return this.binding.path}binding;constructor(t){super(),this.binding=t}getState(){return this.binding.getState()}outerSubscribe(t){return this.binding.subscribe(t)}_connect(){const t=i(()=>{this.notifySubscribers()},"callback");let e=this.binding.getState(),s=e?.subscribe(t);const n=i(()=>{const o=this.binding.getState();if(o===e)return;e=o;const a=s;s=void 0;try{a?.()}finally{s=o?.subscribe(t),t()}},"onRuntimeUpdate");let r;try{r=this.outerSubscribe(n)}catch(o){throw $i(()=>s?.(),o)}return()=>Bs([()=>r(),()=>s?.()])}},ol=class extends ur{static{i(this,"EventSubscriptionSubject")}config;constructor(t){super(),this.config=t}getState(){return this.config.binding.getState()}outerSubscribe(t){return this.config.binding.subscribe(t)}_connect(){const t=`Runtime event "${this.config.event}"`,e=i(a=>{this.notifySubscribers(a,t)},"callback");let s=this.config.binding.getState(),n=s?.unstable_on(this.config.event,e);const r=i(()=>{const a=this.config.binding.getState();if(a===s)return;s=a;const l=n;n=void 0;try{l?.()}finally{n=a?.unstable_on(this.config.event,e),this.config.notifyOnRebind&&e({})}},"onRuntimeUpdate");let o;try{o=this.outerSubscribe(r)}catch(a){throw $i(()=>n?.(),a)}return()=>Bs([()=>o(),()=>n?.()])}},Ir=i(t=>{if(!t.overwrite)return t;const{overwrite:e,...s}=t;return s},"stripOverwrite"),xm=i(t=>{const e=Array.from(t).map(n=>n.getModelContext()).sort((n,r)=>(r.priority??0)-(n.priority??0)),s=Je();return e.reduce((n,r)=>{const o=r.priority??0;if(r.system&&(n.system?n.system+=`
2
-
3
- ${r.system}`:n.system=r.system),r.tools)for(const[a,l]of Object.entries(r.tools)){const u=n.tools!==void 0&&Object.hasOwn(n.tools,a)?n.tools[a]:void 0;if(u&&u!==l){const d=s[a];if(d===o){if(!l.overwrite)throw new Error(`You tried to define a tool with the name ${a}, but it already exists.`);n.tools[a]=Ir(l);continue}const h=d>o?u:l,f=d>o?l:u;n.tools[a]=Ir({...f,...h}),s[a]=Math.max(d,o);continue}n.tools||(n.tools=Je()),n.tools[a]=Ir(l),Object.hasOwn(s,a)||(s[a]=o)}return r.config&&(n.config={...r.config,...n.config}),r.callSettings&&(n.callSettings={...r.callSettings,...n.callSettings}),r.unstable_composerMetadata&&(n.unstable_composerMetadata={...r.unstable_composerMetadata,...n.unstable_composerMetadata}),n},{})},"mergeModelContexts"),al=class{static{i(this,"CompositeContextProvider")}_providers=new Map;_providerUnsubscribes=new Map;getModelContext(){return xm(new Set(this._providers.values()))}registerModelContextProvider(t){const e=Symbol();this._providers.set(e,t);let s;try{s=t.subscribe?.(()=>{this.notifySubscribers()})}catch(r){this._providers.delete(e);try{this.notifySubscribers()}catch{}throw r}this._providerUnsubscribes.set(e,s),this.notifySubscribers();let n=!1;return()=>{if(n)return;n=!0,this._providers.delete(e);const r=this._providerUnsubscribes.get(e);this._providerUnsubscribes.delete(e);let o=!1,a;const l=i(u=>{try{u()}catch(d){o||(o=!0,a=d)}},"runCleanup");if(r&&l(r),l(()=>this.notifySubscribers()),o)throw a}}_subscribers=new Set;notifySubscribers(){ht(this._subscribers)}subscribe(t){return this._subscribers.add(t),()=>{this._subscribers.delete(t)}}},vm=i((t,e)=>t.length===e.length&&t.every((s,n)=>Object.is(s,e[n])),"depsEqual"),Go=i((t,e)=>{const[s]=ye(()=>({pending:void 0}));be(()=>{const n=s.pending;s.pending=void 0;let r;return n!==void 0&&vm(n.deps,e)?r=n:(n?.cleanup?.(),r={deps:e,cleanup:t()}),()=>{s.pending=r,queueMicrotask(()=>{s.pending===r&&(s.pending=void 0,r.cleanup?.())})}},e)},"useReplaySafeEffect"),Gr=[],ym={modelName:void 0,toolNames:Gr},_m=i((t,e)=>t===e||Xt(t,e),"toolNamesEqual"),Cn=i((t,e)=>{const s=t.getModelContext(),n=s.config?.modelName,r=s.tools?Object.keys(s.tools).sort():Gr,o=r.length?r:Gr;return n===e.modelName&&_m(o,e.toolNames)?e:{modelName:n,toolNames:o}},"deriveState"),wm=i(()=>{const t=se(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=new al,t[0]=e):e=t[0];const s=e;let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=i(()=>Cn(s,ym),"t1"),t[1]=n):n=t[1];const[r,o]=ye(n);let a,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=i(()=>(o(m=>Cn(s,m)),s.subscribe(()=>{o(m=>Cn(s,m))})),"t2"),l=[s],t[2]=a,t[3]=l):(a=t[2],l=t[3]),be(a,l);let u;t[4]!==r?(u=i(()=>Cn(s,r),"t4"),t[4]=r,t[5]=u):u=t[5];let d,h,f;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=i(()=>s.getModelContext(),"t5"),h=i(m=>s.subscribe(m),"t6"),f=i(m=>s.registerModelContextProvider(m),"t7"),t[6]=d,t[7]=h,t[8]=f):(d=t[6],h=t[7],f=t[8]);let p;return t[9]!==u?(p={getState:u,getModelContext:d,subscribe:h,register:f},t[9]=u,t[10]=p):p=t[10],p},"useModelContext"),cl=he(wm),Sm=i((t,e)=>{if(!(e.status?.type==="running"||e.status?.type==="requires-action")){const n=t.complete;return typeof n!="function"?n??null:n({args:e.args,result:e.result})}const s=t.running;return typeof s!="function"?s??null:s({args:e.args})},"resolveToolCallText"),Im=i(t=>t.display!==void 0?t.display==="standalone":t.type==="human","isStandaloneToolDisplay"),Tm=i(t=>i(function(s){return Sm(t,s)},"ToolCallTextComponent"),"makeToolCallTextComponent"),ll=i(t=>{const e=se(16),{toolkit:s,mcpApp:n}=t;let r;e[0]!==n?(r=n?[Oe("mcpApp",n)]:[],e[0]=n,e[1]=r):r=e[1];const o=ji(r)[0],[a,l]=ye(km);let u;e[2]!==o||e[3]!==a?(u={toolUIs:a,mcpApp:o},e[2]=o,e[3]=a,e[4]=u):u=e[4];const d=u,h=Hc();let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=i((v,y,T)=>{const E={render:y,renderText:T?.renderText,standalone:T?.standalone??!1};return l(C=>{const N=Je(C);return N[v]=[...N[v]??[],E],N}),()=>{l(C=>{const N=C[v]?.filter(M=>M!==E)??[],q=Je(C);return N.length>0?(q[v]=N,q):(delete q[v],q)})}},"t3"),e[5]=f):f=e[5];const p=f;let m,g;e[6]!==s?(m=i(()=>{if(!s)return;const v=[];for(const[y,T]of Object.entries(s)){const E="render"in T?T.render:void 0,C="renderText"in T?T.renderText:void 0,N=E??(C?Tm(C):void 0);N&&v.push(p(y,N,{standalone:Im(T),renderText:C}))}return()=>Bs(v)},"t4"),g=[s,p],e[6]=s,e[7]=m,e[8]=g):(m=e[7],g=e[8]),be(m,g);let b;e[9]!==h||e[10]!==s?(b=i(()=>{if(!s)return;const v=Object.entries(s).reduce(Am,Je());return h.current.modelContext().register({getModelContext:i(()=>({tools:v}),"getModelContext")})},"t6"),e[9]=h,e[10]=s,e[11]=b):b=e[11];let S;e[12]!==s?(S=[s],e[12]=s,e[13]=S):S=e[13],Wc("modelContext",b,S);let w;return e[14]!==d?(w={getState:i(()=>d,"getState"),setToolUI:p},e[14]=d,e[15]=w):w=e[15],w},"useTools"),Cm=he(ll);Vc(ll,(t,e)=>{!t.modelContext&&e.modelContext.source===null&&(t.modelContext=cl())});function km(){return Je()}i(km,"_temp$5");function Am(t,e){const[s,n]=e;if(n.type==="mcp")return t;const{display:r,render:o,renderText:a,...l}=n;return t[s]=l,t}i(Am,"_temp2$4");var ns=i(t=>ir(t.subscribe,t.getState,t.getServerSnapshot),"useSubscribable"),Em=Symbol.for("assistant-ui.silent-runtime-action"),Rm=i(t=>typeof t=="object"&&t!==null&&Em in t,"isSilentRuntimeAction"),ul=i((t,e)=>{const s=e();return s.catch(n=>{Rm(n)}),s},"handleRuntimeAction"),jm=i(t=>{const e=se(9),{runtime:s}=t,n=ns(s);let r;e[0]!==n?(r=i(()=>n,"t1"),e[0]=n,e[1]=r):r=e[1];let o,a;e[2]!==s?(o=i(()=>ul("attachment remove",s.remove),"t2"),a=i(()=>s,"t3"),e[2]=s,e[3]=o,e[4]=a):(o=e[3],a=e[4]);let l;return e[5]!==r||e[6]!==o||e[7]!==a?(l={getState:r,remove:o,__internal_getRuntime:a},e[5]=r,e[6]=o,e[7]=a,e[8]=l):l=e[8],l},"useAttachmentRuntimeClient"),dl=he(jm),Mm=i(t=>{const e=se(5),{runtime:s,index:n}=t;let r;e[0]!==n||e[1]!==s?(r=s.getAttachmentByIndex(n),e[0]=n,e[1]=s,e[2]=r):r=e[2];const o=r;let a;return e[3]!==o?(a=dl({runtime:o}),e[3]=o,e[4]=a):a=e[4],kt(a)},"useComposerAttachmentClientByIndex"),Nm=he(Mm),Dm=i(({item:t,onMove:e,onRemove:s})=>({getState:i(()=>t,"getState"),steer:i(()=>e({lane:"steer",insertAfter:null}),"steer"),move:e,remove:s}),"useQueueItemClient"),Om=he(Dm),Pm=i(t=>{const e=se(65),{threadIdRef:s,messageIdRef:n,runtime:r,isSuggestion:o}=t,a=ns(r),l=Ps(),u=$e(!1);let d,h;e[0]!==l||e[1]!==n||e[2]!==r||e[3]!==s?(d=i(()=>{const k=[],P=r.unstable_on("send",H=>{const Y=u.current;u.current=!1,l("composer.send",{threadId:s.current,...n&&{messageId:n.current},chars:H.chars,attachments:H.attachments,...Y?{suggestion:!0}:void 0})});k.push(P);const L=r.unstable_on("attachmentAdd",H=>{l("composer.attachmentAdd",{threadId:s.current,...n&&{messageId:n.current},...H.contentType?{contentType:H.contentType}:void 0})});return k.push(L),k.push(r.unstable_on("attachmentAddError",H=>{l("composer.attachmentAddError",{threadId:s.current,...n&&{messageId:n.current},...H.attachmentId&&{attachmentId:H.attachmentId},reason:H.reason,message:H.message,...H.contentType?{contentType:H.contentType}:void 0})})),()=>Bs(k)},"t1"),h=[r,l,s,n],e[0]=l,e[1]=n,e[2]=r,e[3]=s,e[4]=d,e[5]=h):(d=e[4],h=e[5]),be(d,h);let f;if(e[6]!==r||e[7]!==a.attachments){let k;e[9]!==r?(k=i((P,L)=>Oe(P.id,Nm({runtime:r,index:L}),[r,L]),"t4"),e[9]=r,e[10]=k):k=e[10],f=a.attachments.map(k),e[6]=r,e[7]=a.attachments,e[8]=f}else f=e[8];const p=it(f),m=a.queue;let g;if(e[11]!==m||e[12]!==r){let k;e[14]!==r?(k=i(P=>Oe(P.id,Om({item:P,onMove:i(L=>r.moveQueueItem(P.id,L),"onMove"),onRemove:i(()=>r.removeQueueItem(P.id),"onRemove")})),"t5"),e[14]=r,e[15]=k):k=e[15],g=m.map(k),e[11]=m,e[12]=r,e[13]=g}else g=e[13];const b=it(g),S=a.type??"thread";let w;e[16]!==p.state||e[17]!==m||e[18]!==a.attachmentAccept||e[19]!==a.canCancel||e[20]!==a.canSend||e[21]!==a.dictation||e[22]!==a.inTransit||e[23]!==a.isEditing||e[24]!==a.isEmpty||e[25]!==a.quote||e[26]!==a.role||e[27]!==a.runConfig||e[28]!==a.submission||e[29]!==a.text||e[30]!==S?(w={text:a.text,role:a.role,attachments:p.state,runConfig:a.runConfig,isEditing:a.isEditing,canCancel:a.canCancel,canSend:a.canSend,attachmentAccept:a.attachmentAccept,isEmpty:a.isEmpty,type:S,dictation:a.dictation,quote:a.quote,queue:m,submission:a.submission,inTransit:a.inTransit},e[16]=p.state,e[17]=m,e[18]=a.attachmentAccept,e[19]=a.canCancel,e[20]=a.canSend,e[21]=a.dictation,e[22]=a.inTransit,e[23]=a.isEditing,e[24]=a.isEmpty,e[25]=a.quote,e[26]=a.role,e[27]=a.runConfig,e[28]=a.submission,e[29]=a.text,e[30]=S,e[31]=w):w=e[31];const v=w;let y;e[32]!==v?(y=i(()=>v,"t7"),e[32]=v,e[33]=y):y=e[33];let T;e[34]!==o||e[35]!==r?(T=i(k=>{const P=r.getState();u.current=P.canSend&&(o?.(P.text)??!1),r.send(k)},"t8"),e[34]=o,e[35]=r,e[36]=T):T=e[36];let E;e[37]!==l||e[38]!==n||e[39]!==r||e[40]!==s?(E=i(()=>{!n&&r.getState().canCancel&&l("composer.cancel",{threadId:s.current}),r.cancel()},"t9"),e[37]=l,e[38]=n,e[39]=r,e[40]=s,e[41]=E):E=e[41];const C=r.beginEdit??Bm;let N;e[42]!==p?(N=i(k=>"id"in k?p.get({key:k.id}):p.get(k),"t11"),e[42]=p,e[43]=N):N=e[43];let q;e[44]!==b?(q=i(k=>"id"in k?b.get({key:k.id}):b.get(k),"t12"),e[44]=b,e[45]=q):q=e[45];let M;e[46]!==r?(M=i(()=>r,"t13"),e[46]=r,e[47]=M):M=e[47];let R;return e[48]!==r.addAttachment||e[49]!==r.clearAttachments||e[50]!==r.reset||e[51]!==r.setQuote||e[52]!==r.setRole||e[53]!==r.setRunConfig||e[54]!==r.setText||e[55]!==r.startDictation||e[56]!==r.stopDictation||e[57]!==C||e[58]!==N||e[59]!==q||e[60]!==M||e[61]!==y||e[62]!==T||e[63]!==E?(R={getState:y,setText:r.setText,setRole:r.setRole,setRunConfig:r.setRunConfig,addAttachment:r.addAttachment,reset:r.reset,clearAttachments:r.clearAttachments,send:T,cancel:E,beginEdit:C,startDictation:r.startDictation,stopDictation:r.stopDictation,setQuote:r.setQuote,attachment:N,queueItem:q,__internal_getRuntime:M},e[48]=r.addAttachment,e[49]=r.clearAttachments,e[50]=r.reset,e[51]=r.setQuote,e[52]=r.setRole,e[53]=r.setRunConfig,e[54]=r.setText,e[55]=r.startDictation,e[56]=r.stopDictation,e[57]=C,e[58]=N,e[59]=q,e[60]=M,e[61]=y,e[62]=T,e[63]=E,e[64]=R):R=e[64],R},"useComposerClient"),hl=he(Pm);function Bm(){throw new Error("beginEdit is not supported in this runtime")}i(Bm,"_temp$4");var fl=i(t=>({get current(){return t()}}),"liveRef"),$m=i(t=>{const e=se(17),{runtime:s}=t,n=ns(s);let r;e[0]!==n?(r=i(()=>n,"t1"),e[0]=n,e[1]=r):r=e[1];let o,a,l;e[2]!==s?(o=i(f=>s.addToolResult(f),"t2"),a=i(f=>s.resumeToolCall(f),"t3"),l=i(f=>s.respondToToolApproval(f),"t4"),e[2]=s,e[3]=o,e[4]=a,e[5]=l):(o=e[3],a=e[4],l=e[5]);let u;e[6]!==s.unstable_recordInteraction?(u=s.unstable_recordInteraction&&{unstable_recordInteraction:i(f=>s.unstable_recordInteraction(f),"unstable_recordInteraction")},e[6]=s.unstable_recordInteraction,e[7]=u):u=e[7];let d;e[8]!==s?(d=i(()=>s,"t6"),e[8]=s,e[9]=d):d=e[9];let h;return e[10]!==r||e[11]!==o||e[12]!==a||e[13]!==l||e[14]!==u||e[15]!==d?(h={getState:r,addToolResult:o,resumeToolCall:a,respondToToolApproval:l,...u,__internal_getRuntime:d},e[10]=r,e[11]=o,e[12]=a,e[13]=l,e[14]=u,e[15]=d,e[16]=h):h=e[16],h},"useMessagePartClient"),Lm=he($m),Vm=i(t=>{const e=se(5),{runtime:s,index:n}=t;let r;e[0]!==n||e[1]!==s?(r=s.getAttachmentByIndex(n),e[0]=n,e[1]=s,e[2]=r):r=e[2];const o=r;let a;return e[3]!==o?(a=dl({runtime:o}),e[3]=o,e[4]=a):a=e[4],kt(a)},"useMessageAttachmentClientByIndex"),Fm=he(Vm),Um=i(t=>{const e=se(5),{runtime:s,index:n}=t;let r;e[0]!==n||e[1]!==s?(r=s.getMessagePartByIndex(n),e[0]=n,e[1]=s,e[2]=r):r=e[2];const o=r;let a;return e[3]!==o?(a=Lm({runtime:o}),e[3]=o,e[4]=a):a=e[4],kt(a)},"useMessagePartByIndex"),qm=he(Um),zm=i(t=>{const e=se(77),{runtime:s,threadIdRef:n,threadId:r,isLast:o}=t,a=ns(s),l=Ps(),[u,d]=ye(!1),[h,f]=ye(!1);let p;e[0]!==s?(p=fl(()=>s.getState().id),e[0]=s,e[1]=p):p=e[1];const m=p,g=$e(a.status);let b;e[2]!==l||e[3]!==s||e[4]!==r?(b=i(A=>{l(A,{threadId:r,messageId:s.getState().id})},"t2"),e[2]=l,e[3]=s,e[4]=r,e[5]=b):b=e[5];const S=b;let w,v;e[6]!==l||e[7]!==a.id||e[8]!==a.status||e[9]!==r?(w=i(()=>{const A=a.status,$=g.current;g.current=A,A?.type==="incomplete"&&A.reason==="error"&&($?.type!=="incomplete"||$.reason!=="error")&&l("message.error",{threadId:r,messageId:a.id,reason:"error"})},"t3"),v=[a.status,a.id,l,r],e[6]=l,e[7]=a.id,e[8]=a.status,e[9]=r,e[10]=w,e[11]=v):(w=e[10],v=e[11]),be(w,v);let y;e[12]!==m||e[13]!==s.composer||e[14]!==n?(y=hl({runtime:s.composer,threadIdRef:n,messageIdRef:m}),e[12]=m,e[13]=s.composer,e[14]=n,e[15]=y):y=e[15];const T=Rs(y);let E;if(e[16]!==s||e[17]!==a.content){let A;e[19]!==s?(A=i(($,K)=>Oe("toolCallId"in $&&$.toolCallId!=null?`toolCallId-${$.toolCallId}`:`index-${K}`,qm({runtime:s,index:K}),[s,K]),"t7"),e[19]=s,e[20]=A):A=e[20],E=a.content.map(A),e[16]=s,e[17]=a.content,e[18]=E}else E=e[18];const C=it(E);let N;e[21]!==a.attachments?(N=a.attachments??[],e[21]=a.attachments,e[22]=N):N=e[22];let q;if(e[23]!==s||e[24]!==N){let A;e[26]!==s?(A=i(($,K)=>Oe($.id,Fm({runtime:s,index:K}),[s,K]),"t9"),e[26]=s,e[27]=A):A=e[27],q=N.map(A),e[23]=s,e[24]=N,e[25]=q}else q=e[25];const M=it(q),R=a;let k;e[28]!==o?(k=o===!1?{isLast:o}:{},e[28]=o,e[29]=k):k=e[29];let P;e[30]!==T.state||e[31]!==u||e[32]!==h||e[33]!==C.state||e[34]!==k||e[35]!==R?(P={...R,...k,parts:C.state,composer:T.state,isCopied:u,isHovering:h},e[30]=T.state,e[31]=u,e[32]=h,e[33]=C.state,e[34]=k,e[35]=R,e[36]=P):P=e[36];const L=P;let H;e[37]!==L?(H=i(()=>L,"t12"),e[37]=L,e[38]=H):H=e[38];let Y;e[39]!==T.methods?(Y=i(()=>T.methods,"t13"),e[39]=T.methods,e[40]=Y):Y=e[40];let I;e[41]!==s?(I=i(()=>s.delete(),"t14"),e[41]=s,e[42]=I):I=e[42];let V,F;e[43]!==S||e[44]!==s?(V=i(A=>(S("message.reload"),s.reload(A)),"t15"),F=i(()=>(S("message.speak"),s.speak()),"t16"),e[43]=S,e[44]=s,e[45]=V,e[46]=F):(V=e[45],F=e[46]);let G,ne;e[47]!==s?(G=i(()=>s.stopSpeaking(),"t17"),ne=i(A=>s.submitFeedback(A),"t18"),e[47]=s,e[48]=G,e[49]=ne):(G=e[48],ne=e[49]);let X;e[50]!==S||e[51]!==s?(X=i(A=>(S("message.branchSwitched"),s.switchToBranch(A)),"t19"),e[50]=S,e[51]=s,e[52]=X):X=e[52];let we;e[53]!==s?(we=i(()=>s.unstable_getCopyText(),"t20"),e[53]=s,e[54]=we):we=e[54];let pe;e[55]!==C?(pe=i(A=>"index"in A?C.get({index:A.index}):C.get({key:`toolCallId-${A.toolCallId}`}),"t21"),e[55]=C,e[56]=pe):pe=e[56];let fe;e[57]!==M?(fe=i(A=>"id"in A?M.get({key:A.id}):M.get(A),"t22"),e[57]=M,e[58]=fe):fe=e[58];let xe;e[59]!==S?(xe=i(A=>{A&&S("message.copied"),d(A)},"t23"),e[59]=S,e[60]=xe):xe=e[60];let ue;e[61]!==s?(ue=i(()=>s,"t24"),e[61]=s,e[62]=ue):ue=e[62];let j;return e[63]!==H||e[64]!==Y||e[65]!==I||e[66]!==V||e[67]!==F||e[68]!==G||e[69]!==ne||e[70]!==X||e[71]!==we||e[72]!==pe||e[73]!==fe||e[74]!==xe||e[75]!==ue?(j={getState:H,composer:Y,delete:I,reload:V,speak:F,stopSpeaking:G,submitFeedback:ne,switchToBranch:X,getCopyText:we,part:pe,attachment:fe,setIsCopied:xe,setIsHovering:f,__internal_getRuntime:ue},e[63]=H,e[64]=Y,e[65]=I,e[66]=V,e[67]=F,e[68]=G,e[69]=ne,e[70]=X,e[71]=we,e[72]=pe,e[73]=fe,e[74]=xe,e[75]=ue,e[76]=j):j=e[76],j},"useMessageClient"),Hm=he(zm),js=i(t=>t.content.filter(e=>e.type==="text").map(e=>e.text).join(`
4
-
5
- `),"getThreadMessageText"),wt=Object.freeze({type:"complete"}),Wm=Object.freeze({type:"running"}),Km=Object.freeze({cancelled:Object.freeze({type:"incomplete",reason:"cancelled"}),length:Object.freeze({type:"incomplete",reason:"length"}),"content-filter":Object.freeze({type:"incomplete",reason:"content-filter"}),other:Object.freeze({type:"incomplete",reason:"other"}),error:Object.freeze({type:"incomplete",reason:"error"})}),ml=i(t=>{const e=t.status;if(!e||typeof e!="object")return;const{type:s}=e;if(s==="running")return Wm;if(s==="complete")return wt;if(s!=="incomplete")return;const{reason:n}=e;return Km[n==="cancelled"||n==="length"||n==="content-filter"||n==="other"||n==="error"?n:"other"]},"normalizePartStatus"),pl=i(t=>t.interrupt!=null||t.approval!=null&&t.approval.approved===void 0&&t.approval.resolution===void 0,"hasPendingToolAction"),gl=i((t,e,s)=>{if(t.role!=="assistant")return wt;if(s.type==="tool-call")return s.result===void 0||s.isPreliminary||pl(s)?t.status:wt;if(t.status.type==="running"){const r=ml(s);if(r)return r}const n=e===Math.max(0,t.content.length-1);return t.status.type==="requires-action"?wt:n?t.status:wt},"toMessagePartStatus"),Jm=i(t=>{const e=se(7),{type:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=[],e[0]=n):n=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r={},e[1]=r):r=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[2]=o):o=e[2];let a;e[3]!==s?(a={isEditing:!1,isEmpty:!0,text:"",attachmentAccept:"*",attachments:n,role:"user",runConfig:r,canCancel:!1,canSend:!1,type:s,dictation:void 0,quote:void 0,queue:o,submission:void 0,inTransit:void 0},e[3]=s,e[4]=a):a=e[4];const l=a;let u;return e[5]!==l?(u={getState:i(()=>l,"getState"),setText:Ym,setRole:Gm,setRunConfig:Xm,addAttachment:Zm,clearAttachments:ep,attachment:tp,reset:sp,send:np,cancel:rp,startDictation:ip,stopDictation:op,beginEdit:ap,setQuote:cp,queueItem:lp},e[5]=l,e[6]=u):u=e[6],u},"useNoOpComposerClient"),Qm=he(Jm);function Ym(){throw new Error("Not supported")}i(Ym,"_temp$3");function Gm(){throw new Error("Not supported")}i(Gm,"_temp2$3");function Xm(){throw new Error("Not supported")}i(Xm,"_temp3$2");function Zm(){throw new Error("Not supported")}i(Zm,"_temp4$1");function ep(){throw new Error("Not supported")}i(ep,"_temp5$1");function tp(){throw new Error("Not supported")}i(tp,"_temp6$1");function sp(){throw new Error("Not supported")}i(sp,"_temp7$1");function np(){throw new Error("Not supported")}i(np,"_temp8$1");function rp(){throw new Error("Not supported")}i(rp,"_temp9$1");function ip(){throw new Error("Not supported")}i(ip,"_temp0$1");function op(){throw new Error("Not supported")}i(op,"_temp1$1");function ap(){throw new Error("Not supported")}i(ap,"_temp10");function cp(){throw new Error("Not supported")}i(cp,"_temp11");function lp(){throw new Error("Not supported")}i(lp,"_temp12");var up=i(t=>{const e=se(8),{part:s,isMessageRunning:n}=t;let r;e[0]!==n||e[1]!==s?(r=n?ml(s)??wt:wt,e[0]=n,e[1]=s,e[2]=r):r=e[2];let o;e[3]!==s||e[4]!==r?(o={...s,status:r},e[3]=s,e[4]=r,e[5]=o):o=e[5];const a=o;let l;return e[6]!==a?(l={getState:i(()=>a,"getState"),addToolResult:gp,resumeToolCall:bp,respondToToolApproval:xp,unstable_recordInteraction:vp},e[6]=a,e[7]=l):l=e[7],l},"useThreadMessagePartClient"),dp=he(up),hp=i(({attachment:t})=>({getState:i(()=>t,"getState"),remove:i(()=>{throw new Error("Not supported")},"remove")}),"useThreadMessageAttachmentClient"),fp=he(hp),mp=i(t=>{const e=se(38),{message:s,index:n,isLast:r,branchNumber:o,branchCount:a,submission:l}=t,u=r===void 0?!0:r,d=o===void 0?1:o,h=a===void 0?1:a,[f,p]=ye(!1),[m,g]=ye(!1),b=s.role==="assistant"&&s.status.type==="running";let S;if(e[0]!==b||e[1]!==s.content){let I;e[3]!==b?(I=i((V,F)=>Oe("toolCallId"in V&&V.toolCallId!=null?`toolCallId-${V.toolCallId}`:`index-${F}`,dp({part:V,isMessageRunning:b}),[V,b]),"t5"),e[3]=b,e[4]=I):I=e[4],S=s.content.map(I),e[0]=b,e[1]=s.content,e[2]=S}else S=e[2];const w=it(S);let v;e[5]!==s.attachments||e[6]!==l?.attachments?(v=l?.attachments??s.attachments??[],e[5]=s.attachments,e[6]=l?.attachments,e[7]=v):v=e[7];let y;e[8]!==v?(y=v.map(yp),e[8]=v,e[9]=y):y=e[9];const T=it(y);let E;e[10]===Symbol.for("react.memo_cache_sentinel")?(E=Qm({type:"edit"}),e[10]=E):E=e[10];const C=Rs(E),N=C.state;let q;e[11]!==h||e[12]!==d||e[13]!==N||e[14]!==n||e[15]!==f||e[16]!==m||e[17]!==u||e[18]!==s||e[19]!==w.state||e[20]!==l?(q={...s,parts:w.state,composer:N,parentId:null,index:n,isLast:u,branchNumber:d,branchCount:h,speech:void 0,isCopied:f,isHovering:m,submission:l},e[11]=h,e[12]=d,e[13]=N,e[14]=n,e[15]=f,e[16]=m,e[17]=u,e[18]=s,e[19]=w.state,e[20]=l,e[21]=q):q=e[21];const M=q;let R;e[22]!==M?(R=i(()=>M,"t9"),e[22]=M,e[23]=R):R=e[23];let k;e[24]!==C.methods?(k=i(()=>C.methods,"t10"),e[24]=C.methods,e[25]=k):k=e[25];let P;e[26]!==w?(P=i(I=>"index"in I?w.get({index:I.index}):w.get({key:`toolCallId-${I.toolCallId}`}),"t11"),e[26]=w,e[27]=P):P=e[27];let L;e[28]!==T?(L=i(I=>"id"in I?T.get({key:I.id}):T.get(I),"t12"),e[28]=T,e[29]=L):L=e[29];let H;e[30]!==s?(H=i(()=>js(s),"t13"),e[30]=s,e[31]=H):H=e[31];let Y;return e[32]!==k||e[33]!==P||e[34]!==L||e[35]!==H||e[36]!==R?(Y={getState:R,composer:k,part:P,attachment:L,delete:_p,reload:wp,speak:Sp,stopSpeaking:Ip,submitFeedback:Tp,switchToBranch:Cp,getCopyText:H,setIsCopied:p,setIsHovering:g},e[32]=k,e[33]=P,e[34]=L,e[35]=H,e[36]=R,e[37]=Y):Y=e[37],Y},"useThreadMessageClient"),pp=he(mp);function gp(){throw new Error("Not supported")}i(gp,"_temp$2");function bp(){throw new Error("Not supported")}i(bp,"_temp2$2");function xp(){throw new Error("Not supported")}i(xp,"_temp3$1");async function vp(){}i(vp,"_temp4");function yp(t){return Oe(t.id,fp({attachment:t}),[t])}i(yp,"_temp5");function _p(){throw new Error("Not supported in ThreadMessageProvider")}i(_p,"_temp6");function wp(){throw new Error("Not supported in ThreadMessageProvider")}i(wp,"_temp7");function Sp(){throw new Error("Not supported in ThreadMessageProvider")}i(Sp,"_temp8");function Ip(){throw new Error("Not supported in ThreadMessageProvider")}i(Ip,"_temp9");function Tp(){throw new Error("Not supported in ThreadMessageProvider")}i(Tp,"_temp0");function Cp(){throw new Error("Not supported in ThreadMessageProvider")}i(Cp,"_temp1");var bl=i((t,e=21)=>(s=e)=>{let n="",r=s|0;for(;r-- >0;)n+=t[Math.random()*t.length|0];return n},"customAlphabet"),ft=bl("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7),kp="__error__",Ap=i(t=>t.startsWith(kp),"isErrorMessageId");function Ep(t){const e=t.match(/^data:([^;,]*)(?:;[^;,]+)*;base64,(.*)$/i);return e?{mimeType:e[1].toLowerCase()||"text/plain",data:e[2]}:null}i(Ep,"parseDataUrl");var Ms={entries:32,payloadLength:16384,logLength:65536},Rp=64,jp=i(t=>{const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null},"isPlainObject"),zn=i((t,e,s)=>{if(t===null)return!0;switch(typeof t){case"string":case"boolean":return!0;case"number":return Number.isFinite(t);case"object":break;default:return!1}if(s>Rp||e.has(t))return!1;e.add(t);const n=Array.isArray(t)?t.every(r=>zn(r,e,s+1)):jp(t)&&Object.values(t).every(r=>zn(r,e,s+1));return e.delete(t),n},"isPlainJSON"),Hn=i(t=>typeof t=="object"&&t!==null&&!Array.isArray(t),"isJSONObjectValue"),xl=i(t=>t==="action"||t==="human-response","isInteractionType");function Mp(t,e=Date.now()){const{type:s,payload:n}=t;if(!xl(s))throw new Error(`Unknown tool interaction type: ${String(s)}`);if(!zn(n,new Set,0))throw new Error("A tool interaction payload must be plain JSON.");if(s==="action"&&!Hn(n))throw new Error("An action interaction payload must be a JSON object.");const r=JSON.stringify(n);if(r.length>Ms.payloadLength)throw new Error(`A tool interaction payload is limited to ${Ms.payloadLength} characters of JSON.`);return{type:s,occurredAt:e,payload:JSON.parse(r)}}i(Mp,"createToolInteraction");function Np(t,e){const s=[...t?.entries??[],e];let n=t?.omitted??0;for(;s.length>1&&(s.length>Ms.entries||JSON.stringify(s).length>Ms.logLength);)s.shift(),n+=1;return n>0?{entries:s,omitted:n}:{entries:s}}i(Np,"appendToolInteraction");var Dp=i(t=>{if(!Hn(t))return;const{type:e,occurredAt:s,payload:n}=t;if(xl(e)&&!(typeof s!="number"||!Number.isFinite(s))&&zn(n,new Set,0))return e==="action"?Hn(n)?{type:e,occurredAt:s,payload:n}:void 0:{type:e,occurredAt:s,payload:n}},"readInteraction");function vl(t){if(!Hn(t))return;const{entries:e,omitted:s}=t,n=Array.isArray(e)?e.flatMap(o=>{const a=Dp(o);return a?[a]:[]}):[];let r=typeof s=="number"&&Number.isInteger(s)&&s>0?s:0;for(;n.length>1&&(n.length>Ms.entries||JSON.stringify(n).length>Ms.logLength);)n.shift(),r+=1;if(!(n.length===0&&r===0))return r>0?{entries:n,omitted:r}:{entries:n}}i(vl,"readToolInteractionLog");async function*Op(){const t=this.getReader();let e=!0;try{for(;;){let s;try{s=await t.read()}catch(r){throw e=!1,r}if(s.done){e=!1;break}const{value:n}=s;yield n}}finally{try{e&&await t.cancel()}finally{t.releaseLock()}}}i(Op,"streamGeneratorPolyfill");function Tr(t){return t[Symbol.asyncIterator]??=Op,t}i(Tr,"asAsyncIterableStream");var Pp=/[0-9a-fA-F]/;function Bp(t){const e=["ROOT"];let s=-1,n=null,r=0;const o=[];let a;function l(){a!==void 0&&(o.push(JSON.parse(`"${a}"`)),a=void 0)}i(l,"pushCurrentKeyToPath");function u(p,m,g){switch(p){case'"':s=m,e.pop(),e.push(g),e.push("INSIDE_STRING"),l();break;case"f":case"t":case"n":s=m,n=m,e.pop(),e.push(g),e.push("INSIDE_LITERAL");break;case"-":e.pop(),e.push(g),e.push("INSIDE_NUMBER"),l();break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":s=m,e.pop(),e.push(g),e.push("INSIDE_NUMBER"),l();break;case"{":s=m,e.pop(),e.push(g),e.push("INSIDE_OBJECT_START"),l();break;case"[":s=m,e.pop(),e.push(g),e.push("INSIDE_ARRAY_START"),l()}}i(u,"processValueStart");function d(p,m){switch(p){case",":e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":s=m,e.pop(),a=o.pop()}}i(d,"processAfterObjectValue");function h(p,m){switch(p){case",":e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA"),a=(Number(a)+1).toString();break;case"]":s=m,e.pop(),a=o.pop()}}i(h,"processAfterArrayValue");for(let p=0;p<t.length;p++){const m=t[p];switch(e[e.length-1]){case"ROOT":u(m,p,"FINISH");break;case"INSIDE_OBJECT_START":switch(m){case'"':e.pop(),e.push("INSIDE_OBJECT_KEY"),a="";break;case"}":s=p,e.pop(),a=o.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":m==='"'&&(e.pop(),e.push("INSIDE_OBJECT_KEY"),a="");break;case"INSIDE_OBJECT_KEY":switch(m){case'"':e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY");break;case"\\":e.push("INSIDE_STRING_ESCAPE"),a+=m;break;default:a+=m}break;case"INSIDE_OBJECT_AFTER_KEY":m===":"&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":u(m,p,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":d(m,p);break;case"INSIDE_STRING":switch(m){case'"':e.pop(),s=p,a=o.pop();break;case"\\":e.push("INSIDE_STRING_ESCAPE");break;default:s=p}break;case"INSIDE_ARRAY_START":m==="]"?(s=p,e.pop(),a=o.pop()):(a="0",u(m,p,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(m){case",":e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA"),a=(Number(a)+1).toString();break;case"]":s=p,e.pop(),a=o.pop();break;default:s=p}break;case"INSIDE_ARRAY_AFTER_COMMA":u(m,p,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":{e.pop();const g=e[e.length-1];m==="u"?(e.push("INSIDE_STRING_UNICODE_ESCAPE"),r=0):g==="INSIDE_STRING"&&(s=p),g==="INSIDE_OBJECT_KEY"&&(a+=m);break}case"INSIDE_STRING_UNICODE_ESCAPE":{const g=e[e.length-2];if(!Pp.test(m)){e.pop(),p--;break}r++,r===4&&(e.pop(),g==="INSIDE_STRING"&&(s=p)),g==="INSIDE_OBJECT_KEY"&&(a+=m);break}case"INSIDE_NUMBER":switch(m){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":s=p;break;case"e":case"E":case"-":case"+":case".":break;case",":e.pop(),a=o.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&h(m,p),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&d(m,p);break;case"}":e.pop(),a=o.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&d(m,p);break;case"]":e.pop(),a=o.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&h(m,p);break;default:e.pop(),a=o.pop()}break;case"INSIDE_LITERAL":{const g=t.substring(n,p+1);!"false".startsWith(g)&&!"true".startsWith(g)&&!"null".startsWith(g)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?d(m,p):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&h(m,p)):s=p;break}}}let f=t.slice(0,s+1);for(let p=e.length-1;p>=0;p--)switch(e[p]){case"INSIDE_STRING":f+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":f+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":f+="]";break;case"INSIDE_LITERAL":{const m=t.substring(n,t.length);"true".startsWith(m)?f+="true".slice(m.length):"false".startsWith(m)?f+="false".slice(m.length):"null".startsWith(m)&&(f+="null".slice(m.length))}}return[f,o]}i(Bp,"fixJson");var $p=Cu(((t,e)=>{var s=typeof Buffer<"u",n=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,r=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function o(d,h,f){f==null&&h!==null&&typeof h=="object"&&(f=h,h=void 0),s&&Buffer.isBuffer(d)&&(d=d.toString()),d&&d.charCodeAt(0)===65279&&(d=d.slice(1));const p=JSON.parse(d,h);if(p===null||typeof p!="object")return p;const m=f&&f.protoAction||"error",g=f&&f.constructorAction||"error";if(m==="ignore"&&g==="ignore")return p;if(m!=="ignore"&&g!=="ignore"){if(n.test(d)===!1&&r.test(d)===!1)return p}else if(m!=="ignore"&&g==="ignore"){if(n.test(d)===!1)return p}else if(r.test(d)===!1)return p;return a(p,{protoAction:m,constructorAction:g,safe:f&&f.safe})}i(o,"_parse");function a(d,{protoAction:h="error",constructorAction:f="error",safe:p}={}){let m=[d];for(;m.length;){const g=m;m=[];for(const b of g){if(h!=="ignore"&&Object.prototype.hasOwnProperty.call(b,"__proto__")){if(p===!0)return null;if(h==="error")throw new SyntaxError("Object contains forbidden prototype property");delete b.__proto__}if(f!=="ignore"&&Object.prototype.hasOwnProperty.call(b,"constructor")&&b.constructor!==null&&typeof b.constructor=="object"&&Object.prototype.hasOwnProperty.call(b.constructor,"prototype")){if(p===!0)return null;if(f==="error")throw new SyntaxError("Object contains forbidden prototype property");delete b.constructor}for(const S in b){const w=b[S];w&&typeof w=="object"&&m.push(w)}}}return d}i(a,"filter");function l(d,h,f){const{stackTraceLimit:p}=Error;Error.stackTraceLimit=0;try{return o(d,h,f)}finally{Error.stackTraceLimit=p}}i(l,"parse");function u(d,h){const{stackTraceLimit:f}=Error;Error.stackTraceLimit=0;try{return o(d,h,{safe:!0})}catch{return}finally{Error.stackTraceLimit=f}}i(u,"safeParse"),e.exports=l,e.exports.default=l,e.exports.parse=l,e.exports.safeParse=u,e.exports.scan=a})),Xr=ui($p(),1),Bn=Symbol("aui.parse-partial-json-object.meta"),Lp=i(t=>t?.[Bn],"getPartialJsonObjectMeta"),Zr=i(t=>{if(t.length===0)return{[Bn]:{state:"partial",partialPath:[]}};try{const e=Xr.default.parse(t);if(typeof e!="object"||e===null)throw new Error("argsText is expected to be an object");return e[Bn]={state:"complete",partialPath:[]},e}catch{try{const[e,s]=Bp(t),n=Xr.default.parse(e);if(typeof n!="object"||n===null)throw new Error("argsText is expected to be an object");return n[Bn]={state:"partial",partialPath:s},n}catch{return}}},"parsePartialJsonObject"),yl=i((t,e,s)=>{if(typeof t!="object"||t===null)return e.state;if(e.state==="complete")return"complete";if(s.length===0)return e.state;const[n,...r]=s;if(!Object.hasOwn(t,n))return"partial";const[o,...a]=e.partialPath;if(n!==o)return"complete";const l=t[n];return yl(l,{state:"partial",partialPath:a},r)},"getFieldState"),sn=i((t,e)=>{const s=Lp(t);if(!s)throw new Error("unable to determine object state");return yl(t,s,e.map(String))},"getPartialJsonObjectFieldState"),Vp=bl("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7),Fi=i(()=>{let t,e;const s=new Promise((n,r)=>{t=n,e=r});if(!t||!e)throw new Error("Failed to create promise");return{promise:s,resolve:t,reject:e}},"promiseWithResolvers"),Fp=i(()=>{const t=[];let e=!1,s=!1,n=!1,r,o,a=0,l,u;const d=i(()=>(o=void 0,u??=Promise.all(t.splice(0).map(async b=>{try{await b.reader.cancel().catch(()=>{}),await b.pipeTask}finally{b.reader.releaseLock()}})).then(()=>{}),u),"cancelAllReaders"),h=i(b=>{s||n||(n=!0,d(),r.error(b),l?.reject(b),l=void 0)},"handleError"),f=i(b=>{b.promise||(b.promise=b.reader.read().then(({done:S,value:w})=>{b.promise=void 0,!(s||n)&&(S?(t.splice(t.indexOf(b),1),b.reader.releaseLock(),e&&t.length===0&&a===0&&r.close()):r.enqueue(w),l?.resolve(),l=void 0)}).catch(h))},"handlePull"),p=new ReadableStream({start(b){r=b},pull(){return l=Fi(),t.forEach(b=>{f(b)}),l.promise},async cancel(){s=!0;const b=d();l?.resolve(),l=void 0,await b}}),m=i(b=>{if(t.length>0&&(o=void 0),!o){const S=[];o=S,a++,Promise.resolve().then(()=>{if(a--,o===S&&(o=void 0),!(s||n)){for(const w of S)r.enqueue(w);e&&t.length===0&&a===0&&r.close(),l?.resolve(),l=void 0}}).catch(h)}o.push(b)},"enqueueRawChunk");return{readable:p,isSealed(){return e},isCancelled(){return s},isErrored(){return n},seal(){e||s||n||(e=!0,t.length===0&&a===0&&r.close())},addStream:i((b,S)=>{const w=S?.catch(()=>{});if(s||n){b.cancel().catch(()=>{});return}if(e)throw b.cancel().catch(()=>{}),new Error("Cannot add streams after the run callback has settled.");o=void 0;const v={reader:b.getReader(),pipeTask:w};t.push(v),f(v)},"addStream"),enqueue(b){if(!(s||n)){if(e)throw new Error("Cannot add streams after the run callback has settled.");m(b)}}}},"createMergeStream"),_l=i((t,e)=>new ReadableStream({start(s){return t.start?.(e(s))},pull(s){return t.pull?.(e(s))},cancel(s){return t.cancel?.(s)}}),"createControllerStream"),wl=i((t,e)=>{let s;return[_l({start(n){s=n},cancel(n){return e?.(s,n)}},t),s]},"createControllerStreamPair"),Sl=i(t=>t instanceof TypeError,"isClosedControllerError"),Ye=i((t,e,s)=>{try{t.enqueue(e)}catch(n){if(!Sl(n))throw n;s?.(n)}},"enqueueIfOpen"),Il=i(t=>{try{t.close()}catch(e){if(!Sl(e))throw e}},"closeIfOpen"),Tl=class{static{i(this,"TextStreamControllerImpl")}_controller;_strict;_isClosed=!1;_warnedDropped=!1;constructor(t,e={}){this._controller=t,this._strict=e.strict??!0}append(t){const e={type:"text-delta",path:[],textDelta:t};if(this._isClosed){if(this._strict)throw new TypeError("Cannot append to a closed TextStreamController");return Ye(this._controller,e,this._warnDroppedAfterClose),this}return Ye(this._controller,e),this}_warnDroppedAfterClose=i(t=>{this._warnedDropped||(this._warnedDropped=!0)},"_warnDroppedAfterClose");close(){this._isClosed||(this._isClosed=!0,Ye(this._controller,{type:"part-finish",path:[]}),Il(this._controller))}},Up=i((t,e={})=>_l(t,s=>new Tl(s,e)),"createTextStream"),Xo=i((t={})=>wl(e=>new Tl(e,t)),"createTextStreamController"),Zo=Symbol.for("aui.tool-response"),ei="<no result>",It=class ti{static{i(this,"ToolResponse")}get[Zo](){return!0}artifact;result;isError;isPreliminary;modelContent;messages;constructor(e){e.artifact!==void 0&&(this.artifact=e.artifact);const s=e.result;this.result=s===void 0?ei:s,this.isError=e.isError??!1,e.isPreliminary&&(this.isPreliminary=!0),e.modelContent!==void 0&&(this.modelContent=e.modelContent),e.messages!==void 0&&(this.messages=e.messages)}static[Symbol.hasInstance](e){return typeof e=="object"&&e!==null&&Zo in e}static toResponse(e){return e instanceof ti?e:new ti({result:e===void 0?ei:e})}},qp=class{static{i(this,"ToolCallStreamControllerImpl")}_isClosed=!1;_mergeTask;_controller;constructor(t,e={}){this._controller=t;const s=Up({start:i(r=>{this._argsTextController=r},"start")},e);let n=!1;this._mergeTask=s.pipeTo(new WritableStream({write:i(r=>{switch(r.type){case"text-delta":n=!0,Ye(this._controller,r);break;case"part-finish":n||Ye(this._controller,{type:"text-delta",textDelta:"{}",path:[]}),Ye(this._controller,{type:"tool-call-args-text-finish",path:[]});break;default:throw new Error(`Unexpected chunk type: ${r.type}`)}},"write")}))}get argsText(){return this._argsTextController}_argsTextController;async setResponse(t){if(this._isClosed)return;const e=t.result;Ye(this._controller,{type:"result",path:[],...t.artifact!==void 0?{artifact:t.artifact}:{},result:e===void 0?ei:e,isError:t.isError??!1,...t.isPreliminary?{isPreliminary:!0}:{},...t.modelContent!==void 0?{modelContent:t.modelContent}:{},...t.messages!==void 0?{messages:t.messages}:{}}),t.isPreliminary?this._argsTextController.close():await this.close()}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,Ye(this._controller,{type:"part-finish",path:[]}),Il(this._controller))}},zp=i((t={})=>wl(e=>new qp(e,t)),"createToolCallStreamController"),Cl=class{static{i(this,"Counter")}value=-1;up(){return++this.value}},Hp=class extends TransformStream{static{i(this,"PathAppendEncoder")}constructor(t){super({transform(e,s){s.enqueue({...e,path:[t,...e.path]})}})}},u_=class extends TransformStream{static{i(this,"PathAppendDecoder")}constructor(t){super({transform(e,s){const{path:[n,...r]}=e;if(t!==n)throw new Error(`Path mismatch: expected ${t}, got ${n}`);s.enqueue({...e,path:r})}})}},Wp=class extends TransformStream{static{i(this,"PathMergeEncoder")}constructor(t){const e=new Cl,s=new Map;super({transform(n,r){n.type==="part-start"&&n.path.length===0&&s.set(e.up(),t.up());const[o,...a]=n.path;if(o===void 0){r.enqueue(n);return}const l=s.get(o);if(l===void 0)throw new Error("Path not found");r.enqueue({...n,path:[l,...a]})}})}},Kp=class kl{static{i(this,"AssistantStreamControllerImpl")}_state;_parentId;constructor(e,s={}){this._state=e||{strict:s.strict??!0,merger:Fp(),contentCounter:new Cl}}get __internal_isClosed(){return this._state.merger.isSealed()||this._state.merger.isCancelled()||this._state.merger.isErrored()}get __internal_isCancelled(){return this._state.merger.isCancelled()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(e){this._state.closeSubscriber=e}_addTransformedStream(e,s){if(e.locked)throw new TypeError("Cannot merge a stream that is already locked to a reader.");const n=e.pipeTo(s.writable).catch(async r=>{throw await s.writable.abort(r).catch(()=>{}),r});this._state.merger.addStream(s.readable,n)}_addPart(e,s){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:"part-start",part:e,path:[]}),this._addTransformedStream(s,new Hp(this._state.contentCounter.value))}merge(e){this._addTransformedStream(e,new Wp(this._state.contentCounter))}appendText(e){(this._state.append?.kind!=="text"||this._state.append.parentId!==this._parentId)&&(this._state.append={kind:"text",parentId:this._parentId,controller:this.addTextPart()}),this._state.append.controller.append(e)}appendReasoning(e,s){(s!==void 0||this._state.append?.kind!=="reasoning"||this._state.append.parentId!==this._parentId)&&(this._state.append={kind:"reasoning",parentId:this._parentId,controller:this.addReasoningPart(s)}),!(s!==void 0&&e.length===0)&&this._state.append.controller.append(e)}addTextPart(){const[e,s]=Xo({strict:this._state.strict});return this._addPart(this._withParentIdOption({type:"text"}),e),s}addReasoningPart(e){const[s,n]=Xo({strict:this._state.strict});return this._addPart(this._withParentIdOption({type:"reasoning",...e}),s),n}addToolCallPart(e){const s=typeof e=="string"?{toolName:e}:e,n=s.toolName,r=s.toolCallId??Vp(),[o,a]=zp({strict:this._state.strict});return this._addPart({type:"tool-call",toolName:n,toolCallId:r,...this._parentId&&{parentId:this._parentId}},o),s.argsText!==void 0&&(a.argsText.append(s.argsText),a.argsText.close()),s.args!==void 0&&(a.argsText.append(JSON.stringify(s.args)),a.argsText.close()),s.response!==void 0&&a.setResponse(s.response),a}_finishedPartStream(){return new ReadableStream({start(e){e.enqueue({type:"part-finish",path:[]}),e.close()}})}_withParentIdOption(e){return this._parentId?{...e,parentId:this._parentId}:e}appendSource(e){this._addPart(this._withParentIdOption(e),this._finishedPartStream())}appendFile(e){this._addPart(this._withParentIdOption(e),this._finishedPartStream())}appendData(e){this._addPart(this._withParentIdOption(e),this._finishedPartStream())}enqueue(e){this._state.merger.enqueue(e),e.type==="part-start"&&e.path.length===0&&this._state.contentCounter.up()}withParentId(e){const s=new kl(this._state);return s._parentId=e,s}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}};function Jp(t,e={}){const s=new Kp(void 0,e);return i(async()=>{try{await t(s)}catch(r){s.__internal_isClosed?s.__internal_isCancelled:s.enqueue({type:"error",path:[],error:String(r)})}finally{s.__internal_isClosed||s.close()}},"runTask")(),s.__internal_getReadable()}i(Jp,"createAssistantStream");function Qp(t={}){const{resolve:e,promise:s}=Fi();let n;return[Jp(r=>(n=r,n.__internal_subscribeToClose(e),s),t),n]}i(Qp,"createAssistantStreamController");var Al=class extends TransformStream{static{i(this,"AssistantMetaTransformStream")}constructor(){const t=[];super({transform(e,s){if(e.type==="part-start"){if(e.path.length!==0){s.error(new Error("Nested parts are not supported"));return}t.push(e.part),s.enqueue(e);return}if(e.type==="text-delta"||e.type==="result"||e.type==="part-finish"||e.type==="tool-call-args-text-finish"){if(e.path.length!==1){s.error(new Error(`${e.type} chunks must have a path of length 1`));return}const n=e.path[0];if(n<0||n>=t.length){s.error(new Error(`Invalid path index: ${n}`));return}const r=t[n];s.enqueue({...e,meta:r});return}s.enqueue(e)}})}},Cr=i((t,e)=>{if(t.startsWith("data-"))return{type:"data",name:t.substring(5),data:e}},"convertDataPrefixedPart"),nn=i((t,e,s)=>{const{role:n,id:r,createdAt:o,attachments:a,status:l,metadata:u}=t,d={id:r??e,createdAt:o??new Date},h=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content,f=i(({image:p,...m})=>typeof p!="string"?null:Ep(p)?.mimeType.startsWith("image/")?{...m,image:p}:/^(https:\/\/|blob:)/i.test(p)?{...m,image:p}:null,"sanitizeImageContent");if(n!=="user"&&a?.length)throw new Error("attachments are only supported for user messages");if(n!=="assistant"&&l)throw new Error("status is only supported for assistant messages");if(n!=="assistant"&&u?.steps)throw new Error("metadata.steps is only supported for assistant messages");switch(n){case"assistant":return{...d,role:n,content:h.map(p=>{const m=p.type;switch(m){case"text":return p.text?.trim()?p:null;case"reasoning":return!p.text?.trim()&&!p.unstable_summary?.trim()?null:p;case"file":case"source":return p;case"image":return f(p);case"data":return p;case"generative-ui":return p;case"tool-call":{const{parentId:g,messages:b,unstable_interactions:S,...w}=p,v=vl(S),y={...w,toolCallId:p.toolCallId||`tool-${ft()}`,...g!==void 0&&{parentId:g},...b!==void 0&&{messages:b},...v!==void 0&&{unstable_interactions:v}};return p.args?{...y,args:p.args,argsText:p.argsText??JSON.stringify(p.args)}:{...y,args:Zr(p.argsText??"")??{},argsText:p.argsText??""}}case"audio":throw new Error(`Unsupported assistant message part type: ${m}`);default:{const g=m,b=Cr(g,p.data);if(b)return b;throw new Error(`Unsupported assistant message part type: ${g}`)}}}).filter(p=>!!p),status:l??s,metadata:{unstable_state:u?.unstable_state??null,unstable_annotations:u?.unstable_annotations??[],unstable_data:u?.unstable_data??[],custom:u?.custom??{},steps:u?.steps??[],...u?.timing&&{timing:u.timing},...u?.submittedFeedback&&{submittedFeedback:u.submittedFeedback},...u?.isOptimistic&&{isOptimistic:!0},...u?.modality&&{modality:u.modality}}};case"user":return{...d,role:n,content:h.map(p=>{const m=p.type;switch(m){case"text":case"image":case"audio":case"file":case"data":return p;case"reasoning":case"source":case"generative-ui":case"tool-call":throw new Error(`Unsupported user message part type: ${m}`);default:{const g=m,b=Cr(g,p.data);if(b)return b;throw new Error(`Unsupported user message part type: ${g}`)}}}),attachments:(a??[]).map(p=>({...p,content:p.content.map(m=>Cr(m.type,m.data)??m)})),metadata:{custom:u?.custom??{},...u?.isOptimistic&&{isOptimistic:!0},...u?.modality&&{modality:u.modality}}};case"system":if(h.length!==1||h[0].type!=="text")throw new Error("System messages must have exactly one text message part.");return{...d,role:n,content:h,metadata:{custom:u?.custom??{}}};default:throw new Error(`Unknown message role: ${n}`)}},"fromThreadMessageLike"),Yp=i(t=>nn({role:t.role,content:t.role==="system"||t.text?[{type:"text",text:t.text}]:[],attachments:[],metadata:{custom:{...t.quote?{quote:t.quote}:{}}}},t.id,{type:"complete",reason:"unknown"}),"submissionThreadMessage"),Gp=i(t=>{const e=qe(()=>({}),[]),s=e.state,n=[];t.suggestions.forEach(o=>{const a=s?.suggestions[n.length];n.push(a&&Xt(a,o)?a:o)});const r=s&&Xt(n,s.suggestions)?s:{suggestions:n};return e.state=r,r},"useStableSuggestionsState"),Xp=i(t=>({getState:i(()=>t,"getState")}),"useSuggestionClient"),Zp=he(Xp),El=i(t=>{const e=se(9),s=Gp(t);let n;e[0]!==s.suggestions?(n=s.suggestions.map(ng),e[0]=s.suggestions,e[1]=n):n=e[1];const r=it(n);let o;e[2]!==s?(o=i(()=>s,"t1"),e[2]=s,e[3]=o):o=e[3];let a;e[4]!==r?(a=i(u=>{const{index:d}=u;return r.get({index:d})},"t2"),e[4]=r,e[5]=a):a=e[5];let l;return e[6]!==o||e[7]!==a?(l={getState:o,suggestion:a},e[6]=o,e[7]=a,e[8]=l):l=e[8],l},"useSuggestionsClient"),eg=i(t=>{const e=se(6);let s;e[0]!==t?(s=t??[],e[0]=t,e[1]=s):s=e[1];let n;e[2]!==s?(n=s.map(rg),e[2]=s,e[3]=n):n=e[3];let r;return e[4]!==n?(r={suggestions:n},e[4]=n,e[5]=r):r=e[5],El(r)},"useStaticSuggestions"),d_=he(eg),tg=i(t=>{const e=se(4);let s;e[0]!==t?(s=t.map(ig),e[0]=t,e[1]=s):s=e[1];let n;return e[2]!==s?(n={suggestions:s},e[2]=s,e[3]=n):n=e[3],El(n)},"useThreadSuggestions"),sg=he(tg);function ng(t,e){return Oe(e,Zp(t),[t])}i(ng,"_temp$1");function rg(t){return typeof t=="string"?{title:t,label:"",prompt:t}:{title:t.title,label:t.label,prompt:t.prompt}}i(rg,"_temp2$1");function ig(t){return{title:t.title??t.prompt,label:t.label??"",prompt:t.prompt}}i(ig,"_temp3");var og=i(t=>"reason"in t?t.reason:void 0,"getStatusReason"),ag=i(t=>"error"in t?t.error:void 0,"getStatusError"),cg=32,Rl=new WeakMap,jl=i(t=>Rl.get(t)??t.id,"getTaskKey"),lg=i((t,e,s)=>"status"in t&&t.status?gl(t,e,s):wt,"resolveStatus"),ug=i(()=>{let t=[],e=new Map;return s=>{const n=[],r=new Map;let o=!0;const a=i((u,d,h,f)=>{if(!(h>cg))for(const[p,m]of u.entries())for(const[g,b]of m.content.entries()){if(b.type!=="tool-call"||b.messages===void 0)continue;const S=b.messages,w=lg(m,g,b),v=og(w),y=ag(w),T=`${f}${p}.${g}`,E=e.get(T),C=E?.part===b&&E.statusType===w.type&&E.statusReason===v&&Object.is(E.statusError,y)&&E.messages===S&&E.task.messageId===m.id&&E.task.parentTaskId===d&&E.task.depth===h?E.task:{id:b.toolCallId,toolName:b.toolName,args:b.args,result:b.result,...b.isError===void 0?void 0:{isError:b.isError},status:w,timing:b.timing,messageId:m.id,parentTaskId:d,depth:h,messages:S};C!==E?.task&&(o=!1,Rl.set(C,T)),n.push(C),r.set(T,{task:C,part:b,statusType:w.type,statusReason:v,statusError:y,messages:S}),a(S,C.id,h+1,`${T}.`)}},"visit");a(s,null,0,"");const l=o&&n.length===t.length&&n.every((u,d)=>u===t[d])?t:n;return t=l,e=r,l}},"createTaskDeriver"),dg=i(({task:t})=>({getState:i(()=>t,"getState")}),"useTaskClient"),hg=he(dg),fg=i(t=>{const e=se(8),{runtime:s,id:n,threadIdRef:r,threadId:o,isLast:a}=t;let l;e[0]!==n||e[1]!==s?(l=s.getMessageById(n),e[0]=n,e[1]=s,e[2]=l):l=e[2];const u=l;let d;return e[3]!==a||e[4]!==u||e[5]!==o||e[6]!==r?(d=Hm({runtime:u,threadIdRef:r,threadId:o,isLast:a}),e[3]=a,e[4]=u,e[5]=o,e[6]=r,e[7]=d):d=e[7],kt(d)},"useMessageClientById"),mg=he(fg),pg=i(t=>{const e=se(111),{runtime:s}=t,n=ns(s),r=Ps();let o,a;e[0]!==r||e[1]!==s?(o=i(()=>{const B=[];for(const O of["runStart","runEnd","initialize","modelContextUpdate"]){const z=s.unstable_on(O,()=>{const U=s.getState()?.threadId||"unknown";r(`thread.${O}`,{threadId:U})});B.push(z)}return B.push(s.unstable_on("toolApprovalAnswered",O=>{const z=s.getState()?.threadId||"unknown";r("thread.toolApprovalAnswered",{threadId:z,...O})})),()=>Bs(B)},"t1"),a=[s,r],e[0]=r,e[1]=s,e[2]=o,e[3]=a):(o=e[2],a=e[3]),be(o,a);let l;e[4]!==s?(l=fl(()=>s.getState().threadId),e[4]=s,e[5]=l):l=e[5];const u=l;let d;e[6]!==r||e[7]!==s?(d=i(B=>{r(B,{threadId:s.getState().threadId})},"t4"),e[6]=r,e[7]=s,e[8]=d):d=e[8];const h=d;let f;e[9]!==s?(f=i(B=>s.getState().suggestions.some(O=>O.prompt===B),"t5"),e[9]=s,e[10]=f):f=e[10];const p=f;let m;e[11]!==p||e[12]!==s.composer||e[13]!==u?(m=hl({runtime:s.composer,threadIdRef:u,isSuggestion:p}),e[11]=p,e[12]=s.composer,e[13]=u,e[14]=m):m=e[14];const g=Rs(m);let b;e[15]!==n.suggestions?(b=sg(n.suggestions),e[15]=n.suggestions,e[16]=b):b=e[16];const S=Rs(b);let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=ug(),e[17]=w):w=e[17];const v=w;let y;e[18]!==n.messages?(y=v(n.messages),e[18]=n.messages,e[19]=y):y=e[19];const T=y;let E;e[20]!==T?(E=T.map(bg),e[20]=T,e[21]=E):E=e[21];const C=it(E),N=g.state.submission,q=g.state.inTransit;let M;e[22]!==q?(M=q??[],e[22]=q,e[23]=M):M=e[23];let R;e[24]!==N?(R=N?[N]:[],e[24]=N,e[25]=R):R=e[25];let k;e[26]!==M||e[27]!==R?(k=[...M,...R],e[26]=M,e[27]=R,e[28]=k):k=e[28];const P=k;let L;e[29]!==P?(L=P.map(Yp),e[29]=P,e[30]=L):L=e[30];const H=L,Y=n.messages.length-1;let I;if(e[31]!==Y||e[32]!==P||e[33]!==H||e[34]!==s||e[35]!==n.messages||e[36]!==n.threadId||e[37]!==u){let B;e[39]!==Y||e[40]!==P.length||e[41]!==s||e[42]!==n.threadId||e[43]!==u?(B=i((U,ae)=>{const W=ae===Y&&P.length>0?!1:void 0;return Oe(U.id,mg({runtime:s,id:U.id,threadIdRef:u,threadId:n.threadId,isLast:W}),[s,U.id,u,n.threadId,W])},"t16"),e[39]=Y,e[40]=P.length,e[41]=s,e[42]=n.threadId,e[43]=u,e[44]=B):B=e[44];const O=n.messages.map(B);let z;e[45]!==P||e[46]!==H||e[47]!==n.messages.length?(z=P.map((U,ae)=>Oe(U.id,pp({message:H[ae],submission:U,index:n.messages.length+ae,isLast:ae===P.length-1}),[H[ae],U,n.messages.length,ae,P.length])),e[45]=P,e[46]=H,e[47]=n.messages.length,e[48]=z):z=e[48],I=[...O,...z],e[31]=Y,e[32]=P,e[33]=H,e[34]=s,e[35]=n.messages,e[36]=n.threadId,e[37]=u,e[38]=I}else I=e[38];const V=it(I),F=V.state.length===0&&!n.isLoading;let G;e[49]!==g.state||e[50]!==V.state||e[51]!==n.capabilities||e[52]!==n.extras||e[53]!==n.isDisabled||e[54]!==n.isLoading||e[55]!==n.isRunning||e[56]!==n.speech||e[57]!==n.state||e[58]!==n.suggestions||e[59]!==n.voice||e[60]!==F||e[61]!==T?(G={isEmpty:F,isDisabled:n.isDisabled,isLoading:n.isLoading,isRunning:n.isRunning,capabilities:n.capabilities,state:n.state,suggestions:n.suggestions,extras:n.extras,speech:n.speech,voice:n.voice,composer:g.state,messages:V.state,tasks:T},e[49]=g.state,e[50]=V.state,e[51]=n.capabilities,e[52]=n.extras,e[53]=n.isDisabled,e[54]=n.isLoading,e[55]=n.isRunning,e[56]=n.speech,e[57]=n.state,e[58]=n.suggestions,e[59]=n.voice,e[60]=F,e[61]=T,e[62]=G):G=e[62];const ne=G;let X;e[63]!==ne?(X=i(()=>ne,"t18"),e[63]=ne,e[64]=X):X=e[64];let we;e[65]!==g.methods?(we=i(()=>g.methods,"t19"),e[65]=g.methods,e[66]=we):we=e[66];let pe;e[67]!==S?(pe=i(()=>S.methods,"t20"),e[67]=S,e[68]=pe):pe=e[68];let fe;e[69]!==C||e[70]!==T?(fe=i(B=>{if("id"in B){const O=T.find(z=>z.id===B.id);return C.get({key:O?jl(O):B.id})}return C.get(B)},"t21"),e[69]=C,e[70]=T,e[71]=fe):fe=e[71];let xe;e[72]!==r||e[73]!==p||e[74]!==s?(xe=i(B=>{const O=typeof B=="string"?{content:[{type:"text",text:B}]}:B;if((O.role??"user")==="user"){const z=O.content.map(xg).join("");r("composer.send",{threadId:s.getState().threadId,chars:z.length,attachments:O.attachments?.length??0,...p(z)?{suggestion:!0}:void 0})}s.append(B)},"t22"),e[72]=r,e[73]=p,e[74]=s,e[75]=xe):xe=e[75];let ue;e[76]!==h||e[77]!==s||e[78]!==n.isRunning?(ue=i(()=>{n.isRunning&&h("thread.cancelRun"),s.cancelRun()},"t23"),e[76]=h,e[77]=s,e[78]=n.isRunning,e[79]=ue):ue=e[79];let j;e[80]!==h||e[81]!==s?(j=i(()=>{s.connectVoice(),h("thread.voiceStarted")},"t24"),e[80]=h,e[81]=s,e[82]=j):j=e[82];let A;e[83]!==V?(A=i(B=>"id"in B?V.get({key:B.id}):V.get(B),"t25"),e[83]=V,e[84]=A):A=e[84];let $;e[85]!==s?($=i(()=>s,"t26"),e[85]=s,e[86]=$):$=e[86];let K;return e[87]!==s.deleteMessage||e[88]!==s.disconnectVoice||e[89]!==s.export||e[90]!==s.getModelContext||e[91]!==s.getVoiceVolume||e[92]!==s.import||e[93]!==s.importExternalState||e[94]!==s.muteVoice||e[95]!==s.reset||e[96]!==s.resumeRun||e[97]!==s.startRun||e[98]!==s.stopSpeaking||e[99]!==s.subscribeVoiceVolume||e[100]!==s.unmuteVoice||e[101]!==X||e[102]!==we||e[103]!==pe||e[104]!==fe||e[105]!==xe||e[106]!==ue||e[107]!==j||e[108]!==A||e[109]!==$?(K={getState:X,composer:we,suggestions:pe,task:fe,append:xe,deleteMessage:s.deleteMessage,startRun:s.startRun,resumeRun:s.resumeRun,importExternalState:s.importExternalState,cancelRun:ue,getModelContext:s.getModelContext,export:s.export,import:s.import,reset:s.reset,stopSpeaking:s.stopSpeaking,connectVoice:j,disconnectVoice:s.disconnectVoice,getVoiceVolume:s.getVoiceVolume,subscribeVoiceVolume:s.subscribeVoiceVolume,muteVoice:s.muteVoice,unmuteVoice:s.unmuteVoice,message:A,__internal_getRuntime:$},e[87]=s.deleteMessage,e[88]=s.disconnectVoice,e[89]=s.export,e[90]=s.getModelContext,e[91]=s.getVoiceVolume,e[92]=s.import,e[93]=s.importExternalState,e[94]=s.muteVoice,e[95]=s.reset,e[96]=s.resumeRun,e[97]=s.startRun,e[98]=s.stopSpeaking,e[99]=s.subscribeVoiceVolume,e[100]=s.unmuteVoice,e[101]=X,e[102]=we,e[103]=pe,e[104]=fe,e[105]=xe,e[106]=ue,e[107]=j,e[108]=A,e[109]=$,e[110]=K):K=e[110],K},"useThreadClient"),gg=he(pg);function bg(t){return Oe(jl(t),hg({task:t}),[t])}i(bg,"_temp");function xg(t){return t.type==="text"?t.text:""}i(xg,"_temp2");var vg=i(t=>{const e=se(4),s=Ps(),n=$e(t);let r,o;e[0]!==s||e[1]!==t?(r=i(()=>{const a=n.current;a!==t&&(n.current=t,s("threads.selectionChanged",{threadId:t,previousThreadId:a}))},"t0"),o=[t,s],e[0]=s,e[1]=t,e[2]=r,e[3]=o):(r=e[2],o=e[3]),be(r,o)},"useThreadSelectionEvents"),yg=i((t,e,s)=>{const n=se(8),r=s===void 0?e:s,o=Ps(),a=e&&r;let l;n[0]!==a||n[1]!==t?(l={isMain:a,threadId:t},n[0]=a,n[1]=t,n[2]=l):l=n[2];const u=$e(l);let d,h;n[3]!==o||n[4]!==e||n[5]!==t?(d=i(()=>{const f=u.current;f.isMain===e&&f.threadId===t||(u.current={isMain:e,threadId:t},o(e?"threadListItem.switchedTo":"threadListItem.switchedAway",{threadId:t}))},"t3"),h=[e,t,o],n[3]=o,n[4]=e,n[5]=t,n[6]=d,n[7]=h):(d=n[6],h=n[7]),be(d,h)},"useThreadListItemSelectionEvents"),ut=i((t,e)=>ul(`thread list ${t}`,e),"handleThreadListAction"),_g=i(t=>{const e=se(27),{runtime:s,mainThreadIsRunning:n}=t,r=n===void 0?!1:n,o=ns(s);let a;e:{const v=o.isRunning||o.isMain&&r;if(v===o.isRunning){a=o;break e}let y;e[0]!==v||e[1]!==o?(y={...o,isRunning:v},e[0]=v,e[1]=o,e[2]=y):y=e[2],a=y}const l=a;yg(o.id,o.isMain);let u;e[3]!==l?(u=i(()=>l,"t3"),e[3]=l,e[4]=u):u=e[4];let d,h,f,p,m,g,b;e[5]!==s?(h=i(v=>ut("switch",()=>s.switchTo(v)),"t4"),f=i(v=>ut("rename",()=>s.rename(v)),"t5"),p=i(v=>ut("update custom metadata",()=>s.updateCustom(v)),"t6"),m=i(()=>ut("archive",()=>s.archive()),"t7"),g=i(()=>ut("unarchive",()=>s.unarchive()),"t8"),b=i(()=>ut("delete",()=>s.delete()),"t9"),d=i(v=>ut("generate title",()=>s.generateTitle(v)),"t10"),e[5]=s,e[6]=d,e[7]=h,e[8]=f,e[9]=p,e[10]=m,e[11]=g,e[12]=b):(d=e[6],h=e[7],f=e[8],p=e[9],m=e[10],g=e[11],b=e[12]);let S;e[13]!==s?(S=i(()=>s,"t11"),e[13]=s,e[14]=S):S=e[14];let w;return e[15]!==s.detach||e[16]!==s.initialize||e[17]!==d||e[18]!==S||e[19]!==u||e[20]!==h||e[21]!==f||e[22]!==p||e[23]!==m||e[24]!==g||e[25]!==b?(w={getState:u,switchTo:h,rename:f,updateCustom:p,archive:m,unarchive:g,delete:b,generateTitle:d,initialize:s.initialize,detach:s.detach,__internal_getRuntime:S},e[15]=s.detach,e[16]=s.initialize,e[17]=d,e[18]=S,e[19]=u,e[20]=h,e[21]=f,e[22]=p,e[23]=m,e[24]=g,e[25]=b,e[26]=w):w=e[26],w},"useThreadListItemClient"),wg=he(_g),Sg=i(t=>{const e=se(6),{runtime:s,id:n,mainThreadIsRunning:r}=t;let o;e[0]!==n||e[1]!==s?(o=s.getItemById(n),e[0]=n,e[1]=s,e[2]=o):o=e[2];const a=o;let l;return e[3]!==r||e[4]!==a?(l=wg({runtime:a,mainThreadIsRunning:r}),e[3]=r,e[4]=a,e[5]=l):l=e[5],kt(l)},"useThreadListItemClientById"),Ig=he(Sg),Tg=i(t=>{const e=se(48),{runtime:s,__internal_assistantRuntime:n}=t,r=ns(s);vg(r.mainThreadId);const o=Ps();let a,l;e[0]!==o||e[1]!==s?(a=i(()=>s.unstable_subscribeThreadEvents(R=>{const{threadId:k,type:P}=R;k!==s.getState().mainThreadId&&o(`thread.${P}`,{threadId:k})}),"t1"),l=[s,o],e[0]=o,e[1]=s,e[2]=a,e[3]=l):(a=e[2],l=e[3]),be(a,l);let u;e[4]!==s.main?(u=gg({runtime:s.main}),e[4]=s.main,e[5]=u):u=e[5];const d=Rs(u);let h;e[6]!==d.state||e[7]!==s||e[8]!==r.threadItems?(h=Object.keys(r.threadItems).map(R=>Oe(R,Ig({runtime:s,id:R,mainThreadIsRunning:d.state.isRunning}),[s,R,d.state.isRunning])),e[6]=d.state,e[7]=s,e[8]=r.threadItems,e[9]=h):h=e[9];const f=it(h),p=r.newThreadId??null;let m;e[10]!==d.state||e[11]!==r.archivedThreadIds||e[12]!==r.hasMore||e[13]!==r.isLoading||e[14]!==r.isLoadingMore||e[15]!==r.loadError||e[16]!==r.mainThreadId||e[17]!==r.threadIds||e[18]!==p||e[19]!==f.state?(m={mainThreadId:r.mainThreadId,newThreadId:p,isLoading:r.isLoading,loadError:r.loadError,isLoadingMore:r.isLoadingMore,hasMore:r.hasMore,threadIds:r.threadIds,archivedThreadIds:r.archivedThreadIds,threadItems:f.state,main:d.state},e[10]=d.state,e[11]=r.archivedThreadIds,e[12]=r.hasMore,e[13]=r.isLoading,e[14]=r.isLoadingMore,e[15]=r.loadError,e[16]=r.mainThreadId,e[17]=r.threadIds,e[18]=p,e[19]=f.state,e[20]=m):m=e[20];const g=m;let b;e[21]!==g?(b=i(()=>g,"t7"),e[21]=g,e[22]=b):b=e[22];let S;e[23]!==d.methods?(S=i(()=>d.methods,"t8"),e[23]=d.methods,e[24]=S):S=e[24];let w;e[25]!==g||e[26]!==f?(w=i(R=>{if(R==="main")return f.get({key:g.mainThreadId});if("id"in R)return f.get({key:R.id});const{index:k,archived:P}=R,L=P!==void 0&&P?g.archivedThreadIds[k]:g.threadIds[k];return f.get({key:L})},"t9"),e[25]=g,e[26]=f,e[27]=w):w=e[27];let v,y,T,E,C,N;e[28]!==s?(v=i((R,k)=>ut("switch",()=>s.switchToThread(R,k)),"t10"),y=i(()=>ut("create",()=>s.switchToNewThread()),"t11"),T=i(()=>s.getLoadThreadsPromise(),"t12"),E=i(()=>s.reload(),"t13"),C=i(()=>s.reloadMainThread(),"t14"),N=i(()=>s.loadMore(),"t15"),e[28]=s,e[29]=v,e[30]=y,e[31]=T,e[32]=E,e[33]=C,e[34]=N):(v=e[29],y=e[30],T=e[31],E=e[32],C=e[33],N=e[34]);let q;e[35]!==n?(q=i(()=>n,"t16"),e[35]=n,e[36]=q):q=e[36];let M;return e[37]!==v||e[38]!==y||e[39]!==T||e[40]!==E||e[41]!==C||e[42]!==N||e[43]!==q||e[44]!==b||e[45]!==S||e[46]!==w?(M={getState:b,thread:S,item:w,switchToThread:v,switchToNewThread:y,getLoadThreadsPromise:T,reload:E,reloadMainThread:C,loadMore:N,__internal_getAssistantRuntime:q},e[37]=v,e[38]=y,e[39]=T,e[40]=E,e[41]=C,e[42]=N,e[43]=q,e[44]=b,e[45]=S,e[46]=w,e[47]=M):M=e[47],M},"useThreadListClient"),Cg=he(Tg),kg=i((t,e)=>{t.thread??=Tn({source:"threads",query:{type:"main"},get:i(s=>s.threads.thread("main"),"get")}),t.threadListItem??=Tn({source:"threads",query:{type:"main"},get:i(s=>s.threads.item("main"),"get")}),t.composer??=Tn({source:"thread",query:{},get:i(s=>s.threads.thread("main").composer(),"get")}),!t.modelContext&&e.modelContext.source===null&&(t.modelContext=cl()),!t.suggestions&&e.suggestions.source===null&&(t.suggestions=Tn({source:"thread",query:{},get:i(s=>s.thread.suggestions(),"get")}))},"baseRuntimeAdapterTransformScopes"),Ml=i(t=>{const e=se(7),s=Hc();let n;e[0]!==s||e[1]!==t?(n=i(()=>t.registerModelContextProvider(s.current.modelContext()),"t0"),e[0]=s,e[1]=t,e[2]=n):n=e[2];let r;e[3]!==t?(r=[t],e[3]=t,e[4]=r):r=e[4],Wc("modelContext",n,r);let o;return e[5]!==t?(o=Cg({runtime:t.threads,__internal_assistantRuntime:t}),e[5]=t,e[6]=o):o=e[6],kt(o)},"useRuntimeAdapter"),Ag=he(Ml),Eg=i((t,e)=>{kg(t,e),!t.tools&&e.tools.source===null&&(t.tools=Cm({})),!t.dataRenderers&&e.dataRenderers.source===null&&(t.dataRenderers=Af())},"runtimeAdapterTransformScopes");Vc(Ml,Eg);var Rg=Oc({}),ea=i(({effects:t})=>{"use no memo";return Kh(t),null},"MountTapEffects"),jg=Gh(i(function(e,s){"use no memo";const{config:n,children:r}=e,o="extends"in e,a="value"in e,l=Di();if(Gc){if(o&&a)throw new Error("AuiProvider: pass either `extends` or `value`, not both.");if(o&&e.extends===void 0)throw new Error("AuiProvider: `extends` must be a client or null, not undefined.");if(o&&!n)throw new Error("AuiProvider: `extends` requires a `config`.");if(a&&n)throw new Error("AuiProvider: pass either `value` or `config`, not both.");if(!a&&!n)throw new Error("AuiProvider: a `config` is required.");if(!o&&!a&&l!==ys)throw new Error("A parent AuiProvider exists — pass extends={aui} to inherit it or extends={null} to isolate.")}const u=o?e.extends??ys:a?e.value??ys:l,d=Yc(),{client:h,effects:f}=dm(u,n??Rg,d);return Yh(s,()=>h,[h]),(0,c.jsx)(Jr.Provider,{value:d,children:(0,c.jsxs)(Ni.Provider,{value:h,children:[(0,c.jsx)(ea,{effects:$f(u)}),f&&(0,c.jsx)(ea,{effects:f}),r]})})},"AuiProvider")),Mg=i(t=>t._core?.RenderComponent,"getRenderComponent"),Ng=i(({runtime:t,aui:e,config:s,children:n})=>{"use no memo";const r=Mg(t),o=Oc({...s,threads:Ag(t)});return(0,c.jsxs)(jg,{extends:e,config:o,children:[r&&(0,c.jsx)(r,{}),n]})},"AssistantProviderInner"),Dg=kc(t=>{const e=se(5),{runtime:s,aui:n,config:r,children:o}=t,a=n===void 0?null:n;let l;return e[0]!==a||e[1]!==o||e[2]!==r||e[3]!==s?(l=(0,c.jsx)(Ng,{runtime:s,aui:a,config:r,children:o}),e[0]=a,e[1]=o,e[2]=r,e[3]=s,e[4]=l):l=e[4],l}),Og=ss(null),Pg=i(()=>or(Og),"useRuntimeAdapters");function Re(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}i(Re,"isRecord");function Wn(t,e=0){return e>100?!1:t===null||typeof t=="string"||typeof t=="boolean"?!0:typeof t=="number"?!Number.isNaN(t)&&Number.isFinite(t):Array.isArray(t)?t.every(s=>Wn(s,e+1)):Re(t)?Object.entries(t).every(([s,n])=>typeof s=="string"&&Wn(n,e+1)):!1}i(Wn,"isJSONValue");var Bg=class extends TransformStream{static{i(this,"PipeableTransformStream")}constructor(t){super();const e=t(super.readable);Object.defineProperty(this,"readable",{value:e,writable:!1})}};function $g(t,e,s){try{const n=t();if(typeof n=="object"&&n!==null&&"then"in n)return n.then(e,s);e(n)}catch(n){s(n)}}i($g,"withPromiseOrValue");function rn(t,e){let s=t;for(const n of e){if(s==null||!Object.hasOwn(s,n))return;s=s[n]}return s}i(rn,"getField");var Lg=class{static{i(this,"GetHandle")}resolve;reject;disposed=!1;fieldPath;get isDisposed(){return this.disposed}constructor(t,e,s){this.resolve=t,this.reject=e,this.fieldPath=s}update(t){if(!this.disposed)try{if(sn(t,this.fieldPath)==="complete"){const e=rn(t,this.fieldPath);e!==void 0&&(this.resolve(e),this.dispose())}}catch(e){this.reject(e),this.dispose()}}end(t){if(!this.disposed)try{const e=rn(t,this.fieldPath);this.resolve(e)}catch(e){this.reject(e)}finally{this.dispose()}}error(t){this.disposed||(this.reject(t),this.dispose())}dispose(){this.disposed=!0}},Vg=class{static{i(this,"StreamValuesHandle")}controller;disposed=!1;fieldPath;get isDisposed(){return this.disposed}constructor(t,e){this.controller=t,this.fieldPath=e}update(t){if(!this.disposed)try{const e=rn(t,this.fieldPath);e!==void 0&&this.controller.enqueue(e),sn(t,this.fieldPath)==="complete"&&(this.controller.close(),this.dispose())}catch(e){this.controller.error(e),this.dispose()}}end(){this.disposed||(this.controller.close(),this.dispose())}error(t){this.disposed||(this.controller.error(t),this.dispose())}dispose(){this.disposed=!0}},Fg=class{static{i(this,"StreamTextHandle")}controller;disposed=!1;fieldPath;lastValue=void 0;get isDisposed(){return this.disposed}constructor(t,e){this.controller=t,this.fieldPath=e}update(t){if(!this.disposed)try{const e=rn(t,this.fieldPath);if(e!==void 0&&typeof e=="string"){const s=e.substring(this.lastValue?.length||0);this.lastValue=e,this.controller.enqueue(s)}sn(t,this.fieldPath)==="complete"&&(this.controller.close(),this.dispose())}catch(e){this.controller.error(e),this.dispose()}}end(){this.disposed||(this.controller.close(),this.dispose())}error(t){this.disposed||(this.controller.error(t),this.dispose())}dispose(){this.disposed=!0}},Ug=class{static{i(this,"ForEachHandle")}controller;disposed=!1;fieldPath;nextIndex=0;get isDisposed(){return this.disposed}constructor(t,e){this.controller=t,this.fieldPath=e}update(t){if(!this.disposed)try{const e=rn(t,this.fieldPath);if(!Array.isArray(e))return;for(;this.nextIndex<e.length;this.nextIndex++){const s=[...this.fieldPath,this.nextIndex];if(sn(t,s)!=="complete")break;this.controller.enqueue(e[this.nextIndex])}sn(t,this.fieldPath)==="complete"&&(this.controller.close(),this.dispose())}catch(e){this.controller.error(e),this.dispose()}}end(){this.disposed||(this.controller.close(),this.dispose())}error(t){this.disposed||(this.controller.error(t),this.dispose())}dispose(){this.disposed=!0}},qg=class{static{i(this,"ToolCallArgsReaderImpl")}argTextDeltas;handles=new Set;accumulatedText="";parsedTextLength=-1;args=void 0;finished=!1;failure=void 0;constructor(t){this.argTextDeltas=t,this.processStream()}async processStream(){try{const t=this.argTextDeltas.getReader();for(;;){const{value:e,done:s}=await t.read();if(s)break;this.accumulatedText+=e,this.handles.size!==0&&this.parseCurrentArgs()&&this.updateHandles()}}catch(t){this.failure={reason:t}}finally{this.finished=!0;for(const t of this.handles)this.settleHandle(t);this.handles.clear()}}settleHandle(t){this.failure?t.error(this.failure.reason):t.end(this.args)}parseCurrentArgs(){if(this.parsedTextLength===this.accumulatedText.length)return!1;const t=Zr(this.accumulatedText);return this.parsedTextLength=this.accumulatedText.length,t===void 0?(this.args??=Zr(""),!1):(this.args=t,!0)}updateHandles(){for(const t of this.handles)t.update(this.args),t.isDisposed&&this.handles.delete(t)}activateHandle(t){if(this.parseCurrentArgs(),t.update(this.args),!t.isDisposed){if(this.finished){this.settleHandle(t);return}this.handles.add(t)}}get(...t){return new Promise((e,s)=>{const n=new Lg(e,s,t);this.activateHandle(n)})}streamValues(...t){const e=t;let s;const n=new ReadableStream({start:i(r=>{s=new Vg(r,e),this.activateHandle(s)},"start"),cancel:i(()=>{s&&(s.dispose(),this.handles.delete(s))},"cancel")});return Tr(n)}streamText(...t){const e=t;let s;const n=new ReadableStream({start:i(r=>{s=new Fg(r,e),this.activateHandle(s)},"start"),cancel:i(()=>{s&&(s.dispose(),this.handles.delete(s))},"cancel")});return Tr(n)}forEach(...t){const e=t;let s;const n=new ReadableStream({start:i(r=>{s=new Ug(r,e),this.activateHandle(s)},"start"),cancel:i(()=>{s&&(s.dispose(),this.handles.delete(s))},"cancel")});return Tr(n)}},zg=class{static{i(this,"ToolCallResponseReaderImpl")}promise;constructor(t){this.promise=t}get(){return this.promise}},Hg=class{static{i(this,"ToolCallReaderImpl")}args;response;writable;resolve;argsText="";constructor(){const t=new TransformStream;this.writable=t.writable,this.args=new qg(t.readable);const{promise:e,resolve:s}=Fi();this.resolve=s,this.response=new zg(e)}async appendArgsTextDelta(t){const e=this.writable.getWriter();try{await e.write(t)}catch{}finally{e.releaseLock()}this.argsText+=t}async finishArgsText(){const t=this.writable.getWriter();try{await t.close()}catch{}finally{t.releaseLock()}}setResponse(t){this.resolve(t)}result={get:i(async()=>(await this.response.get()).result,"get")}},Wg=Symbol.for("assistant-stream.tool-execution-id"),kr=i((t,e,s,n,r)=>{try{const o=e?.(s,n,r);Promise.resolve(o).catch(a=>{})}catch{}},"invokeExecutionCallback"),bs=i(t=>t.join(","),"pathKey"),Ar=i((t,e)=>{const s={...t};return Object.defineProperty(s,Wg,{value:e,enumerable:!0}),s},"withExecutionId"),Kg=class extends Bg{static{i(this,"ToolExecutionStream")}constructor(t){const e=t,s=new Map,n=new Map,r=new Set,o=new Map;let a=0;super(l=>{const u=new TransformStream({async transform(d,h){const f=o.get(bs(d.path));switch((d.type!=="part-finish"||d.meta.type!=="tool-call")&&h.enqueue(f?Ar(d,f):d),d.type){case"part-start":{const p=a;if(a+=1,d.part.type==="tool-call"){const m=new Hg,g=Symbol();o.set(String(p),g),n.set(g,m),e.streamCall({reader:m,toolCallId:d.part.toolCallId,toolName:d.part.toolName,executionId:g})}break}case"text-delta":if(d.meta.type==="tool-call"){const p=o.get(bs(d.path)),m=p?n.get(p):void 0;if(!m)throw new Error("No controller found for tool call");await m.appendArgsTextDelta(d.textDelta)}break;case"result":{if(d.meta.type!=="tool-call")break;const p=o.get(bs(d.path)),m=p?n.get(p):void 0;if(!m)throw new Error("No controller found for tool call");if(r.add(p),d.isPreliminary)break;m.setResponse(new It({result:d.result,artifact:d.artifact,isError:d.isError,modelContent:d.modelContent,messages:d.messages}));break}case"tool-call-args-text-finish":{if(d.meta.type!=="tool-call")break;const{toolCallId:p,toolName:m}=d.meta,g=o.get(bs(d.path)),b=g?n.get(g):void 0;if(!b)throw new Error("No controller found for tool call");if(await b.finishArgsText(),r.has(g))break;let S=!1;const w=$g(()=>{let v;try{v=Xr.default.parse(b.argsText)}catch(T){throw new Error(`Function parameter parsing failed. ${JSON.stringify(T.message)}`)}const y=e.execute({toolCallId:p,toolName:m,args:v,executionId:g});return y!==void 0&&(S=!0,kr("onExecutionStart",e.onExecutionStart,p,m,g)),y},v=>{if(S&&kr("onExecutionEnd",e.onExecutionEnd,p,m,g),v===void 0)return;const y=new It({artifact:v.artifact,result:v.result,isError:v.isError,messages:v.messages,modelContent:v.modelContent});b.setResponse(y),Ye(h,Ar({type:"result",path:d.path,...y},g))},v=>{S&&kr("onExecutionEnd",e.onExecutionEnd,p,m,g);const y=new It({result:String(v),isError:!0});b.setResponse(y),Ye(h,Ar({type:"result",path:d.path,...y},g))});w&&s.set(g,w);break}case"part-finish":{if(d.meta.type!=="tool-call")break;const p=o.get(bs(d.path)),m=p?s.get(p):void 0,g=i(()=>{p&&(s.delete(p),n.delete(p),r.delete(p),o.delete(bs(d.path)))},"cleanup");m?m.then(()=>{g(),Ye(h,d)}):(g(),h.enqueue(d))}}},async flush(){await Promise.all(s.values())}});return l.pipeThrough(new Al).pipeThrough(u)})}},Nl=Symbol.for("assistant-stream.tool-execution-id"),Kn=Symbol("assistant-stream.tool-aborted"),Jg=i(t=>typeof t=="object"&&t!==null&&"~standard"in t&&t["~standard"].version===1,"isStandardSchemaV1"),Qg=i(t=>typeof t?.then=="function","isThenable"),ta=i(async(t,e,s=!1)=>{let n;const r=new Promise(o=>{n=i(()=>{s?queueMicrotask(()=>queueMicrotask(()=>o(Kn))):o(Kn)},"onAbort"),e.aborted?n():e.addEventListener("abort",n,{once:!0})});try{return await Promise.race([t,r])}finally{e.removeEventListener("abort",n)}},"raceWithAbort"),kn=i(()=>new It({result:"Tool execution was cancelled.",isError:!0}),"cancelledToolResponse");function Yg(t,e,s,n){const r=t?.[s.toolName];return r?.execute?i(async a=>{if(e.aborted)return kn();let l=a,u=s.args;if(Jg(r.parameters)){const f=r.parameters["~standard"].validate(s.args),p=Qg(f)?await ta(f,e):f;if(p===Kn)return kn();p.issues?l=r.experimental_onSchemaValidationError??(()=>{throw new Error(`Function parameter validation failed. ${JSON.stringify(p.issues)}`)}):u=p.value}if(e.aborted)return kn();const d=(async()=>{const f={toolCallId:s.toolCallId,abortSignal:e,human:i(g=>n(s.toolCallId,g,s.executionId),"human"),[Nl]:s.executionId},p=await l(u,f),m=It.toResponse(p);if(r.toModelOutput&&!m.isError&&m.modelContent===void 0)try{const g=await r.toModelOutput({toolCallId:s.toolCallId,input:u,output:m.result});return new It({result:m.result,artifact:m.artifact,isError:m.isError,messages:m.messages,modelContent:g})}catch{}return m})(),h=await ta(d,e,!0);return h===Kn?kn():h},"getResult")(r.execute):void 0}i(Yg,"getToolResponse");function Gg(t,e,s,n,r){const o={toolCallId:n.toolCallId,abortSignal:e,human:i(a=>r(n.toolCallId,a,n.executionId),"human"),[Nl]:n.executionId};t?.[n.toolName]?.streamCall?.(s,o)}i(Gg,"getToolStreamResponse");function Xg(t,e,s,n){const r=typeof t=="function"?t:()=>t,o=typeof e=="function"?e:()=>e,a=n,l=s,u={execute:i(d=>Yg(r(),o(),d,l),"execute"),streamCall:i(({reader:d,...h})=>Gg(r(),o(),d,h,l),"streamCall"),onExecutionStart:a?.onExecutionStart,onExecutionEnd:a?.onExecutionEnd};return new Kg(u)}i(Xg,"toolResultStream");var Zg=100,si=i((t,e,s)=>{if(t===e)return!0;if(s>Zg||t==null||e==null)return!1;if(Array.isArray(t))return!Array.isArray(e)||t.length!==e.length?!1:t.every((o,a)=>si(o,e[a],s+1));if(Array.isArray(e)||!Re(t)||!Re(e))return!1;const n=Object.keys(t),r=Object.keys(e);return n.length!==r.length?!1:n.every(o=>Object.hasOwn(e,o)&&si(t[o],e[o],s+1))},"isJSONValueEqualAtDepth"),Ui=i((t,e)=>!Wn(t)||!Wn(e)?!1:si(t,e,0),"isJSONValueEqual");function eb(t){const e=t.metadata;if(!e||typeof e!="object")return;const s=e.custom;if(!s||typeof s!="object")return;const n=s.interactables;return Array.isArray(n)?n:void 0}i(eb,"unstable_getInteractableSnapshots");function tb(t){return`update_${t.replace(/[^a-zA-Z0-9_-]/g,"_")}`}i(tb,"interactableToolName");var Er=i(t=>{if(!Re(t))return;const e=t.id;return typeof e=="string"||typeof e=="number"?e:void 0},"getArrayItemId");function qi(t,e,s=[]){if(!Re(t)||!Re(e))return e;const n={...t,...e},[r,...o]=s;return r!==void 0&&Object.hasOwn(e,r)&&(n[r]=qi(t[r],e[r],o)),n}i(qi,"overlayPartialPath");function sb(t,e,s,n){let r=Array.isArray(e.set)?[...e.set]:[...t];if(e.clear===!0&&(r=[]),Array.isArray(e.remove)&&e.remove.length>0){const a=new Set(e.remove);r=r.filter(l=>{const u=Er(l);return u!==void 0?!a.has(u):!a.has(l)})}const o=e.update;if(Array.isArray(o)&&o.length>0){const a=new Map;for(const u of o){const d=Er(u);d!==void 0&&!Number.isNaN(d)&&!a.has(d)&&a.set(d,u)}const l=n?.[0]==="update"?{patch:o[Number(n[1])],rest:n.slice(2)}:void 0;r=r.map(u=>{const d=Er(u);if(d===void 0||!Re(u))return u;const h=a.get(d);return h?l&&h===l.patch?qi(u,h,l.rest):{...u,...h}:u})}if(Array.isArray(e.add)&&e.add.length>0){const a=s?e.add.map(l=>{if(!Re(l)||l.id!==void 0)return l;const u=s();return u===void 0?l:{...l,id:u}}):e.add;r=[...r,...a]}return r}i(sb,"applyArrayUpdate");function Rr(t,e,s){if(!Re(t)||!Re(e))return e;const n=Re(s?.arrayBaseline)?s.arrayBaseline:t,r=s?.partialPath,o=Object.entries(t);for(const[a,l]of Object.entries(e)){const u=n[a],d=r?.[0]===a?r.slice(1):void 0;if(Array.isArray(u)&&Re(l)){const h=s?.idFactory&&(s.idKeyedFields===void 0||s.idKeyedFields.has(a))?()=>s.idFactory?.(a):void 0;o.push([a,sb(u,l,h,d)])}else d?o.push([a,qi(t[a],l,d)]):o.push([a,l])}return Object.fromEntries(o)}i(Rr,"shallowMergeInteractableState");function nb(t,e){if(!Re(t)||!Re(e))return;for(const r of Object.keys(t))if(!Object.hasOwn(e,r))return;const s=[];for(const[r,o]of Object.entries(e))(!Object.hasOwn(t,r)||!Ui(t[r],o))&&s.push([r,o]);const n=s.length;if(!(n===0||n===Object.keys(e).length))return Object.fromEntries(s)}i(nb,"shallowDiffInteractableState");var rb=i(t=>{if(!t||typeof t!="object")return;const e=t;return e.type==="tool-call"?e:void 0},"asToolCallPart"),ib=i((t,e)=>{if(!t.args||typeof t.args!="object")return!1;const s=Re(t.result)?t.result:void 0;if(s?.success===!1)return!1;if(typeof s?.id=="string")return s.id===e;const n=t.args.id;return n===e||n===void 0},"updateCallTargets"),ob=i(t=>{const e=Re(t)?t.addedItemIds:void 0;if(!Re(e))return;const s=new Map;for(const[n,r]of Object.entries(e)){if(!Array.isArray(r))continue;const o=r.filter(a=>typeof a=="string");o.length>0&&s.set(n,o)}if(s.size!==0)return n=>s.get(n)?.shift()},"createAddedItemIdFactory"),sa=new WeakMap;function ab(t,e,s){let n=sa.get(t);n||(n=new Map,sa.set(t,n));let r=n.get(s);r||(r=new Map,n.set(s,r));const o=r.get(e);if(o)return o;const a=tb(s),l=[],u=i(()=>l[l.length-1],"current");for(const d of t){if(d.role==="user"){const h=eb(d)?.find(f=>f.id===e);if(!h)continue;if(h.partial){const f=u();f&&l.push({state:Rr(f.state,h.state),origin:"user-edit"})}else l.push({state:h.state,origin:"user-edit"});continue}if(d.role==="assistant")for(const h of d.content??[]){const f=rb(h);if(f){if(f.toolCallId===e&&f.toolName===s)f.args&&typeof f.args=="object"&&l.push({state:f.args,origin:"create",toolCallId:e});else if(f.toolName===a&&ib(f,e)){const p=u();if(p){const{id:m,...g}=f.args,b=ob(f.result);l.push({state:b?Rr(p.state,g,{idFactory:b}):Rr(p.state,g),origin:"update",toolCallId:f.toolCallId})}}}}}return r.set(e,l),l}i(ab,"unstable_getInteractableVersions");function cb(t,e,s){const n=ab(t,e,s),r=n[n.length-1];return r?{state:r.state}:void 0}i(cb,"findModelKnownState");function lb(t,e){if(!t)return;const{interactables:s,...n}=t,r={...n};if(Array.isArray(s)){const o=[];for(const a of s){const l=cb(e,a.id,a.name);if(!l){o.push({id:a.id,name:a.name,state:a.state});continue}if(Ui(a.state,l.state))continue;const u=nb(l.state,a.state);o.push(u?{id:a.id,name:a.name,state:u,partial:!0}:{id:a.id,name:a.name,state:a.state})}o.length&&(r.interactables=o)}return Object.keys(r).length?r:void 0}i(lb,"gateInteractableComposerMetadata");var Zt=Symbol("innerMessage"),jr=Symbol("innerMessages"),ub=[],na=i((t,e)=>{Zt in t||(t[Zt]=e)},"bindExternalStoreMessage"),db=i(t=>{const e="messages"in t&&!("type"in t&&t.type==="tool-call")?t.messages:t,s=e[jr]||e[Zt];return s?Array.isArray(s)?s:(e[jr]=[s],e[jr]):ub},"getExternalStoreMessages"),hb="__external_store_fallback_",Dl=i(t=>t.type==="tool-call"&&t.result===void 0,"isPendingToolCall"),fb=i(t=>{if(t.type!=="tool-call"||t.result!==void 0)return!1;const e=t.messages?.at(-1);return e?.role==="assistant"&&e.status.type==="running"},"isBackgroundToolCall"),Ol=i(t=>t.type==="tool-call"&&pl(t),"isInterruptedToolCall"),rs=Symbol("autoStatus"),ra=Object.freeze(Object.assign({type:"running"},{[rs]:!0})),mb=Object.freeze(Object.assign({type:"complete",reason:"unknown"},{[rs]:!0})),pb=Object.freeze(Object.assign({type:"incomplete",reason:"cancelled"},{[rs]:!0})),gb=Object.freeze(Object.assign({type:"requires-action",reason:"tool-calls"},{[rs]:!0})),bb=Object.freeze(Object.assign({type:"requires-action",reason:"interrupt"},{[rs]:!0})),xb=i(t=>t[rs]===!0,"isAutoStatus"),Pl=i((t,e,s,n,r,o,a)=>t&&r!==void 0&&r!==null?Object.assign({type:"incomplete",reason:"error",error:r},{[rs]:!0}):t&&e?ra:s?bb:a&&!o?ra:n?gb:o?pb:mb,"getAutoStatus"),ia=i(t=>Pl(!1,!1,typeof t!="string"&&t.some(Ol),typeof t!="string"&&t.some(Dl)),"getRepositoryContentAutoStatus"),oa=i((t,e,s)=>Pl(e,s,typeof t!="string"&&t.some(Ol),typeof t!="string"&&t.some(Dl),void 0,void 0,typeof t!="string"&&t.some(fb)),"getContentAutoStatus"),aa=class{static{i(this,"ThreadMessageConverter")}cache=new WeakMap;convertMessages(t,e){return t.map((s,n)=>{const r=e(this.cache.get(s),s,n);return this.cache.set(s,r),r})}},ca=i((t,e)=>{if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(t[s]!==e[s])return!1;return!0},"shallowArrayEqual"),Bl=Symbol.for("assistant-ui.message-not-sent"),la=class extends Error{static{i(this,"MessageNotSentError")}[Bl]=!0;constructor(t="The message was not sent."){super(t),this.name="MessageNotSentError"}},$l=i(t=>typeof t=="object"&&t!==null&&Bl in t,"isMessageNotSentError"),Ll=i((t,e)=>{Promise.resolve(e).catch(s=>{$l(s)})},"reportRunFailure"),Vl=class{static{i(this,"AttachmentRuntimeImpl")}get path(){return this._core.path}_core;constructor(t){this._core=t,this.__internal_bindMethods()}__internal_bindMethods(){this.getState=this.getState.bind(this),this.remove=this.remove.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this._core.getState()}subscribe(t){return this._core.subscribe(t)}},Fl=class extends Vl{static{i(this,"ComposerAttachmentRuntime")}_composerApi;constructor(t,e){super(t),this._composerApi=e}remove(){const t=this._composerApi.getState();if(!t)throw new Error("Composer is not available");return t.removeAttachment(this.getState().id)}},vb=class extends Fl{static{i(this,"ThreadComposerAttachmentRuntimeImpl")}get source(){return"thread-composer"}},yb=class extends Fl{static{i(this,"EditComposerAttachmentRuntimeImpl")}get source(){return"edit-composer"}},_b=class extends Vl{static{i(this,"MessageAttachmentRuntimeImpl")}get source(){return"message"}remove(){throw new Error("Message attachments cannot be removed")}},_s=Object.freeze([]),Ul=Object.freeze({}),wb=i(t=>Object.freeze({type:"thread",isEditing:t?.isEditing??!1,canCancel:t?.canCancel??!1,canSend:t?.canSend??!1,isEmpty:t?.isEmpty??!0,attachments:t?.attachments??_s,text:t?.text??"",role:t?.role??"user",runConfig:t?.runConfig??Ul,attachmentAccept:t?.attachmentAccept??"",dictation:t?.dictation,quote:t?.quote,queue:t?.queue??_s,submission:t?.submission,inTransit:t?.inTransit??_s,value:t?.text??""}),"getThreadComposerState"),Sb=i(t=>Object.freeze({type:"edit",isEditing:t?.isEditing??!1,canCancel:t?.canCancel??!1,canSend:t?.canSend??!1,isEmpty:t?.isEmpty??!0,text:t?.text??"",role:t?.role??"user",attachments:t?.attachments??_s,runConfig:t?.runConfig??Ul,attachmentAccept:t?.attachmentAccept??"",dictation:t?.dictation,quote:t?.quote,queue:t?.queue??_s,submission:t?.submission,inTransit:t?.inTransit??_s,parentId:t?.parentId??null,sourceId:t?.sourceId??null,value:t?.text??""}),"getEditComposerState"),ql=class{static{i(this,"ComposerRuntimeImpl")}get path(){return this._core.path}_core;constructor(t){this._core=t}__internal_bindMethods(){this.setText=this.setText.bind(this),this.setRunConfig=this.setRunConfig.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.addAttachment=this.addAttachment.bind(this),this.reset=this.reset.bind(this),this.clearAttachments=this.clearAttachments.bind(this),this.send=this.send.bind(this),this.cancel=this.cancel.bind(this),this.steerQueueItem=this.steerQueueItem.bind(this),this.moveQueueItem=this.moveQueueItem.bind(this),this.removeQueueItem=this.removeQueueItem.bind(this),this.setRole=this.setRole.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.startDictation=this.startDictation.bind(this),this.stopDictation=this.stopDictation.bind(this),this.setQuote=this.setQuote.bind(this),this.unstable_on=this.unstable_on.bind(this)}setText(t){const e=this._core.getState();if(!e)throw new Error("Composer is not available");e.setText(t)}setRunConfig(t){const e=this._core.getState();if(!e)throw new Error("Composer is not available");e.setRunConfig(t)}addAttachment(t){const e=this._core.getState();if(!e)throw new Error("Composer is not available");return e.addAttachment(t)}reset(){const t=this._core.getState();if(!t)throw new Error("Composer is not available");return t.reset()}clearAttachments(){const t=this._core.getState();if(!t)throw new Error("Composer is not available");return t.clearAttachments()}send(t){const e=this._core.getState();if(!e)throw new Error("Composer is not available");e.send(t)}cancel(){const t=this._core.getState();if(!t)throw new Error("Composer is not available");t.cancel()}steerQueueItem(t){this.moveQueueItem(t,{lane:"steer",insertAfter:null})}moveQueueItem(t,e){const s=this._core.getState();if(!s)throw new Error("Composer is not available");s.moveQueueItem(t,e)}removeQueueItem(t){const e=this._core.getState();if(!e)throw new Error("Composer is not available");e.removeQueueItem(t)}setRole(t){const e=this._core.getState();if(!e)throw new Error("Composer is not available");e.setRole(t)}startDictation(){const t=this._core.getState();if(!t)throw new Error("Composer is not available");t.startDictation()}stopDictation(){const t=this._core.getState();if(!t)throw new Error("Composer is not available");t.stopDictation()}setQuote(t){const e=this._core.getState();if(!e)throw new Error("Composer is not available");e.setQuote(t)}subscribe(t){return this._core.subscribe(t)}_eventSubscriptionSubjects=new Map;unstable_on(t,e){let s=this._eventSubscriptionSubjects.get(t);return s||(s=new ol({event:t,binding:this._core}),this._eventSubscriptionSubjects.set(t,s)),s.subscribe(e)}},Ib=class extends ql{static{i(this,"ThreadComposerRuntimeImpl")}get path(){return this._core.path}get type(){return"thread"}_getState;constructor(t){const e=new Vi({path:t.path,getState:i(()=>wb(t.getState()),"getState"),subscribe:i(s=>t.subscribe(s),"subscribe")});super({path:t.path,getState:i(()=>t.getState(),"getState"),subscribe:i(s=>e.subscribe(s),"subscribe")}),this._getState=e.getState.bind(e),this.__internal_bindMethods()}getState(){return this._getState()}getAttachmentByIndex(t){return new vb(new Ge({path:{...this.path,attachmentSource:"thread-composer",attachmentSelector:{type:"index",index:t},ref:`${this.path.ref}.attachments[${t}]`},getState:i(()=>{const e=this.getState().attachments[t];return e?{...e,source:"thread-composer"}:Xe},"getState"),subscribe:i(e=>this._core.subscribe(e),"subscribe")}),this._core)}},Tb=class extends ql{static{i(this,"EditComposerRuntimeImpl")}get path(){return this._core.path}get type(){return"edit"}_getState;_beginEdit;constructor(t,e){const s=new Vi({path:t.path,getState:i(()=>Sb(t.getState()),"getState"),subscribe:i(n=>t.subscribe(n),"subscribe")});super({path:t.path,getState:i(()=>t.getState(),"getState"),subscribe:i(n=>s.subscribe(n),"subscribe")}),this._beginEdit=e,this._getState=s.getState.bind(s),this.__internal_bindMethods()}__internal_bindMethods(){super.__internal_bindMethods(),this.beginEdit=this.beginEdit.bind(this)}getState(){return this._getState()}beginEdit(){this._beginEdit()}getAttachmentByIndex(t){return new yb(new Ge({path:{...this.path,attachmentSource:"edit-composer",attachmentSelector:{type:"index",index:t},ref:`${this.path.ref}.attachments[${t}]`},getState:i(()=>{const e=this.getState().attachments[t];return e?{...e,source:"edit-composer"}:Xe},"getState"),subscribe:i(e=>this._core.subscribe(e),"subscribe")}),this._core)}},Cb=i(t=>t.display==="text"||t.allowFreeform===!0,"toolApprovalAcceptsText"),ua={"allow-once":!0,"allow-always":!0,"reject-once":!1,"reject-always":!1},kb=i((t,e)=>{const s=e.text;if(s!==void 0&&!Cb(t))throw new Error(`Tool approval "${t.id}" does not accept a free-form answer; the request must declare display "text" or allowFreeform`);let n,r;if("optionId"in e){const o=t.options?.find(a=>a.id===e.optionId);if(!o)throw new Error(`Tool approval has no option with id "${e.optionId}"`);if("approved"in e)n=e.approved;else{if(!Object.hasOwn(ua,o.kind))throw new Error(`Tool approval option "${o.id}" has a custom kind "${o.kind}"; respond with an explicit approved value instead`);n=ua[o.kind]}r=o.id}else if("approved"in e)n=e.approved;else{if(t.display!=="text"&&t.display!=="select")throw new Error(`Tool approval "${t.id}" is a decision, not a question; respond with an explicit approved value, optionally alongside the answer`);n=!0}return{approvalId:t.id,approved:n,...r!==void 0&&{optionId:r},...s!==void 0&&{text:s},...e.reason!=null&&{reason:e.reason}}},"resolveToolApprovalResponse"),da=class{static{i(this,"MessagePartRuntimeImpl")}get path(){return this.contentBinding.path}contentBinding;messageApi;threadApi;constructor(t,e,s){this.contentBinding=t,this.messageApi=e,this.threadApi=s,this.__internal_bindMethods()}__internal_bindMethods(){this.addToolResult=this.addToolResult.bind(this),this.resumeToolCall=this.resumeToolCall.bind(this),this.respondToToolApproval=this.respondToToolApproval.bind(this),this.unstable_recordInteraction=this.unstable_recordInteraction.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this.contentBinding.getState()}addToolResult(t){const e=this.contentBinding.getState();if(!e)throw new Error("Message part is not available");if(e.type!=="tool-call")throw new Error("Tried to add tool result to non-tool message part");if(!this.messageApi)throw new Error("Message API is not available. This is likely a bug in assistant-ui.");if(!this.threadApi)throw new Error("Thread API is not available");const s=this.messageApi.getState();if(!s)throw new Error("Message is not available");const n=e.toolName,r=e.toolCallId,o=It.toResponse(t);this.threadApi.getState().addToolResult({messageId:s.id,toolName:n,toolCallId:r,result:o.result,isError:o.isError,...o.artifact!==void 0&&{artifact:o.artifact},...o.modelContent!==void 0&&{modelContent:o.modelContent}})}resumeToolCall(t){const e=this.contentBinding.getState();if(!e)throw new Error("Message part is not available");if(e.type!=="tool-call")throw new Error("Tried to resume tool call on non-tool message part");if(!this.threadApi)throw new Error("Thread API is not available");const s=e.toolCallId;this.threadApi.getState().resumeToolCall({toolCallId:s,payload:t}),this.unstable_recordInteraction({type:"human-response",payload:t}).catch(()=>{})}respondToToolApproval(t){const e=this.contentBinding.getState();if(!e)throw new Error("Message part is not available");if(e.type!=="tool-call")throw new Error("Tried to respond to tool approval on non-tool message part");if(!e.approval||e.approval.approved!==void 0||e.approval.resolution!==void 0)throw new Error("Tool call has no pending approval");if(!this.threadApi)throw new Error("Thread API is not available");return this.threadApi.getState().respondToToolApproval(kb(e.approval,t))}async unstable_recordInteraction(t){const e=this.contentBinding.getState();if(!e)throw new Error("Message part is not available");if(e.type!=="tool-call")throw new Error("Tried to record interaction on non-tool message part");if(!this.messageApi)throw new Error("Message API is not available. This is likely a bug in assistant-ui.");if(!this.threadApi)throw new Error("Thread API is not available");const s=this.messageApi.getState();if(!s)throw new Error("Message is not available");const n=this.threadApi.getState();if(!n.unstable_recordToolInteraction)throw new Error("Runtime does not support recording tool interactions.");await n.unstable_recordToolInteraction({messageId:s.id,toolCallId:e.toolCallId,interaction:Mp(t)})}subscribe(t){return this.contentBinding.subscribe(t)}},ha=i((t,e)=>{const s=t.content[e];if(!s)return Xe;const n=gl(t,e,s);return Object.freeze({...s,[Zt]:s[Zt],status:n})},"getMessagePartState"),Ab=class{static{i(this,"MessageRuntimeImpl")}get path(){return this._core.path}_core;_threadBinding;constructor(t,e){this._core=t,this._threadBinding=e,this.composer=new Tb(new qn({path:{...this.path,ref:`${this.path.ref}.composer`,composerSource:"edit"},getState:this._getEditComposerRuntimeCore,subscribe:i(s=>this._threadBinding.subscribe(s),"subscribe")}),()=>this._threadBinding.getState().beginEdit(this._core.getState().id)),this.__internal_bindMethods()}__internal_bindMethods(){this.reload=this.reload.bind(this),this.delete=this.delete.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getMessagePartByIndex=this.getMessagePartByIndex.bind(this),this.getMessagePartByToolCallId=this.getMessagePartByToolCallId.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.unstable_getCopyText=this.unstable_getCopyText.bind(this),this.speak=this.speak.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.submitFeedback=this.submitFeedback.bind(this),this.switchToBranch=this.switchToBranch.bind(this)}composer;_getEditComposerRuntimeCore=i(()=>this._threadBinding.getState().getEditComposer(this._core.getState().id),"_getEditComposerRuntimeCore");getState(){return this._core.getState()}delete(){const t=this._core.getState();return this._threadBinding.getState().deleteMessage(t.id)}reload(t={}){const e=this._getEditComposerRuntimeCore(),s=e??this._threadBinding.getState().composer,n=e??s,{runConfig:r=n.runConfig}=t,o=this._core.getState();if(o.role!=="assistant")throw new Error("Can only reload assistant messages");Ll("Message reload",this._threadBinding.getState().startRun({parentId:o.parentId,sourceId:o.id,runConfig:r}))}speak(){const t=this._core.getState();return this._threadBinding.getState().speak(t.id)}stopSpeaking(){const t=this._core.getState();if(this._threadBinding.getState().speech?.messageId===t.id)this._threadBinding.getState().stopSpeaking();else throw new Error("Message is not being spoken")}submitFeedback({type:t,comment:e}){const s=this._core.getState();this._threadBinding.getState().submitFeedback({messageId:s.id,type:t,...e!==void 0?{comment:e}:void 0})}switchToBranch({position:t,branchId:e}){const s=this._core.getState();if(e&&t)throw new Error("May not specify both branchId and position");if(!e&&!t)throw new Error("Must specify either branchId or position");const n=this._threadBinding.getState().getBranches(s.id);let r=e;if(t==="previous"?r=n[s.branchNumber-2]:t==="next"&&(r=n[s.branchNumber]),!r)throw new Error("Branch not found");this._threadBinding.getState().switchToBranch(r)}unstable_getCopyText(){return js(this.getState())}subscribe(t){return this._core.subscribe(t)}getMessagePartByIndex(t){if(t<0)throw new Error("Message part index must be >= 0");return new da(new Ge({path:{...this.path,ref:`${this.path.ref}.content[${t}]`,messagePartSelector:{type:"index",index:t}},getState:i(()=>ha(this.getState(),t),"getState"),subscribe:i(e=>this._core.subscribe(e),"subscribe")}),this._core,this._threadBinding)}getMessagePartByToolCallId(t){return new da(new Ge({path:{...this.path,ref:`${this.path.ref}.content[toolCallId=${JSON.stringify(t)}]`,messagePartSelector:{type:"toolCallId",toolCallId:t}},getState:i(()=>{const e=this._core.getState(),s=e.content.findIndex(n=>n.type==="tool-call"&&n.toolCallId===t);return s===-1?Xe:ha(e,s)},"getState"),subscribe:i(e=>this._core.subscribe(e),"subscribe")}),this._core,this._threadBinding)}getAttachmentByIndex(t){return new _b(new Ge({path:{...this.path,ref:`${this.path.ref}.attachments[${t}]`,attachmentSource:"message",attachmentSelector:{type:"index",index:t}},getState:i(()=>{const e=this.getState().attachments?.[t];return e?{...e,source:"message"}:Xe},"getState"),subscribe:i(e=>this._core.subscribe(e),"subscribe")}))}},Eb=i(t=>({parentId:t.parentId??null,sourceId:t.sourceId??null,runConfig:t.runConfig??{},...t.stream?{stream:t.stream}:{}}),"toResumeRunConfig"),Rb=i(t=>({parentId:t.parentId??null,sourceId:t.sourceId??null,runConfig:t.runConfig??{}}),"toStartRunConfig"),jb=i((t,e)=>typeof e=="string"?{createdAt:new Date,parentId:t.at(-1)?.id??null,sourceId:null,runConfig:{},role:"user",content:[{type:"text",text:e}],attachments:[],metadata:{custom:{}}}:{createdAt:e.createdAt??new Date,parentId:e.parentId===void 0?t.at(-1)?.id??null:e.parentId,sourceId:e.sourceId??null,role:e.role??"user",content:e.content,attachments:e.attachments??[],metadata:e.metadata??{custom:{}},runConfig:e.runConfig??{},startRun:e.startRun},"toAppendMessage"),zi=i(t=>{if(t.isRunning!==void 0)return t.isRunning;const e=t.messages.at(-1);return e?.role==="assistant"&&e.status.type==="running"},"getThreadRuntimeCoreIsRunning"),Mb=i((t,e)=>Object.freeze({threadId:e.id,metadata:e,capabilities:t.capabilities,isDisabled:t.isDisabled,isLoading:t.isLoading,isRunning:zi(t),messages:t.messages,state:t.state,suggestions:t.suggestions,extras:t.extras,speech:t.speech,voice:t.voice}),"getThreadState"),Nb=class{static{i(this,"ThreadRuntimeImpl")}get path(){return this._threadBinding.path}get __internal_threadBinding(){return this._threadBinding}_threadBinding;_stateBinding;constructor(t,e){const s=new Ge({path:t.path,getState:i(()=>Mb(t.getState(),e.getState()),"getState"),subscribe:i(n=>{const r=t.subscribe(n),o=e.subscribe(n);return()=>Bs([r,o])},"subscribe")});this._stateBinding=s,this._threadBinding={path:t.path,getState:i(()=>t.getState(),"getState"),getStateState:i(()=>s.getState(),"getStateState"),outerSubscribe:i(n=>t.outerSubscribe(n),"outerSubscribe"),subscribe:i(n=>t.subscribe(n),"subscribe")},this.composer=new Ib(new qn({path:{...this.path,ref:`${this.path.ref}.composer`,composerSource:"thread"},getState:i(()=>this._threadBinding.getState().composer,"getState"),subscribe:i(n=>this._threadBinding.subscribe(n),"subscribe")})),this.__internal_bindMethods()}__internal_bindMethods(){this.append=this.append.bind(this),this.deleteMessage=this.deleteMessage.bind(this),this.resumeRun=this.resumeRun.bind(this),this.importExternalState=this.importExternalState.bind(this),this.exportExternalState=this.exportExternalState.bind(this),this.startRun=this.startRun.bind(this),this.cancelRun=this.cancelRun.bind(this),this.unstable_notifySessionReset=this.unstable_notifySessionReset.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.connectVoice=this.connectVoice.bind(this),this.disconnectVoice=this.disconnectVoice.bind(this),this.muteVoice=this.muteVoice.bind(this),this.unmuteVoice=this.unmuteVoice.bind(this),this.getVoiceVolume=this.getVoiceVolume.bind(this),this.subscribeVoiceVolume=this.subscribeVoiceVolume.bind(this),this.export=this.export.bind(this),this.import=this.import.bind(this),this.reset=this.reset.bind(this),this.getMessageByIndex=this.getMessageByIndex.bind(this),this.getMessageById=this.getMessageById.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getModelContext=this.getModelContext.bind(this),this.getState=this.getState.bind(this)}composer;getState(){return this._threadBinding.getStateState()}append(t){Ll("Message append",this._threadBinding.getState().append(jb(this._threadBinding.getState().messages,t)))}deleteMessage(t){return this._threadBinding.getState().deleteMessage(t)}subscribe(t){return this._stateBinding.subscribe(t)}getModelContext(){return this._threadBinding.getState().getModelContext()}startRun(t){return this._threadBinding.getState().startRun(Rb(t))}resumeRun(t){return this._threadBinding.getState().resumeRun(Eb(t))}exportExternalState(){return this._threadBinding.getState().exportExternalState()}importExternalState(t){this._threadBinding.getState().importExternalState(t)}cancelRun(){this._threadBinding.getState().cancelRun()}unstable_notifySessionReset(){this._threadBinding.getState().unstable_notifySessionReset()}stopSpeaking(){return this._threadBinding.getState().stopSpeaking()}connectVoice(){this._threadBinding.getState().connectVoice()}disconnectVoice(){this._threadBinding.getState().disconnectVoice()}getVoiceVolume(){return this._threadBinding.getState().getVoiceVolume()}subscribeVoiceVolume(t){return this._threadBinding.getState().subscribeVoiceVolume(t)}muteVoice(){this._threadBinding.getState().muteVoice()}unmuteVoice(){this._threadBinding.getState().unmuteVoice()}export(){return this._threadBinding.getState().export()}import(t){this._threadBinding.getState().import(t)}reset(t){this._threadBinding.getState().reset(t)}getMessageByIndex(t){if(t<0)throw new Error("Message index must be >= 0");return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[${t}]`,messageSelector:{type:"index",index:t}},()=>{const e=this._threadBinding.getState().messages,s=e[t];if(s)return{message:s,parentId:e[t-1]?.id??null,index:t}})}getMessageById(t){return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[messageId=${JSON.stringify(t)}]`,messageSelector:{type:"messageId",messageId:t}},()=>this._threadBinding.getState().getMessageById(t))}_getMessageRuntime(t,e){return new Ab(new Ge({path:t,getState:i(()=>{const{message:s,parentId:n,index:r}=e()??{},{messages:o,speech:a}=this._threadBinding.getState();if(!s||n===void 0||r===void 0)return Xe;const l=this._threadBinding.getState().getBranches(s.id);return{...s,[Zt]:s[Zt],index:r,isLast:o.at(-1)?.id===s.id,parentId:n,branchNumber:l.indexOf(s.id)+1,branchCount:l.length,speech:a?.messageId===s.id?a:void 0}},"getState"),subscribe:i(s=>this._threadBinding.subscribe(s),"subscribe")}),this._threadBinding)}_eventSubscriptionSubjects=new Map;unstable_on(t,e){let s=this._eventSubscriptionSubjects.get(t);return s||(s=new ol({event:t,binding:this._threadBinding,notifyOnRebind:t==="modelContextUpdate"}),this._eventSubscriptionSubjects.set(t,s)),s.subscribe(e)}},Ns=new WeakMap,Xs=i(t=>{let e=Ns.get(t);return e||(e=new AbortController,Ns.set(t,e)),e.signal},"captureThreadRuntimeGeneration"),fa=new WeakMap,zl=i(t=>{let e=fa.get(t);return e||(e=new AbortController,fa.set(t,e)),e},"disposalOf"),Db=i(t=>zl(t).signal,"captureThreadRuntimeDisposal"),Ob=i(t=>{const e=Ns.get(t);e?.signal.aborted||(Ns.delete(t),e?.abort())},"invalidateThreadRuntime"),Pb=i(t=>{if(t.voice)try{t.disconnectVoice()}catch{}},"endVoiceSession"),Hl=i(t=>{const e=Ns.get(t)??new AbortController;Ns.set(t,e),e.abort(),zl(t).abort(),Pb(t)},"disposeThreadRuntime"),An=class{static{i(this,"ThreadListItemRuntimeImpl")}get path(){return this._core.path}_core;_threadListBinding;constructor(t,e){this._core=t,this._threadListBinding=e,this.__internal_bindMethods()}__internal_bindMethods(){this.switchTo=this.switchTo.bind(this),this.rename=this.rename.bind(this),this.updateCustom=this.updateCustom.bind(this),this.archive=this.archive.bind(this),this.unarchive=this.unarchive.bind(this),this.delete=this.delete.bind(this),this.initialize=this.initialize.bind(this),this.generateTitle=this.generateTitle.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getState=this.getState.bind(this),this.detach=this.detach.bind(this)}getState(){return this._core.getState()}switchTo(t){const e=this._core.getState();return this._threadListBinding.switchToThread(e.id,t)}rename(t){const e=this._core.getState();return this._threadListBinding.rename(e.id,t)}updateCustom(t){const e=this._core.getState();if(!this._threadListBinding.updateCustom)throw new Error("Thread list runtime does not support updating custom metadata");return this._threadListBinding.updateCustom(e.id,t)}archive(){const t=this._core.getState();return this._threadListBinding.archive(t.id)}unarchive(){const t=this._core.getState();return this._threadListBinding.unarchive(t.id)}delete(){const t=this._core.getState();return this._threadListBinding.delete(t.id)}initialize(){const t=this._core.getState();return this._threadListBinding.initialize(t.id)}generateTitle(t){const e=this._core.getState();return this._threadListBinding.generateTitle(e.id,t)}unstable_on(t,e){let s=this._core.getState().isMain,n=this._core.getState().id;return this.subscribe(()=>{const r=this._core.getState(),o=r.isMain,a=r.id;s===o&&n===a||(s=o,n=a,!(t==="switchedTo"&&!o)&&(t==="switchedAway"&&o||dt([e],{},`Thread list item "${t}"`)))})}subscribe(t){return this._core.subscribe(t)}detach(){const t=this._core.getState();this._threadListBinding.detach(t.id)}__internal_getRuntime(){return this}},Mr=Promise.resolve(),Bb=i(()=>{},"NOOP_UNSUBSCRIBE"),$b=i(t=>({mainThreadId:t.mainThreadId,newThreadId:t.newThreadId,threadIds:t.threadIds,archivedThreadIds:t.archivedThreadIds,isLoading:t.isLoading,loadError:t.loadError,isLoadingMore:t.isLoadingMore??!1,hasMore:t.hasMore??!1,threadItems:t.threadItems}),"getThreadListState"),En=i((t,e)=>{if(e===void 0)return Xe;const s=t.getItemById(e);return s?{id:s.id,remoteId:s.remoteId,externalId:s.externalId,title:s.title,status:s.status,lastMessageAt:s.lastMessageAt,custom:s.custom,isMain:s.id===t.mainThreadId,isRunning:t.unstable_isThreadRunning?.(s.id)??!1}:Xe},"getThreadListItemState"),Lb=class{static{i(this,"ThreadListRuntimeImpl")}_getState;_stateBinding;_core;_runtimeFactory;constructor(t,e=Nb){this._core=t,this._runtimeFactory=e;const s=new Vi({path:{},getState:i(()=>$b(t),"getState"),subscribe:i(n=>t.subscribe(n),"subscribe")});this._getState=s.getState.bind(s),this._stateBinding=s,this._mainThreadListItemRuntime=new An(new Ge({path:{ref:"threadItems[main]",threadSelector:{type:"main"}},getState:i(()=>En(this._core,this._core.mainThreadId),"getState"),subscribe:i(n=>this._core.subscribe(n),"subscribe")}),this._core),this.main=new e(new qn({path:{ref:"threads.main",threadSelector:{type:"main"}},getState:i(()=>t.getMainThreadRuntimeCore(),"getState"),subscribe:i(n=>t.subscribe(n),"subscribe")}),this._mainThreadListItemRuntime),this.__internal_bindMethods()}__internal_bindMethods(){this.switchToThread=this.switchToThread.bind(this),this.switchToNewThread=this.switchToNewThread.bind(this),this.unstable_subscribeThreadEvents=this.unstable_subscribeThreadEvents.bind(this),this.getLoadThreadsPromise=this.getLoadThreadsPromise.bind(this),this.reload=this.reload.bind(this),this.reloadMainThread=this.reloadMainThread.bind(this),this.loadMore=this.loadMore.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getById=this.getById.bind(this),this.getItemById=this.getItemById.bind(this),this.getItemByIndex=this.getItemByIndex.bind(this),this.getArchivedItemByIndex=this.getArchivedItemByIndex.bind(this)}switchToThread(t,e){return this._core.switchToThread(t,e)}switchToNewThread(){return this._core.switchToNewThread()}unstable_subscribeThreadEvents(t){return this._core.unstable_subscribeThreadEvents?.(t)??Bb}getLoadThreadsPromise(){return this._core.getLoadThreadsPromise()}reload(){return this._core.reload?.()??Mr}reloadMainThread(){return this._core.reloadMainThread?.()??Mr}loadMore(){return this._core.loadMore?.()??Mr}getState(){return this._getState()}subscribe(t){return this._stateBinding.subscribe(t)}_mainThreadListItemRuntime;main;get mainItem(){return this._mainThreadListItemRuntime}_createItemStateBinding(t){return new Ge({path:{ref:`threadItems[threadId=${t}]`,threadSelector:{type:"threadId",threadId:t}},getState:i(()=>En(this._core,t),"getState"),subscribe:i(e=>this._core.subscribe(e),"subscribe")})}getById(t){return new this._runtimeFactory(new qn({path:{ref:`threads[threadId=${JSON.stringify(t)}]`,threadSelector:{type:"threadId",threadId:t}},getState:i(()=>this._core.getThreadRuntimeCore(t),"getState"),subscribe:i(e=>this._core.subscribe(e),"subscribe")}),this._createItemStateBinding(t))}getItemByIndex(t){return new An(new Ge({path:{ref:`threadItems[${t}]`,threadSelector:{type:"index",index:t}},getState:i(()=>En(this._core,this._core.threadIds[t]),"getState"),subscribe:i(e=>this._core.subscribe(e),"subscribe")}),this._core)}getArchivedItemByIndex(t){return new An(new Ge({path:{ref:`archivedThreadItems[${t}]`,threadSelector:{type:"archiveIndex",index:t}},getState:i(()=>En(this._core,this._core.archivedThreadIds[t]),"getState"),subscribe:i(e=>this._core.subscribe(e),"subscribe")}),this._core)}getItemById(t){return new An(this._createItemStateBinding(t),this._core)}},Vb=class{static{i(this,"AssistantRuntimeImpl")}threads;_thread;_core;constructor(t){this._core=t,this.threads=new Lb(t.threads),this._thread=this.threads.main,this.__internal_bindMethods()}__internal_bindMethods(){this.registerModelContextProvider=this.registerModelContextProvider.bind(this)}get thread(){return this._thread}registerModelContextProvider(t){return this._core.registerModelContextProvider(t)}},Fb=class{static{i(this,"BaseAssistantRuntimeCore")}_contextProvider=new al;registerModelContextProvider(t){return this._contextProvider.registerModelContextProvider(t)}getModelContextProvider(){return this._contextProvider}},zt=Object.freeze([]),ws="DEFAULT_THREAD_ID",Ub=Object.freeze([ws]),qb=Object.freeze({id:ws,remoteId:void 0,externalId:void 0,status:"regular"}),zb=Promise.resolve(),ma=Object.freeze(Je({[ws]:qb})),Hb=class extends Li{static{i(this,"ExternalStoreThreadListRuntimeCore")}_mainThreadId=ws;_threads=Ub;_archivedThreads=zt;_threadData=ma;adapter={};get isLoading(){return this.adapter.isLoading??!1}get newThreadId(){}get threadIds(){return this._threads}get archivedThreadIds(){return this._archivedThreads}get threadItems(){return this._threadData}getLoadThreadsPromise(){return zb}_mainThread;get mainThreadId(){return this._mainThreadId}threadFactory;constructor(t={},e){super(),this.threadFactory=e,this.__internal_setAdapter(t,!0)}getMainThreadRuntimeCore(){return this._mainThread}getThreadRuntimeCore(){throw new Error("Method not implemented.")}getItemById(t){return Object.hasOwn(this._threadData,t)?this._threadData[t]:void 0}__internal_setAdapter(t,e=!1){const s=this.adapter;this.adapter=t;const n=t.threadId??ws,r=t.threads??zt,o=t.archivedThreads??zt,a=s.threadId??ws,l=s.threads??zt,u=s.archivedThreads??zt;!e&&(s.isLoading??!1)===(t.isLoading??!1)&&a===n&&l===r&&u===o||((l!==r||u!==o||a!==n)&&(this._threadData=Je(ma,Object.fromEntries(t.threads?.map(d=>[d.id,{...d,remoteId:d.remoteId,externalId:d.externalId,status:"regular"}])??[]),Object.fromEntries(t.archivedThreads?.map(d=>[d.id,{...d,remoteId:d.remoteId,externalId:d.externalId,status:"archived"}])??[]))),l!==r&&(this._threads=this.adapter.threads?.map(d=>d.id)??zt),u!==o&&(this._archivedThreads=this.adapter.archivedThreads?.map(d=>d.id)??zt),(e||a!==n)&&(e||Hl(this._mainThread),this._mainThreadId=n,this._mainThread=this.threadFactory()),Object.hasOwn(this._threadData,this._mainThreadId)||(this._threadData=Je(this._threadData,{[this._mainThreadId]:{id:this._mainThreadId,remoteId:void 0,externalId:void 0,status:"regular"}})),this._notifySubscribers())}async reloadMainThread(){this._mainThread.unstable_refetchThread&&await this._mainThread.unstable_refetchThread()}async switchToThread(t,e){if(this._mainThreadId===t)return;const s=this.adapter.onSwitchToThread;if(!s)throw new Error("External store adapter does not support switching to thread");await s(t)}async switchToNewThread(){const t=this.adapter.onSwitchToNewThread;if(!t)throw new Error("External store adapter does not support switching to new thread");await t()}async rename(t,e){const s=this.adapter.onRename;if(!s)throw new Error("External store adapter does not support renaming");await s(t,e)}async updateCustom(t,e){const s=this.adapter.onUpdateCustom;if(!s)throw new Error("External store adapter does not support updating custom metadata");await s(t,e)}async detach(){}async archive(t){const e=this.adapter.onArchive;if(!e)throw new Error("External store adapter does not support archiving");await e(t)}async unarchive(t){const e=this.adapter.onUnarchive;if(!e)throw new Error("External store adapter does not support unarchiving");await e(t)}async delete(t){const e=this.adapter.onDelete;if(!e)throw new Error("External store adapter does not support deleting");await e(t)}initialize(t){return Promise.resolve({remoteId:t,externalId:void 0})}generateTitle(){throw new Error("Method not implemented.")}},Wl={fromArray:i(t=>{const e=t.map(s=>nn(s,ft(),ia(s.content)));return{messages:e.map((s,n)=>({parentId:n>0?e[n-1].id:null,message:s}))}},"fromArray"),fromBranchableArray:i((t,e)=>({...e?.headId!==void 0?{headId:e.headId}:void 0,messages:t.map(({message:s,parentId:n})=>{if(!s.id)throw new Error("ExportedMessageRepository.fromBranchableArray: Each message must have an 'id' field set.");return{parentId:n,message:nn(s,s.id,ia(s.content))}})}),"fromBranchableArray")},Rn=i(t=>{let e=t;for(;e.next;)e=e.next;return"current"in e?e:null},"findHead"),Wb=i((t,e)=>{const s=new Set(t.map(a=>a.message.id)),n=new Set,r=new Map,o=[];for(const a of t){const{parentId:l}=a;if(l!==null&&s.has(l)&&!n.has(l)&&!e(l)){const u=r.get(l);u?u.push(a):r.set(l,[a]);continue}for(let u=o.push(a)-1;u<o.length;u++){const{id:d}=o[u].message;if(n.has(d))continue;n.add(d);const h=r.get(d);h&&(r.delete(d),o.push(...h))}}for(const a of r.values())o.push(...a);return o},"withParentsFirst"),Kb=class{static{i(this,"CachedValue")}_value=null;func;constructor(t){this.func=t}get value(){return this._value===null&&(this._value=this.func()),this._value}dirty(){this._value=null}},Kl=class{static{i(this,"MessageRepository")}messages=new Map;head=null;root={children:[],next:null};updateLevels(t,e){const s=[{message:t,level:e}];for(;s.length>0;){const n=s.pop();n.message.level=n.level;for(const r of n.message.children){const o=this.messages.get(r);o&&s.push({message:o,level:n.level+1})}}}selectPathTo(t){for(let e=t;e;e=e.prev)(e.prev??this.root).next=e}performOp(t,e,s){const n=e.prev??this.root,r=t??this.root;if(!(s==="relink"&&n===r)){if(s==="relink"){for(let o=t;o;o=o.prev)if(o.current.id===e.current.id)throw new Error("MessageRepository(performOp/relink): A message with the same id already exists in the parent tree. This error occurs if the same message id is found multiple times. This is likely an internal bug in assistant-ui.")}if(s!=="link"&&(n.children=n.children.filter(o=>o!==e.current.id),n.next===e)){const o=n.children.at(-1),a=o?this.messages.get(o):null;if(a===void 0)throw new Error("MessageRepository(performOp/cut): Fallback sibling message not found. This is likely an internal bug in assistant-ui.");n.next=a}if(s!=="cut"){r.children=[...r.children,e.current.id],e.prev=t,Rn(e)===this.head?this.selectPathTo(e):r.next===null&&(r.next=e,this.head===r&&(this.head=Rn(e)));const o=t?t.level+1:0;this.updateLevels(e,o)}}}_messages=new Kb(()=>{const t=new Array((this.head?.level??-1)+1);for(let e=this.head;e;e=e.prev)t[e.level]=e.current;return t});get headId(){return this.head?.current.id??null}get canonicalHeadId(){let t=this.head;for(;t?.current.metadata?.isOptimistic;)t=t.prev;return t?.current.id??null}getMessages(t){if(t===void 0||t===this.head?.current.id)return this._messages.value;const e=this.messages.get(t);if(!e)throw new Error("MessageRepository(getMessages): Head message not found. This is likely an internal bug in assistant-ui.");const s=new Array(e.level+1);for(let n=e;n;n=n.prev)s[n.level]=n.current;return s}addOrUpdateMessage(t,e){const s=this.messages.get(e.id),n=t?this.messages.get(t):null;if(n===void 0)throw new Error("MessageRepository(addOrUpdateMessage): Parent message not found. This is likely an internal bug in assistant-ui.");if(s){this.performOp(n,s,"relink"),s.current=e,this._messages.dirty();return}const r={prev:n,current:e,next:null,children:[],level:n?n.level+1:0};this.messages.set(e.id,r),this.performOp(n,r,"link"),this.head===n&&(this.head=r),this._messages.dirty()}getMessage(t){const e=this.messages.get(t);if(!e)throw new Error("MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui.");return{parentId:e.prev?.current.id??null,message:e.current,index:e.level}}deleteMessage(t,e){const s=this.messages.get(t);if(!s)throw new Error("MessageRepository(deleteMessage): Message not found. This is likely an internal bug in assistant-ui.");const n=e===void 0?s.prev:e===null?null:this.messages.get(e);if(n===void 0)throw new Error("MessageRepository(deleteMessage): Replacement not found. This is likely an internal bug in assistant-ui.");for(let r=n;r;r=r.prev)if(r===s)throw new Error("MessageRepository(deleteMessage): Replacement is the deleted message or one of its descendants. This is likely an internal bug in assistant-ui.");for(const r of s.children){const o=this.messages.get(r);if(!o)throw new Error("MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui.");this.performOp(n,o,"relink")}this.performOp(null,s,"cut"),this.messages.delete(t),this.head===s&&(this.head=Rn(n??this.root)),this._messages.dirty()}hasChildren(t){return(this.messages.get(t)?.children.length??0)>0}getBranches(t){const e=this.messages.get(t);if(!e)throw new Error("MessageRepository(getBranches): Message not found. This is likely an internal bug in assistant-ui.");const{children:s}=e.prev??this.root;return s}evictOffBranchOptimisticMessages(t,e){if(!t)return;const s=new Set;for(let r=e;r;r=r.prev)s.add(r.current.id);const n=[];for(let r=t;r&&!s.has(r.current.id);r=r.prev)r.current.metadata?.isOptimistic&&n.push(r.current.id);for(const r of n)this.messages.has(r)&&this.deleteMessage(r)}switchToBranch(t){const e=this.messages.get(t);if(!e)throw new Error("MessageRepository(switchToBranch): Branch not found. This is likely an internal bug in assistant-ui.");const s=this.head;this.selectPathTo(e),this.head=Rn(e),this.evictOffBranchOptimisticMessages(s,this.head),this._messages.dirty()}resetHead(t){if(t===null){this.clear();return}const e=this.messages.get(t);if(!e)throw new Error("MessageRepository(resetHead): Branch not found. This is likely an internal bug in assistant-ui.");const s=this.head;if(e.children.length>0){const n=[...e.children];for(;n.length>0;){const r=n.pop(),o=this.messages.get(r);if(o){for(const a of o.children)n.push(a);this.messages.delete(r)}}e.children=[],e.next=null}this.head=e,this.selectPathTo(e),this.evictOffBranchOptimisticMessages(s,this.head),this._messages.dirty()}clear(){this.messages.clear(),this.head=null,this.root={children:[],next:null},this._messages.dirty()}export(){const t=[],e=[...this.root.children].reverse();for(;e.length>0;){const s=this.messages.get(e.pop());if(!s)continue;for(let r=s.children.length-1;r>=0;r--)e.push(s.children[r]);if(s.current.metadata?.isOptimistic)continue;let n=s.prev;for(;n&&n.current.metadata?.isOptimistic;)n=n.prev;t.push({message:s.current,parentId:n?.current.id??null})}return{headId:this.canonicalHeadId,messages:t}}import({headId:t,messages:e}){const s=Wb(e,n=>this.messages.has(n));for(const{message:n,parentId:r}of s)this.addOrUpdateMessage(r,n);this.resetHead(t??s.at(-1)?.message.id??null)}},on=Object.freeze([]);function*Hi(t){for(const e of t)if(!(e?.role!=="assistant"||!Array.isArray(e.content)))for(const s of e.content)!s||s.type!=="tool-call"||(yield{part:s,messageId:e.id},s.messages?.length&&(yield*Hi(s.messages)))}i(Hi,"walkToolCallTree");function pa(t,e){if(e==="*")return!0;const s=e.split(",").map(o=>o.trim().toLowerCase()),n=t.name.toLowerCase(),r=t.type.split(";",1)[0].trim().toLowerCase();for(const o of s){if(o.startsWith(".")&&n.endsWith(o)||o.includes("/")&&o===r)return!0;if(o.endsWith("/*")){const a=o.split("/")[0];if(r.startsWith(`${a}/`))return!0}}return!1}i(pa,"fileMatchesAccept");function Jb(t){const e=ft();return t.type==="image"?{id:e,type:"image",name:t.filename??"image",content:[t],status:{type:"complete"}}:t.type==="file"?{id:e,type:"document",name:t.filename??"document",contentType:t.mimeType,content:[t],status:{type:"complete"}}:t.type==="audio"?{id:e,type:"audio",name:`audio.${t.audio.format}`,contentType:`audio/${t.audio.format}`,content:[t],status:{type:"complete"}}:{id:e,type:"data",name:t.name,content:[t],status:{type:"complete"}}}i(Jb,"partToCompleteAttachment");function Qb(t){const e=[];for(const s of t)s.type!=="text"&&e.push(Jb(s));return e}i(Qb,"liftNonTextParts");var Yb=i(t=>"content"in t&&!("lastModified"in t),"isCreateAttachment"),lt=i(t=>t.status.type==="complete","isAttachmentComplete"),Gb=class{static{i(this,"AttachmentAddOperations")}operations=new Set;uploading=new Map;start(){const t={cancelled:!1,attachmentIds:new Set};return this.operations.add(t),t}accept(t,e){if(t.cancelled)return!1;t.attachmentIds.add(e.id);const s=this.uploading.get(e.id);return s?.operation!==t&&(s||e.status.type==="running")&&this.uploading.set(e.id,{operation:t,waiters:s?.waiters??new Set}),e.status.type!=="running"&&this.settle(e.id,t),!0}finish(t){this.operations.delete(t);for(const e of t.attachmentIds)this.settle(e,t)}isCancelled(t){return t.cancelled}cancel(t){for(const e of[...this.operations])e.attachmentIds.has(t)&&(e.cancelled=!0,this.operations.delete(e));this.settle(t)}cancelAll(){for(const t of this.operations)t.cancelled=!0;this.operations.clear();for(const t of[...this.uploading.keys()])this.settle(t)}whenSendable(t){const e=this.uploading.get(t);if(e)return new Promise(s=>e.waiters.add(s))}settle(t,e){const s=this.uploading.get(t);if(s&&!(e&&s.operation!==e)){this.uploading.delete(t);for(const n of s.waiters)n()}}},Xb=i(async(t,e)=>{if(Symbol.asyncIterator in t){for await(const s of t)if(!e(s))break}else e(await t)},"drainAttachmentAdd"),Zb=class{static{i(this,"AttachmentSendOperations")}entries=new WeakMap;removed=new WeakSet;markRemoved(t){this.removed.add(t)}unmarkRemoved(t){this.removed.delete(t)}isRemoved(t){return this.removed.has(t)}async send(t,e,s){if(lt(t))return t;const n=this.entries.get(t)??{};if(n.result)return n.result;if(!e)throw new Error("Attachments are not supported");this.entries.set(t,n);const r=await e.send(t,s?{signal:s}:void 0);return n.result=r,r}transfer(t,e){const s=this.entries.get(t);return s&&this.entries.set(e,s),e}},Jl=class extends Li{static{i(this,"BaseComposerRuntimeCore")}isEditing=!0;enrichWithComposerMetadata(t,e){return e?{...t,metadata:{...t.metadata,custom:{...t.metadata?.custom,...e}}}:t}get attachmentAccept(){return this.getAttachmentAdapter()?.accept??"*"}_attachments=[];get attachments(){return this._attachments}setAttachments(t){this._attachments=t,this._notifySubscribers()}get isEmpty(){return!this.text.trim()&&!this.attachments.length}_text="";get text(){return this._text}_role="user";get role(){return this._role}_runConfig={};get runConfig(){return this._runConfig}_quote=void 0;get quote(){return this._quote}setQuote(t){this._quote!==t&&(this._quote=t,this._notifySubscribers())}setText(t){this._text!==t&&(this._text=t,this._rebaseDictation(t),this._notifySubscribers())}_rebaseDictation(t){if(!this._dictation)return;this._dictationBaseText=t,this._currentInterimText="";const{status:e,inputDisabled:s}=this._dictation;this._dictation=s?{status:e,inputDisabled:s}:{status:e}}setRole(t){this._role!==t&&(this._role=t,this._notifySubscribers())}setRunConfig(t){this._runConfig!==t&&(this._runConfig=t,this._notifySubscribers())}_submission;_submissionSend;_inTransit=[];_inTransitSubmissions=[];_sendGeneration=0;_attachmentAddOperations=new Gb;_attachmentSends=new Zb;get submission(){return this._submission}get inTransit(){return this._inTransitSubmissions}get isSubmitting(){return this._submission!==void 0}get detachesDraftOnSend(){return!0}threadMessageIds(t){}settleInTransit(){if(this._inTransit.length===0)return;const t=new Set,e=this._inTransit.filter(({submission:s,known:n})=>{const r=this.threadMessageIds(s.role)?.find(o=>!n.has(o)&&!t.has(o));return r===void 0?!0:(t.add(r),!1)});e.length!==this._inTransit.length&&(this._setInTransit(e.map(s=>({...s,known:new Set([...s.known,...t])}))),this._notifySubscribers())}_setInTransit(t){this._inTransit=t,this._inTransitSubmissions=t.map(e=>e.submission)}_leaveTransit(t){const e=this._inTransit.filter(s=>s.submission!==t);return e.length===this._inTransit.length?!1:(this._setInTransit(e),!0)}_cancelAttachmentAdd(t){this._attachmentAddOperations.cancel(t)}_cancelAllAttachmentAdds(){this._attachmentAddOperations.cancelAll()}_emptyTextAndAttachments(){this._attachments=[],this._text="",this._rebaseDictation(""),this._notifySubscribers()}async _onClearAttachments(){const t=this.getAttachmentAdapter();if(t){const e=this._attachments.filter(s=>!lt(s));await Promise.all(e.map(async s=>t.remove(s)))}}async reset(){this._cancelAllAttachmentAdds(),this._sendGeneration++;const t=this._discardSubmission();if(this._attachments.length===0&&this._text===""&&this._role==="user"&&Object.keys(this._runConfig).length===0&&this._quote===void 0){await t;return}this._role="user",this._runConfig={},this._quote=void 0;const e=this._onClearAttachments();this._emptyTextAndAttachments(),await Promise.all([e,t])}async clearAttachments(){if(this._cancelAllAttachmentAdds(),this.isSubmitting)for(const e of this._attachments)this._attachmentSends.markRemoved(e);const t=this._onClearAttachments();this.setAttachments([]),await t}async send(t){if(!this.canSend||this.isSubmitting)return;if(this._dictationSession){const l=this._activeDictationSessionId;try{this._dictationSession.cancel()}catch{}finally{this._cleanupDictation({sessionId:l})}}const e=this.attachments.filter(l=>!this._attachmentSends.isRemoved(l));if(!this.text.trim()&&e.length===0)return;const s={id:ft(),role:this.role,text:this.text,quote:this._quote,attachments:e},n={options:t,runConfig:this.runConfig},r=e.filter(lt),o=r.length===e.length;if(o||(this._submission=s,this._submissionSend={...n,controller:new AbortController}),this.detachesDraftOnSend){const l=new Set(e);this._attachments=this._attachments.filter(u=>!l.has(u)),this._text="",this._rebaseDictation(""),this._quote=void 0}const a=++this._sendGeneration;if(this._notifySubscribers(),o){this._dispatch(a,s,r,n,!1);return}await this._prepareSubmission(a)}async _prepareSubmission(t){const e=this.getAttachmentAdapter(),s=(this._submission?.attachments??[]).flatMap(d=>{const h=this._attachmentAddOperations.whenSendable(d.id);return h?[h]:[]});if(s.length>0){if(await Promise.all(s),t!==this._sendGeneration)return;this._refreshSubmissionAttachments()}const n=this._submission,r=this._submissionSend;if(!n||!r)return;const o=n.attachments.filter(d=>!this._attachmentSends.isRemoved(d));for(const d of o)this._cancelAttachmentAdd(d.id);const a=await Promise.allSettled(o.map(d=>this._attachmentSends.send(d,e,r.controller.signal)));if(t!==this._sendGeneration)return;const l=a.find(d=>d.status==="rejected");if(l){this._returnSubmissionToDraft(o,a,l.reason);return}const u=a.flatMap((d,h)=>this._attachmentSends.isRemoved(o[h])||d.status==="rejected"?[]:[d.value]);this._dispatch(t,n,u,r,!0)}_dispatch(t,e,s,n,r){const o={createdAt:new Date,role:e.role,content:e.text?[{type:"text",text:e.text}]:[],attachments:s,runConfig:n.runConfig,metadata:{custom:{...e.quote?{quote:e.quote}:{}}}},a={...e,attachments:s},l=this.queue.length;if(r){if(this._submission=void 0,this._submissionSend=void 0,!this.detachesDraftOnSend){const h=new Map(s.map(f=>[f.id,f]));this._attachments=this._attachments.map(f=>h.get(f.id)??f)}const d=this.threadMessageIds(e.role);d&&this._setInTransit([...this._inTransit,{submission:a,known:new Set(d)}])}let u;try{u=this.handleSend(o,n.options)}catch{this._leaveTransit(a),t===this._sendGeneration?this._returnToDraft(a):this._notifySubscribers();return}u&&u.catch(d=>{const h=this._leaveTransit(a);t===this._sendGeneration&&$l(d)?this._returnToDraft(a):h&&this._notifySubscribers()}),this._notifyEventSubscribers("send",{chars:e.text.length,attachments:s.length}),r&&(this.queue.length>l&&this._leaveTransit(a),this._notifySubscribers(),this.settleInTransit())}_refreshSubmissionAttachments(){const t=this._submission;if(!t)return;const e=t.attachments.filter(s=>!this._attachmentSends.isRemoved(s));e.length!==t.attachments.length&&(this._submission={...t,attachments:e})}_returnSubmissionToDraft(t,e,s){const n=this._submission;if(!n)return;const r=new Map;e.forEach((a,l)=>{a.status==="rejected"&&r.set(t[l].id,a.reason)});const o=n.attachments.map(a=>{if(!r.has(a.id)||lt(a))return a;const l=r.get(a.id);return this._attachmentSends.transfer(a,{...a,status:{type:"incomplete",reason:"error",message:l instanceof Error?l.message:String(l)}})});this._endSubmission(),this._returnToDraft({...n,attachments:o})}_endSubmission(){this._sendGeneration++,this._submission=void 0,this._submissionSend=void 0}__internal_dispose(){this._cancelAllAttachmentAdds(),this._submission&&(this._submissionSend?.controller.abort(),this._endSubmission(),this._notifySubscribers())}cancelSubmission(){const t=this._submission;t&&(this._submissionSend?.controller.abort(),this._endSubmission(),this._returnToDraft(t))}_returnToDraft(t){if(this.detachesDraftOnSend){const e=t.attachments.filter(n=>!this._attachmentSends.isRemoved(n));this._attachments=[...e,...this._attachments];const s=[t.text,this._text].filter(Boolean).join(`
6
- `);this._text=s,this._rebaseDictation(s),this._quote=this._quote??t.quote}else{const e=new Map(t.attachments.map(s=>[s.id,s]));this._attachments=this._attachments.map(s=>e.get(s.id)??s)}this._notifySubscribers()}async _discardSubmission(){const t=this._submission;if(!t)return;this._submissionSend?.controller.abort(),this._endSubmission(),this._notifySubscribers();const e=this.getAttachmentAdapter();if(!e)return;const s=new Set(this._attachments.map(n=>n.id));await Promise.all(t.attachments.filter(n=>!lt(n)&&!s.has(n.id)).map(async n=>e.remove(n)))}restoreDraft(t){return this._text.trim()||this._quote!==void 0||this._attachments.length>0?!1:(this._text=t.text,this._rebaseDictation(t.text),this._quote=t.quote,this._attachments=t.attachments??[],this._notifySubscribers(),!0)}retractDraft(t){const e=t.attachments!==void 0?this._attachments===t.attachments:this._attachments.length===0;this._text!==t.text||this._quote!==t.quote||!e||(this._text="",this._rebaseDictation(""),this._quote=void 0,this._attachments=[],this._notifySubscribers())}cancel(){this.isSubmitting&&!this.detachesDraftOnSend&&(this._submissionSend?.controller.abort(),this._endSubmission(),this._notifySubscribers()),this.handleCancel()}get queue(){return on}moveQueueItem(t,e){}removeQueueItem(t){}async addAttachment(t){if(Yb(t)){const o=this.getAttachmentAdapter();if(o&&!pa({name:t.name,type:t.contentType??""},o.accept)){const l=`File type ${t.contentType||"unknown"} is not accepted. Accepted types: ${o.accept}`,u=new Error(l);throw this._safeEmitAttachmentAddError("not-accepted",l,void 0,u,t.contentType),u}const a={id:t.id??ft(),type:t.type??"document",name:t.name,contentType:t.contentType,content:t.content,status:{type:"complete"}};this._attachments=[...this._attachments,a],this._notifySubscribers(),this._notifyEventSubscribers("attachmentAdd",{...a.contentType?{contentType:a.contentType}:void 0});return}const e=this.getAttachmentAdapter();if(!e){const o="Attachments are not supported",a=new Error(o);throw this._safeEmitAttachmentAddError("no-adapter",o,void 0,a,t.type),a}if(!pa({name:t.name,type:t.type},e.accept)){const o=`File type ${t.type||"unknown"} is not accepted. Accepted types: ${e.accept}`,a=new Error(o);throw this._safeEmitAttachmentAddError("not-accepted",o,void 0,a,t.type),a}const s=this._attachmentAddOperations.start(),n=i(o=>{if(!this._attachmentAddOperations.accept(s,o))return!1;const a=this._submission,l=a?.attachments.some(d=>d.id===o.id)??!1;a&&l&&(this._submission={...a,attachments:a.attachments.map(d=>d.id===o.id?this._attachmentSends.transfer(d,o):d)});const u=this._attachments.findIndex(d=>d.id===o.id);return u!==-1?this._attachments=[...this._attachments.slice(0,u),o,...this._attachments.slice(u+1)]:l||(this._attachments=[...this._attachments,o]),this._notifySubscribers(),!0},"upsertAttachment");let r;try{await Xb(e.add({file:t}),o=>(r=o,n(o)))}catch(o){if(this._attachmentAddOperations.isCancelled(s))return;throw r&&n({...r,status:{type:"incomplete",reason:"error",message:o instanceof Error?o.message:String(o)}}),this._safeEmitAttachmentAddError("adapter-error",o instanceof Error?o.message:String(o),r?.id,o instanceof Error?o:void 0,r?.contentType||t.type),o}finally{this._attachmentAddOperations.finish(s)}this._attachmentAddOperations.isCancelled(s)||(r?.status.type==="incomplete"&&r.status.reason==="error"?this._safeEmitAttachmentAddError("adapter-error",r.status.message??"Attachment upload did not complete successfully.",r.id,void 0,r.contentType||t.type):this._notifyEventSubscribers("attachmentAdd",{...r?.contentType?{contentType:r.contentType}:t.type?{contentType:t.type}:void 0}))}_safeEmitAttachmentAddError(t,e,s,n,r){try{this._notifyEventSubscribers("attachmentAddError",{reason:t,message:e,...s!==void 0&&{attachmentId:s},...n!==void 0&&{error:n},...r?{contentType:r}:void 0})}catch{}}async removeAttachment(t){const e=this._attachments.findIndex(n=>n.id===t);if(e===-1){await this._removeSubmittedAttachment(t);return}const s=this._attachments[e];if(this._cancelAttachmentAdd(t),this._attachmentSends.markRemoved(s),!lt(s)){const n=this.getAttachmentAdapter();if(!n)throw new Error("Attachments are not supported");try{await n.remove(s)}catch(r){const o=r instanceof Error?r.message:String(r);throw this._attachments=this._attachments.map(a=>a.id===t&&!lt(a)?this._attachmentSends.transfer(a,{...a,status:{type:"incomplete",reason:"error",message:o}}):a),this._notifySubscribers(),r}}this._attachments=this._attachments.filter(n=>n.id!==t),this._notifySubscribers()}async _removeSubmittedAttachment(t){const e=this._submission?.attachments.find(n=>n.id===t);if(!e)throw new Error("Attachment not found");if(this._cancelAttachmentAdd(t),this._attachmentSends.markRemoved(e),!lt(e)){const n=this.getAttachmentAdapter();if(!n)throw new Error("Attachments are not supported");try{await n.remove(e)}catch(r){throw this._failSubmittedRemoval(t,r),r}}const s=this._submission;s&&(this._submission={...s,attachments:s.attachments.filter(n=>n.id!==t)},this._notifySubscribers())}_failSubmittedRemoval(t,e){const s=this._submission;if(!s)return;const n=e instanceof Error?e.message:String(e);this._submission={...s,attachments:s.attachments.map(r=>{if(r.id!==t||lt(r))return r;const o=this._attachmentSends.transfer(r,{...r,status:{type:"incomplete",reason:"error",message:n}});return this._attachmentSends.markRemoved(o),o})},this._notifySubscribers()}_dictation;_dictationSession;_dictationUnsubscribes=[];_dictationBaseText="";_currentInterimText="";_dictationSessionIdCounter=0;_activeDictationSessionId;_isCleaningDictation=!1;get dictation(){return this._dictation}_isActiveSession(t,e){return this._activeDictationSessionId===t&&this._dictationSession===e}startDictation(){const t=this.getDictationAdapter();if(!t)throw new Error("Dictation adapter not configured");const e=this._dictationSession!==void 0;if(this._dictationSession){const u=this._dictationSession;this._cleanupDictation({notify:!1}),this._stopDictationSession(u)}const s=t.disableInputDuringDictation??!1;this._dictationBaseText=this._text,this._currentInterimText="";let n;try{n=t.listen()}catch(u){if(e)try{this._notifySubscribers()}catch{}throw u}this._dictationSession=n;const r=++this._dictationSessionIdCounter;this._activeDictationSessionId=r,this._dictation={status:n.status,inputDisabled:s};try{this._notifySubscribers()}catch{}if(!this._isActiveSession(r,n))return;const o=[],a=i(()=>{for(const u of o.splice(0))try{u()}catch{}},"releaseSetup"),l=i(u=>(o.push(u),this._isActiveSession(r,n)?!0:(a(),!1)),"keepUnsubscribe");try{if(!l(n.onSpeech(d=>{if(!this._isActiveSession(r,n))return;const h=d.isFinal!==!1,f=this._dictationBaseText&&!this._dictationBaseText.endsWith(" ")&&d.transcript?" ":"";if(h){if(this._dictationBaseText=this._dictationBaseText+f+d.transcript,this._currentInterimText="",this._text=this._dictationBaseText,this._dictation){const{transcript:p,...m}=this._dictation;this._dictation=m}this._notifySubscribers()}else this._currentInterimText=f+d.transcript,this._text=this._dictationBaseText+this._currentInterimText,this._dictation&&(this._dictation={...this._dictation,transcript:d.transcript}),this._notifySubscribers()}))||!l(n.onSpeechStart(()=>{this._isActiveSession(r,n)&&(this._dictation={status:{type:"running"},inputDisabled:s,...this._dictation?.transcript&&{transcript:this._dictation.transcript}},this._notifySubscribers())}))||!l(n.onSpeechEnd(()=>{this._cleanupDictation({sessionId:r})})))return;const u=setInterval(()=>{this._isActiveSession(r,n)&&n.status.type==="ended"&&this._cleanupDictation({sessionId:r})},100);if(!l(()=>clearInterval(u)))return;this._dictationUnsubscribes.push(...o.splice(0))}catch(u){if(a(),this._isActiveSession(r,n))try{n.cancel()}catch{}finally{this._cleanupDictation({sessionId:r})}throw u}}stopDictation(){if(!this._dictationSession)return;const t=this._dictationSession,e=this._activeDictationSessionId,s=i(()=>this._cleanupDictation({sessionId:e}),"cleanup");this._stopDictationSession(t,s)}_stopDictationSession(t,e=()=>{}){let s;try{s=t.stop()}catch{e();return}s.then(e,n=>{e()})}_cleanupDictation(t){if(t?.sessionId!==void 0&&t.sessionId!==this._activeDictationSessionId||this._isCleaningDictation)return;this._isCleaningDictation=!0;const e=i(s=>{try{s()}catch{}},"runCleanup");try{const s=this._dictationUnsubscribes;this._dictationUnsubscribes=[],this._dictationSession=void 0,this._activeDictationSessionId=void 0,this._dictation=void 0,this._dictationBaseText="",this._currentInterimText="";for(const n of s)e(n);t?.notify!==!1&&e(()=>this._notifySubscribers())}finally{this._isCleaningDictation=!1}}_eventSubscribers=new Map;_notifyEventSubscribers(t,e){const s=this._eventSubscribers.get(t);s&&dt(s,e,`Composer runtime "${t}"`)}unstable_on(t,e){const s=e;let n=this._eventSubscribers.get(t);return n||(n=new Set,this._eventSubscribers.set(t,n)),n.add(s),()=>{this._eventSubscribers.get(t)?.delete(s)}}},ga=i(t=>t.capabilities?.cancel?zi(t):!1,"isCancelable"),e0=class extends Jl{static{i(this,"DefaultThreadComposerRuntimeCore")}get canCancel(){return this.isSubmitting||ga(this.runtime)}get canSend(){if(this.isEmpty||this.runtime.isSendDisabled||this.isSubmitting)return!1;const t=this.runtime.voice;return t?t.canSendText&&this.role==="user"&&this.attachments.length===0:!0}cancel(){if(!this.isSubmitting){super.cancel();return}this.cancelSubmission(),ga(this.runtime)&&super.cancel()}threadMessageIds(t){return this.runtime.messages.filter(e=>e.role===t).map(e=>e.id)}_queueCache;get queue(){const t=this.runtime.getSteerQueueItems?.()??on,e=this.runtime.getQueueItems?.()??on,s=this._queueCache;if(s&&s.steer===t&&s.queue===e)return s.flat;const n=t.length===0?e:e.length===0?t:[...t,...e];return this._queueCache={steer:t,queue:e,flat:n},n}moveQueueItem(t,e){this.runtime.moveQueueItem?.(t,e)}removeQueueItem(t){this.runtime.removeQueueItem?.(t)}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}runtime;constructor(t){super(),this.runtime=t,this.connect()}connect(){let t=!1,e=this.runtime.isSendDisabled,s=this.runtime.voice?.canSendText,n=this.queue;return this.runtime.subscribe(()=>{this.settleInTransit();let r=!1;const o=this.canCancel;t!==o&&(t=o,r=!0),e!==this.runtime.isSendDisabled&&(e=this.runtime.isSendDisabled,r=!0);const a=this.runtime.voice?.canSendText;s!==a&&(s=a,r=!0),n!==this.queue&&(n=this.queue,r=!0),r&&this._notifySubscribers()})}async handleSend(t,e){return this.runtime.append({...t,parentId:this.runtime.messages.at(-1)?.id??null,sourceId:null,startRun:e?.startRun,steer:e?.steer})}async handleCancel(){this.runtime.cancelRun()}},t0=class extends Jl{static{i(this,"DefaultEditComposerRuntimeCore")}get canCancel(){return!0}get detachesDraftOnSend(){return!1}get canSend(){return!this.isEmpty&&!this.runtime.voice&&!this.isSubmitting}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}_nonTextPassthrough;_parentId;_sourceId;runtime;endEditCallback;_ended=!1;constructor(t,e,{parentId:s,message:n}){super(),this.runtime=t;let r=t.voice!==void 0;const o=t.subscribe(()=>{const l=t.voice!==void 0;l!==r&&(r=l,this._notifySubscribers())});this.endEditCallback=()=>{o(),e()},this._parentId=s,this._sourceId=n.id,this.setText(js(n)),this.setRole(n.role);let a;n.role==="user"?(a=[...n.attachments??[],...Qb(n.content)],this._nonTextPassthrough=[]):(a=n.attachments??[],this._nonTextPassthrough=n.content.filter(l=>l.type!=="text")),this.setAttachments(a),this.setRunConfig({...t.composer.runConfig})}get parentId(){return this._parentId}get sourceId(){return this._sourceId}async handleSend(t,e){const s=this._nonTextPassthrough.length>0?[...t.content,...this._nonTextPassthrough]:t.content,n=this.runtime.append({...t,content:s,parentId:this._parentId,sourceId:this._sourceId,startRun:e?.startRun});return this.handleCancel(),n}handleCancel(){this._ended||(this._ended=!0,this.reset().catch(t=>{}),this.endEditCallback(),this._notifySubscribers())}},s0=class extends Li{static{i(this,"BaseThreadRuntimeCore")}_isInitialized=!1;repository=new Kl;_voiceMessages=[];_voiceGeneration=0;_cachedMergedMessages=null;_cachedVoiceGeneration=-1;_cachedMergedBase=null;_markVoiceMessagesDirty(){this._voiceGeneration++,this._cachedMergedMessages=null}_getBaseMessages(){return this.repository.getMessages()}_commitVoiceMessage(t){}_onMessageMetadataChanged(t,e){}_dropVoiceMessage(t,e){const s=this._voiceMessages.findIndex(n=>n.id===t);s!==-1&&(this._voiceMessages.splice(s,1),this._markVoiceMessagesDirty(),e&&this._notifySubscribers())}get messages(){if(this._voiceMessages.length===0)return this._getBaseMessages();const t=this._getBaseMessages();if(this._cachedVoiceGeneration!==this._voiceGeneration||this._cachedMergedBase!==t){const e=new Set(t.map(s=>s.id));this._cachedMergedMessages=[...t,...this._voiceMessages.filter(s=>!e.has(s.id))],this._cachedVoiceGeneration=this._voiceGeneration,this._cachedMergedBase=t}return this._cachedMergedMessages}get state(){let t;for(const e of this.messages)e.role==="assistant"&&(t=e);return t?.metadata.unstable_state??null}composer=new e0(this);_contextProvider;constructor(t){super(),this._contextProvider=t,Db(this).addEventListener("abort",()=>{this.composer.__internal_dispose();for(const e of this._editComposers.values())e.__internal_dispose()})}getModelContext(){return this._contextProvider.getModelContext()}enrichAppendMetadata(t,e=t.parentId){if(t.role!=="user")return t;const s=this.messages,n=e===null?-1:s.findIndex(o=>o.id===e),r=lb(this.getModelContext().unstable_composerMetadata,s.slice(0,n+1));return r?{...t,metadata:{...t.metadata,custom:{...t.metadata?.custom,...r}}}:t}_editComposers=new Map;getEditComposer(t){return this._editComposers.get(t)}_isVoiceMessage(t){return t!==null&&this._voiceMessages.some(e=>e.id===t)}_resolveAppendParent(t){return this._isVoiceMessage(t)?this._getBaseMessages().at(-1)?.id??null:t}beginEdit(t){if(this.voice)throw new Error("Cannot edit a message while a voice session is connected");if(this._isVoiceMessage(t))throw new Error("Voice transcript messages cannot be edited");if(this._editComposers.has(t))throw new Error("Edit already in progress");this._editComposers.set(t,new t0(this,()=>this._editComposers.delete(t),this.repository.getMessage(t))),this._notifySubscribers()}getMessageById(t){try{return this.repository.getMessage(t)}catch{const e=this.repository.getMessages(),s=this._voiceMessages.findIndex(n=>n.id===t);return s!==-1?{parentId:s>0?this._voiceMessages[s-1].id:e.at(-1)?.id??null,message:this._voiceMessages[s],index:e.length+s}:void 0}}getBranches(t){return this._voiceMessages.some(e=>e.id===t)?[]:this.repository.getBranches(t)}switchToBranch(t){this.repository.switchToBranch(t),this._notifySubscribers()}_notifyEventSubscribers(t,e){const s=this._eventSubscribers.get(t);s&&dt(s,e,`Thread runtime "${t}"`)}_notifyToolApprovalAnswered(t,e,s,n){this._notifyEventSubscribers("toolApprovalAnswered",{messageId:t,toolCallId:e,toolName:s,approved:n})}submitFeedback({messageId:t,type:e,comment:s}){const n=this.adapters?.feedback,r=this.getMessageById(t);if(!r)throw new Error(`Message not found: ${t}`);const{message:o,parentId:a}=r,l=s?.trim(),u={type:e,...l?{comment:l}:void 0};if(n?.submit({message:o,...u}),o.role==="assistant"){const d={...o,metadata:{...o.metadata,submittedFeedback:u}},h=this._voiceMessages.findIndex(f=>f.id===t);h===-1?(this.repository.addOrUpdateMessage(a,d),this._onMessageMetadataChanged(o,d)):(this._voiceMessages[h]=d,this._currentAssistantMsg===o&&(this._currentAssistantMsg=d),this._markVoiceMessagesDirty())}this._notifySubscribers()}_stopSpeaking;speech;speak(t){const e=this.adapters?.speech;if(!e)throw new Error("Speech adapter not configured");const s=this.getMessageById(t);if(!s)throw new Error(`Message not found: ${t}`);const{message:n}=s,r=this._stopSpeaking;let o;try{r?.(),o=e.speak(js(n))}catch(h){if(r&&!this._stopSpeaking)try{this._notifySubscribers()}catch{}throw h}let a;const l=i(()=>{this._stopSpeaking=void 0,this.speech=void 0;const h=a;a=void 0,h?.()},"clear"),u=i(()=>{if(this._stopSpeaking===u)try{l()}finally{o.cancel()}},"stop"),d=i(()=>{this._stopSpeaking===u&&(o.status.type==="ended"?ht([l,()=>this._notifySubscribers()]):(this.speech={messageId:t,status:o.status},this._notifySubscribers()))},"update");this._stopSpeaking=u;try{if(a=o.subscribe(d),this._stopSpeaking!==u){a();return}d()}catch(h){if(this._stopSpeaking===u)try{ht([u,()=>this._notifySubscribers()])}catch{}throw h}}stopSpeaking(){if(!this._stopSpeaking)throw new Error("No message is being spoken");ht([this._stopSpeaking,()=>this._notifySubscribers()])}_voiceSession;_voiceUnsubs=[];voice;_voiceVolume=0;_voiceVolumeSubscribers=new Set;getVoiceVolume=i(()=>this._voiceVolume,"getVoiceVolume");subscribeVoiceVolume=i(t=>(this._voiceVolumeSubscribers.add(t),()=>this._voiceVolumeSubscribers.delete(t)),"subscribeVoiceVolume");_onVoiceConnected(){}_onVoiceDisconnected(){}_toVoiceSessionState(t,e,s){return{status:e,isMuted:t.isMuted,mode:s,canSendText:e.type==="running"&&t.sendText!==void 0}}_isRunActive(){if(this.isRunning)return!0;const t=this._getBaseMessages().at(-1);return t?.role==="assistant"&&(t.status.type==="running"||t.status.type==="requires-action")}_getVoiceCommitBarrier(){if(!this.isLoading)return;const t=Xs(this);return(async()=>{for(;this.isLoading&&!t.aborted;)await new Promise(e=>{const s=i(()=>{n(),t.removeEventListener("abort",s),e()},"wake"),n=this.subscribe(s);t.addEventListener("abort",s)})})()}connectVoice(){const t=this.adapters?.voice;if(!t)throw new Error("Voice adapter not configured");if(this._isRunActive())throw new Error("Cannot start a voice session while a run is in progress or paused on a pending tool action");const e=this._voiceSession!==void 0;try{this._disconnectVoice(!1)}catch{}let s;try{s=t.connect({})}catch(o){throw e&&this._voiceSession===void 0&&this._onVoiceDisconnected(),o}this._voiceSession=s;const n=[];this._voiceUnsubs=n;const r=i(()=>{if(this._voiceSession===s&&this._voiceUnsubs===n)return!1;try{ht(n.splice(0))}catch{}return!0},"finishDetachedSetup");try{let o="listening";if(this.voice=this._toVoiceSessionState(s,s.status,o),this._voiceVolume=0,this._notifySubscribers(),r()||(n.push(s.onStatusChange(a=>{this._voiceSession===s&&(a.type==="ended"?(this._finishVoiceAssistantMessage(),this._voiceSession=void 0,this.voice=void 0,this._onVoiceDisconnected()):this.voice=this._toVoiceSessionState(s,a,o),this._notifySubscribers())})),r())||(n.push(s.onModeChange(a=>{this._voiceSession===s&&(o=a,this.voice&&(this.voice={...this.voice,mode:a},this._notifySubscribers()))})),r())||(n.push(s.onVolumeChange(a=>{this._voiceSession===s&&(this._voiceVolume=a,dt(this._voiceVolumeSubscribers,void 0,"Voice volume"))})),r()))return;n.push(s.onTranscript(a=>{this._voiceSession===s&&this._handleVoiceTranscript(a)})),r()||this._onVoiceConnected()}catch(o){if(this._voiceSession===s&&this._voiceUnsubs===n){try{this._disconnectVoice(!1)}catch{}e&&this._voiceSession===void 0&&this._onVoiceDisconnected()}else r();throw o}}_currentAssistantMsg=null;_observeVoiceCommit(t){Promise.resolve(t).catch(e=>{})}_handleVoiceTranscript(t){if(this.ensureInitialized(),t.role==="user")this._finishVoiceAssistantMessage(),this._currentAssistantMsg=null,t.isFinal&&this._observeVoiceCommit(this._commitVoiceUserMessage({id:ft(),role:"user",content:[{type:"text",text:t.text}],metadata:{modality:"voice",custom:{}},createdAt:new Date,attachments:[]}));else{const e=t.isFinal?{type:"complete",reason:"stop"}:{type:"running"};if(!this._currentAssistantMsg)this._currentAssistantMsg={id:ft(),role:"assistant",content:[{type:"text",text:t.text}],metadata:{unstable_state:this.state,unstable_annotations:[],unstable_data:[],steps:[],modality:"voice",custom:{}},status:e,createdAt:new Date},this._voiceMessages.push(this._currentAssistantMsg);else{const s=this._voiceMessages.indexOf(this._currentAssistantMsg);if(s===-1)return;const n={...this._currentAssistantMsg,content:[{type:"text",text:t.text}],status:e};this._voiceMessages[s]=n,this._currentAssistantMsg=n}t.isFinal&&(this._observeVoiceCommit(this._commitVoiceMessage(this._currentAssistantMsg)),this._currentAssistantMsg=null),this._markVoiceMessagesDirty(),this._notifySubscribers()}}_commitVoiceUserMessage(t){this._voiceMessages.push(t);const e=this._commitVoiceMessage(t);return this._markVoiceMessagesDirty(),this._notifySubscribers(),e}async _appendToVoiceSession(t){const e=this._voiceSession;if(!this.voice?.canSendText||!e?.sendText)throw new Error("Cannot send a text message while a voice session is connected");const s=t.content.filter(o=>o.type==="text");if(t.role!=="user"||t.sourceId!=null||t.parentId!==this._resolveAppendParent(this.messages.at(-1)?.id??null)||t.attachments?.length||s.length!==t.content.length||!s.some(o=>o.text.trim()))throw new Error("Only a plain text user message can be sent while a voice session is connected");const n=this.enrichAppendMetadata(t);this.ensureInitialized();const r=Xs(this);try{await e.sendText(js(t))}catch(o){if(r.aborted)return;const a=new la;throw a.cause=o,a}if(!r.aborted){if(this._voiceSession!==e)throw new la("The voice session ended before the typed message was recorded");this._finishVoiceAssistantMessage(!1),this._currentAssistantMsg=null,await this._commitVoiceUserMessage({id:ft(),role:"user",content:s,metadata:{custom:{...n.metadata?.custom}},createdAt:t.createdAt,attachments:[]})}}_finishVoiceAssistantMessage(t=!0){const e=this._voiceMessages.at(-1);if(e?.role==="assistant"&&e.status.type==="running"){const s=this._voiceMessages.length-1;this._voiceMessages[s]={...e,status:{type:"complete",reason:"stop"}},this._observeVoiceCommit(this._commitVoiceMessage(this._voiceMessages[s])),this._currentAssistantMsg=null,this._markVoiceMessagesDirty(),t&&this._notifySubscribers()}}disconnectVoice(){this._disconnectVoice(!0)}_disconnectVoice(t){this._finishVoiceAssistantMessage(!1),this._currentAssistantMsg=null;const e=this._voiceUnsubs.splice(0);this._voiceUnsubs=[];const s=this._voiceSession;this._voiceSession=void 0,this.voice=void 0,this._voiceVolume=0;const n=this.speech&&this._isVoiceMessage(this.speech.messageId)?this._stopSpeaking:void 0;this._voiceMessages=[],this._markVoiceMessagesDirty();try{ht([...e,...n?[n]:[],...s?[()=>s.disconnect()]:[],()=>dt(this._voiceVolumeSubscribers,void 0,"Voice volume"),()=>this._notifySubscribers()])}finally{t&&s&&this._voiceSession===void 0&&this._onVoiceDisconnected()}}muteVoice(){if(!this._voiceSession)throw new Error("No active voice session");this._voiceSession.mute(),this.voice={...this.voice,isMuted:!0},this._notifySubscribers()}unmuteVoice(){if(!this._voiceSession)throw new Error("No active voice session");this._voiceSession.unmute(),this.voice={...this.voice,isMuted:!1},this._notifySubscribers()}ensureInitialized(){this._isInitialized||(this._isInitialized=!0,this._notifyEventSubscribers("initialize",{}))}export(){return this.repository.export()}import(t){this.ensureInitialized(),this.repository.clear(),this.repository.import(t),this._notifySubscribers()}reset(t){this.import(Wl.fromArray(t??[]))}_eventSubscribers=new Map;unstable_on(t,e){const s=e;if(t==="modelContextUpdate")return this._contextProvider.subscribe?.(()=>dt([s],{},`Thread runtime "${t}"`))??(()=>{});let n=this._eventSubscribers.get(t);return n||(n=new Set,this._eventSubscribers.set(t,n)),n.add(s),t==="initialize"&&this._isInitialized&&queueMicrotask(()=>{n.has(s)&&dt([s],{},`Thread runtime "${t}"`)}),()=>{this._eventSubscribers.get(t)?.delete(s)}}},n0=Symbol.for("assistant-stream.tool-execution-id"),Qs=i(t=>{try{return JSON.parse(t),!0}catch{return!1}},"isArgsTextComplete"),ba=i(t=>{try{return JSON.parse(t)}catch{return}},"parseArgsText"),Nr=i((t,e)=>{const s=ba(t),n=ba(e);return s===void 0||n===void 0?!1:Ui(s,n)},"isEquivalentCompleteArgsText"),jn=i(t=>t.result!==void 0&&t.isPreliminary!==!0,"hasFinalResult"),Dr=i(t=>t[n0],"getToolExecutionId"),r0=class{static{i(this,"ToolInvocationTracker")}_getTools;_callbacks;_isClientToolCall;_entries=new Map;_humanInput=new Map;_executing=new Set;_discardedToolCallIds=new Set;_settledResolvers=[];_statuses=new Map;_ac=new AbortController;_pendingRestore=!0;_lastSnapshot=null;_isRunning=!1;_controller;_pipelineDead=!1;_pipelineRestartUsed=!1;constructor(t,e,s){this._getTools=t,this._callbacks=e,this._isClientToolCall=s,this._initPipeline()}_initPipeline(){const[t,e]=Qp();this._controller=e;const n=Xg(()=>this._getWrappedTools(),()=>this._ac.signal,i((r,o,a)=>this._onHumanInput(r,o,a),"human"),{onExecutionStart:i((r,o,a)=>this._onExecutionStart(r,a),"onExecutionStart"),onExecutionEnd:i((r,o,a)=>this._onExecutionEnd(r,a),"onExecutionEnd")});t.pipeThrough(n).pipeThrough(new Al).pipeTo(new WritableStream({write:i(r=>{try{if(r.type!=="result")return;this._handleResultChunk(r)}catch{}},"write")})).catch(r=>{this._pipelineDead=!0})}setState(t){try{if(this._pipelineDead){if(this._pipelineRestartUsed)return;this._pipelineRestartUsed=!0,this._pipelineDead=!1,this._demoteEntriesToRestored(),this._executing.clear(),this._ac=new AbortController,this._initPipeline()}if(this._lastSnapshot&&this._lastSnapshot.messages===t.messages&&this._lastSnapshot.isRunning===t.isRunning&&this._lastSnapshot.isLoading===t.isLoading)return;t.isLoading===!0&&(this._pendingRestore=!0);const e=this._isRunning;this._isRunning=t.isRunning;try{this._processMessages(t.messages)}catch(s){throw this._isRunning=e,s}this._lastSnapshot=t,this._pendingRestore=!1}catch{}}reset(){try{this._pendingRestore=!0,this._entries.clear(),this._discardedToolCallIds.clear(),this._lastSnapshot=null,this.abort(),this._statuses.size>0&&(this._statuses=new Map,this._invokeOnStatusesChange())}catch{}}abort(t){try{if(this._humanInput.forEach(({executionId:s,reject:n},r)=>{try{n(new Error("Tool execution aborted"))}catch{}this._endHumanRequest(r,s)}),this._humanInput.clear(),t?.discardPending)for(const[s,n]of this._entries)n.controller&&(n.argsComplete||n.hasResult||(this._discardedToolCallIds.add(s),n.skipExecute=!0));if(this._ac.abort(),this._ac=new AbortController,this._executing.size===0)return Promise.resolve();const e=new Set(this._executing);return new Promise(s=>{this._settledResolvers.push({executionIds:e,resolve:s})})}catch{return Promise.resolve()}}_endHumanRequest(t,e){if(this._executing.has(e)){this._setStatus(t,{type:"executing"});return}const s=this._entries.get(t)?.executionId;(s===void 0||s===e)&&this._deleteStatus(t)}resume(t,e){try{const s=this._humanInput.get(t);return s?(this._humanInput.delete(t),this._endHumanRequest(t,s.executionId),s.resolve(e),!0):!1}catch{return!1}}getStatuses(){return this._statuses}_getWrappedTools(){const t=this._getTools();if(t)return Object.fromEntries(Object.entries(t).map(([e,s])=>{const n=s.execute,r=s.streamCall;return n===void 0&&r===void 0?[e,s]:[e,{...s,...n!==void 0&&{execute:i((...[o,a])=>{const l=Dr(a),u=this._captureExecution(a.toolCallId,l);return!u||u.skipExecute?new Promise(()=>{}):n(o,a)},"execute")},...r!==void 0&&{streamCall:i((...[o,a])=>{const l=Dr(a);if(this._captureExecution(a.toolCallId,l))return r(o,a)},"streamCall")}}]}))}_captureExecution(t,e){if(e===void 0)return;const s=this._entries.get(t);if(s?.controller)return s.executionId===void 0&&(s.executionId=e),s.executionId===e?s:void 0}_onHumanInput(t,e,s){return new Promise((n,r)=>{const o=this._entries.get(t);if(!o?.controller||o.executionId!==s){r(new Error("Tool execution aborted"));return}const a=this._humanInput.get(t);if(a)try{a.reject(new Error("Human input request was superseded by a new request"))}catch{}this._humanInput.set(t,{executionId:s,resolve:n,reject:r}),this._setStatus(t,{type:"interrupt",payload:{type:"human",payload:e}})})}_onExecutionStart(t,e){this._captureExecution(t,e)&&(this._entries.get(t).skipExecute||(this._executing.add(e),this._humanInput.get(t)?.executionId!==e&&this._setStatus(t,{type:"executing"})))}_onExecutionEnd(t,e){if(e===void 0||!this._executing.delete(e))return;this._entries.get(t)?.executionId===e&&this._deleteStatus(t);const s=[];this._settledResolvers.forEach(({executionIds:n,resolve:r})=>{if([...n].some(o=>this._executing.has(o))){s.push({executionIds:n,resolve:r});return}try{r()}catch{}}),this._settledResolvers.length=0,this._settledResolvers.push(...s)}_handleResultChunk(t){const e=t.meta.toolCallId,s=Dr(t),n=this._entries.get(e);!n||n.executionId!==s||n?.hasResult||n.skipExecute||this._invokeOnResult({type:"add-tool-result",toolCallId:e,toolName:t.meta.toolName,result:t.result,isError:t.isError,...t.artifact!==void 0&&{artifact:t.artifact},...t.modelContent!==void 0&&{modelContent:t.modelContent}})}_invokeOnResult(t){try{this._callbacks.onResult(t)}catch{}}_invokeOnStatusesChange(){try{this._callbacks.onStatusesChange(this._statuses)}catch{}}_setStatus(t,e){const s=new Map(this._statuses);s.set(t,e),this._statuses=s,this._invokeOnStatusesChange()}_deleteStatus(t){if(!this._statuses.has(t))return;const e=new Map(this._statuses);e.delete(t),this._statuses=e,this._invokeOnStatusesChange()}_warnProviderOwnedSkip(t,e){}_shouldCloseArgsStream({argsText:t,hasResult:e,clientOwned:s}){return e?!0:Qs(t)?s||!this._isRunning:!1}_startActiveEntry(t,e,s,n){const r={toolName:e,controller:this._controller.addToolCallPart({toolName:e,toolCallId:t}),argsText:"",hasResult:!1,skipExecute:s,argsComplete:!1,clientOwned:n};return this._entries.set(t,r),r}_demoteEntriesToRestored(){for(const[t,e]of this._entries)if(e.controller){if(!e.argsComplete&&!e.hasResult){this._entries.delete(t);continue}this._entries.set(t,{toolName:e.toolName,argsText:e.argsText,hasResult:e.hasResult})}}_processArgsText(t,e){if(!t.controller)return;const s=e.result!==void 0;if(e.argsText!==t.argsText){let n=!0;if(t.argsComplete)Nr(t.argsText,e.argsText),t.argsText=e.argsText,n=!1;else if(!e.argsText.startsWith(t.argsText))if(Qs(t.argsText)&&Qs(e.argsText)&&Nr(t.argsText,e.argsText)){const r=this._shouldCloseArgsStream({argsText:e.argsText,hasResult:s,clientOwned:t.clientOwned});r&&t.controller.argsText.close(),t.argsText=e.argsText,t.argsComplete=r,n=!1}else n=!1;if(n&&t.controller){const r=e.argsText.slice(t.argsText.length);t.controller.argsText.append(r);const o=this._shouldCloseArgsStream({argsText:e.argsText,hasResult:s,clientOwned:t.clientOwned});o&&t.controller.argsText.close(),t.argsText=e.argsText,t.argsComplete=o}}!t.argsComplete&&t.controller&&this._shouldCloseArgsStream({argsText:t.argsText,hasResult:s,clientOwned:t.clientOwned})&&(t.controller.argsText.close(),t.argsComplete=!0)}_processMessages(t){const e=this._pendingRestore;for(const{part:s}of Hi(t)){const n=this._entries.get(s.toolCallId);if(e){n?.controller||this._entries.set(s.toolCallId,{toolName:s.toolName,argsText:s.argsText,hasResult:jn(s)});continue}let r=n;if(jn(s)&&this._discardedToolCallIds.delete(s.toolCallId),r&&!r.controller){if(r.hasResult||!(s.argsText!==r.argsText&&!(Qs(r.argsText)&&Qs(s.argsText)&&Nr(r.argsText,s.argsText)))&&!jn(s))continue;this._entries.delete(s.toolCallId),r=void 0}if(!r){const o=this._isClientToolCall?.(s),a=s.result===void 0&&o===!1;a&&this._warnProviderOwnedSkip(s.toolName,s.toolCallId),r=this._startActiveEntry(s.toolCallId,s.toolName,s.result!==void 0||a||this._discardedToolCallIds.has(s.toolCallId),o===!0)}if(s.result!==void 0&&(r.skipExecute=!0),s.approval!==void 0&&(r.skipExecute=!0),this._processArgsText(r,s),s.result!==void 0&&!r.hasResult){const{controller:o}=r;if(!o)continue;r.argsComplete=!0,o.setResponse(new It({result:s.result,artifact:s.artifact,isError:s.isError,isPreliminary:s.isPreliminary,...s.modelContent!==void 0?{modelContent:s.modelContent}:{}})),jn(s)&&(r.hasResult=!0,o.close())}}}},i0=Object.freeze([]),Or=i((t,e)=>{Promise.resolve(e).catch(s=>{})},"observeAdapterCallback"),o0=i((t,e)=>t&&e[e.length-1]?.role!=="assistant","hasUpcomingMessage"),a0=class extends s0{static{i(this,"ExternalStoreThreadRuntimeCore")}_capabilities={switchToBranch:!1,switchBranchDuringRun:!1,edit:!1,delete:!1,reload:!1,refetchThread:!1,cancel:!1,unstable_copy:!1,speech:!1,dictation:!1,voice:!1,attachments:!1,feedback:!1,queue:!1,answerToolCall:!1};get capabilities(){return this._capabilities}_messages;isDisabled;isSendDisabled;get isLoading(){return this._store.isLoading??!1}get isRunning(){return this._hasExecutingTools(this._store)?!0:this._store.isRunning}_getBaseMessages(){return this._messages}get state(){return this._store.state??super.state}get adapters(){return this._store.adapters}get unstable_refetchThread(){if(this._store.onRefetchThread)return()=>this._store.onRefetchThread()}suggestions=[];extras=void 0;_converter=new aa;_pendingDeleteEvictions=new Map;_optimistic=null;_store;_getInitializePromise;__internal_setGetInitializePromise(t){this._getInitializePromise=t}_transformedQueue;_toolInvocations=null;_toolStatuses=new Map;_effectiveIsRunning=!1;_inTrackerUpdate=!1;_pendingRunningRefresh=!1;_runTrackerUpdate(t){this._inTrackerUpdate=!0;try{t()}finally{this._inTrackerUpdate=!1}this._pendingRunningRefresh&&(this._pendingRunningRefresh=!1,this._refreshEffectiveIsRunning())}_refreshEffectiveIsRunning(){const t=this._getEffectiveIsRunning(this._store);this._effectiveIsRunning!==t&&(this._effectiveIsRunning=t,this._notifyEventSubscribers(t?"runStart":"runEnd",{}),this._notifySubscribers())}_hasExecutingTools(t){if(t.unstable_enableToolInvocations!==!0||this._toolInvocations===null)return!1;for(const e of this._toolStatuses.values())if(e.type==="executing")return!0;return!1}_getEffectiveIsRunning(t){return(t.isRunning??!1)||this._hasExecutingTools(t)}beginEdit(t){if(!this._store.onEdit)throw new Error("Runtime does not support editing.");super.beginEdit(t)}constructor(t,e){super(t),this.__internal_setAdapter(e)}__internal_setAdapter(t){this._store!==t&&this._updateStoreSnapshot(t)}_updateStoreSnapshot(t){const e=this._effectiveIsRunning;this.isDisabled=t.isDisabled??!1,this.isSendDisabled=t.isSendDisabled??!1;const s=this._store;this._store=t;const n=this._getEffectiveIsRunning(t),r=t.unstable_messageRepositoryInstance,o=r!==void 0&&r!==this.repository;if(o){this.repository=r,this._pendingDeleteEvictions.clear();const f=this.repository.getMessages(),p=f.at(-1);this._optimistic=p?.metadata.isOptimistic?{id:p.id,parentId:f.at(-2)?.id??null}:null}s?.queue!==t.queue&&(this._transformedQueue=void 0,t.queue?.__internal_setDispatchTransform?.(f=>{const p=this.messages.at(-1)?.id??null;return this.enrichAppendMetadata({...f,parentId:p},p)}),t.queue?.__internal_setDispatchTransform&&(this._transformedQueue=t.queue)),this.extras!==t.extras&&(this.extras=t.extras);const a=t.suggestions??i0;Xt(this.suggestions,a)||(this.suggestions=a);const l={switchToBranch:this._store.setMessages!==void 0,switchBranchDuringRun:!1,edit:this._store.onEdit!==void 0,delete:this._store.onDelete!==void 0||this._store.setMessages!==void 0,reload:this._store.onReload!==void 0,refetchThread:this._store.onRefetchThread!==void 0,cancel:this._store.onCancel!==void 0,speech:this._store.adapters?.speech!==void 0,dictation:this._store.adapters?.dictation!==void 0,voice:this._store.adapters?.voice!==void 0,unstable_copy:this._store.unstable_capabilities?.copy!==!1,attachments:!!this._store.adapters?.attachments,feedback:!!this._store.adapters?.feedback,queue:this._store.queue!==void 0,answerToolCall:this._store.onAddToolResult!==void 0||this._store.onResumeToolCall!==void 0||this._store.onRespondToToolApproval!==void 0||this._store.unstable_enableToolInvocations===!0};Xt(this._capabilities,l)||(this._capabilities=l);let u;if(t.messageRepository){if(s&&!o&&s.isRunning===t.isRunning&&s.messageRepository===t.messageRepository&&e===n){this._notifySubscribers();return}const f=t.messageRepository.messages,p=t.messageRepository.headId??f.at(-1)?.message.id??null;if(s&&!o&&s.messageRepository===t.messageRepository)this.repository.resetHead(p),u=this.repository.getMessages();else{const m=new Set(f.map(({message:g})=>g.id));for(const{message:g,parentId:b}of f)this.repository.addOrUpdateMessage(b,g);for(const{message:g}of this.repository.export().messages)m.has(g.id)||this.repository.deleteMessage(g.id);this._pendingDeleteEvictions.clear(),this.repository.resetHead(p),u=this.repository.getMessages()}}else if(t.messages){if(s){if(s.convertMessage!==t.convertMessage)this._converter=new aa;else if(!o&&s.isRunning===t.isRunning&&s.messages===t.messages&&e===n){this._notifySubscribers();return}}u=t.convertMessage?this._converter.convertMessages(t.messages,(m,g,b)=>{if(!t.convertMessage)return g;const S=b===(t.messages?.length??0)-1,w=`${hb}${b}`;if(m&&(m.role!=="assistant"||!xb(m.status)||m.status===oa(m.content,S,n))){if(m.id.startsWith("__external_store_fallback_")&&m.id!==w){const T={...m,id:w};return na(T,g),T}return m}const v=t.convertMessage(g,b),y=nn(v,w,oa(v.content,S,n));return na(y,g),y}):t.messages;const f=new Set,p=[];for(let m=u.length-1;m>=0;m--){const g=u[m];f.has(g.id)||(f.add(g.id),p.push(g))}p.length!==u.length&&(u=p.reverse());for(let m=0;m<u.length;m++){const g=u[m],b=u[m-1];this.repository.addOrUpdateMessage(b?.id??null,g)}if(this._pendingDeleteEvictions.size>0){const m=new Set(u.map(g=>g.id));for(const[g,b]of this._pendingDeleteEvictions){if(m.has(g)){b.size===0&&this._pendingDeleteEvictions.delete(g);continue}this._pendingDeleteEvictions.delete(g);try{this.repository.getMessage(g)}catch{continue}this.repository.deleteMessage(g)}}}else throw new Error("ExternalStoreAdapter must provide either 'messages' or 'messageRepository'");u.length>0&&this.ensureInitialized(),this._effectiveIsRunning=n,e!==n&&(n?this._notifyEventSubscribers("runStart",{}):this._notifyEventSubscribers("runEnd",{}));let d=null;if(o0(n,u)){const f=u.at(-1)?.id??null;this._optimistic?.parentId!==f&&(this._optimistic={id:ft(),parentId:f}),d=this._optimistic.id,this.repository.addOrUpdateMessage(f,nn({role:"assistant",content:[],metadata:{isOptimistic:!0}},d,{type:"running"}))}d===null&&(this._optimistic=null),this.repository.resetHead(d??u.at(-1)?.id??null);const h=this.repository.getMessages();if((!this._messages||!ca(this._messages,h))&&(this._messages=h),this._voiceMessages.length>0){const f=new Set(this._messages.map(m=>m.id)),p=this._voiceMessages.filter(m=>!f.has(m.id));p.length!==this._voiceMessages.length&&(this._voiceMessages=p,this._markVoiceMessagesDirty())}o&&this._runTrackerUpdate(()=>this._toolInvocations?.reset()),this._runTrackerUpdate(()=>this._driveToolInvocations()),this._notifySubscribers()}_driveToolInvocations(){if(!this._store.unstable_enableToolInvocations){this._toolInvocations&&(this._toolInvocations.reset(),this._toolInvocations=null,this._toolStatuses=new Map,this._store.setToolStatuses?.({}));return}this._toolInvocations||(this._toolInvocations=new r0(()=>this.getModelContext().tools,{onResult:i(t=>{try{const e=this._findMessageIdForToolCall(t.toolCallId);if(e===void 0)return;Or("onAddToolResult",this._store.onAddToolResult?.({messageId:e,toolCallId:t.toolCallId,toolName:t.toolName,result:t.result,isError:t.isError,...t.artifact!==void 0&&{artifact:t.artifact},...t.modelContent!==void 0&&{modelContent:t.modelContent}}))}catch{}},"onResult"),onStatusesChange:i(t=>{const e=this._hasExecutingTools(this._store);this._toolStatuses=t;try{this._store.setToolStatuses?.(Object.fromEntries(t))}finally{e!==this._hasExecutingTools(this._store)&&(this._inTrackerUpdate?this._pendingRunningRefresh=!0:this._updateStoreSnapshot(this._store))}},"onStatusesChange")},t=>this._store.unstable_isClientToolCall?.(t))),this._toolInvocations.setState({messages:this._messages,isRunning:this._getEffectiveIsRunning(this._store),...this._store.isLoading!==void 0&&{isLoading:this._store.isLoading}})}_toolCallToMessageId=new Map;_messagesForToolCallIndex=null;_findMessageIdForToolCall(t){if(this._messagesForToolCallIndex!==this._messages){this._toolCallToMessageId.clear();for(const{part:e,messageId:s}of Hi(this._messages))this._toolCallToMessageId.set(e.toolCallId,s);this._messagesForToolCallIndex=this._messages}return this._toolCallToMessageId.get(t)}switchToBranch(t){if(!this._store.setMessages)throw new Error("Runtime does not support switching branches.");if(this._getEffectiveIsRunning(this._store))return;const e=this._store.unstable_onBranchChange,s=e?this.repository.canonicalHeadId:null;this.repository.switchToBranch(t),this._pendingDeleteEvictions.clear(),this.updateMessages(this.repository.getMessages()),e&&this._notifyBranchChange(s,e)}_notifyBranchChange(t,e){const s=this.repository.canonicalHeadId;s!==t&&e({headId:s,visibleMessageIds:this.repository.getMessages().map(n=>n.id)})}async append(t){let e={...t,parentId:this._resolveAppendParent(t.parentId)};if(this.voice)return this._appendToVoiceSession(e);if(this._isVoiceMessage(e.sourceId))throw new Error("Voice transcript messages cannot be edited");const s=e.sourceId!=null||e.parentId!==(this._getBaseMessages().at(-1)?.id??null);e=!s&&this._store.queue&&this._store.queue===this._transformedQueue?e:this.enrichAppendMetadata(e);const n=Xs(this);this.ensureInitialized();const r=this._getInitializePromise?.();if(!s&&this._store.queue){if(r&&await r,n.aborted)return;e.steer??this._getEffectiveIsRunning(this._store)?this._store.queue.steer(e):this._store.queue.enqueue(e);return}if(r?.catch(()=>{}),(e.startRun??e.role==="user")&&await this._toolInvocations?.abort({discardPending:!0}),!n.aborted)if(s){if(!this._store.onEdit)throw new Error("Runtime does not support editing messages.");this._pendingDeleteEvictions.clear(),await this._store.onEdit(e)}else await this._store.onNew(e)}_commitVoiceMessage(t){const e=Xs(this);if(e.aborted){this._dropVoiceMessage(t.id,!1);return}const s=this._getVoiceCommitBarrier();if(!s){this._store.onVoiceTranscript?.(t);return}const n=this.repository;return s.then(()=>{if(e.aborted||this.repository!==n){this._dropVoiceMessage(t.id,!0);return}this._store.onVoiceTranscript?.(t)})}async deleteMessage(t){if(this._store.onDelete){const s=this.repository.getMessages().some(r=>r.id===t),n=Symbol();if(s){const r=this._pendingDeleteEvictions.get(t)??new Set;this._pendingDeleteEvictions.set(t,r.add(n))}try{await this._store.onDelete(t)}finally{this._pendingDeleteEvictions.get(t)?.delete(n)}return}if(!this._store.setMessages)throw new Error("Runtime does not support deleting messages.");this._getEffectiveIsRunning(this._store)&&await this._toolInvocations?.abort();const e=this.repository.getMessages();if(e.findIndex(s=>s.id===t)===-1)throw new Error("Message not found.");this._pendingDeleteEvictions.clear(),this.updateMessages(e.filter(s=>s.id!==t)),this._evictDeletedMessage(t)}_evictDeletedMessage(t){if(!t.startsWith("__external_store_fallback_")){try{this.repository.getMessage(t)}catch{return}this.repository.deleteMessage(t),this._publishRepositoryMessages()}}_publishRepositoryMessages(){const t=this.repository.getMessages();ca(this._messages,t)||(this._messages=t),this._notifySubscribers()}getQueueItems(){return this._store?.queue?.items??on}getSteerQueueItems(){return this._store?.queue?.steerItems??on}moveQueueItem(t,e){this._store?.queue?.move(t,e)}removeQueueItem(t){this._store?.queue?.remove(t)}async startRun(t){if(!this._store.onReload)throw new Error("Runtime does not support reloading messages.");if(this.voice)throw new Error("Cannot start a run while a voice session is connected");if(this._isVoiceMessage(t.sourceId))throw new Error("Voice transcript messages cannot be reloaded");const e=this.repository.getMessages(),s=new Set(e.slice(0,e.findIndex(n=>n.id===t.parentId)+1).map(n=>n.id));for(const n of this._pendingDeleteEvictions.keys())s.has(n)||this._pendingDeleteEvictions.delete(n);await this._toolInvocations?.abort({discardPending:!0}),await this._store.onReload(t.parentId,t)}async resumeRun(t){if(!this._store.onResume)throw new Error("Runtime does not support resuming runs.");if(this.voice)throw new Error("Cannot start a run while a voice session is connected");if(this._isVoiceMessage(t.sourceId))throw new Error("Voice transcript messages cannot be reloaded");await this._store.onResume(t)}exportExternalState(){if(!this._store.onExportExternalState)throw new Error("Runtime does not support exporting external states.");return this._store.onExportExternalState()}importExternalState(t){if(!this._store.onLoadExternalState)throw new Error("Runtime does not support importing external states.");this._runTrackerUpdate(()=>this._toolInvocations?.reset()),this._store.onLoadExternalState(t)}unstable_notifySessionReset(){this._runTrackerUpdate(()=>this._toolInvocations?.reset()),this._store.queue?.__internal_notifyCancelled?.()}cancelRun(){if(!this._store.onCancel)throw new Error("Runtime does not support cancelling runs.");const t=Xs(this);this._toolInvocations?.abort({discardPending:!0}),this._store.queue?.__internal_notifyCancelled?.(),Or("onCancel",this._store.onCancel()),this.dropEmptyOptimisticHead();const e=this.repository.getMessages(),s=e[e.length-1],n=this._store.setMessages!==void 0&&s?.role==="user"&&s.id===e.at(-1)?.id&&s.content.every(o=>o.type==="text")?s:void 0;let r;if(n){const o={text:js(n),attachments:n.attachments,quote:n.metadata.custom.quote};this.composer.restoreDraft(o)&&(this.repository.deleteMessage(n.id),r={id:n.id,draft:o})}this._publishRepositoryMessages(),setTimeout(()=>{if(!t.aborted){if(this.dropEmptyOptimisticHead(),r){const o=this.repository.getMessages();o.at(-1)?.id===r.id?this.repository.deleteMessage(r.id):o.some(a=>a.id===r.id)&&this.composer.retractDraft(r.draft)}this._publishRepositoryMessages(),this.updateMessages(this._messages)}},0)}dropEmptyOptimisticHead(){const t=this.repository.getMessages().at(-1);t&&t.metadata.isOptimistic&&t.content.length===0&&this.repository.deleteMessage(t.id)}addToolResult(t){if(!this._store.onAddToolResult)throw new Error("Runtime does not support tool results.");Or("onAddToolResult",this._store.onAddToolResult(t))}resumeToolCall(t){if(!(this._toolInvocations?.resume(t.toolCallId,t.payload)??!1)){if(this._store.onResumeToolCall){this._store.onResumeToolCall(t);return}throw new Error(`Tool call ${t.toolCallId} is not waiting for resume.`)}}respondToToolApproval(t){if(!this._store.onRespondToToolApproval)throw new Error("Runtime does not support tool approvals.");const e=this.messages.findLast(n=>n.role==="assistant"&&n.content.some(r=>r.type==="tool-call"&&r.approval?.id===t.approvalId)),s=e?.content.find(n=>n.type==="tool-call"&&n.approval?.id===t.approvalId);try{return Promise.resolve(this._store.onRespondToToolApproval(t)).then(()=>{e&&s?.type==="tool-call"&&this._notifyToolApprovalAnswered(e.id,s.toolCallId,s.toolName,t.approved)})}catch(n){return Promise.reject(n)}}async unstable_recordToolInteraction(t){if(!this._store.unstable_onRecordToolInteraction)throw new Error("Runtime does not support recording tool interactions.");await this._store.unstable_onRecordToolInteraction(t)}reset(t){const e=new Kl;e.import(Wl.fromArray(t??[])),this.updateMessages(e.getMessages())}import(t){super.import(t),this._store.onImport&&this._store.onImport(this.repository.getMessages())}updateMessages=i(t=>{this._store.convertMessage!==void 0?this._store.setMessages?.(t.flatMap(db)):this._store.setMessages?.(t)},"updateMessages")},xa=i(t=>t.adapters?.threadList??{},"getThreadListAdapter"),c0=class extends Fb{static{i(this,"ExternalStoreRuntimeCore")}threads;_adapter;constructor(t){super(),this._adapter=t,this.threads=new Hb(xa(t),()=>new a0(this._contextProvider,this._adapter))}setAdapter(t){this._adapter=t,this.threads.__internal_setAdapter(xa(t)),this.threads.getMainThreadRuntimeCore().__internal_setAdapter(t)}},l0=class{static{i(this,"ExternalStoreHistoryCopy")}thread;history;lastHistory;session=0;copied=new Map;failedIds=new Set;interactions=new Map;overlaid=new WeakMap;pending=!1;inFlight=!1;timer;waiters=[];warned=!1;signature(t){try{return JSON.stringify({role:t.role,content:t.content,status:t.role==="assistant"?t.status:void 0,metadata:t.metadata})??t}catch{return t}}branch(){return(this.thread?.messages??[]).filter(t=>!t.metadata.isOptimistic&&!t.id.startsWith("__external_store_fallback_")&&!Ap(t.id)&&!(t.role==="assistant"&&t.status.type==="running")).map(t=>{const e=this.interactions.get(t.id);if(!e)return t;const s=this.overlaid.get(t);if(s&&s.logs.size===e.size&&[...e].every(([r,o])=>s.logs.get(r)===o))return s.message;const n={...t,content:t.content.map(r=>{if(r.type!=="tool-call")return r;const o=e.get(r.toolCallId);return o?{...r,unstable_interactions:o}:r})};return this.overlaid.set(t,{logs:new Map(e),message:n}),n})}seed(){for(const t of this.branch())!this.copied.has(t.id)&&!this.failedIds.has(t.id)&&this.copied.set(t.id,this.signature(t))}attach(t,e){e!==this.lastHistory&&(this.copied.clear(),this.failedIds.clear(),this.interactions.clear(),this.overlaid=new WeakMap,this.lastHistory=e,this.session+=1),this.thread=t,this.history=e,this.seed();const s=t.unstable_on("runStart",()=>this.seed()),n=t.unstable_on("runEnd",()=>this.schedule());return()=>{s(),n(),this.timer!==void 0&&clearTimeout(this.timer),this.timer=void 0,this.pending=!1;const r=new Error("History copy was detached.");for(const o of this.waiters.splice(0))o.reject(r);this.thread=void 0,this.history=void 0}}recordInteraction=i(async t=>{const e=this.thread,s=e?.messages.find(a=>a.id===t.messageId),n=s?.content.find(a=>a.type==="tool-call"&&a.toolCallId===t.toolCallId);if(!e||!s||n?.type!=="tool-call")throw new Error("Tool call is not available.");const r=zi(e);r||this.seed();let o=this.interactions.get(s.id);o||(o=new Map,this.interactions.set(s.id,o)),o.set(t.toolCallId,Np(o.get(t.toolCallId)??vl(n.unstable_interactions),t.interaction)),r||await this.schedule(!0)},"recordInteraction");schedule(t=!1){this.pending=!0;const e=t?new Promise((s,n)=>{this.waiters.push({resolve:s,reject:n})}):Promise.resolve();return!this.inFlight&&this.timer===void 0&&(this.timer=setTimeout(()=>{this.timer=void 0,this.flush()},0)),e}async flush(){if(!this.pending||!this.history)return;const t=this.history,e=this.session;this.pending=!1,this.inFlight=!0;const s=this.waiters.splice(0),n=this.branch(),r=n.map(o=>[o.id,this.signature(o)]).filter(([o,a])=>this.copied.get(o)!==a);try{if(r.length>0&&(await t.unstable_copy?.(n,r.map(([o])=>o)),e===this.session))for(const[o,a]of r)this.copied.set(o,a),this.failedIds.delete(o);for(const o of s)o.resolve()}catch(o){if(e===this.session)for(const[a]of r)this.failedIds.add(a);this.warned||(this.warned=!0);for(const a of s)a.reject(o)}finally{this.inFlight=!1,this.pending&&this.schedule()}}},u0=ss(!1),d0=i(()=>or(u0),"useIsRemoteThreadRuntimeHosted"),h0=i(t=>{const{modelContext:e,feedback:s,history:n}=Pg()??{},[r]=ye(()=>new l0),o=!!n?.unstable_copy&&!t.unstable_persistsHistory&&!t.adapters?.threadList,a=qe(()=>{const f=s&&!t.adapters?.feedback?{...t,adapters:{...t.adapters,feedback:s}}:t;return!o||t.unstable_onRecordToolInteraction?f:{...f,unstable_onRecordToolInteraction:r.recordInteraction}},[o,s,r,t]),[l]=ye(()=>new c0(a)),u=d0(),[d]=ye(()=>({generation:0}));Os(()=>{if(u)return;const f=++d.generation;return()=>queueMicrotask(()=>{d.generation===f&&Hl(l.threads.getMainThreadRuntimeCore())})},[u,d,l]),Go(()=>()=>{Ob(l.threads.getMainThreadRuntimeCore())},[l]),be(()=>{l.setAdapter(a)}),Go(()=>{if(!(!o||!n))return r.attach(l.threads.getMainThreadRuntimeCore(),n)},[o,n,r,l]),be(()=>{if(e)return l.registerModelContextProvider(e)},[e,l]);const[h]=ye(()=>new Vb(l));return h},"useExternalStoreRuntime");function f0(t,e){function s(n){const r=or(t);if(!n?.optional&&!r)throw new Error(`This component must be used within ${e}.`);return r}return i(s,"useContextHook"),s}i(f0,"createContextHook");function m0(t,e){function s(r){const o=t(r);return o?o[e]:null}i(s,"useStoreStoreHook");function n(r){let o=!1,a;typeof r=="function"?a=r:r&&typeof r=="object"&&(o=!!r.optional,a=r.selector);const l=s({optional:o});return l?a?l(a):l():null}return i(n,"useStoreHook"),{[e]:n,[`${e}Store`]:s}}i(m0,"createContextStoreHook");var Ql=ss(null),p0=f0(Ql,"ThreadPrimitive.Viewport"),{useThreadViewport:h_,useThreadViewportStore:g0}=m0(p0,"useThreadViewport"),va=i(t=>{let e;const s=new Set,n=i((d,h)=>{const f=typeof d=="function"?d(e):d;if(!Object.is(f,e)){const p=e;e=h??(typeof f!="object"||f===null)?f:Object.assign({},e,f),s.forEach(m=>m(e,p))}},"setState"),r=i(()=>e,"getState"),l={setState:n,getState:r,getInitialState:i(()=>u,"getInitialState"),subscribe:i(d=>(s.add(d),()=>s.delete(d)),"subscribe")},u=e=t(n,r,l);return l},"createStoreImpl"),b0=i((t=>t?va(t):va),"createStore"),x0=i(t=>t,"identity");function v0(t,e=x0){const s=x.useSyncExternalStore(t.subscribe,x.useCallback(()=>e(t.getState()),[t,e]),x.useCallback(()=>e(t.getInitialState()),[t,e]));return x.useDebugValue(s),s}i(v0,"useStore");var ya=i(t=>{const e=b0(t),s=i(n=>v0(e,n),"useBoundStore");return Object.assign(s,e),s},"createImpl"),y0=i((t=>t?ya(t):ya),"create"),_a=i(t=>{const e=new Map,s=i(()=>{let n=0;for(const r of e.values())n+=r;t(n)},"recalculate");return{register:i(()=>{const n=Symbol();return e.set(n,0),{setHeight:i(r=>{e.get(n)!==r&&(e.set(n,r),s())},"setHeight"),unregister:i(()=>{e.delete(n),s()},"unregister")}},"register")}},"createSizeRegistry"),_0=i((t={})=>{const e=new Set,s=_a(a=>{o.setState({height:{...o.getState().height,viewport:a}})}),n=_a(a=>{o.setState({height:{...o.getState().height,inset:a}})}),r=i((a,l)=>(o.setState({element:{...o.getState().element,[a]:l}}),()=>{o.getState().element[a]===l&&o.setState({element:{...o.getState().element,[a]:null}})}),"registerElementSlot"),o=y0(()=>({isAtBottom:!0,scrollToBottom:i(({behavior:a="auto"}={})=>{dt(e,()=>({behavior:a}),"Thread viewport")},"scrollToBottom"),onScrollToBottom:i(a=>(e.add(a),()=>{e.delete(a)}),"onScrollToBottom"),turnAnchor:t.turnAnchor??"bottom",topAnchorMessageClamp:{tallerThan:t.topAnchorMessageClamp?.tallerThan??"10em",visibleHeight:t.topAnchorMessageClamp?.visibleHeight??"6em"},height:{viewport:0,inset:0},element:{viewport:null,anchor:null,target:null},targetConfig:null,topAnchorTurn:null,registerViewport:s.register,registerContentInset:n.register,registerViewportElement:i(a=>r("viewport",a),"registerViewportElement"),registerAnchorElement:i(a=>r("anchor",a),"registerAnchorElement"),registerAnchorTargetElement:i((a,l)=>(o.setState({element:{...o.getState().element,target:a},targetConfig:a&&l?l:null}),()=>{o.getState().element.target===a&&o.setState({element:{...o.getState().element,target:null},targetConfig:null})}),"registerAnchorTargetElement"),setTopAnchorTurn:i(a=>{o.setState({topAnchorTurn:a})},"setTopAnchorTurn")}));return o},"makeThreadViewportStore"),w0=i(t=>t,"writableStore"),S0=i(t=>{const e=se(11);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={optional:!0},e[0]=s):s=e[0];const n=g0(s);let r;e[1]!==t?(r=i(()=>_0(t),"t1"),e[1]=t,e[2]=r):r=e[2];const[o]=ye(r);let a,l;e[3]!==n||e[4]!==o?(a=i(()=>n?.getState().onScrollToBottom(h=>{o.getState().scrollToBottom(h)}),"t2"),l=[n,o],e[3]=n,e[4]=o,e[5]=a,e[6]=l):(a=e[5],l=e[6]),be(a,l);let u,d;return e[7]!==n||e[8]!==o?(u=i(()=>{if(n)return o.subscribe(h=>{n.getState().isAtBottom!==h.isAtBottom&&w0(n).setState({isAtBottom:h.isAtBottom})})},"t4"),d=[o,n],e[7]=n,e[8]=o,e[9]=u,e[10]=d):(u=e[9],d=e[10]),be(u,d),o},"useThreadViewportStoreValue"),I0=i(t=>{const e=se(7),{children:s,options:n}=t;let r;e[0]!==n?(r=n===void 0?{}:n,e[0]=n,e[1]=r):r=e[1];const o=S0(r);let a;e[2]!==o?(a=i(()=>({useThreadViewport:o}),"t3"),e[2]=o,e[3]=a):a=e[3];const[l]=ye(a);let u;return e[4]!==s||e[5]!==l?(u=(0,c.jsx)(Ql.Provider,{value:l,children:s}),e[4]=s,e[5]=l,e[6]=u):u=e[6],u},"ThreadPrimitiveViewportProvider"),T0=i(()=>{const t=se(3),e=Bi();let s,n;return t[0]!==e?(s=i(()=>{},"t0"),n=[e],t[0]=e,t[1]=s,t[2]=n):(s=t[1],n=t[2]),be(s,n),null},"DevToolsRegistration"),C0=i(t=>{const e=se(8),{children:s,aui:n,config:r,runtime:o}=t,a=n??null;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=(0,c.jsx)(T0,{}),e[0]=l):l=e[0];let u;e[1]!==s?(u=(0,c.jsx)(I0,{children:s}),e[1]=s,e[2]=u):u=e[2];let d;return e[3]!==r||e[4]!==o||e[5]!==a||e[6]!==u?(d=(0,c.jsxs)(Dg,{runtime:o,aui:a,config:r,children:[l,u]}),e[3]=r,e[4]=o,e[5]=a,e[6]=u,e[7]=d):d=e[7],d},"AssistantRuntimeProviderImpl"),k0=kc(C0),A0=15e3;function E0(t,e){return e.aborted?Promise.reject(new DOMException("History read cancelled","AbortError")):new Promise((s,n)=>{const r=new AbortController;let o=!1;const a=i(d=>{o||(o=!0,window.clearTimeout(u),e.removeEventListener("abort",l),d())},"finish"),l=i(()=>{a(()=>n(new DOMException("History read cancelled","AbortError"))),r.abort()},"onAbort"),u=window.setTimeout(()=>{a(()=>n(new Error("Run history took too long to load. Retry to load it."))),r.abort()},A0);e.addEventListener("abort",l,{once:!0});try{t(r.signal).then(d=>a(()=>s(d)),d=>a(()=>n(d)))}catch(d){a(()=>n(d))}})}i(E0,"readTranscriptRequest");var R0=0,j0=1,M0=2e3,N0=256e3,D0=4,O0=3e4,P0=[],B0=2e6,$0=2e4;function ct(t){return typeof t=="string"&&t.trim().length>0?t:null}i(ct,"readString");function Ys(t){return t==="failed"||t==="timed_out"||t==="cancelled"||t==="interrupted"||t==="succeeded"}i(Ys,"isTerminalStatus");function wa(t){return t.status==="running"||Ys(t.status)}i(wa,"canReadPersistedLog");function L0(t){const e=t.status==="queued"?t.logBytes:t.lastOutputBytes??t.logBytes;return typeof e=="number"&&Number.isFinite(e)&&e>0?e:null}i(L0,"runKnownLogBytes");function V0(t,e){const s=L0(t);return s===null?0:Math.max(0,s-Math.max(0,e))}i(V0,"resolveInitialLogOffset");function F0({runs:t,companyId:e,maxChunksPerRun:s,maxBytesPerRun:n=B0,logPollIntervalMs:r=M0,logReadLimitBytes:o=N0,enableRealtimeUpdates:a=!0}){const{visible:l}=Mu(),u=(0,x.useMemo)(()=>typeof s=="number"?{maxChunks:s}:{maxBytes:n,collapseTrimmed:!0},[s,n]),d=(0,x.useMemo)(()=>t.map(j=>{const A=typeof j.logBytes=="number"?j.logBytes:"",$=typeof j.lastOutputBytes=="number"?j.lastOutputBytes:"";return`${j.id}:${j.status}:${j.adapterType}:${j.hasStoredOutput===!0?"1":"0"}:${A}:${$}`}).sort((j,A)=>j.localeCompare(A)).join(","),[t]),h=(0,x.useMemo)(()=>t.map(j=>({...j})),[d]),[f,p]=(0,x.useState)(new Map),[m,g]=(0,x.useState)(new Set),[b,S]=(0,x.useState)(new Map),[w,v]=(0,x.useState)(0),y=(0,x.useCallback)(()=>{q.current.clear(),v(j=>j+1)},[]),T=(0,x.useRef)(new Set),E=(0,x.useRef)(new Map),C=(0,x.useRef)(new Map),N=(0,x.useRef)(new Map),q=(0,x.useRef)(new Set),M=(0,x.useRef)(new Set),R=(0,x.useRef)(new Map),k=(0,x.useRef)(null),P=(0,x.useRef)(new Set),[L,H]=(0,x.useState)(0),Y=(0,x.useRef)(new Map),[I,V]=(0,x.useState)(0);(0,x.useEffect)(()=>Bu(()=>V(j=>j+1)),[]);const{data:F}=Pu({queryKey:Du.instance.generalSettings,queryFn:i(()=>Ed.getGeneral(),"queryFn")}),G=(0,x.useMemo)(()=>new Map(h.map(j=>[j.id,j])),[h]),ne=(0,x.useMemo)(()=>h.filter(j=>j.status==="running").map(j=>j.id).sort((j,A)=>j.localeCompare(A)).join(","),[h]),X=(0,x.useMemo)(()=>new Set(h.filter(j=>j.status==="running").map(j=>j.id)),[ne]),we=(0,x.useMemo)(()=>h.map(j=>j.id).sort((j,A)=>j.localeCompare(A)).join(","),[h]),pe=(0,x.useRef)(new Map),fe=(0,x.useRef)(null),xe=(0,x.useCallback)(()=>{fe.current=null;const j=pe.current;if(j.size===0)return;const A=[...j];j.clear(),p($=>{let K=null;for(const[B,O]of A){const z=(K??$).get(B)??[],{chunks:U,changed:ae}=ah(B,z,O,{seenChunkKeys:T.current,trimmedSeqFloorByRun:E.current},u);ae&&(K=K??new Map($),K.set(B,U))}return K??$})},[u]),ue=(0,x.useCallback)((j,A)=>{if(A.length===0)return;const $=pe.current.get(j);if($)for(const K of A)$.push(K);else pe.current.set(j,[...A]);fe.current===null&&(fe.current=typeof requestAnimationFrame=="function"?{animationFrame:!0,id:requestAnimationFrame(()=>xe())}:{animationFrame:!1,id:window.setTimeout(xe,0)})},[xe]);return(0,x.useEffect)(()=>()=>{const j=fe.current;j!==null&&(fe.current=null,j.animationFrame?cancelAnimationFrame(j.id):window.clearTimeout(j.id))},[]),(0,x.useEffect)(()=>{const j=new Set(h.map(O=>O.id)),A=Date.now(),$=R.current;for(const O of P.current)!j.has(O)&&!$.has(O)&&$.set(O,A+$0);for(const O of j)$.delete(O);P.current=j;const K=new Set(j);let B=Number.POSITIVE_INFINITY;for(const[O,z]of $)z>A?(K.add(O),B=Math.min(B,z)):$.delete(O);p(O=>{const z=new Map;for(const[U,ae]of O)K.has(U)&&z.set(U,ae);return z.size===O.size?O:z}),g(O=>{const z=new Set;for(const U of O)K.has(U)&&z.add(U);return z.size===O.size?O:z}),S(O=>{const z=new Map([...O].filter(([U])=>K.has(U)));return z.size===O.size?O:z});for(const O of C.current.keys()){const z=O.replace(/:records$/,"");K.has(z)||C.current.delete(O)}for(const O of N.current.keys())K.has(O)||N.current.delete(O);for(const O of E.current.keys())K.has(O)||E.current.delete(O);for(const O of q.current.keys())K.has(O)||q.current.delete(O);for(const O of M.current.keys())K.has(O)||M.current.delete(O);for(const O of Y.current.keys())K.has(O)||Y.current.delete(O);for(const O of pe.current.keys())K.has(O)||pe.current.delete(O);if(B!==Number.POSITIVE_INFINITY){const O=window.setTimeout(()=>H(z=>z+1),Math.max(0,B-A)+50);return()=>window.clearTimeout(O)}},[h,L]),(0,x.useEffect)(()=>{if(!l)return;const j=h.filter(wa);if(j.length===0)return;let A=!1;const $=new AbortController,K=new Set,B=i(async W=>{if(Ys(W.status)||M.current.delete(W.id),q.current.has(W.id)||M.current.has(W.id)||K.has(W.id))return;K.add(W.id);const ve=N.current.get(W.id)??V0(W,o);try{const ie=await E0(oe=>Ad.log(W.id,ve,o,{signal:oe}),$.signal);if(A)return;if(S(oe=>{if(!oe.has(W.id))return oe;const le=new Map(oe);return le.delete(W.id),le}),ue(W.id,ih(W.id,ie.content,C.current)),ie.nextOffset!==void 0){N.current.set(W.id,ie.nextOffset);return}ie.content.length>0&&N.current.set(W.id,ve+ie.content.length),Ys(W.status)&&M.current.add(W.id)}catch(ie){if(A)return;ie instanceof Nu&&ie.status===404?(S(oe=>{if(!oe.has(W.id))return oe;const le=new Map(oe);return le.delete(W.id),le}),Ys(W.status)&&q.current.add(W.id)):S(oe=>{if(oe.has(W.id))return oe;const le=new Map(oe);return le.set(W.id,ie instanceof Error?ie:new Error("Run history could not be loaded")),le})}finally{K.delete(W.id),A||g(ie=>{if(ie.has(W.id))return ie;const oe=new Set(ie);return oe.add(W.id),oe})}},"readRunLog"),O=i(async W=>{let ve=0;const ie=i(async()=>{for(;!A&&ve<W.length;)await B(W[ve++])},"worker");await Promise.all(Array.from({length:Math.min(D0,W.length)},ie))},"readEach");O([...j.filter(W=>W.status==="running"),...j.filter(W=>W.status!=="running")]);const z=j.filter(W=>W.status==="running"),U=a?Math.max(r,O0):r,ae=z.length>0&&U>0?window.setInterval(()=>{O(z)},U):null;return()=>{A=!0,$.abort(),ae!==null&&window.clearInterval(ae)}},[l,a,r,o,h,we,w]),(0,x.useEffect)(()=>{if(!l||!a||!e||X.size===0)return;let j=!1,A=null,$=null;k.current?.companyId!==e&&(k.current={companyId:e,attempt:0});const K=k.current,B=i(()=>{if(j)return;K.attempt+=1;const z=Math.min(15e3,1500*2**Math.min(K.attempt-1,4));A=window.setTimeout(O,z)},"scheduleReconnect"),O=i(()=>{if(j)return;const z=Wd(`/api/companies/${encodeURIComponent(e)}/events/ws`);if($=Kd(z),!$){B();return}$.onopen=()=>{j||(K.attempt=0)},$.onmessage=U=>{const ae=typeof U.data=="string"?U.data:"";if(!ae)return;let W;try{W=JSON.parse(ae)}catch{return}if(W.companyId!==e)return;const ve=W.payload??{},ie=ct(ve.runId);if(!(!ie||!X.has(ie))){if(W.type==="heartbeat.run.log"){const oe=ct(ve.chunk);if(!oe)return;const le=ct(ve.ts)??W.createdAt,ze=ct(ve.stream)==="stderr"?"stderr":ct(ve.stream)==="system"?"system":"stdout";ue(ie,[{ts:le,stream:ze,chunk:oe,seq:oh(ve.seq),dedupeKey:`log:${ie}:${le}:${ze}:${oe}`}]);return}if(W.type==="heartbeat.run.event"){const oe=typeof ve.seq=="number"?ve.seq:null,le=ct(ve.eventType)??"event",ze=ct(ve.message)??le;ue(ie,[{ts:W.createdAt,stream:le==="error"?"stderr":"system",chunk:ze,dedupeKey:`socket:event:${ie}:${oe??`${le}:${ze}:${W.createdAt}`}`}]);return}if(W.type==="heartbeat.run.status"){const oe=ct(ve.status)??"updated";ue(ie,[{ts:W.createdAt,stream:Ys(oe)&&oe!=="succeeded"?"stderr":"system",chunk:`run ${oe}`,dedupeKey:`socket:status:${ie}:${oe}:${ct(ve.finishedAt)??""}`}])}}},$.onerror=()=>{$?.close()},$.onclose=()=>{B()}},"connect");return O(),()=>{j=!0,A!==null&&window.clearTimeout(A),$&&($.onmessage=null,$.onerror=null,$.onclose=null,$.readyState===R0?$.onopen=()=>{$?.close(1e3,"live_run_transcripts_unmount")}:$.readyState===j0&&$.close(1e3,"live_run_transcripts_unmount"))}},[l,X,e,a,ue]),{transcriptByRun:(0,x.useMemo)(()=>{const j=new Map,A=F?.censorUsernameInLogs===!0,$=Y.current,K=new Set;for(const B of h){K.add(B.id);const O=f.get(B.id)??P0;let z=$.get(B.id);(!z||z.adapterType!==B.adapterType||z.censorUsernameInLogs!==A||z.parserTick!==I)&&(z={adapterType:B.adapterType,censorUsernameInLogs:A,parserTick:I,incremental:$u(Lu(B.adapterType),{censorUsernameInLogs:A})},$.set(B.id,z)),j.set(B.id,z.incremental.update(O))}for(const B of $.keys())K.has(B)||$.delete(B);return j},[f,F?.censorUsernameInLogs,h,I]),hydratedRunIds:m,errorsByRun:b,retry:y,isInitialHydrating:h.some(j=>wa(j)&&!m.has(j.id)),hasOutputForRun(j){return(f.get(j)?.length??0)>0||G.get(j)?.hasStoredOutput===!0}}}i(F0,"useLiveRunTranscripts");function Sa(t){return typeof t!="object"||t===null||Array.isArray(t)?null:t}i(Sa,"asRecord$1");function U0(t){return t.content.filter(e=>e.type==="text").map(e=>e.text).join("").trim()}i(U0,"readTextContent");function q0({messages:t,isRunning:e,onSend:s,onCancel:n}){const r=(0,x.useRef)(s),o=(0,x.useRef)(n);r.current=s,o.current=n;const a=(0,x.useMemo)(()=>({messages:t,isRunning:e,onNew:i(async l=>{const u=U0(l);if(!u)return;const d=Sa(l.runConfig?.custom),h=Sa(d?.reassignment),f=h&&("assigneeAgentId"in h||"assigneeUserId"in h)?{assigneeAgentId:typeof h.assigneeAgentId=="string"?h.assigneeAgentId:null,assigneeUserId:typeof h.assigneeUserId=="string"?h.assigneeUserId:null}:void 0;await r.current({body:u,reopen:d?.reopen===!0?!0:void 0,reassignment:f,...Array.isArray(d?.attachmentIds)&&d.attachmentIds.length>0?{attachmentIds:[...new Set(d.attachmentIds.filter(p=>typeof p=="string"&&p.length>0))]}:{}})},"onNew"),...n?{onCancel:i(async()=>{await o.current?.()},"onCancel")}:{}}),[t,e,!!n]);return h0(a)}i(q0,"useWardmoteIssueRuntime");function Wi(t){return typeof t!="object"||t===null||Array.isArray(t)?null:t}i(Wi,"asRecord");function Ze(t){return t.replace(/\s+/g," ").trim()}i(Ze,"compactWhitespace");function Ne(t,e){return t.length>e?`${t.slice(0,Math.max(0,e-1))}...`:t}i(Ne,"truncate");function z0(t){return t.replace(/[_-]+/g," ").trim().replace(/\b\w/g,e=>e.toUpperCase())}i(z0,"humanizeLabel");function Jn(t){const e=Ze(t),s=e.match(/^(?:(?:\/bin\/)?(?:zsh|bash|sh)|cmd(?:\.exe)?(?:\s+\/d)?(?:\s+\/s)?(?:\s+\/c)?)\s+(?:-lc|\/c)\s+(.+)$/i)?.[1]??e;return Ze(s.match(/^(['"])([\s\S]*)\1$/)?.[2]??s)}i(Jn,"stripWrappedShell");function Yl(t){if(typeof t=="string")return t;if(t==null)return"";try{return JSON.stringify(t,null,2)}catch{return String(t)}}i(Yl,"formatUnknown");function $n(t,e){for(const s of e){const n=t[s];if(typeof n=="string"&&n.trim())return Ne(Ze(n),120)}return null}i($n,"summarizeRecord");function H0(t){if(!t)return null;const e=t.split(/\r?\n/),s=new Map;let n=e.findIndex(o=>o.trim()==="");n===-1&&(n=e.length);for(let o=0;o<n;o+=1){const a=e[o]?.match(/^([a-z_]+):\s*(.+)$/i);a&&s.set(a[1].toLowerCase(),Ze(a[2]))}const r=e.slice(Math.min(n+1,e.length)).map(o=>Ze(o)).filter(Boolean).join(`
7
- `);return{command:s.get("command")??null,status:s.get("status")??null,exitCode:s.get("exit_code")??null,body:r}}i(H0,"parseStructuredToolResult");function W0(t){if(typeof t=="string")try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}return Yl(t)}i(W0,"formatToolPayload");function K0(t){try{return JSON.parse(t)}catch{return t}}i(K0,"parseToolPayload");function mt(t,e){if(t==="command_execution"||t==="shell"||t==="shellToolCall"||t==="bash")return!0;if(typeof e=="string")return/\b(?:bash|zsh|sh|cmd|powershell)\b/i.test(e);const s=Wi(e);return!!(s&&(typeof s.command=="string"||typeof s.cmd=="string"))}i(mt,"isCommandTool");function Gl(t,e){return mt(t,e)?"Executing command":z0(t)}i(Gl,"displayToolName");function Xl(t,e,s="comfortable"){const n=s==="compact"?72:120;if(typeof e=="string")return Ne(mt(t,e)?Jn(e):Ze(e),n);const r=Wi(e);if(!r){const d=Ze(Yl(e));return d?Ne(d,n):`Inspect ${t} input`}const o=typeof r.command=="string"?r.command:typeof r.cmd=="string"?r.cmd:null,a=$n(r,["description","summary","reason","goal","intent","action","task"])??null;if(a)return Ne(a,n);if(o&&mt(t,r))return Ne(Jn(o),n);const l=$n(r,["path","filePath","file_path","query","url","prompt","message"])??$n(r,["pattern","name","title","target","tool","command","cmd"])??null;if(l)return Ne(l,n);if(Array.isArray(r.paths)&&r.paths.length>0){const d=r.paths.find(h=>typeof h=="string"&&h.trim().length>0);if(d)return Ne(`${r.paths.length} paths, starting with ${d}`,n)}const u=Object.keys(r);return u.length===0?`No ${t} input`:u.length===1?Ne(`${u[0]} payload`,n):Ne(`${u.length} fields: ${u.slice(0,3).join(", ")}`,n)}i(Xl,"summarizeToolInput");function We(t,e=200){if(typeof t=="string"){const s=Ze(t);return s?Ne(s,e):null}return typeof t=="number"||typeof t=="boolean"?String(t):null}i(We,"readToolDetailValue");function J0(t,e){if(typeof e=="string"){const l=Ze(mt(t,e)?Jn(e):e);return l?[{label:mt(t,e)?"Command":"Input",value:Ne(l,200),tone:"code"}]:[]}const s=Wi(e);if(!s)return[];const n=[],r=new Set,o=i((l,u,d="default")=>{if(!u)return;const h=`${l}:${u}`;r.has(h)||(r.add(h),n.push({label:l,value:u,tone:d}))},"pushDetail");if(o("Intent",$n(s,["description","summary","reason","goal","intent","action","task"])??null),o("Path",We(s.path)??We(s.filePath)??We(s.file_path)),o("Directory",We(s.cwd)),o("Query",We(s.query)),o("Target",We(s.url)??We(s.target)),o("Prompt",We(s.prompt)??We(s.message)),o("Pattern",We(s.pattern)),o("Name",We(s.name)??We(s.title)),Array.isArray(s.paths)&&s.paths.length>0){const l=s.paths.filter(u=>typeof u=="string"&&u.trim().length>0).slice(0,3).join(", ");l&&o("Paths",`${l}${s.paths.length>3?`, +${s.paths.length-3} more`:""}`)}const a=typeof s.command=="string"?s.command:typeof s.cmd=="string"?s.cmd:null;return a&&mt(t,s)&&!n.some(l=>l.label==="Intent")&&o("Command",Ne(Jn(a),200),"code"),n}i(J0,"describeToolInput");function Q0(t,e,s="comfortable"){if(!t)return e?"Tool failed":"Waiting for result";const n=H0(t);if(n){if(n.body)return Ne(n.body.split(`
8
- `)[0]??n.body,s==="compact"?84:140);if(n.status==="completed")return"Completed";if(n.status==="failed"||n.status==="error")return n.exitCode?`Failed with exit code ${n.exitCode}`:"Failed"}return Ne(t.split(/\r?\n/).map(r=>Ze(r)).filter(Boolean)[0]??t,s==="compact"?84:140)}i(Q0,"summarizeToolResult");function Pr(t,e=160){return Ne(Ze(t),e)}i(Pr,"summarizeNotice");var ni=30;function Zl(t){return t?Ba(t)?.transcriptPresentation?.maxVisibleEntries??ni:ni}i(Zl,"issueChatTranscriptMaxVisibleEntries");function Be(t){return t instanceof Date?t:new Date(t??Date.now())}i(Be,"toDate");function Ie(t){return Be(t).getTime()}i(Ie,"toTimestamp$1");function Y0(t){return JSON.stringify(t)}i(Y0,"fingerprintThreadMessage");function G0(t){const e=t.metadata?.custom;return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}i(G0,"issueChatMessageCustom$1");function Ia(t){return t.role==="assistant"&&t.status?.type==="running"&&G0(t).kind==="live-run"}i(Ia,"isLiveRunThreadMessage");function X0(t,e){if(!t||!e)return e;if(e.length>=t.length&&e.startsWith(t))return Ta(t,e);const s=ex(t,e);if(s>=8&&s<t.length)return tx(t.slice(0,t.length-s)),e;if(e.length>=t.length||!t.startsWith(e))return Ta(t,e);const n=e.length;if(t[n]===`
9
- `)return e;const r=t.indexOf(`
10
- `,n);return r===-1?t:t.slice(0,r)}i(X0,"preserveReadableStreamingRetraction");function Ta(t,e){if(e.length<=t.length||!e.startsWith(t))return e;const s=e.slice(t.length);if(!s)return e;const n=Z0(s);return n===-1?e:t+s.slice(0,n+1)}i(Ta,"revealCompleteStreamingWords");function Z0(t){let e=-1;for(let s=0;s<t.length;s+=1){const n=t[s];(/\s/.test(n)||/[.,;:!?)}\]"'`]/.test(n))&&(e=s)}return e}i(Z0,"lastReadableWordBoundary");function ex(t,e){const s=Math.min(t.length,e.length);for(let n=s;n>0;n-=1)if(t.endsWith(e.slice(0,n)))return n;return 0}i(ex,"longestSuffixPrefixOverlap");function tx(t){return/(?:\n\s*\n|\n|[.!?]\s+)$/.test(t)}i(tx,"isQuietStreamingRemovalBoundary");function sx(t,e){if(!e||!Ia(t)||!Ia(e))return t;let s=!1;const n=t.content.map((r,o)=>{if(r.type!=="text"&&r.type!=="reasoning")return r;const a=e.content[o];if(a?.type!==r.type)return r;const l=X0(a.text,r.text);return l===r.text?r:(s=!0,{...r,text:l})});return s?{...t,content:n}:t}i(sx,"smoothLiveRunRetractions");function nx(t,e,s){const n=new Map;let r=e.length===t.length;const o=t.map((a,l)=>{const u=s.get(a.id),d=sx(a,u?.message),h=Y0(d),f=u&&u.fingerprint===h?u.message:d;return n.set(a.id,{fingerprint:h,message:f}),r&&e[l]!==f&&(r=!1),f});return{messages:r?e:o,cache:n}}i(nx,"stabilizeThreadMessages");function Br(t){return[...t].sort((e,s)=>{const n=Ie(e.createdAt)-Ie(s.createdAt);return n!==0?n:e.id.localeCompare(s.id)})}i(Br,"sortByCreated");function rx(t){const e=new Map;for(const s of t){const n=e.get(s.id);if(!n){e.set(s.id,s);continue}const r=Ie(n.updatedAt),o=Ie(s.updatedAt);(o>r||o===r&&n.status==="pending"&&s.status!=="pending")&&e.set(s.id,s)}return[...e.values()]}i(rx,"dedupeInteractionsById");function ix(t){const{interactionCreatedAtMs:e,sourceRunId:s,comments:n,timelineEvents:r,linkedRuns:o,liveRuns:a}=t,l=[...n.map(d=>({createdAtMs:Ie(d.createdAt),runId:d.runId??null})),...r.map(d=>({createdAtMs:Ie(d.createdAt),runId:d.runId??null}))],u=[...l,...o.map(d=>({createdAtMs:Ie(Zs(d)),runId:d.runId})),...a.map(d=>({createdAtMs:Ie(d.startedAt??d.createdAt),runId:d.id}))].filter(d=>d.createdAtMs>e&&d.runId!==s).reduce((d,h)=>d===null?h.createdAtMs:Math.min(d,h.createdAtMs),null);return l.filter(d=>d.createdAtMs>e&&d.runId===s&&(u===null||d.createdAtMs<u)).reduce((d,h)=>d===null?h.createdAtMs:Math.max(d,h.createdAtMs),null)}i(ix,"latestSameRunHandoffTimestamp");function Qn(t){if(t===null||typeof t=="string"||typeof t=="number"||typeof t=="boolean")return t;if(Array.isArray(t))return t.map(e=>Qn(e));if(typeof t=="object"&&t){const e=Object.entries(t).map(([s,n])=>[s,Qn(n)]);return Object.fromEntries(e)}return String(t)}i(Qn,"normalizeJsonValue");function Ca(t){return typeof t=="object"&&t&&!Array.isArray(t)?Qn(t):t===void 0?{}:{value:Qn(t)}}i(Ca,"normalizeToolArgs");function ox(t){if(typeof t=="string")return t;if(t==null)return"";try{return JSON.stringify(t,null,2)}catch{return String(t)}}i(ox,"stringifyUnknown");function ax(t,e){return t.text?e.text?t.text.endsWith(`
11
- `)||e.text.startsWith(`
12
- `)||t.text.endsWith(" ")||e.text.startsWith(" ")?`${t.text}${e.text}`:t.type==="text"?`${t.text} ${e.text}`:`${t.text}
13
- ${e.text}`:t.text:e.text}i(ax,"mergePartText");function cx(t){return`\`\`\`diff
14
- ${t.join(`
15
- `)}
16
- \`\`\``}i(cx,"formatDiffBlock");function lx(t){return t.kind!=="init"&&t.kind!=="stderr"&&t.kind!=="stdout"&&t.kind!=="system"&&t.kind!=="workspace_change"&&t.kind!=="workspace_file_reference"&&t.kind!=="runtime_request"&&t.kind!=="run_result"&&t.kind!=="run_terminal"}i(lx,"isIssueChatRenderableTranscriptEntry");function eu(t,e=ni){const s=t.map((a,l)=>({entry:a,fullIndex:l})).filter(({entry:a})=>lx(a));if(s.length<=e)return t;let n=Math.max(0,s.length-e);for(;n>0&&s[n]?.entry.kind==="diff"&&s[n-1]?.entry.kind==="diff";)n-=1;const r=new Set;for(let a=n;a<s.length;a+=1)r.add(a);for(let a=n;a<s.length;a+=1){const l=s[a]?.entry;if(!(l?.kind!=="tool_result"||!l.toolUseId))for(let u=a-1;u>=0;u-=1){const d=s[u]?.entry;if(d?.kind==="tool_call"&&d.toolUseId===l.toolUseId){r.add(u);break}}}const o=new Set;for(const a of r){const l=s[a]?.fullIndex;l!==void 0&&o.add(l)}return t.filter((a,l)=>o.has(l))}i(eu,"compactIssueChatTranscript");function Ki(t){return{unstable_state:null,unstable_annotations:[],unstable_data:[],steps:[],custom:t}}i(Ki,"createAssistantMetadata");function dr(t){return t.authorAgentId??t.runAgentId??t.derivedAuthorAgentId??null}i(dr,"effectiveCommentAuthorAgentId");function ux(t){return t.runId??t.derivedCreatedByRunId??null}i(ux,"effectiveCommentRunId");function dx(t){return t.runAgentId??dr(t)}i(dx,"effectiveCommentRunAgentId");function hx(t){return dr(t)?"agent":t.authorType}i(hx,"effectiveCommentAuthorType");function fx(t,e,s,n,r){const o=dr(t);if(o)return e?.get(o)?.name??(r?.isSystemNotice?"Wardmote":o.slice(0,8));const a=t.authorUserId??null;if(!a)return r?.isSystemNotice?"Wardmote":"You";const l=n?.get(a)?.trim();return l||(Qt(a,s,n)??"You")}i(fx,"authorNameForComment");function tu(t){return t.replace(/_/g," ")}i(tu,"formatStatusLabel");function mx(t){const{comment:e,agentMap:s,currentUserId:n,userLabelMap:r,companyId:o,projectId:a}=t,l=Be(e.createdAt),u=e.authorType==="system",d=u||e.presentation?.kind==="system_notice",h=dr(e),f=fx(e,s,n,r,{isSystemNotice:u}),p={kind:d?"system_notice":"comment",commentId:e.id,anchorId:`comment-${e.id}`,authorName:f,authorType:hx(e),authorAgentId:h,authorUserId:e.authorUserId,onBehalfOfUserId:e.onBehalfOfUserId??null,companyId:o??e.companyId,projectId:a??null,runId:ux(e),runAgentId:dx(e),clientStatus:e.clientStatus??null,queueState:e.queueState??null,queueTargetRunId:e.queueTargetRunId??null,queueReason:e.queueReason??null,interruptedRunId:e.interruptedRunId??null,followUpRequested:e.followUpRequested===!0,publicShareVisible:e.publicShareVisible===!0,presentation:e.presentation??null,commentMetadata:e.metadata??null,origin:e.origin??"comment",fastResponseRequestId:e.fastResponseRequestId??null,deletedAt:e.deletedAt?Be(e.deletedAt).toISOString():null,deletedByType:e.deletedByType??null,deletedByAgentId:e.deletedByAgentId??null,deletedByUserId:e.deletedByUserId??null,deletedByRunId:e.deletedByRunId??null,sourceTrust:e.sourceTrust??null},m=e.deletedAt?"":e.body;return d?{id:e.id,role:"system",createdAt:l,content:[{type:"text",text:m}],metadata:{custom:p}}:h?{id:e.id,role:"assistant",createdAt:l,content:[{type:"text",text:m}],status:{type:"complete",reason:"stop"},metadata:Ki(p)}:{id:e.id,role:"user",createdAt:l,content:[{type:"text",text:m}],attachments:[],metadata:{custom:p}}}i(mx,"createCommentMessage");function px(t){const{event:e,agentMap:s,currentUserId:n,userLabelMap:r}=t,o=e.actorType==="agent"?s?.get(e.actorId)?.name??e.actorId.slice(0,8):e.actorType==="system"?"System":Qt(e.actorId,n,r)??"Board",a=[e.followUpRequested?`${o} requested follow-up`:`${o} updated this issue`];if(e.statusChange&&a.push(`Status: ${e.statusChange.from??"none"} -> ${e.statusChange.to??"none"}`),e.assigneeChange){const l=e.assigneeChange.from.agentId?s?.get(e.assigneeChange.from.agentId)?.name??e.assigneeChange.from.agentId.slice(0,8):Qt(e.assigneeChange.from.userId,n,r)??"Unassigned",u=e.assigneeChange.to.agentId?s?.get(e.assigneeChange.to.agentId)?.name??e.assigneeChange.to.agentId.slice(0,8):Qt(e.assigneeChange.to.userId,n,r)??"Unassigned";a.push(`Assignee: ${l} -> ${u}`)}return e.workspaceChange&&a.push(`Workspace: ${e.workspaceChange.from.label??"none"} -> ${e.workspaceChange.to.label??"none"}`),{id:`activity:${e.id}`,role:"system",createdAt:Be(e.createdAt),content:[{type:"text",text:a.join(`
17
- `)}],metadata:{custom:{kind:"event",anchorId:`activity-${e.id}`,eventId:e.id,actorName:o,actorType:e.actorType,actorId:e.actorId,statusChange:e.statusChange??null,assigneeChange:e.assigneeChange??null,workspaceChange:e.workspaceChange??null,followUpRequested:e.followUpRequested===!0}}}}i(px,"createTimelineEventMessage");function gx(t){return{id:`interaction:${t.id}`,role:"system",createdAt:Be(t.createdAt),content:[{type:"text",text:Wa(t)}],metadata:{custom:{kind:"interaction",anchorId:`interaction-${t.id}`,interaction:t}}}}i(gx,"createInteractionMessage");function Zs(t){return t.finishedAt??t.startedAt??t.createdAt}i(Zs,"runTimestamp");function bx(t){const{isMessageRunning:e,segmentIndex:s,segmentCount:n}=t;return e?n<=0||s<0?!0:s===n-1:!1}i(bx,"isCoTSegmentActive");function xx(t){const e=[];let s=!1,n=0,r=0;for(const o of t){const a=new Date(o.ts).getTime(),l=o.kind==="thinking"||o.kind==="tool_call"||o.kind==="tool_result"||o.kind==="diff"||o.kind==="provider_activity"||o.kind==="result"&&(o.isError&&!!o.errors?.length||!!o.text),u=o.kind==="assistant"&&!!o.text;l?(s||(s=!0,n=a),r=a):u&&s&&(e.push({startMs:n,endMs:r}),s=!1)}return s&&e.push({startMs:n,endMs:r}),e}i(xx,"computeSegmentTimings");function Ji(t){if(t===null||!Number.isFinite(t)||t<=0)return null;const e=Math.max(1,Math.round(t/1e3));if(e<60)return`${e} second${e===1?"":"s"}`;const s=Math.round(e/60);if(s<60)return`${s} minute${s===1?"":"s"}`;const n=Math.floor(s/60),r=s%60;return r===0?`${n} hour${n===1?"":"s"}`:`${n} hour${n===1?"":"s"} ${r} minute${r===1?"":"s"}`}i(Ji,"formatDurationWords");function su(t){const e=t.startedAt??t.createdAt,s=t.finishedAt??null,n=Ji(s?Math.max(0,Ie(s)-Ie(e)):null),r=typeof t.resultJson?.stopReason=="string"?t.resultJson.stopReason:null;switch(t.status){case"succeeded":return n?`Worked for ${n}`:"Finished work";case"failed":case"error":return n?`Failed after ${n}`:"Run failed";case"timed_out":return n?`Timed out after ${n}`:"Run timed out";case"cancelled":return vi(t.resultJson,t.errorCode)?n?`Interrupted by board after ${n}`:"Interrupted by board":r==="paused"?n?`Paused by board after ${n}`:"Paused by board":n?`Cancelled after ${n}`:"Run cancelled";case"queued":return"Queued";case"running":return"Working...";default:return tu(t.status)}}i(su,"runDurationLabel");function vx(t,e){const s=t.agentName??e?.get(t.agentId)?.name??t.agentId.slice(0,8);return{id:`run:${t.runId}`,role:"system",createdAt:Be(Zs(t)),content:[{type:"text",text:`${s} run ${t.runId.slice(0,8)} ${tu(t.status)}`}],metadata:{custom:{kind:"run",anchorId:`run-${t.runId}`,runId:t.runId,runAgentId:t.agentId,runAgentName:s,runStatus:t.status,execution:t.execution,runOperatorInterrupted:vi(t.resultJson,t.errorCode)}}}}i(vx,"createHistoricalRunMessage");function yx(t){const{run:e,transcript:s,hasOutput:n,agentMap:r}=t,o=e.agentName??r?.get(e.agentId)?.name??e.agentId.slice(0,8),{parts:a,notices:l,segments:u}=nu(eu(s,Zl(e.adapterType))),d=n?"":"Run finished",h=a.length>0?a:d?[{type:"text",text:d}]:[];return{id:`run-assistant:${e.runId}`,role:"assistant",createdAt:Be(e.startedAt??e.createdAt),content:h,status:{type:"complete",reason:"stop"},metadata:Ki({kind:"historical-run",anchorId:`run-${e.runId}`,runId:e.runId,runAgentId:e.agentId,runAgentName:o,runStatus:e.status,execution:e.execution,runOperatorInterrupted:vi(e.resultJson,e.errorCode),notices:l,waitingText:d,chainOfThoughtLabel:su(e),chainOfThoughtSegments:u})}}i(yx,"createHistoricalTranscriptMessage");function nu(t){const e=[],s=new Map,n=new Map,r=[];let o=[],a;const l=i(()=>{o.length!==0&&(e.push({type:"text",text:cx(o),parentId:a}),o=[],a=void 0)},"flushPendingDiff");for(const[d,h]of t.entries()){if(h.kind==="diff"){a??=`diff-group:${d}`,o.push(h.text??"");continue}if(l(),h.kind==="assistant"&&h.text){e.push({type:"text",text:h.text});continue}if(h.kind==="provider_activity"){const f=`provider-activity-${d}`,p=Ca({family:h.family??"provider_notice",eventType:h.eventType??"provider.notice.recorded",status:h.status??"informational",title:h.title??"Provider activity",summary:h.summary??"",payload:h.payload??{}});e.push({type:"tool-call",toolCallId:f,toolName:"wardmote_provider_activity",args:p,argsText:"",...h.status==="running"?{}:{result:{status:h.status??"informational"}}});continue}if(h.kind==="thinking"&&h.text){e.push({type:"reasoning",text:h.text});continue}if(h.kind==="tool_call"){const f=h.toolUseId||`tool-${d}`,p={type:"tool-call",toolCallId:f,toolName:h.name||"tool",args:Ca(h.input),argsText:ox(h.input)};if(!s.has(f))n.set(f,e.length),e.push(p);else{const m=n.get(f);m!==void 0&&(e[m]=p)}s.set(f,p);continue}if(h.kind==="tool_result"){const f=h.toolUseId||`tool-result-${d}`,p=s.get(f),m=typeof p?.result=="string"?p.result:"",g=h.delta?`${m}${h.content??""}`:h.content||m,b={type:"tool-call",toolCallId:f,toolName:p?.toolName||h.toolName||"tool",args:p?.args??{},argsText:p?.argsText??"",result:g,isError:h.isError===!0};if(p){const S=n.get(f);S!==void 0&&(e[S]=b)}else n.set(f,e.length),e.push(b);s.set(f,b);continue}if(h.kind!=="init"&&h.kind!=="stderr"&&h.kind!=="stdout"&&h.kind!=="system"&&h.kind==="result"){if(h.isError&&h.errors?.length)for(const f of h.errors)e.push({type:"reasoning",text:`Run error: ${Pr(f)}`});else h.text&&e.push({type:"reasoning",text:h.isError?`Run error: ${Pr(h.text)}`:Pr(h.text)});continue}}l();const u=[];for(const d of e){if(d.type==="tool-call"){u.push(d);continue}const h=u.at(-1);if(h&&h.type===d.type&&h.parentId===d.parentId){u[u.length-1]={...h,text:ax(h,d)};continue}u.push(d)}return{parts:u,notices:r,segments:xx(t)}}i(nu,"buildAssistantPartsFromTranscript");function _x(t,e,s,n){const r=new Map;for(const o of t)Vn(o,n)&&r.set(o.id,o);return e&&Vn(e,n)&&r.set(e.id,{id:e.id,status:e.status,invocationSource:e.invocationSource,triggerDetail:e.triggerDetail,contextCommentId:e.contextCommentId,contextWakeCommentId:e.contextWakeCommentId,startedAt:e.startedAt?Be(e.startedAt).toISOString():null,finishedAt:e.finishedAt?Be(e.finishedAt).toISOString():null,createdAt:Be(e.createdAt).toISOString(),agentId:e.agentId,agentName:e.agentName,adapterType:e.adapterType,logBytes:e.logBytes,lastOutputBytes:e.lastOutputBytes,issueId:e.issueId??s,livenessState:e.livenessState,livenessReason:e.livenessReason,continuationAttempt:e.continuationAttempt,lastUsefulActionAt:e.lastUsefulActionAt?Be(e.lastUsefulActionAt).toISOString():null,nextAction:e.nextAction,outputSilence:e.outputSilence,currentStatusMessage:e.currentStatusMessage??null,currentStatusUpdatedAt:e.currentStatusUpdatedAt?Be(e.currentStatusUpdatedAt).toISOString():null,currentToolName:e.currentToolName??null,lastAssistantSnippet:e.lastAssistantSnippet??null,lastEventAt:e.lastEventAt?Be(e.lastEventAt).toISOString():null}),[...r.values()].sort((o,a)=>Ie(o.createdAt)-Ie(a.createdAt))}i(_x,"normalizeLiveRuns");function wx(t){const{run:e,transcript:s}=t,{parts:n,notices:r,segments:o}=nu(eu(s,Zl(e.adapterType))),a=e.status==="queued"?"Queued...":n.length>0?"":"Working...",l=n;return{id:`run-assistant:${e.id}`,role:"assistant",createdAt:Be(e.startedAt??e.createdAt),content:l,status:{type:"running"},metadata:Ki({kind:"live-run",runId:e.id,runAgentId:e.agentId,runAgentName:e.agentName,runStatus:e.status,execution:e.execution,adapterType:e.adapterType,notices:r,waitingText:a,chainOfThoughtLabel:su(e),chainOfThoughtSegments:o,currentStatusMessage:e.currentStatusMessage??null,currentStatusUpdatedAt:e.currentStatusUpdatedAt??null,currentToolName:e.currentToolName??null,lastAssistantSnippet:e.lastAssistantSnippet??null,lastEventAt:e.lastEventAt??null})}}i(wx,"createLiveRunMessage");function Sx(t,e=[]){return t.presentation?.kind==="system_notice"&&["AI connection needs attention","Configuration incomplete"].includes(t.presentation.title??"")&&!!t.metadata?.sourceRunId&&e.some(s=>s.kind==="connection_intent"&&s.payload.purpose==="ai"&&s.sourceRunId===t.metadata?.sourceRunId)}i(Sx,"isRedundantAiRecoveryNotice");function Ix(t){const{comments:e,interactions:s=[],timelineEvents:n,linkedRuns:r,liveRuns:o,activeRun:a,transcriptsByRunId:l,hasOutputForRun:u,includeSucceededRunsWithoutOutput:d=!1,issueId:h,companyId:f,projectId:p,agentMap:m,currentUserId:g,userLabelMap:b,issueStatus:S}=t,w=[];for(const v of Br(e))Sx(v,s)||w.push({createdAtMs:Ie(v.createdAt),order:1,message:mx({comment:v,agentMap:m,currentUserId:g,userLabelMap:b,companyId:f,projectId:p})});for(const v of Br(rx(s))){if(_d(v))continue;const y=Ie(v.createdAt),T=v.kind==="request_confirmation"&&v.sourceRunId?ix({interactionCreatedAtMs:y,sourceRunId:v.sourceRunId,comments:e,timelineEvents:n,linkedRuns:r,liveRuns:o}):null;w.push({createdAtMs:T??y,order:2,message:gx(v)})}for(const v of Br(n))w.push({createdAtMs:Ie(v.createdAt),order:0,message:px({event:v,agentMap:m,currentUserId:g,userLabelMap:b})});for(const v of[...r].sort((y,T)=>Ie(Zs(y))-Ie(Zs(T)))){const y=l?.get(v.runId)??[],T=y.length>0||(u?.(v.runId)??!1);if(T||v.status!=="succeeded"){w.push({createdAtMs:Ie(v.startedAt??v.createdAt),order:2,message:yx({run:v,transcript:y,hasOutput:T,agentMap:m})});continue}d&&w.push({createdAtMs:Ie(Zs(v)),order:2,message:vx(v,m)})}for(const v of _x(o,a,h,S))w.push({createdAtMs:Ie(v.startedAt??v.createdAt),order:3,message:wx({run:v,transcript:l?.get(v.id)??[]})});return w.sort((v,y)=>v.createdAtMs!==y.createdAtMs?v.createdAtMs-y.createdAtMs:v.order!==y.order?v.order-y.order:v.message.id.localeCompare(y.message.id)).map(v=>v.message)}i(Ix,"buildIssueChatMessages");function ka(t){if(!t)return 0;const e=t instanceof Date?t.getTime():new Date(t).getTime();return Number.isFinite(e)?e:0}i(ka,"toTimestamp");function Tx(t){const{linkedRuns:e=[],liveRuns:s=[],activeRun:n=null,limit:r=20}=t,o=new Map;for(const l of s)o.set(l.id,{id:l.id,status:l.status,adapterType:l.adapterType,logBytes:l.logBytes,lastOutputBytes:l.lastOutputBytes});n&&o.set(n.id,{id:n.id,status:n.status,adapterType:n.adapterType,logBytes:n.logBytes,lastOutputBytes:n.lastOutputBytes});const a=[...e].filter(l=>!o.has(l.runId)&&l.adapterType).sort((l,u)=>ka(u.createdAt)-ka(l.createdAt));for(const l of a){if(o.size>=r)break;const u=l.adapterType;u&&o.set(l.runId,{id:l.runId,status:l.status,adapterType:u,hasStoredOutput:l.hasStoredOutput,logBytes:l.logBytes})}return[...o.values()]}i(Tx,"resolveIssueChatTranscriptRuns");function Cx({children:t,...e}){const s=vd(),n=s?.availability,r=(0,x.useMemo)(()=>{if(n)return a=>{const l=n.check(gd(a));return l.state==="openable"?l.target:null}},[n]),o=i(a=>{if(!s||a.metaKey||a.ctrlKey||a.shiftKey||a.altKey)return;const l=a.target?.closest("a");if(!l)return;const u=new URL(l.href,window.location.href);if(u.origin!==window.location.origin||u.pathname!==window.location.pathname)return;const d=xd(u.search);d&&(a.preventDefault(),s.open(d))},"handleClick");return(0,c.jsx)("div",{onClick:o,children:(0,c.jsx)(Gn,{...e,resolveWorkspaceFileRef:r,children:t})})}i(Cx,"WorkspaceFileMarkdownBody");function kx(t){return t.currentBody.trim()?t.currentBody:t.submittedBody}i(kx,"restoreSubmittedCommentDraft");function Ax(t=document,e=window){const s=[t.scrollingElement,t.documentElement,t.body];for(const n of s){if(!(n instanceof HTMLElement))continue;const r=e.getComputedStyle(n),o=i(a=>a==="hidden"||a==="clip","clipped");if(o(r.overflowY)||o(r.overflow))return!1}return!0}i(Ax,"isWindowScrollable");function Ex(t=document,e=window){const s=t.getElementById("main-content");if(s instanceof HTMLElement){const n=e.getComputedStyle(s).overflowY;if((n==="auto"||n==="scroll"||n==="overlay")&&s.scrollHeight>s.clientHeight+1)return{type:"element",element:s}}return{type:"window"}}i(Ex,"resolveIssueChatScrollTarget");function ru(t){return t?{composerViewportTop:t.getBoundingClientRect().top}:null}i(ru,"captureComposerViewportSnapshot");function Rx(t,e=document){if(!t)return!1;const s=e.activeElement;return!!(s instanceof Node&&t.contains(s))}i(Rx,"shouldPreserveComposerViewport");function iu(t,e,s=document,n=window){if(!t||!e)return;const r=e.getBoundingClientRect().top-t.composerViewportTop;if(!Number.isFinite(r)||Math.abs(r)<1)return;const o=Ex(s,n);if(o.type==="element"){o.element.scrollTop+=r;return}Ax(s,n)&&n.scrollBy({top:r,left:0,behavior:"auto"})}i(iu,"restoreComposerViewportSnapshot");function jx({action:t,scheduledRetry:e}){const s={scheduledRetry:e??null},n=Ld(t,s);if(!n)return null;const r=Fd[n],o=r.icon,a=Vd(t,s),l=Hd(n,t.kind,a),u=a?Ud(a):null;return(0,c.jsxs)(Jt,{variant:"outline","data-testid":"issue-blocked-notice-recovery-indicator","data-recovery-state":n,"data-recovery-kind":t.kind,"data-recovery-lane":a?.lane,role:"status","aria-label":u?`${l} — ${u}`:l,title:u?`${l} — ${u}. Open the source task to act.`:`${l} — open the source task to act.`,className:`[&>svg]:size-2.5 gap-0.5 px-1.5 text-(length:--text-nano) ${r.className}`,children:[(0,c.jsx)(o,{className:"h-2.5 w-2.5","aria-hidden":!0}),l]})}i(jx,"BlockerRecoveryIndicator");function Mx({issueId:t,scheduledRetry:e}){const s=fh(t),n=e.scheduledRetryAt?new Date(e.scheduledRetryAt).toISOString():null,r=n?$d(n):null,o=r==="now"?"due now":r?`scheduled ${r}`:"scheduled",a=s.isSuccess&&(s.data?.outcome==="promoted"||s.data?.outcome==="already_promoted");return(0,c.jsxs)("div",{className:"mt-2 rounded-md border border-amber-300/70 bg-bg/80 p-2 dark:border-amber-500/40 dark:bg-bg/40",children:[(0,c.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,c.jsx)("div",{className:"min-w-0 text-xs leading-5 text-amber-900 dark:text-amber-100",children:s.data?.outcome==="waiting"&&s.data.scheduledRetry?.runId===e.runId?s.data.message:(0,c.jsxs)(c.Fragment,{children:["Wardmote will ask the assignee to choose the next step ",o,". Retry now starts that follow-up immediately."]})}),(0,c.jsx)(Ee,{type:"button",variant:"secondary",size:"sm",className:"shrink-0 shadow-none",onClick:i(()=>s.mutate(),"onClick"),disabled:s.isPending||a,"data-testid":"issue-next-step-retry-now",children:s.isPending?(0,c.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,c.jsx)(pt,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":"true"}),"Retrying..."]}):a?(0,c.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,c.jsx)(Pa,{className:"h-3.5 w-3.5","aria-hidden":"true"}),s.data?.outcome==="already_promoted"?"Already promoted":"Promoted"]}):(0,c.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,c.jsx)(Sd,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Retry now"]})})]}),(0,c.jsx)(gh,{error:s.lastError,className:"mt-2 border-amber-300/70 bg-amber-100/70 text-amber-950 dark:border-amber-500/40 dark:bg-amber-500/15 dark:text-amber-100",onRetry:i(()=>{s.reset(),s.mutate()},"onRetry")})]})}i(Mx,"SuccessfulRunRetryNowControl");var Nx=new Set;function Dx(t){return t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}i(Dx,"waitingTaskStatusLabel");function Aa({blocker:t,running:e=!1}){const s=t.identifier??t.id;return(0,c.jsxs)(Fa,{issuePathId:s,to:$a(s),className:"inline-flex max-w-full items-center gap-1 rounded-md border border-blue-300/70 bg-bg/80 px-2 py-1 font-mono text-xs text-blue-950 transition-colors hover:border-blue-500 hover:bg-blue-100 hover:underline dark:border-blue-500/40 dark:bg-bg/40 dark:text-blue-100 dark:hover:bg-blue-500/15",children:[(0,c.jsx)(zu,{status:t.status,size:"sm",title:`${Dx(t.status)} status`}),(0,c.jsx)("span",{children:t.identifier??t.id.slice(0,8)}),(0,c.jsx)("span",{className:"max-w-(--sz-18rem) truncate font-sans text-(length:--text-micro) text-blue-800 dark:text-blue-200",children:t.title}),e?(0,c.jsx)("span",{className:"ml-0.5 rounded-full bg-blue-500/15 px-1.5 py-0.5 text-(length:--text-nano) font-medium uppercase tracking-wide text-blue-700 dark:bg-blue-400/20 dark:text-blue-200",children:"running"}):null]})}i(Aa,"WaitingChipLink");function Ox({status:t}){return t==="done"?(0,c.jsx)(Pa,{className:"h-3.5 w-3.5 text-blue-500 dark:text-blue-400","aria-hidden":!0}):t==="running"?(0,c.jsx)("span",{className:"flex h-3.5 w-3.5 items-center justify-center","aria-hidden":!0,children:(0,c.jsx)("span",{className:"h-2.5 w-2.5 animate-pulse rounded-full bg-blue-400"})}):(0,c.jsx)(ad,{className:"h-3.5 w-3.5 text-blue-300 dark:text-blue-500/50","aria-hidden":!0})}i(Ox,"WaitingStepGlyph");function Px({liveRunId:t,assigneeAgentId:e}){const s=t?t.slice(0,8):null;return(0,c.jsx)("div",{"data-testid":"issue-next-step-in-flight","data-successful-run-handoff":"in_flight",className:"mb-3 rounded-md border border-line/60 bg-bg-3/40 px-3 py-2 text-xs text-ink-3",children:(0,c.jsxs)("div",{className:"flex items-start gap-2",children:[(0,c.jsx)("span",{className:"mt-1 flex h-3.5 w-3.5 shrink-0 items-center justify-center","aria-hidden":!0,children:(0,c.jsx)("span",{className:"h-2 w-2 animate-pulse rounded-full bg-blue-400"})}),(0,c.jsxs)("p",{className:"min-w-0 leading-5",children:["A correction run is in progress — the agent is working. This alert returns if the run stops without choosing a next step.",s?(0,c.jsxs)(c.Fragment,{children:[" ",e?(0,c.jsxs)(Is,{to:`/agents/${e}/runs/${t}`,className:"font-mono underline underline-offset-2 hover:text-ink",children:["run ",s]}):(0,c.jsxs)("span",{className:"font-mono",children:["run ",s]})]}):null]})]})})}i(Px,"SuccessfulRunHandoffInFlightNotice");function Bx({blockerAttentionState:t,chainBlockers:e,terminalBlockers:s,liveIds:n,parkedBlockers:r,renderParkedChip:o}){const a=zd(e,n),l=a.length,u=a.filter(m=>m.status==="done").length,d=a.filter(m=>m.status==="running").length,h=new Set(a.map(m=>m.blocker.id)),f=new Set,p=[];for(const m of[...s,...e])n.has(m.id)&&(h.has(m.id)||f.has(m.id)||(f.add(m.id),p.push(m)));return(0,c.jsx)("div",{"data-blocker-attention-state":t,"data-testid":"issue-blocked-notice-live",className:"mb-3 rounded-md border border-blue-300/70 bg-blue-50/90 px-3 py-2.5 text-sm text-blue-950 shadow-sm dark:border-blue-500/40 dark:bg-blue-500/10 dark:text-blue-100",children:(0,c.jsxs)("div",{className:"flex items-start gap-2",children:[(0,c.jsx)("span",{className:"mt-1.5 flex h-4 w-4 shrink-0 items-center justify-center","aria-hidden":!0,children:(0,c.jsx)("span",{className:"h-2.5 w-2.5 animate-pulse rounded-full bg-blue-400"})}),(0,c.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,c.jsxs)("div",{className:"space-y-1",children:[(0,c.jsx)("p",{className:"font-medium leading-5",children:"Waiting on live work"}),(0,c.jsxs)("p",{className:"leading-5",children:["Queued behind ",l," ",l===1?"task":"tasks"," being worked in order. This task resumes automatically when the chain is done. Comments still notify the assignee."]})]}),(0,c.jsxs)("div",{className:"space-y-1","data-testid":"issue-blocked-notice-progress",children:[(0,c.jsxs)("div",{className:"text-xs font-medium text-blue-800 dark:text-blue-200",children:[u," of ",l," done",d>0?` · ${d} running`:null]}),(0,c.jsx)("div",{role:"progressbar","aria-label":"Blocker chain progress","aria-valuemin":0,"aria-valuenow":u,"aria-valuemax":l,className:"flex h-2 w-full overflow-hidden rounded-full bg-blue-100 dark:bg-blue-500/20",children:a.map(({blocker:m,status:g})=>(0,c.jsx)("span",{className:te("h-full border-r border-blue-50/80 last:border-r-0 dark:border-blue-950/40",g==="done"?"bg-blue-500 dark:bg-blue-400":g==="running"?"animate-pulse bg-blue-400":"bg-blue-200 dark:bg-blue-500/30"),style:{width:`${100/l}%`},title:`${m.identifier??m.id.slice(0,8)}: ${g}`,"aria-hidden":!0},m.id))})]}),(0,c.jsxs)("div",{"data-testid":"issue-blocked-notice-steps",children:[a.map(({blocker:m,status:g})=>(0,c.jsxs)("div",{className:"flex items-stretch gap-2",children:[(0,c.jsxs)("div",{className:"flex w-3.5 flex-col items-center",children:[(0,c.jsx)("span",{className:"flex min-h-6 items-center",children:(0,c.jsx)(Ox,{status:g})}),(0,c.jsx)("span",{className:"w-px flex-1 bg-blue-300/50 dark:bg-blue-500/30","aria-hidden":!0})]}),(0,c.jsx)("div",{className:"min-w-0 pb-1.5",children:(0,c.jsx)(Aa,{blocker:m,running:g==="running"})})]},m.id)),(0,c.jsxs)("div",{className:"flex items-stretch gap-2",children:[(0,c.jsx)("div",{className:"flex w-3.5 flex-col items-center",children:(0,c.jsx)("span",{className:"mt-1.5 h-3 w-3 rounded-full border border-dashed border-blue-400/60 dark:border-blue-400/50","aria-hidden":!0})}),(0,c.jsx)("div",{className:"min-w-0 pb-0.5",children:(0,c.jsx)("span",{className:"inline-block rounded-md border border-dashed border-blue-300/70 px-2 py-1 text-xs text-blue-800 dark:border-blue-500/40 dark:text-blue-200",children:"This task — resumes automatically when the chain is done"})})]})]}),p.length>0?(0,c.jsxs)("div",{"data-testid":"issue-blocked-notice-now-running",className:"space-y-1 pt-0.5",children:[(0,c.jsx)("div",{className:"text-xs font-medium text-blue-800 dark:text-blue-200",children:"Now running"}),(0,c.jsx)("div",{className:"flex flex-wrap items-center gap-1.5",children:p.map(m=>(0,c.jsx)(Aa,{blocker:m,running:!0},m.id))})]}):null,r.length>0?(0,c.jsxs)("div",{"data-testid":"issue-blocked-notice-parked-row",className:"flex flex-wrap items-center gap-1.5 pt-0.5",children:[(0,c.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-amber-800 dark:text-amber-200",children:[(0,c.jsx)(mi,{className:"h-3 w-3","aria-hidden":!0}),"Blocked by parked work"]}),r.map(m=>o(m))]}):null]})]})})}i(Bx,"WaitingOnLiveWorkNotice");function $x({issueId:t,issueStatus:e,blockers:s,allBlockers:n,liveIssueIds:r,blockerAttention:o,successfulRunHandoff:a,scheduledRetry:l,agentName:u}){if(e==="done"||e==="cancelled")return null;const d=!!(t&&r?.has(t)),h=a!=null&&Jd({successfulRunHandoff:a,scheduledRetry:l})&&!d,f=a!=null&&a.required===!0&&!h&&(a.hasLiveContinuation||d)?(0,c.jsx)(Px,{liveRunId:a.liveRunId,assigneeAgentId:a.assigneeAgentId}):null;if(!h&&s.length===0&&e!=="blocked")return f;const p=h&&t&&l?.status==="scheduled_retry"?{issueId:t,scheduledRetry:l}:null,m=s.length===1?"the linked task":"the linked tasks",g=s.flatMap(I=>I.terminalBlockers??[]).filter((I,V,F)=>F.findIndex(G=>G.id===I.id)===V),b=o?.state==="stalled",S=(()=>{const I=new Set,V=[],F=[...s];for(const G of s)for(const ne of G.terminalBlockers??[])F.push(ne);for(const G of F)qd(G)&&(I.has(G.id)||(I.add(G.id),V.push(G)));return V})(),w=S.length>0,v=o?.sampleStalledBlockerIdentifier??o?.sampleBlockerIdentifier??null,y=(()=>{const I=[];for(const V of[...s,...g])V.status==="in_review"&&(I.some(F=>F.id===V.id)||I.push(V));if(v){const V=I.find(F=>(F.identifier??F.id)===v);if(V)return[V,...I.filter(F=>F.id!==V.id)]}return I})(),T=b&&y.length>0,E=u??"the assignee",C=e==="blocked"&&!b&&s.length>0,N=(()=>{if(!C)return[];const I=new Set,V=[];for(const F of s){const G=(F.terminalBlockers??[]).filter(X=>X.status!=="done"&&X.status!=="cancelled"),ne=G.length>0?G:[F];for(const X of ne)I.has(X.id)||(I.add(X.id),V.push(X))}return V})(),q=N[0]??null,M=q?q.identifier??q.id.slice(0,8):null,R=q?Co(q)?"unavailable":q.status.replace(/_/g," "):null,k=Math.max(N.length-1,0),P=i(I=>{if(Co(I))return(0,c.jsxs)("span",{className:"inline-flex max-w-full items-center gap-1.5",children:[(0,c.jsx)(bd,{identifier:I.identifier}),(0,c.jsx)("span",{className:"text-(length:--text-micro) text-ink-3",children:"Private — you don't have access"})]},I.id);const V=I.identifier??I.id,F=I.activeRecoveryAction??null;return(0,c.jsxs)(Fa,{issuePathId:V,to:$a(V),className:"inline-flex max-w-full items-center gap-1 rounded-md border border-amber-300/70 bg-bg/80 px-2 py-1 font-mono text-xs text-amber-950 transition-colors hover:border-amber-500 hover:bg-amber-100 hover:underline dark:border-amber-500/40 dark:bg-bg/40 dark:text-amber-100 dark:hover:bg-amber-500/15",children:[(0,c.jsx)("span",{children:I.identifier??I.id.slice(0,8)}),(0,c.jsx)("span",{className:"max-w-(--sz-18rem) truncate font-sans text-(length:--text-micro) text-amber-800 dark:text-amber-200",children:I.title}),F?(0,c.jsx)(jx,{action:F,scheduledRetry:I.scheduledRetry}):null]},I.id)},"renderBlockerChip"),L=r??Nx,H=n??s,Y=[...H,...g].some(I=>L.has(I.id));return!h&&o?.state==="covered"&&H.length>0&&Y?(0,c.jsx)(Bx,{blockerAttentionState:o?.state,chainBlockers:H,terminalBlockers:g,liveIds:L,parkedBlockers:w?S:[],renderParkedChip:P}):(0,c.jsx)("div",{"data-blocker-attention-state":o?.state,"data-successful-run-handoff":h?"required":void 0,className:"mb-3 rounded-md border border-amber-300/70 bg-amber-50/90 px-3 py-2.5 text-sm text-amber-950 shadow-sm dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-100",children:(0,c.jsxs)("div",{className:"flex items-start gap-2",children:[(0,c.jsx)(Xn,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-300"}),(0,c.jsxs)("div",{className:"min-w-0 space-y-1.5",children:[h?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("p",{className:"font-medium leading-5",children:"This task still needs a next step."}),(0,c.jsx)("p",{className:"leading-5",children:"A run finished successfully, but the task is still open. Wardmote needs someone to choose what happens next."}),(0,c.jsxs)("ul",{className:"list-disc space-y-1 pl-5 text-xs leading-5 text-amber-900 dark:text-amber-100",children:[(0,c.jsx)("li",{children:"Mark it done or cancelled."}),(0,c.jsx)("li",{children:"Send it for review or ask for input."}),(0,c.jsx)("li",{children:"Record what is blocking it and who owns that blocker."}),(0,c.jsx)("li",{children:"Delegate follow-up work or queue a continuation."})]}),(0,c.jsxs)("div",{className:"flex flex-wrap gap-1.5 text-xs",children:[a.sourceRunId&&a.assigneeAgentId?(0,c.jsxs)(Is,{to:`/agents/${a.assigneeAgentId}/runs/${a.sourceRunId}`,className:"rounded-md border border-amber-300/70 bg-bg/80 px-2 py-1 font-mono text-amber-950 hover:border-amber-500 hover:bg-amber-100 hover:underline dark:border-amber-500/40 dark:bg-bg/40 dark:text-amber-100 dark:hover:bg-amber-500/15",children:["run ",a.sourceRunId.slice(0,8)]}):a.sourceRunId?(0,c.jsxs)("span",{className:"rounded-md border border-amber-300/70 bg-bg/80 px-2 py-1 font-mono text-amber-950 dark:border-amber-500/40 dark:bg-bg/40 dark:text-amber-100",children:["run ",a.sourceRunId.slice(0,8)]}):null,(0,c.jsxs)("span",{className:"rounded-md border border-amber-300/70 bg-bg/80 px-2 py-1 text-amber-900 dark:border-amber-500/40 dark:bg-bg/40 dark:text-amber-100",children:["Asked ",u??"the assignee"," to choose the next step"]})]}),a.detectedProgressSummary?(0,c.jsxs)("p",{className:"text-xs leading-5 text-amber-800 dark:text-amber-200",children:["Detected progress: ",a.detectedProgressSummary]}):null,p?(0,c.jsx)(Mx,{issueId:p.issueId,scheduledRetry:p.scheduledRetry}):null]}):null,h&&(s.length>0||e==="blocked")?(0,c.jsx)("div",{className:"border-t border-amber-300/60 pt-1.5 dark:border-amber-500/30"}):null,s.length>0||e==="blocked"?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("p",{className:"leading-5",children:s.length>0?b?y.length>1?(0,c.jsxs)(c.Fragment,{children:["Work on this task is blocked by ",m,", but the chain is stalled in review without a clear next step. Resolve the stalled reviews below or remove them as blockers."]}):(0,c.jsxs)(c.Fragment,{children:["Work on this task is blocked by ",m,", but the chain is stalled in review without a clear next step. Resolve the stalled review below or remove it as a blocker."]}):C?(0,c.jsxs)(c.Fragment,{children:["A message won’t restart this task yet — it stays blocked by ",m," until ",s.length===1?"it is":"they are"," done, then it reopens automatically. Comments still notify ",E," for questions or triage in the meantime."]}):(0,c.jsxs)(c.Fragment,{children:["Work on this task is blocked by ",m," until ",s.length===1?"it is":"they are"," complete. Comments still notify the assignee for questions or triage."]}):(0,c.jsx)(c.Fragment,{children:"Work on this task is blocked until someone moves it back to To do. Comments still notify the assignee for questions or triage."})}),C&&M?(0,c.jsxs)("p",{"data-testid":"issue-blocked-notice-reopen-suppressed",className:"text-xs font-medium leading-5 text-amber-900 dark:text-amber-100",children:["Still blocked by"," ",(0,c.jsx)("span",{className:"font-mono",children:M}),R?(0,c.jsxs)(c.Fragment,{children:[" (",R,")"]}):null,k>0?` and ${k} other ${k===1?"task":"tasks"}`:null,"."]}):null,s.length>0?(0,c.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.map(P)}):null,T?(0,c.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 pt-0.5",children:[(0,c.jsx)("span",{className:"text-xs font-medium text-amber-800 dark:text-amber-200",children:"Stalled in review"}),y.map(P)]}):g.length>0?(0,c.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 pt-0.5",children:[(0,c.jsx)("span",{className:"text-xs font-medium text-amber-800 dark:text-amber-200",children:"Ultimately waiting on"}),g.map(P)]}):null,w?(0,c.jsxs)("div",{"data-testid":"issue-blocked-notice-parked-row",className:"flex flex-wrap items-center gap-1.5 pt-0.5",children:[(0,c.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-amber-800 dark:text-amber-200",children:[(0,c.jsx)(mi,{className:"h-3 w-3","aria-hidden":!0}),"Blocked by parked work"]}),S.map(P)]}):null]}):null]})]})})}i($x,"IssueBlockedNotice");function Lx({issueStatus:t,assigneeAgent:e,assigneeUserId:s,onResume:n,resuming:r}){if(t!=="backlog"||!e&&!s)return null;const o=e?.name??"the assignee";return(0,c.jsx)("div",{"data-testid":"issue-assigned-backlog-notice","data-issue-status":t,className:"mb-3 rounded-md border border-amber-300/70 bg-amber-50/90 px-3 py-2.5 text-sm text-amber-950 shadow-sm dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-100",children:(0,c.jsxs)("div",{className:"flex items-start gap-2",children:[(0,c.jsx)(mi,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-300"}),(0,c.jsxs)("div",{className:"min-w-0 flex-1 space-y-1.5",children:[(0,c.jsxs)("p",{className:"leading-5",children:[(0,c.jsx)("span",{className:"font-medium",children:"Parked"})," —"," ",(0,c.jsx)("span",{className:"font-medium",children:o})," will not be asked to work on this until status changes to To do or In progress."]}),e?(0,c.jsx)("p",{className:"text-xs leading-5 text-amber-800 dark:text-amber-200",children:"Comments still notify the assignee for questions or triage. Leave this parked only if the work is intentionally on hold."}):null,n?(0,c.jsx)("div",{className:"pt-0.5",children:(0,c.jsx)(Ee,{size:"sm",variant:"secondary",className:"h-7",onClick:n,disabled:r,"data-testid":"issue-assigned-backlog-resume",children:r?"Resuming…":"Resume now"})}):null]})]})})}i(Lx,"IssueAssignedBacklogNotice");function Vx(t){const{authorAgentId:e,onBehalfOfUserId:s,issueAssigneeAgentId:n,resolveUserLabel:r}=t;return!e||!s||n&&e===n?null:{userName:Fu(r?.(s))}}i(Vx,"resolveCommentAttribution");function Fx(){return(0,c.jsxs)(Jt,{variant:"outline",className:"gap-1 text-(length:--text-nano) uppercase tracking-(--tracking-eyebrow)",title:"Visible on the public link",children:[(0,c.jsx)(Va,{className:"h-3 w-3","aria-hidden":!0}),"Public"]})}i(Fx,"CommentPublicShareBadge");function Ux({visible:t,onToggle:e}){return(0,c.jsxs)(za,{children:[(0,c.jsx)(Ua,{asChild:!0,children:(0,c.jsx)(Ee,{variant:"ghost",size:"icon-xs",title:"Comment actions","aria-label":"Comment actions",children:(0,c.jsx)(Ha,{className:"h-3.5 w-3.5"})})}),(0,c.jsx)(qa,{align:"end",children:(0,c.jsxs)(On,{onSelect:i(()=>e(!t),"onSelect"),children:[t?(0,c.jsx)(yd,{className:"mr-2 h-3.5 w-3.5"}):(0,c.jsx)(Va,{className:"mr-2 h-3.5 w-3.5"}),t?"Hide from public link":"Show on public link"]})})]})}i(Ux,"CommentPublicShareMenu");var At=(0,x.createContext)({feedbackDataSharingPreference:"prompt",feedbackTermsUrl:null,issueStatus:void 0,successfulRunHandoff:null}),qx="max-w-(--sz-calc-7) sm:max-w-(--pct-85)";function zx(t){const{messageId:e,currentFolded:s,isFoldable:n,previousMessageId:r,previousIsFoldable:o}=t;return e!==r?n:n?o?s:!0:!1}i(zx,"resolveAssistantMessageFoldedState");function Hx(t,e){if(e.length===0)return-1;const s=e[0];let n=-1,r=!1;for(const o of t)if(o.type==="reasoning"||o.type==="tool-call"){if(r||(n++,r=!0),o===s)return n}else r=!1;return-1}i(Hx,"findCoTSegmentIndex");function ou(t,e){return ch(!!(e&&t)),!e||!t?null:Ji(Date.now()-t)}i(ou,"useLiveElapsed");function Mn(t,e){return typeof t[e]=="string"?t[e].trim():""}i(Mn,"readCustomString");function Wx(t){if(!t)return null;const e=new Date(t).getTime();return Number.isFinite(e)?e:null}i(Wx,"toTimestampOrNull");function au({custom:t,active:e,className:s}){const n=Mn(t,"currentStatusMessage"),r=Mn(t,"currentToolName"),o=Mn(t,"lastAssistantSnippet"),a=Wx(Mn(t,"lastEventAt")),l=ou(a,e),u=a?Date.now()-a:null;if(!e)return null;const d=[r?`Using ${r}`:o||n,l?u!==null&&u>=15e3?`no output for ${l} - still running`:`${l} ago`:""].filter(Boolean).join(" · ");return d?(0,c.jsx)("span",{className:te("mt-0.5 block truncate text-xs leading-4 text-ink-3/70",s),title:d,children:d}):null}i(au,"IssueChatLiveRunStatusLine");function Ue(t){const e=(0,x.useRef)(t);return(0,x.useLayoutEffect)(()=>{e.current=t},[t]),(0,x.useMemo)(()=>{if(t)return((...s)=>e.current?.(...s))},[!!t])}i(Ue,"useStableEvent");function Kx(t,e){return!!t.trim()&&e.kind!=="none"}i(Kx,"shouldRenderComposerHandoffPreview");var Jx=class extends x.Component{static{i(this,"IssueChatErrorBoundary")}state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,e){}componentDidUpdate(t){this.state.hasError&&t.resetKey!==this.props.resetKey&&this.setState({hasError:!1})}render(){return this.state.hasError?(0,c.jsx)(Gx,{messages:this.props.messages,emptyMessage:this.props.emptyMessage,variant:this.props.variant,externalReferences:this.props.externalReferences}):this.props.children}};function Ea({agent:t,onResume:e,resuming:s}){if(!t||t.status!=="paused")return null;const n=t.pauseReason==="budget"?"It was paused by a budget hard stop.":t.pauseReason==="import"?"It arrived paused from an organization import — imported agents stay parked until you resume them.":t.pauseReason==="system"?"It was paused by the system.":"It was paused manually.",r=!!e&&t.pauseReason!=="budget";return(0,c.jsx)("div",{"data-testid":"issue-assignee-paused-notice",className:"mb-3",children:(0,c.jsxs)(Bd,{tone:"warning",icon:nc,compact:!0,title:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"font-medium",children:t.name})," is paused."]}),actions:r?(0,c.jsx)(Ee,{size:"sm",variant:"secondary",onClick:e,disabled:s,"data-testid":"issue-assignee-paused-resume",children:s?"Resuming…":"Resume agent"}):void 0,children:["New runs will not start until the agent is resumed. ",n]})})}i(Ea,"IssueAssigneePausedNotice");function Qx(t){const e=t.metadata?.custom;return typeof e?.authorName=="string"?e.authorName:typeof e?.runAgentName=="string"?e.runAgentName:t.role==="assistant"?"Agent":t.role==="user"?"You":"System"}i(Qx,"fallbackAuthorLabel");function Yx(t){const e=[];for(const n of t.content){if(n.type==="text"||n.type==="reasoning"){n.text.trim().length>0&&e.push(n.text);continue}if(n.type==="tool-call"){const r=[`Tool: ${n.toolName}`];n.argsText?.trim()&&r.push(`Args:
18
- ${n.argsText}`),typeof n.result=="string"&&n.result.trim()&&r.push(`Result:
19
- ${n.result}`),e.push(r.join(`
20
-
21
- `))}}const s=t.metadata?.custom;return e.length===0&&typeof s?.waitingText=="string"&&s.waitingText.trim()&&e.push(s.waitingText),e}i(Yx,"fallbackTextParts");function Gx({messages:t,emptyMessage:e,variant:s,externalReferences:n}){return(0,c.jsxs)("div",{className:te(s==="embedded"?"space-y-3":"space-y-4"),children:[(0,c.jsx)("div",{className:"rounded-xl border border-amber-300/60 bg-amber-50/80 px-4 py-3 text-sm text-amber-900 dark:border-amber-500/30 dark:bg-amber-950/20 dark:text-amber-200",children:(0,c.jsxs)("div",{className:"flex items-start gap-2",children:[(0,c.jsx)(Xn,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,c.jsxs)("div",{className:"space-y-1",children:[(0,c.jsx)("p",{className:"font-medium",children:"Chat renderer hit an internal state error."}),(0,c.jsx)("p",{className:"text-xs opacity-80",children:"Showing a safe fallback transcript instead of crashing the tasks page."})]})]})}),t.length===0?(0,c.jsx)($r,{className:te("block shadow-none text-center text-sm text-ink-3",s==="embedded"?"border-dashed border-line/70 bg-bg/60 px-4 py-6":"border-dashed px-6 py-10"),children:e}):(0,c.jsx)("div",{className:te(s==="embedded"?"space-y-3":"space-y-4"),children:t.map(r=>{const o=Yx(r);return(0,c.jsxs)($r,{className:"block border-line/60 bg-bg-2/70 px-4 py-3",children:[(0,c.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-sm",children:[(0,c.jsx)("span",{className:"font-medium text-ink",children:Qx(r)}),r.createdAt?(0,c.jsx)("span",{className:"text-(length:--text-micro) text-ink-3",children:es(r.createdAt)}):null]}),(0,c.jsx)("div",{className:"space-y-2",children:o.length>0?o.map((a,l)=>(0,c.jsx)(Gn,{externalReferences:n,children:a},`${r.id}:fallback:${l}`)):(0,c.jsx)("p",{className:"text-sm text-ink-3",children:"No message content."})})]},r.id)})})]})}i(Gx,"IssueChatFallbackThread");var Xx=800,Zx=96,ev=.4;function Nn(t){return Array.from(t.dataTransfer?.types??[]).includes("Files")}i(Nn,"hasFilePayload");function tv(t){return!Number.isFinite(t)||t<=0?"":t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1048576).toFixed(1)} MB`}i(tv,"formatAttachmentSize");function xs(t){return t?typeof t=="string"?t:t.toISOString():null}i(xs,"toIsoString");function Ra(t){if(t==null)return;const e=new Date(t);return Number.isNaN(e.getTime())?void 0:e.toISOString()}i(Ra,"toValidIsoString");function sv(t){if(!t||t==="__none__")return{assigneeAgentId:null,assigneeUserId:null};if(t.startsWith("agent:")){const e=t.slice(6);return e?{assigneeAgentId:e,assigneeUserId:null}:null}if(t.startsWith("user:")){const e=t.slice(5);return e?{assigneeAgentId:null,assigneeUserId:e}:null}return null}i(sv,"parseReassignment");function nv(t,e){return(t==="done"||t==="cancelled"||t==="blocked")&&e.startsWith("agent:")}i(nv,"shouldImplicitlyReopenComment");function rv(t){return!t||t==="__none__"}i(rv,"isUnassignedReassignValue");var iv=6048e5;function es(t){if(!t)return"";const e=new Date(t).getTime();return Date.now()-e<iv?Ln(t):ku(t)}i(es,"commentDateLabel");var cu=(0,x.memo)(i(function({text:e,recessed:s,onAccent:n}){const{onImageClick:r,externalReferences:o,linkCaseReferences:a}=(0,x.useContext)(At);return rc(e)?(0,c.jsx)(ov,{text:e,recessed:s,onImageClick:r}):(0,c.jsx)(Cx,{className:te("text-sm leading-6",n&&"wardmote-markdown-on-accent"),style:s?{opacity:.55}:void 0,softBreaks:!0,onImageClick:r,externalReferences:o,linkCaseReferences:a,children:e})},"IssueChatTextPart"));function ov({text:t,recessed:e,onImageClick:s}){const n=Qd(t);return(0,c.jsx)("div",{className:te("rounded-md border px-3 py-2.5 text-sm shadow-sm",n?"border-red-500/35 bg-red-500/10 text-red-950 dark:text-red-100":"border-amber-300/70 bg-amber-50/90 text-amber-950 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-100"),style:e?{opacity:.55}:void 0,children:(0,c.jsxs)("div",{className:"flex items-start gap-2",children:[(0,c.jsx)(Xn,{className:te("mt-1 h-4 w-4 shrink-0",n?"text-red-600 dark:text-red-300":"text-amber-600 dark:text-amber-300")}),(0,c.jsx)(Gn,{className:"min-w-0 text-sm leading-6",softBreaks:!0,onImageClick:s,children:t})]})})}i(ov,"SuccessfulRunHandoffCommentCallout");function ja(t){return t?t.replace(/_/g," "):"None"}i(ja,"humanizeValue");function Qi(t){const e=t.trim().split(/\s+/);return e.length>=2?(e[0][0]+e[e.length-1][0]).toUpperCase():t.slice(0,2).toUpperCase()}i(Qi,"initialsForName");function av(t){const{agentId:e,userId:s,agentMap:n,currentUserId:r,userLabelMap:o}=t;return e?n?.get(e)?.name??e.slice(0,8):s?o?.get(s)??Qt(s,r,o)??"Board":"System"}i(av,"formatInteractionActorLabel");function cv(t){if(t.length===0)return null;let e=0,s=0;for(const r of t)mt(r.toolName,r.args)?e++:s++;const n=[];return e>0&&n.push(`ran ${e} command${e===1?"":"s"}`),s>0&&n.push(`called ${s} tool${s===1?"":"s"}`),n.join(", ")}i(cv,"toolCountSummary");function lv(t){const e=Gl(t.toolName,t.args);if(mt(t.toolName,t.args))return e;const s=t.result===void 0?Xl(t.toolName,t.args):null;return s?`${e} ${s}`:e}i(lv,"cleanToolDisplayText");function uv({message:t,cotParts:e}){const{agentMap:s}=(0,x.useContext)(At),n=t.metadata.custom,r=typeof n.runAgentId=="string"?n.runAgentId:null,o=(typeof n.authorAgentId=="string"?n.authorAgentId:null)??r;o&&s?.get(o)?.icon;const a=typeof n.adapterType=="string"?n.adapterType:null,l=(a?Ba(a)?.transcriptPresentation?.liveReasoningView:void 0)==="scrollLog",u=t.role==="assistant"&&t.status?.type==="running",d=(0,x.useMemo)(()=>Hx(t.content,e),[t.content,e]),h=e.filter(C=>C.type==="reasoning"&&!!C.text).map(C=>C.text).join(`
22
- `),f=e.filter(C=>C.type==="tool-call"),p=Array.isArray(n.chainOfThoughtSegments)?n.chainOfThoughtSegments:[],m=d>=0?p[d]??null:null,g=bx({isMessageRunning:u,segmentIndex:d,segmentCount:p.length}),[b,S]=(0,x.useState)(g),w=ou(m?.startMs,g);(0,x.useEffect)(()=>{g&&S(!0)},[g]);let v,y=null;if(g)v="Working",w&&(y=`for ${w}`);else if(m){const C=m.endMs-m.startMs,N=Ji(C);v="Worked",N&&(y=`for ${N}`)}else v="Worked";const T=cv(f),E=h.trim().length>0||f.length>0;return(0,c.jsxs)("div",{children:[(0,c.jsxs)("button",{type:"button",className:"group flex w-full items-start gap-2.5 rounded-lg px-1 py-2 text-left transition-colors hover:bg-bg-3/5",onClick:i(()=>E&&S(C=>!C),"onClick"),children:[(0,c.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,c.jsxs)("div",{className:"flex min-w-0 items-center gap-2.5",children:[(0,c.jsxs)("span",{className:"inline-flex items-center gap-2 text-sm font-medium text-ink/80",children:[o?(0,c.jsx)(rt,{agent:o?s?.get(o)??{id:o}:void 0,size:16}):g?(0,c.jsx)(pt,{className:"h-4 w-4 shrink-0 animate-spin text-ink-3"}):(0,c.jsx)("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:(0,c.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500/70"})}),g?(0,c.jsx)("span",{className:"shimmer-text",children:v}):v]}),y?(0,c.jsx)("span",{className:"text-xs text-ink-3/60",children:y}):null,T?(0,c.jsxs)("span",{className:"text-xs text-ink-3/40",children:["· ",T]}):null]}),(0,c.jsx)(au,{custom:n,active:g,className:"pl-6"})]}),E?(0,c.jsx)(ts,{className:te("mt-0.5 h-4 w-4 shrink-0 text-ink-3/50 transition-transform",b&&"rotate-180")}):null]}),b&&E?(0,c.jsx)("div",{className:"space-y-1 py-1",children:g&&l?(0,c.jsxs)(c.Fragment,{children:[h?(0,c.jsx)(dv,{text:h}):null,f.map(C=>(0,c.jsx)(Ma,{toolName:C.toolName,args:C.args,argsText:C.argsText,result:C.result,isError:!1},C.toolCallId))]}):g?(0,c.jsxs)(c.Fragment,{children:[h?(0,c.jsx)(ri,{text:h}):null,f.length>0?(0,c.jsx)(hv,{toolParts:f}):null]}):(0,c.jsxs)(c.Fragment,{children:[h?(0,c.jsx)(ri,{text:h}):null,f.map(C=>(0,c.jsx)(Ma,{toolName:C.toolName,args:C.args,argsText:C.argsText,result:C.result,isError:!1},C.toolCallId))]})}):null]})}i(uv,"IssueChatChainOfThought");function dv({text:t}){const e=t.split(`
23
- `).filter(r=>r.trim()),s=(0,x.useRef)(null),n=(0,x.useRef)(!0);return(0,x.useEffect)(()=>{const r=s.current;r&&n.current&&(r.scrollTop=r.scrollHeight)},[t]),e.length<=1?(0,c.jsx)(ri,{text:t}):(0,c.jsxs)("div",{className:"flex gap-2 px-1",children:[(0,c.jsx)("div",{className:"flex flex-col items-center pt-0.5",children:(0,c.jsx)(La,{className:"h-3.5 w-3.5 shrink-0 text-ink-3/50"})}),(0,c.jsx)("div",{ref:s,onScroll:i(()=>{const r=s.current;r&&(n.current=r.scrollHeight-r.scrollTop-r.clientHeight<24)},"onScroll"),className:"min-w-0 flex-1 max-h-40 space-y-0.5 overflow-y-auto pr-1",children:e.map((r,o)=>(0,c.jsx)("p",{className:"whitespace-pre-wrap break-words text-(length:--text-compact) italic leading-5 text-ink-3/70",children:r},o))})]})}i(dv,"IssueChatVerboseLiveReasoningPart");function ri({text:t}){const e=t.split(`
24
- `).filter(a=>a.trim()),s=e[e.length-1]??t.slice(-200),n=(0,x.useRef)(s),[r,o]=(0,x.useState)({key:0,current:s,exiting:null});return(0,x.useEffect)(()=>{if(s!==n.current){const a=n.current;n.current=s,o(l=>({key:l.key+1,current:s,exiting:a}))}},[s]),(0,c.jsxs)("div",{className:"flex gap-2 px-1",children:[(0,c.jsx)("div",{className:"flex flex-col items-center pt-0.5",children:(0,c.jsx)(La,{className:"h-3.5 w-3.5 shrink-0 text-ink-3/50"})}),(0,c.jsxs)("div",{className:"relative h-5 min-w-0 flex-1 overflow-hidden",children:[r.exiting!==null&&(0,c.jsx)("span",{className:"cot-line-exit absolute inset-x-0 truncate text-(length:--text-compact) italic leading-5 text-ink-3/70",onAnimationEnd:i(()=>o(a=>({...a,exiting:null})),"onAnimationEnd"),children:r.exiting},`out-${r.key}`),(0,c.jsx)("span",{className:te("absolute inset-x-0 truncate text-(length:--text-compact) italic leading-5 text-ink-3/70",r.key>0&&"cot-line-enter"),children:r.current},`in-${r.key}`)]})]})}i(ri,"IssueChatReasoningPart");function hv({toolParts:t}){const e=t[t.length-1];if(!e)return null;const s=lv(e),n=(0,x.useRef)(s),[r,o]=(0,x.useState)({key:0,current:s,exiting:null});(0,x.useEffect)(()=>{if(s!==n.current){const u=n.current;n.current=s,o(d=>({key:d.key+1,current:s,exiting:u}))}},[s]);const a=lu(e.toolName),l=e.result===void 0;return(0,c.jsxs)("div",{className:"flex gap-2 px-1",children:[(0,c.jsx)("div",{className:"flex flex-col items-center pt-0.5",children:l?(0,c.jsx)(pt,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-ink-3/50"}):(0,c.jsx)(a,{className:"h-3.5 w-3.5 shrink-0 text-ink-3/50"})}),(0,c.jsxs)("div",{className:"relative h-5 min-w-0 flex-1 overflow-hidden",children:[r.exiting!==null&&(0,c.jsx)("span",{className:"cot-line-exit absolute inset-x-0 truncate text-(length:--text-compact) leading-5 text-ink-3/70",onAnimationEnd:i(()=>o(u=>({...u,exiting:null})),"onAnimationEnd"),children:r.exiting},`out-${r.key}`),(0,c.jsx)("span",{className:te("absolute inset-x-0 truncate text-(length:--text-compact) leading-5 text-ink-3/70",r.key>0&&"cot-line-enter"),children:r.current},`in-${r.key}`)]})]})}i(hv,"IssueChatRollingToolPart");function ii({children:t,className:e}){const[s,n]=(0,x.useState)(!1),r=Zn();return(0,c.jsxs)("div",{className:"group/pre relative",children:[(0,c.jsx)("pre",{className:e,children:t}),(0,c.jsx)("button",{type:"button",className:te("absolute right-1.5 top-1.5 inline-flex h-6 w-6 items-center justify-center rounded-md bg-bg/80 text-ink-3 opacity-0 backdrop-blur-sm transition-opacity hover:text-ink group-hover/pre:opacity-100",s&&"opacity-100"),title:"Copy","aria-label":"Copy",onClick:i(()=>{Cs(t).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(o=>{r?.pushToast({title:"Copy failed",body:o instanceof Error?o.message:"Unable to copy text",tone:"error"})})},"onClick"),children:s?(0,c.jsx)(Ts,{className:"h-3 w-3"}):(0,c.jsx)(en,{className:"h-3 w-3"})})]})}i(ii,"CopyablePreBlock");var fv={wardmote_provider_activity:fi};function lu(t){return fv[t]??Hu}i(lu,"getToolIcon");function Ma({toolName:t,args:e,argsText:s,result:n,isError:r}){const[o,a]=(0,x.useState)(!1);if(t==="wardmote_provider_activity")return(0,c.jsx)(mv,{args:e,running:n===void 0,open:o,onToggle:i(()=>a(w=>!w),"onToggle")});const l=s??"",u=e??K0(l),d=typeof n=="string"?n:n===void 0?"":W0(n),h=J0(t,u),f=Gl(t,u),p=mt(t,u)?null:n===void 0?Xl(t,u):Q0(d,!1),m=lu(t),g=h.find(w=>w.label==="Intent"),b=g?.value??f,S=h.filter(w=>w.label!=="Intent");return(0,c.jsxs)("div",{className:"flex gap-2 px-1",children:[(0,c.jsxs)("div",{className:"flex flex-col items-center pt-1",children:[(0,c.jsx)(m,{className:"h-3.5 w-3.5 shrink-0 text-ink-3/50"}),o?(0,c.jsx)("div",{className:"mt-1 w-px flex-1 bg-line/40"}):null]}),(0,c.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,c.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md py-0.5 text-left transition-colors hover:bg-bg-3/5",onClick:i(()=>a(w=>!w),"onClick"),children:[(0,c.jsxs)("span",{className:"min-w-0 flex-1 truncate text-(length:--text-compact) text-ink-3/80",children:[b,!g&&p?(0,c.jsx)("span",{className:"ml-1.5 text-ink-3/50",children:p}):null]}),n===void 0?(0,c.jsx)(pt,{className:"h-3 w-3 shrink-0 animate-spin text-ink-3/50"}):null,(0,c.jsx)(ts,{className:te("h-3.5 w-3.5 shrink-0 text-ink-3/40 transition-transform",o&&"rotate-180")})]}),o?(0,c.jsxs)("div",{className:"mt-1 space-y-2 pb-1",children:[S.length>0?(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"mb-1 text-(length:--text-nano) font-semibold uppercase tracking-(--tracking-eyebrow) text-ink-3/60",children:"Input"}),(0,c.jsx)("dl",{className:"space-y-1.5",children:S.map(w=>(0,c.jsxs)("div",{children:[(0,c.jsx)("dt",{className:"text-(length:--text-nano) font-medium text-ink-3/60",children:w.label}),(0,c.jsx)("dd",{className:te("text-xs leading-5 text-ink/70",w.tone==="code"&&"font-mono text-(length:--text-micro)"),children:w.value})]},`${w.label}:${w.value}`))})]}):l?(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"mb-1 text-(length:--text-nano) font-semibold uppercase tracking-(--tracking-eyebrow) text-ink-3/60",children:"Input"}),(0,c.jsx)(ii,{className:"overflow-x-auto rounded-md bg-bg-3/30 p-2 text-(length:--text-micro) leading-4 text-ink/70",children:l})]}):null,n!==void 0?(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"mb-1 text-(length:--text-nano) font-semibold uppercase tracking-(--tracking-eyebrow) text-ink-3/60",children:"Result"}),(0,c.jsx)(ii,{className:"overflow-x-auto rounded-md bg-bg-3/30 p-2 text-(length:--text-micro) leading-4 text-ink/70",children:d})]}):null]}):null]})]})}i(Ma,"IssueChatToolPart");function mv({args:t,running:e,open:s,onToggle:n}){const r=typeof t=="object"&&t!==null&&!Array.isArray(t)?t:{},o=typeof r.payload=="object"&&r.payload!==null&&!Array.isArray(r.payload)?r.payload:{},a=typeof r.title=="string"?r.title:"Provider activity",l=typeof r.summary=="string"?r.summary:"",u=Array.isArray(o.steps)?o.steps.slice(0,256):[],d=Array.isArray(o.children)?o.children.slice(0,64):[],h=Array.isArray(o.sources)?o.sources.slice(0,64):[],f=typeof o.output=="string"?o.output.slice(-8192):"",p=typeof o.effectiveModel=="string"?o.effectiveModel:null,m=typeof o.requestedModel=="string"?o.requestedModel:null,g=u.length>0||d.length>0||h.length>0||f.length>0||p!==null;return(0,c.jsxs)("div",{className:"flex gap-2 px-1","data-provider-family":String(r.family??"unknown"),children:[(0,c.jsx)("div",{className:"pt-1",children:(0,c.jsx)(fi,{className:"h-3.5 w-3.5 text-ink-3/50"})}),(0,c.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,c.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md py-0.5 text-left hover:bg-bg-3/5",onClick:n,"aria-expanded":s,children:[(0,c.jsxs)("span",{className:"min-w-0 flex-1 truncate text-(length:--text-compact) text-ink-3/80",children:[a,l?(0,c.jsx)("span",{className:"ml-1.5 text-ink-3/50",children:l}):null]}),e?(0,c.jsx)(pt,{className:"h-3 w-3 animate-spin text-ink-3/50"}):null,g?(0,c.jsx)(ts,{className:te("h-3.5 w-3.5 text-ink-3/40 transition-transform",s&&"rotate-180")}):null]}),s&&g?(0,c.jsxs)("div",{className:"mt-1 space-y-2 rounded-md border border-line/50 bg-bg-3/15 p-2 text-xs",children:[u.map((b,S)=>{const w=typeof b=="object"&&b!==null?b:{};return(0,c.jsxs)("div",{className:"flex gap-2",children:[(0,c.jsx)("span",{"aria-hidden":!0,children:w.status==="completed"?"✓":w.status==="blocked"?"!":"○"}),(0,c.jsx)("span",{children:String(w.body??"")})]},String(w.stepId??S))}),d.map((b,S)=>{const w=typeof b=="object"&&b!==null?b:{};return(0,c.jsxs)("div",{children:[(0,c.jsx)("span",{className:"font-medium",children:String(w.role??"Child agent")})," ","· ",String(w.status??"unknown"),w.summary?` — ${String(w.summary)}`:""]},String(w.childId??S))}),h.map((b,S)=>{const w=typeof b=="object"&&b!==null?b:{},v=typeof w.url=="string"&&/^https?:\/\//.test(w.url)?w.url:null;return(0,c.jsxs)("div",{children:[v?(0,c.jsx)("a",{href:v,target:"_blank",rel:"noreferrer",className:"underline",children:String(w.title??v)}):(0,c.jsx)("span",{children:String(w.title??"Unavailable source")})," ",(0,c.jsx)("span",{className:"text-ink-3",children:"(provider-reported)"})]},String(w.sourceId??S))}),p?(0,c.jsxs)("div",{children:[(0,c.jsx)("span",{className:"text-ink-3",children:"Model"})," ",m&&m!==p?`${m} → `:"",p]}):null,f?(0,c.jsx)(ii,{className:"max-h-56 overflow-auto whitespace-pre-wrap rounded bg-bg/70 p-2 font-mono text-(length:--text-micro)",children:f}):null]}):null]})]})}i(mv,"IssueChatProviderActivity");function pv(t){return t.content.filter(e=>e.type==="text").map(e=>e.text).join(`
25
-
26
- `)}i(pv,"getThreadMessageCopyText");var gv=(0,x.memo)(i(function({message:e,recessed:s=!1,onAccent:n=!1}){return(0,c.jsx)(c.Fragment,{children:e.content.filter(r=>r.type==="text").map((r,o)=>(0,c.jsx)(cu,{text:r.text,recessed:s,onAccent:n},`${e.id}:text:${o}`))})},"IssueChatTextParts"));function bv(t){const e=[];let s=[],n=-1;const r=i(()=>{s.length!==0&&(e.push({type:"cot",parts:s,startIndex:n}),s=[],n=-1)},"flushCoT");return t.forEach((o,a)=>{if(o.type==="reasoning"||o.type==="tool-call"){s.length===0&&(n=a),s.push(o);return}r(),o.type==="text"&&e.push({type:"text",part:o,index:a})}),r(),e}i(bv,"groupAssistantParts");var Na=(0,x.memo)(i(function({message:e,hasCoT:s}){const n=(0,x.useMemo)(()=>bv(e.content),[e.content]);return(0,c.jsx)(c.Fragment,{children:n.map(r=>r.type==="text"?(0,c.jsx)(cu,{text:r.part.text,recessed:s},`${e.id}:text:${r.index}`):(0,c.jsx)(uv,{message:e,cotParts:r.parts},`${e.id}:cot:${r.startIndex}`))})},"IssueChatAssistantParts"));function xv({message:t,isInterruptingQueuedRun:e}){const{onInterruptQueued:s,onCancelQueued:n,onDeleteComment:r,onSetCommentPublicShare:o,currentUserId:a,userProfileMap:l}=(0,x.useContext)(At),u=t.metadata.custom,d=typeof u.anchorId=="string"?u.anchorId:void 0,h=typeof u.commentId=="string"?u.commentId:t.id,f=typeof u.authorName=="string"?u.authorName:null,p=typeof u.authorUserId=="string"?u.authorUserId:null,m=u.queueState==="queued"||u.clientStatus==="queued",g=du(u.sourceTrust)?u.sourceTrust:null,b=u.followUpRequested===!0,S=u.publicShareVisible===!0,w=uu(u.commentMetadata)&&u.commentMetadata.sourceChannel==="imessage-photon",v=(typeof u.queueReason=="string"?u.queueReason:null)==="hold"?"⏸ Deferred wake":"Queued",y=u.clientStatus==="pending",T=!!u.deletedAt,E=typeof u.queueTargetRunId=="string"?u.queueTargetRunId:null,[C,N]=(0,x.useState)(!1),[q,M]=(0,x.useState)(!1),R=Zn(),{isCurrentUser:k,authorName:P,avatarUrl:L}=nh({authorName:f,authorUserId:p,currentUserId:a,userProfileMap:l}),H=(0,c.jsxs)(hi,{size:"sm",className:"shrink-0",children:[L?(0,c.jsx)(ed,{src:L,alt:P}):null,(0,c.jsx)(di,{children:Qi(P)})]}),Y=!!(r&&k&&!m&&!y&&!T),I=!!(o&&u.authorType==="user"&&!m&&!y&&!T),V=i(()=>{Y&&M(!0)},"handleDeleteComment"),F=i(()=>{Y&&(M(!1),r?.(h))},"confirmDeleteComment"),G=(0,c.jsxs)("div",{className:te("flex min-w-0 max-w-(--pct-85) flex-col",k&&"items-end"),children:[(0,c.jsxs)("div",{className:te("mb-1 flex items-center gap-2 px-1",k?"justify-end":"justify-start"),children:[(0,c.jsx)("span",{className:"text-sm font-medium text-ink",children:P}),(0,c.jsx)(Pn,{sourceTrust:g,artifactLabel:"comment"}),b?(0,c.jsx)(Jt,{variant:"outline",className:"text-(length:--text-nano) uppercase tracking-(--tracking-eyebrow)",children:"Follow-up"}):null,S&&!T?(0,c.jsx)(Fx,{}):null]}),(0,c.jsxs)("div",{className:te("min-w-0 max-w-full overflow-hidden break-all rounded-2xl px-4 py-2.5",k?"rounded-br-(--rad-4)":"rounded-bl-(--rad-4)",m?"bg-amber-50/80 dark:bg-amber-500/10":T?"bg-bg-3/50 text-ink-3":k?"bg-(--liveness-blue) text-white":"bg-bg-3",y&&"opacity-80"),children:[m?(0,c.jsxs)("div",{className:"mb-1.5 flex items-center gap-2",children:[(0,c.jsx)(Jt,{variant:"outline",className:"border-amber-400/60 bg-amber-100/70 text-(length:--text-nano) uppercase tracking-(--tracking-eyebrow) text-amber-800 dark:border-amber-400/40 dark:bg-amber-500/20 dark:text-amber-200",children:v}),s?(0,c.jsx)(Ee,{size:"sm",variant:"danger",className:"h-6 px-2 text-(length:--text-micro)",disabled:e,onClick:i(()=>{s(E)},"onClick"),children:e?"Interrupting...":"Interrupt"}):null,n?(0,c.jsx)(Ee,{size:"sm",variant:"secondary",className:"h-6 px-2 text-(length:--text-micro)",onClick:i(()=>n(h),"onClick"),children:"Cancel"}):null]}):null,T?(0,c.jsx)("div",{className:"text-sm italic text-ink-3",children:"Comment deleted"}):(0,c.jsx)("div",{className:"min-w-0 max-w-full space-y-3",children:(0,c.jsx)(gv,{message:t,onAccent:k&&!m})})]}),w&&!T?(0,c.jsx)("div",{className:"mt-1 px-1 text-xs text-ink-3",children:"Sent from iMessage"}):null,y?(0,c.jsx)("div",{className:te("mt-1 flex px-1 text-(length:--text-micro) text-ink-3",k?"justify-end":"justify-start"),children:"Sending..."}):(0,c.jsxs)("div",{className:te("mt-1 flex items-center gap-1.5 px-1 opacity-0 transition-opacity group-hover:opacity-100",k?"justify-end":"justify-start"),children:[(0,c.jsxs)(bi,{children:[(0,c.jsx)(pi,{asChild:!0,children:(0,c.jsx)("a",{href:d?`#${d}`:void 0,className:"text-(length:--text-micro) text-ink-3 hover:text-ink hover:underline",children:t.createdAt?es(t.createdAt):""})}),(0,c.jsx)(gi,{side:"bottom",className:"text-xs",children:t.createdAt?Yn(t.createdAt):""})]}),T?null:(0,c.jsx)("button",{type:"button",className:"inline-flex h-6 w-6 items-center justify-center text-ink-3 transition-colors hover:text-ink",title:"Copy message","aria-label":"Copy message",onClick:i(()=>{const ne=t.content.filter(X=>X.type==="text").map(X=>X.text).join(`
27
-
28
- `);Cs(ne).then(()=>{N(!0),setTimeout(()=>N(!1),2e3)}).catch(X=>{R?.pushToast({title:"Copy failed",body:X instanceof Error?X.message:"Unable to copy message",tone:"error"})})},"onClick"),children:C?(0,c.jsx)(Ts,{className:"h-3.5 w-3.5"}):(0,c.jsx)(en,{className:"h-3.5 w-3.5"})}),Y?(0,c.jsx)("button",{type:"button",className:"inline-flex h-6 w-6 items-center justify-center text-ink-3 transition-colors hover:text-bad",title:"Delete comment","aria-label":"Delete comment",onClick:V,children:(0,c.jsx)(Qa,{className:"h-3.5 w-3.5"})}):null,I?(0,c.jsx)(Ux,{visible:S,onToggle:i(ne=>{o?.(h,ne)},"onToggle")}):null]})]});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{id:d,children:(0,c.jsx)("div",{className:te("group flex items-end gap-2",k&&"justify-end"),children:k?(0,c.jsxs)(c.Fragment,{children:[G,H]}):(0,c.jsxs)(c.Fragment,{children:[H,G]})})}),(0,c.jsx)(tc,{open:q,onOpenChange:M,children:(0,c.jsxs)(Xa,{children:[(0,c.jsxs)(Ya,{children:[(0,c.jsx)(ec,{children:"Delete comment?"}),(0,c.jsx)(Za,{children:"This will replace the comment with a deleted-comment marker."})]}),(0,c.jsxs)(Ga,{children:[(0,c.jsx)(Ee,{variant:"secondary",onClick:i(()=>M(!1),"onClick"),children:"Cancel"}),(0,c.jsx)(Ee,{variant:"delete",onClick:F,children:"Delete comment"})]})]})})]})}i(xv,"IssueChatUserMessage");function vv({message:t,activeVote:e,isRunActive:s,isStoppingRun:n}){const{feedbackDataSharingPreference:r,feedbackTermsUrl:o,onVote:a,agentMap:l,onStopRun:u,stopRunLabel:d="Stop run",stoppingRunLabel:h="Stopping...",stopRunVariant:f="stop",runFinalizationActions:p=[],userLabelMap:m,issueAssigneeAgentId:g}=(0,x.useContext)(At),b=t.metadata.custom,S=typeof b.anchorId=="string"?b.anchorId:void 0,w=typeof b.authorName=="string"?b.authorName:typeof b.runAgentName=="string"?b.runAgentName:"Agent",v=typeof b.authorAgentId=="string"?b.authorAgentId:null,y=typeof b.runId=="string"?b.runId:null,T=typeof b.runAgentId=="string"?b.runAgentId:null,E=typeof b.runStatus=="string"?b.runStatus:null,C=v??T;C&&l?.get(C)?.icon;const N=typeof b.commentId=="string"?b.commentId:null,q=du(b.sourceTrust)?b.sourceTrust:null,M=Vx({authorAgentId:v,onBehalfOfUserId:typeof b.onBehalfOfUserId=="string"?b.onBehalfOfUserId:null,issueAssigneeAgentId:g,resolveUserLabel:i(U=>m?.get(U),"resolveUserLabel")}),R=Array.isArray(b.notices)?b.notices.filter(U=>typeof U=="string"&&U.length>0):[],k=typeof b.waitingText=="string"?b.waitingText:"",P=t.role==="assistant"&&t.status?.type==="running",L=y&&T?`/agents/${T}/runs/${y}`:null,H=!!y&&(s||E==="queued"||E==="running"),Y=typeof b.chainOfThoughtLabel=="string"?b.chainOfThoughtLabel:null,I=t.content.some(U=>U.type==="reasoning"||U.type==="tool-call"),V=!!b.deletedAt,F=!P&&!!Y,[G,ne]=(0,x.useState)(F),[X,we]=(0,x.useState)({messageId:t.id,isFoldable:F}),[pe,fe]=(0,x.useState)(!1),xe=Zn(),ue=V?"":pv(t);if(t.id!==X.messageId||F!==X.isFoldable){const U=zx({messageId:t.id,currentFolded:G,isFoldable:F,previousMessageId:X.messageId,previousIsFoldable:X.isFoldable});we({messageId:t.id,isFoldable:F}),U!==G&&ne(U)}const j=i(async(U,ae)=>{!N||!a||await a(N,U,ae)},"handleVote"),A=b.followUpRequested===!0,$=typeof b.kind=="string"?b.kind:null,K=t.content.some(U=>U.type==="text"&&typeof U.text=="string"&&U.text.trim().length>0),B=$==="comment"&&!!N&&!P&&(K||V),O=(0,c.jsx)(rt,{agent:C?l?.get(C)??{id:C,name:w}:{name:w},size:32}),z=(0,c.jsxs)("div",{className:"mt-2 flex items-center gap-1",children:[(0,c.jsx)("button",{type:"button",className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-ink-3 transition-colors hover:bg-bg-3 hover:text-ink",title:"Copy message","aria-label":"Copy message",onClick:i(()=>{Cs(ue).then(()=>{fe(!0),setTimeout(()=>fe(!1),2e3)}).catch(U=>{xe?.pushToast({title:"Copy failed",body:U instanceof Error?U.message:"Unable to copy message",tone:"error"})})},"onClick"),children:pe?(0,c.jsx)(Ts,{className:"h-3.5 w-3.5"}):(0,c.jsx)(en,{className:"h-3.5 w-3.5"})}),N&&a?(0,c.jsx)(yv,{activeVote:e,sharingPreference:r,termsUrl:o??null,onVote:j}):null,(0,c.jsxs)(bi,{children:[(0,c.jsx)(pi,{asChild:!0,children:(0,c.jsx)("a",{href:S?`#${S}`:void 0,className:"text-(length:--text-micro) text-ink-3 hover:text-ink hover:underline",children:t.createdAt?es(t.createdAt):""})}),(0,c.jsx)(gi,{side:"bottom",className:"text-xs",children:t.createdAt?Yn(t.createdAt):""})]}),(0,c.jsxs)(za,{children:[(0,c.jsx)(Ua,{asChild:!0,children:(0,c.jsx)(Ee,{variant:"ghost",size:"icon-xs",title:"More actions","aria-label":"More actions",children:(0,c.jsx)(Ha,{className:"h-3.5 w-3.5"})})}),(0,c.jsxs)(qa,{align:"end",children:[b.origin==="fast_response"&&(0,c.jsx)("div",{className:"max-w-xs px-2 py-2 text-xs text-ink-3",children:"Platform-generated acknowledgement. The agent’s substantive response follows separately."}),(0,c.jsxs)(On,{onClick:i(()=>{Cs(ue).catch(U=>{xe?.pushToast({title:"Copy failed",body:U instanceof Error?U.message:"Unable to copy message",tone:"error"})})},"onClick"),children:[(0,c.jsx)(en,{className:"mr-2 h-3.5 w-3.5"}),"Copy message"]}),H&&u&&y?(0,c.jsxs)(On,{disabled:n,className:te(f==="pause"?"text-amber-700 focus:text-amber-800 dark:text-amber-300 dark:focus:text-amber-200":"text-red-700 focus:text-red-800 dark:text-red-300 dark:focus:text-red-200"),onSelect:i(()=>{u(y)},"onSelect"),children:[f==="pause"?(0,c.jsx)(nc,{className:"mr-2 h-3.5 w-3.5"}):(0,c.jsx)(Ja,{className:"mr-2 h-3.5 w-3.5 fill-current"}),n?h:d]}):null,L?(0,c.jsx)(On,{asChild:!0,children:(0,c.jsxs)(Is,{to:L,target:"_blank",rel:"noreferrer noopener",children:[(0,c.jsx)(Id,{className:"mr-2 h-3.5 w-3.5"}),"View run"]})}):null]})]})]});return B?(0,c.jsx)("div",{id:S,children:(0,c.jsxs)("div",{className:"group flex flex-col items-start py-1.5",children:[(0,c.jsxs)("div",{className:"mb-1 flex items-center gap-1.5 px-1",children:[(0,c.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center text-ink-3",children:C?(0,c.jsx)(rt,{agent:C?l?.get(C)??{id:C}:void 0,size:16}):(0,c.jsx)(hi,{size:"sm",className:"size-5",children:(0,c.jsx)(di,{className:"text-(length:--text-nano)",children:Qi(w)})})}),(0,c.jsx)("span",{className:"text-sm font-medium text-ink",children:w}),M?(0,c.jsx)(vh,{agentName:w,userName:M.userName}):null,(0,c.jsx)(Pn,{sourceTrust:q,artifactLabel:"comment"}),A?(0,c.jsx)(Jt,{variant:"outline",className:"text-(length:--text-nano) uppercase tracking-(--tracking-eyebrow)",children:"Follow-up"}):null]}),(0,c.jsx)("div",{className:te("min-w-0 break-words px-3 py-2 text-sm overflow-x-auto overflow-y-visible [border-radius:14px_14px_14px_4px]",qx,V?"border border-line bg-bg-3/50 text-ink-3":"border border-line bg-bg-2 text-ink"),children:V?(0,c.jsx)("div",{className:"text-sm italic text-ink-3",children:"Comment deleted"}):(0,c.jsxs)("div",{className:"min-w-0 max-w-full space-y-3",children:[(0,c.jsx)(Na,{message:t,hasCoT:!1}),R.length>0?(0,c.jsx)("div",{className:"space-y-2",children:R.map((U,ae)=>(0,c.jsx)("div",{className:"rounded-sm border border-line/60 bg-bg-3/20 px-3 py-2 text-sm text-ink-3",children:U},`${t.id}:notice:${ae}`))}):null]})}),V?null:z]})}):(0,c.jsx)("div",{id:S,children:(0,c.jsxs)("div",{className:"flex items-start gap-2.5 py-1.5",children:[O,(0,c.jsxs)("div",{className:"min-w-0 flex-1",children:[F?(0,c.jsxs)("button",{type:"button",className:"group flex w-full items-center gap-2 py-0.5 text-left",onClick:i(()=>ne(U=>!U),"onClick"),children:[(0,c.jsx)("span",{className:"text-sm font-medium text-ink",children:w}),(0,c.jsx)(Pn,{sourceTrust:q,artifactLabel:"comment"}),(0,c.jsx)("span",{className:"text-xs text-ink-3/60",children:Y?.toLowerCase()}),(0,c.jsx)(ts,{"aria-hidden":"true",className:te("h-3.5 w-3.5 shrink-0 text-ink-3/40 opacity-0 transition-[opacity,transform] group-hover:opacity-100 group-focus-visible:opacity-100",!G&&"rotate-180")}),t.createdAt?(0,c.jsx)("span",{className:"ml-auto text-(length:--text-micro) text-ink-3/50",children:es(t.createdAt)}):null]}):(0,c.jsxs)("div",{className:"mb-1.5 flex items-center gap-2",children:[(0,c.jsx)("span",{className:"text-sm font-medium text-ink",children:w}),(0,c.jsx)(Pn,{sourceTrust:q,artifactLabel:"comment"}),A?(0,c.jsx)(Jt,{variant:"outline",className:"text-(length:--text-nano) uppercase tracking-(--tracking-eyebrow)",children:"Follow-up"}):null,P?(0,c.jsxs)(Jt,{variant:"outline",className:te("text-(length:--text-nano) uppercase tracking-(--tracking-eyebrow)",qu),children:[(0,c.jsx)(pt,{className:"h-3 w-3 animate-spin"}),"Running"]}):null]}),V?(0,c.jsx)("div",{className:"rounded-sm bg-bg-3/40 px-3 py-2 text-sm italic text-ink-3",children:"Comment deleted"}):G?null:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsx)(Na,{message:t,hasCoT:I}),t.content.length===0&&k?(0,c.jsxs)("div",{className:"rounded-lg px-1 py-2",children:[(0,c.jsx)("div",{className:"flex min-w-0 items-center gap-2.5",children:(0,c.jsxs)("span",{className:"inline-flex items-center gap-2 text-sm font-medium text-ink/80",children:[C?(0,c.jsx)(rt,{agent:C?l?.get(C)??{id:C}:void 0,size:16}):(0,c.jsx)(pt,{className:"h-4 w-4 shrink-0 animate-spin text-ink-3"}),(0,c.jsx)("span",{className:"shimmer-text",children:k})]})}),(0,c.jsx)(au,{custom:b,active:P,className:"pl-6"})]}):null,R.length>0?(0,c.jsx)("div",{className:"space-y-2",children:R.map((U,ae)=>(0,c.jsx)("div",{className:"rounded-sm border border-line/60 bg-bg-3/20 px-3 py-2 text-sm text-ink-3",children:U},`${t.id}:notice:${ae}`))}):null]}),z]})]})]})})}i(vv,"IssueChatAssistantMessage");function yv({activeVote:t,sharingPreference:e="prompt",termsUrl:s,onVote:n}){const[r,o]=(0,x.useState)(!1),[a,l]=(0,x.useState)(null),[u,d]=(0,x.useState)(!1),[h,f]=(0,x.useState)(""),[p,m]=(0,x.useState)(null),g=a??t??null;(0,x.useEffect)(()=>{a&&t===a&&l(null)},[t,a]);async function b(T,E){o(!0);try{await n(T,E)}catch{l(null)}finally{o(!1)}}i(b,"doVote");function S(T,E){if(l(T),e==="prompt"){m({vote:T,...E?{reason:E}:{}});return}b(T,{...e==="allowed"?{allowSharing:!0}:{},...E?{reason:E}:{}})}i(S,"handleVote");function w(){S("up")}i(w,"handleThumbsUp");function v(){l("down"),d(!0),S("down")}i(v,"handleThumbsDown");function y(){h.trim()&&(e==="prompt"?m({vote:"down",reason:h}):b("down",{...e==="allowed"?{allowSharing:!0}:{},reason:h}),d(!1),f(""))}return i(y,"handleSubmitReason"),(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("button",{type:"button",disabled:r,className:te("inline-flex h-7 w-7 items-center justify-center rounded-md transition-colors",g==="up"?"text-green-600 dark:text-green-400":"text-ink-3 hover:bg-bg-3 hover:text-ink"),title:"Helpful","aria-label":"Helpful",onClick:w,children:(0,c.jsx)(Cd,{className:"h-3.5 w-3.5"})}),(0,c.jsxs)(od,{open:u,onOpenChange:d,children:[(0,c.jsx)(rd,{asChild:!0,children:(0,c.jsx)("button",{type:"button",disabled:r,className:te("inline-flex h-7 w-7 items-center justify-center rounded-md transition-colors",g==="down"?"text-amber-600 dark:text-amber-400":"text-ink-3 hover:bg-bg-3 hover:text-ink"),title:"Needs work","aria-label":"Needs work",onClick:v,children:(0,c.jsx)(Td,{className:"h-3.5 w-3.5"})})}),(0,c.jsxs)(id,{side:"top",align:"start",className:"w-80 p-3",children:[(0,c.jsx)("div",{className:"mb-2 text-sm font-medium",children:"What could have been better?"}),(0,c.jsx)(Rd,{value:h,onChange:i(T=>f(T.target.value),"onChange"),placeholder:"Add a short note",className:"min-h-20 resize-y bg-bg text-sm",disabled:r}),(0,c.jsxs)("div",{className:"mt-2 flex items-center justify-end gap-2",children:[(0,c.jsx)(Ee,{type:"button",size:"sm",variant:"secondary",disabled:r,onClick:i(()=>{d(!1),f("")},"onClick"),children:"Dismiss"}),(0,c.jsx)(Ee,{type:"button",size:"sm",disabled:r||!h.trim(),onClick:y,children:r?"Saving...":"Save note"})]})]})]}),(0,c.jsx)(tc,{open:!!p,onOpenChange:i(T=>{!T&&!r&&(m(null),l(null))},"onOpenChange"),children:(0,c.jsxs)(Xa,{children:[(0,c.jsxs)(Ya,{children:[(0,c.jsx)(ec,{children:"Save your feedback sharing preference"}),(0,c.jsx)(Za,{children:"Choose whether voted AI outputs can be included in this instance's feedback export. This answer becomes the default for future thumbs up and thumbs down votes."})]}),(0,c.jsxs)("div",{className:"space-y-3 text-sm text-ink-3",children:[(0,c.jsx)("p",{children:"This vote is always saved locally."}),(0,c.jsxs)("p",{children:["Choose"," ",(0,c.jsx)("span",{className:"font-medium text-ink",children:"Always allow"})," ","to share this vote and future voted AI outputs. Choose"," ",(0,c.jsx)("span",{className:"font-medium text-ink",children:"Don't allow"})," ","to keep this vote and future votes local."]}),(0,c.jsx)("p",{children:"You can change this later in Settings > General."}),s?(0,c.jsx)("a",{href:s,target:"_blank",rel:"noreferrer",className:"inline-flex text-sm text-ink underline underline-offset-4",children:"Read our terms of service"}):null]}),(0,c.jsxs)(Ga,{children:[(0,c.jsx)(Ee,{type:"button",variant:"secondary",disabled:!p||r,onClick:i(()=>{p&&b(p.vote,p.reason?{reason:p.reason}:void 0).then(()=>m(null))},"onClick"),children:r?"Saving...":"Don't allow"}),(0,c.jsx)(Ee,{type:"button",disabled:!p||r,onClick:i(()=>{p&&b(p.vote,{allowSharing:!0,...p.reason?{reason:p.reason}:{}}).then(()=>m(null))},"onClick"),children:r?"Saving...":"Always allow"})]})]})})]})}i(yv,"IssueChatFeedbackButtons");function _v({message:t,anchorId:e,interaction:s}){const{agentMap:n,currentUserId:r,userLabelMap:o,onAcceptInteraction:a,onRejectInteraction:l,onCancelInteraction:u,onUploadImage:d,externalReferences:h}=(0,x.useContext)(At),[f,p]=(0,x.useState)(!1),m=!!(s.resolvedByAgentId||s.resolvedByUserId),g=m?s.resolvedByAgentId??null:s.createdByAgentId??null,b=m?s.resolvedByUserId??null:s.createdByUserId??null,S=av({agentId:g,userId:b,agentMap:n,currentUserId:r,userLabelMap:o});g&&n?.get(g)?.icon;const w=!!(b&&r&&b===r),v=e?`${e}-details`:`${s.id}-details`,y=Wa(s),T=(0,c.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,c.jsxs)("div",{className:te("flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs",w&&"justify-end"),children:[(0,c.jsx)("span",{className:"font-medium text-ink",children:S}),(0,c.jsx)("span",{className:"text-ink-3",children:"updated this task"}),(0,c.jsx)("a",{href:e?`#${e}`:void 0,className:"text-xs text-ink-3 transition-colors hover:text-ink hover:underline",children:Ln(t.createdAt)}),(0,c.jsxs)("button",{type:"button",className:"inline-flex items-center gap-1 rounded-md border border-line/70 bg-bg/70 px-1.5 py-0.5 text-(length:--text-micro) font-medium text-ink-3 transition-colors hover:border-line hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-2","aria-expanded":f,"aria-controls":v,onClick:i(()=>p(E=>!E),"onClick"),children:[(0,c.jsx)(ts,{className:te("h-3 w-3 transition-transform",f&&"rotate-180")}),f?"Hide confirmation":"Expired confirmation"]})]}),f?(0,c.jsx)("p",{className:te("mt-1 text-xs text-ink-3",w&&"text-right"),children:y}):null]});return(0,c.jsxs)("div",{id:e,children:[w?(0,c.jsx)("div",{className:"flex items-start justify-end gap-2 py-1",children:T}):(0,c.jsxs)("div",{className:"flex items-start gap-2.5 py-1",children:[g?(0,c.jsx)(rt,{agent:n?.get(g)??{id:g,name:S},size:32}):(0,c.jsx)(hi,{size:"sm",className:"mt-0.5",children:(0,c.jsx)(di,{children:Qi(S)})}),T]}),f?(0,c.jsx)("div",{id:v,className:"mt-2",children:(0,c.jsx)(Ka,{interaction:s,agentMap:n,currentUserId:r,userLabelMap:o,onAcceptInteraction:a,onRejectInteraction:l,onCancelInteraction:u,onUploadImage:d,externalReferences:h})}):null]})}i(_v,"ExpiredRequestConfirmationActivity");function wv(t){if(!t||typeof t!="object")return!1;const e=t;return e.kind==="system_notice"||e.kind==="message"}i(wv,"isIssueCommentPresentation");function uu(t){if(!t||typeof t!="object")return!1;const e=t;return e.version===1&&Array.isArray(e.sections)}i(uu,"isIssueCommentMetadata");function du(t){if(!t||typeof t!="object")return!1;const e=t;return e.preset==="low_trust_review"&&(e.disposition==="quarantined"||e.disposition==="promoted")}i(du,"isSourceTrustMetadata");function Sv(t){return t==="done"||t==="cancelled"}i(Sv,"issueStatusIsTerminalDisposition");function Iv(t){if(t?.sourceRunId)return t.sourceRunId;const e=[];for(const s of t?.sections??[])for(const n of s.rows)n.type==="run_link"&&e.push(n.runId);return e.length===1?e[0]:null}i(Iv,"sourceRunIdFromSuccessfulRunHandoffMetadata");function Tv(t){if(!rc(t.bodyText))return!1;const e=t.successfulRunHandoff??null;if(e?.state==="resolved"||Sv(t.issueStatus)||e?.hasLiveContinuation)return!0;const s=Iv(t.metadata)??t.runId??null;return!!(s&&e?.sourceRunId&&s!==e.sourceRunId)}i(Tv,"isStaleSuccessfulRunHandoffNotice");function Cv({row:t}){const e=(0,c.jsx)("span",{className:"text-(length:--text-nano) font-semibold uppercase tracking-(--tracking-eyebrow) text-ink-3",children:t.label}),s=(()=>{switch(t.kind){case"text":return(0,c.jsx)("span",{children:t.value});case"code":return(0,c.jsx)("code",{className:"rounded bg-bg-3 px-1.5 py-0.5 font-mono text-(length:--text-micro) text-ink/80",children:t.value});case"issue":{const n=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{children:t.identifier}),t.title?(0,c.jsxs)("span",{className:"text-ink-3",children:[" - ",t.title]}):null]});return t.href?(0,c.jsx)("a",{href:t.href,className:"font-medium text-ink underline-offset-2 hover:underline",children:n}):(0,c.jsx)("span",{className:"font-medium text-ink",children:n})}case"agent":return t.href?(0,c.jsx)("a",{href:t.href,className:"font-medium text-ink underline-offset-2 hover:underline",children:t.name}):(0,c.jsx)("span",{className:"font-medium text-ink",children:t.name});case"run":{const n=t.runId.length>12?`${t.runId.slice(0,8)}...`:t.runId,r=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("code",{className:"rounded bg-bg-3 px-1.5 py-0.5 font-mono text-(length:--text-micro) text-ink/80",children:n}),t.status?(0,c.jsx)("span",{children:t.status}):null]});return t.href?(0,c.jsx)("a",{href:t.href,className:"inline-flex items-center gap-1.5 underline-offset-2 hover:underline",children:r}):(0,c.jsx)("span",{className:"inline-flex items-center gap-1.5",children:r})}}})();return(0,c.jsxs)("div",{className:"grid grid-cols-(--gtc-7) gap-2 text-xs leading-5",children:[e,(0,c.jsx)("div",{className:"min-w-0 break-words text-ink/80",children:s})]})}i(Cv,"StaleDispositionWarningMetadataRow");function hu(t){switch(t.kind){case"issue":return`issue:${t.label}:${t.identifier}:${t.href??""}:${t.title??""}`;case"agent":return`agent:${t.label}:${t.name}:${t.href??""}`;case"run":return`run:${t.label}:${t.runId}:${t.href??""}:${t.status??""}`;default:return`${t.kind}:${t.label}:${t.value}`}}i(hu,"metadataRowKey");function kv(t){return`${t.title??"details"}:${t.rows.map(hu).join("|")}`}i(kv,"metadataSectionKey");function Dn(t){return t===null||typeof t=="string"}i(Dn,"isNullableString");function Da(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t;return Dn(e.label)&&Dn(e.projectWorkspaceId)&&Dn(e.executionWorkspaceId)&&Dn(e.mode)}i(Da,"isTimelineWorkspace");function Av(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t;return Da(e.from)&&Da(e.to)}i(Av,"isTimelineWorkspaceChange");function Ev({sections:t}){return t.length===0?(0,c.jsx)("div",{className:"text-xs leading-5 text-ink-3",children:"No additional details."}):(0,c.jsx)("div",{className:"space-y-3 text-left",children:t.map(e=>(0,c.jsxs)("div",{className:"space-y-1.5",children:[e.title?(0,c.jsx)("div",{className:"text-(length:--text-nano) font-semibold uppercase tracking-(--tracking-eyebrow) text-ink-3",children:e.title}):null,(0,c.jsx)("div",{className:"space-y-1",children:e.rows.map(s=>(0,c.jsx)(Cv,{row:s},hu(s)))})]},kv(e)))})}i(Ev,"StaleDispositionWarningDetails");function Rv({anchorId:t,message:e,metadata:s,runAgentId:n}){const[r,o]=(0,x.useState)(!1),a=(0,x.useId)(),l=eh(s,{runAgentId:n});return(0,c.jsx)("div",{id:t,"data-testid":"stale-disposition-warning",children:(0,c.jsxs)("div",{className:"flex items-start gap-2.5 py-1.5",children:[(0,c.jsx)("span",{className:"size-6 shrink-0","aria-hidden":!0}),(0,c.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,c.jsxs)("button",{type:"button","aria-expanded":r,"aria-controls":a,className:"group flex w-full items-center gap-2 py-0.5 text-left",onClick:i(()=>o(u=>!u),"onClick"),children:[(0,c.jsx)("span",{className:"text-sm font-medium text-ink/80",children:"Stale disposition warning"}),(0,c.jsxs)("span",{className:"ml-auto flex items-center gap-1.5",children:[e.createdAt?(0,c.jsx)("span",{"data-testid":"stale-disposition-warning-time",className:"text-(length:--text-micro) text-ink-3/50",children:es(e.createdAt)}):null,(0,c.jsx)(ts,{className:te("h-3.5 w-3.5 text-ink-3/40 transition-transform",r&&"rotate-180")})]})]}),(0,c.jsx)("div",{id:a,hidden:!r,className:"space-y-1 py-1",children:(0,c.jsx)(Ev,{sections:l})})]})]})})}i(Rv,"StaleDispositionWarningRow");var jv={neutral:"bg-ink-3/40",info:"bg-sky-500 dark:bg-sky-400",success:"bg-emerald-500 dark:bg-emerald-400",warning:"bg-amber-500 dark:bg-amber-400",danger:"bg-red-500 dark:bg-red-400"};function Mv({anchorId:t,message:e,tone:s,title:n,source:r,noticeProps:o,defaultOpen:a=!1}){const[l,u]=(0,x.useState)(a),d=(0,x.useId)();return(0,c.jsx)("div",{id:t,"data-testid":"compact-system-notice",className:"group",children:(0,c.jsxs)("div",{className:"flex items-start gap-2.5 py-1.5",children:[(0,c.jsx)("span",{className:"size-6 shrink-0","aria-hidden":!0}),(0,c.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,c.jsxs)("button",{type:"button","aria-expanded":l,"aria-controls":d,className:"-mx-1 flex w-full items-center gap-2 rounded-md px-1 py-0.5 text-left transition-colors hover:bg-bg-3/5",onClick:i(()=>u(h=>!h),"onClick"),children:[(0,c.jsx)("span",{className:te("size-1.5 shrink-0 rounded-full",jv[s]),"aria-hidden":!0}),(0,c.jsx)("span",{className:"truncate text-sm font-medium text-ink/80",children:n}),r?(0,c.jsxs)("span",{className:"truncate text-(length:--text-micro) text-ink-3",children:["· ",r.label]}):null,(0,c.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-1.5",children:[e.createdAt?(0,c.jsx)("span",{"data-testid":"compact-system-notice-time",className:"whitespace-nowrap text-(length:--text-micro) text-ink-3/50",children:es(e.createdAt)}):null,(0,c.jsx)(ts,{className:te("h-3.5 w-3.5 shrink-0 text-ink-3/40 transition-transform group-hover:text-ink-3/70",l&&"rotate-180")})]})]}),(0,c.jsx)("div",{id:d,hidden:!l,className:"py-1",children:(0,c.jsx)(xi,{...o})})]})]})})}i(Mv,"CompactSystemNoticeRow");function Nv(t){const e=t.message.metadata.custom;return Gd(typeof e.commentId=="string"?e.commentId:t.message.id)??(0,c.jsx)(Dv,{...t})}i(Nv,"SystemNoticeCommentRow");function Dv({message:t,anchorId:e}){const{onImageClick:s,agentMap:n,issueStatus:r,successfulRunHandoff:o}=(0,x.useContext)(At),a=Zn(),l=t.metadata.custom,u=wv(l.presentation)?l.presentation:null,d=uu(l.commentMetadata)?l.commentMetadata:null,h=Xd(d),f=Yd(d),p=typeof l.runAgentId=="string"?l.runAgentId:null,m=typeof l.runId=="string"?l.runId:null,g=typeof l.authorType=="string"?l.authorType:null,b=typeof l.authorName=="string"?l.authorName:null,S=t.content.filter(R=>R.type==="text").map(R=>R.text).join(`
29
-
30
- `),w=Tv({bodyText:S,issueStatus:r,successfulRunHandoff:o,runId:m,metadata:d}),[v,y]=(0,x.useState)(!1),[T,E]=(0,x.useState)(!1),C=(()=>{const R=p?n?.get(p)?.name??null:null;if(g==="system"){const k=R??"Wardmote";return p&&m?{label:k,href:`/agents/${p}/runs/${m}`}:{label:k}}if(p&&m)return{label:b??R??"Wardmote",href:`/agents/${p}/runs/${m}`};if(b)return{label:b}})(),N=rh({presentation:u,metadata:d,body:(0,c.jsx)(Gn,{className:"text-sm leading-6",softBreaks:!0,onImageClick:s,children:S}),timestamp:Ra(t.createdAt),source:C,runAgentId:p}),q=i(()=>{Cs(S).then(()=>{y(!0),setTimeout(()=>y(!1),2e3)}).catch(R=>{a?.pushToast({title:"Copy failed",body:R instanceof Error?R.message:"Unable to copy system notice",tone:"error"})})},"handleCopy"),M=i(()=>{if(!e||typeof window>"u")return;const R=`${window.location.origin}${window.location.pathname}#${e}`;Cs(R).then(()=>{E(!0),setTimeout(()=>E(!1),2e3)}).catch(k=>{a?.pushToast({title:"Copy failed",body:k instanceof Error?k.message:"Unable to copy system notice link",tone:"error"})})},"handleCopyLink");if(g==="system"&&f)return(0,c.jsx)("div",{id:e,children:(0,c.jsx)(Zd,{...f.props},`${f.actionId}:${f.runId}`)});if(g==="system"&&h)return(0,c.jsx)("div",{id:e,children:(0,c.jsx)(th,{snapshot:h,createdAt:Ra(t.createdAt),defaultExpanded:u?.detailsDefaultOpen})});if(w)return(0,c.jsx)(Rv,{anchorId:e,message:t,metadata:d,runAgentId:p});if(u?.density==="compact"){const R=u.tone??"neutral",k=sh(R,u.title);return(0,c.jsx)(Mv,{anchorId:e,message:t,tone:R,title:k,source:C,noticeProps:N,defaultOpen:!!u.detailsDefaultOpen})}return(0,c.jsx)("div",{id:e,className:"group",children:(0,c.jsxs)("div",{className:"py-1",children:[(0,c.jsx)(xi,{...N}),(0,c.jsxs)("div",{className:"mt-1 flex items-center justify-end gap-1.5 px-1 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,c.jsxs)(bi,{children:[(0,c.jsx)(pi,{asChild:!0,children:(0,c.jsx)("a",{href:e?`#${e}`:void 0,className:"text-(length:--text-micro) text-ink-3 hover:text-ink hover:underline",children:t.createdAt?es(t.createdAt):""})}),(0,c.jsx)(gi,{side:"bottom",className:"text-xs",children:t.createdAt?Yn(t.createdAt):""})]}),e?(0,c.jsx)("button",{type:"button",className:"inline-flex h-6 w-6 items-center justify-center text-ink-3 transition-colors hover:text-ink",title:"Copy link","aria-label":"Copy link to system notice",onClick:M,children:T?(0,c.jsx)(Ts,{className:"h-3.5 w-3.5"}):(0,c.jsx)(sc,{className:"h-3.5 w-3.5"})}):null,(0,c.jsx)("button",{type:"button",className:"inline-flex h-6 w-6 items-center justify-center text-ink-3 transition-colors hover:text-ink",title:"Copy notice text","aria-label":"Copy system notice",onClick:q,children:v?(0,c.jsx)(Ts,{className:"h-3.5 w-3.5"}):(0,c.jsx)(en,{className:"h-3.5 w-3.5"})})]})]})})}i(Dv,"SystemNoticeCommentContent");function Oa({anchorId:t,icon:e,children:s,testid:n="issue-chat-metadata-row"}){return(0,c.jsx)("div",{id:t,"data-testid":n,children:(0,c.jsxs)("div",{className:"ml-3 flex items-start gap-2.5 border-l-2 border-line/50 py-0.5 pl-3",children:[(0,c.jsx)("span",{className:"mt-px flex size-(--sz-18px) shrink-0 items-center justify-center rounded-full border border-line/70 bg-bg-3/30 text-ink-3/60",children:e}),(0,c.jsx)("div",{className:"min-w-0 flex-1 space-y-1",children:s})]})})}i(Oa,"IssueChatMetadataRow");function Ov({message:t}){const{agentMap:e,currentUserId:s,userLabelMap:n,onAcceptInteraction:r,onRejectInteraction:o,onSubmitInteractionAnswers:a,onCancelInteraction:l,onSubmitInteractionVerdicts:u,onUploadImage:d,externalReferences:h}=(0,x.useContext)(At),f=t.metadata.custom,p=typeof f.anchorId=="string"?f.anchorId:void 0,m=typeof f.runId=="string"?f.runId:null,g=typeof f.runAgentId=="string"?f.runAgentId:null,b=typeof f.runAgentName=="string"?f.runAgentName:null,S=typeof f.runStatus=="string"?f.runStatus:null,w=typeof f.actorName=="string"?f.actorName:null,v=typeof f.actorType=="string"?f.actorType:null,y=typeof f.actorId=="string"?f.actorId:null,T=typeof f.statusChange=="object"&&f.statusChange?f.statusChange:null,E=typeof f.assigneeChange=="object"&&f.assigneeChange?f.assigneeChange:null,C=Av(f.workspaceChange)?f.workspaceChange:null,N=wd(f.interaction)?f.interaction:null;if(f.kind==="system_notice")return(0,c.jsx)(Nv,{message:t,anchorId:p});if(f.kind==="interaction"&&N)return N.kind==="request_confirmation"&&N.status==="expired"&&!N.payload.secretProposal?(0,c.jsx)(_v,{message:t,anchorId:p,interaction:N}):(0,c.jsx)("div",{id:p,children:(0,c.jsx)("div",{className:"py-1.5",children:(0,c.jsx)(Ka,{interaction:N,agentMap:e,currentUserId:s,userLabelMap:n,onAcceptInteraction:r,onRejectInteraction:o,onSubmitInteractionAnswers:a,onCancelInteraction:l,onSubmitInteractionVerdicts:u,onUploadImage:d,externalReferences:h})})});if(f.kind==="event"&&w){const M=v==="agent";M&&y&&e?.get(y)?.icon;const R=v==="user"&&!!s&&y===s,k=M?(0,c.jsx)(rt,{agent:y?e?.get(y)??{id:y}:void 0,size:16}):(0,c.jsx)(fi,{className:"h-3 w-3"}),P={agentMap:e,currentUserId:s,resolveUserLabel:i(L=>Qt(L,null,n),"resolveUserLabel")};return(0,c.jsxs)(Oa,{anchorId:p,icon:k,children:[(0,c.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-1.5 gap-y-0.5 text-xs",children:[(0,c.jsx)("span",{className:"font-medium text-ink",children:w}),(0,c.jsx)("span",{className:"text-ink-3",children:f.followUpRequested===!0?"requested follow-up":"updated this task"}),(0,c.jsx)("a",{href:p?`#${p}`:void 0,className:"text-xs text-ink-3/70 transition-colors hover:text-ink hover:underline",children:Ln(t.createdAt)})]}),T?(0,c.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 text-xs",children:[(0,c.jsx)("span",{className:"text-(length:--text-nano) font-medium uppercase tracking-wider text-ink-3/70",children:"Status"}),(0,c.jsx)("span",{className:"text-ink-3",children:ja(T.from)}),(0,c.jsx)(wr,{className:"h-3 w-3 text-ink-3/70"}),(0,c.jsx)("span",{className:"font-medium text-ink",children:ja(T.to)})]}):null,E?(0,c.jsxs)("div",{className:"space-y-1",children:[(0,c.jsxs)("div",{className:te("flex flex-wrap items-center gap-1.5 text-xs",R&&"justify-end"),children:[(0,c.jsx)("span",{className:"text-(length:--text-nano) font-medium uppercase tracking-wider text-ink-3/70",children:"Assignee"}),(0,c.jsx)(Ro,{assignee:E.from,resolvers:P}),(0,c.jsx)(wr,{className:"h-3 w-3 text-ink-3/70"}),(0,c.jsx)(Ro,{assignee:E.to,resolvers:P})]}),(0,c.jsx)("div",{className:te(R&&"flex justify-end"),children:(0,c.jsx)(mh,{to:E.to,resolvers:P,interruptedRunAttached:f.interruptedRunId!=null})})]}):null,C?(0,c.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 text-xs",children:[(0,c.jsx)("span",{className:"text-(length:--text-nano) font-medium uppercase tracking-wider text-ink-3/70",children:"Workspace"}),(0,c.jsx)("span",{className:"text-ink-3",children:jo(C.from)}),(0,c.jsx)(wr,{className:"h-3 w-3 text-ink-3/70"}),(0,c.jsx)("span",{className:"font-medium text-ink",children:jo(C.to)})]}):null]})}const q=b??(g?e?.get(g)?.name??g.slice(0,8):null);if(g&&e?.get(g)?.icon,f.kind==="run"&&m&&g&&q&&S){const M=(0,c.jsx)(rt,{agent:e?.get(g)??{id:g},size:16});return(0,c.jsx)(Oa,{anchorId:p,icon:M,children:(0,c.jsxs)("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-xs",children:[(0,c.jsx)(Is,{to:`/agents/${g}`,className:"font-medium text-ink transition-colors hover:underline",children:q}),(0,c.jsx)("span",{className:"text-ink-3",children:"run"}),(0,c.jsx)(Is,{to:`/agents/${g}/runs/${m}`,className:"inline-flex items-center rounded-md border border-line bg-bg-3/40 px-1.5 py-0.5 font-mono text-(length:--text-nano) text-ink-3 transition-colors hover:bg-bg-3/60 hover:text-ink",children:m.slice(0,8)}),(0,c.jsx)(uh,{status:S,operatorInterrupted:f.runOperatorInterrupted===!0}),(0,c.jsx)("a",{href:p?`#${p}`:void 0,className:"text-xs text-ink-3/70 transition-colors hover:text-ink hover:underline",children:Ln(t.createdAt)})]})})}return null}i(Ov,"IssueChatSystemMessage");function is(t){return t.metadata?.custom??{}}i(is,"issueChatMessageCustom");function Pv(t){const e=is(t);return typeof e.kind=="string"?e.kind:t.role}i(Pv,"issueChatMessageKind");function Bv(t){const e=is(t);return typeof e.commentId=="string"?e.commentId:null}i(Bv,"issueChatMessageCommentId");function fu(t){const e=is(t);return typeof e.runId=="string"?e.runId:null}i(fu,"issueChatMessageRunId");function $v(t){const e=is(t);return typeof e.queueTargetRunId=="string"?e.queueTargetRunId:null}i($v,"issueChatMessageQueueTargetRunId");function oi(t,e){const s=Bv(t);return s?e.get(s)??null:null}i(oi,"issueChatMessageActiveVote");function ai(t,e){const s=fu(t);return!!(s&&e.has(s))}i(ai,"issueChatMessageRunIsActive");function ci(t,e){const s=fu(t);return!!(s&&e===s)}i(ci,"issueChatMessageRunIsStopping");function li(t,e){const s=$v(t);return!!(s&&e===s)}i(li,"issueChatMessageQueuedRunIsInterrupting");function Lv(t){return!!is(t).deletedAt}i(Lv,"issueChatMessageIsDeleted");function Vv(t){const e=is(t);return typeof e.deletedAt=="string"?e.deletedAt:null}i(Vv,"issueChatMessageDeletedAt");var Fv=6,Uv=220,qv=16,zv=12;function Ss(t){const e=t.metadata.custom;return typeof e?.anchorId=="string"?e.anchorId:null}i(Ss,"issueChatMessageAnchorId");function mu(t,e){return t.findIndex(s=>Ss(s)===e)}i(mu,"findMessageAnchorIndex");function Hv(t){for(let e=t.length-1;e>=0;e-=1){const s=Ss(t[e]);if(s&&s.startsWith("comment-"))return e}return-1}i(Hv,"findLatestCommentMessageIndex");function Wv(t){const{itemStart:e,previousSize:s,nextSize:n,viewportStart:r}=t;return e+s>r?0:n-s}i(Wv,"getVirtualizedMeasurementScrollAdjustment");function Kv({count:t,estimateSize:e,overscan:s,scrollMargin:n,gap:r,getItemKey:o,mode:a}){const l=(0,x.useRef)(new Map),[,u]=(0,x.useState)(0),d=e(),h=[],f=[];let p=n;for(let M=0;M<t;M+=1){const R=o(M),k=l.current.get(R)??d;h.push(p),f.push(k),p+=k+r}const m=Math.max(0,p-n-r),g=i(()=>a.kind==="window"?window.innerHeight:a.element.clientHeight,"viewportHeight"),b=i(()=>a.kind==="window"?window.scrollY:a.element.scrollTop,"scrollOffset"),S=i(()=>{const M=a.kind==="window"?document.documentElement.scrollHeight:a.element.scrollHeight;return Math.max(0,Math.max(M,m)-g())},"maxScrollOffset");(0,x.useEffect)(()=>{if(typeof window>"u")return;const M=a.kind==="window"?window:a.element,R=i(()=>u(k=>k+1),"update");return M.addEventListener("scroll",R,{passive:!0}),window.addEventListener("resize",R),()=>{M.removeEventListener("scroll",R),window.removeEventListener("resize",R)}},[a]);const w=Math.max(n,b()),v=w+g();let y=0;for(;y<t-1&&h[y]+f[y]<w;)y+=1;let T=y;for(;T<t-1&&h[T]<=v;)T+=1;const E=Math.max(0,y-s),C=Math.min(t-1,T+s),N=[];for(let M=E;M<=C;M+=1)N.push({index:M,key:o(M),start:h[M]??n,size:f[M]??d});return{getVirtualItems:i(()=>N,"getVirtualItems"),getTotalSize:i(()=>m,"getTotalSize"),scrollToIndex:i((M,R)=>{const k=Math.max(0,Math.min(M,t-1)),P=S();let L=h[k]??n;R?.align==="center"?L=L-g()/2+(f[k]??d)/2:R?.align==="end"&&(L=L+(f[k]??d)-g()),L=Math.max(0,Math.min(L,P)),a.kind==="window"?window.scrollTo({top:L,behavior:R?.behavior}):a.element.scrollTo({top:L,behavior:R?.behavior}),u(H=>H+1)},"scrollToIndex"),measure:i(()=>{},"measure"),measureElement:i(M=>{if(!M)return;const R=Number(M.dataset.index);if(!Number.isInteger(R)||R<0||R>=t)return;const k=M.getBoundingClientRect().height||M.offsetHeight;if(!Number.isFinite(k)||k<=0)return;const P=o(R),L=l.current.get(P)??d;if(Math.abs(L-k)<1)return;const H=Wv({itemStart:h[R]??n,previousSize:L,nextSize:k,viewportStart:Math.max(n,b())});l.current.set(P,k),Math.abs(H)>=1&&(a.kind==="window"?window.scrollBy({top:H,behavior:"auto"}):a.element.scrollBy({top:H,behavior:"auto"})),u(Y=>Y+1)},"measureElement")}}i(Kv,"useIssueThreadVirtualizer");function Jv(t){if(!t||typeof window>"u")return null;let e=t.parentElement;for(;e&&e!==document.body&&e!==document.documentElement;){const s=window.getComputedStyle(e).overflowY;if(s==="auto"||s==="scroll"||s==="overlay")return e;e=e.parentElement}return null}i(Jv,"findScrollContainer");var Qv=(0,x.forwardRef)(i(function(e,s){const n=(0,x.useRef)(null),[r,o]=(0,x.useState)({kind:"window"});return(0,x.useLayoutEffect)(()=>{if(typeof window>"u")return;const a=i(()=>{const l=n.current;if(!l)return;const u=Jv(l);o(d=>u===null?d.kind==="window"?d:{kind:"window"}:d.kind==="element"&&d.element===u?d:{kind:"element",element:u})},"detect");return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[]),(0,c.jsx)(Yv,{ref:s,probeRef:n,mode:r,...e},r.kind==="window"?"window":"element")},"VirtualizedIssueChatThreadList")),Yv=(0,x.forwardRef)(i(function({messages:e,feedbackVoteByTargetId:s,activeRunIds:n,stoppingRunId:r,interruptingQueuedRunId:o,variant:a,mode:l,probeRef:u},d){const h=(0,x.useRef)(null),[f,p]=(0,x.useState)(0),m=(0,x.useRef)(null),g=(0,x.useCallback)(y=>{h.current=y,u.current=y},[u]);(0,x.useLayoutEffect)(()=>{if(!h.current||typeof window>"u")return;const y=i(()=>{if(!h.current)return;const T=h.current.getBoundingClientRect(),E=l.kind==="window"?T.top+window.scrollY:T.top-l.element.getBoundingClientRect().top+l.element.scrollTop;p(C=>Math.abs(C-E)<.5?C:E)},"update");return y(),window.addEventListener("resize",y),()=>{window.removeEventListener("resize",y)}},[l]);const b=a==="embedded"?zv:qv,S=Kv({count:e.length,estimateSize:i(()=>Uv,"estimateSize"),overscan:Fv,scrollMargin:f,gap:b,getItemKey:i(y=>e[y]?.id??y,"getItemKey"),mode:l});(0,x.useImperativeHandle)(d,()=>({scrollToIndex:i((y,T)=>{y<0||y>=e.length||S.scrollToIndex(y,{align:T?.align??"center",behavior:T?.behavior??"smooth"})},"scrollToIndex"),scrollToLatest:i(y=>{e.length!==0&&S.scrollToIndex(e.length-1,{align:"end",behavior:y?.behavior??"smooth"})},"scrollToLatest"),measure:i(()=>{S.measure()},"measure")}),[e.length,S]),(0,x.useLayoutEffect)(()=>()=>{const y=h.current;if(!y||typeof window>"u")return;const T=Array.from(y.querySelectorAll("[data-anchor-id][data-index]")).find(N=>N.getBoundingClientRect().bottom>=0);if(!T)return;const E=T.dataset.anchorId,C=Number(T.dataset.index);!E||!Number.isFinite(C)||(m.current={anchorId:E,index:C,viewportTop:T.getBoundingClientRect().top})},[e]),(0,x.useLayoutEffect)(()=>{const y=m.current;if(m.current=null,S.measure(),!y||typeof window>"u")return;const T=mu(e,y.anchorId);T<=y.index||(S.scrollToIndex(T,{align:"start",behavior:"auto"}),requestAnimationFrame(()=>{const E=document.getElementById(y.anchorId);if(!E)return;const C=E.getBoundingClientRect().top-y.viewportTop;Math.abs(C)>1&&(l.kind==="window"?window.scrollBy({top:C,behavior:"auto"}):l.element.scrollBy({top:C,behavior:"auto"})),S.measure()}))},[e,S,l]);const w=S.getVirtualItems(),v=S.getTotalSize();return(0,c.jsx)("div",{ref:g,"data-testid":"issue-chat-thread-virtualizer","data-virtual-count":e.length,style:{position:"relative",width:"100%",height:v},children:w.map(y=>{const T=e[y.index];if(!T)return null;const E=Ss(T);return(0,c.jsx)("div",{"data-index":y.index,"data-anchor-id":E??void 0,"data-testid":"issue-chat-thread-virtual-row",ref:i(C=>{C&&S.measureElement(C)},"ref"),onLoadCapture:i(C=>{S.measureElement(C.currentTarget)},"onLoadCapture"),onClickCapture:i(C=>{const N=C.currentTarget;requestAnimationFrame(()=>{S.measureElement(N)})},"onClickCapture"),onTransitionEndCapture:i(C=>{S.measureElement(C.currentTarget)},"onTransitionEndCapture"),style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${y.start-f}px)`},children:(0,c.jsx)(pu,{message:T,feedbackVoteByTargetId:s,activeRunIds:n,stoppingRunId:r,interruptingQueuedRunId:o})},y.key)})})},"VirtualizedIssueChatThreadListInner"));function Gv({message:t,deletedAt:e}){const s=is(t),n=typeof s.anchorId=="string"?s.anchorId:void 0,r=typeof s.authorName=="string"?s.authorName:"Comment",o=new Date(e),a=Number.isNaN(o.getTime())?"":Yn(o);return(0,c.jsxs)("div",{id:n,className:"flex items-start gap-2.5 py-1.5",children:[(0,c.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-line bg-bg-3/40 text-ink-3",children:(0,c.jsx)(Qa,{className:"h-3.5 w-3.5"})}),(0,c.jsxs)("div",{className:"min-w-0 rounded-md border border-dashed border-line bg-bg-3/20 px-3 py-2 text-sm text-ink-3",children:[(0,c.jsx)("span",{className:"font-medium text-ink/80",children:r}),(0,c.jsx)("span",{children:" deleted this comment"}),a?(0,c.jsxs)("span",{className:"text-xs",children:[" · ",a]}):null]})]})}i(Gv,"IssueChatDeletedComment");var pu=(0,x.memo)(i(function({message:e,feedbackVoteByTargetId:s,activeRunIds:n,stoppingRunId:r,interruptingQueuedRunId:o}){const a=Pv(e),l=Vv(e),u=oi(e,s),d=ai(e,n),h=ci(e,r),f=li(e,o),p=l?(0,c.jsx)(Gv,{message:e,deletedAt:l}):e.role==="user"?(0,c.jsx)(xv,{message:e,isInterruptingQueuedRun:f}):e.role==="assistant"?(0,c.jsx)(vv,{message:e,activeVote:u,isRunActive:d,isStoppingRun:h}):(0,c.jsx)(Ov,{message:e});return(0,c.jsx)("div",{"data-testid":"issue-chat-message-row","data-message-role":e.role,"data-message-kind":a,children:p})},"IssueChatMessageRow"),Xv);function Xv(t,e){return!(t.message!==e.message||oi(t.message,t.feedbackVoteByTargetId)!==oi(e.message,e.feedbackVoteByTargetId)||ai(t.message,t.activeRunIds)!==ai(e.message,e.activeRunIds)||ci(t.message,t.stoppingRunId)!==ci(e.message,e.stoppingRunId)||li(t.message,t.interruptingQueuedRunId)!==li(e.message,e.interruptingQueuedRunId))}i(Xv,"areIssueChatMessageRowPropsEqual");var Zv=(0,x.forwardRef)(i(function({onSend:e,confirmedSubmissionIds:s,onReviewConversation:n,onStop:r,stopPending:o,stopScope:a="leaf",onImageUpload:l,onAttachImage:u,draftKey:d,enableReassign:h=!1,reassignOptions:f=[],currentAssigneeValue:p="",issueId:m=null,suggestedAssigneeValue:g,mentions:b=[],agentMap:S,hasActiveRun:w=!1,currentUserId:v=null,userLabelMap:y=null,composerPause:T=null,composerDisabledReason:E=null,composerHint:C=null,issueStatus:N,issueWorkMode:q,onWorkModeChange:M},R){const k=ld(r,o),P=(0,x.useMemo)(()=>{const _=d&&Od(d);return _?{sourceKey:d,key:_,persisted:!0}:null},[d]),[L,H]=(0,x.useState)(null),Y=L?.sourceKey===d?L:P,I=Y?.key??d;(0,x.useEffect)(()=>H(P),[d,P]);const V=(0,x.useRef)(void 0),[F,G]=(0,x.useState)(()=>I?Ao(I):""),[ne,X]=(0,x.useState)(!1),[we,pe]=(0,x.useState)(!1),[fe,xe]=(0,x.useState)(null),[ue,j]=(0,x.useState)(null),[A,$]=(0,x.useState)(()=>I?Ft(I):null),K=(0,x.useRef)(I);(0,x.useEffect)(()=>(K.current=I,$(I?Ft(I):null),()=>{K.current=void 0}),[I]);const B=(0,x.useRef)(F);B.current=F;const O=(0,x.useRef)(null),z=(0,x.useRef)(null);function U(_){const J=typeof _=="function"?_(B.current):_;B.current=J,G(J),j(null);const Q=z.current;!Q||Q.draftKey!==I||Ft(Q.draftKey)?.attemptId!==Q.attemptId||(Ut(Q.draftKey,J?`${Q.submittedBody}
31
-
32
- ${J}`:Q.submittedBody,Q.attemptId),Sn(Q.draftKey,{attemptId:Q.attemptId,reviewed:!1,nextDraftOffset:Q.submittedBody.length+(J?2:0),submittedAttachmentIds:Q.submittedAttachmentIds}))}i(U,"changeBody");const ae=(0,x.useRef)(ne);ae.current=ne;const[W,ve]=(0,x.useState)(!1),[ie,oe]=(0,x.useState)(!1),[le,ze]=(0,x.useState)(()=>I?Sr(I).map(_=>({..._,size:_.size??0,id:`receipt:${_.attachmentId}`,status:"attached"})):[]),bt=(0,x.useRef)(le);function Ve(_){const J=typeof _=="function"?_(bt.current):_;bt.current=J,ze(J);const Q=z.current;Q&&Q.draftKey===I&&ko(Q.draftKey,J.filter(ce=>ce.status==="attached"&&ce.attachmentId).map(ce=>({...ce,inline:ce.inline===!0})),Q.attemptId)}i(Ve,"setComposerAttachments");const xt=(0,x.useRef)(0),os=g??p,[Qe,Pe]=(0,x.useState)(os),Et=md(),ln=Et.clear;(0,x.useEffect)(()=>ln(),[ln,I,p]);const[hr,$s]=(0,x.useState)(!1),[fr,un]=(0,x.useState)(null),as=q??"standard",[vt,Rt]=(0,x.useState)(as),Ls=typeof M=="function",cs=(0,x.useRef)(null),Vs=(0,x.useRef)(null),Fs=(0,x.useRef)(!1),dn=(0,x.useRef)(null),jt=(0,x.useRef)(null),Mt=(0,x.useRef)(null),tt=!A&&!!(l||u),ls=W||le.some(_=>_.status!=="attached"),Nt=le.filter(_=>_.status==="attached"&&!_.inline&&_.contentPath);function hn(_){_&&requestAnimationFrame(()=>{iu(_,jt.current)})}i(hn,"queueViewportRestore");function Us(){typeof jt.current?.scrollIntoView=="function"&&jt.current.scrollIntoView({behavior:"smooth",block:"end"}),requestAnimationFrame(()=>{window.scrollBy({top:Zx,behavior:"smooth"}),dn.current?.focus()})}i(Us,"focusComposer"),(0,x.useEffect)(()=>{!I||Y?.key===I&&!Y.persisted||(G(Ao(I)),Ve(Sr(I).map(_=>({..._,size:_.size??0,id:`receipt:${_.attachmentId}`,status:"attached"}))))},[I]),(0,x.useEffect)(()=>{if(!A||!s.has(A.attemptId))return;const{attemptId:_}=A,J=O.current;if(J&&J.draftKey===I&&J.attemptId===_)return;const Q=A.nextDraftOffset===void 0?"":B.current.slice(A.nextDraftOffset),ce=A.submittedAttachmentIds;let Z=ce?bt.current.filter(re=>!re.attachmentId||!ce.includes(re.attachmentId)):[];if(I){const re=Ft(I);re?.attemptId===_&&Eo(I,_);const me=Md(I),Fe=Sr(I).filter(je=>!ce?.includes(je.attachmentId)),Pt=re&&re.attemptId!==_,Bt=JSON.stringify(Z.map(je=>je.attachmentId).sort())!==JSON.stringify(Fe.map(je=>je.attachmentId).sort());if(me!==null&&(Pt||!re||me!==Q||Bt)){if(!Pt&&(me===Q||me===B.current)){const ds=new Set(Z.map(_e=>_e.attachmentId)),hs=[...Z,...Fe.filter(_e=>!ds.has(_e.attachmentId)).map(_e=>({..._e,size:_e.size??0,id:`receipt:${_e.attachmentId}`,status:"attached"}))];hs.length<=20&&(Z=hs)}const je=Dd(d,Q,Z);V.current=I,H({sourceKey:d,...je})}}O.current={draftKey:I,attemptId:_},$(null),G(Q),B.current=Q,Ve(Z)},[s,I,d,A]),(0,x.useEffect)(()=>{!I||V.current===I||ne||le!==bt.current||ko(I,le.filter(_=>_.status==="attached"&&_.attachmentId))},[le,I,ne]),(0,x.useEffect)(()=>{!I||ne||(Mt.current&&clearTimeout(Mt.current),Mt.current=setTimeout(()=>{V.current!==I&&Ut(I,F)},Xx))},[F,I,ne]),(0,x.useEffect)(()=>()=>{Mt.current&&clearTimeout(Mt.current),I&&V.current!==I&&!ae.current&&Ut(I,B.current)},[I]),(0,x.useEffect)(()=>{if(!I)return;const _=i(()=>{V.current!==I&&!ae.current&&Ut(I,B.current)},"flushDraft");return window.addEventListener("beforeunload",_),()=>window.removeEventListener("beforeunload",_)},[I]),(0,x.useEffect)(()=>{Pe(os)},[os]),(0,x.useEffect)(()=>{Rt(as)},[as]),(0,x.useImperativeHandle)(R,()=>({focus:Us,restoreDraft:i(_=>{G(J=>kx({currentBody:J,submittedBody:_})),Us()},"restoreDraft")}),[]);const mr=!ne&&!W&&F.trim().length===0&&le.length===0&&!!(r||k.stopping);async function fn(){if(!T&&!(!F.trim()&&Nt.length===0||ne||ls||A)){if(h&&f.length>0&&rv(Qe)){$s(!0);return}await mn()}}i(fn,"handleSubmit");async function mn(){if(T)return;const _=sd(F);if(_.matched&&"error"in _){xe(_.error);return}xe(null);const J=_.matched&&"command"in _?_.command:null,Q=J?.mode,ce=(J?J.prompt:F).trim();if(!ce&&Nt.length===0||ne||ls||A)return;const Z=h&&Qe!==p,re=Z?sv(Qe)??void 0:void 0,me=re?.assigneeAgentId&&Et.hasValues?{...re,modelOverride:Et.values}:re,Fe=nv(N,Z?Qe:p)?!0:void 0,Pt=[ce,...Nt.map(Se=>`[${Se.name.replace(/[[\]]/g,"\\$&")}](${Se.contentPath})`)].filter(Boolean).join(`
33
-
34
- `),Bt=new Set(le.map(Se=>Se.id)),je=[...new Set(le.filter(Se=>Se.status==="attached"&&Se.attachmentId&&(!Se.inline||Se.contentPath&&ce.includes(Se.contentPath))).map(Se=>Se.attachmentId))],ds=ru(jt.current),hs=vt!==as;I&&Ut(I,ce),X(!0),B.current="",G("");let _e=null;try{hs&&M&&await M(vt);const Se=I?Ft(I):null;if(Se){$(Se),G(ce);return}_e=crypto.randomUUID(),I&&(Ut(I,ce),Sn(I,{attemptId:_e,reviewed:!1}),z.current={draftKey:I,attemptId:_e,submittedBody:ce,submittedAttachmentIds:je},U(B.current));const _t=e(Pt,Fe,me,je.length?je:void 0,_e,Q);hn(ds);const $t=await _t;if(I&&Eo(I,_e,K.current===I?B.current:void 0),K.current!==I)return;j(td($t)),Ve(Lt=>Lt.filter(ge=>!Bt.has(ge.id))),Pe(os),Et.clear()}catch(Se){if(K.current!==I)return;const _t=B.current;if(_e&&Se instanceof Uu){const Lt={attemptId:_e,reviewed:!1,nextDraftOffset:ce.length+(_t?2:0),submittedAttachmentIds:je};$(Lt),I&&Ft(I)?.attemptId===_e&&Sn(I,Lt)}else I&&_e&&Nd(I,_e);const $t=_t?`${ce}
35
-
36
- ${_t}`:ce;I&&Ut(I,$t,_e??void 0),G($t)}finally{z.current?.attemptId===_e&&(z.current=null),X(!1),hn(ds)}}i(mn,"submitComment");async function us(_,J=!0){const Q=`${_.name}:${_.size}:${_.lastModified}:${Math.random().toString(36).slice(2)}`,ce=_.type.startsWith("image/");Ve(Z=>[...Z,{id:Q,name:_.name,size:_.size,status:"uploading",inline:ce}]);try{if(!u&&l&&ce){const Z=await l(_);if(!bt.current.some(me=>me.id===Q))return;const re=`![${_.name.replace(/[[\]]/g,"\\$&")}](${Z})`;return J&&U(me=>me?`${me}
37
-
38
- ${re}`:re),Ve(me=>me.map(Fe=>Fe.id===Q?{...Fe,status:"attached",contentPath:Z}:Fe)),Z}else if(u){const Z=await u(_);if(!Z?.contentPath)throw new Error("Upload did not return a file URL");if(!bt.current.some(re=>re.id===Q))return;if(ce&&J){const re=`![${_.name.replace(/[[\]]/g,"\\$&")}](${Z.contentPath})`;U(me=>me?`${me}
39
-
40
- ${re}`:re)}return Ve(re=>re.map(me=>me.id===Q?{...me,status:"attached",attachmentId:Z.id,contentPath:Z?.contentPath,name:Z?.originalFilename??me.name}:me)),Z.contentPath}else Ve(Z=>Z.map(re=>re.id===Q?{...re,status:"error",error:"This file type cannot be attached here"}:re))}catch(Z){Ve(re=>re.map(me=>me.id===Q?{...me,status:"error",error:Z instanceof Error?Z.message:"Upload failed"}:me))}}i(us,"attachFile");async function pn(_){const J=_.target.files?.[0];if(J){ve(!0);try{await us(J)}finally{ve(!1),cs.current&&(cs.current.value="")}}}i(pn,"handleAttachFile");async function Yi(_){if(!(!_||_.length===0)){ve(!0);try{for(const J of Array.from(_))await us(J)}finally{ve(!1)}}}i(Yi,"handleDroppedFiles");function Gi(){xt.current=0,oe(!1)}i(Gi,"resetDragState");function Xi(_){!tt||!Nn(_)||(_.preventDefault(),_.stopPropagation(),xt.current+=1,oe(!0))}i(Xi,"handleFileDragEnter");function Zi(_){!tt||!Nn(_)||(_.preventDefault(),_.stopPropagation(),_.dataTransfer.dropEffect="copy")}i(Zi,"handleFileDragOver");function qs(_){!tt||!Nn(_)||(_.preventDefault(),_.stopPropagation(),xt.current=Math.max(0,xt.current-1),xt.current===0&&oe(!1))}i(qs,"handleFileDragLeave");function gn(_){!tt||!Nn(_)||(_.preventDefault(),_.stopPropagation(),Gi(),Yi(_.dataTransfer?.files))}i(gn,"handleFileDrop");const ot=ju(),Dt=!ot&&!ne&&!ls&&!A&&(!!F.trim()||Nt.length>0),yt=(0,x.useMemo)(()=>b.filter(_=>(_.kind??"agent")==="agent"&&(_.agentId??_.id)).map(_=>({agentId:_.agentId??_.id.replace(/^agent:/,""),name:_.name})),[b]),Ot=(0,x.useMemo)(()=>({agentMap:S,currentUserId:v,resolveUserLabel:i(_=>Qt(_,null,y),"resolveUserLabel")}),[S,v,y]),at=(0,x.useMemo)(()=>ph(F),[F]),Te=(0,x.useMemo)(()=>at.length>0?null:hh(F,yt),[F,at,yt]),zs=(0,x.useMemo)(()=>dh({reassignTarget:Qe,currentAssigneeValue:p,hasActiveRun:w,bodyHasAgentMention:at.length>0,mentionedAgentId:at[0]??null,plainNameCandidate:Te}),[Qe,p,w,at,Te]),bn=!!(Te&&Te.matchedText!==fr),Hs=Te?S?.get(Te.agentId)?.name??Te.matchedText:"";function xn(){if(!Te)return;const _=b.find(Z=>(Z.agentId??Z.id.replace(/^agent:/,""))===Te.agentId),J=Te.agentId,Q=`[@${_?.name??Te.matchedText}](${Vu(J,_?.agentIcon??null)}) `,ce=new RegExp(`(?<![\\w@/])${Te.matchedText.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w/])`,"i");U(Z=>ce.test(Z)?Z.replace(ce,Q.trimEnd()):Z?`${Z} ${Q}`:Q),un(Te.matchedText)}if(i(xn,"insertCoachMention"),T)return(0,c.jsx)(hd,{...T,hasDraft:!!(F.trim()||Nt.length)});if(E)return(0,c.jsx)("div",{className:"rounded-md border border-amber-300/70 bg-amber-50/80 px-3 py-2 text-sm text-amber-900 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-100",children:E});const Ws=dd(vt);function Ks(_){const J=_.code==="Period"||_.key===".";!(_.metaKey||_.ctrlKey)||!J||(_.preventDefault(),Rt(Q=>ud(Q)))}return i(Ks,"handleComposerKeyDown"),(0,c.jsxs)("div",{ref:jt,"data-testid":"issue-chat-composer","data-pending-work-mode":vt,className:te("relative rounded-md border border-line/70 bg-bg/95 p-(--sz-15px) shadow-(--shadow-extract-4) backdrop-blur transition-(--tp-border-color-background-color-box-shadow) duration-150 supports-[backdrop-filter]:bg-bg/85 dark:shadow-(--shadow-extract-5)",Ws.classes.container,ie&&"border-accent/45 bg-bg shadow-(--shadow-extract-7)"),onKeyDownCapture:Ks,onDragEnterCapture:Xi,onDragOverCapture:Zi,onDragLeaveCapture:qs,onDropCapture:gn,children:[ie&&tt?(0,c.jsx)("div",{"data-testid":"issue-chat-composer-drop-overlay",className:"pointer-events-none absolute inset-2 z-30 flex items-center justify-center rounded-sm border border-dashed border-accent/55 bg-bg/75 px-4 py-3 text-center shadow-sm backdrop-blur-(--blur-2px) dark:bg-bg/65",children:(0,c.jsxs)("div",{className:"flex max-w-md items-center gap-3 rounded-md bg-bg/80 px-3 py-2 text-left shadow-sm ring-1 ring-line/60",children:[(0,c.jsx)("span",{className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-accent/10 text-accent",children:(0,c.jsx)(sc,{className:"h-4 w-4"})}),(0,c.jsxs)("div",{className:"min-w-0",children:[(0,c.jsx)("div",{className:"text-sm font-medium text-ink",children:"Drop to upload"}),(0,c.jsx)("div",{className:"mt-0.5 text-xs leading-5 text-ink-3",children:"Images insert into the reply. Other files are added to this task."})]})]})}):null,Y&&Y.sourceKey===d?(0,c.jsxs)("p",{role:"status",className:"mb-3 text-sm text-ink-3",children:["Another tab changed the saved draft. This draft is kept separately in this tab.",Y.persisted?" It will be restored if you reload this tab.":" Browser storage is unavailable; copy your text before leaving."]}):null,A?(0,c.jsxs)("div",{role:"alert",className:"mb-3 space-y-2 rounded-md border border-line bg-bg-3 p-3 text-sm",children:[(0,c.jsx)("p",{children:"We couldn’t confirm whether this comment was saved. It may already be in the conversation. Review it before starting another draft."}),(0,c.jsx)(Ee,{type:"button",variant:"secondary",size:"sm",onClick:i(async()=>{pe(!1);try{if(!n)throw new Error("Review unavailable");if(await n(),K.current!==I)return;const _={...A,reviewed:!0};$(_),I&&Ft(I)?.attemptId===_.attemptId&&Sn(I,_)}catch{pe(!0)}},"onClick"),children:"Review conversation"}),we?(0,c.jsx)("p",{children:"Couldn’t refresh the conversation. Try reviewing it again."}):null,A.reviewed?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("p",{children:"Discarding this draft does not remove any saved comment or uploaded file."}),(0,c.jsx)(Ee,{type:"button",variant:"secondary",size:"sm",onClick:i(()=>{I&&jd(I,A.attemptId),B.current="",G(""),Ve([]),$(null)},"onClick"),children:"Discard draft and start new"})]}):null]}):null,(0,c.jsx)(nd,{ref:dn,readOnly:!!A,value:F,onChange:U,placeholder:"Reply",mentions:b,onSubmit:fn,imageUploadHandler:tt?async _=>{const J=await us(_,!1);if(!J)throw new Error("Upload did not return a file URL");return J}:void 0,fileDropTarget:"parent",bordered:!1,contentClassName:"max-h-(--sz-28dvh) overflow-y-auto pr-1 pb-2 text-sm scrollbar-auto-hide"}),bn&&Te?(0,c.jsx)("div",{className:"mt-2",children:(0,c.jsx)(lh,{candidate:Te,agentDisplayName:Hs,onInsert:xn,onDismiss:i(()=>un(Te.matchedText),"onDismiss")})}):null,fe?(0,c.jsx)("p",{className:"text-xs text-bad",role:"alert","data-testid":"issue-chat-delivery-error",children:fe}):null,ue?(0,c.jsx)("p",{className:"text-xs text-ink-3",role:"status","data-testid":"issue-chat-delivery-notice",children:ue}):null,C?(0,c.jsx)("div",{className:"inline-flex items-center rounded-full border border-line/70 bg-bg-3/30 px-2 py-1 text-(length:--text-micro) text-ink-3",children:C}):null,le.length>0?(0,c.jsx)("div",{"data-testid":"issue-chat-composer-attachments",className:"mb-3 mt-2 space-y-1.5 rounded-md border border-dashed border-line/80 bg-bg-3/20 p-2",children:le.map(_=>{const J=tv(_.size),Q=_.status==="uploading"?"Uploading to task":_.status==="error"?_.error??"Upload failed":_.inline?"Inserted inline":"Attached to task";return(0,c.jsxs)("div",{className:te("flex min-w-0 items-center gap-2 rounded-sm px-2 py-1.5 text-xs",_.status==="error"?"bg-bad/10 text-bad":"bg-bg/70 text-ink-3"),children:[_.status==="uploading"?(0,c.jsx)(pt,{className:"h-3.5 w-3.5 shrink-0 animate-spin"}):_.status==="attached"?(0,c.jsx)(Ts,{className:"h-3.5 w-3.5 shrink-0 text-green-600 dark:text-green-400"}):(0,c.jsx)(Xn,{className:"h-3.5 w-3.5 shrink-0"}),(0,c.jsx)("span",{className:"min-w-0 flex-1 truncate font-medium text-ink",children:_.name}),J?(0,c.jsx)("span",{className:"shrink-0 text-ink-3",children:J}):null,(0,c.jsx)("span",{className:"shrink-0 text-ink-3",children:Q}),!_.inline||_.status!=="attached"?(0,c.jsx)(Ee,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Remove ${_.name}`,disabled:!!A,onClick:i(()=>Ve(ce=>ce.filter(Z=>Z.id!==_.id)),"onClick"),children:(0,c.jsx)(kd,{className:"h-3.5 w-3.5","aria-hidden":!0})}):null]},_.id)})}):null,Kx(F,zs)?(0,c.jsx)("div",{className:"my-2",children:(0,c.jsx)(bh,{preview:zs,resolvers:Ot})}):null,(0,c.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-3",children:[(0,c.jsxs)("div",{className:"mr-auto flex items-center gap-2",children:[tt?(0,c.jsx)("input",{ref:cs,type:"file",className:"hidden",onChange:pn}):null,(0,c.jsx)(pd,{mode:vt,onModeChange:Ls?Rt:void 0,onAttachFile:tt?()=>cs.current?.click():void 0,attachDisabled:W,disabled:!!A,triggerTestId:"issue-chat-composer-add",menuTestId:"issue-chat-composer-add-menu"}),(0,c.jsx)(fd,{mode:vt,onRemove:Ls?()=>Rt("standard"):void 0,disabled:!!A,testId:"issue-chat-composer-work-mode-chip"})]}),h&&f.length>0&&m?(0,c.jsx)(cd,{issueId:m,assigneeValue:Qe,currentAssigneeValue:p,options:f,staging:Et,onAssigneeChange:i(_=>Pe(_??""),"onAssigneeChange"),triggerRef:Vs,renderAssigneeIdentity:i(_=>{const J=_.startsWith("agent:")?S?.get(_.slice(6)):null;return J?(0,c.jsx)(rt,{agent:J,size:16,className:"size-4 shrink-0"}):null},"renderAssigneeIdentity")}):h&&f.length>0?(0,c.jsx)(Pd,{ref:Vs,value:Qe,options:f,placeholder:"Responsible",noneLabel:"No responsible",searchPlaceholder:"Search responsible...",emptyMessage:"No responsible found.",onChange:Pe,className:"h-8 text-xs",renderTriggerValue:i(_=>{if(!_)return(0,c.jsx)("span",{className:"text-ink-3",children:"Responsible"});const J=_.id.startsWith("agent:")?_.id.slice(6):null,Q=J?S?.get(J):null;return(0,c.jsxs)(c.Fragment,{children:[Q?(0,c.jsx)(rt,{agent:Q,size:16,className:"h-3.5 w-3.5 shrink-0 text-ink-3"}):null,(0,c.jsx)("span",{className:"truncate",children:_.label})]})},"renderTriggerValue"),renderOption:i(_=>{if(!_.id)return(0,c.jsx)("span",{className:"truncate",children:_.label});const J=_.id.startsWith("agent:")?_.id.slice(6):null,Q=J?S?.get(J):null;return(0,c.jsxs)(c.Fragment,{children:[Q?(0,c.jsx)(rt,{agent:Q,size:16,className:"h-3.5 w-3.5 shrink-0 text-ink-3"}):null,(0,c.jsx)("span",{className:"truncate",children:_.label})]})},"renderOption")}):null,mr?(0,c.jsx)(Ee,{size:"icon-sm",disabled:k.stopping,onClick:i(()=>{k.stop()},"onClick"),"aria-label":k.stopping?"Stopping…":"Stop",title:"Stop response",children:k.stopping?(0,c.jsx)(pt,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,c.jsx)(Ja,{className:"h-4 w-4 fill-current","aria-hidden":!0})}):(0,c.jsx)(Ee,{size:"sm",disabled:!Dt,title:ot?Ou:void 0,onClick:i(()=>{fn()},"onClick"),children:ne?"Posting...":"Send"})]}),k.error?(0,c.jsx)("p",{role:"alert",className:"text-xs text-bad",children:k.error}):null,(0,c.jsx)(Zu,{open:hr,onOpenChange:$s,children:(0,c.jsxs)(Ju,{"data-testid":"issue-chat-no-assignee-dialog",onCloseAutoFocus:i(_=>{Fs.current&&(_.preventDefault(),Fs.current=!1,Vs.current?.focus())},"onCloseAutoFocus"),children:[(0,c.jsxs)(Xu,{children:[(0,c.jsx)(Ku,{children:"No responsible selected"}),(0,c.jsx)(Wu,{children:"This comment will be posted without an assignee, so no agent will be woken to act on it. Go back to pick a responsible, or send anyway."})]}),(0,c.jsxs)(Yu,{children:[(0,c.jsx)(Gu,{"data-testid":"issue-chat-no-assignee-go-back",onClick:i(()=>{Fs.current=!0},"onClick"),children:"Go back"}),(0,c.jsx)(Qu,{"data-testid":"issue-chat-no-assignee-send-anyway",onClick:i(()=>{mn()},"onClick"),children:"Send anyway"})]})]})})]})},"IssueChatComposer"));function f_({comments:t,interactions:e=[],feedbackVotes:s=[],feedbackDataSharingPreference:n="prompt",feedbackTermsUrl:r=null,linkedRuns:o=[],timelineEvents:a=[],liveRuns:l=[],activeRun:u=null,issueId:d=null,blockedBy:h=[],liveIssueIds:f,blockerAttention:p=null,successfulRunHandoff:m=null,scheduledRetry:g=null,recoveryAction:b=null,onResolveRecoveryAction:S,onReissueIsolatedRecoveryAction:w,reissueIsolatedRecoveryActionPending:v=!1,onReconcileForwardRecoveryAction:y,onBreakGlassOverrideRecoveryAction:T,onQuarantineRestoreRecoveryAction:E,quarantineRestoreRecoveryActionPending:C=!1,canBreakGlassRecoveryAction:N=!1,reconcileRecoveryActionPending:q=!1,canFalsePositiveRecoveryAction:M=!1,legacyRecoverySourceIssue:R=null,companyId:k,projectId:P,issueStatus:L,issueAssigneeAgentId:H=null,agentMap:Y,currentUserId:I,userLabelMap:V,userProfileMap:F,onVote:G,onAdd:ne,onReviewConversation:X,onCancelRun:we,stopPending:pe,stopScope:fe,onStopRun:xe,stopRunLabel:ue,stoppingRunLabel:j,stopRunVariant:A,runFinalizationActions:$,imageUploadHandler:K,onAttachImage:B,draftKey:O,enableReassign:z=!1,reassignOptions:U=[],currentAssigneeValue:ae="",suggestedAssigneeValue:W,mentions:ve=[],composerPause:ie=null,composerDisabledReason:oe=null,composerHint:le=null,showComposer:ze=!0,showJumpToLatest:bt,autoScrollToLatestOnInitialLoad:Ve=!1,autoScrollToHashOnInitialLoad:xt=!1,emptyMessage:os,footer:Qe,variant:Pe="full",enableLiveTranscriptPolling:Et=!0,transcriptsByRunId:ln,hasOutputForRun:hr,includeSucceededRunsWithoutOutput:$s=!1,onInterruptQueued:fr,onCancelQueued:un,onDeleteComment:as,onSetCommentPublicShare:vt,interruptingQueuedRunId:Rt=null,stoppingRunId:Ls=null,onImageClick:cs,onAcceptInteraction:Vs,onRejectInteraction:Fs,onSubmitInteractionAnswers:dn,onCancelInteraction:jt,onSubmitInteractionVerdicts:Mt,composerRef:tt,composerAccessory:ls,issueWorkMode:Nt,onWorkModeChange:hn,onRefreshLatestComments:Us,assigneeUserId:mr=null,onResumeFromBacklog:fn,resumeFromBacklogPending:mn=!1,onResumeAssignee:us,resumeAssigneePending:pn=!1,onTryAgainNoLiveExecutionPath:Yi,tryAgainNoLiveExecutionPathPending:Gi,onRetryFailedRun:Xi,retryFailedRunId:Zi,externalReferences:qs,linkCaseReferences:gn=!1}){const ot=Ru(),Dt=(0,x.useRef)(null),yt=(0,x.useRef)(!1),Ot=(0,x.useRef)(null),at=(0,x.useRef)(null),Te=(0,x.useRef)(null),zs=(0,x.useRef)(null),bn=(0,x.useRef)(!1),Hs=(0,x.useRef)(!1),xn=(0,x.useRef)(null),Ws=(0,x.useRef)(!1),Ks=(0,x.useRef)(null),_=(0,x.useRef)(0),J=(0,x.useRef)([]),Q=(0,x.useRef)(null),[ce,Z]=(0,x.useState)(0),re=(0,x.useMemo)(()=>{const D=new Map;for(const ee of l)Vn(ee,L)&&D.set(ee.id,ee);return u&&Vn(u,L)&&D.set(u.id,{id:u.id,status:u.status,invocationSource:u.invocationSource,triggerDetail:u.triggerDetail,contextCommentId:u.contextCommentId,contextWakeCommentId:u.contextWakeCommentId,startedAt:xs(u.startedAt),finishedAt:xs(u.finishedAt),createdAt:xs(u.createdAt)??new Date().toISOString(),agentId:u.agentId,agentName:u.agentName,adapterType:u.adapterType,logBytes:u.logBytes,lastOutputBytes:u.lastOutputBytes,issueId:u.issueId,livenessState:u.livenessState,livenessReason:u.livenessReason,continuationAttempt:u.continuationAttempt,lastUsefulActionAt:xs(u.lastUsefulActionAt),nextAction:u.nextAction,outputSilence:u.outputSilence,currentStatusMessage:u.currentStatusMessage??null,currentStatusUpdatedAt:xs(u.currentStatusUpdatedAt),currentToolName:u.currentToolName??null,lastAssistantSnippet:u.lastAssistantSnippet??null,lastEventAt:xs(u.lastEventAt)}),[...D.values()].sort((ee,de)=>new Date(ee.createdAt).getTime()-new Date(de.createdAt).getTime())},[u,L,l]),me=(0,x.useMemo)(()=>Tx({linkedRuns:o,liveRuns:re,activeRun:u}),[u,re,o]),Fe=(0,x.useMemo)(()=>{const D=new Set;for(const ee of re)(ee.status==="queued"||ee.status==="running")&&D.add(ee.id);return D},[re]),Pt=(0,x.useMemo)(()=>re.some(D=>D.status==="running"),[re]),Bt=(0,x.useMemo)(()=>!m||m.hasLiveContinuation?m??null:Fe.size>0||d&&f?.has(d)?{...m,hasLiveContinuation:!0}:m,[m,Fe,d,f]),je=(0,x.useCallback)(()=>{for(const D of J.current)window.clearTimeout(D);J.current=[],Q.current?.(),Q.current=null},[]);(0,x.useEffect)(()=>je,[je]);const{transcriptByRun:ds,hasOutputForRun:hs}=F0({runs:Et?me:[],companyId:k}),_e=ln??ds,Se=hr??hs,_t=(0,x.useMemo)(()=>Ix({comments:t,interactions:e,timelineEvents:a,linkedRuns:o,liveRuns:l,activeRun:u,transcriptsByRunId:_e,hasOutputForRun:Se,includeSucceededRunsWithoutOutput:$s,companyId:k,projectId:P,agentMap:Y,currentUserId:I,userLabelMap:V,issueStatus:L}),[t,e,a,o,l,u,_e,Se,$s,k,P,Y,I,V,L]),$t=(0,x.useRef)([]),Lt=(0,x.useRef)(new Map),ge=(0,x.useMemo)(()=>{const D=nx(_t,$t.current,Lt.current);return $t.current=D.messages,Lt.current=D.cache,D.messages},[_t]),fs=(0,x.useRef)(ge);fs.current=ge;const gu=re.some(D=>D.status==="queued"||D.status==="running"),bu=(0,x.useMemo)(()=>h.filter(D=>D.status!=="done"&&D.status!=="cancelled"),[h]),pr=(0,x.useMemo)(()=>{if(!ae.startsWith("agent:"))return null;const D=ae.slice(6);return Y?.get(D)??null},[Y,ae]),eo=(0,x.useMemo)(()=>{const D=new Map;for(const ee of s)ee.targetType==="issue_comment"&&D.set(ee.targetId,ee.vote);return D},[s]),vn=ge.length>=150,gr=(0,x.useMemo)(()=>{const D=new Map;return ge.forEach((ee,de)=>{const Ce=Ss(ee);Ce&&D.set(Ce,de)}),D},[ge]);function br(D,ee,de=ge){const Ce=de.length>=150,Ae=de===ge?gr.get(D):mu(de,D);if(Ce&&Ae!==void 0&&Ae>=0)return Ot.current?(Ot.current.scrollToIndex(Ae,{align:ee?.align??"center",behavior:ee?.behavior??"smooth"}),!0):!1;const He=document.getElementById(D);return He?(He.scrollIntoView({behavior:ee?.behavior??"smooth",block:ee?.align==="start"?"start":ee?.align==="end"?"end":"center"}),!0):!1}i(br,"scrollToThreadAnchor");const to=(0,x.useCallback)((D,ee,de,Ce,Ae,He)=>(Hs.current=!0,ne(D,ee,de,Ce,Ae,He)),[ne]),xu=q0({messages:ge,isRunning:gu,onSend:i(async({body:D,reopen:ee,reassignment:de,attachmentIds:Ce})=>{await to(D,ee,de,Ce)},"onSend"),onCancel:we});(0,x.useEffect)(()=>{const D=[...ge].reverse().find(de=>de.role==="user"),ee=D?.id??null;if(Hs.current&&ee&&ee!==xn.current){Hs.current=!1;const de=D?.metadata.custom,Ce=typeof de?.anchorId=="string"?de.anchorId:null;if(Ce){const Ae=Math.round(window.innerHeight*ev);Ks.current=Ce,_.current=Ae,Z(Ae),requestAnimationFrame(()=>{br(Ce,{align:"start",behavior:"smooth"})})}}xn.current=ee},[gr,ge,vn]),(0,x.useLayoutEffect)(()=>{const D=Ks.current;if(!D||_.current<=0)return;const ee=document.getElementById(D),de=at.current;if(!ee||!de)return;const Ce=Math.max(0,de.getBoundingClientRect().top-ee.getBoundingClientRect().bottom),Ae=Math.max(0,_.current-Ce);Z(He=>He===Ae?He:Ae),Ae===0&&(Ks.current=null,_.current=0)},[ge]),(0,x.useLayoutEffect)(()=>{const D=Te.current;bn.current&&iu(zs.current,D),zs.current=ru(D),bn.current=Rx(D)},[ge]),(0,x.useEffect)(()=>{const D=ot.hash||(typeof window<"u"?window.location.hash:""),ee=D.startsWith("#comment-")||D.startsWith("#activity-")||D.startsWith("#run-")||D.startsWith("#interaction-");if(ge.length===0)return;if(!ee){yt.current||(yt.current=!0);return}if(Dt.current===D)return;const de=D.slice(1);if(de.startsWith("comment-")){const Vt=ge.find(ms=>Ss(ms)===de);if(Vt&&Lv(Vt)){yt.current=!0,Dt.current=D,typeof window<"u"&&window.history.replaceState(null,"",`${ot.pathname}${ot.search}`);return}}if(!yt.current&&(yt.current=!0,!xt)){Dt.current=D;return}let Ce=!1;const Ae=i((Vt=!1)=>{Ce||Dt.current===D||br(de,{align:"center",behavior:"smooth"})&&(Vt||!vn||document.getElementById(de))&&(Dt.current=D)},"attemptScroll");Ae();const He=requestAnimationFrame(()=>Ae()),_n=window.setTimeout(()=>Ae(!0),250);return()=>{Ce=!0,cancelAnimationFrame(He),window.clearTimeout(_n)}},[xt,ot.hash,gr,ge,vn]),(0,x.useEffect)(()=>{if(Ws.current||!Ve||Pe!=="full"||ge.length===0)return;const D=ot.hash||(typeof window<"u"?window.location.hash:"");if(D.startsWith("#comment-")||D.startsWith("#activity-")||D.startsWith("#run-")||D.startsWith("#interaction-")){Ws.current=!0;return}Ws.current=!0;const ee=requestAnimationFrame(()=>yn(fs.current));return()=>cancelAnimationFrame(ee)},[Ve,ge,Pe,ot.hash]);function xr(){if(vn){Ot.current?.scrollToLatest({behavior:"smooth"});return}at.current?.scrollIntoView({behavior:"smooth",block:"end"})}i(xr,"jumpToLatestFallback");function yn(D=fs.current){const ee=Hv(D);if(ee<0){xr();return}const de=Ss(D[ee]);if(!de){xr();return}if(!br(de,{align:"end",behavior:"smooth"},D)){xr();return}if(typeof window>"u")return;const Ce=typeof performance<"u"?performance.now():Date.now(),Ae=4e3,He=80,_n=4;je();const Vt=i(()=>document.getElementById("main-content"),"resolveScrollContainer"),ms=Vt()??window;let vo=-1,yo=-1,vr=0,_o=!1;const wn=i(()=>{_o=!0},"cancel"),wo=i(()=>{ms.removeEventListener("wheel",wn),ms.removeEventListener("touchstart",wn)},"cleanup");ms.addEventListener("wheel",wn,{once:!0,passive:!0}),ms.addEventListener("touchstart",wn,{once:!0,passive:!0}),Q.current=wo;const yr=i(()=>{wo(),Q.current=null;for(const Js of J.current)window.clearTimeout(Js);J.current=[]},"finish"),_r=i(Js=>{const ps=window.setTimeout(()=>{J.current=J.current.filter(gs=>gs!==ps),Su()},Js);J.current.push(ps)},"scheduleTick"),Su=i(()=>{const Js=typeof performance<"u"?performance.now():Date.now();if(_o||Js-Ce>Ae){yr();return}if(typeof document>"u"){yr();return}const ps=document.getElementById(de);if(!ps){Ot.current?.scrollToIndex(ee,{align:"end",behavior:"auto"}),_r(He);return}const gs=Vt(),Iu=gs?gs.getBoundingClientRect().bottom:window.innerHeight,So=ps.getBoundingClientRect().bottom-Iu;Math.abs(So)>_n&&ps.scrollIntoView({behavior:"smooth",block:"end"});const Io=gs?.scrollTop??window.scrollY,To=gs?.scrollHeight??document.documentElement.scrollHeight;if(Math.abs(Io-vo)<1&&To===yo&&Math.abs(So)<=_n){if(vr+=1,vr>=3){yr();return}}else vr=0;vo=Io,yo=To,_r(He)},"tick");_r(120)}i(yn,"scrollToLatestCommentWithSettle");function vu(){if(Us){const D=Us();if(D&&typeof D.then=="function"){D.then(()=>yn(fs.current),()=>yn(fs.current));return}}yn(fs.current)}i(vu,"handleJumpToLatest");const so=Ue(G),no=Ue(xe),ro=Ue(fr),io=Ue(un),oo=Ue(as),ao=Ue(vt),co=Ue(cs),lo=Ue(Vs),uo=Ue(Fs),ho=Ue(dn),fo=Ue(jt),mo=Ue(Mt),po=Ue(K),yu=(0,x.useMemo)(()=>({feedbackDataSharingPreference:n,feedbackTermsUrl:r,agentMap:Y,currentUserId:I,userLabelMap:V,userProfileMap:F,onVote:so,onStopRun:no,stopRunLabel:ue,stoppingRunLabel:j,stopRunVariant:A,runFinalizationActions:$,onInterruptQueued:ie?void 0:ro,onCancelQueued:ie?void 0:io,onDeleteComment:oo,onSetCommentPublicShare:ao,onImageClick:co,onAcceptInteraction:lo,onRejectInteraction:uo,onSubmitInteractionAnswers:ho,onCancelInteraction:fo,onSubmitInteractionVerdicts:mo,onUploadImage:po,issueStatus:L,issueAssigneeAgentId:H,successfulRunHandoff:Bt,externalReferences:qs,linkCaseReferences:gn}),[n,r,Y,I,V,F,so,no,ue,j,A,$,ie,ro,io,oo,ao,co,lo,uo,ho,fo,mo,po,L,H,Bt,qs,gn]),_u=bt??Pe==="full",go=os??(Pe==="embedded"?"No run output yet.":"This task conversation is empty. Start with a message below."),bo=(0,x.useRef)(null),xo=(0,x.useRef)(0);bo.current!==ge&&(bo.current=ge,xo.current+=1);const wu=String(xo.current);return(0,c.jsx)(k0,{runtime:xu,children:(0,c.jsx)(At.Provider,{value:yu,children:(0,c.jsxs)("div",{className:te(Pe==="embedded"?"space-y-3":"space-y-4"),children:[_u?(0,c.jsx)("div",{className:"flex justify-end",children:(0,c.jsx)("button",{type:"button",onClick:vu,className:"text-xs text-ink-3 transition-colors hover:text-ink",children:"Jump to latest"})}):null,(0,c.jsx)(Jx,{resetKey:wu,messages:ge,emptyMessage:go,variant:Pe,externalReferences:qs,children:(0,c.jsx)("div",{"data-testid":"thread-root",children:(0,c.jsxs)("div",{"data-testid":"thread-viewport",className:Pe==="embedded"?"space-y-3":"space-y-4",children:[ge.length===0?(0,c.jsx)($r,{className:te("block shadow-none text-center text-sm text-ink-3",Pe==="embedded"?"border-dashed border-line/70 bg-bg/60 px-4 py-6":"border-dashed px-6 py-10"),children:go}):ge.length>=150?(0,c.jsx)(Qv,{ref:Ot,messages:ge,feedbackVoteByTargetId:eo,activeRunIds:Fe,stoppingRunId:Ls,interruptingQueuedRunId:Rt,variant:Pe}):ge.map(D=>(0,c.jsx)(pu,{message:D,feedbackVoteByTargetId:eo,activeRunIds:Fe,stoppingRunId:Ls,interruptingQueuedRunId:Rt},D.id)),ze?(0,c.jsxs)("div",{"data-testid":"issue-chat-thread-notices",className:"space-y-2",children:[(0,c.jsx)(Lx,{issueStatus:L??"",assigneeAgent:pr,assigneeUserId:mr,onResume:fn,resuming:mn}),b?(0,c.jsx)(xh,{action:b,agentMap:Y,scheduledRetry:g,onResolve:S,onReissueIsolated:w,reissuePending:v,onReconcileForward:y,onBreakGlassOverride:T,onQuarantineRestore:E,quarantineRestorePending:C,canBreakGlass:N,reconcilePending:q,canFalsePositive:M}):null,R?(0,c.jsx)(xi,{tone:"info",label:"Legacy recovery task",body:(0,c.jsxs)("span",{children:["Legacy recovery task. Newer recovery actions live on the source task",R.identifier?(0,c.jsxs)(c.Fragment,{children:[" — ",(0,c.jsxs)(Is,{to:R.href,className:"underline-offset-2 hover:underline",children:[R.identifier,R.title?(0,c.jsxs)("span",{className:"text-ink-3",children:[" ","— ",R.title]}):null]})]}):"."]})}):null,(0,c.jsx)($x,{issueId:d,issueStatus:L,blockers:bu,allBlockers:h,liveIssueIds:f,blockerAttention:p,successfulRunHandoff:b?null:Bt,scheduledRetry:g,agentName:m?.assigneeAgentId?Y?.get(m.assigneeAgentId)?.name??null:null}),(0,c.jsx)(Ea,{agent:pr,onResume:us,resuming:pn})]}):(0,c.jsx)("div",{"data-testid":"issue-chat-thread-notices",className:"space-y-2",children:(0,c.jsx)(Ea,{agent:pr,onResume:us,resuming:pn})}),Qe?(0,c.jsx)("div",{"data-testid":"issue-chat-thread-footer",children:Qe}):null,(0,c.jsx)("div",{ref:at}),ze?(0,c.jsx)("div",{"aria-hidden":!0,"data-testid":"issue-chat-bottom-spacer",style:{height:ce}}):null]})})}),ze&&ls?(0,c.jsx)("div",{"data-testid":"issue-chat-composer-accessory",className:"mb-2",children:ls}):null,ze?(0,c.jsx)("div",{ref:Te,"data-testid":"issue-chat-composer-dock",className:"sticky bottom-(--sz-calc-8) z-20 space-y-2 bg-gradient-to-t from-bg via-bg/95 to-bg/0 pt-6",children:(0,c.jsx)(Zv,{ref:tt,onSend:to,onReviewConversation:X,onImageUpload:K,onAttachImage:B,draftKey:O,confirmedSubmissionIds:new Set(t.filter(D=>D.authorUserId===I&&D.clientRequestId&&!("clientStatus"in D&&D.clientStatus)).map(D=>D.clientRequestId)),enableReassign:z,reassignOptions:U,currentAssigneeValue:ae,issueId:d,suggestedAssigneeValue:W,mentions:ve,agentMap:Y,hasActiveRun:!!Pt,onStop:Pt?we:void 0,stopPending:pe,stopScope:fe,currentUserId:I,userLabelMap:V,composerPause:ie,composerDisabledReason:oe,composerHint:le,issueStatus:L,issueWorkMode:Nt,onWorkModeChange:hn})}):null]})})})}i(f_,"IssueChatThread");export{Vx as a,Sx as c,F0 as d,E0 as f,Ux as i,ix as l,r_ as m,f_ as n,Cx as o,i_ as p,Fx as r,Ji as s,Ea as t,mt as u};