@flowllm-ai/axonx-studio 0.0.1
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.
- package/LICENSE +204 -0
- package/README.md +35 -0
- package/dist/assets/AgentWorkspace-CFX9cOOZ.js +1 -0
- package/dist/assets/ApiWorkspace-nuk0izk4.js +1 -0
- package/dist/assets/BacktestChart-B2A5g1WP.js +1 -0
- package/dist/assets/BacktestView-gMr3Zzhd.js +1 -0
- package/dist/assets/FilePreview-CUhmqr1c.js +1 -0
- package/dist/assets/HomePage-DfqAqAoX.js +1 -0
- package/dist/assets/ResearchPage-C8utBx0S.js +2 -0
- package/dist/assets/RuntimeWorkspace-CuOILV19.js +1 -0
- package/dist/assets/SchemaField-DTKpNfN-.js +1 -0
- package/dist/assets/StrategyComparePage-C04eQjCX.js +1 -0
- package/dist/assets/SubmitPage-BvV71x4v.js +1 -0
- package/dist/assets/TrainingCurveChart-BQJ9RnCV.js +1 -0
- package/dist/assets/TushareBrowserPage-D8Li-RN1.js +2 -0
- package/dist/assets/api-gyN9gj0Q.js +1 -0
- package/dist/assets/arrow-down-BH_K5gzy.js +1 -0
- package/dist/assets/arrow-right-Bqs4l9-C.js +1 -0
- package/dist/assets/check-D-YJERlt.js +1 -0
- package/dist/assets/circle-check-CuU7pF2N.js +1 -0
- package/dist/assets/client-BfOnNqgS.js +1 -0
- package/dist/assets/createLucideIcon-3GmWj6nd.js +1 -0
- package/dist/assets/file-spreadsheet-CCWLaZh3.js +1 -0
- package/dist/assets/hard-drive-BPS9bHrX.js +1 -0
- package/dist/assets/i18n-Cg91z-Pm.js +1 -0
- package/dist/assets/index-CUghMSjC.css +1 -0
- package/dist/assets/index-Dds_R6_G.js +11 -0
- package/dist/assets/installCanvasRenderer-bcUHIcHi.js +18 -0
- package/dist/assets/jsx-runtime-g_EzXSjx.js +1 -0
- package/dist/assets/lib-BNb3H2Uy.js +29 -0
- package/dist/assets/plus-5N8AgcCa.js +1 -0
- package/dist/assets/refresh-cw-DbZV2zTG.js +1 -0
- package/dist/assets/search-DgRYeO6M.js +1 -0
- package/dist/assets/send-DmE0S-qF.js +1 -0
- package/dist/assets/sourceTasks-BvyYdRNC.js +1 -0
- package/dist/assets/square-check-BHpZrFnJ.js +1 -0
- package/dist/assets/trash-DLhoydbu.js +1 -0
- package/dist/axonx-icon.svg +21 -0
- package/dist/axonx-logo.svg +46 -0
- package/dist/index.html +31 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
AxonX
|
|
2
|
+
Copyright 2026 FlowLLM-AI
|
|
3
|
+
|
|
4
|
+
Apache License
|
|
5
|
+
Version 2.0, January 2004
|
|
6
|
+
http://www.apache.org/licenses/
|
|
7
|
+
|
|
8
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
9
|
+
|
|
10
|
+
1. Definitions.
|
|
11
|
+
|
|
12
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
13
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
14
|
+
|
|
15
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
16
|
+
the copyright owner that is granting the License.
|
|
17
|
+
|
|
18
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
19
|
+
other entities that control, are controlled by, or are under common
|
|
20
|
+
control with that entity. For the purposes of this definition,
|
|
21
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
22
|
+
direction or management of such entity, whether by contract or
|
|
23
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
24
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
25
|
+
|
|
26
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
27
|
+
exercising permissions granted by this License.
|
|
28
|
+
|
|
29
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
30
|
+
including but not limited to software source code, documentation
|
|
31
|
+
source, and configuration files.
|
|
32
|
+
|
|
33
|
+
"Object" form shall mean any form resulting from mechanical
|
|
34
|
+
transformation or translation of a Source form, including but
|
|
35
|
+
not limited to compiled object code, generated documentation,
|
|
36
|
+
and conversions to other media types.
|
|
37
|
+
|
|
38
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
39
|
+
Object form, made available under the License, as indicated by a
|
|
40
|
+
copyright notice that is included in or attached to the work
|
|
41
|
+
(an example is provided in the Appendix below).
|
|
42
|
+
|
|
43
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
44
|
+
form, that is based on (or derived from) the Work and for which the
|
|
45
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
46
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
47
|
+
of this License, Derivative Works shall not include works that remain
|
|
48
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
49
|
+
the Work and Derivative Works thereof.
|
|
50
|
+
|
|
51
|
+
"Contribution" shall mean any work of authorship, including
|
|
52
|
+
the original version of the Work and any modifications or additions
|
|
53
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
54
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
55
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
56
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
57
|
+
means any form of electronic, verbal, or written communication sent
|
|
58
|
+
to the Licensor or its representatives, including but not limited to
|
|
59
|
+
communication on electronic mailing lists, source code control systems,
|
|
60
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
61
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
62
|
+
excluding communication that is conspicuously marked or otherwise
|
|
63
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
64
|
+
|
|
65
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
66
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
67
|
+
subsequently incorporated within the Work.
|
|
68
|
+
|
|
69
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
70
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
71
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
72
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
73
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
74
|
+
Work and such Derivative Works in Source or Object form.
|
|
75
|
+
|
|
76
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
77
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
78
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
79
|
+
(except as stated in this section) patent license to make, have made,
|
|
80
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
81
|
+
where such license applies only to those patent claims licensable
|
|
82
|
+
by such Contributor that are necessarily infringed by their
|
|
83
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
84
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
85
|
+
institute patent litigation against any entity (including a
|
|
86
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
87
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
88
|
+
or contributory patent infringement, then any patent licenses
|
|
89
|
+
granted to You under this License for that Work shall terminate
|
|
90
|
+
as of the date such litigation is filed.
|
|
91
|
+
|
|
92
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
93
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
94
|
+
modifications, and in Source or Object form, provided that You
|
|
95
|
+
meet the following conditions:
|
|
96
|
+
|
|
97
|
+
(a) You must give any other recipients of the Work or
|
|
98
|
+
Derivative Works a copy of this License; and
|
|
99
|
+
|
|
100
|
+
(b) You must cause any modified files to carry prominent notices
|
|
101
|
+
stating that You changed the files; and
|
|
102
|
+
|
|
103
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
104
|
+
that You distribute, all copyright, patent, trademark, and
|
|
105
|
+
attribution notices from the Source form of the Work,
|
|
106
|
+
excluding those notices that do not pertain to any part of
|
|
107
|
+
the Derivative Works; and
|
|
108
|
+
|
|
109
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
110
|
+
distribution, then any Derivative Works that You distribute must
|
|
111
|
+
include a readable copy of the attribution notices contained
|
|
112
|
+
within such NOTICE file, excluding those notices that do not
|
|
113
|
+
pertain to any part of the Derivative Works, in at least one
|
|
114
|
+
of the following places: within a NOTICE text file distributed
|
|
115
|
+
as part of the Derivative Works; within the Source form or
|
|
116
|
+
documentation, if provided along with the Derivative Works; or,
|
|
117
|
+
within a display generated by the Derivative Works, if and
|
|
118
|
+
wherever such third-party notices normally appear. The contents
|
|
119
|
+
of the NOTICE file are for informational purposes only and
|
|
120
|
+
do not modify the License. You may add Your own attribution
|
|
121
|
+
notices within Derivative Works that You distribute, alongside
|
|
122
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
123
|
+
that such additional attribution notices cannot be construed
|
|
124
|
+
as modifying the License.
|
|
125
|
+
|
|
126
|
+
You may add Your own copyright statement to Your modifications and
|
|
127
|
+
may provide additional or different license terms and conditions
|
|
128
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
129
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
130
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
131
|
+
the conditions stated in this License.
|
|
132
|
+
|
|
133
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
134
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
135
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
136
|
+
this License, without any additional terms or conditions.
|
|
137
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
138
|
+
the terms of any separate license agreement you may have executed
|
|
139
|
+
with Licensor regarding such Contributions.
|
|
140
|
+
|
|
141
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
142
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
143
|
+
except as required for reasonable and customary use in describing the
|
|
144
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
145
|
+
|
|
146
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
147
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
148
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
149
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
150
|
+
implied, including, without limitation, any warranties or conditions
|
|
151
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
152
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
153
|
+
appropriateness of using or redistributing the Work and assume any
|
|
154
|
+
risks associated with Your exercise of permissions under this License.
|
|
155
|
+
|
|
156
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
157
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
158
|
+
unless required by applicable law (such as deliberate and grossly
|
|
159
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
160
|
+
liable to You for damages, including any direct, indirect, special,
|
|
161
|
+
incidental, or consequential damages of any character arising as a
|
|
162
|
+
result of this License or out of the use or inability to use the
|
|
163
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
164
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
165
|
+
other commercial damages or losses), even if such Contributor
|
|
166
|
+
has been advised of the possibility of such damages.
|
|
167
|
+
|
|
168
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
169
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
170
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
171
|
+
or other liability obligations and/or rights consistent with this
|
|
172
|
+
License. However, in accepting such obligations, You may act only
|
|
173
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
174
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
175
|
+
defend, and hold each Contributor harmless for any liability
|
|
176
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
177
|
+
of your accepting any such warranty or additional liability.
|
|
178
|
+
|
|
179
|
+
END OF TERMS AND CONDITIONS
|
|
180
|
+
|
|
181
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
182
|
+
|
|
183
|
+
To apply the Apache License to your work, attach the following
|
|
184
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
185
|
+
replaced with your own identifying information. (Don't include
|
|
186
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
187
|
+
comment syntax for the file format. We also recommend that a
|
|
188
|
+
file or class name and description of purpose be included on the
|
|
189
|
+
same "printed page" as the copyright notice for easier
|
|
190
|
+
identification within third-party archives.
|
|
191
|
+
|
|
192
|
+
Copyright 2026 FlowLLM-AI
|
|
193
|
+
|
|
194
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
195
|
+
you may not use this file except in compliance with the License.
|
|
196
|
+
You may obtain a copy of the License at
|
|
197
|
+
|
|
198
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
199
|
+
|
|
200
|
+
Unless required by applicable law or agreed to in writing, software
|
|
201
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
202
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
203
|
+
See the License for the specific language governing permissions and
|
|
204
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# AxonX Studio
|
|
2
|
+
|
|
3
|
+
AxonX 的任务与量化研究工作台,提供任务提交、运行状态、日志和研究结果视图。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install "axonx[studio]"
|
|
9
|
+
export AXONX_SERVICE_TOKEN='replace-with-your-local-service-token'
|
|
10
|
+
axonx start --service.host 127.0.0.1
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
打开 <http://127.0.0.1:1024/>,在 **Settings → Service token** 中填入相同 token。已有 AxonX 环境也可单独安装 `axonx-studio`。发布包包含静态资源,无需 Node.js 或本地构建。
|
|
14
|
+
|
|
15
|
+
npm 包分发相同的静态资源:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @flowllm-ai/axonx-studio
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
资源位于 `node_modules/@flowllm-ai/axonx-studio/dist/`。此包用于独立静态托管,后端服务仍由 AxonX 提供;静态站点需将 API 请求代理到后端。使用 AxonX 内置托管时,安装上面的 Python 包即可。
|
|
22
|
+
|
|
23
|
+
## 源码开发
|
|
24
|
+
|
|
25
|
+
先从仓库根目录安装核心与开发依赖,再构建 Studio:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install -e '.[dev]'
|
|
29
|
+
cd axonx_studio
|
|
30
|
+
npm ci && npm run build
|
|
31
|
+
cd ..
|
|
32
|
+
pip install ./axonx_studio
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
开发服务器、目录结构和验证命令见 [Studio 开发](https://flowllm-ai.github.io/AxonX/zh/development/studio),连接与操作见 [Studio 入门](https://flowllm-ai.github.io/AxonX/zh/getting-started/studio)。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,c as t,n,t as r}from"./jsx-runtime-g_EzXSjx.js";import{t as i}from"./createLucideIcon-3GmWj6nd.js";import{t as a}from"./circle-check-CuU7pF2N.js";import{i as o,n as s}from"./client-BfOnNqgS.js";import{t as c}from"./plus-5N8AgcCa.js";import{t as l}from"./send-DmE0S-qF.js";import{t as u}from"./trash-DLhoydbu.js";import{E as d,P as f,f as p,l as m,p as h,x as g,y as _}from"./index-Dds_R6_G.js";import{n as v,t as y}from"./lib-BNb3H2Uy.js";var b={name:`circle-ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M17 12h.01`,key:`1m0b6t`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M7 12h.01`,key:`eqddd0`}]]};b.node;var x=i(b),S={name:`circle-x`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-circle`]};S.node;var C=i(S),w={name:`git-fork`,size:24,node:[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]};w.node;var T=i(w),E={name:`message-square-text`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]};E.node;var D=i(E),O={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};O.node;var k=i(O),A={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};A.node;var j=i(A),M=t(e(),1),N=(e,t)=>s.invoke(`list_agent_sessions`,{limit:200,offset:0},{target:e,signal:t}),P=(e,t,n)=>s.invoke(`get_agent_session`,{session_id:e,limit:1e3,offset:0},{target:t,signal:n}),F=(e,t,n,r,i)=>m(s,`agent_chat`,{message:e,...t?{session_id:t}:{}},{target:n,signal:r,onEvent:i}),I=(e,t,n)=>s.invoke(`rename_agent_session`,{session_id:e,title:t},{target:n}),ee=(e,t,n)=>s.invoke(`tag_agent_session`,{session_id:e,tag:t},{target:n}),te=(e,t)=>s.invoke(`delete_agent_session`,{session_id:e},{target:t}),L=(e,t)=>s.invoke(`fork_agent_session`,{session_id:e},{target:t}),R=(e,t)=>s.invoke(`cancel_agent_turn`,{session_id:e},{target:t}),z=r();function B({value:e,running:t,canStop:r,onChange:i,onSend:a,onStop:o}){let{t:s}=n();return(0,z.jsxs)(`div`,{className:`agent-composer-wrap`,children:[(0,z.jsxs)(`div`,{className:`agent-composer`,children:[(0,z.jsx)(`textarea`,{value:e,rows:1,placeholder:s(`agent.composerPlaceholder`),disabled:t,onChange:e=>i(e.target.value),onKeyDown:n=>{n.key===`Enter`&&!n.shiftKey&&(n.preventDefault(),!t&&e.trim()&&a())}}),t?(0,z.jsx)(`button`,{className:`agent-stop`,onClick:o,disabled:!r,title:s(`agent.stop`),children:(0,z.jsx)(j,{})}):(0,z.jsx)(`button`,{className:`agent-send`,onClick:a,disabled:!e.trim(),title:s(`agent.send`),children:(0,z.jsx)(l,{})})]}),(0,z.jsx)(`small`,{children:s(`agent.composerHint`)})]})}function V(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function H({block:e,latest:t=!1}){let[n,r]=(0,M.useState)(t);if((0,M.useEffect)(()=>{r(t)},[t]),e.block_type===`thinking`)return(0,z.jsxs)(`details`,{className:`agent-thinking`,open:n,onToggle:e=>r(e.currentTarget.open),children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(x,{}),`Thinking`,(0,z.jsx)(f,{})]}),(0,z.jsx)(`div`,{className:`agent-markdown`,children:(0,z.jsx)(v,{remarkPlugins:[y],children:e.text})})]});if(e.block_type===`tool`){let t=e.status===`failed`,i=V(e.payload.name)||`Tool`;return(0,z.jsxs)(`details`,{className:`agent-tool ${t?`failed`:``}`,open:n,onToggle:e=>r(e.currentTarget.open),children:[(0,z.jsxs)(`summary`,{children:[t?(0,z.jsx)(C,{}):e.status===`running`?(0,z.jsx)(x,{}):(0,z.jsx)(a,{}),(0,z.jsx)(`strong`,{children:i}),(0,z.jsx)(`span`,{className:`agent-tool-status`,children:e.status}),(0,z.jsx)(f,{className:`agent-tool-chevron`})]}),(0,z.jsxs)(`div`,{children:[e.payload.input!=null&&(0,z.jsxs)(`section`,{children:[(0,z.jsx)(`small`,{children:`INPUT`}),(0,z.jsx)(`pre`,{children:V(e.payload.input)})]}),e.payload.result!=null&&(0,z.jsxs)(`section`,{children:[(0,z.jsx)(`small`,{children:`RESULT`}),(0,z.jsx)(`pre`,{children:V(e.payload.result)})]})]})]})}return(0,z.jsx)(`div`,{className:`agent-markdown agent-block-${e.block_type}`,children:(0,z.jsx)(v,{remarkPlugins:[y],children:e.text})})}function U({className:e=``,labelled:t=!1}){return(0,z.jsx)(`img`,{className:`axonx-mark ${e}`.trim(),src:`/axonx-icon.svg`,alt:t?`AxonX`:``})}function W({conversation:e,loading:t,running:r}){let{t:i}=n(),a=(0,M.useRef)(null),s=(0,M.useMemo)(()=>{let t=[];for(let n of e.order){let r=e.blocks[n];if(!r)continue;let i=t[t.length-1];i?.id===r.message_uuid?i.blocks.push(r):t.push({id:r.message_uuid,role:r.role,blocks:[r]})}return t},[e]),c=e.order.at(-1);return(0,M.useEffect)(()=>{a.current&&(a.current.scrollTop=a.current.scrollHeight)},[e,r]),t?(0,z.jsxs)(`div`,{className:`agent-conversation-state`,children:[(0,z.jsx)(o,{className:`spin`}),i(`agent.loadingConversation`)]}):(0,z.jsx)(`div`,{className:`agent-conversation`,ref:a,children:!s.length&&!r?(0,z.jsxs)(`div`,{className:`agent-welcome`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(U,{labelled:!0})}),(0,z.jsx)(`h1`,{children:i(`agent.welcomeTitle`)}),(0,z.jsx)(`p`,{children:i(`agent.welcomeLead`)})]}):(0,z.jsxs)(`div`,{className:`agent-message-list`,children:[s.map(e=>(0,z.jsxs)(`article`,{className:`agent-message ${e.role}`,children:[(0,z.jsxs)(`header`,{children:[e.role===`user`?(0,z.jsx)(D,{}):(0,z.jsx)(U,{}),(0,z.jsx)(`span`,{children:i(`agent.roles.${e.role}`)})]}),(0,z.jsx)(`div`,{children:e.blocks.map(e=>(0,z.jsx)(H,{block:e,latest:e.block_id===c},e.block_id))})]},e.id)),r&&(0,z.jsxs)(`div`,{className:`agent-running-indicator`,role:`status`,children:[(0,z.jsx)(`i`,{}),(0,z.jsx)(`i`,{}),(0,z.jsx)(`i`,{}),(0,z.jsx)(`span`,{children:i(`agent.working`)})]})]})})}var G=()=>({order:[],blocks:{}});function K(e){return{order:e.map(e=>e.block_id),blocks:Object.fromEntries(e.map(e=>[e.block_id,{...e}]))}}function q(e,t,n){let r={block_id:n,block_type:`text`,message_uuid:n,role:`user`,status:`completed`,text:t,payload:{},local:!0};return{order:[...e.order,n],blocks:{...e.blocks,[n]:r}}}function J(e){return typeof e==`string`&&e?e:void 0}function Y(e){return{role:e.type_name===`UserMessage`?`user`:e.type_name===`AssistantMessage`||e.type_name===`StreamEvent`?`assistant`:`system`,messageUuid:J(e.message.uuid)||J(e.message.message_id)||`${e.session_id}:${e.sequence}`}}function X(e,t,n,r){let i=e.blocks[t.block_id],a=i||{block_id:t.block_id,block_type:t.block_type,message_uuid:r,role:n,status:`running`,text:``,payload:{}},o={...a.payload,...t.payload},s=a.text;t.operation===`append`&&(s+=t.delta),t.operation===`replace`&&typeof t.payload.text==`string`&&(s=t.payload.text);let c=typeof t.payload.status==`string`?t.payload.status:t.operation===`finish`?`completed`:a.status,l={...a,block_type:t.block_type,status:c,text:s,payload:o};return{order:i?e.order:[...e.order,t.block_id],blocks:{...e.blocks,[t.block_id]:l}}}function ne(e,t){let{role:n,messageUuid:r}=Y(t);return t.presentation.reduce((e,t)=>X(e,t,n,r),e)}function Z(e){return e.custom_title||e.summary||e.first_prompt||e.session_id}function re({sessions:e,selectedId:t,loading:r,open:i,onClose:a,onNew:s,onSelect:l,onRename:d,onTag:f,onFork:p,onDelete:m}){let{t:h,i18n:v}=n(),[y,b]=(0,M.useState)(),x=(0,M.useRef)(null),S=[{id:`rename`,icon:k,label:h(`agent.rename`),run:d},{id:`tag`,icon:g,label:h(`agent.tag`),run:f},{id:`fork`,icon:T,label:h(`agent.fork`),run:p},{id:`delete`,icon:u,label:h(`agent.delete`),run:m,danger:!0}];(0,M.useEffect)(()=>{if(!y)return;let e=e=>{x.current?.contains(e.target)||b(void 0)},t=()=>b(void 0),n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`pointerdown`,e),window.addEventListener(`resize`,t),window.addEventListener(`scroll`,t,!0),window.addEventListener(`keydown`,n),()=>{window.removeEventListener(`pointerdown`,e),window.removeEventListener(`resize`,t),window.removeEventListener(`scroll`,t,!0),window.removeEventListener(`keydown`,n)}},[y]);let C=e=>{if(!y)return;let{session:t}=y;b(void 0),e(t)};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`aside`,{className:`agent-session-rail ${i?`open`:``}`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:h(`agent.sessions`)}),(0,z.jsx)(`small`,{children:e.length})]}),(0,z.jsx)(`button`,{"aria-label":h(`agent.newChat`),className:`agent-new-session-button`,onClick:s,title:h(`agent.newChat`),children:(0,z.jsx)(c,{})})]}),(0,z.jsx)(`div`,{className:`agent-session-list`,children:r&&!e.length?(0,z.jsx)(`div`,{className:`agent-session-loading`,children:(0,z.jsx)(o,{className:`spin`})}):e.length?e.map(e=>{let n=e.session_id===t;return(0,z.jsxs)(`article`,{className:n?`selected`:``,onContextMenu:t=>{t.preventDefault(),b({session:e,x:Math.max(8,Math.min(t.clientX,window.innerWidth-192)),y:Math.max(8,Math.min(t.clientY,window.innerHeight-176))})},children:[(0,z.jsxs)(`button`,{className:`agent-session-main`,onClick:()=>{l(e.session_id),a()},children:[(0,z.jsx)(`strong`,{children:Z(e)}),(0,z.jsxs)(`span`,{children:[e.tag&&(0,z.jsx)(`i`,{children:e.tag}),new Intl.DateTimeFormat(v.resolvedLanguage,{month:`short`,day:`numeric`}).format(e.last_modified)]})]}),n&&(0,z.jsx)(`div`,{className:`agent-session-actions`,children:S.map(t=>(0,z.jsx)(`button`,{className:t.danger?`danger`:``,onClick:()=>t.run(e),title:t.label,children:(0,z.jsx)(t.icon,{})},t.id))})]},e.session_id)}):(0,z.jsx)(`p`,{children:h(`agent.noSessions`)})})]}),(0,z.jsx)(_,{min:220,max:480,className:`agent-session-resizer`}),y&&(0,z.jsx)(`div`,{"aria-label":h(`agent.sessionMenu`),className:`agent-session-context-menu`,ref:x,role:`menu`,style:{left:y.x,top:y.y},children:S.map(e=>(0,z.jsxs)(`button`,{className:e.danger?`danger`:``,onClick:()=>C(e.run),role:`menuitem`,children:[(0,z.jsx)(e.icon,{}),e.label]},e.id))}),i&&(0,z.jsx)(`button`,{className:`agent-rail-scrim`,onClick:a,"aria-label":h(`agent.closeSessions`)})]})}function Q({view:e,resource:t,target:r,navigate:i,replace:a,onOptionsChange:o,onConnection:s}){let{t:c}=n(),l=e===`chat`?t:void 0,[u,f]=(0,M.useState)([]),[m,g]=(0,M.useState)(!0),[_,v]=(0,M.useState)(G),[y,b]=(0,M.useState)(!1),[x,S]=(0,M.useState)(``),[C,w]=(0,M.useState)(!1),[T,E]=(0,M.useState)(!1),[D,O]=(0,M.useState)(``),[k,A]=(0,M.useState)(!1),j=(0,M.useRef)(l),V=(0,M.useRef)(null),H=(0,M.useRef)(!1),J=(0,M.useRef)(``),Y=(0,M.useCallback)(async()=>{g(!0);try{let e=await N(r);f(e),o(e.map(e=>({value:e.session_id,label:e.custom_title||e.summary||e.first_prompt||e.session_id,detail:e.tag||e.backend}))),s(!0)}catch(e){h(e)||(O(p(e)),s(!1))}finally{g(!1)}},[s,o,r]),X=(0,M.useCallback)(async e=>{let t=await P(e,r);return j.current===e&&(v(K(t.blocks)),O(``)),t},[r]);(0,M.useEffect)(()=>{Y()},[Y]),(0,M.useEffect)(()=>()=>V.current?.abort(),[r]),(0,M.useEffect)(()=>{if(l===j.current&&H.current)return;if(H.current&&l!==j.current&&V.current?.abort(),j.current=l,O(``),!l){v(G()),b(!1);return}let e=new AbortController;return b(!0),P(l,r,e.signal).then(e=>{j.current===l&&v(K(e.blocks)),s(!0)}).catch(e=>{h(e)||(O(p(e)),s(!1))}).finally(()=>{j.current===l&&b(!1)}),()=>e.abort()},[s,r,l]);let Z=(0,M.useCallback)(async()=>{let e=x.trim();if(!e||H.current)return;let t=j.current,n=`local-${Date.now()}-${Math.random().toString(36).slice(2)}`;v(t=>q(t,e,n)),S(``),O(``),w(!0),H.current=!0;let i=new AbortController;V.current=i;let o=t,l=``,u=e=>{if(e.kind===`agent_message`){let t=e;o||(o=t.session_id,j.current=o,a({section:`agent`,view:`chat`,resource:o})),v(e=>ne(e,t))}else if(e.kind===`result`){let t=e;l=typeof t.metadata.terminal_reason==`string`?t.metadata.terminal_reason:``}};try{await F(e,t,r,i.signal,u),s(!0)}catch(e){h(e)||O(p(e))}finally{if(H.current=!1,w(!1),E(!1),V.current=null,o)try{await X(o),await Y()}catch(e){h(e)||O(p(e))}(l===`aborted_streaming`||l===`aborted_tools`)&&O(c(`agent.cancelled`))}},[x,s,X,Y,r,a,c]);(0,M.useEffect)(()=>{let n=`${e}:${t||``}`;n!==J.current&&(J.current=n,S(e===`task`&&t?c(`agent.taskPrompt`,{taskId:t}):``))},[t,c,e]);let Q=async()=>{let e=j.current;if(e&&!T){E(!0);try{await R(e,r)}catch(e){E(!1),O(p(e))}}},ie=async e=>{let t=window.prompt(c(`agent.renamePrompt`),e.custom_title||``);t?.trim()&&(await I(e.session_id,t.trim(),r),await Y())},ae=async e=>{let t=window.prompt(c(`agent.tagPrompt`),e.tag||``);t!==null&&(await ee(e.session_id,t.trim()||null,r),await Y())},oe=async e=>{let t=await L(e.session_id,r);await Y(),i({section:`agent`,view:`chat`,resource:t.session_id})},se=async e=>{window.confirm(c(`agent.deleteConfirm`))&&(await te(e.session_id,r),j.current===e.session_id&&i({section:`agent`,view:`new`}),await Y())},$=e=>{e.catch(e=>O(p(e)))};return(0,z.jsxs)(`section`,{className:`agent-workspace`,children:[(0,z.jsx)(re,{sessions:u,selectedId:l,loading:m,open:k,onClose:()=>A(!1),onNew:()=>i({section:`agent`,view:`new`}),onSelect:e=>i({section:`agent`,view:`chat`,resource:e}),onRename:e=>$(ie(e)),onTag:e=>$(ae(e)),onFork:e=>$(oe(e)),onDelete:e=>$(se(e))}),(0,z.jsxs)(`main`,{className:`agent-chat-pane`,children:[(0,z.jsxs)(`header`,{className:`agent-chat-header`,children:[(0,z.jsx)(`button`,{className:`agent-mobile-sessions`,onClick:()=>A(!0),children:(0,z.jsx)(d,{})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(U,{}),(0,z.jsx)(`span`,{children:c(l?`agent.conversation`:`agent.newChat`)})]})]}),D&&(0,z.jsxs)(`div`,{className:`agent-error`,role:`alert`,children:[D,(0,z.jsx)(`button`,{onClick:()=>O(``),children:`×`})]}),(0,z.jsx)(W,{conversation:_,loading:y,running:C}),(0,z.jsx)(B,{value:x,running:C,canStop:!!j.current&&!T,onChange:S,onSend:()=>void Z(),onStop:()=>void Q()})]})]})}export{Q as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,c as t,n,t as r}from"./jsx-runtime-g_EzXSjx.js";import{t as i}from"./createLucideIcon-3GmWj6nd.js";import{t as a}from"./arrow-right-Bqs4l9-C.js";import{i as o,n as s,r as c,t as l}from"./SchemaField-DTKpNfN-.js";import{t as u}from"./circle-check-CuU7pF2N.js";import{i as d,n as f}from"./client-BfOnNqgS.js";import{t as p}from"./search-DgRYeO6M.js";import{T as m,y as h}from"./index-Dds_R6_G.js";var g={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};g.node;var _=i(g),v=t(e(),1),y=(e,t)=>f.jobs({target:e,signal:t}),b=(e,t,n,r)=>f.invoke(e,t,{target:n,signal:r}),x=r();function S({machine:e,initialName:t,onSelected:r,onOptionsChange:i,onConnection:f}){let{t:g}=n(),[S,C]=(0,v.useState)([]),[w,T]=(0,v.useState)(t||``),[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(!0),[A,j]=(0,v.useState)(``),[M,N]=(0,v.useState)({}),[P,F]=(0,v.useState)(!1),[I,L]=(0,v.useState)(),R=(0,v.useCallback)(()=>{let t=new AbortController;return k(!0),j(``),y(e.isLocal?void 0:e.address,t.signal).then(e=>{let t=e.items;C(t),T(e=>t.some(t=>t.name===e)?e:``),f(!0)}).catch(e=>{e?.name!==`AbortError`&&(j(String(e)),f(!1))}).finally(()=>k(!1)),()=>t.abort()},[e.address,e.isLocal,f]);(0,v.useEffect)(R,[R]),(0,v.useEffect)(()=>{t&&S.some(e=>e.name===t)&&T(t)},[t,S]),(0,v.useEffect)(()=>{i?.(S.map(e=>({value:e.name,label:e.name,detail:`POST`})))},[S,i]);let z=S.find(e=>e.name===w),B=(0,v.useMemo)(()=>S.filter(e=>`${e.name} ${e.description}`.toLowerCase().includes(E.toLowerCase())),[S,E]);(0,v.useEffect)(()=>{z&&(N(s(z.input_schema)),L(void 0),j(``))},[z]);let V=e=>{T(e),r(e)};return(0,x.jsxs)(`section`,{className:`api-workspace unified-workspace`,children:[(0,x.jsxs)(`aside`,{className:`context-rail api-index rail-panel`,children:[(0,x.jsxs)(`header`,{className:`rail-header`,children:[(0,x.jsxs)(`div`,{className:`rail-heading`,children:[(0,x.jsx)(`small`,{children:`PUBLIC API`}),(0,x.jsx)(`strong`,{children:g(`api.interfaces`)})]}),(0,x.jsx)(`em`,{children:S.length})]}),(0,x.jsxs)(`label`,{className:`context-search rail-search`,children:[(0,x.jsx)(p,{}),(0,x.jsx)(`input`,{value:E,onChange:e=>D(e.target.value),placeholder:g(`api.search`)})]}),(0,x.jsx)(`nav`,{className:`rail-scroll`,children:O&&!S.length?(0,x.jsx)(d,{className:`spin context-loader`}):B.map(e=>(0,x.jsxs)(`button`,{className:`rail-list-item${w===e.name?` active`:``}`,onClick:()=>V(e.name),children:[(0,x.jsx)(m,{}),(0,x.jsxs)(`span`,{className:`rail-item-copy`,children:[(0,x.jsx)(`strong`,{children:e.name}),(0,x.jsxs)(`small`,{children:[`POST /jobs/`,e.name]})]}),(0,x.jsx)(a,{})]},e.name))})]}),(0,x.jsx)(h,{min:180,max:440,className:`context-resizer`}),(0,x.jsx)(`main`,{className:`workspace-canvas api-canvas`,children:z?(0,x.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),!z)return;let n=c(z.input_schema,M,{required:g(`required`),invalidJson:g(`jsonHint`)});if(Object.keys(n.errors).length){j(Object.values(n.errors)[0]);return}try{F(!0),j(``),L(await b(z.name,n.data,e.isLocal?void 0:e.address)),f(!0)}catch(e){j(e instanceof Error?e.message:String(e)),f(!1)}finally{F(!1)}},children:[(0,x.jsxs)(`header`,{className:`canvas-heading api-heading`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`small`,{children:[`POST /jobs/`,z.name]}),(0,x.jsx)(`h1`,{children:z.name}),(0,x.jsx)(`p`,{children:z.description||g(`api.noDescription`)})]}),(0,x.jsxs)(`span`,{children:[(0,x.jsx)(u,{}),g(`api.available`)]})]}),(0,x.jsxs)(`section`,{className:`api-form-card`,children:[(0,x.jsxs)(`header`,{children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(o,{}),(0,x.jsx)(`strong`,{children:g(`api.requestParameters`)})]}),(0,x.jsxs)(`small`,{children:[Object.keys(z.input_schema.properties||{}).length,` `,`fields`]})]}),(0,x.jsx)(`div`,{className:`api-fields`,children:Object.entries(z.input_schema.properties||{}).map(([e,t])=>(0,x.jsx)(l,{name:e,schema:t,required:(z.input_schema.required||[]).includes(e),value:M[e]??``,variant:`compact`,onChange:t=>N(n=>({...n,[e]:t}))},e))})]}),A&&(0,x.jsx)(`div`,{className:`inline-error`,children:A}),(0,x.jsxs)(`footer`,{className:`api-submit-row`,children:[(0,x.jsxs)(`code`,{children:[`POST /jobs/`,z.name]}),(0,x.jsxs)(`button`,{className:`primary-button`,disabled:P,children:[P?(0,x.jsx)(d,{className:`spin`}):(0,x.jsx)(_,{}),g(P?`api.calling`:`api.call`)]})]}),I!==void 0&&(0,x.jsxs)(`section`,{className:`api-response`,children:[(0,x.jsxs)(`header`,{children:[(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`i`,{}),`200`]}),(0,x.jsx)(`strong`,{children:g(`api.response`)})]}),(0,x.jsx)(`pre`,{children:JSON.stringify(I,null,2)})]})]}):(0,x.jsxs)(`div`,{className:`empty-workspace`,children:[(0,x.jsx)(m,{}),(0,x.jsx)(`strong`,{children:g(`api.select`)})]})})]})}export{S as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,c as t,t as n}from"./jsx-runtime-g_EzXSjx.js";import{i as r}from"./api-gyN9gj0Q.js";import{n as i}from"./i18n-Cg91z-Pm.js";import{$ as a,A as o,B as s,C as c,D as l,E as u,F as d,G as f,H as p,I as m,J as h,K as g,L as _,M as v,N as y,O as b,P as x,Q as S,R as C,S as w,T,U as E,V as D,W as O,X as k,Y as A,Z as j,_ as M,_t as N,a as P,at as F,b as ee,c as te,ct as I,d as ne,dt as L,et as re,f as ie,ft as ae,g as oe,gt as se,h as ce,ht as le,i as ue,it as R,j as de,k as fe,l as z,lt as pe,m as me,mt as he,n as ge,nt as _e,o as ve,ot as ye,p as be,pt as xe,q as Se,r as Ce,rt as B,s as we,st as Te,t as Ee,tt as De,u as Oe,ut as ke,v as Ae,w as je,x as Me,y as Ne,z as Pe}from"./installCanvasRenderer-bcUHIcHi.js";function Fe(){oe(`liPosMinGap`,Ie)}function Ie(e,t,n){var r=ke(),i=n.serUids,a=n.liPosMinGap,o,s=t.axis,c=s.scale,u=c.needTransform(),f=c.getFilter?c.getFilter():null,p=d(f);function h(n){me(e,t.sers,function(e){var t=e.getRawData(),r=t.getDimensionIndex(t.mapDimension(s.dim));r>=0&&n(r,e,t.getStore())})}var g=0;if(h(function(e,t,n){r.set(t.uid,1),(!i||!i.hasKey(t.uid))&&(o=!0),g+=n.count()}),(!i||i.keys().length!==r.keys().length)&&(o=!0),!o&&a!=null){t.liPosMinGap=a;return}l(V,g);var _=0;h(function(e,t,n){for(var r=0,i=n.count();r<i;++r){var a=n.get(e,r);isFinite(a)&&(!f||m(p,a))&&(u&&(a=c.transformIn(a,null)),V.arr[_++]=a)}});var v=V.typed?V.arr.subarray(0,_):(V.arr.length=_,V.arr);V.typed?v.sort():re(v);for(var y=1/0,b=1;b<_;++b){var x=v[b]-v[b-1];x>0&&x<y&&(y=x)}n.liPosMinGap=t.liPosMinGap=De(y)?y:_>0?-2:-1,n.serUids=r}var V=l({ctor:T},50);function Le(e){return function(t,n){var r=ie(t,{fromStat:{key:e}});if(De(r.w2))return[-r.w2/2,r.w2/2]}}function H(e,t){return e+`|&`+t}function Re(e){return Fe(),{liPosMinGap:!ee(e.scale)}}function ze(e,t,n,r){M(e,{key:t,seriesType:n,coordSysType:r,getMetrics:Re})}function Be(e){return e.scale.rawExtentInfo.makeRenderInfo().startValue}var Ve=S(),He=`__ec_stack_`;function U(e){return e.get(`stack`)||He+e.seriesIndex}function Ue(e,t){var n=We(e,t);return n.columnMap=Ge(n),n}function We(e,t){var n=H(t,z),r=[],i=ie(e,{fromStat:{key:n},min:1});return ce(e,n,function(e){r.push({barWidth:F(e.get(`barWidth`),i.w),barMaxWidth:F(e.get(`barMaxWidth`),i.w),barMinWidth:F(e.get(`barMinWidth`)||(W(e)?.5:1),i.w),barGap:e.get(`barGap`),barCategoryGap:e.get(`barCategoryGap`),defaultBarGap:e.get(`defaultBarGap`),stackId:U(e)})}),{bandWidthResult:i,seriesInfo:r}}function Ge(e){var t=e.bandWidthResult.w,n=t,r=0,i,a,o=[],s={};L(e.seriesInfo,function(e,t){t||(a=e.defaultBarGap||0);var c=e.stackId;xe(s,c)||r++;var l=s[c];l||(l=s[c]={width:0,maxWidth:0},o.push(c));var u=e.barWidth;u&&!l.width&&(l.width=u,u=R(n,u),n-=u);var d=e.barMaxWidth;d&&(l.maxWidth=d);var f=e.barMinWidth;f&&(l.minWidth=f);var p=e.barGap;p!=null&&(a=p);var m=e.barCategoryGap;m!=null&&(i=m)}),i??=B(35-o.length*4,15)+`%`;var c=F(i,t),l=F(a,1),u=(n-c)/(r+(r-1)*l);u=B(u,0),L(o,function(e){var t=s[e],i=t.maxWidth,a=t.minWidth;if(t.width){var o=t.width;i&&(o=R(o,i)),a&&(o=B(o,a)),t.width=o,n-=o+l*o,r--}else{var o=u;i&&i<o&&(o=R(i,n)),a&&a>o&&(o=a),o!==u&&(t.width=o,n-=o+l*o,r--)}}),u=(n-c)/(r+(r-1)*l),u=B(u,0);var d=0,f;L(o,function(e){var t=s[e];t.width||=u,f=t,d+=t.width*(1+l)}),f&&(d-=f.width*l);var p={},m=-d/2;return L(o,function(e){var n=s[e];p[e]=p[e]||{bandWidth:t,offset:m,width:n.width},m+=n.width*(1+l)}),p}function Ke(e){return{seriesType:e,overallReset:function(t){var n=H(e,z);be(t,n,function(t){var r=Ue(t,e);ce(t,n,function(e){var t=r.columnMap[U(e)];e.getData().setLayout({bandWidth:t.bandWidth,offset:t.offset,size:t.width})})})}}}function qe(e){return{seriesType:e,plan:je(),reset:function(e){if(ne(e)){var t=e.getData(),n=e.coordinateSystem,r=n.getBaseAxis(),i=n.getOtherAxis(r),a=t.getDimensionIndex(t.mapDimension(i.dim)),o=t.getDimensionIndex(t.mapDimension(r.dim)),s=e.get(`showBackground`,!0),c=t.mapDimension(i.dim),l=t.getCalculationInfo(`stackResultDimension`),d=x(t,c)&&!!t.getCalculationInfo(`stackedOnSeries`),f=i.isHorizontal(),p=i.toGlobalCoord(i.dataToCoord(Be(i))),m=W(e),h=e.get(`barMinHeight`)||0,g=l&&t.getDimensionIndex(l),_=t.getLayout(`size`),v=t.getLayout(`offset`);return{progress:function(e,t){for(var r=e.count,i=m&&u(r*3),c=m&&s&&u(r*3),l=m&&u(r),y=n.master.getRect(),b=f?y.width:y.height,x,S=t.getStore(),C=0;(x=e.next())!=null;){var w=S.get(d?g:a,x),T=S.get(o,x),E=p,D=void 0;d&&(D=+w-S.get(a,x));var O=void 0,k=void 0,A=void 0,j=void 0;if(f){var M=n.dataToPoint([w,T]);d&&(E=n.dataToPoint([D,T])[0]),O=E,k=M[1]+v,A=M[0]-E,j=_,_e(A)<h&&(A=(A<0?-1:1)*h)}else{var M=n.dataToPoint([T,w]);d&&(E=n.dataToPoint([T,D])[1]),O=M[0]+v,k=E,A=_,j=M[1]-E,_e(j)<h&&(j=(j<=0?-1:1)*h)}m?(i[C]=O,i[C+1]=k,i[C+2]=f?A:j,c&&(c[C]=f?y.x:O,c[C+1]=f?k:y.y,c[C+2]=b),l[x]=x):t.setItemLayout(x,{x:O,y:k,width:A,height:j}),C+=3}m&&t.setLayout({largePoints:i,largeDataIndices:l,largeBackgroundPoints:c,valueAxisHorizontal:f})}}}}}}function W(e){return e.pipelineContext&&e.pipelineContext.large}function Je(e){return Le(H(e,z))}function Ye(e){Ve(e,function(){function t(t){var n=H(t,z);ze(e,n,t,z),Oe(n,Je(t))}t(`bar`),t(`pictorialBar`)})}var G=function(e){N(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.getInitialData=function(e,t){return y(null,this,{useEncodeDefaulter:!0})},t.prototype.getMarkerPosition=function(e,t,n){var r=this.coordinateSystem;if(r&&r.clampData){var i=r.clampData(e),a=r.dataToPoint(i);if(n)L(r.getAxes(),function(e,n){if(e.type===`category`&&t!=null){var r=e.getTicksCoords(),o=e.getTickModel().get(`alignWithLabel`),s=i[n],c=t[n]===`x1`||t[n]===`y1`;if(c&&!o&&(s+=1),r.length<2)return;if(r.length===2){a[n]=e.toGlobalCoord(e.getExtent()[+!!c]);return}for(var l=void 0,u=void 0,d=1,f=0;f<r.length;f++){var p=r[f].coord,m=f===r.length-1?r[f-1].tickValue+d:r[f].tickValue;if(m===s){u=p;break}if(m<s)l=p;else if(l!=null&&m>s){u=(p+l)/2;break}f===1&&(d=m-r[0].tickValue)}u??(l?l&&(u=r[r.length-1].coord):u=r[0].coord),a[n]=e.toGlobalCoord(u)}});else{var o=this.getData(),s=o.getLayout(`offset`),c=o.getLayout(`size`),l=+!r.getBaseAxis().isHorizontal();a[l]+=s+c/2}return a}return[NaN,NaN]},t.prototype.__requireStartValue=function(e){return this.getBaseAxis()!==e},t.type=`series.__base_bar__`,t.defaultOption={z:2,coordinateSystem:`cartesian2d`,legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:`mod`,defaultBarGap:`10%`},t}(o);o.registerClass(G);var Xe=function(e){N(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.getInitialData=function(){return y(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get(`realtimeSort`,!0)||null})},t.prototype.getProgressive=function(){return this.get(`large`)?this.get(`progressive`):!1},t.prototype.__preparePipelineContext=function(e,t){var n=a(this,e,t);return n.progressiveRender&&(n.large=!0),n},t.prototype.brushSelector=function(e,t,n){return n.rect(t.getItemLayout(e))},t.type=`series.bar`,t.dependencies=[`grid`,`polar`],t.defaultOption=v(G.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:`rgba(180, 180, 180, 0.2)`,borderColor:null,borderWidth:0,borderType:`solid`,borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:de.color.primary,borderWidth:2}},realtimeSort:!1}),t}(G),Ze=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return e}(),Qe=function(e){N(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`sausage`,n}return t.prototype.getDefaultShape=function(){return new Ze},t.prototype.buildPath=function(e,t){var n=t.cx,r=t.cy,i=Math.max(t.r0||0,0),a=Math.max(t.r,0),o=(a-i)*.5,s=i+o,c=t.startAngle,l=t.endAngle,u=t.clockwise,d=Math.PI*2,f=u?l-c<d:c-l<d;f||(c=l-(u?d:-d));var p=Math.cos(c),m=Math.sin(c),h=Math.cos(l),g=Math.sin(l);f?(e.moveTo(p*i+n,m*i+r),e.arc(p*s+n,m*s+r,o,-Math.PI+c,c,!u)):e.moveTo(p*a+n,m*a+r),e.arc(n,r,a,c,l,!u),e.arc(h*s+n,g*s+r,o,l-Math.PI*2,l-Math.PI,!u),i!==0&&e.arc(n,r,i,l,c,u)},t}(Te);function $e(e,t){t||={};var n=t.isRoundCap;return function(t,r,i){var a=r.position;if(!a||a instanceof Array)return I(t,r,i);var o=e(a),s=r.distance==null?5:r.distance,c=this.shape,l=c.cx,u=c.cy,d=c.r,f=c.r0,p=(d+f)/2,m=c.startAngle,h=c.endAngle,g=(m+h)/2,_=n?Math.abs(d-f)/2:0,v=Math.cos,y=Math.sin,b=l+d*v(m),x=u+d*y(m),S=`left`,C=`top`;switch(o){case`startArc`:b=l+(f-s)*v(g),x=u+(f-s)*y(g),S=`center`,C=`top`;break;case`insideStartArc`:b=l+(f+s)*v(g),x=u+(f+s)*y(g),S=`center`,C=`bottom`;break;case`startAngle`:b=l+p*v(m)+K(m,s+_,!1),x=u+p*y(m)+q(m,s+_,!1),S=`right`,C=`middle`;break;case`insideStartAngle`:b=l+p*v(m)+K(m,-s+_,!1),x=u+p*y(m)+q(m,-s+_,!1),S=`left`,C=`middle`;break;case`middle`:b=l+p*v(g),x=u+p*y(g),S=`center`,C=`middle`;break;case`endArc`:b=l+(d+s)*v(g),x=u+(d+s)*y(g),S=`center`,C=`bottom`;break;case`insideEndArc`:b=l+(d-s)*v(g),x=u+(d-s)*y(g),S=`center`,C=`top`;break;case`endAngle`:b=l+p*v(h)+K(h,s+_,!0),x=u+p*y(h)+q(h,s+_,!0),S=`left`,C=`middle`;break;case`insideEndAngle`:b=l+p*v(h)+K(h,-s+_,!0),x=u+p*y(h)+q(h,-s+_,!0),S=`right`,C=`middle`;break;default:return I(t,r,i)}return t||={},t.x=b,t.y=x,t.align=S,t.verticalAlign=C,t}}function et(e,t,n,r){if(le(r)){e.setTextConfig({rotation:r});return}if(he(t)){e.setTextConfig({rotation:0});return}var i=e.shape,a=i.clockwise?i.startAngle:i.endAngle,o=i.clockwise?i.endAngle:i.startAngle,s=(a+o)/2,c,l=n(t);switch(l){case`startArc`:case`insideStartArc`:case`middle`:case`insideEndArc`:case`endArc`:c=s;break;case`startAngle`:case`insideStartAngle`:c=a;break;case`endAngle`:case`insideEndAngle`:c=o;break;default:e.setTextConfig({rotation:0});return}var u=Math.PI*1.5-c;l===`middle`&&u>Math.PI/2&&u<Math.PI*1.5&&(u-=Math.PI),e.setTextConfig({rotation:u})}function K(e,t,n){return t*Math.sin(e)*(n?-1:1)}function q(e,t,n){return t*Math.cos(e)*(n?1:-1)}function tt(e,t,n){var r=e.get(`borderRadius`);if(r==null)return n?{cornerRadius:0}:null;he(r)||(r=[r,r,r,r]);var i=Math.abs(t.r||0-t.r0||0);return{cornerRadius:se(r,function(e){return pe(e,i)})}}var J=Math.max,Y=Math.min,nt=function(e){N(t,e);function t(){var t=e.call(this)||this;return t.type=`bar`,t._isFirstFrame=!0,t}return t.prototype.render=function(e,t,n,r){this._model=e,this._removeOnRenderedListener(n),this._updateDrawMode(e);var i=e.get(`coordinateSystem`);(i===`cartesian2d`||i===`polar`)&&(this._progressiveEls=null,this._isLargeDraw?this._renderLarge(e,t,n):this._renderNormal(e,t,n,r))},t.prototype.incrementalPrepareRender=function(e){this._clear(),this._updateDrawMode(e),this._updateLargeClip(e)},t.prototype.incrementalRender=function(e,t){this._progressiveEls=[],this._incrementalRenderLarge(e,t)},t.prototype.eachRendered=function(e){D(this._progressiveEls||this.group,e)},t.prototype._updateDrawMode=function(e){var t=e.pipelineContext.large;(this._isLargeDraw==null||t!==this._isLargeDraw)&&(this._isLargeDraw=t,this._clear())},t.prototype._renderNormal=function(e,t,n,r){var i=this.group,a=e.getData(),o=this._data,s=e.coordinateSystem,c=s.getBaseAxis(),l;s.type===`cartesian2d`?l=c.isHorizontal():s.type===`polar`&&(l=c.dim===`angle`);var u=e.isAnimationEnabled()?e:null,d=at(e,s);d&&this._enableRealtimeSort(d,a,n);var m=e.get(`clip`,!0)||d,h=s.getArea();i.removeClipPath();var g=e.get(`roundCap`,!0),_=e.get(`showBackground`,!0),v=e.getModel(`backgroundStyle`),y=v.get(`borderRadius`)||0,b=[],x=this._backgroundEls,S=r&&r.isInitSort,w=r&&r.type===`changeAxisOrder`;function T(e){var t=X[s.type](a,e);if(!t)return null;var n=bt(s,l,t);return n.useStyle(v.getItemStyle()),s.type===`cartesian2d`?n.setShape(`r`,y):n.setShape(`cornerRadius`,y),b[e]=n,n}a.diff(o).add(function(t){var n=a.getItemModel(t),r=X[s.type](a,t,n);if(r&&(_&&T(t),a.hasValue(t)&&ut[s.type](r))){var o=!1;m&&(o=rt[s.type](h,r));var f=it[s.type](e,a,t,r,l,u,c.model,!1,g);d&&(f.forceLabelAnimation=!0),pt(f,a,t,n,r,e,l,s.type===`polar`),S?f.attr({shape:r}):d?ot(d,u,f,r,t,l,!1,!1):p(f,{shape:r},e,t),a.setItemGraphicEl(t,f),i.add(f),f.ignore=o}}).update(function(t,n){var r=a.getItemModel(t),p=X[s.type](a,t,r);if(p){if(_){var D=void 0;x.length===0?D=T(n):(D=x[n],D.useStyle(v.getItemStyle()),s.type===`cartesian2d`?D.setShape(`r`,y):D.setShape(`cornerRadius`,y),b[t]=D);var k=X[s.type](a,t),A=yt(l,k,s);f(D,{shape:A},u,t)}var j=o.getItemGraphicEl(n);if(!a.hasValue(t)||!ut[s.type](p)){i.remove(j);return}var M=!1;if(m&&(M=rt[s.type](h,p),M&&i.remove(j)),j&&(j.type===`sector`&&g||j.type===`sausage`&&!g)&&(j&&E(j,e,n),j=null),j?O(j):j=it[s.type](e,a,t,p,l,u,c.model,!0,g),d&&(j.forceLabelAnimation=!0),w){var N=j.getTextContent();if(N){var P=C(N);P.prevValue!=null&&(P.prevValue=P.value)}}else pt(j,a,t,r,p,e,l,s.type===`polar`);S?j.attr({shape:p}):d?ot(d,u,j,p,t,l,!0,w):f(j,{shape:p},e,t,null),a.setItemGraphicEl(t,j),j.ignore=M,i.add(j)}}).remove(function(t){var n=o.getItemGraphicEl(t);n&&E(n,e,t)}).execute();var D=this._backgroundGroup||=new Se;D.removeAll();for(var k=0;k<b.length;++k)D.add(b[k]);i.add(D),this._backgroundEls=b,this._data=a},t.prototype._renderLarge=function(e,t,n){this._clear(),gt(e,this.group),this._updateLargeClip(e)},t.prototype._incrementalRenderLarge=function(e,t){this._removeBackground(),gt(t,this.group,this._progressiveEls,!0)},t.prototype._updateLargeClip=function(e){var t=e.get(`clip`,!0)&&w(e.coordinateSystem,!1,e),n=this.group;t?n.setClipPath(t):n.removeClipPath()},t.prototype._enableRealtimeSort=function(e,t,n){var r=this;if(t.count()){var i=e.baseAxis;if(this._isFirstFrame)this._dispatchInitSort(t,e,n),this._isFirstFrame=!1;else{var a=function(e){var n=t.getItemGraphicEl(e),r=n&&n.shape;return r&&Math.abs(i.isHorizontal()?r.height:r.width)||0};this._onRendered=function(){r._updateSortWithinSameData(t,a,i,n)},n.getZr().on(`rendered`,this._onRendered)}}},t.prototype._dataSort=function(e,t,n){var r=[];return e.each(e.mapDimension(t.dim),function(e,t){var i=n(t);i??=NaN,r.push({dataIndex:t,mappedValue:i,ordinalNumber:e})}),r.sort(function(e,t){return t.mappedValue-e.mappedValue}),{ordinalNumbers:se(r,function(e){return e.ordinalNumber})}},t.prototype._isOrderChangedWithinSameData=function(e,t,n){for(var r=n.scale,i=e.mapDimension(n.dim),a=Number.MAX_VALUE,o=0,s=r.getOrdinalMeta().categories.length;o<s;++o){var c=e.rawIndexOf(i,r.getRawOrdinalNumber(o)),l=c<0?Number.MIN_VALUE:t(e.indexOfRawIndex(c));if(l>a)return!0;a=l}return!1},t.prototype._isOrderDifferentInView=function(e,t){for(var n=t.scale,r=n.getExtent(),i=Math.max(0,r[0]),a=Math.min(r[1],n.getOrdinalMeta().categories.length-1);i<=a;++i)if(e.ordinalNumbers[i]!==n.getRawOrdinalNumber(i))return!0},t.prototype._updateSortWithinSameData=function(e,t,n,r){if(this._isOrderChangedWithinSameData(e,t,n)){var i=this._dataSort(e,n,t);this._isOrderDifferentInView(i,n)&&(this._removeOnRenderedListener(r),r.dispatchAction({type:`changeAxisOrder`,componentType:n.dim+`Axis`,axisId:n.index,sortInfo:i}))}},t.prototype._dispatchInitSort=function(e,t,n){var r=t.baseAxis,i=this._dataSort(e,r,function(n){return e.get(e.mapDimension(t.otherAxis.dim),n)});n.dispatchAction({type:`changeAxisOrder`,componentType:r.dim+`Axis`,isInitSort:!0,axisId:r.index,sortInfo:i})},t.prototype.remove=function(e,t){this._clear(this._model),this._removeOnRenderedListener(t)},t.prototype.dispose=function(e,t){this._removeOnRenderedListener(t)},t.prototype._removeOnRenderedListener=function(e){this._onRendered&&=(e.getZr().off(`rendered`,this._onRendered),null)},t.prototype._clear=function(e){var t=this.group,n=this._data;e&&e.isAnimationEnabled()&&n&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],n.eachItemGraphicEl(function(t){E(t,e,k(t).dataIndex)})):t.removeAll(),this._data=null,this._isFirstFrame=!0},t.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},t.type=`bar`,t}(c),rt={cartesian2d:function(e,t){var n=t.width<0?-1:1,r=t.height<0?-1:1;n<0&&(t.x+=t.width,t.width=-t.width),r<0&&(t.y+=t.height,t.height=-t.height);var i=e.x+e.width,a=e.y+e.height,o=J(t.x,e.x),s=Y(t.x+t.width,i),c=J(t.y,e.y),l=Y(t.y+t.height,a),u=s<o,d=l<c;return t.x=u&&o>i?s:o,t.y=d&&c>a?l:c,t.width=u?0:s-o,t.height=d?0:l-c,n<0&&(t.x+=t.width,t.width=-t.width),r<0&&(t.y+=t.height,t.height=-t.height),u||d},polar:function(e,t){var n=t.r0<=t.r?1:-1;if(n<0){var r=t.r;t.r=t.r0,t.r0=r}var i=Y(t.r,e.r),a=J(t.r0,e.r0);t.r=i,t.r0=a;var o=i-a<0;if(n<0){var r=t.r;t.r=t.r0,t.r0=r}return o}},it={cartesian2d:function(e,t,n,r,i,a,o,s,c){var l=new ye({shape:ae({},r),z2:1});if(l.__dataIndex=n,l.name=`item`,a){var u=l.shape,d=i?`height`:`width`;u[d]=0}return l},polar:function(e,t,n,r,i,a,o,s,c){var l=!i&&c?Qe:g,u=new l({shape:r,z2:1});if(u.name=`item`,u.calculateTextPosition=$e(ft(i),{isRoundCap:l===Qe}),a){var d=u.shape,m=i?`r`:`endAngle`,h={};d[m]=i?r.r0:r.startAngle,h[m]=r[m],(s?f:p)(u,{shape:h},a)}return u}};function at(e,t){var n=e.get(`realtimeSort`,!0),r=t.getBaseAxis();if(n&&r.type===`category`&&t.type===`cartesian2d`)return{baseAxis:r,otherAxis:t.getOtherAxis(r)}}function ot(e,t,n,r,i,a,o,s){var c,l;a?(l={x:r.x,width:r.width},c={y:r.y,height:r.height}):(l={y:r.y,height:r.height},c={x:r.x,width:r.width}),s||(o?f:p)(n,{shape:c},t,i,null);var u=t?e.baseAxis.model:null;(o?f:p)(n,{shape:l},u,i)}function st(e,t){for(var n=0;n<t.length;n++)if(!isFinite(e[t[n]]))return!0;return!1}var ct=[`x`,`y`,`width`,`height`],lt=[`cx`,`cy`,`r`,`startAngle`,`endAngle`],ut={cartesian2d:function(e){return!st(e,ct)},polar:function(e){return!st(e,lt)}},X={cartesian2d:function(e,t,n){var r=e.getItemLayout(t);if(!r)return null;var i=n?mt(n,r):0,a=r.width>0?1:-1,o=r.height>0?1:-1;return{x:r.x+a*i/2,y:r.y+o*i/2,width:r.width-a*i,height:r.height-o*i}},polar:function(e,t,n){var r=e.getItemLayout(t);return{cx:r.cx,cy:r.cy,r0:r.r0,r:r.r,startAngle:r.startAngle,endAngle:r.endAngle,clockwise:r.clockwise}}};function dt(e){return e.startAngle!=null&&e.endAngle!=null&&e.startAngle===e.endAngle}function ft(e){return function(e){var t=e?`Arc`:`Angle`;return function(e){switch(e){case`start`:case`insideStart`:case`end`:case`insideEnd`:return e+t;default:return e}}}(e)}function pt(e,t,n,r,i,a,o,c){var l=t.getItemVisual(n,`style`);if(!c){var u=r.get([`itemStyle`,`borderRadius`])||0;e.setShape(`r`,u)}else if(!a.get(`roundCap`)){var d=e.shape,f=tt(r.getModel(`itemStyle`),d,!0);ae(d,f),e.setShape(d)}e.useStyle(l);var p=r.getShallow(`cursor`);p&&e.attr(`cursor`,p);var m=c?o?i.r>=i.r0?`endArc`:`startArc`:i.endAngle>=i.startAngle?`endAngle`:`startAngle`:o?xt(i,a.coordinateSystem):St(i,a.coordinateSystem),g=_(r);Pe(e,g,{labelFetcher:a,labelDataIndex:n,defaultText:fe(a.getData(),n),inheritColor:l.fill,defaultOpacity:l.opacity,defaultOutsidePosition:m});var v=e.getTextContent();if(c&&v){var y=r.get([`label`,`position`]);e.textConfig.inside=y===`middle`||null,et(e,y===`outside`?m:y,ft(o),r.get([`label`,`rotate`]))}s(v,g,a.getRawValue(n),function(e){return b(t,e)});var x=r.getModel([`emphasis`]);A(e,x.get(`focus`),x.get(`blurScope`),x.get(`disabled`)),h(e,r),dt(i)&&(e.style.fill=`none`,e.style.stroke=`none`,L(e.states,function(e){e.style&&(e.style.fill=e.style.stroke=`none`)}))}function mt(e,t){var n=e.get([`itemStyle`,`borderColor`]);if(!n||n===`none`)return 0;var r=e.get([`itemStyle`,`borderWidth`])||0,i=isNaN(t.width)?Number.MAX_VALUE:Math.abs(t.width),a=isNaN(t.height)?Number.MAX_VALUE:Math.abs(t.height);return Math.min(r,i,a)}var ht=function(){function e(){}return e}(),Z=function(e){N(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`largeBar`,n}return t.prototype.getDefaultShape=function(){return new ht},t.prototype.buildPath=function(e,t){for(var n=t.points,r=this.baseDimIdx,i=1-this.baseDimIdx,a=[],o=[],s=this.barWidth,c=0;c<n.length;c+=3)o[r]=s,o[i]=n[c+2],a[r]=n[c+r],a[i]=n[c+i],e.rect(a[0],a[1],o[0],o[1])},t}(Te);function gt(e,t,n,r){var i=e.getData(),a=+!!i.getLayout(`valueAxisHorizontal`),o=i.getLayout(`largeDataIndices`),s=i.getLayout(`size`),c=e.getModel(`backgroundStyle`),l=i.getLayout(`largeBackgroundPoints`),u=r?j(e):0;if(l){var d=new Z({shape:{points:l},incremental:u,silent:!0,z2:0});d.baseDimIdx=a,d.largeDataIndices=o,d.barWidth=s,d.useStyle(c.getItemStyle()),t.add(d),n&&n.push(d)}var f=new Z({shape:{points:i.getLayout(`largePoints`)},incremental:u,ignoreCoarsePointer:!0,z2:1});f.baseDimIdx=a,f.largeDataIndices=o,f.barWidth=s,t.add(f),f.useStyle(i.getVisual(`style`)),f.style.stroke=null,k(f).seriesIndex=e.seriesIndex,e.get(`silent`)||(f.on(`mousedown`,_t),f.on(`mousemove`,_t)),n&&n.push(f)}var _t=te(function(e){var t=this,n=vt(t,e.offsetX,e.offsetY);k(t).dataIndex=n>=0?n:null},30,!1);function vt(e,t,n){for(var r=e.baseDimIdx,i=1-r,a=e.shape.points,o=e.largeDataIndices,s=[],c=[],l=e.barWidth,u=0,d=a.length/3;u<d;u++){var f=u*3;if(c[r]=l,c[i]=a[f+2],s[r]=a[f+r],s[i]=a[f+i],c[i]<0&&(s[i]+=c[i],c[i]=-c[i]),t>=s[0]&&t<=s[0]+c[0]&&n>=s[1]&&n<=s[1]+c[1])return o[u]}return-1}function yt(e,t,n){if(Me(n,`cartesian2d`)){var r=t,i=n.getArea();return{x:e?r.x:i.x,y:e?i.y:r.y,width:e?r.width:i.width,height:e?i.height:r.height}}var i=n.getArea(),a=t;return{cx:i.cx,cy:i.cy,r0:e?i.r0:a.r0,r:e?i.r:a.r,startAngle:e?a.startAngle:0,endAngle:e?a.endAngle:Math.PI*2}}function bt(e,t,n){return new(e.type===`polar`?g:ye)({shape:yt(t,n,e),silent:!0,z2:0})}function xt(e,t){return e.height===0?t.getOtherAxis(t.getBaseAxis()).inverse?`bottom`:`top`:e.height>0?`bottom`:`top`}function St(e,t){return e.width===0?t.getOtherAxis(t.getBaseAxis()).inverse?`left`:`right`:e.width>=0?`right`:`left`}function Ct(e){e.registerChartView(nt),e.registerSeriesModel(Xe),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,Ke(`bar`)),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,qe(`bar`)),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,Ne(`bar`)),e.registerAction({type:`changeAxisOrder`,event:`changeAxisOrder`,update:`update`},function(e,t){var n=e.componentType||`series`;t.eachComponent({mainType:n,query:e},function(t){e.sortInfo&&t.axis.setCategorySortInfo(e.sortInfo)})}),Ye(e)}var wt=e=>{if(e.kind!==`parquet`)throw Error(i.t(`backtest.errors.parquetRequired`));let t=e.columns||[];return(e.rows||[]).map(e=>Object.fromEntries(t.map((t,n)=>[t,e[n]])))},Q=async(e,t,n)=>{let a=5e3,o=[];for(let s=0;;s+=a){let c=await r(e,s,a,t,n);if(c.kind!==`parquet`)throw Error(i.t(`backtest.errors.parquetRequired`));if(o.push(...wt(c)),!c.has_more)return o}};async function Tt(e,t,n){let r=e.artifacts?.daily?.path,a=e.artifacts?.summary?.path;if(!r||!a)throw Error(i.t(`backtest.errors.missingDailySummary`));let[o,s]=await Promise.all([Q(`${e._path}/${r}`,t,n),Q(`${e._path}/${a}`,t,n)]);return{daily:o,summary:s}}async function Et(e,t,n){let r=e.artifacts?.daily?.path;if(!r)throw Error(i.t(`backtest.errors.missingDaily`));return Q(`${e._path}/${r}`,t,n)}var $=t(e(),1),Dt=n();ve([Ae,Ct,P,ge,Ce,ue,Ee]);function Ot({rows:e,series:t,percent:n=!1,zoom:r=!1,onHover:i,onSelect:a}){let o=(0,$.useRef)(null),[s,c]=(0,$.useState)(()=>document.documentElement.dataset.theme);return(0,$.useEffect)(()=>{let e=new MutationObserver(()=>c(document.documentElement.dataset.theme));return e.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),()=>e.disconnect()},[]),(0,$.useEffect)(()=>{if(!o.current)return;let s=getComputedStyle(o.current),c=e=>s.getPropertyValue(e).trim(),l=Array.from({length:8},(e,t)=>c(`--chart-${t+1}`)),u=c(`--muted`),d=c(`--faint`),f=c(`--line`),p=c(`--surface`),m=c(`--ink`),h=we(o.current,void 0,{renderer:`canvas`}),g=(e,t)=>t===`percent`||!t&&n?`${(e*100).toFixed(1)}%`:e.toFixed(t===`precise`?4:t===`decimal`?2:3),_=e=>t.find(t=>(t.axis||0)===e)?.format,v=t.some(e=>e.axis===1),y=r&&e.length>18,b=y?Math.max(0,100-1800/e.length):0,x=(n,r)=>{let i=e.slice(Math.floor(n/100*(e.length-1)),Math.ceil(r/100*(e.length-1))+1),a=[0,1].map(e=>{let n=t.filter(t=>(t.axis||0)===e).flatMap(e=>i.map(t=>t[e.key])).filter(e=>e!=null&&e!==``).map(Number).filter(Number.isFinite);return{positive:Math.max(0,...n),negative:Math.max(0,...n.map(e=>-e))}}),o=Math.min(.85,Math.max(.15,...a.map(({positive:e,negative:t})=>e+t?e/(e+t):0)));return a.map(({positive:e,negative:t})=>{let n=Math.max(e/o,t/(1-o),1e-6)*1.08;return{min:-(1-o)*n,max:o*n}})},S=v?x(b,100):[];h.setOption({animation:!1,color:l,grid:{left:66,right:v?66:22,top:68,bottom:y?76:42},legend:{type:`scroll`,top:8,textStyle:{color:u,fontSize:11}},tooltip:{trigger:`axis`,order:`valueDesc`,backgroundColor:p,borderColor:f,textStyle:{color:m},valueFormatter:e=>g(Number(e))},xAxis:{type:`category`,boundaryGap:t.some(e=>e.type===`bar`),data:e.map(e=>e.date),axisLabel:{color:d,hideOverlap:!0},axisLine:{lineStyle:{color:f}}},...y?{dataZoom:[{type:`inside`,start:b,end:100},{type:`slider`,start:b,end:100,bottom:12,height:20,borderColor:f,fillerColor:c(`--accent-soft`),handleStyle:{color:c(`--accent`)},textStyle:{color:d}}]}:{},yAxis:[{type:`value`,...v?{...S[0],splitNumber:6}:{},axisLabel:{formatter:e=>g(e,_(0)),color:d},splitLine:{lineStyle:{color:f,opacity:.6}}},...v?[{type:`value`,...S[1],splitNumber:6,axisLabel:{formatter:e=>g(e,_(1)),color:d},splitLine:{show:!1}}]:[]],series:t.map(t=>({name:t.label,type:t.type||`line`,yAxisIndex:t.axis||0,data:e.map(e=>{let n=e[t.key];if(n==null||n===``)return null;let r=Number(n);return Number.isFinite(r)?r:null}),showSymbol:!1,connectNulls:!1,smooth:!1,barMaxWidth:24,tooltip:{valueFormatter:e=>g(Number(e),t.format)},lineStyle:{width:t.dashed?1.4:2,type:t.dashed?`dashed`:`solid`},emphasis:{focus:`series`}}))}),v&&y&&h.on(`datazoom`,()=>{let e=h.getOption().dataZoom?.[0],t=x(e?.start??0,e?.end??100);h.setOption({yAxis:t},{lazyUpdate:!0})});let C=t=>e[t.dataIndex]?.date;h.on(`mouseover`,e=>i?.(C(e))),h.on(`click`,e=>a?.(C(e)));let w=new ResizeObserver(()=>h.resize());return w.observe(o.current),()=>{w.disconnect(),h.dispose()}},[i,a,n,e,t,s,r]),(0,Dt.jsx)(`div`,{className:`backtest-chart`,ref:o})}export{Tt as n,Et as r,Ot as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,c as t,n,t as r}from"./jsx-runtime-g_EzXSjx.js";import{t as i}from"./createLucideIcon-3GmWj6nd.js";import{t as a}from"./arrow-down-BH_K5gzy.js";import{i as o}from"./client-BfOnNqgS.js";import{a as s}from"./api-gyN9gj0Q.js";import{n as c,t as l}from"./BacktestChart-B2A5g1WP.js";var u={name:`arrow-up-down`,size:24,node:[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]};u.node;var d=i(u),f={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};f.node;var p=i(f),m={name:`list-restart`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M7 12H3`,key:`13ou7f`}],[`path`,{d:`M7 19H3`,key:`wbqt3n`}],[`path`,{d:`M12 18a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L11 14`,key:`qth677`}],[`path`,{d:`M11 10v4h4`,key:`172dkj`}]]};m.node;var h=i(m),g={name:`lock-keyhole`,size:24,node:[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]};g.node;var _=i(g),v={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};v.node;var y=i(v),b=t(e(),1),x=r();function S({range:e,count:t,onChange:n,labels:r}){let i=(0,b.useRef)(null),a=Math.max(0,t-1),o=e=>`${a?e/a*100:0}%`,s=(e,t)=>{let n=t.getBoundingClientRect();return Math.round(Math.max(0,Math.min(1,(e-n.left)/n.width))*a)},c=(t,r)=>{let i=e[t],o=r.key===`ArrowLeft`||r.key===`ArrowDown`?i-1:r.key===`ArrowRight`||r.key===`ArrowUp`?i+1:r.key===`Home`?0:r.key===`End`?a:null;o!==null&&(r.preventDefault(),n(t,Math.max(0,Math.min(a,o))))};return(0,x.jsxs)(`div`,{className:`date-range-slider`,onPointerDown:t=>{let r=s(t.clientX,t.currentTarget),a=t.target.closest(`[data-edge]`),o=a?Number(a.dataset.edge):Math.abs(r-e[0])<=Math.abs(r-e[1])?0:1;i.current=o,t.currentTarget.setPointerCapture(t.pointerId),n(o,r)},onPointerMove:e=>{i.current!==null&&n(i.current,s(e.clientX,e.currentTarget))},onPointerUp:()=>{i.current=null},onPointerCancel:()=>{i.current=null},onLostPointerCapture:()=>{i.current=null},children:[(0,x.jsx)(`div`,{className:`date-range-track`}),(0,x.jsx)(`div`,{className:`date-range-selection`,style:{left:o(e[0]),right:`${100-(a?e[1]/a*100:0)}%`}}),[0,1].map(t=>(0,x.jsx)(`span`,{className:`date-range-handle`,"data-edge":t,role:`slider`,tabIndex:0,"aria-label":r[t],"aria-valuemin":t===0?0:e[0],"aria-valuemax":t===0?e[1]:a,"aria-valuenow":e[t],style:{left:o(e[t])},onKeyDown:e=>c(t,e)},t))]})}var C=e=>e==null||e===``?NaN:Number(e),w=(e,t=2)=>Number.isFinite(C(e))?C(e).toFixed(t):`—`,T=e=>Number.isFinite(C(e))?`${(C(e)*100).toFixed(2)}%`:`—`,E=e=>`${e.slice(0,4)}-${e.slice(4,6)}-${e.slice(6,8)}`,D=e=>e.replaceAll(`-`,``),O=[{key:`ic`,label:`IC`},{key:`rank_ic`,label:`RankIC`}],k=[5,10,15,20,30].map(e=>({key:`ndcg_${e}`,label:`NDCG@${e}`,sourceKey:`top${e}_ndcg`})),A=(e,t)=>{let n=0;return e.forEach((e,r)=>{e.trade_date<=t&&(n=r)}),n};function j(e,t,n=20){return e.map((r,i)=>{let a=e.slice(Math.max(0,i-n+1),i+1).map(e=>C(e[t])).filter(Number.isFinite);return a.length?a.reduce((e,t)=>e+t,0)/a.length:null})}function M({rows:e,series:t}){let{t:r}=n();return(0,x.jsxs)(`div`,{className:`backtest-series-means`,children:[(0,x.jsx)(`small`,{children:r(`backtest.daily_mean_in_range`)}),t.map(({key:t,label:n,sourceKey:r})=>{let i=e.map(e=>C(e[r||t])).filter(Number.isFinite),a=i.length?i.reduce((e,t)=>e+t,0)/i.length:NaN;return(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`em`,{children:n}),(0,x.jsx)(`strong`,{children:w(a,4)})]},t)})]})}function N(e,t,n,r,i){let a=new Map,o=[...t.map(e=>[`top${e}`,`top${e}_${r?`net`:`gross`}_return`]),...n.map(({key:e})=>[`benchmark_${e}`,`benchmark_${e}_return`])];for(let[e]of o)a.set(e,+!!r);let s=[{date:i,...Object.fromEntries(o.map(([e])=>[e,0]))}];for(let t of e){let e={date:t.trade_date};for(let[n,i]of o){let o=C(t[i]);if(!Number.isFinite(o)){e[n]=null;continue}let s=r?(a.get(n)||1)*(1+o):(a.get(n)||0)+o;a.set(n,s),e[n]=r?s-1:s}s.push(e)}return s}function P(e){let t=j(e,`ic`),n=j(e,`rank_ic`),r=[5,10,15,20,30].map(t=>[t,j(e,`top${t}_ndcg`)]);return e.map((e,i)=>({date:e.trade_date,ic:t[i],rank_ic:n[i],...Object.fromEntries(r.map(([e,t])=>[`ndcg_${e}`,t[i]]))}))}function F({meta:e,target:t}){let{t:r}=n(),[i,a]=(0,b.useState)([]),[l,u]=(0,b.useState)([]),[d,f]=(0,b.useState)(!0),[p,m]=(0,b.useState)(``);return(0,b.useEffect)(()=>{let n=new AbortController;return f(!0),m(``),c(e,t,n.signal).then(e=>{a(e.daily),u(e.summary)}).catch(e=>{n.signal.aborted||m(e instanceof Error?e.message:String(e))}).finally(()=>!n.signal.aborted&&f(!1)),()=>n.abort()},[e,t]),d?(0,x.jsx)(`div`,{className:`research-loading`,children:(0,x.jsx)(o,{className:`spin`})}):p||!i.length?(0,x.jsxs)(`div`,{className:`data-gap`,children:[(0,x.jsx)(s,{}),(0,x.jsx)(`strong`,{children:r(`backtest.unable_to_load_backtest_artifacts`)}),(0,x.jsx)(`span`,{children:p||r(`backtest.daily_parquet_is_empty`)})]}):(0,x.jsx)(I,{meta:e,daily:i,summary:l})}function I({meta:e,daily:t,summary:r}){let{t:i}=n(),a=e.dimensions?.top_ns||[1,2,3,5,10,15,20,30],o=e.dimensions?.benchmarks||[{key:`universe`,label:i(`backtest.marketAverage`)}],[s,c]=(0,b.useState)(`gross`),[l,u]=(0,b.useState)([0,t.length-1]),[d,f]=(0,b.useState)(``),[p,m]=(0,b.useState)(``),h=[[`gross`,i(`backtest.gross_return`)],[`net`,i(`backtest.net_return`)],[`quality`,i(`backtest.model_quality`)],[`overall`,i(`backtest.overall`)],[`year`,i(`backtest.yearly`)],[`quarter`,i(`backtest.quarterly`)],[`month`,i(`backtest.monthly`)]];return(0,x.jsxs)(`div`,{className:`backtest-report`,children:[(0,x.jsx)(`nav`,{className:`backtest-tabs`,children:h.map(([e,t])=>(0,x.jsx)(`button`,{className:s===e?`active`:``,onClick:()=>c(e),children:t},e))}),s===`gross`||s===`net`||s===`quality`?(0,x.jsx)(L,{view:s,daily:t,topNs:a,benchmarks:o,range:l,setRange:u,hoveredDate:d,setHoveredDate:f,lockedDate:p,setLockedDate:m}):(0,x.jsx)(q,{rows:r.filter(e=>e.period_type===s),topNs:a,benchmarks:o})]})}function L({view:e,daily:t,topNs:r,benchmarks:i,range:a,setRange:o,hoveredDate:s,setHoveredDate:c,lockedDate:u,setLockedDate:d}){let{t:f}=n(),p=(e,t)=>o(n=>{let[r,i]=n,a=e===0?[Math.min(t,i),i]:[r,Math.max(t,r)];return a[0]===r&&a[1]===i?n:a}),m=(0,b.useMemo)(()=>t.slice(a[0],a[1]+1),[t,a]),h=(0,b.useMemo)(()=>P(t),[t]),g=(0,b.useMemo)(()=>h.slice(a[0],a[1]+1),[h,a]),_=new Set(m.map(e=>e.trade_date)),v=_.has(u)&&u||_.has(s)&&s||m.at(-1)?.trade_date,C=t.find(e=>e.trade_date===v)||m.at(-1),w=(0,b.useCallback)(e=>{e!==f(`common.start`)&&c(e)},[c,f]),T=(0,b.useCallback)(e=>{e!==f(`common.start`)&&d(t=>t===e?``:e)},[d,f]),j=(0,b.useMemo)(()=>[...r.map(e=>({key:`top${e}`,label:`Top ${e}`})),...i.map(({key:e,label:t})=>({key:`benchmark_${e}`,label:t,dashed:!0}))],[i,r]),F=(0,b.useMemo)(()=>N(m,r,i,!1,f(`common.start`)),[i,m,r,f]),I=(0,b.useMemo)(()=>N(m,r,i,!0,f(`common.start`)),[i,m,r,f]);return(0,x.jsxs)(`div`,{className:`backtest-overview`,children:[(0,x.jsxs)(`section`,{className:`range-toolbar`,children:[(0,x.jsxs)(`label`,{children:[(0,x.jsx)(`span`,{children:f(`backtest.from`)}),(0,x.jsx)(`input`,{type:`date`,value:E(t[a[0]].trade_date),min:E(t[0].trade_date),max:E(t[a[1]].trade_date),onChange:e=>{let n=D(e.target.value);p(0,Math.max(0,t.findIndex(e=>e.trade_date>=n)))}})]}),(0,x.jsx)(S,{range:a,count:t.length,onChange:p,labels:[f(`backtest.dateRange.start`),f(`backtest.dateRange.end`)]}),(0,x.jsxs)(`label`,{children:[(0,x.jsx)(`span`,{children:f(`backtest.to`)}),(0,x.jsx)(`input`,{type:`date`,value:E(t[a[1]].trade_date),min:E(t[a[0]].trade_date),max:E(t.at(-1).trade_date),onChange:e=>{let n=D(e.target.value);p(1,A(t,n))}})]}),(0,x.jsxs)(`strong`,{children:[m.length,` `,f(`backtest.days`)]}),(0,x.jsx)(`button`,{onClick:()=>o([0,t.length-1]),title:f(`backtest.reset`),children:(0,x.jsx)(y,{})})]}),e===`gross`&&(0,x.jsx)(R,{title:f(`backtest.cumulative_gross_return`),hint:f(`backtest.arithmetic_sum_rebased_to_zero`),children:(0,x.jsx)(l,{rows:F,series:j,percent:!0,onHover:w,onSelect:T})}),e===`net`&&(0,x.jsx)(R,{title:f(`backtest.compounded_net_return`),hint:f(`backtest.strategies_include_turnover_costs`),children:(0,x.jsx)(l,{rows:I,series:j,percent:!0,onHover:w,onSelect:T})}),e===`quality`&&(0,x.jsxs)(R,{title:`IC / RankIC · MA20`,hint:f(`backtest.candidate_universe`),children:[(0,x.jsx)(M,{rows:m,series:O}),(0,x.jsx)(l,{rows:g,series:O,onHover:w,onSelect:T})]}),e===`quality`&&(0,x.jsxs)(R,{title:`NDCG · MA20`,hint:f(`backtest.return_percentile_relevance`),children:[(0,x.jsx)(M,{rows:m,series:k}),(0,x.jsx)(l,{rows:g,series:k,onHover:w,onSelect:T})]}),(e===`gross`||e===`net`)&&(0,x.jsx)(z,{row:C,locked:!!(u&&_.has(u)),onUnlock:()=>d(``),onLatest:()=>{d(``),c(``)}})]})}function R({title:e,hint:t,children:n}){return(0,x.jsxs)(`section`,{className:`viz-card backtest-chart-card`,children:[(0,x.jsxs)(`header`,{children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`small`,{children:`BACKTEST SERIES`}),(0,x.jsx)(`h3`,{children:e})]}),(0,x.jsx)(`span`,{children:t})]}),n]})}function z({row:e,locked:t,onUnlock:r,onLatest:i}){let{t:o,i18n:s}=n(),c=e?.top30_holdings||[],[l,u]=(0,b.useState)(null),f=l?[...c].sort((e,t)=>{let n=e[l.key],r=t[l.key];return(typeof n==`number`&&typeof r==`number`?n-r:String(n).localeCompare(String(r),s.resolvedLanguage===`zh`?`zh-CN`:`en`))*(l.direction===`asc`?1:-1)}):c,m=e=>{let t=c.map(t=>t[e]);return new Set(t).size>1?G(t):void 0},g={prediction:m(`prediction`),daily_return:m(`daily_return`),weight:m(`weight`)},v=(e,t)=>{let n=l?.key===e;return(0,x.jsx)(`th`,{"aria-sort":n?l.direction===`asc`?`ascending`:`descending`:`none`,children:(0,x.jsxs)(`button`,{type:`button`,className:`summary-sort-button${n?` active`:``}`,onClick:()=>u(t=>W(t,e)),"aria-label":o(`backtest.sortBy`,{label:t,direction:n&&l.direction===`asc`?o(`backtest.descending`):o(`backtest.ascending`)}),children:[(0,x.jsx)(`span`,{children:t}),n?l.direction===`asc`?(0,x.jsx)(p,{}):(0,x.jsx)(a,{}):(0,x.jsx)(d,{})]})},e)};return(0,x.jsxs)(`section`,{className:`viz-card holdings-panel`,children:[(0,x.jsxs)(`header`,{children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`small`,{children:`TOP 30 HOLDINGS`}),(0,x.jsxs)(`h3`,{children:[e?.trade_date||`—`,` · `,c.length,` `,o(`backtest.stocks`)]})]}),(0,x.jsxs)(`div`,{className:`holdings-actions`,children:[(0,x.jsxs)(`button`,{type:`button`,className:`summary-sort-reset`,onClick:()=>u(null),disabled:!l,"aria-label":o(`backtest.reset_holdings_sorting`),title:o(`backtest.reset_sorting`),children:[(0,x.jsx)(h,{}),o(`backtest.reset_sort`)]}),t&&(0,x.jsxs)(`button`,{type:`button`,onClick:r,children:[(0,x.jsx)(_,{}),o(`backtest.unlock`)]}),(0,x.jsxs)(`button`,{type:`button`,onClick:i,title:o(`backtest.show_the_latest_day_in`),children:[(0,x.jsx)(y,{}),o(`backtest.latest`)]})]})]}),(0,x.jsx)(`div`,{className:`mini-table`,children:(0,x.jsxs)(`table`,{children:[(0,x.jsx)(`thead`,{children:(0,x.jsxs)(`tr`,{children:[v(`rank`,`#`),v(`ts_code`,o(`backtest.code`)),v(`name`,o(`backtest.name`)),v(`prediction`,o(`backtest.prediction`)),v(`daily_return`,o(`backtest.return`)),v(`weight`,o(`backtest.weight`))]})}),(0,x.jsx)(`tbody`,{children:f.map(e=>(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:e.rank}),(0,x.jsx)(`td`,{children:(0,x.jsx)(`code`,{children:e.ts_code})}),(0,x.jsx)(`td`,{children:e.name}),(0,x.jsx)(`td`,{children:(0,x.jsx)(K,{value:e.prediction,format:e=>w(e,6),domain:g.prediction})}),(0,x.jsx)(`td`,{className:e.daily_return>=0?`positive`:`negative`,children:(0,x.jsx)(K,{value:e.daily_return,format:T,domain:g.daily_return})}),(0,x.jsx)(`td`,{children:(0,x.jsx)(K,{value:e.weight,format:T,domain:g.weight})})]},e.ts_code))})]})})]})}var B=[{key:`net_cumulative_return`,format:T,percent:!0},{key:`net_annualized_return`,format:T,percent:!0},{key:`net_annualized_volatility`,format:T,percent:!0},{key:`net_max_drawdown`,format:T,percent:!0},{key:`net_win_rate`,format:T,percent:!0},{key:`average_turnover`,format:T,percent:!0},{key:`gross_cumulative_return`,format:T,percent:!0},{key:`gross_sharpe`,format:w,percent:!1}],V=[{key:`trading_days`,format:e=>w(e,0),percent:!1},{key:`ic_mean`,format:e=>w(e,4),percent:!1},{key:`icir`,format:w,percent:!1},{key:`rank_ic_mean`,format:e=>w(e,4),percent:!1},{key:`rank_icir`,format:w,percent:!1}],H=(e,t,n)=>e[`top${t}_${n}`],U=e=>e==null||!Number.isFinite(Number(e))?``:Number(e)<0?`negative`:Number(e)>0?`positive`:``,W=(e,t)=>({key:t,direction:e?.key===t&&e.direction===`asc`?`desc`:`asc`}),G=e=>{let t=e.map(C).filter(Number.isFinite);return{min:Math.min(0,...t),max:Math.max(0,...t)}};function K({value:e,format:t,domain:n}){let r=C(e),i=n?-n.min/(n.max-n.min||1)*100:0,a=Number.isFinite(r)?n&&r<0?i+r/(n.max-n.min||1)*100:i:0,o=Number.isFinite(r)?Math.abs(r/((n?.max??0)-(n?.min??0)||1))*100:0;return(0,x.jsxs)(`span`,{className:`summary-data-cell`,children:[n&&n.min<0&&n.max>0&&(0,x.jsx)(`span`,{className:`summary-data-zero`,style:{left:`${i}%`},"aria-hidden":`true`}),n&&o>0&&(0,x.jsx)(`span`,{className:`summary-data-bar${r<0?` negative`:``}`,style:{left:`${a}%`,width:`${o}%`},"aria-hidden":`true`}),(0,x.jsx)(`span`,{className:`summary-data-value`,children:t(e)})]})}function q({rows:e,topNs:t,benchmarks:r}){let{t:i}=n(),[o,s]=(0,b.useState)(t.includes(30)?30:t[0]),[c,l]=(0,b.useState)(null),[u,f]=(0,b.useState)(null),m=e[0]?.period_type===`overall`,h=[...e].sort((e,t)=>e.period.localeCompare(t.period)),g=[...B,...r.map(({key:e,label:t})=>({key:`information_ratio_${e}`,label:`IR · ${t}`,english:`IR · ${t}`,format:w,percent:!1}))],_=e=>m?`${e.period_start}—${e.period_end}`:e.period;if(!e.length)return(0,x.jsx)(`div`,{className:`chart-empty`,children:i(`backtest.noSummaryData`)});let v=m?t.map(e=>({row:h[0],topN:e,key:`top-${e}`})):h.map(e=>({row:e,topN:o,key:e.period})),S=Object.fromEntries(V.map(({key:e})=>[e,G(h.map(t=>t[e]))])),T=Object.fromEntries(g.map(({key:e})=>[e,G(v.map(({row:t,topN:n})=>H(t,n,e)))])),E=c?[...h].sort((e,t)=>{let{key:n,direction:r}=c;if(n===`period`)return e.period.localeCompare(t.period)*(r===`asc`?1:-1);let i=C(e[n]),a=C(t[n]);return Number.isFinite(i)?Number.isFinite(a)?(i-a)*(r===`asc`?1:-1):-1:+!!Number.isFinite(a)}):h,D=u?[...v].sort((e,t)=>{let{key:n,direction:r}=u;if(n===`top_n`)return(e.topN-t.topN)*(r===`asc`?1:-1);if(n===`period`)return e.row.period.localeCompare(t.row.period)*(r===`asc`?1:-1);let i=C(H(e.row,e.topN,n)),a=C(H(t.row,t.topN,n));return Number.isFinite(i)?Number.isFinite(a)?(i-a)*(r===`asc`?1:-1):-1:+!!Number.isFinite(a)}):v,O=(e,t,n,r)=>{let o=n?.key===e;return(0,x.jsx)(`th`,{"aria-sort":o?n.direction===`asc`?`ascending`:`descending`:`none`,children:(0,x.jsxs)(`button`,{type:`button`,className:`summary-sort-button${o?` active`:``}`,onClick:()=>r(e),"aria-label":i(`backtest.sortBy`,{label:t,direction:o&&n.direction===`asc`?i(`backtest.descending`):i(`backtest.ascending`)}),children:[(0,x.jsx)(`span`,{children:t}),o?n.direction===`asc`?(0,x.jsx)(p,{}):(0,x.jsx)(a,{}):(0,x.jsx)(d,{})]})},e)},k=(0,x.jsxs)(`label`,{className:`summary-select-label`,children:[(0,x.jsx)(`span`,{children:`Top N`}),(0,x.jsx)(`select`,{"aria-label":i(`backtest.select_top_n`),value:o,onChange:e=>s(Number(e.target.value)),children:t.map(e=>(0,x.jsxs)(`option`,{value:e,children:[`Top `,e]},e))})]});return(0,x.jsxs)(`div`,{className:`summary-view`,children:[(0,x.jsxs)(`section`,{className:`summary-section`,children:[(0,x.jsxs)(`div`,{className:`summary-section-heading`,children:[(0,x.jsx)(`span`,{className:`summary-section-index`,children:`01`}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`small`,{children:i(`backtest.independent_of_top_n`)}),(0,x.jsx)(`h3`,{children:i(`backtest.overall_metrics`)})]})]}),m&&(0,x.jsx)(`div`,{className:`summary-signal-cards`,children:V.map(({key:t,format:n})=>(0,x.jsxs)(`article`,{className:`viz-card`,children:[(0,x.jsx)(`span`,{children:i(`backtest.metrics.${t}`)}),(0,x.jsx)(`strong`,{children:n(e[0][t])})]},t))}),(0,x.jsxs)(`section`,{className:`viz-card summary-table summary-signal-table`,children:[(0,x.jsxs)(`header`,{children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`small`,{children:`BASE METRICS`}),(0,x.jsx)(`h3`,{children:i(`backtest.overall_metric_details`)})]}),(0,x.jsx)(`button`,{type:`button`,className:`summary-sort-reset`,onClick:()=>l(null),disabled:!c,"aria-label":i(`backtest.reset_overall_metric_sorting`),title:i(`backtest.reset_sorting`),children:(0,x.jsx)(y,{})})]}),(0,x.jsx)(`div`,{className:`mini-table`,role:`region`,"aria-label":i(`backtest.overall_metric_details`),tabIndex:0,children:(0,x.jsxs)(`table`,{children:[(0,x.jsx)(`thead`,{children:(0,x.jsxs)(`tr`,{children:[O(`period`,i(`backtest.period`),c,e=>l(t=>W(t,e))),V.map(e=>O(e.key,i(`backtest.metrics.${e.key}`),c,e=>l(t=>W(t,e))))]})}),(0,x.jsx)(`tbody`,{children:E.map(e=>(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:(0,x.jsx)(`strong`,{children:_(e)})}),V.map(({key:t,format:n})=>(0,x.jsx)(`td`,{children:(0,x.jsx)(K,{value:e[t],format:n,domain:h.length>1?S[t]:void 0})},t))]},e.period))})]})})]})]}),(0,x.jsxs)(`section`,{className:`summary-section`,children:[(0,x.jsxs)(`div`,{className:`summary-section-heading`,children:[(0,x.jsx)(`span`,{className:`summary-section-index`,children:`02`}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`small`,{children:i(`backtest.filter_by_portfolio_size`)}),(0,x.jsxs)(`h3`,{children:[`Top N `,i(`backtest.metrics_2`)]})]})]}),(0,x.jsxs)(`section`,{className:`viz-card summary-table summary-detail-table`,children:[(0,x.jsxs)(`header`,{children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`small`,{children:`TOP N DETAIL`}),(0,x.jsx)(`h3`,{children:m?i(`backtest.all_top_n_metrics`):i(`backtest.topNAllMetrics`,{topN:o})})]}),(0,x.jsxs)(`div`,{className:`summary-chart-controls`,children:[!m&&k,(0,x.jsx)(`span`,{className:`summary-table-hint`,children:i(`backtest.scroll_sideways`)}),(0,x.jsx)(`button`,{type:`button`,className:`summary-sort-reset`,onClick:()=>f(null),disabled:!u,"aria-label":i(`backtest.reset_table_sorting`),title:i(`backtest.reset_sorting`),children:(0,x.jsx)(y,{})})]})]}),(0,x.jsx)(`div`,{className:`mini-table`,role:`region`,"aria-label":i(m?`backtest.overall_metrics_by_top_n`:`backtest.top_n_period_metric_details`),tabIndex:0,children:(0,x.jsxs)(`table`,{children:[(0,x.jsx)(`thead`,{children:(0,x.jsxs)(`tr`,{children:[O(m?`top_n`:`period`,m?`Top N`:i(`backtest.period`),u,e=>f(t=>W(t,e))),g.map(e=>O(e.key,i(`backtest.metrics.${e.key}`),u,e=>f(t=>W(t,e))))]})}),(0,x.jsx)(`tbody`,{children:D.map(({row:e,topN:t,key:n})=>(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{children:(0,x.jsx)(`strong`,{children:m?`Top ${t}`:_(e)})}),g.map(({key:n,format:r})=>{let i=H(e,t,n);return(0,x.jsx)(`td`,{className:U(i),children:(0,x.jsx)(K,{value:i,format:r,domain:v.length>1?T[n]:void 0})},n)})]},n))})]})})]})]})]})}export{F as BacktestView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,c as t,n,t as r}from"./jsx-runtime-g_EzXSjx.js";import{t as i}from"./file-spreadsheet-CCWLaZh3.js";import{a}from"./api-gyN9gj0Q.js";import{N as o,g as s,j as c}from"./index-Dds_R6_G.js";import{n as l,t as u}from"./lib-BNb3H2Uy.js";import{n as d}from"./TushareBrowserPage-D8Li-RN1.js";var f=t(e(),1),p=r();function m({preview:e,onPage:t}){let{t:r}=n();if(e.kind===`parquet`){let n=e.offset||0,a=e.limit||200;return(0,p.jsxs)(`div`,{className:`workspace-parquet`,children:[(0,p.jsxs)(`div`,{className:`parquet-summary`,children:[(0,p.jsxs)(`article`,{children:[(0,p.jsx)(`small`,{children:r(`workspacePreview.rowCount`)}),(0,p.jsx)(`strong`,{children:(e.row_count??0).toLocaleString()})]}),(0,p.jsxs)(`article`,{children:[(0,p.jsx)(`small`,{children:r(`workspacePreview.fields`)}),(0,p.jsx)(`strong`,{children:e.column_schema?.length??e.columns?.length??0})]}),(0,p.jsxs)(`article`,{children:[(0,p.jsx)(`small`,{children:r(`workspacePreview.rowGroups`)}),(0,p.jsx)(`strong`,{children:e.row_group_count??0})]}),(0,p.jsxs)(`article`,{children:[(0,p.jsx)(`small`,{children:r(`workspacePreview.size`)}),(0,p.jsx)(`strong`,{children:s(e.size)})]})]}),(0,p.jsxs)(`section`,{className:`parquet-schema`,children:[(0,p.jsxs)(`header`,{children:[(0,p.jsx)(c,{}),(0,p.jsx)(`strong`,{children:r(`workspacePreview.schema`)})]}),(0,p.jsx)(`div`,{children:(e.column_schema||[]).map(e=>(0,p.jsxs)(`span`,{children:[(0,p.jsx)(`code`,{children:e.name}),(0,p.jsx)(`small`,{children:e.type}),e.nullable&&(0,p.jsx)(`i`,{children:`NULL`})]},e.name))})]}),(0,p.jsxs)(`section`,{className:`parquet-sample`,children:[(0,p.jsxs)(`header`,{children:[(0,p.jsx)(i,{}),(0,p.jsx)(`strong`,{children:r(`workspacePreview.parquet`)}),(0,p.jsxs)(`small`,{children:[e.rows?.length?`${n+1}–${n+e.rows.length}`:`0`,` `,r(`workspacePreview.rows`)]})]}),(0,p.jsx)(h,{columns:e.columns||[],rows:e.rows||[],offset:n}),(0,p.jsxs)(`footer`,{children:[(0,p.jsx)(`button`,{disabled:n===0,onClick:()=>t(Math.max(0,n-a)),children:r(`workspacePreview.previous`)}),(0,p.jsx)(`button`,{disabled:!e.has_more,onClick:()=>t(n+a),children:r(`workspacePreview.next`)})]})]})]})}if(e.kind===`unsupported`)return(0,p.jsxs)(`div`,{className:`workspace-preview-message`,children:[(0,p.jsx)(d,{}),(0,p.jsx)(`strong`,{children:r(`workspacePreview.unsupported`)})]});if(e.kind===`csv`){let n=e.offset||0,i=e.limit||200;return(0,p.jsxs)(`div`,{className:`workspace-csv`,children:[(0,p.jsx)(`div`,{className:`workspace-csv-scroll`,children:(0,p.jsx)(h,{columns:e.columns||[],rows:e.rows||[],offset:n})}),(0,p.jsxs)(`footer`,{children:[(0,p.jsxs)(`span`,{children:[e.rows?.length?`${n+1}–${n+e.rows.length}`:`0`,` `,r(`workspacePreview.rows`)]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`button`,{disabled:n===0,onClick:()=>t(Math.max(0,n-i)),children:r(`workspacePreview.previous`)}),(0,p.jsx)(`button`,{disabled:!e.has_more,onClick:()=>t(n+i),children:r(`workspacePreview.next`)})]})]})]})}let o=(e.kind===`json`||e.kind===`yaml`)&&!e.parse_error&&e.data!==void 0;return(0,p.jsxs)(`div`,{className:`workspace-document`,children:[e.truncated&&(0,p.jsxs)(`div`,{className:`workspace-notice`,children:[(0,p.jsx)(a,{}),r(`workspacePreview.truncated`)]}),e.kind===`json`&&e.parse_error&&(0,p.jsxs)(`div`,{className:`workspace-notice error`,children:[(0,p.jsx)(a,{}),(0,p.jsx)(`strong`,{children:r(`workspacePreview.invalidJson`)}),(0,p.jsx)(`span`,{children:e.parse_error})]}),e.kind===`yaml`&&e.parse_error&&(0,p.jsxs)(`div`,{className:`workspace-notice error`,children:[(0,p.jsx)(a,{}),(0,p.jsx)(`strong`,{children:r(`workspacePreview.invalidYaml`)}),(0,p.jsx)(`span`,{children:e.parse_error})]}),e.kind===`markdown`&&e.frontmatter!==null&&e.frontmatter!==void 0&&(0,p.jsxs)(`section`,{className:`workspace-frontmatter`,children:[(0,p.jsx)(`header`,{children:r(`workspacePreview.frontmatter`)}),(0,p.jsx)(`pre`,{children:JSON.stringify(e.frontmatter,null,2)})]}),e.kind===`markdown`&&e.frontmatter_error&&(0,p.jsxs)(`div`,{className:`workspace-notice error`,children:[(0,p.jsx)(a,{}),e.frontmatter_error]}),e.kind===`markdown`?(0,p.jsx)(`article`,{className:`workspace-markdown`,children:(0,p.jsx)(l,{remarkPlugins:[u],components:{img:({alt:e})=>(0,p.jsxs)(`span`,{className:`markdown-image-placeholder`,children:[`[`,e||`image`,`]`]}),a:({children:e,...t})=>(0,p.jsx)(`a`,{...t,target:`_blank`,rel:`noreferrer`,children:e})},children:e.content||``})}):o?(0,p.jsx)(g,{value:e.data}):(0,p.jsx)(`pre`,{className:`workspace-code`,children:e.content||``})]})}function h({columns:e,rows:t,offset:n=0}){return(0,p.jsxs)(`table`,{children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{children:`#`}),e.map((e,t)=>(0,p.jsx)(`th`,{children:e||`Column ${t+1}`},`${e}-${t}`))]})}),(0,p.jsx)(`tbody`,{children:t.map((t,r)=>(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`td`,{children:n+r+1}),e.map((e,n)=>(0,p.jsx)(`td`,{title:String(t[n]??``),children:String(t[n]??``)},n))]},r))})]})}function g({value:e}){return(0,p.jsx)(`div`,{className:`structured-tree`,children:(0,p.jsx)(_,{name:`root`,value:e,depth:0})})}function _({name:e,value:t,depth:r}){let{t:i}=n(),[a,s]=(0,f.useState)(r===0),c=Array.isArray(t);if(!(typeof t==`object`&&t)){let n=t===null?`null`:typeof t,i=typeof t==`string`?JSON.stringify(t):String(t);return(0,p.jsxs)(`div`,{className:`structured-leaf`,style:{"--tree-depth":r},children:[(0,p.jsx)(`span`,{className:`structured-key`,children:e}),(0,p.jsx)(`i`,{children:`:`}),(0,p.jsx)(`span`,{className:`structured-value ${n}`,children:i})]})}let l=c?t.map((e,t)=>[`[${t}]`,e]):Object.entries(t);return(0,p.jsxs)(`div`,{className:`structured-node`,children:[(0,p.jsxs)(`button`,{type:`button`,className:`structured-toggle`,style:{"--tree-depth":r},"aria-expanded":a,onClick:()=>s(e=>!e),children:[a?(0,p.jsx)(`span`,{children:`−`}):(0,p.jsx)(o,{}),(0,p.jsx)(`span`,{className:`structured-key`,children:e}),(0,p.jsx)(`b`,{children:i(c?`workspacePreview.list`:`workspacePreview.dict`)}),(0,p.jsxs)(`small`,{children:[l.length,` `,i(c?`workspacePreview.items`:`workspacePreview.keys`)]})]}),a&&(0,p.jsx)(`div`,{className:`structured-children`,children:l.map(([e,t])=>(0,p.jsx)(_,{name:e,value:t,depth:r+1},e))})]})}export{m as FilePreview};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./jsx-runtime-g_EzXSjx.js";import{t as n}from"./createLucideIcon-3GmWj6nd.js";import{t as r}from"./arrow-down-BH_K5gzy.js";import{t as i}from"./arrow-right-Bqs4l9-C.js";import{t as a}from"./send-DmE0S-qF.js";import{A as o,L as s,R as c,T as l,h as u}from"./index-Dds_R6_G.js";var d={name:`chart-no-axes-combined`,size:24,node:[[`path`,{d:`M12 16v5`,key:`zza2cw`}],[`path`,{d:`M16 14.639V21`,key:`1s85h0`}],[`path`,{d:`M20 10.656V21`,key:`q45596`}],[`path`,{d:`m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15`,key:`1fw8x9`}],[`path`,{d:`M4 18.463V21`,key:`1otddq`}],[`path`,{d:`M8 14.656V21`,key:`1t2idw`}]]};d.node;var f=n(d),p={name:`puzzle`,size:24,node:[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]};p.node;var m=n(p),h=t(),g=[`raw`,`etl`,`factors`,`train`,`predict`,`backtest`],_=[{id:`plugin`,code:`PLUGIN`,icon:m},{id:`machine`,code:`MACHINE`,icon:l},{id:`job`,code:`JOB`,icon:o},{id:`task`,code:`TASK`,icon:c},{id:`agent`,code:`AGENT`,icon:s},{id:`feedback`,code:`FEEDBACK`,icon:f}];function v({id:e}){let t=u.find(t=>t.id===e)?.icon;return t?(0,h.jsx)(t,{"aria-hidden":`true`}):null}function y({onNavigate:t}){let{t:n}=e();return(0,h.jsx)(`section`,{className:`workspace-page overview-page`,children:(0,h.jsxs)(`div`,{className:`overview-hero`,children:[(0,h.jsxs)(`section`,{className:`hero-quant`,"aria-label":n(`home.quantAria`),children:[(0,h.jsxs)(`div`,{className:`hero-quant-heading`,children:[(0,h.jsx)(`span`,{children:`01 / QUANT RESEARCH`}),(0,h.jsx)(`h2`,{children:n(`home.quantTitle`)}),(0,h.jsx)(`p`,{children:n(`home.quantLead`)})]}),(0,h.jsx)(`ol`,{className:`hero-quant-steps`,children:g.map((e,a)=>(0,h.jsxs)(`li`,{children:[(0,h.jsxs)(`button`,{className:`hero-quant-step hero-quant-${e}`,onClick:()=>t(e),children:[(0,h.jsx)(`span`,{className:`hero-quant-icon`,children:(0,h.jsx)(v,{id:e})}),(0,h.jsxs)(`span`,{className:`hero-quant-step-copy`,children:[(0,h.jsx)(`strong`,{children:n(`home.steps.${e}.title`)}),(0,h.jsx)(`small`,{children:n(`home.steps.${e}.detail`)})]}),(0,h.jsx)(i,{className:`hero-quant-open`,"aria-hidden":`true`})]}),a<g.length-1&&(0,h.jsx)(r,{className:`hero-quant-connector`,"aria-hidden":`true`})]},e))})]}),(0,h.jsxs)(`section`,{className:`hero-brand`,"aria-label":n(`home.brandAria`),children:[(0,h.jsxs)(`div`,{className:`hero-brand-halo`,"aria-hidden":`true`,children:[(0,h.jsx)(`span`,{}),(0,h.jsx)(`span`,{}),(0,h.jsx)(`span`,{})]}),(0,h.jsxs)(`div`,{className:`hero-brand-content`,children:[(0,h.jsx)(`span`,{className:`hero-brand-kicker`,children:`AXONX / AGENT-NATIVE QUANT HARNESS`}),(0,h.jsx)(`img`,{src:`/axonx-logo.svg`,alt:`AxonX`}),(0,h.jsx)(`h1`,{children:n(`home.brandTitle`)}),(0,h.jsx)(`p`,{children:n(`home.brandLead`)}),(0,h.jsxs)(`div`,{className:`hero-brand-actions`,children:[(0,h.jsxs)(`button`,{className:`primary-button`,onClick:()=>t(`submit`),children:[(0,h.jsx)(a,{"aria-hidden":`true`}),n(`home.submitTask`),(0,h.jsx)(i,{"aria-hidden":`true`})]}),(0,h.jsxs)(`button`,{className:`secondary-button`,onClick:()=>t(`tasks`),children:[(0,h.jsx)(c,{"aria-hidden":`true`}),n(`home.manageTasks`)]})]}),(0,h.jsxs)(`div`,{className:`hero-brand-footer`,children:[(0,h.jsx)(`span`,{children:`PLUGIN`}),(0,h.jsx)(`i`,{}),(0,h.jsx)(`span`,{children:`JOB`}),(0,h.jsx)(`i`,{}),(0,h.jsx)(`span`,{children:`TASK`}),(0,h.jsx)(`i`,{}),(0,h.jsx)(`span`,{children:`RESULT`})]})]})]}),(0,h.jsxs)(`section`,{className:`hero-harness`,"aria-label":n(`home.capabilitiesAria`),children:[(0,h.jsxs)(`div`,{className:`hero-harness-heading`,children:[(0,h.jsx)(`span`,{children:`02 / HARNESS CORE`}),(0,h.jsx)(`h2`,{children:n(`home.capabilitiesTitle`)}),(0,h.jsx)(`p`,{children:n(`home.capabilitiesLead`)})]}),(0,h.jsx)(`div`,{className:`hero-harness-manifest`,children:_.map(e=>{let t=e.icon;return(0,h.jsxs)(`div`,{className:`hero-harness-feature`,children:[(0,h.jsx)(`span`,{className:`hero-harness-icon`,children:(0,h.jsx)(t,{"aria-hidden":`true`})}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`strong`,{children:n(`home.features.${e.id}.title`)}),(0,h.jsx)(`small`,{children:n(`home.features.${e.id}.detail`)})]}),(0,h.jsx)(`code`,{children:e.code})]},e.code)})})]})]})})}export{y as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BacktestView-gMr3Zzhd.js","assets/jsx-runtime-g_EzXSjx.js","assets/createLucideIcon-3GmWj6nd.js","assets/arrow-down-BH_K5gzy.js","assets/client-BfOnNqgS.js","assets/api-gyN9gj0Q.js","assets/BacktestChart-B2A5g1WP.js","assets/i18n-Cg91z-Pm.js","assets/installCanvasRenderer-bcUHIcHi.js","assets/TrainingCurveChart-BQJ9RnCV.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e,c as t,n,t as r}from"./jsx-runtime-g_EzXSjx.js";import{t as i}from"./createLucideIcon-3GmWj6nd.js";import{t as a}from"./arrow-right-Bqs4l9-C.js";import{t as o}from"./check-D-YJERlt.js";import{t as s}from"./circle-check-CuU7pF2N.js";import{n as c,t as l}from"./square-check-BHpZrFnJ.js";import{t as u}from"./file-spreadsheet-CCWLaZh3.js";import{i as d}from"./client-BfOnNqgS.js";import{t as f}from"./refresh-cw-DbZV2zTG.js";import{t as p}from"./search-DgRYeO6M.js";import{t as m}from"./trash-DLhoydbu.js";import{a as h,i as g,n as _,t as v}from"./api-gyN9gj0Q.js";import{r as y}from"./i18n-Cg91z-Pm.js";import{D as b,F as x,I as S,S as C,b as w,g as T,j as E,k as D,u as O,y as k}from"./index-Dds_R6_G.js";import{t as A}from"./sourceTasks-BvyYdRNC.js";var j={name:`trending-up`,size:24,node:[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]};j.node;var M=i(j),N=t(e(),1),P=r(),F=(0,N.lazy)(()=>O(()=>import(`./BacktestView-gMr3Zzhd.js`).then(e=>({default:e.BacktestView})),__vite__mapDeps([0,1,2,3,4,5,6,7,8]))),I=(0,N.lazy)(()=>O(()=>import(`./TrainingCurveChart-BQJ9RnCV.js`).then(e=>({default:e.TrainingCurveChart})),__vite__mapDeps([9,1,8]))),L=(e,t=2)=>{if(e==null||e===``)return`—`;let n=Number(e);return Number.isFinite(n)?Math.abs(n)>=1e6?new Intl.NumberFormat(y(),{notation:`compact`,maximumFractionDigits:2}).format(n):n.toLocaleString(y(),{maximumFractionDigits:t}):String(e)};function R(e){if(!e||typeof e!=`object`)return;let t=e;if(Array.isArray(t.x))return{x:t.x,y_left:t.y_left||{},y_right:t.y_right||{}}}function z(e,t,n){let[r,i]=(0,N.useState)([]),[a,o]=(0,N.useState)(!0),[s,c]=(0,N.useState)(``),l=(0,N.useRef)(0),u=(0,N.useCallback)(()=>{let r=++l.current;o(!0),c(``),i([]),_(e,t).then(async e=>{let a=e.entries.filter(e=>e.kind===`directory`),o=await Promise.all(a.map(async e=>{try{let n=await g(`${e.path}/metadata.json`,0,200,t);if(n.kind!==`json`||!n.data||typeof n.data!=`object`||Array.isArray(n.data))throw Error(n.kind===`json`&&n.parse_error||`Invalid task metadata`);let r=n.data,i=r.output_params||{},a=r.input_params||{};return{rows:i.rows,train_rows:i.train_rows,days:i.days,date_range:i.date_range,output_file:i.output_file,result_file:i.result_file,model_file:i.model_file,predictions_file:i.predictions_file,feature_columns:i.feature_columns,label_columns:i.label_columns,target_columns:i.target_columns,output_columns:i.output_columns,prediction_statistics:i.statistics,index_weight_columns:i.index_weight_columns,scores:i.scores,model_name:i.model_name,metrics:i.metrics,parameters:i.parameters,training_curve:R(i.training_curve),dimensions:i.dimensions,artifacts:i.artifacts||{},task_key:String(r.reg_name),task_id:String(r.task_id),task_type:r.task_type,created_at:String(r.created_at),source:A(a.source_tasks),config:{task_id:String(r.task_id),task_type:r.task_type,task_name:String(a.task_name),input_dir:typeof a.input_dir==`string`?a.input_dir:void 0},_path:e.path,_modified:e.modified_at}}catch(t){return console.warn(`Skipping task directory ${e.path}:`,t),null}}));r===l.current&&(i(o.filter(e=>e!==null).sort((e,t)=>String(t.created_at||t._modified).localeCompare(String(e.created_at||e._modified)))),n?.(!0))}).catch(e=>{r===l.current&&(c(e instanceof Error?e.message:String(e)),n?.(!1))}).finally(()=>{r===l.current&&o(!1)})},[e,n,t]);return(0,N.useEffect)(()=>(u(),()=>{l.current+=1}),[u]),{tasks:r,loading:a,error:s,load:u}}function B({kind:e,target:t,initialSelectedId:r,onSelected:i,onOptionsChange:s,onConnection:c,onNavigate:u}){let{t:g,i18n:_}=n(),y=_.resolvedLanguage===`zh`?`zh-CN`:`en-US`,b=[g(`research.pages.${e}.title`),g(`research.pages.${e}.lead`)],{tasks:x,loading:S,error:C,load:T}=z(e,t,c),[D,O]=(0,N.useState)(``),[A,j]=(0,N.useState)(``),[M,F]=(0,N.useState)(!1),[I,L]=(0,N.useState)({}),[R,B]=(0,N.useState)([]),[H,U]=(0,N.useState)(!1),[W,G]=(0,N.useState)(``),[K,q]=(0,N.useState)(null);(0,N.useEffect)(()=>{x.length&&(r&&x.some(e=>e.config.task_id===r)?O(r):x.some(e=>e.config.task_id===D)||O(``))},[x,D,r]),(0,N.useEffect)(()=>{s?.(x.map(t=>({value:t.config.task_id,label:t.config.task_id,detail:t.task_key||e})))},[x,e,s]),(0,N.useEffect)(()=>{F(!1),L({}),B([]),q(null)},[e,t]),(0,N.useEffect)(()=>{if(!K)return;let e=()=>q(null),t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`click`,e),window.addEventListener(`blur`,e),window.addEventListener(`keydown`,t),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`click`,e),window.removeEventListener(`blur`,e),window.removeEventListener(`keydown`,t),window.removeEventListener(`scroll`,e,!0)}},[K]);let J=x.find(e=>e.config.task_id===D),Y=x.filter(e=>`${e.config.task_id} ${e.task_key}`.toLowerCase().includes(A.toLowerCase())),X=Object.keys(I).length,Z=Y.length>0&&Y.every(e=>I[e._path]),Q=e=>L(t=>{let n={...t};return n[e._path]?delete n[e._path]:n[e._path]=e,n}),$=()=>L(e=>{let t={...e};for(let e of Y)Z?delete t[e._path]:t[e._path]=e;return t}),ee=async()=>{if(R.length){U(!0),G(``);try{await v(R.map(e=>e._path),t),B([]),L({}),F(!1),T(),c(!0)}catch(e){G(e instanceof Error?e.message:String(e)),c(!1)}finally{U(!1)}}};return(0,P.jsxs)(`section`,{className:`workspace-page research-page`,children:[(0,P.jsxs)(`div`,{className:`page-heading`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`p`,{className:`eyebrow`,children:[`RESEARCH / `,e.toUpperCase()]}),(0,P.jsx)(`h1`,{children:b[0]}),(0,P.jsx)(`span`,{children:b[1]})]}),e!==`etl`&&(0,P.jsxs)(`button`,{className:`secondary-button`,onClick:T,children:[(0,P.jsx)(f,{className:S?`spin`:``}),g(`research.refresh`)]})]}),C&&(0,P.jsxs)(`div`,{className:`error-banner`,children:[(0,P.jsx)(h,{}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`strong`,{children:g(`research.unable_to_load_artifacts`)}),(0,P.jsx)(`span`,{children:C})]}),(0,P.jsx)(`button`,{type:`button`,onClick:T,children:g(`research.retry`)})]}),!C&&(0,P.jsxs)(`div`,{className:`research-layout`,children:[(0,P.jsxs)(`aside`,{className:`run-index rail-panel ${M?`selecting`:``}`,children:[(0,P.jsxs)(`header`,{className:`run-index-header rail-header`,children:[(0,P.jsxs)(`div`,{className:`run-index-heading rail-heading`,children:[(0,P.jsx)(`small`,{children:`TASK VERSIONS`}),(0,P.jsx)(`strong`,{children:g(`research.task_versions`)})]}),(0,P.jsxs)(`div`,{className:`run-index-tools`,children:[(0,P.jsx)(`em`,{children:x.length}),(0,P.jsx)(`button`,{className:`run-index-refresh rail-refresh`,"aria-label":g(`research.refresh`),onClick:T,children:(0,P.jsx)(f,{className:S?`spin`:``})})]})]}),(0,P.jsxs)(`label`,{className:`run-index-search rail-search`,children:[(0,P.jsx)(p,{}),(0,P.jsx)(`input`,{value:A,onChange:e=>j(e.target.value),placeholder:g(`research.search_task_id`)})]}),(0,P.jsx)(`div`,{className:`rail-scroll`,children:S&&!x.length?(0,P.jsx)(`span`,{className:`run-loading`,children:(0,P.jsx)(d,{className:`spin`})}):Y.map(t=>(0,P.jsxs)(`article`,{className:`${D===t.config.task_id?`active`:``} ${I[t._path]?`checked`:``}`,onContextMenu:e=>{e.preventDefault(),q({task:t,x:Math.max(6,Math.min(e.clientX,window.innerWidth-224)),y:Math.max(6,Math.min(e.clientY,window.innerHeight-150))})},children:[M&&(0,P.jsx)(`button`,{className:`run-check`,"aria-label":`${g(`research.select`)} ${t.config.task_id}`,onClick:()=>Q(t),children:I[t._path]&&(0,P.jsx)(o,{})}),(0,P.jsxs)(`button`,{className:`run-main rail-list-item`,onClick:()=>M?Q(t):(O(t.config.task_id),i?.(t.config.task_id)),children:[(0,P.jsx)(`span`,{className:`run-item-avatar rail-avatar run-kind-${e}`,children:String(t.task_key||e).trim().slice(0,1).toUpperCase()}),(0,P.jsxs)(`span`,{className:`rail-item-copy`,children:[(0,P.jsx)(`strong`,{children:t.task_key||e}),(0,P.jsx)(`code`,{children:t.config.task_id}),(0,P.jsx)(`small`,{children:t.created_at?new Date(t.created_at).toLocaleString(y):g(`research.metadata_unavailable`)})]}),!M&&(0,P.jsx)(a,{})]})]},t.config.task_id))}),M&&(0,P.jsxs)(`footer`,{className:`run-selection`,children:[(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`strong`,{children:X}),g(`research.selected`)]}),(0,P.jsx)(`button`,{onClick:()=>{F(!1),L({})},children:g(`research.done`)}),(0,P.jsx)(`button`,{onClick:$,children:g(Z?`research.deselect`:`research.select_all`)}),(0,P.jsxs)(`button`,{className:`danger`,disabled:!X,onClick:()=>{B(Object.values(I)),G(``)},children:[(0,P.jsx)(m,{}),g(`research.delete`)]})]})]}),(0,P.jsx)(k,{min:180,max:460,className:`context-resizer`}),(0,P.jsx)(`main`,{className:`research-canvas`,children:S?(0,P.jsx)(`div`,{className:`research-loading`,children:(0,P.jsx)(d,{className:`spin`})}):J?(0,P.jsx)(V,{kind:e,meta:J,target:t,onNavigate:u}):!S&&(0,P.jsxs)(`div`,{className:`empty-research`,children:[(0,P.jsx)(E,{}),(0,P.jsx)(`strong`,{children:x.length?g(`research.select_a_task_version`):g(`research.noKindTasks`,{kind:e})}),(0,P.jsx)(`span`,{children:x.length?g(`research.its_data_and_artifacts_will`):g(`research.task_artifacts_will_appear_here`)})]})})]}),K&&(0,P.jsxs)(`div`,{className:`workspace-context-menu task-version-context-menu`,role:`menu`,style:{left:K.x,top:K.y},onClick:e=>e.stopPropagation(),children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{children:K.task.config.task_id}),(0,P.jsx)(`small`,{children:K.task.task_key||e})]}),(0,P.jsxs)(`button`,{role:`menuitem`,onClick:()=>{F(!0),I[K.task._path]||Q(K.task),q(null)},children:[(0,P.jsx)(l,{}),g(`research.select`)]}),(0,P.jsxs)(`button`,{className:`danger`,role:`menuitem`,onClick:()=>{B([K.task]),G(``),q(null)},children:[(0,P.jsx)(m,{}),g(`research.delete`)]})]}),R.length>0&&(0,P.jsx)(`div`,{className:`modal-backdrop`,role:`presentation`,onClick:()=>!H&&B([]),children:(0,P.jsxs)(`div`,{className:`confirm-modal workspace-delete-modal`,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":`task-version-delete-title`,onClick:e=>e.stopPropagation(),children:[(0,P.jsx)(`button`,{className:`close-button`,"aria-label":g(`research.cancel`),disabled:H,onClick:()=>B([]),children:(0,P.jsx)(w,{})}),(0,P.jsx)(`div`,{className:`danger-icon`,children:(0,P.jsx)(m,{})}),(0,P.jsx)(`h2`,{id:`task-version-delete-title`,children:R.length>1?g(`research.delete_selected_task_versions`):g(`research.delete_this_task_version`)}),(0,P.jsxs)(`div`,{className:`workspace-delete-list`,children:[R.slice(0,6).map(e=>(0,P.jsx)(`code`,{children:e.config.task_id},e._path)),R.length>6&&(0,P.jsxs)(`span`,{children:[`+`,R.length-6]})]}),(0,P.jsx)(`p`,{children:g(`research.the_task_directories_and_all`)}),W&&(0,P.jsxs)(`div`,{className:`inline-error`,children:[(0,P.jsx)(`strong`,{children:g(`research.delete_failed`)}),(0,P.jsx)(`span`,{children:W})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`button`,{className:`secondary-button`,disabled:H,onClick:()=>B([]),children:g(`research.cancel`)}),(0,P.jsxs)(`button`,{className:`danger-button`,disabled:H,onClick:()=>void ee(),children:[H?(0,P.jsx)(d,{className:`spin`}):(0,P.jsx)(m,{}),H?g(`research.deleting`):`${g(`research.delete`)} (${R.length})`]})]})]})})]})}function V({kind:e,meta:t,target:r,onNavigate:i}){let{t:l}=n(),[u,f]=(0,N.useState)(``),p={etl:`etl`,analysis:`factors`,train:`train`,predict:`predict`,backtest:`backtest`},m=(t.source||[]).map(e=>({taskId:e,type:e.split(`#`)[0],page:p[e.split(`#`)[0]]||`runtime`})),h=async e=>{await navigator.clipboard.writeText(e),f(e),window.setTimeout(()=>f(t=>t===e?``:t),1600)};return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`header`,{className:`artifact-header`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{className:`artifact-kind ${e}`,children:H(e)}),(0,P.jsxs)(`div`,{className:`artifact-title`,children:[(0,P.jsx)(`small`,{children:t.task_key||e}),(0,P.jsxs)(`div`,{className:`artifact-title-row`,children:[(0,P.jsx)(`h2`,{title:t.config.task_id,children:t.config.task_id}),(0,P.jsx)(`button`,{type:`button`,className:`artifact-id-copy`,onClick:()=>void h(t.config.task_id),title:l(`research.copy_task_id`),"aria-label":l(`research.copy_task_id`),children:u===t.config.task_id?(0,P.jsx)(o,{}):(0,P.jsx)(c,{})})]})]})]}),(0,P.jsxs)(`div`,{className:`artifact-header-actions`,children:[e===`backtest`&&(0,P.jsxs)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>i(`compare`,t.config.task_id),children:[(0,P.jsx)(b,{}),l(`research.compare`)]}),(0,P.jsxs)(`span`,{className:`ready-badge`,children:[(0,P.jsx)(s,{}),l(`research.artifacts_ready`)]})]})]}),m.length>0&&(0,P.jsxs)(`div`,{className:`lineage-strip`,children:[(0,P.jsxs)(`span`,{children:[(0,P.jsx)(D,{}),l(`research.upstream_tasks`)]}),(0,P.jsx)(`div`,{className:`lineage-sources`,children:m.map(e=>(0,P.jsxs)(`div`,{className:`lineage-node`,children:[(0,P.jsxs)(`button`,{className:`lineage-link`,onClick:()=>i(e.page,e.taskId),title:`${l(`research.open_upstream_task`)}: ${e.taskId}`,children:[(0,P.jsx)(`em`,{children:e.type.toUpperCase()}),(0,P.jsx)(`code`,{children:e.taskId}),(0,P.jsx)(a,{})]}),(0,P.jsx)(`button`,{className:`lineage-copy`,onClick:()=>void h(e.taskId),"aria-label":l(`research.copy_upstream_task_id`),children:u===e.taskId?(0,P.jsx)(o,{}):(0,P.jsx)(c,{})})]},e.taskId))})]}),(0,P.jsx)(K,{meta:t,kind:e}),e===`backtest`&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(`div`,{className:`research-loading`,children:(0,P.jsx)(d,{className:`spin`})}),children:(0,P.jsx)(F,{meta:t,target:r})})]})}var H=e=>e===`analysis`?(0,P.jsx)(C,{}):e===`backtest`?(0,P.jsx)(M,{}):e===`train`?(0,P.jsx)(S,{}):e===`predict`?(0,P.jsx)(x,{}):(0,P.jsx)(E,{});function U({items:e}){return(0,P.jsx)(`div`,{className:`artifact-kpis count-${Math.min(e.length,4)}`,children:e.map(e=>(0,P.jsxs)(`article`,{children:[(0,P.jsx)(`small`,{children:e.label}),(0,P.jsx)(`strong`,{children:e.value}),e.hint&&(0,P.jsx)(`span`,{children:e.hint})]},e.label))})}function W({scores:e}){let{t}=n(),[r,i]=(0,N.useState)(``),[a,o]=(0,N.useState)(``),s=Object.entries(e).map(([e,t])=>{let n=e.indexOf(`/`);return{metric:n<0?e:e.slice(0,n),label:n<0?`—`:e.slice(n+1),values:t}});if(!s.length)return null;let c=[...new Set(s.map(e=>e.metric))],l=c.includes(r)?r:c[0],u=[...new Set(s.filter(e=>e.metric===l).map(e=>e.label))],d=u.includes(a)?a:u[0],f=s.find(e=>e.metric===l&&e.label===d)?.values||{},p=Object.entries(f).sort(([e,t],[n,r])=>Math.abs(r)-Math.abs(t)||e.localeCompare(n)),m=Math.max(...p.map(([,e])=>Math.abs(e)),0);return(0,P.jsxs)(`section`,{className:`viz-card wide analysis-score-card`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`small`,{children:`SCORES`}),(0,P.jsx)(`h3`,{children:t(`research.factor_scores`)})]}),(0,P.jsxs)(`div`,{className:`analysis-score-controls`,children:[(0,P.jsxs)(`label`,{children:[(0,P.jsx)(`span`,{children:t(`research.metric`)}),(0,P.jsx)(`select`,{value:l,onChange:e=>i(e.target.value),children:c.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))})]}),(0,P.jsxs)(`label`,{children:[(0,P.jsx)(`span`,{children:t(`research.label`)}),(0,P.jsx)(`select`,{value:d,onChange:e=>o(e.target.value),children:u.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))})]}),(0,P.jsx)(`span`,{className:`analysis-score-count`,children:p.length})]})]}),(0,P.jsx)(`div`,{className:`analysis-score-scroll`,children:(0,P.jsxs)(`table`,{children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`th`,{children:t(`research.factor`)}),(0,P.jsx)(`th`,{children:t(`research.magnitude`)}),(0,P.jsx)(`th`,{children:t(`research.score`)})]})}),(0,P.jsx)(`tbody`,{children:p.map(([e,t])=>{let n=m?Math.abs(t)/m*50:0;return(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`td`,{children:(0,P.jsx)(`code`,{children:e})}),(0,P.jsx)(`td`,{children:(0,P.jsx)(`div`,{className:`analysis-score-bar`,"aria-hidden":`true`,children:(0,P.jsx)(`span`,{className:t<0?`negative`:`positive`,style:{left:`${t<0?50-n:50}%`,width:`${n}%`}})})}),(0,P.jsx)(`td`,{children:L(t,4)})]},e)})})]})})]})}function G({meta:e}){let{t}=n(),r=e.prediction_statistics,i=e.output_columns?.length?e.output_columns:[`trade_date`,`ts_code`,`pred`,`actual_return`,`label_valid`,`name`,`is_buyable`,...e.index_weight_columns||[]],a=t=>t===void 0||!e.rows?`—`:`${L(t/e.rows*100,1)}%`,o=Object.entries(r?.indices||{});return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`section`,{className:`viz-card wide prediction-overview-card`,children:[(0,P.jsx)(`header`,{children:(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`small`,{children:`OVERVIEW`}),(0,P.jsx)(`h3`,{children:t(`research.prediction_overview`)})]})}),(0,P.jsxs)(`div`,{className:`prediction-stat-grid`,children:[(0,P.jsxs)(`div`,{className:`prediction-score-block`,children:[(0,P.jsx)(`small`,{children:t(`research.prediction_score_mean`)}),(0,P.jsx)(`strong`,{children:L(r?.pred.mean,4)}),(0,P.jsxs)(`div`,{className:`prediction-score-range`,children:[(0,P.jsxs)(`span`,{children:[t(`research.min`),` `,(0,P.jsx)(`b`,{children:L(r?.pred.min,4)})]}),(0,P.jsxs)(`span`,{children:[t(`research.median`),` `,(0,P.jsx)(`b`,{children:L(r?.pred.median,4)})]}),(0,P.jsxs)(`span`,{children:[t(`research.max`),` `,(0,P.jsx)(`b`,{children:L(r?.pred.max,4)})]})]})]}),(0,P.jsxs)(`div`,{className:`prediction-coverage-block`,children:[(0,P.jsx)(`small`,{children:t(`research.sample_coverage`)}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:t(`research.symbols_days`)}),(0,P.jsxs)(`strong`,{children:[L(r?.symbols,0),` / `,L(r?.days,0)]})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:t(`research.buyable`)}),(0,P.jsx)(`strong`,{children:a(r?.buyable_rows)})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:t(`research.valid_return`)}),(0,P.jsx)(`strong`,{children:a(r?.valid_return_rows)})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:t(`research.backtest_candidates`)}),(0,P.jsx)(`strong`,{children:a(r?.candidate_rows)})]})]})]}),(0,P.jsxs)(`div`,{className:`prediction-index-strip`,children:[(0,P.jsx)(`small`,{children:t(`research.index_weights`)}),o.length?o.map(([e,n])=>(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`code`,{children:e.replace(`index_weight_`,``).toUpperCase()}),L(n.constituents,0),` `,t(`research.symbols`),` ·`,` `,L(n.days_with_weights,0),` `,t(`research.days`)]},e)):(0,P.jsx)(`span`,{children:(e.index_weight_columns||[]).map(e=>e.replace(`index_weight_`,``).toUpperCase()).join(` · `)||`—`})]})]}),(0,P.jsxs)(`section`,{className:`viz-card wide prediction-columns-card`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`small`,{children:`SCHEMA`}),(0,P.jsx)(`h3`,{children:t(`research.result_columns`)})]}),(0,P.jsx)(`span`,{children:i.length})]}),(0,P.jsx)(`div`,{className:`prediction-column-grid`,children:i.map(e=>(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`code`,{children:e}),(0,P.jsx)(`span`,{children:e.startsWith(`index_weight_`)?t(`research.index_weight_decimal`):t(`research.columns.${e}`,{defaultValue:`—`})})]},e))}),(0,P.jsx)(`p`,{children:t(`research.pred_is_a_ranking_score`)})]})]})}function K({meta:e,kind:t}){let{t:r}=n(),i=t===`train`?e.train_rows:t===`backtest`?e.days:e.rows,a=r(t===`train`?`research.train_rows`:t===`backtest`?`research.days_2`:t===`predict`?`research.prediction_rows`:`research.rows`),o=t===`etl`?[[`output_file`,e.output_file]]:t===`analysis`?[[`result_file`,e.result_file]]:t===`train`?[[`model_file`,e.model_file]]:t===`predict`?[[`predictions_file`,e.predictions_file]]:[[`daily_file`,e.artifacts.daily?.path&&`${e._path}/${e.artifacts.daily.path}`],[`summary_file`,e.artifacts.summary?.path&&`${e._path}/${e.artifacts.summary.path}`]],s=(t===`etl`?[[r(`research.feature_columns`),e.feature_columns],[r(`research.label_columns`),e.label_columns]]:t===`train`?[[r(`research.feature_columns`),e.feature_columns],[r(`research.target_columns`),e.target_columns]]:[]).map(([e,n])=>Array.isArray(n)&&(n.length>0||t===`train`)?(0,P.jsxs)(`section`,{className:`viz-card base-columns-card`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`small`,{children:`COLUMNS`}),(0,P.jsx)(`h3`,{children:e})]}),(0,P.jsx)(`span`,{children:n.length})]}),(0,P.jsx)(`div`,{className:`base-column-list`,children:n.map(e=>(0,P.jsx)(`code`,{children:e},e))})]},String(e)):null);return(0,P.jsxs)(`div`,{className:`artifact-content`,children:[(0,P.jsx)(U,{items:[{label:a,value:L(i,0)},...t===`train`?[{label:r(`research.model`),value:e.model_name||`—`}]:[],...t===`etl`||t===`predict`||t===`backtest`?[{label:r(`research.start`),value:e.date_range?.start||`—`},{label:r(`research.end`),value:e.date_range?.end||`—`}]:[],{label:r(`research.artifacts`),value:L(Object.keys(e.artifacts||{}).length,0)}]}),t===`train`?(0,P.jsxs)(`div`,{className:`train-config-grid`,children:[s,(0,P.jsxs)(`section`,{className:`viz-card train-parameters-card`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`small`,{children:`PARAMETERS`}),(0,P.jsx)(`h3`,{children:r(`research.effective_parameters`)})]}),(0,P.jsx)(`span`,{children:Object.keys(e.parameters||{}).length})]}),(0,P.jsx)(`div`,{className:`base-value-list`,children:Object.entries(e.parameters||{}).map(([e,t])=>(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`code`,{children:e}),(0,P.jsx)(`strong`,{children:typeof t==`string`?t:JSON.stringify(t)})]},e))})]})]}):t===`predict`?(0,P.jsx)(G,{meta:e}):s,t===`analysis`&&(0,P.jsx)(W,{scores:e.scores||{}}),t===`train`&&(0,P.jsxs)(`section`,{className:`viz-card wide train-curve-card`,children:[(0,P.jsx)(`header`,{children:(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`small`,{children:`TRAINING`}),(0,P.jsx)(`h3`,{children:r(`research.training_curves`)})]})}),e.training_curve?.x.length?(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(`div`,{className:`research-loading`,children:(0,P.jsx)(d,{className:`spin`})}),children:(0,P.jsx)(I,{curve:e.training_curve})}):(0,P.jsx)(`div`,{className:`train-curve-empty`,children:r(`research.no_training_curve_is_available`)}),e.training_curve&&Object.keys(e.training_curve.y_left).some(e=>e.endsWith(`_l2`))&&Object.keys(e.training_curve.y_right).some(e=>e.endsWith(`_l1`))&&(0,P.jsx)(`p`,{className:`train-curve-note`,children:r(`research.left_axis_l2_mean_squared`)}),Object.keys(e.metrics||{}).length>0&&(0,P.jsx)(`div`,{className:`train-curve-metrics`,children:Object.entries(e.metrics||{}).map(([e,t])=>(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`small`,{children:e}),(0,P.jsx)(`strong`,{children:L(t,4)})]},e))})]}),(0,P.jsxs)(`section`,{className:`viz-card base-files-card`,children:[(0,P.jsx)(`header`,{children:(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`small`,{children:`OUTPUT`}),(0,P.jsx)(`h3`,{children:r(`research.output_files`)})]})}),(0,P.jsx)(`div`,{className:`artifact-files`,children:o.map(([e,t])=>t&&(0,P.jsxs)(`div`,{children:[(0,P.jsx)(u,{}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`strong`,{children:e}),(0,P.jsx)(`code`,{children:t})]})]},e))}),t===`etl`&&e.config.input_dir&&(0,P.jsxs)(`div`,{className:`artifact-input-dir`,children:[(0,P.jsx)(`small`,{children:r(`research.input_directory`)}),(0,P.jsx)(`code`,{children:e.config.input_dir})]})]}),(0,P.jsxs)(`section`,{className:`viz-card base-files-card`,children:[(0,P.jsx)(`header`,{children:(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`small`,{children:`ARTIFACTS`}),(0,P.jsx)(`h3`,{children:r(`research.artifacts_2`)})]})}),(0,P.jsx)(q,{meta:e})]})]})}function q({meta:e,exclude:t=[]}){return(0,P.jsx)(`div`,{className:`artifact-files`,children:Object.entries(e.artifacts||{}).filter(([e])=>!t.includes(e)).map(([e,t])=>(0,P.jsxs)(`div`,{children:[(0,P.jsx)(u,{}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`strong`,{children:e}),(0,P.jsx)(`code`,{children:t.path})]}),(0,P.jsx)(`em`,{children:T(t.size,!1)})]},e))})}export{B as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,c as t,n,t as r}from"./jsx-runtime-g_EzXSjx.js";import{t as i}from"./createLucideIcon-3GmWj6nd.js";import{t as a}from"./check-D-YJERlt.js";import{n as o,t as s}from"./square-check-BHpZrFnJ.js";import{n as c,r as l,t as u}from"./hard-drive-BPS9bHrX.js";import{i as d,n as f}from"./client-BfOnNqgS.js";import{t as p}from"./plus-5N8AgcCa.js";import{t as m}from"./refresh-cw-DbZV2zTG.js";import{t as h}from"./search-DgRYeO6M.js";import{t as g}from"./trash-DLhoydbu.js";import{a as _,i as v}from"./api-gyN9gj0Q.js";import{C as y,L as ee,M as b,O as x,P as te,_ as S,a as C,b as ne,d as w,g as T,k as re,m as E,n as ie,o as ae,p as oe,r as D,s as se,t as ce,v as O,w as k,z as A}from"./index-Dds_R6_G.js";var j={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};j.node;var M=i(j),N={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};N.node;var P=i(N),F={name:`ban`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]};F.node;var le=i(F),I={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};I.node;var ue=i(I),L={name:`gauge`,size:24,node:[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]};L.node;var R=i(L),de={name:`locate-fixed`,size:24,node:[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};de.node;var fe=i(de),z={name:`memory-stick`,size:24,node:[[`path`,{d:`M12 12v-2`,key:`fwoke6`}],[`path`,{d:`M12 18v-2`,key:`qj6yno`}],[`path`,{d:`M16 12v-2`,key:`heuere`}],[`path`,{d:`M16 18v-2`,key:`s1ct0w`}],[`path`,{d:`M2 11h1.5`,key:`15p63e`}],[`path`,{d:`M20 18v-2`,key:`12ehxp`}],[`path`,{d:`M20.5 11H22`,key:`khsy7a`}],[`path`,{d:`M4 18v-2`,key:`1c3oqr`}],[`path`,{d:`M8 12v-2`,key:`1mwtfd`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`10`,rx:`2`,key:`1qcswk`}]]};z.node;var B=i(z),V={name:`microchip`,size:24,node:[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 17h4`,key:`pvmtpo`}],[`path`,{d:`M10 7h4`,key:`1vgcok`}],[`path`,{d:`M18 12h2`,key:`quuxs7`}],[`path`,{d:`M18 18h2`,key:`4scel`}],[`path`,{d:`M18 6h2`,key:`1ptzki`}],[`path`,{d:`M4 12h2`,key:`1ltxp0`}],[`path`,{d:`M4 18h2`,key:`1xrofg`}],[`path`,{d:`M4 6h2`,key:`1cx33n`}],[`rect`,{x:`6`,y:`2`,width:`12`,height:`20`,rx:`2`,key:`749fme`}]]};V.node;var H=i(V),U={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};U.node;var pe=i(U),W=t(e(),1),G=r();function me({node:e}){let{t}=n(),r=e.info;if(!r)return null;let i=r.cpu.total_cores==null?null:Math.round(r.cpu.total_cores*r.cpu.usage_percent)/100;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`section`,{className:`machine-resource-group host-resource-section`,children:[(0,G.jsxs)(`div`,{className:`section-title`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(b,{}),(0,G.jsx)(`span`,{children:t(`machine.cpuMemory`)})]}),(0,G.jsx)(`small`,{children:`4 METRICS`})]}),(0,G.jsxs)(`div`,{className:`resource-grid`,children:[(0,G.jsx)(he,{label:t(`cpuUsage`),value:r.cpu.usage_percent,tone:`cpu`,icon:(0,G.jsx)(b,{}),detail:`${i??`—`} / ${r.cpu.total_cores??`—`} ${t(`coresUsed`)}`}),(0,G.jsx)(he,{label:t(`memoryUsage`),value:r.memory.usage_percent,tone:`memory`,icon:(0,G.jsx)(B,{}),detail:`${T(r.memory.available_bytes)} ${t(`available`)}`}),(0,G.jsxs)(`article`,{className:`capacity-card`,children:[(0,G.jsxs)(`header`,{children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(R,{}),t(`cpuCapacity`)]}),(0,G.jsx)(`small`,{children:`CPU`})]}),(0,G.jsx)(K,{label:t(`totalCores`),value:`${r.cpu.total_cores??`—`}`,percent:r.cpu.total_cores==null?0:100}),(0,G.jsx)(K,{label:t(`physicalCores`),value:`${r.cpu.physical_cores??`—`}`,percent:r.cpu.physical_cores&&r.cpu.total_cores?r.cpu.physical_cores/r.cpu.total_cores*100:0}),(0,G.jsx)(K,{label:t(`coresUsed`),value:`${i??`—`}`,percent:r.cpu.usage_percent})]}),(0,G.jsxs)(`article`,{className:`capacity-card memory-card`,children:[(0,G.jsxs)(`header`,{children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(u,{}),t(`memoryCapacity`)]}),(0,G.jsx)(`small`,{children:`RAM`})]}),(0,G.jsx)(K,{label:t(`usedMemory`),value:T(r.memory.used_bytes),percent:r.memory.usage_percent}),(0,G.jsx)(K,{label:t(`available`),value:T(r.memory.available_bytes),percent:100-r.memory.usage_percent}),(0,G.jsx)(K,{label:t(`totalMemory`),value:T(r.memory.total_bytes),percent:100})]})]})]}),(0,G.jsxs)(`section`,{className:`machine-resource-group gpu-section`,children:[(0,G.jsxs)(`div`,{className:`section-title`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(H,{}),(0,G.jsx)(`span`,{children:t(`gpuResources`)})]}),(0,G.jsxs)(`small`,{children:[r.gpus.length,` DEVICES`]})]}),r.gpus.length?(0,G.jsx)(`div`,{className:`gpu-grid`,children:r.gpus.map(e=>(0,G.jsx)(ge,{gpu:e},`${e.vendor}-${e.index}`))}):(0,G.jsxs)(`div`,{className:`no-gpu`,children:[(0,G.jsx)(`span`,{children:(0,G.jsx)(H,{})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:t(`noGpu`)}),(0,G.jsx)(`small`,{children:t(`noGpuHint`)})]})]})]})]})}function he({label:e,value:t,tone:n,icon:r,detail:i}){let a=Math.max(0,Math.min(100,t));return(0,G.jsxs)(`article`,{className:`resource-gauge-card ${n}`,children:[(0,G.jsxs)(`header`,{children:[(0,G.jsxs)(`span`,{children:[r,e]}),(0,G.jsxs)(`i`,{className:`live-wave`,children:[(0,G.jsx)(`b`,{}),(0,G.jsx)(`b`,{}),(0,G.jsx)(`b`,{})]})]}),(0,G.jsx)(`div`,{className:`gauge-ring`,style:{background:`conic-gradient(var(--gauge) ${a}%, var(--surface-3) 0)`},children:(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[a.toFixed(1),(0,G.jsx)(`small`,{children:`%`})]}),(0,G.jsx)(`span`,{children:`LIVE`})]})}),(0,G.jsx)(`p`,{children:i})]})}function K({label:e,value:t,percent:n}){return(0,G.jsxs)(`div`,{className:`capacity-row`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{children:e}),(0,G.jsx)(`strong`,{children:t})]}),(0,G.jsx)(`div`,{children:(0,G.jsx)(`i`,{style:{width:`${Math.max(0,Math.min(100,n))}%`}})})]})}function ge({gpu:e}){let{t}=n();return(0,G.jsxs)(`article`,{className:`gpu-card`,children:[(0,G.jsxs)(`header`,{children:[(0,G.jsxs)(`span`,{children:[e.vendor.toUpperCase(),` · GPU `,e.index]}),(0,G.jsx)(`strong`,{children:e.name||`GPU`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(K,{label:t(`gpuUtilization`),value:e.usage_percent==null?`—`:`${e.usage_percent}%`,percent:e.usage_percent||0}),(0,G.jsx)(K,{label:t(`gpuMemory`),value:e.memory_used_bytes==null?`—`:`${T(e.memory_used_bytes)} / ${T(e.memory_total_bytes||0)}`,percent:e.memory_usage_percent||0})]})]})}function _e(e,t){let n=(0,W.useCallback)(t=>E(e,t),[e]),r=w(n);return(0,W.useEffect)(()=>{r.data?t(!0):r.error&&t(!1)},[t,r.data,r.error]),r}function ve(e){if(!e.steps.length)return null;let t=e.steps.findIndex(e=>!e.finished_at),n=t>=0?t:e.steps.length-1,r=e.steps[n];return{current:n+1,name:r.name,percentage:Math.max(0,Math.min(100,Math.round(r.percentage??0)))}}function ye(e){return S(e)}function be(e,t){if(!e.started_at)return`—`;let n=e.finished_at?new Date(e.finished_at).getTime():Date.now(),r=Math.max(0,Math.floor((n-new Date(e.started_at).getTime())/1e3));return r<60?t(`formats.duration.seconds`,{seconds:r}):r<3600?t(`formats.duration.minutesSeconds`,{minutes:Math.floor(r/60),seconds:r%60}):t(`formats.duration.hoursMinutes`,{hours:Math.floor(r/3600),minutes:Math.floor(r%3600/60)})}function xe(e=1600){let[t,n]=(0,W.useState)(``),r=(0,W.useRef)(void 0);return(0,W.useEffect)(()=>()=>window.clearTimeout(r.current),[]),{copied:t,copy:(0,W.useCallback)(async(t,i=t)=>{await navigator.clipboard.writeText(t),n(i),window.clearTimeout(r.current),r.current=window.setTimeout(()=>n(``),e)},[e])}}function Se(e,t,n){let[r,i]=(0,W.useState)(n);return(0,W.useEffect)(()=>{if(i(n),!t)return;let r=window.setInterval(()=>{i(t=>t<=1?(e(),n):t-1)},1e3);return()=>window.clearInterval(r)},[e,t,n]),r}var q=new Set([`queued`,`running`]),Ce=new Set([`failed`,`cancelled`]);function we({target:e,onSubmit:t,onOpenTask:r,onTasksChange:i,onConnection:a}){let{t:o}=n(),[c,l]=(0,W.useState)([]),[u,f]=(0,W.useState)(!0),[v,y]=(0,W.useState)(!1),[ee,b]=(0,W.useState)(``),[x,te]=(0,W.useState)(!0),[S,w]=(0,W.useState)(``),[T,re]=(0,W.useState)(``),[E,ae]=(0,W.useState)(``),[oe,D]=(0,W.useState)(null),[se,O]=(0,W.useState)(!1),[k,A]=(0,W.useState)(new Set),[j,M]=(0,W.useState)(!1),[N,P]=(0,W.useState)(null),[F,I]=(0,W.useState)(!1),[ue,L]=(0,W.useState)(!1),R=(0,W.useCallback)(async(t=!1)=>{t?y(!0):f(!0);try{let t=[...await C(e)].sort((e,t)=>J(t)-J(e));l(t),A(e=>new Set([...e].filter(e=>t.some(t=>t.task_id===e&&!q.has(t.state))))),b(``),a(!0)}catch(e){b(e instanceof Error?e.message:String(e)),a(!1)}finally{f(!1),y(!1)}},[a,e]);(0,W.useEffect)(()=>{R()},[R]),(0,W.useEffect)(()=>{i?.(c.map(e=>({value:e.task_id,label:e.task_id,detail:e.task_name||e.task_type})))},[c,i]),(0,W.useEffect)(()=>{if(!N)return;let e=()=>P(null),t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`click`,e),window.addEventListener(`blur`,e),window.addEventListener(`keydown`,t),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`click`,e),window.removeEventListener(`blur`,e),window.removeEventListener(`keydown`,t),window.removeEventListener(`scroll`,e,!0)}},[N]);let de=Se((0,W.useCallback)(()=>{R(!0)},[R]),x,2),fe=(0,W.useMemo)(()=>[...new Set(c.map(e=>e.task_type))].sort(),[c]),z=(0,W.useMemo)(()=>c.filter(e=>{let t=S.trim().toLowerCase(),n=!t||`${e.task_id} ${e.task_type} ${e.pid||``}`.toLowerCase().includes(t),r=!T||T===`active`&&q.has(e.state)||T===`attention`&&Ce.has(e.state)||e.state===T;return n&&r&&(!E||e.task_type===E)}),[c,S,T,E]),B={total:c.length,active:c.filter(e=>q.has(e.state)).length,attention:c.filter(e=>Ce.has(e.state)).length},V=z.filter(e=>!q.has(e.state)).map(e=>e.task_id),H=[...k],U=V.length>0&&V.every(e=>k.has(e)),pe=()=>A(e=>{let t=new Set(e);return U?V.forEach(e=>t.delete(e)):V.forEach(e=>t.add(e)),t}),me=e=>A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),he=e=>{q.has(e.state)||(M(!0),A(t=>new Set(t).add(e.task_id)),P(null))},K=()=>{M(!1),A(new Set)},ge=async()=>{if(oe){O(!0);try{if(!await ce(oe.task_id,e))throw Error(o(`cancelFailed`));D(null),await R(!0)}catch(e){D(null),b(e instanceof Error?e.message:String(e))}finally{O(!1)}}},_e=async()=>{if(!H.length)return;let t=H;L(!0);try{let n=await ie(t,e);if(A(e=>{let t=new Set(e);return n.forEach(e=>t.delete(e)),t}),n.length===t.length&&M(!1),I(!1),await R(!0),n.length!==t.length)throw Error(o(`deletePartial`,{deleted:n.length,total:t.length}))}catch(e){I(!1),b(e instanceof Error?e.message:String(e))}finally{L(!1)}};return(0,G.jsxs)(`section`,{className:`workspace-page`,children:[(0,G.jsxs)(`div`,{className:`page-heading`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`eyebrow`,children:`TASK RUNTIME / 01`}),(0,G.jsx)(`h1`,{children:o(`taskTitle`)}),(0,G.jsx)(`span`,{children:o(`taskLead`)})]}),(0,G.jsxs)(`div`,{className:`heading-actions`,children:[j&&(0,G.jsxs)(`div`,{className:`task-selection-actions`,children:[(0,G.jsx)(`span`,{children:o(`selectedCount`,{count:k.size})}),(0,G.jsxs)(`button`,{className:`danger-outline`,onClick:()=>I(!0),disabled:!k.size,children:[(0,G.jsx)(g,{size:14}),o(`confirmDelete`)]}),(0,G.jsxs)(`button`,{className:`secondary-button`,onClick:K,children:[(0,G.jsx)(ne,{size:14}),o(`finishSelection`)]})]}),(0,G.jsxs)(`label`,{className:`auto-toggle`,title:o(`autoRefresh`),children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:x,onChange:e=>te(e.target.checked),"aria-label":o(`autoRefresh`)}),(0,G.jsx)(`i`,{}),x&&(0,G.jsx)(`small`,{children:o(`nextRefresh`,{seconds:de})})]}),(0,G.jsx)(`button`,{className:`secondary-button`,onClick:()=>void R(!0),disabled:v,title:o(`refreshNow`),"aria-label":o(`refreshNow`),children:(0,G.jsx)(m,{size:16,className:v?`spin`:``})})]})]}),ee&&(0,G.jsxs)(`div`,{className:`error-banner`,children:[(0,G.jsx)(_,{size:18}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:o(`requestFailed`)}),(0,G.jsxs)(`span`,{children:[ee,` · `,o(`staleHint`)]})]}),(0,G.jsx)(`button`,{onClick:()=>void R(),children:o(`retry`)})]}),(0,G.jsx)(`div`,{className:`data-panel`,children:(0,G.jsxs)(`div`,{className:`table-wrap`,children:[(0,G.jsxs)(`table`,{children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[j&&(0,G.jsx)(`th`,{className:`select-column`,children:(0,G.jsx)(`input`,{type:`checkbox`,"aria-label":o(`selectAll`),checked:U,disabled:!V.length,onChange:pe})}),(0,G.jsx)(`th`,{className:`task-filter-column`,children:(0,G.jsxs)(`div`,{className:`table-search-head`,children:[(0,G.jsx)(`span`,{children:o(`taskId`)}),(0,G.jsxs)(`label`,{className:`search-field`,children:[(0,G.jsx)(h,{size:15}),(0,G.jsx)(`input`,{value:S,onChange:e=>w(e.target.value),placeholder:o(`search`)})]}),(0,G.jsxs)(`small`,{children:[z.length,` / `,c.length]})]})}),(0,G.jsx)(`th`,{className:`type-column`,children:(0,G.jsxs)(`select`,{className:`table-filter-select`,"aria-label":o(`type`),value:E,onChange:e=>ae(e.target.value),children:[(0,G.jsxs)(`option`,{value:``,children:[o(`allTypes`),` · `,c.length]}),fe.map(e=>(0,G.jsxs)(`option`,{value:e,children:[o(`types.${e}`,e),` ·`,` `,c.filter(t=>t.task_type===e).length]},e))]})}),(0,G.jsx)(`th`,{className:`state-column`,children:(0,G.jsxs)(`select`,{className:`table-filter-select`,"aria-label":o(`state`),value:T,onChange:e=>re(e.target.value),children:[(0,G.jsxs)(`option`,{value:``,children:[o(`allStates`),` · `,B.total]}),(0,G.jsxs)(`option`,{value:`active`,children:[o(`active`),` · `,B.active]}),(0,G.jsxs)(`option`,{value:`attention`,children:[o(`attention`),` · `,B.attention]}),Object.entries(o(`states`,{returnObjects:!0})).map(([e,t])=>(0,G.jsxs)(`option`,{value:e,children:[t,` ·`,` `,c.filter(t=>t.state===e).length]},e))]})}),(0,G.jsx)(`th`,{className:`progress-column`,children:o(`progress`)}),(0,G.jsx)(`th`,{className:`started-column`,children:o(`started`)}),(0,G.jsx)(`th`,{className:`duration-column`,children:o(`duration`)})]})}),(0,G.jsx)(`tbody`,{children:z.map(e=>(0,G.jsx)(Te,{task:e,selectionMode:j,selected:k.has(e.task_id),onSelect:()=>me(e.task_id),onOpen:()=>r(e.task_id),onContextMenu:t=>{t.preventDefault(),P({task:e,x:Math.max(6,Math.min(t.clientX,window.innerWidth-224)),y:Math.max(6,Math.min(t.clientY,window.innerHeight-240))})}},e.task_id))})]}),!u&&z.length===0&&(0,G.jsxs)(`div`,{className:`empty-state`,children:[(0,G.jsx)(`span`,{className:`empty-glyph`,children:`⌁`}),(0,G.jsx)(`strong`,{children:c.length?o(`noMatches`):o(`noTasks`)}),(0,G.jsx)(`p`,{children:c.length?o(`noMatches`):o(`noTasksHint`)}),!c.length&&(0,G.jsxs)(`button`,{className:`primary-button`,onClick:t,children:[(0,G.jsx)(p,{size:17}),o(`pages.submit`)]})]}),u&&(0,G.jsxs)(`div`,{className:`loading-state`,children:[(0,G.jsx)(d,{className:`spin`}),` `,o(`tasks.loadingRuntime`)]})]})}),N&&(0,G.jsxs)(`div`,{className:`workspace-context-menu task-context-menu`,role:`menu`,style:{left:N.x,top:N.y},onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`header`,{children:[(0,G.jsx)(`span`,{children:N.task.task_id}),(0,G.jsx)(`small`,{children:o(`types.${N.task.task_type}`)})]}),(0,G.jsxs)(`button`,{role:`menuitem`,onClick:()=>{r(N.task.task_id),P(null)},children:[(0,G.jsx)(h,{}),o(`details`)]}),!q.has(N.task.state)&&(0,G.jsxs)(`button`,{role:`menuitem`,onClick:()=>he(N.task),children:[(0,G.jsx)(s,{}),o(`enableMultiSelect`)]}),q.has(N.task.state)&&(0,G.jsxs)(`button`,{className:`danger`,role:`menuitem`,onClick:()=>{D(N.task),P(null)},children:[(0,G.jsx)(le,{}),o(`cancel`)]})]}),oe&&(0,G.jsx)(`div`,{className:`modal-backdrop`,onMouseDown:()=>D(null),children:(0,G.jsxs)(`div`,{className:`confirm-modal`,onMouseDown:e=>e.stopPropagation(),role:`dialog`,"aria-modal":`true`,children:[(0,G.jsx)(`button`,{className:`close-button`,onClick:()=>D(null),children:(0,G.jsx)(ne,{})}),(0,G.jsx)(`span`,{className:`danger-icon`,children:(0,G.jsx)(le,{})}),(0,G.jsx)(`h2`,{children:o(`cancelConfirm`)}),(0,G.jsx)(`code`,{children:oe.task_id}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`button`,{className:`secondary-button`,onClick:()=>D(null),children:o(`close`)}),(0,G.jsx)(`button`,{className:`danger-button`,onClick:()=>void ge(),disabled:se,children:o(se?`cancelling`:`confirmCancel`)})]})]})}),F&&(0,G.jsx)(`div`,{className:`modal-backdrop`,onMouseDown:()=>I(!1),children:(0,G.jsxs)(`div`,{className:`confirm-modal`,onMouseDown:e=>e.stopPropagation(),role:`dialog`,"aria-modal":`true`,children:[(0,G.jsx)(`button`,{className:`close-button`,onClick:()=>I(!1),children:(0,G.jsx)(ne,{})}),(0,G.jsx)(`span`,{className:`danger-icon`,children:(0,G.jsx)(g,{})}),(0,G.jsx)(`h2`,{children:o(`deleteConfirm`,{count:k.size})}),(0,G.jsx)(`p`,{children:o(`deleteHint`)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`button`,{className:`secondary-button`,onClick:()=>I(!1),children:o(`close`)}),(0,G.jsx)(`button`,{className:`danger-button`,onClick:()=>void _e(),disabled:ue,children:o(ue?`deleting`:`confirmDelete`)})]})]})})]})}function J(e){let t=e.started_at||e.created_at||e.finished_at;return t?new Date(t).getTime():0}function Te({task:e,selectionMode:t,selected:r,onSelect:i,onOpen:s,onContextMenu:c}){let{t:l}=n(),u=ve(e),d=!q.has(e.state),f=xe(),p=f.copied===e.task_id;return(0,G.jsxs)(`tr`,{className:r?`selected`:``,onClick:t?d?i:void 0:s,onContextMenu:c,children:[t&&(0,G.jsx)(`td`,{className:`select-column`,onClick:e=>e.stopPropagation(),children:(0,G.jsx)(`input`,{type:`checkbox`,"aria-label":l(`selectTask`,{taskId:e.task_id}),checked:r,disabled:!d,onChange:i})}),(0,G.jsx)(`td`,{className:`task-id-column`,children:(0,G.jsxs)(`div`,{className:`task-identity`,children:[(0,G.jsx)(`span`,{className:`task-orb ${e.state}`,children:e.task_type.slice(0,1).toUpperCase()}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`span`,{className:`task-id-line`,children:[(0,G.jsx)(`strong`,{title:e.task_id,children:e.task_id}),(0,G.jsx)(`button`,{type:`button`,className:p?`copied`:``,"aria-label":l(p?`copied`:`copyTaskId`),title:l(p?`copied`:`copyTaskId`),onClick:t=>{t.stopPropagation(),f.copy(e.task_id)},children:p?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(a,{}),(0,G.jsx)(`span`,{"aria-live":`polite`,children:l(`copied`)})]}):(0,G.jsx)(o,{})})]}),(0,G.jsxs)(`small`,{children:[`PID `,e.pid||`—`]})]})]})}),(0,G.jsx)(`td`,{className:`type-column`,children:(0,G.jsx)(`span`,{className:`type-chip`,children:l(`types.${e.task_type}`,e.task_type)})}),(0,G.jsx)(`td`,{className:`state-column`,children:(0,G.jsx)(Ee,{state:e.state})}),(0,G.jsx)(`td`,{className:`progress-column`,children:u?(0,G.jsxs)(`div`,{className:`progress-cell`,children:[(0,G.jsxs)(`span`,{className:`progress-step`,children:[(0,G.jsx)(`small`,{children:l(`step`)}),(0,G.jsx)(`strong`,{children:u.current})]}),(0,G.jsxs)(`span`,{className:`progress-ring`,style:{"--step-progress":`${u.percentage}%`},children:[(0,G.jsx)(`strong`,{children:u.percentage}),(0,G.jsx)(`small`,{children:`%`})]})]}):(0,G.jsx)(`span`,{className:`muted`,children:l(`notStarted`)})}),(0,G.jsx)(`td`,{className:`started-column`,children:ye(e.started_at||e.created_at)}),(0,G.jsx)(`td`,{className:`duration-column`,children:be(e,l)})]})}function Ee({state:e}){let{t}=n();return(0,G.jsxs)(`span`,{className:`status-badge ${e}`,children:[(0,G.jsx)(`i`,{}),t(`states.${e}`)]})}var De=A(),Oe=(e,t,n)=>f.invoke(`get_task_graph`,{task_id:e},{target:t,signal:n}),Y=216,X=68,Z=104,Q=28,ke=32;function Ae(e){let[t=e.kind,n=e.task_name,r=e.task_id]=e.task_id.split(`#`);return{scope:n?`${t.toUpperCase()}: ${n}`:t.toUpperCase(),name:r}}function je(e){let t=new Set(e.nodes.map(e=>e.task_id)),n=new Map,r=new Map;for(let i of e.nodes)n.set(i.task_id,i.parent_ids.filter(e=>t.has(e))),r.set(i.task_id,[]);for(let n of e.edges)t.has(n.from)&&t.has(n.to)&&r.get(n.from)?.push(n.to);let i=new Map,a=e.nodes.filter(e=>!n.get(e.task_id)?.length).map(e=>e.task_id);for(a.forEach(e=>i.set(e,0));a.length;){let e=a.shift();for(let t of r.get(e)||[]){let r=Math.max(i.get(t)||0,(i.get(e)||0)+1);i.set(t,r),(n.get(t)||[]).every(e=>i.has(e))&&!a.includes(t)&&a.push(t)}}let o=Math.max(0,...i.values())+1;e.nodes.forEach(e=>{i.has(e.task_id)||i.set(e.task_id,o)});let s=new Map;e.nodes.forEach(e=>{let t=i.get(e.task_id)||0;s.set(t,[...s.get(t)||[],e])});let c=Math.max(1,...[...s.values()].map(e=>e.length)),l=Math.max(300,64+c*X+(c-1)*Q),u=Math.max(760,64+s.size*Y+Math.max(0,s.size-1)*Z),d=new Map;for(let[e,t]of s){let n=t.length*X+(t.length-1)*Q;t.forEach((t,r)=>d.set(t.task_id,{x:ke+e*320,y:(l-n)/2+r*96}))}return{width:u,height:l,positions:d}}function Me({taskId:e,target:t,locateRequest:r,onOpenTask:i,onInterpretTask:a,onConnection:s}){let{t:c}=n(),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!0),[p,m]=(0,W.useState)(``),[g,v]=(0,W.useState)(null),y=(0,W.useRef)(null);(0,W.useEffect)(()=>{if(!g)return;let e=()=>v(null),t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`click`,e),window.addEventListener(`blur`,e),window.addEventListener(`keydown`,t),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`click`,e),window.removeEventListener(`blur`,e),window.removeEventListener(`keydown`,t),window.removeEventListener(`scroll`,e,!0)}},[g]),(0,W.useEffect)(()=>v(null),[e]),(0,W.useEffect)(()=>{let n=new AbortController;return f(!0),m(``),Oe(e,t,n.signal).then(e=>{u(e),s(!0)}).catch(e=>{n.signal.aborted||(u(null),m(e instanceof Error?e.message:String(e)),s(!1))}).finally(()=>{n.signal.aborted||f(!1)}),()=>n.abort()},[s,t,e]);let b=(0,W.useMemo)(()=>l?je(l):null,[l]),x=(0,W.useCallback)(()=>{if(!b||!y.current)return;let t=b.positions.get(e);t&&y.current.scrollTo({left:Math.max(0,t.x-y.current.clientWidth/2+Y/2),top:Math.max(0,t.y-y.current.clientHeight/2+X/2),behavior:`smooth`})},[b,e]);return(0,W.useEffect)(()=>{r&&x()},[x,r]),d?(0,G.jsx)(`div`,{className:`task-relations-message`,children:c(`taskGraph.loading_task_relationships`)}):p?(0,G.jsxs)(`div`,{className:`task-relations-message error`,role:`alert`,children:[(0,G.jsx)(_,{}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:c(`taskGraph.unable_to_load_relationships`)}),(0,G.jsx)(`span`,{children:p})]})]}):!l||!b?null:(0,G.jsxs)(`div`,{className:`task-relations-panel`,children:[l.nodes.some(e=>e.provisional)&&(0,G.jsx)(`p`,{className:`task-relations-provisional`,children:c(`taskGraph.some_tasks_use_provisional_relationships`)}),(0,G.jsx)(`div`,{className:`task-relations-body`,children:(0,G.jsx)(`div`,{className:`task-relations-viewport`,ref:y,children:(0,G.jsxs)(`div`,{className:`task-relations-graph`,style:{width:b.width,height:b.height},children:[(0,G.jsx)(`svg`,{"aria-hidden":`true`,width:b.width,height:b.height,children:l.edges.map(e=>{let t=b.positions.get(e.from),n=b.positions.get(e.to);if(!t||!n)return null;let r=t.x+Y,i=t.y+X/2,a=n.x,o=n.y+X/2,s=(r+a)/2;return(0,G.jsx)(`path`,{d:`M ${r} ${i} C ${s} ${i}, ${s} ${o}, ${a} ${o}`},`${e.from}:${e.to}`)})}),l.nodes.map(t=>{let n=b.positions.get(t.task_id),r=Ae(t);return(0,G.jsxs)(`button`,{className:`task-relation-node ${t.kind} ${t.task_id===e?`current`:``} ${t.missing?`missing`:``}`,style:{left:n.x,top:n.y,width:Y,height:X},onClick:()=>!t.missing&&i(t.task_id),onContextMenu:e=>{t.missing||(e.preventDefault(),v({node:t,x:Math.max(6,Math.min(e.clientX,window.innerWidth-224)),y:Math.max(6,Math.min(e.clientY,window.innerHeight-180))}))},disabled:t.missing,title:t.missing?void 0:c(`taskGraph.open_task`),children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:r.scope}),t.state&&(0,G.jsx)(`i`,{className:`relation-state ${t.state}`,children:c(`states.${t.state}`)})]}),(0,G.jsx)(`code`,{title:t.task_id,children:r.name})]},t.task_id)})]})})}),g&&(0,De.createPortal)((0,G.jsxs)(`div`,{className:`workspace-context-menu task-context-menu`,role:`menu`,style:{left:g.x,top:g.y},onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`header`,{children:[(0,G.jsx)(`span`,{title:g.node.task_id,children:g.node.task_id}),(0,G.jsx)(`small`,{children:c(`taskGraph.kinds.${g.node.kind}`)})]}),(0,G.jsxs)(`button`,{role:`menuitem`,onClick:()=>{i(g.node.task_id),v(null)},children:[(0,G.jsx)(h,{}),c(`taskGraph.open_task`)]}),(0,G.jsxs)(`button`,{role:`menuitem`,onClick:()=>{a(g.node.task_id),v(null)},children:[(0,G.jsx)(ee,{}),c(`agent.interpretTask`)]}),(0,G.jsxs)(`button`,{role:`menuitem`,onClick:()=>{navigator.clipboard.writeText(g.node.task_id),v(null)},children:[(0,G.jsx)(o,{}),c(`taskGraph.copy_task_id`)]})]}),document.body)]})}var Ne=new Set([`queued`,`running`]),Pe=65536,Fe=524288;function Ie({taskId:e,target:t,onBack:r,onOpenTask:i,onInterpretTask:s,onOpenResearch:u,onConnection:f}){let{t:p}=n(),h=p(`taskDetail`,{returnObjects:!0}),[g,_]=(0,W.useState)(null),[b,x]=(0,W.useState)(!0),[te,S]=(0,W.useState)(!1),[C,w]=(0,W.useState)(``),[E,ie]=(0,W.useState)(``),[O,k]=(0,W.useState)(``),[A,j]=(0,W.useState)(!1),[N,F]=(0,W.useState)(0),[I,L]=(0,W.useState)(0),[R,de]=(0,W.useState)(0),[z,B]=(0,W.useState)(!1),[V,H]=(0,W.useState)(!1),[U,pe]=(0,W.useState)(!0),[me,he]=(0,W.useState)(!1),[K,ge]=(0,W.useState)(!1),[_e,xe]=(0,W.useState)(!1),[Se,q]=(0,W.useState)(0),[Ce,we]=(0,W.useState)(!0),[J,Te]=(0,W.useState)({config:!1,relations:!1,details:!0,logs:!0}),De=(0,W.useRef)(null),Oe=(0,W.useRef)(!1),Y=(0,W.useRef)(0),X=g?.state;(0,W.useEffect)(()=>{let n=g?.task_type;if(!n||!X||Ne.has(X)||![`etl`,`analysis`,`train`,`predict`,`backtest`].includes(n)){xe(!1);return}let r=new AbortController;return xe(!1),v(`${n}/${e}/metadata.json`,0,1,t,r.signal).then(t=>{r.signal.aborted||xe(t.kind===`json`&&!!t.data&&!Array.isArray(t.data)&&typeof t.data==`object`&&t.data.task_id===e)}).catch(()=>{r.signal.aborted||xe(!1)}),()=>r.abort()},[t,g?.task_type,e,X]);let Z=(0,W.useCallback)(async()=>{x(!0);try{let n=await D(e,t);return _(n),w(``),f(!0),n}catch(e){return w(e instanceof Error?e.message:String(e)),f(!1),null}finally{x(!1)}},[f,t,e]),Q=(0,W.useCallback)(async(n,r)=>{if(!Oe.current){Oe.current=!0,j(!0);try{let i=r===`prepend`?Math.min(Pe,Math.max(1024,Fe-Y.current)):Pe,a=await ae(e,n,i,t);de(a.file_size),k(``),r===`replace`||a.reset?(Y.current=a.content.length,ie(a.content),F(a.start_offset),H(!1),L(a.next_offset),B(a.has_more_before)):r===`prepend`?(ie(e=>{let t=`${a.content}${e}`;return Y.current=t.length,t}),F(a.start_offset),B(a.has_more_before)):a.content&&(ie(e=>{let t=`${e}${a.content}`;return t.length<=Fe?(Y.current=t.length,t):(Y.current=Fe,H(!0),B(!1),t.slice(-524288))}),L(a.next_offset))}catch(e){k(e instanceof Error?e.message:String(e))}finally{Oe.current=!1,j(!1)}}},[t,e]);(0,W.useEffect)(()=>{Z().then(e=>{e?.log_path&&!Ne.has(e.state)&&Q(-1,`replace`)})},[Q,Z]),(0,W.useEffect)(()=>{if(!X||!Ne.has(X))return;let n=new AbortController;return se(e,t,n.signal,e=>{e.kind===`progress`&&_(t=>{if(!t)return t;let n={name:e.name,started_at:e.started_at,finished_at:e.finished_at,percentage:e.percentage},r=t.steps.findIndex(t=>t.name===e.name),i=[...t.steps];return r<0?i.push(n):i[r]=n,{...t,steps:i}}),e.kind===`log`&&(de(e.file_size),F(e.start_offset),L(e.next_offset),B(e.has_more_before),ie(t=>{let n=e.reset?e.content:t+e.content;return n.length<=Fe?(Y.current=n.length,n):(H(!0),B(!1),Y.current=Fe,n.slice(-524288))}))}).then(e=>{_(e),w(``),f(!0)}).catch(e=>{oe(e)||(w(e instanceof Error?e.message:String(e)),Z())}),()=>n.abort()},[Z,f,t,e,X]),(0,W.useEffect)(()=>{U&&De.current&&(De.current.scrollTop=De.current.scrollHeight)},[U,E]);let ke=async()=>{await navigator.clipboard.writeText(E),he(!0),window.setTimeout(()=>he(!1),1500)},Ae=async()=>{g&&(await navigator.clipboard.writeText(JSON.stringify(g.config||{},null,2)),ge(!0),window.setTimeout(()=>ge(!1),1500))},je=async()=>{if(g&&window.confirm(p(`cancelConfirm`))){S(!0);try{if(!await ce(g.task_id,t))throw Error(p(`cancelFailed`));await Z()}catch(e){w(e instanceof Error?e.message:String(e))}finally{S(!1)}}};if(b&&!g)return(0,G.jsxs)(`section`,{className:`workspace-page task-detail-loading`,children:[(0,G.jsx)(d,{className:`spin`}),h.refreshing]});if(!g)return(0,G.jsxs)(`section`,{className:`workspace-page`,children:[(0,G.jsxs)(`button`,{className:`detail-back`,onClick:r,children:[(0,G.jsx)(M,{}),h.back]}),(0,G.jsxs)(`div`,{className:`error-banner`,children:[(0,G.jsx)(`strong`,{children:h.taskMissing}),(0,G.jsx)(`span`,{children:C})]})]});let Ie=ve(g),Be=Object.entries(g.config||{}),Ve=g.steps.filter(e=>e.percentage===100).length,$=e=>{we(!1),Te(t=>({...t,[e]:!t[e]}))};return(0,G.jsxs)(`section`,{className:`workspace-page task-detail-page`,children:[(0,G.jsxs)(`div`,{className:`task-detail-heading`,children:[(0,G.jsxs)(`button`,{className:`detail-back`,onClick:r,children:[(0,G.jsx)(M,{}),h.back]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`eyebrow`,children:`TASK RUN / DETAIL`}),(0,G.jsx)(`h1`,{children:g.task_id}),(0,G.jsxs)(`span`,{className:`task-detail-subtitle`,children:[(0,G.jsx)(Ee,{state:g.state}),p(`types.${g.task_type}`,g.task_type),` · PID`,` `,g.pid||`—`]})]}),(0,G.jsxs)(`div`,{className:`task-detail-heading-actions`,children:[_e&&(0,G.jsxs)(`button`,{className:`secondary-button`,onClick:()=>u(g.task_type,g.task_id),children:[(0,G.jsx)(P,{}),h.openResearch]}),(0,G.jsxs)(`button`,{className:`secondary-button`,onClick:()=>s(g.task_id),children:[(0,G.jsx)(ee,{}),p(`agent.interpretTask`)]}),Ne.has(g.state)&&(0,G.jsxs)(`button`,{className:`danger-outline task-detail-cancel`,onClick:()=>void je(),disabled:te,children:[(0,G.jsx)(le,{}),p(te?`cancelling`:`cancel`)]})]})]}),C&&(0,G.jsxs)(`div`,{className:`error-banner`,children:[(0,G.jsx)(`strong`,{children:p(`requestFailed`)}),(0,G.jsx)(`span`,{children:C}),(0,G.jsx)(`button`,{onClick:()=>void Z(),children:p(`retry`)})]}),(0,G.jsxs)(`div`,{className:`task-detail-dashboard ${Ce?`initially-aligned`:``}`,children:[(0,G.jsxs)(`div`,{className:`task-detail-column task-detail-left`,children:[(0,G.jsxs)(Le,{className:`task-config-card`,title:h.config,summary:p(`taskDetail.configSummary`,{count:Be.length}),icon:(0,G.jsx)(y,{}),open:J.config,onToggle:()=>$(`config`),actions:(0,G.jsx)(`button`,{onClick:()=>void Ae(),title:K?h.copied:h.copyConfig,"aria-label":K?h.copied:h.copyConfig,children:K?(0,G.jsx)(a,{}):(0,G.jsx)(o,{})}),children:[(0,G.jsxs)(`div`,{className:`config-source`,children:[(0,G.jsx)(`span`,{children:h.task}),(0,G.jsx)(`code`,{children:g.task_name}),(0,G.jsx)(`i`,{children:h.snapshot})]}),Be.length?(0,G.jsx)(`dl`,{className:`task-config-list`,children:Be.map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:e}),(0,G.jsx)(`dd`,{title:ze(t),children:ze(t)})]},e))}):(0,G.jsxs)(`div`,{className:`task-config-empty`,children:[(0,G.jsx)(l,{}),h.noConfig]})]}),(0,G.jsxs)(Le,{className:`task-run-card`,title:h.runDetails,summary:`${Ve} ${h.completedSteps}`,icon:(0,G.jsx)(`span`,{className:`task-orb ${g.state}`,children:g.task_type.slice(0,1).toUpperCase()}),open:J.details,onToggle:()=>$(`details`),children:[(0,G.jsxs)(`div`,{className:`task-run-meta`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`small`,{children:p(`started`)}),(0,G.jsx)(`strong`,{children:ye(g.started_at)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`small`,{children:p(`duration`)}),(0,G.jsx)(`strong`,{children:be(g,p)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`small`,{children:`EXIT CODE`}),(0,G.jsx)(`strong`,{children:g.exit_code})]})]}),Ie&&(0,G.jsxs)(`div`,{className:`task-current-step`,children:[(0,G.jsx)(`span`,{children:p(`progress`)}),(0,G.jsx)(`code`,{title:Ie.name,children:Ie.name}),(0,G.jsxs)(`strong`,{children:[Ie.percentage,`%`]})]}),(0,G.jsx)(Re,{title:p(`steps`),children:(0,G.jsx)(`div`,{className:`step-list`,children:g.steps.length?g.steps.map((e,t)=>{let n=Math.max(0,Math.min(100,e.percentage??0)),r=g.state===`failed`&&t===g.steps.length-1,i=!r&&e.percentage===100;return(0,G.jsxs)(`div`,{className:`step-item ${r?`failed`:``}`,children:[(0,G.jsx)(`span`,{className:r?`failed`:i?`done`:`active`,style:!r&&!i?{"--step-progress":`${n}%`}:void 0,children:r?(0,G.jsx)(ne,{}):i?(0,G.jsx)(a,{}):t+1}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:e.name}),(0,G.jsx)(`small`,{children:r?g.error||p(`error`):e.finished_at?ye(e.finished_at):e.started_at?`${Math.round(n)}%`:p(`notStarted`)})]})]},`${e.name}-${t}`)}):(0,G.jsx)(`p`,{className:`muted`,children:p(`notStarted`)})})}),Object.keys(g.result).length>0&&(0,G.jsx)(Re,{title:p(`result`),children:(0,G.jsx)(`pre`,{children:JSON.stringify(g.result,null,2)})})]})]}),(0,G.jsxs)(`div`,{className:`task-detail-column task-detail-right`,children:[(0,G.jsx)(Le,{className:`task-relations-card`,title:h.relations,summary:h.relationsSummary,icon:(0,G.jsx)(re,{}),open:J.relations,onToggle:()=>$(`relations`),actions:(0,G.jsx)(`button`,{onClick:()=>{we(!1),Te(e=>({...e,relations:!0})),q(e=>e+1)},title:p(`taskGraph.locate_current_task`),"aria-label":p(`taskGraph.locate_current_task`),children:(0,G.jsx)(fe,{})}),children:(0,G.jsx)(Me,{taskId:e,target:t,locateRequest:Se,onOpenTask:i,onInterpretTask:s,onConnection:f})}),(0,G.jsx)(Le,{className:`task-log-card`,title:h.logs,summary:g.log_path||h.logUnavailable,icon:(0,G.jsx)(c,{}),open:J.logs,onToggle:()=>$(`logs`),actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{onClick:()=>void Q(-1,`replace`),disabled:A||!g.log_path,title:h.refreshLog,"aria-label":h.refreshLog,children:(0,G.jsx)(m,{className:A?`spin`:void 0})}),(0,G.jsxs)(`label`,{className:`log-follow`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:U,onChange:e=>pe(e.target.checked)}),h.follow]}),(0,G.jsx)(`button`,{onClick:()=>void ke(),disabled:!E,title:me?h.copied:h.copy,"aria-label":me?h.copied:h.copy,children:me?(0,G.jsx)(a,{}):(0,G.jsx)(o,{})})]}),children:(0,G.jsxs)(`div`,{className:`log-panel`,children:[(0,G.jsxs)(`div`,{className:`log-meta`,children:[(0,G.jsxs)(`span`,{children:[h.loaded,` `,T(Math.min(R,Math.max(0,I-N))),` `,h.of,` `,T(R)]}),(0,G.jsx)(`span`,{children:h.bounded})]}),z&&!V&&(0,G.jsxs)(`button`,{className:`load-earlier`,onClick:()=>void Q(Math.max(0,N-Pe),`prepend`),disabled:A||E.length>523264,children:[(0,G.jsx)(ue,{}),h.loadEarlier]}),O?(0,G.jsxs)(`div`,{className:`log-placeholder error`,children:[(0,G.jsx)(`strong`,{children:h.logError}),(0,G.jsx)(`span`,{children:O})]}):g.log_path?!E&&!A?(0,G.jsx)(`div`,{className:`log-placeholder`,children:h.logEmpty}):(0,G.jsxs)(`pre`,{className:`log-content`,ref:De,children:[E,A&&(0,G.jsx)(`span`,{className:`log-cursor`})]}):(0,G.jsx)(`div`,{className:`log-placeholder`,children:h.logUnavailable})]})})]})]})]})}function Le({className:e,title:t,summary:n,icon:r,open:i,onToggle:a,actions:o,children:s}){let c=`${e}-content`;return(0,G.jsxs)(`section`,{className:`task-detail-card ${e} ${i?`open`:`collapsed`}`,children:[(0,G.jsxs)(`header`,{children:[(0,G.jsxs)(`button`,{className:`task-detail-card-toggle`,onClick:a,"aria-expanded":i,"aria-controls":c,children:[(0,G.jsx)(`span`,{className:`task-detail-card-icon`,children:r}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:t}),(0,G.jsx)(`small`,{children:n})]})]}),o&&(0,G.jsx)(`div`,{className:`task-detail-card-actions`,children:o}),(0,G.jsx)(`button`,{className:`task-detail-card-chevron`,onClick:a,"aria-expanded":i,"aria-controls":c,"aria-label":t,children:(0,G.jsx)(te,{})})]}),i&&(0,G.jsx)(`div`,{className:`task-detail-card-body`,id:c,children:s})]})}function Re({title:e,children:t}){return(0,G.jsxs)(`section`,{className:`detail-section`,children:[(0,G.jsx)(`h3`,{children:e}),t]})}function ze(e){return typeof e==`string`?e||`""`:JSON.stringify(e)}function Be({machine:e,target:t,view:n,taskId:r,onNavigate:i,onSubmit:a,onInterpretTask:o,onOpenResearch:s,onOptionsChange:c,onConnection:l}){return(0,W.useEffect)(()=>{if(n!==`task`||!r||!c)return;let e=new AbortController;return C(t,e.signal).then(e=>c(e.map(e=>({value:e.task_id,label:e.task_id,detail:e.task_name||e.task_type})))).catch(()=>void 0),()=>e.abort()},[n,r,t,c]),(0,G.jsx)(`section`,{className:`runtime-workspace unified-workspace`,children:(0,G.jsx)(`main`,{className:`workspace-canvas`,children:n===`resources`?(0,G.jsx)(He,{machine:e,target:t,onConnection:l}):n===`environment`?(0,G.jsx)(Ve,{machine:e,target:t,onConnection:l}):n!==`tasks`&&r?(0,G.jsx)(Ie,{taskId:r,target:t,onBack:()=>i(`tasks`),onOpenTask:e=>i(`task`,e),onInterpretTask:o,onOpenResearch:s,onConnection:l},`${t||`local`}:${r}`):(0,G.jsx)(we,{target:t,onSubmit:a,onOpenTask:e=>i(`task`,e),onTasksChange:c,onConnection:l})})})}function Ve({machine:e,target:t,onConnection:r}){let{t:i}=n(),{data:a,loading:o,error:s,reload:c}=_e(t,r);return(0,G.jsxs)(`section`,{className:`runtime-environment-page`,children:[(0,G.jsxs)(`header`,{className:`canvas-heading`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`small`,{children:`RUNTIME / ENVIRONMENT`}),(0,G.jsx)(`h1`,{children:i(`runtime.environment`)}),(0,G.jsx)(`p`,{children:i(`runtime.environmentLead`)})]}),(0,G.jsxs)(`button`,{className:`secondary-button`,onClick:()=>void c(),children:[(0,G.jsx)(m,{className:o?`spin`:``}),i(`refresh`)]})]}),o&&!a?(0,G.jsx)(`div`,{className:`loading-state machine-loading`,children:(0,G.jsx)(d,{className:`spin`})}):s?(0,G.jsxs)(`div`,{className:`machine-offline`,children:[(0,G.jsx)(`span`,{children:(0,G.jsx)(k,{})}),(0,G.jsx)(`h2`,{children:i(`runtime.environmentUnavailable`)}),(0,G.jsx)(`p`,{children:s})]}):a&&(0,G.jsxs)(`section`,{className:`runtime-environment-card`,children:[(0,G.jsxs)(`header`,{children:[(0,G.jsx)(pe,{}),(0,G.jsx)(`strong`,{children:i(`runtime.versionInformation`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)($,{label:i(`runtime.axonxVersion`),value:`v${a.axonx.version}`}),(0,G.jsx)($,{label:`GIT COMMIT`,value:a.axonx.git_commit||`—`,icon:(0,G.jsx)(x,{})}),(0,G.jsx)($,{label:`GIT BRANCH`,value:a.axonx.git_branch||`—`,icon:(0,G.jsx)(re,{})}),(0,G.jsx)($,{label:i(`runtime.endpoint`),value:O(e.address)})]})]})]})}function $({label:e,value:t,icon:n}){return(0,G.jsxs)(`article`,{children:[(0,G.jsx)(`small`,{children:e}),(0,G.jsxs)(`strong`,{children:[n,t]})]})}function He({machine:e,target:t,onConnection:r}){let{t:i}=n(),{data:a,loading:o,error:s,reload:c}=_e(t,r),l=a?{...e,info:a}:e;return(0,G.jsxs)(`section`,{className:`current-machine-page`,children:[(0,G.jsxs)(`header`,{className:`canvas-heading`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`small`,{children:`MACHINE / LIVE`}),(0,G.jsx)(`h1`,{children:i(`runtime.machineResources`)}),(0,G.jsxs)(`p`,{className:`machine-heading-meta`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(k,{}),O(e.address)]}),(0,G.jsxs)(`span`,{className:`online`,children:[(0,G.jsx)(`i`,{}),i(`shell.online`)]})]})]}),(0,G.jsx)(`button`,{className:`secondary-button machine-refresh-button`,onClick:()=>void c(),"aria-label":i(`runtime.refreshMachine`),title:i(`runtime.refreshMachine`),children:(0,G.jsx)(m,{className:o?`spin`:``})})]}),o&&!a?(0,G.jsx)(`div`,{className:`loading-state machine-loading`,children:(0,G.jsx)(d,{className:`spin`})}):s?(0,G.jsxs)(`div`,{className:`machine-offline`,children:[(0,G.jsx)(`span`,{children:(0,G.jsx)(k,{})}),(0,G.jsx)(`h2`,{children:i(`runtime.machineUnavailable`)}),(0,G.jsx)(`p`,{children:s})]}):a&&(0,G.jsx)(me,{node:l})]})}export{Be as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./jsx-runtime-g_EzXSjx.js";import{t as n}from"./createLucideIcon-3GmWj6nd.js";var r={name:`braces`,size:24,node:[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]],aliases:[`curly-braces`]};r.node;var i=n(r);function a(e){return Array.isArray(e.type)?e.type.find(e=>e!==`null`)||`string`:e.type?e.type:e.anyOf?.map(a).find(e=>e!==`null`)||`string`}function o(e,t){let n=a(t);return n===`boolean`?!!e:t.enum||n===`object`||n===`array`?e===void 0?``:JSON.stringify(e,null,n===`object`||n===`array`?2:void 0):String(e??``)}function s(e,t){let n=a(t);return t.enum?JSON.parse(String(e)):n===`boolean`?!!e:n===`integer`?Number.parseInt(String(e),10):n===`number`?Number(String(e)):n===`object`||n===`array`?JSON.parse(String(e)):String(e)}function c(e){return Object.fromEntries(Object.entries(e.properties||{}).map(([e,t])=>[e,t.default===void 0?a(t)!==`boolean`&&``:o(t.default,t)]))}function l(e,t,n){let r={},i={},o=new Set(e.required||[]);for(let[c,l]of Object.entries(e.properties||{})){let e=t[c],u=a(l);if((e===``||e===void 0)&&o.has(c)){i[c]=n.required;continue}if(e!==``&&e!==void 0&&(u!==`boolean`||e!==!1||l.default!==void 0||o.has(c)))try{r[c]=s(e,l)}catch{i[c]=n.invalidJson}}return{data:r,errors:i}}function u(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}var d=t();function f({name:t,schema:n,required:r,value:i,error:o,variant:s=`default`,onChange:c}){let{t:l}=e(),f=a(n),p=`field-${s}-${t}`,m=n.title||(s==="default"?u(t):t),h=(0,d.jsx)(`em`,{className:r?`required`:``,children:l(r?`required`:`optional`)}),g=(0,d.jsxs)(d.Fragment,{children:[s==="default"?(0,d.jsxs)(`div`,{className:`field-label`,children:[(0,d.jsx)(`span`,{children:m}),h]}):(0,d.jsxs)(`span`,{children:[(0,d.jsx)(`strong`,{children:m}),h]}),n.description&&(0,d.jsx)(`small`,{children:n.description}),n.enum?(0,d.jsxs)(`select`,{id:p,value:String(i),required:r,onChange:e=>c(e.target.value),children:[(0,d.jsx)(`option`,{value:``,children:s==="default"?l(`choose`):`—`}),n.enum.map(e=>(0,d.jsx)(`option`,{value:JSON.stringify(e),children:String(e)},JSON.stringify(e)))]}):f===`boolean`?(0,d.jsxs)(`button`,{id:p,type:`button`,className:`switch-control ${i?`on`:``}`,onClick:()=>c(!i),role:`switch`,"aria-checked":!!i,children:[(0,d.jsx)(`i`,{}),(0,d.jsx)(`span`,{children:l(i?`common.true`:`common.false`)})]}):f===`object`||f===`array`?(0,d.jsx)(`textarea`,{id:p,value:String(i),required:r,placeholder:f===`array`?`[]`:`{}`,onChange:e=>c(e.target.value)}):(0,d.jsx)(`input`,{id:p,type:f===`integer`||f===`number`?`number`:n.format===`date`?`date`:`text`,step:f===`integer`?1:f===`number`?`any`:void 0,min:n.minimum,max:n.maximum,value:String(i),required:r,placeholder:t===`source_tasks`?l(`schemaForm.sourceTasksPlaceholder`):void 0,onChange:e=>c(e.target.value)}),o&&(0,d.jsx)(`span`,{className:`field-error`,children:o})]});return s==="default"?(0,d.jsx)(`label`,{className:`schema-field ${f===`object`||f===`array`?`wide`:``}`,htmlFor:p,children:g}):(0,d.jsx)(`label`,{className:f===`object`||f===`array`?`wide`:``,htmlFor:p,children:g})}export{i,c as n,l as r,f as t};
|