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,984 @@
1
+ var Gt = Object.defineProperty;
2
+ var Rt = (e, t, r) => t in e ? Gt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var he = (e, t, r) => Rt(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { jsx as u, Fragment as ie, jsxs as J } from "react/jsx-runtime";
5
+ import { OrbitControls as Et } from "@react-three/drei";
6
+ import { useFrame as te, Canvas as _t } from "@react-three/fiber";
7
+ import { EffectComposer as Bt, Bloom as Lt, Vignette as Ot } from "@react-three/postprocessing";
8
+ import { useState as xe, useRef as G, useMemo as E, useEffect as Ft } from "react";
9
+ import { T as Nt, l as Se, m as Ht, j as It, h as Q, w as R, C as Dt, i as it, p as Ut, e as Wt, r as dt, b as jt, c as Mt, s as Kt, L as Be, K as Xt, G as qt, n as Yt, d as $t, R as Zt, u as Qt, k as Jt, f as eo, H as to, t as oo, g as no } from "./ClusterBall-CPsd6JvJ.js";
10
+ import * as o from "three";
11
+ import { a as lt, r as ro, s as ao } from "./spread-CWdeDFd9.js";
12
+ var bt;
13
+ const fe = typeof window < "u" && !!((bt = window.matchMedia) != null && bt.call(window, "(prefers-reduced-motion: reduce)").matches), ve = new o.Color("#ffb627"), _e = new o.Color("#f59e0b"), re = new o.Color("#ffd166");
14
+ new o.Color("#1f1206");
15
+ const ge = new o.Color("#fff3d6"), je = new o.Color("#ff3b2f"), so = new o.Color(1, 1, 1), Xe = Object.fromEntries(Object.entries(Nt).map(([e, t]) => [e, new o.Color(t).lerp(ve, 0.18)])), q = (e) => e < 0 ? 0 : e > 1 ? 1 : e, qe = (e) => 1 - Math.pow(1 - q(e), 3), de = (e) => (e = q(e), e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2), mt = (e) => {
16
+ e = q(e);
17
+ const t = 1.9;
18
+ return 1 + (t + 1) * Math.pow(e - 1, 3) + t * Math.pow(e - 1, 2);
19
+ };
20
+ let Oe = null;
21
+ function xt() {
22
+ if (Oe) return Oe;
23
+ const e = document.createElement("canvas");
24
+ e.width = e.height = 128;
25
+ const t = e.getContext("2d"), r = t.createRadialGradient(64, 64, 0, 64, 64, 64);
26
+ return r.addColorStop(0, "rgba(255,255,255,1)"), r.addColorStop(0.18, "rgba(255,255,255,0.55)"), r.addColorStop(0.5, "rgba(255,255,255,0.12)"), r.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = r, t.fillRect(0, 0, 128, 128), Oe = new o.CanvasTexture(e), Oe;
27
+ }
28
+ function be(e = "#fff") {
29
+ return new o.SpriteMaterial({ map: xt(), color: e, blending: o.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 });
30
+ }
31
+ function et(e = "#fff") {
32
+ return new o.MeshBasicMaterial({ color: e, blending: o.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 });
33
+ }
34
+ function ct() {
35
+ return new o.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 });
36
+ }
37
+ const we = new o.SphereGeometry(1, 28, 20), St = new o.ConeGeometry(1, 1, 12).translate(0, 0.5, 0);
38
+ function io(e = 56, t = 6) {
39
+ const r = [], a = [];
40
+ for (let n = 0; n <= e; n++) for (let l = 0; l < t; l++) {
41
+ const d = l / t * Math.PI * 2;
42
+ r.push(n / e, Math.cos(d), Math.sin(d));
43
+ }
44
+ for (let n = 0; n < e; n++)
45
+ for (let l = 0; l < t; l++) {
46
+ const d = n * t + l, p = n * t + (l + 1) % t;
47
+ a.push(d, d + t, p, p, d + t, p + t);
48
+ }
49
+ const i = new o.BufferGeometry();
50
+ return i.setAttribute("position", new o.Float32BufferAttribute(r, 3)), i.setIndex(a), i.boundingSphere = new o.Sphere(new o.Vector3(), 1e4), i;
51
+ }
52
+ const Ct = io();
53
+ function At(e, t = 0.05, r = 1) {
54
+ return new o.ShaderMaterial({
55
+ uniforms: {
56
+ uP0: { value: new o.Vector3() },
57
+ uP1: { value: new o.Vector3() },
58
+ uP2: { value: new o.Vector3() },
59
+ uRadius: { value: t },
60
+ uColor: { value: new o.Color(e) },
61
+ uHeadColor: { value: new o.Color(e) },
62
+ uOpacity: { value: 1 },
63
+ uGrow: { value: 1 },
64
+ uTime: { value: 0 },
65
+ uFlow: { value: 0 },
66
+ uHead: { value: -1 },
67
+ uDots: { value: r }
68
+ },
69
+ vertexShader: (
70
+ /* glsl */
71
+ `
72
+ uniform vec3 uP0; uniform vec3 uP1; uniform vec3 uP2; uniform float uRadius;
73
+ varying float vT; varying float vRim;
74
+ void main(){
75
+ float t = position.x; float a = 1.0 - t;
76
+ vec3 p = a*a*uP0 + 2.0*a*t*uP1 + t*t*uP2;
77
+ vec3 tg = 2.0*a*(uP1-uP0) + 2.0*t*(uP2-uP1);
78
+ tg = length(tg) > 1e-5 ? normalize(tg) : vec3(1.0,0.0,0.0);
79
+ vec3 up = abs(tg.y) > 0.92 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,0.0);
80
+ vec3 n = normalize(cross(tg, up)); vec3 b = cross(tg, n);
81
+ vec3 off = n*position.y + b*position.z;
82
+ vec4 mv = modelViewMatrix * vec4(p + off * uRadius, 1.0);
83
+ vRim = abs(dot(normalize(normalMatrix * off), normalize(-mv.xyz)));
84
+ vT = t;
85
+ gl_Position = projectionMatrix * mv;
86
+ }`
87
+ ),
88
+ fragmentShader: (
89
+ /* glsl */
90
+ `
91
+ uniform vec3 uColor; uniform vec3 uHeadColor; uniform float uOpacity; uniform float uGrow; uniform float uTime;
92
+ uniform float uFlow; uniform float uHead; uniform float uDots;
93
+ varying float vT; varying float vRim;
94
+ void main(){
95
+ if (vT > uGrow) discard;
96
+ float core = 0.3 + 0.7 * vRim * vRim;
97
+ // dotted flight trail (bees leave little glowing dots)
98
+ float d = fract(vT * 34.0 - uTime * 0.6 * uFlow);
99
+ float dots = mix(1.0, smoothstep(0.55, 0.35, abs(d - 0.5) * 2.0) * 0.9 + 0.1, uDots);
100
+ // directional flow: brighter packets travelling start (t=0) → end (t=1)
101
+ float flow = uFlow * pow(max(0.0, sin((vT * 5.0 - uTime * 0.8) * 3.14159)), 10.0);
102
+ float head = 0.0;
103
+ if (uHead >= 0.0) { float e = vT - uHead; head = e > 0.0 ? exp(-e * e / 0.0007) : exp(e / 0.09); }
104
+ vec3 col = uColor * uOpacity * (core * dots + flow * 2.4) + uHeadColor * head * 1.6;
105
+ gl_FragColor = vec4(col, 1.0);
106
+ }`
107
+ ),
108
+ transparent: !0,
109
+ depthWrite: !1,
110
+ blending: o.AdditiveBlending
111
+ });
112
+ }
113
+ function ye(e, t, r, a, i) {
114
+ const n = 1 - a;
115
+ return i.set(n * n * e.x + 2 * n * a * t.x + a * a * r.x, n * n * e.y + 2 * n * a * t.y + a * a * r.y, n * n * e.z + 2 * n * a * t.z + a * a * r.z);
116
+ }
117
+ function Qe(e, t, r, a) {
118
+ return a.copy(e).add(t).multiplyScalar(0.5), a.y += r, a.z += r * 0.8, a;
119
+ }
120
+ const Ze = class Ze {
121
+ constructor(t) {
122
+ he(this, "mesh");
123
+ he(this, "colors");
124
+ he(this, "n", 0);
125
+ he(this, "o", new o.Object3D());
126
+ he(this, "a", new o.Vector3());
127
+ he(this, "b", new o.Vector3());
128
+ this.max = t, this.colors = new Float32Array(t * 3), this.mesh = new o.InstancedMesh(St, new o.MeshBasicMaterial({ blending: o.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 }), t), this.mesh.instanceColor = new o.InstancedBufferAttribute(this.colors, 3), this.mesh.frustumCulled = !1, this.mesh.count = 0;
129
+ }
130
+ begin() {
131
+ this.n = 0;
132
+ }
133
+ add(t, r, a, i, n, l, d, p = 1) {
134
+ this.n >= this.max || p <= 3e-3 || (ye(t, r, a, i, this.a), ye(t, r, a, Math.min(1, Math.max(0, i + 0.02 * n)), this.b), this.b.sub(this.a), !(this.b.lengthSq() < 1e-8) && (this.o.position.copy(this.a), this.o.quaternion.setFromUnitVectors(Ze.UP, this.b.normalize()), this.o.scale.set(l * 0.42, l, l * 0.42), this.o.updateMatrix(), this.mesh.setMatrixAt(this.n, this.o.matrix), this.colors[this.n * 3] = d.r * p, this.colors[this.n * 3 + 1] = d.g * p, this.colors[this.n * 3 + 2] = d.b * p, this.n++));
135
+ }
136
+ end() {
137
+ this.mesh.count = this.n, this.mesh.instanceMatrix.needsUpdate = !0, this.mesh.instanceColor && (this.mesh.instanceColor.needsUpdate = !0);
138
+ }
139
+ };
140
+ he(Ze, "UP", new o.Vector3(0, 1, 0));
141
+ let Ye = Ze;
142
+ const $e = 0.64, Fe = 17.8, ke = 11.4, zt = (e, t) => -0.0105 * e * e - 0.016 * t * t, Ve = [
143
+ [-8.5, 3.6],
144
+ [8, -4.4],
145
+ [8, 4.2],
146
+ [-8.5, -4.6],
147
+ [-0.5, 0],
148
+ [-13.5, 0],
149
+ [13, 0]
150
+ ], ut = 4.2;
151
+ function Pt(e, t) {
152
+ if (Se.grouped) {
153
+ const n = Ve[Ht(e)], l = It(e);
154
+ return t.set(n[0] + (l ? n[0] < 0 ? -1.5 : 1.5 : 0), n[1] + lt(l) * 4.2, ut + (Q(e, 3) - 0.5) * 0.8);
155
+ }
156
+ const r = R.runs.get(e), a = r ? r.slot : Math.floor(Q(e, 9) * Ve.length), i = Ve[a % Ve.length];
157
+ return t.set(i[0] + (Q(e, 1) - 0.5) * 2.4, i[1] + (Q(e, 2) - 0.5) * 1.6, ut + (Q(e, 3) - 0.5) * 1.2);
158
+ }
159
+ function lo(e, t) {
160
+ const r = Ve[e % Ve.length];
161
+ return t.set(r[0], r[1], ut - 0.6);
162
+ }
163
+ const ht = { planner: -4.2, researcher: 0, writer: 4.2, graph_scout: 0, records_scout: 0, data_scout: 0 }, Ne = new o.Vector3(), co = new o.Vector3(), ft = /* @__PURE__ */ new Map();
164
+ function uo(e) {
165
+ ft.delete(e);
166
+ }
167
+ function kt(e, t) {
168
+ Pt(e.run, Ne);
169
+ const r = e.parent ? R.instances.get(e.parent) ?? R.archive.get(e.parent) : void 0;
170
+ if (!e.subagent || !r) {
171
+ const p = ro(e);
172
+ return t.set(Ne.x + ht[e.type] + (Q(e.id, 4) - 0.5) * 0.8, Ne.y - ht[e.type] * 0.25 + lt(p) * 2.9 + (Q(e.id, 5) - 0.5) * 0.6, Ne.z + (Q(e.id, 6) - 0.5) * 0.8), t;
173
+ }
174
+ const a = Ke.get(r.id) ?? kt(r, co);
175
+ let i = ft.get(e.id);
176
+ i === void 0 && ft.set(e.id, i = ao(e, `w:${r.id}`));
177
+ const l = Math.atan2(a.y + 1e-3, a.x) + (Q(e.run, 7) - 0.5) * 0.9 + lt(i) * 0.72, d = 3.3 + (Q(e.id, 8) - 0.5) * 0.8 + Math.floor(i / 6) * 1.5;
178
+ return t.set(a.x + Math.cos(l) * d, a.y + Math.sin(l) * d * 0.8, a.z + 1.4 + (Q(e.id, 10) - 0.5) * 1.2), t;
179
+ }
180
+ const se = /* @__PURE__ */ new Map(), Ke = /* @__PURE__ */ new Map(), Me = /* @__PURE__ */ new Map(), Ee = [
181
+ [-20.2, -2.2, 2.5],
182
+ [20.2, -1.6, 2.5],
183
+ [-20.6, 6, 1.5],
184
+ [21.2, -8.4, 2.5],
185
+ [15.5, -10, 4],
186
+ [-21, -8.5, 3],
187
+ [-6, -13.6, 4],
188
+ [21.5, 6.5, 1]
189
+ ];
190
+ function Le(e, t) {
191
+ const r = Ee[e % Ee.length], a = Math.floor(e / Ee.length);
192
+ return t.set(r[0] * (1 + a * 0.12), r[1] * (1 + a * 0.1), r[2] - a * 2);
193
+ }
194
+ const Te = 1.55;
195
+ function Vt(e, t, r) {
196
+ const a = Ee[e % Ee.length], i = Math.atan2(a[1] + 9, a[0] * 0.22);
197
+ if (r <= 1) return i;
198
+ const n = Math.min(Math.PI * 1.25, (r - 1) * 1.05);
199
+ return i - n / 2 + n * t / (r - 1);
200
+ }
201
+ function fo(e, t, r, a) {
202
+ Le(e, a);
203
+ const i = Vt(e, t, r);
204
+ return a.set(a.x + Math.cos(i) * Te * 1.9, a.y + Math.sin(i) * Te * 1.9, a.z + 0.1);
205
+ }
206
+ function He(e, t, r) {
207
+ return e.r += t.r * r, e.g += t.g * r, e.b += t.b * r, e;
208
+ }
209
+ const po = [
210
+ [-15.5, 5.5, 3],
211
+ [12, -8, 3],
212
+ [2.5, 8.8, 3],
213
+ [-16.5, -3.6, 3],
214
+ [2, -8.6, 3],
215
+ [-17.5, 0.5, 3]
216
+ ];
217
+ function mo(e, t) {
218
+ return Se.laneExpanded[e] ? t.fromArray(po[e]) : (lo(e, t), t.x < 0 && t.y < -3.4 && (t.y = -3.4), t);
219
+ }
220
+ function ho() {
221
+ return /* @__PURE__ */ u(Dt, { place: mo, radius: 1.6, variant: "swarm", color: "#ffb627" });
222
+ }
223
+ const go = new o.Color("#5b4a3a"), vo = new o.Vector3(0, 1, 0), gt = new o.CylinderGeometry(0.018, 0.012, 0.55, 5).translate(0, 0.275, 0), wo = new o.ConeGeometry(0.07, 0.3, 8).rotateZ(Math.PI / 2), yo = new o.SphereGeometry(1.15, 10, 8), bo = new o.MeshBasicMaterial({ transparent: !0, opacity: 0, depthWrite: !1, colorWrite: !1 }), Mo = new o.RingGeometry(1.25, 1.36, 6, 1), tt = 7;
224
+ let Ie = null;
225
+ function xo() {
226
+ if (Ie) return Ie;
227
+ const e = document.createElement("canvas");
228
+ e.width = 128, e.height = 256;
229
+ const t = e.getContext("2d");
230
+ t.translate(64, 128);
231
+ const r = t.createRadialGradient(0, -20, 4, 0, 0, 120);
232
+ r.addColorStop(0, "rgba(255,255,255,0.35)"), r.addColorStop(1, "rgba(255,255,255,0.08)"), t.fillStyle = r, t.beginPath(), t.ellipse(0, 0, 54, 120, 0, 0, Math.PI * 2), t.fill(), t.strokeStyle = "rgba(255,255,255,0.95)", t.lineWidth = 5, t.stroke(), t.strokeStyle = "rgba(255,255,255,0.45)", t.lineWidth = 2.5;
233
+ for (const [a, i, n, l] of [
234
+ [0, 110, -8, -60],
235
+ [0, 110, 26, -40],
236
+ [0, 110, -30, 10],
237
+ [-8, -60, 20, -95]
238
+ ])
239
+ t.beginPath(), t.moveTo(a, i), t.quadraticCurveTo((a + n) / 2 + 10, (i + l) / 2, n, l), t.stroke();
240
+ return Ie = new o.CanvasTexture(e), Ie;
241
+ }
242
+ const vt = new o.PlaneGeometry(0.62, 1.25).translate(0, 0.6, 0);
243
+ function ot(e, t, r) {
244
+ return new o.ShaderMaterial({
245
+ uniforms: {
246
+ uBase: { value: new o.Color(e) },
247
+ uDark: { value: new o.Color("#170b03") },
248
+ uRim: { value: t.clone() },
249
+ uGlow: { value: 0 },
250
+ uStripes: { value: r },
251
+ uFade: { value: 1 }
252
+ },
253
+ vertexShader: (
254
+ /* glsl */
255
+ `
256
+ varying vec3 vN; varying vec3 vV; varying vec3 vL;
257
+ void main(){
258
+ vL = position;
259
+ vec4 mv = modelViewMatrix * vec4(position, 1.0);
260
+ vN = normalize(normalMatrix * normal);
261
+ vV = normalize(-mv.xyz);
262
+ gl_Position = projectionMatrix * mv;
263
+ }`
264
+ ),
265
+ fragmentShader: (
266
+ /* glsl */
267
+ `
268
+ uniform vec3 uBase; uniform vec3 uDark; uniform vec3 uRim; uniform float uGlow; uniform float uStripes; uniform float uFade;
269
+ varying vec3 vN; varying vec3 vV; varying vec3 vL;
270
+ void main(){
271
+ vec3 n = normalize(vN);
272
+ float lam = 0.35 + 0.65 * max(0.0, dot(n, normalize(vec3(0.3, 0.8, 0.6))));
273
+ float fres = pow(1.0 - abs(dot(n, normalize(vV))), 2.2);
274
+ float s = uStripes > 0.0 ? smoothstep(0.42, 0.58, abs(fract(vL.x * uStripes + 0.25) - 0.5) * 2.0) : 0.0;
275
+ vec3 body = mix(uBase, uDark, s * 0.92) * lam * (0.55 + uGlow * 0.9);
276
+ vec3 col = body + uRim * fres * (0.55 + uGlow * 1.2) + uBase * uGlow * 0.25 * (1.0 - s);
277
+ gl_FragColor = vec4(col * uFade, 1.0);
278
+ }`
279
+ )
280
+ });
281
+ }
282
+ function So({ inst: e, onSelect: t }) {
283
+ const r = G(null), a = G(null), i = G(null), n = G(null), l = G(null), d = G(null), p = G(null), f = G(null), v = G(null), m = !e.subagent, C = E(() => [...e.id].reduce((k, y) => (k * 31 + y.charCodeAt(0)) % 9973, 7) / 9973, [e.id]), h = Xe[e.type], g = E(() => {
284
+ const k = h.clone().lerp(re, 0.25), y = ot(m ? "#f2a516" : "#e6a21c", k, m ? 2 : 2.4), S = ot("#8a5512", k, 0), M = ot("#2a1606", k, 0);
285
+ return {
286
+ abdomen: y,
287
+ thorax: S,
288
+ head: M,
289
+ bodies: [y, S, M],
290
+ wing: new o.MeshBasicMaterial({ map: xo(), color: ge.clone().lerp(h, 0.35).multiplyScalar(0.55), blending: o.AdditiveBlending, transparent: !0, depthWrite: !1, side: o.DoubleSide, toneMapped: !1 }),
291
+ halo: be(h),
292
+ pollen: et(_e),
293
+ ring: et(ge),
294
+ path: At(h.clone().lerp(re, 0.35), m ? 0.07 : 0.055, 1),
295
+ arrow: et(h)
296
+ };
297
+ }, [h, m]), s = E(
298
+ () => ({
299
+ home: new o.Vector3(),
300
+ target: new o.Vector3(),
301
+ live: new o.Vector3(),
302
+ prev: new o.Vector3(),
303
+ p0: new o.Vector3(),
304
+ p1: new o.Vector3(),
305
+ fly: new o.Vector3(),
306
+ a: new o.Vector3(),
307
+ b: new o.Vector3(),
308
+ d: new o.Vector3(),
309
+ c: new o.Color(),
310
+ init: !1,
311
+ p0set: !1,
312
+ face: 1,
313
+ yaw: 0,
314
+ vx: 0,
315
+ parentK: 0,
316
+ pend: 0
317
+ }),
318
+ []
319
+ );
320
+ Ft(() => (se.set(e.id, s.live), Ke.set(e.id, s.home), Me.set(e.id, s.p1), () => {
321
+ se.get(e.id) === s.live && se.delete(e.id), Ke.get(e.id) === s.home && Ke.delete(e.id), Me.get(e.id) === s.p1 && Me.delete(e.id), uo(e.id);
322
+ }), [e.id, s]), te(({ clock: k }) => {
323
+ var U;
324
+ const y = performance.now(), S = k.elapsedTime, M = fe ? 0 : 1;
325
+ kt(e, s.target), s.init ? s.home.lerp(s.target, 0.035) : (s.home.copy(s.target), s.init = !0);
326
+ const A = (y - e.bornAt) / 1e3, b = e.exitAt ? (y - e.exitAt) / 1e3 : -1, Y = e.status === "failed", D = Ut(e, y), B = Wt(e, y), H = b < 0 && (e.status === "thinking" || e.status === "spawning"), $ = e.parent ? R.instances.get(e.parent) : void 0, w = e.parent ? se.get(e.parent) : void 0;
327
+ w ? (s.p0.copy(w), s.p0set = !0) : s.p0set || (s.p0.copy(s.home), s.p0set = !0);
328
+ const P = !!e.parent && s.p0set && !!w;
329
+ if (s.live.set(
330
+ s.home.x + Math.sin(S * 0.7 + C * 20) * 0.22 * M,
331
+ s.home.y + Math.sin(S * 1.4 + C * 9) * 0.16 * M,
332
+ s.home.z + Math.cos(S * 0.6 + C * 5) * 0.18 * M
333
+ ), b >= 0) {
334
+ const T = de(b / 2.4);
335
+ s.live.y += Y ? -T * 2.2 : T * 1.6, s.live.z += Y ? 0 : T * 1.2;
336
+ }
337
+ Qe(s.p0, s.live, e.subagent ? 1.6 : 2.2, s.p1);
338
+ const _ = e.parent ? de(A / 1.5) : 1;
339
+ _ < 1 && P ? ye(s.p0, s.p1, s.live, _, s.fly) : s.fly.copy(s.live), r.current && r.current.position.copy(s.fly), s.vx = s.vx * 0.85 + (s.fly.x - s.prev.x) * 0.15, s.prev.copy(s.fly), (!s.init || A < 0.05) && (s.face = s.home.x < 0 ? 1 : -1), s.vx > 0.012 ? s.face = 1 : s.vx < -0.012 && (s.face = -1);
340
+ const le = s.face > 0 ? -0.45 : Math.PI + 0.45;
341
+ s.yaw += (le - s.yaw) * 0.08;
342
+ const Ge = e.parent ? mt(A / 0.9) : mt(A / 0.7), me = Math.max(1e-4, dt(e) * jt() * (0.35 + 0.65 * Ge) * (b >= 0 ? Math.max(0.25, D) : 1));
343
+ a.current && (a.current.rotation.set(0, s.yaw, Math.sin(S * 1.4 + C * 9) * 0.08 * M + (Y && b >= 0 ? -0.6 : 0)), a.current.scale.setScalar(me * (1 + B * 0.05)));
344
+ const oe = 0.25 + (fe ? 0.5 : H ? 0.5 + 0.5 * Math.sin(S * 46 + C * 10) : b < 0 ? 0.5 + 0.5 * Math.sin(S * 9 + C * 10) : 0.5 + 0.5 * Math.sin(S * 26)) * 0.85;
345
+ i.current && i.current.rotation.set(oe, 0, 0.35), n.current && n.current.rotation.set(-oe, 0, 0.35);
346
+ const c = b >= 0 ? D : q(A / 0.4);
347
+ g.wing.color.copy(ge).lerp(h, 0.35).multiplyScalar((H ? 0.75 : 0.45) * c + B * 0.15);
348
+ const z = (H ? 0.55 + 0.15 * Math.sin(S * 3 + C * 7) * M : 0.18) + B * 0.55;
349
+ for (const T of g.bodies)
350
+ T.uniforms.uGlow.value = z, T.uniforms.uFade.value = c, Y && b >= 0 && T.uniforms.uRim.value.copy(je).lerp(go, q(b));
351
+ l.current && (l.current.scale.setScalar(me * ((H ? 3.2 : 2.3) + B * 1.6)), s.c.copy(h).lerp(re, 0.3).multiplyScalar(((H ? 0.24 : 0.1) + B * 0.22) * c), Y && b >= 0 && s.c.copy(je).multiplyScalar(0.2 * c), g.halo.color.copy(s.c));
352
+ let N = -1;
353
+ for (const T of R.mcpPending.values()) T.instance === e.id && (N = Math.max(N, Mt(T, y)));
354
+ if (s.pend += ((N >= 0 && b < 0 ? 1 : 0) - s.pend) * 0.1, d.current && (d.current.visible = s.pend > 0.02, d.current.rotation.set(1.15, 0, S * 1.6 * M), d.current.scale.setScalar(Math.max(1e-4, me * 1.25 * (0.6 + 0.4 * s.pend))), s.c.copy(_e).lerp(je, q((N - 1.2) / 1.2)), g.pollen.color.copy(s.c).multiplyScalar(1.6 * s.pend)), p.current) {
355
+ const T = R.selected === e.id;
356
+ p.current.visible = T, T && (p.current.rotation.z = S * 0.4 * M, p.current.scale.setScalar(me * (1.15 + 0.05 * Math.sin(S * 3))), g.ring.color.copy(ge).multiplyScalar(0.9));
357
+ }
358
+ (U = v.current) == null || U.setOpacity(Kt(e.id) ? q(A / 0.8) * (b >= 0 ? D : 1) * 0.95 : 0);
359
+ const L = !!$ && !$.exitAt;
360
+ s.parentK += ((P && !e.exitAt && L ? 1 : 0) - s.parentK) * (L ? 0.06 : 0.035);
361
+ const V = g.path.uniforms;
362
+ V.uP0.value.copy(s.p0), V.uP1.value.copy(s.p1), V.uP2.value.copy(s.live);
363
+ const ee = b >= 0 ? de(b / 1.4) : 0;
364
+ if (V.uGrow.value = P ? Math.max(0, _ * (1 - ee)) : 0, V.uHead.value = _ < 1 ? _ : -1, V.uHeadColor.value.copy(h).lerp(ge, 0.4).multiplyScalar(1.4), V.uOpacity.value = (H ? 0.75 : 0.5) * Math.max(s.parentK, _ < 1 ? 0.6 : 0), V.uFlow.value = _ >= 1 ? 1 : 0, V.uTime.value = fe ? 0 : S, f.current) {
365
+ const T = P && _ >= 1 && s.parentK > 0.05 && V.uGrow.value > 0.9;
366
+ if (f.current.visible = T, T) {
367
+ ye(s.p0, s.p1, s.live, 0.78, s.a), ye(s.p0, s.p1, s.live, 0.8, s.b), f.current.position.copy(s.a), s.d.subVectors(s.b, s.a).normalize(), f.current.quaternion.setFromUnitVectors(vo, s.d);
368
+ const O = e.subagent ? 0.8 : 1;
369
+ f.current.scale.set(0.15 * O, 0.4 * O, 0.15 * O), g.arrow.color.copy(h).lerp(re, 0.3).multiplyScalar(1.5 * s.parentK);
370
+ }
371
+ }
372
+ });
373
+ const F = (k) => {
374
+ k.stopPropagation(), t(e.id);
375
+ }, K = e.id.split(":")[2], x = m ? 1 : 0.78;
376
+ return /* @__PURE__ */ J(ie, { children: [
377
+ /* @__PURE__ */ u("mesh", { geometry: Ct, material: g.path, frustumCulled: !1 }),
378
+ /* @__PURE__ */ u("mesh", { ref: f, geometry: St, material: g.arrow, visible: !1 }),
379
+ /* @__PURE__ */ J("group", { ref: r, children: [
380
+ /* @__PURE__ */ u("sprite", { ref: l, material: g.halo }),
381
+ /* @__PURE__ */ J("group", { ref: a, scale: 1e-4, children: [
382
+ /* @__PURE__ */ u("mesh", { geometry: yo, material: bo, onClick: F, onPointerOver: () => document.body.style.cursor = "pointer", onPointerOut: () => document.body.style.cursor = "" }),
383
+ /* @__PURE__ */ u("mesh", { geometry: we, material: g.abdomen, position: [-0.35 - x * 0.5, -0.05, 0], scale: [x, 0.44, 0.44], rotation: [0, 0, 0.12] }),
384
+ /* @__PURE__ */ u("mesh", { geometry: wo, material: g.head, position: [-0.35 - x * 1.48, -0.16, 0] }),
385
+ /* @__PURE__ */ u("mesh", { geometry: we, material: g.thorax, position: [0.12, 0.02, 0], scale: 0.34 }),
386
+ /* @__PURE__ */ u("mesh", { geometry: we, material: g.head, position: [0.56, 0, 0], scale: [0.24, 0.25, 0.25] }),
387
+ /* @__PURE__ */ u("mesh", { geometry: gt, material: g.head, position: [0.66, 0.16, 0.08], rotation: [0.3, 0, -0.55] }),
388
+ /* @__PURE__ */ u("mesh", { geometry: gt, material: g.head, position: [0.66, 0.16, -0.08], rotation: [-0.3, 0, -0.55] }),
389
+ /* @__PURE__ */ J("group", { position: [0.06, 0.28, 0], children: [
390
+ /* @__PURE__ */ u("mesh", { ref: i, geometry: vt, material: g.wing }),
391
+ /* @__PURE__ */ u("mesh", { ref: n, geometry: vt, material: g.wing })
392
+ ] })
393
+ ] }),
394
+ /* @__PURE__ */ u("group", { ref: d, visible: !1, children: Array.from({ length: tt }, (k, y) => /* @__PURE__ */ u("mesh", { geometry: we, material: g.pollen, position: [Math.cos(y / tt * Math.PI * 2) * 1.1, Math.sin(y / tt * Math.PI * 2) * 1.1, 0], scale: y % 2 ? 0.07 : 0.1 }, y)) }),
395
+ /* @__PURE__ */ u("mesh", { ref: p, geometry: Mo, material: g.ring, visible: !1 }),
396
+ /* @__PURE__ */ u(
397
+ Be,
398
+ {
399
+ ref: v,
400
+ position: [0, -0.95 * dt(e) - 0.2, 0],
401
+ text: `${e.name}${K !== void 0 && e.subagent ? ` ${Number(K) + 1}` : ""}`,
402
+ color: `#${h.getHexString()}`,
403
+ size: m ? 0.3 : 0.22,
404
+ opacity: 0,
405
+ pxRange: m ? [9, 14] : [8, 11.5],
406
+ glow: m ? 1.05 : 0.9
407
+ }
408
+ )
409
+ ] })
410
+ ] });
411
+ }
412
+ function Co({ onSelect: e }) {
413
+ const [t, r] = xe([]), a = G(/* @__PURE__ */ new Set()), i = G(-1);
414
+ return te(() => {
415
+ const n = R.instances;
416
+ let l = n.size !== a.current.size || i.current !== Se.version;
417
+ if (!l)
418
+ for (const d of n.keys()) a.current.has(d) || (l = !0);
419
+ l && (a.current = new Set(n.keys()), i.current = Se.version, r([...n.values()].filter(it).sort((d, p) => d.bornAt - p.bornAt)));
420
+ }), /* @__PURE__ */ u(ie, { children: t.map((n) => /* @__PURE__ */ u(So, { inst: n, onSelect: e }, n.id)) });
421
+ }
422
+ const nt = 4;
423
+ function Ao({ comet: e }) {
424
+ const t = G([]), r = R.instances.get(e.from), a = r ? Xe[r.type] : re, i = E(() => Array.from({ length: nt }, (l, d) => new o.SpriteMaterial({ map: xt(), color: a.clone().lerp(ge, 0.45).multiplyScalar(1.6 * (1 - d / nt)), blending: o.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 })), [a]), n = E(() => ({ a: new o.Vector3(), b: new o.Vector3(), c: new o.Vector3(), h: new o.Vector3() }), []);
425
+ return te(() => {
426
+ const l = se.get(e.from), d = se.get(e.to), p = q((performance.now() - e.start) / e.dur), f = !!l && !!d && p < 1;
427
+ for (let v = 0; v < nt; v++) {
428
+ const m = t.current[v];
429
+ if (!m || (m.visible = f, !f)) continue;
430
+ const C = R.instances.get(e.to);
431
+ (C == null ? void 0 : C.parent) === e.from && Me.get(e.to) ? (n.c.copy(Me.get(e.to)), n.a.copy(l), n.b.copy(d)) : (r == null ? void 0 : r.parent) === e.to && Me.get(e.from) ? (n.c.copy(Me.get(e.from)), n.a.copy(l), n.b.copy(d)) : (n.a.copy(l), n.b.copy(d), Qe(n.a, n.b, 1.8, n.c)), ye(n.a, n.c, n.b, de(q(p - v * 0.035)), n.h), m.position.copy(n.h), m.scale.setScalar(0.95 - v * 0.17);
432
+ }
433
+ }), /* @__PURE__ */ u(ie, { children: i.map((l, d) => /* @__PURE__ */ u("sprite", { ref: (p) => void (t.current[d] = p), material: l, visible: !1 }, d)) });
434
+ }
435
+ function zo() {
436
+ const [e, t] = xe([]), r = G({ n: -1, first: -1, last: -1 });
437
+ return te(() => {
438
+ const a = R.comets, i = r.current, n = a.length ? a[0].id : -1, l = a.length ? a[a.length - 1].id : -1;
439
+ (a.length !== i.n || n !== i.first || l !== i.last) && (i.n = a.length, i.first = n, i.last = l, t(ko(a)));
440
+ }), /* @__PURE__ */ u(ie, { children: e.map((a) => /* @__PURE__ */ u(Ao, { comet: a }, a.id)) });
441
+ }
442
+ const Po = 40;
443
+ function ko(e) {
444
+ const t = [];
445
+ for (let r = e.length - 1; r >= 0 && t.length < Po; r--) {
446
+ const a = e[r];
447
+ (!Se.grouped || it(a.from) && it(a.to)) && t.push(a);
448
+ }
449
+ return t.reverse();
450
+ }
451
+ const Vo = 360, To = 24, De = 48, Ae = 18, rt = 96, ze = 10, Go = 48, Ue = 5, wt = 1, Ro = (
452
+ /* glsl */
453
+ `
454
+ attribute vec3 aColor; attribute float aGlow; attribute float aCap;
455
+ varying vec3 vLocal; varying vec3 vLN; varying vec3 vN; varying vec3 vV; varying vec3 vColor; varying float vGlow; varying float vCap;
456
+ void main(){
457
+ vLocal = position; vLN = normal; vColor = aColor; vGlow = aGlow; vCap = aCap;
458
+ vec4 mv = modelViewMatrix * instanceMatrix * vec4(position, 1.0);
459
+ vN = normalize(normalMatrix * mat3(instanceMatrix) * normal);
460
+ vV = normalize(-mv.xyz);
461
+ gl_Position = projectionMatrix * mv;
462
+ }`
463
+ ), Eo = (
464
+ /* glsl */
465
+ `
466
+ uniform vec3 uWax; uniform vec3 uRim; uniform float uTime;
467
+ varying vec3 vLocal; varying vec3 vLN; varying vec3 vN; varying vec3 vV; varying vec3 vColor; varying float vGlow; varying float vCap;
468
+ void main(){
469
+ float fres = pow(1.0 - abs(dot(normalize(vN), normalize(vV))), 2.0);
470
+ if (vLN.z > 0.5) {
471
+ // front face: pointy-top hexagon, d = 0 at centre → 1 at the wall
472
+ vec2 p = abs(vLocal.xy);
473
+ float d = max(p.x, p.x * 0.5 + p.y * 0.8660254) / 0.8660254;
474
+ float wall = smoothstep(0.78, 0.92, d);
475
+ float lip = smoothstep(0.86, 0.95, d) * (1.0 - smoothstep(0.97, 1.0, d));
476
+ float depth = 1.0 - d * d; // recessed cell: darker toward the walls
477
+ vec3 wax = uWax * (0.55 + 0.6 * depth);
478
+ // honey / light pooled inside the cell, hottest at the centre
479
+ vec3 honey = vColor * (0.25 + 1.05 * depth);
480
+ // capped (entity) cells: a soft wax dome highlight
481
+ float dome = vCap * (1.0 - smoothstep(0.0, 0.8, d)) * 0.10;
482
+ vec3 inner = wax + honey + uRim * dome;
483
+ vec3 rim = uRim * (0.12 + vGlow * 0.6) + vColor * 0.4;
484
+ vec3 col = mix(inner, rim, wall) + uRim * lip * 0.22;
485
+ gl_FragColor = vec4(col, 1.0);
486
+ } else {
487
+ // side walls: dark wax with warm fresnel
488
+ vec3 col = uWax * 0.5 + uRim * fres * 0.18 + vColor * 0.18;
489
+ gl_FragColor = vec4(col, 1.0);
490
+ }
491
+ }`
492
+ );
493
+ function _o() {
494
+ const e = [], t = Math.sqrt(3) * $e, r = 1.5 * $e, a = new o.Vector3(), i = new o.Vector3(0, 0, 1);
495
+ for (let n = -Math.ceil(ke / r) - 1; n <= Math.ceil(ke / r) + 1; n++)
496
+ for (let l = -Math.ceil(Fe / t) - 1; l <= Math.ceil(Fe / t) + 1; l++) {
497
+ const d = l * t + (n & 1 ? t / 2 : 0), p = n * r, f = `${n}:${l}`, v = Math.atan2(p / ke, d / Fe), m = 1 + 0.06 * Math.sin(v * 5 + 1.3) + 0.04 * Math.sin(v * 11 + 0.4) + (Q(f, 3) - 0.5) * 0.05, C = Math.hypot(d / Fe, p / ke);
498
+ if (C > m) continue;
499
+ const h = q((C - (m - 0.16)) / 0.16);
500
+ a.set(0.021 * d, 0.032 * p, 1).normalize();
501
+ const g = new o.Quaternion().setFromUnitVectors(i, a), s = (Q(f, 1) - 0.5) * 0.12 - h * 0.5;
502
+ e.push({ x: d, y: p, z: zt(d, p) + s, q: g, depth: 1.2 * (1 - h * 0.75), edge: h, seed: Q(f, 2) });
503
+ }
504
+ return e;
505
+ }
506
+ function Bo({ galaxy: e }) {
507
+ const t = E(() => ({ nodes: e.nodes.slice(0, Vo), links: e.links }), [e]), r = G([]), a = G([]), i = G(Array(Ue).fill("")), n = E(() => {
508
+ const p = _o(), f = p.length, v = new o.CylinderGeometry(1, 1, wt, 6, 1).rotateX(Math.PI / 2), m = new o.InstancedBufferAttribute(new Float32Array(f * 3), 3), C = new o.InstancedBufferAttribute(new Float32Array(f), 1), h = new o.InstancedBufferAttribute(new Float32Array(f), 1);
509
+ v.setAttribute("aColor", m), v.setAttribute("aGlow", C), v.setAttribute("aCap", h);
510
+ const g = new o.ShaderMaterial({
511
+ uniforms: { uWax: { value: new o.Color("#1e1005") }, uRim: { value: new o.Color("#ffae3b") }, uTime: { value: 0 } },
512
+ vertexShader: Ro,
513
+ fragmentShader: Eo
514
+ }), s = new o.InstancedMesh(v, g, f), F = new o.Object3D(), K = new Float32Array(f * 3), x = new o.Vector3();
515
+ p.forEach((w, P) => {
516
+ x.set(0, 0, 1).applyQuaternion(w.q), F.position.set(w.x, w.y, w.z).addScaledVector(x, -(wt * w.depth) / 2), F.quaternion.copy(w.q), F.scale.set($e * 0.93, $e * 0.93, w.depth), F.updateMatrix(), s.setMatrixAt(P, F.matrix), K.set([w.x, w.y, w.z + 0.05], P * 3);
517
+ }), s.instanceMatrix.needsUpdate = !0, s.frustumCulled = !1;
518
+ const k = p.map((w, P) => ({ i: P, s: w.seed })).filter(({ i: w }) => p[w].edge < 0.2);
519
+ k.sort((w, P) => w.s - P.s);
520
+ const y = Math.min(t.nodes.length, Math.floor(k.length * 0.34)), S = new Int32Array(y), M = Array.from({ length: f }, () => new o.Color()), A = new Float32Array(f), b = new Uint8Array(f), Y = new o.Color();
521
+ for (let w = 0; w < f; w++) {
522
+ const P = p[w];
523
+ P.seed > 0.62 && P.edge < 0.5 ? (b[w] = 1, M[w].copy(ve).multiplyScalar(0.07 + 0.08 * Q(String(w), 5))) : M[w].copy(_e).multiplyScalar(0.012);
524
+ }
525
+ for (let w = 0; w < y; w++) {
526
+ const P = k[w].i;
527
+ S[w] = P, h.setX(P, 1), Y.set(Xt[t.nodes[w].kind] ?? "#f59e0b").lerp(ve, 0.65), M[P].copy(Y).multiplyScalar(0.085), A[P] = 0.1, b[P] = 0;
528
+ }
529
+ h.needsUpdate = !0;
530
+ const D = new Map(t.nodes.slice(0, y).map((w, P) => [w.id, P])), B = Array.from({ length: y }, () => []);
531
+ for (const w of t.links) {
532
+ const P = D.get(w.source), _ = D.get(w.target);
533
+ P === void 0 || _ === void 0 || P === _ || (B[P].length < 4 && B[P].push(_), B[_].length < 4 && B[_].push(P));
534
+ }
535
+ const H = new o.BufferGeometry();
536
+ H.setAttribute("position", new o.BufferAttribute(new Float32Array(De * Ae * 2 * 3), 3)), H.setAttribute("color", new o.BufferAttribute(new Float32Array(De * Ae * 2 * 3), 3)), H.boundingSphere = new o.Sphere(new o.Vector3(), 1e4);
537
+ const $ = new o.BufferGeometry();
538
+ return $.setAttribute("position", new o.BufferAttribute(new Float32Array(rt * ze * 2 * 3), 3)), $.setAttribute("color", new o.BufferAttribute(new Float32Array(rt * ze * 2 * 3), 3)), $.boundingSphere = new o.Sphere(new o.Vector3(), 1e4), { cells: p, N: f, mesh: s, mat: g, aColor: m, aGlow: C, front: K, nodeCell: S, nNodes: y, baseC: M, baseG: A, honeyCell: b, adj: B, beams: H, links: $, acc: Array.from({ length: f }, () => new o.Color()), glow: new Float32Array(f), fire: new Float32Array(y) };
539
+ }, [t]), l = E(
540
+ () => ({
541
+ ripples: [],
542
+ seenLlm: /* @__PURE__ */ new Map(),
543
+ idx: /* @__PURE__ */ new Map(),
544
+ arrows: new Ye(De),
545
+ beamMat: ct(),
546
+ linkMat: ct(),
547
+ a: new o.Vector3(),
548
+ b: new o.Vector3(),
549
+ m: new o.Vector3(),
550
+ p: new o.Vector3(),
551
+ c: new o.Color(),
552
+ aura: be(new o.Color("#ff9a1f").multiplyScalar(0.16)),
553
+ aura2: be(new o.Color("#ffcf6b").multiplyScalar(0.09))
554
+ }),
555
+ []
556
+ ), d = (p) => {
557
+ let f = l.idx.get(p);
558
+ return f === void 0 && l.idx.set(p, f = n.nNodes ? Yt({ nodes: t.nodes.slice(0, n.nNodes) }, p) : -1), f;
559
+ };
560
+ return te(({ clock: p }) => {
561
+ const f = performance.now(), v = fe ? 0 : p.elapsedTime, { cells: m, N: C, acc: h, glow: g, baseC: s, baseG: F, honeyCell: K, front: x, nodeCell: k, fire: y } = n, { a: S, b: M, m: A, p: b, c: Y, arrows: D, ripples: B } = l;
562
+ for (const c of R.instances.values()) {
563
+ const z = l.seenLlm.get(c.id);
564
+ if (!z) {
565
+ l.seenLlm.set(c.id, { calls: c.llmCalls, tokens: c.tokens });
566
+ continue;
567
+ }
568
+ if (c.llmCalls > z.calls) {
569
+ const N = c.tokens - z.tokens, L = se.get(c.id);
570
+ L && B.length < To && B.push({ x: L.x, y: L.y, start: f, r: 1.8 + Math.min(6.5, N / 650), dur: 1900 + Math.min(1400, N / 3), c: new o.Color().copy(ve).lerp(Xe[c.type], 0.3), k: 0.9 + Math.min(1.2, N / 3e3) }), z.calls = c.llmCalls, z.tokens = c.tokens;
571
+ }
572
+ }
573
+ if (l.seenLlm.size > 400)
574
+ for (const c of l.seenLlm.keys()) R.instances.has(c) || l.seenLlm.delete(c);
575
+ for (let c = B.length - 1; c >= 0; c--) f - B[c].start > B[c].dur && B.splice(c, 1);
576
+ for (let c = 0; c < C; c++)
577
+ h[c].copy(s[c]), K[c] && h[c].multiplyScalar(0.75 + 0.35 * Math.sin(v * 0.5 + m[c].x * 0.22 + m[c].y * 0.31 + m[c].seed * 3)), g[c] = F[c];
578
+ for (const c of B) {
579
+ const z = (f - c.start) / c.dur, N = c.r * qe(z * 1.6), L = (1 - z) * (1 - z), V = (c.r + 1) * (c.r + 1);
580
+ for (let ee = 0; ee < C; ee++) {
581
+ const U = m[ee].x - c.x, T = m[ee].y - c.y, O = U * U + T * T;
582
+ if (O > V) continue;
583
+ const ce = Math.sqrt(O), pe = ce < N ? Math.pow(1 - ce / (c.r + 0.6), 1.5) * 0.85 : 0, ae = Math.exp(-(((ce - N) / 0.7) ** 2)), ne = (pe + ae * 0.9) * L * c.k;
584
+ ne < 0.01 || (He(h[ee], c.c, ne), g[ee] += ne * 0.8);
585
+ }
586
+ }
587
+ y.fill(0);
588
+ const H = n.beams.getAttribute("position"), $ = n.beams.getAttribute("color"), w = n.links.getAttribute("position"), P = n.links.getAttribute("color");
589
+ let _ = 0, le = 0;
590
+ D.begin();
591
+ const Ge = R.flares;
592
+ for (let c = Math.max(0, Ge.length - Go); c < Ge.length; c++) {
593
+ const z = Ge[c], N = d(z.node);
594
+ if (N < 0) continue;
595
+ const L = k[N], V = (f - z.start) / 1e3, ee = R.instances.get(z.instance), U = z.op === "write", T = U ? ge : ee ? Xe[ee.type] : re, O = V < 0.3 ? V / 0.3 : Math.exp(-(V - 0.3) * 1.1);
596
+ if (O > y[N] && (y[N] = O), He(h[L], T, O * (U ? 2.6 : 1.9)), g[L] += O * 1.6, U) {
597
+ const ae = m[L].x, ne = m[L].y, ue = 1.2 + qe(V / 1.2) * 1.6;
598
+ for (let X = 0; X < C; X++) {
599
+ const I = m[X].x - ae, W = m[X].y - ne;
600
+ if (Math.abs(I) > 3.2 || Math.abs(W) > 3.2 || X === L) continue;
601
+ const j = Math.hypot(I, W), Z = Math.exp(-(((j - ue) / 0.6) ** 2)) * O * 0.6;
602
+ Z > 0.01 && (He(h[X], ve, Z), g[X] += Z * 0.5);
603
+ }
604
+ }
605
+ const ce = n.adj[N];
606
+ for (let ae = 0; ae < ce.length && le < rt; ae++) {
607
+ const ne = k[ce[ae]], ue = O * 0.55;
608
+ if (ue < 0.02) break;
609
+ S.set(x[L * 3], x[L * 3 + 1], x[L * 3 + 2] + 0.12), M.set(x[ne * 3], x[ne * 3 + 1], x[ne * 3 + 2] + 0.12), A.copy(S).add(M).multiplyScalar(0.5), A.z += 0.5 + S.distanceTo(M) * 0.08;
610
+ const X = q(V * 1.4);
611
+ for (let I = 0; I < ze; I++)
612
+ for (let W = 0; W < 2; W++) {
613
+ const j = (I + W) / ze, Z = 1 - j;
614
+ b.set(Z * Z * S.x + 2 * Z * j * A.x + j * j * M.x, Z * Z * S.y + 2 * Z * j * A.y + j * j * M.y, Z * Z * S.z + 2 * Z * j * A.z + j * j * M.z);
615
+ const Ce = (le * ze + I) * 2 + W;
616
+ w.setXYZ(Ce, b.x, b.y, b.z);
617
+ const Je = ue * (j <= X ? 0.35 + Math.exp(-(((j - X) / 0.12) ** 2)) * 1.2 : 0);
618
+ P.setXYZ(Ce, re.r * Je, re.g * Je, re.b * Je);
619
+ }
620
+ He(h[ne], re, ue * 0.5 * X), le++;
621
+ }
622
+ const pe = se.get(z.instance);
623
+ if (pe && V < 2.2 && _ < De) {
624
+ M.set(x[L * 3], x[L * 3 + 1], x[L * 3 + 2]), A.copy(pe).add(M).multiplyScalar(0.5), A.z += 1.2;
625
+ const ae = Math.min(1, V / 0.25) * (1 - V / 2.2) ** 1.5, ne = U ? Math.min(1, V * 0.9) : 1 - Math.min(1, V * 0.9);
626
+ for (let ue = 0; ue < Ae; ue++)
627
+ for (let X = 0; X < 2; X++) {
628
+ const I = (ue + X) / Ae, W = 1 - I;
629
+ b.set(W * W * pe.x + 2 * W * I * A.x + I * I * M.x, W * W * pe.y + 2 * W * I * A.y + I * I * M.y, W * W * pe.z + 2 * W * I * A.z + I * I * M.z);
630
+ const j = (_ * Ae + ue) * 2 + X;
631
+ H.setXYZ(j, b.x, b.y, b.z);
632
+ const Z = Math.exp(-(((I - ne) / 0.09) ** 2)) * 1.4, Ce = ae * ((U ? 0.4 : 0.18) + Z) * 0.8;
633
+ $.setXYZ(j, T.r * Ce, T.g * Ce, T.b * Ce);
634
+ }
635
+ U ? D.add(pe, A, M, 0.9, 1, 0.4, T, ae * 1.2) : D.add(pe, A, M, 0.1, -1, 0.4, T, ae * 1.4), _++;
636
+ }
637
+ }
638
+ n.beams.setDrawRange(0, _ * Ae * 2), n.links.setDrawRange(0, le * ze * 2), H.needsUpdate = $.needsUpdate = w.needsUpdate = P.needsUpdate = !0, D.end();
639
+ const me = n.aColor.array, pt = n.aGlow.array;
640
+ for (let c = 0; c < C; c++) {
641
+ const z = Math.max(h[c].r, h[c].g, h[c].b);
642
+ z > 1.4 && h[c].multiplyScalar((1.4 + (z - 1.4) * 0.25) / z), me[c * 3] = h[c].r, me[c * 3 + 1] = h[c].g, me[c * 3 + 2] = h[c].b, pt[c] = g[c];
643
+ }
644
+ n.aColor.needsUpdate = !0, n.aGlow.needsUpdate = !0;
645
+ let oe = 0;
646
+ for (let c = R.flares.length - 1; c >= 0 && oe < Ue; c--) {
647
+ const z = R.flares[c];
648
+ if (f - z.start > 2300) break;
649
+ let N = !1;
650
+ for (let O = 0; O < oe; O++) i.current[O] === z.node && (N = !0);
651
+ if (N) continue;
652
+ const L = d(z.node);
653
+ if (L < 0) continue;
654
+ const V = k[L];
655
+ let ee = !1;
656
+ for (let O = 0; O < oe; O++) {
657
+ const ce = a.current[O];
658
+ ce && Math.abs(ce.position.y - x[V * 3 + 1]) < 0.7 && Math.abs(ce.position.x - x[V * 3]) < 3.4 && (ee = !0);
659
+ }
660
+ if (ee) continue;
661
+ const U = r.current[oe], T = a.current[oe];
662
+ U && T && (T.position.set(x[V * 3], x[V * 3 + 1], x[V * 3 + 2] + 0.3), i.current[oe] !== z.node + z.op && (U.setText(`${z.op === "write" ? "wrote" : "read"} · ${z.node}`), U.setColor(z.op === "write" ? "#fff3d6" : "#ffb627")), U.setOpacity(1)), i.current[oe] = z.node, oe++;
663
+ }
664
+ for (let c = oe; c < Ue; c++) {
665
+ const z = r.current[c];
666
+ z == null || z.setOpacity(0), i.current[c] = "";
667
+ }
668
+ }), /* @__PURE__ */ J(ie, { children: [
669
+ /* @__PURE__ */ u("sprite", { material: l.aura, scale: [60, 40, 1], position: [0, 0, -8] }),
670
+ /* @__PURE__ */ u("sprite", { material: l.aura2, scale: [30, 22, 1], position: [0, 0, -5] }),
671
+ /* @__PURE__ */ u("primitive", { object: n.mesh }),
672
+ /* @__PURE__ */ u("lineSegments", { geometry: n.links, material: l.linkMat, frustumCulled: !1 }),
673
+ /* @__PURE__ */ u("lineSegments", { geometry: n.beams, material: l.beamMat, frustumCulled: !1 }),
674
+ /* @__PURE__ */ u("primitive", { object: l.arrows.mesh }),
675
+ Array.from({ length: Ue }, (p, f) => /* @__PURE__ */ u("group", { ref: (v) => void (a.current[f] = v), children: /* @__PURE__ */ u(Be, { ref: (v) => void (r.current[f] = v), text: "", offset: [0, 0.42], size: 0.24, opacity: 0, fadeMs: 250, pxRange: [8, 12] }) }, f)),
676
+ /* @__PURE__ */ u(qt, { position: [0, -ke - 0.6, zt(0, ke) + 0.5], prefix: "comb = ", color: "#f59e0b", size: 0.26, opacity: 0.75, pxRange: [8, 12] })
677
+ ] });
678
+ }
679
+ const Lo = { db: "⛁", warehouse: "▤", spark: "✷", api: "⇄", storage: "▣", queue: "≡" };
680
+ function Tt(e) {
681
+ return new o.ShaderMaterial({
682
+ uniforms: { uColor: { value: e.clone() }, uGlow: { value: 0.2 }, uHead: { value: -1 }, uHeadK: { value: 0 } },
683
+ vertexShader: (
684
+ /* glsl */
685
+ `
686
+ varying float vU; varying vec3 vN; varying vec3 vV; varying float vY;
687
+ void main(){
688
+ vU = position.x * 0.5 + 0.5; vY = position.y; // 0 = base (heart), 1 = tip
689
+ vec4 mv = modelViewMatrix * vec4(position, 1.0);
690
+ vN = normalize(normalMatrix * normal); vV = normalize(-mv.xyz);
691
+ gl_Position = projectionMatrix * mv;
692
+ }`
693
+ ),
694
+ fragmentShader: (
695
+ /* glsl */
696
+ `
697
+ uniform vec3 uColor; uniform float uGlow; uniform float uHead; uniform float uHeadK;
698
+ varying float vU; varying vec3 vN; varying vec3 vV; varying float vY;
699
+ void main(){
700
+ float fres = pow(1.0 - abs(dot(normalize(vN), normalize(vV))), 1.8);
701
+ float vein = exp(-vY * vY / 0.004) * 0.35;
702
+ float body = 0.25 + 0.75 * smoothstep(0.0, 0.9, vU);
703
+ float head = uHead >= 0.0 ? exp(-pow((vU - uHead) / 0.12, 2.0)) * uHeadK : 0.0;
704
+ vec3 col = uColor * (uGlow * (body * 0.55 + fres * 1.1 + vein) + head * 2.2) + vec3(1.0, 0.95, 0.85) * head * 0.6;
705
+ gl_FragColor = vec4(col, 1.0);
706
+ }`
707
+ ),
708
+ transparent: !0,
709
+ depthWrite: !1,
710
+ blending: o.AdditiveBlending
711
+ });
712
+ }
713
+ function Oo({ srv: e, res: t, k: r, n: a }) {
714
+ const i = Vt(e.slot, r, a), n = E(() => Le(e.slot, new o.Vector3()), [e.slot]), l = E(() => fo(e.slot, r, a, new o.Vector3()), [e.slot, r, a]), d = E(() => new o.Color(e.color).lerp(ve, 0.25), [e.color]), p = E(() => Tt(d), [d]), f = E(() => be(d), [d]), v = G(null), m = G(null), C = G(null), h = G("");
715
+ te(({ clock: s }) => {
716
+ const F = performance.now(), K = fe ? 0 : s.elapsedTime, x = t.inflight > 0, k = Math.exp(-((F - t.activeAt) / 1e3) * 1.4);
717
+ let y = null;
718
+ for (const b of R.mcpCalls) b.server === e.name && b.resource === t.name && (!y || b.start > y.start) && (y = b);
719
+ const S = y ? (F - y.start) / y.dur : 9, M = x ? 0.5 + 0.5 * Math.sin(s.elapsedTime * 5) : 0;
720
+ if (p.uniforms.uGlow.value = x ? 1.1 + M * 0.5 : 0.28 + k * 0.8, y && S < 1 ? (p.uniforms.uHead.value = y.phase === "call" ? de(S) : 1 - de(S), p.uniforms.uHeadK.value = 1 - S * 0.4) : x ? (p.uniforms.uHead.value = K * 0.7 % 1, p.uniforms.uHeadK.value = 0.6) : p.uniforms.uHeadK.value = 0, v.current) {
721
+ const b = x ? 1.12 + M * 0.04 : 1 + k * 0.06;
722
+ v.current.scale.set(b, 1, 1), v.current.rotation.z = i + Math.sin(K * 0.5 + r * 1.7) * 0.03;
723
+ }
724
+ m.current && (m.current.scale.setScalar(x ? 3.4 + M * 0.6 : 1.8 + k * 1.2), f.color.copy(d).multiplyScalar(x ? 0.32 + M * 0.15 : 0.03 + k * 0.18));
725
+ let A = `${Lo[t.kind] ?? "•"} ${t.name}`;
726
+ if (x) {
727
+ let b = "";
728
+ for (const Y of R.mcpPending.values()) Y.server === e.name && Y.resource === t.name && (b = Y.tool);
729
+ A = `${t.name} ▶ ${b || "query"}()`;
730
+ } else y && y.phase === "result" && F - y.start < 1800 && (A = `${t.name} ✓ returned`);
731
+ C.current && (A !== h.current && (C.current.setText(A), h.current = A), C.current.setOpacity(x ? 1 : 0.6 + k * 0.4), C.current.setEmphasis(x));
732
+ });
733
+ const g = Math.cos(i) >= 0 ? 1 : -1;
734
+ return /* @__PURE__ */ J(ie, { children: [
735
+ /* @__PURE__ */ u("group", { position: n, children: /* @__PURE__ */ u("group", { ref: v, rotation: [0, 0, i], children: /* @__PURE__ */ u("mesh", { geometry: we, material: p, position: [Te * 0.98, 0, 0.05], scale: [Te, 0.52, 0.12] }) }) }),
736
+ /* @__PURE__ */ u("sprite", { ref: m, material: f, position: [n.x + Math.cos(i) * Te, n.y + Math.sin(i) * Te, n.z] }),
737
+ /* @__PURE__ */ u(
738
+ Be,
739
+ {
740
+ ref: C,
741
+ position: [l.x + g * 0.15, l.y + (Math.sin(i) >= 0 ? 0.45 : -0.45), l.z],
742
+ text: t.name,
743
+ color: e.color,
744
+ size: 0.2,
745
+ opacity: 0.6,
746
+ pxRange: [7.5, 11.5],
747
+ renderOrder: 18
748
+ }
749
+ )
750
+ ] });
751
+ }
752
+ const yt = 8, at = 34;
753
+ function Fo({ srv: e }) {
754
+ const t = E(() => Le(e.slot, new o.Vector3()), [e.slot]), r = E(() => new o.Color(e.color).lerp(ve, 0.25), [e.color]), a = E(() => {
755
+ const f = At("#6b7a1f", 0.09, 0);
756
+ f.uniforms.uP0.value.copy(t);
757
+ const v = Math.sign(t.x || 1);
758
+ f.uniforms.uP2.value.set(t.x + v * 1.5, t.y - 9, t.z - 2.5), f.uniforms.uP1.value.set(t.x - v * 0.4, t.y - 4, t.z - 0.5), f.uniforms.uOpacity.value = 0.32;
759
+ const m = Tt(new o.Color("#c2410c").lerp(r, 0.3));
760
+ m.uniforms.uGlow.value = 0.16;
761
+ const C = new o.InstancedMesh(we, new o.MeshBasicMaterial({ color: re.clone().multiplyScalar(0.7), toneMapped: !1 }), at), h = new o.Object3D();
762
+ for (let g = 0; g < at; g++) {
763
+ const s = 0.62 * Math.sqrt((g + 0.5) / at), F = g * 2.39996;
764
+ h.position.set(Math.cos(F) * s, Math.sin(F) * s, 0.22 + 0.12 * (1 - s)), h.scale.setScalar(0.055 + 0.03 * (1 - s)), h.updateMatrix(), C.setMatrixAt(g, h.matrix);
765
+ }
766
+ return { stem: f, sepal: m, seeds: C, disc: new o.MeshBasicMaterial({ color: new o.Color("#3a1d06"), toneMapped: !1 }), heart: be(r), halo: be(r) };
767
+ }, [t, r]), i = G(null), n = G(null), [l, d] = xe([]), p = G(0);
768
+ return te(({ clock: f }) => {
769
+ var h;
770
+ e.resources.size !== p.current && (p.current = e.resources.size, d([...e.resources.values()]));
771
+ const v = performance.now(), m = e.inflight > 0, C = Math.exp(-((v - e.activeAt) / 1e3) * 1.4);
772
+ a.halo.color.copy(r).multiplyScalar(m ? 0.3 : 0.08 + C * 0.18), (h = i.current) == null || h.scale.setScalar(m ? 7 : 5.5), a.seeds.material.color.copy(re).multiplyScalar(m ? 1.4 : 0.6 + C * 0.6), n.current && (n.current.rotation.z = (fe ? 0 : f.elapsedTime) * (m ? 0.5 : 0.08));
773
+ }), /* @__PURE__ */ J(ie, { children: [
774
+ /* @__PURE__ */ u("mesh", { geometry: Ct, material: a.stem, frustumCulled: !1 }),
775
+ /* @__PURE__ */ J("group", { position: t, children: [
776
+ /* @__PURE__ */ u("sprite", { ref: i, material: a.halo, position: [0, 0, -0.4] }),
777
+ Array.from({ length: yt }, (f, v) => /* @__PURE__ */ u("group", { rotation: [0, 0, v / yt * Math.PI * 2 + 0.2], children: /* @__PURE__ */ u("mesh", { geometry: we, material: a.sepal, position: [0.85, 0, -0.25], scale: [0.85, 0.3, 0.08] }) }, v)),
778
+ /* @__PURE__ */ u("mesh", { geometry: we, material: a.disc, scale: [0.72, 0.72, 0.28] }),
779
+ /* @__PURE__ */ u("group", { ref: n, children: /* @__PURE__ */ u("primitive", { object: a.seeds }) }),
780
+ /* @__PURE__ */ u(Be, { position: [0, t.y < 0 ? -1.2 : 1.25, 0], text: `MCP · ${e.name}`, color: e.color, size: 0.28, pxRange: [9, 13] })
781
+ ] }),
782
+ l.map((f, v) => /* @__PURE__ */ u(Oo, { srv: e, res: f, k: v, n: l.length }, f.name))
783
+ ] });
784
+ }
785
+ const We = 24, Pe = 40, Re = 3;
786
+ function No() {
787
+ const e = E(() => {
788
+ const i = new o.BufferGeometry();
789
+ return i.setAttribute("position", new o.BufferAttribute(new Float32Array(We * Re * Pe * 2 * 3), 3)), i.setAttribute("color", new o.BufferAttribute(new Float32Array(We * Re * Pe * 2 * 3), 3)), i.boundingSphere = new o.Sphere(new o.Vector3(), 1e4), i;
790
+ }, []), t = E(() => ct(), []), r = E(() => new Ye(We), []), a = E(() => ({ a: new o.Vector3(), b: new o.Vector3(), c: new o.Vector3(), p: new o.Vector3(), col: new o.Color(), k: new o.Color() }), []);
791
+ return te(({ clock: i }) => {
792
+ const n = performance.now(), l = fe ? 0 : i.elapsedTime, d = e.getAttribute("position"), p = e.getAttribute("color");
793
+ let f = 0;
794
+ r.begin();
795
+ const v = (m, C, h, g) => {
796
+ if (f >= We) return;
797
+ const s = se.get(m), F = R.mcpServers.get(C);
798
+ if (!s || !F) return;
799
+ const { a: K, b: x, c: k, p: y, col: S, k: M } = a;
800
+ K.copy(s), Le(F.slot, x), Qe(K, x, 1.4, k), S.set(F.color).lerp(_e, 0.4);
801
+ let A;
802
+ h === 0 ? (S.lerp(_e, q(g / 1.2)), g > 1.2 && S.lerp(je, q((g - 1.2) / 1)), A = (0.25 + Math.min(0.6, g * 0.25)) * qe(g / 0.3)) : (M.copy(S).lerp(ge, 0.45), A = 1.3 * (g < 0.75 ? 1 : 1 - (g - 0.75) / 0.25));
803
+ const b = 1 - de(g / 0.75), Y = h === 0 ? 0.03 : 0.07;
804
+ for (let D = 0; D < Re; D++) {
805
+ const B = (D - 1) * Y;
806
+ for (let H = 0; H < Pe; H++)
807
+ for (let $ = 0; $ < 2; $++) {
808
+ const w = (H + $) / Pe;
809
+ ye(K, k, x, w, y);
810
+ const P = ((f * Re + D) * Pe + H) * 2 + $;
811
+ d.setXYZ(P, y.x + B, y.y - B, y.z + B * 0.5);
812
+ let _;
813
+ h === 0 ? _ = A * (0.25 + Math.pow(Math.max(0, Math.sin(w * 22 - l * 2.4)), 8) * 1.5) * (D === 1 ? 1 : 0.25) : _ = A * (0.25 + Math.exp(-(((w - b) / 0.07) ** 2)) * 3.2 * (g < 0.8 ? 1 : 0)) * (D === 1 ? 1 : 0.6);
814
+ const le = h === 0 ? S : M;
815
+ p.setXYZ(P, le.r * _, le.g * _, le.b * _);
816
+ }
817
+ }
818
+ h === 0 ? r.add(K, k, x, 0.9, 1, 0.48, S, 0.4 + A * 1.4) : r.add(K, k, x, 0.08, -1, 0.62, M, A * 1.6), f++;
819
+ };
820
+ for (const m of R.mcpPending.values()) v(m.instance, m.server, 0, Mt(m, n));
821
+ for (const m of R.mcpCalls) m.phase === "result" && v(m.instance, m.server, 1, q((n - m.start) / m.dur));
822
+ e.setDrawRange(0, f * Re * Pe * 2), d.needsUpdate = !0, p.needsUpdate = !0, r.end();
823
+ }), /* @__PURE__ */ J(ie, { children: [
824
+ /* @__PURE__ */ u("lineSegments", { geometry: e, material: t, frustumCulled: !1 }),
825
+ /* @__PURE__ */ u("primitive", { object: r.mesh })
826
+ ] });
827
+ }
828
+ function Ho({ call: e }) {
829
+ const t = R.mcpServers.get(e.server), r = E(() => be(new o.Color((t == null ? void 0 : t.color) ?? "#fff").lerp(so, 0.4).multiplyScalar(1.7)), [t]), a = G(null), i = E(() => ({ a: new o.Vector3(), b: new o.Vector3(), c: new o.Vector3(), h: new o.Vector3() }), []);
830
+ return te(() => {
831
+ const n = se.get(e.instance);
832
+ if (!a.current) return;
833
+ if (!n || !t) return void (a.current.visible = !1);
834
+ i.a.copy(n), Le(t.slot, i.b), Qe(i.a, i.b, 1.4, i.c);
835
+ const l = q((performance.now() - e.start) / (e.phase === "call" ? e.dur : e.dur * 0.75));
836
+ ye(i.a, i.c, i.b, e.phase === "call" ? de(l) : 1 - de(l), i.h), a.current.visible = l < 1, a.current.position.copy(i.h), a.current.scale.setScalar(1);
837
+ }), /* @__PURE__ */ u("sprite", { ref: a, material: r, visible: !1 });
838
+ }
839
+ const Io = 32;
840
+ function Do() {
841
+ const [e, t] = xe([]), [r, a] = xe([]), i = G({ s: -1, n: -1, first: -1, last: -1 });
842
+ return te(() => {
843
+ const n = i.current;
844
+ R.mcpServers.size !== n.s && (n.s = R.mcpServers.size, t([...R.mcpServers.values()]));
845
+ const l = R.mcpCalls, d = l.length ? l[0].id : -1, p = l.length ? l[l.length - 1].id : -1;
846
+ if (l.length !== n.n || d !== n.first || p !== n.last) {
847
+ n.n = l.length, n.first = d, n.last = p;
848
+ const f = [];
849
+ for (let v = l.length - 1; v >= 0 && f.length < Io; v--) se.has(l[v].instance) && f.push(l[v]);
850
+ a(f);
851
+ }
852
+ }), /* @__PURE__ */ J(ie, { children: [
853
+ e.map((n) => /* @__PURE__ */ u(Fo, { srv: n }, n.name)),
854
+ r.map((n) => /* @__PURE__ */ u(Ho, { call: n }, n.id)),
855
+ /* @__PURE__ */ u(No, {})
856
+ ] });
857
+ }
858
+ function Uo({ run: e }) {
859
+ const t = E(() => new o.Color(e.color).lerp(ve, 0.55), [e.color]), r = E(() => be("#000"), []), a = G(null), i = G(null), n = E(() => new o.Vector3(), []);
860
+ return te(({ clock: l }) => {
861
+ var m;
862
+ const d = performance.now();
863
+ Pt(e.id, n);
864
+ const p = qe((d - e.startedAt) / 1200), f = e.endedAt ? q(1 - (d - e.endedAt - (Zt - 2500)) / 2500) : 1, v = 0.9 + 0.1 * Math.sin((fe ? 0 : l.elapsedTime) * 0.6 + e.slot);
865
+ r.color.copy(t).multiplyScalar(0.2 * p * f * v), a.current && (a.current.position.set(n.x, n.y, -1.2), a.current.scale.set(15, 11, 1)), (m = i.current) == null || m.position.set(n.x, n.y + 2.9, n.z);
866
+ }), /* @__PURE__ */ J(ie, { children: [
867
+ /* @__PURE__ */ u("sprite", { ref: a, material: r }),
868
+ /* @__PURE__ */ u("group", { ref: i, children: /* @__PURE__ */ u(Wo, { run: e }) })
869
+ ] });
870
+ }
871
+ function Wo({ run: e }) {
872
+ Qt();
873
+ const t = e.status !== "started";
874
+ return /* @__PURE__ */ u(
875
+ Be,
876
+ {
877
+ text: e.topic,
878
+ secondary: Jt(e, { base: "#c8b28a", current: "#ffd166", done: "#f1e4c8" }, ["swarm working…", "swarm home"]),
879
+ color: e.color,
880
+ size: 0.34,
881
+ maxWidth: 9,
882
+ opacity: t ? 0.5 : 1,
883
+ fadeMs: 400,
884
+ pxRange: [10, 15]
885
+ }
886
+ );
887
+ }
888
+ function jo() {
889
+ const [e, t] = xe([]), r = G(/* @__PURE__ */ new Set()), a = G(-1);
890
+ return te(() => {
891
+ const i = R.runs;
892
+ let n = i.size !== r.current.size || a.current !== Se.version;
893
+ if (!n)
894
+ for (const l of i.keys()) r.current.has(l) || (n = !0);
895
+ n && (r.current = new Set(i.keys()), a.current = Se.version, t([...i.values()].filter((l) => $t(l.id))));
896
+ }), /* @__PURE__ */ u(ie, { children: e.map((i) => /* @__PURE__ */ u(Uo, { run: i }, i.id)) });
897
+ }
898
+ const st = fe ? 220 : 520;
899
+ function Ko() {
900
+ const { geo: e, mat: t } = E(() => {
901
+ const r = new Float32Array(st * 3), a = new Float32Array(st);
902
+ for (let l = 0; l < st; l++)
903
+ r.set([(Math.random() - 0.5) * 60, (Math.random() - 0.5) * 36, -4 + Math.random() * 14], l * 3), a[l] = Math.random();
904
+ const i = new o.BufferGeometry();
905
+ i.setAttribute("position", new o.BufferAttribute(r, 3)), i.setAttribute("aSeed", new o.BufferAttribute(a, 1)), i.boundingSphere = new o.Sphere(new o.Vector3(), 1e4);
906
+ const n = new o.ShaderMaterial({
907
+ uniforms: { uTime: { value: 0 }, uScale: { value: 300 } },
908
+ vertexShader: (
909
+ /* glsl */
910
+ `
911
+ attribute float aSeed; uniform float uTime; uniform float uScale; varying float vA;
912
+ void main(){
913
+ vec3 p = position;
914
+ float t = uTime * (0.15 + aSeed * 0.2);
915
+ p.y = mod(p.y + 18.0 + t * 1.2, 36.0) - 18.0;
916
+ p.x += sin(t * 1.3 + aSeed * 40.0) * 0.8;
917
+ p.z += cos(t + aSeed * 20.0) * 0.5;
918
+ vec4 mv = modelViewMatrix * vec4(p, 1.0);
919
+ vA = (0.35 + 0.65 * fract(aSeed * 7.3)) * (0.6 + 0.4 * sin(uTime * (0.8 + aSeed) + aSeed * 30.0));
920
+ gl_PointSize = (0.05 + aSeed * 0.09) * uScale / -mv.z;
921
+ gl_Position = projectionMatrix * mv;
922
+ }`
923
+ ),
924
+ fragmentShader: (
925
+ /* glsl */
926
+ `
927
+ varying float vA;
928
+ void main(){ float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
929
+ gl_FragColor = vec4(vec3(1.0, 0.72, 0.3) * pow(1.0 - r, 2.0) * vA * 0.9, 1.0); }`
930
+ ),
931
+ transparent: !0,
932
+ depthWrite: !1,
933
+ blending: o.AdditiveBlending
934
+ });
935
+ return { geo: i, mat: n };
936
+ }, []);
937
+ return te(({ clock: r, size: a, gl: i }) => {
938
+ t.uniforms.uTime.value = fe ? 0 : r.elapsedTime, t.uniforms.uScale.value = a.height * i.getPixelRatio();
939
+ }), /* @__PURE__ */ u("points", { geometry: e, material: t, frustumCulled: !1 });
940
+ }
941
+ function Xo() {
942
+ return te(() => {
943
+ oo(), no();
944
+ }), null;
945
+ }
946
+ function qo({ children: e }) {
947
+ return /* @__PURE__ */ u("group", { position: [-1.6, 0.4, 0], children: e });
948
+ }
949
+ function nn() {
950
+ const e = eo(), [t, r] = xe(null);
951
+ return /* @__PURE__ */ J("div", { className: "scene-root", style: { background: "#080402" }, children: [
952
+ /* @__PURE__ */ J(_t, { camera: { position: [0, -1.5, 38], fov: 45 }, dpr: [1, 2], gl: { antialias: !1, powerPreference: "high-performance" }, onPointerMissed: () => r(null), children: [
953
+ /* @__PURE__ */ u("color", { attach: "background", args: ["#080402"] }),
954
+ /* @__PURE__ */ u("fog", { attach: "fog", args: ["#080402", 40, 90] }),
955
+ /* @__PURE__ */ u(Xo, {}),
956
+ /* @__PURE__ */ u(Ko, {}),
957
+ /* @__PURE__ */ J(qo, { children: [
958
+ /* @__PURE__ */ u(Bo, { galaxy: e }),
959
+ /* @__PURE__ */ u(jo, {}),
960
+ /* @__PURE__ */ u(Co, { onSelect: r }),
961
+ /* @__PURE__ */ u(zo, {}),
962
+ /* @__PURE__ */ u(ho, {}),
963
+ /* @__PURE__ */ u(Do, {})
964
+ ] }),
965
+ /* @__PURE__ */ u(Et, { makeDefault: !0, enablePan: !1, enableDamping: !0, dampingFactor: 0.06, minDistance: 14, maxDistance: 52, minPolarAngle: Math.PI * 0.25, maxPolarAngle: Math.PI * 0.72, minAzimuthAngle: -0.9, maxAzimuthAngle: 0.9 }),
966
+ /* @__PURE__ */ J(Bt, { multisampling: 0, children: [
967
+ /* @__PURE__ */ u(Lt, { mipmapBlur: !0, intensity: 1.15, luminanceThreshold: 0.22, luminanceSmoothing: 0.3, radius: 0.78 }),
968
+ /* @__PURE__ */ u(Ot, { eskil: !1, offset: 0.2, darkness: 0.88 })
969
+ ] })
970
+ ] }),
971
+ /* @__PURE__ */ u(
972
+ to,
973
+ {
974
+ title: "hive · glowing honeycomb",
975
+ subtitle: "♛ queens = agents, workers = subagents flying out along their flight paths · LLM calls flood the comb with honey light · the comb is the knowledge graph · ✿ MCP flowers, one petal per backend",
976
+ selected: t,
977
+ onClose: () => r(null)
978
+ }
979
+ )
980
+ ] });
981
+ }
982
+ export {
983
+ nn as default
984
+ };