@redocly/replay 0.27.0-next.4 → 0.27.0-next.5

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