@next-bricks/ai-portal 0.16.2 → 0.16.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/bricks.json +19 -19
  2. package/dist/chunks/6220.512ca2ff.js +3 -0
  3. package/dist/chunks/6220.512ca2ff.js.map +1 -0
  4. package/dist/chunks/9073.49ce5e46.js +2 -0
  5. package/dist/chunks/9073.49ce5e46.js.map +1 -0
  6. package/dist/chunks/chat-history.45b2a02b.js +3 -0
  7. package/dist/chunks/chat-history.45b2a02b.js.map +1 -0
  8. package/dist/chunks/cruise-canvas.5d3695e1.js +2 -0
  9. package/dist/chunks/cruise-canvas.5d3695e1.js.map +1 -0
  10. package/dist/chunks/elevo-sidebar.9ad9608d.js +3 -0
  11. package/dist/chunks/elevo-sidebar.9ad9608d.js.map +1 -0
  12. package/dist/chunks/{main.997c6dda.js → main.87081e6e.js} +2 -2
  13. package/dist/chunks/{main.997c6dda.js.map → main.87081e6e.js.map} +1 -1
  14. package/dist/examples.json +9 -9
  15. package/dist/index.76b94c33.js +2 -0
  16. package/dist/{index.9c92ae05.js.map → index.76b94c33.js.map} +1 -1
  17. package/dist/manifest.json +115 -106
  18. package/dist/types.json +200 -186
  19. package/dist-types/cruise-canvas/PlanProgress/PlanProgress.d.ts +2 -1
  20. package/dist-types/cruise-canvas/index.d.ts +6 -2
  21. package/dist-types/cruise-canvas/useTaskDetail.d.ts +1 -1
  22. package/dist-types/cruise-canvas/utils/handleKeyboardNav.d.ts +14 -1
  23. package/dist-types/elevo-sidebar/ChatHistory.d.ts +2 -1
  24. package/dist-types/elevo-sidebar/index.d.ts +2 -0
  25. package/package.json +2 -2
  26. package/dist/chunks/6220.43f2b07b.js +0 -3
  27. package/dist/chunks/6220.43f2b07b.js.map +0 -1
  28. package/dist/chunks/9073.c6114084.js +0 -2
  29. package/dist/chunks/9073.c6114084.js.map +0 -1
  30. package/dist/chunks/chat-history.be541949.js +0 -3
  31. package/dist/chunks/chat-history.be541949.js.map +0 -1
  32. package/dist/chunks/cruise-canvas.234f0add.js +0 -2
  33. package/dist/chunks/cruise-canvas.234f0add.js.map +0 -1
  34. package/dist/chunks/elevo-sidebar.de21ad02.js +0 -3
  35. package/dist/chunks/elevo-sidebar.de21ad02.js.map +0 -1
  36. package/dist/index.9c92ae05.js +0 -2
  37. /package/dist/chunks/{6220.43f2b07b.js.LICENSE.txt → 6220.512ca2ff.js.LICENSE.txt} +0 -0
  38. /package/dist/chunks/{chat-history.be541949.js.LICENSE.txt → chat-history.45b2a02b.js.LICENSE.txt} +0 -0
  39. /package/dist/chunks/{elevo-sidebar.de21ad02.js.LICENSE.txt → elevo-sidebar.9ad9608d.js.LICENSE.txt} +0 -0
