agentglow 0.1.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.
@@ -0,0 +1,857 @@
1
+ import { jsxs as N, jsx as r } from "react/jsx-runtime";
2
+ import { Trail as wt, OrbitControls as Gt } from "@react-three/drei";
3
+ import { useThree as _t, useFrame as oe, Canvas as kt } from "@react-three/fiber";
4
+ import { EffectComposer as Ft, Bloom as Rt, Vignette as Ot, Noise as It } from "@react-three/postprocessing";
5
+ import { useMemo as u, useState as Oe, useRef as k, useEffect as He } from "react";
6
+ import { l as me, o as Et, j as Vt, h as Wt, w as O, L as Ze, c as Dt, d as Lt, S as Ce, R as Xt, t as Nt, g as jt, i as Ne, T as Ye, a as qt, e as Ht, b as Ge, K as pt, G as Zt, n as Yt, C as $t, f as Kt, H as Jt } from "./ClusterBall-CPsd6JvJ.js";
7
+ import * as t from "three";
8
+ import { a as bt, i as Qt, j as fe, r as en } from "./spread-CWdeDFd9.js";
9
+ var yt;
10
+ const xt = typeof window < "u" && !!((yt = window.matchMedia) != null && yt.call(window, "(prefers-reduced-motion: reduce)").matches), Ie = xt ? 0.25 : 1, Be = -7.2, Me = -12, Le = 12, J = { plan: -7.5, research: 0, write: 7.5 }, tn = [5, 1.1, -2.8], St = (e) => tn[e % 3] + (e >= 3 ? 1.2 : 0), At = (e) => e >= 3 ? -6 - (e - 3) * 2.5 : -(e % 3) * 0.7, at = (e) => me.grouped ? Et(e) : e;
11
+ function it(e, o) {
12
+ const n = bt(Vt(e));
13
+ return o.set(0, n * 1.3, -Math.abs(n) * 2.2);
14
+ }
15
+ const Re = (e, o) => Math.sin(e * 0.32 + o * 1.9) * 0.45 + Math.sin(e * 0.11 + o) * 0.3, Xe = (e, o) => Math.sin(e * 0.2 + o * 0.7) * 0.35, Ct = (e, o) => 0;
16
+ function ct(e, o, n, s) {
17
+ return s.set(o, St(e) + Ct() + Re(o, e), At(e) + Xe(o, e));
18
+ }
19
+ const Ke = [-0.55, 0.55, -1.25, 1.25, 0, -1.6], Bt = Qt, nn = (e) => e === "planner" ? "plan" : e === "writer" ? "write" : "research";
20
+ function on(e, o, n, s, a) {
21
+ const p = e.id;
22
+ let i = J[nn(e.type)] + fe(p, 41) * 1.2 + bt(n) * 1.9, c = 1.15 + fe(p, 42) * 0.5 + (n ? 0.6 : 0), h = 0.4 + fe(p, 43) * 0.7;
23
+ if (Bt(e.type)) {
24
+ const d = Ke[n % Ke.length] + fe(e.run, 44) * 0.5 + fe(p, 45) * 0.16, F = 3.6 * (0.85 + 0.3 * Wt(e.run, 46)) + Math.floor(n / Ke.length) * 1.4;
25
+ i = Math.sin(d) * F, c = 0.2 - Math.cos(d) * 1.1 + fe(p, 47) * 0.35, h = 2.2 + fe(p, 48) * 0.8;
26
+ }
27
+ return i += fe(e.run, 49) * 2.4 + (o >= 3 ? 3 : 0), ct(o, i, s, a), a.add(it(e.run, rn)), a.y += c, a.z += h, a;
28
+ }
29
+ const rn = new t.Vector3(), ne = /* @__PURE__ */ new Map(), Pe = /* @__PURE__ */ new Map(), Pt = { id: null };
30
+ function sn(e) {
31
+ let o = 7;
32
+ for (let n = 0; n < e.length; n++) o = o * 31 + e.charCodeAt(n) >>> 0;
33
+ return o;
34
+ }
35
+ const ae = (e) => e < 0 ? 0 : e > 1 ? 1 : e, an = (e) => 1 - Math.pow(1 - e, 3), cn = (e) => 1 + 2.9 * Math.pow(e - 1, 3) + 1.9 * Math.pow(e - 1, 2), _e = new t.Vector3();
36
+ function je(e, o, n, s, a) {
37
+ _e.copy(e).add(o).multiplyScalar(0.5), _e.y += s;
38
+ const p = 1 - n;
39
+ return a.set(
40
+ p * p * e.x + 2 * p * n * _e.x + n * n * o.x,
41
+ p * p * e.y + 2 * p * n * _e.y + n * n * o.y,
42
+ p * p * e.z + 2 * p * n * _e.z + n * n * o.z
43
+ );
44
+ }
45
+ let Ve = null;
46
+ function qe() {
47
+ if (Ve) return Ve;
48
+ const e = document.createElement("canvas");
49
+ e.width = e.height = 64;
50
+ const o = e.getContext("2d"), n = o.createRadialGradient(32, 32, 0, 32, 32, 32);
51
+ return n.addColorStop(0, "rgba(255,255,255,1)"), n.addColorStop(0.35, "rgba(255,255,255,0.55)"), n.addColorStop(1, "rgba(255,255,255,0)"), o.fillStyle = n, o.fillRect(0, 0, 64, 64), Ve = new t.CanvasTexture(e), Ve;
52
+ }
53
+ function Tt(e) {
54
+ return new t.ShaderMaterial({
55
+ uniforms: {
56
+ uColor: { value: new t.Color(e) },
57
+ uIntensity: { value: 1 },
58
+ uOpacity: { value: 1 },
59
+ uFlash: { value: 0 }
60
+ },
61
+ vertexShader: (
62
+ /* glsl */
63
+ `
64
+ varying vec3 vN; varying vec3 vV; varying vec3 vP;
65
+ void main() {
66
+ vP = position;
67
+ vec4 mv = modelViewMatrix * vec4(position, 1.0);
68
+ vN = normalize(normalMatrix * normal);
69
+ vV = normalize(-mv.xyz);
70
+ gl_Position = projectionMatrix * mv;
71
+ }`
72
+ ),
73
+ fragmentShader: (
74
+ /* glsl */
75
+ `
76
+ uniform vec3 uColor; uniform float uIntensity; uniform float uOpacity; uniform float uFlash;
77
+ varying vec3 vN; varying vec3 vV; varying vec3 vP;
78
+ void main() {
79
+ float f = pow(1.0 - abs(dot(normalize(vN), normalize(vV))), 2.2);
80
+ float margin = 1.0 - smoothstep(0.0, 0.22, vP.y);
81
+ float canals = pow(abs(sin(atan(vP.z, vP.x) * 4.0)), 18.0) * smoothstep(0.05, 0.6, vP.y);
82
+ float top = smoothstep(0.75, 1.0, vP.y);
83
+ float b = 0.10 + f * 1.5 + margin * 1.1 + canals * 0.6 + top * 0.25;
84
+ vec3 c = mix(uColor, vec3(1.0), clamp(uFlash * 0.7 + margin * 0.15, 0.0, 1.0)) * b * uIntensity;
85
+ float a = clamp((0.18 + f * 0.9 + margin * 0.7) * uOpacity, 0.0, 1.0);
86
+ gl_FragColor = vec4(c, a);
87
+ }`
88
+ ),
89
+ transparent: !0,
90
+ depthWrite: !1,
91
+ side: t.DoubleSide,
92
+ blending: t.AdditiveBlending
93
+ });
94
+ }
95
+ function dt(e) {
96
+ return new t.ShaderMaterial({
97
+ uniforms: {
98
+ uColor: { value: new t.Color(e) },
99
+ uTime: { value: 0 },
100
+ uReveal: { value: 0 },
101
+ uFade: { value: 1 },
102
+ uPulse: { value: -1 },
103
+ uPulseAmp: { value: 0 },
104
+ uWidthGlow: { value: 1 }
105
+ },
106
+ vertexShader: (
107
+ /* glsl */
108
+ `
109
+ varying vec2 vUv;
110
+ void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`
111
+ ),
112
+ fragmentShader: (
113
+ /* glsl */
114
+ `
115
+ uniform vec3 uColor; uniform float uTime; uniform float uReveal; uniform float uFade; uniform float uPulse; uniform float uPulseAmp; uniform float uWidthGlow;
116
+ varying vec2 vUv;
117
+ void main() {
118
+ float u = vUv.x;
119
+ float flow = pow(0.5 + 0.5 * sin(u * 70.0 - uTime * 2.4), 8.0);
120
+ float pulse = exp(-pow((u - uPulse) * 22.0, 2.0)) * uPulseAmp;
121
+ float ends = smoothstep(0.0, 0.07, u) * smoothstep(1.0, 0.93, u);
122
+ float rev = smoothstep(uReveal, uReveal - 0.04, u);
123
+ float b = (0.32 + flow * 0.7) * uWidthGlow + pulse * 5.0;
124
+ vec3 c = mix(uColor, vec3(1.0), clamp(pulse * 0.6, 0.0, 1.0)) * b;
125
+ float a = ends * rev * uFade;
126
+ gl_FragColor = vec4(c, a);
127
+ }`
128
+ ),
129
+ transparent: !0,
130
+ depthWrite: !1,
131
+ blending: t.AdditiveBlending
132
+ });
133
+ }
134
+ function ln() {
135
+ return new t.ShaderMaterial({
136
+ uniforms: { uTime: { value: 0 }, uPx: { value: 1 } },
137
+ vertexShader: (
138
+ /* glsl */
139
+ `
140
+ attribute float aSeed;
141
+ uniform float uTime; uniform float uPx;
142
+ varying float vA;
143
+ void main() {
144
+ vec3 p = position;
145
+ float H = 24.0;
146
+ p.y = mod(p.y - uTime * (0.18 + aSeed * 0.25) + 12.0, H) - 10.0;
147
+ p.x += sin(uTime * 0.3 + aSeed * 40.0) * 0.4;
148
+ p.z += cos(uTime * 0.23 + aSeed * 23.0) * 0.3;
149
+ vec4 mv = modelViewMatrix * vec4(p, 1.0);
150
+ gl_PointSize = (0.5 + aSeed * 1.5) * uPx * (28.0 / -mv.z);
151
+ vA = (0.12 + aSeed * 0.4) * smoothstep(-10.0, -7.0, p.y) * smoothstep(14.0, 10.0, p.y);
152
+ gl_Position = projectionMatrix * mv;
153
+ }`
154
+ ),
155
+ fragmentShader: (
156
+ /* glsl */
157
+ `
158
+ varying float vA;
159
+ void main() {
160
+ float d = length(gl_PointCoord - 0.5);
161
+ float a = smoothstep(0.5, 0.0, d) * vA;
162
+ gl_FragColor = vec4(vec3(0.55, 0.8, 1.0), a);
163
+ }`
164
+ ),
165
+ transparent: !0,
166
+ depthWrite: !1,
167
+ blending: t.AdditiveBlending
168
+ });
169
+ }
170
+ function ke(e) {
171
+ return new t.ShaderMaterial({
172
+ uniforms: { uTime: { value: 0 }, uStrength: { value: e }, uSeed: { value: Math.random() * 10 } },
173
+ vertexShader: (
174
+ /* glsl */
175
+ `
176
+ varying vec2 vUv;
177
+ void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`
178
+ ),
179
+ fragmentShader: (
180
+ /* glsl */
181
+ `
182
+ uniform float uTime; uniform float uStrength; uniform float uSeed;
183
+ varying vec2 vUv;
184
+ void main() {
185
+ float across = exp(-pow((vUv.x - 0.5) * 3.2, 2.0));
186
+ float down = pow(vUv.y, 1.6);
187
+ float shimmer = 0.75 + 0.25 * sin(uTime * 0.6 + uSeed + vUv.y * 6.0);
188
+ float a = across * down * shimmer * uStrength;
189
+ gl_FragColor = vec4(vec3(0.35, 0.65, 1.0), a);
190
+ }`
191
+ ),
192
+ transparent: !0,
193
+ depthWrite: !1,
194
+ side: t.DoubleSide,
195
+ blending: t.AdditiveBlending
196
+ });
197
+ }
198
+ function un() {
199
+ return new t.ShaderMaterial({
200
+ uniforms: { uTime: { value: 0 } },
201
+ vertexShader: (
202
+ /* glsl */
203
+ `
204
+ varying vec3 vDir;
205
+ void main() { vDir = normalize(position); gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`
206
+ ),
207
+ fragmentShader: (
208
+ /* glsl */
209
+ `
210
+ uniform float uTime;
211
+ varying vec3 vDir;
212
+ void main() {
213
+ float y = vDir.y;
214
+ vec3 deep = vec3(0.002, 0.006, 0.014);
215
+ vec3 mid = vec3(0.006, 0.026, 0.05);
216
+ vec3 top = vec3(0.02, 0.09, 0.15);
217
+ vec3 c = mix(deep, mid, smoothstep(-0.35, 0.15, y));
218
+ c = mix(c, top, smoothstep(0.2, 0.85, y));
219
+ float caust = pow(0.5 + 0.5 * sin(vDir.x * 18.0 + uTime * 0.4) * sin(vDir.z * 15.0 - uTime * 0.3), 6.0);
220
+ c += vec3(0.03, 0.08, 0.12) * caust * smoothstep(0.55, 0.95, y);
221
+ gl_FragColor = vec4(c, 1.0);
222
+ }`
223
+ ),
224
+ side: t.BackSide,
225
+ depthWrite: !1
226
+ });
227
+ }
228
+ function pn() {
229
+ return new t.ShaderMaterial({
230
+ uniforms: { uTime: { value: 0 } },
231
+ vertexShader: (
232
+ /* glsl */
233
+ `
234
+ varying vec2 vXZ;
235
+ void main() { vec4 w = modelMatrix * vec4(position, 1.0); vXZ = w.xz; gl_Position = projectionMatrix * viewMatrix * w; }`
236
+ ),
237
+ fragmentShader: (
238
+ /* glsl */
239
+ `
240
+ uniform float uTime;
241
+ varying vec2 vXZ;
242
+ void main() {
243
+ vec2 p = vXZ;
244
+ float c1 = sin(p.x * 0.9 + uTime * 0.5 + sin(p.y * 0.7 + uTime * 0.3) * 1.5);
245
+ float c2 = sin(p.y * 1.1 - uTime * 0.4 + sin(p.x * 0.6 - uTime * 0.2) * 1.7);
246
+ float caust = pow(0.5 + 0.25 * (c1 + c2), 5.0);
247
+ float d = length(vec2(p.x * 0.6, (p.y + 3.0)));
248
+ float fade = smoothstep(22.0, 4.0, d);
249
+ vec3 sand = vec3(0.012, 0.03, 0.045);
250
+ vec3 c = sand + vec3(0.05, 0.13, 0.17) * caust;
251
+ gl_FragColor = vec4(c, fade);
252
+ }`
253
+ ),
254
+ transparent: !0,
255
+ depthWrite: !1
256
+ });
257
+ }
258
+ const Je = xt ? 700 : 2200;
259
+ function dn() {
260
+ const e = _t((i) => i.viewport.dpr), o = u(un, []), n = u(pn, []), s = u(ln, []), a = u(
261
+ () => [
262
+ { x: J.plan, w: 4.5, rz: 0.08, m: ke(0.07) },
263
+ { x: J.research, w: 6, rz: 0.03, m: ke(0.09) },
264
+ { x: J.write, w: 4.5, rz: -0.06, m: ke(0.07) },
265
+ { x: -15, w: 8, rz: 0.15, m: ke(0.035) },
266
+ { x: 14, w: 7, rz: -0.12, m: ke(0.035) }
267
+ ],
268
+ []
269
+ ), p = u(() => {
270
+ const i = new t.BufferGeometry(), c = new Float32Array(Je * 3), h = new Float32Array(Je);
271
+ for (let d = 0; d < Je; d++)
272
+ c[d * 3] = (Math.random() - 0.5) * 50, c[d * 3 + 1] = Math.random() * 24 - 10, c[d * 3 + 2] = Math.random() * 34 - 22, h[d] = Math.random();
273
+ return i.setAttribute("position", new t.BufferAttribute(c, 3)), i.setAttribute("aSeed", new t.BufferAttribute(h, 1)), i;
274
+ }, []);
275
+ return oe(({ clock: i }) => {
276
+ const c = i.elapsedTime * Ie;
277
+ o.uniforms.uTime.value = c, n.uniforms.uTime.value = c, s.uniforms.uTime.value = c, s.uniforms.uPx.value = e;
278
+ for (const h of a) h.m.uniforms.uTime.value = c;
279
+ }), /* @__PURE__ */ N("group", { children: [
280
+ /* @__PURE__ */ r("mesh", { material: o, renderOrder: -10, children: /* @__PURE__ */ r("sphereGeometry", { args: [120, 32, 16] }) }),
281
+ /* @__PURE__ */ r("mesh", { material: n, rotation: [-Math.PI / 2, 0, 0], position: [0, Be, -4], children: /* @__PURE__ */ r("planeGeometry", { args: [110, 70, 1, 1] }) }),
282
+ a.map((i, c) => /* @__PURE__ */ r("mesh", { material: i.m, position: [i.x, 3.5, -3.5 - (c > 2 ? 4 : 0)], rotation: [0, 0, i.rz], children: /* @__PURE__ */ r("planeGeometry", { args: [i.w, 24] }) }, c)),
283
+ /* @__PURE__ */ r("points", { geometry: p, material: s, frustumCulled: !1 })
284
+ ] });
285
+ }
286
+ const ft = [
287
+ [-19.5, 4.2, -7],
288
+ [19.5, 4.2, -7],
289
+ [-19.5, -2.6, -6],
290
+ [19.5, -2.6, -6],
291
+ [0, 11, -12],
292
+ [-9, 11.5, -14],
293
+ [9, 11.5, -14]
294
+ ], fn = (e) => ft[e % ft.length];
295
+ new t.Color();
296
+ const mt = new t.Vector3(0.95, 0.75, 0.25);
297
+ function mn({ srv: e }) {
298
+ const [o, n, s] = fn(e.slot), a = k(null), p = k(null), i = k(null), c = k(null), h = k(null), d = k(null), F = u(() => new t.Color(e.color), [e.color]), C = u(() => Tt(e.color), [e.color]), P = u(() => new t.MeshBasicMaterial({ toneMapped: !1 }), []), f = u(() => new t.SpriteMaterial({ color: e.color, map: qe(), transparent: !0, toneMapped: !1, blending: t.AdditiveBlending, depthWrite: !1 }), [e.color]), S = u(() => new t.MeshBasicMaterial({ color: new t.Color(e.color).multiplyScalar(0.8), toneMapped: !1 }), [e.color]), V = u(() => new t.MeshBasicMaterial({ color: new t.Color(2.5, 2.5, 2.5), toneMapped: !1 }), []), T = u(() => new t.MeshBasicMaterial({ color: e.color, transparent: !0, toneMapped: !1, blending: t.AdditiveBlending, depthWrite: !1, side: t.DoubleSide }), [e.color]), x = u(() => {
299
+ const _ = new t.QuadraticBezierCurve3(new t.Vector3(0.55, 0.35, 0), new t.Vector3(0.75, 1.25, 0), mt);
300
+ return new t.TubeGeometry(_, 16, 0.018, 4);
301
+ }, []), y = u(() => new t.Vector3(), []), A = u(() => performance.now(), []);
302
+ return He(() => (Pe.set(e.name, y), () => void Pe.delete(e.name)), [e.name, y]), oe(({ clock: _ }) => {
303
+ var B;
304
+ const w = performance.now(), b = _.elapsedTime * Ie, R = O.mcpServers.get(e.name) ?? e, I = R.inflight > 0, v = Math.exp(-(w - R.activeAt) / 500), l = Math.min(1, (w - A) / 1200), E = a.current, g = p.current;
305
+ if (!E || !g) return;
306
+ E.position.set(o + Math.sin(b * 0.3 + R.slot) * 0.5, n + Math.sin(b * 0.45 + R.slot * 2) * 0.35, s), g.rotation.y = (o > 0 ? Math.PI : 0) + Math.sin(b * (I ? 2.4 : 0.6)) * (I ? 0.35 : 0.12), g.rotation.z = Math.sin(b * 0.5 + R.slot) * 0.08, g.scale.setScalar(l * (1 + v * 0.12)), C.uniforms.uIntensity.value = 0.16 + (I ? 0.18 : 0) + v * 0.45, C.uniforms.uOpacity.value = 0.7 * l;
307
+ const z = (I ? 2.4 + Math.sin(w / 110) * 0.9 : 1.2) + v * 4;
308
+ if (P.color.copy(F).multiplyScalar(z), i.current && i.current.scale.setScalar(1 + v * 0.5 + (I ? 0.15 * Math.sin(w / 110) : 0)), c.current && (c.current.scale.setScalar(1.6 + v * 2 + (I ? 0.8 : 0)), f.opacity = 0.35 + v * 0.4 + (I ? 0.2 : 0)), h.current) {
309
+ const M = (w - R.activeAt) / 1100;
310
+ h.current.visible = M < 1, h.current.scale.setScalar(0.3 + M * 2.4), T.opacity = Math.max(0, 1 - M) * 0.9;
311
+ }
312
+ i.current && i.current.getWorldPosition(y), (B = d.current) == null || B.setOpacity(l * (I ? 1 : 0.75));
313
+ }), /* @__PURE__ */ N("group", { ref: a, children: [
314
+ /* @__PURE__ */ N("group", { ref: p, children: [
315
+ /* @__PURE__ */ r("mesh", { material: C, scale: [0.95, 0.62, 0.55], children: /* @__PURE__ */ r("sphereGeometry", { args: [1, 28, 18] }) }),
316
+ /* @__PURE__ */ r("mesh", { material: C, position: [0.62, -0.28, 0], rotation: [0, 0, -0.5], scale: [0.5, 0.18, 0.42], children: /* @__PURE__ */ r("sphereGeometry", { args: [1, 16, 10] }) }),
317
+ /* @__PURE__ */ r("mesh", { material: C, position: [-1.15, 0.05, 0], rotation: [0, 0, Math.PI / 2], scale: [0.6, 0.45, 0.12], children: /* @__PURE__ */ r("coneGeometry", { args: [0.7, 0.9, 12] }) }),
318
+ /* @__PURE__ */ r("mesh", { material: S, geometry: x }),
319
+ /* @__PURE__ */ r("mesh", { material: V, position: [0.55, 0.12, 0.42], children: /* @__PURE__ */ r("sphereGeometry", { args: [0.05, 8, 6] }) }),
320
+ /* @__PURE__ */ N("group", { position: mt, children: [
321
+ /* @__PURE__ */ r("mesh", { ref: i, material: P, children: /* @__PURE__ */ r("sphereGeometry", { args: [0.13, 16, 12] }) }),
322
+ /* @__PURE__ */ r("sprite", { ref: c, material: f }),
323
+ /* @__PURE__ */ r("mesh", { ref: h, material: T, visible: !1, children: /* @__PURE__ */ r("ringGeometry", { args: [0.92, 1, 48] }) })
324
+ ] })
325
+ ] }),
326
+ /* @__PURE__ */ r(Ze, { ref: d, position: [0, -1.15, 0], text: `mcp · ${e.name}`, color: e.color, size: 0.3, opacity: 0, pxRange: [9, 13] })
327
+ ] });
328
+ }
329
+ function hn() {
330
+ const n = u(() => {
331
+ const h = new t.BufferGeometry();
332
+ return h.setAttribute("position", new t.BufferAttribute(new Float32Array(4032), 3)), h.setAttribute("color", new t.BufferAttribute(new Float32Array(4032), 3)), h;
333
+ }, []), s = u(() => new t.Vector3(), []), a = u(() => new t.Color("#f59e0b"), []), p = u(() => new t.Color("#ef4444"), []), i = u(() => new t.Color(1, 1, 1), []), c = u(() => new t.Color(), []);
334
+ return oe(({ clock: h }) => {
335
+ var x;
336
+ const d = performance.now(), F = h.elapsedTime, C = n.getAttribute("position"), P = n.getAttribute("color"), f = C.array, S = P.array;
337
+ let V = 0;
338
+ const T = (y, A, _) => {
339
+ for (let w = 0; w < 28; w++)
340
+ for (let b = 0; b < 2; b++) {
341
+ const R = (w + b) / 28, I = ((V * 28 + w) * 2 + b) * 3;
342
+ je(y, A, R, 1.6, s);
343
+ const v = Math.sin(R * 14 - F * 5) * 0.05 * Math.sin(R * Math.PI);
344
+ f[I] = s.x, f[I + 1] = s.y + v, f[I + 2] = s.z;
345
+ const l = _(R);
346
+ S[I] = c.r * l, S[I + 1] = c.g * l, S[I + 2] = c.b * l;
347
+ }
348
+ V++;
349
+ };
350
+ for (const y of O.mcpPending.values()) {
351
+ if (V >= 24) break;
352
+ const A = ne.get(y.instance), _ = Pe.get(y.server);
353
+ if (!A || !_) continue;
354
+ const w = Dt(y, d), b = O.mcpServers.get(y.server);
355
+ c.set((b == null ? void 0 : b.color) ?? "#94a3b8"), w < 1 ? c.lerp(a, w * 0.8) : c.copy(a).lerp(p, Math.min(1, (w - 1) / 1.2));
356
+ const R = 0.35 + Math.min(w, 3) * 0.35, I = Math.min(1, w * 4);
357
+ T(A, _, (v) => {
358
+ if (v > I) return 0;
359
+ const l = v * 6 - F * 1.8;
360
+ return R * (0.45 + Math.pow(l - Math.floor(l), 8) * 3);
361
+ });
362
+ }
363
+ for (const y of O.mcpResolved) {
364
+ if (V >= 24) break;
365
+ const A = ne.get(y.instance), _ = Pe.get(y.server);
366
+ if (!A || !_) continue;
367
+ const w = (d - y.resolvedAt) / 700;
368
+ c.set(((x = O.mcpServers.get(y.server)) == null ? void 0 : x.color) ?? "#ffffff").lerp(i, 0.6);
369
+ const b = 1 - w * 1.15;
370
+ T(A, _, (R) => (1 - w) * (0.25 + Math.exp(-Math.pow((R - b) * 9, 2)) * 5));
371
+ }
372
+ n.setDrawRange(0, V * 28 * 2), C.needsUpdate = !0, P.needsUpdate = !0;
373
+ }), /* @__PURE__ */ r("lineSegments", { geometry: n, frustumCulled: !1, children: /* @__PURE__ */ r("lineBasicMaterial", { vertexColors: !0, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) });
374
+ }
375
+ function gn() {
376
+ const [e, o] = Oe([]), n = k(0);
377
+ return oe(() => {
378
+ O.mcpServers.size !== n.current && (n.current = O.mcpServers.size, o([...O.mcpServers.values()]));
379
+ }), /* @__PURE__ */ N("group", { children: [
380
+ e.map((s) => /* @__PURE__ */ r(mn, { srv: s }, s.name)),
381
+ /* @__PURE__ */ r(hn, {})
382
+ ] });
383
+ }
384
+ const Qe = (e) => (e - Me) / (Le - Me), Mn = { queued: "#1e3a5f", running: "#ffffff", done: "#5eead4", failed: "#ef4444" }, Se = new t.Color(), ht = new t.Color("#ffffff"), vn = new t.Vector3();
385
+ function yn({ run: e }) {
386
+ const o = at(e.slot), n = k(null), s = k(null), a = k([]), p = k(null), { tube: i, glow: c } = u(() => {
387
+ const T = [];
388
+ for (let y = Me; y <= Le + 1e-6; y += 0.5) T.push(new t.Vector3(y, Re(y, o), Xe(y, o)));
389
+ const x = new t.CatmullRomCurve3(T);
390
+ return { tube: new t.TubeGeometry(x, 200, 0.05, 6), glow: new t.TubeGeometry(x, 120, 0.32, 8) };
391
+ }, [o]), h = u(() => dt(e.color), [e.color]), d = u(() => {
392
+ const T = dt(e.color);
393
+ return T.uniforms.uWidthGlow.value = 0.18, T;
394
+ }, [e.color]), F = u(() => [h, d], [h, d]), C = u(() => new t.Color(e.color), [e.color]), P = u(() => Ce.map(() => new t.MeshBasicMaterial({ toneMapped: !1, transparent: !0 })), []), f = u(() => Ce.map(() => new t.MeshBasicMaterial({ toneMapped: !1, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1 })), []), S = u(() => Ce.map(() => new t.SpriteMaterial({ map: qe(), toneMapped: !1, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1 })), []), V = u(() => new t.MeshBasicMaterial({ toneMapped: !1, transparent: !0 }), []);
395
+ return He(
396
+ () => () => {
397
+ i.dispose(), c.dispose(), h.dispose(), d.dispose(), [...P, ...f, ...S, V].forEach((T) => T.dispose());
398
+ },
399
+ [i, c, h, d, P, f, S, V]
400
+ ), oe(({ clock: T }) => {
401
+ var v;
402
+ const x = performance.now(), y = T.elapsedTime, A = O.runs.get(e.id) ?? e;
403
+ n.current && n.current.position.set(0, St(o) + Ct(), At(o)).add(it(e.id, vn));
404
+ const _ = ae((x - A.startedAt) / 1600) * 1.1, w = A.endedAt ? Math.max(0, 1 - (x - A.endedAt) / Xt) : 1;
405
+ let b = -1, R = 0;
406
+ const I = (x - A.handoffAt) / 1300;
407
+ if (A.handoffAt && I < 1) {
408
+ const l = 1 - Math.pow(1 - I, 3);
409
+ b = Qe(J[A.handoffFrom] + (J[A.handoffTo] - J[A.handoffFrom]) * l), R = Math.sin(I * Math.PI) * 1.2 + 0.3;
410
+ } else if (A.endedAt && x - A.endedAt < 1400) {
411
+ const l = (x - A.endedAt) / 1400;
412
+ b = Qe(J.write + (Le - J.write) * l), R = (1 - l) * 0.45;
413
+ }
414
+ for (const l of F)
415
+ l.uniforms.uTime.value = y * Ie, l.uniforms.uReveal.value = _, l.uniforms.uFade.value = w, l.uniforms.uPulse.value = b, l.uniforms.uPulseAmp.value = R;
416
+ if (s.current && (s.current.visible = b >= 0, b >= 0)) {
417
+ const l = Me + b * (Le - Me);
418
+ s.current.position.set(l, Re(l, o), Xe(l, o)), s.current.scale.setScalar(0.18 + R * 0.12), V.color.copy(ht).lerp(C, 0.3).multiplyScalar(4 * Math.max(0.3, R)), V.opacity = w;
419
+ }
420
+ Ce.forEach((l, E) => {
421
+ const g = a.current[E];
422
+ if (!g) return;
423
+ const z = A.steps[l], B = ae((_ - Qe(J[l])) * 6), M = z === "running", U = M ? 0.5 + 0.5 * Math.sin(y * 5.5) : 0;
424
+ g.scale.setScalar(B * (M ? 1.15 + U * 0.2 : z === "done" ? 0.9 : 0.75)), g.rotation.y += M ? 0.05 : 4e-3;
425
+ const D = P[E];
426
+ z === "queued" ? Se.copy(C).multiplyScalar(0.35) : M ? Se.copy(C).lerp(ht, 0.35).multiplyScalar(2.2 + U * 2.2) : Se.set(Mn[z]).multiplyScalar(z === "done" ? 1.5 : 2.5), D.color.copy(Se), D.opacity = w, f[E].color.copy(Se).multiplyScalar(M ? 0.9 : 0.5), f[E].opacity = w * (z === "queued" ? 0.35 : 1), S[E].color.copy(M ? C : Se), S[E].opacity = w * (M ? 0.45 + U * 0.3 : z === "done" ? 0.18 : 0.05);
427
+ }), (v = p.current) == null || v.setOpacity(w * ae(_ * 2));
428
+ }), /* @__PURE__ */ N("group", { ref: n, children: [
429
+ /* @__PURE__ */ r("mesh", { geometry: i, material: h }),
430
+ /* @__PURE__ */ r("mesh", { geometry: c, material: d }),
431
+ /* @__PURE__ */ r("mesh", { ref: s, material: V, visible: !1, children: /* @__PURE__ */ r("sphereGeometry", { args: [1, 16, 12] }) }),
432
+ Ce.map((T, x) => /* @__PURE__ */ r("group", { position: [J[T], Re(J[T], o), Xe(J[T], o)], children: /* @__PURE__ */ N("group", { ref: (y) => void (a.current[x] = y), children: [
433
+ /* @__PURE__ */ r("mesh", { material: P[x], children: /* @__PURE__ */ r("icosahedronGeometry", { args: [0.2, 2] }) }),
434
+ Array.from({ length: 8 }, (y, A) => {
435
+ const _ = A / 8 * Math.PI * 2;
436
+ return /* @__PURE__ */ r("mesh", { material: f[x], position: [Math.cos(_) * 0.36, 0.1 + A % 2 * 0.08, Math.sin(_) * 0.36], children: /* @__PURE__ */ r("sphereGeometry", { args: [0.055, 8, 6] }) }, A);
437
+ }),
438
+ /* @__PURE__ */ r("mesh", { material: f[x], rotation: [Math.PI / 2, 0, 0], children: /* @__PURE__ */ r("torusGeometry", { args: [0.36, 0.012, 6, 40] }) }),
439
+ /* @__PURE__ */ r("sprite", { material: S[x], scale: 2.4 })
440
+ ] }) }, T)),
441
+ /* @__PURE__ */ r(Ze, { ref: p, position: [Me - 0.4, Re(Me, o) + 0.55, 0], text: e.topic, color: e.color, size: 0.3, maxWidth: 10, opacity: 0, pxRange: [9.5, 14] })
442
+ ] });
443
+ }
444
+ function wn() {
445
+ const [e, o] = Oe([]), n = k([]), s = k(-1);
446
+ return oe(() => {
447
+ const a = n.current;
448
+ let p = a.length === O.runs.size && s.current === me.version;
449
+ if (p) {
450
+ let i = 0;
451
+ for (const c of O.runs.keys()) if (a[i++] !== c) {
452
+ p = !1;
453
+ break;
454
+ }
455
+ }
456
+ p || (n.current = [...O.runs.keys()], s.current = me.version, o([...O.runs.values()].filter((i) => Lt(i.id))));
457
+ }), /* @__PURE__ */ N("group", { children: [
458
+ e.map((a) => /* @__PURE__ */ r(yn, { run: a }, a.id)),
459
+ Ce.map((a) => /* @__PURE__ */ r(Ze, { position: [J[a], -4.9, 2.2], text: `hatchet · ${a}`, color: "#7dd3fc", size: 0.26, opacity: 0.85, pxRange: [8, 12] }, a))
460
+ ] });
461
+ }
462
+ const We = 9, ge = 11, De = 46, zt = 1500, Fe = new t.Vector3(), gt = new t.Color();
463
+ function bn({ inst: e, onSelect: o }) {
464
+ const n = e.id, s = Bt(e.type), a = s ? 0.42 : 0.62, p = u(() => en(e), [e]), i = sn(n) % 1e3 / 1e3, c = Ye[e.type], h = k(null), d = k(null), F = k(null), C = k(null), P = k(null), f = k(null), S = k(null), V = k(i * 6), T = u(() => Tt(c), [c]), x = u(() => new t.MeshBasicMaterial({ color: c, transparent: !0, toneMapped: !1, blending: t.AdditiveBlending, depthWrite: !1 }), [c]), y = u(() => new t.SpriteMaterial({ color: c, map: qe(), transparent: !0, opacity: 0.06, toneMapped: !1, blending: t.AdditiveBlending, depthWrite: !1 }), [c]), A = u(() => new t.Color(c), [c]), _ = u(() => {
465
+ const l = new t.BufferGeometry(), E = We * ge * 2;
466
+ l.setAttribute("position", new t.BufferAttribute(new Float32Array(E * 3), 3));
467
+ const g = new Float32Array(E * 3), z = new t.Color(c);
468
+ for (let B = 0; B < We; B++)
469
+ for (let M = 0; M < ge; M++)
470
+ for (let U = 0; U < 2; U++) {
471
+ const D = 1 - (M + U) / ge, L = (B * ge + M) * 2 + U;
472
+ g[L * 3] = z.r * (0.4 + D * 1.8), g[L * 3 + 1] = z.g * (0.4 + D * 1.8), g[L * 3 + 2] = z.b * (0.4 + D * 1.8);
473
+ }
474
+ return l.setAttribute("color", new t.BufferAttribute(g, 3)), l;
475
+ }, [c]), w = u(() => new t.LineBasicMaterial({ vertexColors: !0, transparent: !0, opacity: 0.8, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }), []), b = u(() => {
476
+ const l = new Float32Array(De * 4);
477
+ for (let g = 0; g < De; g++) {
478
+ const z = Math.random() * Math.PI * 2, B = Math.random() * 1.4 - 0.4, M = Math.sqrt(1 - Math.min(1, B * B));
479
+ l[g * 4] = Math.cos(z) * M, l[g * 4 + 1] = B, l[g * 4 + 2] = Math.sin(z) * M, l[g * 4 + 3] = 0.5 + Math.random();
480
+ }
481
+ const E = new t.BufferGeometry();
482
+ return E.setAttribute("position", new t.BufferAttribute(new Float32Array(De * 3), 3)), { dirs: l, g: E };
483
+ }, []), R = u(
484
+ () => new t.PointsMaterial({ color: new t.Color(c).multiplyScalar(2.2), size: s ? 0.16 : 0.22, map: qe(), transparent: !0, depthWrite: !1, blending: t.AdditiveBlending, toneMapped: !1 }),
485
+ [c, s]
486
+ ), I = u(() => new t.Vector3(), []), v = u(() => new t.Vector3(), []);
487
+ return He(() => {
488
+ const l = e.parent ? ne.get(e.parent) : void 0, E = O.runs.get(e.run);
489
+ return l ? v.copy(l) : ct(at((E == null ? void 0 : E.slot) ?? 0), J.plan, performance.now() / 1e3, v).add(it(e.run, Fe)), I.copy(v), ne.set(n, I), () => {
490
+ ne.delete(n), T.dispose(), x.dispose(), y.dispose(), _.dispose(), b.g.dispose(), R.dispose();
491
+ };
492
+ }, []), oe(({ clock: l }, E) => {
493
+ var Ee;
494
+ const g = performance.now(), z = l.elapsedTime, B = e, M = O.runs.get(B.run);
495
+ on(B, at((M == null ? void 0 : M.slot) ?? 0), p, z, Fe), Fe.x += Math.sin(z * 0.4 + i * 9) * 0.12, Fe.y += Math.sin(z * 0.7 + i * 5) * 0.12;
496
+ const U = ae((g - B.bornAt) / zt), D = an(ae(U / 0.8)), L = U < 0.32, re = L ? 0 : cn(ae((U - 0.32) / 0.68)), $ = B.exitAt ? (g - B.exitAt) / qt(B) : 0, j = B.exitAt > 0, ee = j ? Math.max(0, 1 - $ * 1.25) : 1, q = j ? Math.exp(-(g - B.exitAt) / 220) : 0, m = B.status === "failed";
497
+ let G = !1;
498
+ for (const Z of O.mcpPending.values()) Z.instance === n && (G = !0);
499
+ const W = (B.status === "thinking" || B.status === "spawning") && !G, X = Ht(B, g), Q = Pt.id === n, se = j ? 0.8 : W ? 4.6 : G ? 1.8 : 1.1;
500
+ V.current += E * se;
501
+ const K = Math.pow(0.5 + 0.5 * Math.sin(V.current), 3), H = W ? 1 : 0.45;
502
+ I.lerpVectors(v, Fe, D), I.y += K * 0.12 * H + (j ? $ * 1.2 : 0), h.current && (h.current.position.copy(I), h.current.rotation.z = Math.sin(z * 0.5 + i * 7) * 0.12, h.current.rotation.x = Math.sin(z * 0.37 + i * 3) * 0.08);
503
+ const de = a * Ge() * re * (1 + X * 0.14) * (1 + (j ? $ * 0.6 : 0)), Y = 1 + K * 0.14 * H, ie = 0.8 * (1 - K * 0.24 * H);
504
+ d.current && (d.current.visible = !(j && ee <= 1e-3)), (Ee = F.current) == null || Ee.scale.set(Math.max(1e-4, de * Y), Math.max(1e-4, de * ie), Math.max(1e-4, de * Y));
505
+ const ve = W ? 1.25 : G ? 0.7 + 0.35 * Math.sin(z * 2.2) : 0.45;
506
+ if (T.uniforms.uIntensity.value = ve + X * 1.7 + q * 5 + (Q ? 0.7 : 0), T.uniforms.uOpacity.value = ee * (0.4 + 0.6 * ae(re)), T.uniforms.uFlash.value = q + 0, m && j && T.uniforms.uColor.value.set("#ef4444"), C.current) {
507
+ const Z = Ge() * (L ? a * (0.32 + 0.08 * Math.sin(g / 50)) : a * (0.22 + X * 0.06) * Math.min(1, re + 0.3));
508
+ C.current.scale.setScalar(Math.max(1e-4, Z * (1 - (j ? $ : 0)))), C.current.position.y = L ? 0 : de * ie * 0.35, gt.copy(A).multiplyScalar((L ? 5 : 1.6 + X * 3) * ve + q * 8), x.color.copy(gt), x.opacity = ee;
509
+ }
510
+ P.current && (P.current.scale.setScalar(a * Ge() * (L ? 3 : 4.2 + X * 2 + q * 4)), y.opacity = (0.12 + X * 0.16 + (L ? 0.5 : 0) + q * 0.6 + (Q ? 0.2 : 0)) * ee);
511
+ const ce = _.getAttribute("position"), Te = ce.array, ye = de * Y * 0.88, we = a * Ge() * (s ? 3 : 3.6) * ae(re) * (0.85 + 0.15 * (1 - K)), he = W ? 3.2 : 1.1, le = a * Ge() * (W ? 0.55 : 0.35);
512
+ for (let Z = 0; Z < We; Z++) {
513
+ const be = Z / We * Math.PI * 2, xe = Math.cos(be), ze = Math.sin(be), te = Z % 3 === 0 ? 0.35 : 1;
514
+ for (let ue = 0; ue < ge; ue++)
515
+ for (let pe = 0; pe < 2; pe++) {
516
+ const Ue = (ue + pe) / ge, lt = z * he * (0.85 + Z % 4 * 0.08) - Ue * 5 + Z * 1.7, ut = ye * te * (1 - Ue * 0.4), $e = ((Z * ge + ue) * 2 + pe) * 3;
517
+ Te[$e] = xe * ut + Math.sin(lt) * le * Ue, Te[$e + 1] = -Ue * we * (te < 1 ? 0.7 : 1), Te[$e + 2] = ze * ut + Math.cos(lt * 0.8) * le * Ue * 0.7;
518
+ }
519
+ }
520
+ if (ce.needsUpdate = !0, w.opacity = ee * (W ? 0.95 : 0.55) * ae(re * 1.5), S.current && (S.current.visible = j, j)) {
521
+ const Z = b.g.getAttribute("position"), be = Z.array, xe = (g - B.exitAt) / 1e3, ze = 1 - Math.exp(-xe * 3.5);
522
+ for (let te = 0; te < De; te++) {
523
+ const ue = b.dirs, pe = ue[te * 4 + 3];
524
+ be[te * 3] = ue[te * 4] * a * 2.2 * ze * pe + Math.sin(xe * 2 + te) * 0.08, be[te * 3 + 1] = ue[te * 4 + 1] * a * 1.6 * ze * pe + xe * 0.9 * pe, be[te * 3 + 2] = ue[te * 4 + 2] * a * 2.2 * ze * pe;
525
+ }
526
+ Z.needsUpdate = !0, R.opacity = Math.max(0, 1 - $) * Math.min(1, xe * 6);
527
+ }
528
+ }), /* @__PURE__ */ N("group", { ref: h, children: [
529
+ /* @__PURE__ */ N("group", { ref: d, children: [
530
+ /* @__PURE__ */ r(
531
+ "mesh",
532
+ {
533
+ ref: F,
534
+ material: T,
535
+ onClick: (l) => (l.stopPropagation(), o(n)),
536
+ onPointerOver: () => document.body.style.cursor = "pointer",
537
+ onPointerOut: () => document.body.style.cursor = "",
538
+ children: /* @__PURE__ */ r("sphereGeometry", { args: [1, 36, 18, 0, Math.PI * 2, 0, Math.PI / 2] })
539
+ }
540
+ ),
541
+ /* @__PURE__ */ r("mesh", { ref: C, material: x, children: /* @__PURE__ */ r("sphereGeometry", { args: [1, 16, 12] }) }),
542
+ /* @__PURE__ */ r("sprite", { ref: P, material: y }),
543
+ /* @__PURE__ */ r("lineSegments", { ref: f, geometry: _, material: w, frustumCulled: !1 })
544
+ ] }),
545
+ /* @__PURE__ */ r("points", { ref: S, geometry: b.g, material: R, frustumCulled: !1, visible: !1 })
546
+ ] });
547
+ }
548
+ function xn({ onSelect: e }) {
549
+ const [o, n] = Oe([]), s = k([]), a = k(-1);
550
+ return oe(() => {
551
+ Nt(), jt();
552
+ const p = s.current;
553
+ let i = p.length === O.instances.size && a.current === me.version;
554
+ if (i) {
555
+ let c = 0;
556
+ for (const h of O.instances.keys()) if (p[c++] !== h) {
557
+ i = !1;
558
+ break;
559
+ }
560
+ }
561
+ i || (s.current = [...O.instances.keys()], a.current = me.version, n([...O.instances.values()].filter(Ne)));
562
+ }), /* @__PURE__ */ N("group", { children: [
563
+ o.map((p) => /* @__PURE__ */ r(bn, { inst: p, onSelect: e }, p.id)),
564
+ /* @__PURE__ */ r(Sn, {})
565
+ ] });
566
+ }
567
+ function Sn() {
568
+ const n = u(() => {
569
+ const a = new t.BufferGeometry();
570
+ return a.setAttribute("position", new t.BufferAttribute(new Float32Array(2880), 3)), a.setAttribute("color", new t.BufferAttribute(new Float32Array(2880), 3)), a;
571
+ }, []), s = u(() => new t.Color(), []);
572
+ return oe(({ clock: a }) => {
573
+ const p = performance.now(), i = a.elapsedTime, c = n.getAttribute("position"), h = n.getAttribute("color"), d = c.array, F = h.array;
574
+ let C = 0;
575
+ for (const P of O.instances.values()) {
576
+ if (C >= 48) break;
577
+ if (!P.parent) continue;
578
+ const f = ne.get(P.parent), S = ne.get(P.id), V = O.instances.get(P.parent);
579
+ if (!f || !S || !V) continue;
580
+ const T = ae((p - P.bornAt) / zt), x = (P.exitAt ? Math.max(0, 1 - (p - P.exitAt) / 900) : 1) * (V.exitAt ? Math.max(0, 1 - (p - V.exitAt) / 900) : 1);
581
+ if (x <= 0) continue;
582
+ const y = (0.22 + Math.pow(1 - T, 2) * 2.2) * x;
583
+ s.set(Ye[P.type]);
584
+ for (let A = 0; A < 10; A++)
585
+ for (let _ = 0; _ < 2; _++) {
586
+ const w = (A + _) / 10, b = ((C * 10 + A) * 2 + _) * 3, R = Math.sin(w * Math.PI) * (0.35 + 0.1 * Math.sin(i * 1.3 + C));
587
+ d[b] = f.x + (S.x - f.x) * w, d[b + 1] = f.y - 0.25 + (S.y - f.y + 0.25) * w - R, d[b + 2] = f.z + (S.z - f.z) * w;
588
+ const I = T < 1 ? Math.exp(-Math.pow((w - T * 1.1) * 7, 2)) * 3 : 0, v = y * (0.5 + w * 0.5) + I * x;
589
+ F[b] = s.r * v, F[b + 1] = s.g * v, F[b + 2] = s.b * v;
590
+ }
591
+ C++;
592
+ }
593
+ n.setDrawRange(0, C * 10 * 2), c.needsUpdate = !0, h.needsUpdate = !0;
594
+ }), /* @__PURE__ */ r("lineSegments", { geometry: n, frustumCulled: !1, children: /* @__PURE__ */ r("lineBasicMaterial", { vertexColors: !0, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) });
595
+ }
596
+ const An = new t.ConeGeometry(0.07, 0.34, 8).rotateX(Math.PI / 2), Mt = new t.Vector3(), Ut = (e) => e < 0.5 ? 2 * e * e : 1 - Math.pow(-2 * e + 2, 2) / 2;
597
+ function vt(e) {
598
+ const [o, n] = Oe([]), s = k([]);
599
+ return oe(() => {
600
+ const a = e(), p = s.current;
601
+ let i = p.length === a.length;
602
+ if (i)
603
+ for (let c = 0; c < a.length; c++) p[c] !== a[c].id && (i = !1);
604
+ i || (s.current = a.map((c) => c.id), n(a.slice()));
605
+ }), o;
606
+ }
607
+ function Cn({ comet: e }) {
608
+ const o = k(null), n = O.instances.get(e.from), s = n ? Ye[n.type] : "#a5f3fc", a = u(() => new t.MeshBasicMaterial({ color: new t.Color(s).multiplyScalar(4), toneMapped: !1 }), [s]), p = u(() => (ne.get(e.from) ?? new t.Vector3()).clone(), [e.from]);
609
+ return oe(() => {
610
+ const i = o.current;
611
+ if (!i) return;
612
+ const c = Math.min(1, (performance.now() - e.start) / e.dur), h = ne.get(e.from), d = ne.get(e.to);
613
+ if (!h || !d) {
614
+ i.scale.setScalar(1e-3);
615
+ return;
616
+ }
617
+ je(h, d, Ut(c), 1.1, i.position), i.scale.setScalar(c >= 1 ? 1e-3 : 1 + Math.sin(c * Math.PI) * 0.4);
618
+ }), /* @__PURE__ */ r(wt, { width: 1.8, length: 6, color: s, attenuation: (i) => i * i, decay: 1.4, children: /* @__PURE__ */ r("mesh", { ref: o, position: p, material: a, children: /* @__PURE__ */ r("sphereGeometry", { args: [0.11, 12, 10] }) }) });
619
+ }
620
+ function Bn({ call: e }) {
621
+ const o = k(null), n = O.mcpServers.get(e.server), s = (n == null ? void 0 : n.color) ?? "#94a3b8", a = u(() => new t.MeshBasicMaterial({ color: new t.Color(s).multiplyScalar(e.phase === "result" ? 5 : 3.5), toneMapped: !1 }), [s, e.phase]), p = u(() => ((e.phase === "call" ? ne.get(e.instance) : Pe.get(e.server)) ?? new t.Vector3()).clone(), [e]);
622
+ return oe(() => {
623
+ const i = o.current;
624
+ if (!i) return;
625
+ const c = Math.min(1, (performance.now() - e.start) / e.dur), h = ne.get(e.instance), d = Pe.get(e.server);
626
+ if (!h || !d) {
627
+ i.scale.setScalar(1e-3);
628
+ return;
629
+ }
630
+ const F = Ut(c), C = e.phase === "call" ? F : 1 - F;
631
+ je(h, d, C, 1.6, i.position), je(h, d, e.phase === "call" ? Math.min(1, C + 0.02) : Math.max(0, C - 0.02), 1.6, Mt), i.lookAt(Mt), i.scale.setScalar(c >= 1 ? 1e-3 : 1);
632
+ }), /* @__PURE__ */ r(wt, { width: 1.4, length: 5, color: s, attenuation: (i) => i * i * i, decay: 1.6, children: /* @__PURE__ */ r("mesh", { ref: o, position: p, material: a, geometry: An }) });
633
+ }
634
+ const et = [], tt = [];
635
+ function Pn() {
636
+ if (!me.grouped) return O.comets;
637
+ et.length = 0;
638
+ for (const e of O.comets) Ne(e.from) && Ne(e.to) && et.push(e);
639
+ return et;
640
+ }
641
+ function Tn() {
642
+ if (!me.grouped) return O.mcpCalls;
643
+ tt.length = 0;
644
+ for (const e of O.mcpCalls) Ne(e.instance) && tt.push(e);
645
+ return tt;
646
+ }
647
+ function zn() {
648
+ const e = vt(Pn), o = vt(Tn);
649
+ return /* @__PURE__ */ N("group", { children: [
650
+ e.map((n) => /* @__PURE__ */ r(Cn, { comet: n }, n.id)),
651
+ o.map((n) => /* @__PURE__ */ r(Bn, { call: n }, n.id))
652
+ ] });
653
+ }
654
+ const nt = 60, ot = [0, 1, 2, 3], Un = 9, rt = 180, st = 60, Ae = 6;
655
+ function Gn(e) {
656
+ let o = e >>> 0;
657
+ return () => (o = o * 1664525 + 1013904223 >>> 0) / 4294967296;
658
+ }
659
+ function _n(e) {
660
+ const o = Gn(1337), n = e.nodes.length, s = /* @__PURE__ */ new Map();
661
+ e.nodes.forEach((d, F) => (s.get(d.kind) ?? s.set(d.kind, []).get(d.kind)).push(F));
662
+ const a = [];
663
+ for (const [d, F] of s) {
664
+ const C = Math.max(1, Math.ceil(F.length / 22));
665
+ for (let P = 0; P < C; P++) a.push({ kind: d, members: F.filter((f, S) => S % C === P) });
666
+ }
667
+ for (let d = a.length - 1; d > 0; d--) {
668
+ const F = Math.floor(o() * (d + 1));
669
+ [a[d], a[F]] = [a[F], a[d]];
670
+ }
671
+ const p = new Float32Array(n * 3), i = new Float32Array(n * 3), c = new Float32Array(n), h = new Int32Array(n);
672
+ return a.forEach((d, F) => {
673
+ const C = (F + 0.5) / a.length, P = F * 2.39996, f = Math.sqrt(C), S = Math.cos(P) * f * 13.5, V = -4.5 + Math.sin(P) * f * 5.5, T = 0.5 + Math.sqrt(d.members.length) * 0.17;
674
+ d.members.forEach((x) => {
675
+ h[x] = d.members[0];
676
+ const y = o() * Math.PI * 2, A = Math.pow(o(), 0.7) * T, _ = S + Math.cos(y) * A, w = V + Math.sin(y) * A * 0.8, b = (0.35 + o() * 0.7) * (1.5 - A / T * 0.8);
677
+ p[x * 3] = _, p[x * 3 + 1] = Be, p[x * 3 + 2] = w, i[x * 3] = _ + Math.cos(y) * b * 0.35, i[x * 3 + 1] = Be + b, i[x * 3 + 2] = w + Math.sin(y) * b * 0.3, c[x] = o() * 6.28;
678
+ });
679
+ }), { base: p, head: i, phase: c, hub: h };
680
+ }
681
+ const kn = 200;
682
+ function Fn({ galaxy: e }) {
683
+ const o = u(() => {
684
+ const v = e.nodes.slice(0, kn), l = new Set(v.map((E) => E.id));
685
+ return { nodes: v, links: e.links.filter((E) => l.has(E.source) && l.has(E.target)) };
686
+ }, [e]), n = o.nodes.length, s = u(() => _n(o), [o]), a = u(() => o.nodes.map((v) => new t.Color(pt[v.kind] ?? "#94a3b8")), [o]), p = u(() => /* @__PURE__ */ new Map(), []), i = (v) => {
687
+ let l = p.get(v);
688
+ return l === void 0 && p.set(v, l = Yt(e, v) % n), l;
689
+ }, c = k(null), h = k(null), d = k(null), F = k(null), C = u(() => new Float32Array(n), [n]), P = u(() => new Float32Array(n), [n]), f = u(() => new t.Object3D(), []), S = u(() => new t.Color(), []), V = u(() => new t.Color(1, 1, 1), []), T = u(() => new t.Vector3(0, 1, 0), []), x = u(() => new t.Vector3(), []), y = u(() => new t.Vector3(), []), A = u(() => {
690
+ const v = new Map(o.nodes.map((M, U) => [M.id, U])), l = [], E = [], g = s.head, z = (M, U, D, L, re) => {
691
+ const $ = a[M], j = a[U];
692
+ for (let ee = 0; ee < re; ee++)
693
+ for (let q = 0; q < 2; q++) {
694
+ const m = (ee + q) / re;
695
+ l.push(g[M * 3] + (g[U * 3] - g[M * 3]) * m, g[M * 3 + 1] + (g[U * 3 + 1] - g[M * 3 + 1]) * m + Math.sin(m * Math.PI) * D, g[M * 3 + 2] + (g[U * 3 + 2] - g[M * 3 + 2]) * m), E.push(($.r + (j.r - $.r) * m) * L, ($.g + (j.g - $.g) * m) * L, ($.b + (j.b - $.b) * m) * L);
696
+ }
697
+ };
698
+ s.hub.forEach((M, U) => M !== U && z(U, M, 0, 0.32, 1));
699
+ for (const M of o.links) {
700
+ const U = v.get(M.source), D = v.get(M.target);
701
+ if (U === void 0 || D === void 0 || U === D) continue;
702
+ const L = Math.hypot(g[U * 3] - g[D * 3], g[U * 3 + 2] - g[D * 3 + 2]);
703
+ z(U, D, Math.min(1.4, 0.15 + L * 0.09), 0.42, 10);
704
+ }
705
+ const B = new t.BufferGeometry();
706
+ return B.setAttribute("position", new t.Float32BufferAttribute(l, 3)), B.setAttribute("color", new t.Float32BufferAttribute(E, 3)), B;
707
+ }, [o, s, a]), _ = k([]), w = k([]), b = k(["", "", "", ""]), R = u(() => {
708
+ const v = new t.BufferGeometry();
709
+ return v.setAttribute("position", new t.BufferAttribute(new Float32Array(st * Ae * 2 * 3), 3)), v.setAttribute("color", new t.BufferAttribute(new Float32Array(st * Ae * 2 * 3), 3)), v;
710
+ }, []);
711
+ oe(({ clock: v }) => {
712
+ const l = performance.now(), E = v.elapsedTime * Ie;
713
+ C.fill(0), P.fill(0);
714
+ const g = c.current, z = h.current, B = d.current, M = F.current;
715
+ if (!g || !z || !B || !M) return;
716
+ let U = 0, D = 0, L = 0;
717
+ const re = R.getAttribute("position"), $ = R.getAttribute("color"), j = re.array, ee = $.array;
718
+ for (const m of O.flares) {
719
+ const G = i(m.node), W = (l - m.start) / 2600;
720
+ if (W < 0 || W >= 1) continue;
721
+ const X = m.op === "write", Q = Math.exp(-W * 2.6) * Math.min(1, W * 20);
722
+ Q > C[G] && (C[G] = Q), X && (P[G] = Math.max(P[G], Q));
723
+ const se = s.base[G * 3], K = s.base[G * 3 + 2];
724
+ if (U < nt) {
725
+ f.position.set(se, Be + 0.03, K), f.rotation.set(-Math.PI / 2, 0, 0), f.scale.setScalar(0.2 + Math.sqrt(W) * (X ? 3.6 : 2.2)), f.updateMatrix(), B.setMatrixAt(U, f.matrix);
726
+ const Y = Math.pow(1 - W, 2) * (X ? 3 : 1.6);
727
+ X ? S.copy(V).multiplyScalar(Y) : S.copy(a[G]).multiplyScalar(Y), B.setColorAt(U, S), U++;
728
+ }
729
+ if (X)
730
+ for (let Y = 0; Y < Un && D < rt; Y++) {
731
+ const ie = (m.id * 13 + Y * 7) % 97, ve = 1.4 + ie % 10 * 0.18, ce = W * 2.6 - Y * 0.08;
732
+ ce < 0 || (f.position.set(
733
+ se + Math.sin(ie) * 0.35 + Math.sin(ce * 5 + Y) * 0.1,
734
+ Be + 0.3 + ce * ve * 0.6,
735
+ K + Math.cos(ie) * 0.35
736
+ ), f.rotation.set(0, 0, 0), f.scale.setScalar((0.05 + ie % 5 * 0.015) * (1 + ce * 0.3)), f.updateMatrix(), M.setMatrixAt(D, f.matrix), S.setRGB(1, 1.5, 1.9).multiplyScalar(Math.pow(Math.max(0, 1 - W), 1.5)), M.setColorAt(D, S), D++);
737
+ }
738
+ const H = ne.get(m.instance), de = O.instances.get(m.instance);
739
+ if (H && de && L < st && W < 0.75) {
740
+ const Y = W / 0.75, ie = Math.pow(1 - Y, 1.5) * Math.min(1, Y * 12) * (X ? 2.4 : 1.6);
741
+ X ? S.copy(V) : S.set(Ye[de.type]);
742
+ const ve = s.head[G * 3], ce = s.head[G * 3 + 1], Te = s.head[G * 3 + 2];
743
+ for (let ye = 0; ye < Ae; ye++)
744
+ for (let we = 0; we < 2; we++) {
745
+ const he = (ye + we) / Ae, le = ((L * Ae + ye) * 2 + we) * 3;
746
+ j[le] = H.x + (ve - H.x) * he, j[le + 1] = H.y + (ce - H.y) * he, j[le + 2] = H.z + (Te - H.z) * he;
747
+ const Ee = Math.exp(-Math.pow((he - Math.min(1, Y * 2.2)) * 6, 2)) * 2, Z = ie * (0.35 + he * 0.4 + Ee);
748
+ ee[le] = S.r * Z, ee[le + 1] = S.g * Z, ee[le + 2] = S.b * Z;
749
+ }
750
+ L++;
751
+ }
752
+ }
753
+ for (let m = U; m < nt; m++)
754
+ f.scale.setScalar(0), f.updateMatrix(), B.setMatrixAt(m, f.matrix);
755
+ for (let m = D; m < rt; m++)
756
+ f.scale.setScalar(0), f.updateMatrix(), M.setMatrixAt(m, f.matrix);
757
+ B.instanceMatrix.needsUpdate = !0, B.instanceColor && (B.instanceColor.needsUpdate = !0), M.instanceMatrix.needsUpdate = !0, M.instanceColor && (M.instanceColor.needsUpdate = !0), R.setDrawRange(0, L * Ae * 2), re.needsUpdate = !0, $.needsUpdate = !0;
758
+ let q = 0;
759
+ for (let m = O.flares.length - 1; m >= 0 && q < ot.length; m--) {
760
+ const G = O.flares[m], W = (l - G.start) / 1e3;
761
+ if (W > 1.8) continue;
762
+ let X = !1;
763
+ for (let H = 0; H < q; H++) b.current[H] === G.node && (X = !0);
764
+ if (X) continue;
765
+ const Q = i(G.node), se = _.current[q], K = w.current[q];
766
+ se && K && (se.position.set(s.head[Q * 3], s.head[Q * 3 + 1] + 0.55 + W * 0.25, s.head[Q * 3 + 2]), b.current[q] !== G.node && (K.setText((G.op === "write" ? "wrote · " : "") + G.node), K.setColor(G.op === "write" ? "#ffffff" : pt[o.nodes[Q].kind] ?? "#94a3b8")), K.setOpacity(Math.min(1, (1.8 - W) * 2))), b.current[q] = G.node, q++;
767
+ }
768
+ for (let m = q; m < ot.length; m++) {
769
+ const G = w.current[m];
770
+ G == null || G.setOpacity(0), b.current[m] = "";
771
+ }
772
+ for (let m = 0; m < n; m++) {
773
+ const G = C[m], W = 0, X = 0, Q = s.base[m * 3], se = s.base[m * 3 + 1], K = s.base[m * 3 + 2];
774
+ y.set(s.head[m * 3] + W, s.head[m * 3 + 1], s.head[m * 3 + 2] + X), x.set(y.x - Q, y.y - se, y.z - K);
775
+ const H = x.length();
776
+ x.multiplyScalar(1 / H), f.position.set(Q, se, K), f.quaternion.setFromUnitVectors(T, x), f.scale.set(1 + G, H, 1 + G), f.updateMatrix(), z.setMatrixAt(m, f.matrix), S.copy(a[m]).multiplyScalar(0.22 + G * 1.2), z.setColorAt(m, S), f.position.copy(y), f.quaternion.identity(), f.scale.setScalar(1 + G * 2.6), f.updateMatrix(), g.setMatrixAt(m, f.matrix), S.copy(a[m]).multiplyScalar(0.75 + 0.25 * Math.sin(E * 0.8 + s.phase[m] * 3) + G * 5), P[m] > 0.01 && (S.lerp(V.setScalar(6), P[m] * 0.7), V.setScalar(1)), g.setColorAt(m, S);
777
+ }
778
+ g.instanceMatrix.needsUpdate = !0, g.instanceColor && (g.instanceColor.needsUpdate = !0), z.instanceMatrix.needsUpdate = !0, z.instanceColor && (z.instanceColor.needsUpdate = !0);
779
+ });
780
+ const I = u(() => new t.CylinderGeometry(0.022, 0.05, 1, 5, 1, !0).translate(0, 0.5, 0), []);
781
+ return /* @__PURE__ */ N("group", { children: [
782
+ /* @__PURE__ */ r("instancedMesh", { ref: h, args: [I, void 0, Math.max(1, n)], frustumCulled: !1, children: /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1 }) }),
783
+ /* @__PURE__ */ N("instancedMesh", { ref: c, args: [void 0, void 0, Math.max(1, n)], frustumCulled: !1, children: [
784
+ /* @__PURE__ */ r("icosahedronGeometry", { args: [0.085, 1] }),
785
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1 })
786
+ ] }),
787
+ /* @__PURE__ */ r("lineSegments", { geometry: A, children: /* @__PURE__ */ r("lineBasicMaterial", { vertexColors: !0, transparent: !0, opacity: 0.9, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) }),
788
+ /* @__PURE__ */ N("instancedMesh", { ref: d, args: [void 0, void 0, nt], frustumCulled: !1, children: [
789
+ /* @__PURE__ */ r("ringGeometry", { args: [0.86, 1, 48] }),
790
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1, side: t.DoubleSide })
791
+ ] }),
792
+ /* @__PURE__ */ N("instancedMesh", { ref: F, args: [void 0, void 0, rt], frustumCulled: !1, children: [
793
+ /* @__PURE__ */ r("sphereGeometry", { args: [1, 10, 8] }),
794
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1 })
795
+ ] }),
796
+ /* @__PURE__ */ r("lineSegments", { geometry: R, frustumCulled: !1, children: /* @__PURE__ */ r("lineBasicMaterial", { vertexColors: !0, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) }),
797
+ /* @__PURE__ */ r(Zt, { position: [0, Be + 0.2, 4.4], color: "#2dd4bf", size: 0.3, pxRange: [9, 13] }),
798
+ ot.map((v) => /* @__PURE__ */ r("group", { ref: (l) => void (_.current[v] = l), children: /* @__PURE__ */ r(Ze, { ref: (l) => void (w.current[v] = l), text: "", size: 0.24, opacity: 0, pxRange: [8, 12] }) }, v))
799
+ ] });
800
+ }
801
+ function Rn(e, o, n) {
802
+ const s = me.laneExpanded[e] > 0, a = s ? e >= 3 ? 8.5 : -9.6 : e >= 3 ? 4.5 : -2.5;
803
+ return ct(e, a + Math.sin(n * 0.13 * Ie + e) * 0.5, n, o), o.y += s ? 0.35 : 1.3, o.z += 0.6, o;
804
+ }
805
+ function On() {
806
+ return /* @__PURE__ */ r($t, { place: Rn, radius: 1.25, variant: "swarm", pointSize: 0.9, labelBelow: 1.15 });
807
+ }
808
+ function Nn() {
809
+ const e = Kt(), [o, n] = Oe(null);
810
+ return He(() => {
811
+ Pt.id = o;
812
+ }, [o]), /* @__PURE__ */ N("div", { className: "scene-root", style: { background: "#010409" }, children: [
813
+ /* @__PURE__ */ N(
814
+ kt,
815
+ {
816
+ camera: { position: [0, 0.6, 21], fov: 50, near: 0.1, far: 300 },
817
+ dpr: [1, 2],
818
+ gl: { antialias: !1, powerPreference: "high-performance" },
819
+ onPointerMissed: () => n(null),
820
+ children: [
821
+ /* @__PURE__ */ r("color", { attach: "background", args: ["#010409"] }),
822
+ /* @__PURE__ */ r(dn, {}),
823
+ /* @__PURE__ */ r(Fn, { galaxy: e }),
824
+ /* @__PURE__ */ r(wn, {}),
825
+ /* @__PURE__ */ r(xn, { onSelect: n }),
826
+ /* @__PURE__ */ r(zn, {}),
827
+ /* @__PURE__ */ r(On, {}),
828
+ /* @__PURE__ */ r(gn, {}),
829
+ /* @__PURE__ */ r(
830
+ Gt,
831
+ {
832
+ makeDefault: !0,
833
+ target: [0, -0.4, -1],
834
+ enableDamping: !0,
835
+ dampingFactor: 0.06,
836
+ minDistance: 9,
837
+ maxDistance: 36,
838
+ minPolarAngle: Math.PI * 0.28,
839
+ maxPolarAngle: Math.PI * 0.6,
840
+ minAzimuthAngle: -0.8,
841
+ maxAzimuthAngle: 0.8
842
+ }
843
+ ),
844
+ /* @__PURE__ */ N(Ft, { multisampling: 0, children: [
845
+ /* @__PURE__ */ r(Rt, { mipmapBlur: !0, intensity: 1.25, luminanceThreshold: 0.16, luminanceSmoothing: 0.25, radius: 0.78 }),
846
+ /* @__PURE__ */ r(Ot, { eskil: !1, offset: 0.22, darkness: 0.9 }),
847
+ /* @__PURE__ */ r(It, { opacity: 0.03 })
848
+ ] })
849
+ ]
850
+ }
851
+ ),
852
+ /* @__PURE__ */ r(Jt, { title: "Deep sea · bioluminescent agents", subtitle: "jellyfish = agents · currents = Hatchet runs · coral reef = knowledge graph · anglerfish = MCP servers", selected: o, onClose: () => n(null) })
853
+ ] });
854
+ }
855
+ export {
856
+ Nn as default
857
+ };