@redocly/replay 0.27.0-next.4 → 0.27.0-next.6
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/dist/replay-AiChatProvider-D7E0a83D.js +1006 -0
- package/dist/replay-AiChatProvider-p9SioFWy.js +6 -0
- package/dist/replay-AiChatSqliteDBStorage-CKQJ5VZi.js +88 -0
- package/dist/replay-AiChatSqliteDBStorage-DgGB1XKW.js +1 -0
- package/dist/replay-AiPanel-BLkqnlmb.js +849 -0
- package/dist/replay-AiPanel-DvOGYsWl.js +2918 -0
- package/dist/replay-HistorySqliteDBStorage-BrILW8Fu.js +1 -0
- package/dist/replay-HistorySqliteDBStorage-CtF6-vY8.js +113 -0
- package/dist/replay-SqliteDBStorage-CNJbZXTw.js +14 -0
- package/dist/replay-SqliteDBStorage-D_31Bd3Z.js +2857 -0
- package/dist/replay-StepContextSqliteDBStorage-BSepLyBI.js +1 -0
- package/dist/replay-StepContextSqliteDBStorage-BfAAKDwA.js +83 -0
- package/dist/replay-agent-loop-DklepPbJ.js +1533 -0
- package/dist/replay-agent-loop-fKCHgyOD.js +1 -0
- package/dist/replay-ai-chat-mappers-D-vUBq2s.js +1 -0
- package/dist/replay-ai-chat-mappers-IWtvE0Nl.js +99 -0
- package/dist/replay-ai-message-parts.schema-BBdjwldJ.js +1 -0
- package/dist/replay-ai-message-parts.schema-E9u9-nqr.js +60 -0
- package/dist/replay-create-model-CfrWgdF7.js +38224 -0
- package/dist/replay-create-model-xGRAIhcu.js +104 -0
- package/dist/replay-db-BtdwaWh3.js +306 -0
- package/dist/replay-db-XlueEDU-.js +64 -0
- package/dist/replay-defaults-CzR6jw9a.js +32 -0
- package/dist/replay-defaults-DVvOnvnR.js +27 -0
- package/dist/replay-external-resolver-D6VSVDwt.js +34 -0
- package/dist/replay-external-resolver-Skh0OGde.js +2 -0
- package/dist/replay-history.schema-5ce6X0R1.js +28 -0
- package/dist/replay-history.schema-miM3Etuf.js +1 -0
- package/dist/replay-index-BEzVYZeb.js +504 -0
- package/dist/{replay-index-DCclzbQl.js → replay-index-BOB__Jm6.js} +1 -1
- package/dist/replay-index-C6SJPGDO.js +23 -0
- package/dist/{replay-index-D6LeDb4M.js → replay-index-CCvitTKt.js} +6 -6
- package/dist/replay-index-CUs62_1f.js +1 -0
- package/dist/replay-index-DXnDNeqk.js +93088 -0
- package/dist/replay-index-S_wAPmTA.js +6877 -0
- package/dist/replay-index-fVC8e5y9.js +1 -0
- package/dist/replay-indexes-CfsvVMi_.js +1242 -0
- package/dist/replay-indexes-Dqjl8m6C.js +1 -0
- package/dist/replay-lint-BCVeL_wb.js +184 -0
- package/dist/replay-lint-DjMIgYfF.js +33416 -0
- package/dist/{replay-lint-graphql-Cdmm_aJs.js → replay-lint-graphql-Bltv-T6_.js} +2 -2
- package/dist/{replay-lint-graphql-8tMA-ttz.js → replay-lint-graphql-bkrdHRy7.js} +5 -5
- package/dist/replay-resolve-BhcSceq-.js +3694 -0
- package/dist/replay-resolve-CQL6WBG1.js +47 -0
- package/dist/{replay-respect-run-DrWWHTWp.js → replay-respect-run-CecN1j9r.js} +1608 -1558
- package/dist/replay-respect-run-rJm4W93K.js +78 -0
- package/dist/replay-step-context.schema-BuuXkAck.js +1 -0
- package/dist/replay-step-context.schema-DBk4jufr.js +21 -0
- package/dist/{replay-tauri-path-BIIo3xjJ.js → replay-tauri-path--8KtMkGg.js} +1 -1
- package/dist/{replay-tauri-path-BQmCYwRI.js → replay-tauri-path--BfusnkB.js} +4 -4
- package/dist/replay-useAiChatQueries-B1-NwsZz.js +213 -0
- package/dist/replay-useAiChatQueries-Btd-PmIH.js +3532 -0
- package/dist/replay-validate-key-Bk0SFd3-.js +1 -0
- package/dist/replay-validate-key-CYsfegSv.js +28 -0
- package/dist/replay.cjs +1 -1
- package/dist/replay.d.ts +37 -5
- package/dist/replay.js +18 -18
- package/package.json +4 -4
- package/dist/replay-index-BFggGnsX.js +0 -181252
- package/dist/replay-index-BWX4r5us.js +0 -8354
- package/dist/replay-index-DuAFN7X8.js +0 -21
- package/dist/replay-index-tDvNtfHp.js +0 -1
- package/dist/replay-respect-run-DGe96SG3.js +0 -78
|
@@ -0,0 +1,2918 @@
|
|
|
1
|
+
import { jsx as i, jsxs as h, Fragment as Fe } from "react/jsx-runtime";
|
|
2
|
+
import { useState as K, useEffect as B, useCallback as $, useMemo as S, Fragment as yt, useRef as F, useLayoutEffect as je, createContext as xt, useContext as wt } from "react";
|
|
3
|
+
import c, { css as fe, keyframes as bt } from "styled-components";
|
|
4
|
+
import { Tooltip as Y, AI_SEARCH_MAX_MESSAGE_LENGTH as Ct, Button as V, SubtractIcon as kt, AddIcon as Tt, CheckmarkFilledIcon as It, CloseFilledIcon as St, CheckboxIcon as At, capitalize as ee, ChevronDownIcon as Lt, ChevronRightIcon as Pt, SettingsCogIcon as Et, Dropdown as Rt, DropdownMenu as Ot, DropdownMenuItem as We, CheckmarkIcon as $t, ClaudeIcon as Dt, GeminiIcon as Mt, ChatGptIcon as zt, Typography as re, TrashCanIcon as _t, AiStarsGradientIcon as Vt, NewChatIcon as Ht, RecentlyViewedIcon as Bt, CloseIcon as Nt, ArrowLeftIcon as Ft } from "@redocly/theme";
|
|
5
|
+
import { G as xe, H as Ue, T as X, J as we, K as jt, b as Wt, m as Ye, i as Ut, j as Yt, L as Gt, N as pe, O as he, P as N, Q as me, U as Kt, V as qt, W as Ge, X as Zt, Y as Jt, R as ge, E as le, Z as Ke, p as qe, _ as ye, $ as U, a0 as Xt } from "./replay-index-DXnDNeqk.js";
|
|
6
|
+
import { l as Qt, n as en, p as tn, q as nn, T as rn, t as on, v as an, x as Ze, C as k, y as sn, z as Je, L as cn, B as q, D as ln, E as dn, F as un, G as fn, H as j } from "./replay-useAiChatQueries-Btd-PmIH.js";
|
|
7
|
+
import { M as D } from "./replay-db-BtdwaWh3.js";
|
|
8
|
+
import "@tanstack/react-query";
|
|
9
|
+
import { Link as pn } from "react-router-dom";
|
|
10
|
+
const te = c.div`
|
|
11
|
+
width: var(--search-ai-thinking-dot-size);
|
|
12
|
+
height: var(--search-ai-thinking-dot-size);
|
|
13
|
+
border-radius: 50%;
|
|
14
|
+
background: var(--search-ai-thinking-dot-color);
|
|
15
|
+
animation: bounce 1.4s infinite ease-in-out;
|
|
16
|
+
|
|
17
|
+
&:nth-child(1) {
|
|
18
|
+
animation-delay: -0.32s;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&:nth-child(2) {
|
|
22
|
+
animation-delay: -0.16s;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&:nth-child(3) {
|
|
26
|
+
animation-delay: 0s;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@keyframes bounce {
|
|
30
|
+
0%,
|
|
31
|
+
80%,
|
|
32
|
+
100% {
|
|
33
|
+
opacity: 0.2;
|
|
34
|
+
transform: scale(0.8);
|
|
35
|
+
}
|
|
36
|
+
40% {
|
|
37
|
+
opacity: 1;
|
|
38
|
+
transform: scale(1);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
`, Xe = 280;
|
|
42
|
+
function be() {
|
|
43
|
+
const [e, t] = K(
|
|
44
|
+
() => xe().getIndexingActivityState().inProgress
|
|
45
|
+
);
|
|
46
|
+
return B(() => xe().subscribe("indexing-activity", (r) => {
|
|
47
|
+
t(r.inProgress);
|
|
48
|
+
}), []), /* @__PURE__ */ i(hn, { $open: e, children: /* @__PURE__ */ i(gn, { children: /* @__PURE__ */ i(vn, { $open: e, "aria-hidden": !e, children: /* @__PURE__ */ i(
|
|
49
|
+
Y,
|
|
50
|
+
{
|
|
51
|
+
tip: "We're building a search index of your project. Until it's ready, the assistant may need more context in each reply to stay accurate, which can use more tokens.",
|
|
52
|
+
placement: "top",
|
|
53
|
+
width: "240px",
|
|
54
|
+
arrowPosition: "left",
|
|
55
|
+
children: /* @__PURE__ */ h(mn, { role: "status", "aria-live": "polite", "aria-label": "Indexing in progress...", children: [
|
|
56
|
+
/* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(te, {}) }),
|
|
57
|
+
/* @__PURE__ */ i(yn, { children: "Indexing in progress..." })
|
|
58
|
+
] })
|
|
59
|
+
}
|
|
60
|
+
) }) }) });
|
|
61
|
+
}
|
|
62
|
+
const hn = c.div`
|
|
63
|
+
display: grid;
|
|
64
|
+
grid-template-rows: ${({ $open: e }) => e ? "1fr" : "0fr"};
|
|
65
|
+
transition: grid-template-rows ${Xe}ms ease-out;
|
|
66
|
+
`, gn = c.div`
|
|
67
|
+
min-height: 0;
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
`, vn = c.div`
|
|
70
|
+
opacity: ${({ $open: e }) => e ? 1 : 0};
|
|
71
|
+
transition: opacity ${Xe}ms ease-out;
|
|
72
|
+
pointer-events: ${({ $open: e }) => e ? "auto" : "none"};
|
|
73
|
+
padding: var(--spacing-xs);
|
|
74
|
+
padding-top: var(--spacing-xxs);
|
|
75
|
+
`, mn = c.div`
|
|
76
|
+
width: 100%;
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
gap: var(--spacing-xxs);
|
|
80
|
+
background: var(--layer-color);
|
|
81
|
+
padding: var(--spacing-xs) var(--spacing-sm);
|
|
82
|
+
border-radius: var(--border-radius);
|
|
83
|
+
font-size: var(--font-size-sm);
|
|
84
|
+
line-height: var(--line-height-sm);
|
|
85
|
+
`, yn = c.div`
|
|
86
|
+
flex: 1;
|
|
87
|
+
min-width: 0;
|
|
88
|
+
`, xn = (e) => /* @__PURE__ */ i(
|
|
89
|
+
"svg",
|
|
90
|
+
{
|
|
91
|
+
width: "16",
|
|
92
|
+
height: "16",
|
|
93
|
+
viewBox: "0 0 16 16",
|
|
94
|
+
fill: "none",
|
|
95
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
96
|
+
...e,
|
|
97
|
+
children: /* @__PURE__ */ i(
|
|
98
|
+
"path",
|
|
99
|
+
{
|
|
100
|
+
d: "M13.0094 7.61066L3.38435 2.79816C3.30892 2.76043 3.22418 2.74532 3.14035 2.75463C3.05652 2.76394 2.97717 2.79729 2.91186 2.85066C2.84948 2.90294 2.80292 2.97158 2.77742 3.04886C2.75191 3.12615 2.74847 3.20902 2.76748 3.28816L3.92685 7.56253H8.87498V8.43753H3.92685L2.74998 12.6988C2.73214 12.7649 2.73006 12.8342 2.7439 12.9013C2.75774 12.9683 2.78712 13.0312 2.82968 13.0848C2.87223 13.1384 2.92677 13.1813 2.98891 13.21C3.05106 13.2387 3.11907 13.2524 3.18748 13.25C3.25597 13.2496 3.3234 13.2331 3.38435 13.2019L13.0094 8.38941C13.081 8.35269 13.1412 8.29692 13.1832 8.22821C13.2252 8.15951 13.2474 8.08055 13.2474 8.00003C13.2474 7.91951 13.2252 7.84056 13.1832 7.77185C13.1412 7.70315 13.081 7.64737 13.0094 7.61066Z",
|
|
101
|
+
fill: "white"
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
), wn = c(xn).attrs({
|
|
106
|
+
"data-component-name": "icons/SendIcon/SendIcon"
|
|
107
|
+
})`
|
|
108
|
+
path {
|
|
109
|
+
fill: ${({ color: e }) => Ue(e)};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
height: ${({ size: e }) => e || "16px"};
|
|
113
|
+
width: ${({ size: e }) => e || "16px"};
|
|
114
|
+
`, bn = (e) => /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 14 14", fill: "none", ...e, children: /* @__PURE__ */ i("path", { d: "M10.5 3.5V10.5H3.5V3.5H10.5ZM10.5 2.625H3.5C3.26794 2.625 3.04538 2.71719 2.88128 2.88128C2.71719 3.04538 2.625 3.26794 2.625 3.5V10.5C2.625 10.7321 2.71719 10.9546 2.88128 11.1187C3.04538 11.2828 3.26794 11.375 3.5 11.375H10.5C10.7321 11.375 10.9546 11.2828 11.1187 11.1187C11.2828 10.9546 11.375 10.7321 11.375 10.5V3.5C11.375 3.26794 11.2828 3.04538 11.1187 2.88128C10.9546 2.71719 10.7321 2.625 10.5 2.625Z" }) }), Cn = c(bn).attrs({
|
|
115
|
+
"data-component-name": "icons/StopIcon/StopIcon"
|
|
116
|
+
})`
|
|
117
|
+
path {
|
|
118
|
+
fill: ${({ color: e }) => Ue(e)};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
height: ${({ size: e }) => e || "16px"};
|
|
122
|
+
width: ${({ size: e }) => e || "16px"};
|
|
123
|
+
`;
|
|
124
|
+
function kn({
|
|
125
|
+
placeholder: e = "Ask anything...",
|
|
126
|
+
className: t,
|
|
127
|
+
disabled: n,
|
|
128
|
+
isStreaming: r = !1,
|
|
129
|
+
onStop: o,
|
|
130
|
+
modelSelector: a,
|
|
131
|
+
value: s,
|
|
132
|
+
onValueChange: l,
|
|
133
|
+
onSubmit: d,
|
|
134
|
+
textareaRef: u
|
|
135
|
+
}) {
|
|
136
|
+
const f = s.trim(), p = !n && f.length > 0 && !r, g = !n && f.length > 0, m = (b) => {
|
|
137
|
+
l(b.target.value);
|
|
138
|
+
}, v = () => {
|
|
139
|
+
!f || n || r || d();
|
|
140
|
+
}, x = () => {
|
|
141
|
+
!r || !o || o();
|
|
142
|
+
};
|
|
143
|
+
return /* @__PURE__ */ h(Tn, { className: t, $isActive: g, children: [
|
|
144
|
+
/* @__PURE__ */ i(
|
|
145
|
+
In,
|
|
146
|
+
{
|
|
147
|
+
ref: u,
|
|
148
|
+
rows: 1,
|
|
149
|
+
maxLength: Ct,
|
|
150
|
+
placeholder: e,
|
|
151
|
+
value: s,
|
|
152
|
+
disabled: n,
|
|
153
|
+
spellCheck: !1,
|
|
154
|
+
onChange: m,
|
|
155
|
+
onKeyDown: (b) => {
|
|
156
|
+
b.key === "Enter" && !b.shiftKey && !b.nativeEvent.isComposing && (b.preventDefault(), r && o ? x() : v());
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
),
|
|
160
|
+
/* @__PURE__ */ h(Sn, { children: [
|
|
161
|
+
a,
|
|
162
|
+
r && o ? /* @__PURE__ */ i(
|
|
163
|
+
Ln,
|
|
164
|
+
{
|
|
165
|
+
type: "button",
|
|
166
|
+
size: "small",
|
|
167
|
+
"aria-label": "Stop generating",
|
|
168
|
+
icon: /* @__PURE__ */ i(Cn, { color: "var(--icon-color-on-color)" }),
|
|
169
|
+
onClick: x
|
|
170
|
+
}
|
|
171
|
+
) : /* @__PURE__ */ i(
|
|
172
|
+
An,
|
|
173
|
+
{
|
|
174
|
+
type: "button",
|
|
175
|
+
size: "small",
|
|
176
|
+
"aria-label": "Send message",
|
|
177
|
+
icon: /* @__PURE__ */ i(wn, { color: "var(--icon-color-on-color)" }),
|
|
178
|
+
onClick: v,
|
|
179
|
+
disabled: !p
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
] })
|
|
183
|
+
] });
|
|
184
|
+
}
|
|
185
|
+
const Tn = c.div`
|
|
186
|
+
display: flex;
|
|
187
|
+
flex-direction: column;
|
|
188
|
+
gap: var(--spacing-xs);
|
|
189
|
+
width: 100%;
|
|
190
|
+
padding: var(--spacing-xs);
|
|
191
|
+
border: var(--search-ai-conversation-input-border, 1px solid var(--border-color-secondary));
|
|
192
|
+
border-radius: var(--search-ai-conversation-input-border-radius, var(--border-radius-lg));
|
|
193
|
+
background-color: var(--layer-color);
|
|
194
|
+
box-sizing: border-box;
|
|
195
|
+
|
|
196
|
+
&:hover,
|
|
197
|
+
&:focus-within {
|
|
198
|
+
border-color: transparent;
|
|
199
|
+
background:
|
|
200
|
+
linear-gradient(var(--layer-color), var(--layer-color)) padding-box,
|
|
201
|
+
var(--replay-ai-gradient-soft) border-box;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
${({ $isActive: e }) => e && fe`
|
|
205
|
+
border-color: transparent;
|
|
206
|
+
background:
|
|
207
|
+
linear-gradient(var(--layer-color), var(--layer-color)) padding-box,
|
|
208
|
+
var(--replay-ai-gradient-soft) border-box;
|
|
209
|
+
`}
|
|
210
|
+
`, In = c.textarea`
|
|
211
|
+
max-height: 150px;
|
|
212
|
+
min-height: var(--search-ai-conversation-input-min-height);
|
|
213
|
+
|
|
214
|
+
resize: none;
|
|
215
|
+
border: none;
|
|
216
|
+
outline: none;
|
|
217
|
+
padding: 0;
|
|
218
|
+
font-family: var(--font-family-base);
|
|
219
|
+
font-size: var(--font-size-base);
|
|
220
|
+
line-height: var(--line-height-base);
|
|
221
|
+
color: var(--text-color-primary);
|
|
222
|
+
caret-color: var(--text-color-primary);
|
|
223
|
+
background-color: transparent;
|
|
224
|
+
field-sizing: content;
|
|
225
|
+
|
|
226
|
+
&::placeholder {
|
|
227
|
+
color: var(--text-color-helper);
|
|
228
|
+
text-indent: 2px;
|
|
229
|
+
}
|
|
230
|
+
`, Sn = c.div`
|
|
231
|
+
display: flex;
|
|
232
|
+
justify-content: space-between;
|
|
233
|
+
align-items: center;
|
|
234
|
+
gap: var(--spacing-xs);
|
|
235
|
+
`, An = c(V)`
|
|
236
|
+
box-sizing: border-box;
|
|
237
|
+
background: var(--search-ai-gradient);
|
|
238
|
+
|
|
239
|
+
&:disabled {
|
|
240
|
+
background: var(--replay-ai-gradient-disabled);
|
|
241
|
+
border: var(--replay-ai-send-button-disabled-border);
|
|
242
|
+
width: 24px;
|
|
243
|
+
height: 24px;
|
|
244
|
+
}
|
|
245
|
+
`, Ln = c(V)`
|
|
246
|
+
box-sizing: border-box;
|
|
247
|
+
background: var(--color-warm-grey-9);
|
|
248
|
+
border-radius: var(--border-radius-xxl);
|
|
249
|
+
`, Pn = /* @__PURE__ */ new Set(["collection", "workflow", "step", "operation", "workflow-run"]);
|
|
250
|
+
function Qe(e) {
|
|
251
|
+
return `replay://step?${new URLSearchParams({
|
|
252
|
+
collectionId: e.collectionId.trim(),
|
|
253
|
+
workflowId: e.workflowId.trim(),
|
|
254
|
+
stepId: e.stepId.trim()
|
|
255
|
+
}).toString()}`;
|
|
256
|
+
}
|
|
257
|
+
function R(e, t) {
|
|
258
|
+
const n = e.get(t);
|
|
259
|
+
if (n == null)
|
|
260
|
+
return null;
|
|
261
|
+
const r = n.trim();
|
|
262
|
+
return r.length > 0 ? r : null;
|
|
263
|
+
}
|
|
264
|
+
function En(e) {
|
|
265
|
+
let t;
|
|
266
|
+
try {
|
|
267
|
+
t = new URL(e);
|
|
268
|
+
} catch {
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
if (t.protocol !== "replay:")
|
|
272
|
+
return null;
|
|
273
|
+
const n = t.hostname.toLowerCase();
|
|
274
|
+
if (!Pn.has(n))
|
|
275
|
+
return null;
|
|
276
|
+
const r = t.searchParams;
|
|
277
|
+
switch (n) {
|
|
278
|
+
case "collection": {
|
|
279
|
+
const o = R(r, "collectionId");
|
|
280
|
+
return o ? { kind: "collection", collectionId: o } : null;
|
|
281
|
+
}
|
|
282
|
+
case "workflow": {
|
|
283
|
+
const o = R(r, "collectionId"), a = R(r, "workflowId");
|
|
284
|
+
return !o || !a ? null : { kind: "workflow", collectionId: o, workflowId: a };
|
|
285
|
+
}
|
|
286
|
+
case "step": {
|
|
287
|
+
const o = R(r, "collectionId"), a = R(r, "workflowId"), s = R(r, "stepId");
|
|
288
|
+
return !o || !a || !s ? null : { kind: "step", collectionId: o, workflowId: a, stepId: s };
|
|
289
|
+
}
|
|
290
|
+
case "operation": {
|
|
291
|
+
const o = R(r, "operationId");
|
|
292
|
+
return o ? { kind: "operation", operationId: o } : null;
|
|
293
|
+
}
|
|
294
|
+
case "workflow-run": {
|
|
295
|
+
const o = R(r, "collectionId"), a = R(r, "workflowId");
|
|
296
|
+
if (!o || !a) return null;
|
|
297
|
+
const s = R(r, "historyId"), l = s === "null" || s === "undefined" ? null : s;
|
|
298
|
+
return {
|
|
299
|
+
kind: "workflow-run",
|
|
300
|
+
collectionId: o,
|
|
301
|
+
workflowId: a,
|
|
302
|
+
...l ? { historyId: l } : {}
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
default:
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
function Rn(e, t, n) {
|
|
310
|
+
return e.tabsState.tabs.get({ noproxy: !0 }).findIndex(({ data: r }) => jt(r, Wt.WorkflowRun) && r.collectionId === t && r.workflowId === n);
|
|
311
|
+
}
|
|
312
|
+
function On(e, t, n, r = {}) {
|
|
313
|
+
switch (n.kind) {
|
|
314
|
+
case "collection":
|
|
315
|
+
t.openCollectionTab({
|
|
316
|
+
collectionId: n.collectionId,
|
|
317
|
+
activeTabName: we.COLLECTION_SETTINGS
|
|
318
|
+
});
|
|
319
|
+
break;
|
|
320
|
+
case "workflow":
|
|
321
|
+
t.openWorkflowTab({
|
|
322
|
+
collectionId: n.collectionId,
|
|
323
|
+
workflowId: n.workflowId,
|
|
324
|
+
activeTabName: we.WORKFLOW_SETTINGS
|
|
325
|
+
});
|
|
326
|
+
break;
|
|
327
|
+
case "step":
|
|
328
|
+
t.openStepTabFromCollection({
|
|
329
|
+
collectionId: n.collectionId,
|
|
330
|
+
workflowId: n.workflowId,
|
|
331
|
+
stepId: n.stepId,
|
|
332
|
+
state: X.Normal
|
|
333
|
+
});
|
|
334
|
+
break;
|
|
335
|
+
case "workflow-run": {
|
|
336
|
+
const o = r.workflowRunHistoryIds?.[nn(n.collectionId, n.workflowId)] ?? [], a = n.historyId && o.includes(n.historyId) ? n.historyId : o.at(-1) ?? n.historyId;
|
|
337
|
+
if (a) {
|
|
338
|
+
t.openWorkflowRunTabFromHistory(a, { state: X.Normal });
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
const s = Rn(
|
|
342
|
+
e,
|
|
343
|
+
n.collectionId,
|
|
344
|
+
n.workflowId
|
|
345
|
+
);
|
|
346
|
+
if (s !== -1) {
|
|
347
|
+
e.tabsState.tabs.get({ noproxy: !0 })[s].state === X.Preview && t.changeTabState(s, X.Normal), t.handleTabChange(s);
|
|
348
|
+
break;
|
|
349
|
+
}
|
|
350
|
+
t.openWorkflowRunTab({
|
|
351
|
+
collectionId: n.collectionId,
|
|
352
|
+
workflowId: n.workflowId
|
|
353
|
+
});
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
case "operation": {
|
|
357
|
+
const o = Qt(e, n.operationId);
|
|
358
|
+
if (!o.ok) {
|
|
359
|
+
console.warn("[executeReplayChatLink] Operation not resolved", {
|
|
360
|
+
operationId: n.operationId,
|
|
361
|
+
message: o.message
|
|
362
|
+
});
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
en(
|
|
366
|
+
e,
|
|
367
|
+
tn(o.value),
|
|
368
|
+
t
|
|
369
|
+
);
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
function $n(e, t, n, r = {}) {
|
|
375
|
+
const o = En(n);
|
|
376
|
+
o && On(e, t, o, r);
|
|
377
|
+
}
|
|
378
|
+
function et({
|
|
379
|
+
workflowRunHistoryIds: e
|
|
380
|
+
} = {}) {
|
|
381
|
+
const t = Ye(), { getApiOperation: n } = Ut(), {
|
|
382
|
+
handleTabChange: r,
|
|
383
|
+
addNewTab: o,
|
|
384
|
+
openCollectionTab: a,
|
|
385
|
+
openWorkflowTab: s,
|
|
386
|
+
openStepTabFromCollection: l,
|
|
387
|
+
openWorkflowRunTab: d,
|
|
388
|
+
openWorkflowRunTabFromHistory: u,
|
|
389
|
+
changeTabState: f
|
|
390
|
+
} = Yt();
|
|
391
|
+
return $(
|
|
392
|
+
(p) => {
|
|
393
|
+
const g = p.target;
|
|
394
|
+
if (!(g instanceof Element))
|
|
395
|
+
return;
|
|
396
|
+
const m = g.closest("a[href]");
|
|
397
|
+
if (!(m instanceof HTMLAnchorElement))
|
|
398
|
+
return;
|
|
399
|
+
const v = m.getAttribute("href");
|
|
400
|
+
v?.startsWith("replay:") && (p.preventDefault(), p.stopPropagation(), $n(
|
|
401
|
+
t,
|
|
402
|
+
{
|
|
403
|
+
getApiOperation: n,
|
|
404
|
+
handleTabChange: r,
|
|
405
|
+
addNewTab: o,
|
|
406
|
+
openCollectionTab: a,
|
|
407
|
+
openWorkflowTab: s,
|
|
408
|
+
openStepTabFromCollection: l,
|
|
409
|
+
openWorkflowRunTab: d,
|
|
410
|
+
openWorkflowRunTabFromHistory: u,
|
|
411
|
+
changeTabState: f
|
|
412
|
+
},
|
|
413
|
+
v,
|
|
414
|
+
{ workflowRunHistoryIds: e }
|
|
415
|
+
));
|
|
416
|
+
},
|
|
417
|
+
[
|
|
418
|
+
e,
|
|
419
|
+
t,
|
|
420
|
+
n,
|
|
421
|
+
r,
|
|
422
|
+
o,
|
|
423
|
+
a,
|
|
424
|
+
s,
|
|
425
|
+
l,
|
|
426
|
+
d,
|
|
427
|
+
u,
|
|
428
|
+
f
|
|
429
|
+
]
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
class Dn {
|
|
433
|
+
diff(t, n, r = {}) {
|
|
434
|
+
let o;
|
|
435
|
+
typeof r == "function" ? (o = r, r = {}) : "callback" in r && (o = r.callback);
|
|
436
|
+
const a = this.castInput(t, r), s = this.castInput(n, r), l = this.removeEmpty(this.tokenize(a, r)), d = this.removeEmpty(this.tokenize(s, r));
|
|
437
|
+
return this.diffWithOptionsObj(l, d, r, o);
|
|
438
|
+
}
|
|
439
|
+
diffWithOptionsObj(t, n, r, o) {
|
|
440
|
+
var a;
|
|
441
|
+
const s = (y) => {
|
|
442
|
+
if (y = this.postProcess(y, r), o) {
|
|
443
|
+
setTimeout(function() {
|
|
444
|
+
o(y);
|
|
445
|
+
}, 0);
|
|
446
|
+
return;
|
|
447
|
+
} else
|
|
448
|
+
return y;
|
|
449
|
+
}, l = n.length, d = t.length;
|
|
450
|
+
let u = 1, f = l + d;
|
|
451
|
+
r.maxEditLength != null && (f = Math.min(f, r.maxEditLength));
|
|
452
|
+
const p = (a = r.timeout) !== null && a !== void 0 ? a : 1 / 0, g = Date.now() + p, m = [{ oldPos: -1, lastComponent: void 0 }];
|
|
453
|
+
let v = this.extractCommon(m[0], n, t, 0, r);
|
|
454
|
+
if (m[0].oldPos + 1 >= d && v + 1 >= l)
|
|
455
|
+
return s(this.buildValues(m[0].lastComponent, n, t));
|
|
456
|
+
let x = -1 / 0, w = 1 / 0;
|
|
457
|
+
const b = () => {
|
|
458
|
+
for (let y = Math.max(x, -u); y <= Math.min(w, u); y += 2) {
|
|
459
|
+
let A;
|
|
460
|
+
const z = m[y - 1], P = m[y + 1];
|
|
461
|
+
z && (m[y - 1] = void 0);
|
|
462
|
+
let M = !1;
|
|
463
|
+
if (P) {
|
|
464
|
+
const J = P.oldPos - y;
|
|
465
|
+
M = P && 0 <= J && J < l;
|
|
466
|
+
}
|
|
467
|
+
const Z = z && z.oldPos + 1 < d;
|
|
468
|
+
if (!M && !Z) {
|
|
469
|
+
m[y] = void 0;
|
|
470
|
+
continue;
|
|
471
|
+
}
|
|
472
|
+
if (!Z || M && z.oldPos < P.oldPos ? A = this.addToPath(P, !0, !1, 0, r) : A = this.addToPath(z, !1, !0, 1, r), v = this.extractCommon(A, n, t, y, r), A.oldPos + 1 >= d && v + 1 >= l)
|
|
473
|
+
return s(this.buildValues(A.lastComponent, n, t)) || !0;
|
|
474
|
+
m[y] = A, A.oldPos + 1 >= d && (w = Math.min(w, y - 1)), v + 1 >= l && (x = Math.max(x, y + 1));
|
|
475
|
+
}
|
|
476
|
+
u++;
|
|
477
|
+
};
|
|
478
|
+
if (o)
|
|
479
|
+
(function y() {
|
|
480
|
+
setTimeout(function() {
|
|
481
|
+
if (u > f || Date.now() > g)
|
|
482
|
+
return o(void 0);
|
|
483
|
+
b() || y();
|
|
484
|
+
}, 0);
|
|
485
|
+
})();
|
|
486
|
+
else
|
|
487
|
+
for (; u <= f && Date.now() <= g; ) {
|
|
488
|
+
const y = b();
|
|
489
|
+
if (y)
|
|
490
|
+
return y;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
addToPath(t, n, r, o, a) {
|
|
494
|
+
const s = t.lastComponent;
|
|
495
|
+
return s && !a.oneChangePerToken && s.added === n && s.removed === r ? {
|
|
496
|
+
oldPos: t.oldPos + o,
|
|
497
|
+
lastComponent: { count: s.count + 1, added: n, removed: r, previousComponent: s.previousComponent }
|
|
498
|
+
} : {
|
|
499
|
+
oldPos: t.oldPos + o,
|
|
500
|
+
lastComponent: { count: 1, added: n, removed: r, previousComponent: s }
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
extractCommon(t, n, r, o, a) {
|
|
504
|
+
const s = n.length, l = r.length;
|
|
505
|
+
let d = t.oldPos, u = d - o, f = 0;
|
|
506
|
+
for (; u + 1 < s && d + 1 < l && this.equals(r[d + 1], n[u + 1], a); )
|
|
507
|
+
u++, d++, f++, a.oneChangePerToken && (t.lastComponent = { count: 1, previousComponent: t.lastComponent, added: !1, removed: !1 });
|
|
508
|
+
return f && !a.oneChangePerToken && (t.lastComponent = { count: f, previousComponent: t.lastComponent, added: !1, removed: !1 }), t.oldPos = d, u;
|
|
509
|
+
}
|
|
510
|
+
equals(t, n, r) {
|
|
511
|
+
return r.comparator ? r.comparator(t, n) : t === n || !!r.ignoreCase && t.toLowerCase() === n.toLowerCase();
|
|
512
|
+
}
|
|
513
|
+
removeEmpty(t) {
|
|
514
|
+
const n = [];
|
|
515
|
+
for (let r = 0; r < t.length; r++)
|
|
516
|
+
t[r] && n.push(t[r]);
|
|
517
|
+
return n;
|
|
518
|
+
}
|
|
519
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
520
|
+
castInput(t, n) {
|
|
521
|
+
return t;
|
|
522
|
+
}
|
|
523
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
524
|
+
tokenize(t, n) {
|
|
525
|
+
return Array.from(t);
|
|
526
|
+
}
|
|
527
|
+
join(t) {
|
|
528
|
+
return t.join("");
|
|
529
|
+
}
|
|
530
|
+
postProcess(t, n) {
|
|
531
|
+
return t;
|
|
532
|
+
}
|
|
533
|
+
get useLongestToken() {
|
|
534
|
+
return !1;
|
|
535
|
+
}
|
|
536
|
+
buildValues(t, n, r) {
|
|
537
|
+
const o = [];
|
|
538
|
+
let a;
|
|
539
|
+
for (; t; )
|
|
540
|
+
o.push(t), a = t.previousComponent, delete t.previousComponent, t = a;
|
|
541
|
+
o.reverse();
|
|
542
|
+
const s = o.length;
|
|
543
|
+
let l = 0, d = 0, u = 0;
|
|
544
|
+
for (; l < s; l++) {
|
|
545
|
+
const f = o[l];
|
|
546
|
+
if (f.removed)
|
|
547
|
+
f.value = this.join(r.slice(u, u + f.count)), u += f.count;
|
|
548
|
+
else {
|
|
549
|
+
if (!f.added && this.useLongestToken) {
|
|
550
|
+
let p = n.slice(d, d + f.count);
|
|
551
|
+
p = p.map(function(g, m) {
|
|
552
|
+
const v = r[u + m];
|
|
553
|
+
return v.length > g.length ? v : g;
|
|
554
|
+
}), f.value = this.join(p);
|
|
555
|
+
} else
|
|
556
|
+
f.value = this.join(n.slice(d, d + f.count));
|
|
557
|
+
d += f.count, f.added || (u += f.count);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
return o;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
class Mn extends Dn {
|
|
564
|
+
constructor() {
|
|
565
|
+
super(...arguments), this.tokenize = Vn;
|
|
566
|
+
}
|
|
567
|
+
equals(t, n, r) {
|
|
568
|
+
return r.ignoreWhitespace ? ((!r.newlineIsToken || !t.includes(`
|
|
569
|
+
`)) && (t = t.trim()), (!r.newlineIsToken || !n.includes(`
|
|
570
|
+
`)) && (n = n.trim())) : r.ignoreNewlineAtEof && !r.newlineIsToken && (t.endsWith(`
|
|
571
|
+
`) && (t = t.slice(0, -1)), n.endsWith(`
|
|
572
|
+
`) && (n = n.slice(0, -1))), super.equals(t, n, r);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
const zn = new Mn();
|
|
576
|
+
function _n(e, t, n) {
|
|
577
|
+
return zn.diff(e, t, n);
|
|
578
|
+
}
|
|
579
|
+
function Vn(e, t) {
|
|
580
|
+
t.stripTrailingCr && (e = e.replace(/\r\n/g, `
|
|
581
|
+
`));
|
|
582
|
+
const n = [], r = e.split(/(\n|\r\n)/);
|
|
583
|
+
r[r.length - 1] || r.pop();
|
|
584
|
+
for (let o = 0; o < r.length; o++) {
|
|
585
|
+
const a = r[o];
|
|
586
|
+
o % 2 && !t.newlineIsToken ? n[n.length - 1] += a : n.push(a);
|
|
587
|
+
}
|
|
588
|
+
return n;
|
|
589
|
+
}
|
|
590
|
+
const Hn = 500;
|
|
591
|
+
function Bn(e, t) {
|
|
592
|
+
const n = Nn(e, t);
|
|
593
|
+
if (n.length === 0) return [];
|
|
594
|
+
const r = [];
|
|
595
|
+
let o = 0;
|
|
596
|
+
for (; o < n.length; ) {
|
|
597
|
+
let a = o;
|
|
598
|
+
const s = n[o].type === "context";
|
|
599
|
+
for (; a < n.length && n[a].type === "context" === s; ) a++;
|
|
600
|
+
const l = n.slice(o, a);
|
|
601
|
+
r.push({
|
|
602
|
+
start: o,
|
|
603
|
+
end: a,
|
|
604
|
+
rows: l,
|
|
605
|
+
hasAdditions: l.some((d) => d.type === "add"),
|
|
606
|
+
hasRemovals: l.some((d) => d.type === "remove")
|
|
607
|
+
}), o = a;
|
|
608
|
+
}
|
|
609
|
+
return r;
|
|
610
|
+
}
|
|
611
|
+
function Nn(e, t) {
|
|
612
|
+
if (e === void 0)
|
|
613
|
+
return t === void 0 ? [] : W(t, "add");
|
|
614
|
+
if (t === void 0) return W(e, "remove");
|
|
615
|
+
if (e === t) return W(t, "context");
|
|
616
|
+
const n = Fn(e, t);
|
|
617
|
+
return n ? n.flatMap(
|
|
618
|
+
(r) => W(r.value, r.added ? "add" : r.removed ? "remove" : "context")
|
|
619
|
+
) : [...W(e, "remove"), ...W(t, "add")];
|
|
620
|
+
}
|
|
621
|
+
function Fn(e, t) {
|
|
622
|
+
try {
|
|
623
|
+
return _n(e, t, { timeout: Hn });
|
|
624
|
+
} catch {
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
function W(e, t) {
|
|
629
|
+
const n = e.split(`
|
|
630
|
+
`);
|
|
631
|
+
return n.length > 1 && n[n.length - 1] === "" && n.pop(), n.map((r) => ({ type: t, text: r }));
|
|
632
|
+
}
|
|
633
|
+
const Ce = 1, ke = (e) => e && e.hasAdditions !== e.hasRemovals, Te = (e) => e && (e.hasAdditions || e.hasRemovals);
|
|
634
|
+
function jn(e, t, n) {
|
|
635
|
+
if (e.hasAdditions || e.hasRemovals)
|
|
636
|
+
return Q(e.rows);
|
|
637
|
+
const r = n[t - 1], o = n[t + 1], a = ke(r) ? Ce : 0, s = ke(o) ? Ce : 0;
|
|
638
|
+
if (a + s >= e.rows.length) return Q(e.rows);
|
|
639
|
+
const l = e.rows.slice(0, a), d = s > 0 ? e.rows.slice(-s) : [], u = [];
|
|
640
|
+
return u.push(...Q(l)), Te(r) && Te(o) && u.push({ kind: "separator" }), u.push(...Q(d)), u;
|
|
641
|
+
}
|
|
642
|
+
function Q(e) {
|
|
643
|
+
return e.map((t) => ({
|
|
644
|
+
kind: "row",
|
|
645
|
+
row: t
|
|
646
|
+
}));
|
|
647
|
+
}
|
|
648
|
+
const Wn = 200;
|
|
649
|
+
function Ie({ oldValue: e, newValue: t }) {
|
|
650
|
+
const n = S(() => Bn(e, t), [e, t]), r = S(() => n.flatMap(jn), [n]);
|
|
651
|
+
return S(() => n.some((a) => a.hasAdditions || a.hasRemovals), [n]) ? /* @__PURE__ */ i(Yn, { $maxHeight: Wn, children: r.map((a, s) => {
|
|
652
|
+
if (a.kind === "separator")
|
|
653
|
+
return /* @__PURE__ */ i(Jn, { children: /* @__PURE__ */ i(Se, { children: "···" }) }, s);
|
|
654
|
+
const { row: l } = a, d = Un(l.type);
|
|
655
|
+
return /* @__PURE__ */ h(d, { children: [
|
|
656
|
+
/* @__PURE__ */ h(Zn, { children: [
|
|
657
|
+
l.type === "remove" && /* @__PURE__ */ i(kt, { size: "12px" }),
|
|
658
|
+
l.type === "add" && /* @__PURE__ */ i(Tt, { size: "12px" })
|
|
659
|
+
] }),
|
|
660
|
+
/* @__PURE__ */ i(Se, { children: l.text === "" ? " " : l.text })
|
|
661
|
+
] }, s);
|
|
662
|
+
}) }) : null;
|
|
663
|
+
}
|
|
664
|
+
function Un(e) {
|
|
665
|
+
return e === "remove" ? Gn : e === "add" ? Kn : qn;
|
|
666
|
+
}
|
|
667
|
+
const Yn = c.div`
|
|
668
|
+
display: flex;
|
|
669
|
+
flex-direction: column;
|
|
670
|
+
width: 100%;
|
|
671
|
+
min-width: 0;
|
|
672
|
+
max-height: ${({ $maxHeight: e }) => e}px;
|
|
673
|
+
overflow-y: auto;
|
|
674
|
+
border-radius: var(--border-radius);
|
|
675
|
+
&::-webkit-scrollbar-track {
|
|
676
|
+
margin: var(--spacing-xxs) 0;
|
|
677
|
+
}
|
|
678
|
+
`, se = c.div`
|
|
679
|
+
display: flex;
|
|
680
|
+
font-size: var(--font-size-sm);
|
|
681
|
+
line-height: var(--line-height-sm);
|
|
682
|
+
font-weight: var(--font-weight-regular);
|
|
683
|
+
padding-right: var(--spacing-xxs);
|
|
684
|
+
`, Gn = c(se)`
|
|
685
|
+
background: var(--admonition-danger-bg-color);
|
|
686
|
+
color: var(--color-raspberry-7);
|
|
687
|
+
`, Kn = c(se)`
|
|
688
|
+
background: var(--admonition-success-bg-color);
|
|
689
|
+
color: var(--color-green-7);
|
|
690
|
+
`, qn = c(se)`
|
|
691
|
+
background: transparent;
|
|
692
|
+
color: var(--text-color-secondary);
|
|
693
|
+
`, Zn = c.span`
|
|
694
|
+
display: flex;
|
|
695
|
+
align-items: center;
|
|
696
|
+
justify-content: center;
|
|
697
|
+
min-width: 16px;
|
|
698
|
+
height: 20px;
|
|
699
|
+
flex-shrink: 0;
|
|
700
|
+
`, Se = c.span`
|
|
701
|
+
width: 100%;
|
|
702
|
+
min-width: 0;
|
|
703
|
+
line-height: var(--line-height-sm);
|
|
704
|
+
font-size: var(--font-size-sm);
|
|
705
|
+
font-weight: var(--font-weight-regular);
|
|
706
|
+
white-space: pre-wrap;
|
|
707
|
+
word-break: break-all;
|
|
708
|
+
`, Jn = c(se)`
|
|
709
|
+
user-select: none;
|
|
710
|
+
`, Xn = (e) => typeof e != "object" || e === null ? !1 : "kind" in e && e.kind === "batch" ? "changes" in e ? Array.isArray(e.changes) && e.changes.every(Ae) : !1 : Ae(e);
|
|
711
|
+
function Ae(e) {
|
|
712
|
+
return typeof e != "object" || e === null || !("id" in e) || !("target" in e) || !("included" in e) || !("kind" in e) ? !1 : e.kind === "single";
|
|
713
|
+
}
|
|
714
|
+
const Qn = {
|
|
715
|
+
approveLabel: "Approve",
|
|
716
|
+
denyLabel: "Deny"
|
|
717
|
+
};
|
|
718
|
+
function er(e, t) {
|
|
719
|
+
const n = T(t, "action");
|
|
720
|
+
if (n) {
|
|
721
|
+
const o = rn[n];
|
|
722
|
+
if (o) return o;
|
|
723
|
+
}
|
|
724
|
+
const r = on[e];
|
|
725
|
+
return r || Qn;
|
|
726
|
+
}
|
|
727
|
+
function T(e, t) {
|
|
728
|
+
if (!e || typeof e != "object") return null;
|
|
729
|
+
const n = e.payload;
|
|
730
|
+
if (!n || typeof n != "object") return null;
|
|
731
|
+
const r = n[t];
|
|
732
|
+
return typeof r != "string" ? null : r.trim() || null;
|
|
733
|
+
}
|
|
734
|
+
function Le(e, t) {
|
|
735
|
+
if (!(typeof t > "u"))
|
|
736
|
+
return e ? `${e}: ${t}` : t;
|
|
737
|
+
}
|
|
738
|
+
function tr(e) {
|
|
739
|
+
return e ? "changes" in e ? Array.isArray(e.changes) ? e.changes.map((t) => !t || typeof t != "object" || !("approved" in t) ? !1 : t.approved === !0) : [] : [] : [];
|
|
740
|
+
}
|
|
741
|
+
function nr(e, t) {
|
|
742
|
+
if (!e || typeof e != "object") return;
|
|
743
|
+
const n = oe(e, pe), r = oe(n, he);
|
|
744
|
+
if (!(t in r)) return;
|
|
745
|
+
const o = r[t];
|
|
746
|
+
if (Array.isArray(o) && o.length !== 0 && o.every(Xn))
|
|
747
|
+
return o;
|
|
748
|
+
}
|
|
749
|
+
function tt(e, t) {
|
|
750
|
+
return an(e) && Ze(e) && e.toolCallId === t;
|
|
751
|
+
}
|
|
752
|
+
function rr(e, t, n) {
|
|
753
|
+
const r = e.parts.map((d) => tt(d, t) ? { ...d, input: or(d.input, n) } : d), o = e.metadata && typeof e.metadata == "object" ? e.metadata : {}, a = oe(o, pe), l = { ...oe(a, he), [t]: Gt(n) };
|
|
754
|
+
return {
|
|
755
|
+
...e,
|
|
756
|
+
parts: r,
|
|
757
|
+
metadata: {
|
|
758
|
+
...o,
|
|
759
|
+
[pe]: {
|
|
760
|
+
...a,
|
|
761
|
+
[he]: l
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
function oe(e, t) {
|
|
767
|
+
const n = e[t];
|
|
768
|
+
return typeof n == "object" && n !== null ? n : {};
|
|
769
|
+
}
|
|
770
|
+
function or(e, t) {
|
|
771
|
+
if (!e || !("changes" in e) || !Array.isArray(e.changes)) return e;
|
|
772
|
+
const { changes: n, ...r } = e;
|
|
773
|
+
return {
|
|
774
|
+
...r,
|
|
775
|
+
changes: n.map((o, a) => ({
|
|
776
|
+
...o,
|
|
777
|
+
approved: t[a]?.included ?? !1
|
|
778
|
+
}))
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
function ir({
|
|
782
|
+
preview: e,
|
|
783
|
+
isIncluded: t,
|
|
784
|
+
onToggle: n,
|
|
785
|
+
readOnly: r
|
|
786
|
+
}) {
|
|
787
|
+
if (e.kind === "batch")
|
|
788
|
+
return /* @__PURE__ */ i(
|
|
789
|
+
Pe,
|
|
790
|
+
{
|
|
791
|
+
isIncluded: t,
|
|
792
|
+
onToggle: n,
|
|
793
|
+
readOnly: r,
|
|
794
|
+
primaryLabel: e.target.type,
|
|
795
|
+
children: /* @__PURE__ */ i(vr, { children: e.changes.map((l) => /* @__PURE__ */ i(
|
|
796
|
+
Ie,
|
|
797
|
+
{
|
|
798
|
+
oldValue: Le(l.target.key, l.oldValue),
|
|
799
|
+
newValue: Le(l.target.key, l.newValue)
|
|
800
|
+
},
|
|
801
|
+
l.id
|
|
802
|
+
)) })
|
|
803
|
+
}
|
|
804
|
+
);
|
|
805
|
+
const { target: o, oldValue: a, newValue: s } = e;
|
|
806
|
+
return /* @__PURE__ */ i(
|
|
807
|
+
Pe,
|
|
808
|
+
{
|
|
809
|
+
isIncluded: t,
|
|
810
|
+
onToggle: n,
|
|
811
|
+
readOnly: r,
|
|
812
|
+
primaryLabel: o.key ?? o.type,
|
|
813
|
+
categoryLabel: o.key ? o.type : void 0,
|
|
814
|
+
children: /* @__PURE__ */ i(Ie, { oldValue: a, newValue: s })
|
|
815
|
+
}
|
|
816
|
+
);
|
|
817
|
+
}
|
|
818
|
+
function Pe({
|
|
819
|
+
isIncluded: e,
|
|
820
|
+
onToggle: t,
|
|
821
|
+
readOnly: n,
|
|
822
|
+
primaryLabel: r,
|
|
823
|
+
categoryLabel: o,
|
|
824
|
+
children: a
|
|
825
|
+
}) {
|
|
826
|
+
return /* @__PURE__ */ h(ar, { $dimmed: n && !e, children: [
|
|
827
|
+
/* @__PURE__ */ h(sr, { children: [
|
|
828
|
+
n ? /* @__PURE__ */ i(pr, { children: e ? /* @__PURE__ */ i(hr, { size: "16px" }) : /* @__PURE__ */ i(gr, { size: "16px" }) }) : /* @__PURE__ */ h(ur, { children: [
|
|
829
|
+
/* @__PURE__ */ i(dr, { checked: e }),
|
|
830
|
+
/* @__PURE__ */ i(fr, { type: "checkbox", checked: e, onChange: t })
|
|
831
|
+
] }),
|
|
832
|
+
/* @__PURE__ */ i(cr, { children: r }),
|
|
833
|
+
o ? /* @__PURE__ */ i(lr, { children: o }) : null
|
|
834
|
+
] }),
|
|
835
|
+
a
|
|
836
|
+
] });
|
|
837
|
+
}
|
|
838
|
+
const ar = c.div`
|
|
839
|
+
display: flex;
|
|
840
|
+
flex-direction: column;
|
|
841
|
+
gap: var(--spacing-xs);
|
|
842
|
+
min-width: 0;
|
|
843
|
+
padding: var(--spacing-xs);
|
|
844
|
+
border-bottom: 1px solid var(--border-color-secondary);
|
|
845
|
+
box-sizing: border-box;
|
|
846
|
+
opacity: ${({ $dimmed: e }) => e ? 0.4 : 1};
|
|
847
|
+
&:last-child {
|
|
848
|
+
border-bottom: none;
|
|
849
|
+
}
|
|
850
|
+
`, sr = c.div`
|
|
851
|
+
display: flex;
|
|
852
|
+
align-items: center;
|
|
853
|
+
gap: var(--spacing-xs);
|
|
854
|
+
min-width: 0;
|
|
855
|
+
`, cr = c.span`
|
|
856
|
+
flex: 1;
|
|
857
|
+
min-width: 0;
|
|
858
|
+
color: var(--text-color-primary);
|
|
859
|
+
font-size: var(--font-size-sm);
|
|
860
|
+
font-weight: var(--font-weight-medium);
|
|
861
|
+
line-height: var(--line-height-sm);
|
|
862
|
+
overflow: hidden;
|
|
863
|
+
text-overflow: ellipsis;
|
|
864
|
+
white-space: nowrap;
|
|
865
|
+
`, lr = c.span`
|
|
866
|
+
flex-shrink: 0;
|
|
867
|
+
font-family: var(--code-block-font-family, var(--font-family-monospace, monospace));
|
|
868
|
+
font-size: var(--font-size-sm);
|
|
869
|
+
font-weight: var(--font-weight-regular);
|
|
870
|
+
line-height: var(--line-height-sm);
|
|
871
|
+
color: var(--text-color-secondary);
|
|
872
|
+
`, dr = c(At).attrs({ "aria-hidden": !0 })`
|
|
873
|
+
--checkbox-border-color: var(--color-blueberry-6);
|
|
874
|
+
--checkbox-box-color: var(--color-blueberry-6);
|
|
875
|
+
--checkbox-box-color-active: var(--color-blueberry-6);
|
|
876
|
+
`, ur = c.span`
|
|
877
|
+
position: relative;
|
|
878
|
+
display: inline-flex;
|
|
879
|
+
flex-shrink: 0;
|
|
880
|
+
width: 16px;
|
|
881
|
+
height: 16px;
|
|
882
|
+
`, fr = c.input`
|
|
883
|
+
position: absolute;
|
|
884
|
+
inset: 0;
|
|
885
|
+
width: 16px;
|
|
886
|
+
height: 16px;
|
|
887
|
+
margin: 0;
|
|
888
|
+
opacity: 0;
|
|
889
|
+
cursor: pointer;
|
|
890
|
+
`, pr = c.span`
|
|
891
|
+
display: inline-flex;
|
|
892
|
+
flex-shrink: 0;
|
|
893
|
+
width: 16px;
|
|
894
|
+
height: 16px;
|
|
895
|
+
align-items: center;
|
|
896
|
+
justify-content: center;
|
|
897
|
+
`, hr = c(It)`
|
|
898
|
+
color: var(--color-success-base);
|
|
899
|
+
`, gr = c(St)`
|
|
900
|
+
color: var(--text-color-description);
|
|
901
|
+
`, vr = c.div`
|
|
902
|
+
display: flex;
|
|
903
|
+
flex-direction: column;
|
|
904
|
+
gap: var(--spacing-xxs);
|
|
905
|
+
min-width: 0;
|
|
906
|
+
`;
|
|
907
|
+
function nt({
|
|
908
|
+
previews: e,
|
|
909
|
+
handleToggle: t,
|
|
910
|
+
readOnly: n
|
|
911
|
+
}) {
|
|
912
|
+
return e.length === 0 ? null : /* @__PURE__ */ i(mr, { children: e.map((r, o) => /* @__PURE__ */ i(
|
|
913
|
+
ir,
|
|
914
|
+
{
|
|
915
|
+
preview: r,
|
|
916
|
+
isIncluded: r.included,
|
|
917
|
+
onToggle: t ? () => t(o) : void 0,
|
|
918
|
+
readOnly: n
|
|
919
|
+
},
|
|
920
|
+
r.id
|
|
921
|
+
)) });
|
|
922
|
+
}
|
|
923
|
+
const mr = c.div`
|
|
924
|
+
display: flex;
|
|
925
|
+
flex-direction: column;
|
|
926
|
+
`, yr = {
|
|
927
|
+
update_step: br,
|
|
928
|
+
update_security: Cr,
|
|
929
|
+
run_request: Ir,
|
|
930
|
+
web_search: Sr,
|
|
931
|
+
manage_environment: kr,
|
|
932
|
+
manage_collection: Tr
|
|
933
|
+
};
|
|
934
|
+
function xr(e, t) {
|
|
935
|
+
const n = yr[e];
|
|
936
|
+
return n ? n(t) : wr(e);
|
|
937
|
+
}
|
|
938
|
+
function wr(e) {
|
|
939
|
+
return [{ kind: "text", text: e.split("_").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ") }];
|
|
940
|
+
}
|
|
941
|
+
function br(e) {
|
|
942
|
+
return rt(e, "Update step");
|
|
943
|
+
}
|
|
944
|
+
function Cr(e) {
|
|
945
|
+
return rt(e, "Update security");
|
|
946
|
+
}
|
|
947
|
+
function rt(e, t) {
|
|
948
|
+
const { collectionId: n, workflowId: r, stepId: o } = Ar(e);
|
|
949
|
+
return !n || !r || !o ? I(t) : ot(
|
|
950
|
+
`${t} `,
|
|
951
|
+
Qe({ collectionId: n, workflowId: r, stepId: o }),
|
|
952
|
+
o
|
|
953
|
+
);
|
|
954
|
+
}
|
|
955
|
+
function I(e) {
|
|
956
|
+
return [{ kind: "text", text: e }];
|
|
957
|
+
}
|
|
958
|
+
function E(e, t) {
|
|
959
|
+
return t ? `${e} "${t}"` : e;
|
|
960
|
+
}
|
|
961
|
+
function ot(e, t, n) {
|
|
962
|
+
return [
|
|
963
|
+
{ kind: "text", text: e },
|
|
964
|
+
{ kind: "link", href: t, label: n }
|
|
965
|
+
];
|
|
966
|
+
}
|
|
967
|
+
function kr(e) {
|
|
968
|
+
const t = T(e, "action"), n = T(e, "environment"), r = n ? ` in environment "${n}"` : "";
|
|
969
|
+
switch (t) {
|
|
970
|
+
case "add_environment":
|
|
971
|
+
return I(E("Add environment", n));
|
|
972
|
+
case "set_active_environment":
|
|
973
|
+
return I(
|
|
974
|
+
n ? `Switch active environment to ${n}` : "Switch active environment"
|
|
975
|
+
);
|
|
976
|
+
case "upsert_input":
|
|
977
|
+
return I(E("Set input", T(e, "name")) + r);
|
|
978
|
+
case "remove_input":
|
|
979
|
+
return I(
|
|
980
|
+
E("Remove input", T(e, "inputName")) + r
|
|
981
|
+
);
|
|
982
|
+
case "upsert_server":
|
|
983
|
+
return I(E("Set server", T(e, "apiId")) + r);
|
|
984
|
+
case "remove_server":
|
|
985
|
+
return I(
|
|
986
|
+
E("Remove server", T(e, "apiId")) + r
|
|
987
|
+
);
|
|
988
|
+
default:
|
|
989
|
+
return I("Manage environment");
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
function Tr(e) {
|
|
993
|
+
switch (T(e, "action")) {
|
|
994
|
+
case "create_collection":
|
|
995
|
+
return I(E("Create collection", T(e, "title")));
|
|
996
|
+
case "delete_collection":
|
|
997
|
+
return I(
|
|
998
|
+
E("Delete collection", T(e, "collectionId"))
|
|
999
|
+
);
|
|
1000
|
+
case "create_workflow":
|
|
1001
|
+
return I(E("Create workflow", T(e, "name")));
|
|
1002
|
+
case "delete_workflow":
|
|
1003
|
+
return I(E("Delete workflow", T(e, "workflowId")));
|
|
1004
|
+
case "create_step":
|
|
1005
|
+
return I(E("Create step", T(e, "stepName")));
|
|
1006
|
+
case "delete_step": {
|
|
1007
|
+
const n = T(e, "collectionId"), r = T(e, "workflowId"), o = T(e, "stepId");
|
|
1008
|
+
return !n || !r || !o ? I("Delete step") : ot(
|
|
1009
|
+
"Delete step ",
|
|
1010
|
+
Qe({ collectionId: n, workflowId: r, stepId: o }),
|
|
1011
|
+
o
|
|
1012
|
+
);
|
|
1013
|
+
}
|
|
1014
|
+
case "save_tab_to_collection":
|
|
1015
|
+
return I(
|
|
1016
|
+
E("Save tab as step", T(e, "newStepName"))
|
|
1017
|
+
);
|
|
1018
|
+
default:
|
|
1019
|
+
return I("Manage collection");
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
function Ir() {
|
|
1023
|
+
return [{ kind: "text", text: "Run current request" }];
|
|
1024
|
+
}
|
|
1025
|
+
function Sr(e) {
|
|
1026
|
+
return [
|
|
1027
|
+
{
|
|
1028
|
+
kind: "text",
|
|
1029
|
+
text: "Search the web at "
|
|
1030
|
+
},
|
|
1031
|
+
{
|
|
1032
|
+
kind: "link",
|
|
1033
|
+
href: e.url,
|
|
1034
|
+
label: e.url
|
|
1035
|
+
}
|
|
1036
|
+
];
|
|
1037
|
+
}
|
|
1038
|
+
function Ar(e) {
|
|
1039
|
+
return {
|
|
1040
|
+
collectionId: de(e, "collectionId"),
|
|
1041
|
+
workflowId: de(e, "workflowId"),
|
|
1042
|
+
stepId: de(e, "stepId")
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1045
|
+
function de(e, t) {
|
|
1046
|
+
if (!e || !(t in e)) return null;
|
|
1047
|
+
const n = e[t];
|
|
1048
|
+
return typeof n == "string" && n.trim() || null;
|
|
1049
|
+
}
|
|
1050
|
+
function it({ toolName: e, input: t }) {
|
|
1051
|
+
const n = xr(e, t), r = et();
|
|
1052
|
+
return /* @__PURE__ */ i(Lr, { onClick: r, children: /* @__PURE__ */ i(Pr, { children: n.map(
|
|
1053
|
+
(o, a) => o.kind === "text" ? /* @__PURE__ */ i("span", { children: o.text }, a) : /* @__PURE__ */ i(Er, { href: o.href, children: o.label }, a)
|
|
1054
|
+
) }) });
|
|
1055
|
+
}
|
|
1056
|
+
const Lr = c.div`
|
|
1057
|
+
display: flex;
|
|
1058
|
+
flex-direction: column;
|
|
1059
|
+
gap: 0;
|
|
1060
|
+
min-width: 0;
|
|
1061
|
+
padding: var(--spacing-xs) var(--spacing-sm);
|
|
1062
|
+
|
|
1063
|
+
&:not(:last-child) {
|
|
1064
|
+
border-bottom: 1px solid var(--border-color-secondary);
|
|
1065
|
+
}
|
|
1066
|
+
`, Pr = c.span`
|
|
1067
|
+
font-family: var(--font-family-base);
|
|
1068
|
+
font-size: var(--font-size-sm);
|
|
1069
|
+
font-weight: var(--font-weight-regular);
|
|
1070
|
+
line-height: var(--line-height-sm);
|
|
1071
|
+
color: var(--text-color-primary);
|
|
1072
|
+
`, Er = c.a`
|
|
1073
|
+
color: var(--link-color-primary);
|
|
1074
|
+
cursor: pointer;
|
|
1075
|
+
text-decoration: none;
|
|
1076
|
+
|
|
1077
|
+
&:hover {
|
|
1078
|
+
color: var(--link-color-primary, var(--text-color-link));
|
|
1079
|
+
}
|
|
1080
|
+
`;
|
|
1081
|
+
function C({
|
|
1082
|
+
id: e,
|
|
1083
|
+
targetType: t,
|
|
1084
|
+
targetKey: n,
|
|
1085
|
+
oldValue: r,
|
|
1086
|
+
newValue: o
|
|
1087
|
+
}) {
|
|
1088
|
+
return {
|
|
1089
|
+
kind: "single",
|
|
1090
|
+
id: e,
|
|
1091
|
+
target: n === void 0 ? { type: t } : { type: t, key: n },
|
|
1092
|
+
oldValue: r,
|
|
1093
|
+
newValue: o,
|
|
1094
|
+
included: !0
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
function _(e, t) {
|
|
1098
|
+
return C({ id: e, targetType: t, oldValue: void 0, newValue: void 0 });
|
|
1099
|
+
}
|
|
1100
|
+
function G({
|
|
1101
|
+
data: e,
|
|
1102
|
+
baseId: t,
|
|
1103
|
+
targetType: n,
|
|
1104
|
+
batchTargetKey: r,
|
|
1105
|
+
getOldValue: o,
|
|
1106
|
+
getNewValue: a = (l, d) => String(d ?? ""),
|
|
1107
|
+
resolveTargetKey: s = (l) => l
|
|
1108
|
+
}) {
|
|
1109
|
+
const l = Object.entries(e).filter(([, f]) => f !== void 0);
|
|
1110
|
+
if (l.length === 0)
|
|
1111
|
+
return _(t, n);
|
|
1112
|
+
if (l.length >= 2) {
|
|
1113
|
+
const f = l.map(
|
|
1114
|
+
([g, m]) => C({
|
|
1115
|
+
id: `${t}:${g}`,
|
|
1116
|
+
targetType: n,
|
|
1117
|
+
targetKey: s(g),
|
|
1118
|
+
oldValue: o(g),
|
|
1119
|
+
newValue: a(g, m)
|
|
1120
|
+
})
|
|
1121
|
+
);
|
|
1122
|
+
return { kind: "batch", id: t, target: r !== void 0 ? { type: n, key: r } : { type: n }, changes: f, included: !0 };
|
|
1123
|
+
}
|
|
1124
|
+
const [d, u] = l[0];
|
|
1125
|
+
return C({
|
|
1126
|
+
id: t,
|
|
1127
|
+
targetType: n,
|
|
1128
|
+
targetKey: s(d),
|
|
1129
|
+
oldValue: o(d),
|
|
1130
|
+
newValue: a(d, u)
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
function Rr({
|
|
1134
|
+
store: e,
|
|
1135
|
+
input: t
|
|
1136
|
+
}) {
|
|
1137
|
+
if (!Or(t)) return [];
|
|
1138
|
+
const n = /* @__PURE__ */ new Map(), r = (o) => {
|
|
1139
|
+
const a = n.get(o);
|
|
1140
|
+
if (a) return a;
|
|
1141
|
+
const s = Je(e, t.collectionId, t.workflowId, o), l = s.ok ? s.value : null, d = l ? Array.from(l.security.get({ noproxy: !0 })) : [];
|
|
1142
|
+
return n.set(o, d), d;
|
|
1143
|
+
};
|
|
1144
|
+
return t.changes.map((o, a) => {
|
|
1145
|
+
const s = o.stepId?.trim(), l = s || t.stepId;
|
|
1146
|
+
return $r(r(l), o, a, s);
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
function Or(e) {
|
|
1150
|
+
if (typeof e != "object" || e === null) return !1;
|
|
1151
|
+
const t = e;
|
|
1152
|
+
return typeof t.collectionId == "string" && typeof t.workflowId == "string" && typeof t.stepId == "string" && Array.isArray(t.changes) && t.changes.length > 0;
|
|
1153
|
+
}
|
|
1154
|
+
function H(e, t) {
|
|
1155
|
+
return e ? t ? `${e}: ${t}` : e : t;
|
|
1156
|
+
}
|
|
1157
|
+
function $r(e, t, n, r) {
|
|
1158
|
+
const o = `security[${n}]`;
|
|
1159
|
+
switch (t.action) {
|
|
1160
|
+
case k.ADD: {
|
|
1161
|
+
const { type: a, schemeId: s, data: l } = t;
|
|
1162
|
+
return !l || Object.keys(l).length === 0 ? C({
|
|
1163
|
+
id: o,
|
|
1164
|
+
targetType: a,
|
|
1165
|
+
targetKey: H(r, s),
|
|
1166
|
+
oldValue: void 0,
|
|
1167
|
+
newValue: a
|
|
1168
|
+
}) : G({
|
|
1169
|
+
data: l,
|
|
1170
|
+
baseId: o,
|
|
1171
|
+
targetType: a,
|
|
1172
|
+
batchTargetKey: H(r, s),
|
|
1173
|
+
getOldValue: () => {
|
|
1174
|
+
},
|
|
1175
|
+
resolveTargetKey: (d) => H(r, d)
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
case k.UPDATE: {
|
|
1179
|
+
const { type: a, schemeId: s, data: l } = t, d = t.index !== void 0 ? e[t.index] : void 0;
|
|
1180
|
+
return !l || Object.keys(l).length === 0 ? C({
|
|
1181
|
+
id: o,
|
|
1182
|
+
targetType: a,
|
|
1183
|
+
targetKey: H(r, s),
|
|
1184
|
+
oldValue: Re(d),
|
|
1185
|
+
newValue: a
|
|
1186
|
+
}) : G({
|
|
1187
|
+
data: l,
|
|
1188
|
+
baseId: o,
|
|
1189
|
+
targetType: a,
|
|
1190
|
+
batchTargetKey: H(r, s),
|
|
1191
|
+
getOldValue: (u) => d ? Dr(d, u) : void 0,
|
|
1192
|
+
resolveTargetKey: (u) => H(r, u)
|
|
1193
|
+
});
|
|
1194
|
+
}
|
|
1195
|
+
case k.REMOVE: {
|
|
1196
|
+
const a = sn(e, t), s = a.ok ? a.entry : void 0;
|
|
1197
|
+
return C({
|
|
1198
|
+
id: o,
|
|
1199
|
+
targetType: s?.securityType ?? "Security",
|
|
1200
|
+
targetKey: H(r, st(s)),
|
|
1201
|
+
oldValue: Re(s),
|
|
1202
|
+
newValue: void 0
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
function Dr(e, t) {
|
|
1208
|
+
switch (e.securityType) {
|
|
1209
|
+
case N.NoAuth:
|
|
1210
|
+
return;
|
|
1211
|
+
case N.OAuth2:
|
|
1212
|
+
return Ee(e[N.OAuth2], t);
|
|
1213
|
+
case N.OpenIDConnect: {
|
|
1214
|
+
const n = e[N.OpenIDConnect];
|
|
1215
|
+
return t === "openIdConnectUrl" ? n.openIdConnectUrl || void 0 : t === "userInfoUrl" ? n.userInfoUrl || void 0 : Ee(n, t);
|
|
1216
|
+
}
|
|
1217
|
+
default: {
|
|
1218
|
+
const n = e[e.securityType];
|
|
1219
|
+
return at(n, t);
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
function Ee(e, t) {
|
|
1224
|
+
if (t === "grantType") return e.grantType || void 0;
|
|
1225
|
+
if (!e.grantType) return;
|
|
1226
|
+
const n = e[e.grantType];
|
|
1227
|
+
return at(n, t);
|
|
1228
|
+
}
|
|
1229
|
+
function at(e, t) {
|
|
1230
|
+
const n = e[t];
|
|
1231
|
+
return n !== void 0 && n !== "" ? String(n) : void 0;
|
|
1232
|
+
}
|
|
1233
|
+
function Re(e) {
|
|
1234
|
+
if (!e || e.securityType === N.NoAuth) return;
|
|
1235
|
+
const t = st(e);
|
|
1236
|
+
return t ? `${e.securityType} (${t})` : e.securityType;
|
|
1237
|
+
}
|
|
1238
|
+
function st(e) {
|
|
1239
|
+
return !e || e.securityType === N.NoAuth ? void 0 : e[e.securityType]?.schemeName || void 0;
|
|
1240
|
+
}
|
|
1241
|
+
function Mr({
|
|
1242
|
+
store: e,
|
|
1243
|
+
input: t
|
|
1244
|
+
}) {
|
|
1245
|
+
if (!zr(t)) return [];
|
|
1246
|
+
const n = Je(e, t.collectionId, t.workflowId, t.stepId), r = n.ok ? n.value : null;
|
|
1247
|
+
return t.changes.map((o, a) => _r(r, o, a));
|
|
1248
|
+
}
|
|
1249
|
+
function zr(e) {
|
|
1250
|
+
return typeof e != "object" || e === null ? !1 : "collectionId" in e && "workflowId" in e && "stepId" in e && "changes" in e && Array.isArray(e.changes) && e.changes.length > 0 && typeof e.collectionId == "string" && typeof e.workflowId == "string" && typeof e.stepId == "string";
|
|
1251
|
+
}
|
|
1252
|
+
function _r(e, t, n) {
|
|
1253
|
+
const r = t.id ?? `${t.field}[${n}]`;
|
|
1254
|
+
switch (t.field) {
|
|
1255
|
+
case "method":
|
|
1256
|
+
case "url":
|
|
1257
|
+
case "description":
|
|
1258
|
+
return Vr(e, t, r);
|
|
1259
|
+
case "parameters":
|
|
1260
|
+
return Hr(e, t, r);
|
|
1261
|
+
case "outputs":
|
|
1262
|
+
return Br(e, t, r);
|
|
1263
|
+
case "body":
|
|
1264
|
+
return Nr(e, t, r);
|
|
1265
|
+
case "successCriteria":
|
|
1266
|
+
return Fr(e, t, r);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
function Vr(e, t, n) {
|
|
1270
|
+
const r = ee(t.field);
|
|
1271
|
+
switch (t.action) {
|
|
1272
|
+
case k.ADD:
|
|
1273
|
+
return C({
|
|
1274
|
+
id: n,
|
|
1275
|
+
targetType: r,
|
|
1276
|
+
oldValue: void 0,
|
|
1277
|
+
newValue: t.data
|
|
1278
|
+
});
|
|
1279
|
+
case k.UPDATE:
|
|
1280
|
+
return C({
|
|
1281
|
+
id: n,
|
|
1282
|
+
targetType: r,
|
|
1283
|
+
oldValue: Oe(e, t.field),
|
|
1284
|
+
newValue: t.data
|
|
1285
|
+
});
|
|
1286
|
+
case k.REMOVE:
|
|
1287
|
+
return C({
|
|
1288
|
+
id: n,
|
|
1289
|
+
targetType: r,
|
|
1290
|
+
oldValue: Oe(e, t.field),
|
|
1291
|
+
newValue: void 0
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
function Hr(e, t, n) {
|
|
1296
|
+
switch (t.action) {
|
|
1297
|
+
case k.ADD: {
|
|
1298
|
+
if (!t.data) return _(n, "parameter");
|
|
1299
|
+
const { in: r, name: o, value: a } = t.data;
|
|
1300
|
+
return C({
|
|
1301
|
+
id: n,
|
|
1302
|
+
targetType: ee(r),
|
|
1303
|
+
targetKey: o,
|
|
1304
|
+
oldValue: void 0,
|
|
1305
|
+
newValue: a
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1308
|
+
case k.UPDATE: {
|
|
1309
|
+
if (!t.id && !t.data?.name) return _(n, "parameter");
|
|
1310
|
+
const r = $e(e, t), o = t.data?.in ?? r?.in ?? "parameter";
|
|
1311
|
+
return C({
|
|
1312
|
+
id: n,
|
|
1313
|
+
targetType: ee(o),
|
|
1314
|
+
targetKey: t.data?.name ?? r?.key,
|
|
1315
|
+
oldValue: r ? r.value ?? "" : void 0,
|
|
1316
|
+
newValue: t.data?.value
|
|
1317
|
+
});
|
|
1318
|
+
}
|
|
1319
|
+
case k.REMOVE: {
|
|
1320
|
+
if (!t.id && !t.data?.name) return _(n, "parameter");
|
|
1321
|
+
const r = $e(e, t), o = t.data?.in ?? r?.in ?? "parameter";
|
|
1322
|
+
return C({
|
|
1323
|
+
id: n,
|
|
1324
|
+
targetType: ee(o),
|
|
1325
|
+
targetKey: r?.key ?? t.data?.name,
|
|
1326
|
+
oldValue: r ? r.value ?? "" : void 0,
|
|
1327
|
+
newValue: void 0
|
|
1328
|
+
});
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
function Br(e, t, n) {
|
|
1333
|
+
switch (t.action) {
|
|
1334
|
+
case k.ADD:
|
|
1335
|
+
return t.data ? C({
|
|
1336
|
+
id: n,
|
|
1337
|
+
targetType: "Output",
|
|
1338
|
+
targetKey: t.data.name,
|
|
1339
|
+
oldValue: void 0,
|
|
1340
|
+
newValue: t.data.expression
|
|
1341
|
+
}) : C({
|
|
1342
|
+
id: n,
|
|
1343
|
+
targetType: "Output",
|
|
1344
|
+
oldValue: void 0,
|
|
1345
|
+
newValue: void 0
|
|
1346
|
+
});
|
|
1347
|
+
case k.UPDATE: {
|
|
1348
|
+
if (!t.data)
|
|
1349
|
+
return C({
|
|
1350
|
+
id: n,
|
|
1351
|
+
targetType: "Output",
|
|
1352
|
+
oldValue: void 0,
|
|
1353
|
+
newValue: void 0
|
|
1354
|
+
});
|
|
1355
|
+
const r = t.id && e ? Me(e, t.id) : void 0;
|
|
1356
|
+
return C({
|
|
1357
|
+
id: n,
|
|
1358
|
+
targetType: "Output",
|
|
1359
|
+
targetKey: t.data.name,
|
|
1360
|
+
oldValue: r?.value,
|
|
1361
|
+
newValue: t.data.expression
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1364
|
+
case k.REMOVE: {
|
|
1365
|
+
if (!t.id && !t.data?.name) return _(n, "Output");
|
|
1366
|
+
let r = t.id && e ? Me(e, t.id) : void 0;
|
|
1367
|
+
return !r && e && t.data?.name && (r = Ur(e, t.data.name)), C({
|
|
1368
|
+
id: n,
|
|
1369
|
+
targetType: "Output",
|
|
1370
|
+
targetKey: r?.key ?? t.data?.name,
|
|
1371
|
+
oldValue: r?.value,
|
|
1372
|
+
newValue: void 0
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
function Nr(e, t, n) {
|
|
1378
|
+
const { data: r } = t;
|
|
1379
|
+
switch (t.action) {
|
|
1380
|
+
case k.ADD:
|
|
1381
|
+
return G({
|
|
1382
|
+
data: r,
|
|
1383
|
+
baseId: n,
|
|
1384
|
+
targetType: "Body",
|
|
1385
|
+
getOldValue: () => {
|
|
1386
|
+
},
|
|
1387
|
+
getNewValue: (o) => o === "content" ? ue(r.content, r.contentType) : ae(r[o]),
|
|
1388
|
+
resolveTargetKey: (o) => o === "content" ? void 0 : o
|
|
1389
|
+
});
|
|
1390
|
+
case k.UPDATE: {
|
|
1391
|
+
const o = e?.requestBody.type.get(), a = r.contentType ?? o;
|
|
1392
|
+
return G({
|
|
1393
|
+
data: r,
|
|
1394
|
+
baseId: n,
|
|
1395
|
+
targetType: "Body",
|
|
1396
|
+
getOldValue: (s) => {
|
|
1397
|
+
if (e) {
|
|
1398
|
+
if (s === "content")
|
|
1399
|
+
return ue(e.requestBody.content.get(), o) || void 0;
|
|
1400
|
+
if (s === "contentType") return o;
|
|
1401
|
+
}
|
|
1402
|
+
},
|
|
1403
|
+
getNewValue: (s) => s === "content" ? ue(r.content, a) : ae(r[s]),
|
|
1404
|
+
resolveTargetKey: (s) => s === "content" ? void 0 : s
|
|
1405
|
+
});
|
|
1406
|
+
}
|
|
1407
|
+
case k.REMOVE: {
|
|
1408
|
+
const o = e ? me({
|
|
1409
|
+
contentType: e.requestBody.type.get(),
|
|
1410
|
+
content: e.requestBody.content.get()
|
|
1411
|
+
}) : void 0;
|
|
1412
|
+
return C({
|
|
1413
|
+
id: n,
|
|
1414
|
+
targetType: "Body",
|
|
1415
|
+
oldValue: o,
|
|
1416
|
+
newValue: void 0
|
|
1417
|
+
});
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
function Fr(e, t, n) {
|
|
1422
|
+
switch (t.action) {
|
|
1423
|
+
case k.ADD:
|
|
1424
|
+
return t.data ? G({
|
|
1425
|
+
data: t.data,
|
|
1426
|
+
baseId: n,
|
|
1427
|
+
targetType: "successCriteria",
|
|
1428
|
+
getOldValue: () => {
|
|
1429
|
+
},
|
|
1430
|
+
getNewValue: (r) => ae(t.data[r])
|
|
1431
|
+
}) : _(n, "successCriteria");
|
|
1432
|
+
case k.UPDATE: {
|
|
1433
|
+
if (!t.data) return _(n, "successCriteria");
|
|
1434
|
+
const r = typeof t.id == "string" && e ? De(e, t.id) : void 0;
|
|
1435
|
+
return G({
|
|
1436
|
+
data: t.data,
|
|
1437
|
+
baseId: n,
|
|
1438
|
+
targetType: "successCriteria",
|
|
1439
|
+
getOldValue: (o) => {
|
|
1440
|
+
if (r) {
|
|
1441
|
+
if (o === "condition") return r.condition;
|
|
1442
|
+
if (o === "context") return r.context ?? void 0;
|
|
1443
|
+
if (o === "type") return r.type;
|
|
1444
|
+
}
|
|
1445
|
+
},
|
|
1446
|
+
getNewValue: (o) => ae(t.data[o])
|
|
1447
|
+
});
|
|
1448
|
+
}
|
|
1449
|
+
case k.REMOVE: {
|
|
1450
|
+
if (typeof t.id != "string") return _(n, "successCriteria");
|
|
1451
|
+
const r = e ? De(e, t.id) : void 0;
|
|
1452
|
+
return C({
|
|
1453
|
+
id: n,
|
|
1454
|
+
targetType: "successCriteria",
|
|
1455
|
+
targetKey: r?.condition,
|
|
1456
|
+
oldValue: r ? me(r) : void 0,
|
|
1457
|
+
newValue: void 0
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
function Oe(e, t) {
|
|
1463
|
+
if (e)
|
|
1464
|
+
switch (t) {
|
|
1465
|
+
case "method":
|
|
1466
|
+
return e.xOperation.ornull?.method.get();
|
|
1467
|
+
case "url":
|
|
1468
|
+
return e.xOperation.ornull?.url.get();
|
|
1469
|
+
case "description":
|
|
1470
|
+
return e.description.get();
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
function $e(e, t) {
|
|
1474
|
+
let n = t.id && e ? jr(e, t.id) : null;
|
|
1475
|
+
return !n && e && t.data?.name && (n = Wr(e, t.data.name)), n;
|
|
1476
|
+
}
|
|
1477
|
+
function ct(e, t) {
|
|
1478
|
+
for (const n of ["path", "query", "header", "cookie"]) {
|
|
1479
|
+
const r = e.parameters[cn[n]].get().find((o) => Kt(o) && t(o));
|
|
1480
|
+
if (r) return r;
|
|
1481
|
+
}
|
|
1482
|
+
return null;
|
|
1483
|
+
}
|
|
1484
|
+
function jr(e, t) {
|
|
1485
|
+
return ct(e, (n) => n.id === t);
|
|
1486
|
+
}
|
|
1487
|
+
function Wr(e, t) {
|
|
1488
|
+
return ct(e, (n) => n.key === t);
|
|
1489
|
+
}
|
|
1490
|
+
function De(e, t) {
|
|
1491
|
+
return e.successCriteria.get().find((n) => n.condition === t);
|
|
1492
|
+
}
|
|
1493
|
+
function lt(e, t) {
|
|
1494
|
+
for (const n of e.outputs.get())
|
|
1495
|
+
if (t(n))
|
|
1496
|
+
return {
|
|
1497
|
+
key: ie(n.key),
|
|
1498
|
+
value: ie(n.value)
|
|
1499
|
+
};
|
|
1500
|
+
}
|
|
1501
|
+
function Me(e, t) {
|
|
1502
|
+
return lt(e, (n) => ie(n.id) === t);
|
|
1503
|
+
}
|
|
1504
|
+
function Ur(e, t) {
|
|
1505
|
+
return lt(e, (n) => ie(n.key) === t);
|
|
1506
|
+
}
|
|
1507
|
+
function ie(e) {
|
|
1508
|
+
return typeof e == "string" ? e : e.get();
|
|
1509
|
+
}
|
|
1510
|
+
function ae(e) {
|
|
1511
|
+
return e == null ? "" : typeof e == "string" ? e : me(e);
|
|
1512
|
+
}
|
|
1513
|
+
function ue(e, t) {
|
|
1514
|
+
if (!e || t !== qt.JSON) return e;
|
|
1515
|
+
try {
|
|
1516
|
+
return JSON.stringify(JSON.parse(e), null, 2);
|
|
1517
|
+
} catch {
|
|
1518
|
+
return e;
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
const Yr = {
|
|
1522
|
+
update_security: Rr,
|
|
1523
|
+
update_step: Mr
|
|
1524
|
+
};
|
|
1525
|
+
function dt(e, t) {
|
|
1526
|
+
const n = Ye(), r = S(() => {
|
|
1527
|
+
const d = e ? Yr[e] : void 0;
|
|
1528
|
+
if (!d) return [];
|
|
1529
|
+
try {
|
|
1530
|
+
return d({ store: n, input: t });
|
|
1531
|
+
} catch (u) {
|
|
1532
|
+
return console.error("Unable to build change previews", u), [];
|
|
1533
|
+
}
|
|
1534
|
+
}, [e, n, t]), [o, a] = K(
|
|
1535
|
+
() => Object.fromEntries(r.map((d) => [d.id, d.included]))
|
|
1536
|
+
), s = S(
|
|
1537
|
+
() => r.map((d) => ({ ...d, included: o[d.id] ?? d.included })),
|
|
1538
|
+
[r, o]
|
|
1539
|
+
), l = $(
|
|
1540
|
+
(d) => {
|
|
1541
|
+
a(typeof d == "function" ? (u) => {
|
|
1542
|
+
const f = r.map((p) => ({
|
|
1543
|
+
...p,
|
|
1544
|
+
included: u[p.id] ?? p.included
|
|
1545
|
+
}));
|
|
1546
|
+
return Object.fromEntries(d(f).map((p) => [p.id, p.included]));
|
|
1547
|
+
} : Object.fromEntries(d.map((u) => [u.id, u.included])));
|
|
1548
|
+
},
|
|
1549
|
+
[r]
|
|
1550
|
+
);
|
|
1551
|
+
return { previews: s, setPreviews: l };
|
|
1552
|
+
}
|
|
1553
|
+
function Gr({
|
|
1554
|
+
toolCallId: e,
|
|
1555
|
+
toolName: t,
|
|
1556
|
+
input: n,
|
|
1557
|
+
onApprove: r,
|
|
1558
|
+
onDeny: o
|
|
1559
|
+
}) {
|
|
1560
|
+
const { updateMessages: a } = q(), { previews: s, setPreviews: l } = dt(t, n), { includedCount: d, totalCount: u } = S(
|
|
1561
|
+
() => ({
|
|
1562
|
+
includedCount: s.filter((v) => v.included).length,
|
|
1563
|
+
totalCount: s.length
|
|
1564
|
+
}),
|
|
1565
|
+
[s]
|
|
1566
|
+
), { approveLabel: f, denyLabel: p } = S(
|
|
1567
|
+
() => er(t, n),
|
|
1568
|
+
[t, n]
|
|
1569
|
+
), g = $(() => {
|
|
1570
|
+
a((v) => {
|
|
1571
|
+
const x = [];
|
|
1572
|
+
for (let w = 0; w < v.length; w++) {
|
|
1573
|
+
const b = v[w], { parts: y } = b, A = b.role === "assistant", z = y.some(
|
|
1574
|
+
(P) => tt(P, e)
|
|
1575
|
+
);
|
|
1576
|
+
if (A && z) {
|
|
1577
|
+
const P = rr(b, e, s);
|
|
1578
|
+
x.push({ index: w, message: P });
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
return x;
|
|
1582
|
+
}), r();
|
|
1583
|
+
}, [s, r, a, e]), m = $(
|
|
1584
|
+
(v) => {
|
|
1585
|
+
l(
|
|
1586
|
+
(x) => x.map(
|
|
1587
|
+
(w, b) => b === v ? { ...w, included: !w.included } : w
|
|
1588
|
+
)
|
|
1589
|
+
);
|
|
1590
|
+
},
|
|
1591
|
+
[l]
|
|
1592
|
+
);
|
|
1593
|
+
return /* @__PURE__ */ h(Kr, { children: [
|
|
1594
|
+
/* @__PURE__ */ i(it, { toolName: t, input: n }),
|
|
1595
|
+
s.length ? /* @__PURE__ */ i(qr, { children: /* @__PURE__ */ i(nt, { previews: s, handleToggle: m }) }) : null,
|
|
1596
|
+
s.length ? /* @__PURE__ */ i(Ge, {}) : null,
|
|
1597
|
+
/* @__PURE__ */ h(Zr, { children: [
|
|
1598
|
+
u > 1 ? /* @__PURE__ */ h(Jr, { children: [
|
|
1599
|
+
d,
|
|
1600
|
+
" of ",
|
|
1601
|
+
u,
|
|
1602
|
+
" selected"
|
|
1603
|
+
] }) : null,
|
|
1604
|
+
/* @__PURE__ */ i(Xr, { size: "small", variant: "secondary", onClick: o, children: p }),
|
|
1605
|
+
/* @__PURE__ */ i(
|
|
1606
|
+
Qr,
|
|
1607
|
+
{
|
|
1608
|
+
size: "small",
|
|
1609
|
+
variant: "primary",
|
|
1610
|
+
onClick: g,
|
|
1611
|
+
disabled: u > 0 ? d === 0 : !1,
|
|
1612
|
+
children: f
|
|
1613
|
+
}
|
|
1614
|
+
)
|
|
1615
|
+
] })
|
|
1616
|
+
] });
|
|
1617
|
+
}
|
|
1618
|
+
const Kr = c.div`
|
|
1619
|
+
display: flex;
|
|
1620
|
+
color: var(--text-color-primary);
|
|
1621
|
+
flex-direction: column;
|
|
1622
|
+
gap: var(--spacing-xs);
|
|
1623
|
+
width: 100%;
|
|
1624
|
+
min-width: 0;
|
|
1625
|
+
border-radius: var(--border-radius-md, 10px);
|
|
1626
|
+
border: 1px solid var(--border-color-secondary);
|
|
1627
|
+
background: var(--layer-color);
|
|
1628
|
+
line-height: var(--line-height-sm);
|
|
1629
|
+
`, qr = c.div`
|
|
1630
|
+
display: flex;
|
|
1631
|
+
flex-direction: column;
|
|
1632
|
+
gap: var(--spacing-xs);
|
|
1633
|
+
min-width: 0;
|
|
1634
|
+
`, Zr = c.div`
|
|
1635
|
+
display: flex;
|
|
1636
|
+
flex-wrap: wrap;
|
|
1637
|
+
justify-content: flex-end;
|
|
1638
|
+
align-items: center;
|
|
1639
|
+
padding: 0 var(--spacing-sm) var(--spacing-xs) var(--spacing-sm);
|
|
1640
|
+
gap: var(--spacing-xxs);
|
|
1641
|
+
`, Jr = c.span`
|
|
1642
|
+
flex: 1;
|
|
1643
|
+
font-size: var(--font-size-sm);
|
|
1644
|
+
font-weight: var(--font-weight-regular);
|
|
1645
|
+
line-height: var(--line-height-sm);
|
|
1646
|
+
color: var(--text-color-secondary);
|
|
1647
|
+
`, Xr = c(V)`
|
|
1648
|
+
background: none;
|
|
1649
|
+
`, Qr = c(V)`
|
|
1650
|
+
border: 1px solid var(--button-bg-color);
|
|
1651
|
+
padding-top: 0;
|
|
1652
|
+
padding-bottom: 0;
|
|
1653
|
+
&:disabled {
|
|
1654
|
+
border: 1px solid var(--button-border-color-disabled);
|
|
1655
|
+
}
|
|
1656
|
+
`;
|
|
1657
|
+
function eo({
|
|
1658
|
+
approvalId: e,
|
|
1659
|
+
toolCallId: t,
|
|
1660
|
+
toolName: n,
|
|
1661
|
+
input: r
|
|
1662
|
+
}) {
|
|
1663
|
+
const { addToolApprovalResponse: o } = q(), a = $(() => {
|
|
1664
|
+
o({ id: e, approved: !0 });
|
|
1665
|
+
}, [e, o]), s = $(() => {
|
|
1666
|
+
o({ id: e, approved: !1 });
|
|
1667
|
+
}, [e, o]);
|
|
1668
|
+
return /* @__PURE__ */ i(
|
|
1669
|
+
Gr,
|
|
1670
|
+
{
|
|
1671
|
+
onApprove: a,
|
|
1672
|
+
onDeny: s,
|
|
1673
|
+
toolCallId: t,
|
|
1674
|
+
toolName: n,
|
|
1675
|
+
input: r
|
|
1676
|
+
}
|
|
1677
|
+
);
|
|
1678
|
+
}
|
|
1679
|
+
function to({
|
|
1680
|
+
toolName: e,
|
|
1681
|
+
toolCallId: t,
|
|
1682
|
+
input: n,
|
|
1683
|
+
isDenied: r,
|
|
1684
|
+
messageMetadata: o,
|
|
1685
|
+
onUndo: a
|
|
1686
|
+
}) {
|
|
1687
|
+
const s = S(
|
|
1688
|
+
() => nr(o, t),
|
|
1689
|
+
[o, t]
|
|
1690
|
+
), { previews: l } = dt(
|
|
1691
|
+
s ? void 0 : e,
|
|
1692
|
+
n
|
|
1693
|
+
), d = S(() => {
|
|
1694
|
+
const g = s ?? l;
|
|
1695
|
+
if (r)
|
|
1696
|
+
return g.map((v) => ({ ...v, included: !1 }));
|
|
1697
|
+
const m = tr(n);
|
|
1698
|
+
return g.map((v, x) => ({
|
|
1699
|
+
...v,
|
|
1700
|
+
included: m[x] ?? v.included
|
|
1701
|
+
}));
|
|
1702
|
+
}, [s, l, n, r]);
|
|
1703
|
+
if (d.length === 0)
|
|
1704
|
+
return null;
|
|
1705
|
+
const u = d.filter((g) => g.included).length, p = u === 0 ? "Nothing applied" : `${u} ${u === 1 ? "change" : "changes"} applied`;
|
|
1706
|
+
return /* @__PURE__ */ h(no, { children: [
|
|
1707
|
+
/* @__PURE__ */ i(it, { toolName: e, input: n }),
|
|
1708
|
+
/* @__PURE__ */ i(ro, { children: /* @__PURE__ */ i(nt, { previews: d, readOnly: !0 }) }),
|
|
1709
|
+
/* @__PURE__ */ i(Ge, {}),
|
|
1710
|
+
/* @__PURE__ */ h(oo, { children: [
|
|
1711
|
+
/* @__PURE__ */ i(io, { children: p }),
|
|
1712
|
+
a ? /* @__PURE__ */ i(ao, { size: "small", variant: "outlined", onClick: a, children: "Undo" }) : null
|
|
1713
|
+
] })
|
|
1714
|
+
] });
|
|
1715
|
+
}
|
|
1716
|
+
const no = c.div`
|
|
1717
|
+
display: flex;
|
|
1718
|
+
color: var(--text-color-primary);
|
|
1719
|
+
flex-direction: column;
|
|
1720
|
+
width: 100%;
|
|
1721
|
+
min-width: 0;
|
|
1722
|
+
border-radius: var(--border-radius-md, 10px);
|
|
1723
|
+
border: 1px solid var(--border-color-secondary);
|
|
1724
|
+
background: var(--layer-color);
|
|
1725
|
+
line-height: var(--line-height-sm);
|
|
1726
|
+
`, ro = c.div`
|
|
1727
|
+
display: flex;
|
|
1728
|
+
flex-direction: column;
|
|
1729
|
+
min-width: 0;
|
|
1730
|
+
`, oo = c.div`
|
|
1731
|
+
display: flex;
|
|
1732
|
+
justify-content: space-between;
|
|
1733
|
+
align-items: center;
|
|
1734
|
+
padding: var(--spacing-xs) var(--spacing-sm);
|
|
1735
|
+
gap: var(--spacing-xs);
|
|
1736
|
+
`, io = c.span`
|
|
1737
|
+
font-size: var(--font-size-sm);
|
|
1738
|
+
font-weight: var(--font-weight-regular);
|
|
1739
|
+
line-height: var(--line-height-sm);
|
|
1740
|
+
color: var(--text-color-secondary);
|
|
1741
|
+
`, ao = c(V)`
|
|
1742
|
+
padding-top: 0;
|
|
1743
|
+
padding-bottom: 0;
|
|
1744
|
+
`;
|
|
1745
|
+
function so({ items: e, isLast: t }) {
|
|
1746
|
+
const [n, r] = K(t), o = $(() => {
|
|
1747
|
+
r((s) => !s);
|
|
1748
|
+
}, []), a = S(() => e.filter((s) => s.kind === "action"), [e]);
|
|
1749
|
+
return /* @__PURE__ */ h(lo, { children: [
|
|
1750
|
+
/* @__PURE__ */ h(uo, { type: "button", onClick: o, "aria-expanded": n, children: [
|
|
1751
|
+
/* @__PURE__ */ i(fo, { children: n ? /* @__PURE__ */ i(Lt, { size: "12px", color: "var(--icon-color-additional)" }) : /* @__PURE__ */ i(Pt, { size: "12px", color: "var(--icon-color-additional)" }) }),
|
|
1752
|
+
/* @__PURE__ */ h(po, { children: [
|
|
1753
|
+
a.length,
|
|
1754
|
+
" ",
|
|
1755
|
+
a.length === 1 ? "action" : "actions"
|
|
1756
|
+
] })
|
|
1757
|
+
] }),
|
|
1758
|
+
n && /* @__PURE__ */ i(ho, { children: a.map((s, l) => /* @__PURE__ */ i(co, { text: s.text }, l)) })
|
|
1759
|
+
] });
|
|
1760
|
+
}
|
|
1761
|
+
function co({ text: e }) {
|
|
1762
|
+
return /* @__PURE__ */ h(go, { children: [
|
|
1763
|
+
/* @__PURE__ */ h(vo, { children: [
|
|
1764
|
+
/* @__PURE__ */ i(mo, { "aria-hidden": !0 }),
|
|
1765
|
+
/* @__PURE__ */ i(yo, { children: /* @__PURE__ */ i(xo, { "aria-hidden": !0 }) }),
|
|
1766
|
+
/* @__PURE__ */ i(ut, { "aria-hidden": !0 })
|
|
1767
|
+
] }),
|
|
1768
|
+
/* @__PURE__ */ i(wo, { children: e })
|
|
1769
|
+
] });
|
|
1770
|
+
}
|
|
1771
|
+
const lo = c.div`
|
|
1772
|
+
display: flex;
|
|
1773
|
+
flex-direction: column;
|
|
1774
|
+
width: 100%;
|
|
1775
|
+
min-width: 0;
|
|
1776
|
+
`, uo = c.button`
|
|
1777
|
+
display: flex;
|
|
1778
|
+
align-items: center;
|
|
1779
|
+
cursor: pointer;
|
|
1780
|
+
user-select: none;
|
|
1781
|
+
width: fit-content;
|
|
1782
|
+
padding: 0;
|
|
1783
|
+
`, fo = c.span`
|
|
1784
|
+
display: flex;
|
|
1785
|
+
align-items: center;
|
|
1786
|
+
flex-shrink: 0;
|
|
1787
|
+
`, po = c.span`
|
|
1788
|
+
font-size: var(--font-size-sm);
|
|
1789
|
+
font-weight: var(--font-weight-regular);
|
|
1790
|
+
line-height: var(--line-height-sm);
|
|
1791
|
+
color: var(--text-color-description);
|
|
1792
|
+
`, ho = c.div`
|
|
1793
|
+
display: flex;
|
|
1794
|
+
flex-direction: column;
|
|
1795
|
+
gap: 0;
|
|
1796
|
+
`, ut = c.span`
|
|
1797
|
+
display: block;
|
|
1798
|
+
width: 1px;
|
|
1799
|
+
flex-shrink: 0;
|
|
1800
|
+
align-self: center;
|
|
1801
|
+
background: var(--border-color-secondary);
|
|
1802
|
+
flex: 1 1 auto;
|
|
1803
|
+
min-height: 8px;
|
|
1804
|
+
`, go = c.div`
|
|
1805
|
+
display: flex;
|
|
1806
|
+
flex-direction: row;
|
|
1807
|
+
align-items: stretch;
|
|
1808
|
+
gap: var(--spacing-xxs);
|
|
1809
|
+
min-width: 0;
|
|
1810
|
+
|
|
1811
|
+
&:last-child {
|
|
1812
|
+
${ut} {
|
|
1813
|
+
display: none;
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
`, vo = c.div`
|
|
1817
|
+
display: flex;
|
|
1818
|
+
flex-direction: column;
|
|
1819
|
+
align-items: center;
|
|
1820
|
+
box-sizing: border-box;
|
|
1821
|
+
width: 12px;
|
|
1822
|
+
flex: 0 0 auto;
|
|
1823
|
+
align-self: stretch;
|
|
1824
|
+
min-height: 0;
|
|
1825
|
+
`, mo = c.span`
|
|
1826
|
+
display: block;
|
|
1827
|
+
width: 1px;
|
|
1828
|
+
height: 4px;
|
|
1829
|
+
flex: 0 0 auto;
|
|
1830
|
+
flex-shrink: 0;
|
|
1831
|
+
background: var(--border-color-secondary);
|
|
1832
|
+
`, yo = c.div`
|
|
1833
|
+
width: 12px;
|
|
1834
|
+
height: 12px;
|
|
1835
|
+
flex: 0 0 auto;
|
|
1836
|
+
flex-shrink: 0;
|
|
1837
|
+
display: flex;
|
|
1838
|
+
align-items: center;
|
|
1839
|
+
justify-content: center;
|
|
1840
|
+
`, xo = c.span`
|
|
1841
|
+
width: 4px;
|
|
1842
|
+
height: 4px;
|
|
1843
|
+
flex-shrink: 0;
|
|
1844
|
+
border-radius: 50%;
|
|
1845
|
+
box-sizing: border-box;
|
|
1846
|
+
border: 1px solid var(--border-color-secondary);
|
|
1847
|
+
background: transparent;
|
|
1848
|
+
`, wo = c.span`
|
|
1849
|
+
flex: 1;
|
|
1850
|
+
min-width: 0;
|
|
1851
|
+
align-self: flex-start;
|
|
1852
|
+
font-size: var(--font-size-sm);
|
|
1853
|
+
font-weight: var(--font-weight-regular);
|
|
1854
|
+
line-height: var(--line-height-sm);
|
|
1855
|
+
color: var(--text-color-helper);
|
|
1856
|
+
`;
|
|
1857
|
+
function bo({
|
|
1858
|
+
items: e,
|
|
1859
|
+
messageMetadata: t
|
|
1860
|
+
}) {
|
|
1861
|
+
return /* @__PURE__ */ i(ko, { children: e.map((n, r) => {
|
|
1862
|
+
if (n.kind === "reasoning-block") {
|
|
1863
|
+
const s = r === e.length - 1;
|
|
1864
|
+
return /* @__PURE__ */ i(so, { items: n.items, isLast: s }, n.key);
|
|
1865
|
+
}
|
|
1866
|
+
if (n.kind === "text")
|
|
1867
|
+
return /* @__PURE__ */ i(
|
|
1868
|
+
Co,
|
|
1869
|
+
{
|
|
1870
|
+
rawMarkdown: n.text,
|
|
1871
|
+
workflowRunHistoryIds: n.workflowRunHistoryIds
|
|
1872
|
+
},
|
|
1873
|
+
n.key
|
|
1874
|
+
);
|
|
1875
|
+
const { part: o } = n, a = ln(o.type);
|
|
1876
|
+
return a && Ze(o) ? /* @__PURE__ */ i(
|
|
1877
|
+
eo,
|
|
1878
|
+
{
|
|
1879
|
+
approvalId: o.approval.id,
|
|
1880
|
+
toolCallId: o.toolCallId,
|
|
1881
|
+
toolName: a,
|
|
1882
|
+
input: o.input
|
|
1883
|
+
},
|
|
1884
|
+
n.key
|
|
1885
|
+
) : a && dn(o) ? /* @__PURE__ */ i(
|
|
1886
|
+
to,
|
|
1887
|
+
{
|
|
1888
|
+
toolName: a,
|
|
1889
|
+
toolCallId: o.toolCallId,
|
|
1890
|
+
input: o.input,
|
|
1891
|
+
isDenied: o.state === "output-denied",
|
|
1892
|
+
messageMetadata: t
|
|
1893
|
+
},
|
|
1894
|
+
n.key
|
|
1895
|
+
) : null;
|
|
1896
|
+
}) });
|
|
1897
|
+
}
|
|
1898
|
+
function Co({
|
|
1899
|
+
rawMarkdown: e,
|
|
1900
|
+
workflowRunHistoryIds: t
|
|
1901
|
+
}) {
|
|
1902
|
+
const n = et({ workflowRunHistoryIds: t });
|
|
1903
|
+
return /* @__PURE__ */ i(To, { onClick: n, children: /* @__PURE__ */ i(Zt, { rawMarkdown: e, parser: Jt }) });
|
|
1904
|
+
}
|
|
1905
|
+
const ko = c.div`
|
|
1906
|
+
display: flex;
|
|
1907
|
+
flex-direction: column;
|
|
1908
|
+
gap: var(--spacing-xs);
|
|
1909
|
+
`, To = c.div`
|
|
1910
|
+
white-space: normal;
|
|
1911
|
+
|
|
1912
|
+
max-width: 100%;
|
|
1913
|
+
overflow: hidden;
|
|
1914
|
+
|
|
1915
|
+
p:first-child {
|
|
1916
|
+
margin-top: 0;
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
p:last-child {
|
|
1920
|
+
margin-bottom: 0;
|
|
1921
|
+
}
|
|
1922
|
+
`, ft = c.div`
|
|
1923
|
+
font-family: var(--font-family-base);
|
|
1924
|
+
font-size: var(--font-size-sm);
|
|
1925
|
+
line-height: var(--line-height-sm);
|
|
1926
|
+
color: var(--text-color-primary);
|
|
1927
|
+
`;
|
|
1928
|
+
function Io() {
|
|
1929
|
+
return /* @__PURE__ */ h(So, { children: [
|
|
1930
|
+
/* @__PURE__ */ i(te, {}),
|
|
1931
|
+
/* @__PURE__ */ i(te, {}),
|
|
1932
|
+
/* @__PURE__ */ i(te, {})
|
|
1933
|
+
] });
|
|
1934
|
+
}
|
|
1935
|
+
const So = c.div`
|
|
1936
|
+
display: flex;
|
|
1937
|
+
align-items: center;
|
|
1938
|
+
justify-content: space-between;
|
|
1939
|
+
width: 24px;
|
|
1940
|
+
height: 24px;
|
|
1941
|
+
`;
|
|
1942
|
+
function Ao() {
|
|
1943
|
+
return /* @__PURE__ */ h(Lo, { children: [
|
|
1944
|
+
/* @__PURE__ */ i(Io, {}),
|
|
1945
|
+
/* @__PURE__ */ i(Po, { children: "Thinking" })
|
|
1946
|
+
] });
|
|
1947
|
+
}
|
|
1948
|
+
const Lo = c.div`
|
|
1949
|
+
display: flex;
|
|
1950
|
+
align-items: center;
|
|
1951
|
+
gap: var(--spacing-xxs);
|
|
1952
|
+
`, Po = c.span`
|
|
1953
|
+
font-family: var(--font-family-base);
|
|
1954
|
+
font-size: var(--font-size-sm);
|
|
1955
|
+
line-height: var(--line-height-sm);
|
|
1956
|
+
color: var(--text-color-helper);
|
|
1957
|
+
`;
|
|
1958
|
+
function Eo({ items: e }) {
|
|
1959
|
+
return /* @__PURE__ */ i(yt, { children: e.map((t) => t.kind !== "text" ? null : /* @__PURE__ */ i(ft, { children: t.text }, t.key)) });
|
|
1960
|
+
}
|
|
1961
|
+
const Ro = "Something went wrong. Please try again.";
|
|
1962
|
+
function Oo(e) {
|
|
1963
|
+
const t = e?.message?.trim();
|
|
1964
|
+
return t || Ro;
|
|
1965
|
+
}
|
|
1966
|
+
function $o({ message: e, isLastMessage: t }) {
|
|
1967
|
+
const { chatStatus: n, chatError: r } = q(), { role: o, parts: a } = e, s = o === D.ASSISTANT, l = S(() => un(a), [a]), d = l.length > 0, u = n === "error" && t && s && !d;
|
|
1968
|
+
return !d && !u ? null : /* @__PURE__ */ i(pt, { $role: o, children: /* @__PURE__ */ i(
|
|
1969
|
+
Mo,
|
|
1970
|
+
{
|
|
1971
|
+
isFailedEmptyAssistant: u,
|
|
1972
|
+
chatError: r,
|
|
1973
|
+
isAssistant: s,
|
|
1974
|
+
contentItems: l,
|
|
1975
|
+
messageMetadata: e.metadata
|
|
1976
|
+
}
|
|
1977
|
+
) });
|
|
1978
|
+
}
|
|
1979
|
+
function Do() {
|
|
1980
|
+
return /* @__PURE__ */ i(pt, { $role: D.ASSISTANT, children: /* @__PURE__ */ i(ve, { children: /* @__PURE__ */ i(Ao, {}) }) });
|
|
1981
|
+
}
|
|
1982
|
+
function Mo({
|
|
1983
|
+
isFailedEmptyAssistant: e,
|
|
1984
|
+
chatError: t,
|
|
1985
|
+
isAssistant: n,
|
|
1986
|
+
contentItems: r,
|
|
1987
|
+
messageMetadata: o
|
|
1988
|
+
}) {
|
|
1989
|
+
return e ? /* @__PURE__ */ i(ve, { children: /* @__PURE__ */ i(ft, { children: Oo(t) }) }) : /* @__PURE__ */ i(ve, { children: n ? /* @__PURE__ */ i(bo, { items: r, messageMetadata: o }) : /* @__PURE__ */ i(Eo, { items: r }) });
|
|
1990
|
+
}
|
|
1991
|
+
const pt = c.div`
|
|
1992
|
+
display: flex;
|
|
1993
|
+
flex-direction: column;
|
|
1994
|
+
padding: var(--spacing-xs) var(--spacing-sm);
|
|
1995
|
+
gap: var(--spacing-xxs);
|
|
1996
|
+
min-width: 0;
|
|
1997
|
+
width: ${({ $role: e }) => e === D.ASSISTANT ? "100%" : "fit-content"};
|
|
1998
|
+
border-radius: ${({ $role: e }) => e === D.USER ? "6px 0px 6px 6px" : "0px 6px 6px 6px"};
|
|
1999
|
+
background: ${({ $role: e }) => e === D.USER ? "var(--replay-ai-user-message-gradient)" : "transparent"};
|
|
2000
|
+
border: none;
|
|
2001
|
+
color: var(--text-color-primary);
|
|
2002
|
+
box-sizing: border-box;
|
|
2003
|
+
word-wrap: break-word;
|
|
2004
|
+
white-space: pre-wrap;
|
|
2005
|
+
max-width: 100%;
|
|
2006
|
+
`, ve = c.div`
|
|
2007
|
+
display: flex;
|
|
2008
|
+
flex-direction: column;
|
|
2009
|
+
gap: var(--spacing-xxs);
|
|
2010
|
+
min-width: 0;
|
|
2011
|
+
width: 100%;
|
|
2012
|
+
`;
|
|
2013
|
+
function zo() {
|
|
2014
|
+
const { messages: e, isStreaming: t } = q(), n = e.at(-1), r = S(() => {
|
|
2015
|
+
const o = n?.role === D.ASSISTANT, a = n?.parts.at(-1)?.type === "text";
|
|
2016
|
+
return t && !(o && a);
|
|
2017
|
+
}, [t, n?.parts, n?.role]);
|
|
2018
|
+
return /* @__PURE__ */ h(_o, { children: [
|
|
2019
|
+
e.map((o, a) => /* @__PURE__ */ i(ze, { $role: o.role, children: /* @__PURE__ */ i(_e, { $role: o.role, children: /* @__PURE__ */ i($o, { message: o, isLastMessage: a === e.length - 1 }) }) }, o.id)),
|
|
2020
|
+
r && /* @__PURE__ */ i(ze, { $role: D.ASSISTANT, children: /* @__PURE__ */ i(_e, { $role: D.ASSISTANT, children: /* @__PURE__ */ i(Do, {}) }) })
|
|
2021
|
+
] });
|
|
2022
|
+
}
|
|
2023
|
+
const _o = c.div`
|
|
2024
|
+
display: flex;
|
|
2025
|
+
flex-direction: column;
|
|
2026
|
+
gap: var(--spacing-xs);
|
|
2027
|
+
width: 100%;
|
|
2028
|
+
`, ze = c.div`
|
|
2029
|
+
display: flex;
|
|
2030
|
+
width: 100%;
|
|
2031
|
+
justify-content: ${({ $role: e }) => e === D.USER ? "flex-end" : "flex-start"};
|
|
2032
|
+
`, _e = c.div`
|
|
2033
|
+
display: flex;
|
|
2034
|
+
flex-direction: column;
|
|
2035
|
+
align-items: ${({ $role: e }) => e === D.USER ? "flex-end" : "stretch"};
|
|
2036
|
+
gap: var(--spacing-xs);
|
|
2037
|
+
min-width: 0;
|
|
2038
|
+
width: 100%;
|
|
2039
|
+
max-width: 100%;
|
|
2040
|
+
`;
|
|
2041
|
+
function Vo(e) {
|
|
2042
|
+
const t = F(void 0);
|
|
2043
|
+
return B(() => {
|
|
2044
|
+
t.current = e;
|
|
2045
|
+
}), t.current;
|
|
2046
|
+
}
|
|
2047
|
+
const ht = c.div`
|
|
2048
|
+
display: flex;
|
|
2049
|
+
flex-direction: column;
|
|
2050
|
+
flex: 1;
|
|
2051
|
+
width: 100%;
|
|
2052
|
+
overflow: auto;
|
|
2053
|
+
padding: var(--spacing-xs);
|
|
2054
|
+
`, Ho = (e) => /* @__PURE__ */ h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 14 14", fill: "none", ...e, children: [
|
|
2055
|
+
/* @__PURE__ */ i(
|
|
2056
|
+
"path",
|
|
2057
|
+
{
|
|
2058
|
+
d: "M12.1683 8.65224C13.4439 7.91782 13.4439 6.08176 12.1683 5.34733L8.48891 3.22903L5.13033 6.57817C5.03961 6.66863 5.03961 6.8153 5.13033 6.90577L8.81674 10.5818L12.1683 8.65224Z",
|
|
2059
|
+
fill: "url(#replay-icon-gradient)"
|
|
2060
|
+
}
|
|
2061
|
+
),
|
|
2062
|
+
/* @__PURE__ */ i(
|
|
2063
|
+
"path",
|
|
2064
|
+
{
|
|
2065
|
+
d: "M7.56707 11.3013L3.81522 13.4613C2.53957 14.1957 0.945007 13.2777 0.945007 11.8088L0.945008 2.19072C0.945008 0.721872 2.53957 -0.196157 3.81522 0.538267L7.23924 2.50957L4.14475 5.59536C3.5097 6.22861 3.5097 7.25532 4.14475 7.88858L7.56707 11.3013Z",
|
|
2066
|
+
fill: "url(#replay-icon-gradient)"
|
|
2067
|
+
}
|
|
2068
|
+
),
|
|
2069
|
+
/* @__PURE__ */ i("defs", { children: /* @__PURE__ */ h(
|
|
2070
|
+
"linearGradient",
|
|
2071
|
+
{
|
|
2072
|
+
id: "replay-icon-gradient",
|
|
2073
|
+
x1: "12.0947",
|
|
2074
|
+
y1: "10.9627",
|
|
2075
|
+
x2: "1.65018",
|
|
2076
|
+
y2: "0.120816",
|
|
2077
|
+
gradientUnits: "userSpaceOnUse",
|
|
2078
|
+
children: [
|
|
2079
|
+
/* @__PURE__ */ i("stop", { stopColor: "#C361FF" }),
|
|
2080
|
+
/* @__PURE__ */ i("stop", { offset: "0.411322", stopColor: "#9461FF" }),
|
|
2081
|
+
/* @__PURE__ */ i("stop", { offset: "0.73777", stopColor: "#207DFF" }),
|
|
2082
|
+
/* @__PURE__ */ i("stop", { offset: "1", stopColor: "#1DA8F6" })
|
|
2083
|
+
]
|
|
2084
|
+
}
|
|
2085
|
+
) })
|
|
2086
|
+
] }), Bo = c(Ho)`
|
|
2087
|
+
height: ${({ size: e }) => e || "14px"};
|
|
2088
|
+
width: ${({ size: e }) => e || "14px"};
|
|
2089
|
+
`;
|
|
2090
|
+
function No(e) {
|
|
2091
|
+
const t = "var(--font-size-base)";
|
|
2092
|
+
switch (e) {
|
|
2093
|
+
case ge:
|
|
2094
|
+
return /* @__PURE__ */ i(Bo, { size: t });
|
|
2095
|
+
case le.OPENAI:
|
|
2096
|
+
return /* @__PURE__ */ i(zt, { size: t, color: "var(--text-color-primary)" });
|
|
2097
|
+
case le.GEMINI:
|
|
2098
|
+
return /* @__PURE__ */ i(Mt, { size: t });
|
|
2099
|
+
case le.ANTHROPIC:
|
|
2100
|
+
return /* @__PURE__ */ i(Dt, { size: t, color: "var(--replay-claude-icon-color)" });
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
function Fo({
|
|
2104
|
+
models: e,
|
|
2105
|
+
selectedModelId: t,
|
|
2106
|
+
placement: n,
|
|
2107
|
+
onModelSelect: r,
|
|
2108
|
+
onSettingsOpen: o
|
|
2109
|
+
}) {
|
|
2110
|
+
const a = e.find((p) => p.id === t), s = a?.label ?? "Replay AI", l = a?.id, d = e.filter((p) => p.provider === ge), u = e.filter((p) => p.provider !== ge), f = d.length > 0 && u.length > 0;
|
|
2111
|
+
return /* @__PURE__ */ i(Yo, { children: /* @__PURE__ */ i(
|
|
2112
|
+
Go,
|
|
2113
|
+
{
|
|
2114
|
+
trigger: /* @__PURE__ */ i(jo, { label: s }),
|
|
2115
|
+
placement: n,
|
|
2116
|
+
alignment: "start",
|
|
2117
|
+
withArrow: !0,
|
|
2118
|
+
children: /* @__PURE__ */ h(Ko, { children: [
|
|
2119
|
+
/* @__PURE__ */ h(Jo, { children: [
|
|
2120
|
+
d.map((p) => /* @__PURE__ */ i(
|
|
2121
|
+
Ve,
|
|
2122
|
+
{
|
|
2123
|
+
model: p,
|
|
2124
|
+
activeModelId: l,
|
|
2125
|
+
onModelSelect: r
|
|
2126
|
+
},
|
|
2127
|
+
p.id
|
|
2128
|
+
)),
|
|
2129
|
+
f && /* @__PURE__ */ i(He, { "aria-hidden": !0 }),
|
|
2130
|
+
u.length > 0 && /* @__PURE__ */ i(Fe, { children: u.map((p) => /* @__PURE__ */ i(
|
|
2131
|
+
Ve,
|
|
2132
|
+
{
|
|
2133
|
+
model: p,
|
|
2134
|
+
activeModelId: l,
|
|
2135
|
+
onModelSelect: r
|
|
2136
|
+
},
|
|
2137
|
+
p.id
|
|
2138
|
+
)) })
|
|
2139
|
+
] }),
|
|
2140
|
+
o && e.length > 0 && /* @__PURE__ */ i(He, { "aria-hidden": !0 }),
|
|
2141
|
+
o && /* @__PURE__ */ i(
|
|
2142
|
+
Xo,
|
|
2143
|
+
{
|
|
2144
|
+
prefix: /* @__PURE__ */ i(Et, { size: "var(--font-size-base)", color: "var(--text-color-secondary)" }),
|
|
2145
|
+
content: "Manage models",
|
|
2146
|
+
onAction: () => o("ai-providers")
|
|
2147
|
+
}
|
|
2148
|
+
)
|
|
2149
|
+
] })
|
|
2150
|
+
}
|
|
2151
|
+
) });
|
|
2152
|
+
}
|
|
2153
|
+
function jo({
|
|
2154
|
+
label: e,
|
|
2155
|
+
icon: t,
|
|
2156
|
+
onClick: n,
|
|
2157
|
+
onKeyDown: r
|
|
2158
|
+
}) {
|
|
2159
|
+
return /* @__PURE__ */ h(Wo, { onClick: n, onKeyDown: r, children: [
|
|
2160
|
+
/* @__PURE__ */ i(Uo, { children: e }),
|
|
2161
|
+
t
|
|
2162
|
+
] });
|
|
2163
|
+
}
|
|
2164
|
+
function Ve({ model: e, activeModelId: t, onModelSelect: n }) {
|
|
2165
|
+
const r = e.id === t;
|
|
2166
|
+
return /* @__PURE__ */ i(
|
|
2167
|
+
We,
|
|
2168
|
+
{
|
|
2169
|
+
prefix: No(e.provider),
|
|
2170
|
+
suffix: r ? /* @__PURE__ */ i(Zo, { size: "var(--font-size-base)", color: "var(--text-color-primary)" }) : void 0,
|
|
2171
|
+
onAction: () => n(e.id),
|
|
2172
|
+
active: r,
|
|
2173
|
+
children: /* @__PURE__ */ i(qo, { children: e.label })
|
|
2174
|
+
}
|
|
2175
|
+
);
|
|
2176
|
+
}
|
|
2177
|
+
const Wo = c.div`
|
|
2178
|
+
display: flex;
|
|
2179
|
+
align-items: center;
|
|
2180
|
+
min-width: 0;
|
|
2181
|
+
gap: var(--spacing-xxs);
|
|
2182
|
+
height: 24px;
|
|
2183
|
+
padding: 0 var(--spacing-xs);
|
|
2184
|
+
border-radius: var(--border-radius);
|
|
2185
|
+
background: var(--bg-color-active);
|
|
2186
|
+
cursor: pointer;
|
|
2187
|
+
user-select: none;
|
|
2188
|
+
|
|
2189
|
+
&:hover {
|
|
2190
|
+
background: var(--layer-color-active);
|
|
2191
|
+
}
|
|
2192
|
+
`, Uo = c.span`
|
|
2193
|
+
overflow: hidden;
|
|
2194
|
+
text-overflow: ellipsis;
|
|
2195
|
+
font-family: var(--font-family-base);
|
|
2196
|
+
font-size: var(--font-size-base);
|
|
2197
|
+
font-weight: var(--font-weight-regular);
|
|
2198
|
+
line-height: var(--line-height-base);
|
|
2199
|
+
color: var(--text-color-primary);
|
|
2200
|
+
white-space: nowrap;
|
|
2201
|
+
`, Yo = c.div`
|
|
2202
|
+
--dropdown-menu-padding-top: 0;
|
|
2203
|
+
|
|
2204
|
+
min-width: 0;
|
|
2205
|
+
flex: 1;
|
|
2206
|
+
position: relative;
|
|
2207
|
+
`, Go = c(Rt)`
|
|
2208
|
+
width: 100%;
|
|
2209
|
+
min-width: 0;
|
|
2210
|
+
flex: 1;
|
|
2211
|
+
|
|
2212
|
+
> :last-child {
|
|
2213
|
+
width: 100%;
|
|
2214
|
+
max-width: 200px;
|
|
2215
|
+
}
|
|
2216
|
+
`, Ko = c(Ot)`
|
|
2217
|
+
--dropdown-menu-item-gap: calc(var(--spacing-unit) / 2);
|
|
2218
|
+
--dropdown-menu-item-padding-vertical: var(--spacing-xxs);
|
|
2219
|
+
--dropdown-menu-item-padding-horizontal: var(--spacing-xs);
|
|
2220
|
+
|
|
2221
|
+
padding: var(--spacing-xxs);
|
|
2222
|
+
margin: 5px 0;
|
|
2223
|
+
border-radius: var(--border-radius-lg);
|
|
2224
|
+
background: var(--bg-color);
|
|
2225
|
+
`, qo = c.span`
|
|
2226
|
+
flex: 1;
|
|
2227
|
+
min-width: 0;
|
|
2228
|
+
overflow: hidden;
|
|
2229
|
+
text-overflow: ellipsis;
|
|
2230
|
+
white-space: nowrap;
|
|
2231
|
+
`, Zo = c($t)`
|
|
2232
|
+
margin-left: var(--spacing-xxs);
|
|
2233
|
+
`, He = c.li`
|
|
2234
|
+
flex-shrink: 0;
|
|
2235
|
+
list-style: none;
|
|
2236
|
+
width: 100%;
|
|
2237
|
+
height: 1px;
|
|
2238
|
+
margin: 0;
|
|
2239
|
+
background: var(--border-color-secondary);
|
|
2240
|
+
`, Jo = c.li`
|
|
2241
|
+
display: flex;
|
|
2242
|
+
flex-direction: column;
|
|
2243
|
+
gap: var(--dropdown-menu-item-gap);
|
|
2244
|
+
list-style: none;
|
|
2245
|
+
min-height: 0;
|
|
2246
|
+
overflow-y: auto;
|
|
2247
|
+
`, Xo = c(We)`
|
|
2248
|
+
flex-shrink: 0;
|
|
2249
|
+
`;
|
|
2250
|
+
function Qo() {
|
|
2251
|
+
const {
|
|
2252
|
+
chatId: e,
|
|
2253
|
+
isLoading: t,
|
|
2254
|
+
pendingComposerPreset: n,
|
|
2255
|
+
clearPendingComposerPreset: r,
|
|
2256
|
+
availableModels: o,
|
|
2257
|
+
selectedModelId: a,
|
|
2258
|
+
selectModel: s,
|
|
2259
|
+
onSettingsOpen: l
|
|
2260
|
+
} = Ke(), { messages: d, isStreaming: u, sendMessage: f, stopGeneration: p } = q(), { isOpen: g } = qe(), [m, v] = K(""), x = F(null), w = F(null), b = F(!0), y = d.length > 0, A = Vo(d.length), P = A !== void 0 && A > 0 && !y, M = $((L = "smooth") => {
|
|
2261
|
+
w.current && w.current.scrollTo({
|
|
2262
|
+
top: w.current.scrollHeight,
|
|
2263
|
+
behavior: L
|
|
2264
|
+
});
|
|
2265
|
+
}, []), Z = $(() => {
|
|
2266
|
+
const L = w.current;
|
|
2267
|
+
if (!L) return;
|
|
2268
|
+
L.scrollHeight - L.scrollTop - L.clientHeight < 50 && (b.current = !0);
|
|
2269
|
+
}, []);
|
|
2270
|
+
B(() => {
|
|
2271
|
+
const L = w.current;
|
|
2272
|
+
if (!L) return;
|
|
2273
|
+
const ce = (mt) => {
|
|
2274
|
+
mt.deltaY < 0 && (b.current = !1);
|
|
2275
|
+
};
|
|
2276
|
+
return L.addEventListener("wheel", ce, { passive: !0 }), () => L.removeEventListener("wheel", ce);
|
|
2277
|
+
}, []);
|
|
2278
|
+
const J = $(async () => {
|
|
2279
|
+
m && (v(""), b.current = !0, await f(m), x.current && requestAnimationFrame(() => x.current?.focus()));
|
|
2280
|
+
}, [f, m]);
|
|
2281
|
+
return B(() => {
|
|
2282
|
+
g && (x.current && x.current.focus(), b.current = !0, M());
|
|
2283
|
+
}, [g, d.length, M]), B(() => {
|
|
2284
|
+
u && b.current && M();
|
|
2285
|
+
}), B(
|
|
2286
|
+
function() {
|
|
2287
|
+
g && x.current && (x.current.focus(), M("instant"));
|
|
2288
|
+
},
|
|
2289
|
+
[e, g, M]
|
|
2290
|
+
), B(
|
|
2291
|
+
function() {
|
|
2292
|
+
!g || n === null || (v(n), r());
|
|
2293
|
+
},
|
|
2294
|
+
[g, n, r]
|
|
2295
|
+
), /* @__PURE__ */ h(ht, { children: [
|
|
2296
|
+
/* @__PURE__ */ i(
|
|
2297
|
+
ei,
|
|
2298
|
+
{
|
|
2299
|
+
ref: w,
|
|
2300
|
+
$isExpanded: t || y,
|
|
2301
|
+
$isAnimated: u || P,
|
|
2302
|
+
onScroll: Z,
|
|
2303
|
+
children: t ? /* @__PURE__ */ i(ti, { children: /* @__PURE__ */ i(ye, { size: "20px" }) }) : /* @__PURE__ */ i(zo, {})
|
|
2304
|
+
}
|
|
2305
|
+
),
|
|
2306
|
+
/* @__PURE__ */ i(
|
|
2307
|
+
kn,
|
|
2308
|
+
{
|
|
2309
|
+
value: m,
|
|
2310
|
+
onValueChange: v,
|
|
2311
|
+
onSubmit: J,
|
|
2312
|
+
isStreaming: u,
|
|
2313
|
+
onStop: p,
|
|
2314
|
+
textareaRef: x,
|
|
2315
|
+
modelSelector: /* @__PURE__ */ i(
|
|
2316
|
+
Fo,
|
|
2317
|
+
{
|
|
2318
|
+
models: o,
|
|
2319
|
+
selectedModelId: a,
|
|
2320
|
+
placement: y ? "top" : "bottom",
|
|
2321
|
+
onModelSelect: s,
|
|
2322
|
+
onSettingsOpen: l
|
|
2323
|
+
}
|
|
2324
|
+
)
|
|
2325
|
+
}
|
|
2326
|
+
)
|
|
2327
|
+
] });
|
|
2328
|
+
}
|
|
2329
|
+
const ei = c.div`
|
|
2330
|
+
flex: ${({ $isExpanded: e }) => e ? 1 : 0};
|
|
2331
|
+
width: 100%;
|
|
2332
|
+
overflow: auto;
|
|
2333
|
+
padding-bottom: ${(e) => e.$isExpanded ? "var(--spacing-xs)" : "0"};
|
|
2334
|
+
transition-property: flex;
|
|
2335
|
+
transition-duration: ${(e) => e.$isAnimated ? "var(--replay-transition-duration)" : "0s"};
|
|
2336
|
+
transition-timing-function: var(--replay-transition-timing-function);
|
|
2337
|
+
`, ti = c.div`
|
|
2338
|
+
display: flex;
|
|
2339
|
+
justify-content: center;
|
|
2340
|
+
height: 100%;
|
|
2341
|
+
padding-top: var(--spacing-lg);
|
|
2342
|
+
`, O = {
|
|
2343
|
+
TODAY: "today",
|
|
2344
|
+
YESTERDAY: "yesterday",
|
|
2345
|
+
LAST_WEEK: "last_week",
|
|
2346
|
+
LAST_MONTH: "last_month",
|
|
2347
|
+
OLDER: "older"
|
|
2348
|
+
}, ni = {
|
|
2349
|
+
[O.TODAY]: "Today",
|
|
2350
|
+
[O.YESTERDAY]: "Yesterday",
|
|
2351
|
+
[O.LAST_WEEK]: "Last 7 days",
|
|
2352
|
+
[O.LAST_MONTH]: "Last 30 days",
|
|
2353
|
+
[O.OLDER]: "Older"
|
|
2354
|
+
};
|
|
2355
|
+
function ri(e, t = Date.now()) {
|
|
2356
|
+
const n = U(e).startOf("day"), r = U(t).startOf("day"), o = U(t).subtract(1, "day").startOf("day"), a = U(t).subtract(7, "day").startOf("day"), s = U(t).subtract(30, "day").startOf("day");
|
|
2357
|
+
return n.isSame(r, "day") ? O.TODAY : n.isSame(o, "day") ? O.YESTERDAY : !n.isBefore(a, "day") && n.isBefore(o, "day") ? O.LAST_WEEK : !n.isBefore(s, "day") && n.isBefore(a, "day") ? O.LAST_MONTH : O.OLDER;
|
|
2358
|
+
}
|
|
2359
|
+
function oi(e) {
|
|
2360
|
+
const t = [];
|
|
2361
|
+
for (const n of e) {
|
|
2362
|
+
const r = ri(n.updatedAt), o = t[t.length - 1];
|
|
2363
|
+
!o || o.bucket !== r ? t.push({ bucket: r, chats: [n] }) : o.chats.push(n);
|
|
2364
|
+
}
|
|
2365
|
+
return t;
|
|
2366
|
+
}
|
|
2367
|
+
function ii(e) {
|
|
2368
|
+
const {
|
|
2369
|
+
scrollRef: t,
|
|
2370
|
+
sentinelRef: n,
|
|
2371
|
+
hasNextPage: r,
|
|
2372
|
+
isFetchingNextPage: o,
|
|
2373
|
+
fetchNextPage: a,
|
|
2374
|
+
observerResetKey: s
|
|
2375
|
+
} = e;
|
|
2376
|
+
je(() => {
|
|
2377
|
+
const l = t.current, d = n.current;
|
|
2378
|
+
if (!l || !d) return;
|
|
2379
|
+
const u = new IntersectionObserver(
|
|
2380
|
+
(f) => {
|
|
2381
|
+
const p = f[0];
|
|
2382
|
+
p && p.isIntersecting && r && (o || a());
|
|
2383
|
+
},
|
|
2384
|
+
{ root: l, rootMargin: "80px" }
|
|
2385
|
+
);
|
|
2386
|
+
return u.observe(d), () => {
|
|
2387
|
+
u.disconnect();
|
|
2388
|
+
};
|
|
2389
|
+
}, [s, a, r, o, t, n]);
|
|
2390
|
+
}
|
|
2391
|
+
const gt = c(ht)`
|
|
2392
|
+
gap: var(--spacing-xxs);
|
|
2393
|
+
user-select: none;
|
|
2394
|
+
`, ai = c.div`
|
|
2395
|
+
display: flex;
|
|
2396
|
+
flex-direction: column;
|
|
2397
|
+
gap: var(--spacing-xs);
|
|
2398
|
+
`, si = c.div`
|
|
2399
|
+
display: flex;
|
|
2400
|
+
flex-direction: column;
|
|
2401
|
+
gap: var(--spacing-xxs);
|
|
2402
|
+
`, ci = c(gt)`
|
|
2403
|
+
display: flex;
|
|
2404
|
+
flex-grow: 1;
|
|
2405
|
+
align-items: center;
|
|
2406
|
+
flex-direction: column;
|
|
2407
|
+
padding: var(--spacing-md);
|
|
2408
|
+
`, li = c.div`
|
|
2409
|
+
display: flex;
|
|
2410
|
+
flex-grow: 1;
|
|
2411
|
+
align-items: center;
|
|
2412
|
+
justify-content: center;
|
|
2413
|
+
`, di = c.div`
|
|
2414
|
+
display: flex;
|
|
2415
|
+
flex-direction: column;
|
|
2416
|
+
align-items: center;
|
|
2417
|
+
max-width: 75%;
|
|
2418
|
+
gap: var(--spacing-xxs);
|
|
2419
|
+
`, ui = c.div`
|
|
2420
|
+
display: flex;
|
|
2421
|
+
justify-content: center;
|
|
2422
|
+
padding: var(--spacing-xs);
|
|
2423
|
+
`, fi = c(re)`
|
|
2424
|
+
padding-left: var(--spacing-xs);
|
|
2425
|
+
font-size: var(--font-size-sm);
|
|
2426
|
+
color: var(--color-warm-grey-7);
|
|
2427
|
+
`, pi = c.div`
|
|
2428
|
+
display: flex;
|
|
2429
|
+
flex-grow: 1;
|
|
2430
|
+
|
|
2431
|
+
.tooltip-expanded {
|
|
2432
|
+
flex-grow: 1;
|
|
2433
|
+
min-width: 0;
|
|
2434
|
+
}
|
|
2435
|
+
`, hi = c.div`
|
|
2436
|
+
display: flex;
|
|
2437
|
+
align-items: center;
|
|
2438
|
+
justify-content: space-between;
|
|
2439
|
+
flex-grow: 1;
|
|
2440
|
+
min-width: 0;
|
|
2441
|
+
border-radius: var(--border-radius);
|
|
2442
|
+
padding: calc(var(--spacing-xxs) / 2) var(--spacing-xs);
|
|
2443
|
+
gap: calc(var(--spacing-xxs) * 2.5);
|
|
2444
|
+
cursor: pointer;
|
|
2445
|
+
|
|
2446
|
+
${V} {
|
|
2447
|
+
display: none;
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
&:focus-within,
|
|
2451
|
+
&:hover {
|
|
2452
|
+
background-color: var(--color-hover-base);
|
|
2453
|
+
|
|
2454
|
+
${V} {
|
|
2455
|
+
display: inline-flex;
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
`, gi = c(re)`
|
|
2459
|
+
overflow: hidden;
|
|
2460
|
+
white-space: nowrap;
|
|
2461
|
+
text-overflow: ellipsis;
|
|
2462
|
+
`, vi = c.div`
|
|
2463
|
+
height: 1px;
|
|
2464
|
+
flex-shrink: 0;
|
|
2465
|
+
`;
|
|
2466
|
+
function mi(e) {
|
|
2467
|
+
const { chat: t, onSelect: n, onRemove: r } = e;
|
|
2468
|
+
return /* @__PURE__ */ i(pi, { children: /* @__PURE__ */ i(Y, { tip: U(t.updatedAt).format("MMM DD, YYYY, hh:mm:ss A"), className: "expanded", children: /* @__PURE__ */ h(hi, { role: "button", onClick: () => n?.(t.id), children: [
|
|
2469
|
+
/* @__PURE__ */ i(gi, { children: t.title ?? "New chat" }),
|
|
2470
|
+
/* @__PURE__ */ i(
|
|
2471
|
+
V,
|
|
2472
|
+
{
|
|
2473
|
+
variant: "ghost",
|
|
2474
|
+
size: "small",
|
|
2475
|
+
tone: "danger",
|
|
2476
|
+
icon: /* @__PURE__ */ i(_t, {}),
|
|
2477
|
+
onClick: (o) => {
|
|
2478
|
+
o.stopPropagation(), r?.(t.id);
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
)
|
|
2482
|
+
] }) }) });
|
|
2483
|
+
}
|
|
2484
|
+
function yi(e) {
|
|
2485
|
+
const { group: t, onChatSelect: n, onChatRemove: r } = e;
|
|
2486
|
+
return /* @__PURE__ */ h(si, { children: [
|
|
2487
|
+
/* @__PURE__ */ i(fi, { children: ni[t.bucket] }),
|
|
2488
|
+
t.chats.map((o) => /* @__PURE__ */ i(
|
|
2489
|
+
mi,
|
|
2490
|
+
{
|
|
2491
|
+
chat: o,
|
|
2492
|
+
onSelect: n,
|
|
2493
|
+
onRemove: r
|
|
2494
|
+
},
|
|
2495
|
+
o.id
|
|
2496
|
+
))
|
|
2497
|
+
] });
|
|
2498
|
+
}
|
|
2499
|
+
function xi() {
|
|
2500
|
+
return /* @__PURE__ */ i(li, { children: /* @__PURE__ */ h(di, { children: [
|
|
2501
|
+
/* @__PURE__ */ i(re, { textAlign: "center", fontWeight: "var(--font-weight-semibold)", children: "No chat history" }),
|
|
2502
|
+
/* @__PURE__ */ i(re, { textAlign: "center", children: "Ask questions or let the assistant take action for you." })
|
|
2503
|
+
] }) });
|
|
2504
|
+
}
|
|
2505
|
+
function wi() {
|
|
2506
|
+
return /* @__PURE__ */ i(ci, { children: /* @__PURE__ */ i(ye, {}) });
|
|
2507
|
+
}
|
|
2508
|
+
const bi = 50;
|
|
2509
|
+
function Ci(e) {
|
|
2510
|
+
const { onChatSelect: t, onChatRemove: n } = e, r = F(null), o = F(null), { data: a, isPending: s, hasNextPage: l, isFetchingNextPage: d, fetchNextPage: u } = fn(bi), f = S(() => (a?.pages ?? []).flatMap((g) => g.items), [a?.pages]), p = S(() => oi(f), [f]);
|
|
2511
|
+
return ii({
|
|
2512
|
+
scrollRef: r,
|
|
2513
|
+
sentinelRef: o,
|
|
2514
|
+
hasNextPage: l,
|
|
2515
|
+
isFetchingNextPage: d,
|
|
2516
|
+
fetchNextPage: u,
|
|
2517
|
+
observerResetKey: a?.pages.length
|
|
2518
|
+
}), s && !a ? /* @__PURE__ */ i(wi, {}) : f.length === 0 ? /* @__PURE__ */ i(xi, {}) : /* @__PURE__ */ h(gt, { ref: r, children: [
|
|
2519
|
+
/* @__PURE__ */ i(ai, { children: p.map((g) => /* @__PURE__ */ i(
|
|
2520
|
+
yi,
|
|
2521
|
+
{
|
|
2522
|
+
group: g,
|
|
2523
|
+
onChatSelect: t,
|
|
2524
|
+
onChatRemove: n
|
|
2525
|
+
},
|
|
2526
|
+
`${g.bucket}-${g.chats[0]?.id ?? ""}`
|
|
2527
|
+
)) }),
|
|
2528
|
+
l && /* @__PURE__ */ i(vi, { ref: o, "aria-hidden": !0 }),
|
|
2529
|
+
d && /* @__PURE__ */ i(ui, { children: /* @__PURE__ */ i(ye, {}) })
|
|
2530
|
+
] });
|
|
2531
|
+
}
|
|
2532
|
+
const ki = xt(null);
|
|
2533
|
+
function Ti(e) {
|
|
2534
|
+
const t = wt(ki);
|
|
2535
|
+
if (t?.components) {
|
|
2536
|
+
const { LinkComponent: s } = t.components;
|
|
2537
|
+
return /* @__PURE__ */ i(s, { ...e });
|
|
2538
|
+
}
|
|
2539
|
+
const { external: n, languageInsensitive: r, innerRef: o, ...a } = e;
|
|
2540
|
+
return /* @__PURE__ */ i(pn, { ref: o, ...a });
|
|
2541
|
+
}
|
|
2542
|
+
const Ii = () => bt`
|
|
2543
|
+
0% {
|
|
2544
|
+
color: var(--button-content-color);
|
|
2545
|
+
background-color: var(--button-bg-color-active);
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
50% {
|
|
2549
|
+
background-color: var(--button-bg-color);
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
100% {
|
|
2553
|
+
color: var(--button-content-color);
|
|
2554
|
+
background-color: var(--button-bg-color-active);
|
|
2555
|
+
}
|
|
2556
|
+
`, Si = c(Ti)`
|
|
2557
|
+
text-decoration: none;
|
|
2558
|
+
&:focus-visible {
|
|
2559
|
+
outline: 1px solid var(--button-border-color-focused);
|
|
2560
|
+
}
|
|
2561
|
+
border-radius: var(--button-border-radius);
|
|
2562
|
+
`;
|
|
2563
|
+
function Ai({
|
|
2564
|
+
variant: e = "secondary",
|
|
2565
|
+
tone: t = "default",
|
|
2566
|
+
size: n = "medium",
|
|
2567
|
+
extraClass: r = "",
|
|
2568
|
+
className: o = ""
|
|
2569
|
+
}) {
|
|
2570
|
+
return [
|
|
2571
|
+
"button",
|
|
2572
|
+
r,
|
|
2573
|
+
`button-tone-${t}`,
|
|
2574
|
+
`button-variant-${e}`,
|
|
2575
|
+
`button-size-${n}`,
|
|
2576
|
+
o
|
|
2577
|
+
].filter((s) => s).join(" ").trim();
|
|
2578
|
+
}
|
|
2579
|
+
const Li = c.button`
|
|
2580
|
+
width: ${({ $fullWidth: e }) => e ? "100%" : "auto"};
|
|
2581
|
+
|
|
2582
|
+
display: inline-flex;
|
|
2583
|
+
align-items: center;
|
|
2584
|
+
justify-content: center;
|
|
2585
|
+
gap: var(--button-gap);
|
|
2586
|
+
margin: var(--button-margin);
|
|
2587
|
+
cursor: pointer;
|
|
2588
|
+
text-wrap: var(--button-text-wrap);
|
|
2589
|
+
|
|
2590
|
+
color: var(--button-color);
|
|
2591
|
+
background-color: var(--button-bg-color);
|
|
2592
|
+
border: var(--button-border-width) var(--button-border-style) var(--button-border-color);
|
|
2593
|
+
box-shadow: var(--button-box-shadow);
|
|
2594
|
+
backdrop-filter: var(--button-backdrop-filter, none);
|
|
2595
|
+
|
|
2596
|
+
font-weight: var(--button-font-weight);
|
|
2597
|
+
font-size: var(--button-font-size);
|
|
2598
|
+
line-height: var(--button-line-height);
|
|
2599
|
+
padding: ${({ $icon: e, $iconPosition: t, $iconOnly: n }) => e ? `var(--button-icon-${n ? "" : `${t || "left"}-`}padding)` : "var(--button-padding)"};
|
|
2600
|
+
border-radius: var(--button-border-radius);
|
|
2601
|
+
|
|
2602
|
+
svg {
|
|
2603
|
+
width: var(--button-icon-size);
|
|
2604
|
+
height: var(--button-icon-size);
|
|
2605
|
+
}
|
|
2606
|
+
|
|
2607
|
+
&:hover {
|
|
2608
|
+
background-color: var(--button-bg-color-hover);
|
|
2609
|
+
color: var(--button-color-hover);
|
|
2610
|
+
border-color: var(--button-border-color-hover);
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2613
|
+
&:active,
|
|
2614
|
+
&.active {
|
|
2615
|
+
background-color: var(--button-bg-color-active);
|
|
2616
|
+
border-color: var(--button-border-color-active);
|
|
2617
|
+
color: var(--button-color-active);
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2620
|
+
&:focus-visible {
|
|
2621
|
+
outline: 1px solid var(--button-border-color-focused);
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
&.button-tone-danger {
|
|
2625
|
+
color: var(--button-content-color-danger);
|
|
2626
|
+
border-color: var(--button-border-color-danger);
|
|
2627
|
+
background-color: var(--button-bg-color-danger);
|
|
2628
|
+
|
|
2629
|
+
&:hover {
|
|
2630
|
+
color: var(--button-content-color-danger-hover);
|
|
2631
|
+
border-color: var(--button-border-color-danger-hover);
|
|
2632
|
+
background-color: var(--button-bg-color-danger-hover);
|
|
2633
|
+
}
|
|
2634
|
+
|
|
2635
|
+
&:active {
|
|
2636
|
+
color: var(--button-content-color-danger-pressed);
|
|
2637
|
+
border-color: var(--button-border-color-danger-pressed);
|
|
2638
|
+
background-color: var(--button-bg-color-danger-pressed);
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
&:disabled {
|
|
2643
|
+
pointer-events: none;
|
|
2644
|
+
background-color: var(--button-bg-color-disabled);
|
|
2645
|
+
color: var(--button-content-color-disabled);
|
|
2646
|
+
border-color: var(--button-border-color-disabled);
|
|
2647
|
+
border-width: var(--button-border-width-disabled);
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2650
|
+
${({ $variant: e, $size: t }) => (e === "link" || e === "ghost") && t === "small" && fe`
|
|
2651
|
+
--button-font-size: var(--font-size-sm);
|
|
2652
|
+
--button-line-height: var(--line-height-sm);
|
|
2653
|
+
--button-icon-padding: var(--button-icon-padding-small) !important;
|
|
2654
|
+
`}
|
|
2655
|
+
|
|
2656
|
+
${({ $blinking: e }) => e && fe`
|
|
2657
|
+
pointer-events: none;
|
|
2658
|
+
animation: ${Ii()} 1.2s infinite;
|
|
2659
|
+
`}
|
|
2660
|
+
`, Pi = (e) => {
|
|
2661
|
+
const {
|
|
2662
|
+
languageInsensitive: t,
|
|
2663
|
+
fullWidth: n,
|
|
2664
|
+
blinking: r,
|
|
2665
|
+
iconPosition: o,
|
|
2666
|
+
icon: a,
|
|
2667
|
+
children: s,
|
|
2668
|
+
variant: l,
|
|
2669
|
+
tone: d,
|
|
2670
|
+
size: u,
|
|
2671
|
+
extraClass: f,
|
|
2672
|
+
to: p,
|
|
2673
|
+
external: g,
|
|
2674
|
+
className: m,
|
|
2675
|
+
...v
|
|
2676
|
+
} = e, x = "tabIndex" in e ? e.tabIndex : e.to ? -1 : void 0, w = /* @__PURE__ */ h(
|
|
2677
|
+
Li,
|
|
2678
|
+
{
|
|
2679
|
+
"data-component-name": "Button/Button",
|
|
2680
|
+
...v,
|
|
2681
|
+
className: Ai({ variant: l, tone: d, size: u, extraClass: f, className: m }),
|
|
2682
|
+
$fullWidth: n,
|
|
2683
|
+
$blinking: r,
|
|
2684
|
+
$iconPosition: o,
|
|
2685
|
+
$icon: a,
|
|
2686
|
+
$iconOnly: !s && a != null,
|
|
2687
|
+
$variant: l,
|
|
2688
|
+
$size: u,
|
|
2689
|
+
tabIndex: x,
|
|
2690
|
+
children: [
|
|
2691
|
+
a && o !== "right" && a,
|
|
2692
|
+
s,
|
|
2693
|
+
a && o === "right" && a
|
|
2694
|
+
]
|
|
2695
|
+
}
|
|
2696
|
+
);
|
|
2697
|
+
return p ? /* @__PURE__ */ i(
|
|
2698
|
+
Si,
|
|
2699
|
+
{
|
|
2700
|
+
to: p,
|
|
2701
|
+
external: g,
|
|
2702
|
+
languageInsensitive: t,
|
|
2703
|
+
onClick: e.onClick,
|
|
2704
|
+
children: w
|
|
2705
|
+
}
|
|
2706
|
+
) : w;
|
|
2707
|
+
}, ne = c(Pi)``;
|
|
2708
|
+
function Ei() {
|
|
2709
|
+
const e = F(null), [t, n] = K(!1);
|
|
2710
|
+
return je(() => {
|
|
2711
|
+
if (!e.current) return;
|
|
2712
|
+
const r = e.current;
|
|
2713
|
+
function o() {
|
|
2714
|
+
n(r.scrollWidth > r.clientWidth);
|
|
2715
|
+
}
|
|
2716
|
+
o();
|
|
2717
|
+
const a = new ResizeObserver(o);
|
|
2718
|
+
return a.observe(r), () => a.disconnect();
|
|
2719
|
+
}, []), {
|
|
2720
|
+
ref: e,
|
|
2721
|
+
value: t
|
|
2722
|
+
};
|
|
2723
|
+
}
|
|
2724
|
+
function Ri(e) {
|
|
2725
|
+
const { ref: t, value: n } = Ei();
|
|
2726
|
+
return /* @__PURE__ */ i(Oi, { children: /* @__PURE__ */ i(Y, { tip: e.value, className: "no-overflow", disabled: !n, children: /* @__PURE__ */ i($i, { ref: t, children: e.value }) }) });
|
|
2727
|
+
}
|
|
2728
|
+
const Oi = c.div`
|
|
2729
|
+
overflow: hidden;
|
|
2730
|
+
.tooltip-no-overflow {
|
|
2731
|
+
overflow: hidden;
|
|
2732
|
+
}
|
|
2733
|
+
`, $i = c.div`
|
|
2734
|
+
color: var(--text-color-primary);
|
|
2735
|
+
font-size: var(--font-size-base);
|
|
2736
|
+
line-height: var(--line-height-base);
|
|
2737
|
+
overflow: hidden;
|
|
2738
|
+
white-space: nowrap;
|
|
2739
|
+
text-overflow: ellipsis;
|
|
2740
|
+
user-select: none;
|
|
2741
|
+
`;
|
|
2742
|
+
function vt(e) {
|
|
2743
|
+
const { children: t, buttons: n } = e;
|
|
2744
|
+
return /* @__PURE__ */ h(Di, { children: [
|
|
2745
|
+
/* @__PURE__ */ i(Mi, { children: t }),
|
|
2746
|
+
n && /* @__PURE__ */ i(zi, { children: n })
|
|
2747
|
+
] });
|
|
2748
|
+
}
|
|
2749
|
+
const Di = c.div`
|
|
2750
|
+
display: flex;
|
|
2751
|
+
flex-direction: row;
|
|
2752
|
+
align-items: center;
|
|
2753
|
+
padding: var(--spacing-xs);
|
|
2754
|
+
gap: var(--spacing-xs);
|
|
2755
|
+
width: 100%;
|
|
2756
|
+
flex-shrink: 0;
|
|
2757
|
+
`, Mi = c.div`
|
|
2758
|
+
display: flex;
|
|
2759
|
+
align-items: center;
|
|
2760
|
+
gap: var(--spacing-xs);
|
|
2761
|
+
min-width: 0;
|
|
2762
|
+
flex: 1;
|
|
2763
|
+
`, zi = c.div`
|
|
2764
|
+
display: flex;
|
|
2765
|
+
align-items: center;
|
|
2766
|
+
gap: 2px;
|
|
2767
|
+
`;
|
|
2768
|
+
function _i(e) {
|
|
2769
|
+
const { title: t, onCreateNewChat: n, onViewHistory: r, onClose: o } = e;
|
|
2770
|
+
return /* @__PURE__ */ h(vt, { buttons: /* @__PURE__ */ h(Fe, { children: [
|
|
2771
|
+
/* @__PURE__ */ i(Y, { tip: "New chat", children: /* @__PURE__ */ i(
|
|
2772
|
+
ne,
|
|
2773
|
+
{
|
|
2774
|
+
size: "small",
|
|
2775
|
+
variant: "text",
|
|
2776
|
+
"aria-label": "Create new chat",
|
|
2777
|
+
onClick: n,
|
|
2778
|
+
icon: /* @__PURE__ */ i(Ht, {})
|
|
2779
|
+
}
|
|
2780
|
+
) }),
|
|
2781
|
+
/* @__PURE__ */ i(Y, { tip: "Chat history", children: /* @__PURE__ */ i(
|
|
2782
|
+
ne,
|
|
2783
|
+
{
|
|
2784
|
+
size: "small",
|
|
2785
|
+
variant: "text",
|
|
2786
|
+
"aria-label": "View chat history",
|
|
2787
|
+
onClick: r,
|
|
2788
|
+
icon: /* @__PURE__ */ i(Bt, {})
|
|
2789
|
+
}
|
|
2790
|
+
) }),
|
|
2791
|
+
/* @__PURE__ */ i(Hi, { children: /* @__PURE__ */ i(Xt, {}) }),
|
|
2792
|
+
/* @__PURE__ */ i(Y, { tip: "Close", arrowPosition: "left", children: /* @__PURE__ */ i(
|
|
2793
|
+
ne,
|
|
2794
|
+
{
|
|
2795
|
+
variant: "text",
|
|
2796
|
+
size: "small",
|
|
2797
|
+
"aria-label": "Close panel",
|
|
2798
|
+
icon: /* @__PURE__ */ i(Nt, {}),
|
|
2799
|
+
onClick: o
|
|
2800
|
+
}
|
|
2801
|
+
) })
|
|
2802
|
+
] }), children: [
|
|
2803
|
+
/* @__PURE__ */ i(Vi, { children: /* @__PURE__ */ i(Vt, { size: "14px" }) }),
|
|
2804
|
+
/* @__PURE__ */ i(Ri, { value: t })
|
|
2805
|
+
] });
|
|
2806
|
+
}
|
|
2807
|
+
const Vi = c.div`
|
|
2808
|
+
display: flex;
|
|
2809
|
+
`, Hi = c.div`
|
|
2810
|
+
display: flex;
|
|
2811
|
+
height: 14px;
|
|
2812
|
+
`, Bi = /* @__PURE__ */ new Set([
|
|
2813
|
+
"color",
|
|
2814
|
+
"fontFamily",
|
|
2815
|
+
"fontSize",
|
|
2816
|
+
"fontStyle",
|
|
2817
|
+
"fontWeight",
|
|
2818
|
+
"lineHeight",
|
|
2819
|
+
"letterSpacing",
|
|
2820
|
+
"marginBottom",
|
|
2821
|
+
"marginTop",
|
|
2822
|
+
"textAlign"
|
|
2823
|
+
]), Ni = c.span.withConfig({
|
|
2824
|
+
shouldForwardProp: (e) => !Bi.has(e)
|
|
2825
|
+
}).attrs({
|
|
2826
|
+
"data-component-name": "Typography/Typography"
|
|
2827
|
+
})`
|
|
2828
|
+
color: ${({ color: e }) => e || "var(--text-color-primary)"};
|
|
2829
|
+
font-family: ${({ fontFamily: e }) => e || "var(--font-family-base)"};
|
|
2830
|
+
font-size: ${({ fontSize: e }) => e || "var(--font-size-base)"};
|
|
2831
|
+
font-style: ${({ fontStyle: e }) => e};
|
|
2832
|
+
font-weight: ${({ fontWeight: e }) => e || "var(--font-weight-regular)"};
|
|
2833
|
+
line-height: ${({ lineHeight: e }) => e || "var(--line-height-base)"};
|
|
2834
|
+
letter-spacing: ${({ letterSpacing: e }) => e};
|
|
2835
|
+
margin-bottom: ${({ marginBottom: e }) => e};
|
|
2836
|
+
margin-top: ${({ marginTop: e }) => e};
|
|
2837
|
+
text-align: ${({ textAlign: e }) => e};
|
|
2838
|
+
`;
|
|
2839
|
+
function Fi(e) {
|
|
2840
|
+
const { onReturnFromHistory: t } = e;
|
|
2841
|
+
return /* @__PURE__ */ h(vt, { children: [
|
|
2842
|
+
/* @__PURE__ */ i(
|
|
2843
|
+
ne,
|
|
2844
|
+
{
|
|
2845
|
+
size: "small",
|
|
2846
|
+
variant: "text",
|
|
2847
|
+
"aria-label": "Return to chat",
|
|
2848
|
+
onClick: t,
|
|
2849
|
+
icon: /* @__PURE__ */ i(Ft, {})
|
|
2850
|
+
}
|
|
2851
|
+
),
|
|
2852
|
+
/* @__PURE__ */ i(ji, { children: /* @__PURE__ */ i(Ni, { children: "Chat history" }) })
|
|
2853
|
+
] });
|
|
2854
|
+
}
|
|
2855
|
+
const ji = c.div`
|
|
2856
|
+
user-select: none;
|
|
2857
|
+
`;
|
|
2858
|
+
function na() {
|
|
2859
|
+
const [e, t] = K(j.CHAT), n = qe(), r = Ke(), o = () => {
|
|
2860
|
+
t(j.HISTORY);
|
|
2861
|
+
}, a = () => {
|
|
2862
|
+
t(j.CHAT);
|
|
2863
|
+
}, s = async (l) => {
|
|
2864
|
+
r.selectChat(l), t(j.CHAT);
|
|
2865
|
+
};
|
|
2866
|
+
return /* @__PURE__ */ h(Wi, { children: [
|
|
2867
|
+
/* @__PURE__ */ h(Be, { isActive: e === j.CHAT, children: [
|
|
2868
|
+
/* @__PURE__ */ i(
|
|
2869
|
+
_i,
|
|
2870
|
+
{
|
|
2871
|
+
title: r.title,
|
|
2872
|
+
onCreateNewChat: r.createNewChat,
|
|
2873
|
+
onViewHistory: o,
|
|
2874
|
+
onClose: n.closePanel
|
|
2875
|
+
}
|
|
2876
|
+
),
|
|
2877
|
+
/* @__PURE__ */ i(Qo, {}),
|
|
2878
|
+
/* @__PURE__ */ i(Ne, { children: /* @__PURE__ */ i(be, {}) })
|
|
2879
|
+
] }),
|
|
2880
|
+
/* @__PURE__ */ h(Be, { isActive: e === j.HISTORY, isSliding: !0, children: [
|
|
2881
|
+
/* @__PURE__ */ i(Fi, { onReturnFromHistory: a }),
|
|
2882
|
+
/* @__PURE__ */ i(Ci, { onChatSelect: s, onChatRemove: r.removeChat }),
|
|
2883
|
+
/* @__PURE__ */ i(Ne, { children: /* @__PURE__ */ i(be, {}) })
|
|
2884
|
+
] })
|
|
2885
|
+
] });
|
|
2886
|
+
}
|
|
2887
|
+
function Be(e) {
|
|
2888
|
+
const { children: t, isActive: n, isSliding: r = !1 } = e, o = /* @__PURE__ */ i(Ui, { inert: !n, children: t });
|
|
2889
|
+
return r ? /* @__PURE__ */ i(Yi, { $isExpanded: n, children: o }) : o;
|
|
2890
|
+
}
|
|
2891
|
+
const Wi = c.div`
|
|
2892
|
+
position: relative;
|
|
2893
|
+
height: 100%;
|
|
2894
|
+
overflow: clip;
|
|
2895
|
+
`, Ui = c.div`
|
|
2896
|
+
display: flex;
|
|
2897
|
+
height: 100%;
|
|
2898
|
+
flex-direction: column;
|
|
2899
|
+
align-items: flex-start;
|
|
2900
|
+
border-radius: var(--border-radius-md);
|
|
2901
|
+
background: var(--bg-color);
|
|
2902
|
+
margin-left: var(--spacing-xxs);
|
|
2903
|
+
`, Yi = c.div`
|
|
2904
|
+
position: absolute;
|
|
2905
|
+
inset: 0;
|
|
2906
|
+
transform: translateX(${(e) => e.$isExpanded ? "0%" : "100%"});
|
|
2907
|
+
transition-property: transform;
|
|
2908
|
+
transition-duration: 400ms;
|
|
2909
|
+
transition-timing-function: cubic-bezier(0.45, 0, 0.55, 1);
|
|
2910
|
+
@media (prefers-reduced-motion: reduce) {
|
|
2911
|
+
transition-duration: 0ms;
|
|
2912
|
+
}
|
|
2913
|
+
`, Ne = c.div`
|
|
2914
|
+
width: 100%;
|
|
2915
|
+
`;
|
|
2916
|
+
export {
|
|
2917
|
+
na as AiPanel
|
|
2918
|
+
};
|