package/dist/types.json CHANGED
@@ -1,9 +1,4 @@
1
1
  {
2
- "ai-portal.home-container": {
3
- "properties": [],
4
- "events": [],
5
- "methods": []
6
- },
7
2
  "ai-portal.stat-with-mini-chart": {
8
3
  "properties": [
9
4
  {
@@ -113,187 +108,10 @@
113
108
  "events": [],
114
109
  "methods": []
115
110
  },
116
- "ai-portal.chat-history": {
117
- "properties": [
118
- {
119
- "name": "list",
120
- "annotation": {
121
- "type": "array",
122
- "elementType": {
123
- "type": "reference",
124
- "typeName": {
125
- "type": "identifier",
126
- "name": "HistoryItem"
127
- }
128
- }
129
- }
130
- },
131
- {
132
- "name": "actions",
133
- "annotation": {
134
- "type": "array",
135
- "elementType": {
136
- "type": "reference",
137
- "typeName": {
138
- "type": "identifier",
139
- "name": "ActionType"
140
- }
141
- }
142
- }
143
- },
144
- {
145
- "name": "nextToken",
146
- "annotation": {
147
- "type": "keyword",
148
- "value": "string"
149
- }
150
- }
151
- ],
152
- "events": [
153
- {
154
- "name": "action.click",
155
- "detail": {
156
- "annotation": {
157
- "type": "reference",
158
- "typeName": {
159
- "type": "identifier",
160
- "name": "ActionClickDetail"
161
- }
162
- }
163
- }
164
- },
165
- {
166
- "name": "load.more",
167
- "detail": {
168
- "annotation": {
169
- "type": "typeLiteral",
170
- "members": [
171
- {
172
- "type": "propertySignature",
173
- "key": {
174
- "type": "identifier",
175
- "name": "nextToken"
176
- },
177
- "annotation": {
178
- "type": "keyword",
179
- "value": "string"
180
- },
181
- "computed": false
182
- }
183
- ]
184
- }
185
- }
186
- }
187
- ],
188
- "methods": [],
189
- "types": [
190
- {
191
- "type": "interface",
192
- "name": "HistoryItem",
193
- "body": [
194
- {
195
- "type": "propertySignature",
196
- "key": {
197
- "type": "identifier",
198
- "name": "id"
199
- },
200
- "annotation": {
201
- "type": "keyword",
202
- "value": "string"
203
- },
204
- "computed": false
205
- },
206
- {
207
- "type": "propertySignature",
208
- "key": {
209
- "type": "identifier",
210
- "name": "url"
211
- },
212
- "annotation": {
213
- "type": "keyword",
214
- "value": "string"
215
- },
216
- "computed": false
217
- },
218
- {
219
- "type": "propertySignature",
220
- "key": {
221
- "type": "identifier",
222
- "name": "title"
223
- },
224
- "annotation": {
225
- "type": "keyword",
226
- "value": "string"
227
- },
228
- "computed": false
229
- },
230
- {
231
- "type": "propertySignature",
232
- "key": {
233
- "type": "identifier",
234
- "name": "startTime"
235
- },
236
- "annotation": {
237
- "type": "keyword",
238
- "value": "number"
239
- },
240
- "computed": false
241
- },
242
- {
243
- "type": "propertySignature",
244
- "key": {
245
- "type": "identifier",
246
- "name": "state"
247
- },
248
- "annotation": {
249
- "type": "reference",
250
- "typeName": {
251
- "type": "identifier",
252
- "name": "TaskState"
253
- }
254
- },
255
- "optional": true,
256
- "computed": false
257
- }
258
- ]
259
- },
260
- {
261
- "type": "interface",
262
- "name": "ActionClickDetail",
263
- "body": [
264
- {
265
- "type": "propertySignature",
266
- "key": {
267
- "type": "identifier",
268
- "name": "action"
269
- },
270
- "annotation": {
271
- "type": "reference",
272
- "typeName": {
273
- "type": "identifier",
274
- "name": "SimpleActionType"
275
- }
276
- },
277
- "computed": false
278
- },
279
- {
280
- "type": "propertySignature",
281
- "key": {
282
- "type": "identifier",
283
- "name": "item"
284
- },
285
- "annotation": {
286
- "type": "reference",
287
- "typeName": {
288
- "type": "identifier",
289
- "name": "HistoryItem"
290
- }
291
- },
292
- "computed": false
293
- }
294
- ]
295
- }
296
- ]
111
+ "ai-portal.home-container": {
112
+ "properties": [],
113
+ "events": [],
114
+ "methods": []
297
115
  },
298
116
  "ai-portal.chat-box": {
299
117
  "properties": [
@@ -423,6 +241,13 @@
423
241
  "value": "string"
424
242
  }
425
243
  },
244
+ {
245
+ "name": "historyActiveId",
246
+ "annotation": {
247
+ "type": "keyword",
248
+ "value": "string"
249
+ }
250
+ },
426
251
  {
427
252
  "name": "historyUrlTemplate",
428
253
  "annotation": {
@@ -565,6 +390,188 @@
565
390
  }
566
391
  ]
567
392
  },
393
+ "ai-portal.chat-history": {
394
+ "properties": [
395
+ {
396
+ "name": "list",
397
+ "annotation": {
398
+ "type": "array",
399
+ "elementType": {
400
+ "type": "reference",
401
+ "typeName": {
402
+ "type": "identifier",
403
+ "name": "HistoryItem"
404
+ }
405
+ }
406
+ }
407
+ },
408
+ {
409
+ "name": "actions",
410
+ "annotation": {
411
+ "type": "array",
412
+ "elementType": {
413
+ "type": "reference",
414
+ "typeName": {
415
+ "type": "identifier",
416
+ "name": "ActionType"
417
+ }
418
+ }
419
+ }
420
+ },
421
+ {
422
+ "name": "nextToken",
423
+ "annotation": {
424
+ "type": "keyword",
425
+ "value": "string"
426
+ }
427
+ }
428
+ ],
429
+ "events": [
430
+ {
431
+ "name": "action.click",
432
+ "detail": {
433
+ "annotation": {
434
+ "type": "reference",
435
+ "typeName": {
436
+ "type": "identifier",
437
+ "name": "ActionClickDetail"
438
+ }
439
+ }
440
+ }
441
+ },
442
+ {
443
+ "name": "load.more",
444
+ "detail": {
445
+ "annotation": {
446
+ "type": "typeLiteral",
447
+ "members": [
448
+ {
449
+ "type": "propertySignature",
450
+ "key": {
451
+ "type": "identifier",
452
+ "name": "nextToken"
453
+ },
454
+ "annotation": {
455
+ "type": "keyword",
456
+ "value": "string"
457
+ },
458
+ "computed": false
459
+ }
460
+ ]
461
+ }
462
+ }
463
+ }
464
+ ],
465
+ "methods": [],
466
+ "types": [
467
+ {
468
+ "type": "interface",
469
+ "name": "HistoryItem",
470
+ "body": [
471
+ {
472
+ "type": "propertySignature",
473
+ "key": {
474
+ "type": "identifier",
475
+ "name": "id"
476
+ },
477
+ "annotation": {
478
+ "type": "keyword",
479
+ "value": "string"
480
+ },
481
+ "computed": false
482
+ },
483
+ {
484
+ "type": "propertySignature",
485
+ "key": {
486
+ "type": "identifier",
487
+ "name": "url"
488
+ },
489
+ "annotation": {
490
+ "type": "keyword",
491
+ "value": "string"
492
+ },
493
+ "computed": false
494
+ },
495
+ {
496
+ "type": "propertySignature",
497
+ "key": {
498
+ "type": "identifier",
499
+ "name": "title"
500
+ },
501
+ "annotation": {
502
+ "type": "keyword",
503
+ "value": "string"
504
+ },
505
+ "computed": false
506
+ },
507
+ {
508
+ "type": "propertySignature",
509
+ "key": {
510
+ "type": "identifier",
511
+ "name": "startTime"
512
+ },
513
+ "annotation": {
514
+ "type": "keyword",
515
+ "value": "number"
516
+ },
517
+ "computed": false
518
+ },
519
+ {
520
+ "type": "propertySignature",
521
+ "key": {
522
+ "type": "identifier",
523
+ "name": "state"
524
+ },
525
+ "annotation": {
526
+ "type": "reference",
527
+ "typeName": {
528
+ "type": "identifier",
529
+ "name": "TaskState"
530
+ }
531
+ },
532
+ "optional": true,
533
+ "computed": false
534
+ }
535
+ ]
536
+ },
537
+ {
538
+ "type": "interface",
539
+ "name": "ActionClickDetail",
540
+ "body": [
541
+ {
542
+ "type": "propertySignature",
543
+ "key": {
544
+ "type": "identifier",
545
+ "name": "action"
546
+ },
547
+ "annotation": {
548
+ "type": "reference",
549
+ "typeName": {
550
+ "type": "identifier",
551
+ "name": "SimpleActionType"
552
+ }
553
+ },
554
+ "computed": false
555
+ },
556
+ {
557
+ "type": "propertySignature",
558
+ "key": {
559
+ "type": "identifier",
560
+ "name": "item"
561
+ },
562
+ "annotation": {
563
+ "type": "reference",
564
+ "typeName": {
565
+ "type": "identifier",
566
+ "name": "HistoryItem"
567
+ }
568
+ },
569
+ "computed": false
570
+ }
571
+ ]
572
+ }
573
+ ]
574
+ },
568
575
  "ai-portal.cruise-canvas": {
569
576
  "properties": [
570
577
  {
@@ -599,6 +606,13 @@
599
606
  },
600
607
  {
601
608
  "name": "replay",
609
+ "annotation": {
610
+ "type": "keyword",
611
+ "value": "boolean"
612
+ }
613
+ },
614
+ {
615
+ "name": "replayDelay",
602
616
  "annotation": {
603
617
  "type": "keyword",
604
618
  "value": "number"
@@ -2,5 +2,6 @@ import type { StepWithState, TaskState } from "../interfaces";
2
2
  export interface PlanProgressProps {
3
3
  plan?: StepWithState[];
4
4
  state?: TaskState;
5
+ replay?: boolean;
5
6
  }
6
- export declare function PlanProgress({ plan, state: taskState, }: PlanProgressProps): JSX.Element | null;
7
+ export declare function PlanProgress({ plan, state: taskState, replay, }: PlanProgressProps): JSX.Element | null;
@@ -6,7 +6,8 @@ export interface CruiseCanvasProps {
6
6
  taskId?: string;
7
7
  task?: TaskBaseDetail;
8
8
  jobs?: Job[];
9
- replay?: number;
9
+ replay?: boolean;
10
+ replayDelay?: number;
10
11
  }
11
12
  /**
12
13
  * 构件 `ai-portal.cruise-canvas`
@@ -16,10 +17,13 @@ export declare class CruiseCanvas extends ReactNextElement implements CruiseCanv
16
17
  accessor taskId: string | undefined;
17
18
  accessor task: TaskBaseDetail | undefined;
18
19
  accessor jobs: Job[] | undefined;
20
+ accessor replay: boolean | undefined;
19
21
  /**
20
22
  * 设置回放时消息之间的时间间隔,单位为秒。
23
+ *
24
+ * @default 2
21
25
  */
22
- accessor replay: number | undefined;
26
+ accessor replayDelay: number | undefined;
23
27
  resumed(): void;
24
28
  render(): React.JSX.Element;
25
29
  }
@@ -1,5 +1,5 @@
1
1
  import type { Job, StepWithState } from "./interfaces";
2
- export declare function useTaskDetail(taskId: string | undefined, replay?: number): {
2
+ export declare function useTaskDetail(taskId: string | undefined, replay?: boolean, replayDelay?: number): {
3
3
  task: import("./interfaces").TaskBaseDetail | null;
4
4
  jobs: Job[];
5
5
  plan: StepWithState[];
@@ -2,7 +2,7 @@ import type { GraphNode } from "../interfaces";
2
2
  export type KeyboardAction = KeyboardActionSwitchActiveNode | KeyboardActionEnter | KeyboardActionScroll;
3
3
  export interface KeyboardActionSwitchActiveNode {
4
4
  action: "switch-active-node";
5
- node: GraphNode;
5
+ node: GraphNode | null;
6
6
  }
7
7
  export interface KeyboardActionEnter {
8
8
  action: "enter";
@@ -14,6 +14,19 @@ export interface KeyboardActionScroll {
14
14
  range: "line" | "page" | "document";
15
15
  node?: undefined;
16
16
  }
17
+ /**
18
+ * Keyboard navigation:
19
+ * - When no node is active, simulate browser page scrolling shortcuts:
20
+ * - Space: scroll down (or up with shift) by page
21
+ * - Arrow keys: scroll by line in the direction of the arrow
22
+ * - Arrow up/down with ⌘ on Mac: scroll to top/bottom of document
23
+ * - Home/end: scroll to top/bottom of document
24
+ * - When a node is active:
25
+ * - Arrow keys: switch active node in the direction of the arrow
26
+ * - Arrow up/down with ⌘ on Mac: switch active node to the top/bottom most node
27
+ * - Escape: clear active node
28
+ * - Enter: Enter the detail of the active node
29
+ */
17
30
  export declare function handleKeyboardNav(event: KeyboardEvent, { activeNodeId, nodes, }: {
18
31
  activeNodeId: string | null;
19
32
  nodes: GraphNode[];
@@ -16,9 +16,10 @@ export interface ActionClickDetail {
16
16
  item: HistoryItem;
17
17
  }
18
18
  export interface ChatHistoryProps {
19
+ activeId?: string;
19
20
  urlTemplate?: string;
20
21
  actions?: ActionType[];
21
22
  onActionClick: (detail: ActionClickDetail) => void;
22
23
  onHistoryClick: () => void;
23
24
  }
24
- export declare function ChatHistory({ actions, urlTemplate, onActionClick, onHistoryClick, }: ChatHistoryProps): React.JSX.Element;
25
+ export declare function ChatHistory({ activeId, actions, urlTemplate, onActionClick, onHistoryClick, }: ChatHistoryProps): React.JSX.Element;
@@ -7,6 +7,7 @@ export interface ElevoSidebarProps {
7
7
  behavior?: "default" | "drawer";
8
8
  logoUrl?: string;
9
9
  newChatUrl?: string;
10
+ historyActiveId?: string;
10
11
  historyUrlTemplate?: string;
11
12
  historyActions?: ActionType[];
12
13
  }
@@ -19,6 +20,7 @@ export declare class ElevoSidebar extends ReactNextElement implements ElevoSideb
19
20
  accessor behavior: "default" | "drawer" | undefined;
20
21
  accessor logoUrl: string | undefined;
21
22
  accessor newChatUrl: string | undefined;
23
+ accessor historyActiveId: string | undefined;
22
24
  accessor historyUrlTemplate: string | undefined;
23
25
  accessor historyActions: ActionType[] | undefined;
24
26
  render(): React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-bricks/ai-portal",
3
- "version": "0.16.2",
3
+ "version": "0.16.4",
4
4
  "homepage": "https://github.com/easyops-cn/next-advanced-bricks/tree/master/bricks/ai-portal",
5
5
  "repository": {
6
6
  "type": "git",
@@ -45,5 +45,5 @@
45
45
  "@next-bricks/mini-chart": "*",
46
46
  "@next-bricks/presentational": "*"
47
47
  },
48
- "gitHead": "e5cb1158bfe8020020504cf3a0a37764a3f1a3ca"
48
+ "gitHead": "b8996e45bb3f119221fba6d84caa136171c9b363"
49
49
  }
@@ -1,3 +0,0 @@
1
- /*! For license information please see 6220.43f2b07b.js.LICENSE.txt */
2
- "use strict";(globalThis.webpackChunk_next_bricks_ai_portal=globalThis.webpackChunk_next_bricks_ai_portal||[]).push([[6220],{24:(e,t,n)=>{n.d(t,{A:()=>o});var i=n(36758),a=n.n(i),s=n(40935),r=n.n(s)()(a());r.push([e.id,':host{display:block;white-space:nowrap}.container{border-radius:var(--elevo-border-radius)}:host([hidden]){display:none}*{box-sizing:border-box}.label{font-weight:500;overflow:hidden;text-overflow:ellipsis}.stat{font-weight:600}.chart{min-width:0}.chart > *{display:block}:host(:not([size="small"])) .container{background:linear-gradient(164deg,rgba(105,153,253,0) 40%,rgba(105,153,253,0.05) 60%,rgba(105,153,253,0.32) 100%),#fff;padding:22px}:host(:not([size="small"])) .label{font-size:14px;height:22px;margin-bottom:16px}:host(:not([size="small"])) .stat-and-chart{display:flex;align-items:center;justify-content:end;position:relative}:host(:not([size="small"])) .stat{font-size:36px;color:#1d212a;position:absolute;left:0}:host(:not([size="small"])) .chart{width:calc(100% - 160px)}:host([size="small"]) .container{padding:11px 15px;display:flex;align-items:center;justify-content:end;position:relative;background:var(--elevo-component-background);-webkit-backdrop-filter:var(--elevo-component-backdrop-filter);backdrop-filter:var(--elevo-component-backdrop-filter)}:host([size="small"]) .label-and-stat{position:absolute;left:15px}:host([size="small"]) .label{font-size:12px;color:#8c8c8c;line-height:17px;height:17px;margin-bottom:7px}:host([size="small"]) .stat{font-size:20px;color:#262626;line-height:24px}:host([size="small"]) .chart{width:calc(100% - 90px)}',""]);const o=r.toString()},21411:(e,t,n)=>{n.d(t,{A:()=>o});var i=n(36758),a=n.n(i),s=n(40935),r=n.n(s)()(a());r.push([e.id,":host{display:block}:host([hidden]){display:none}*{box-sizing:border-box}ul{list-style:none;margin:0;padding:0}.loading{display:flex;justify-content:center;padding:8px}.group + .group{margin-top:15px}.group-title{font-weight:500;font-size:12px;color:#000;padding:8px;height:36px;line-height:20px}.item{display:block}.item::part(link){display:flex;align-items:center;padding:0 8px;height:36px;border-radius:8px;color:#000}.item::part(link):hover{background:rgba(0,0,0,0.04)}.item-title{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.actions{cursor:auto}.item:not(:hover):not(.active) .actions{display:none}.working{width:8px;height:8px;border-radius:8px;background:#2540ff;margin:0 7px}.item:hover .working,\n.item.active .working{display:none}.load-more{display:flex;justify-content:center;align-items:center;height:36px}",""]);const o=r.toString()},26093:(e,t,n)=>{var i,a=n(74635),s=n(70918),r=n(26902),o=n(5536),l=n(86121),c=n(70829),d=n(62740),u=n(18769),h=n.n(u),m=n(7921),p=n(11280),g=n(23081),b=(n(65168),n(90079)),f=n(53373),v=n.n(f),A=n(99126),k=n(67566),x=n(8324),E=n(69445),w=n(2460),y=n(32464),N=n(58231),S=n(36494),T=n(97642),M=n(92773),C=n(59533),R=n(13153),_=n(34999),I=n(27954),Y=n(24388),W=n(56938),O=n(77971),z=n(39295),D=n(39194),U=n(16854),j=n(55805),P=n(85620),L=n(73349),V=n(62601),F=n(57097),H=n(83490);let B,$,q,G,K,X,Q,J,Z,ee,te,ne,ie,ae,se,re,oe,le,ce,de,ue,he,me,pe,ge,be;(0,b.initializeI18n)(w.NS,w.I);const{defineElement:fe,property:ve,event:Ae,method:ke}=(0,m.createDecorators)(),xe=(0,u.memo)(Pe),Ee=(0,u.forwardRef)(je);let we;var ye=new WeakMap,Ne=new WeakMap,Se=new WeakMap,Te=new WeakMap,Me=new WeakMap,Ce=new WeakSet,Re=new WeakMap,_e=new WeakMap,Ie=new WeakMap,Ye=new WeakMap,We=new WeakMap,Oe=new WeakMap,ze=new WeakMap,De=new WeakMap;class Ue extends p.ReactNextElement{constructor(){super(...arguments),(0,a.A)(this,Ce),(0,s.A)(this,ye,(B(this),q(this))),(0,s.A)(this,Ne,(G(this),K(this))),(0,s.A)(this,Se,(X(this),Q(this))),(0,s.A)(this,Te,(J(this),Z(this))),(0,s.A)(this,Me,(ee(this),te(this))),(0,s.A)(this,Re,(ae(this),()=>{(0,o.A)(Ce,this,ne).emit()})),(0,s.A)(this,_e,se(this)),(0,s.A)(this,Ie,(le(this),()=>{(0,o.A)(Ce,this,re).emit()})),(0,s.A)(this,Ye,ce(this)),(0,s.A)(this,We,(he(this),()=>{(0,o.A)(Ce,this,de).emit()})),(0,s.A)(this,Oe,me(this)),(0,s.A)(this,ze,(be(this),()=>{(0,o.A)(Ce,this,pe).emit()})),(0,s.A)(this,De,(0,u.createRef)())}get taskId(){return(0,c.A)(ye,this)}set taskId(e){(0,l.A)(ye,this,e)}get task(){return(0,c.A)(Ne,this)}set task(e){(0,l.A)(Ne,this,e)}get jobs(){return(0,c.A)(Se,this)}set jobs(e){(0,l.A)(Se,this,e)}get replay(){return(0,c.A)(Te,this)}set replay(e){(0,l.A)(Te,this,e)}resumed(){var e;null===(e=(0,c.A)(De,this).current)||void 0===e||e.resumed()}render(){return h().createElement(Ee,{taskId:this.taskId,jobs:this.jobs,task:this.task,replay:this.replay,onShare:(0,c.A)(Re,this),onPause:(0,c.A)(Ie,this),onResume:(0,c.A)(We,this),onCancel:(0,c.A)(ze,this),ref:(0,c.A)(De,this)})}}function je(e,t){var n;let{taskId:i,task:a,jobs:s,replay:r,onShare:o,onPause:l,onResume:c,onCancel:d}=e;const m=(0,u.useRef)(null),{task:p,jobs:b,plan:f,error:A,humanInputRef:w,resumedRef:I}=(0,M.S)(i,r),Y=i?p:a,W=i?b:s,O=i?f:null==a?void 0:a.plan,z=(0,C.B)(Y,W),D=null==z?void 0:z.nodes,B=null==z?void 0:z.edges,$=null==z?void 0:z.nav,q=null==z?void 0:z.views,G=null!==(n=null==Y?void 0:Y.title)&&void 0!==n?n:"",K=null==Y?void 0:Y.state,[X,Q]=(0,u.useState)(null),J=(0,u.useMemo)((()=>{if(X){const[e,t]=X.split(":");if("job"===e||"view"===e)return t}return null}),[X]);(0,u.useImperativeHandle)(t,(()=>({resumed:()=>{var e;return null===(e=I.current)||void 0===e?void 0:e.call(I)}})),[I]);const Z=(0,u.useRef)(!1);(0,u.useEffect)((()=>{const e=setTimeout((()=>{Z.current=!0}),3e3);return()=>{clearTimeout(e)}}),[]),(0,u.useEffect)((()=>{(0,g.getRuntime)().applyPageTitle(G)}),[G]),(0,u.useEffect)((()=>{A&&(0,g.handleHttpError)(A)}),[A]);const ee=(0,u.useCallback)(((e,t)=>{var n;null===(n=w.current)||void 0===n||n.call(w,e,t)}),[w]),[te,ne]=(0,u.useState)(null),ie=(0,u.useCallback)(((e,t)=>{ne((n=>{if(!t){if(!n)return null;const t=new Map(n);return t.delete(e)?t:n}return n?new Map(n).set(e,t):new Map([[e,t]])}))}),[]),{sizeReady:ae,nodes:se,edges:re}=(0,T.g)({rawNodes:D,rawEdges:B,state:K,sizeMap:te}),oe=(0,u.useRef)(!1),le=(0,u.useRef)(!1),[ce,de]=(0,u.useState)(!1),{grabbing:ue,transform:he,transformRef:me,zoomer:pe}=(0,N.f)({rootRef:m,zoomable:ae,scrollable:ae&&!ce,pannable:ae,manualScrolledUpRef:le}),ge=(0,u.useRef)(!1),be=(0,u.useMemo)((()=>{let e=null;const t=n=>{const i=me.current,a="function"==typeof n?n(i):n;if(!a)return;const{transform:s,translateBy:r}=a;let o=(0,k.A)(m.current);var l,c,d,u,h,p;Z.current&&0!==a.duration&&(ge.current=!0,o=o.transition().duration(null!==(l=a.duration)&&void 0!==l?l:300).ease((e=>e*(2-e))).on("end",(()=>{if(ge.current=!1,e){const n=e;e=null,t(n)}}))),s?pe.transform(o,new x.uV(null!==(c=s.k)&&void 0!==c?c:i.k,null!==(d=s.x)&&void 0!==d?d:i.x,null!==(u=s.y)&&void 0!==u?u:i.y)):pe.translateBy(o,null!==(h=r[0])&&void 0!==h?h:0,null!==(p=r[1])&&void 0!==p?p:0)};return n=>{ge.current?e=n:t(n)}}),[me,pe]),{centered:fe,setCentered:ve,reCenterRef:Ae}=(0,S.E)({nodes:se,sizeReady:ae,zoomer:pe,rootRef:m,pushZoomTransition:be}),ke=!U.QB.includes(null!=K?K:"working")&&2===se.length,Ee=(0,u.useMemo)((()=>new Set(re.map((e=>e.source)))),[re]),we=(0,u.useMemo)((()=>{if(!ae)return null;const e=[];for(const t of se)Ee.has(t.id)||e.push(t);return e.length>0?Math.max(...e.map((e=>e.view.y+e.view.height))):null}),[se,Ee,ae]),ye=(0,u.useRef)(null);(0,u.useEffect)((()=>{ye.current=we}),[we]),(0,u.useEffect)((()=>{const e=m.current;!e||null===we||oe.current&&le.current||be((t=>{const{offsetHeight:n}=e,i=we*t.k+t.y,a=n-U.xX-i;return a<0?{transform:{y:t.y+a},duration:a>-100?100:a<-500?300:200}:null}))}),[we,be]),(0,u.useEffect)((()=>{const e=ye.current,t=m.current;if(!t||null===e||ge.current)return;const{offsetHeight:n}=t,i=e*he.k+he.y,a=n-U.xX-i;oe.current=a<0}),[he,pe]);const Ne=(0,u.useCallback)((()=>{Ae.current=!0,ve(!1)}),[Ae,ve]),Se=(0,u.useCallback)((e=>{pe.scaleTo((0,k.A)(m.current),e)}),[pe]),Te=(0,u.useMemo)((()=>ae?(0,E.o)(se.map((e=>e.view))):null),[se,ae]);(0,u.useEffect)((()=>{if(!Te)return;const e=m.current;if(!e)return;const{offsetWidth:t,offsetHeight:n}=e,i=t/he.k,a=n/he.k,s=-(i-20-Te.x),r=i-20+(Te.x+Te.width),o=-(a-20-Te.y),l=a-20+(Te.y+Te.height);pe.translateExtent([[s,o],[r,l]])}),[pe,he.k,Te]);const Me=(0,u.useCallback)((e=>{let{nodeId:t,jobId:n,behavior:i,block:a}=e;const s=m.current,r=se.filter((e=>{var i;return!(t&&e.id!==t||n&&(null===(i=e.job)||void 0===i?void 0:i.id)!==n)}));if(!s||0===r.length)return;const o=(0,E.o)(r.map((e=>e.view))),{x:l,y:c}=(0,V.D)(o,[s.offsetWidth,s.offsetHeight],[U.RV,U.kq,U.xX,U.bL],me.current,a);(l||c)&&be({translateBy:[l,c],duration:"instant"===i?0:void 0})}),[se,be,me]),Ce=(0,u.useCallback)(((e,t)=>{const n=m.current;if(!n||!ae)return;let i,a=0,s=0,r=300;const o="left"===e||"right"===e;if("line"===t)i=40*("up"===e||"left"===e?1:-1),r=150;else if("page"===t)i=(n.offsetHeight-U.xX)*("up"===e?-1:1);else{const{y:t,height:a}=(0,E.o)(se.map((e=>e.view)));if("down"===e){const e=t+a-t+U.xX;i=n.offsetHeight-e-me.current.y}else i=t+U.RV-me.current.y}o?a=i:s=i,(a||s)&&be({translateBy:[a,s],duration:r})}),[se,be,ae,me]),[Re,_e]=(0,u.useState)(null),[Ie,Ye]=(0,u.useState)(null),We=(0,u.useMemo)((()=>({humanInput:ee,onShare:o,onPause:l,onResume:c,onCancel:d,onNodeResize:ie,activeToolCallJobId:Re,setActiveToolCallJobId:_e,setActiveNodeId:Q,hoverOnScrollableContent:ce,setHoverOnScrollableContent:de,activeExpandedViewJobId:Ie,setActiveExpandedViewJobId:Ye})),[Re,ce,Ie,ie,ee,o,l,c,d]),Oe=(0,u.useMemo)((()=>Re?null==W?void 0:W.find((e=>e.id===Re)):null),[Re,W]),ze=(0,u.useCallback)((e=>{for(const t of e.nativeEvent.composedPath()){if(t instanceof HTMLElement&&t.classList.contains(y.A.node))return;if(t===m.current)break}Q(null)}),[]);return(0,u.useEffect)((()=>{const e=m.current;if(!e||Oe||Ie)return;const t=t=>{if(document.activeElement&&document.activeElement!==document.body&&document.activeElement!==e)return;const n=(0,F.l)(t,{activeNodeId:X,nodes:se});if(!n)return;const{action:i,node:a}=n;if("scroll"===i)Ce(n.direction,n.range);else if("enter"===i){var s,r;if("job"!==a.type&&"view"!==a.type)return;const e="ask_human"===(null===(s=a.job.toolCall)||void 0===s?void 0:s.name),t="ask_human_confirming_plan"===(null===(r=a.job.toolCall)||void 0===r?void 0:r.name);if(e||t)return}t.preventDefault(),t.stopPropagation(),"enter"===i?"view"===a.type?Ye(a.job.id):_e(a.job.id):"switch-active-node"===i&&(Q(a.id),"job"===a.type||"view"===a.type?Me({jobId:a.job.id,behavior:"smooth"}):Me({nodeId:a.id,behavior:"smooth"}))};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}}),[X,Oe,Ie,se,Me,Ce]),h().createElement(P.Q.Provider,{value:We},h().createElement("div",{className:v()(y.A.root,{[y.A.loading]:!Y}),ref:m,style:{cursor:ue?"grabbing":"grab"},tabIndex:-1,onClick:ze},!Y&&h().createElement("div",{className:y.A["loading-icon"]},h().createElement(j.Bj,{lib:"antd",theme:"outlined",icon:"loading-3-quarters",spinning:!0})),h().createElement("div",{className:v()(y.A.canvas,{[y.A.ready]:ae&&fe}),style:{transform:`translate3d(${he.x}px, ${he.y}px, 0) scale(${he.k})`}},h().createElement("svg",{className:y.A.edges},re.map((e=>h().createElement("path",{className:y.A.edge,key:`${e.source}-${e.target}`,d:e.points.map(((e,t)=>{let{x:n,y:i}=e;return`${0===t?"M":"L"}${n},${i}`})).join(" ")})))),se.map((e=>{var t,n,i;return h().createElement(xe,{key:e.id,id:e.id,type:e.type,content:e.content,job:e.job,state:e.state,startTime:null==Y?void 0:Y.startTime,taskLoading:ke,instructionLoading:"instruction"===e.type&&!Ee.has(e.id)&&!U.QB.includes(null!==(t=e.state)&&void 0!==t?t:"working")&&!U.X4.includes(null!=K?K:"working"),edges:re,x:null===(n=e.view)||void 0===n?void 0:n.x,y:null===(i=e.view)||void 0===i?void 0:i.y,active:X===e.id})})))),h().createElement("div",{className:y.A.widgets},h().createElement("div",{className:y.A["nav-container"]},h().createElement("ul",{className:y.A.nav},null==$?void 0:$.map((e=>h().createElement("li",{key:e.id,className:v()(y.A["nav-item"],{[y.A.active]:J===e.id})},h().createElement("a",{className:y.A["nav-link"],onClick:()=>{Q(`job:${e.id}`),Me({jobId:e.id,block:"start"})}},h().createElement("span",{className:y.A["nav-link-text"]},e.title))))))),h().createElement(R.r,{plan:O,state:K}),h().createElement(_.l,{scale:he.k,onScaleChange:Se,onReCenter:Ne})),Oe&&h().createElement(L.M,{job:Oe}),Ie&&h().createElement(H.f,{views:q}))}function Pe(e){let{id:t,type:n,state:i,job:a,content:s,startTime:r,taskLoading:o,instructionLoading:l,x:c,y:d,active:m}=e;const p=(0,u.useRef)(null),{onNodeResize:g,setActiveNodeId:b}=(0,u.useContext)(P.Q);(0,u.useEffect)((()=>{const e=p.current;if(!e)return;const n=new A.A((()=>{g(t,[e.offsetWidth,e.offsetHeight])}));return n.observe(e),()=>{n.disconnect(),g(t,null)}}),[t,g]),(0,u.useEffect)((()=>{const e=p.current;if(!e)return;const t=e=>{e.stopPropagation()};return e.addEventListener("mousedown",t),()=>{e.removeEventListener("mousedown",t)}}),[]);const f=(0,u.useCallback)((()=>{"start"!==n&&"instruction"!==n&&b(t)}),[t,b,n]);return h().createElement("div",{className:v()(y.A.node,{[y.A.ready]:null!=c&&null!=d}),ref:p,style:{left:c,top:d},onClick:f},"start"===n?h().createElement(I.H,null):"end"===n?h().createElement(z.s,{active:m}):"requirement"===n?h().createElement(Y.O,{content:s,startTime:r,loading:o,active:m}):"instruction"===n?h().createElement(W.L,{content:a.instruction,loading:l}):"view"===n?h().createElement(D.Y,{job:a,active:m}):h().createElement(O.W,{state:i,job:a,active:m}))}i=Ue,({e:[q,G,K,X,Q,J,Z,ee,te,ne,ie,ae,se,re,oe,le,ce,de,ue,he,me,pe,ge,be,B],c:[we,$]}=(0,d.A)(i,[fe("ai-portal.cruise-canvas",{shadowOptions:!1})],[[ve(),1,"taskId"],[ve({attribute:!1}),1,"task"],[ve({attribute:!1}),1,"jobs"],[ve({type:Number}),1,"replay"],[Ae({type:"share"}),1,"shareEvent",e=>(0,c.A)(Me,e),(e,t)=>(0,l.A)(Me,e,t)],[Ae({type:"pause"}),1,"pauseEvent",e=>(0,c.A)(_e,e),(e,t)=>(0,l.A)(_e,e,t)],[Ae({type:"resume"}),1,"resumeEvent",e=>(0,c.A)(Ye,e),(e,t)=>(0,l.A)(Ye,e,t)],[Ae({type:"cancel"}),1,"cancelEvent",e=>(0,c.A)(Oe,e),(e,t)=>(0,l.A)(Oe,e,t)],[ke(),2,"resumed"]],0,(e=>De.has((0,r.A)(e))),p.ReactNextElement)),$();var Le=n(71451),Ve=n(41030);let Fe=function(e){return e.ASK_ANY_THING="ASK_ANYTHING",e.COMMON_TASKS="COMMON_TASKS",e}({});const He="bricks/ai-portal/chat-box",Be={en:{[Fe.ASK_ANY_THING]:"Ask anything",[Fe.COMMON_TASKS]:"Common tasks"},zh:{[Fe.ASK_ANY_THING]:"询问任何问题",[Fe.COMMON_TASKS]:"常用任务"}},$e=b.i18n.getFixedT(null,He),qe=n.p+"images/af389fa6.svg";var Ge,Ke=n(47008);let Xe,Qe,Je,Ze,et,tt,nt,it,at,st,rt,ot,lt,ct,dt;(0,b.initializeI18n)(He,Be);const ut=(0,p.wrapBrick)("eo-icon"),{defineElement:ht,property:mt,event:pt}=(0,m.createDecorators)();let gt;var bt=new WeakMap,ft=new WeakMap,vt=new WeakMap,At=new WeakMap,kt=new WeakMap,xt=new WeakMap,Et=new WeakSet,wt=new WeakMap;class yt extends p.ReactNextElement{constructor(){super(...arguments),(0,a.A)(this,Et),(0,s.A)(this,bt,Qe(this)),(0,s.A)(this,ft,(Je(this),Ze(this))),(0,s.A)(this,vt,(et(this),tt(this))),(0,s.A)(this,At,(nt(this),it(this))),(0,s.A)(this,kt,(at(this),st(this))),(0,s.A)(this,xt,(rt(this),ot(this))),(0,s.A)(this,wt,(dt(this),e=>{(0,o.A)(Et,this,lt).emit(e)}))}get disabled(){return(0,c.A)(bt,this)}set disabled(e){(0,l.A)(bt,this,e)}get placeholder(){return(0,c.A)(ft,this)}set placeholder(e){(0,l.A)(ft,this,e)}get autoFocus(){return(0,c.A)(vt,this)}set autoFocus(e){(0,l.A)(vt,this,e)}get suggestions(){return(0,c.A)(At,this)}set suggestions(e){(0,l.A)(At,this,e)}get suggestionsLabel(){return(0,c.A)(kt,this)}set suggestionsLabel(e){(0,l.A)(kt,this,e)}render(){return h().createElement(Nt,{disabled:this.disabled,placeholder:this.placeholder,autoFocus:this.autoFocus,suggestions:this.suggestions,suggestionsLabel:this.suggestionsLabel,onSubmit:(0,c.A)(wt,this)})}}function Nt(e){let{disabled:t,placeholder:n,autoFocus:i,suggestions:a,suggestionsLabel:s,onSubmit:r}=e;const o=(0,u.useRef)(null),l=(0,u.useRef)(null),[c,d]=(0,u.useState)(""),m=(0,u.useRef)(""),p=(0,u.useCallback)((e=>{e.currentTarget.value&&(null==r||r(e.currentTarget.value))}),[r]),g=(0,u.useCallback)((e=>{m.current=e.target.value,d(e.target.value)}),[]),b=(0,u.useCallback)((()=>{null==r||r(m.current)}),[r]);(0,u.useEffect)((()=>{i&&Promise.resolve().then((()=>{var e;null===(e=l.current)||void 0===e||e.focus()}))}),[]);const f=(0,u.useMemo)((()=>null!=a&&a.length?(0,Ve.chunk)(a,Math.max(2,Math.ceil(a.length/2))):[]),[a]),v=(0,u.useCallback)((e=>{m.current=e.content,d(e.content),setTimeout((()=>{var e;null===(e=l.current)||void 0===e||e.focus()}))}),[]);return h().createElement("div",{className:"root"},h().createElement("div",{className:"container",ref:o},h().createElement(Le.e,{containerRef:o,ref:l,value:c,minRows:3,paddingSize:62,autoResize:!0,disabled:t,placeholder:null!=n?n:$e(Fe.ASK_ANY_THING),submitWhen:"enter-without-shift",onSubmit:p,onChange:g}),h().createElement("button",{className:"btn-send",disabled:!c,onClick:b},h().createElement(ut,{lib:"fa",prefix:"fas",icon:"arrow-up"}))),!(null==f||!f.length)&&h().createElement("div",{className:"suggestions"},h().createElement("div",{className:"heading"},h().createElement("img",{className:"icon",src:qe,width:16,height:16}),h().createElement("span",null,null!=s?s:$e(Fe.COMMON_TASKS))),f.map(((e,t)=>h().createElement(St,{key:t,suggestions:e,pixelPerSecond:10*(t+2),onSelect:v})))))}function St(e){let{suggestions:t,pixelPerSecond:n,onSelect:i}=e;const a=(0,u.useRef)(null),s=(0,u.useRef)(null),[r,o]=(0,u.useState)(0);return(0,u.useEffect)((()=>{const e=a.current,t=s.current;if(!e||!t)return;let i,r,l,c,d=0;const u=(t.offsetWidth-7)/2+7;function h(e){r=e,void 0===l&&(l=e),void 0!==i&&(d+=e-i,i=void 0),o((e-l-d)/1e3*n%u),c=requestAnimationFrame(h)}c=requestAnimationFrame(h);const m=()=>{cancelAnimationFrame(c),i=r},p=()=>{c=requestAnimationFrame(h)};return e.addEventListener("mouseenter",m),e.addEventListener("mouseleave",p),()=>{cancelAnimationFrame(c),e.removeEventListener("mouseenter",m),e.removeEventListener("mouseleave",p)}}),[t,n]),h().createElement("div",{className:"carousel",ref:a},h().createElement("ul",{className:"list",ref:s,style:{transform:`translateX(${-r}px)`}},[...t,...t].map(((e,t)=>h().createElement("li",{key:t},h().createElement("div",{className:"item",onClick:()=>i(e),title:e.content},h().createElement("div",{className:"title"},e.title),h().createElement("div",{className:"content"},e.content)))))))}Ge=yt,({e:[Qe,Je,Ze,et,tt,nt,it,at,st,rt,ot,lt,ct,dt],c:[gt,Xe]}=(0,d.A)(Ge,[ht("ai-portal.chat-box",{styleTexts:[Ke.A]})],[[mt({type:Boolean}),1,"disabled"],[mt(),1,"placeholder"],[mt({type:Boolean}),1,"autoFocus"],[mt({attribute:!1}),1,"suggestions"],[mt(),1,"suggestionsLabel"],[pt({type:"message.submit"}),1,"messageSubmit",e=>(0,c.A)(xt,e),(e,t)=>(0,l.A)(xt,e,t)]],0,(e=>wt.has((0,r.A)(e))),p.ReactNextElement)),Xe();var Tt,Mt=n(82165);let Ct;const{defineElement:Rt}=(0,m.createDecorators)();let _t;class It extends p.ReactNextElement{render(){return h().createElement(Yt,null)}}function Yt(){return h().createElement("slot",null)}Tt=It,[_t,Ct]=(0,d.A)(Tt,[Rt("ai-portal.home-container",{styleTexts:[Mt.A]})],[],0,void 0,p.ReactNextElement).c,Ct();var Wt=n(21302),Ot=n.n(Wt);let zt=function(e){return e.TODAY="TODAY",e.YESTERDAY="YESTERDAY",e.PREVIOUS_7_DAYS="PREVIOUS_7_DAYS",e.PREVIOUS_30_DAYS="PREVIOUS_30_DAYS",e}({});const Dt="bricks/ai-portal/chat-history",Ut={en:{[zt.TODAY]:"Today",[zt.YESTERDAY]:"Yesterday",[zt.PREVIOUS_7_DAYS]:"Previous 7 days",[zt.PREVIOUS_30_DAYS]:"Previous 30 days"},zh:{[zt.TODAY]:"今天",[zt.YESTERDAY]:"昨天",[zt.PREVIOUS_7_DAYS]:"过去7天",[zt.PREVIOUS_30_DAYS]:"过去30天"}},jt=b.i18n.getFixedT(null,Dt);var Pt,Lt=n(21411);let Vt,Ft,Ht,Bt,$t,qt,Gt,Kt,Xt,Qt,Jt,Zt,en,tn,nn;(0,b.initializeI18n)(Dt,Ut);const an=(0,p.wrapBrick)("eo-icon"),sn=(0,p.wrapBrick)("eo-link"),rn=(0,p.wrapBrick)("eo-mini-actions",{onActionClick:"action.click",onVisibleChange:"visible.change"}),{defineElement:on,property:ln,event:cn}=(0,m.createDecorators)();let dn;var un=new WeakMap,hn=new WeakMap,mn=new WeakMap,pn=new WeakMap,gn=new WeakSet,bn=new WeakMap,fn=new WeakMap,vn=new WeakMap;class An extends p.ReactNextElement{constructor(){super(...arguments),(0,a.A)(this,gn),(0,s.A)(this,un,Ft(this)),(0,s.A)(this,hn,(Ht(this),Bt(this))),(0,s.A)(this,mn,($t(this),qt(this))),(0,s.A)(this,pn,(Gt(this),Kt(this))),(0,s.A)(this,bn,(Jt(this),e=>{(0,o.A)(gn,this,Xt).emit(e)})),(0,s.A)(this,fn,Zt(this)),(0,s.A)(this,vn,(nn(this),e=>{(0,o.A)(gn,this,en).emit({nextToken:e})}))}get list(){return(0,c.A)(un,this)}set list(e){(0,l.A)(un,this,e)}get actions(){return(0,c.A)(hn,this)}set actions(e){(0,l.A)(hn,this,e)}get nextToken(){return(0,c.A)(mn,this)}set nextToken(e){(0,l.A)(mn,this,e)}render(){return h().createElement(kn,{root:this,list:this.list,actions:this.actions,nextToken:this.nextToken,onActionClick:(0,c.A)(bn,this),onLoadMore:(0,c.A)(vn,this)})}}function kn(e){let{root:t,list:n,actions:i,nextToken:a,onActionClick:s,onLoadMore:r}=e;const o=(0,u.useMemo)((()=>{const e=new Map,t=Ot()(),i=t.startOf("day"),a=i.clone().subtract(1,"day"),s=i.clone().subtract(7,"days"),r=i.clone().subtract(30,"days"),o=+i/1e3,l=+a/1e3,c=+s/1e3,d=+r/1e3,u=+t.startOf("year")/1e3;for(const t of null!=n?n:[]){let n;n=t.startTime>=o?jt(zt.TODAY):t.startTime>=l?jt(zt.YESTERDAY):t.startTime>=c?jt(zt.PREVIOUS_7_DAYS):t.startTime>=d?jt(zt.PREVIOUS_30_DAYS):t.startTime>=u?Ot()(1e3*t.startTime).format("MMMM"):Ot()(1e3*t.startTime).format("YYYY");let i=e.get(n);i||e.set(n,i={title:n,items:[]}),i.items.push(t)}return[...e.values()]}),[n]),[l,c]=(0,u.useState)(null),d=(0,u.useRef)(null);return(0,u.useEffect)((()=>{const e=d.current;if(!e||!a)return;const n=new IntersectionObserver((e=>{for(const t of e)t.isIntersecting&&r(a)}),{root:t});return n.observe(e),()=>{n.disconnect()}}),[a,r,t]),n?h().createElement(h().Fragment,null,h().createElement("ul",null,o.map((e=>h().createElement("li",{key:e.title,className:"group"},h().createElement("div",{className:"group-title"},e.title),h().createElement("ul",{className:"items"},e.items.map((e=>h().createElement("li",{key:e.id},h().createElement(sn,{className:v()("item",{active:l===e.id}),url:e.url},h().createElement("div",{className:"item-title",title:e.title},e.title),h().createElement(rn,{className:"actions",actions:i,onActionClick:t=>{s({action:t.detail,item:e})},onVisibleChange:t=>{c(t.detail?e.id:null)}}),!U.QB.includes(e.state)&&h().createElement("div",{className:"working"})))))))))),a&&h().createElement("div",{className:"load-more",ref:d},h().createElement(an,{lib:"antd",icon:"loading-3-quarters",spinning:!0}))):h().createElement("div",{className:"loading"},h().createElement(an,{lib:"antd",theme:"outlined",icon:"loading-3-quarters",spinning:!0}))}Pt=An,({e:[Ft,Ht,Bt,$t,qt,Gt,Kt,Xt,Qt,Jt,Zt,en,tn,nn],c:[dn,Vt]}=(0,d.A)(Pt,[on("ai-portal.chat-history",{styleTexts:[Lt.A]})],[[ln({attribute:!1}),1,"list"],[ln({attribute:!1}),1,"actions"],[ln(),1,"nextToken"],[cn({type:"action.click"}),1,"actionClick",e=>(0,c.A)(pn,e),(e,t)=>(0,l.A)(pn,e,t)],[cn({type:"load.more"}),1,"loadMore",e=>(0,c.A)(fn,e),(e,t)=>(0,l.A)(fn,e,t)]],0,(e=>vn.has((0,r.A)(e))),p.ReactNextElement)),Vt();var xn,En=n(89575),wn=n(24);let yn,Nn,Sn,Tn,Mn,Cn,Rn,_n,In,Yn,Wn,On,zn,Dn,Un,jn,Pn,Ln,Vn,Fn,Hn;const Bn=(0,p.wrapBrick)("eo-mini-line-chart"),{defineElement:$n,property:qn}=(0,m.createDecorators)();let Gn;var Kn=new WeakMap,Xn=new WeakMap,Qn=new WeakMap,Jn=new WeakMap,Zn=new WeakMap,ei=new WeakMap,ti=new WeakMap,ni=new WeakMap,ii=new WeakMap,ai=new WeakMap;class si extends p.ReactNextElement{constructor(){super(...arguments),(0,s.A)(this,Kn,Nn(this)),(0,s.A)(this,Xn,(Sn(this),Tn(this))),(0,s.A)(this,Qn,(Mn(this),Cn(this))),(0,s.A)(this,Jn,(Rn(this),_n(this))),(0,s.A)(this,Zn,(In(this),Yn(this))),(0,s.A)(this,ei,(Wn(this),On(this))),(0,s.A)(this,ti,(zn(this),Dn(this))),(0,s.A)(this,ni,(Un(this),jn(this))),(0,s.A)(this,ii,(Pn(this),Ln(this))),(0,s.A)(this,ai,(Vn(this),Fn(this))),Hn(this)}get label(){return(0,c.A)(Kn,this)}set label(e){(0,l.A)(Kn,this,e)}get value(){return(0,c.A)(Xn,this)}set value(e){(0,l.A)(Xn,this,e)}get size(){return(0,c.A)(Qn,this)}set size(e){(0,l.A)(Qn,this,e)}get lineColor(){return(0,c.A)(Jn,this)}set lineColor(e){(0,l.A)(Jn,this,e)}get showArea(){return(0,c.A)(Zn,this)}set showArea(e){(0,l.A)(Zn,this,e)}get min(){return(0,c.A)(ei,this)}set min(e){(0,l.A)(ei,this,e)}get max(){return(0,c.A)(ti,this)}set max(e){(0,l.A)(ti,this,e)}get xField(){return(0,c.A)(ni,this)}set xField(e){(0,l.A)(ni,this,e)}get yField(){return(0,c.A)(ii,this)}set yField(e){(0,l.A)(ii,this,e)}get data(){return(0,c.A)(ai,this)}set data(e){(0,l.A)(ai,this,e)}render(){return h().createElement(ri,{label:this.label,value:this.value,size:this.size,lineColor:this.lineColor,showArea:this.showArea,min:this.min,max:this.max,xField:this.xField,yField:this.yField,data:this.data})}}function ri(e){let{label:t,value:n,size:i,...a}=e;return"small"===i?h().createElement("div",{className:"container"},h().createElement("div",{className:"label-and-stat"},h().createElement("div",{className:"label"},t),h().createElement("div",{className:"stat"},n)),h().createElement("div",{className:"chart"},h().createElement(Bn,(0,En.A)({},a,{lineWidth:1.5,width:"auto",height:"55"})))):h().createElement("div",{className:"container"},h().createElement("div",{className:"label"},t),h().createElement("div",{className:"stat-and-chart"},h().createElement("div",{className:"chart"},h().createElement(Bn,(0,En.A)({},a,{lineWidth:2,width:"auto",height:"92"}))),h().createElement("div",{className:"stat"},n)))}xn=si,({e:[Nn,Sn,Tn,Mn,Cn,Rn,_n,In,Yn,Wn,On,zn,Dn,Un,jn,Pn,Ln,Vn,Fn,Hn],c:[Gn,yn]}=(0,d.A)(xn,[$n("ai-portal.stat-with-mini-chart",{styleTexts:[wn.A]})],[[qn(),1,"label"],[qn(),1,"value"],[qn(),1,"size"],[qn(),1,"lineColor"],[qn({type:Boolean}),1,"showArea"],[qn({type:Number}),1,"min"],[qn({type:Number}),1,"max"],[qn(),1,"xField"],[qn(),1,"yField"],[qn({attribute:!1}),1,"data"]],0,void 0,p.ReactNextElement)),yn();const oi=n.p+"images/7385e5f5.png";var li,ci=n(31653);let di;const{defineElement:ui}=(0,m.createDecorators)();let hi;class mi extends p.ReactNextElement{render(){return h().createElement(pi,null)}}function pi(){return h().createElement("img",{src:oi,alt:"Elevo",width:95,height:26})}li=mi,[hi,di]=(0,d.A)(li,[ui("ai-portal.elevo-logo",{styleTexts:[ci.A]})],[],0,void 0,p.ReactNextElement).c,di();let gi=function(e){return e.NEW_CHAT="NEW_CHAT",e.LOGOUT="LOGOUT",e.TODAY="TODAY",e.YESTERDAY="YESTERDAY",e.PREVIOUS_7_DAYS="PREVIOUS_7_DAYS",e.PREVIOUS_30_DAYS="PREVIOUS_30_DAYS",e}({});const bi="bricks/ai-portal/elevo-sidebar",fi={en:{[gi.NEW_CHAT]:"New chat",[gi.LOGOUT]:"Logout",[gi.TODAY]:"Today",[gi.YESTERDAY]:"Yesterday",[gi.PREVIOUS_7_DAYS]:"Previous 7 days",[gi.PREVIOUS_30_DAYS]:"Previous 30 days"},zh:{[gi.NEW_CHAT]:"新对话",[gi.LOGOUT]:"登出",[gi.TODAY]:"今天",[gi.YESTERDAY]:"昨天",[gi.PREVIOUS_7_DAYS]:"过去7天",[gi.PREVIOUS_30_DAYS]:"过去30天"}},vi=b.i18n.getFixedT(null,bi);var Ai=n(61408);const ki=(0,p.wrapBrick)("eo-icon"),xi=(0,p.wrapBrick)("eo-link"),Ei=(0,p.wrapBrick)("eo-dropdown-actions",{onActionClick:"action.click",onVisibleChange:"visible.change"}),wi=(0,p.wrapBrick)("eo-easyops-avatar"),yi=(0,p.wrapBrick)("eo-mini-actions",{onActionClick:"action.click",onVisibleChange:"visible.change"});var Ni=n(57372);const Si=async(e,t)=>(await Ni.http.post("api/gateway/logic.llm.aiops_service/api/v1/llm/agent/flow/search",e,t)).data;function Ti(e){let{actions:t=[],urlTemplate:n,onActionClick:i,onHistoryClick:a}=e;const s=(0,u.useRef)(null),[r,o]=(0,u.useState)(null),[l,c]=(0,u.useState)(),[d,m]=(0,u.useState)();(0,u.useEffect)((()=>{Promise.all([Si({next_token:d}),new Promise((e=>setTimeout(e,500)))]).then((e=>{let[t]=e;o((e=>[...null!=e?e:[],...t.data])),c(t.next_token)})).catch((e=>{console.error("Error loading chat history:",e)}))}),[d]);const p=(0,u.useMemo)((()=>{const e=new Map,t=Ot()(),n=t.startOf("day"),i=n.clone().subtract(1,"day"),a=n.clone().subtract(7,"days"),s=n.clone().subtract(30,"days"),o=+n/1e3,l=+i/1e3,c=+a/1e3,d=+s/1e3,u=+t.startOf("year")/1e3;for(const t of null!=r?r:[]){let n;n=t.startTime>=o?vi(gi.TODAY):t.startTime>=l?vi(gi.YESTERDAY):t.startTime>=c?vi(gi.PREVIOUS_7_DAYS):t.startTime>=d?vi(gi.PREVIOUS_30_DAYS):t.startTime>=u?Ot()(1e3*t.startTime).format("MMMM"):Ot()(1e3*t.startTime).format("YYYY");let i=e.get(n);i||e.set(n,i={title:n,items:[]}),i.items.push(t)}return[...e.values()]}),[r]),[g,b]=(0,u.useState)(null),f=(0,u.useRef)(null);return(0,u.useEffect)((()=>{const e=f.current,t=s.current;if(!e||!l||!t)return;const n=new IntersectionObserver((e=>{for(const t of e)t.isIntersecting&&m(l)}),{root:t});return n.observe(e),()=>{n.disconnect()}}),[l]),r?h().createElement("div",{className:"history",ref:s},h().createElement("ul",null,p.map((e=>h().createElement("li",{key:e.title,className:"group"},h().createElement("div",{className:"group-title"},e.title),h().createElement("ul",{className:"items"},e.items.map((e=>{return h().createElement("li",{key:e.id},h().createElement(xi,(0,En.A)({className:v()("item",{active:g===e.id}),onClick:a},n?{url:(s=n,r=e,null==s?void 0:s.replace(/{{(.*?)}}/g,((e,t)=>(0,Ve.get)(r,t))))}:null),h().createElement("div",{className:"item-title",title:e.title},e.title),h().createElement(yi,{className:"actions",actions:t,onActionClick:t=>{i({action:t.detail,item:e})},onVisibleChange:t=>{b(t.detail?e.id:null)}}),!U.QB.includes(e.state)&&h().createElement("div",{className:"working"})));var s,r}))))))),l&&h().createElement("div",{className:"load-more",ref:f},h().createElement(ki,{lib:"antd",icon:"loading-3-quarters",spinning:!0}))):h().createElement("div",{className:"history"},h().createElement("div",{className:"loading"},h().createElement(ki,{lib:"antd",theme:"outlined",icon:"loading-3-quarters",spinning:!0})))}var Mi;let Ci,Ri,_i,Ii,Yi,Wi,Oi,zi,Di,Ui,ji,Pi,Li,Vi,Fi,Hi,Bi,$i,qi,Gi,Ki;(0,b.initializeI18n)(bi,fi);const Xi=[{icon:{lib:"fa",prefix:"fas",icon:"arrow-right-from-bracket"},text:vi(gi.LOGOUT)}],{defineElement:Qi,property:Ji,event:Zi}=(0,m.createDecorators)();let ea;var ta=new WeakMap,na=new WeakMap,ia=new WeakMap,aa=new WeakMap,sa=new WeakMap,ra=new WeakMap,oa=new WeakMap,la=new WeakSet,ca=new WeakMap,da=new WeakMap,ua=new WeakMap;class ha extends p.ReactNextElement{constructor(){super(...arguments),(0,a.A)(this,la),(0,s.A)(this,ta,Ri(this)),(0,s.A)(this,na,(_i(this),Ii(this))),(0,s.A)(this,ia,(Yi(this),Wi(this))),(0,s.A)(this,aa,(Oi(this),zi(this))),(0,s.A)(this,sa,(Di(this),Ui(this))),(0,s.A)(this,ra,(ji(this),Pi(this))),(0,s.A)(this,oa,(Li(this),Vi(this))),(0,s.A)(this,ca,(Bi(this),()=>{(0,o.A)(la,this,Fi).emit()})),(0,s.A)(this,da,$i(this)),(0,s.A)(this,ua,(Ki(this),e=>{(0,o.A)(la,this,qi).emit(e)}))}get userInstanceId(){return(0,c.A)(ta,this)}set userInstanceId(e){(0,l.A)(ta,this,e)}get behavior(){return(0,c.A)(na,this)}set behavior(e){(0,l.A)(na,this,e)}get logoUrl(){return(0,c.A)(ia,this)}set logoUrl(e){(0,l.A)(ia,this,e)}get newChatUrl(){return(0,c.A)(aa,this)}set newChatUrl(e){(0,l.A)(aa,this,e)}get historyUrlTemplate(){return(0,c.A)(sa,this)}set historyUrlTemplate(e){(0,l.A)(sa,this,e)}get historyActions(){return(0,c.A)(ra,this)}set historyActions(e){(0,l.A)(ra,this,e)}render(){return h().createElement(ma,{userInstanceId:this.userInstanceId,behavior:this.behavior,logoUrl:this.logoUrl,newChatUrl:this.newChatUrl,historyUrlTemplate:this.historyUrlTemplate,historyActions:this.historyActions,onLogout:(0,c.A)(ca,this),onActionClick:(0,c.A)(ua,this)})}}function ma(e){let{userInstanceId:t,behavior:n,logoUrl:i,newChatUrl:a,historyUrlTemplate:s,historyActions:r,onLogout:o,onActionClick:l}=e;const[c,d]=(0,u.useState)("drawer"===n),m=(0,u.useCallback)((()=>{d(!0)}),[]),p=(0,u.useCallback)((()=>{d(!1)}),[]);(0,u.useEffect)((()=>{"drawer"===n&&d(!0)}),[n]);const g=(0,u.useCallback)((()=>{d(!0)}),[]),b=(0,u.useCallback)((()=>{"drawer"===n&&d(!0)}),[n]);return h().createElement("div",{className:v()("container",{collapsed:c})},"drawer"===n&&!c&&h().createElement("div",{className:"mask",onClick:g}),h().createElement("div",{className:"sidebar"},h().createElement("div",{className:"logo-bar"},h().createElement(xi,{url:i,className:"logo-link"},h().createElement("img",{className:"logo",alt:"Elevo",src:oi,width:95,height:26})),h().createElement("button",{className:"toggle",onClick:m},h().createElement(ki,{lib:"easyops",icon:"sidebar"}))),h().createElement(xi,{className:"new-chat",url:a},h().createElement(ki,{className:"new-chat-icon",lib:"easyops",icon:"new-chat"}),vi(gi.NEW_CHAT)),h().createElement(Ti,{urlTemplate:s,actions:r,onActionClick:l,onHistoryClick:b}),h().createElement("div",{className:"footer"},h().createElement(Ei,{className:"dropdown",actions:Xi,onActionClick:o},h().createElement("button",{className:"account"},h().createElement(wi,{nameOrInstanceId:t,showName:!0,size:"xs"}))))),h().createElement("div",{className:"alternative"},h().createElement("button",{className:"toggle",onClick:p},h().createElement(ki,{lib:"easyops",icon:"sidebar"})),h().createElement(xi,{className:"new-chat",url:a},h().createElement(ki,{className:"new-chat-icon",lib:"easyops",icon:"new-chat"}),vi(gi.NEW_CHAT))))}Mi=ha,({e:[Ri,_i,Ii,Yi,Wi,Oi,zi,Di,Ui,ji,Pi,Li,Vi,Fi,Hi,Bi,$i,qi,Gi,Ki],c:[ea,Ci]}=(0,d.A)(Mi,[Qi("ai-portal.elevo-sidebar",{styleTexts:[Ai.A]})],[[Ji(),1,"userInstanceId"],[Ji(),1,"behavior"],[Ji(),1,"logoUrl"],[Ji(),1,"newChatUrl"],[Ji(),1,"historyUrlTemplate"],[Ji({attribute:!1}),1,"historyActions"],[Zi({type:"logout"}),1,"logout",e=>(0,c.A)(oa,e),(e,t)=>(0,l.A)(oa,e,t)],[Zi({type:"action.click"}),1,"actionClick",e=>(0,c.A)(da,e),(e,t)=>(0,l.A)(da,e,t)]],0,(e=>ua.has((0,r.A)(e))),p.ReactNextElement)),Ci()},31653:(e,t,n)=>{n.d(t,{A:()=>o});var i=n(36758),a=n.n(i),s=n(40935),r=n.n(s)()(a());r.push([e.id,":host{display:inline-block;padding:3px 0}:host([hidden]){display:none}img{display:block}",""]);const o=r.toString()},32360:(e,t,n)=>{e.exports=n.p+"images/6336f999.png"},47008:(e,t,n)=>{n.d(t,{A:()=>h});var i=n(36758),a=n.n(i),s=n(40935),r=n.n(s),o=n(20062),l=n.n(o),c=new URL(n(91107),n.b),d=r()(a()),u=l()(c);d.push([e.id,`:host{display:block}:host([hidden]){display:none}*{box-sizing:border-box}.root{color:#262626;background-color:#e1e3ec;background-image:url(${u});background-size:694px 144px;background-position:top left;background-repeat:no-repeat;box-shadow:inset 0px 2px 5px 1px rgba(42,46,59,0.1);border-radius:20px;padding:12px}.container{position:relative}textarea{display:block;width:100%;padding:10px 16px 52px;color:var(--antd-input-color);background:rgba(255,255,255,0.8);border-radius:14px;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border:1px solid rgba(255,255,255,0.5);font-size:14px;line-height:22px;height:130px}textarea::placeholder{color:rgba(0,0,0,0.4)}.btn-send:focus,\ntextarea:focus{outline:none}.btn-send{position:absolute;bottom:14px;right:14px;width:28px;height:28px;display:flex;align-items:center;justify-content:center;background:#2540ff;border:none;border-radius:8px;color:#fff}.btn-send[disabled]{background:rgba(0,0,0,0.15)}.btn-send:not([disabled]){cursor:pointer}.btn-send:not([disabled]):hover{background:#5166ff}.btn-send:not([disabled]):active{background:#1e33cc}.suggestions{margin-top:19px}.heading{display:flex;align-items:center;padding:0 5px;margin-bottom:8px}.icon{margin-right:5px}.carousel{overflow:hidden}.carousel + .carousel{margin-top:7px}.list{display:flex;width:max-content;list-style:none;margin:0;padding:0;font-size:12px}.item{background:rgba(255,255,255,0.4);border-radius:12px;border:1px solid #dcdee6;padding:12px;max-width:330px;cursor:pointer}.item:hover{background:rgba(255,255,255,0.5);border:1px solid rgba(37,64,255,0.3)}.list > li + li{margin-left:7px}.title{margin-bottom:4px}.content{color:rgba(0,0,0,0.45);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tooltip{display:block}`,""]);const h=d.toString()},61408:(e,t,n)=>{n.d(t,{A:()=>o});var i=n(36758),a=n.n(i),s=n(40935),r=n.n(s)()(a());r.push([e.id,':host{display:block}:host([hidden]){display:none}*{box-sizing:border-box}.sidebar{position:relative;width:261px;height:100%;background:#f6f7f9;border-right:1px solid #e3e5eb;padding:26px 16px 0;display:flex;flex-direction:column;transition:transform 0.3s ease-in-out}.logo-bar{display:flex;align-items:center;justify-content:space-between;margin-bottom:30px}.logo-link::part(link){display:block}.logo{vertical-align:middle}.toggle{color:#595959;font-size:18px;width:28px;height:28px;display:flex;align-items:center;justify-content:space-between;background:none;border:none;cursor:pointer;border-radius:8px}.toggle:hover{background:rgba(0,0,0,0.04)}.new-chat::part(link){display:flex;align-items:center;color:var(--elevo-color-brand);font-size:14px;text-align:left;cursor:pointer}.sidebar .new-chat::part(link){background:#f0f4ff;border-radius:8px;border:1px solid #c9d7ff;padding:9px 13px;font-weight:500;margin-bottom:23px}.sidebar .new-chat::part(link):hover{background:rgba(201,215,255,0.5)}.new-chat-icon{font-size:16px;margin-right:5px}.footer{border-top:1px solid rgba(0,0,0,0.04);padding:9px 12px;margin:0 -16px}.dropdown{display:block}.account{background:none;border:none;border-radius:8px;padding:6px 10px;display:block;width:100%;text-align:left;cursor:pointer}.account:hover{background:rgba(0,0,0,0.04)}.alternative{position:fixed;top:14px;left:16px;display:flex;align-items:center;opacity:0;z-index:1;transition:opacity 0.2s ease-in-out}.alternative .new-chat::part(link){padding:4px;margin-left:16px;font-size:12px}.alternative .new-chat::part(link):hover{color:#7891ff}.alternative .new-chat::part(link):active{color:#0911b3}.container{width:261px;height:100%;transition:width 0.3s ease-in-out}.collapsed{width:0;overflow:visible}.collapsed .sidebar{transform:translateX(-100%)}.collapsed .alternative{opacity:1}:host([behavior="drawer"]){z-index:1;width:0}:host(:not([behavior="drawer"])) .alternative .new-chat{display:none}.mask{position:fixed;top:0;right:0;bottom:0;left:0;background:var(--antd-modal-mask-bg)}.history{flex:1;min-height:0;overflow-y:auto;margin:0 -16px;padding:0 12px}.history ul{list-style:none;margin:0;padding:0}.history .loading{display:flex;justify-content:center;padding:8px}.history .group + .group{margin-top:15px}.history .group-title{font-weight:500;font-size:12px;color:#000;padding:8px;height:36px;line-height:20px}.history .item{display:block}.history .item::part(link){display:flex;align-items:center;padding:0 8px;height:36px;border-radius:8px;color:#000}.history .item::part(link):hover{background:rgba(0,0,0,0.04)}.history .item-title{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.history .actions{cursor:auto}.history .item:not(:hover):not(.active) .actions{display:none}.history .working{width:8px;height:8px;border-radius:8px;background:#2540ff;margin:0 7px}.history .item:hover .working,.history .item.active .working{display:none}.history .load-more{display:flex;justify-content:center;align-items:center;height:36px}',""]);const o=r.toString()},82165:(e,t,n)=>{n.d(t,{A:()=>h});var i=n(36758),a=n.n(i),s=n(40935),r=n.n(s),o=n(20062),l=n.n(o),c=new URL(n(32360),n.b),d=r()(a()),u=l()(c);d.push([e.id,`:host{display:block;background-color:#fff;background-image:url(${u});background-position:center;background-size:cover;background-repeat:no-repeat;background-attachment:fixed}:host([hidden]){display:none}`,""]);const h=d.toString()},91107:(e,t,n)=>{e.exports=n.p+"images/eef4f2bd.png"}}]);
3
- //# sourceMappingURL=6220.43f2b07b.js.map