chatlab-cli 0.36.1 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/dist/{chat-command-XPJ43KSW.mjs → chat-command-WBAJBKIE.mjs} +15 -16
  2. package/dist/{chat-command-XPJ43KSW.mjs.map → chat-command-WBAJBKIE.mjs.map} +1 -1
  3. package/dist/chunk-2TV7M4CC.mjs +101 -0
  4. package/dist/chunk-2TV7M4CC.mjs.map +1 -0
  5. package/dist/{chunk-Q3NEL2KK.mjs → chunk-4J4MA3RC.mjs} +2606 -671
  6. package/dist/chunk-4J4MA3RC.mjs.map +1 -0
  7. package/dist/{chunk-NFTCEJBJ.mjs → chunk-5YOHLJFB.mjs} +98 -284
  8. package/dist/chunk-5YOHLJFB.mjs.map +1 -0
  9. package/dist/{chunk-L7TIIVAY.mjs → chunk-CR2MU7LN.mjs} +49 -55
  10. package/dist/chunk-CR2MU7LN.mjs.map +1 -0
  11. package/dist/{chunk-2JPFBIAG.mjs → chunk-DKIYHA3O.mjs} +284 -31
  12. package/dist/chunk-DKIYHA3O.mjs.map +1 -0
  13. package/dist/{chunk-FJOGBUXU.mjs → chunk-DQR2YS3I.mjs} +1930 -33
  14. package/dist/chunk-DQR2YS3I.mjs.map +1 -0
  15. package/dist/{chunk-JOVL7OTW.mjs → chunk-EJBBVLUN.mjs} +3 -3
  16. package/dist/chunk-EJBBVLUN.mjs.map +1 -0
  17. package/dist/{chunk-X2QBH24F.mjs → chunk-FM3GXNEO.mjs} +1643 -3
  18. package/dist/chunk-FM3GXNEO.mjs.map +1 -0
  19. package/dist/{chunk-R73XMAB2.mjs → chunk-MSMDLDPB.mjs} +96 -5
  20. package/dist/chunk-MSMDLDPB.mjs.map +1 -0
  21. package/dist/{chunk-NQHZPSW2.mjs → chunk-N2WGG3MS.mjs} +2 -2
  22. package/dist/{chunk-67HNPYZJ.mjs → chunk-RXMSZIYD.mjs} +3 -3
  23. package/dist/{chunk-5MJO4AJB.mjs → chunk-SQWN4GTQ.mjs} +2 -2
  24. package/dist/cli.mjs +9 -9
  25. package/dist/contacts-worker.mjs +2 -2
  26. package/dist/global-insight-worker.mjs +1 -1
  27. package/dist/{http-5RVY5J5U.mjs → http-X6OEOOSH.mjs} +12 -12
  28. package/dist/{import-ILTWVHKU.mjs → import-WBJ6YIQ7.mjs} +7 -7
  29. package/dist/index.mjs +12 -12
  30. package/dist/{mcp-Y2YXOFB4.mjs → mcp-FR6OKWKL.mjs} +8 -8
  31. package/dist/people-relationships-worker.mjs +2 -2
  32. package/dist/semantic-index-worker.mjs +1 -1
  33. package/dist/{src-OV5ZNE3Z.mjs → src-WE5HNN2O.mjs} +44 -14
  34. package/dist/{stream-import-XOUM3Z5W.mjs → stream-import-YYQVZDGQ.mjs} +7 -7
  35. package/dist/{worker-runtime-JNGURHDM.mjs → worker-runtime-YGB5ZDE4.mjs} +5 -5
  36. package/dist-cli-web/assets/AISettingsTab-Co2sM1iY.js +1 -0
  37. package/dist-cli-web/assets/{AboutTab-CxI8zJNz.js → AboutTab-DQ8r6mYE.js} +1 -1
  38. package/dist-cli-web/assets/ActionToolsPanel-CmYpw8Mt.css +1 -0
  39. package/dist-cli-web/assets/ActionToolsPanel.vue_vue_type_script_setup_true_lang--RPlmfIu.js +75 -0
  40. package/dist-cli-web/assets/{Alert-_MYcI_E2.js → Alert-DU1tLAAg.js} +1 -1
  41. package/dist-cli-web/assets/ApiSettingsTab-D5g5b79L.js +2 -0
  42. package/dist-cli-web/assets/BatchManageTab-BFUyVaGU.js +1 -0
  43. package/dist-cli-web/assets/{BufferResource-i64DlwQT.js → BufferResource-C-RfYwQW.js} +1 -1
  44. package/dist-cli-web/assets/{CanvasRenderer-B76mEt9A.js → CanvasRenderer-Dz7JAMrR.js} +1 -1
  45. package/dist-cli-web/assets/CardDecoration-D28DI1G9.js +1 -0
  46. package/dist-cli-web/assets/ChatRecordDrawer-Cph819yY.js +1 -0
  47. package/dist-cli-web/assets/{ChatRecordWorkspace-CyfPIlIy.js → ChatRecordWorkspace-BAfERdPc.js} +1 -1
  48. package/dist-cli-web/assets/Checkbox-B8uqt13j.js +1 -0
  49. package/dist-cli-web/assets/DataDirCleanupNotice-3sGBE5vU.js +1 -0
  50. package/dist-cli-web/assets/{DatePicker.vue_vue_type_script_setup_true_lang-DqNBNa1D.js → DatePicker.vue_vue_type_script_setup_true_lang-CQuub8-f.js} +1 -1
  51. package/dist-cli-web/assets/{DebugToolsPanel-CbNsD9co.js → DebugToolsPanel-Cwkr0BOY.js} +1 -1
  52. package/dist-cli-web/assets/EChart.vue_vue_type_script_setup_true_lang-BuLujQCF.js +1 -0
  53. package/dist-cli-web/assets/EChartBar.vue_vue_type_script_setup_true_lang-DuA5xbcC.js +1 -0
  54. package/dist-cli-web/assets/EChartLine.vue_vue_type_script_setup_true_lang-CvmMEfYq.js +1 -0
  55. package/dist-cli-web/assets/EChartWordcloud-CHVtyPR7.js +1 -0
  56. package/dist-cli-web/assets/FileDropZone.vue_vue_type_script_setup_true_lang-BKPy9Qv-.js +1 -0
  57. package/dist-cli-web/assets/{Filter-yxkeHO78.js → Filter-CMfRHIoK.js} +1 -1
  58. package/dist-cli-web/assets/GlobalTaskBar-Jz6MASCu.js +1 -0
  59. package/dist-cli-web/assets/GlobalTaskBar-haLzezqY.css +1 -0
  60. package/dist-cli-web/assets/GroupRelationshipGalaxyView-Ch4obfEq.js +1 -0
  61. package/dist-cli-web/assets/Label-CuryuymO.js +1 -0
  62. package/dist-cli-web/assets/LoadingState.vue_vue_type_script_setup_true_lang-CoeQsaiL.js +1 -0
  63. package/dist-cli-web/assets/MessageExportModal-JqGZ-iLr.js +1 -0
  64. package/dist-cli-web/assets/PageHeader-CPLgiKT8.css +1 -0
  65. package/dist-cli-web/assets/PageHeader-D4up77TB.js +1 -0
  66. package/dist-cli-web/assets/{PageTabs.vue_vue_type_script_setup_true_lang-_j82asQU.js → PageTabs.vue_vue_type_script_setup_true_lang-DYQRFk9s.js} +1 -1
  67. package/dist-cli-web/assets/{RelationshipGalaxyCanvas-BODk18aA.js → RelationshipGalaxyCanvas-Cn7Eta5U.js} +3 -3
  68. package/dist-cli-web/assets/{RelationshipGalaxyThreeCanvas-BJyuRiC-.js → RelationshipGalaxyThreeCanvas-LlaX57z6.js} +1 -1
  69. package/dist-cli-web/assets/{RenderTargetSystem-CVMvAUSv.js → RenderTargetSystem-JhA2PUFi.js} +1 -1
  70. package/dist-cli-web/assets/{RovingFocusItem-DC_06OmN.js → RovingFocusItem-DHaiTb4j.js} +1 -1
  71. package/dist-cli-web/assets/{ScreenCaptureModal-DrBFDOtC.js → ScreenCaptureModal-Bxhyt5g1.js} +1 -1
  72. package/dist-cli-web/assets/SectionTabs.vue_vue_type_script_setup_true_lang-BlAje3Tf.js +1 -0
  73. package/dist-cli-web/assets/Select-Beeqv0wU.js +1 -0
  74. package/dist-cli-web/assets/SettingsModal-DV8yDBJs.js +2 -0
  75. package/dist-cli-web/assets/{StorageTab-B0ebN0f8.js → StorageTab-B7GHadia.js} +1 -1
  76. package/dist-cli-web/assets/Switch-u4zlvUMa.js +1 -0
  77. package/dist-cli-web/assets/{Tabs-N3Q-Mpqi.js → Tabs-B7-Koq3x.js} +1 -1
  78. package/dist-cli-web/assets/Tabs-RWKHwtfM.js +1 -0
  79. package/dist-cli-web/assets/ThemeCard.vue_vue_type_script_setup_true_lang-ndsa3-aT.js +1 -0
  80. package/dist-cli-web/assets/{TimeSelect.vue_vue_type_script_setup_true_lang-Ccunouyf.js → TimeSelect.vue_vue_type_script_setup_true_lang-DKa1flT-.js} +1 -1
  81. package/dist-cli-web/assets/{VisuallyHiddenInput-OAJEt_Y5.js → VisuallyHiddenInput-DGDqcvUy.js} +1 -1
  82. package/dist-cli-web/assets/{WebGLRenderer-DuUeftYD.js → WebGLRenderer-ifvgA1fe.js} +1 -1
  83. package/dist-cli-web/assets/{WebGPURenderer-DoWQxiWZ.js → WebGPURenderer-DwzmuWF0.js} +1 -1
  84. package/dist-cli-web/assets/aiChat-BY4C3UQe.js +8 -0
  85. package/dist-cli-web/assets/base-BWDX-164.js +1 -0
  86. package/dist-cli-web/assets/{browserAll-Cb-mtR2y.js → browserAll-CSIIETeE.js} +1 -1
  87. package/dist-cli-web/assets/chatMessages--r0obAVw.css +1 -0
  88. package/dist-cli-web/assets/chatMessages-Zywjea1n.js +147 -0
  89. package/dist-cli-web/assets/cli-web-BRY49NWe.js +1 -0
  90. package/dist-cli-web/assets/{fetch-BbcFaCRB.js → fetch-Bf4cqeM3.js} +1 -1
  91. package/dist-cli-web/assets/{fetch-B-6tyYWu.js → fetch-BiXab0IF.js} +1 -1
  92. package/dist-cli-web/assets/{fetch-DEub4tOo.js → fetch-C8CcoTWY.js} +1 -1
  93. package/dist-cli-web/assets/{fetch-Qs38Hx1V.js → fetch-Co2vLmiE.js} +1 -1
  94. package/dist-cli-web/assets/{fetch-DLTlYnDB.js → fetch-D3nLtFBi.js} +1 -1
  95. package/dist-cli-web/assets/{fetch-BkA_so1e.js → fetch-DNSDHSqQ.js} +1 -1
  96. package/dist-cli-web/assets/{fetch-sYDJ-Zs8.js → fetch-DeHqF6yL.js} +1 -1
  97. package/dist-cli-web/assets/{fetch-B4PYy5JS.js → fetch-jx1VdM9j.js} +3 -3
  98. package/dist-cli-web/assets/{fetch-CW2fKvGp.js → fetch-mYSeL4Ki.js} +1 -1
  99. package/dist-cli-web/assets/fetch-qBaUXqFt.js +1 -0
  100. package/dist-cli-web/assets/{fetch-BzXuAaT3.js → fetch-r6mhEGrP.js} +1 -1
  101. package/dist-cli-web/assets/{fetch-AvsnJLWJ.js → fetch-wzv71PYy.js} +1 -1
  102. package/dist-cli-web/assets/{host-DYIkQqvY.js → host-1emQf9_4.js} +1 -1
  103. package/dist-cli-web/assets/{host-B6SQ6OGo.js → host-jXJHyyOX.js} +1 -1
  104. package/dist-cli-web/assets/index-2dJCozDq.js +64 -0
  105. package/dist-cli-web/assets/index-6ejRbH3h.js +2 -0
  106. package/dist-cli-web/assets/index-B4mJkX_d.js +1 -0
  107. package/dist-cli-web/assets/index-B7biznha.js +1 -0
  108. package/dist-cli-web/assets/index-BOcFyPCa.js +1 -0
  109. package/dist-cli-web/assets/index-BQ463TS7.js +1 -0
  110. package/dist-cli-web/assets/index-BZpR015e.css +1 -0
  111. package/dist-cli-web/assets/index-BgelKQTW.css +1 -0
  112. package/dist-cli-web/assets/index-C1A1FwpO.css +1 -0
  113. package/dist-cli-web/assets/index-CIIyg_o9.css +1 -0
  114. package/dist-cli-web/assets/{index-CShh95fU.js → index-CYc_VLgK.js} +1 -1
  115. package/dist-cli-web/assets/index-ClHMs0-a.js +2 -0
  116. package/dist-cli-web/assets/{index-D64XYYts.js → index-Cw0IhKZ6.js} +10 -10
  117. package/dist-cli-web/assets/{index-C_OS8Y8W.js → index-DOqbUvhA.js} +1 -1
  118. package/dist-cli-web/assets/index-DnpnIyle.js +135 -0
  119. package/dist-cli-web/assets/index-LV9LfFNu.js +1 -0
  120. package/dist-cli-web/assets/index-kePiJ3ca.js +137 -0
  121. package/dist-cli-web/assets/index-slDUxib2.js +1 -0
  122. package/dist-cli-web/assets/{people-page-header-0jvXFFnh.js → people-page-header-Cx5r9Bk2.js} +1 -1
  123. package/dist-cli-web/assets/{prompt-BPYj29Vq.js → prompt-BggEDxxi.js} +1 -1
  124. package/dist-cli-web/assets/{semantic-index-config-builder-vO37z355.js → semantic-index-config-builder-1sO0aEc1.js} +1 -1
  125. package/dist-cli-web/assets/{service-D29Vftq9.js → service-Bvq1fRkC.js} +1 -1
  126. package/dist-cli-web/assets/service-DkPheDt8.js +1 -0
  127. package/dist-cli-web/assets/service-DvI8O_7K.js +1 -0
  128. package/dist-cli-web/assets/useFormControl-B0aShtLp.js +1 -0
  129. package/dist-cli-web/assets/useTable-DC7oxmBl.js +1 -0
  130. package/dist-cli-web/assets/{useToast-BA0EwImD.js → useToast-CCPBE-Sy.js} +1 -1
  131. package/dist-cli-web/assets/{vendor-echarts-hTLhTs52.js → vendor-echarts-C9ugTmum.js} +1 -1
  132. package/dist-cli-web/assets/{vendor-echarts-wordcloud-B8CF_NgP.js → vendor-echarts-wordcloud-DNiU8Psq.js} +1 -1
  133. package/dist-cli-web/assets/{webworkerAll-ZPE_yGnC.js → webworkerAll-FCJk6reG.js} +1 -1
  134. package/dist-cli-web/index.html +2 -2
  135. package/package.json +1 -1
  136. package/dist/chunk-2JPFBIAG.mjs.map +0 -1
  137. package/dist/chunk-6QP47LID.mjs +0 -41
  138. package/dist/chunk-6QP47LID.mjs.map +0 -1
  139. package/dist/chunk-FJOGBUXU.mjs.map +0 -1
  140. package/dist/chunk-JOVL7OTW.mjs.map +0 -1
  141. package/dist/chunk-L7TIIVAY.mjs.map +0 -1
  142. package/dist/chunk-NFTCEJBJ.mjs.map +0 -1
  143. package/dist/chunk-Q3NEL2KK.mjs.map +0 -1
  144. package/dist/chunk-R73XMAB2.mjs.map +0 -1
  145. package/dist/chunk-X2QBH24F.mjs.map +0 -1
  146. package/dist-cli-web/assets/AISettingsTab-vvjijrc5.js +0 -1
  147. package/dist-cli-web/assets/ActionToolsPanel-Dp-ojXjO.css +0 -1
  148. package/dist-cli-web/assets/ActionToolsPanel.vue_vue_type_script_setup_true_lang-w0hHEodr.js +0 -110
  149. package/dist-cli-web/assets/ApiSettingsTab-CK7U6dVA.js +0 -2
  150. package/dist-cli-web/assets/BatchManageTab-1WnEqqpB.js +0 -1
  151. package/dist-cli-web/assets/ChatRecordDrawer-Bp6OSCrz.js +0 -1
  152. package/dist-cli-web/assets/Checkbox-Ci7IeRw1.js +0 -1
  153. package/dist-cli-web/assets/DataDirCleanupNotice-Dh63pOLt.js +0 -1
  154. package/dist-cli-web/assets/EChart.vue_vue_type_script_setup_true_lang-YeqmodwE.js +0 -1
  155. package/dist-cli-web/assets/EChartBar.vue_vue_type_script_setup_true_lang-C3pZmq0v.js +0 -1
  156. package/dist-cli-web/assets/EChartLine.vue_vue_type_script_setup_true_lang-Co6olfwv.js +0 -1
  157. package/dist-cli-web/assets/EChartWordcloud-rDusZwSq.js +0 -1
  158. package/dist-cli-web/assets/GlobalTaskBar-BlZ-fFiq.js +0 -1
  159. package/dist-cli-web/assets/GlobalTaskBar-COW_uBX6.css +0 -1
  160. package/dist-cli-web/assets/GroupRelationshipGalaxyView-BXQBX0zJ.js +0 -1
  161. package/dist-cli-web/assets/Label-CFAZFBQX.js +0 -1
  162. package/dist-cli-web/assets/LoadingState.vue_vue_type_script_setup_true_lang-CwgpqtMZ.js +0 -1
  163. package/dist-cli-web/assets/MessageExportModal-DU71grc7.js +0 -1
  164. package/dist-cli-web/assets/PageHeader-BDPf4NuI.js +0 -1
  165. package/dist-cli-web/assets/PageHeader-XIXMTomn.css +0 -1
  166. package/dist-cli-web/assets/SectionTabs.vue_vue_type_script_setup_true_lang-C-Zj2biH.js +0 -1
  167. package/dist-cli-web/assets/Select-DLK2LYhO.js +0 -1
  168. package/dist-cli-web/assets/SettingsModal-DqaR4Dx5.js +0 -2
  169. package/dist-cli-web/assets/Switch-CokhQWxm.js +0 -1
  170. package/dist-cli-web/assets/Tabs-D1UiZNaZ.js +0 -1
  171. package/dist-cli-web/assets/ThemeCard.vue_vue_type_script_setup_true_lang-OT-I0mbU.js +0 -1
  172. package/dist-cli-web/assets/aiChat-CdADfRnU.js +0 -8
  173. package/dist-cli-web/assets/cli-web-BHQCZLLg.js +0 -1
  174. package/dist-cli-web/assets/fetch-ul8-uQIb.js +0 -1
  175. package/dist-cli-web/assets/index--IEkRjKe.js +0 -64
  176. package/dist-cli-web/assets/index-9iaY_EWG.js +0 -1
  177. package/dist-cli-web/assets/index-B4J99zv3.css +0 -1
  178. package/dist-cli-web/assets/index-BBeqtL8d.css +0 -1
  179. package/dist-cli-web/assets/index-BnaLj2dx.css +0 -1
  180. package/dist-cli-web/assets/index-C7omDgiJ.js +0 -2
  181. package/dist-cli-web/assets/index-CHsM84U1.js +0 -2
  182. package/dist-cli-web/assets/index-CL8u01Pf.js +0 -137
  183. package/dist-cli-web/assets/index-DrCc8p_I.css +0 -1
  184. package/dist-cli-web/assets/index-UpTe1KzQ.js +0 -1
  185. package/dist-cli-web/assets/index-a8Hw6eD8.js +0 -1
  186. package/dist-cli-web/assets/index-jwjzZNKm.js +0 -1
  187. package/dist-cli-web/assets/index-pkxlF8Ee.js +0 -1
  188. package/dist-cli-web/assets/index-sWxuTsa7.js +0 -36
  189. package/dist-cli-web/assets/service-CVoA9yNf.js +0 -1
  190. package/dist-cli-web/assets/service-DMysyLCa.js +0 -1
  191. package/dist-cli-web/assets/useFormControl-DVawP2DO.js +0 -1
  192. package/dist-cli-web/assets/useTable-Bv3R_Hux.js +0 -1
  193. /package/dist/{chunk-NQHZPSW2.mjs.map → chunk-N2WGG3MS.mjs.map} +0 -0
  194. /package/dist/{chunk-67HNPYZJ.mjs.map → chunk-RXMSZIYD.mjs.map} +0 -0
  195. /package/dist/{chunk-5MJO4AJB.mjs.map → chunk-SQWN4GTQ.mjs.map} +0 -0
  196. /package/dist/{http-5RVY5J5U.mjs.map → http-X6OEOOSH.mjs.map} +0 -0
  197. /package/dist/{import-ILTWVHKU.mjs.map → import-WBJ6YIQ7.mjs.map} +0 -0
  198. /package/dist/{mcp-Y2YXOFB4.mjs.map → mcp-FR6OKWKL.mjs.map} +0 -0
  199. /package/dist/{src-OV5ZNE3Z.mjs.map → src-WE5HNN2O.mjs.map} +0 -0
  200. /package/dist/{stream-import-XOUM3Z5W.mjs.map → stream-import-YYQVZDGQ.mjs.map} +0 -0
  201. /package/dist/{worker-runtime-JNGURHDM.mjs.map → worker-runtime-YGB5ZDE4.mjs.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{y as L,a as D,j as l,z as k,e as pe,H as le,D as T,c as C,d as B,B as fe,I as z,J as w,w as v,K as y,q as ge,L as me,N as O,O as R,r as G,M as F,Q as I,V as _e,W,X as be,S as H,T as E,A as xe,R as ye}from"./RelationshipGalaxyCanvas-BODk18aA.js";import{c as Ge,u as Pe,U as Se,B as Te,G as Be,e as Ce,l as ve,a as Ue,t as Me}from"./BufferResource-i64DlwQT.js";import{R as we,S as Re,d as Ee}from"./RenderTargetSystem-CVMvAUSv.js";import"./index-sWxuTsa7.js";import"./vendor-snapdom--nZvo8Sg.js";import"./index-C7omDgiJ.js";import"./Tabs-D1UiZNaZ.js";import"./RovingFocusItem-DC_06OmN.js";import"./useToast-BA0EwImD.js";import"./LoadingState.vue_vue_type_script_setup_true_lang-CwgpqtMZ.js";import"./people-page-header-0jvXFFnh.js";import"./relationship-galaxy-connections-Cg4G5yYE.js";import"./relationship-galaxy-viewport-Cwfa51ER.js";import"./Filter-yxkeHO78.js";const P=D.for2d();class N{start(e,t,r){const s=e.renderer,i=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=t,i.setGeometry(t,n),P.blendMode="normal",s.pipeline.getPipeline(t,n,P);const o=s.globalUniforms.bindGroup;i.resetBindGroup(1),i.setBindGroup(0,o,n)}execute(e,t){const r=this._shader.gpuProgram,s=e.renderer,i=s.encoder;if(!t.bindGroup){const u=t.textures;t.bindGroup=L(u.textures,u.count,s.limits.maxBatchableTextures)}P.blendMode=t.blendMode;const n=s.bindGroup.getBindGroup(t.bindGroup,r,1),o=s.pipeline.getPipeline(this._geometry,r,P,t.topology);t.bindGroup._touch(s.gc.now,s.tick),i.setPipeline(o),i.renderPassEncoder.setBindGroup(1,n),i.renderPassEncoder.drawIndexed(t.size,1,t.start)}}N.extension={type:[l.WebGPUPipesAdaptor],name:"batch"};class V{constructor(e){this._hash=Object.create(null),this._renderer=e}contextChange(e){this._gpu=e}getBindGroup(e,t,r){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,r)}_createBindGroup(e,t,r){const s=this._gpu.device,i=t.layout[r],n=[],o=this._renderer;for(const g in i){const p=e.resources[g]??e.resources[i[g]];let h;if(p._resourceType==="uniformGroup"){const d=p;o.ubo.updateUniformGroup(d);const f=d.buffer;h={buffer:o.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(p._resourceType==="buffer"){const d=p;h={buffer:o.buffer.getGPUBuffer(d),offset:0,size:d.descriptor.size}}else if(p._resourceType==="bufferResource"){const d=p;h={buffer:o.buffer.getGPUBuffer(d.buffer),offset:d.offset,size:d.size}}else if(p._resourceType==="textureSampler"){const d=p;h=o.texture.getGpuSampler(d)}else if(p._resourceType==="textureSource"){const d=p;h=o.texture.getTextureView(d)}n.push({binding:i[g],resource:h})}const u=o.shader.getProgramData(t).bindGroups[r],c=s.createBindGroup({layout:u,entries:n});return this._hash[e._key]=c,c}destroy(){this._hash=null,this._renderer=null}}V.extension={type:[l.WebGPUSystem],name:"bindGroup"};class Ae{constructor(e){this.gpuBuffer=e}destroy(){this.gpuBuffer.destroy(),this.gpuBuffer=null}}class j{constructor(e){this._renderer=e,this._managedBuffers=new k({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"gpuBuffer"})}contextChange(e){this._gpu=e}getGPUBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]?.gpuBuffer||this.createGPUBuffer(e)}updateBuffer(e){const t=this.getGPUBuffer(e),r=e.data;return e._updateID&&r&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,0,r.buffer,0,(e._updateSize||r.byteLength)+3&-4)),t}destroyAll(){this._managedBuffers.removeAll()}onBufferUnload(e){e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this)}createGPUBuffer(e){const t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e._resourceId=pe("resource"),e.data&&(le(e.data.buffer,t.getMappedRange(),e.data.byteOffset,e.data.byteLength),t.unmap()),e._gpuData[this._renderer.uid]=new Ae(t),this._managedBuffers.add(e)&&(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this)),t}onBufferChange(e){this._managedBuffers.remove(e),e._updateID=0,this.createGPUBuffer(e)}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gpu=null}}j.extension={type:[l.WebGPUSystem],name:"buffer"};class Le{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${e*4}`);const t=this.byteIndex;let r=t+e*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,t}addGroup(e){const t=this.addEmptyGroup(e.length);for(let r=0;r<e.length;r++)this.data[t/4+r]=e[r];return t}destroy(){this.data=null}}class K{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.pipeline.setColorMask(e))}destroy(){this._renderer=null,this._colorMaskCache=null}}K.extension={type:[l.WebGPUSystem],name:"colorMask"};class U{constructor(e){this._renderer=e}async init(e){return this._initPromise?this._initPromise:(this._initPromise=(e.gpu?Promise.resolve(e.gpu):this._createDeviceAndAdaptor(e)).then(t=>{this.gpu=t,this.extensions={transientAttachment:typeof GPUTextureUsage.TRANSIENT_ATTACHMENT=="number"},this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){const t=await T.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(i=>t.features.has(i)),s=await t.requestDevice({requiredFeatures:r});return{adapter:t,device:s}}destroy(){this.gpu=null,this.extensions=null,this._renderer=null}}U.extension={type:[l.WebGPUSystem],name:"device"};U.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};class q{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(e.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(e){this.renderPassEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setPipelineFromGeometryProgramAndState(e,t,r,s){const i=this._renderer.pipeline.getPipeline(e,t,r,s);this.setPipeline(i)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;const t=e.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){this._boundBindGroup[e]=null}setBindGroup(e,t,r){if(this._boundBindGroup[e]===t)return;this._boundBindGroup[e]=t,t._touch(this._renderer.gc.now,this._renderer.tick);const s=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,s)}setGeometry(e,t){const r=this._renderer.pipeline.getBufferNamesToBind(e,t);for(const s in r)this._setVertexBuffer(parseInt(s,10),e.attributes[r[s]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(const r in e.groups){const s=e.groups[r];t||this._syncBindGroup(s),this.setBindGroup(r,s,e.gpuProgram)}}_syncBindGroup(e){for(const t in e.resources){const r=e.resources[t];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(e){const{geometry:t,shader:r,state:s,topology:i,size:n,start:o,instanceCount:u,skipSync:c}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,s,i),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,c),t.indexBuffer?this.renderPassEncoder.drawIndexed(n||t.indexBuffer.data.length,u??t.instanceCount,o||0):this.renderPassEncoder.draw(n||t.getSize(),u??t.instanceCount,o||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const e=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1],this._renderer.renderTarget.mipLevel,this._renderer.renderTarget.layer);this.renderPassEncoder=this.commandEncoder.beginRenderPass(e);const t=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,i={...this._boundBindGroup};this._clearCache();const n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(t);for(const o in r)this._setVertexBuffer(o,r[o]);for(const o in i)this.setBindGroup(o,i[o],null);this._setIndexBuffer(s)}_clearCache(){for(let e=0;e<16;e++)this._boundBindGroup[e]=null,this._boundVertexBuffer[e]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(e){this._gpu=e}}q.extension={type:[l.WebGPUSystem],name:"encoder",priority:1};class Y{constructor(e){this._renderer=e}contextChange(){this.maxTextures=this._renderer.device.gpu.device.limits.maxSampledTexturesPerShaderStage,this.maxBatchableTextures=this.maxTextures}destroy(){}}Y.extension={type:[l.WebGPUSystem],name:"limits"};class ${constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:C.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){const r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=e,r.stencilReference=t;const s=this._renderer;s.pipeline.setStencilMode(e),s.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}$.extension={type:[l.WebGPUSystem],name:"stencil"};const S={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}};function De(a){const e=a.map(r=>({data:r,offset:0,size:0}));let t=0;for(let r=0;r<e.length;r++){const s=e[r];let i=S[s.data.type].size;const n=S[s.data.type].align;if(!S[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(i=Math.max(i,n)*s.data.size),t=Math.ceil(t/n)*n,s.size=i,s.offset=t,t+=i}return t=Math.ceil(t/16)*16,{uboElements:e,size:t}}function ke(a,e){const{size:t,align:r}=S[a.data.type],s=(r-t)/4,i=a.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
1
+ import{y as L,a as D,j as l,z as k,e as pe,H as le,D as T,c as C,d as B,B as fe,I as z,J as w,w as v,K as y,q as ge,L as me,N as O,O as R,r as G,M as F,Q as I,V as _e,W,X as be,S as H,T as E,A as xe,R as ye}from"./RelationshipGalaxyCanvas-Cn7Eta5U.js";import{c as Ge,u as Pe,U as Se,B as Te,G as Be,e as Ce,l as ve,a as Ue,t as Me}from"./BufferResource-C-RfYwQW.js";import{R as we,S as Re,d as Ee}from"./RenderTargetSystem-JhA2PUFi.js";import"./index-DnpnIyle.js";import"./vendor-snapdom--nZvo8Sg.js";import"./index-ClHMs0-a.js";import"./Tabs-RWKHwtfM.js";import"./RovingFocusItem-DHaiTb4j.js";import"./useToast-CCPBE-Sy.js";import"./LoadingState.vue_vue_type_script_setup_true_lang-CoeQsaiL.js";import"./people-page-header-Cx5r9Bk2.js";import"./relationship-galaxy-connections-Cg4G5yYE.js";import"./relationship-galaxy-viewport-Cwfa51ER.js";import"./Filter-CMfRHIoK.js";const P=D.for2d();class N{start(e,t,r){const s=e.renderer,i=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=t,i.setGeometry(t,n),P.blendMode="normal",s.pipeline.getPipeline(t,n,P);const o=s.globalUniforms.bindGroup;i.resetBindGroup(1),i.setBindGroup(0,o,n)}execute(e,t){const r=this._shader.gpuProgram,s=e.renderer,i=s.encoder;if(!t.bindGroup){const u=t.textures;t.bindGroup=L(u.textures,u.count,s.limits.maxBatchableTextures)}P.blendMode=t.blendMode;const n=s.bindGroup.getBindGroup(t.bindGroup,r,1),o=s.pipeline.getPipeline(this._geometry,r,P,t.topology);t.bindGroup._touch(s.gc.now,s.tick),i.setPipeline(o),i.renderPassEncoder.setBindGroup(1,n),i.renderPassEncoder.drawIndexed(t.size,1,t.start)}}N.extension={type:[l.WebGPUPipesAdaptor],name:"batch"};class V{constructor(e){this._hash=Object.create(null),this._renderer=e}contextChange(e){this._gpu=e}getBindGroup(e,t,r){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,r)}_createBindGroup(e,t,r){const s=this._gpu.device,i=t.layout[r],n=[],o=this._renderer;for(const g in i){const p=e.resources[g]??e.resources[i[g]];let h;if(p._resourceType==="uniformGroup"){const d=p;o.ubo.updateUniformGroup(d);const f=d.buffer;h={buffer:o.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(p._resourceType==="buffer"){const d=p;h={buffer:o.buffer.getGPUBuffer(d),offset:0,size:d.descriptor.size}}else if(p._resourceType==="bufferResource"){const d=p;h={buffer:o.buffer.getGPUBuffer(d.buffer),offset:d.offset,size:d.size}}else if(p._resourceType==="textureSampler"){const d=p;h=o.texture.getGpuSampler(d)}else if(p._resourceType==="textureSource"){const d=p;h=o.texture.getTextureView(d)}n.push({binding:i[g],resource:h})}const u=o.shader.getProgramData(t).bindGroups[r],c=s.createBindGroup({layout:u,entries:n});return this._hash[e._key]=c,c}destroy(){this._hash=null,this._renderer=null}}V.extension={type:[l.WebGPUSystem],name:"bindGroup"};class Ae{constructor(e){this.gpuBuffer=e}destroy(){this.gpuBuffer.destroy(),this.gpuBuffer=null}}class j{constructor(e){this._renderer=e,this._managedBuffers=new k({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"gpuBuffer"})}contextChange(e){this._gpu=e}getGPUBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]?.gpuBuffer||this.createGPUBuffer(e)}updateBuffer(e){const t=this.getGPUBuffer(e),r=e.data;return e._updateID&&r&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,0,r.buffer,0,(e._updateSize||r.byteLength)+3&-4)),t}destroyAll(){this._managedBuffers.removeAll()}onBufferUnload(e){e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this)}createGPUBuffer(e){const t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e._resourceId=pe("resource"),e.data&&(le(e.data.buffer,t.getMappedRange(),e.data.byteOffset,e.data.byteLength),t.unmap()),e._gpuData[this._renderer.uid]=new Ae(t),this._managedBuffers.add(e)&&(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this)),t}onBufferChange(e){this._managedBuffers.remove(e),e._updateID=0,this.createGPUBuffer(e)}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gpu=null}}j.extension={type:[l.WebGPUSystem],name:"buffer"};class Le{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${e*4}`);const t=this.byteIndex;let r=t+e*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,t}addGroup(e){const t=this.addEmptyGroup(e.length);for(let r=0;r<e.length;r++)this.data[t/4+r]=e[r];return t}destroy(){this.data=null}}class K{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.pipeline.setColorMask(e))}destroy(){this._renderer=null,this._colorMaskCache=null}}K.extension={type:[l.WebGPUSystem],name:"colorMask"};class U{constructor(e){this._renderer=e}async init(e){return this._initPromise?this._initPromise:(this._initPromise=(e.gpu?Promise.resolve(e.gpu):this._createDeviceAndAdaptor(e)).then(t=>{this.gpu=t,this.extensions={transientAttachment:typeof GPUTextureUsage.TRANSIENT_ATTACHMENT=="number"},this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){const t=await T.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(i=>t.features.has(i)),s=await t.requestDevice({requiredFeatures:r});return{adapter:t,device:s}}destroy(){this.gpu=null,this.extensions=null,this._renderer=null}}U.extension={type:[l.WebGPUSystem],name:"device"};U.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};class q{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(e.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(e){this.renderPassEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setPipelineFromGeometryProgramAndState(e,t,r,s){const i=this._renderer.pipeline.getPipeline(e,t,r,s);this.setPipeline(i)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;const t=e.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){this._boundBindGroup[e]=null}setBindGroup(e,t,r){if(this._boundBindGroup[e]===t)return;this._boundBindGroup[e]=t,t._touch(this._renderer.gc.now,this._renderer.tick);const s=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,s)}setGeometry(e,t){const r=this._renderer.pipeline.getBufferNamesToBind(e,t);for(const s in r)this._setVertexBuffer(parseInt(s,10),e.attributes[r[s]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(const r in e.groups){const s=e.groups[r];t||this._syncBindGroup(s),this.setBindGroup(r,s,e.gpuProgram)}}_syncBindGroup(e){for(const t in e.resources){const r=e.resources[t];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(e){const{geometry:t,shader:r,state:s,topology:i,size:n,start:o,instanceCount:u,skipSync:c}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,s,i),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,c),t.indexBuffer?this.renderPassEncoder.drawIndexed(n||t.indexBuffer.data.length,u??t.instanceCount,o||0):this.renderPassEncoder.draw(n||t.getSize(),u??t.instanceCount,o||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const e=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1],this._renderer.renderTarget.mipLevel,this._renderer.renderTarget.layer);this.renderPassEncoder=this.commandEncoder.beginRenderPass(e);const t=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,i={...this._boundBindGroup};this._clearCache();const n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(t);for(const o in r)this._setVertexBuffer(o,r[o]);for(const o in i)this.setBindGroup(o,i[o],null);this._setIndexBuffer(s)}_clearCache(){for(let e=0;e<16;e++)this._boundBindGroup[e]=null,this._boundVertexBuffer[e]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(e){this._gpu=e}}q.extension={type:[l.WebGPUSystem],name:"encoder",priority:1};class Y{constructor(e){this._renderer=e}contextChange(){this.maxTextures=this._renderer.device.gpu.device.limits.maxSampledTexturesPerShaderStage,this.maxBatchableTextures=this.maxTextures}destroy(){}}Y.extension={type:[l.WebGPUSystem],name:"limits"};class ${constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:C.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){const r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=e,r.stencilReference=t;const s=this._renderer;s.pipeline.setStencilMode(e),s.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}$.extension={type:[l.WebGPUSystem],name:"stencil"};const S={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}};function De(a){const e=a.map(r=>({data:r,offset:0,size:0}));let t=0;for(let r=0;r<e.length;r++){const s=e[r];let i=S[s.data.type].size;const n=S[s.data.type].align;if(!S[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(i=Math.max(i,n)*s.data.size),t=Math.ceil(t/n)*n,s.size=i,s.offset=t,t+=i}return t=Math.ceil(t/16)*16,{uboElements:e,size:t}}function ke(a,e){const{size:t,align:r}=S[a.data.type],s=(r-t)/4,i=a.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
2
2
  v = uv.${a.data.name};
3
3
  ${e!==0?`offset += ${e};`:""}
4
4
 
@@ -0,0 +1,8 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DnpnIyle.js","assets/vendor-snapdom--nZvo8Sg.js","assets/index-BZpR015e.css"])))=>i.map(i=>d[i]);
2
+ import{$ as qt,h as ht,b as z,e as ae,aB as rt,aG as st,bP as ut,bQ as Vt,Z as Gt,bt as Qt,bR as Ct,ap as Yt,ab as Zt,bS as Xt,aA as Kt,L as At,aF as ke,bT as bt,a5 as es}from"./index-DnpnIyle.js";import{u as ts}from"./prompt-BggEDxxi.js";import{C as Ot}from"./chatlabSiteLocale-CrCNb8QP.js";const Ve="chart_runtime",ss=4e3,ns=`
3
+ …[truncated]`;function wt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Bt(e){return!wt(e)||!Array.isArray(e.content)?"":e.content.map(s=>wt(s)&&s.type==="text"&&typeof s.text=="string"?s.text:"").filter(s=>s.length>0).join(`
4
+ `)}function Rt(e,s=ss){return e.length<=s?e:e.slice(0,s)+ns}function se(){return qt("assistant-crud")}function Te(){return qt("skill-crud")}const Mt=Ot,rs={"zh-CN":"cn","zh-TW":"cn","en-US":"en","ja-JP":"ja"},$t=ht("assistant",()=>{const e=z([]),s=z(null),o=z(!1),c=new Set;let i=null;const g=z([]),b=z([]),C=z([]),w=z(!1),M=z(null),q=z("group"),W=z("zh-CN"),D=ae(()=>s.value?e.value.find(m=>m.id===s.value)??null:null),O=ae(()=>e.value.filter(m=>{const f=!m.applicableChatTypes?.length||m.applicableChatTypes.includes(q.value),R=!m.supportedLocales?.length||m.supportedLocales.some(H=>W.value.startsWith(H));return f&&R})),G=4,re=ae(()=>O.value.slice(0,G)),$=ae(()=>O.value.slice(G)),L=ae(()=>O.value.length>G),Z=ae(()=>{const m=new Set(e.value.map(f=>f.id));return C.value.map(f=>({...f,imported:m.has(f.id)}))});function Ae(m,f){q.value=m,W.value=f}async function te(){try{const m=se();e.value=await m.getAll(),o.value=!0}catch(m){console.error("[AssistantStore] Failed to load assistants:",m)}}async function ie(){try{g.value=await se().getBuiltinCatalog()}catch(m){console.error("[AssistantStore] Failed to load builtin catalog:",m)}}async function be(){try{b.value=await se().getBuiltinToolCatalog()}catch(m){console.error("[AssistantStore] Failed to load builtin tool catalog:",m)}}async function he(m){const f=rs[m||W.value]??"en",R=`${Mt}/${f}/assistant.json`;w.value=!0,M.value=null;try{const H=await rt().fetchRemoteConfig(R);if(!H.success||!H.data){M.value=H.error||"Failed to fetch cloud catalog",C.value=[];return}const $e=H.data;if(!Array.isArray($e)){M.value="Invalid catalog format",C.value=[];return}C.value=$e.filter(Be=>Be.id&&Be.name&&Be.path)}catch(H){M.value=String(H),C.value=[]}finally{w.value=!1}}async function j(m){const f=`${Mt}${m.path}`;try{const R=await rt().fetchRemoteConfig(f);if(!R.success||typeof R.data!="string")return{success:!1,error:R.error||"Failed to fetch assistant content"};const H=await se().importFromMd(R.data);return H.success&&await te(),H}catch(R){return{success:!1,error:String(R)}}}function qe(m){return e.value.some(f=>f.id===m)}function Oe(m){s.value=m}function le(){s.value=null}async function _e(m){try{return await se().getConfig(m)}catch(f){return console.error("[AssistantStore] Failed to get config:",f),null}}async function I(m,f){try{const R=await se().update(m,f);return R.success&&await te(),R}catch(R){return{success:!1,error:String(R)}}}async function h(m){try{const f=await se().reset(m);return f.success&&await te(),f}catch(f){return{success:!1,error:String(f)}}}async function P(m){const f=st(m);if(c.has(f))return null;c.add(f);try{const R=await se().getUpgradeInfo(f);if(!R)return null;try{if(i||(i={...(await ut().getPreferences()).assistantUpgradeSkippedVersions}),R.latestVersion!==null&&i[R.builtinId]===R.latestVersion)return null}catch(H){console.error("[AssistantStore] Failed to load skipped assistant upgrades:",H)}return R}catch(R){return c.delete(f),console.error("[AssistantStore] Failed to check assistant upgrade:",R),null}}async function ce(m){if(m.latestVersion===null)return{success:!1,error:"Assistant template version is unavailable"};try{i||(i={...(await ut().getPreferences()).assistantUpgradeSkippedVersions});const f={...i,[m.builtinId]:m.latestVersion},R=await ut().savePreferences({assistantUpgradeSkippedVersions:f});return R.success&&(i=f),R}catch(f){return{success:!1,error:String(f)}}}async function we(m,f){try{const R=await se().upgradeWithBackup(m.assistantId,f);return R.success&&await te(),R}catch(R){return{success:!1,error:String(R)}}}async function Qe(m){try{const f=await se().importBuiltin(m);return f.success&&(await te(),await ie()),f}catch(f){return{success:!1,error:String(f)}}}async function ot(m){try{const f=await se().reimport(m);return f.success&&(await te(),await ie()),f}catch(f){return{success:!1,error:String(f)}}}async function at(m){try{const f=await se().create(m);return f.success&&await te(),f}catch(f){return{success:!1,error:String(f)}}}async function Ye(m){try{const f=se(),R=await f.getConfig(m);if(!R)return{success:!1,error:"Assistant not found"};const{id:H,builtinId:$e,...Be}=R,ze=await f.create({...Be,name:`${R.name}${Vt.global.t("ai.assistant.duplicateSuffix")}`});return ze.success&&await te(),ze}catch(f){return{success:!1,error:String(f)}}}async function it(m){try{const f=await se().delete(m);return f.success&&await te(),f}catch(f){return{success:!1,error:String(f)}}}return{assistants:e,selectedAssistantId:s,selectedAssistant:D,isLoaded:o,builtinCatalog:g,builtinToolCatalog:b,cloudCatalog:C,cloudLoading:w,cloudError:M,cloudCatalogWithStatus:Z,currentChatType:q,currentLocale:W,filteredAssistants:O,defaultAssistants:re,moreAssistants:$,hasMoreAssistants:L,loadAssistants:te,loadBuiltinCatalog:ie,loadBuiltinToolCatalog:be,fetchCloudCatalog:he,importFromCloud:j,isCloudItemImported:qe,selectAssistant:Oe,clearSelection:le,setFilterContext:Ae,getAssistantConfig:_e,updateAssistant:I,createAssistant:at,duplicateAssistant:Ye,resetAssistant:h,checkDefaultAssistantUpgrade:P,skipAssistantUpgrade:ce,upgradeAssistantWithBackup:we,importAssistant:Qe,reimportAssistant:ot,deleteAssistant:it}}),Pt=Ot,os={"zh-CN":"cn","zh-TW":"cn","en-US":"en","ja-JP":"ja"},as=ht("skill",()=>{const e=z([]),s=z(null),o=z(!1),c=z([]),i=z([]),g=z(!1),b=z(null),C=z("group"),w=z("zh-CN");function M(){const I=w.value.startsWith("zh");return{id:Ve,name:I?"绘图助手":"Chart Assistant",description:I?"按本轮问题生成灵活的聊天数据图表":"Generate flexible charts for this chat question",tags:[I?"图表":"chart"],chatScope:"all",tools:["render_chart","get_schema"],builtinId:Ve}}const q=ae(()=>s.value?s.value===Ve?M():e.value.find(I=>I.id===s.value)??null:null),W=ae(()=>M()),D=ae(()=>e.value.filter(I=>I.chatScope==="all"||I.chatScope===C.value)),O=ae(()=>{const h=$t().selectedAssistant,P=[W.value,...D.value];return h?P.filter(ce=>(ce.tools.length,!0)):P}),G=ae(()=>{const I={};for(const h of O.value){const P=h.tags[0]||"other";I[P]||(I[P]=[]),I[P].push(h)}return I}),re=ae(()=>{const I=new Set(e.value.map(h=>h.id));return i.value.map(h=>({...h,imported:I.has(h.id)}))});function $(I,h){C.value=I,h&&(w.value=h)}async function L(){try{e.value=await Te().getAll(),o.value=!0}catch(I){console.error("[SkillStore] Failed to load skills:",I)}}async function Z(){try{c.value=await Te().getBuiltinCatalog()}catch(I){console.error("[SkillStore] Failed to load builtin catalog:",I)}}async function Ae(){const I=os[w.value]??"en",h=`${Pt}/${I}/skill.json`;g.value=!0,b.value=null;try{const P=await rt().fetchRemoteConfig(h);if(!P.success||!P.data){b.value=P.error||"Failed to fetch cloud catalog",i.value=[];return}const ce=P.data;if(!Array.isArray(ce)){b.value="Invalid catalog format",i.value=[];return}i.value=ce.filter(we=>we.id&&we.name&&we.path)}catch(P){b.value=String(P),i.value=[]}finally{g.value=!1}}async function te(I){const h=`${Pt}${I.path}`;try{const P=await rt().fetchRemoteConfig(h);if(!P.success||typeof P.data!="string")return{success:!1,error:P.error||"Failed to fetch skill content"};const ce=await Te().importFromMd(P.data);return ce.success&&await L(),ce}catch(P){return{success:!1,error:String(P)}}}function ie(I){return e.value.some(h=>h.id===I)}function be(I){s.value=I}async function he(I){if(I===Ve)return{...M(),prompt:"",builtinId:Ve};try{return await Te().getConfig(I)}catch(h){return console.error("[SkillStore] Failed to get skill config:",h),null}}async function j(I,h){try{const P=await Te().update(I,h);return P.success&&await L(),P}catch(P){return{success:!1,error:String(P)}}}async function qe(I){try{const h=await Te().create(I);return h.success&&await L(),h}catch(h){return{success:!1,error:String(h)}}}async function Oe(I){try{const h=await Te().delete(I);return h.success&&(s.value===I&&(s.value=null),await L()),h}catch(h){return{success:!1,error:String(h)}}}async function le(I){try{const h=await Te().importBuiltin(I);return h.success&&(await L(),await Z()),h}catch(h){return{success:!1,error:String(h)}}}async function _e(I){try{const h=await Te().reimport(I);return h.success&&(await L(),await Z()),h}catch(h){return{success:!1,error:String(h)}}}return{skills:e,activeSkillId:s,builtinCatalog:c,isLoaded:o,currentChatType:C,currentLocale:w,activeSkill:q,scopedSkills:D,compatibleSkills:O,groupedSkills:G,cloudCatalog:i,cloudLoading:g,cloudError:b,cloudCatalogWithStatus:re,setFilterContext:$,loadSkills:L,loadBuiltinCatalog:Z,fetchCloudCatalog:Ae,importFromCloud:te,isCloudItemImported:ie,activateSkill:be,getSkillConfig:he,updateSkill:j,createSkill:qe,deleteSkill:Oe,importSkill:le,reimportSkill:_e}});async function zt(e){const{url:s,method:o="POST",headers:c={},body:i,signal:g,onEvent:b}=e,C=await Gt(s,{method:o,headers:{"Content-Type":"application/json",...c},body:i!=null?JSON.stringify(i):void 0,signal:g});if(!C.ok){const D=await C.text().catch(()=>"");throw new Error(`SSE request failed: HTTP ${C.status} ${D}`)}if(!C.body)throw new Error("SSE response has no body");const w=C.body.getReader(),M=new TextDecoder;let q="",W="";for(;;){const{done:D,value:O}=await w.read();if(D)break;q+=M.decode(O,{stream:!0});const G=q.split(`
5
+ `);q=G.pop()||"";for(const re of G)re.startsWith("event: ")?W=re.slice(7).trim():re.startsWith("data: ")&&(b({event:W,data:re.slice(6)}),W="")}q.trim()&&q.startsWith("data: ")&&b({event:W,data:q.slice(6)})}function xs(){return{async chatStream(e,s,o){let c;try{return await zt({url:"/_web/ai/llm/chat-stream",body:{messages:e,options:s},onEvent:({data:i})=>{try{const g=JSON.parse(i);g.finishReason==="error"&&g.error&&(c=g.error),o?.(g)}catch{}}}),c?{success:!1,error:c}:{success:!0}}catch(i){const g=i instanceof Error?i.message:String(i);return{success:!1,error:c??g}}}}}const Fe=new Map;function dt(){return{runStream(e,s){const o=Date.now();Ct("ai_request_started");const c=new AbortController,i=`local_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;Fe.set(i,{serverId:"",abortController:c});const b=new Promise(C=>{let w="";const M=[];let q=0,W,D=!1,O;zt({url:"/_web/ai/agent/stream",body:e,signal:c.signal,onEvent:({event:G,data:re})=>{try{const $=JSON.parse(re);if(G==="meta"){const Z=Fe.get(i);Z&&(Z.serverId=$.requestId??"");return}const L=$;switch(s?.(L),L.type){case"content":L.content&&(w+=L.content);break;case"tool_start":L.toolName&&M.push(L.toolName);break;case"status":L.status&&(q=L.status.round);break;case"done":L.usage&&(W=L.usage);break;case"error":D=!0,O=L.error;break}}catch{}}}).then(()=>{Fe.delete(i),C({success:!D,result:{content:w,toolsUsed:M,toolRounds:q,totalUsage:W},...D&&O?{error:O}:{}})}).catch(G=>{Fe.delete(i),c.signal.aborted?C({success:!1,result:{content:w,toolsUsed:M,toolRounds:q,aborted:!0}}):C({success:!1,error:{name:"FetchError",message:G.message??String(G),stack:null}})})}).then(C=>(Ct("ai_request_completed",{success:C.success,duration_ms:Date.now()-o,...C.success?{}:{failure_reason:C.result?.aborted?"aborted":C.error?.name==="FetchError"?"network":"unknown"}}),C));return{requestId:i,promise:b}},async abort(e){const s=Fe.get(e);if(!s)return{success:!1,error:"Request not found"};if(s.abortController.abort(),s.serverId)try{const{post:o}=await Qt(async()=>{const{post:c}=await import("./index-DnpnIyle.js").then(i=>i.dW);return{post:c}},__vite__mapDeps([0,1,2]));await o("/ai/agent/abort",{requestId:s.serverId})}catch{}return Fe.delete(e),{success:!0}}}}function is(e){return e.desensitize&&!e.desensitizeRules.some(s=>s.builtin)}function ls(e){if(e.dataCleaning||e.mergeConsecutive||e.blacklistKeywords.length>0||e.denoise||e.desensitize||e.anonymizeNames)return{dataCleaning:e.dataCleaning,mergeConsecutive:e.mergeConsecutive,mergeWindowSeconds:e.mergeWindowSeconds,blacklistKeywords:[...e.blacklistKeywords],denoise:e.denoise,desensitize:e.desensitize,desensitizeRules:e.desensitizeRules.map(o=>({...o,locales:[...o.locales]})),anonymizeNames:e.anonymizeNames}}function me(e){return e==="render_chart"}function cs(e,s,o){if(!e||!me(e))return null;const c=e;return{type:"tool",tool:{name:c,displayName:c,status:"running",params:s,toolCallId:o,transient:!0}}}function St(e,s,o){if(!ne(e))return!1;const c=e;return c.type!=="tool"||!c.tool||c.tool.transient!==!0||c.tool.name!==s||o&&c.tool.toolCallId!==o?!1:me(String(c.tool.name))}function us(e,s,o){let c=!1;const i=[...e];for(let g=i.length-1;g>=0;g--)if(St(i[g],s,o)){i.splice(g,1),c=!0;break}return c?i:[...e]}function ne(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function xt(e){return ne(e)&&e.version===1&&ne(e.spec)&&ne(e.dataset)}function kt(e){if(!ne(e))return[];const s=ne(e.details)?e.details:e,o=[];if(xt(s.chart)&&o.push(s.chart),Array.isArray(s.charts))for(const c of s.charts)xt(c)&&o.push(c);return o}function Wt(e){return{...e,dataset:{...e.dataset,rows:[]}}}function jt(e){return e.map(s=>({type:"chart",chart:Wt(s)}))}function yt(e){return Array.isArray(e)?`[${e.map(yt).join(",")}]`:ne(e)?`{${Object.keys(e).sort().map(s=>`${JSON.stringify(s)}:${yt(e[s])}`).join(",")}}`:JSON.stringify(e)}function Et(e){const s=Wt(e);return yt({spec:s.spec,columns:s.dataset.columns,data:s.data,rowCount:s.rowCount,truncated:s.truncated})}function ds(e,s){const o=Et(s);return e.some(c=>{if(!ne(c))return!1;const i=c;return i.type==="chart"&&i.chart?Et(i.chart)===o:!1})}function fs(e,s,o,c){const i=[...e];let g=-1;for(let M=i.length-1;M>=0;M--)if(St(i[M],s,o)){g=M;break}const b=g>=0?i.filter((M,q)=>q!==g):i,C=c.filter(M=>!ds(b,M)),w=jt(C);return g>=0?(i.splice(g,1,...w),i):[...i,...w]}function ps(e,s,o,c,i){if(c.length>0)return fs(e,s,o,c);if(i){let b=!1;const C=e.map(w=>{if(!St(w,s,o))return w;b=!0;const M={...w.tool};return delete M.transient,{...w,tool:{...M,status:"error",result:i.error.message,displayResult:i.error.message,isError:!0}}});return b?C:[...e,i]}return us(e,s,o)}function Es(e,s,o){const c=e[s];return!ne(c)||c.type!=="error"||!ne(c.error)||c.error.name!=="ChartRenderError"?!1:o?.isStreaming?!0:e.slice(s+1).some(i=>ne(i)&&i.type==="chart")}function gs(e){return ne(e)?typeof e.error=="string"?e.error:ne(e.error)&&typeof e.error.message=="string"?e.error.message:Array.isArray(e.content)?e.content.map(s=>ne(s)&&s.type==="text"&&typeof s.text=="string"?s.text:"").join(`
6
+ `).trim():null:null}function Nt(e,s){if(!me(e)||kt(s).length>0)return null;const o=gs(s);if(!o)return null;const i=/^Error:\s*(.+)$/is.exec(o)?.[1]?.trim();return!i||/^Call get_schema before render_chart\b/i.test(i)?null:{type:"error",error:{name:"ChartRenderError",message:i,stack:null}}}function nt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ft(e){return nt(e)&&e.version===1&&typeof e.query=="string"&&Array.isArray(e.groups)}function _t(e){if(!nt(e))return null;const s=nt(e.details)?e.details:null;if(s&&ft(s.evidence))return s.evidence;const o=nt(e.data)?e.data:null;return o&&ft(o.evidence)?o.evidence:ft(e.evidence)?e.evidence:null}function ms(e){return{type:"evidence",evidence:e}}function Ge(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pt(e){return Ge(e)?e.version===1&&typeof e.query=="string"&&Array.isArray(e.sources)&&Ge(e.coverage):!1}function ks(e){if(!Ge(e))return null;const s=Ge(e.details)?e.details:null;if(s&&pt(s.crossChatEvidence))return s.crossChatEvidence;const o=Ge(e.data)?e.data:null;return o&&pt(o.crossChatEvidence)?o.crossChatEvidence:pt(e.crossChatEvidence)?e.crossChatEvidence:null}function ys(e){return{type:"cross_chat_evidence",evidence:e}}function Dt(e){return JSON.parse(JSON.stringify(e))}function vt(e){return JSON.parse(JSON.stringify(e))}function Ht(e){return e?.type==="plan_draft"&&typeof e.text=="string"}function Is(e,s){const o=e.map(vt),c=o[o.length-1];return Ht(c)?c.text+=s:o.push({type:"plan_draft",version:1,status:"streaming",text:s}),o}function Ts(e,s){const o=e.map(vt);for(let c=o.length-1;c>=0;c--){const i=o[c];if(Ht(i)){const g=i.text.trim();return o[c]={...Dt(s),...g?{displayText:g}:{}},o}}return o.push(Dt(s)),o}function hs(e){return e.filter(s=>s.type!=="plan_draft").map(vt)}function Ss(e){if(e)for(let s=e.length-1;s>=0;s-=1){const o=e[s];if(o.type==="text"&&o.processDurationMs!==void 0)return o.processDurationMs}}function Ke(e,s){if(!e)return;const o=e.findLastIndex(c=>c.type==="text");return o<0?e:e.map((c,i)=>i===o&&c.type==="text"?{...c,processDurationMs:s}:c)}function Ut(e){if(!e)return;const s=JSON.parse(JSON.stringify(e));for(const o of s)o.type==="tool"&&delete o.tool.displayResult;return s}function gt(e){return e.toolCallId?`id:${e.toolCallId}`:`name:${e.name}`}function Lt(){const e=new Map;let s=null;const o=()=>{if(s){const i=e.get(s);if(i)return i}const c=Array.from(e.entries()).at(-1);return s=c?.[0]??null,c?.[1]??null};return{start(c){const i=gt(c),g={name:c.name,displayName:c.name,status:"running",toolCallId:c.toolCallId};return e.set(i,g),s=i,g},update(c){const i=gt(c),g=e.get(i);if(!g)return o();const b={...g,progress:c.progress};return e.set(i,b),s=i,b},finish(c){const i=gt(c),g=e.get(i);e.delete(i),s===i&&(s=null);const b=o();return b||(g?{...g,status:c.status}:null)},current(){return o()},clear(){e.clear(),s=null}}}function vs(e,s){if(!e.isStreaming)return null;const o=e.contentBlocks?[...e.contentBlocks]:[];let c=e.content,i=!1;for(const g of s){const b=o[o.length-1];if(g.type==="content"){if(g.content.trim().length===0&&b?.type!=="text")continue;b?.type==="text"?b.text=(b.text||"")+g.content:o.push({type:"text",text:g.content}),c+=g.content,i=!0;continue}const C=g.thinkTag||"think";b?.type==="think"&&b.tag===C?(b.text=(b.text||"")+g.content,i=!0):g.content.trim().length>0&&(o.push({type:"think",tag:C,text:g.content}),i=!0)}return i?{content:c,contentBlocks:o}:{content:e.content,contentBlocks:e.contentBlocks||[]}}function Cs(){return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?{request:e=>requestAnimationFrame(e),cancel:e=>cancelAnimationFrame(e)}:{request:e=>setTimeout(e,16),cancel:e=>clearTimeout(e)}}function As(e,s=Cs()){let o=null,c=[];function i(){if(o!==null&&(s.cancel(o),o=null),c.length===0)return;const C=c;c=[],e(C)}function g(C){const w=c[c.length-1];w?.type==="content"&&C.type==="content"||w?.type==="think"&&C.type==="think"&&w.thinkTag===C.thinkTag?w.content+=C.content:c.push({...C}),o===null&&(o=s.request(()=>{o=null,i()}))}function b(){o!==null&&(s.cancel(o),o=null),c=[]}return{push:g,flush:i,cancel:b}}const ge="__draft__";function bs(e){return e?`${e.startTs}_${e.endTs}`:"all"}function ws(e){return e.kind==="global"?"global":`${e.sessionId}:${e.chatType}:${bs(e.timeFilter)}`}function It(){return{promptTokens:0,completionTokens:0,totalTokens:0,cacheReadTokens:0,cacheWriteTokens:0}}function Ft(e){return{promptTokens:e.promptTokens??0,completionTokens:e.completionTokens??0,totalTokens:e.totalTokens??0,cacheReadTokens:e.cacheReadTokens??0,cacheWriteTokens:e.cacheWriteTokens??0}}function et(e){if(e&&typeof e=="object"){const s=e;return{name:typeof s.name=="string"?s.name:null,message:typeof s.message=="string"?s.message:"未知错误",stack:typeof s.stack=="string"?s.stack:null,statusCode:typeof s.statusCode=="number"?s.statusCode:null,url:typeof s.url=="string"?s.url:null,responseBody:typeof s.responseBody=="string"?s.responseBody:null,responseHeaders:s.responseHeaders&&typeof s.responseHeaders=="object"?s.responseHeaders:null,requestBody:typeof s.requestBody=="string"?s.requestBody:null,cause:typeof s.cause=="string"?s.cause:null,provider:typeof s.provider=="string"?s.provider:null,friendlyMessage:typeof s.friendlyMessage=="string"?s.friendlyMessage:null}}return{name:null,message:e?String(e):"未知错误",stack:null}}function tt(e){const s=e.contentBlocks;return{id:e.id,role:e.role,content:e.content,timestamp:e.timestamp*1e3,parentId:e.parentId,contentBlocks:s,processDurationMs:Ss(s),entityRefs:e.entityRefs}}function Tt(e=null){return{messages:[],sourceMessages:[],currentKeywords:[],assistantId:e,loaded:!1}}function Bs(e){const s=Tt(null);return{kind:e.kind??"session",sessionId:e.sessionId,sessionName:e.sessionName,chatType:e.chatType,locale:e.locale,timeFilter:e.timeFilter,selectedAssistantId:null,messages:s.messages,sourceMessages:s.sourceMessages,currentKeywords:s.currentKeywords,isLoadingSource:!1,isAIThinking:!1,currentAIChatId:null,currentToolStatus:null,toolsUsedInCurrentRound:[],sessionTokenUsage:It(),agentStatus:null,ownerInfo:void 0,ownerInfoInitialized:!1,isAborted:!1,currentRequestId:"",currentAgentRequestId:"",aiChatBuffers:{[ge]:s}}}function mt(e){return e.currentAIChatId??ge}const Ns=ht("aiChatRuntime",()=>{const e=z({}),s=z(null),o=ts(),c=Yt(),i=Zt(),g=$t(),b=as(),C=Xt(),{aiGlobalSettings:w}=Kt(o);let M=null;const q=new Map;function W(n){const t=(q.get(n)??0)+1;return q.set(n,t),t}function D(n,t){return q.get(n)===t}function O(n){return`${n}_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function G(n){const t=ws(n),a=e.value[t];if(a)return a.sessionName=n.sessionName,a.chatType=n.chatType,a.locale=n.locale,a.timeFilter=n.timeFilter,{chatKey:t,state:a};const r=Bs(n);e.value[t]=r;const u=e.value[t];return be(t),{chatKey:t,state:u}}function re(n){return G({kind:"global",sessionId:"",sessionName:"Global AI analysis",chatType:"group",locale:n})}function $(n){return e.value[n]??null}function L(){return s.value?$(s.value.chatKey):null}function Z(n,t,a=null){return n.aiChatBuffers[t]||(n.aiChatBuffers[t]=Tt(a)),n.aiChatBuffers[t]}function Ae(n,t){const a=n.currentAIChatId??ge,r=n.aiChatBuffers[a];r&&(r.sessionTokenUsage={...n.sessionTokenUsage});const u=Z(n,t);n.currentAIChatId=t===ge?null:t,n.messages=u.messages,n.sourceMessages=u.sourceMessages,n.currentKeywords=u.currentKeywords,n.selectedAssistantId=u.assistantId,n.sessionTokenUsage=u.sessionTokenUsage?{...u.sessionTokenUsage}:It(),n.agentStatus=null}function te(n,t,a){const r=Z(n,t);return n.aiChatBuffers[a]=r,t!==a&&delete n.aiChatBuffers[t],n.currentAIChatId===null&&t===ge&&(n.currentAIChatId=a),r}function ie(n){const t=$(n);t&&(t.selectedAssistantId?g.selectAssistant(t.selectedAssistantId):g.clearSelection())}async function be(n){const t=$(n);if(!t||t.kind==="global")return;const r=c.sessions.find(u=>u.id===t.sessionId)?.ownerId;if(!r){t.ownerInfo=void 0,t.ownerInfoInitialized=!0;return}if(!(t.ownerInfoInitialized&&t.ownerInfo?.platformId===r))try{const v=(await At().getMembers(t.sessionId)).find(p=>p.platformId===r);t.ownerInfo=v?{platformId:r,displayName:v.groupNickname||v.accountName||r}:{platformId:r,displayName:r},t.ownerInfoInitialized=!0}catch(u){console.error("[AI] 获取 Owner 信息失败:",u),t.ownerInfo=void 0,t.ownerInfoInitialized=!0}}function he(n,t,a,r=null){const u=$(n);u&&(s.value={requestId:a,kind:u.kind,chatKey:n,sessionId:u.sessionId,sessionName:u.sessionName,chatType:u.chatType,aiChatId:r,questionPreview:t.trim().slice(0,80),startedAt:Date.now()})}function j(n,t){s.value&&s.value.chatKey===n&&(t&&s.value.requestId!==t||(s.value=null))}function qe(n,t){s.value&&s.value.chatKey===n&&(s.value.aiChatId=t)}function Oe(n){return{phase:"preparing",round:0,toolsUsed:n.toolsUsedInCurrentRound.length,contextTokens:0,totalUsage:{...n.sessionTokenUsage},updatedAt:Date.now()}}function le(n,t,a){const r=n.agentStatus?{...n.agentStatus}:Oe(n);n.agentStatus={...r,...a,phase:t,updatedAt:Date.now()}}function _e(n,t){const a=$(n);if(!a||a.isAIThinking)return!1;const r=Z(a,mt(a),t);return r.assistantId=t,a.selectedAssistantId=t,g.selectAssistant(t),!0}async function I(n,t,a){const r=$(n);if(!r||!D(n,a))return!1;try{const u=await ke().getAIChat(t);if(!D(n,a))return!1;const v=u?.kind===r.kind&&(r.kind==="global"||u.sessionId===r.sessionId);if(!u||!v)return!1;const p=Z(r,t,u.assistantId);if(!p.loaded){const[T,A]=await Promise.all([ke().getMessages(t),ke().getAIChatTokenUsage(t)]);if(!D(n,a))return!1;p.messages.splice(0,p.messages.length,...T.map(B=>tt(B))),p.sourceMessages.splice(0,p.sourceMessages.length),p.currentKeywords.splice(0,p.currentKeywords.length),p.sessionTokenUsage=Ft(A),p.loaded=!0}return D(n,a)?(p.assistantId=u.assistantId,Ae(r,t),ie(n),!0):!1}catch(u){return D(n,a)&&console.error("[AI] 加载对话历史失败:",u),!1}}async function h(n,t){return $(n)?I(n,t,W(n)):!1}function P(n,t){const a=$(n);if(!a)return!1;const r=t??ge;return a.aiChatBuffers[r]?(W(n),Ae(a,r),ie(n),!0):!1}function ce(){if(!s.value)return!1;const n=s.value,t=P(n.chatKey,n.aiChatId);return M=t&&n.kind==="session"?n.chatKey:null,t}async function we(n,t){const a=M===n;if(M=null,a)return;const r=$(n);if(!r||r.isAIThinking)return;const u=W(n);if(!(!g.isLoaded&&(await g.loadAssistants(),!D(n,u)))&&!(t&&(await I(n,t,u)||!D(n,u)))){try{const v=(await ke().getAIChats(r.sessionId))[0];if(!D(n,u)||v&&v.id!==t&&(await I(n,v.id,u)||!D(n,u)))return}catch(v){if(!D(n,u))return;console.error("[AI] Failed to load the latest conversation:",v)}if(D(n,u)){if(!r.selectedAssistantId){const v=st(r.locale);_e(n,v)}Qe(n)}}}function Qe(n,t){const a=$(n);if(!a||a.isAIThinking)return!1;W(n);const r=Tt(a.selectedAssistantId);return a.aiChatBuffers[ge]=r,Ae(a,ge),a.currentToolStatus=null,a.toolsUsedInCurrentRound=[],a.isLoadingSource=!1,a.sessionTokenUsage=It(),a.agentStatus=null,a.isAborted=!1,a.currentRequestId="",a.currentAgentRequestId="",t&&r.messages.push({id:O("welcome"),role:"assistant",content:t,timestamp:Date.now()}),!0}async function ot(){}async function at(){}function Ye(n,t){let a;const r=y=>{const S=t();n.messages[S]={...n.messages[S],...y}},u=(y,S,k)=>{const N=t(),x=n.messages[N].contentBlocks||[],K=S||"think",J=x[x.length-1];let F=J;if(J&&J.type==="think"&&J.tag===K)J.text+=y;else if(y.trim().length>0)F={type:"think",tag:K,text:y},x.push(F);else if(k!==void 0)for(let V=x.length-1;V>=0;V--){const ve=x[V];if(ve.type==="think"&&ve.tag===K){F=ve;break}}k!==void 0&&F&&F.type==="think"&&(F.durationMs=k),r({contentBlocks:[...x]})},v=As(y=>{const S=t(),k=n.messages[S],N=vs(k,y);N&&r({content:N.content,contentBlocks:N.contentBlocks})}),p=()=>v.flush(),T=()=>v.cancel(),A=y=>{p(),r(y)};return{updateAIMessage:A,appendTextToBlocks:y=>{y&&(y.trim().length>0&&a===void 0&&(a=Date.now()),v.push({type:"content",content:y}))},appendThinkToBlocks:(y,S,k)=>{!y&&k===void 0||(y&&v.push({type:"think",content:y,thinkTag:S}),k!==void 0&&(p(),u("",S,k)))},appendChartsToBlocks:y=>{if(y.length===0)return;p();const S=t(),k=n.messages[S].contentBlocks||[];k.push(...jt(y)),A({contentBlocks:[...k]})},appendEvidenceToBlocks:y=>{p();const S=t(),k=n.messages[S].contentBlocks||[];k.push(ms(y)),A({contentBlocks:[...k]})},appendCrossChatEvidenceToBlocks:y=>{p();const S=t(),k=n.messages[S].contentBlocks||[];k.push(ys(y)),A({contentBlocks:[...k]})},appendPlanDraftToBlocks:y=>{if(!y)return;p();const S=t(),k=n.messages[S].contentBlocks||[];A({contentBlocks:[...Is(k,y)]})},appendPlanToBlocks:y=>{p();const S=t(),k=n.messages[S].contentBlocks||[];A({contentBlocks:[...Ts(k,y)]})},removePlanDraftsFromBlocks:()=>{p();const y=t(),S=n.messages[y].contentBlocks||[];A({contentBlocks:[...hs(S)]})},updatePlanBlockStatus:y=>{p();const S=t(),k=n.messages[S].contentBlocks||[];for(let N=k.length-1;N>=0;N--){const x=k[N];if(x.type==="plan"){x.status=y;break}}A({contentBlocks:[...k]})},appendErrorToBlocks:y=>{p();const S=t(),k=n.messages[S].contentBlocks||[];k.push({type:"error",error:y}),A({contentBlocks:[...k]})},addToolBlock:(y,S,k)=>{p();const N=t(),x=n.messages[N].contentBlocks||[];x.push({type:"tool",tool:{name:y,displayName:y,status:"running",params:S,toolCallId:k}}),A({contentBlocks:[...x]})},addRenderOnlyToolPendingBlock:(y,S,k)=>{const N=cs(y,S,k);if(!N)return;p();const x=t(),K=n.messages[x].contentBlocks||[];K.push(N),A({contentBlocks:[...K]})},updateRenderOnlyToolResult:(y,S,k,N)=>{p();const x=t(),K=n.messages[x].contentBlocks||[];A({contentBlocks:ps(K,y,S,k,N)})},updateToolBlockStatus:(y,S,k)=>{p();const N=t(),x=n.messages[N].contentBlocks||[],K=F=>F.type==="tool"&&F.tool.status==="running";let J;if(k?.toolCallId)for(let F=x.length-1;F>=0;F--){const V=x[F];if(K(V)&&V.tool.toolCallId===k.toolCallId){J=V;break}}if(!J)for(let F=x.length-1;F>=0;F--){const V=x[F];if(K(V)&&V.tool.name===y){J=V;break}}J&&(J.tool.status=S,k?.result!==void 0&&(J.tool.result=k.result),k?.displayResult!==void 0&&(J.tool.displayResult=k.displayResult),k?.isError!==void 0&&(J.tool.isError=k.isError)),A({contentBlocks:[...x]})},completeTurn:y=>{p();const S=a;if(a=void 0,y||S===void 0)return;const k=t(),N=n.messages[k];if(!N||N.processDurationMs!==void 0)return;const x=Math.max(0,S-N.timestamp);r({processDurationMs:x,contentBlocks:Ke(N.contentBlocks,x)})},settleProcessDuration:()=>{p();const y=t(),S=n.messages[y];if(!S||S.processDurationMs!==void 0)return;const k=Math.max(0,Date.now()-S.timestamp);r({processDurationMs:k,contentBlocks:Ke(S.contentBlocks,k)})},flushPendingText:p,discardPendingText:T}}async function it(n,t,a){const r=$(n);if(!r)return{success:!1,reason:"error"};if(!t.trim())return{success:!1,reason:"empty"};if(r.isAIThinking||s.value)return{success:!1,reason:"busy",activeTask:s.value};const u=O("req"),v=mt(r);let p=v===ge?null:v;const T=Z(r,v,r.selectedAssistantId);let A,B;const Q=new Set;let Y=null;T.assistantId=r.selectedAssistantId,T.loaded=!0,he(n,t,u,p),ie(n),r.kind==="session"&&be(n);const ue=r.kind==="session"?b.activeSkillId:null,ye=r.kind==="session"?b.activeSkill?.name:null,De=w.value.enableAutoSkill??!0,Ze=De?w.value.chartAutoMode??"suggest":"explicit",We=(a?.mentionedMembers??[]).map(E=>({memberId:E.memberId,platformId:E.platformId,displayName:E.displayName,aliases:[...E.aliases],mentionText:E.mentionText})),X=(a?.entityRefs??[]).map(E=>({...E}));r.isAIThinking=!0,r.isLoadingSource=!0,r.currentToolStatus=null,r.toolsUsedInCurrentRound=[],r.agentStatus=null,r.isAborted=!1,r.currentRequestId=u,r.currentAgentRequestId="";try{const E=await bt().hasConfig();if(r.isAborted)return j(n,u),{success:!1,reason:"aborted"};if(r.currentRequestId!==u)return j(n,u),{success:!1,reason:"busy",activeTask:s.value};if(!E)return T.messages.push({id:O("error"),role:"assistant",content:"⚠️ 请先配置 AI 服务。点击左下角「设置」按钮前往「模型配置Tab」进行配置。",timestamp:Date.now()}),j(n,u),{success:!1,reason:"no_config"};const _={id:O("user"),role:"user",content:t,timestamp:Date.now(),toolCalls:[],entityRefs:X};A=_,T.messages.push(_);const Re={id:O("ai"),role:"assistant",content:"",timestamp:Date.now(),isStreaming:!0,contentBlocks:[]};ue&&ye&&Re.contentBlocks.push({type:"skill",skillId:ue,skillName:ye}),T.messages.push(Re);try{a?.onAccepted?.()}catch(l){console.error("[AI] Failed to acknowledge accepted user message:",l)}let U=T.messages.length-1,de=!1;const oe=Lt(),{updateAIMessage:Se,appendTextToBlocks:y,appendThinkToBlocks:S,appendChartsToBlocks:k,appendEvidenceToBlocks:N,appendCrossChatEvidenceToBlocks:x,appendPlanDraftToBlocks:K,appendPlanToBlocks:J,removePlanDraftsFromBlocks:F,updatePlanBlockStatus:V,appendErrorToBlocks:ve,addToolBlock:je,addRenderOnlyToolPendingBlock:lt,updateRenderOnlyToolResult:fe,updateToolBlockStatus:Me,completeTurn:Xe,settleProcessDuration:Pe,flushPendingText:Ue,discardPendingText:xe}=Ye(T,()=>U),Ie=T.assistantId??st(r.locale);if(!p){const l=t.slice(0,50)+(t.length>50?"...":""),d=r.kind==="global"?await ke().createGlobalAIChat(l,Ie):await ke().createAIChat(r.sessionId,l,Ie);if(r.isAborted)return Pe(),Se({isStreaming:!1}),j(n,u),{success:!1,reason:"aborted"};if(r.currentRequestId!==u)return Pe(),Se({isStreaming:!1}),j(n,u),{success:!1,reason:"busy",activeTask:s.value};p=d.id,te(r,ge,d.id),T.assistantId=Ie,qe(n,d.id)}const Ee={sessionId:r.sessionId,aiChatId:p,timeFilter:r.timeFilter?{startTs:r.timeFilter.startTs,endTs:r.timeFilter.endTs}:void 0,maxMessagesLimit:w.value.maxMessagesPerRequest,ownerInfo:r.ownerInfo?{platformId:r.ownerInfo.platformId,displayName:r.ownerInfo.displayName}:void 0,mentionedMembers:We.length>0?We:void 0,preprocessConfig:await f(),searchContextBefore:w.value.searchContextBefore,searchContextAfter:w.value.searchContextAfter},{requestId:pe,promise:ct}=dt().runStream({userMessage:t,chatKind:r.kind,sessionId:r.kind==="session"?r.sessionId:void 0,entityRefs:r.kind==="global"&&X.length>0?X:void 0,aiChatId:p,timeFilter:Ee.timeFilter,maxMessagesLimit:Ee.maxMessagesLimit,ownerInfo:r.kind==="session"?Ee.ownerInfo:void 0,mentionedMembers:r.kind==="session"?Ee.mentionedMembers:void 0,preprocessConfig:Ee.preprocessConfig,chatType:r.chatType,locale:r.locale,assistantId:Ie,skillId:r.kind==="session"?ue:void 0,enableAutoSkill:r.kind==="session"&&!ue?De:void 0,chartAutoMode:r.kind==="session"&&!ue?Ze:void 0,thinkingLevel:(()=>{const l=C.defaultAssistant;if(!(!l?.configId||!l?.modelId))return o.getThinkingLevel(l.configId,l.modelId)})()},l=>{if(!(r.isAborted||u!==r.currentRequestId))switch(l.type){case"content":l.content&&(r.currentToolStatus=oe.current(),y(l.content));break;case"think":l.content?S(l.content,l.thinkTag):l.thinkDurationMs!==void 0&&S("",l.thinkTag,l.thinkDurationMs);break;case"tool_start":if(l.toolName){const d=l.toolParams;r.currentToolStatus=oe.start({name:l.toolName,toolCallId:l.toolCallId}),r.toolsUsedInCurrentRound.push(l.toolName),me(l.toolName)?lt(l.toolName,d,l.toolCallId):je(l.toolName,d,l.toolCallId)}break;case"tool_update":Ue(),l.toolName&&l.toolProgress&&(r.currentToolStatus=oe.update({name:l.toolName,toolCallId:l.toolCallId,progress:l.toolProgress}));break;case"tool_result":if(l.toolName){const d=kt(l.toolResult),ee=Nt(l.toolName,l.toolResult);me(l.toolName)?fe(l.toolName,l.toolCallId,d,ee):k(d);const Ne=_t(l.toolResult);Ne&&N(Ne);const He=ks(l.toolResult);He&&x(He),ee&&(me(l.toolName)||ve(ee.error));const Le=ee!==null||l.toolIsError===!0;if(r.currentToolStatus?.name===l.toolName&&(r.currentToolStatus={...r.currentToolStatus,status:Le?"error":"done"}),!me(l.toolName)){const Je=Bt(l.toolResult);Me(l.toolName,Le?"error":"done",{toolCallId:l.toolCallId,result:Rt(Je),displayResult:Je,isError:l.toolIsError})}r.currentToolStatus=oe.finish({name:l.toolName,toolCallId:l.toolCallId,status:Le?"error":"done"})}r.isLoadingSource=!1;break;case"plan_delta":l.planDelta&&K(l.planDelta);break;case"memory_change":l.memoryId&&Q.add(l.memoryId),l.provenanceToken&&(Y=l.provenanceToken);break;case"plan":l.plan&&(J(l.plan),V("executing"));break;case"plan_skipped":F();break;case"turn_end":Xe(!!l.hadToolCalls);break;case"status":Ue(),l.status&&(!r.agentStatus||l.status.updatedAt>=r.agentStatus.updatedAt)&&(r.agentStatus=l.status);break;case"compression_done":if(Ue(),l.compressionResult){const d={id:`summary-${Date.now()}`,role:"summary",content:l.compressionResult.summaryContent,timestamp:l.compressionResult.timestamp},ee=Math.max(0,T.messages.length-2);T.messages.splice(ee,0,d),U++}break;case"done":Pe(),oe.clear(),r.currentToolStatus=null,de||V("done"),l.usage&&(B={...l.usage},r.sessionTokenUsage={promptTokens:r.sessionTokenUsage.promptTokens+l.usage.promptTokens,completionTokens:r.sessionTokenUsage.completionTokens+l.usage.completionTokens,totalTokens:r.sessionTokenUsage.totalTokens+l.usage.totalTokens,cacheReadTokens:r.sessionTokenUsage.cacheReadTokens+l.usage.cacheReadTokens,cacheWriteTokens:r.sessionTokenUsage.cacheWriteTokens+l.usage.cacheWriteTokens}),le(r,de?"error":"completed",l.usage?{totalUsage:l.usage}:void 0);break;case"error":if(Pe(),F(),V("skipped"),r.currentToolStatus&&(r.currentToolStatus={...r.currentToolStatus,status:"error"},Me(r.currentToolStatus.name,"error",{toolCallId:r.currentToolStatus.toolCallId})),oe.clear(),!de){de=!0;const d=T.messages[U].contentBlocks||[];d.push({type:"error",error:et(l.error)}),Se({contentBlocks:[...d],isStreaming:!1})}le(r,"error");break}});r.currentAgentRequestId=pe,he(n,t,pe,p);const Ce=await ct;if(r.isAborted)return xe(),j(n,pe),{success:!1,reason:"aborted"};if(Ue(),u!==r.currentRequestId)return j(n,pe),{success:!1,reason:"busy",activeTask:s.value};if(Ce.success&&Ce.result){T.messages[U]={...T.messages[U],dataSource:{toolsUsed:Ce.result.toolsUsed,toolRounds:Ce.result.toolRounds},isStreaming:!1};const l=await m(p,_,T.messages[U],B,[...Q],Y);if(!l)return{success:!1,reason:"error"};Object.assign(_,l.userMessage),T.messages[U]={...T.messages[U],...l.assistantMessage,isStreaming:!1}}else if(de){const l=await m(p,_,T.messages[U],B,[...Q],Y);if(!l)return{success:!1,reason:"error"};Object.assign(_,l.userMessage),T.messages[U]={...T.messages[U],...l.assistantMessage,isStreaming:!1}}else{le(r,"error");const l=T.messages[U].contentBlocks||[];l.push({type:"error",error:et(Ce.error)}),T.messages[U]={...T.messages[U],contentBlocks:[...l],isStreaming:!1};const d=await m(p,_,T.messages[U],B,[...Q],Y);if(!d)return{success:!1,reason:"error"};Object.assign(_,d.userMessage),T.messages[U]={...T.messages[U],...d.assistantMessage,isStreaming:!1}}return Ce.success?{success:!0}:{success:!1,reason:"error"}}catch(E){console.error("[AI] 处理失败:",E),r.agentStatus=null;const _=T.messages[T.messages.length-1];if(_&&_.role==="assistant"){const Re={name:E instanceof Error?E.name:null,message:E instanceof Error?E.message:String(E),stack:E instanceof Error?E.stack??null:null},U=_.contentBlocks||[];U.push({type:"error",error:Re}),_.contentBlocks=[...U];const de=_.processDurationMs??Math.max(0,Date.now()-_.timestamp);_.processDurationMs=de,_.contentBlocks=Ke(_.contentBlocks,de),_.isStreaming=!1;const oe=A||T.messages.findLast(Se=>Se.role==="user");oe&&await m(p,oe,_,B,[...Q],Y)}return{success:!1,reason:"error"}}finally{r.isAIThinking=!1,r.isLoadingSource=!1,r.currentToolStatus=null,r.isAborted=!1,r.currentRequestId="",r.currentAgentRequestId="",j(n)}}async function m(n,t,a,r,u=[],v=null){try{if(!n)return null;const p=Ut(a.contentBlocks),{userMessage:T,assistantMessage:A}=await ke().addMessagePair(n,{content:t.content,entityRefs:t.entityRefs},{content:a.content,contentBlocks:p,tokenUsage:r});if(u.length>0)try{if(!v)throw new Error("Memory provenance token is missing");await ke().linkAIMemorySources({provenanceToken:v,aiChatId:n,userMessageId:T.id,assistantMessageId:A.id,memoryIds:u})}catch(B){es("AI memory source linking failed",B instanceof Error?B.stack:void 0)}return{userMessage:tt(T),assistantMessage:tt(A)}}catch(p){return console.error("[AI] 保存对话失败:",p),null}}async function f(){const n=i.aiPreprocessConfig;return is(n)&&await i.ensureDesensitizeRules(),ls(i.aiPreprocessConfig)}function R(n){return n.trim().replace(/^[\s"'“”‘’([{<]+|[\s"'“”‘’)\]}>.,!?;:,。!?;:、]+$/g,"").toLocaleLowerCase()}async function H(n,t){const a=new Set;for(const r of t.matchAll(/@([^\s@]+)/g)){const u=R(r[1]??"");u&&a.add(u)}if(a.size===0)return[];try{const r=await At().getMembers(n.sessionId),u=new Map;r.forEach(A=>{const B=A.groupNickname||A.accountName||A.platformId;u.set(B,(u.get(B)??0)+1)});const v=r.map(A=>{const B=A.groupNickname||A.accountName||A.platformId,Q=(u.get(B)??0)>1?`${B}·${A.platformId}`:B,Y=[...A.aliases],ue=[B,A.groupNickname||"",A.accountName||"",A.platformId,Q,...Y].map(R).filter(Boolean);return{memberId:A.id,platformId:A.platformId,displayName:B,aliases:Y,mentionText:`@${Q}`,lookupValues:ue}}),p=[],T=new Set;for(const A of a){const B=v.find(Q=>!T.has(Q.memberId)&&Q.lookupValues.includes(A));B&&(T.add(B.memberId),p.push({memberId:B.memberId,platformId:B.platformId,displayName:B.displayName,aliases:B.aliases,mentionText:B.mentionText}))}return p}catch(r){return console.error("[AI] Failed to resolve mentioned members for edited message:",r),[]}}async function $e(n,t,a){const r=$(n),u=a.trim();if(!r||!r.currentAIChatId)return{success:!1,reason:"error"};if(!u)return{success:!1,reason:"empty"};if(r.isAIThinking||s.value)return{success:!1,reason:"busy",activeTask:s.value};const v=Z(r,r.currentAIChatId,r.selectedAssistantId),p=v.messages.findIndex(Y=>Y.id===t),T=v.messages[p];if(!T||T.role!=="user"||T.isStreaming)return{success:!1,reason:"error"};if(T.content.trim()===u)return{success:!1,reason:"empty"};const A=v.messages.findLastIndex(Y=>Y.role==="user"),B=v.messages.slice(p+1);return p===A&&(B.length===0||B.length===1&&B[0]?.role==="assistant")?Be(n,r,v,p,T,u):{success:!1,reason:"error"}}async function Be(n,t,a,r,u,v){const p=O("req");let T,A=!1;const B=Lt();he(n,v,p,t.currentAIChatId),ie(n),be(n),t.isAIThinking=!0,t.isLoadingSource=!0,t.currentToolStatus=null,t.toolsUsedInCurrentRound=[],t.agentStatus=null,t.isAborted=!1,t.currentRequestId=p,t.currentAgentRequestId="";const Q=a.messages[r+1],Y=Q?.role==="assistant",ue={id:O("ai"),role:"assistant",content:"",timestamp:Date.now(),isStreaming:!0,contentBlocks:[]},ye=b.activeSkillId,De=b.activeSkill?.name;ye&&De&&ue.contentBlocks.push({type:"skill",skillId:ye,skillName:De});const Ze={...u,content:v},We=Y?2:1;a.messages.splice(r,We,Ze,ue);const X=r+1,E=()=>{a.messages.splice(r,a.messages.length-r,u),Y&&a.messages.splice(r+1,0,Q)},{updateAIMessage:_,appendTextToBlocks:Re,appendThinkToBlocks:U,appendChartsToBlocks:de,appendEvidenceToBlocks:oe,appendPlanDraftToBlocks:Se,appendPlanToBlocks:y,removePlanDraftsFromBlocks:S,updatePlanBlockStatus:k,appendErrorToBlocks:N,addToolBlock:x,addRenderOnlyToolPendingBlock:K,updateRenderOnlyToolResult:J,updateToolBlockStatus:F,completeTurn:V,settleProcessDuration:ve,flushPendingText:je,discardPendingText:lt}=Ye(a,()=>X);try{if(!await bt().hasConfig())return E(),j(n,p),{success:!1,reason:"no_config"};const Me=a.assistantId??st(t.locale),Xe=await H(t,v);if(t.isAborted)return E(),j(n,p),{success:!1,reason:"aborted"};if(p!==t.currentRequestId)return E(),j(n,p),{success:!1,reason:"busy",activeTask:s.value};const Pe=w.value.enableAutoSkill??!0,Ue=Pe?w.value.chartAutoMode??"suggest":"explicit",xe={sessionId:t.sessionId,aiChatId:t.currentAIChatId,historyLeafMessageId:u.parentId??null,timeFilter:t.timeFilter?{startTs:t.timeFilter.startTs,endTs:t.timeFilter.endTs}:void 0,maxMessagesLimit:w.value.maxMessagesPerRequest,ownerInfo:t.ownerInfo?{platformId:t.ownerInfo.platformId,displayName:t.ownerInfo.displayName}:void 0,mentionedMembers:Xe.length>0?Xe:void 0,preprocessConfig:await f(),searchContextBefore:w.value.searchContextBefore,searchContextAfter:w.value.searchContextAfter},{requestId:Ie,promise:Ee}=dt().runStream({userMessage:v,sessionId:t.sessionId,aiChatId:t.currentAIChatId,historyLeafMessageId:u.parentId??null,timeFilter:xe.timeFilter,maxMessagesLimit:xe.maxMessagesLimit,ownerInfo:xe.ownerInfo,mentionedMembers:xe.mentionedMembers,preprocessConfig:xe.preprocessConfig,chatType:t.chatType,locale:t.locale,assistantId:Me,skillId:ye,enableAutoSkill:ye?void 0:Pe,chartAutoMode:ye?void 0:Ue,thinkingLevel:(()=>{const d=C.defaultAssistant;if(!(!d?.configId||!d?.modelId))return o.getThinkingLevel(d.configId,d.modelId)})()},d=>{if(!(t.isAborted||p!==t.currentRequestId))switch(d.type){case"content":t.currentToolStatus=B.current(),Re(d.content||"");break;case"think":d.content?U(d.content,d.thinkTag):d.thinkDurationMs!==void 0&&U("",d.thinkTag,d.thinkDurationMs);break;case"tool_start":if(d.toolName){const ee=d.toolParams;t.currentToolStatus=B.start({name:d.toolName,toolCallId:d.toolCallId}),t.toolsUsedInCurrentRound.push(d.toolName),me(d.toolName)?K(d.toolName,ee,d.toolCallId):x(d.toolName,ee,d.toolCallId)}break;case"tool_update":je(),d.toolName&&d.toolProgress&&(t.currentToolStatus=B.update({name:d.toolName,toolCallId:d.toolCallId,progress:d.toolProgress}));break;case"tool_result":if(d.toolName){const ee=kt(d.toolResult),Ne=Nt(d.toolName,d.toolResult),He=Ne!==null||d.toolIsError===!0;me(d.toolName)?J(d.toolName,d.toolCallId,ee,Ne):de(ee);const Le=_t(d.toolResult);if(Le&&oe(Le),Ne&&(me(d.toolName)||N(Ne.error)),!me(d.toolName)){const Je=Bt(d.toolResult);F(d.toolName,He?"error":"done",{toolCallId:d.toolCallId,result:Rt(Je),displayResult:Je,isError:d.toolIsError})}t.currentToolStatus=B.finish({name:d.toolName,toolCallId:d.toolCallId,status:He?"error":"done"})}t.isLoadingSource=!1;break;case"plan_delta":d.planDelta&&Se(d.planDelta);break;case"plan":d.plan&&(y(d.plan),k("executing"));break;case"plan_skipped":S();break;case"turn_end":V(!!d.hadToolCalls);break;case"status":je(),d.status&&(!t.agentStatus||d.status.updatedAt>=t.agentStatus.updatedAt)&&(t.agentStatus=d.status);break;case"done":ve(),B.clear(),t.currentToolStatus=null,A||k("done"),d.usage&&(T={...d.usage}),le(t,A?"error":"completed",d.usage?{totalUsage:d.usage}:void 0);break;case"error":{ve(),S(),k("skipped"),A=!0,t.currentToolStatus&&F(t.currentToolStatus.name,"error",{toolCallId:t.currentToolStatus.toolCallId}),B.clear();const ee=a.messages[X].contentBlocks||[];ee.push({type:"error",error:et(d.error)}),_({contentBlocks:[...ee],isStreaming:!1}),le(t,"error");break}}});t.currentAgentRequestId=Ie,he(n,v,Ie,t.currentAIChatId);const pe=await Ee;if(t.isAborted)return lt(),E(),j(n,Ie),{success:!1,reason:"aborted"};if(je(),p!==t.currentRequestId)return E(),j(n,Ie),{success:!1,reason:"busy",activeTask:s.value};if(pe.success&&pe.result)_({dataSource:{toolsUsed:pe.result.toolsUsed,toolRounds:pe.result.toolRounds},isStreaming:!1});else if(!A){le(t,"error");const d=a.messages[X].contentBlocks||[];d.push({type:"error",error:et(pe.error)}),_({contentBlocks:[...d],isStreaming:!1})}if(!pe.success)return E(),{success:!1,reason:"error"};const ct=Ut(a.messages[X].contentBlocks),Ce=await ke().replaceLatestMessageRound(t.currentAIChatId,{userMessageId:u.id,userContent:v,assistantMessage:{content:a.messages[X].content,contentBlocks:ct,tokenUsage:T}}),l=a.messages[X].processDurationMs;return a.messages[X]={...tt(Ce),dataSource:a.messages[X].dataSource,processDurationMs:l,isStreaming:!1},a.messages[r]={...a.messages[r],content:v},a.sessionTokenUsage=Ft(await ke().getAIChatTokenUsage(t.currentAIChatId)),t.sessionTokenUsage={...a.sessionTokenUsage},{success:!0}}catch(fe){if(t.isAborted)return E(),{success:!1,reason:"aborted"};console.error("[AI] edit and regenerate failed:",fe);const Me=a.messages[X]?.contentBlocks||[];return Me.push({type:"error",error:{name:fe instanceof Error?fe.name:null,message:fe instanceof Error?fe.message:String(fe),stack:fe instanceof Error?fe.stack??null:null}}),a.messages[X]&&_({contentBlocks:[...Me],isStreaming:!1}),{success:!1,reason:"error"}}finally{t.isAIThinking=!1,t.isLoadingSource=!1,t.currentToolStatus=null,t.isAborted=!1,t.currentRequestId="",t.currentAgentRequestId="",j(n)}}async function ze(n){const t=$(n);if(!t||!t.isAIThinking)return!1;t.isAborted=!0,t.isAIThinking=!1,t.isLoadingSource=!1,t.currentToolStatus=null,le(t,"aborted");const a=s.value?.chatKey===n?s.value.aiChatId??ge:mt(t),r=t.aiChatBuffers[a],u=r?r.messages[r.messages.length-1]:void 0;if(u&&u.role==="assistant"&&u.isStreaming){const v=u.processDurationMs??Math.max(0,Date.now()-u.timestamp);u.processDurationMs=v,u.contentBlocks=Ke(u.contentBlocks,v),u.isStreaming=!1,u.content+=`
7
+
8
+ _(已停止生成)_`}if(t.currentAgentRequestId)try{await dt().abort(t.currentAgentRequestId)}catch(v){console.error("[AI] 中止 Agent 请求失败:",v)}return t.currentRequestId="",t.currentAgentRequestId="",j(n),!0}async function Jt(){return s.value?ze(s.value.chatKey):!1}return{sessionStates:e,activeTask:s,ensureSessionState:G,ensureGlobalState:re,getSessionState:$,getActiveTaskState:L,applySessionAssistantSelection:ie,selectAssistantForSession:_e,loadAIChat:h,focusAIChat:P,focusActiveTaskAIChat:ce,resetToSelectorOnEnter:we,startNewAIChat:Qe,loadMoreSourceMessages:ot,updateMaxMessages:at,sendMessage:it,editMessageAndRegenerate:$e,stopGeneration:ze,stopActiveTask:Jt}});export{as as a,xs as b,$t as c,Es as s,Ns as u};
@@ -0,0 +1 @@
1
+ import{M as e}from"./index-DnpnIyle.js";const r={[e.TEXT]:"text",[e.IMAGE]:"image",[e.VOICE]:"voice",[e.VIDEO]:"video",[e.FILE]:"file",[e.EMOJI]:"emoji",[e.LINK]:"link",[e.LOCATION]:"location",[e.RED_PACKET]:"redPacket",[e.TRANSFER]:"transfer",[e.POKE]:"poke",[e.CALL]:"call",[e.SHARE]:"share",[e.REPLY]:"reply",[e.FORWARD]:"forward",[e.CONTACT]:"contact",[e.SYSTEM]:"system",[e.RECALL]:"recall",[e.OTHER]:"other"};function n(a,o){const E=r[a];return o&&E?o(`common.messageType.${E}`):o?o("common.messageType.unknown"):"未知"}export{n as g};
@@ -1,4 +1,4 @@
1
- import{t as M,U as Z,P as f,v as te,j as y,E as ie,w as g,r as P,x as V}from"./RelationshipGalaxyCanvas-BODk18aA.js";import"./webworkerAll-ZPE_yGnC.js";import"./index-sWxuTsa7.js";import"./vendor-snapdom--nZvo8Sg.js";import"./index-C7omDgiJ.js";import"./Tabs-D1UiZNaZ.js";import"./RovingFocusItem-DC_06OmN.js";import"./useToast-BA0EwImD.js";import"./LoadingState.vue_vue_type_script_setup_true_lang-CwgpqtMZ.js";import"./people-page-header-0jvXFFnh.js";import"./relationship-galaxy-connections-Cg4G5yYE.js";import"./relationship-galaxy-viewport-Cwfa51ER.js";import"./Filter-yxkeHO78.js";class q{constructor(e){this._lastTransform="",this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;const t=this._canvas.getBoundingClientRect(),i=this._canvas.width,n=this._canvas.height,s=t.width/i*this._renderer.resolution,o=t.height/n*this._renderer.resolution,r=t.left,l=t.top,d=`translate(${r}px, ${l}px) scale(${s}, ${o})`;d!==this._lastTransform&&(this._domElement.style.transform=d,this._lastTransform=d)},this._domElement=e.domElement,this._renderer=e.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){"ResizeObserver"in globalThis?(this._observer&&(this._observer.disconnect(),this._observer=null),this._observer=new ResizeObserver(e=>{for(const t of e){if(t.target!==this._canvas)continue;const i=this.canvas.width,n=this.canvas.height,s=t.contentRect.width/i*this._renderer.resolution,o=t.contentRect.height/n*this._renderer.resolution;(this._lastScaleX!==s||this._lastScaleY!==o)&&(this.updateTranslation(),this._lastScaleX=s,this._lastScaleY=o)}}),this._observer.observe(this._canvas)):this._tickerAttached||M.shared.add(this.updateTranslation,this,Z.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&M.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform="",this._lastScaleX=null,this._lastScaleY=null}}class w{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=w.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new f,this.page=new f,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,n,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}var I=/iPhone/i,B=/iPod/i,C=/iPad/i,U=/\biOS-universal(?:.+)Mac\b/i,k=/\bAndroid(?:.+)Mobile\b/i,R=/Android/i,b=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,O=/Silk/i,v=/Windows Phone/i,X=/\bWindows(?:.+)ARM\b/i,K=/BlackBerry/i,Y=/BB10/i,H=/Opera Mini/i,F=/\b(CriOS|Chrome)(?:.+)Mobile/i,N=/Mobile(?:.+)Firefox\b/i,$=function(a){return typeof a<"u"&&a.platform==="MacIntel"&&typeof a.maxTouchPoints=="number"&&a.maxTouchPoints>1&&typeof MSStream>"u"};function ne(a){return function(e){return e.test(a)}}function j(a){var e={userAgent:"",platform:"",maxTouchPoints:0};!a&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof a=="string"?e.userAgent=a:a&&a.userAgent&&(e={userAgent:a.userAgent,platform:a.platform,maxTouchPoints:a.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var n=ne(t),s={apple:{phone:n(I)&&!n(v),ipod:n(B),tablet:!n(I)&&(n(C)||$(e))&&!n(v),universal:n(U),device:(n(I)||n(B)||n(C)||n(U)||$(e))&&!n(v)},amazon:{phone:n(b),tablet:!n(b)&&n(O),device:n(b)||n(O)},android:{phone:!n(v)&&n(b)||!n(v)&&n(k),tablet:!n(v)&&!n(b)&&!n(k)&&(n(O)||n(R)),device:!n(v)&&(n(b)||n(O)||n(k)||n(R))||n(/\bokhttp\b/i)},windows:{phone:n(v),tablet:n(X),device:n(v)||n(X)},other:{blackberry:n(K),blackberry10:n(Y),opera:n(H),firefox:n(N),chrome:n(F),device:n(K)||n(Y)||n(H)||n(N)||n(F)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}const se=j.default??j,oe=se(globalThis.navigator),re=9,G=100,ae=0,le=0,W=2,z=1,he=-1e3,ce=-1e3,de=2,L=class J{constructor(e,t=oe){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){const e=document.createElement("button");e.style.width=`${z}px`,e.style.height=`${z}px`,e.style.position="absolute",e.style.top=`${he}px`,e.style.left=`${ce}px`,e.style.zIndex=de.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.position="absolute",this._div.style.top=`${ae}px`,this._div.style.left=`${le}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=W.toString(),this._canvasObserver=new q({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);const e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{const t=new MutationObserver(()=>{e.parentNode&&(t.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(const e of this._children)e._accessibleDiv?.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;for(const e in this._pools)this._pools[e].forEach(i=>{i.parentNode&&i.parentNode.removeChild(i)}),delete this._pools[e];this._div?.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);const t=e.children;if(t)for(let i=0;i<t.length;i++)this._updateAccessibleObjects(t[i])}init(e){const i={accessibilityOptions:{...J.defaultOptions,...e?.accessibilityOptions||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){const e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests))return;const t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(const i of this._children)i._renderId===this._renderId&&t.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){const n=this._children[i];t.has(i)||(n._accessibleDiv&&n._accessibleDiv.parentNode&&(n._accessibleDiv.parentNode.removeChild(n._accessibleDiv),this._getPool(n.accessibleType).push(n._accessibleDiv),n._accessibleDiv=null),n._accessibleActive=!1,te(this._children,i,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let i=0;i<this._children.length;i++){const n=this._children[i];if(!n._accessibleActive||!n._accessibleDiv)continue;const s=n._accessibleDiv,o=n.hitArea||n.getBounds().rectangle;if(n.hitArea){const r=n.worldTransform;s.style.left=`${r.tx+o.x*r.a}px`,s.style.top=`${r.ty+o.y*r.d}px`,s.style.width=`${o.width*r.a}px`,s.style.height=`${o.height*r.d}px`}else this._capHitArea(o),s.style.left=`${o.x}px`,s.style.top=`${o.y}px`,s.style.width=`${o.width}px`,s.style.height=`${o.height}px`}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let i=this._getPool(e.accessibleType).pop();i?(i.innerHTML="",i.removeAttribute("title"),i.removeAttribute("aria-label"),i.tabIndex=0):(e.accessibleType==="button"?i=document.createElement("button"):(i=document.createElement(e.accessibleType),i.style.cssText=`
1
+ import{t as M,U as Z,P as f,v as te,j as y,E as ie,w as g,r as P,x as V}from"./RelationshipGalaxyCanvas-Cn7Eta5U.js";import"./webworkerAll-FCJk6reG.js";import"./index-DnpnIyle.js";import"./vendor-snapdom--nZvo8Sg.js";import"./index-ClHMs0-a.js";import"./Tabs-RWKHwtfM.js";import"./RovingFocusItem-DHaiTb4j.js";import"./useToast-CCPBE-Sy.js";import"./LoadingState.vue_vue_type_script_setup_true_lang-CoeQsaiL.js";import"./people-page-header-Cx5r9Bk2.js";import"./relationship-galaxy-connections-Cg4G5yYE.js";import"./relationship-galaxy-viewport-Cwfa51ER.js";import"./Filter-CMfRHIoK.js";class q{constructor(e){this._lastTransform="",this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;const t=this._canvas.getBoundingClientRect(),i=this._canvas.width,n=this._canvas.height,s=t.width/i*this._renderer.resolution,o=t.height/n*this._renderer.resolution,r=t.left,l=t.top,d=`translate(${r}px, ${l}px) scale(${s}, ${o})`;d!==this._lastTransform&&(this._domElement.style.transform=d,this._lastTransform=d)},this._domElement=e.domElement,this._renderer=e.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){"ResizeObserver"in globalThis?(this._observer&&(this._observer.disconnect(),this._observer=null),this._observer=new ResizeObserver(e=>{for(const t of e){if(t.target!==this._canvas)continue;const i=this.canvas.width,n=this.canvas.height,s=t.contentRect.width/i*this._renderer.resolution,o=t.contentRect.height/n*this._renderer.resolution;(this._lastScaleX!==s||this._lastScaleY!==o)&&(this.updateTranslation(),this._lastScaleX=s,this._lastScaleY=o)}}),this._observer.observe(this._canvas)):this._tickerAttached||M.shared.add(this.updateTranslation,this,Z.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&M.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform="",this._lastScaleX=null,this._lastScaleY=null}}class w{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=w.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new f,this.page=new f,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,n,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}var I=/iPhone/i,B=/iPod/i,C=/iPad/i,U=/\biOS-universal(?:.+)Mac\b/i,k=/\bAndroid(?:.+)Mobile\b/i,R=/Android/i,b=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,O=/Silk/i,v=/Windows Phone/i,X=/\bWindows(?:.+)ARM\b/i,K=/BlackBerry/i,Y=/BB10/i,H=/Opera Mini/i,F=/\b(CriOS|Chrome)(?:.+)Mobile/i,N=/Mobile(?:.+)Firefox\b/i,$=function(a){return typeof a<"u"&&a.platform==="MacIntel"&&typeof a.maxTouchPoints=="number"&&a.maxTouchPoints>1&&typeof MSStream>"u"};function ne(a){return function(e){return e.test(a)}}function j(a){var e={userAgent:"",platform:"",maxTouchPoints:0};!a&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof a=="string"?e.userAgent=a:a&&a.userAgent&&(e={userAgent:a.userAgent,platform:a.platform,maxTouchPoints:a.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var n=ne(t),s={apple:{phone:n(I)&&!n(v),ipod:n(B),tablet:!n(I)&&(n(C)||$(e))&&!n(v),universal:n(U),device:(n(I)||n(B)||n(C)||n(U)||$(e))&&!n(v)},amazon:{phone:n(b),tablet:!n(b)&&n(O),device:n(b)||n(O)},android:{phone:!n(v)&&n(b)||!n(v)&&n(k),tablet:!n(v)&&!n(b)&&!n(k)&&(n(O)||n(R)),device:!n(v)&&(n(b)||n(O)||n(k)||n(R))||n(/\bokhttp\b/i)},windows:{phone:n(v),tablet:n(X),device:n(v)||n(X)},other:{blackberry:n(K),blackberry10:n(Y),opera:n(H),firefox:n(N),chrome:n(F),device:n(K)||n(Y)||n(H)||n(N)||n(F)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}const se=j.default??j,oe=se(globalThis.navigator),re=9,G=100,ae=0,le=0,W=2,z=1,he=-1e3,ce=-1e3,de=2,L=class J{constructor(e,t=oe){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){const e=document.createElement("button");e.style.width=`${z}px`,e.style.height=`${z}px`,e.style.position="absolute",e.style.top=`${he}px`,e.style.left=`${ce}px`,e.style.zIndex=de.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.position="absolute",this._div.style.top=`${ae}px`,this._div.style.left=`${le}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=W.toString(),this._canvasObserver=new q({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);const e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{const t=new MutationObserver(()=>{e.parentNode&&(t.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(const e of this._children)e._accessibleDiv?.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;for(const e in this._pools)this._pools[e].forEach(i=>{i.parentNode&&i.parentNode.removeChild(i)}),delete this._pools[e];this._div?.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);const t=e.children;if(t)for(let i=0;i<t.length;i++)this._updateAccessibleObjects(t[i])}init(e){const i={accessibilityOptions:{...J.defaultOptions,...e?.accessibilityOptions||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){const e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests))return;const t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(const i of this._children)i._renderId===this._renderId&&t.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){const n=this._children[i];t.has(i)||(n._accessibleDiv&&n._accessibleDiv.parentNode&&(n._accessibleDiv.parentNode.removeChild(n._accessibleDiv),this._getPool(n.accessibleType).push(n._accessibleDiv),n._accessibleDiv=null),n._accessibleActive=!1,te(this._children,i,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let i=0;i<this._children.length;i++){const n=this._children[i];if(!n._accessibleActive||!n._accessibleDiv)continue;const s=n._accessibleDiv,o=n.hitArea||n.getBounds().rectangle;if(n.hitArea){const r=n.worldTransform;s.style.left=`${r.tx+o.x*r.a}px`,s.style.top=`${r.ty+o.y*r.d}px`,s.style.width=`${o.width*r.a}px`,s.style.height=`${o.height*r.d}px`}else this._capHitArea(o),s.style.left=`${o.x}px`,s.style.top=`${o.y}px`,s.style.width=`${o.width}px`,s.style.height=`${o.height}px`}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let i=this._getPool(e.accessibleType).pop();i?(i.innerHTML="",i.removeAttribute("title"),i.removeAttribute("aria-label"),i.tabIndex=0):(e.accessibleType==="button"?i=document.createElement("button"):(i=document.createElement(e.accessibleType),i.style.cssText=`
2
2
  color: transparent;
3
3
  pointer-events: none;
4
4
  padding: 0;
@@ -0,0 +1 @@
1
+ .evidence-details[data-v-812e30c9]{max-height:min(24rem,50vh);overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}.cross-chat-evidence-details[data-v-8bc36d76]{max-height:min(32rem,65vh);overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}.ai-user-bubble{padding:10px 16px}.ai-user-bubble .prose{font-size:16px;line-height:24px}.ai-message-actions button{color:#6b7280!important}.ai-message-actions button:hover:not(:disabled){color:#374151!important;background-color:#f3f4f6}.dark .ai-message-actions button{color:#9ca3af!important}.dark .ai-message-actions button:hover:not(:disabled){color:#e5e7eb!important;background-color:#1f2937}.ai-live-row{position:relative;overflow:hidden}.ai-live-row[data-running]:after{content:"";position:absolute;inset-block:0;left:0;width:300px;background:linear-gradient(90deg,transparent 0%,color-mix(in srgb,var(--color-page-bg) 60%,transparent) 55%,transparent 100%);animation:ai-live-row-sweep 2.5s ease-in-out infinite;pointer-events:none}.dark .ai-live-row[data-running]:after{background:linear-gradient(90deg,transparent 0%,color-mix(in srgb,var(--color-page-dark) 60%,transparent) 55%,transparent 100%)}@keyframes ai-live-row-sweep{0%{left:-300px}80%,to{left:100%}}.ai-process-fold{display:grid;grid-template-rows:0fr;transition:grid-template-rows .2s ease-out}.ai-process-fold[data-open]{grid-template-rows:1fr}.ai-process-fold-inner{min-height:0;overflow:hidden;visibility:hidden;transition:visibility 0s linear .2s}.ai-process-fold[data-open]>.ai-process-fold-inner{visibility:visible;transition-delay:0s}.ai-tool-result-scroll{max-height:min(18rem,40vh);overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}.prose.ai-process-detail-content{font-size:.875rem;line-height:1.5rem}.prose.ai-thought-content{line-height:1.2rem}@media(prefers-reduced-motion:reduce){.ai-live-row[data-running]:after{animation:none}.ai-process-fold{transition:none}}.ai-chat-editor[data-v-81d43e7c] .tiptap{min-height:48px;max-height:192px;overflow-y:auto;border:0;padding:0;color:var(--color-gray-900);font-size:.875rem;line-height:1.5rem;outline:none}.ai-chat-editor[data-v-81d43e7c] .tiptap p{margin:0}.ai-chat-editor[data-v-81d43e7c] .tiptap .ai-chat-mention{display:inline-flex;align-items:center;border-radius:.375rem;background:color-mix(in srgb,var(--color-primary-500) 12%,transparent);padding:0 .25rem;color:var(--color-primary-700);line-height:1.25rem;white-space:nowrap}.ai-chat-editor[data-v-81d43e7c] .tiptap p.is-editor-empty:first-child:before{color:var(--color-gray-400)}.dark .ai-chat-editor[data-v-81d43e7c] .tiptap{color:var(--color-gray-100)}.dark .ai-chat-editor[data-v-81d43e7c] .tiptap .ai-chat-mention{background:color-mix(in srgb,var(--color-primary-500) 16%,transparent);color:var(--color-primary-400)}.dark .ai-chat-editor[data-v-81d43e7c] .tiptap p.is-editor-empty:first-child:before{color:var(--color-gray-500)}.ai-chat-mention-menu-host>div{width:16rem!important;max-width:calc(100vw - 2rem);opacity:0;visibility:hidden}.ai-chat-mention-menu-host>div[style*="transform: translate"]{visibility:visible;animation:ai-chat-mention-menu-reveal 0s 40ms forwards}@keyframes ai-chat-mention-menu-reveal{to{opacity:1}}.ai-chat-mention-menu-host [role=listbox]{box-sizing:border-box;width:16rem;min-width:0;max-width:calc(100vw - 2rem);max-height:16rem;padding:.25rem;overflow:hidden;background:var(--ui-bg);border:1px solid var(--ui-border);border-radius:.75rem;box-shadow:0 12px 32px #00000029}.ai-chat-mention-menu-host [role=presentation]{overflow-y:auto;scrollbar-width:thin}.ai-chat-mention-menu-host [role=group]{padding:0}.ai-chat-mention-menu-host [role=option]{min-height:2.25rem;align-items:center;gap:.375rem;padding:.25rem .5rem;border-radius:.5rem}.ai-chat-mention-menu-host [role=option]:before{inset:0;border-radius:.5rem}.ai-chat-mention-menu-host.has-keyboard-selection [role=option][data-highlighted]:before{background:color-mix(in srgb,var(--ui-primary) 10%,transparent)}.ai-chat-mention-menu-host [role=option]:hover:before{background:color-mix(in srgb,var(--ui-primary) 6%,transparent)}.ai-chat-mention-tabs{padding:.25rem .25rem .375rem;background:var(--ui-bg)}.ai-chat-mention-tabs__inner{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.125rem;padding:.125rem;background:var(--ui-bg-muted);border-radius:.5rem}.ai-chat-mention-tabs__button{height:1.625rem;padding:0 .5rem;color:var(--ui-text-muted);font-size:.75rem;line-height:1rem;cursor:pointer;border-radius:.375rem}.ai-chat-mention-tabs__button:hover{color:var(--ui-text-highlighted)}.ai-chat-mention-tabs__button.is-active{color:var(--ui-text-highlighted);background:var(--ui-bg);box-shadow:0 1px 2px #00000014}.slash-menu-enter-active[data-v-0f67bc21],.slash-menu-leave-active[data-v-0f67bc21]{transition:opacity .16s ease,transform .16s ease}.slash-menu-enter-from[data-v-0f67bc21],.slash-menu-leave-to[data-v-0f67bc21]{transform:translateY(8px);opacity:0}