agentglow 0.4.1 → 0.4.2
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.
- package/dist/chunks/KitScene-D8qiflCw.js +6804 -0
- package/dist/chunks/index-B-GgW6Df.js +770 -0
- package/dist/chunks/index-B8E_UpEh.js +436 -0
- package/dist/chunks/index-BGWvBQoI.js +884 -0
- package/dist/chunks/index-BxZgELLY.js +590 -0
- package/dist/chunks/index-CAK2lh3j.js +699 -0
- package/dist/chunks/index-CEd8CHA3.js +943 -0
- package/dist/chunks/index-DGp3aLoB.js +941 -0
- package/dist/chunks/{index-DjDzoHSk.js → index-rhTWZ_I3.js} +7 -7
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/world.d.ts +35 -0
- package/package.json +1 -1
- package/dist/chunks/KitScene-qkWr95H9.js +0 -5933
- package/dist/chunks/ResourceWire-BWQJV3bx.js +0 -36
- package/dist/chunks/index-2zvNrAfW.js +0 -921
- package/dist/chunks/index-BP5CK-0G.js +0 -495
- package/dist/chunks/index-B__6Mr7M.js +0 -839
- package/dist/chunks/index-Bfpwwg62.js +0 -793
- package/dist/chunks/index-BkOdY6y8.js +0 -678
- package/dist/chunks/index-Bxr6tpps.js +0 -1015
- package/dist/chunks/index-vbo-4RNb.js +0 -990
|
@@ -0,0 +1,943 @@
|
|
|
1
|
+
var Te = Object.defineProperty;
|
|
2
|
+
var Re = (t, n, o) => n in t ? Te(t, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[n] = o;
|
|
3
|
+
var B = (t, n, o) => Re(t, typeof n != "symbol" ? n + "" : n, o);
|
|
4
|
+
import { jsxs as vt, Fragment as Tt, jsx as S } from "react/jsx-runtime";
|
|
5
|
+
import { EffectComposer as _e, Bloom as Ee, Vignette as Be } from "@react-three/postprocessing";
|
|
6
|
+
import { useThree as Kt, useFrame as At } from "@react-three/fiber";
|
|
7
|
+
import { useMemo as I, useRef as F } from "react";
|
|
8
|
+
import * as r from "three";
|
|
9
|
+
import { X as ke, T as ue, g as Ke, h as kt, b as Ve, K as Oe, A as Qt, w as X, a as ht, F as Fe, P as je, L as te, G as Ge, C as Ie, d as ve, k as Le, Y as De, Q as We, R as Ne, u as Xe, E as Ue, l as Ye, W as He, Z 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-D8qiflCw.js";
|
|
10
|
+
var Me;
|
|
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
|
+
function fe(t, n) {
|
|
13
|
+
const o = document.createElement("canvas");
|
|
14
|
+
o.width = o.height = t, n(o.getContext("2d"), t);
|
|
15
|
+
const e = new r.CanvasTexture(o);
|
|
16
|
+
return e.colorSpace = r.SRGBColorSpace, e;
|
|
17
|
+
}
|
|
18
|
+
let rn = null;
|
|
19
|
+
function Dt() {
|
|
20
|
+
return rn ?? (rn = fe(128, (t, n) => {
|
|
21
|
+
const o = t.createRadialGradient(n / 2, n / 2, 0, n / 2, n / 2, n / 2);
|
|
22
|
+
o.addColorStop(0, "rgba(255,255,255,1)"), o.addColorStop(0.1, "rgba(255,255,255,0.7)"), o.addColorStop(0.35, "rgba(255,255,255,0.14)"), o.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = o, t.fillRect(0, 0, n, n);
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
let an = null;
|
|
26
|
+
function Se() {
|
|
27
|
+
return an ?? (an = fe(256, (t, n) => {
|
|
28
|
+
const o = n / 2, e = t.createRadialGradient(o, o, o * 0.7, o, o, o * 0.98);
|
|
29
|
+
e.addColorStop(0, "rgba(255,255,255,0)"), e.addColorStop(0.6, "rgba(255,255,255,0.85)"), e.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = e, t.fillRect(0, 0, n, n);
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
let sn = null;
|
|
33
|
+
function cn() {
|
|
34
|
+
return sn ?? (sn = fe(256, (t, n) => {
|
|
35
|
+
const o = n / 2;
|
|
36
|
+
for (const c of [0, Math.PI / 2, Math.PI / 4, -Math.PI / 4]) {
|
|
37
|
+
const f = c % (Math.PI / 2) === 0 ? o : o * 0.5;
|
|
38
|
+
t.save(), t.translate(o, o), t.rotate(c);
|
|
39
|
+
const m = t.createLinearGradient(-f, 0, f, 0);
|
|
40
|
+
m.addColorStop(0, "rgba(255,255,255,0)"), m.addColorStop(0.5, "rgba(255,255,255,1)"), m.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = m, t.beginPath(), t.moveTo(-f, 0), t.lineTo(0, -3), t.lineTo(f, 0), t.lineTo(0, 3), t.closePath(), t.fill(), t.restore();
|
|
41
|
+
}
|
|
42
|
+
const e = t.createRadialGradient(o, o, 0, o, o, o * 0.25);
|
|
43
|
+
e.addColorStop(0, "rgba(255,255,255,1)"), e.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = e, t.fillRect(0, 0, n, n);
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
function xt(t, n = "#fff") {
|
|
47
|
+
return new r.SpriteMaterial({ map: t, color: n, blending: r.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 });
|
|
48
|
+
}
|
|
49
|
+
const Ae = () => new r.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: r.AdditiveBlending, depthWrite: !1, toneMapped: !1 }), ln = new r.TorusGeometry(1, 0.014, 6, 96), un = new r.SphereGeometry(1, 20, 14);
|
|
50
|
+
function ee(t, n, o) {
|
|
51
|
+
return t * n / (2 * Math.tan(o * Math.PI / 360));
|
|
52
|
+
}
|
|
53
|
+
const fn = {
|
|
54
|
+
name: "show",
|
|
55
|
+
local: { topGap: 3.9, fanLen: 3.5, subGap: 2.9, fan: "spread", stackGap: 2.1, pad: 1.45 },
|
|
56
|
+
run(t, n, o) {
|
|
57
|
+
const e = n.n;
|
|
58
|
+
if (o.angle = Math.PI / 2, e <= 1) {
|
|
59
|
+
o.a = 0, o.b = 0;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const c = 2 * n.hu + 2.6, f = 2 * n.hv + 3.4, m = Math.max(1, Math.min(e, Math.round(Math.sqrt(e * n.aspect * f / c)))), i = Math.ceil(e / m), a = Math.floor(t / m), p = a === i - 1 ? e - a * m : m, s = t - a * m;
|
|
63
|
+
o.a = (s - (p - 1) / 2) * c, o.b = ((i - 1) / 2 - a) * f;
|
|
64
|
+
},
|
|
65
|
+
cluster: ke.cluster,
|
|
66
|
+
periphery: "sides"
|
|
67
|
+
}, dn = 24576, pt = 0, mt = 1, le = 2, hn = 3, pn = (
|
|
68
|
+
/* glsl */
|
|
69
|
+
`
|
|
70
|
+
attribute vec4 iP; attribute vec4 iV; attribute vec4 iT; attribute vec4 iC;
|
|
71
|
+
#ifdef STREAK
|
|
72
|
+
attribute float aEnd;
|
|
73
|
+
#endif
|
|
74
|
+
uniform float uTime; uniform float uScale; uniform float uTrail;
|
|
75
|
+
varying vec3 vC; varying float vSmoke;
|
|
76
|
+
float h1(float n){ return fract(sin(n) * 43758.5453); }
|
|
77
|
+
vec3 at(float a){
|
|
78
|
+
float k = iV.w;
|
|
79
|
+
float e = (1.0 - exp(-k * a)) / k;
|
|
80
|
+
return iP.xyz + iV.xyz * e - vec3(0.0, iT.z * (a - e) / k, 0.0);
|
|
81
|
+
}
|
|
82
|
+
void main(){
|
|
83
|
+
float a = uTime - iT.x;
|
|
84
|
+
float life = iT.y;
|
|
85
|
+
float kind = iC.w;
|
|
86
|
+
vSmoke = kind > 1.5 && kind < 2.5 ? 1.0 : 0.0;
|
|
87
|
+
#ifdef STREAK
|
|
88
|
+
bool dead = a < 0.0 || a > life || vSmoke > 0.5;
|
|
89
|
+
#else
|
|
90
|
+
bool dead = a < 0.0 || a > life;
|
|
91
|
+
#endif
|
|
92
|
+
if (dead) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); gl_PointSize = 0.0; vC = vec3(0.0); return; }
|
|
93
|
+
float u = a / life;
|
|
94
|
+
float f = 1.0 - u;
|
|
95
|
+
float lum = pow(f, 1.25) * min(1.0, a * 30.0 + 0.2);
|
|
96
|
+
vec3 col = mix(vec3(1.0, 0.96, 0.88), iC.rgb, smoothstep(0.0, 0.2, u));
|
|
97
|
+
col = mix(col, vec3(1.0, 0.42, 0.12) * 0.85, smoothstep(0.55, 1.0, u) * 0.55);
|
|
98
|
+
float seed = iT.w;
|
|
99
|
+
if (kind > 0.5 && kind < 1.5) {
|
|
100
|
+
float fl = step(0.52, h1(floor(uTime * 24.0) * 0.731 + seed * 91.7));
|
|
101
|
+
lum *= 0.1 + fl * 2.1;
|
|
102
|
+
} else if (kind > 2.5) {
|
|
103
|
+
lum *= 0.65 + 0.35 * sin(uTime * 11.0 + seed * 40.0);
|
|
104
|
+
}
|
|
105
|
+
float size = iP.w;
|
|
106
|
+
if (vSmoke > 0.5) {
|
|
107
|
+
col = mix(iC.rgb, vec3(0.55, 0.6, 0.78), 0.55);
|
|
108
|
+
lum = 0.05 * sin(3.14159 * min(1.0, u * 1.6 + 0.02)) * f;
|
|
109
|
+
size *= 1.0 + u * 2.6;
|
|
110
|
+
}
|
|
111
|
+
vec3 p = at(a);
|
|
112
|
+
#ifdef STREAK
|
|
113
|
+
if (aEnd > 0.5) { p = at(max(0.0, a - uTrail)); lum = 0.0; }
|
|
114
|
+
lum *= 0.55;
|
|
115
|
+
#endif
|
|
116
|
+
vC = col * lum;
|
|
117
|
+
vec4 mv = modelViewMatrix * vec4(p, 1.0);
|
|
118
|
+
gl_Position = projectionMatrix * mv;
|
|
119
|
+
#ifndef STREAK
|
|
120
|
+
float px = size * uScale / -mv.z;
|
|
121
|
+
// sub-pixel sparks would shimmer: keep 1.4px and dim them instead
|
|
122
|
+
if (px < 1.4) { vC *= px / 1.4; px = 1.4; }
|
|
123
|
+
gl_PointSize = px;
|
|
124
|
+
#endif
|
|
125
|
+
}`
|
|
126
|
+
), mn = (
|
|
127
|
+
/* glsl */
|
|
128
|
+
`
|
|
129
|
+
varying vec3 vC; varying float vSmoke;
|
|
130
|
+
void main(){
|
|
131
|
+
#ifdef STREAK
|
|
132
|
+
gl_FragColor = vec4(vC, 1.0);
|
|
133
|
+
#else
|
|
134
|
+
float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
|
|
135
|
+
float k = vSmoke > 0.5 ? pow(1.0 - r, 2.0) : smoothstep(0.42, 0.0, r) * 1.3 + pow(1.0 - r, 3.0) * 0.3;
|
|
136
|
+
gl_FragColor = vec4(vC * k, 1.0);
|
|
137
|
+
#endif
|
|
138
|
+
}`
|
|
139
|
+
), vn = {};
|
|
140
|
+
class gn {
|
|
141
|
+
constructor() {
|
|
142
|
+
B(this, "cap", dn);
|
|
143
|
+
B(this, "base", performance.now());
|
|
144
|
+
B(this, "P");
|
|
145
|
+
B(this, "V");
|
|
146
|
+
B(this, "T");
|
|
147
|
+
B(this, "C");
|
|
148
|
+
B(this, "head", 0);
|
|
149
|
+
B(this, "dirtyStart", 0);
|
|
150
|
+
B(this, "dirtyN", 0);
|
|
151
|
+
B(this, "attrs");
|
|
152
|
+
B(this, "points");
|
|
153
|
+
B(this, "streaks");
|
|
154
|
+
B(this, "pmat");
|
|
155
|
+
B(this, "smat");
|
|
156
|
+
const n = this.cap, o = () => new r.InstancedBufferAttribute(new Float32Array(n * 4), 4).setUsage(r.DynamicDrawUsage);
|
|
157
|
+
this.P = o(), this.V = o(), this.T = o(), this.C = o(), this.attrs = [this.P, this.V, this.T, this.C];
|
|
158
|
+
for (let a = 0; a < n; a++)
|
|
159
|
+
this.T.array[a * 4] = 1e9, this.T.array[a * 4 + 1] = 1, this.V.array[a * 4 + 3] = 1;
|
|
160
|
+
const e = (a) => (a.setAttribute("iP", this.P), a.setAttribute("iV", this.V), a.setAttribute("iT", this.T), a.setAttribute("iC", this.C), a.instanceCount = n, a.boundingSphere = new r.Sphere(new r.Vector3(), 1e5), a), c = e(new r.InstancedBufferGeometry());
|
|
161
|
+
c.setAttribute("position", new r.BufferAttribute(new Float32Array(3), 3));
|
|
162
|
+
const f = e(new r.InstancedBufferGeometry());
|
|
163
|
+
f.setAttribute("position", new r.BufferAttribute(new Float32Array(6), 3)), f.setAttribute("aEnd", new r.BufferAttribute(new Float32Array([0, 1]), 1));
|
|
164
|
+
const i = { uniforms: { uTime: { value: 0 }, uScale: { value: 400 }, uTrail: { value: 0.085 } }, vertexShader: pn, fragmentShader: mn, transparent: !0, depthWrite: !1, depthTest: !1, blending: r.AdditiveBlending };
|
|
165
|
+
this.pmat = new r.ShaderMaterial(i), this.smat = new r.ShaderMaterial({ ...i, defines: { STREAK: 1 } }), this.points = new r.Points(c, this.pmat), this.streaks = new r.LineSegments(f, this.smat), this.points.frustumCulled = this.streaks.frustumCulled = !1, this.points.renderOrder = this.streaks.renderOrder = 2;
|
|
166
|
+
}
|
|
167
|
+
/** shader clock (seconds) */
|
|
168
|
+
time() {
|
|
169
|
+
return (performance.now() - this.base) / 1e3;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Emit one particle. p = start (stage), v = velocity (units/s), drag (1/s, > 0), grav (units/s^2 downward),
|
|
173
|
+
* life (s), size (world units), color + brightness k, kind, delay (s).
|
|
174
|
+
*/
|
|
175
|
+
emit(n, o, e, c, f, m, i, a, p, s, v, y, u, b = 0) {
|
|
176
|
+
const g = this.head;
|
|
177
|
+
this.head = (this.head + 1) % this.cap, this.dirtyN === 0 && (this.dirtyStart = g), this.dirtyN++;
|
|
178
|
+
const w = g * 4, d = this.P.array, h = this.V.array, E = this.T.array, P = this.C.array;
|
|
179
|
+
d[w] = n, d[w + 1] = o, d[w + 2] = e, d[w + 3] = s, h[w] = c, h[w + 1] = f, h[w + 2] = m, h[w + 3] = Math.max(0.05, i), E[w] = this.time() + b, E[w + 1] = p, E[w + 2] = a, E[w + 3] = Math.random(), P[w] = v.r * y, P[w + 1] = v.g * y, P[w + 2] = v.b * y, P[w + 3] = u;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* A spherical burst at (x, y, z): n particles, speed ~ `speed` (with spread), a share of glitter.
|
|
183
|
+
* `flat` squashes the z velocity (bursts read best facing the camera).
|
|
184
|
+
*/
|
|
185
|
+
burst(n, o, e, c, f, m, i, a = vn) {
|
|
186
|
+
const p = a.drag ?? 2.4, s = a.grav ?? 1.4, v = a.life ?? 1.8, y = a.size ?? 0.12, u = a.glitter ?? 0.2, b = a.flat ?? 0.45, g = a.jitter ?? 0.12, w = Math.PI * (3 - Math.sqrt(5)), d = Math.random() * 6.283;
|
|
187
|
+
for (let h = 0; h < c; h++) {
|
|
188
|
+
const E = 1 - 2 * (h + 0.5) / c, P = Math.sqrt(1 - E * E), l = h * w + d, Q = f * (1 - g + Math.random() * 2 * g), et = a.kind ?? (Math.random() < u ? mt : pt), W = a.c2 && h % 3 === 0 ? a.c2 : m;
|
|
189
|
+
this.emit(n, o, e, Math.cos(l) * P * Q, E * Q, Math.sin(l) * P * Q * b, p, s, v * (0.75 + Math.random() * 0.5), y * (0.8 + Math.random() * 0.4), W, i, et);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
setScale(n, o, e) {
|
|
193
|
+
this.pmat.uniforms.uScale.value = ee(n, o, e);
|
|
194
|
+
}
|
|
195
|
+
/** upload what was emitted since the last flush (one or two contiguous ranges) */
|
|
196
|
+
flush() {
|
|
197
|
+
if (this.pmat.uniforms.uTime.value = this.time(), !this.dirtyN) return;
|
|
198
|
+
const n = Math.min(this.dirtyN, this.cap), o = n >= this.cap ? 0 : this.dirtyStart;
|
|
199
|
+
for (const e of this.attrs)
|
|
200
|
+
e.clearUpdateRanges(), o + n <= this.cap ? e.addUpdateRange(o * 4, n * 4) : (e.addUpdateRange(o * 4, (this.cap - o) * 4), e.addUpdateRange(0, (o + n - this.cap) * 4)), e.needsUpdate = !0;
|
|
201
|
+
this.dirtyN = 0;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
let yn = null;
|
|
205
|
+
const Vt = () => yn ?? (yn = new gn()), ot = Z ? 0.4 : 1, jt = 84;
|
|
206
|
+
function Ce(t) {
|
|
207
|
+
const n = new r.BufferGeometry(), o = t ? 2 : 1, e = new Float32Array(jt * o * 3), c = new Float32Array(jt * o * 4), f = new Float32Array(jt * o), m = Math.PI * (3 - Math.sqrt(5));
|
|
208
|
+
let i = 9173;
|
|
209
|
+
const a = () => (i = i * 16807 % 2147483647) / 2147483647;
|
|
210
|
+
for (let p = 0; p < jt; p++) {
|
|
211
|
+
const s = 1 - 2 * (p + 0.5) / jt, v = Math.sqrt(1 - s * s), y = p * m, u = Math.cos(y) * v + (a() - 0.5) * 0.08, b = s + (a() - 0.5) * 0.08, g = Math.sin(y) * v + (a() - 0.5) * 0.08, w = Math.hypot(u, b, g) || 1, d = [a(), a(), a(), a()];
|
|
212
|
+
for (let h = 0; h < o; h++) {
|
|
213
|
+
const E = p * o + h;
|
|
214
|
+
e.set([u / w, b / w, g / w], E * 3), c.set(d, E * 4), f[E] = h;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return n.setAttribute("position", new r.BufferAttribute(e.slice(), 3)), n.setAttribute("aDir", new r.BufferAttribute(e, 3)), n.setAttribute("aRnd", new r.BufferAttribute(c, 4)), t && n.setAttribute("aEnd", new r.BufferAttribute(f, 1)), n.boundingSphere = new r.Sphere(new r.Vector3(), 1e5), n;
|
|
218
|
+
}
|
|
219
|
+
const wn = Ce(!1), bn = Ce(!0), Mn = (
|
|
220
|
+
/* glsl */
|
|
221
|
+
`
|
|
222
|
+
attribute vec3 aDir; attribute vec4 aRnd;
|
|
223
|
+
#ifdef STREAK
|
|
224
|
+
attribute float aEnd;
|
|
225
|
+
#endif
|
|
226
|
+
uniform vec3 uC; uniform float uR; uniform float uAge; uniform float uTime; uniform vec3 uCol; uniform vec3 uCol2;
|
|
227
|
+
uniform float uLvl; uniform float uCrackle; uniform float uDone; uniform float uWait; uniform float uScale; uniform float uOpacity;
|
|
228
|
+
uniform float uSeed; uniform float uSize;
|
|
229
|
+
varying vec3 vC;
|
|
230
|
+
float h1(float n){ return fract(sin(n) * 43758.5453); }
|
|
231
|
+
void main(){
|
|
232
|
+
float a = uAge;
|
|
233
|
+
if (a < 0.0) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); gl_PointSize = 0.0; vC = vec3(0.0); return; }
|
|
234
|
+
// burst: fast expansion with a little overshoot, then a slow breathing hold
|
|
235
|
+
float ex = 1.0 - exp(-a * 5.5);
|
|
236
|
+
ex *= 1.0 + 0.07 * exp(-a * 1.6) * sin(a * 7.0);
|
|
237
|
+
float wob = 1.0 + 0.035 * sin(uTime * (0.7 + aRnd.x * 0.6) + aRnd.z * 6.283);
|
|
238
|
+
float rr = uR * (0.8 + 0.24 * aRnd.y) * ex * wob * mix(1.0, 0.5, uWait);
|
|
239
|
+
// slow spin about a tilted axis: stars glide across the shell (the 3D sphere sparkles as it turns)
|
|
240
|
+
float sp = uTime * (0.09 + 0.06 * uSeed) + uSeed * 6.283;
|
|
241
|
+
float cs = cos(sp), sn = sin(sp);
|
|
242
|
+
vec3 d = vec3(aDir.x * cs + aDir.z * sn, aDir.y, -aDir.x * sn + aDir.z * cs);
|
|
243
|
+
float sag = uR * (0.1 * (1.0 - exp(-a * 1.2)) + uWait * 0.18 * (1.0 - d.y));
|
|
244
|
+
vec3 c0 = uC - vec3(0.0, sag * 0.4, 0.0);
|
|
245
|
+
vec3 p = c0 + d * rr;
|
|
246
|
+
p.y -= sag * (0.6 + 0.5 * aRnd.w);
|
|
247
|
+
// done: the stars fall away and spread like a dying willow
|
|
248
|
+
p += d * uDone * uR * 0.3;
|
|
249
|
+
p.y -= uDone * uDone * uR * (0.7 + 1.3 * aRnd.z);
|
|
250
|
+
float tw = 0.55 + 0.45 * sin(uTime * (1.2 + aRnd.x * 2.6) + aRnd.z * 40.0);
|
|
251
|
+
float flash = exp(-a * 3.0) * 0.8;
|
|
252
|
+
float gl = uCrackle * step(1.0 - uCrackle * 0.6, h1(floor(uTime * 22.0) * 0.37 + aRnd.x * 137.0 + uSeed * 11.0));
|
|
253
|
+
float lvl = uLvl * (0.35 + 0.65 * tw) + flash + gl * 2.4;
|
|
254
|
+
lvl *= mix(1.0, 0.42, uWait) * (1.0 - uDone * 0.3);
|
|
255
|
+
vec3 col = mix(uCol, uCol2, step(0.62, aRnd.y));
|
|
256
|
+
col = mix(col, vec3(1.0), clamp(flash * 0.25 + gl * 0.7, 0.0, 1.0));
|
|
257
|
+
col = mix(col, vec3(1.0, 0.5, 0.16), uWait * 0.55 + uDone * 0.45);
|
|
258
|
+
#ifdef STREAK
|
|
259
|
+
// petal streak toward the centre: long while fresh (the burst), short once it hangs
|
|
260
|
+
float tail = mix(0.42, 0.8, smoothstep(0.2, 3.0, a)) + uDone * 0.1;
|
|
261
|
+
if (aEnd > 0.5) { p = c0 + (p - c0) * tail; lvl = 0.0; }
|
|
262
|
+
lvl *= 0.5 * (1.0 - uWait * 0.6);
|
|
263
|
+
#endif
|
|
264
|
+
vC = col * lvl * uOpacity;
|
|
265
|
+
vec4 mv = modelViewMatrix * vec4(p, 1.0);
|
|
266
|
+
gl_Position = projectionMatrix * mv;
|
|
267
|
+
#ifndef STREAK
|
|
268
|
+
float px = uSize * (0.7 + 0.6 * aRnd.w) * (1.0 + gl * 0.5 + flash * 0.3) * uScale / -mv.z;
|
|
269
|
+
if (px < 1.5) { vC *= px / 1.5; px = 1.5; }
|
|
270
|
+
gl_PointSize = px;
|
|
271
|
+
#endif
|
|
272
|
+
}`
|
|
273
|
+
), xn = (
|
|
274
|
+
/* glsl */
|
|
275
|
+
`
|
|
276
|
+
varying vec3 vC;
|
|
277
|
+
void main(){
|
|
278
|
+
#ifdef STREAK
|
|
279
|
+
gl_FragColor = vec4(vC, 1.0);
|
|
280
|
+
#else
|
|
281
|
+
float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
|
|
282
|
+
gl_FragColor = vec4(vC * (smoothstep(0.45, 0.0, r) * 1.25 + pow(1.0 - r, 3.0) * 0.35), 1.0);
|
|
283
|
+
#endif
|
|
284
|
+
}`
|
|
285
|
+
);
|
|
286
|
+
function Sn(t, n, o) {
|
|
287
|
+
const e = {
|
|
288
|
+
uC: { value: new r.Vector3() },
|
|
289
|
+
uR: { value: 1 },
|
|
290
|
+
uAge: { value: -1 },
|
|
291
|
+
uTime: { value: 0 },
|
|
292
|
+
uCol: { value: t.clone() },
|
|
293
|
+
uCol2: { value: n.clone() },
|
|
294
|
+
uLvl: { value: 1 },
|
|
295
|
+
uCrackle: { value: 0 },
|
|
296
|
+
uDone: { value: 0 },
|
|
297
|
+
uWait: { value: 0 },
|
|
298
|
+
uScale: { value: 400 },
|
|
299
|
+
uOpacity: { value: 1 },
|
|
300
|
+
uSeed: { value: o },
|
|
301
|
+
uSize: { value: 0.1 }
|
|
302
|
+
}, c = { uniforms: e, vertexShader: Mn, fragmentShader: xn, transparent: !0, depthWrite: !1, depthTest: !1, blending: r.AdditiveBlending };
|
|
303
|
+
return { u: e, pts: new r.ShaderMaterial(c), lines: new r.ShaderMaterial({ ...c, defines: { STREAK: 1 } }) };
|
|
304
|
+
}
|
|
305
|
+
function Pt(t, n, o, e, c) {
|
|
306
|
+
const f = 1 - e;
|
|
307
|
+
return c.set(f * f * t.x + 2 * f * e * n.x + e * e * o.x, f * f * t.y + 2 * f * e * n.y + e * e * o.y, f * f * t.z + 2 * f * e * n.z + e * e * o.z);
|
|
308
|
+
}
|
|
309
|
+
function St(t, n, o, e, c) {
|
|
310
|
+
const f = n.x - t.x, m = n.y - t.y, i = Math.hypot(f, m) || 1;
|
|
311
|
+
return c.copy(t).add(n).multiplyScalar(0.5), c.x += -m / i * o, c.y += f / i * o + e, c;
|
|
312
|
+
}
|
|
313
|
+
class de {
|
|
314
|
+
constructor(n, o = 28) {
|
|
315
|
+
B(this, "geo", new r.BufferGeometry());
|
|
316
|
+
B(this, "obj");
|
|
317
|
+
B(this, "P");
|
|
318
|
+
B(this, "C");
|
|
319
|
+
B(this, "n", 0);
|
|
320
|
+
B(this, "p", new r.Vector3());
|
|
321
|
+
this.max = n, this.seg = o, this.P = new r.BufferAttribute(new Float32Array(n * o * 6), 3), this.C = new r.BufferAttribute(new Float32Array(n * o * 6), 3), this.geo.setAttribute("position", this.P), this.geo.setAttribute("color", this.C), this.geo.boundingSphere = new r.Sphere(new r.Vector3(), 1e5), this.obj = new r.LineSegments(this.geo, Ae()), this.obj.frustumCulled = !1;
|
|
322
|
+
}
|
|
323
|
+
begin() {
|
|
324
|
+
this.n = 0;
|
|
325
|
+
}
|
|
326
|
+
add(n, o, e, c, f, m, i, a, p, s, v) {
|
|
327
|
+
if (this.n >= this.max || i <= m) return;
|
|
328
|
+
const y = this.seg;
|
|
329
|
+
for (let u = 0; u < y; u++)
|
|
330
|
+
for (let b = 0; b < 2; b++) {
|
|
331
|
+
const g = m + (i - m) * (u + b) / y;
|
|
332
|
+
Pt(n, o, e, g, this.p);
|
|
333
|
+
const w = (this.n * y + u) * 2 + b;
|
|
334
|
+
this.P.setXYZ(w, this.p.x, this.p.y, this.p.z);
|
|
335
|
+
let d = f;
|
|
336
|
+
a > 0 && (d += a * Math.pow(Math.max(0, Math.sin((g * 8 - p * 1.1) * Math.PI)), 8)), d *= 0.25 + 0.75 * q(Math.min((g - m) / 0.08, (i - g) / 0.05)), s >= 0 && (d += v * Math.exp(-(((g - s) / 0.05) ** 2))), this.C.setXYZ(w, c.r * d, c.g * d, c.b * d);
|
|
337
|
+
}
|
|
338
|
+
this.n++;
|
|
339
|
+
}
|
|
340
|
+
end() {
|
|
341
|
+
this.geo.setDrawRange(0, this.n * this.seg * 2), this.P.needsUpdate = !0, this.C.needsUpdate = !0;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
const An = (
|
|
345
|
+
/* glsl */
|
|
346
|
+
`
|
|
347
|
+
attribute float aSize; attribute vec3 aColor; uniform float uScale; varying vec3 vC;
|
|
348
|
+
void main(){ vec4 mv = modelViewMatrix * vec4(position, 1.0); vC = aColor; gl_PointSize = max(1.5, aSize * uScale / -mv.z); gl_Position = projectionMatrix * mv; }`
|
|
349
|
+
), Cn = (
|
|
350
|
+
/* glsl */
|
|
351
|
+
`
|
|
352
|
+
varying vec3 vC;
|
|
353
|
+
void main(){ float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
|
|
354
|
+
gl_FragColor = vec4(vC * (smoothstep(0.35, 0.0, r) * 1.4 + pow(1.0 - r, 2.6) * 0.45), 1.0); }`
|
|
355
|
+
);
|
|
356
|
+
class he {
|
|
357
|
+
constructor(n) {
|
|
358
|
+
B(this, "geo", new r.BufferGeometry());
|
|
359
|
+
B(this, "mat", new r.ShaderMaterial({ uniforms: { uScale: { value: 400 } }, vertexShader: An, fragmentShader: Cn, transparent: !0, depthWrite: !1, blending: r.AdditiveBlending }));
|
|
360
|
+
B(this, "obj");
|
|
361
|
+
B(this, "P");
|
|
362
|
+
B(this, "S");
|
|
363
|
+
B(this, "C");
|
|
364
|
+
B(this, "n", 0);
|
|
365
|
+
this.max = n, this.P = new r.BufferAttribute(new Float32Array(n * 3), 3), this.S = new r.BufferAttribute(new Float32Array(n), 1), this.C = new r.BufferAttribute(new Float32Array(n * 3), 3), this.geo.setAttribute("position", this.P), this.geo.setAttribute("aSize", this.S), this.geo.setAttribute("aColor", this.C), this.geo.boundingSphere = new r.Sphere(new r.Vector3(), 1e5), this.obj = new r.Points(this.geo, this.mat), this.obj.frustumCulled = !1;
|
|
366
|
+
}
|
|
367
|
+
setScale(n, o, e) {
|
|
368
|
+
this.mat.uniforms.uScale.value = ee(n, o, e);
|
|
369
|
+
}
|
|
370
|
+
begin() {
|
|
371
|
+
this.n = 0;
|
|
372
|
+
}
|
|
373
|
+
add(n, o, e, c) {
|
|
374
|
+
this.n >= this.max || (this.P.setXYZ(this.n, n.x, n.y, n.z), this.S.setX(this.n, o), this.C.setXYZ(this.n, e.r * c, e.g * c, e.b * c), this.n++);
|
|
375
|
+
}
|
|
376
|
+
end() {
|
|
377
|
+
this.geo.setDrawRange(0, this.n), this.P.needsUpdate = !0, this.S.needsUpdate = !0, this.C.needsUpdate = !0;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
const qt = 9, re = 6, zn = 220, ge = 40, ae = 8, Yt = 4, Pn = (
|
|
381
|
+
/* glsl */
|
|
382
|
+
`
|
|
383
|
+
attribute float aSize; attribute vec3 aColor; uniform float uScale; varying vec3 vC;
|
|
384
|
+
void main(){ vec4 mv = modelViewMatrix * vec4(position, 1.0); vC = aColor; float px = aSize * uScale / -mv.z;
|
|
385
|
+
if (px < 1.6) { vC *= px / 1.6; px = 1.6; } gl_PointSize = px; gl_Position = projectionMatrix * mv; }`
|
|
386
|
+
), Tn = (
|
|
387
|
+
/* glsl */
|
|
388
|
+
`
|
|
389
|
+
varying vec3 vC;
|
|
390
|
+
void main(){ float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
|
|
391
|
+
gl_FragColor = vec4(vC * (smoothstep(0.4, 0.0, r) * 1.2 + pow(1.0 - r, 2.4) * 0.4), 1.0); }`
|
|
392
|
+
);
|
|
393
|
+
function Rn({ galaxy: t }) {
|
|
394
|
+
const n = I(() => Ke(t, zn), [t]), o = n.nodes.length, { size: e, gl: c, camera: f } = Kt(), m = F([]), i = F([]), a = F(Array(Yt).fill("")), p = F([]), s = I(() => {
|
|
395
|
+
const d = new Float32Array(o * 3);
|
|
396
|
+
n.nodes.forEach((_, G) => {
|
|
397
|
+
const C = Math.sqrt(kt(_.id, 2)) * 0.95, ut = kt(_.id, 3) * Math.PI * 2;
|
|
398
|
+
d.set([Math.cos(ut) * C * qt, Math.sin(ut) * C * re, (kt(_.id, 4) - 0.5) * 2], G * 3);
|
|
399
|
+
}), Ve(n, d, qt * 0.12);
|
|
400
|
+
const h = n.nodes.map((_) => new r.Color(Oe[_.kind] ?? "#94a3b8").lerp(It, 0.55).multiplyScalar(0.55)), E = n.nodes.map((_) => 0.32 + Math.pow(kt(_.id, 5), 4) * 0.45), P = new r.BufferGeometry();
|
|
401
|
+
P.setAttribute("position", new r.BufferAttribute(d, 3)), P.setAttribute("aSize", new r.BufferAttribute(new Float32Array(o), 1)), P.setAttribute("aColor", new r.BufferAttribute(new Float32Array(o * 3), 3));
|
|
402
|
+
const l = new Map(n.nodes.map((_, G) => [_.id, G])), Q = [], et = new r.Vector3(), W = new r.Vector3();
|
|
403
|
+
for (const _ of n.links) {
|
|
404
|
+
const G = l.get(_.source), C = l.get(_.target);
|
|
405
|
+
G === void 0 || C === void 0 || G === C || (et.fromArray(d, G * 3), W.fromArray(d, C * 3), et.distanceTo(W) < 3.4 && Q.push(G, C));
|
|
406
|
+
}
|
|
407
|
+
const V = new Float32Array(Q.length * 3);
|
|
408
|
+
Q.forEach((_, G) => V.set([d[_ * 3], d[_ * 3 + 1], d[_ * 3 + 2]], G * 3));
|
|
409
|
+
const Y = new r.BufferGeometry();
|
|
410
|
+
return Y.setAttribute("position", new r.BufferAttribute(V, 3)), Y.setAttribute("color", new r.BufferAttribute(new Float32Array(Q.length * 3), 3)), { pos: d, base: h, baseSize: E, ngeo: P, lgeo: Y, owner: Int32Array.from(Q), fire: new Float32Array(o), white: new Float32Array(o), fireC: Array.from({ length: o }, () => new r.Color()), phase: n.nodes.map((_) => kt(_.id, 6) * 6.283) };
|
|
411
|
+
}, [n, o]), v = I(
|
|
412
|
+
() => ({
|
|
413
|
+
haze: xt(Dt(), "#000"),
|
|
414
|
+
nodes: new r.ShaderMaterial({ uniforms: { uScale: { value: 400 } }, vertexShader: Pn, fragmentShader: Tn, transparent: !0, depthWrite: !1, blending: r.AdditiveBlending }),
|
|
415
|
+
fil: new r.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: r.AdditiveBlending, depthWrite: !1, toneMapped: !1 }),
|
|
416
|
+
ripples: Array.from({ length: ae }, () => xt(Se(), "#000"))
|
|
417
|
+
}),
|
|
418
|
+
[]
|
|
419
|
+
), y = I(() => new de(ge, 24), []), u = I(() => new he(ge), []), b = I(() => /* @__PURE__ */ new Map(), [n]), g = I(() => ({ v: new r.Vector3(), w: new r.Vector3(), ctrl: new r.Vector3(), h: new r.Vector3(), c: new r.Color(), act: 0 }), []), w = (d) => {
|
|
420
|
+
let h = b.get(d);
|
|
421
|
+
return h === void 0 && b.set(d, h = Ie(n, d)), h;
|
|
422
|
+
};
|
|
423
|
+
return At(({ clock: d }) => {
|
|
424
|
+
var _t;
|
|
425
|
+
const h = performance.now(), E = Math.max(1e-4, Qt.graph.scale), P = Z ? 0 : d.elapsedTime, l = f.fov, Q = c.getPixelRatio();
|
|
426
|
+
v.nodes.uniforms.uScale.value = ee(e.height, Q, l) * Qt.graph.scale * 1.8, u.setScale(e.height, Q, l);
|
|
427
|
+
const { pos: et, base: W, baseSize: V, fire: Y, white: _, fireC: G, phase: C } = s, { v: ut, w: M, ctrl: j, h: Wt, c: K } = g;
|
|
428
|
+
Y.fill(0), _.fill(0), y.begin(), u.begin();
|
|
429
|
+
let ft = 0, Rt = 0;
|
|
430
|
+
for (const x of X.flares) {
|
|
431
|
+
const z = w(x.node), L = (h - x.start) / 1e3, gt = X.instances.get(x.instance), nt = gt ? Lt[gt.type] : H, O = x.op === "write", N = L < 0.3 ? L / 0.3 : Math.exp(-(L - 0.3) * 1.1);
|
|
432
|
+
if (Rt = Math.max(Rt, N), N > Y[z] && (Y[z] = N, G[z].copy(O ? D : nt), _[z] = O ? 1 : 0), ut.fromArray(et, z * 3), O && L < 1.6 && ft < ae) {
|
|
433
|
+
const at = p.current[ft];
|
|
434
|
+
if (at) {
|
|
435
|
+
const st = L / 1.6;
|
|
436
|
+
at.visible = !0, at.position.copy(ut), at.scale.setScalar(0.4 + st * 3), v.ripples[ft].color.copy(H).multiplyScalar((1 - st) * (1 - st) * 0.9);
|
|
437
|
+
}
|
|
438
|
+
ft++;
|
|
439
|
+
}
|
|
440
|
+
const rt = ht(x.instance);
|
|
441
|
+
if (rt && L < 2) {
|
|
442
|
+
Fe(ut, M), St(rt, M, 1, 1.4, j);
|
|
443
|
+
const at = Math.min(1, L / 0.25) * Math.pow(1 - L / 2, 1.5), st = O ? Math.min(1, L * 0.9) : 1 - Math.min(1, L * 0.9);
|
|
444
|
+
K.copy(O ? D : nt).lerp(H, 0.25), y.add(rt, j, M, K, (O ? 0.4 : 0.3) * at, 0.05, 0.99, 0, P, st, 1.7 * at), st > 0.02 && st < 0.98 && (Pt(rt, j, M, st, Wt), u.add(Wt, 0.6, K, 1.5 * at));
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
for (let x = ft; x < ae; x++) {
|
|
448
|
+
const z = p.current[x];
|
|
449
|
+
z && (z.visible = !1);
|
|
450
|
+
}
|
|
451
|
+
y.end(), u.end(), g.act += (Rt - g.act) * 0.05, v.haze.color.copy(It).multiplyScalar(0.05 + g.act * 0.05);
|
|
452
|
+
const J = s.ngeo.getAttribute("aSize"), Ot = s.ngeo.getAttribute("aColor");
|
|
453
|
+
for (let x = 0; x < o; x++) {
|
|
454
|
+
const z = Y[x], L = Z ? 1 : 0.7 + 0.3 * Math.sin(P * (0.7 + C[x] % 1) + C[x]);
|
|
455
|
+
J.setX(x, V[x] + z * (0.8 + _[x] * 0.4)), K.copy(W[x]).multiplyScalar(L), z > 0.01 && (K.r += G[x].r * z * 1.4 + z * (0.2 + _[x]), K.g += G[x].g * z * 1.4 + z * (0.2 + _[x]), K.b += G[x].b * z * 1.4 + z * (0.2 + _[x])), Ot.setXYZ(x, K.r, K.g, K.b);
|
|
456
|
+
}
|
|
457
|
+
J.needsUpdate = !0, Ot.needsUpdate = !0;
|
|
458
|
+
const Nt = s.lgeo.getAttribute("color"), it = s.owner;
|
|
459
|
+
for (let x = 0; x < it.length; x++) {
|
|
460
|
+
const z = Math.max(Y[it[x]], Y[it[x ^ 1]]);
|
|
461
|
+
Nt.setXYZ(x, 0.2 + z * 0.6, 0.11 + z * 0.45, 0.07 + z * 0.25);
|
|
462
|
+
}
|
|
463
|
+
Nt.needsUpdate = !0;
|
|
464
|
+
let tt = 0;
|
|
465
|
+
for (let x = X.flares.length - 1; x >= 0 && tt < Yt; x--) {
|
|
466
|
+
const z = X.flares[x];
|
|
467
|
+
if (h - z.start > 2200) break;
|
|
468
|
+
if (z.area) continue;
|
|
469
|
+
let L = !1;
|
|
470
|
+
for (let N = 0; N < tt; N++) a.current[N] === z.node && (L = !0);
|
|
471
|
+
if (L) continue;
|
|
472
|
+
const gt = w(z.node);
|
|
473
|
+
for (let N = 0; N < tt; N++) {
|
|
474
|
+
const rt = i.current[N];
|
|
475
|
+
rt && Math.abs(rt.position.y - et[gt * 3 + 1]) < 0.9 / E && Math.abs(rt.position.x - et[gt * 3]) < 4.5 / E && (L = !0);
|
|
476
|
+
}
|
|
477
|
+
if (L) continue;
|
|
478
|
+
const nt = m.current[tt], O = i.current[tt];
|
|
479
|
+
nt && O && (O.position.fromArray(et, gt * 3), a.current[tt] !== z.node && (nt.setText(`${z.op === "write" ? "wrote" : "read"} · ${z.node}`), nt.setColor(z.op === "write" ? "#ffffff" : "#ffc46b")), nt.setOpacity(q(1.4 - (h - z.start) / 1600))), a.current[tt] = z.node, tt++;
|
|
480
|
+
}
|
|
481
|
+
for (let x = tt; x < Yt; x++)
|
|
482
|
+
(_t = m.current[x]) == null || _t.setOpacity(0), a.current[x] = "";
|
|
483
|
+
}), /* @__PURE__ */ vt(Tt, { children: [
|
|
484
|
+
/* @__PURE__ */ S("sprite", { material: v.haze, scale: [qt * 3.2, re * 3.2, 1], position: [0, 0, -0.5] }),
|
|
485
|
+
/* @__PURE__ */ S("lineSegments", { geometry: s.lgeo, material: v.fil, frustumCulled: !1 }),
|
|
486
|
+
/* @__PURE__ */ S("points", { geometry: s.ngeo, material: v.nodes, frustumCulled: !1 }),
|
|
487
|
+
v.ripples.map((d, h) => /* @__PURE__ */ S("sprite", { ref: (E) => void (p.current[h] = E), material: d, visible: !1 }, h)),
|
|
488
|
+
/* @__PURE__ */ vt(je, { children: [
|
|
489
|
+
/* @__PURE__ */ S("primitive", { object: y.obj }),
|
|
490
|
+
/* @__PURE__ */ S("primitive", { object: u.obj })
|
|
491
|
+
] }),
|
|
492
|
+
Array.from({ length: Yt }, (d, h) => /* @__PURE__ */ S("group", { ref: (E) => void (i.current[h] = E), children: /* @__PURE__ */ S(te, { ref: (E) => void (m.current[h] = E), text: "", offset: [0, 0.4], size: 0.24, opacity: 0, fadeMs: 250, pxRange: [8, 12] }) }, h)),
|
|
493
|
+
/* @__PURE__ */ S(Ge, { position: [0, re * 1.18, 0], suffix: " · embers", color: "#ffb066", letterSpacing: 0.04, size: 0.28, opacity: 0.85, pxRange: [8, 12] })
|
|
494
|
+
] });
|
|
495
|
+
}
|
|
496
|
+
const ye = 48, yt = new r.Vector3(), ct = new r.Vector3(), wt = new r.Vector3(), lt = new r.Vector3(), dt = new r.Color();
|
|
497
|
+
function _n() {
|
|
498
|
+
const { size: t, gl: n, camera: o } = Kt(), e = I(() => new de(ye, 32), []), c = I(() => new he(ye), []);
|
|
499
|
+
return At(({ clock: f }) => {
|
|
500
|
+
const m = performance.now(), i = Z ? 0 : f.elapsedTime;
|
|
501
|
+
c.setScale(t.height, n.getPixelRatio(), o.fov), e.begin(), c.begin();
|
|
502
|
+
const a = Vt();
|
|
503
|
+
for (const p of X.mcpPending.values()) {
|
|
504
|
+
const s = ht(p.instance), v = ve(p.server), y = X.mcpServers.get(p.server);
|
|
505
|
+
if (!s || !y || !v) continue;
|
|
506
|
+
yt.copy(s), ct.copy(v), St(yt, ct, 0.8, 1.2, wt);
|
|
507
|
+
const u = Le(p, m);
|
|
508
|
+
dt.set(y.color).lerp(nn, q(u / 1.2)), u > 1.2 && dt.lerp(Gt, q((u - 1.2) / 1));
|
|
509
|
+
const b = (0.16 + Math.min(0.3, u * 0.12)) * ce(u / 0.3), g = 0.05 + 0.9 * ce(u / 0.5);
|
|
510
|
+
if (e.add(yt, wt, ct, dt, b, 0.05, g, 0.7, i, u < 0.5 ? g : -1, 1.2), u < 0.5 && (Pt(yt, wt, ct, g, lt), c.add(lt, 0.5, D, 1.4), Z || a.emit(lt.x, lt.y, lt.z, (Math.random() - 0.5) * 0.4, -0.4, 0, 2.5, 1.4, 0.45, 0.06, dt, 1, mt)), p.resource) {
|
|
511
|
+
const w = De(p.server, p.resource) ?? We(p.server, p.resource);
|
|
512
|
+
w && (St(ct, w, 0.25, 0.2, wt), e.add(ct, wt, w, dt, b * 0.9, 0.15, 0.85, 0.7, i, -1, 0));
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
for (const p of X.mcpCalls) {
|
|
516
|
+
if (p.phase !== "result") continue;
|
|
517
|
+
const s = q((m - p.start) / p.dur);
|
|
518
|
+
if (s >= 1) continue;
|
|
519
|
+
const v = ht(p.instance), y = ve(p.server), u = X.mcpServers.get(p.server);
|
|
520
|
+
if (!v || !u || !y) continue;
|
|
521
|
+
ct.copy(y), dt.set(u.color).lerp(D, 0.45), yt.copy(v), St(yt, ct, 0.8, 1.2, wt);
|
|
522
|
+
const b = Zt(s), g = 1 - Math.max(0, (b - 0.85) / 0.15);
|
|
523
|
+
e.add(yt, wt, ct, dt, 0, Math.max(0.03, 1 - b - 0.02), Math.min(0.97, 1 - b + 0.2), 0, i, 1 - b, 1.5 * g), Pt(yt, wt, ct, 1 - b, lt), c.add(lt, 0.65, dt, 1.6 * g), !Z && Math.random() < 0.8 && a.emit(lt.x, lt.y, lt.z, (Math.random() - 0.5) * 0.4, -0.3, 0, 2.5, 1.2, 0.5, 0.06, dt, 1, pt);
|
|
524
|
+
}
|
|
525
|
+
e.end(), c.end();
|
|
526
|
+
}), /* @__PURE__ */ vt(Tt, { children: [
|
|
527
|
+
/* @__PURE__ */ S("primitive", { object: e.obj }),
|
|
528
|
+
/* @__PURE__ */ S("primitive", { object: c.obj })
|
|
529
|
+
] });
|
|
530
|
+
}
|
|
531
|
+
function En({ run: t }) {
|
|
532
|
+
const n = I(() => new r.Color(t.color), [t.color]), o = I(() => ({ haze: xt(Dt(), "#000") }), []), e = F(null), c = F(null), f = I(() => ({ x: 0, fresh: !0 }), []);
|
|
533
|
+
return At(({ clock: m }) => {
|
|
534
|
+
var d;
|
|
535
|
+
const i = performance.now(), a = t.run ?? X.runs.get(t.id), p = a ? ce((i - a.startedAt) / 1500) : 1, s = a != null && a.endedAt ? q(1 - (i - a.endedAt - (Ne - 2500)) / 2500) : 1, v = Z ? 0 : m.elapsedTime, y = Math.abs(t.side.x) * t.hu + Math.abs(t.axis.x) * t.hv, u = Math.abs(t.side.y) * t.hu + Math.abs(t.axis.y) * t.hv;
|
|
536
|
+
e.current && (e.current.position.set(t.origin.x, t.origin.y, -0.4), e.current.scale.set(y * 2.6 + 5, u * 2.6 + 4, 1), o.haze.color.copy(n).multiplyScalar(0.045 * p * s * (0.9 + 0.1 * Math.sin(v * 0.4 + t.index))));
|
|
537
|
+
let b = 0, g = 0;
|
|
538
|
+
for (const h of Qt.agents.values()) h.run === t && h.depth === 0 && (b += h.live.x, g++);
|
|
539
|
+
const w = g ? b / g : t.origin.x;
|
|
540
|
+
f.x = f.fresh ? w : f.x + (w - f.x) * 0.06, f.fresh = !1, (d = c.current) == null || d.position.set(f.x, t.origin.y + u + 0.6, 0);
|
|
541
|
+
}), /* @__PURE__ */ vt(Tt, { children: [
|
|
542
|
+
/* @__PURE__ */ S("sprite", { ref: e, material: o.haze, renderOrder: -4 }),
|
|
543
|
+
/* @__PURE__ */ S("group", { ref: c, children: t.run && /* @__PURE__ */ S(Bn, { run: t.run }) })
|
|
544
|
+
] });
|
|
545
|
+
}
|
|
546
|
+
function Bn({ run: t }) {
|
|
547
|
+
Xe();
|
|
548
|
+
const n = t.status !== "started";
|
|
549
|
+
return /* @__PURE__ */ S(
|
|
550
|
+
te,
|
|
551
|
+
{
|
|
552
|
+
text: t.topic,
|
|
553
|
+
secondary: Ue(t, { base: "#a39bb8", current: "#ffd28a", done: "#d6d0e6" }, ["running…", "run complete"]),
|
|
554
|
+
color: t.color,
|
|
555
|
+
textColor: "#fff3e6",
|
|
556
|
+
plate: "none",
|
|
557
|
+
anchorY: "bottom",
|
|
558
|
+
uppercase: !0,
|
|
559
|
+
letterSpacing: 0.12,
|
|
560
|
+
size: 0.34,
|
|
561
|
+
maxWidth: 11,
|
|
562
|
+
opacity: n ? 0.5 : 0.92,
|
|
563
|
+
fadeMs: 600,
|
|
564
|
+
pxRange: [10, 14],
|
|
565
|
+
glow: 1.1
|
|
566
|
+
}
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
const se = 6;
|
|
570
|
+
function kn() {
|
|
571
|
+
const t = F(/* @__PURE__ */ new Set()), n = F([]), o = F([]), e = F([]), c = F([]), f = I(() => new r.Color(), []);
|
|
572
|
+
return At(() => {
|
|
573
|
+
const m = performance.now();
|
|
574
|
+
for (const i of X.runs.values()) {
|
|
575
|
+
if (!i.final || t.current.has(i.id)) continue;
|
|
576
|
+
t.current.add(i.id);
|
|
577
|
+
const a = Qt.runs.get(i.id);
|
|
578
|
+
if (!a) continue;
|
|
579
|
+
let p;
|
|
580
|
+
for (const u of X.instances.values()) u.run === i.id && !u.parent && (p = ht(u.id) ?? p);
|
|
581
|
+
const s = (p ?? a.origin).clone();
|
|
582
|
+
s.y += 2.2, n.current.push({ run: i.id, start: m, at: s, text: i.final }), n.current.length > se && n.current.shift();
|
|
583
|
+
const v = Vt();
|
|
584
|
+
f.set(i.color).lerp(H, 0.6);
|
|
585
|
+
const y = Math.round(110 * ot);
|
|
586
|
+
for (let u = 0; u < y; u++) {
|
|
587
|
+
const b = u / y * Math.PI * 2, g = 6.5 * (0.95 + Math.random() * 0.1);
|
|
588
|
+
v.emit(s.x, s.y, s.z, Math.cos(b) * g, Math.sin(b) * g * 0.92, 0, 1.6, 0.9, 2.4 + Math.random() * 0.8, 0.1, u % 2 ? H : f, 1.1, u % 3 === 0 ? pt : mt), u % 2 === 0 && v.emit(s.x, s.y, s.z, Math.cos(b) * g * 0.5, Math.sin(b) * g * 0.5, 0, 1.8, 0.7, 1.6, 0.08, D, 1, pt);
|
|
589
|
+
}
|
|
590
|
+
for (let u = 0; u < 6 * ot; u++) v.emit(s.x + (Math.random() - 0.5) * 3, s.y + (Math.random() - 0.5) * 2, s.z, 0.15, 0.12, 0, 0.5, -0.03, 5, 3.2, xe, 1, le);
|
|
591
|
+
}
|
|
592
|
+
if (t.current.size > 200)
|
|
593
|
+
for (const i of t.current) X.runs.has(i) || t.current.delete(i);
|
|
594
|
+
n.current.length && m - n.current[0].start > 5600 && n.current.shift();
|
|
595
|
+
for (let i = 0; i < se; i++) {
|
|
596
|
+
const a = n.current[i], p = o.current[i], s = e.current[i];
|
|
597
|
+
if (!p || !s) continue;
|
|
598
|
+
if (!a) {
|
|
599
|
+
p.setOpacity(0);
|
|
600
|
+
continue;
|
|
601
|
+
}
|
|
602
|
+
const v = (m - a.start) / 1e3;
|
|
603
|
+
s.position.set(a.at.x, a.at.y - 3.4, a.at.z), c.current[i] !== a.run + a.start && (c.current[i] = a.run + a.start, p.setText(`finale · ${a.text.length > 64 ? a.text.slice(0, 62) + "…" : a.text}`)), p.setOpacity(q(v / 0.3) * q((5.4 - v) / 1.2));
|
|
604
|
+
}
|
|
605
|
+
}), /* @__PURE__ */ S(Tt, { children: Array.from({ length: se }, (m, i) => /* @__PURE__ */ S("group", { ref: (a) => void (e.current[i] = a), children: /* @__PURE__ */ S(te, { ref: (a) => void (o.current[i] = a), text: "", color: "#ffd28a", size: 0.26, maxWidth: 11, opacity: 0, pxRange: [8, 12], renderOrder: 24 }) }, i)) });
|
|
606
|
+
}
|
|
607
|
+
const Kn = 1.7, ze = 0.5, Vn = 1.5, On = new r.MeshBasicMaterial({ colorWrite: !1, depthWrite: !1, transparent: !0, opacity: 0 }), T = new r.Vector3(), we = new r.Color(), R = Math.random, $ = new r.Vector3();
|
|
608
|
+
function ie(t, n, o, e, c, f) {
|
|
609
|
+
t = Math.max(0, t);
|
|
610
|
+
const m = n ? 1 - (1 - t) * (1 - t) : 1 - Math.pow(1 - t, 1.8);
|
|
611
|
+
return Pt(o, e, c, m, f);
|
|
612
|
+
}
|
|
613
|
+
function Fn(t, n, o, e, c, f) {
|
|
614
|
+
const m = n * Math.PI * 2 + (o - 0.5) * 0.5, i = e * (0.85 + o * 0.2);
|
|
615
|
+
c.set(t.x + Math.cos(m) * i, t.y + i * (0.42 + n * 0.12), t.z + Math.sin(m) * i * 0.7), f.copy(c).add(t).multiplyScalar(0.5), f.y += i * 0.12;
|
|
616
|
+
}
|
|
617
|
+
const Jt = 18;
|
|
618
|
+
function jn() {
|
|
619
|
+
const t = new r.BufferGeometry();
|
|
620
|
+
return t.setAttribute("position", new r.BufferAttribute(new Float32Array(Jt * 6), 3)), t.setAttribute("color", new r.BufferAttribute(new Float32Array(Jt * 6), 3)), t.boundingSphere = new r.Sphere(new r.Vector3(), 1e5), t;
|
|
621
|
+
}
|
|
622
|
+
function Et(t) {
|
|
623
|
+
const n = R() * Math.PI * 2, o = R() * 2 - 1, e = Math.sqrt(1 - o * o);
|
|
624
|
+
return t.set(Math.cos(n) * e, o, Math.sin(n) * e * 0.4);
|
|
625
|
+
}
|
|
626
|
+
function Gn({ agent: t, selected: n, onSelect: o }) {
|
|
627
|
+
const e = t.inst, { size: c, gl: f, camera: m } = Kt(), i = F(null), a = F(null), p = F(null), s = F(null), v = F(null), y = F(null), u = F(null), b = F(null), g = F(null), w = F(null), d = I(() => [...e.id].reduce((W, V) => (W * 31 + V.charCodeAt(0)) % 9973, 7) / 9973, [e.id]), h = Lt[e.type], E = on[e.type], P = I(() => ({
|
|
628
|
+
sh: Sn(h, E, d),
|
|
629
|
+
halo: xt(Dt(), "#000"),
|
|
630
|
+
core: xt(Dt(), "#000"),
|
|
631
|
+
flash: xt(Se(), "#000"),
|
|
632
|
+
salute: xt(cn(), "#000"),
|
|
633
|
+
rocket: xt(Dt(), "#000"),
|
|
634
|
+
tailGeo: jn(),
|
|
635
|
+
tail: Ae(),
|
|
636
|
+
sel: new r.MeshBasicMaterial({ color: "#000", blending: r.AdditiveBlending, transparent: !0, depthWrite: !1, toneMapped: !1 })
|
|
637
|
+
}), [h, E, d]), l = I(() => {
|
|
638
|
+
const W = performance.now(), V = W - e.bornAt < 600;
|
|
639
|
+
return {
|
|
640
|
+
launch: V,
|
|
641
|
+
burstAt: V ? -1 : W - 2e3,
|
|
642
|
+
mountAt: W,
|
|
643
|
+
burst: !V,
|
|
644
|
+
calls: e.llmCalls,
|
|
645
|
+
tools: e.toolCalls,
|
|
646
|
+
decAt: W,
|
|
647
|
+
saluteAt: -1e9,
|
|
648
|
+
done: !1,
|
|
649
|
+
doneK: 0,
|
|
650
|
+
waitK: 0,
|
|
651
|
+
selK: 0,
|
|
652
|
+
from: new r.Vector3(),
|
|
653
|
+
ctrl: new r.Vector3(),
|
|
654
|
+
aimed: !1
|
|
655
|
+
};
|
|
656
|
+
}, []);
|
|
657
|
+
At(({ clock: W }) => {
|
|
658
|
+
var st, pe;
|
|
659
|
+
const V = performance.now(), Y = Z ? 0 : W.elapsedTime, _ = Vt(), G = t.scale, C = Vn * G * (t.depth > 0 ? 1.4 : 1), ut = Z ? 0 : 0.06 * $t.spread;
|
|
660
|
+
t.live.set(t.pos.x + Math.sin(Y * 0.23 + d * 20) * ut, t.pos.y + Math.cos(Y * 0.19 + d * 13) * ut * 0.7, t.pos.z);
|
|
661
|
+
const M = t.live, j = !!e.parent && t.depth > 0, Wt = j ? ze : Kn;
|
|
662
|
+
if (l.launch && l.burstAt < 0) {
|
|
663
|
+
const A = (V - e.bornAt) / 1e3 / Wt;
|
|
664
|
+
if (A >= 1) l.burstAt = V;
|
|
665
|
+
else {
|
|
666
|
+
const k = j ? ht(e.parent) : void 0;
|
|
667
|
+
k ? (l.from.copy(k), St(l.from, M, 0.4 * G, 0.6 * G, l.ctrl)) : l.aimed || (l.aimed = !0, Fn(M, kt(t.run.id, 3), d, Math.max(12, m.position.length()), l.from, l.ctrl)), ie(A, j, l.from, l.ctrl, M, T);
|
|
668
|
+
const U = j ? 1 : q(A / 0.12);
|
|
669
|
+
v.current && (v.current.visible = !0, v.current.position.copy(T), v.current.scale.setScalar((j ? 0.5 : 1.15) * (Z ? 1 : 0.85 + 0.15 * Math.sin(Y * 37 + d * 9)))), P.rocket.color.copy(H).lerp(D, 0.6).multiplyScalar(1.5 * U);
|
|
670
|
+
const Ct = P.tailGeo.getAttribute("position"), Ft = P.tailGeo.getAttribute("color"), Xt = j ? 0.3 : 0.32;
|
|
671
|
+
for (let zt = 0; zt < Jt; zt++)
|
|
672
|
+
for (let Ut = 0; Ut < 2; Ut++) {
|
|
673
|
+
const ne = (zt + Ut) / Jt;
|
|
674
|
+
ie(A - Xt * (1 - ne), j, l.from, l.ctrl, M, $);
|
|
675
|
+
const me = zt * 2 + Ut;
|
|
676
|
+
Ct.setXYZ(me, $.x, $.y, $.z);
|
|
677
|
+
const oe = ne * ne * (j ? 1.1 : 1.6) * U;
|
|
678
|
+
Ft.setXYZ(me, H.r * oe, H.g * oe * 0.92, H.b * oe * 0.8);
|
|
679
|
+
}
|
|
680
|
+
Ct.needsUpdate = !0, Ft.needsUpdate = !0, y.current && (y.current.visible = !0);
|
|
681
|
+
const Pe = (j ? 2 : 9) * ot * U;
|
|
682
|
+
for (let zt = 0; zt < Pe; zt++)
|
|
683
|
+
ie(A - R() * (j ? 0.04 : 0.025), j, l.from, l.ctrl, M, $), j ? _.emit($.x, $.y, $.z, (R() - 0.5) * 0.9, -0.3 - R() * 1.2, (R() - 0.5) * 0.2, 2.2, 2, 0.35 + R() * 0.55, 0.06, R() < 0.3 ? D : H, 0.95, R() < 0.4 ? mt : pt) : _.emit($.x, $.y, $.z, (R() - 0.5) * 0.35, (R() - 0.5) * 0.35, (R() - 0.5) * 0.15, 1.6, 0.45, 0.9 + R() * 1.2, 0.08, R() < 0.4 ? D : R() < 0.5 ? H : h, 0.95, R() < 0.65 ? mt : pt);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
(!l.launch || l.burstAt >= 0) && (v.current && (v.current.visible = !1), y.current && (y.current.visible = !1));
|
|
687
|
+
const K = l.burstAt < 0 ? -1 : (V - l.burstAt) / 1e3;
|
|
688
|
+
if (l.burstAt >= 0 && !l.burst) {
|
|
689
|
+
l.burst = !0;
|
|
690
|
+
const A = Math.round((j ? 100 : 230) * ot), k = 2.4;
|
|
691
|
+
_.burst(M.x, M.y, M.z, A, C * 2.6 * k, h, 1.55, { drag: k, grav: 1.1, life: j ? 1.7 : 2.5, size: j ? 0.095 : 0.13, glitter: 0.3, c2: E });
|
|
692
|
+
for (let U = 0; U < 5 * ot; U++)
|
|
693
|
+
Et(T), _.emit(M.x + T.x * C * 0.4, M.y + T.y * C * 0.4, M.z, T.x * 0.35, T.y * 0.35 + 0.1, 0, 0.8, -0.05, 3.2 + R(), C * 1.5, h, 0.9, le);
|
|
694
|
+
}
|
|
695
|
+
const ft = e.exitAt ? (V - e.exitAt) / Math.max(400, Ye(e)) : -1, Rt = ft >= 0 ? q(ft) : 0, J = ft < 0 && !e.doneAt, Ot = e.status === "failed";
|
|
696
|
+
if (!J && !l.done && K > 0) {
|
|
697
|
+
l.done = !0;
|
|
698
|
+
const A = Math.round((j ? 26 : 50) * ot);
|
|
699
|
+
for (let k = 0; k < A; k++) {
|
|
700
|
+
Et(T);
|
|
701
|
+
const U = C * (0.75 + R() * 0.3);
|
|
702
|
+
_.emit(M.x + T.x * U, M.y + T.y * U, M.z + T.z * U, T.x * 0.5, T.y * 0.3 - 0.2, 0, 1.3, 0.9, 2.2 + R() * 1.2, 0.075, Ot ? Gt : R() < 0.5 ? H : It, 0.85, hn);
|
|
703
|
+
}
|
|
704
|
+
for (let k = 0; k < 6 * ot; k++)
|
|
705
|
+
Et(T), _.emit(M.x + T.x * C * 0.6, M.y + T.y * C * 0.6, M.z, T.x * 0.25 + 0.08, 0.18 + R() * 0.15, 0, 0.6, -0.04, 4 + R() * 1.5, C * 1.6, xe, 1, le);
|
|
706
|
+
}
|
|
707
|
+
l.doneK += ((J ? 0 : 1) - l.doneK) * (Z ? 1 : 0.035);
|
|
708
|
+
const Nt = J && e.status === "waiting";
|
|
709
|
+
if (l.waitK += ((Nt ? 1 : 0) - l.waitK) * 0.05, e.llmCalls !== l.calls && (l.calls = e.llmCalls, J && K > 0)) {
|
|
710
|
+
const A = Math.round((10 + 26 * (e.pulse / 2.5)) * ot);
|
|
711
|
+
for (let k = 0; k < A; k++) {
|
|
712
|
+
Et(T);
|
|
713
|
+
const U = C * (0.7 + R() * 0.35);
|
|
714
|
+
_.emit(M.x + T.x * U, M.y + T.y * U, M.z + T.z * U, T.x * C * 0.9, T.y * C * 0.9, T.z * C * 0.4, 3.2, 0.5, 0.45 + R() * 0.55 * (e.pulse / 1.5), 0.065, R() < 0.5 ? D : E, 1, mt, R() * 0.25);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
if (e.toolCalls !== l.tools && (l.tools = e.toolCalls, J && K > 0)) {
|
|
718
|
+
Et(T), T.y = Math.abs(T.y) * 0.6 + 0.3, T.normalize();
|
|
719
|
+
for (let A = 0; A < 7 * ot; A++) {
|
|
720
|
+
const k = C * (3.2 + A * 0.25);
|
|
721
|
+
_.emit(M.x + T.x * C * 0.8, M.y + T.y * C * 0.8, M.z, T.x * k + (R() - 0.5) * 0.3, T.y * k + (R() - 0.5) * 0.3, 0, 3, 1.4, 0.5 + A * 0.05, 0.07, A === 0 ? D : E, 1, pt, A * 0.018);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
const it = e.decisions;
|
|
725
|
+
for (let A = it.length - 1; A >= 0; A--) {
|
|
726
|
+
const k = it[A];
|
|
727
|
+
if (k.at <= l.decAt) break;
|
|
728
|
+
if (!(k.at > V) && He(k) && V - l.saluteAt > 450 && J) {
|
|
729
|
+
l.saluteAt = V;
|
|
730
|
+
const U = Math.round(30 * ot);
|
|
731
|
+
for (let Ct = 0; Ct < U; Ct++) {
|
|
732
|
+
const Ft = Ct / U * Math.PI * 2, Xt = C * 7 * (0.85 + R() * 0.3);
|
|
733
|
+
_.emit(M.x, M.y, M.z + 0.05, Math.cos(Ft) * Xt, Math.sin(Ft) * Xt, 0, 6, 0.8, 0.35 + R() * 0.2, 0.08, Ct % 4 === 0 ? D : Gt, 1.2, pt);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
let tt = l.decAt;
|
|
738
|
+
for (let A = it.length - 1; A >= 0; A--) it[A].at <= V && it[A].at > tt && (tt = it[A].at);
|
|
739
|
+
l.decAt = tt;
|
|
740
|
+
const _t = e.hv ? $e(e.hv, V) : 0, x = e.hv ? Math.min(1, e.hv.rate / 6) : 0;
|
|
741
|
+
if (J && _t > 0.05 && K > 0 && R() < (0.35 + x * 0.9) * _t * ot) {
|
|
742
|
+
Et(T);
|
|
743
|
+
const A = C * (0.8 + R() * 0.3);
|
|
744
|
+
_.emit(M.x + T.x * A, M.y + T.y * A, M.z, T.x * C * 0.6, T.y * C * 0.6, 0, 3, 0.4, 0.35 + R() * 0.3, 0.06, R() < 0.6 ? D : E, 1, mt);
|
|
745
|
+
}
|
|
746
|
+
const z = Ze(e, V), L = J && (e.status === "thinking" || e.status === "spawning"), gt = l.launch ? 1 : q((V - l.mountAt) / 500), nt = (1 - Rt) * gt, O = P.sh.u;
|
|
747
|
+
O.uC.value.copy(M), O.uR.value = C, O.uAge.value = K, O.uTime.value = Y, O.uLvl.value = (L ? 1.3 : 1) + z * 0.3, O.uCrackle.value = Math.min(1, z * 0.45 + _t * (0.45 + x * 0.4)) * (J ? 1 : 0) * (Z ? 0.3 : 1), O.uDone.value = l.doneK, O.uWait.value = l.waitK, O.uScale.value = ee(c.height, f.getPixelRatio(), m.fov), O.uOpacity.value = nt, O.uSize.value = (j ? 0.1 : 0.13) * Math.max(0.75, Math.min(1.5, G)), O.uCol2.value.copy(Ot && !J ? Gt : E);
|
|
748
|
+
const N = K >= 0, rt = N ? 1 - Math.exp(-K * 5.5) : 0, at = 0.55 + 0.45 * Math.sin(Y * 2.2 + d * 6);
|
|
749
|
+
if (a.current && (a.current.visible = N, a.current.position.copy(M), a.current.scale.setScalar(Math.max(1e-4, C * (0.55 + z * 0.12 + l.waitK * 0.25 * at) * rt)), we.copy(D).lerp(h, 0.25).lerp(It, l.waitK * 0.85 + l.doneK * 0.6), P.core.color.copy(we).multiplyScalar((0.8 + z * 0.3) * (1 - l.waitK * 0.35 * (1 - at)) * (1 - l.doneK * 0.8) * nt)), i.current && (i.current.visible = N, i.current.position.copy(M), i.current.position.z -= 0.05, i.current.scale.setScalar(Math.max(1e-4, C * 3.4 * rt * (1 - l.waitK * 0.35))), P.halo.color.copy(h).lerp(It, l.waitK * 0.7).multiplyScalar((0.19 + z * 0.07 + (N ? Math.exp(-K * 2.5) * 0.3 : 0)) * (1 - l.doneK * 0.7) * nt)), p.current) {
|
|
750
|
+
const A = l.launch && N && K < 1;
|
|
751
|
+
if (p.current.visible = A, A) {
|
|
752
|
+
const k = 1 - Math.pow(1 - K, 3);
|
|
753
|
+
p.current.position.copy(M), p.current.scale.setScalar(C * (0.5 + k * 2.6)), P.flash.color.copy(h).lerp(D, 0.5).multiplyScalar((1 - K) * (1 - K) * (1 - K) * 0.7);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
if (s.current) {
|
|
757
|
+
const A = (V - l.saluteAt) / 1e3, k = A < 0.5;
|
|
758
|
+
s.current.visible = k, k && (s.current.position.copy(M), s.current.position.z += 0.1, s.current.scale.setScalar(C * (1.6 + A * 5)), P.salute.color.copy(D).lerp(Gt, q(A * 4)).multiplyScalar(1.6 * (1 - A / 0.5) * (1 - A / 0.5)));
|
|
759
|
+
}
|
|
760
|
+
l.selK += ((n ? 1 : 0) - l.selK) * 0.12, u.current && (u.current.visible = l.selK > 0.02, u.current.position.copy(M), u.current.scale.setScalar(C * (1.35 + (1 - l.selK) * 0.5)), P.sel.color.setScalar(0.85 * l.selK * nt)), b.current && (b.current.position.copy(M), b.current.scale.setScalar(Math.max(1e-4, C * 0.95))), (st = g.current) == null || st.position.set(M.x, M.y - C * (1.05 - l.waitK * 0.35) - 0.28, M.z), (pe = w.current) == null || pe.setOpacity(qe(e.id) ? (N ? q(K * 2) : 0) * (J ? 0.95 : 0.6) * (1 - Rt) : 0);
|
|
761
|
+
});
|
|
762
|
+
const Q = (W) => {
|
|
763
|
+
W.stopPropagation(), o(e.id);
|
|
764
|
+
}, et = e.id.split(":")[2];
|
|
765
|
+
return /* @__PURE__ */ vt(Tt, { children: [
|
|
766
|
+
/* @__PURE__ */ S("mesh", { ref: b, geometry: un, material: On, scale: 1e-4, onClick: Q, onPointerOver: () => document.body.style.cursor = "pointer", onPointerOut: () => document.body.style.cursor = "" }),
|
|
767
|
+
/* @__PURE__ */ S("sprite", { ref: i, material: P.halo, visible: !1 }),
|
|
768
|
+
/* @__PURE__ */ S("lineSegments", { geometry: bn, material: P.sh.lines, frustumCulled: !1, renderOrder: 3 }),
|
|
769
|
+
/* @__PURE__ */ S("points", { geometry: wn, material: P.sh.pts, frustumCulled: !1, renderOrder: 4 }),
|
|
770
|
+
/* @__PURE__ */ S("sprite", { ref: a, material: P.core, visible: !1, renderOrder: 5 }),
|
|
771
|
+
/* @__PURE__ */ S("sprite", { ref: p, material: P.flash, visible: !1 }),
|
|
772
|
+
/* @__PURE__ */ S("sprite", { ref: s, material: P.salute, visible: !1, renderOrder: 6 }),
|
|
773
|
+
/* @__PURE__ */ S("sprite", { ref: v, material: P.rocket, visible: !1 }),
|
|
774
|
+
/* @__PURE__ */ S("lineSegments", { ref: y, geometry: P.tailGeo, material: P.tail, visible: !1, frustumCulled: !1 }),
|
|
775
|
+
/* @__PURE__ */ S("mesh", { ref: u, geometry: ln, material: P.sel, visible: !1 }),
|
|
776
|
+
/* @__PURE__ */ S("group", { ref: g, children: /* @__PURE__ */ S(
|
|
777
|
+
te,
|
|
778
|
+
{
|
|
779
|
+
ref: w,
|
|
780
|
+
text: `${e.name}${et !== void 0 ? ` ${Number(et) + 1}` : ""}`,
|
|
781
|
+
live: e.job ? () => Qe(e) : null,
|
|
782
|
+
color: ue[e.type],
|
|
783
|
+
size: e.subagent ? 0.22 : 0.28,
|
|
784
|
+
letterSpacing: 0.02,
|
|
785
|
+
opacity: 0,
|
|
786
|
+
fit: !0,
|
|
787
|
+
pxRange: e.subagent ? [8, 11.5] : [9, 13.5]
|
|
788
|
+
}
|
|
789
|
+
) })
|
|
790
|
+
] });
|
|
791
|
+
}
|
|
792
|
+
const In = 96, be = 32, Ht = new r.Vector3(), bt = new r.Vector3(), Bt = new r.Vector3(), Mt = new r.Color();
|
|
793
|
+
function Ln() {
|
|
794
|
+
const { size: t, gl: n, camera: o } = Kt(), e = I(() => new de(In + be, 22), []), c = I(() => new he(be), []), f = I(() => /* @__PURE__ */ new Map(), []);
|
|
795
|
+
return At(({ clock: m }) => {
|
|
796
|
+
const i = performance.now(), a = Z ? 0 : m.elapsedTime;
|
|
797
|
+
c.setScale(t.height, n.getPixelRatio(), o.fov), e.begin(), c.begin();
|
|
798
|
+
for (const s of f.keys()) X.instances.has(s) || f.delete(s);
|
|
799
|
+
for (const s of X.instances.values()) {
|
|
800
|
+
if (!s.parent) continue;
|
|
801
|
+
const v = ht(s.parent), y = ht(s.id);
|
|
802
|
+
if (!v || !y) continue;
|
|
803
|
+
const u = X.instances.get(s.parent), g = (i - s.bornAt) / 1e3 > ze && u && !u.exitAt && !s.exitAt && !s.doneAt ? 1 : 0;
|
|
804
|
+
let w = f.get(s.id) ?? 0;
|
|
805
|
+
if (w += (g - w) * (g ? 0.04 : 0.03), f.set(s.id, w), w < 0.01) continue;
|
|
806
|
+
const d = $t.scale;
|
|
807
|
+
St(v, y, 0.4 * d, 0.6 * d, bt);
|
|
808
|
+
const h = v.distanceTo(y) || 1, E = Math.min(0.35, 0.75 * d * 1.35 / h), P = 1 - Math.min(0.35, 0.75 * d * 0.6 / h);
|
|
809
|
+
Mt.copy(Lt[s.type]).lerp(H, 0.5), e.add(v, bt, y, Mt, 0.16 * w, E, P, 0.12 * w, a, -1, 0);
|
|
810
|
+
}
|
|
811
|
+
const p = Vt();
|
|
812
|
+
for (const s of X.comets) {
|
|
813
|
+
const v = ht(s.from), y = ht(s.to);
|
|
814
|
+
if (!v || !y) continue;
|
|
815
|
+
const u = Je(s, i);
|
|
816
|
+
if (!tn(s, i)) continue;
|
|
817
|
+
const b = X.instances.get(s.from), g = X.instances.get(s.to);
|
|
818
|
+
if ((g == null ? void 0 : g.parent) === s.from || (b == null ? void 0 : b.parent) === s.to) {
|
|
819
|
+
const d = (g == null ? void 0 : g.parent) === s.from;
|
|
820
|
+
$.copy(d ? v : y), Ht.copy(d ? y : v), St($, Ht, 0.4 * $t.scale, 0.6 * $t.scale, bt);
|
|
821
|
+
const h = d ? Zt(u) : 1 - Zt(u);
|
|
822
|
+
Pt($, bt, Ht, h, Bt), Mt.copy(b ? Lt[b.type] : H).lerp(D, 0.45);
|
|
823
|
+
const E = Math.min(1, u / 0.1) * Math.min(1, (1 - u) / 0.15);
|
|
824
|
+
e.add($, bt, Ht, Mt, 0, d ? Math.max(0, h - 0.25) : h, d ? h : Math.min(1, h + 0.25), 0, a, h, 1.4 * E);
|
|
825
|
+
} else {
|
|
826
|
+
St(v, y, 1.2, 1, bt);
|
|
827
|
+
const d = Zt(u);
|
|
828
|
+
Pt(v, bt, y, d, Bt), Mt.copy(b ? Lt[b.type] : H).lerp(D, 0.45);
|
|
829
|
+
const h = Math.min(1, u / 0.1) * Math.min(1, (1 - u) / 0.15);
|
|
830
|
+
e.add(v, bt, y, Mt, 0, Math.max(0, d - 0.22), d, 0, a, d, 1.4 * h);
|
|
831
|
+
}
|
|
832
|
+
c.add(Bt, 0.55, Mt, 1.5), !Z && R() < 0.7 && p.emit(Bt.x, Bt.y, Bt.z, (R() - 0.5) * 0.4, -0.3 - R() * 0.3, 0, 2.5, 1.2, 0.5, 0.06, Mt, 0.9, mt);
|
|
833
|
+
}
|
|
834
|
+
e.end(), c.end();
|
|
835
|
+
}), /* @__PURE__ */ vt(Tt, { children: [
|
|
836
|
+
/* @__PURE__ */ S("primitive", { object: e.obj }),
|
|
837
|
+
/* @__PURE__ */ S("primitive", { object: c.obj })
|
|
838
|
+
] });
|
|
839
|
+
}
|
|
840
|
+
const Dn = (
|
|
841
|
+
/* glsl */
|
|
842
|
+
`
|
|
843
|
+
varying vec3 vW;
|
|
844
|
+
void main(){ vec4 w = modelMatrix * vec4(position, 1.0); vW = w.xyz; gl_Position = projectionMatrix * viewMatrix * w; }`
|
|
845
|
+
), Wn = (
|
|
846
|
+
/* glsl */
|
|
847
|
+
`
|
|
848
|
+
uniform float uTime; uniform float uK; uniform float uPx;
|
|
849
|
+
varying vec3 vW;
|
|
850
|
+
float h(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
|
|
851
|
+
void main(){
|
|
852
|
+
vec3 d = normalize(vW - cameraPosition);
|
|
853
|
+
// deep navy overhead, a faint violet glow lower in the sky (no horizon line: it just thins out)
|
|
854
|
+
float y = d.y;
|
|
855
|
+
vec3 col = mix(vec3(0.019, 0.015, 0.038), vec3(0.004, 0.006, 0.022), smoothstep(-0.55, 0.45, y));
|
|
856
|
+
col += vec3(0.020, 0.009, 0.016) * smoothstep(0.2, -0.6, y);
|
|
857
|
+
// stars on the sky sphere: one candidate per ~2.2 css px cell (in angle), sparse and twinkling. Drawn with a
|
|
858
|
+
// pixel-sized falloff so they stay crisp and don't crawl while the camera turns
|
|
859
|
+
vec2 g = vec2(atan(d.z, d.x), asin(clamp(y, -1.0, 1.0))) * uK;
|
|
860
|
+
vec2 cell = floor(g);
|
|
861
|
+
float r = h(cell);
|
|
862
|
+
if (r > 0.955) {
|
|
863
|
+
vec2 c = vec2(h(cell + 1.7), h(cell + 4.3)) * 0.6 + 0.2;
|
|
864
|
+
float dp = length(fract(g) - c) * 2.2 * uPx;
|
|
865
|
+
float m = pow(h(cell + 9.1), 3.0);
|
|
866
|
+
float tw = 0.65 + 0.35 * sin(uTime * (0.8 + r * 2.0) + r * 60.0);
|
|
867
|
+
col += vec3(0.75, 0.8, 1.0) * smoothstep(0.8 + m * 0.9, 0.0, dp) * (0.16 + m * 0.75) * tw;
|
|
868
|
+
}
|
|
869
|
+
gl_FragColor = vec4(col, 1.0);
|
|
870
|
+
}`
|
|
871
|
+
);
|
|
872
|
+
function Nn() {
|
|
873
|
+
const { size: t, gl: n, camera: o } = Kt(), e = I(
|
|
874
|
+
() => new r.ShaderMaterial({
|
|
875
|
+
uniforms: { uTime: { value: 0 }, uK: { value: 300 }, uPx: { value: 1 } },
|
|
876
|
+
vertexShader: Dn,
|
|
877
|
+
fragmentShader: Wn,
|
|
878
|
+
depthWrite: !1,
|
|
879
|
+
depthTest: !1
|
|
880
|
+
}),
|
|
881
|
+
[]
|
|
882
|
+
), c = F(null);
|
|
883
|
+
return At(({ clock: f }) => {
|
|
884
|
+
const m = e.uniforms, i = Math.atan2(o.position.x, o.position.z), a = Math.cos(i), p = Math.sin(i);
|
|
885
|
+
c.current && (c.current.position.set(-p * 0.6, 0, -a * 0.6), c.current.rotation.y = i), m.uTime.value = Z ? 0 : f.elapsedTime, m.uPx.value = n.getPixelRatio();
|
|
886
|
+
const s = o.fov;
|
|
887
|
+
m.uK.value = t.height / (2.2 * 2 * Math.tan(s * Math.PI / 360));
|
|
888
|
+
}), /* @__PURE__ */ S("mesh", { ref: c, material: e, position: [0, 0, -0.6], renderOrder: -10, frustumCulled: !1, children: /* @__PURE__ */ S("planeGeometry", { args: [6e3, 6e3] }) });
|
|
889
|
+
}
|
|
890
|
+
function Xn() {
|
|
891
|
+
const { size: t, gl: n, camera: o } = Kt(), e = Vt();
|
|
892
|
+
return At(() => {
|
|
893
|
+
e.setScale(t.height, n.getPixelRatio(), o.fov), e.flush();
|
|
894
|
+
}), /* @__PURE__ */ vt(Tt, { children: [
|
|
895
|
+
/* @__PURE__ */ S("primitive", { object: e.streaks }),
|
|
896
|
+
/* @__PURE__ */ S("primitive", { object: e.points })
|
|
897
|
+
] });
|
|
898
|
+
}
|
|
899
|
+
const Un = {
|
|
900
|
+
emit: (t, n, o) => {
|
|
901
|
+
Math.random() > ot || Vt().emit(t.x, t.y, t.z, n.x, n.y, n.z, 2.4, 2.2, 0.4 + Math.random() * 0.35, 0.06, o, 1, Math.random() < 0.3 ? mt : pt);
|
|
902
|
+
}
|
|
903
|
+
}, Yn = {
|
|
904
|
+
minPolarAngle: Math.PI * 0.3,
|
|
905
|
+
maxPolarAngle: Math.PI * 0.68
|
|
906
|
+
};
|
|
907
|
+
function to() {
|
|
908
|
+
return /* @__PURE__ */ vt(
|
|
909
|
+
en,
|
|
910
|
+
{
|
|
911
|
+
title: "fireworks · night show",
|
|
912
|
+
subtitle: "Each agent streaks in as a shooting star and bursts into a star shell (subagents = secondary bursts) · shells crackle on LLM calls · ✦ comets on tool calls · red salute = deny · ember = waiting · willow = done · ◆ MCP crystals with orbiting backend satellites · graph = embers",
|
|
913
|
+
preset: fn,
|
|
914
|
+
plane: "xy",
|
|
915
|
+
camera: { position: [0, 0, 34], fov: 46, far: 1200 },
|
|
916
|
+
controls: Yn,
|
|
917
|
+
bg: "#03040d",
|
|
918
|
+
gl: { antialias: !0 },
|
|
919
|
+
fit: { nRef: 4, min: 0.62, max: 1.6, minRadius: 5.5 },
|
|
920
|
+
agentRadius: 1.7,
|
|
921
|
+
graph: { natural: qt * 1.1, radius: 3.4 },
|
|
922
|
+
Background: /* @__PURE__ */ S(Nn, {}),
|
|
923
|
+
Agent: Gn,
|
|
924
|
+
RunMarker: En,
|
|
925
|
+
mcpStyle: Un,
|
|
926
|
+
GraphResource: Rn,
|
|
927
|
+
cluster: { radius: 1.5, variant: "stars", glowGain: 0.9 },
|
|
928
|
+
PostFX: /* @__PURE__ */ vt(_e, { multisampling: 0, children: [
|
|
929
|
+
/* @__PURE__ */ S(Ee, { mipmapBlur: !0, intensity: 0.85, luminanceThreshold: 0.3, luminanceSmoothing: 0.3, radius: 0.65 }),
|
|
930
|
+
/* @__PURE__ */ S(Be, { eskil: !1, offset: 0.35, darkness: 0.5 })
|
|
931
|
+
] }),
|
|
932
|
+
children: [
|
|
933
|
+
/* @__PURE__ */ S(Ln, {}),
|
|
934
|
+
/* @__PURE__ */ S(_n, {}),
|
|
935
|
+
/* @__PURE__ */ S(kn, {}),
|
|
936
|
+
/* @__PURE__ */ S(Xn, {})
|
|
937
|
+
]
|
|
938
|
+
}
|
|
939
|
+
);
|
|
940
|
+
}
|
|
941
|
+
export {
|
|
942
|
+
to as default
|
|
943
|
+
};
|