agentglow 0.1.0 → 0.2.1

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