agentglow 0.4.4 → 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.
@@ -6,7 +6,7 @@ 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, 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-CsXvCpWR.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
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;
@@ -163,23 +163,23 @@ class qe {
163
163
  d(this, "stTh", new Float32Array(3));
164
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 qe {
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 qe {
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
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 qe {
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 qe {
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 = Ue(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);
@@ -335,7 +335,7 @@ class qe {
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
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] = (i = this.runRef[n]) != null && i.hasSteps ? 1 : 0;
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 qe {
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,29 +361,29 @@ class qe {
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
388
  for (let u = 0; u < F; u++)
389
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++);
@@ -393,7 +393,7 @@ class qe {
393
393
  const a = this.fieldR, M = a * a;
394
394
  for (let u = 0; u < W; u++) {
395
395
  const x = u * 3;
396
- let y = i[x], m = i[x + 1], P = i[x + 2];
396
+ let y = o[x], m = o[x + 1], P = o[x + 2];
397
397
  const _ = f[u];
398
398
  if (_ >= 0) {
399
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;
@@ -428,39 +428,39 @@ class qe {
428
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
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] * u * 2.4, i[a * 3 + 1] = t[M * 3 + 1] * C + 0.06 + o[M * 3 + 1] * u * 2.4, i[a * 3 + 2] = t[M * 3 + 2] * C + 0.12 + o[M * 3 + 2] * u * 2.4, s[a] = 0.3 + this.nB[a] * 0.2 + u * 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;
@@ -468,7 +468,7 @@ class qe {
468
468
  const M = r[a * 3], u = r[a * 3 + 2];
469
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;
@@ -476,15 +476,15 @@ class qe {
476
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
478
  const m = Math.max(this.burst[M], this.burst[u] * 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;
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 qe {
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
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;
@@ -523,10 +523,10 @@ class qe {
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
528
  const l = (h, A, I, a, M, u, 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] = u, n[f] = x, f++);
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
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
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);
@@ -560,10 +560,10 @@ class qe {
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
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), o.set([x, y, m, P, _, B], p * 6), p++;
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;
@@ -637,42 +637,42 @@ class qe {
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, u = 1 - 0.75 * ze(o.id);
656
- G.setRGB(o.r, o.g, o.b).multiplyScalar((1.3 + o.bright * 1.5 + o.e * 1.1) * u), 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).multiplyScalar(u), 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];
668
+ const v = zt(i, b), h = this.rCol[t];
669
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
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
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 (o.handoffAt && b === o.handoffTo) {
675
- const y = (e - o.handoffAt) / 1e3 - 1.2;
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
678
  A += m * 0.8, u += m * 2, x += m * 10;
@@ -682,25 +682,25 @@ class qe {
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
692
  const R = ve(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);
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])
@@ -710,7 +710,7 @@ class qe {
710
710
  }
711
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
712
  function Ze() {
713
- const g = Ut(), e = ue((i) => i.gl), c = Ee();
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 Ze() {
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 }),
@@ -737,7 +737,7 @@ function Ze() {
737
737
  ] });
738
738
  }
739
739
  function He({ agent: g, selected: e, onSelect: c }) {
740
- const i = st(null);
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 He({ 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 = "",
@@ -766,17 +766,17 @@ function He({ agent: g, selected: e, onSelect: c }) {
766
766
  }
767
767
  function Ve({ run: g }) {
768
768
  Be();
769
- const e = g.run ?? q.runs.get(g.id), c = st(null), i = st([]);
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];
774
+ const t = o.current[r];
775
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 } = _e(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,7 +793,7 @@ function Ve({ run: g }) {
793
793
  pxRange: [10, 14]
794
794
  }
795
795
  ) }),
796
- e.hasSteps && !s && Oe.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
799
  text: Te(e, l),
@@ -825,9 +825,9 @@ 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
833
  const l = (n.inst.job ? ke(n.inst) : n.inst.name) + " · " + n.inst.status;
@@ -837,10 +837,10 @@ function Je() {
837
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
846
  function rs() {
@@ -6,7 +6,7 @@ import { EffectComposer as _e, Bloom as Ee, Vignette as Be } from "@react-three/
6
6
  import { useThree as Kt, useFrame as At } from "@react-three/fiber";
7
7
  import { useMemo as I, useRef as F } from "react";
8
8
  import * as r from "three";
9
- import { Y as ke, T as ue, g as Ke, h as kt, b as Ve, K as Oe, A as Qt, w as U, a as ht, F as Fe, Q as je, L as te, G as Ge, C as Ie, d as ve, k as Le, Z as De, U as We, R as Ne, u as Ue, E as Xe, l as Ye, X as He, _ as $e, e as Ze, s as qe, j as Qe, n as Je, o as tn, f as $t, x as en } from "./KitScene-CsXvCpWR.js";
9
+ import { Y as ke, T as ue, g as Ke, h as kt, b as Ve, K as Oe, A as Qt, w as U, a as ht, F as Fe, Q as je, L as te, G as Ge, C as Ie, d as ve, k as Le, Z as De, U as We, R as Ne, u as Ue, E as Xe, l as Ye, X as He, _ as $e, e as Ze, s as qe, j as Qe, n as Je, o as tn, f as $t, x as en } from "./KitScene-DNk9wirq.js";
10
10
  var Me;
11
11
  const Z = typeof window < "u" && !!((Me = window.matchMedia) != null && Me.call(window, "(prefers-reduced-motion: reduce)").matches), q = (t) => t < 0 ? 0 : t > 1 ? 1 : t, ce = (t) => 1 - Math.pow(1 - q(t), 3), Zt = (t) => (t = q(t), t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2), D = new r.Color(1, 1, 1), H = new r.Color("#ffc46b"), It = new r.Color("#ff7a2e"), nn = new r.Color("#fbbf24"), Gt = new r.Color("#ff2d4a"), xe = new r.Color("#8a93b8"), Lt = Object.fromEntries(Object.entries(ue).map(([t, n]) => [t, new r.Color(n).lerp(D, 0.12)])), on = Object.fromEntries(Object.entries(ue).map(([t, n]) => [t, new r.Color(n).lerp(H, 0.35).lerp(D, 0.25)]));
12
12
  function fe(t, n) {
@@ -4,7 +4,7 @@ import { EffectComposer as Ne, Bloom as je, Vignette as Ke, Noise as Qe } from "
4
4
  import { useFrame as K } from "@react-three/fiber";
5
5
  import { useRef as A, useMemo as E, useEffect as Je, useState as Xe } from "react";
6
6
  import * as t from "three";
7
- import { h as oe, i as et, T as ae, f as tt, a as H, p as nt, e as ot, l as rt, j as st, s as at, L as Ge, w as G, g as ct, b as it, K as lt, G as ut, c as J, d as Ce, k as pt, m as he, n as ft, o as dt, S as fe, R as ht, q as mt, u as yt, r as gt, t as Oe, v as Pe, x as Mt } from "./KitScene-CsXvCpWR.js";
7
+ import { h as oe, i as et, T as ae, f as tt, a as H, p as nt, e as ot, l as rt, j as st, s as at, L as Ge, w as G, g as ct, b as it, K as lt, G as ut, c as J, d as Ce, k as pt, m as he, n as ft, o as dt, S as fe, R as ht, q as mt, u as yt, r as gt, t as Oe, v as Pe, x as Mt } from "./KitScene-DNk9wirq.js";
8
8
  var Fe;
9
9
  const U = typeof window < "u" && !!((Fe = window.matchMedia) != null && Fe.call(window, "(prefers-reduced-motion: reduce)").matches), Le = Math.PI * 2, Ae = [Math.PI * 0.5, Math.PI * 0.5 + Le / 3, Math.PI * 0.5 + Le * 2 / 3], Ye = et, wt = (e) => (oe(e, 11) - 0.5) * 2.4, Z = {
10
10
  /** the galaxy's inner (tilted) group; its matrixWorld includes the kit's side placement + scale */