agentglow 0.4.3 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
1
1
  var le = Object.defineProperty;
2
2
  var he = (g, e, c) => e in g ? le(g, e, { enumerable: !0, configurable: !0, writable: !0, value: c }) : g[e] = c;
3
- var u = (g, e, c) => he(g, typeof e != "symbol" ? e + "" : e, c);
3
+ var d = (g, e, c) => he(g, typeof e != "symbol" ? e + "" : e, c);
4
4
  import { jsxs as dt, jsx as O, Fragment as fe } from "react/jsx-runtime";
5
5
  import { useFrame as gt, useThree as ue } from "@react-three/fiber";
6
6
  import { EffectComposer as de, Bloom as pe, Vignette as ge, Noise as me } from "@react-three/postprocessing";
7
7
  import { useMemo as Me, useRef as st, useEffect as At } from "react";
8
8
  import * as w from "three";
9
- import { g as ye, K as Ae, F as be, f as et, A as Z, w as q, H as ne, I as ie, R as xe, k as $t, p as we, e as Re, q as zt, o as Se, n as Ge, d as Tt, J as ze, M as ve, T as oe, i as Ie, x as Ce, G as Pe, u as Fe, L as vt, t as Jt, v as Qt, S as Be, N as Oe, O as Te, j as Ee, r as ke } from "./KitScene-DsZmpTf7.js";
9
+ import { g as ye, K as Ae, F as be, f as et, A as Z, w as q, H as ne, I as ie, R as xe, k as $t, p as we, e as Re, q as zt, o as Se, n as Ge, d as Tt, J as ze, M as ve, N as Ie, T as oe, i as Ce, x as Pe, G as Fe, u as Be, L as vt, t as Jt, v as Qt, S as Oe, O as Te, P as Ee, j as ke, r as _e } from "./KitScene-DNk9wirq.js";
10
10
  var se;
11
- const pt = typeof window < "u" && !!((se = window.matchMedia) != null && se.call(window, "(prefers-reduced-motion: reduce)").matches), nt = pt ? 0.3 : 1, W = pt ? 9e3 : 24e3, it = pt ? 3500 : 8e3, F = 12, $ = pt ? 450 : 1100, Et = 9e3, Y = 64, kt = 31, _e = 4.6, ot = 28, _t = 64, Rt = 18, Lt = 16, ht = 8, X = Math.PI * 2, re = 200, tt = re + ve, Dt = 5.4, Gt = 3.2, Le = ["planner", "researcher", "writer"], yt = Object.fromEntries(Object.entries(oe).map(([g, e]) => [g, new w.Color(e)])), De = Ie, Ue = () => ({ used: !1, id: "", inst: null, seen: 0, x: 0, y: 0, z: 0, r: 1, g: 1, b: 1, omega: 0, bright: 0, swirl: 0, rscale: 1, tiltA: 0, tiltB: 0, count: 0, want: 0, rank: 0, ka: null, released: !1, p: 0, e: 0, waitMcp: 0 }), St = tt * 3, je = (g) => {
11
+ const pt = typeof window < "u" && !!((se = window.matchMedia) != null && se.call(window, "(prefers-reduced-motion: reduce)").matches), nt = pt ? 0.3 : 1, W = pt ? 9e3 : 24e3, it = pt ? 3500 : 8e3, F = 12, $ = pt ? 450 : 1100, Et = 9e3, Y = 64, kt = 31, Le = 4.6, ot = 28, _t = 64, Rt = 18, Lt = 16, ht = 8, X = Math.PI * 2, re = 200, tt = re + Ie, Dt = 5.4, Gt = 3.2, De = ["planner", "researcher", "writer"], yt = Object.fromEntries(Object.entries(oe).map(([g, e]) => [g, new w.Color(e)])), Ue = Ce, je = () => ({ used: !1, id: "", inst: null, seen: 0, x: 0, y: 0, z: 0, r: 1, g: 1, b: 1, omega: 0, bright: 0, swirl: 0, rscale: 1, tiltA: 0, tiltB: 0, count: 0, want: 0, rank: 0, ka: null, released: !1, p: 0, e: 0, waitMcp: 0 }), St = tt * 3, Ne = (g) => {
12
12
  let e = 7;
13
13
  for (let c = 0; c < g.length; c++) e = e * 31 + g.charCodeAt(c) >>> 0;
14
14
  return e % 100003;
@@ -59,127 +59,127 @@ function te() {
59
59
  blending: w.AdditiveBlending
60
60
  });
61
61
  }
