@monoform-ui/react 0.0.0-stage → 0.2.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +228 -2
  3. package/THIRD_PARTY_NOTICES.md +37 -0
  4. package/dist/actions.d.ts +80 -0
  5. package/dist/advanced-forms.d.ts +107 -0
  6. package/dist/advanced-inputs.d.ts +103 -0
  7. package/dist/agent-chat.d.ts +98 -0
  8. package/dist/agent-input.d.ts +54 -0
  9. package/dist/ai-creation-input.d.ts +71 -0
  10. package/dist/ai-interactions.d.ts +90 -0
  11. package/dist/ai-status.d.ts +17 -0
  12. package/dist/ai.cjs +2 -0
  13. package/dist/ai.cjs.map +1 -0
  14. package/dist/ai.d.ts +6 -0
  15. package/dist/ai.js +29 -0
  16. package/dist/ai.js.map +1 -0
  17. package/dist/app-shell.d.ts +69 -0
  18. package/dist/assets/backgrounds/monolith-field-dark-desktop.avif +0 -0
  19. package/dist/assets/backgrounds/monolith-field-dark-desktop.webp +0 -0
  20. package/dist/assets/backgrounds/monolith-field-dark-mobile.avif +0 -0
  21. package/dist/assets/backgrounds/monolith-field-dark-mobile.webp +0 -0
  22. package/dist/assets/backgrounds/monolith-field-dark.svg +58 -0
  23. package/dist/assets/backgrounds/monolith-field-light-desktop.avif +0 -0
  24. package/dist/assets/backgrounds/monolith-field-light-desktop.webp +0 -0
  25. package/dist/assets/backgrounds/monolith-field-light-mobile.avif +0 -0
  26. package/dist/assets/backgrounds/monolith-field-light-mobile.webp +0 -0
  27. package/dist/assets/backgrounds/monolith-field-light.svg +58 -0
  28. package/dist/assets/backgrounds/optical-fog-dark-desktop.avif +0 -0
  29. package/dist/assets/backgrounds/optical-fog-dark-desktop.webp +0 -0
  30. package/dist/assets/backgrounds/optical-fog-dark-mobile.avif +0 -0
  31. package/dist/assets/backgrounds/optical-fog-dark-mobile.webp +0 -0
  32. package/dist/assets/backgrounds/optical-fog-dark.svg +50 -0
  33. package/dist/assets/backgrounds/optical-fog-light-desktop.avif +0 -0
  34. package/dist/assets/backgrounds/optical-fog-light-desktop.webp +0 -0
  35. package/dist/assets/backgrounds/optical-fog-light-mobile.avif +0 -0
  36. package/dist/assets/backgrounds/optical-fog-light-mobile.webp +0 -0
  37. package/dist/assets/backgrounds/optical-fog-light.svg +50 -0
  38. package/dist/assets/backgrounds/orbital-field-dark-desktop.avif +0 -0
  39. package/dist/assets/backgrounds/orbital-field-dark-desktop.webp +0 -0
  40. package/dist/assets/backgrounds/orbital-field-dark-mobile.avif +0 -0
  41. package/dist/assets/backgrounds/orbital-field-dark-mobile.webp +0 -0
  42. package/dist/assets/backgrounds/orbital-field-dark.svg +49 -0
  43. package/dist/assets/backgrounds/orbital-field-light-desktop.avif +0 -0
  44. package/dist/assets/backgrounds/orbital-field-light-desktop.webp +0 -0
  45. package/dist/assets/backgrounds/orbital-field-light-mobile.avif +0 -0
  46. package/dist/assets/backgrounds/orbital-field-light-mobile.webp +0 -0
  47. package/dist/assets/backgrounds/orbital-field-light.svg +49 -0
  48. package/dist/assets/backgrounds/signal-lattice-dark-desktop.avif +0 -0
  49. package/dist/assets/backgrounds/signal-lattice-dark-desktop.webp +0 -0
  50. package/dist/assets/backgrounds/signal-lattice-dark-mobile.avif +0 -0
  51. package/dist/assets/backgrounds/signal-lattice-dark-mobile.webp +0 -0
  52. package/dist/assets/backgrounds/signal-lattice-dark.svg +39 -0
  53. package/dist/assets/backgrounds/signal-lattice-light-desktop.avif +0 -0
  54. package/dist/assets/backgrounds/signal-lattice-light-desktop.webp +0 -0
  55. package/dist/assets/backgrounds/signal-lattice-light-mobile.avif +0 -0
  56. package/dist/assets/backgrounds/signal-lattice-light-mobile.webp +0 -0
  57. package/dist/assets/backgrounds/signal-lattice-light.svg +39 -0
  58. package/dist/background-assets.d.ts +144 -0
  59. package/dist/backgrounds.cjs +2 -0
  60. package/dist/backgrounds.cjs.map +1 -0
  61. package/dist/backgrounds.css +463 -0
  62. package/dist/backgrounds.d.ts +44 -0
  63. package/dist/backgrounds.js +256 -0
  64. package/dist/backgrounds.js.map +1 -0
  65. package/dist/catalog.cjs +2 -0
  66. package/dist/catalog.cjs.map +1 -0
  67. package/dist/catalog.d.ts +27 -0
  68. package/dist/catalog.js +307 -0
  69. package/dist/catalog.js.map +1 -0
  70. package/dist/collections-CXPc6huw.cjs +2 -0
  71. package/dist/collections-CXPc6huw.cjs.map +1 -0
  72. package/dist/collections-GglQdMPr.js +1308 -0
  73. package/dist/collections-GglQdMPr.js.map +1 -0
  74. package/dist/collections.d.ts +52 -0
  75. package/dist/command-palette-B4r2GzmF.cjs +2 -0
  76. package/dist/command-palette-B4r2GzmF.cjs.map +1 -0
  77. package/dist/command-palette-DwfgljM2.js +2773 -0
  78. package/dist/command-palette-DwfgljM2.js.map +1 -0
  79. package/dist/command-palette.d.ts +26 -0
  80. package/dist/core.cjs +2 -0
  81. package/dist/core.cjs.map +1 -0
  82. package/dist/core.css +8659 -0
  83. package/dist/core.d.ts +19 -0
  84. package/dist/core.js +176 -0
  85. package/dist/core.js.map +1 -0
  86. package/dist/data-grid.d.ts +62 -0
  87. package/dist/data-workbench.d.ts +103 -0
  88. package/dist/data.cjs +2 -0
  89. package/dist/data.cjs.map +1 -0
  90. package/dist/data.d.ts +6 -0
  91. package/dist/data.js +19 -0
  92. package/dist/data.js.map +1 -0
  93. package/dist/description-list.d.ts +8 -0
  94. package/dist/effects.cjs +2 -0
  95. package/dist/effects.cjs.map +1 -0
  96. package/dist/effects.css +442 -0
  97. package/dist/effects.d.ts +2 -0
  98. package/dist/effects.js +19 -0
  99. package/dist/effects.js.map +1 -0
  100. package/dist/feedback.d.ts +40 -0
  101. package/dist/forms.d.ts +89 -0
  102. package/dist/harness-D7tlTUb2.cjs +2 -0
  103. package/dist/harness-D7tlTUb2.cjs.map +1 -0
  104. package/dist/harness-Dcqe3-AP.js +2282 -0
  105. package/dist/harness-Dcqe3-AP.js.map +1 -0
  106. package/dist/harness.d.ts +89 -0
  107. package/dist/hooks.d.ts +6 -0
  108. package/dist/image-effects-BaXRloLB.js +164 -0
  109. package/dist/image-effects-BaXRloLB.js.map +1 -0
  110. package/dist/image-effects-D57JACXp.cjs +2 -0
  111. package/dist/image-effects-D57JACXp.cjs.map +1 -0
  112. package/dist/image-effects.d.ts +14 -0
  113. package/dist/index.cjs +2 -0
  114. package/dist/index.cjs.map +1 -0
  115. package/dist/index.d.ts +5 -0
  116. package/dist/index.js +239 -0
  117. package/dist/index.js.map +1 -0
  118. package/dist/locale.d.ts +358 -0
  119. package/dist/motion-effects-C1Rs4a2H.js +449 -0
  120. package/dist/motion-effects-C1Rs4a2H.js.map +1 -0
  121. package/dist/motion-effects-ze3SOVGs.cjs +2 -0
  122. package/dist/motion-effects-ze3SOVGs.cjs.map +1 -0
  123. package/dist/motion-effects.d.ts +76 -0
  124. package/dist/nav-menu.d.ts +45 -0
  125. package/dist/navigation-BG-qLyKt.cjs +2 -0
  126. package/dist/navigation-BG-qLyKt.cjs.map +1 -0
  127. package/dist/navigation-Bp7q1n-5.js +252 -0
  128. package/dist/navigation-Bp7q1n-5.js.map +1 -0
  129. package/dist/navigation.d.ts +53 -0
  130. package/dist/overlays-BhrWwlkN.js +1288 -0
  131. package/dist/overlays-BhrWwlkN.js.map +1 -0
  132. package/dist/overlays-DvozzH8D.cjs +2 -0
  133. package/dist/overlays-DvozzH8D.cjs.map +1 -0
  134. package/dist/overlays.d.ts +92 -0
  135. package/dist/people-picker.d.ts +65 -0
  136. package/dist/portal.d.ts +3 -0
  137. package/dist/primitives-Bb7v-uZh.js +217 -0
  138. package/dist/primitives-Bb7v-uZh.js.map +1 -0
  139. package/dist/primitives-CEcOVwUM.cjs +2 -0
  140. package/dist/primitives-CEcOVwUM.cjs.map +1 -0
  141. package/dist/primitives.d.ts +66 -0
  142. package/dist/rounded-card-border-B3d1HqwY.js +185 -0
  143. package/dist/rounded-card-border-B3d1HqwY.js.map +1 -0
  144. package/dist/rounded-card-border-CMiEPJIF.cjs +2 -0
  145. package/dist/rounded-card-border-CMiEPJIF.cjs.map +1 -0
  146. package/dist/rounded-card-border.d.ts +3 -0
  147. package/dist/sizes.d.ts +4 -0
  148. package/dist/status-toast.d.ts +20 -0
  149. package/dist/styles.css +9566 -0
  150. package/dist/theme-C3i6xkHd.cjs +2 -0
  151. package/dist/theme-C3i6xkHd.cjs.map +1 -0
  152. package/dist/theme-CHYnSgLv.js +914 -0
  153. package/dist/theme-CHYnSgLv.js.map +1 -0
  154. package/dist/theme.d.ts +24 -0
  155. package/dist/timeline.d.ts +15 -0
  156. package/dist/tree-view-Djlqyml-.js +132 -0
  157. package/dist/tree-view-Djlqyml-.js.map +1 -0
  158. package/dist/tree-view-iVh5jMNt.cjs +2 -0
  159. package/dist/tree-view-iVh5jMNt.cjs.map +1 -0
  160. package/dist/tree-view.d.ts +18 -0
  161. package/dist/utils.d.ts +2 -0
  162. package/package.json +162 -4
@@ -0,0 +1,2282 @@
1
+ import { jsx as e, jsxs as l, Fragment as Ke } from "react/jsx-runtime";
2
+ import { forwardRef as oe, useRef as le, useEffect as ve, useId as Pe, useState as j, useMemo as qe } from "react";
3
+ import { a as bn, u as V, c as $ } from "./theme-CHYnSgLv.js";
4
+ import { FileText as Ze, X as $e, SlidersHorizontal as _n, Paperclip as Nn, ArrowUp as Je, ImagePlus as Be, ChevronDown as De, Lock as yn, Unlock as wn, Images as Cn, AtSign as Mn, Sparkles as pe, AlertTriangle as zn, ShieldCheck as en, Check as Oe, HelpCircle as kn, Circle as Sn, Clipboard as xn, RotateCcw as nn, ThumbsUp as An, ThumbsDown as In, MoreHorizontal as Tn, Wrench as an, User as Rn, Bot as tn, ExternalLink as Pn, GitBranch as ln, ChevronLeft as Dn, CircleDashed as rn, Database as Ln, Hammer as $n, Timer as On, CircleSlash as En, TriangleAlert as We, CheckCircle2 as Vn } from "lucide-react";
5
+ import { B as qn } from "./motion-effects-C1Rs4a2H.js";
6
+ import { aR as ie, av as Le, al as Ie, ap as Te, l as ee, ao as Re, au as He, aj as Xe, ac as Ne, ah as ge, B as re, ax as Ee, aq as sn, A as cn, aA as Un, aC as Fn, aD as xe, aB as Ae } from "./overlays-BhrWwlkN.js";
7
+ import { I as Ye } from "./primitives-Bb7v-uZh.js";
8
+ import { a as Ue, D as te, T as Kn, b as jn } from "./tree-view-Djlqyml-.js";
9
+ const wa = {
10
+ thinking: "Thinking...",
11
+ searching: "Searching...",
12
+ listening: "Listening...",
13
+ solving: "Solving...",
14
+ speaking: "Speaking...",
15
+ error: "Connection interrupted"
16
+ };
17
+ function Bn(n = 180) {
18
+ const r = Math.PI * (3 - Math.sqrt(5));
19
+ return Array.from({ length: n }, (i, a) => {
20
+ const t = 1 - a / (n - 1) * 2, c = Math.sqrt(Math.max(0, 1 - t * t)), f = r * a;
21
+ return {
22
+ x: Math.cos(f) * c,
23
+ y: t,
24
+ z: Math.sin(f) * c,
25
+ phase: (Math.sin(a * 91.73) + 1) * Math.PI,
26
+ size: 0.8 + (Math.sin(a * 37.41) + 1) / 2 * 0.8
27
+ };
28
+ });
29
+ }
30
+ function Wn(n, r, i, a) {
31
+ const t = n.getContext("2d");
32
+ if (!t) return;
33
+ const c = n.getBoundingClientRect(), f = Math.max(1, c.width), g = Math.max(1, c.height), N = Math.min(window.devicePixelRatio || 1, 2);
34
+ (n.width !== Math.round(f * N) || n.height !== Math.round(g * N)) && (n.width = Math.round(f * N), n.height = Math.round(g * N)), t.setTransform(N, 0, 0, N, 0, 0), t.clearRect(0, 0, f, g);
35
+ const v = getComputedStyle(n), h = v.getPropertyValue("--mf-text").trim() || "currentColor", M = v.getPropertyValue("--mf-text-muted").trim() || h, k = v.getPropertyValue("--mf-red").trim() || "#ef7777", u = document.documentElement.dataset.mfTheme === "light" || n.closest(".mf-root")?.getAttribute("data-mf-theme") === "light", o = i === "error" ? k : h, S = u ? "17,19,21" : "245,246,247", b = f / 2, z = g / 2, C = Math.min(f, g) * 0.33, x = {
36
+ thinking: 0.58,
37
+ searching: 0.34,
38
+ listening: 0.44,
39
+ solving: 0.9,
40
+ speaking: 0.5,
41
+ error: 0.12
42
+ }, P = t.createRadialGradient(b, z, 1, b, z, C * 1.3);
43
+ P.addColorStop(
44
+ 0,
45
+ i === "error" ? "rgba(255,100,100,.08)" : `rgba(${S},.05)`
46
+ ), P.addColorStop(0.64, `rgba(${S},.01)`), P.addColorStop(1, `rgba(${S},0)`), t.fillStyle = P, t.fillRect(0, 0, f, g), t.save(), t.translate(b, z), t.rotate(-0.18), t.strokeStyle = M, t.globalAlpha = 0.16, t.lineWidth = 0.8, t.setLineDash([2, 5]), [0.72, 1, 1.23].forEach((p, y) => {
47
+ t.beginPath(), t.ellipse(
48
+ 0,
49
+ 0,
50
+ C * p,
51
+ C * p * (0.34 + y * 0.07),
52
+ y * 0.4,
53
+ 0,
54
+ Math.PI * 2
55
+ ), t.stroke();
56
+ }), t.restore();
57
+ const D = a * x[i], q = -0.2 + Math.sin(a * 0.35) * 0.1, L = Math.cos(D), B = Math.sin(D), _ = Math.cos(q), U = Math.sin(q), m = a * 0.72, d = [];
58
+ if (r.forEach((p, y) => {
59
+ let F = p.x, G = p.y, Q = p.z;
60
+ if (i === "listening") {
61
+ const K = 1 + Math.sin(a * 3.2 + p.y * 5 + p.phase * 0.12) * 0.055;
62
+ F *= K, G *= K, Q *= K;
63
+ } else if (i === "speaking") {
64
+ const K = 1 + Math.sin(a * 4.1 - p.y * 7.5 + p.phase * 0.1) * 0.11;
65
+ F *= K, G *= K, Q *= K;
66
+ } else i === "solving" ? F += Math.sin(a * 2.2 + Math.floor(p.y * 5) * 0.72) * 0.045 : i === "error" && (F += Math.sin(a * 9 + y * 3.1) * 8e-3, G += Math.cos(a * 8 + y * 2.7) * 8e-3);
67
+ const A = F * L - Q * B, T = F * B + Q * L, Y = G * _ - T * U, W = G * U + T * _, Z = 1.55 / (1.55 + W * 0.46), me = Math.max(0, Math.min(1, (1 - W) / 2));
68
+ let de = 0.22 + me * 0.78;
69
+ if (i === "searching") {
70
+ const K = Math.atan2(Q, F), ue = Math.abs(
71
+ Math.atan2(Math.sin(K - m), Math.cos(K - m))
72
+ ), se = Math.min(ue, Math.PI - ue), he = Math.exp(-Math.pow(se / 0.14, 2));
73
+ de *= 0.36 + he * 0.92;
74
+ }
75
+ i === "error" && (de *= 0.48), d.push({
76
+ x: b + A * C * Z,
77
+ y: z + Y * C * Z,
78
+ z: W,
79
+ alpha: de,
80
+ size: p.size * (0.74 + me * 0.5)
81
+ });
82
+ }), d.sort((p, y) => y.z - p.z), d.forEach((p) => {
83
+ t.beginPath(), t.arc(p.x, p.y, p.size, 0, Math.PI * 2), t.fillStyle = o, t.globalAlpha = p.alpha, t.fill();
84
+ }), t.globalAlpha = 1, i === "searching") {
85
+ t.save(), t.translate(b, z), t.strokeStyle = o, t.lineWidth = 0.8, t.setLineDash([1.5, 5]), t.globalAlpha = 0.2, t.beginPath(), t.ellipse(
86
+ 0,
87
+ 0,
88
+ Math.max(1.5, Math.abs(Math.cos(m)) * C),
89
+ C * 0.98,
90
+ -0.08,
91
+ 0,
92
+ Math.PI * 2
93
+ ), t.stroke(), t.setLineDash([]), t.globalAlpha = 0.62;
94
+ const p = Math.sin(a * 1.7) * C * 0.72, y = Math.cos(m) * Math.sqrt(Math.max(0, C * C - p * p));
95
+ t.beginPath(), t.arc(y, p, 1.7, 0, Math.PI * 2), t.fillStyle = o, t.fill(), t.restore(), t.globalAlpha = 1;
96
+ }
97
+ if (i === "speaking") {
98
+ for (let p = 0; p < 3; p += 1) {
99
+ const y = (a * 0.22 + p * 0.33) % 1;
100
+ t.beginPath(), t.arc(b, z, C * (0.7 + y * 0.8), 0, Math.PI * 2), t.strokeStyle = o, t.globalAlpha = (1 - y) * 0.14, t.lineWidth = 0.8, t.stroke();
101
+ }
102
+ t.globalAlpha = 1;
103
+ }
104
+ i === "error" && (t.beginPath(), t.arc(b, z, C * 1.06, 0, Math.PI * 2), t.strokeStyle = k, t.globalAlpha = 0.45, t.lineWidth = 1, t.stroke(), t.globalAlpha = 1);
105
+ }
106
+ const Hn = oe(
107
+ ({
108
+ state: n = "thinking",
109
+ size: r = 180,
110
+ speed: i = 1,
111
+ paused: a = !1,
112
+ label: t,
113
+ className: c,
114
+ style: f,
115
+ ...g
116
+ }, N) => {
117
+ const v = le(null), h = le(null), { resolvedMode: M } = bn(), { messages: k } = V();
118
+ return ve(() => {
119
+ const u = v.current, o = h.current;
120
+ if (!u || !o) return;
121
+ const S = Bn(), b = window.matchMedia("(prefers-reduced-motion: reduce)");
122
+ let z = 0, C = 0, x = performance.now(), P = !0;
123
+ const D = (m) => {
124
+ Wn(o, S, n, m);
125
+ }, q = (m) => {
126
+ const d = Math.min(0.05, Math.max(0, (m - x) / 1e3));
127
+ x = m, C += d * i, D(C), z = requestAnimationFrame(q);
128
+ }, L = () => {
129
+ if (z && cancelAnimationFrame(z), z = 0, a || b.matches || !P || document.hidden) {
130
+ D(C || 0.8);
131
+ return;
132
+ }
133
+ x = performance.now(), z = requestAnimationFrame(q);
134
+ }, B = new ResizeObserver(() => D(C)), _ = new IntersectionObserver((m) => {
135
+ P = m.some((d) => d.isIntersecting), L();
136
+ }), U = () => L();
137
+ return B.observe(u), _.observe(u), b.addEventListener("change", L), document.addEventListener("visibilitychange", U), L(), () => {
138
+ z && cancelAnimationFrame(z), B.disconnect(), _.disconnect(), b.removeEventListener("change", L), document.removeEventListener("visibilitychange", U);
139
+ };
140
+ }, [a, M, i, n]), /* @__PURE__ */ e(
141
+ "div",
142
+ {
143
+ ref: (u) => {
144
+ v.current = u, typeof N == "function" ? N(u) : N && (N.current = u);
145
+ },
146
+ className: $("mf-ai-orb", c),
147
+ style: { width: r, height: r, ...f },
148
+ "data-state": n,
149
+ ...g,
150
+ children: /* @__PURE__ */ e(
151
+ "canvas",
152
+ {
153
+ ref: h,
154
+ className: "mf-ai-orb__canvas",
155
+ role: "img",
156
+ "aria-label": t ?? k.ai.orbLabel(k.ai[n])
157
+ }
158
+ )
159
+ }
160
+ );
161
+ }
162
+ );
163
+ Hn.displayName = "AIStatusOrb";
164
+ function Ca({
165
+ state: n = "thinking",
166
+ label: r,
167
+ elapsed: i,
168
+ className: a,
169
+ ...t
170
+ }) {
171
+ const { messages: c } = V();
172
+ return /* @__PURE__ */ l(
173
+ "div",
174
+ {
175
+ className: $("mf-ai-pill", `mf-ai-pill--${n}`, a),
176
+ role: "status",
177
+ "aria-live": "polite",
178
+ ...t,
179
+ children: [
180
+ /* @__PURE__ */ e("span", { className: "mf-ai-pill__dot", "aria-hidden": "true" }),
181
+ /* @__PURE__ */ e("span", { children: r ?? c.ai[n] }),
182
+ i ? /* @__PURE__ */ e("span", { className: "mf-ai-pill__elapsed", children: i }) : null
183
+ ]
184
+ }
185
+ );
186
+ }
187
+ function Xn(n, r) {
188
+ return n.reduce((i, a) => {
189
+ const t = a.defaultValue ?? a.options.find((f) => !f.disabled)?.value, c = r?.[a.name] ?? t;
190
+ return c && (i[a.name] = c), i;
191
+ }, {});
192
+ }
193
+ const Yn = oe(
194
+ ({
195
+ models: n = [],
196
+ model: r,
197
+ defaultModel: i,
198
+ onModelChange: a,
199
+ parameters: t = [],
200
+ parameterValues: c,
201
+ defaultParameterValues: f,
202
+ onParameterValuesChange: g,
203
+ value: N,
204
+ defaultValue: v = "",
205
+ onValueChange: h,
206
+ files: M,
207
+ defaultFiles: k = [],
208
+ onFilesChange: u,
209
+ onSubmit: o,
210
+ onError: S,
211
+ placeholder: b,
212
+ disabled: z = !1,
213
+ loading: C = !1,
214
+ maxLength: x,
215
+ allowAttachments: P = !0,
216
+ accept: D,
217
+ multipleAttachments: q = !0,
218
+ resetOnSubmit: L = !0,
219
+ showShortcutHint: B = !0,
220
+ submitLabel: _,
221
+ textareaId: U,
222
+ beam: m = "auto",
223
+ beamColorVariant: d = "colorful",
224
+ beamActive: p,
225
+ beamStrength: y = 0.72,
226
+ className: F,
227
+ "aria-label": G,
228
+ ...Q
229
+ }, A) => {
230
+ const { messages: T } = V(), Y = Pe(), W = U ?? Y, Z = le(null), [me, de] = j(!1), [K, ue] = ie({
231
+ value: N,
232
+ defaultValue: v,
233
+ onChange: h
234
+ }), se = i ?? n.find((I) => !I.disabled)?.value ?? "", [he, ye] = ie({
235
+ value: r,
236
+ defaultValue: se,
237
+ onChange: a
238
+ }), [w, we] = ie({
239
+ value: c,
240
+ defaultValue: Xn(t, f),
241
+ onChange: g
242
+ }), [O, be] = ie({
243
+ value: M,
244
+ defaultValue: k,
245
+ onChange: u
246
+ }), H = C || me, Ce = !z && !H && (K.trim().length > 0 || O.length > 0), ne = n.find((I) => I.value === he)?.label ?? he, Me = (I) => {
247
+ if (!I) return;
248
+ const J = Array.from(I);
249
+ be(
250
+ q ? [...O, ...J] : J.slice(0, 1)
251
+ ), Z.current && (Z.current.value = "");
252
+ }, X = async () => {
253
+ if (Ce) {
254
+ de(!0);
255
+ try {
256
+ await o({
257
+ value: K.trim(),
258
+ model: he,
259
+ parameters: { ...w },
260
+ files: [...O]
261
+ }), L && (ue(""), be([]));
262
+ } catch (I) {
263
+ S?.(I);
264
+ } finally {
265
+ de(!1);
266
+ }
267
+ }
268
+ }, ze = (I) => {
269
+ I.preventDefault(), X();
270
+ }, ke = (I) => {
271
+ I.key === "Enter" && !I.shiftKey && !I.nativeEvent.isComposing && (I.preventDefault(), X());
272
+ }, Se = /* @__PURE__ */ l(
273
+ "form",
274
+ {
275
+ ref: A,
276
+ className: $("mf-agent-input", F),
277
+ "aria-label": G ?? T.agentInput.placeholder,
278
+ "aria-busy": H || void 0,
279
+ "data-disabled": z || void 0,
280
+ "data-loading": H || void 0,
281
+ onSubmit: ze,
282
+ ...Q,
283
+ children: [
284
+ /* @__PURE__ */ e("label", { htmlFor: W, className: "mf-visually-hidden", children: G ?? T.agentInput.placeholder }),
285
+ /* @__PURE__ */ e(
286
+ "textarea",
287
+ {
288
+ id: W,
289
+ className: "mf-agent-input__field",
290
+ value: K,
291
+ placeholder: b ?? T.agentInput.placeholder,
292
+ disabled: z || H,
293
+ maxLength: x,
294
+ rows: 3,
295
+ onChange: (I) => ue(I.target.value),
296
+ onKeyDown: ke
297
+ }
298
+ ),
299
+ O.length ? /* @__PURE__ */ e("ul", { className: "mf-agent-input__files", "aria-label": T.forms.selectedFiles, children: O.map((I, J) => /* @__PURE__ */ l("li", { children: [
300
+ /* @__PURE__ */ e(Ze, { size: 13, "aria-hidden": "true" }),
301
+ /* @__PURE__ */ e("span", { children: I.name }),
302
+ /* @__PURE__ */ e(
303
+ "button",
304
+ {
305
+ type: "button",
306
+ "aria-label": T.agentInput.removeAttachment(I.name),
307
+ disabled: z || H,
308
+ onClick: () => be(
309
+ O.filter((_e, ce) => ce !== J)
310
+ ),
311
+ children: /* @__PURE__ */ e($e, { size: 11, "aria-hidden": "true" })
312
+ }
313
+ )
314
+ ] }, `${I.name}-${I.lastModified}-${J}`)) }) : null,
315
+ /* @__PURE__ */ l("div", { className: "mf-agent-input__toolbar", children: [
316
+ /* @__PURE__ */ l("div", { className: "mf-agent-input__controls", children: [
317
+ n.length ? /* @__PURE__ */ e(
318
+ Le,
319
+ {
320
+ className: "mf-agent-input__select mf-agent-input__model",
321
+ value: he,
322
+ onValueChange: ye,
323
+ options: n,
324
+ "aria-label": `${T.agentInput.modelLabel}: ${ne}`,
325
+ disabled: z || H
326
+ }
327
+ ) : null,
328
+ t.map((I) => {
329
+ const J = w[I.name] ?? I.defaultValue ?? I.options.find((ce) => !ce.disabled)?.value ?? "", _e = I.options.find((ce) => ce.value === J)?.label ?? J;
330
+ return /* @__PURE__ */ l("div", { className: "mf-agent-input__parameter", children: [
331
+ /* @__PURE__ */ e(
332
+ _n,
333
+ {
334
+ className: "mf-agent-input__parameter-icon",
335
+ size: 13,
336
+ "aria-hidden": "true"
337
+ }
338
+ ),
339
+ /* @__PURE__ */ e(
340
+ Le,
341
+ {
342
+ className: "mf-agent-input__select",
343
+ value: J,
344
+ onValueChange: (ce) => we({
345
+ ...w,
346
+ [I.name]: ce
347
+ }),
348
+ options: I.options,
349
+ "aria-label": `${I.label}: ${_e}`,
350
+ disabled: z || H
351
+ }
352
+ )
353
+ ] }, I.name);
354
+ }),
355
+ P ? /* @__PURE__ */ l(Ke, { children: [
356
+ /* @__PURE__ */ e(
357
+ "input",
358
+ {
359
+ ref: Z,
360
+ className: "mf-agent-input__file-native",
361
+ type: "file",
362
+ accept: D,
363
+ multiple: q,
364
+ tabIndex: -1,
365
+ "aria-label": T.agentInput.chooseAttachment,
366
+ disabled: z || H,
367
+ onChange: (I) => Me(I.target.files)
368
+ }
369
+ ),
370
+ /* @__PURE__ */ e(
371
+ "button",
372
+ {
373
+ type: "button",
374
+ className: "mf-agent-input__tool",
375
+ "aria-label": T.agentInput.attachFile,
376
+ disabled: z || H,
377
+ onClick: () => Z.current?.click(),
378
+ children: /* @__PURE__ */ e(Nn, { size: 15, "aria-hidden": "true" })
379
+ }
380
+ )
381
+ ] }) : null
382
+ ] }),
383
+ /* @__PURE__ */ l("div", { className: "mf-agent-input__actions", children: [
384
+ B ? /* @__PURE__ */ e("span", { className: "mf-agent-input__hint", children: T.agentInput.shortcutHint }) : null,
385
+ x ? /* @__PURE__ */ l("span", { className: "mf-agent-input__count", children: [
386
+ K.length,
387
+ "/",
388
+ x
389
+ ] }) : null,
390
+ /* @__PURE__ */ e(
391
+ "button",
392
+ {
393
+ type: "submit",
394
+ className: "mf-agent-input__send",
395
+ "aria-label": H ? T.agentInput.sending : _ ?? T.agentInput.send,
396
+ disabled: !Ce,
397
+ children: H ? /* @__PURE__ */ e("span", { className: "mf-agent-input__spinner", "aria-hidden": "true" }) : /* @__PURE__ */ e(Je, { size: 16, "aria-hidden": "true" })
398
+ }
399
+ )
400
+ ] })
401
+ ] })
402
+ ]
403
+ }
404
+ );
405
+ return m === "none" ? Se : /* @__PURE__ */ e(
406
+ qn,
407
+ {
408
+ className: "mf-agent-input-beam",
409
+ size: m === "auto" ? "pulse-inner" : m,
410
+ colorVariant: d,
411
+ active: p ?? (m === "auto" ? H : !0),
412
+ strength: y,
413
+ children: Se
414
+ }
415
+ );
416
+ }
417
+ );
418
+ Yn.displayName = "AgentInput";
419
+ const Gn = [
420
+ { value: "smart", label: "智能" },
421
+ { value: "1:1", label: "1:1" },
422
+ { value: "9:16", label: "9:16" },
423
+ { value: "16:9", label: "16:9" },
424
+ { value: "3:4", label: "3:4" },
425
+ { value: "4:3", label: "4:3" },
426
+ { value: "2:3", label: "2:3" },
427
+ { value: "3:2", label: "3:2" },
428
+ { value: "9:21", label: "9:21" },
429
+ { value: "21:9", label: "21:9" }
430
+ ], on = [
431
+ { value: "1.5K", label: "1.5K", baseSize: 1536 },
432
+ { value: "2K", label: "2K", baseSize: 2048 },
433
+ { value: "4K", label: "4K", baseSize: 4096 }
434
+ ], Qn = [
435
+ { value: "image", label: "图片生成" },
436
+ { value: "video", label: "视频生成" }
437
+ ], Zn = [
438
+ { value: "standard", label: "通用模型" },
439
+ { value: "pro", label: "专业模型", premium: !0 }
440
+ ];
441
+ function dn(n) {
442
+ if (n === "smart") return 1;
443
+ const [r, i] = n.split(":").map(Number);
444
+ return (r ?? 1) / (i ?? 1);
445
+ }
446
+ function un(n, r) {
447
+ const i = dn(n);
448
+ return i >= 1 ? { width: r, height: Math.max(1, Math.round(r / i)) } : { width: Math.max(1, Math.round(r * i)), height: r };
449
+ }
450
+ function Ge(n, r, i) {
451
+ const a = i?.ratio ?? "1:1", t = i?.resolution ?? "2K", c = on.find(
452
+ (g) => g.value === t
453
+ ), f = i?.width && i?.height ? { width: i.width, height: i.height } : un(a, c?.baseSize ?? 2048);
454
+ return {
455
+ prompt: i?.prompt ?? "",
456
+ mode: i?.mode ?? n[0]?.value ?? "image",
457
+ model: i?.model ?? r[0]?.value ?? "standard",
458
+ ratio: a,
459
+ resolution: t,
460
+ width: f.width,
461
+ height: f.height,
462
+ lockAspectRatio: i?.lockAspectRatio ?? !0,
463
+ count: i?.count ?? 1,
464
+ referenceIds: i?.referenceIds ?? [],
465
+ files: i?.files ?? []
466
+ };
467
+ }
468
+ function Ve(n) {
469
+ return `${n.name}:${n.lastModified}:${n.size}`;
470
+ }
471
+ function Jn(n, r) {
472
+ const i = r?.split(",").map((c) => c.trim().toLowerCase()).filter(Boolean);
473
+ if (!i?.length) return !0;
474
+ const a = n.name.toLowerCase(), t = n.type.toLowerCase();
475
+ return i.some((c) => c.startsWith(".") ? a.endsWith(c) : c.endsWith("/*") ? t.startsWith(c.slice(0, -1)) : t === c);
476
+ }
477
+ const ea = oe(
478
+ ({
479
+ modes: n = Qn,
480
+ models: r = Zn,
481
+ ratios: i = Gn,
482
+ resolutions: a = on,
483
+ references: t = [],
484
+ value: c,
485
+ defaultValue: f,
486
+ onValueChange: g,
487
+ onSubmit: N,
488
+ onError: v,
489
+ onCreateReference: h,
490
+ cost: M,
491
+ placeholder: k,
492
+ disabled: u = !1,
493
+ loading: o = !1,
494
+ maxFiles: S = 4,
495
+ maxCount: b = 4,
496
+ accept: z = "image/*",
497
+ resetOnSubmit: C = !0,
498
+ submitLabel: x,
499
+ className: P,
500
+ "aria-label": D,
501
+ ...q
502
+ }, L) => {
503
+ const { messages: B } = V(), _ = B.aiCreationInput, U = Pe(), m = le(null), [d, p] = j(!1), [y, F] = j(!1), [G, Q] = j(!1), [A, T] = j(!1), [Y, W] = j(""), [Z, me] = j(0), [de, K] = j(0), [ue, se] = j(0), [he, ye] = j({}), [w, we] = ie({
504
+ value: c,
505
+ defaultValue: Ge(n, r, f),
506
+ onChange: g
507
+ }), O = o || d, be = n.find((s) => s.value === w.mode), H = r.find((s) => s.value === w.model), Ce = a.find(
508
+ (s) => s.value === w.resolution
509
+ ), ne = qe(() => {
510
+ const s = Y.trim().toLocaleLowerCase();
511
+ return t.filter(
512
+ (R) => !s || `${R.label} ${R.description ?? ""}`.toLocaleLowerCase().includes(s)
513
+ );
514
+ }, [Y, t]), Me = !u && !O && (w.prompt.trim().length > 0 || w.files.length > 0 || w.referenceIds.length > 0);
515
+ ve(() => {
516
+ if (typeof URL > "u" || typeof URL.createObjectURL != "function") {
517
+ ye({});
518
+ return;
519
+ }
520
+ const s = w.files.reduce((R, E) => (R[Ve(E)] = URL.createObjectURL(E), R), {});
521
+ return ye(s), () => {
522
+ Object.values(s).forEach((R) => URL.revokeObjectURL(R));
523
+ };
524
+ }, [w.files]);
525
+ const X = (s) => we({ ...w, ...s }), ze = (s, R) => {
526
+ const E = a.find((ae) => ae.value === R)?.baseSize;
527
+ X({
528
+ ratio: s,
529
+ resolution: R,
530
+ ...E ? un(s, E) : {}
531
+ });
532
+ }, ke = (s, R) => {
533
+ const E = Math.max(1, Math.round(R));
534
+ if (!w.lockAspectRatio) {
535
+ X({ [s]: E, resolution: "custom" });
536
+ return;
537
+ }
538
+ const ae = w.width / w.height;
539
+ X({
540
+ width: s === "width" ? E : Math.max(1, Math.round(E * ae)),
541
+ height: s === "height" ? E : Math.max(1, Math.round(E / ae)),
542
+ resolution: "custom"
543
+ });
544
+ }, Se = (s) => {
545
+ if (!s) return;
546
+ const R = Array.from(s).filter(
547
+ (E) => Jn(E, z) && E.size <= 10 * 1024 * 1024
548
+ );
549
+ X({ files: [...w.files, ...R].slice(0, S) }), m.current && (m.current.value = "");
550
+ }, je = () => {
551
+ me(w.prompt.length), K(w.prompt.length), W(""), se(0), T(!0);
552
+ }, I = (s, R) => {
553
+ X({ prompt: s });
554
+ const ae = s.slice(0, R).match(/(?:^|\s)@([^\s@]*)$/);
555
+ if (!ae) {
556
+ T(!1);
557
+ return;
558
+ }
559
+ const fe = ae[1] ?? "";
560
+ W(fe), me(R - fe.length - 1), K(R), se(0), T(!0);
561
+ }, J = (s) => {
562
+ const R = w.prompt.slice(0, Z).replace(/\s+$/, ""), E = w.prompt.slice(de).replace(/^\s+/, ""), ae = `@${s.label}`, fe = `${R}${R ? " " : ""}${ae}${E ? ` ${E}` : ""}`;
563
+ X({
564
+ prompt: fe,
565
+ referenceIds: w.referenceIds.includes(s.id) ? w.referenceIds : [...w.referenceIds, s.id]
566
+ }), T(!1);
567
+ }, _e = async () => {
568
+ if (Me) {
569
+ p(!0);
570
+ try {
571
+ await N(w), C && we(Ge(n, r, f));
572
+ } catch (s) {
573
+ v?.(s);
574
+ } finally {
575
+ p(!1);
576
+ }
577
+ }
578
+ }, ce = (s) => {
579
+ s.preventDefault(), _e();
580
+ }, vn = (s) => {
581
+ if (A) {
582
+ if (s.key === "Escape") {
583
+ s.preventDefault(), T(!1);
584
+ return;
585
+ }
586
+ if (ne.length && s.key === "ArrowDown") {
587
+ s.preventDefault(), se((R) => (R + 1) % ne.length);
588
+ return;
589
+ }
590
+ if (ne.length && s.key === "ArrowUp") {
591
+ s.preventDefault(), se(
592
+ (R) => (R - 1 + ne.length) % ne.length
593
+ );
594
+ return;
595
+ }
596
+ if (ne.length && s.key === "Enter") {
597
+ s.preventDefault(), J(ne[ue]);
598
+ return;
599
+ }
600
+ if (s.key === "Enter") {
601
+ s.preventDefault();
602
+ return;
603
+ }
604
+ }
605
+ s.key === "Enter" && !s.shiftKey && !s.nativeEvent.isComposing && (s.preventDefault(), _e());
606
+ };
607
+ return /* @__PURE__ */ l(
608
+ "form",
609
+ {
610
+ ref: L,
611
+ className: $(
612
+ "mf-creation-input",
613
+ u && "is-disabled",
614
+ O && "is-loading",
615
+ P
616
+ ),
617
+ "aria-label": D ?? _.label,
618
+ "aria-busy": O || void 0,
619
+ onSubmit: ce,
620
+ ...q,
621
+ children: [
622
+ /* @__PURE__ */ l("div", { className: "mf-creation-input__composer", children: [
623
+ /* @__PURE__ */ l("div", { className: "mf-creation-input__media", children: [
624
+ /* @__PURE__ */ e(
625
+ "input",
626
+ {
627
+ ref: m,
628
+ className: "mf-creation-input__file-input",
629
+ type: "file",
630
+ accept: z,
631
+ multiple: !0,
632
+ disabled: u || O,
633
+ "aria-label": _.chooseFiles,
634
+ onChange: (s) => Se(s.target.files)
635
+ }
636
+ ),
637
+ w.files.map((s, R) => {
638
+ const E = he[Ve(s)];
639
+ return /* @__PURE__ */ l("div", { className: "mf-creation-input__media-item", children: [
640
+ E ? /* @__PURE__ */ e("img", { src: E, alt: "" }) : /* @__PURE__ */ e(Be, { size: 18, "aria-hidden": "true" }),
641
+ /* @__PURE__ */ e(
642
+ "button",
643
+ {
644
+ type: "button",
645
+ "aria-label": _.removeFile(s.name),
646
+ disabled: u || O,
647
+ onClick: () => X({
648
+ files: w.files.filter((ae, fe) => fe !== R)
649
+ }),
650
+ children: /* @__PURE__ */ e($e, { size: 11, "aria-hidden": "true" })
651
+ }
652
+ )
653
+ ] }, Ve(s));
654
+ }),
655
+ w.files.length < S ? /* @__PURE__ */ e(
656
+ "button",
657
+ {
658
+ type: "button",
659
+ className: "mf-creation-input__upload",
660
+ "aria-label": _.addFile,
661
+ disabled: u || O,
662
+ onClick: () => m.current?.click(),
663
+ children: /* @__PURE__ */ e(Be, { size: 18, "aria-hidden": "true" })
664
+ }
665
+ ) : null
666
+ ] }),
667
+ /* @__PURE__ */ l("div", { className: "mf-creation-input__prompt", children: [
668
+ /* @__PURE__ */ e("label", { className: "mf-visually-hidden", htmlFor: U, children: _.prompt }),
669
+ /* @__PURE__ */ e(
670
+ "textarea",
671
+ {
672
+ id: U,
673
+ className: "mf-creation-input__textarea",
674
+ value: w.prompt,
675
+ placeholder: k ?? _.placeholder,
676
+ disabled: u || O,
677
+ rows: 3,
678
+ onChange: (s) => I(
679
+ s.target.value,
680
+ s.target.selectionStart ?? s.target.value.length
681
+ ),
682
+ onKeyDown: vn
683
+ }
684
+ )
685
+ ] })
686
+ ] }),
687
+ /* @__PURE__ */ l("div", { className: "mf-creation-input__toolbar", children: [
688
+ /* @__PURE__ */ l("div", { className: "mf-creation-input__controls", children: [
689
+ /* @__PURE__ */ e(
690
+ Le,
691
+ {
692
+ className: "mf-creation-input__select mf-creation-input__mode",
693
+ value: w.mode,
694
+ onValueChange: (s) => X({ mode: s }),
695
+ options: n,
696
+ "aria-label": `${_.mode}: ${be?.label ?? w.mode}`,
697
+ disabled: u || O
698
+ }
699
+ ),
700
+ /* @__PURE__ */ e(
701
+ Le,
702
+ {
703
+ className: "mf-creation-input__select mf-creation-input__model",
704
+ value: w.model,
705
+ onValueChange: (s) => X({ model: s }),
706
+ options: r,
707
+ "aria-label": `${_.model}: ${H?.label ?? w.model}`,
708
+ disabled: u || O
709
+ }
710
+ ),
711
+ /* @__PURE__ */ l(Ie, { open: y, onOpenChange: F, children: [
712
+ /* @__PURE__ */ e(Te, { asChild: !0, children: /* @__PURE__ */ l(
713
+ ee,
714
+ {
715
+ variant: "ghost",
716
+ className: "mf-creation-input__trigger",
717
+ leadingIcon: /* @__PURE__ */ e(Qe, { ratio: w.ratio }),
718
+ trailingIcon: /* @__PURE__ */ e(De, { size: 12, "aria-hidden": "true" }),
719
+ disabled: u || O,
720
+ children: [
721
+ i.find((s) => s.value === w.ratio)?.label ?? w.ratio,
722
+ " · ",
723
+ w.resolution === "custom" ? _.custom : Ce?.label ?? w.resolution
724
+ ]
725
+ }
726
+ ) }),
727
+ /* @__PURE__ */ l(
728
+ Re,
729
+ {
730
+ align: "start",
731
+ side: "top",
732
+ className: "mf-creation-input__output-panel",
733
+ children: [
734
+ /* @__PURE__ */ l("div", { className: "mf-creation-input__panel-section", children: [
735
+ /* @__PURE__ */ e("strong", { children: _.ratio }),
736
+ /* @__PURE__ */ e(
737
+ "div",
738
+ {
739
+ className: "mf-creation-input__ratios",
740
+ role: "radiogroup",
741
+ "aria-label": _.ratio,
742
+ children: i.map((s) => /* @__PURE__ */ l(
743
+ "button",
744
+ {
745
+ type: "button",
746
+ className: "mf-creation-input__ratio-option",
747
+ role: "radio",
748
+ "aria-checked": w.ratio === s.value,
749
+ onClick: () => ze(s.value, w.resolution),
750
+ children: [
751
+ /* @__PURE__ */ e(Qe, { ratio: s.value }),
752
+ /* @__PURE__ */ e("span", { children: s.label })
753
+ ]
754
+ },
755
+ s.value
756
+ ))
757
+ }
758
+ )
759
+ ] }),
760
+ /* @__PURE__ */ l("div", { className: "mf-creation-input__panel-section", children: [
761
+ /* @__PURE__ */ e("strong", { children: _.resolution }),
762
+ /* @__PURE__ */ e(
763
+ He,
764
+ {
765
+ "aria-label": _.resolution,
766
+ value: w.resolution,
767
+ onValueChange: (s) => ze(w.ratio, s),
768
+ options: [
769
+ ...a.map((s) => ({
770
+ value: s.value,
771
+ label: s.label
772
+ })),
773
+ { value: "custom", label: _.custom }
774
+ ]
775
+ }
776
+ )
777
+ ] }),
778
+ /* @__PURE__ */ l("div", { className: "mf-creation-input__dimensions", children: [
779
+ /* @__PURE__ */ l("div", { className: "mf-creation-input__dimension-field", children: [
780
+ /* @__PURE__ */ e("span", { children: "W" }),
781
+ /* @__PURE__ */ e(
782
+ Xe,
783
+ {
784
+ "aria-label": _.width,
785
+ value: w.width,
786
+ min: 64,
787
+ max: 8192,
788
+ onValueChange: (s) => ke("width", s)
789
+ }
790
+ )
791
+ ] }),
792
+ /* @__PURE__ */ e(
793
+ "button",
794
+ {
795
+ type: "button",
796
+ className: "mf-creation-input__lock",
797
+ "aria-label": _.lockRatio,
798
+ "aria-pressed": w.lockAspectRatio,
799
+ onClick: () => X({ lockAspectRatio: !w.lockAspectRatio }),
800
+ children: w.lockAspectRatio ? /* @__PURE__ */ e(yn, { size: 15, "aria-hidden": "true" }) : /* @__PURE__ */ e(wn, { size: 15, "aria-hidden": "true" })
801
+ }
802
+ ),
803
+ /* @__PURE__ */ l("div", { className: "mf-creation-input__dimension-field", children: [
804
+ /* @__PURE__ */ e("span", { children: "H" }),
805
+ /* @__PURE__ */ e(
806
+ Xe,
807
+ {
808
+ "aria-label": _.height,
809
+ value: w.height,
810
+ min: 64,
811
+ max: 8192,
812
+ onValueChange: (s) => ke("height", s)
813
+ }
814
+ )
815
+ ] }),
816
+ /* @__PURE__ */ e("span", { className: "mf-creation-input__unit", children: "PX" })
817
+ ] })
818
+ ]
819
+ }
820
+ )
821
+ ] }),
822
+ /* @__PURE__ */ l(Ie, { open: G, onOpenChange: Q, children: [
823
+ /* @__PURE__ */ e(Te, { asChild: !0, children: /* @__PURE__ */ e(
824
+ ee,
825
+ {
826
+ variant: "ghost",
827
+ className: "mf-creation-input__trigger",
828
+ leadingIcon: /* @__PURE__ */ e(Cn, { size: 14, "aria-hidden": "true" }),
829
+ trailingIcon: /* @__PURE__ */ e(De, { size: 12, "aria-hidden": "true" }),
830
+ disabled: u || O,
831
+ children: _.countValue(w.count)
832
+ }
833
+ ) }),
834
+ /* @__PURE__ */ l(
835
+ Re,
836
+ {
837
+ align: "start",
838
+ side: "top",
839
+ className: "mf-creation-input__count-panel",
840
+ children: [
841
+ /* @__PURE__ */ e("strong", { children: _.count }),
842
+ /* @__PURE__ */ e(
843
+ He,
844
+ {
845
+ "aria-label": _.count,
846
+ value: String(w.count),
847
+ onValueChange: (s) => {
848
+ X({ count: Number(s) }), Q(!1);
849
+ },
850
+ options: Array.from(
851
+ { length: Math.max(1, Math.min(4, b)) },
852
+ (s, R) => ({
853
+ value: String(R + 1),
854
+ label: String(R + 1)
855
+ })
856
+ )
857
+ }
858
+ )
859
+ ]
860
+ }
861
+ )
862
+ ] }),
863
+ /* @__PURE__ */ l(Ie, { open: A, onOpenChange: T, children: [
864
+ /* @__PURE__ */ e(Te, { asChild: !0, children: /* @__PURE__ */ e(
865
+ ee,
866
+ {
867
+ variant: "ghost",
868
+ className: "mf-creation-input__trigger mf-creation-input__mention-trigger",
869
+ leadingIcon: /* @__PURE__ */ e(Mn, { size: 14, "aria-hidden": "true" }),
870
+ "aria-label": _.mention,
871
+ disabled: u || O,
872
+ onClick: je,
873
+ children: _.mention
874
+ }
875
+ ) }),
876
+ /* @__PURE__ */ l(
877
+ Re,
878
+ {
879
+ align: "start",
880
+ side: "top",
881
+ className: "mf-creation-input__mention-panel",
882
+ children: [
883
+ /* @__PURE__ */ e("strong", { children: _.references }),
884
+ ne.length ? /* @__PURE__ */ e(
885
+ "div",
886
+ {
887
+ className: "mf-creation-input__reference-list",
888
+ role: "listbox",
889
+ "aria-label": _.references,
890
+ children: ne.map((s, R) => /* @__PURE__ */ l(
891
+ "button",
892
+ {
893
+ type: "button",
894
+ role: "option",
895
+ "aria-selected": R === ue,
896
+ onMouseEnter: () => se(R),
897
+ onClick: () => J(s),
898
+ children: [
899
+ /* @__PURE__ */ e("span", { className: "mf-creation-input__reference-thumb", children: s.thumbnail ?? /* @__PURE__ */ e(pe, { size: 14, "aria-hidden": "true" }) }),
900
+ /* @__PURE__ */ l("span", { children: [
901
+ /* @__PURE__ */ e("strong", { children: s.label }),
902
+ s.description ? /* @__PURE__ */ e("small", { children: s.description }) : null
903
+ ] })
904
+ ]
905
+ },
906
+ s.id
907
+ ))
908
+ }
909
+ ) : /* @__PURE__ */ e(
910
+ Ne,
911
+ {
912
+ title: _.noReferences,
913
+ description: _.noReferencesDescription,
914
+ action: h ? /* @__PURE__ */ e(
915
+ ee,
916
+ {
917
+ size: "sm",
918
+ variant: "secondary",
919
+ onClick: () => {
920
+ T(!1), h();
921
+ },
922
+ children: _.createReference
923
+ }
924
+ ) : void 0
925
+ }
926
+ )
927
+ ]
928
+ }
929
+ )
930
+ ] })
931
+ ] }),
932
+ /* @__PURE__ */ l("div", { className: "mf-creation-input__actions", children: [
933
+ M ? /* @__PURE__ */ l("span", { className: "mf-creation-input__cost", "aria-label": _.credits, children: [
934
+ /* @__PURE__ */ e(pe, { size: 12, "aria-hidden": "true" }),
935
+ /* @__PURE__ */ e("strong", { children: M.remaining }),
936
+ /* @__PURE__ */ l("span", { children: [
937
+ "/",
938
+ M.total
939
+ ] })
940
+ ] }) : null,
941
+ /* @__PURE__ */ e(
942
+ ge,
943
+ {
944
+ type: "submit",
945
+ label: O ? _.sending : x ?? _.send,
946
+ variant: "primary",
947
+ className: "mf-creation-input__send",
948
+ loading: O,
949
+ disabled: !Me,
950
+ children: /* @__PURE__ */ e(Je, { size: 16, "aria-hidden": "true" })
951
+ }
952
+ )
953
+ ] })
954
+ ] })
955
+ ]
956
+ }
957
+ );
958
+ }
959
+ );
960
+ ea.displayName = "AICreationInput";
961
+ function Qe({ ratio: n }) {
962
+ if (n === "smart")
963
+ return /* @__PURE__ */ e("span", { className: "mf-creation-input__ratio-icon is-smart", "aria-hidden": "true", children: /* @__PURE__ */ e("span", {}) });
964
+ const r = dn(n), i = r >= 1 ? 16 : Math.max(7, 16 * r), a = r >= 1 ? Math.max(7, 16 / r) : 16;
965
+ return /* @__PURE__ */ e(
966
+ "span",
967
+ {
968
+ className: "mf-creation-input__ratio-icon",
969
+ "aria-hidden": "true",
970
+ style: { width: i, height: a }
971
+ }
972
+ );
973
+ }
974
+ const na = oe(
975
+ ({
976
+ title: n,
977
+ description: r,
978
+ mode: i = "single",
979
+ options: a,
980
+ value: t,
981
+ defaultValue: c,
982
+ onValueChange: f,
983
+ onSubmit: g,
984
+ onSkip: N,
985
+ submitLabel: v,
986
+ skipLabel: h,
987
+ allowSkip: M = !1,
988
+ disabled: k = !1,
989
+ loading: u = !1,
990
+ className: o,
991
+ ...S
992
+ }, b) => {
993
+ const { messages: z } = V(), C = z.aiInteraction, x = i === "multiple", [P, D] = ie({
994
+ value: t,
995
+ defaultValue: c ?? (x ? [] : ""),
996
+ onChange: f
997
+ }), q = le([]), [L, B] = j(!1), _ = Array.isArray(P) ? P : P ? [P] : [], U = _.length > 0 && !k && !u && !L, m = a.findIndex(
998
+ (A) => _.includes(A.value) && !A.disabled
999
+ ), d = Math.max(
1000
+ 0,
1001
+ a.findIndex((A) => !A.disabled)
1002
+ ), p = m >= 0 ? m : d, y = (A) => {
1003
+ if (!(k || u || A.disabled)) {
1004
+ if (!x) {
1005
+ D(A.value);
1006
+ return;
1007
+ }
1008
+ D(
1009
+ _.includes(A.value) ? _.filter((T) => T !== A.value) : [..._, A.value]
1010
+ );
1011
+ }
1012
+ }, F = (A, T) => {
1013
+ for (let Y = 0; Y < a.length; Y += 1) {
1014
+ const W = (A + T * Y + a.length) % Math.max(1, a.length), Z = a[W];
1015
+ if (!Z?.disabled) {
1016
+ y(Z), q.current[W]?.focus();
1017
+ return;
1018
+ }
1019
+ }
1020
+ }, G = (A, T) => {
1021
+ if (!x)
1022
+ switch (A.key) {
1023
+ case "ArrowDown":
1024
+ case "ArrowRight":
1025
+ A.preventDefault(), F(T + 1, 1);
1026
+ break;
1027
+ case "ArrowUp":
1028
+ case "ArrowLeft":
1029
+ A.preventDefault(), F(T - 1, -1);
1030
+ break;
1031
+ case "Home":
1032
+ A.preventDefault(), F(0, 1);
1033
+ break;
1034
+ case "End":
1035
+ A.preventDefault(), F(a.length - 1, -1);
1036
+ break;
1037
+ }
1038
+ }, Q = async () => {
1039
+ if (U) {
1040
+ B(!0);
1041
+ try {
1042
+ await g?.(P);
1043
+ } finally {
1044
+ B(!1);
1045
+ }
1046
+ }
1047
+ };
1048
+ return /* @__PURE__ */ l(
1049
+ "section",
1050
+ {
1051
+ ref: b,
1052
+ className: $("mf-clarification-prompt", o),
1053
+ "aria-label": typeof n == "string" ? n : C.clarificationTitle,
1054
+ "data-mode": i,
1055
+ ...S,
1056
+ children: [
1057
+ /* @__PURE__ */ l("header", { className: "mf-ai-interaction__header", children: [
1058
+ /* @__PURE__ */ e("span", { className: "mf-ai-interaction__icon", "aria-hidden": "true", children: /* @__PURE__ */ e(kn, { size: 15 }) }),
1059
+ /* @__PURE__ */ l("div", { children: [
1060
+ /* @__PURE__ */ e("strong", { children: n ?? C.clarificationTitle }),
1061
+ /* @__PURE__ */ e("p", { children: r ?? C.clarificationDescription })
1062
+ ] })
1063
+ ] }),
1064
+ /* @__PURE__ */ e(
1065
+ "div",
1066
+ {
1067
+ className: "mf-clarification-prompt__options",
1068
+ role: x ? "group" : "radiogroup",
1069
+ "aria-label": C.clarificationOptions,
1070
+ "aria-required": x ? void 0 : !0,
1071
+ children: a.map((A, T) => {
1072
+ const Y = _.includes(A.value);
1073
+ return /* @__PURE__ */ l(
1074
+ "button",
1075
+ {
1076
+ ref: (W) => {
1077
+ q.current[T] = W;
1078
+ },
1079
+ type: "button",
1080
+ className: "mf-clarification-prompt__option",
1081
+ role: x ? "checkbox" : "radio",
1082
+ "aria-checked": Y,
1083
+ tabIndex: x ? void 0 : T === p ? 0 : -1,
1084
+ disabled: k || u || A.disabled,
1085
+ onKeyDown: (W) => G(W, T),
1086
+ onClick: () => y(A),
1087
+ children: [
1088
+ /* @__PURE__ */ e("span", { className: "mf-clarification-prompt__indicator", "aria-hidden": "true", children: Y ? x ? /* @__PURE__ */ e(Oe, { size: 12 }) : /* @__PURE__ */ e("span", {}) : null }),
1089
+ A.icon ? /* @__PURE__ */ e("span", { className: "mf-clarification-prompt__option-icon", children: A.icon }) : null,
1090
+ /* @__PURE__ */ l("span", { className: "mf-clarification-prompt__copy", children: [
1091
+ /* @__PURE__ */ e("strong", { children: A.label }),
1092
+ A.description ? /* @__PURE__ */ e("small", { children: A.description }) : null
1093
+ ] })
1094
+ ]
1095
+ },
1096
+ A.value
1097
+ );
1098
+ })
1099
+ }
1100
+ ),
1101
+ /* @__PURE__ */ l("div", { className: "mf-ai-interaction__actions", children: [
1102
+ M ? /* @__PURE__ */ e(
1103
+ ee,
1104
+ {
1105
+ variant: "ghost",
1106
+ size: "sm",
1107
+ disabled: k || u,
1108
+ onClick: N,
1109
+ children: h ?? C.skip
1110
+ }
1111
+ ) : null,
1112
+ /* @__PURE__ */ e(
1113
+ ee,
1114
+ {
1115
+ variant: "primary",
1116
+ size: "sm",
1117
+ loading: u || L,
1118
+ disabled: !U,
1119
+ onClick: () => {
1120
+ Q();
1121
+ },
1122
+ children: v ?? C.submit
1123
+ }
1124
+ )
1125
+ ] })
1126
+ ]
1127
+ }
1128
+ );
1129
+ }
1130
+ );
1131
+ na.displayName = "ClarificationPrompt";
1132
+ const aa = oe(
1133
+ ({
1134
+ title: n,
1135
+ description: r,
1136
+ risk: i = "medium",
1137
+ items: a,
1138
+ status: t = "pending",
1139
+ approveLabel: c,
1140
+ rejectLabel: f,
1141
+ onApprove: g,
1142
+ onReject: N,
1143
+ disabled: v = !1,
1144
+ loading: h = !1,
1145
+ className: M,
1146
+ ...k
1147
+ }, u) => {
1148
+ const { messages: o } = V(), S = o.aiInteraction, [b, z] = j(null), C = t === "pending", x = i === "high" ? "danger" : i === "low" ? "info" : "warning", P = async (D) => {
1149
+ z(D);
1150
+ try {
1151
+ await (D === "approve" ? g?.() : N?.());
1152
+ } finally {
1153
+ z(null);
1154
+ }
1155
+ };
1156
+ return /* @__PURE__ */ l(
1157
+ "section",
1158
+ {
1159
+ ref: u,
1160
+ className: $("mf-approval-request", M),
1161
+ "data-status": t,
1162
+ "aria-label": typeof n == "string" ? n : S.approvalTitle,
1163
+ ...k,
1164
+ children: [
1165
+ /* @__PURE__ */ l("header", { className: "mf-ai-interaction__header", children: [
1166
+ /* @__PURE__ */ e("span", { className: "mf-ai-interaction__icon", "aria-hidden": "true", children: i === "high" ? /* @__PURE__ */ e(zn, { size: 15 }) : /* @__PURE__ */ e(en, { size: 15 }) }),
1167
+ /* @__PURE__ */ l("div", { children: [
1168
+ /* @__PURE__ */ e("strong", { children: n ?? S.approvalTitle }),
1169
+ /* @__PURE__ */ e("p", { children: r ?? S.approvalDescription })
1170
+ ] }),
1171
+ /* @__PURE__ */ e(re, { tone: x, children: S.risk[i] })
1172
+ ] }),
1173
+ a?.length ? /* @__PURE__ */ e("dl", { className: "mf-approval-request__items", children: a.map((D, q) => /* @__PURE__ */ l("div", { children: [
1174
+ /* @__PURE__ */ e("dt", { children: D.label }),
1175
+ /* @__PURE__ */ e("dd", { children: D.value })
1176
+ ] }, q)) }) : null,
1177
+ C ? /* @__PURE__ */ l("div", { className: "mf-ai-interaction__actions", children: [
1178
+ /* @__PURE__ */ e(
1179
+ ee,
1180
+ {
1181
+ variant: "secondary",
1182
+ size: "sm",
1183
+ loading: b === "reject" || h,
1184
+ disabled: v || b !== null && b !== "reject",
1185
+ onClick: () => {
1186
+ P("reject");
1187
+ },
1188
+ children: f ?? S.reject
1189
+ }
1190
+ ),
1191
+ /* @__PURE__ */ e(
1192
+ ee,
1193
+ {
1194
+ variant: "primary",
1195
+ size: "sm",
1196
+ loading: b === "approve" || h,
1197
+ disabled: v || b !== null && b !== "approve",
1198
+ onClick: () => {
1199
+ P("approve");
1200
+ },
1201
+ children: c ?? S.approve
1202
+ }
1203
+ )
1204
+ ] }) : /* @__PURE__ */ l("div", { className: "mf-approval-request__result", role: "status", children: [
1205
+ t === "approved" ? /* @__PURE__ */ e(Oe, { size: 14, "aria-hidden": "true" }) : /* @__PURE__ */ e($e, { size: 14, "aria-hidden": "true" }),
1206
+ t === "approved" ? S.approved : S.rejected
1207
+ ] })
1208
+ ]
1209
+ }
1210
+ );
1211
+ }
1212
+ );
1213
+ aa.displayName = "ApprovalRequest";
1214
+ const ta = oe(
1215
+ ({
1216
+ title: n,
1217
+ description: r,
1218
+ steps: i,
1219
+ status: a = "pending",
1220
+ approveLabel: t,
1221
+ requestChangesLabel: c,
1222
+ onApprove: f,
1223
+ onRequestChanges: g,
1224
+ disabled: N = !1,
1225
+ loading: v = !1,
1226
+ className: h,
1227
+ ...M
1228
+ }, k) => {
1229
+ const { messages: u } = V(), o = u.aiInteraction, [S, b] = j(null), z = a === "pending", C = async (x) => {
1230
+ b(x);
1231
+ try {
1232
+ await (x === "approve" ? f?.() : g?.());
1233
+ } finally {
1234
+ b(null);
1235
+ }
1236
+ };
1237
+ return /* @__PURE__ */ l(
1238
+ "section",
1239
+ {
1240
+ ref: k,
1241
+ className: $("mf-plan-review", h),
1242
+ "data-status": a,
1243
+ "aria-label": typeof n == "string" ? n : o.planTitle,
1244
+ ...M,
1245
+ children: [
1246
+ /* @__PURE__ */ l("header", { className: "mf-ai-interaction__header", children: [
1247
+ /* @__PURE__ */ e("span", { className: "mf-ai-interaction__icon", "aria-hidden": "true", children: /* @__PURE__ */ e(Sn, { size: 14 }) }),
1248
+ /* @__PURE__ */ l("div", { children: [
1249
+ /* @__PURE__ */ e("strong", { children: n ?? o.planTitle }),
1250
+ /* @__PURE__ */ e("p", { children: r ?? o.planDescription })
1251
+ ] }),
1252
+ /* @__PURE__ */ e(
1253
+ re,
1254
+ {
1255
+ tone: a === "approved" ? "success" : a === "changes-requested" ? "warning" : "info",
1256
+ children: a === "approved" ? o.approved : a === "changes-requested" ? o.changesRequested : o.pending
1257
+ }
1258
+ )
1259
+ ] }),
1260
+ /* @__PURE__ */ e("ol", { className: "mf-plan-review__steps", children: i.map((x, P) => /* @__PURE__ */ l("li", { children: [
1261
+ /* @__PURE__ */ e("span", { children: P + 1 }),
1262
+ /* @__PURE__ */ l("div", { children: [
1263
+ /* @__PURE__ */ e("strong", { children: x.label }),
1264
+ x.description ? /* @__PURE__ */ e("p", { children: x.description }) : null
1265
+ ] })
1266
+ ] }, x.id)) }),
1267
+ z ? /* @__PURE__ */ l("div", { className: "mf-ai-interaction__actions", children: [
1268
+ /* @__PURE__ */ e(
1269
+ ee,
1270
+ {
1271
+ variant: "secondary",
1272
+ size: "sm",
1273
+ loading: S === "changes" || v,
1274
+ disabled: N || S !== null && S !== "changes",
1275
+ onClick: () => {
1276
+ C("changes");
1277
+ },
1278
+ children: c ?? o.requestChanges
1279
+ }
1280
+ ),
1281
+ /* @__PURE__ */ e(
1282
+ ee,
1283
+ {
1284
+ variant: "primary",
1285
+ size: "sm",
1286
+ loading: S === "approve" || v,
1287
+ disabled: N || S !== null && S !== "approve",
1288
+ onClick: () => {
1289
+ C("approve");
1290
+ },
1291
+ children: t ?? o.approvePlan
1292
+ }
1293
+ )
1294
+ ] }) : null
1295
+ ]
1296
+ }
1297
+ );
1298
+ }
1299
+ );
1300
+ ta.displayName = "PlanReview";
1301
+ const ia = oe(
1302
+ ({
1303
+ options: n,
1304
+ value: r,
1305
+ defaultValue: i,
1306
+ onValueChange: a,
1307
+ label: t,
1308
+ placeholder: c,
1309
+ disabled: f = !1,
1310
+ className: g,
1311
+ ...N
1312
+ }, v) => {
1313
+ const { messages: h } = V(), M = h.aiInteraction, [k, u] = j(!1), o = le([]), S = le(n);
1314
+ S.current = n;
1315
+ const [b, z] = ie({
1316
+ value: r,
1317
+ defaultValue: i ?? n[0]?.value ?? "",
1318
+ onChange: a
1319
+ }), C = le(b);
1320
+ C.current = b;
1321
+ const [x, P] = j(0), D = n.find((m) => m.value === b), q = typeof D?.label == "string" ? D.label : typeof c == "string" ? c : b, L = (m, d) => {
1322
+ for (let p = 0; p < n.length; p += 1) {
1323
+ const y = (m + d * p + n.length) % Math.max(1, n.length);
1324
+ if (!n[y]?.disabled) return y;
1325
+ }
1326
+ return Math.max(0, Math.min(m, n.length - 1));
1327
+ }, B = (m) => {
1328
+ const d = L(m, 1);
1329
+ P(d), o.current[d]?.focus();
1330
+ }, _ = (m) => {
1331
+ m.disabled || (z(m.value), u(!1));
1332
+ };
1333
+ ve(() => {
1334
+ if (!k) return;
1335
+ const m = S.current.findIndex(
1336
+ (y) => y.value === C.current && !y.disabled
1337
+ ), d = m >= 0 ? m : L(0, 1);
1338
+ P(d);
1339
+ const p = window.requestAnimationFrame(() => {
1340
+ o.current[d]?.focus();
1341
+ });
1342
+ return () => window.cancelAnimationFrame(p);
1343
+ }, [k]);
1344
+ const U = (m, d) => {
1345
+ let p = d;
1346
+ switch (m.key) {
1347
+ case "ArrowDown":
1348
+ p = L(d + 1, 1);
1349
+ break;
1350
+ case "ArrowUp":
1351
+ p = L(d - 1, -1);
1352
+ break;
1353
+ case "Home":
1354
+ p = L(0, 1);
1355
+ break;
1356
+ case "End":
1357
+ p = L(n.length - 1, -1);
1358
+ break;
1359
+ case "Enter":
1360
+ case " ":
1361
+ m.preventDefault(), _(n[d]);
1362
+ return;
1363
+ default:
1364
+ return;
1365
+ }
1366
+ m.preventDefault(), B(p);
1367
+ };
1368
+ return /* @__PURE__ */ e("div", { ref: v, className: $("mf-model-selector", g), ...N, children: /* @__PURE__ */ l(Ie, { open: k, onOpenChange: u, children: [
1369
+ /* @__PURE__ */ e(Te, { asChild: !0, children: /* @__PURE__ */ e(
1370
+ ee,
1371
+ {
1372
+ variant: "ghost",
1373
+ size: "sm",
1374
+ className: "mf-model-selector__trigger",
1375
+ leadingIcon: /* @__PURE__ */ e(Ye, { icon: pe, size: "sm" }),
1376
+ trailingIcon: /* @__PURE__ */ e(Ye, { icon: De, size: "xs" }),
1377
+ disabled: f,
1378
+ "aria-label": `${M.modelLabel}: ${q}`,
1379
+ children: D?.label ?? c ?? M.modelPlaceholder
1380
+ }
1381
+ ) }),
1382
+ /* @__PURE__ */ l(Re, { align: "start", side: "top", className: "mf-model-selector__content", children: [
1383
+ /* @__PURE__ */ e("strong", { children: t ?? M.modelLabel }),
1384
+ /* @__PURE__ */ e("div", { role: "listbox", "aria-label": M.modelOptions, children: n.map((m, d) => {
1385
+ const p = m.value === b;
1386
+ return /* @__PURE__ */ l(
1387
+ "button",
1388
+ {
1389
+ ref: (y) => {
1390
+ o.current[d] = y;
1391
+ },
1392
+ type: "button",
1393
+ role: "option",
1394
+ "aria-selected": p,
1395
+ tabIndex: d === x ? 0 : -1,
1396
+ disabled: m.disabled,
1397
+ onFocus: () => P(d),
1398
+ onKeyDown: (y) => U(y, d),
1399
+ onClick: () => _(m),
1400
+ children: [
1401
+ /* @__PURE__ */ e("span", { className: "mf-model-selector__check", "aria-hidden": "true", children: p ? /* @__PURE__ */ e(Oe, { size: 12 }) : null }),
1402
+ /* @__PURE__ */ l("span", { className: "mf-model-selector__copy", children: [
1403
+ /* @__PURE__ */ e("strong", { children: m.label }),
1404
+ m.description ? /* @__PURE__ */ e("small", { children: m.description }) : null,
1405
+ m.contextWindow ? /* @__PURE__ */ e("small", { children: M.contextWindow(m.contextWindow) }) : null
1406
+ ] }),
1407
+ m.badges?.length ? /* @__PURE__ */ e("span", { className: "mf-model-selector__badges", children: m.badges.map((y, F) => /* @__PURE__ */ e(re, { tone: "info", children: y }, F)) }) : null
1408
+ ]
1409
+ },
1410
+ m.value
1411
+ );
1412
+ }) })
1413
+ ] })
1414
+ ] }) });
1415
+ }
1416
+ );
1417
+ ia.displayName = "ModelSelector";
1418
+ const la = oe(
1419
+ ({
1420
+ used: n,
1421
+ limit: r,
1422
+ reserved: i = 0,
1423
+ label: a,
1424
+ compact: t = !1,
1425
+ warningAt: c = 0.75,
1426
+ criticalAt: f = 0.9,
1427
+ className: g,
1428
+ ...N
1429
+ }, v) => {
1430
+ const { formatNumber: h, messages: M } = V(), k = M.aiInteraction, u = Math.max(1, r), o = Math.max(0, Math.min(u, n)), S = Math.max(0, Math.min(u - o, i)), b = o / u, z = b >= f ? "danger" : b >= c ? "warning" : "info", C = o / u * 100, x = S / u * 100;
1431
+ return /* @__PURE__ */ l(
1432
+ "div",
1433
+ {
1434
+ ref: v,
1435
+ className: $("mf-context-meter", t && "is-compact", g),
1436
+ "data-tone": z,
1437
+ role: "meter",
1438
+ "aria-label": typeof a == "string" ? a : k.contextLabel,
1439
+ "aria-valuemin": 0,
1440
+ "aria-valuemax": u,
1441
+ "aria-valuenow": o,
1442
+ "aria-valuetext": k.contextValue(
1443
+ h(o),
1444
+ h(u)
1445
+ ),
1446
+ ...N,
1447
+ children: [
1448
+ t ? null : /* @__PURE__ */ l("div", { className: "mf-context-meter__header", children: [
1449
+ /* @__PURE__ */ e("span", { children: a ?? k.contextLabel }),
1450
+ /* @__PURE__ */ l("strong", { children: [
1451
+ h(o),
1452
+ " / ",
1453
+ h(u)
1454
+ ] })
1455
+ ] }),
1456
+ /* @__PURE__ */ l("div", { className: "mf-context-meter__track", "aria-hidden": "true", children: [
1457
+ /* @__PURE__ */ e("span", { className: "mf-context-meter__used", style: { width: `${C}%` } }),
1458
+ S ? /* @__PURE__ */ e(
1459
+ "span",
1460
+ {
1461
+ className: "mf-context-meter__reserved",
1462
+ style: { width: `${x}%` }
1463
+ }
1464
+ ) : null
1465
+ ] }),
1466
+ t ? null : /* @__PURE__ */ e("small", { children: k.contextRemaining(h(u - o)) })
1467
+ ]
1468
+ }
1469
+ );
1470
+ }
1471
+ );
1472
+ la.displayName = "ContextMeter";
1473
+ const ra = oe(
1474
+ ({
1475
+ children: n,
1476
+ empty: r,
1477
+ autoScroll: i = !0,
1478
+ ariaLabel: a,
1479
+ className: t,
1480
+ "aria-label": c,
1481
+ ...f
1482
+ }, g) => {
1483
+ const { messages: N } = V(), v = le(null);
1484
+ return ve(() => {
1485
+ const h = v.current;
1486
+ !i || !h || (h.scrollTop = h.scrollHeight);
1487
+ }, [i, n]), /* @__PURE__ */ e(
1488
+ "div",
1489
+ {
1490
+ ref: (h) => {
1491
+ v.current = h, typeof g == "function" ? g(h) : g && (g.current = h);
1492
+ },
1493
+ className: $("mf-chat-thread", t),
1494
+ role: "log",
1495
+ "aria-label": c ?? a ?? N.agentChat.threadLabel,
1496
+ "aria-live": "polite",
1497
+ "aria-relevant": "additions text",
1498
+ ...f,
1499
+ children: n ?? r ?? /* @__PURE__ */ e(
1500
+ Ne,
1501
+ {
1502
+ icon: /* @__PURE__ */ e(pe, { size: 18, "aria-hidden": "true" }),
1503
+ title: N.agentChat.emptyTitle,
1504
+ description: N.agentChat.emptyDescription
1505
+ }
1506
+ )
1507
+ }
1508
+ );
1509
+ }
1510
+ );
1511
+ ra.displayName = "ChatThread";
1512
+ function Ma({
1513
+ role: n = "assistant",
1514
+ name: r,
1515
+ avatar: i,
1516
+ timestamp: a,
1517
+ status: t = "idle",
1518
+ actions: c,
1519
+ className: f,
1520
+ children: g,
1521
+ ...N
1522
+ }) {
1523
+ const { messages: v } = V(), h = r ?? v.agentChat.roleLabels[n], M = n === "user" ? /* @__PURE__ */ e(Rn, { size: 15, "aria-hidden": "true" }) : n === "tool" ? /* @__PURE__ */ e(an, { size: 15, "aria-hidden": "true" }) : /* @__PURE__ */ e(tn, { size: 15, "aria-hidden": "true" });
1524
+ return /* @__PURE__ */ l(
1525
+ "article",
1526
+ {
1527
+ className: $(
1528
+ "mf-chat-message",
1529
+ `mf-chat-message--${n}`,
1530
+ t === "error" && "is-error",
1531
+ f
1532
+ ),
1533
+ "aria-busy": t === "streaming" || void 0,
1534
+ ...N,
1535
+ children: [
1536
+ /* @__PURE__ */ e("div", { className: "mf-chat-message__avatar", "aria-hidden": "true", children: i ?? M }),
1537
+ /* @__PURE__ */ l("div", { className: "mf-chat-message__body", children: [
1538
+ /* @__PURE__ */ l("header", { className: "mf-chat-message__header", children: [
1539
+ /* @__PURE__ */ e("strong", { children: h }),
1540
+ a ? /* @__PURE__ */ e("time", { children: a }) : null
1541
+ ] }),
1542
+ /* @__PURE__ */ e("div", { className: "mf-chat-message__content", children: g }),
1543
+ c ? /* @__PURE__ */ e("div", { className: "mf-chat-message__actions", children: c }) : null
1544
+ ] })
1545
+ ]
1546
+ }
1547
+ );
1548
+ }
1549
+ function za({
1550
+ text: n,
1551
+ children: r,
1552
+ state: i = "streaming",
1553
+ className: a,
1554
+ ...t
1555
+ }) {
1556
+ return /* @__PURE__ */ l(
1557
+ "span",
1558
+ {
1559
+ className: $("mf-streaming-text", a),
1560
+ "data-state": i,
1561
+ "aria-live": i === "streaming" ? "polite" : void 0,
1562
+ "aria-busy": i === "streaming" || void 0,
1563
+ ...t,
1564
+ children: [
1565
+ r ?? n,
1566
+ i === "streaming" ? /* @__PURE__ */ e("span", { className: "mf-streaming-text__cursor", "aria-hidden": "true" }) : null
1567
+ ]
1568
+ }
1569
+ );
1570
+ }
1571
+ function ka({
1572
+ content: n,
1573
+ onCopy: r,
1574
+ onRetry: i,
1575
+ onFeedback: a,
1576
+ onMore: t,
1577
+ className: c,
1578
+ ...f
1579
+ }) {
1580
+ const { messages: g } = V(), [N, v] = j(!1), h = le(null);
1581
+ ve(
1582
+ () => () => {
1583
+ h.current && window.clearTimeout(h.current);
1584
+ },
1585
+ []
1586
+ );
1587
+ const M = async () => {
1588
+ r ? await r() : n && navigator.clipboard && await navigator.clipboard.writeText(n), v(!0), h.current && window.clearTimeout(h.current), h.current = window.setTimeout(() => v(!1), 1600);
1589
+ };
1590
+ return /* @__PURE__ */ l("div", { className: $("mf-message-actions", c), ...f, children: [
1591
+ /* @__PURE__ */ e(
1592
+ ge,
1593
+ {
1594
+ label: N ? g.agentChat.copied : g.agentChat.copy,
1595
+ size: "sm",
1596
+ onClick: () => {
1597
+ M();
1598
+ },
1599
+ children: N ? /* @__PURE__ */ e(Oe, { size: 13, "aria-hidden": "true" }) : /* @__PURE__ */ e(xn, { size: 13, "aria-hidden": "true" })
1600
+ }
1601
+ ),
1602
+ i ? /* @__PURE__ */ e(ge, { label: g.agentChat.retry, size: "sm", onClick: i, children: /* @__PURE__ */ e(nn, { size: 13, "aria-hidden": "true" }) }) : null,
1603
+ a ? /* @__PURE__ */ l(Ke, { children: [
1604
+ /* @__PURE__ */ e(
1605
+ ge,
1606
+ {
1607
+ label: g.agentChat.goodResponse,
1608
+ size: "sm",
1609
+ onClick: () => a("positive"),
1610
+ children: /* @__PURE__ */ e(An, { size: 13, "aria-hidden": "true" })
1611
+ }
1612
+ ),
1613
+ /* @__PURE__ */ e(
1614
+ ge,
1615
+ {
1616
+ label: g.agentChat.badResponse,
1617
+ size: "sm",
1618
+ onClick: () => a("negative"),
1619
+ children: /* @__PURE__ */ e(In, { size: 13, "aria-hidden": "true" })
1620
+ }
1621
+ )
1622
+ ] }) : null,
1623
+ t ? /* @__PURE__ */ e(ge, { label: g.agentChat.moreActions, size: "sm", onClick: t, children: /* @__PURE__ */ e(Tn, { size: 13, "aria-hidden": "true" }) }) : null
1624
+ ] });
1625
+ }
1626
+ function Sa({
1627
+ title: n,
1628
+ status: r = "complete",
1629
+ duration: i,
1630
+ open: a,
1631
+ defaultOpen: t = !1,
1632
+ onOpenChange: c,
1633
+ className: f,
1634
+ children: g,
1635
+ ...N
1636
+ }) {
1637
+ const { messages: v } = V(), h = Pe(), M = Pe(), [k, u] = ie({
1638
+ value: a,
1639
+ defaultValue: t,
1640
+ onChange: c
1641
+ }), o = r === "thinking" ? v.agentChat.running : r === "error" ? v.agentChat.failed : v.agentChat.completed;
1642
+ return /* @__PURE__ */ l(
1643
+ "section",
1644
+ {
1645
+ className: $("mf-reasoning-panel", f),
1646
+ "data-status": r,
1647
+ ...N,
1648
+ children: [
1649
+ /* @__PURE__ */ l(
1650
+ "button",
1651
+ {
1652
+ type: "button",
1653
+ className: "mf-reasoning-panel__trigger",
1654
+ "aria-expanded": k,
1655
+ "aria-controls": h,
1656
+ onClick: () => u(!k),
1657
+ children: [
1658
+ r === "thinking" ? /* @__PURE__ */ e(Ee, { size: "sm" }) : /* @__PURE__ */ e(pe, { size: 14, "aria-hidden": "true" }),
1659
+ /* @__PURE__ */ e("span", { id: M, children: n ?? v.agentChat.reasoning }),
1660
+ i ? /* @__PURE__ */ e("small", { children: i }) : null,
1661
+ /* @__PURE__ */ e(
1662
+ re,
1663
+ {
1664
+ tone: r === "error" ? "danger" : r === "complete" ? "success" : "info",
1665
+ children: o
1666
+ }
1667
+ ),
1668
+ /* @__PURE__ */ e(
1669
+ De,
1670
+ {
1671
+ className: "mf-reasoning-panel__chevron",
1672
+ size: 13,
1673
+ "aria-hidden": "true"
1674
+ }
1675
+ )
1676
+ ]
1677
+ }
1678
+ ),
1679
+ k ? /* @__PURE__ */ e(
1680
+ "div",
1681
+ {
1682
+ className: "mf-reasoning-panel__content",
1683
+ id: h,
1684
+ role: "region",
1685
+ "aria-labelledby": M,
1686
+ children: g
1687
+ }
1688
+ ) : null
1689
+ ]
1690
+ }
1691
+ );
1692
+ }
1693
+ function sa(n) {
1694
+ const { messages: r } = V();
1695
+ return {
1696
+ pending: r.agentChat.awaitingApproval,
1697
+ running: r.agentChat.running,
1698
+ "awaiting-approval": r.agentChat.awaitingApproval,
1699
+ complete: r.agentChat.completed,
1700
+ error: r.agentChat.failed
1701
+ }[n];
1702
+ }
1703
+ function xa({
1704
+ name: n,
1705
+ title: r,
1706
+ description: i,
1707
+ status: a = "running",
1708
+ parameters: t,
1709
+ icon: c,
1710
+ className: f,
1711
+ children: g,
1712
+ ...N
1713
+ }) {
1714
+ const { messages: v } = V(), h = sa(a), M = a === "error" ? "danger" : a === "complete" ? "success" : a === "awaiting-approval" || a === "pending" ? "warning" : "info";
1715
+ return /* @__PURE__ */ l("div", { className: $("mf-tool-call", f), "data-status": a, ...N, children: [
1716
+ /* @__PURE__ */ l("div", { className: "mf-tool-call__header", children: [
1717
+ /* @__PURE__ */ e("span", { className: "mf-tool-call__icon", children: c ?? /* @__PURE__ */ e(an, { size: 15, "aria-hidden": "true" }) }),
1718
+ /* @__PURE__ */ l("div", { className: "mf-tool-call__copy", children: [
1719
+ /* @__PURE__ */ e("strong", { children: r ?? n }),
1720
+ /* @__PURE__ */ l("span", { children: [
1721
+ v.agentChat.toolCall,
1722
+ " · ",
1723
+ n
1724
+ ] })
1725
+ ] }),
1726
+ /* @__PURE__ */ e(re, { tone: M, children: h })
1727
+ ] }),
1728
+ i ? /* @__PURE__ */ e("p", { className: "mf-tool-call__description", children: i }) : null,
1729
+ t && Object.keys(t).length ? /* @__PURE__ */ e("dl", { className: "mf-tool-call__parameters", children: Object.entries(t).map(([k, u]) => /* @__PURE__ */ l("div", { children: [
1730
+ /* @__PURE__ */ e("dt", { children: k }),
1731
+ /* @__PURE__ */ e("dd", { children: u })
1732
+ ] }, k)) }) : null,
1733
+ g
1734
+ ] });
1735
+ }
1736
+ function Aa({
1737
+ title: n,
1738
+ status: r = "success",
1739
+ output: i,
1740
+ onRetry: a,
1741
+ className: t,
1742
+ children: c,
1743
+ ...f
1744
+ }) {
1745
+ const { messages: g } = V();
1746
+ return /* @__PURE__ */ l(
1747
+ "div",
1748
+ {
1749
+ className: $("mf-tool-result", t),
1750
+ "data-status": r,
1751
+ role: r === "error" ? "alert" : "status",
1752
+ ...f,
1753
+ children: [
1754
+ /* @__PURE__ */ l("div", { className: "mf-tool-result__header", children: [
1755
+ r === "running" ? /* @__PURE__ */ e(Ee, { size: "sm" }) : /* @__PURE__ */ e("span", { className: "mf-tool-result__dot", "aria-hidden": "true" }),
1756
+ /* @__PURE__ */ e("strong", { children: n ?? g.agentChat.result }),
1757
+ a && r === "error" ? /* @__PURE__ */ l("button", { type: "button", onClick: a, children: [
1758
+ /* @__PURE__ */ e(nn, { size: 12, "aria-hidden": "true" }),
1759
+ g.agentChat.retryTool
1760
+ ] }) : null
1761
+ ] }),
1762
+ c ?? i ? /* @__PURE__ */ e("div", { className: "mf-tool-result__content", children: c ?? i }) : null
1763
+ ]
1764
+ }
1765
+ );
1766
+ }
1767
+ function Ia({
1768
+ index: n,
1769
+ title: r,
1770
+ source: i,
1771
+ locator: a,
1772
+ snippet: t,
1773
+ href: c,
1774
+ onClick: f,
1775
+ className: g,
1776
+ ...N
1777
+ }) {
1778
+ const v = /* @__PURE__ */ l(Ke, { children: [
1779
+ /* @__PURE__ */ e("span", { className: "mf-citation__index", "aria-hidden": "true", children: n }),
1780
+ /* @__PURE__ */ l("span", { className: "mf-citation__copy", children: [
1781
+ /* @__PURE__ */ e("strong", { children: r }),
1782
+ i || a ? /* @__PURE__ */ l("small", { children: [
1783
+ i,
1784
+ i && a ? " · " : null,
1785
+ a
1786
+ ] }) : null,
1787
+ t ? /* @__PURE__ */ e("span", { children: t }) : null
1788
+ ] }),
1789
+ c ? /* @__PURE__ */ e(Pn, { size: 12, "aria-hidden": "true" }) : null
1790
+ ] });
1791
+ return /* @__PURE__ */ e("span", { className: $("mf-citation", g), ...N, children: c ? /* @__PURE__ */ e("a", { href: c, target: "_blank", rel: "noreferrer", children: v }) : /* @__PURE__ */ e("button", { type: "button", onClick: f, children: v }) });
1792
+ }
1793
+ function Ta({
1794
+ files: n,
1795
+ onRemove: r,
1796
+ className: i,
1797
+ ...a
1798
+ }) {
1799
+ const { messages: t } = V();
1800
+ return /* @__PURE__ */ e(
1801
+ "ul",
1802
+ {
1803
+ className: $("mf-attachment-list", i),
1804
+ "aria-label": t.agentChat.attachments,
1805
+ ...a,
1806
+ children: n.map((c) => /* @__PURE__ */ l("li", { "data-status": c.status ?? "ready", children: [
1807
+ /* @__PURE__ */ e("span", { className: "mf-attachment-list__icon", children: /* @__PURE__ */ e(Ze, { size: 14, "aria-hidden": "true" }) }),
1808
+ /* @__PURE__ */ l("span", { className: "mf-attachment-list__copy", children: [
1809
+ /* @__PURE__ */ e("strong", { children: c.name }),
1810
+ /* @__PURE__ */ l("small", { children: [
1811
+ [c.type, c.size].filter(Boolean).join(" · "),
1812
+ c.error ? ` · ${c.error}` : ""
1813
+ ] }),
1814
+ c.status === "uploading" ? /* @__PURE__ */ e("span", { className: "mf-attachment-list__progress", "aria-hidden": "true", children: /* @__PURE__ */ e(
1815
+ "i",
1816
+ {
1817
+ style: { width: `${Math.max(0, Math.min(100, c.progress ?? 0))}%` }
1818
+ }
1819
+ ) }) : null
1820
+ ] }),
1821
+ r ? /* @__PURE__ */ e(
1822
+ "button",
1823
+ {
1824
+ type: "button",
1825
+ "aria-label": t.agentChat.removeAttachment(c.name),
1826
+ onClick: () => r(c),
1827
+ children: /* @__PURE__ */ e($e, { size: 11, "aria-hidden": "true" })
1828
+ }
1829
+ ) : null
1830
+ ] }, c.id))
1831
+ }
1832
+ );
1833
+ }
1834
+ function Ra({
1835
+ suggestions: n,
1836
+ title: r,
1837
+ className: i,
1838
+ ...a
1839
+ }) {
1840
+ const { messages: t } = V();
1841
+ return /* @__PURE__ */ l("div", { className: $("mf-suggestion-list", i), ...a, children: [
1842
+ /* @__PURE__ */ e("strong", { className: "mf-suggestion-list__title", children: r ?? t.agentChat.suggestions }),
1843
+ /* @__PURE__ */ e("div", { className: "mf-suggestion-list__items", children: n.map((c) => /* @__PURE__ */ l(
1844
+ "button",
1845
+ {
1846
+ type: "button",
1847
+ "aria-label": `${t.agentChat.useSuggestion(c.label)}${c.description ? `: ${c.description}` : ""}`,
1848
+ onClick: c.onSelect,
1849
+ children: [
1850
+ c.icon ?? /* @__PURE__ */ e(pe, { size: 12, "aria-hidden": "true" }),
1851
+ /* @__PURE__ */ l("span", { children: [
1852
+ /* @__PURE__ */ e("strong", { children: c.label }),
1853
+ c.description ? /* @__PURE__ */ e("small", { children: c.description }) : null
1854
+ ] })
1855
+ ]
1856
+ },
1857
+ c.id
1858
+ )) })
1859
+ ] });
1860
+ }
1861
+ const ca = {
1862
+ queued: "neutral",
1863
+ running: "info",
1864
+ paused: "warning",
1865
+ succeeded: "success",
1866
+ failed: "danger",
1867
+ cancelled: "neutral",
1868
+ "needs-review": "warning"
1869
+ }, oa = {
1870
+ passed: "success",
1871
+ failed: "danger",
1872
+ warning: "warning",
1873
+ skipped: "neutral"
1874
+ }, hn = {
1875
+ pending: "neutral",
1876
+ running: "info",
1877
+ success: "success",
1878
+ warning: "warning",
1879
+ error: "danger",
1880
+ cancelled: "neutral"
1881
+ }, mn = {
1882
+ agent: /* @__PURE__ */ e(tn, { size: 14, "aria-hidden": "true" }),
1883
+ model: /* @__PURE__ */ e(pe, { size: 14, "aria-hidden": "true" }),
1884
+ tool: /* @__PURE__ */ e($n, { size: 14, "aria-hidden": "true" }),
1885
+ retrieval: /* @__PURE__ */ e(Ln, { size: 14, "aria-hidden": "true" }),
1886
+ approval: /* @__PURE__ */ e(en, { size: 14, "aria-hidden": "true" }),
1887
+ custom: /* @__PURE__ */ e(ln, { size: 14, "aria-hidden": "true" })
1888
+ }, da = {
1889
+ pending: /* @__PURE__ */ e(rn, { size: 13, "aria-hidden": "true" }),
1890
+ running: /* @__PURE__ */ e(Ee, { size: "sm" }),
1891
+ success: /* @__PURE__ */ e(Vn, { size: 13, "aria-hidden": "true" }),
1892
+ warning: /* @__PURE__ */ e(We, { size: 13, "aria-hidden": "true" }),
1893
+ error: /* @__PURE__ */ e(We, { size: 13, "aria-hidden": "true" }),
1894
+ cancelled: /* @__PURE__ */ e(En, { size: 13, "aria-hidden": "true" })
1895
+ };
1896
+ function ua() {
1897
+ const [n, r] = j(!1);
1898
+ return ve(() => {
1899
+ const i = window.matchMedia("(max-width: 760px)"), a = () => r(i.matches);
1900
+ return a(), i.addEventListener("change", a), () => i.removeEventListener("change", a);
1901
+ }, []), n;
1902
+ }
1903
+ function Fe(n, r) {
1904
+ for (const i of n) {
1905
+ if (i.id === r) return i;
1906
+ const a = i.children ? Fe(i.children, r) : void 0;
1907
+ if (a) return a;
1908
+ }
1909
+ }
1910
+ function pn(n, r, i = []) {
1911
+ for (const a of n) {
1912
+ if (a.id === r) return i;
1913
+ if (a.children) {
1914
+ const t = pn(a.children, r, [...i, a.id]);
1915
+ if (t.length) return t;
1916
+ }
1917
+ }
1918
+ return [];
1919
+ }
1920
+ function fn(n, r, i) {
1921
+ return n.map((a) => ({
1922
+ id: a.id,
1923
+ icon: mn[a.type],
1924
+ label: /* @__PURE__ */ l("span", { className: "mf-trace-viewer__span-label", children: [
1925
+ /* @__PURE__ */ e("span", { children: a.title ?? a.name }),
1926
+ a.durationMs !== void 0 ? /* @__PURE__ */ e("small", { children: i(a.durationMs) }) : null,
1927
+ /* @__PURE__ */ e(re, { tone: hn[a.status], children: r.spanStatus[a.status] })
1928
+ ] }),
1929
+ description: typeof a.title < "u" && a.title !== a.name ? a.name : void 0,
1930
+ children: a.children ? fn(a.children, r, i) : void 0
1931
+ }));
1932
+ }
1933
+ function ha(n) {
1934
+ return n < 1e3 ? `${Math.round(n)} ms` : `${(n / 1e3).toFixed(1)} s`;
1935
+ }
1936
+ function Pa({
1937
+ title: n,
1938
+ status: r,
1939
+ runId: i,
1940
+ model: a,
1941
+ startedAt: t,
1942
+ finishedAt: c,
1943
+ duration: f,
1944
+ progress: g,
1945
+ completedCases: N,
1946
+ totalCases: v,
1947
+ metrics: h = [],
1948
+ actions: M,
1949
+ className: k,
1950
+ "aria-label": u,
1951
+ ...o
1952
+ }) {
1953
+ const { messages: S } = V(), b = S.harness, z = g ?? (N !== void 0 && v && v > 0 ? N / v * 100 : void 0);
1954
+ return /* @__PURE__ */ l(
1955
+ "section",
1956
+ {
1957
+ className: $("mf-run-overview", k),
1958
+ "aria-label": u ?? b.runOverview,
1959
+ ...o,
1960
+ children: [
1961
+ /* @__PURE__ */ l("div", { className: "mf-run-overview__header", children: [
1962
+ /* @__PURE__ */ l("div", { className: "mf-run-overview__copy", children: [
1963
+ /* @__PURE__ */ e("span", { children: b.run }),
1964
+ /* @__PURE__ */ e("h2", { children: n }),
1965
+ i ? /* @__PURE__ */ e("small", { children: i }) : null
1966
+ ] }),
1967
+ /* @__PURE__ */ l("div", { className: "mf-run-overview__actions", children: [
1968
+ /* @__PURE__ */ e(re, { tone: ca[r], dot: !0, children: /* @__PURE__ */ e("span", { role: "status", "aria-live": "polite", children: b.runStatus[r] }) }),
1969
+ M
1970
+ ] })
1971
+ ] }),
1972
+ /* @__PURE__ */ l(Ue, { className: "mf-run-overview__meta", children: [
1973
+ a ? /* @__PURE__ */ e(te, { label: b.model, children: a }) : null,
1974
+ t ? /* @__PURE__ */ e(te, { label: b.startedAt, children: t }) : null,
1975
+ c ? /* @__PURE__ */ e(te, { label: b.finishedAt, children: c }) : null,
1976
+ f ? /* @__PURE__ */ e(te, { label: b.duration, children: f }) : null,
1977
+ N !== void 0 ? /* @__PURE__ */ l(te, { label: b.cases, children: [
1978
+ N,
1979
+ v !== void 0 ? ` / ${v}` : null
1980
+ ] }) : null
1981
+ ] }),
1982
+ z !== void 0 ? /* @__PURE__ */ l("div", { className: "mf-run-overview__progress", children: [
1983
+ /* @__PURE__ */ e(
1984
+ sn,
1985
+ {
1986
+ value: z,
1987
+ label: b.runProgress,
1988
+ "aria-valuetext": `${Math.round(z)}%`
1989
+ }
1990
+ ),
1991
+ /* @__PURE__ */ l("span", { children: [
1992
+ Math.round(z),
1993
+ "%"
1994
+ ] })
1995
+ ] }) : null,
1996
+ h.length ? /* @__PURE__ */ e("ul", { className: "mf-run-overview__metrics", children: h.map((C) => /* @__PURE__ */ l("li", { children: [
1997
+ /* @__PURE__ */ e("span", { children: C.label }),
1998
+ /* @__PURE__ */ e("strong", { children: C.value }),
1999
+ C.description ? /* @__PURE__ */ e("small", { children: C.description }) : null,
2000
+ C.tone ? /* @__PURE__ */ e(re, { tone: C.tone, children: b.metric }) : null
2001
+ ] }, C.id)) }) : null
2002
+ ]
2003
+ }
2004
+ );
2005
+ }
2006
+ function Da({
2007
+ status: n,
2008
+ title: r,
2009
+ description: i,
2010
+ primaryScore: a,
2011
+ metrics: t = [],
2012
+ reason: c,
2013
+ actions: f,
2014
+ className: g,
2015
+ "aria-label": N,
2016
+ ...v
2017
+ }) {
2018
+ const { messages: h } = V(), M = h.harness, k = a?.max ?? 100, u = a ? Math.max(0, Math.min(100, a.value / k * 100)) : void 0;
2019
+ return /* @__PURE__ */ l(
2020
+ "section",
2021
+ {
2022
+ className: $("mf-evaluation-summary", g),
2023
+ "aria-label": N ?? M.evaluationSummary,
2024
+ ...v,
2025
+ children: [
2026
+ /* @__PURE__ */ l("header", { className: "mf-evaluation-summary__header", children: [
2027
+ /* @__PURE__ */ l("div", { children: [
2028
+ /* @__PURE__ */ e("span", { children: M.evaluation }),
2029
+ /* @__PURE__ */ e("h2", { children: r ?? M.evaluationSummary }),
2030
+ i ? /* @__PURE__ */ e("p", { children: i }) : null
2031
+ ] }),
2032
+ /* @__PURE__ */ e(re, { tone: oa[n], dot: !0, children: M.evaluationStatus[n] })
2033
+ ] }),
2034
+ a ? /* @__PURE__ */ l("div", { className: "mf-evaluation-summary__score", children: [
2035
+ /* @__PURE__ */ e("span", { children: a.label ?? M.score }),
2036
+ /* @__PURE__ */ l("strong", { children: [
2037
+ a.value,
2038
+ a.max !== void 0 ? ` / ${a.max}` : null
2039
+ ] }),
2040
+ u !== void 0 ? /* @__PURE__ */ e(
2041
+ sn,
2042
+ {
2043
+ value: u,
2044
+ label: M.score,
2045
+ "aria-valuetext": `${Math.round(u)}%`
2046
+ }
2047
+ ) : null
2048
+ ] }) : null,
2049
+ t.length ? /* @__PURE__ */ e("ul", { className: "mf-evaluation-summary__metrics", children: t.map((o) => /* @__PURE__ */ l("li", { children: [
2050
+ /* @__PURE__ */ e("span", { children: o.label }),
2051
+ /* @__PURE__ */ l("strong", { children: [
2052
+ o.value,
2053
+ o.max !== void 0 ? ` / ${o.max}` : null
2054
+ ] }),
2055
+ o.description ? /* @__PURE__ */ e("small", { children: o.description }) : null
2056
+ ] }, o.id)) }) : null,
2057
+ c ? /* @__PURE__ */ e(
2058
+ cn,
2059
+ {
2060
+ tone: n === "failed" ? "danger" : n === "warning" ? "warning" : "neutral",
2061
+ title: M.reason,
2062
+ children: c
2063
+ }
2064
+ ) : null,
2065
+ f ? /* @__PURE__ */ e("div", { className: "mf-evaluation-summary__actions", children: f }) : null
2066
+ ]
2067
+ }
2068
+ );
2069
+ }
2070
+ function La({
2071
+ spans: n,
2072
+ selectedId: r,
2073
+ defaultSelectedId: i,
2074
+ onSelectedIdChange: a,
2075
+ expandedIds: t,
2076
+ defaultExpandedIds: c,
2077
+ onExpandedIdsChange: f,
2078
+ loading: g = !1,
2079
+ emptyMessage: N,
2080
+ formatDuration: v = ha,
2081
+ className: h,
2082
+ "aria-label": M,
2083
+ ...k
2084
+ }) {
2085
+ const { messages: u } = V(), o = u.harness, S = ua(), [b, z] = ie({
2086
+ value: r,
2087
+ defaultValue: i,
2088
+ onChange: (d) => {
2089
+ a?.(d, d ? Fe(n, d) : void 0);
2090
+ }
2091
+ }), C = qe(() => {
2092
+ if (c) return c;
2093
+ const d = i ?? n[0]?.id, p = d ? pn(n, d) : [];
2094
+ return Array.from(/* @__PURE__ */ new Set([...n.map((y) => y.id), ...p]));
2095
+ }, [c, i, n]), [x, P] = ie({
2096
+ value: t,
2097
+ defaultValue: C,
2098
+ onChange: f
2099
+ }), D = b ?? i, q = D ? Fe(n, D) : void 0, L = q ?? n[0], B = qe(
2100
+ () => fn(n, o, v),
2101
+ [v, o, n]
2102
+ ), _ = (d) => {
2103
+ z(d);
2104
+ };
2105
+ if (g)
2106
+ return /* @__PURE__ */ e(
2107
+ "section",
2108
+ {
2109
+ className: $("mf-trace-viewer", "is-loading", h),
2110
+ "aria-label": M ?? o.traceViewer,
2111
+ ...k,
2112
+ children: /* @__PURE__ */ l("div", { className: "mf-trace-viewer__status", children: [
2113
+ /* @__PURE__ */ e(Ee, { label: o.loadingTrace }),
2114
+ /* @__PURE__ */ e("span", { children: o.loadingTrace })
2115
+ ] })
2116
+ }
2117
+ );
2118
+ if (!n.length)
2119
+ return /* @__PURE__ */ e(
2120
+ "section",
2121
+ {
2122
+ className: $("mf-trace-viewer", "is-empty", h),
2123
+ "aria-label": M ?? o.traceViewer,
2124
+ ...k,
2125
+ children: /* @__PURE__ */ e(
2126
+ Ne,
2127
+ {
2128
+ icon: /* @__PURE__ */ e(ln, { size: 22, "aria-hidden": "true" }),
2129
+ title: N ?? o.emptyTrace
2130
+ }
2131
+ )
2132
+ }
2133
+ );
2134
+ const U = () => /* @__PURE__ */ l("div", { className: "mf-trace-viewer__tree-pane", children: [
2135
+ /* @__PURE__ */ l("div", { className: "mf-trace-viewer__pane-header", children: [
2136
+ /* @__PURE__ */ e("span", { children: o.spans }),
2137
+ /* @__PURE__ */ e("small", { children: o.spanCount(gn(n)) })
2138
+ ] }),
2139
+ /* @__PURE__ */ e(
2140
+ jn,
2141
+ {
2142
+ "aria-label": o.traceTree,
2143
+ nodes: B,
2144
+ expanded: x,
2145
+ onExpandedChange: P,
2146
+ selected: S ? b : D ?? L?.id,
2147
+ onSelect: (d) => _(d.id)
2148
+ }
2149
+ )
2150
+ ] }), m = (d) => {
2151
+ if (!d)
2152
+ return /* @__PURE__ */ e(
2153
+ Ne,
2154
+ {
2155
+ icon: /* @__PURE__ */ e(ma, {}),
2156
+ title: o.selectSpan,
2157
+ description: o.selectSpanDescription
2158
+ }
2159
+ );
2160
+ const p = [
2161
+ d.input !== void 0 ? "input" : void 0,
2162
+ d.output !== void 0 ? "output" : void 0,
2163
+ d.attributes?.length ? "attributes" : void 0,
2164
+ d.events?.length ? "events" : void 0
2165
+ ].filter((y) => !!y);
2166
+ return /* @__PURE__ */ l("div", { className: "mf-trace-viewer__detail", children: [
2167
+ /* @__PURE__ */ l("header", { className: "mf-trace-viewer__detail-header", children: [
2168
+ S ? /* @__PURE__ */ e(
2169
+ ee,
2170
+ {
2171
+ size: "sm",
2172
+ variant: "ghost",
2173
+ leadingIcon: /* @__PURE__ */ e(Dn, { size: 14, "aria-hidden": "true" }),
2174
+ onClick: () => _(void 0),
2175
+ children: o.backToSpans
2176
+ }
2177
+ ) : null,
2178
+ /* @__PURE__ */ e("span", { className: "mf-trace-viewer__detail-icon", children: mn[d.type] }),
2179
+ /* @__PURE__ */ l("div", { children: [
2180
+ /* @__PURE__ */ e("small", { children: o.spanType[d.type] }),
2181
+ /* @__PURE__ */ e("h3", { children: d.title ?? d.name }),
2182
+ d.description ? /* @__PURE__ */ e("p", { children: d.description }) : null
2183
+ ] }),
2184
+ /* @__PURE__ */ e(re, { tone: hn[d.status], children: o.spanStatus[d.status] })
2185
+ ] }),
2186
+ /* @__PURE__ */ l(Ue, { className: "mf-trace-viewer__meta", children: [
2187
+ /* @__PURE__ */ e(te, { label: o.spanId, children: d.id }),
2188
+ /* @__PURE__ */ e(te, { label: o.spanTypeLabel, children: o.spanType[d.type] }),
2189
+ d.offsetMs !== void 0 ? /* @__PURE__ */ e(te, { label: o.offset, children: v(d.offsetMs) }) : null,
2190
+ d.durationMs !== void 0 ? /* @__PURE__ */ e(te, { label: o.duration, children: v(d.durationMs) }) : null
2191
+ ] }),
2192
+ d.error ? /* @__PURE__ */ e(cn, { tone: "danger", title: o.spanError, children: d.error }) : null,
2193
+ p.length ? /* @__PURE__ */ l(Un, { defaultValue: p[0], className: "mf-trace-viewer__tabs", children: [
2194
+ /* @__PURE__ */ l(Fn, { size: "sm", children: [
2195
+ d.input !== void 0 ? /* @__PURE__ */ e(xe, { value: "input", children: o.input }) : null,
2196
+ d.output !== void 0 ? /* @__PURE__ */ e(xe, { value: "output", children: o.output }) : null,
2197
+ d.attributes?.length ? /* @__PURE__ */ e(xe, { value: "attributes", children: o.attributes }) : null,
2198
+ d.events?.length ? /* @__PURE__ */ e(xe, { value: "events", children: o.events }) : null
2199
+ ] }),
2200
+ d.input !== void 0 ? /* @__PURE__ */ e(Ae, { value: "input", children: /* @__PURE__ */ e("div", { className: "mf-trace-viewer__payload", children: d.input }) }) : null,
2201
+ d.output !== void 0 ? /* @__PURE__ */ e(Ae, { value: "output", children: /* @__PURE__ */ e("div", { className: "mf-trace-viewer__payload", children: d.output }) }) : null,
2202
+ d.attributes?.length ? /* @__PURE__ */ e(Ae, { value: "attributes", children: /* @__PURE__ */ e(Ue, { children: d.attributes.map((y) => /* @__PURE__ */ e(te, { label: y.label, children: y.value }, y.id)) }) }) : null,
2203
+ d.events?.length ? /* @__PURE__ */ e(Ae, { value: "events", children: /* @__PURE__ */ e(
2204
+ Kn,
2205
+ {
2206
+ items: d.events.map((y) => ({
2207
+ id: y.id,
2208
+ title: y.title,
2209
+ description: y.description,
2210
+ timestamp: y.timestamp,
2211
+ status: y.status === "error" ? "danger" : y.status === "warning" ? "warning" : y.status === "success" ? "success" : "default",
2212
+ icon: y.status ? da[y.status] : void 0
2213
+ }))
2214
+ }
2215
+ ) }) : null
2216
+ ] }) : /* @__PURE__ */ e(
2217
+ Ne,
2218
+ {
2219
+ icon: /* @__PURE__ */ e(rn, { size: 20, "aria-hidden": "true" }),
2220
+ title: o.noSpanDetails
2221
+ }
2222
+ )
2223
+ ] }, d.id);
2224
+ };
2225
+ return S ? /* @__PURE__ */ e(
2226
+ "section",
2227
+ {
2228
+ className: $("mf-trace-viewer", "mf-trace-viewer--mobile", h),
2229
+ "aria-label": M ?? o.traceViewer,
2230
+ ...k,
2231
+ children: b ? m(q) : U()
2232
+ }
2233
+ ) : /* @__PURE__ */ e(
2234
+ "section",
2235
+ {
2236
+ className: $("mf-trace-viewer", h),
2237
+ "aria-label": M ?? o.traceViewer,
2238
+ ...k,
2239
+ children: /* @__PURE__ */ l("div", { className: "mf-trace-viewer__workspace", children: [
2240
+ U(),
2241
+ /* @__PURE__ */ e("div", { className: "mf-trace-viewer__detail-pane", children: m(L) })
2242
+ ] })
2243
+ }
2244
+ );
2245
+ }
2246
+ function gn(n) {
2247
+ return n.reduce(
2248
+ (r, i) => r + 1 + gn(i.children ?? []),
2249
+ 0
2250
+ );
2251
+ }
2252
+ function ma() {
2253
+ return /* @__PURE__ */ e(On, { size: 21, "aria-hidden": "true" });
2254
+ }
2255
+ export {
2256
+ ea as A,
2257
+ Ma as C,
2258
+ Da as E,
2259
+ ka as M,
2260
+ ta as P,
2261
+ Sa as R,
2262
+ za as S,
2263
+ xa as T,
2264
+ Hn as a,
2265
+ Ca as b,
2266
+ Yn as c,
2267
+ aa as d,
2268
+ Ta as e,
2269
+ ra as f,
2270
+ Ia as g,
2271
+ na as h,
2272
+ la as i,
2273
+ ia as j,
2274
+ Pa as k,
2275
+ Ra as l,
2276
+ Aa as m,
2277
+ La as n,
2278
+ Gn as o,
2279
+ on as p,
2280
+ wa as q
2281
+ };
2282
+ //# sourceMappingURL=harness-Dcqe3-AP.js.map