62
- const S = new w.Vector3(), N = new w.Vector3(), T = new w.Vector3(), G = new w.Color(), J = new w.Color(), Q = new w.Object3D(), V = new w.Color(1, 1, 1), ee = new w.Color("#fbbf24"), Ne = new w.Color("#ef4444"), We = new w.Color("#ef4444");
63
- class Xe {
62
+ const S = new w.Vector3(), N = new w.Vector3(), T = new w.Vector3(), G = new w.Color(), J = new w.Color(), Q = new w.Object3D(), V = new w.Color(1, 1, 1), ee = new w.Color("#fbbf24"), We = new w.Color("#ef4444"), Xe = new w.Color("#ef4444");
63
+ class qe {
64
64
  constructor() {
65
- u(this, "material", te());
65
+ d(this, "material", te());
66
66
  /** nebula points live in the (scaled) side graph group: their sprite size follows kit.graph.scale */
67
- u(this, "nebMaterial", te());
68
- u(this, "frame", 0);
69
- u(this, "selectedId", null);
67
+ d(this, "nebMaterial", te());
68
+ d(this, "frame", 0);
69
+ d(this, "selectedId", null);
70
70
  /** field radius (grows with the kit core so the murmuration always surrounds the agents + periphery) */
71
- u(this, "fieldR", kt);
71
+ d(this, "fieldR", kt);
72
72
  // ---- field
73
- u(this, "fieldGeo", ft(W));
74
- u(this, "fP", j(this.fieldGeo, "position"));
75
- u(this, "fC", j(this.fieldGeo, "acol"));
76
- u(this, "fS", j(this.fieldGeo, "size"));
77
- u(this, "fYb", new Float32Array(W));
78
- u(this, "fIvx", new Float32Array(W));
79
- u(this, "fIvz", new Float32Array(W));
80
- u(this, "fHeat", new Float32Array(W));
81
- u(this, "fT", new Float32Array(W * 3));
82
- u(this, "fOwner", new Int16Array(W).fill(-1));
83
- u(this, "fAng", new Float32Array(W));
84
- u(this, "fOrb", new Float32Array(W));
85
- u(this, "fRnd", new Float32Array(W));
73
+ d(this, "fieldGeo", ft(W));
74
+ d(this, "fP", j(this.fieldGeo, "position"));
75
+ d(this, "fC", j(this.fieldGeo, "acol"));
76
+ d(this, "fS", j(this.fieldGeo, "size"));
77
+ d(this, "fYb", new Float32Array(W));
78
+ d(this, "fIvx", new Float32Array(W));
79
+ d(this, "fIvz", new Float32Array(W));
80
+ d(this, "fHeat", new Float32Array(W));
81
+ d(this, "fT", new Float32Array(W * 3));
82
+ d(this, "fOwner", new Int16Array(W).fill(-1));
83
+ d(this, "fAng", new Float32Array(W));
84
+ d(this, "fOrb", new Float32Array(W));
85
+ d(this, "fRnd", new Float32Array(W));
86
86
  // ---- slots (agent eddies, one per drawn kit agent)
87
- u(this, "slots", Array.from({ length: Y }, Ue));
88
- u(this, "idToSlot", /* @__PURE__ */ new Map());
89
- u(this, "pendingByInst", /* @__PURE__ */ new Map());
87
+ d(this, "slots", Array.from({ length: Y }, je));
88
+ d(this, "idToSlot", /* @__PURE__ */ new Map());
89
+ d(this, "pendingByInst", /* @__PURE__ */ new Map());
90
90
  // ---- runs (pooled vortices, one per drawn kit run; a vortex fades out after its run leaves the kit)
91
- u(this, "runRef", new Array(F).fill(null));
92
- u(this, "runKit", new Array(F).fill(null));
93
- u(this, "runId", new Array(F).fill(""));
94
- u(this, "runPool", /* @__PURE__ */ new Map());
95
- u(this, "rPresent", new Uint8Array(F));
96
- u(this, "rSteps", new Uint8Array(F));
97
- u(this, "rX", new Float32Array(F));
98
- u(this, "rZ", new Float32Array(F));
91
+ d(this, "runRef", new Array(F).fill(null));
92
+ d(this, "runKit", new Array(F).fill(null));
93
+ d(this, "runId", new Array(F).fill(""));
94
+ d(this, "runPool", /* @__PURE__ */ new Map());
95
+ d(this, "rPresent", new Uint8Array(F));
96
+ d(this, "rSteps", new Uint8Array(F));
97
+ d(this, "rX", new Float32Array(F));
98
+ d(this, "rZ", new Float32Array(F));
99
99
  /** vortex loop radius per run (around its agents) */
100
- u(this, "rR", new Float32Array(F).fill(_e));
100
+ d(this, "rR", new Float32Array(F).fill(Le));
101
101
  /** step attractors (x, z) per run: at the kit's role slots (plan | research | write) */
102
- u(this, "rAt", new Float32Array(F * 6));
103
- u(this, "rAlpha", new Float32Array(F));
104
- u(this, "rCol", Array.from({ length: F }, () => new w.Color()));
105
- u(this, "rColStr", new Array(F).fill(""));
106
- u(this, "runGeo", ft(F * $));
107
- u(this, "rTh", new Float32Array(F * $));
108
- u(this, "rSp", new Float32Array(F * $));
109
- u(this, "rRr", new Float32Array(F * $));
110
- u(this, "rY", new Float32Array(F * $));
102
+ d(this, "rAt", new Float32Array(F * 6));
103
+ d(this, "rAlpha", new Float32Array(F));
104
+ d(this, "rCol", Array.from({ length: F }, () => new w.Color()));
105
+ d(this, "rColStr", new Array(F).fill(""));
106
+ d(this, "runGeo", ft(F * $));
107
+ d(this, "rTh", new Float32Array(F * $));
108
+ d(this, "rSp", new Float32Array(F * $));
109
+ d(this, "rRr", new Float32Array(F * $));
110
+ d(this, "rY", new Float32Array(F * $));
111
111
  // ---- nebula (FalkorDB side current; local frame of the kit side graph)
112
- u(this, "nebGeo", ft(it));
113
- u(this, "anchorGeo", ft(tt));
114
- u(this, "nA", new Uint16Array(it));
115
- u(this, "nO", new Float32Array(it * 3));
116
- u(this, "nSpin", new Float32Array(it));
117
- u(this, "nB", new Float32Array(it));
118
- u(this, "aLocal", new Float32Array(tt * 3));
119
- u(this, "aCol", new Float32Array(tt * 3));
120
- u(this, "aNamed", new Uint8Array(tt));
121
- u(this, "burst", new Float32Array(tt));
122
- u(this, "burstW", new Float32Array(tt));
123
- u(this, "flareCol", new Float32Array(tt * 3));
124
- u(this, "nameIdx", /* @__PURE__ */ new Map());
125
- u(this, "nebAngle", 0.4);
126
- u(this, "nAnchors", 0);
127
- u(this, "edgeGeo", new w.BufferGeometry());
128
- u(this, "edgeA", new Uint16Array(St * 2));
129
- u(this, "nEdge", 0);
130
- u(this, "lastFlareId", 0);
131
- u(this, "lastFlare", null);
112
+ d(this, "nebGeo", ft(it));
113
+ d(this, "anchorGeo", ft(tt));
114
+ d(this, "nA", new Uint16Array(it));
115
+ d(this, "nO", new Float32Array(it * 3));
116
+ d(this, "nSpin", new Float32Array(it));
117
+ d(this, "nB", new Float32Array(it));
118
+ d(this, "aLocal", new Float32Array(tt * 3));
119
+ d(this, "aCol", new Float32Array(tt * 3));
120
+ d(this, "aNamed", new Uint8Array(tt));
121
+ d(this, "burst", new Float32Array(tt));
122
+ d(this, "burstW", new Float32Array(tt));
123
+ d(this, "flareCol", new Float32Array(tt * 3));
124
+ d(this, "nameIdx", /* @__PURE__ */ new Map());
125
+ d(this, "nebAngle", 0.4);
126
+ d(this, "nAnchors", 0);
127
+ d(this, "edgeGeo", new w.BufferGeometry());
128
+ d(this, "edgeA", new Uint16Array(St * 2));
129
+ d(this, "nEdge", 0);
130
+ d(this, "lastFlareId", 0);
131
+ d(this, "lastFlare", null);
132
132
  // ---- streams + lines
133
- u(this, "streamGeo", ft(Et));
134
- u(this, "beamGeo");
135
- u(this, "glowGeo", ft(Y + F * 3 + ht));
133
+ d(this, "streamGeo", ft(Et));
134
+ d(this, "beamGeo");
135
+ d(this, "glowGeo", ft(Y + F * 3 + ht));
136
136
  // ---- meshes
137
- u(this, "cores");
138
- u(this, "attractors");
139
- u(this, "stepRings");
140
- u(this, "rings");
141
- u(this, "pulsars");
142
- u(this, "pulsarBeams");
143
- u(this, "selRing");
144
- u(this, "ringStart", new Float32Array(ot).fill(-1e9));
145
- u(this, "ringDur", new Float32Array(ot).fill(1));
146
- u(this, "ringMax", new Float32Array(ot));
147
- u(this, "ringPos", new Float32Array(ot * 3));
148
- u(this, "ringCol", new Float32Array(ot * 3));
149
- u(this, "ringNext", 0);
150
- u(this, "mcpSpin", new Float32Array(ht));
137
+ d(this, "cores");
138
+ d(this, "attractors");
139
+ d(this, "stepRings");
140
+ d(this, "rings");
141
+ d(this, "pulsars");
142
+ d(this, "pulsarBeams");
143
+ d(this, "selRing");
144
+ d(this, "ringStart", new Float32Array(ot).fill(-1e9));
145
+ d(this, "ringDur", new Float32Array(ot).fill(1));
146
+ d(this, "ringMax", new Float32Array(ot));
147
+ d(this, "ringPos", new Float32Array(ot * 3));
148
+ d(this, "ringCol", new Float32Array(ot * 3));
149
+ d(this, "ringNext", 0);
150
+ d(this, "mcpSpin", new Float32Array(ht));
151
151
  // ------------------------------------------------------------------ frame
152
152
  /** kit fit size multiplier for eddies, sampled once per frame */
153
- u(this, "lodK", 1);
153
+ d(this, "lodK", 1);
154
154
  // active runs / swirls packed for the hot loop
155
- u(this, "aX", new Float32Array(F));
156
- u(this, "aZ", new Float32Array(F));
157
- u(this, "aA", new Float32Array(F));
158
- u(this, "aRR", new Float32Array(F));
159
- u(this, "aR", new Float32Array(F * 3));
160
- u(this, "sX", new Float32Array(Y));
161
- u(this, "sZ", new Float32Array(Y));
162
- u(this, "sS", new Float32Array(Y));
163
- u(this, "stTh", new Float32Array(3));
164
- u(this, "stB", new Float32Array(3));
155
+ d(this, "aX", new Float32Array(F));
156
+ d(this, "aZ", new Float32Array(F));
157
+ d(this, "aA", new Float32Array(F));
158
+ d(this, "aRR", new Float32Array(F));
159
+ d(this, "aR", new Float32Array(F * 3));
160
+ d(this, "sX", new Float32Array(Y));
161
+ d(this, "sZ", new Float32Array(Y));
162
+ d(this, "sS", new Float32Array(Y));
163
+ d(this, "stTh", new Float32Array(3));
164
+ d(this, "stB", new Float32Array(3));
165
165
  for (let t = 0; t < W; t++) {
166
- const o = Math.sqrt(Math.random()) * kt, p = Math.random() * X;
167
- this.fP[t * 3] = Math.cos(p) * o, this.fP[t * 3 + 2] = Math.sin(p) * o, this.fYb[t] = (Math.random() - 0.5) * (0.6 + o * 0.05), this.fP[t * 3 + 1] = this.fYb[t], this.fRnd[t] = Math.random(), this.fOrb[t] = 0.16 + 1.35 * Math.pow(Math.random(), 1.5), this.fAng[t] = Math.random() * X;
166
+ const i = Math.sqrt(Math.random()) * kt, p = Math.random() * X;
167
+ this.fP[t * 3] = Math.cos(p) * i, this.fP[t * 3 + 2] = Math.sin(p) * i, this.fYb[t] = (Math.random() - 0.5) * (0.6 + i * 0.05), this.fP[t * 3 + 1] = this.fYb[t], this.fRnd[t] = Math.random(), this.fOrb[t] = 0.16 + 1.35 * Math.pow(Math.random(), 1.5), this.fAng[t] = Math.random() * X;
168
168
  }
169
169
  for (let t = 0; t < F * $; t++) {
170
170
  this.rTh[t] = Math.random() * X, this.rSp[t] = 0.2 + Math.random() * 0.14;
171
- const o = (Math.random() + Math.random() + Math.random() - 1.5) * 0.55;
172
- this.rRr[t] = o, this.rY[t] = (Math.random() - 0.5) * 0.35;
171
+ const i = (Math.random() + Math.random() + Math.random() - 1.5) * 0.55;
172
+ this.rRr[t] = i, this.rY[t] = (Math.random() - 0.5) * 0.35;
173
173
  }
174
174
  for (let t = 0; t < it; t++) {
175
- const o = 0.18 + 0.55 * Math.pow(Math.random(), 3), p = Math.random() * X, b = o * Math.sqrt(-2 * Math.log(1 - Math.random() * 0.98));
176
- this.nO[t * 3] = Math.cos(p) * b, this.nO[t * 3 + 1] = (Math.random() - 0.5) * o * 0.8, this.nO[t * 3 + 2] = Math.sin(p) * b, this.nSpin[t] = (0.15 + Math.random() * 0.5) * (Math.random() < 0.5 ? 1 : 0.6), this.nB[t] = 0.5 + Math.random() * 0.7;
175
+ const i = 0.18 + 0.55 * Math.pow(Math.random(), 3), p = Math.random() * X, b = i * Math.sqrt(-2 * Math.log(1 - Math.random() * 0.98));
176
+ this.nO[t * 3] = Math.cos(p) * b, this.nO[t * 3 + 1] = (Math.random() - 0.5) * i * 0.8, this.nO[t * 3 + 2] = Math.sin(p) * b, this.nSpin[t] = (0.15 + Math.random() * 0.5) * (Math.random() < 0.5 ? 1 : 0.6), this.nB[t] = 0.5 + Math.random() * 0.7;
177
177
  }
178
178
  this.anchorGeo.setDrawRange(0, 0), this.edgeGeo.setAttribute("position", new w.BufferAttribute(new Float32Array(St * 2 * 3), 3)), this.edgeGeo.setAttribute("color", new w.BufferAttribute(new Float32Array(St * 2 * 3), 3).setUsage(w.DynamicDrawUsage)), this.edgeGeo.setDrawRange(0, 0), this.edgeGeo.boundingSphere = new w.Sphere(new w.Vector3(), 50);
179
179
  const e = _t + Lt * Rt;
180
180
  this.beamGeo = new w.BufferGeometry(), this.beamGeo.setAttribute("position", new w.BufferAttribute(new Float32Array(e * 6), 3).setUsage(w.DynamicDrawUsage)), this.beamGeo.setAttribute("color", new w.BufferAttribute(new Float32Array(e * 6), 3).setUsage(w.DynamicDrawUsage));
181
- const c = new w.Sphere(new w.Vector3(), 400), i = new w.MeshBasicMaterial({ toneMapped: !1 });
182
- this.cores = new w.InstancedMesh(new w.IcosahedronGeometry(0.26, 3), i, Y), this.attractors = new w.InstancedMesh(new w.IcosahedronGeometry(0.3, 3), new w.MeshBasicMaterial({ toneMapped: !1 }), F * 3);
181
+ const c = new w.Sphere(new w.Vector3(), 400), o = new w.MeshBasicMaterial({ toneMapped: !1 });
182
+ this.cores = new w.InstancedMesh(new w.IcosahedronGeometry(0.26, 3), o, Y), this.attractors = new w.InstancedMesh(new w.IcosahedronGeometry(0.3, 3), new w.MeshBasicMaterial({ toneMapped: !1 }), F * 3);
183
183
  const s = new w.RingGeometry(0.9, 1, 96);
184
184
  s.rotateX(-Math.PI / 2);
185
185
  const n = () => new w.MeshBasicMaterial({ toneMapped: !1, transparent: !0, blending: w.AdditiveBlending, depthWrite: !1, side: w.DoubleSide });
@@ -188,16 +188,16 @@ class Xe {
188
188
  f.translate(0, 1.6, 0);
189
189
  const l = f.clone().rotateX(Math.PI), r = new w.BufferGeometry();
190
190
  {
191
- const t = f.getAttribute("position").array, o = l.getAttribute("position").array, p = f.getIndex().array, b = l.getIndex().array, R = new Float32Array(t.length + o.length);
192
- R.set(t), R.set(o, t.length);
191
+ const t = f.getAttribute("position").array, i = l.getAttribute("position").array, p = f.getIndex().array, b = l.getIndex().array, R = new Float32Array(t.length + i.length);
192
+ R.set(t), R.set(i, t.length);
193
193
  const z = [...p, ...Array.from(b, (v) => v + t.length / 3)];
194
194
  r.setAttribute("position", new w.BufferAttribute(R, 3)), r.setIndex(z);
195
195
  }
196
196
  this.pulsarBeams = new w.InstancedMesh(r, n(), ht);
197
197
  for (const t of [this.cores, this.attractors, this.stepRings, this.rings, this.pulsars, this.pulsarBeams]) {
198
198
  t.boundingSphere = c, t.frustumCulled = !1, t.instanceMatrix.setUsage(w.DynamicDrawUsage), t.setColorAt(0, G.setRGB(0, 0, 0));
199
- for (let o = 0; o < t.count; o++)
200
- Q.position.set(0, -999, 0), Q.scale.setScalar(1e-4), Q.updateMatrix(), t.setMatrixAt(o, Q.matrix), t.setColorAt(o, G.setRGB(0, 0, 0));
199
+ for (let i = 0; i < t.count; i++)
200
+ Q.position.set(0, -999, 0), Q.scale.setScalar(1e-4), Q.updateMatrix(), t.setMatrixAt(i, Q.matrix), t.setColorAt(i, G.setRGB(0, 0, 0));
201
201
  }
202
202
  this.selRing = new w.Mesh(new w.RingGeometry(1.25, 1.33, 64).rotateX(-Math.PI / 2), n()), this.selRing.visible = !1;
203
203
  }
@@ -206,40 +206,40 @@ class Xe {
206
206
  * a node never moves when others arrive), new anchors take over a share of the nebula particles. No reset.
207
207
  */
208
208
  setGalaxy(e) {
209
- const c = ye(e, re), i = Math.min(tt, c.nodes.length), s = this.nAnchors;
210
- this.nAnchors = i, this.nameIdx.clear();
209
+ const c = ye(e, re), o = Math.min(tt, c.nodes.length), s = this.nAnchors;
210
+ this.nAnchors = o, this.nameIdx.clear();
211
211
  const n = /* @__PURE__ */ new Map();
212
- for (let p = 0; p < i; p++) {
212
+ for (let p = 0; p < o; p++) {
213
213
  const b = c.nodes[p];
214
214
  this.nameIdx.set(b.name.toLowerCase(), p), n.set(b.id, p);
215
- const R = je(b.id), z = K(R), v = 0.5 + (Dt - 0.9) * Math.sqrt(z) + (K(R + 1) - 0.5) * 0.45, h = R % 3 / 3 * X + v * 1.15 + (K(R + 2) - 0.5) * 0.5;
215
+ const R = Ne(b.id), z = K(R), v = 0.5 + (Dt - 0.9) * Math.sqrt(z) + (K(R + 1) - 0.5) * 0.45, h = R % 3 / 3 * X + v * 1.15 + (K(R + 2) - 0.5) * 0.5;
216
216
  this.aLocal[p * 3] = Math.cos(h) * v, this.aLocal[p * 3 + 1] = (K(R + 3) - 0.5) * 0.7 * (1.3 - z) + 0.4, this.aLocal[p * 3 + 2] = Math.sin(h) * v, G.set(Ae[b.kind] ?? "#94a3b8"), this.aCol[p * 3] = G.r, this.aCol[p * 3 + 1] = G.g, this.aCol[p * 3 + 2] = G.b, this.aNamed[p] = p < 22 ? 1 : 0;
217
217
  }
218
- if (i > 0) {
219
- const p = s > 0 && i > s ? (i - s) / i : s > 0 ? 0 : 1;
218
+ if (o > 0) {
219
+ const p = s > 0 && o > s ? (o - s) / o : s > 0 ? 0 : 1;
220
220
  for (let b = 0; b < it; b++)
221
- this.nA[b] >= i ? this.nA[b] = Math.floor(Math.random() * i) : p > 0 && Math.random() < p && (this.nA[b] = s > 0 ? s + Math.floor(Math.random() * (i - s)) : Math.random() < 0.2 ? Math.floor(Math.random() * Math.min(22, i)) : Math.floor(Math.random() * i));
221
+ this.nA[b] >= o ? this.nA[b] = Math.floor(Math.random() * o) : p > 0 && Math.random() < p && (this.nA[b] = s > 0 ? s + Math.floor(Math.random() * (o - s)) : Math.random() < 0.2 ? Math.floor(Math.random() * Math.min(22, o)) : Math.floor(Math.random() * o));
222
222
  }
223
- this.anchorGeo.setDrawRange(0, i);
223
+ this.anchorGeo.setDrawRange(0, o);
224
224
  const f = this.edgeA;
225
225
  let l = 0;
226
226
  const r = /* @__PURE__ */ new Set(), t = (p, b) => {
227
227
  if (p === b || l >= St) return;
228
228
  const R = p < b ? p * 4096 + b : b * 4096 + p;
229
229
  r.has(R) || (r.add(R), f[l * 2] = p, f[l * 2 + 1] = b, l++);
230
- }, o = this.aLocal;
230
+ }, i = this.aLocal;
231
231
  for (const p of c.links) {
232
232
  const b = n.get(p.source), R = n.get(p.target);
233
233
  if (b !== void 0 && R !== void 0) {
234
- const z = o[b * 3] - o[R * 3], v = o[b * 3 + 2] - o[R * 3 + 2];
234
+ const z = i[b * 3] - i[R * 3], v = i[b * 3 + 2] - i[R * 3 + 2];
235
235
  z * z + v * v < 9 && t(b, R);
236
236
  }
237
237
  }
238
- for (let p = 0; p < i; p++) {
238
+ for (let p = 0; p < o; p++) {
239
239
  let b = -1, R = 1e9, z = -1, v = 1e9;
240
- for (let h = 0; h < i; h++) {
240
+ for (let h = 0; h < o; h++) {
241
241
  if (h === p) continue;
242
- const A = o[p * 3] - o[h * 3], I = o[p * 3 + 1] - o[h * 3 + 1], a = o[p * 3 + 2] - o[h * 3 + 2], M = A * A + I * I + a * a;
242
+ const A = i[p * 3] - i[h * 3], I = i[p * 3 + 1] - i[h * 3 + 1], a = i[p * 3 + 2] - i[h * 3 + 2], M = A * A + I * I + a * a;
243
243
  M < R ? (z = b, v = R, b = h, R = M) : M < v && (z = h, v = M);
244
244
  }
245
245
  b >= 0 && t(p, b), z >= 0 && p % 2 === 0 && t(p, z);
@@ -255,18 +255,18 @@ class Xe {
255
255
  // ------------------------------------------------------------------ helpers
256
256
  anchorIdx(e) {
257
257
  const c = e.toLowerCase();
258
- let i = this.nameIdx.get(c);
259
- if (i === void 0) {
258
+ let o = this.nameIdx.get(c);
259
+ if (o === void 0) {
260
260
  let s = 7;
261
261
  for (let n = 0; n < c.length; n++) s = s * 31 + c.charCodeAt(n) >>> 0;
262
- i = s % Math.max(1, this.nAnchors), this.nameIdx.set(c, i);
262
+ o = s % Math.max(1, this.nAnchors), this.nameIdx.set(c, o);
263
263
  }
264
- return i;
264
+ return o;
265
265
  }
266
266
  /** anchor in the nebula's local frame (rotated by the slow spin) */
267
267
  anchorLocal(e, c) {
268
- const i = Math.cos(this.nebAngle), s = Math.sin(this.nebAngle), n = this.aLocal[e * 3], f = this.aLocal[e * 3 + 2];
269
- return c.set(n * i - f * s, this.aLocal[e * 3 + 1], n * s + f * i);
268
+ const o = Math.cos(this.nebAngle), s = Math.sin(this.nebAngle), n = this.aLocal[e * 3], f = this.aLocal[e * 3 + 2];
269
+ return c.set(n * o - f * s, this.aLocal[e * 3 + 1], n * s + f * o);
270
270
  }
271
271
  /** anchor on stage (the kit places + scales the side graph) */
272
272
  anchorWorld(e, c) {
@@ -277,46 +277,46 @@ class Xe {
277
277
  return c === void 0 ? null : this.slots[c];
278
278
  }
279
279
  /** stage position of a run's step attractor k (pool slot s) */
280
- attractor(e, c, i) {
281
- return i.set(this.rAt[e * 6 + c * 2], 0.35, this.rAt[e * 6 + c * 2 + 1]);
280
+ attractor(e, c, o) {
281
+ return o.set(this.rAt[e * 6 + c * 2], 0.35, this.rAt[e * 6 + c * 2 + 1]);
282
282
  }
283
- emitRing(e, c, i, s, n, f, l, r = 1) {
283
+ emitRing(e, c, o, s, n, f, l, r = 1) {
284
284
  const t = this.ringNext++ % ot;
285
- this.ringStart[t] = l, this.ringDur[t] = f, this.ringMax[t] = n, this.ringPos[t * 3] = e, this.ringPos[t * 3 + 1] = c, this.ringPos[t * 3 + 2] = i, this.ringCol[t * 3] = s.r * r, this.ringCol[t * 3 + 1] = s.g * r, this.ringCol[t * 3 + 2] = s.b * r;
285
+ this.ringStart[t] = l, this.ringDur[t] = f, this.ringMax[t] = n, this.ringPos[t * 3] = e, this.ringPos[t * 3 + 1] = c, this.ringPos[t * 3 + 2] = o, this.ringCol[t * 3] = s.r * r, this.ringCol[t * 3 + 1] = s.g * r, this.ringCol[t * 3 + 2] = s.b * r;
286
286
  }
287
287
  alloc(e, c) {
288
- const i = e.inst, s = this.slots.findIndex((r) => !r.used);
288
+ const o = e.inst, s = this.slots.findIndex((r) => !r.used);
289
289
  if (s < 0) return -1;
290
- const n = this.slots[s], f = yt[i.type];
291
- Object.assign(n, { used: !0, id: i.id, inst: i, ka: e, count: 0, released: !1, r: f.r, g: f.g, b: f.b, omega: 2, bright: 0.6, swirl: 0, p: 0, e: 0 }), n.tiltA = (K(s + c) - 0.5) * 0.7, n.tiltB = (K(s * 3.1 + c) - 0.5) * 0.7, n.rscale = De(i.type) || e.depth > 0 ? 0.72 : 1, n.want = Math.round((n.rscale < 1 ? 380 : 620) * (pt ? 0.5 : 1));
292
- const l = i.parent ? this.slotOf(i.parent) : null;
293
- if (l ? (n.x = l.x, n.y = l.y, n.z = l.z) : (n.x = e.pos.x, n.y = 0.9, n.z = e.pos.z), this.idToSlot.set(i.id, s), this.emitRing(n.x, n.y, n.z, f, 2.4 * et.scale, 0.9, c, 2.2), l) {
294
- const r = this.idToSlot.get(i.parent);
290
+ const n = this.slots[s], f = yt[o.type];
291
+ Object.assign(n, { used: !0, id: o.id, inst: o, ka: e, count: 0, released: !1, r: f.r, g: f.g, b: f.b, omega: 2, bright: 0.6, swirl: 0, p: 0, e: 0 }), n.tiltA = (K(s + c) - 0.5) * 0.7, n.tiltB = (K(s * 3.1 + c) - 0.5) * 0.7, n.rscale = Ue(o.type) || e.depth > 0 ? 0.72 : 1, n.want = Math.round((n.rscale < 1 ? 380 : 620) * (pt ? 0.5 : 1));
292
+ const l = o.parent ? this.slotOf(o.parent) : null;
293
+ if (l ? (n.x = l.x, n.y = l.y, n.z = l.z) : (n.x = e.pos.x, n.y = e.pos.y + 0.9, n.z = e.pos.z), this.idToSlot.set(o.id, s), this.emitRing(n.x, n.y, n.z, f, 2.4 * et.scale, 0.9, c, 2.2), l) {
294
+ const r = this.idToSlot.get(o.parent);
295
295
  let t = Math.floor(l.count * 0.28);
296
- for (let o = 0; o < W && t > 0; o++)
297
- this.fOwner[o] === r && o & 1 && (this.fOwner[o] = s, l.count--, n.count++, t--);
296
+ for (let i = 0; i < W && t > 0; i++)
297
+ this.fOwner[i] === r && i & 1 && (this.fOwner[i] = s, l.count--, n.count++, t--);
298
298
  }
299
299
  return s;
300
300
  }
301
301
  release(e, c) {
302
- const i = this.slots[e], s = this.fP;
302
+ const o = this.slots[e], s = this.fP;
303
303
  for (let n = 0; n < W; n++) {
304
304
  if (this.fOwner[n] !== e) continue;
305
305
  this.fOwner[n] = -1;
306
- const f = s[n * 3] - i.x, l = s[n * 3 + 2] - i.z, r = Math.sqrt(f * f + l * l) + 1e-3, t = (2.4 + this.fRnd[n] * 3.6) * (pt ? 0.5 : 1);
307
- this.fIvx[n] = f / r * t - l / r * i.omega * 0.5, this.fIvz[n] = l / r * t + f / r * i.omega * 0.5, this.fHeat[n] = 1, this.fT[n * 3] = i.r, this.fT[n * 3 + 1] = i.g, this.fT[n * 3 + 2] = i.b;
306
+ const f = s[n * 3] - o.x, l = s[n * 3 + 2] - o.z, r = Math.sqrt(f * f + l * l) + 1e-3, t = (2.4 + this.fRnd[n] * 3.6) * (pt ? 0.5 : 1);
307
+ this.fIvx[n] = f / r * t - l / r * o.omega * 0.5, this.fIvz[n] = l / r * t + f / r * o.omega * 0.5, this.fHeat[n] = 1, this.fT[n * 3] = o.r, this.fT[n * 3 + 1] = o.g, this.fT[n * 3 + 2] = o.b;
308
308
  }
309
- i.count = 0, G.setRGB(i.r, i.g, i.b).lerp(V, 0.5), this.emitRing(i.x, i.y, i.z, G, 3.2 * et.scale, 1.1, c, 2.6);
309
+ o.count = 0, G.setRGB(o.r, o.g, o.b).lerp(V, 0.5), this.emitRing(o.x, o.y, o.z, G, 3.2 * et.scale, 1.1, c, 2.6);
310
310
  }
311
311
  /** Once per frame, after the kit's ticker (world tick -> lodTick -> kitTick). */
312
- update(e, c, i) {
312
+ update(e, c, o) {
313
313
  const s = Math.min(0.05, e);
314
314
  this.lodK = et.scale, this.frame++;
315
315
  const n = Math.max(kt, Z.core.r + 20);
316
- this.fieldR += (n - this.fieldR) * Math.min(1, s * 0.8), this.nebAngle += s * 0.04 * nt, this.syncRuns(c, s), this.syncSlots(c, s, i), this.recruit(c), this.updateField(s, i), this.updateFlares(c), this.updateNebula(i), this.updateRunCurrents(c, i), this.updateStreams(c, i), this.updateMeshes(c, i, s);
316
+ this.fieldR += (n - this.fieldR) * Math.min(1, s * 0.8), this.nebAngle += s * 0.04 * nt, this.syncRuns(c, s), this.syncSlots(c, s, o), this.recruit(c), this.updateField(s, o), this.updateFlares(c), this.updateNebula(o), this.updateRunCurrents(c, o), this.updateStreams(c, o), this.updateMeshes(c, o, s);
317
317
  }
318
318
  syncRuns(e, c) {
319
- var i;
319
+ var o;
320
320
  this.rPresent.fill(0);
321
321
  for (const s of Z.runs.values()) {
322
322
  let n = this.runPool.get(s.id);
@@ -334,8 +334,8 @@ class Xe {
334
334
  }
335
335
  this.rPresent[n] = 1, this.runKit[n] = s, this.runRef[n] = s.run ?? q.runs.get(s.id) ?? null, this.rX[n] = s.origin.x, this.rZ[n] = s.origin.z, this.rR[n] = Math.max(2.6, Math.min(11, Math.hypot(s.hu, s.hv) * 0.92 + 0.6));
336
336
  for (let f = 0; f < 3; f++)
337
- ne(s, ie(Le[f]), 0, S), this.rAt[n * 6 + f * 2] = S.x, this.rAt[n * 6 + f * 2 + 1] = S.z;
338
- this.rSteps[n] = (i = this.runRef[n]) != null && i.hasSteps ? 1 : 0;
337
+ ne(s, ie(De[f]), 0, S), this.rAt[n * 6 + f * 2] = S.x, this.rAt[n * 6 + f * 2 + 1] = S.z;
338
+ this.rSteps[n] = (o = this.runRef[n]) != null && o.hasSteps ? 1 : 0;
339
339
  }
340
340
  for (let s = 0; s < F; s++) {
341
341
  this.rPresent[s] || this.runId[s] && this.rAlpha[s] < 0.01 && (this.runPool.get(this.runId[s]) === s && this.runPool.delete(this.runId[s]), this.runId[s] = "", this.runRef[s] = null, this.runKit[s] = null);
@@ -344,7 +344,7 @@ class Xe {
344
344
  n && this.rPresent[s] && (f = Math.min(1, (e - n.startedAt) / 1800), n.endedAt && (f *= Math.max(0, 1 - (e - n.endedAt - (xe - 3e3)) / 3e3))), n && n.color !== this.rColStr[s] && (this.rColStr[s] = n.color, this.rCol[s].set(n.color)), this.rAlpha[s] += (f - this.rAlpha[s]) * Math.min(1, c * 3);
345
345
  }
346
346
  }
347
- syncSlots(e, c, i) {
347
+ syncSlots(e, c, o) {
348
348
  const s = this.frame;
349
349
  for (const l of Z.agents.values()) {
350
350
  let r = this.idToSlot.get(l.id);
@@ -361,45 +361,45 @@ class Xe {
361
361
  r.count > 0 && this.release(l, e), r.used = !1, r.inst = null, r.ka = null, this.idToSlot.delete(r.id);
362
362
  continue;
363
363
  }
364
- const o = r.ka, p = o.pos.x, b = o.pos.z, R = 0.9 + Math.sin(i * 0.9 + l) * 0.18;
365
- t.exitAt || (r.x += (p - r.x) * n, r.y += (R - r.y) * n, r.z += (b - r.z) * n), o.live.set(r.x, r.y, r.z), r.p = we(t, e), r.e = Re(t, e), r.waitMcp = this.pendingByInst.get(t.id) ?? -1;
364
+ const i = r.ka, p = i.pos.x, b = i.pos.z, R = i.pos.y + 0.9 + Math.sin(o * 0.9 + l) * 0.18;
365
+ t.exitAt || (r.x += (p - r.x) * n, r.y += (R - r.y) * n, r.z += (b - r.z) * n), i.live.set(r.x, r.y, r.z), r.p = we(t, e), r.e = Re(t, e), r.waitMcp = this.pendingByInst.get(t.id) ?? -1;
366
366
  const z = t.status === "thinking", v = t.status === "waiting";
367
367
  let h = z ? 3.6 : v ? 0.7 : 2.2, A = z ? 1 : v ? 0.3 : 0.7;
368
- r.waitMcp >= 0 && (h = 1, A = 0.45 + 0.3 * (0.5 + 0.5 * Math.sin(i * 3.2))), t.exitAt && (h = 0, A = 0), r.omega += (h * (1 + r.e * 0.7) * nt - r.omega) * f, r.bright += (A + r.e * 1.2 - r.bright) * f, r.swirl = t.exitAt ? 0 : (z ? 1.6 : 0.6) * r.p * nt, t.exitAt && !r.released && (r.released = !0, this.release(l, e));
368
+ r.waitMcp >= 0 && (h = 1, A = 0.45 + 0.3 * (0.5 + 0.5 * Math.sin(o * 3.2))), t.exitAt && (h = 0, A = 0), r.omega += (h * (1 + r.e * 0.7) * nt - r.omega) * f, r.bright += (A + r.e * 1.2 - r.bright) * f, r.swirl = t.exitAt ? 0 : (z ? 1.6 : 0.6) * r.p * nt, t.exitAt && !r.released && (r.released = !0, this.release(l, e));
369
369
  }
370
370
  }
371
371
  recruit(e) {
372
372
  const c = this.fP;
373
- for (let i = 0; i < Y; i++) {
374
- const s = this.slots[i];
373
+ for (let o = 0; o < Y; o++) {
374
+ const s = this.slots[o];
375
375
  if (!s.used || !s.inst || s.inst.exitAt) continue;
376
376
  const n = (e - s.inst.bornAt) / 1e3, f = s.want * Math.min(1, n / 1.6);
377
377
  for (let l = 0; l < 140 && s.count < f; l++) {
378
378
  const r = Math.random() * W | 0;
379
379
  if (this.fOwner[r] !== -1) continue;
380
- const t = c[r * 3] - s.x, o = c[r * 3 + 2] - s.z;
381
- t * t + o * o > 120 || (this.fOwner[r] = i, this.fAng[r] = Math.atan2(o, t), s.count++);
380
+ const t = c[r * 3] - s.x, i = c[r * 3 + 2] - s.z;
381
+ t * t + i * i > 120 || (this.fOwner[r] = o, this.fAng[r] = Math.atan2(i, t), s.count++);
382
382
  }
383
383
  }
384
384
  }
385
385
  updateField(e, c) {
386
- const i = this.fP, s = this.fC, n = this.fS, f = this.fOwner, l = this.slots, r = this.fRnd, t = e * nt, o = c * nt, p = 1 - Math.exp(-e * 2.8), b = Math.exp(-e * 0.5), R = Math.exp(-e * 1.3), z = 0.23 * o, v = 0.17 * o, h = 0.11 * o;
386
+ const o = this.fP, s = this.fC, n = this.fS, f = this.fOwner, l = this.slots, r = this.fRnd, t = e * nt, i = c * nt, p = 1 - Math.exp(-e * 2.8), b = Math.exp(-e * 0.5), R = Math.exp(-e * 1.3), z = 0.23 * i, v = 0.17 * i, h = 0.11 * i;
387
387
  let A = 0;
388
- for (let d = 0; d < F; d++)
389
- this.rAlpha[d] < 0.01 || (this.aX[A] = this.rX[d], this.aZ[A] = this.rZ[d], this.aRR[A] = this.rR[d], this.aA[A] = this.rAlpha[d], this.aR[A * 3] = this.rCol[d].r, this.aR[A * 3 + 1] = this.rCol[d].g, this.aR[A * 3 + 2] = this.rCol[d].b, A++);
388
+ for (let u = 0; u < F; u++)
389
+ this.rAlpha[u] < 0.01 || (this.aX[A] = this.rX[u], this.aZ[A] = this.rZ[u], this.aRR[A] = this.rR[u], this.aA[A] = this.rAlpha[u], this.aR[A * 3] = this.rCol[u].r, this.aR[A * 3 + 1] = this.rCol[u].g, this.aR[A * 3 + 2] = this.rCol[u].b, A++);
390
390
  let I = 0;
391
- for (const d of l)
392
- !d.used || d.swirl <= 0.01 || (this.sX[I] = d.x, this.sZ[I] = d.z, this.sS[I] = d.swirl, I++);
391
+ for (const u of l)
392
+ !u.used || u.swirl <= 0.01 || (this.sX[I] = u.x, this.sZ[I] = u.z, this.sS[I] = u.swirl, I++);
393
393
  const a = this.fieldR, M = a * a;
394
- for (let d = 0; d < W; d++) {
395
- const x = d * 3;
396
- let y = i[x], m = i[x + 1], P = i[x + 2];
397
- const _ = f[d];
394
+ for (let u = 0; u < W; u++) {
395
+ const x = u * 3;
396
+ let y = o[x], m = o[x + 1], P = o[x + 2];
397
+ const _ = f[u];
398
398
  if (_ >= 0) {
399
- const B = l[_], E = this.fOrb[d] * B.rscale * (0.35 + 0.65 * B.p) * this.lodK, k = this.fAng[d] += B.omega * e / (0.3 + E), D = Math.cos(k), C = Math.sin(k), L = B.x + D * E, bt = B.z + C * E, It = B.y + (C * B.tiltA + D * B.tiltB) * E + (r[d] - 0.5) * 0.14;
399
+ const B = l[_], E = this.fOrb[u] * B.rscale * (0.35 + 0.65 * B.p) * this.lodK, k = this.fAng[u] += B.omega * e / (0.3 + E), D = Math.cos(k), C = Math.sin(k), L = B.x + D * E, bt = B.z + C * E, It = B.y + (C * B.tiltA + D * B.tiltB) * E + (r[u] - 0.5) * 0.14;
400
400
  y += (L - y) * p, m += (It - m) * p, P += (bt - P) * p;
401
- const mt = B.bright * (1.5 - E * 0.55) * (0.6 + 0.4 * r[d]);
402
- s[x] = B.r * mt + 0.05, s[x + 1] = B.g * mt + 0.05, s[x + 2] = B.b * mt + 0.05, n[d] = 0.5 + 0.35 * r[d];
401
+ const mt = B.bright * (1.5 - E * 0.55) * (0.6 + 0.4 * r[u]);
402
+ s[x] = B.r * mt + 0.05, s[x + 1] = B.g * mt + 0.05, s[x + 2] = B.b * mt + 0.05, n[u] = 0.5 + 0.35 * r[u];
403
403
  } else {
404
404
  const B = y * y + P * P, E = Math.sqrt(B) + 1e-4, k = E / 11, D = 1.25 * k / (1 + k * k);
405
405
  let C = -P / E * D, L = y / E * D;
@@ -421,70 +421,70 @@ class Xe {
421
421
  const ct = this.sS[U] / (1 + Mt * 0.9);
422
422
  C -= at * ct, L += H * ct;
423
423
  }
424
- C += this.fIvx[d], L += this.fIvz[d], this.fIvx[d] *= R, this.fIvz[d] *= R, y += C * t, P += L * t, m += (this.fYb[d] - m) * e * 1.2;
425
- const xt = this.fHeat[d] *= b, ce = C * C + L * L, Pt = (0.14 + qt * 2.8) * (0.6 + Math.min(1.2, ce * 0.3)) * (0.45 + 0.75 * r[d]), Ft = 0.5 + 0.5 * Math.sin(Xt * 1.3 + 1);
426
- if (s[x] = (0.05 + 0.05 * Ft) * Pt + Yt * 0.42 + this.fT[x] * xt * 1.8, s[x + 1] = (0.08 + 0.03 * Ft) * Pt + Kt * 0.42 + this.fT[x + 1] * xt * 1.8, s[x + 2] = (0.2 - 0.04 * Ft) * Pt + Zt * 0.42 + this.fT[x + 2] * xt * 1.8, n[d] = 0.26 + 0.2 * r[d] + qt * 0.12 + xt * 0.35, B > M) {
424
+ C += this.fIvx[u], L += this.fIvz[u], this.fIvx[u] *= R, this.fIvz[u] *= R, y += C * t, P += L * t, m += (this.fYb[u] - m) * e * 1.2;
425
+ const xt = this.fHeat[u] *= b, ce = C * C + L * L, Pt = (0.14 + qt * 2.8) * (0.6 + Math.min(1.2, ce * 0.3)) * (0.45 + 0.75 * r[u]), Ft = 0.5 + 0.5 * Math.sin(Xt * 1.3 + 1);
426
+ if (s[x] = (0.05 + 0.05 * Ft) * Pt + Yt * 0.42 + this.fT[x] * xt * 1.8, s[x + 1] = (0.08 + 0.03 * Ft) * Pt + Kt * 0.42 + this.fT[x + 1] * xt * 1.8, s[x + 2] = (0.2 - 0.04 * Ft) * Pt + Zt * 0.42 + this.fT[x + 2] * xt * 1.8, n[u] = 0.26 + 0.2 * r[u] + qt * 0.12 + xt * 0.35, B > M) {
427
427
  const U = Math.sqrt(Math.random()) * a * 0.97, H = Math.random() * X;
428
- y = Math.cos(H) * U, P = Math.sin(H) * U, this.fHeat[d] = 0, this.fIvx[d] = this.fIvz[d] = 0;
428
+ y = Math.cos(H) * U, P = Math.sin(H) * U, this.fHeat[u] = 0, this.fIvx[u] = this.fIvz[u] = 0;
429
429
  }
430
430
  }
431
- i[x] = y, i[x + 1] = m, i[x + 2] = P;
431
+ o[x] = y, o[x + 1] = m, o[x + 2] = P;
432
432
  }
433
433
  ut(this.fieldGeo);
434
434
  }
435
435
  updateFlares(e) {
436
436
  if (this.burst.fill(0), this.burstW.fill(0), !this.nAnchors || !Z.graphWanted) return;
437
437
  const c = Z.graph.scale;
438
- for (const i of q.flares) {
439
- const s = this.anchorIdx(i.node), n = (e - i.start) / 1e3, f = (1 - Math.exp(-n * 9)) * Math.exp(-n * 1.3);
440
- if (i.id > this.lastFlareId) {
441
- if (this.lastFlareId = i.id, this.anchorWorld(s, S), i.op === "write")
438
+ for (const o of q.flares) {
439
+ const s = this.anchorIdx(o.node), n = (e - o.start) / 1e3, f = (1 - Math.exp(-n * 9)) * Math.exp(-n * 1.3);
440
+ if (o.id > this.lastFlareId) {
441
+ if (this.lastFlareId = o.id, this.anchorWorld(s, S), o.op === "write")
442
442
  this.emitRing(S.x, S.y, S.z, V, 4.2 * c, 1.7, e, 2.4), this.emitRing(S.x, S.y, S.z, V, 2.2 * c, 1, e, 1.6);
443
443
  else {
444
- const l = q.instances.get(i.instance);
444
+ const l = q.instances.get(o.instance);
445
445
  this.emitRing(S.x, S.y, S.z, l ? yt[l.type] : V, 1.1 * c, 0.7, e, 1.6);
446
446
  }
447
- i.area || (this.lastFlare = { name: i.node, op: i.op, at: e, idx: s });
447
+ o.area || (this.lastFlare = { name: o.node, op: o.op, at: e, idx: s });
448
448
  }
449
449
  if (f > this.burst[s]) {
450
450
  this.burst[s] = f;
451
- const l = q.instances.get(i.instance), r = i.op === "write" ? V : l ? yt[l.type] : V;
452
- this.flareCol[s * 3] = r.r, this.flareCol[s * 3 + 1] = r.g, this.flareCol[s * 3 + 2] = r.b, i.op === "write" && (this.burstW[s] = 1);
451
+ const l = q.instances.get(o.instance), r = o.op === "write" ? V : l ? yt[l.type] : V;
452
+ this.flareCol[s * 3] = r.r, this.flareCol[s * 3 + 1] = r.g, this.flareCol[s * 3 + 2] = r.b, o.op === "write" && (this.burstW[s] = 1);
453
453
  }
454
454
  }
455
455
  }
456
456
  updateNebula(e) {
457
457
  if (!this.nAnchors || !Z.graphWanted) return;
458
- const c = j(this.nebGeo, "position"), i = j(this.nebGeo, "acol"), s = j(this.nebGeo, "size"), n = Math.cos(this.nebAngle), f = Math.sin(this.nebAngle), l = e * nt, r = this.aLocal, t = this.aCol, o = this.flareCol;
458
+ const c = j(this.nebGeo, "position"), o = j(this.nebGeo, "acol"), s = j(this.nebGeo, "size"), n = Math.cos(this.nebAngle), f = Math.sin(this.nebAngle), l = e * nt, r = this.aLocal, t = this.aCol, i = this.flareCol;
459
459
  for (let a = 0; a < it; a++) {
460
- const M = this.nA[a], d = this.burst[M], x = l * this.nSpin[a], y = Math.cos(x), m = Math.sin(x), P = this.nO[a * 3], _ = this.nO[a * 3 + 2], B = 1 + d * (2.2 + this.burstW[M] * 4.5), E = r[M * 3] + (P * y - _ * m) * B, k = r[M * 3 + 2] + (P * m + _ * y) * B, D = r[M * 3 + 1] + this.nO[a * 3 + 1] * B;
460
+ const M = this.nA[a], u = this.burst[M], x = l * this.nSpin[a], y = Math.cos(x), m = Math.sin(x), P = this.nO[a * 3], _ = this.nO[a * 3 + 2], B = 1 + u * (2.2 + this.burstW[M] * 4.5), E = r[M * 3] + (P * y - _ * m) * B, k = r[M * 3 + 2] + (P * m + _ * y) * B, D = r[M * 3 + 1] + this.nO[a * 3 + 1] * B;
461
461
  c[a * 3] = E * n - k * f, c[a * 3 + 1] = D, c[a * 3 + 2] = E * f + k * n;
462
462
  const C = this.nB[a] * 0.3;
463
- i[a * 3] = t[M * 3] * C + 0.05 + o[M * 3] * d * 2.4, i[a * 3 + 1] = t[M * 3 + 1] * C + 0.06 + o[M * 3 + 1] * d * 2.4, i[a * 3 + 2] = t[M * 3 + 2] * C + 0.12 + o[M * 3 + 2] * d * 2.4, s[a] = 0.3 + this.nB[a] * 0.2 + d * 0.5;
463
+ o[a * 3] = t[M * 3] * C + 0.05 + i[M * 3] * u * 2.4, o[a * 3 + 1] = t[M * 3 + 1] * C + 0.06 + i[M * 3 + 1] * u * 2.4, o[a * 3 + 2] = t[M * 3 + 2] * C + 0.12 + i[M * 3 + 2] * u * 2.4, s[a] = 0.3 + this.nB[a] * 0.2 + u * 0.5;
464
464
  }
465
465
  ut(this.nebGeo);
466
466
  const p = j(this.anchorGeo, "position"), b = j(this.anchorGeo, "acol"), R = j(this.anchorGeo, "size"), z = this.nAnchors;
467
467
  for (let a = 0; a < z; a++) {
468
- const M = r[a * 3], d = r[a * 3 + 2];
469
- p[a * 3] = M * n - d * f, p[a * 3 + 1] = r[a * 3 + 1], p[a * 3 + 2] = M * f + d * n;
468
+ const M = r[a * 3], u = r[a * 3 + 2];
469
+ p[a * 3] = M * n - u * f, p[a * 3 + 1] = r[a * 3 + 1], p[a * 3 + 2] = M * f + u * n;
470
470
  const x = this.burst[a], y = this.aNamed[a] ? 2.2 : 1.1;
471
- b[a * 3] = t[a * 3] * y + o[a * 3] * x * 7, b[a * 3 + 1] = t[a * 3 + 1] * y + o[a * 3 + 1] * x * 7, b[a * 3 + 2] = t[a * 3 + 2] * y + o[a * 3 + 2] * x * 7, R[a] = (this.aNamed[a] ? 1.25 : 0.75) * (1 + x * 3.5);
471
+ b[a * 3] = t[a * 3] * y + i[a * 3] * x * 7, b[a * 3 + 1] = t[a * 3 + 1] * y + i[a * 3 + 1] * x * 7, b[a * 3 + 2] = t[a * 3 + 2] * y + i[a * 3 + 2] * x * 7, R[a] = (this.aNamed[a] ? 1.25 : 0.75) * (1 + x * 3.5);
472
472
  }
473
473
  ut(this.anchorGeo);
474
474
  const v = this.edgeGeo.getAttribute("position").array, h = this.edgeGeo.getAttribute("color").array, A = this.edgeA, I = this.nEdge * 2;
475
475
  for (let a = 0; a < I; a++) {
476
- const M = A[a], d = A[a ^ 1], x = r[M * 3], y = r[M * 3 + 2];
476
+ const M = A[a], u = A[a ^ 1], x = r[M * 3], y = r[M * 3 + 2];
477
477
  v[a * 3] = x * n - y * f, v[a * 3 + 1] = r[M * 3 + 1], v[a * 3 + 2] = x * f + y * n;
478
- const m = Math.max(this.burst[M], this.burst[d] * 0.6);
479
- h[a * 3] = t[M * 3] * 0.32 + 0.05 + o[M * 3] * m * 3, h[a * 3 + 1] = t[M * 3 + 1] * 0.32 + 0.06 + o[M * 3 + 1] * m * 3, h[a * 3 + 2] = t[M * 3 + 2] * 0.32 + 0.1 + o[M * 3 + 2] * m * 3;
478
+ const m = Math.max(this.burst[M], this.burst[u] * 0.6);
479
+ h[a * 3] = t[M * 3] * 0.32 + 0.05 + i[M * 3] * m * 3, h[a * 3 + 1] = t[M * 3 + 1] * 0.32 + 0.06 + i[M * 3 + 1] * m * 3, h[a * 3 + 2] = t[M * 3 + 2] * 0.32 + 0.1 + i[M * 3 + 2] * m * 3;
480
480
  }
481
481
  this.edgeGeo.getAttribute("color").needsUpdate = !0, this.edgeGeo.getAttribute("position").needsUpdate = !0;
482
482
  }
483
483
  updateRunCurrents(e, c) {
484
- const i = j(this.runGeo, "position"), s = j(this.runGeo, "acol"), n = j(this.runGeo, "size"), f = c * nt, l = this.stTh, r = this.stB;
484
+ const o = j(this.runGeo, "position"), s = j(this.runGeo, "acol"), n = j(this.runGeo, "size"), f = c * nt, l = this.stTh, r = this.stB;
485
485
  for (let t = 0; t < F; t++) {
486
- const o = this.runRef[t], p = this.rAlpha[t], b = t * $;
487
- if (!o || p < 0.01) {
486
+ const i = this.runRef[t], p = this.rAlpha[t], b = t * $;
487
+ if (!i || p < 0.01) {
488
488
  for (let y = 0; y < $; y++) n[b + y] = 0;
489
489
  continue;
490
490
  }
@@ -492,16 +492,16 @@ class Xe {
492
492
  for (let y = 0; y < 3; y++) {
493
493
  const m = this.rAt[t * 6 + y * 2] - R, P = this.rAt[t * 6 + y * 2 + 1] - z;
494
494
  l[y] = m * m + P * P < 0.6 ? -Math.PI / 2 : Math.atan2(P, m);
495
- const _ = zt(o, y);
495
+ const _ = zt(i, y);
496
496
  r[y] = this.rSteps[t] ? _ === "running" ? 2.2 : _ === "done" ? 0.5 : 0 : 0;
497
497
  }
498
- const h = (e - o.handoffAt) / 1e3, A = this.rSteps[t] === 1 && o.handoffAt > 0 && h < 2.4, I = l[o.handoffFrom];
499
- let a = (l[o.handoffTo] - I) % X;
498
+ const h = (e - i.handoffAt) / 1e3, A = this.rSteps[t] === 1 && i.handoffAt > 0 && h < 2.4, I = l[i.handoffFrom];
499
+ let a = (l[i.handoffTo] - I) % X;
500
500
  a < 0 && (a += X);
501
- const M = a * Math.min(1, 1 - Math.pow(1 - Math.min(1, h / 1.4), 3)), d = A ? 3.2 * (1 - h / 2.4) : 0, x = this.rCol[t];
501
+ const M = a * Math.min(1, 1 - Math.pow(1 - Math.min(1, h / 1.4), 3)), u = A ? 3.2 * (1 - h / 2.4) : 0, x = this.rCol[t];
502
502
  for (let y = 0; y < $; y++) {
503
503
  const m = b + y, P = this.rTh[m] + f * this.rSp[m], _ = v + this.rRr[m] + 0.16 * Math.sin(3 * P + f * 0.6 + m);
504
- i[m * 3] = R + Math.cos(P) * _, i[m * 3 + 1] = 0.25 + this.rY[m], i[m * 3 + 2] = z + Math.sin(P) * _;
504
+ o[m * 3] = R + Math.cos(P) * _, o[m * 3 + 1] = 0.25 + this.rY[m], o[m * 3 + 2] = z + Math.sin(P) * _;
505
505
  let B = 0;
506
506
  for (let C = 0; C < 3; C++) {
507
507
  if (r[C] === 0) continue;
@@ -513,7 +513,7 @@ class Xe {
513
513
  let C = (P - I) % X;
514
514
  if (C < 0 && (C += X), C <= M && C <= a + 0.1) {
515
515
  const L = Math.exp(-(M - C) * 2.2);
516
- B += d * (0.4 + L), E = 0.6 * L;
516
+ B += u * (0.4 + L), E = 0.6 * L;
517
517
  }
518
518
  }
519
519
  const k = Math.exp(-this.rRr[m] * this.rRr[m] * 4), D = p * (0.32 + 0.5 * k + B);
@@ -523,13 +523,13 @@ class Xe {
523
523
  ut(this.runGeo);
524
524
  }
525
525
  updateStreams(e, c) {
526
- const i = j(this.streamGeo, "position"), s = j(this.streamGeo, "acol"), n = j(this.streamGeo, "size");
526
+ const o = j(this.streamGeo, "position"), s = j(this.streamGeo, "acol"), n = j(this.streamGeo, "size");
527
527
  let f = 0;
528
- const l = (h, A, I, a, M, d, x) => {
529
- f >= Et || (i[f * 3] = h, i[f * 3 + 1] = A, i[f * 3 + 2] = I, s[f * 3] = a, s[f * 3 + 1] = M, s[f * 3 + 2] = d, n[f] = x, f++);
528
+ const l = (h, A, I, a, M, u, x) => {
529
+ f >= Et || (o[f * 3] = h, o[f * 3 + 1] = A, o[f * 3 + 2] = I, s[f * 3] = a, s[f * 3 + 1] = M, s[f * 3 + 2] = u, n[f] = x, f++);
530
530
  }, r = (h, A, I, a, M) => {
531
- const d = (h.x + A.x) / 2, x = (h.y + A.y) / 2 + I, y = (h.z + A.z) / 2, m = 1 - a;
532
- return M.set(m * m * h.x + 2 * m * a * d + a * a * A.x, m * m * h.y + 2 * m * a * x + a * a * A.y, m * m * h.z + 2 * m * a * y + a * a * A.z);
531
+ const u = (h.x + A.x) / 2, x = (h.y + A.y) / 2 + I, y = (h.z + A.z) / 2, m = 1 - a;
532
+ return M.set(m * m * h.x + 2 * m * a * u + a * a * A.x, m * m * h.y + 2 * m * a * x + a * a * A.y, m * m * h.z + 2 * m * a * y + a * a * A.z);
533
533
  };
534
534
  for (let h = 0; h < F; h++) {
535
535
  const A = this.runRef[h];
@@ -538,12 +538,12 @@ class Xe {
538
538
  if (I > 2.4 || !this.rSteps[h] || this.rAlpha[h] < 0.01) continue;
539
539
  this.attractor(h, A.handoffFrom, S), this.attractor(h, A.handoffTo, N);
540
540
  const a = this.rCol[h], M = 220;
541
- for (let d = 0; d < M; d++) {
542
- const x = (I - d / M * 1.4) / 0.9;
541
+ for (let u = 0; u < M; u++) {
542
+ const x = (I - u / M * 1.4) / 0.9;
543
543
  if (x < 0 || x > 1) continue;
544
544
  r(S, N, 2.2, x, T);
545
545
  const y = Math.sin(x * Math.PI) * 0.35, m = (1 - x * 0.4) * 2.4;
546
- l(T.x + (K(d) - 0.5) * y, T.y + (K(d + 7) - 0.5) * y, T.z + (K(d + 13) - 0.5) * y, (a.r * 0.6 + 0.4) * m, (a.g * 0.6 + 0.4) * m, (a.b * 0.6 + 0.4) * m, 0.7 + (d % 9 === 0 ? 0.8 : 0));
546
+ l(T.x + (K(u) - 0.5) * y, T.y + (K(u + 7) - 0.5) * y, T.z + (K(u + 13) - 0.5) * y, (a.r * 0.6 + 0.4) * m, (a.g * 0.6 + 0.4) * m, (a.b * 0.6 + 0.4) * m, 0.7 + (u % 9 === 0 ? 0.8 : 0));
547
547
  }
548
548
  }
549
549
  for (const h of q.comets) {
@@ -551,19 +551,19 @@ class Xe {
551
551
  if (!A || !I || h.failed && !Se(h, e)) continue;
552
552
  const a = Ge(h, e), M = a < 0.5 ? 2 * a * a : 1 - Math.pow(-2 * a + 2, 2) / 2;
553
553
  S.set(A.x, A.y, A.z), N.set(I.x, I.y, I.z);
554
- const d = S.distanceTo(N), x = A.inst ? yt[A.inst.type] : V, y = h.failed ? 1 : a >= 1 ? Math.max(0, 1 - (e - h.start - h.dur) / 250) : 1;
554
+ const u = S.distanceTo(N), x = A.inst ? yt[A.inst.type] : V, y = h.failed ? 1 : a >= 1 ? Math.max(0, 1 - (e - h.start - h.dur) / 250) : 1;
555
555
  for (let m = 0; m < 90; m++) {
556
556
  const P = M - m * 55e-4;
557
557
  if (P < 0) break;
558
- r(S, N, 1.2 + d * 0.16, P, T);
558
+ r(S, N, 1.2 + u * 0.16, P, T);
559
559
  const _ = m * 6e-3, B = (m === 0 ? 7 : 3.2 * Math.pow(1 - m / 90, 1.6)) * y;
560
560
  l(T.x + (K(h.id + m) - 0.5) * _, T.y + (K(h.id * 3 + m) - 0.5) * _, T.z + (K(h.id * 7 + m) - 0.5) * _, (x.r * 0.7 + 0.3) * B, (x.g * 0.7 + 0.3) * B, (x.b * 0.7 + 0.3) * B, m === 0 ? 2.6 : 0.85 - m * 6e-3);
561
561
  }
562
562
  }
563
- const t = this.beamGeo.getAttribute("position").array, o = this.beamGeo.getAttribute("color").array;
563
+ const t = this.beamGeo.getAttribute("position").array, i = this.beamGeo.getAttribute("color").array;
564
564
  let p = 0;
565
- const b = (h, A, I, a, M, d, x, y, m, P, _, B) => {
566
- t.set([h, A, I, a, M, d], p * 6), o.set([x, y, m, P, _, B], p * 6), p++;
565
+ const b = (h, A, I, a, M, u, x, y, m, P, _, B) => {
566
+ t.set([h, A, I, a, M, u], p * 6), i.set([x, y, m, P, _, B], p * 6), p++;
567
567
  }, R = this.nAnchors > 0 && Z.graphWanted && Z.graph.mix > 0.05;
568
568
  for (const h of q.flares) {
569
569
  if (!R || p >= _t) break;
@@ -572,12 +572,12 @@ class Xe {
572
572
  const I = (e - h.start) / 2600;
573
573
  if (I >= 1) continue;
574
574
  this.anchorWorld(this.anchorIdx(h.node), N), S.set(A.x, A.y, A.z);
575
- const a = h.op === "write", M = a ? V : A.inst ? yt[A.inst.type] : V, d = (1 - I) * (a ? 1.6 : 1);
576
- b(S.x, S.y, S.z, N.x, N.y, N.z, M.r * d * 0.6, M.g * d * 0.6, M.b * d * 0.6, M.r * d * 1.4, M.g * d * 1.4, M.b * d * 1.4);
575
+ const a = h.op === "write", M = a ? V : A.inst ? yt[A.inst.type] : V, u = (1 - I) * (a ? 1.6 : 1);
576
+ b(S.x, S.y, S.z, N.x, N.y, N.z, M.r * u * 0.6, M.g * u * 0.6, M.b * u * 0.6, M.r * u * 1.4, M.g * u * 1.4, M.b * u * 1.4);
577
577
  for (let x = 0; x < 22; x++) {
578
578
  let y = ((e - h.start) / 1e3 * 0.75 + x / 22) % 1;
579
579
  a || (y = 1 - y), r(S, N, 1.2, y, T);
580
- const m = 2.4 * d * Math.sin(y * Math.PI);
580
+ const m = 2.4 * u * Math.sin(y * Math.PI);
581
581
  l(T.x, T.y, T.z, M.r * m, M.g * m, M.b * m, 0.55);
582
582
  }
583
583
  }
@@ -587,13 +587,13 @@ class Xe {
587
587
  const M = (e - h.start) / h.dur;
588
588
  if (M > 1) continue;
589
589
  S.set(A.x, A.y, A.z), N.copy(a).setY(Gt);
590
- const d = h.phase === "call" ? S : N, x = h.phase === "call" ? N : S;
590
+ const u = h.phase === "call" ? S : N, x = h.phase === "call" ? N : S;
591
591
  G.set(I.color);
592
592
  const y = 1 - Math.pow(1 - M, 2);
593
593
  for (let m = 0; m < 60; m++) {
594
594
  const P = y - m * 8e-3;
595
595
  if (P < 0) break;
596
- r(d, x, 3, P, T);
596
+ r(u, x, 3, P, T);
597
597
  const _ = (m === 0 ? 6 : 2.6 * (1 - m / 60)) * (h.phase === "result" ? 1.2 : 1);
598
598
  l(T.x, T.y, T.z, (G.r * 0.75 + 0.25) * _, (G.g * 0.75 + 0.25) * _, (G.b * 0.75 + 0.25) * _, m === 0 ? 2.2 : 0.7);
599
599
  }
@@ -601,9 +601,9 @@ class Xe {
601
601
  let z = 0;
602
602
  const v = (h, A, I, a) => {
603
603
  if (z >= Lt) return;
604
- const M = this.slotOf(h), d = q.mcpServers.get(A), x = Tt(A);
605
- if (!M || !d || !x) return;
606
- z++, S.set(M.x, M.y, M.z), N.copy(x).setY(Gt), G.set(d.color), I < 2 ? G.lerp(ee, Math.min(1, I / 2)) : G.copy(ee).lerp(Ne, Math.min(1, I - 2));
604
+ const M = this.slotOf(h), u = q.mcpServers.get(A), x = Tt(A);
605
+ if (!M || !u || !x) return;
606
+ z++, S.set(M.x, M.y, M.z), N.copy(x).setY(Gt), G.set(u.color), I < 2 ? G.lerp(ee, Math.min(1, I / 2)) : G.copy(ee).lerp(We, Math.min(1, I - 2));
607
607
  const y = a >= 0 ? (1 - a) * 1.2 : 0.5 + Math.min(1.8, I * 0.6), m = c * 2.2;
608
608
  let P = S.x, _ = S.y, B = S.z;
609
609
  for (let E = 1; E <= Rt; E++) {
@@ -637,70 +637,70 @@ class Xe {
637
637
  n[h] = 0;
638
638
  this.streamGeo.setDrawRange(0, Math.max(f, 1)), ut(this.streamGeo), this.beamGeo.setDrawRange(0, p * 2), this.beamGeo.getAttribute("position").needsUpdate = !0, this.beamGeo.getAttribute("color").needsUpdate = !0;
639
639
  }
640
- setInst(e, c, i, s, n, f, l, r = 0, t = 0, o = 0) {
641
- Q.position.set(i, s, n), Q.rotation.set(r, t, o), Q.scale.setScalar(Math.max(1e-4, f)), Q.updateMatrix(), e.setMatrixAt(c, Q.matrix), e.setColorAt(c, l);
640
+ setInst(e, c, o, s, n, f, l, r = 0, t = 0, i = 0) {
641
+ Q.position.set(o, s, n), Q.rotation.set(r, t, i), Q.scale.setScalar(Math.max(1e-4, f)), Q.updateMatrix(), e.setMatrixAt(c, Q.matrix), e.setColorAt(c, l);
642
642
  }
643
- updateMeshes(e, c, i) {
644
- const s = j(this.glowGeo, "position"), n = j(this.glowGeo, "acol"), f = j(this.glowGeo, "size"), l = (t, o, p, b, R, z, v) => {
645
- s[t * 3] = o, s[t * 3 + 1] = p, s[t * 3 + 2] = b, n[t * 3] = R.r * z, n[t * 3 + 1] = R.g * z, n[t * 3 + 2] = R.b * z, f[t] = v;
643
+ updateMeshes(e, c, o) {
644
+ const s = j(this.glowGeo, "position"), n = j(this.glowGeo, "acol"), f = j(this.glowGeo, "size"), l = (t, i, p, b, R, z, v) => {
645
+ s[t * 3] = i, s[t * 3 + 1] = p, s[t * 3 + 2] = b, n[t * 3] = R.r * z, n[t * 3 + 1] = R.g * z, n[t * 3 + 2] = R.b * z, f[t] = v;
646
646
  };
647
647
  let r = null;
648
648
  for (let t = 0; t < Y; t++) {
649
- const o = this.slots[t];
650
- if (!o.used || !o.inst) {
649
+ const i = this.slots[t];
650
+ if (!i.used || !i.inst) {
651
651
  this.setInst(this.cores, t, 0, -999, 0, 0, G.setRGB(0, 0, 0)), f[t] = 0;
652
652
  continue;
653
653
  }
654
- o.id === this.selectedId && (r = o);
655
- const p = o.inst, b = (e - p.bornAt) / 1e3, R = Math.exp(-b * 3.5), z = p.exitAt ? (e - p.exitAt) / 1e3 : -1, v = z >= 0 ? Math.exp(-z * 5) : 0, A = p.status === "thinking" && !p.exitAt ? 0.1 * Math.sin(c * 9 + t) : 0, I = z >= 0 ? Math.pow(o.p, 1.6) : o.p, a = et.scale, M = (I * (1 + o.e * 0.45 + A) + v * 0.9 + R * 0.6) * a;
656
- G.setRGB(o.r, o.g, o.b).multiplyScalar(1.3 + o.bright * 1.5 + o.e * 1.1), G.lerp(J.setRGB(4, 4, 4), Math.min(1, R + v)), this.setInst(this.cores, t, o.x, o.y, o.z, M, G, c * o.omega * 0.3, c * o.omega, 0), G.setRGB(o.r, o.g, o.b), l(t, o.x, o.y, o.z, G, (0.3 + o.bright * 0.4 + o.e * 0.5 + R * 2 + v * 2.5) * o.p + v, (5 + o.e * 4 + R * 10 + v * 14) * Math.max(o.p, v) * a);
654
+ i.id === this.selectedId && (r = i);
655
+ const p = i.inst, b = (e - p.bornAt) / 1e3, R = Math.exp(-b * 3.5), z = p.exitAt ? (e - p.exitAt) / 1e3 : -1, v = z >= 0 ? Math.exp(-z * 5) : 0, A = p.status === "thinking" && !p.exitAt ? 0.1 * Math.sin(c * 9 + t) : 0, I = z >= 0 ? Math.pow(i.p, 1.6) : i.p, a = et.scale, M = (I * (1 + i.e * 0.45 + A) + v * 0.9 + R * 0.6) * a, u = 1 - 0.75 * ze(i.id);
656
+ G.setRGB(i.r, i.g, i.b).multiplyScalar((1.3 + i.bright * 1.5 + i.e * 1.1) * u), G.lerp(J.setRGB(4, 4, 4), Math.min(1, R + v)), this.setInst(this.cores, t, i.x, i.y, i.z, M, G, c * i.omega * 0.3, c * i.omega, 0), G.setRGB(i.r, i.g, i.b).multiplyScalar(u), l(t, i.x, i.y, i.z, G, (0.3 + i.bright * 0.4 + i.e * 0.5 + R * 2 + v * 2.5) * i.p + v, (5 + i.e * 4 + R * 10 + v * 14) * Math.max(i.p, v) * a);
657
657
  }
658
658
  r ? (this.selRing.visible = !0, this.selRing.position.set(r.x, r.y, r.z), this.selRing.rotation.y = c * 1.5, this.selRing.scale.setScalar(1 + 0.08 * Math.sin(c * 4)), this.selRing.material.color.setRGB(r.r * 3, r.g * 3, r.b * 3)) : this.selRing.visible = !1;
659
659
  for (let t = 0; t < F; t++) {
660
- const o = this.runRef[t], p = this.rAlpha[t];
660
+ const i = this.runRef[t], p = this.rAlpha[t];
661
661
  for (let b = 0; b < 3; b++) {
662
662
  const R = t * 3 + b, z = Y + R;
663
- if (!o || p < 0.01 || !this.rSteps[t]) {
663
+ if (!i || p < 0.01 || !this.rSteps[t]) {
664
664
  this.setInst(this.attractors, R, 0, -999, 0, 0, G.setRGB(0, 0, 0)), this.setInst(this.stepRings, R, 0, -999, 0, 0, G), f[z] = 0;
665
665
  continue;
666
666
  }
667
667
  this.attractor(t, b, S);
668
- const v = zt(o, b), h = this.rCol[t];
669
- let A = 0.6, I = 0.5, a = 0.25, M = 0.9, d = 0.12, x = 4;
668
+ const v = zt(i, b), h = this.rCol[t];
669
+ let A = 0.6, I = 0.5, a = 0.25, M = 0.9, u = 0.12, x = 4;
670
670
  if (G.copy(h), v === "running") {
671
671
  const y = 0.5 + 0.5 * Math.sin(c * 5);
672
- A = 1.15 + y * 0.2, G.lerp(V, 0.45), I = 3 + y * 1.5, a = 1.4 + y, M = 1.15 + y * 0.25, d = 1.1 + y * 0.6, x = 12;
673
- } else v === "done" ? (A = 0.85, I = 1.8, a = 0.7, M = 0.95, d = 0.4, x = 6) : v === "failed" && G.copy(We);
674
- if (o.handoffAt && b === o.handoffTo) {
675
- const y = (e - o.handoffAt) / 1e3 - 1.2;
672
+ A = 1.15 + y * 0.2, G.lerp(V, 0.45), I = 3 + y * 1.5, a = 1.4 + y, M = 1.15 + y * 0.25, u = 1.1 + y * 0.6, x = 12;
673
+ } else v === "done" ? (A = 0.85, I = 1.8, a = 0.7, M = 0.95, u = 0.4, x = 6) : v === "failed" && G.copy(Xe);
674
+ if (i.handoffAt && b === i.handoffTo) {
675
+ const y = (e - i.handoffAt) / 1e3 - 1.2;
676
676
  if (y > 0 && y < 1) {
677
677
  const m = Math.exp(-y * 4);
678
- A += m * 0.8, d += m * 2, x += m * 10;
678
+ A += m * 0.8, u += m * 2, x += m * 10;
679
679
  }
680
680
  }
681
- J.copy(G).multiplyScalar(I * p), this.setInst(this.attractors, R, S.x, S.y, S.z, A, J, 0, c * 0.6, 0), J.copy(G).multiplyScalar(a * p), this.setInst(this.stepRings, R, S.x, S.y, S.z, M, J, 0, v === "running" ? c * 1.6 : 0.3, 0), l(z, S.x, S.y, S.z, G, d * p, x);
681
+ J.copy(G).multiplyScalar(I * p), this.setInst(this.attractors, R, S.x, S.y, S.z, A, J, 0, c * 0.6, 0), J.copy(G).multiplyScalar(a * p), this.setInst(this.stepRings, R, S.x, S.y, S.z, M, J, 0, v === "running" ? c * 1.6 : 0.3, 0), l(z, S.x, S.y, S.z, G, u * p, x);
682
682
  }
683
683
  }
684
684
  for (let t = 0; t < ht; t++) {
685
- const o = Y + F * 3 + t;
686
- this.setInst(this.pulsars, t, 0, -999, 0, 0, G.setRGB(0, 0, 0)), this.setInst(this.pulsarBeams, t, 0, -999, 0, 0, G), f[o] = 0;
685
+ const i = Y + F * 3 + t;
686
+ this.setInst(this.pulsars, t, 0, -999, 0, 0, G.setRGB(0, 0, 0)), this.setInst(this.pulsarBeams, t, 0, -999, 0, 0, G), f[i] = 0;
687
687
  }
688
688
  for (const t of q.mcpServers.values()) {
689
- const o = t.slot % ht, p = Y + F * 3 + o, b = Tt(t.name);
689
+ const i = t.slot % ht, p = Y + F * 3 + i, b = Tt(t.name);
690
690
  if (!b) continue;
691
691
  S.copy(b).setY(Gt);
692
- const R = ze(t.activeAt, e, 2.5), z = t.inflight > 0 ? 1 : 0;
693
- this.mcpSpin[o] += i * (0.4 + z * 3.5) * nt;
694
- const v = 0.5 + 0.5 * Math.sin(c * (z ? 9 : 2.2) + o);
695
- G.set(t.color), J.copy(G).multiplyScalar(1.6 + z * 1.6 + R * 3 + v * 0.6), this.setInst(this.pulsars, o, S.x, S.y, S.z, 1 + R * 0.6 + z * 0.2 * v, J, 0, this.mcpSpin[o], 0), J.copy(G).multiplyScalar(0.25 + z * 0.9 * v + R * 0.8), this.setInst(this.pulsarBeams, o, S.x, S.y, S.z, 1 + z * 0.3, J, 0.5 * Math.sin(this.mcpSpin[o] * 0.5), this.mcpSpin[o], 0.35 + 0.3 * Math.cos(this.mcpSpin[o])), l(p, S.x, S.y, S.z, G, 0.2 + z * 0.25 * v + R * 0.35, 5 + R * 3 + z * 2);
692
+ const R = ve(t.activeAt, e, 2.5), z = t.inflight > 0 ? 1 : 0;
693
+ this.mcpSpin[i] += o * (0.4 + z * 3.5) * nt;
694
+ const v = 0.5 + 0.5 * Math.sin(c * (z ? 9 : 2.2) + i);
695
+ G.set(t.color), J.copy(G).multiplyScalar(1.6 + z * 1.6 + R * 3 + v * 0.6), this.setInst(this.pulsars, i, S.x, S.y, S.z, 1 + R * 0.6 + z * 0.2 * v, J, 0, this.mcpSpin[i], 0), J.copy(G).multiplyScalar(0.25 + z * 0.9 * v + R * 0.8), this.setInst(this.pulsarBeams, i, S.x, S.y, S.z, 1 + z * 0.3, J, 0.5 * Math.sin(this.mcpSpin[i] * 0.5), this.mcpSpin[i], 0.35 + 0.3 * Math.cos(this.mcpSpin[i])), l(p, S.x, S.y, S.z, G, 0.2 + z * 0.25 * v + R * 0.35, 5 + R * 3 + z * 2);
696
696
  }
697
697
  for (let t = 0; t < ot; t++) {
698
- const o = (e - this.ringStart[t]) / (this.ringDur[t] * 1e3);
699
- if (o < 0 || o >= 1) {
698
+ const i = (e - this.ringStart[t]) / (this.ringDur[t] * 1e3);
699
+ if (i < 0 || i >= 1) {
700
700
  this.setInst(this.rings, t, 0, -999, 0, 0, G.setRGB(0, 0, 0));
701
701
  continue;
702
702
  }
703
- const p = 1 - Math.pow(1 - o, 3), b = (1 - o) * (1 - o);
703
+ const p = 1 - Math.pow(1 - i, 3), b = (1 - i) * (1 - i);
704
704
  G.setRGB(this.ringCol[t * 3] * b, this.ringCol[t * 3 + 1] * b, this.ringCol[t * 3 + 2] * b), this.setInst(this.rings, t, this.ringPos[t * 3], this.ringPos[t * 3 + 1], this.ringPos[t * 3 + 2], 0.15 + this.ringMax[t] * p, G);
705
705
  }
706
706
  for (const t of [this.cores, this.attractors, this.stepRings, this.rings, this.pulsars, this.pulsarBeams])
@@ -708,9 +708,9 @@ class Xe {
708
708
  ut(this.glowGeo);
709
709
  }
710
710
  }
711
- const qe = { tint: "#a5b4fc", tintAmt: 0.2, gain: 0.6, halo: 0.25, lift: Gt }, lt = new w.Vector3(), Ye = ["planner", "researcher", "writer"], rt = { engine: null }, Ut = () => rt.engine ?? (rt.engine = new Xe());
712
- function Ke() {
713
- const g = Ut(), e = ue((i) => i.gl), c = Te();
711
+ const Ye = { tint: "#a5b4fc", tintAmt: 0.2, gain: 0.6, halo: 0.25, lift: Gt }, lt = new w.Vector3(), Ke = ["planner", "researcher", "writer"], rt = { engine: null }, Ut = () => rt.engine ?? (rt.engine = new qe());
712
+ function Ze() {
713
+ const g = Ut(), e = ue((o) => o.gl), c = Ee();
714
714
  return At(() => {
715
715
  g.setGalaxy(c);
716
716
  }, [g, c]), At(() => {
@@ -720,8 +720,8 @@ function Ke() {
720
720
  g.dispose(), rt.engine === g && (rt.engine = null);
721
721
  },
722
722
  [g]
723
- ), gt((i, s) => {
724
- g.update(s, performance.now(), i.clock.elapsedTime);
723
+ ), gt((o, s) => {
724
+ g.update(s, performance.now(), o.clock.elapsedTime);
725
725
  }), /* @__PURE__ */ dt("group", { children: [
726
726
  /* @__PURE__ */ O("points", { geometry: g.fieldGeo, material: g.material, frustumCulled: !1 }),
727
727
  /* @__PURE__ */ O("points", { geometry: g.runGeo, material: g.material, frustumCulled: !1 }),
@@ -736,8 +736,8 @@ function Ke() {
736
736
  /* @__PURE__ */ O("primitive", { object: g.selRing })
737
737
  ] });
738
738
  }
739
- function Ze({ agent: g, selected: e, onSelect: c }) {
740
- const i = st(null);
739
+ function He({ agent: g, selected: e, onSelect: c }) {
740
+ const o = st(null);
741
741
  return At(() => {
742
742
  const s = Ut();
743
743
  e ? s.selectedId = g.id : s.selectedId === g.id && (s.selectedId = null);
@@ -748,12 +748,12 @@ function Ze({ agent: g, selected: e, onSelect: c }) {
748
748
  },
749
749
  [g.id]
750
750
  ), gt(() => {
751
- const s = i.current;
751
+ const s = o.current;
752
752
  s && (s.position.copy(g.live), s.scale.setScalar(Math.max(0.6, et.scale) * (g.depth ? 0.8 : 1)), s.visible = !g.inst.exitAt);
753
753
  }), /* @__PURE__ */ dt(
754
754
  "mesh",
755
755
  {
756
- ref: i,
756
+ ref: o,
757
757
  onClick: (s) => (s.stopPropagation(), c(g.id)),
758
758
  onPointerOver: () => document.body.style.cursor = "pointer",
759
759
  onPointerOut: () => document.body.style.cursor = "",
@@ -764,19 +764,19 @@ function Ze({ agent: g, selected: e, onSelect: c }) {
764
764
  }
765
765
  );
766
766
  }
767
- function He({ run: g }) {
768
- Fe();
769
- const e = g.run ?? q.runs.get(g.id), c = st(null), i = st([]);
767
+ function Ve({ run: g }) {
768
+ Be();
769
+ const e = g.run ?? q.runs.get(g.id), c = st(null), o = st([]);
770
770
  if (gt(() => {
771
771
  var l;
772
772
  (l = c.current) == null || l.position.set(g.origin.x, 0.6, g.origin.z - Math.min(11, Math.hypot(g.hu, g.hv) * 0.92 + 0.6) - 1.3);
773
773
  for (let r = 0; r < 3; r++) {
774
- const t = i.current[r];
775
- t && (ne(g, ie(Ye[r]), 0, lt), t.position.set(lt.x, 1.45 * Math.max(0.85, et.scale), lt.z + 0.9 * et.spread));
774
+ const t = o.current[r];
775
+ t && (ne(g, ie(Ke[r]), 0, lt), t.position.set(lt.x, 1.45 * Math.max(0.85, et.scale), lt.z + 0.9 * et.spread));
776
776
  }
777
777
  }), !e) return null;
778
778
  const s = et.w < 900, n = (l) => l === "running" ? e.color : l === "done" ? "#cbd5e1" : l === "failed" ? "#fecaca" : "#64748b", f = () => {
779
- const { shown: l, more: r } = ke(e), t = l.map((o, p) => ({ text: `${p ? " " : ""}${o.toUpperCase()}`, color: n(e.steps[o]) }));
779
+ const { shown: l, more: r } = _e(e), t = l.map((i, p) => ({ text: `${p ? " " : ""}${i.toUpperCase()}`, color: n(e.steps[i]) }));
780
780
  return r && t.push({ text: ` +${r}`, color: n("queued") }), e.status === "started" && Jt(e) && t.push({ text: ` ${Qt(e)}`, color: n("queued") }), t;
781
781
  };
782
782
  return /* @__PURE__ */ dt(fe, { children: [
@@ -793,10 +793,10 @@ function He({ run: g }) {
793
793
  pxRange: [10, 14]
794
794
  }
795
795
  ) }),
796
- e.hasSteps && !s && Be.map((l) => /* @__PURE__ */ O("group", { ref: (r) => void (i.current[l] = r), children: /* @__PURE__ */ O(
796
+ e.hasSteps && !s && Oe.map((l) => /* @__PURE__ */ O("group", { ref: (r) => void (o.current[l] = r), children: /* @__PURE__ */ O(
797
797
  vt,
798
798
  {
799
- text: Oe(e, l),
799
+ text: Te(e, l),
800
800
  font: "mono",
801
801
  plate: "none",
802
802
  uppercase: !0,
@@ -810,7 +810,7 @@ function He({ run: g }) {
810
810
  ) }, l))
811
811
  ] });
812
812
  }
813
- function Ve(g) {
813
+ function $e(g) {
814
814
  const e = Ut();
815
815
  return gt(() => {
816
816
  e.nebMaterial.uniforms.uScale.value = e.material.uniforms.uScale.value * Z.graph.scale;
@@ -818,35 +818,35 @@ function Ve(g) {
818
818
  /* @__PURE__ */ O("points", { geometry: e.nebGeo, material: e.nebMaterial, frustumCulled: !1 }),
819
819
  /* @__PURE__ */ O("points", { geometry: e.anchorGeo, material: e.nebMaterial, frustumCulled: !1 }),
820
820
  /* @__PURE__ */ O("lineSegments", { geometry: e.edgeGeo, frustumCulled: !1, children: /* @__PURE__ */ O("lineBasicMaterial", { vertexColors: !0, transparent: !0, blending: w.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) }),
821
- /* @__PURE__ */ O(Pe, { position: [0, -0.6, Dt + 0.9], color: "#a5b4fc", size: 0.34, pxRange: [9.5, 13] })
821
+ /* @__PURE__ */ O(Fe, { position: [0, -0.6, Dt + 0.9], color: "#a5b4fc", size: 0.34, pxRange: [9.5, 13] })
822
822
  ] });
823
823
  }
824
- function $e() {
824
+ function Je() {
825
825
  const g = st(null), e = st(null), c = st("");
826
826
  return gt(() => {
827
827
  var r;
828
- const i = rt.engine;
829
- if (!i) return;
830
- const s = i.selectedId ?? q.focus, n = s ? i.slotOf(s) : null, f = !!n && !!n.inst && !n.inst.exitAt;
828
+ const o = rt.engine;
829
+ if (!o) return;
830
+ const s = o.selectedId ?? q.focus, n = s ? o.slotOf(s) : null, f = !!n && !!n.inst && !n.inst.exitAt;
831
831
  if ((r = e.current) == null || r.setOpacity(f ? 1 : 0), !n || !n.inst || !g.current || !e.current) return;
832
832
  g.current.position.set(n.x, n.y + 1.25 * Math.max(0.85, et.scale), n.z);
833
- const l = (n.inst.job ? Ee(n.inst) : n.inst.name) + " · " + n.inst.status;
833
+ const l = (n.inst.job ? ke(n.inst) : n.inst.name) + " · " + n.inst.status;
834
834
  l !== c.current && (c.current = l, e.current.setText(l), e.current.setColor(oe[n.inst.type]));
835
835
  }), /* @__PURE__ */ O("group", { ref: g, children: /* @__PURE__ */ O(vt, { ref: e, text: "", size: 0.3, opacity: 0, fadeMs: 300, pxRange: [9, 13], renderOrder: 24 }) });
836
836
  }
837
- function Je() {
837
+ function Qe() {
838
838
  const g = st(null), e = st(null), c = st("");
839
839
  return gt(() => {
840
- const i = rt.engine, s = i == null ? void 0 : i.lastFlare;
841
- if (!i || !s || !g.current || !e.current) return;
840
+ const o = rt.engine, s = o == null ? void 0 : o.lastFlare;
841
+ if (!o || !s || !g.current || !e.current) return;
842
842
  const n = (performance.now() - s.at) / 1e3;
843
- e.current.setOpacity(n < 2.2 && Z.graphWanted ? 1 : 0), i.anchorWorld(s.idx, lt), g.current.position.set(lt.x, lt.y + 0.9, lt.z), c.current !== s.name + s.op && (c.current = s.name + s.op, e.current.setText((s.op === "write" ? "wrote · " : "read · ") + s.name), e.current.setColor(s.op === "write" ? "#ffffff" : "#a5b4fc"));
843
+ e.current.setOpacity(n < 2.2 && Z.graphWanted ? 1 : 0), o.anchorWorld(s.idx, lt), g.current.position.set(lt.x, lt.y + 0.9, lt.z), c.current !== s.name + s.op && (c.current = s.name + s.op, e.current.setText((s.op === "write" ? "wrote · " : "read · ") + s.name), e.current.setColor(s.op === "write" ? "#ffffff" : "#a5b4fc"));
844
844
  }), /* @__PURE__ */ O("group", { ref: g, children: /* @__PURE__ */ O(vt, { ref: e, text: "", size: 0.28, opacity: 0, fadeMs: 400, pxRange: [8.5, 12], renderOrder: 24 }) });
845
845
  }
846
- function os() {
846
+ function rs() {
847
847
  const g = Me(() => ({ nRef: 4, min: 0.62, max: 1.45, minRadius: 7 }), []);
848
848
  return /* @__PURE__ */ dt(
849
- Ce,
849
+ Pe,
850
850
  {
851
851
  title: "flow · murmuration",
852
852
  subtitle: "agents are eddies condensing out of the current · hatchet runs are vortices · the knowledge graph is a nebula current on the side",
@@ -860,10 +860,10 @@ function os() {
860
860
  agentRadius: 1.6,
861
861
  graph: { natural: Dt, radius: 3.6 },
862
862
  peripheryGap: 4.5,
863
- Agent: Ze,
864
- RunMarker: He,
865
- mcpStyle: qe,
866
- GraphResource: Ve,
863
+ Agent: He,
864
+ RunMarker: Ve,
865
+ mcpStyle: Ye,
866
+ GraphResource: $e,
867
867
  cluster: { radius: 1.7, variant: "swarm", pointSize: 1.1 },
868
868
  clusterOffset: [0, 1.8, 0],
869
869
  PostFX: /* @__PURE__ */ dt(de, { multisampling: 0, children: [
@@ -872,13 +872,13 @@ function os() {
872
872
  /* @__PURE__ */ O(me, { opacity: 0.03 })
873
873
  ] }),
874
874
  children: [
875
- /* @__PURE__ */ O(Ke, {}),
876
- /* @__PURE__ */ O($e, {}),
877
- /* @__PURE__ */ O(Je, {})
875
+ /* @__PURE__ */ O(Ze, {}),
876
+ /* @__PURE__ */ O(Je, {}),
877
+ /* @__PURE__ */ O(Qe, {})
878
878
  ]
879
879
  }
880
880
  );
881
881
  }
882
882
  export {
883
- os as default
883
+ rs as default
884
884
  };