@kolkrabbi/design-editor 0.23.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +2 -2
  2. package/dist/BindDot-CMUtpJPX.js +84 -0
  3. package/dist/BufferGeometryUtils-Cc8LNd5v.js +150 -0
  4. package/dist/ColorModesWindow-CWhL6nfm.js +1493 -0
  5. package/dist/GLTFLoader-BFir8PCc.js +1361 -0
  6. package/dist/OBJLoader-BgqC_-Jn.js +287 -0
  7. package/dist/{OrbitControls-Cql8Rn2i.js → OrbitControls-DVpLgmKv.js} +2755 -2202
  8. package/dist/STLLoader-C6DGLf6r.js +83 -0
  9. package/dist/TreePicker-nMf17QGH.js +68 -0
  10. package/dist/core-CfGqY4VB.js +17504 -0
  11. package/dist/core.js +4 -3
  12. package/dist/design-editor.css +1 -1
  13. package/dist/design-editor.js +2114 -916
  14. package/dist/effects-DZEmfY7a.js +444 -0
  15. package/dist/effects.js +1 -1
  16. package/dist/generators-D1tFSZgG.js +2961 -0
  17. package/dist/generators.js +1 -1
  18. package/dist/{host-B4SRaN9h.js → host-CRsCCafL.js} +429 -370
  19. package/dist/{host-be1CWhN1.js → host-ZLJKCZ54.js} +137 -136
  20. package/dist/motion-BJ8xqUKI.js +3096 -0
  21. package/dist/motion.js +1 -1
  22. package/dist/previewScale-BMkeLc6w.js +26 -0
  23. package/dist/{rolls-Bg1XHuvJ.js → rolls-BGtqxVYq.js} +2621 -1522
  24. package/dist/{src-B5fQgAVE.js → src-BpTckTDZ.js} +1 -1
  25. package/dist/{labels-B5qkocWy.js → timelinePinned-BwYq1Msi.js} +321 -164
  26. package/dist/{useLayerEdit-ieOjHx6x.js → useLayerEdit-BFcZhiNX.js} +20992 -12580
  27. package/package.json +11 -9
  28. package/dist/RuleRow-BXkjpTyN.js +0 -650
  29. package/dist/TreePicker-DLmMl0aU.js +0 -68
  30. package/dist/core-CTI1YRJD.js +0 -12335
  31. package/dist/effectCategories-BcaQSD_V.js +0 -4216
  32. package/dist/effects-pCd8YTdQ.js +0 -469
  33. package/dist/generators-B8_StNAy.js +0 -2517
  34. package/dist/motion-DFnAar_2.js +0 -2263
@@ -1,9 +1,11 @@
1
- import { It as e, Rt as t } from "./rolls-Bg1XHuvJ.js";
2
- import { A as n, C as r, D as i, E as a, M as o, O as s, S as c, T as l, Z as u, _ as d, b as f, j as p, k as m, v as h, w as g, x as _, y as v } from "./useLayerEdit-ieOjHx6x.js";
3
- import { a as y, i as ee, o as te, r as b } from "./generators-B8_StNAy.js";
4
- import { $ as ne, A as x, B as re, C as ie, D as ae, E as oe, F as se, G as S, H as ce, I as le, J as ue, K as de, L as fe, N as C, O as pe, P as me, Q as he, R as ge, S as _e, T as ve, U as ye, V as be, W as w, X as T, Y as E, Z as xe, _ as Se, a as D, at as O, b as Ce, c as we, ct as k, d as A, et as Te, f as j, g as M, i as N, it as P, k as Ee, l as F, lt as De, m as Oe, n as ke, nt as Ae, o as je, ot as I, p as Me, q as Ne, r as L, rt as Pe, s as Fe, st as Ie, t as R, tt as Le, u as z, v as Re, w as B, x as V, y as H, z as ze } from "./OrbitControls-Cql8Rn2i.js";
1
+ import { Qt as e, en as t } from "./rolls-BGtqxVYq.js";
2
+ import { B as n, F as r, G as i, H as a, I as o, J as s, K as c, L as l, M as u, N as d, P as f, R as p, U as m, V as h, W as g, pt as _, q as v, z as y } from "./useLayerEdit-BFcZhiNX.js";
3
+ import { a as ee, i as te, o as b, s as ne } from "./generators-D1tFSZgG.js";
4
+ import { n as x, r as re } from "./previewScale-BMkeLc6w.js";
5
+ import { A as ie, At as ae, Bt as S, C as oe, D as se, Dt as C, E as ce, Et as w, F as le, Gt as T, Ht as E, Kt as ue, L as D, Lt as de, N as fe, Nt as pe, O, P as me, Pt as he, Rt as ge, S as k, T as A, Ut as _e, Vt as j, _t as M, a as N, at as ve, b as ye, bt as be, c as xe, d as P, et as F, f as I, g as Se, gt as L, h as Ce, ht as we, i as Te, it as Ee, jt as De, k as Oe, m as R, mt as ke, n as Ae, nt as je, o as Me, ot as Ne, p as z, pt as Pe, r as Fe, rt as Ie, st as Le, t as B, tt as Re, u as ze, v as V, vt as Be, x as Ve, yt as He, zt as Ue } from "./OrbitControls-DVpLgmKv.js";
6
+ import { n as We, t as Ge } from "./BufferGeometryUtils-Cc8LNd5v.js";
5
7
  //#region src/loops/gl/DriftEngine.js
6
- var Be = {
8
+ var Ke = {
7
9
  clouds: 0,
8
10
  cirrus: 1,
9
11
  aurora: 2,
@@ -13,24 +15,24 @@ var Be = {
13
15
  folds: 0,
14
16
  flag: 1,
15
17
  drape: 2
16
- }, Ve = "\n varying vec2 vUv;\n void main(){ vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", He = "\n precision highp float;\n varying vec2 vUv;\n uniform float uPhase, uAspect;\n uniform float uScale, uWarp, uEvolve, uGust, uContrast, uCoverage, uSoft, uSheen, uGrain;\n uniform float uAmp, uChop, uFoam, uFold, uDrape, uSway;\n uniform vec2 uFlow, uLight; // direction vectors (unit)\n uniform int uStyle;\n uniform vec3 uColors[5];\n uniform vec3 uBase;\n", Ue = "\n const float TAU = 6.28318530718;\n \n vec4 mod289(vec4 x){ return x - floor(x*(1.0/289.0))*289.0; }\n float mod289(float x){ return x - floor(x*(1.0/289.0))*289.0; }\n vec4 permute(vec4 x){ return mod289(((x*34.0)+1.0)*x); }\n float permute(float x){ return mod289(((x*34.0)+1.0)*x); }\n vec4 taylorInvSqrt(vec4 r){ return 1.79284291400159 - 0.85373472095314*r; }\n float taylorInvSqrt(float r){ return 1.79284291400159 - 0.85373472095314*r; }\n vec4 grad4(float j, vec4 ip){\n const vec4 ones = vec4(1.0, 1.0, 1.0, -1.0);\n vec4 p, s;\n p.xyz = floor( fract(vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0;\n p.w = 1.5 - dot(abs(p.xyz), ones.xyz);\n s = vec4(lessThan(p, vec4(0.0)));\n p.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www;\n return p;\n }\n float snoise(vec4 v){\n const vec4 C = vec4(0.138196601125011, 0.276393202250021, 0.414589803375032, -0.447213595499958);\n vec4 i = floor(v + dot(v, vec4(0.309016994374947451)) );\n vec4 x0 = v - i + dot(i, C.xxxx);\n vec4 i0;\n vec3 isX = step(x0.yzw, x0.xxx);\n vec3 isYZ = step(x0.zww, x0.yyz);\n i0.x = isX.x + isX.y + isX.z;\n i0.yzw = 1.0 - isX;\n i0.y += isYZ.x + isYZ.y;\n i0.zw += 1.0 - isYZ.xy;\n i0.z += isYZ.z;\n i0.w += 1.0 - isYZ.z;\n vec4 i3 = clamp(i0, 0.0, 1.0);\n vec4 i2 = clamp(i0 - 1.0, 0.0, 1.0);\n vec4 i1 = clamp(i0 - 2.0, 0.0, 1.0);\n vec4 x1 = x0 - i1 + C.xxxx;\n vec4 x2 = x0 - i2 + C.yyyy;\n vec4 x3 = x0 - i3 + C.zzzz;\n vec4 x4 = x0 + C.wwww;\n i = mod289(i);\n float j0 = permute(permute(permute(permute(i.w) + i.z) + i.y) + i.x);\n vec4 j1 = permute(permute(permute(permute(\n i.w + vec4(i1.w, i2.w, i3.w, 1.0))\n + i.z + vec4(i1.z, i2.z, i3.z, 1.0))\n + i.y + vec4(i1.y, i2.y, i3.y, 1.0))\n + i.x + vec4(i1.x, i2.x, i3.x, 1.0));\n vec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0);\n vec4 p0 = grad4(j0, ip);\n vec4 p1 = grad4(j1.x, ip);\n vec4 p2 = grad4(j1.y, ip);\n vec4 p3 = grad4(j1.z, ip);\n vec4 p4 = grad4(j1.w, ip);\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2,p2), dot(p3,p3)));\n p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; p3 *= norm.w;\n p4 *= taylorInvSqrt(dot(p4,p4));\n vec3 m0 = max(0.6 - vec3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.0);\n vec2 m1 = max(0.6 - vec2(dot(x3,x3), dot(x4,x4)), 0.0);\n m0 = m0*m0; m1 = m1*m1;\n return 49.0 * ( dot(m0*m0, vec3(dot(p0,x0), dot(p1,x1), dot(p2,x2)))\n + dot(m1*m1, vec2(dot(p3,x3), dot(p4,x4))) );\n }\n\n float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }\n // noise sampled on a circle in (z,w) → perfectly periodic in phase.\n float loopNoise(vec2 p, float ph, float r){\n float a = TAU * ph;\n return snoise(vec4(p, r * cos(a), r * sin(a)));\n }\n float lfbm(vec2 p, float ph, float r){\n float v = 0.0, amp = 0.5;\n for (int i = 0; i < 4; i++){ v += amp * loopNoise(p, ph, r); p *= 2.02; amp *= 0.5; r *= 1.7; }\n return v;\n }\n vec3 ramp(float t){\n float ft = clamp(t, 0.0, 1.0) * 4.0; // 5 stops → 4 segments\n int i = int(floor(ft));\n vec3 a = uColors[i];\n vec3 b = uColors[i + 1 < 5 ? i + 1 : 4];\n return mix(a, b, fract(ft));\n }\n // loop-safe grain: seeded off the same phase circle so it closes too.\n float grain(float ph){ return hash(vUv * vec2(1920.0, 1080.0) + (0.5 + 0.5*cos(TAU*ph)) * 13.0) - 0.5; }\n", We = {
17
- air: He + Ue + "\n void main(){\n vec2 p = vUv * 2.0 - 1.0; p.x *= uAspect;\n float ph = uPhase;\n vec2 gust = uFlow * sin(TAU * ph) * uGust; // directional sway, loop-safe\n\n float f; float sheen = 0.0;\n if (uStyle == 1) {\n vec2 ps = vec2(p.x * 0.28 + p.y * 0.22, p.y * 1.25) * uScale + gust; // cirrus\n f = lfbm(ps, ph, uEvolve);\n } else if (uStyle == 2) {\n vec2 sp = p * uScale + gust; // aurora\n float band = sp.x * 1.6 + 0.6 * lfbm(vec2(sp.y * 1.2, 0.0), ph, uEvolve);\n f = sin(band * 3.14159) * 0.5 + 0.4 * lfbm(sp, ph, uEvolve);\n } else {\n vec2 sp = p * 0.62 * uScale + gust; // clouds (domain-warped)\n vec2 q = vec2(lfbm(sp + vec2(0.0, 1.3), ph, uEvolve), lfbm(sp + vec2(5.2, 1.3), ph, uEvolve));\n vec2 r = vec2(lfbm(sp + uWarp * q + vec2(1.7, 9.2), ph, uEvolve),\n lfbm(sp + uWarp * q + vec2(8.3, 2.8), ph, uEvolve));\n f = lfbm(sp + uWarp * r, ph, uEvolve);\n sheen = pow(clamp(length(r) * 0.6, 0.0, 1.0), 3.0);\n }\n\n float d = clamp(f * 0.5 + 0.5, 0.0, 1.0);\n vec3 cloudCol = ramp(d);\n float edge = mix(0.04, 0.6, uSoft);\n float lo = 1.0 - uCoverage;\n float cov = smoothstep(lo, lo + edge, d);\n vec3 col = mix(uBase, cloudCol, cov);\n col += sheen * uSheen * 0.18 * cov;\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n",
18
- water: He + Ue + "\n // height field — directional swells (integer cycles/loop) + looped ripple.\n float waterH(vec2 p, float ph, float scl){\n vec2 d1 = normalize(uFlow + vec2(0.0001));\n vec2 d2 = normalize(vec2(-d1.y, d1.x) * 0.7 + d1 * 0.3);\n float k = uScale * scl;\n float a = uAmp;\n float v = 0.0;\n v += a * sin(dot(p, d1) * 2.2 * k + TAU * ph * 2.0);\n v += a * 0.55 * sin(dot(p, d2) * 3.6 * k + TAU * ph * 3.0);\n v += a * 0.30 * sin(dot(p, normalize(d1 + d2)) * 6.0 * k + TAU * ph * 5.0);\n v += uChop * 0.35 * lfbm(p * 3.0 * k, ph, uEvolve);\n return v;\n }\n void main(){\n vec2 p = vUv * 2.0 - 1.0; p.x *= uAspect;\n float ph = uPhase;\n\n if (uStyle == 2) { // caustics — ridged looped-noise veins over deep water\n float c = pow(1.0 - abs(lfbm(p * 2.4 * uScale, ph, uEvolve)), 6.0)\n + 0.6 * pow(1.0 - abs(lfbm(p * 4.8 * uScale + vec2(3.0), ph, uEvolve)), 8.0);\n c *= uChop + 0.5;\n vec3 col = ramp(clamp(0.3 + c * 0.7, 0.0, 1.0));\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n return;\n }\n\n float scl = (uStyle == 1) ? 2.2 : 1.0; // ripples = higher frequency\n float e = 0.0022;\n float hC = waterH(p, ph, scl);\n float hX = waterH(p + vec2(e, 0.0), ph, scl);\n float hY = waterH(p + vec2(0.0, e), ph, scl);\n vec3 n = normalize(vec3(hC - hX, hC - hY, e * 8.0));\n\n vec3 L = normalize(vec3(normalize(uLight + vec2(0.0001)) * 0.8, 0.6));\n vec3 V = vec3(0.0, 0.0, 1.0);\n float spec = pow(max(dot(reflect(-L, n), V), 0.0), 40.0) * uSheen;\n float fres = pow(1.0 - max(n.z, 0.0), 3.0);\n\n float t = clamp(0.5 + hC * 0.6, 0.0, 1.0);\n vec3 col = mix(ramp(t), uBase, fres * 0.6); // sky reflection at grazing\n col += spec;\n float slope = clamp(length(vec2(hC - hX, hC - hY)) * 120.0, 0.0, 1.0);\n float foam = smoothstep(1.0 - uFoam, 1.0, max(slope, t * 0.8));\n col = mix(col, vec3(0.95), foam * uFoam);\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n",
19
- cloth: He + Ue + "\n float clothH(vec2 p, float ph){\n vec2 fd = normalize(uFlow + vec2(0.0001)); // fold direction\n vec2 pd = vec2(-fd.y, fd.x);\n float k = uScale;\n float sway = uSway * sin(TAU * ph);\n float v = uFold * sin(dot(p, pd) * 5.0 * k + sway * 2.0 + 0.6 * lfbm(p * 1.5 * k, ph, uEvolve));\n if (uStyle == 1) v += uFold * 0.7 * sin(dot(p, fd) * 4.0 * k + TAU * ph * 2.0); // flag travel\n if (uStyle == 2) v += uDrape * sin(p.y * 3.0 * k + TAU * ph) * (0.5 + 0.5 * p.y); // drape sag\n v += uDrape * 0.30 * lfbm(p * 4.0 * k, ph, uEvolve); // wrinkle\n return v;\n }\n void main(){\n vec2 p = vUv * 2.0 - 1.0; p.x *= uAspect;\n float ph = uPhase;\n float e = 0.0025;\n float hC = clothH(p, ph);\n float hX = clothH(p + vec2(e, 0.0), ph);\n float hY = clothH(p + vec2(0.0, e), ph);\n vec3 n = normalize(vec3(hC - hX, hC - hY, e * 6.0));\n\n vec3 L = normalize(vec3(normalize(uLight + vec2(0.0001)) * 0.9, 0.5));\n float diff = 0.5 + 0.5 * dot(n, L);\n float sheen = pow(1.0 - abs(dot(n, L)), 3.0) * uSheen; // anisotropic satin rim\n vec3 col = ramp(clamp(diff, 0.0, 1.0));\n col += sheen * 0.5;\n col *= mix(1.0, 0.7, smoothstep(0.0, -uFold, hC)); // valley self-shadow\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n"
20
- }, U = (e) => {
18
+ }, qe = "\n varying vec2 vUv;\n void main(){ vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", Je = "\n precision highp float;\n varying vec2 vUv;\n uniform float uPhase, uAspect;\n uniform float uScale, uWarp, uEvolve, uGust, uContrast, uCoverage, uSoft, uSheen, uGrain;\n uniform float uAmp, uChop, uFoam, uFold, uDrape, uSway;\n uniform vec2 uFlow, uLight; // direction vectors (unit)\n uniform int uStyle;\n uniform vec3 uColors[5];\n uniform vec3 uBase;\n", Ye = "\n const float TAU = 6.28318530718;\n \n vec4 mod289(vec4 x){ return x - floor(x*(1.0/289.0))*289.0; }\n float mod289(float x){ return x - floor(x*(1.0/289.0))*289.0; }\n vec4 permute(vec4 x){ return mod289(((x*34.0)+1.0)*x); }\n float permute(float x){ return mod289(((x*34.0)+1.0)*x); }\n vec4 taylorInvSqrt(vec4 r){ return 1.79284291400159 - 0.85373472095314*r; }\n float taylorInvSqrt(float r){ return 1.79284291400159 - 0.85373472095314*r; }\n vec4 grad4(float j, vec4 ip){\n const vec4 ones = vec4(1.0, 1.0, 1.0, -1.0);\n vec4 p, s;\n p.xyz = floor( fract(vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0;\n p.w = 1.5 - dot(abs(p.xyz), ones.xyz);\n s = vec4(lessThan(p, vec4(0.0)));\n p.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www;\n return p;\n }\n float snoise(vec4 v){\n const vec4 C = vec4(0.138196601125011, 0.276393202250021, 0.414589803375032, -0.447213595499958);\n vec4 i = floor(v + dot(v, vec4(0.309016994374947451)) );\n vec4 x0 = v - i + dot(i, C.xxxx);\n vec4 i0;\n vec3 isX = step(x0.yzw, x0.xxx);\n vec3 isYZ = step(x0.zww, x0.yyz);\n i0.x = isX.x + isX.y + isX.z;\n i0.yzw = 1.0 - isX;\n i0.y += isYZ.x + isYZ.y;\n i0.zw += 1.0 - isYZ.xy;\n i0.z += isYZ.z;\n i0.w += 1.0 - isYZ.z;\n vec4 i3 = clamp(i0, 0.0, 1.0);\n vec4 i2 = clamp(i0 - 1.0, 0.0, 1.0);\n vec4 i1 = clamp(i0 - 2.0, 0.0, 1.0);\n vec4 x1 = x0 - i1 + C.xxxx;\n vec4 x2 = x0 - i2 + C.yyyy;\n vec4 x3 = x0 - i3 + C.zzzz;\n vec4 x4 = x0 + C.wwww;\n i = mod289(i);\n float j0 = permute(permute(permute(permute(i.w) + i.z) + i.y) + i.x);\n vec4 j1 = permute(permute(permute(permute(\n i.w + vec4(i1.w, i2.w, i3.w, 1.0))\n + i.z + vec4(i1.z, i2.z, i3.z, 1.0))\n + i.y + vec4(i1.y, i2.y, i3.y, 1.0))\n + i.x + vec4(i1.x, i2.x, i3.x, 1.0));\n vec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0);\n vec4 p0 = grad4(j0, ip);\n vec4 p1 = grad4(j1.x, ip);\n vec4 p2 = grad4(j1.y, ip);\n vec4 p3 = grad4(j1.z, ip);\n vec4 p4 = grad4(j1.w, ip);\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2,p2), dot(p3,p3)));\n p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; p3 *= norm.w;\n p4 *= taylorInvSqrt(dot(p4,p4));\n vec3 m0 = max(0.6 - vec3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.0);\n vec2 m1 = max(0.6 - vec2(dot(x3,x3), dot(x4,x4)), 0.0);\n m0 = m0*m0; m1 = m1*m1;\n return 49.0 * ( dot(m0*m0, vec3(dot(p0,x0), dot(p1,x1), dot(p2,x2)))\n + dot(m1*m1, vec2(dot(p3,x3), dot(p4,x4))) );\n }\n\n float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }\n // noise sampled on a circle in (z,w) → perfectly periodic in phase.\n float loopNoise(vec2 p, float ph, float r){\n float a = TAU * ph;\n return snoise(vec4(p, r * cos(a), r * sin(a)));\n }\n float lfbm(vec2 p, float ph, float r){\n float v = 0.0, amp = 0.5;\n for (int i = 0; i < 4; i++){ v += amp * loopNoise(p, ph, r); p *= 2.02; amp *= 0.5; r *= 1.7; }\n return v;\n }\n vec3 ramp(float t){\n float ft = clamp(t, 0.0, 1.0) * 4.0; // 5 stops → 4 segments\n int i = int(floor(ft));\n vec3 a = uColors[i];\n vec3 b = uColors[i + 1 < 5 ? i + 1 : 4];\n return mix(a, b, fract(ft));\n }\n // loop-safe grain: seeded off the same phase circle so it closes too.\n float grain(float ph){ return hash(vUv * vec2(1920.0, 1080.0) + (0.5 + 0.5*cos(TAU*ph)) * 13.0) - 0.5; }\n", Xe = {
19
+ air: Je + Ye + "\n void main(){\n vec2 p = vUv * 2.0 - 1.0; p.x *= uAspect;\n float ph = uPhase;\n vec2 gust = uFlow * sin(TAU * ph) * uGust; // directional sway, loop-safe\n\n float f; float sheen = 0.0;\n if (uStyle == 1) {\n vec2 ps = vec2(p.x * 0.28 + p.y * 0.22, p.y * 1.25) * uScale + gust; // cirrus\n f = lfbm(ps, ph, uEvolve);\n } else if (uStyle == 2) {\n vec2 sp = p * uScale + gust; // aurora\n float band = sp.x * 1.6 + 0.6 * lfbm(vec2(sp.y * 1.2, 0.0), ph, uEvolve);\n f = sin(band * 3.14159) * 0.5 + 0.4 * lfbm(sp, ph, uEvolve);\n } else {\n vec2 sp = p * 0.62 * uScale + gust; // clouds (domain-warped)\n vec2 q = vec2(lfbm(sp + vec2(0.0, 1.3), ph, uEvolve), lfbm(sp + vec2(5.2, 1.3), ph, uEvolve));\n vec2 r = vec2(lfbm(sp + uWarp * q + vec2(1.7, 9.2), ph, uEvolve),\n lfbm(sp + uWarp * q + vec2(8.3, 2.8), ph, uEvolve));\n f = lfbm(sp + uWarp * r, ph, uEvolve);\n sheen = pow(clamp(length(r) * 0.6, 0.0, 1.0), 3.0);\n }\n\n float d = clamp(f * 0.5 + 0.5, 0.0, 1.0);\n vec3 cloudCol = ramp(d);\n float edge = mix(0.04, 0.6, uSoft);\n float lo = 1.0 - uCoverage;\n float cov = smoothstep(lo, lo + edge, d);\n vec3 col = mix(uBase, cloudCol, cov);\n col += sheen * uSheen * 0.18 * cov;\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n",
20
+ water: Je + Ye + "\n // height field — directional swells (integer cycles/loop) + looped ripple.\n float waterH(vec2 p, float ph, float scl){\n vec2 d1 = normalize(uFlow + vec2(0.0001));\n vec2 d2 = normalize(vec2(-d1.y, d1.x) * 0.7 + d1 * 0.3);\n float k = uScale * scl;\n float a = uAmp;\n float v = 0.0;\n v += a * sin(dot(p, d1) * 2.2 * k + TAU * ph * 2.0);\n v += a * 0.55 * sin(dot(p, d2) * 3.6 * k + TAU * ph * 3.0);\n v += a * 0.30 * sin(dot(p, normalize(d1 + d2)) * 6.0 * k + TAU * ph * 5.0);\n v += uChop * 0.35 * lfbm(p * 3.0 * k, ph, uEvolve);\n return v;\n }\n void main(){\n vec2 p = vUv * 2.0 - 1.0; p.x *= uAspect;\n float ph = uPhase;\n\n if (uStyle == 2) { // caustics — ridged looped-noise veins over deep water\n float c = pow(1.0 - abs(lfbm(p * 2.4 * uScale, ph, uEvolve)), 6.0)\n + 0.6 * pow(1.0 - abs(lfbm(p * 4.8 * uScale + vec2(3.0), ph, uEvolve)), 8.0);\n c *= uChop + 0.5;\n vec3 col = ramp(clamp(0.3 + c * 0.7, 0.0, 1.0));\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n return;\n }\n\n float scl = (uStyle == 1) ? 2.2 : 1.0; // ripples = higher frequency\n float e = 0.0022;\n float hC = waterH(p, ph, scl);\n float hX = waterH(p + vec2(e, 0.0), ph, scl);\n float hY = waterH(p + vec2(0.0, e), ph, scl);\n vec3 n = normalize(vec3(hC - hX, hC - hY, e * 8.0));\n\n vec3 L = normalize(vec3(normalize(uLight + vec2(0.0001)) * 0.8, 0.6));\n vec3 V = vec3(0.0, 0.0, 1.0);\n float spec = pow(max(dot(reflect(-L, n), V), 0.0), 40.0) * uSheen;\n float fres = pow(1.0 - max(n.z, 0.0), 3.0);\n\n float t = clamp(0.5 + hC * 0.6, 0.0, 1.0);\n vec3 col = mix(ramp(t), uBase, fres * 0.6); // sky reflection at grazing\n col += spec;\n float slope = clamp(length(vec2(hC - hX, hC - hY)) * 120.0, 0.0, 1.0);\n float foam = smoothstep(1.0 - uFoam, 1.0, max(slope, t * 0.8));\n col = mix(col, vec3(0.95), foam * uFoam);\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n",
21
+ cloth: Je + Ye + "\n float clothH(vec2 p, float ph){\n vec2 fd = normalize(uFlow + vec2(0.0001)); // fold direction\n vec2 pd = vec2(-fd.y, fd.x);\n float k = uScale;\n float sway = uSway * sin(TAU * ph);\n float v = uFold * sin(dot(p, pd) * 5.0 * k + sway * 2.0 + 0.6 * lfbm(p * 1.5 * k, ph, uEvolve));\n if (uStyle == 1) v += uFold * 0.7 * sin(dot(p, fd) * 4.0 * k + TAU * ph * 2.0); // flag travel\n if (uStyle == 2) v += uDrape * sin(p.y * 3.0 * k + TAU * ph) * (0.5 + 0.5 * p.y); // drape sag\n v += uDrape * 0.30 * lfbm(p * 4.0 * k, ph, uEvolve); // wrinkle\n return v;\n }\n void main(){\n vec2 p = vUv * 2.0 - 1.0; p.x *= uAspect;\n float ph = uPhase;\n float e = 0.0025;\n float hC = clothH(p, ph);\n float hX = clothH(p + vec2(e, 0.0), ph);\n float hY = clothH(p + vec2(0.0, e), ph);\n vec3 n = normalize(vec3(hC - hX, hC - hY, e * 6.0));\n\n vec3 L = normalize(vec3(normalize(uLight + vec2(0.0001)) * 0.9, 0.5));\n float diff = 0.5 + 0.5 * dot(n, L);\n float sheen = pow(1.0 - abs(dot(n, L)), 3.0) * uSheen; // anisotropic satin rim\n vec3 col = ramp(clamp(diff, 0.0, 1.0));\n col += sheen * 0.5;\n col *= mix(1.0, 0.7, smoothstep(0.0, -uFold, hC)); // valley self-shadow\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n"
22
+ }, H = (e) => {
21
23
  let t = parseInt(e.slice(1), 16);
22
- return new I((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
23
- }, Ge = class {
24
+ return new E((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
25
+ }, Ze = class {
24
26
  constructor(e = "air") {
25
27
  this.family = e, this.renderer = null, this.time = 0, this.period = 8, this.playing = !0, this.speed = 1;
26
28
  }
27
29
  init(e) {
28
- this.renderer = new D({
30
+ this.renderer = new N({
29
31
  canvas: e,
30
32
  antialias: !0,
31
33
  preserveDrawingBuffer: !0
32
- }), this.scene = new E(), this.cam = new j();
33
- let t = p[this.family][0];
34
+ }), this.scene = new w(), this.cam = new R();
35
+ let t = v[this.family][0];
34
36
  this.uniforms = {
35
37
  uPhase: { value: 0 },
36
38
  uAspect: { value: 1 },
@@ -49,19 +51,19 @@ var Be = {
49
51
  uFold: { value: .7 },
50
52
  uDrape: { value: .5 },
51
53
  uSway: { value: .5 },
52
- uFlow: { value: new O(1, 0) },
53
- uLight: { value: new O(.7, .7) },
54
+ uFlow: { value: new j(1, 0) },
55
+ uLight: { value: new j(.7, .7) },
54
56
  uStyle: { value: 0 },
55
- uColors: { value: t.cols.map(U) },
56
- uBase: { value: U(t.base) }
57
- }, this.mat = new T({
58
- vertexShader: Ve,
59
- fragmentShader: We[this.family],
57
+ uColors: { value: t.cols.map(H) },
58
+ uBase: { value: H(t.base) }
59
+ }, this.mat = new C({
60
+ vertexShader: qe,
61
+ fragmentShader: Xe[this.family],
60
62
  uniforms: this.uniforms
61
- }), this.geo = new S(2, 2), this.scene.add(new C(this.geo, this.mat));
63
+ }), this.geo = new M(2, 2), this.scene.add(new F(this.geo, this.mat));
62
64
  }
63
65
  resize(e, t) {
64
- this.renderer && (this.renderer.setSize(e, t, !1), this.uniforms.uAspect.value = e / t);
66
+ this.renderer && (this.renderer.setPixelRatio(re()), this.renderer.setSize(e, t, !1), this.uniforms.uAspect.value = e / t);
65
67
  }
66
68
  setPointer(e) {
67
69
  if (!this.uniforms || !e) return;
@@ -79,9 +81,9 @@ var Be = {
79
81
  let n = e.light * Math.PI / 180;
80
82
  t.uLight.value.set(Math.cos(n), Math.sin(n));
81
83
  }
82
- if (e.period != null && (this.period = e.period), e.speed != null && (this.speed = e.speed), e.style != null && (t.uStyle.value = Be[e.style] ?? 0), e.palette != null) {
83
- let n = o(this.family, e.palette);
84
- t.uColors.value = n.cols.map(U), t.uBase.value = U(n.base);
84
+ if (e.period != null && (this.period = e.period), e.speed != null && (this.speed = e.speed), e.style != null && (t.uStyle.value = Ke[e.style] ?? 0), e.palette != null) {
85
+ let n = s(this.family, e.palette);
86
+ t.uColors.value = n.cols.map(H), t.uBase.value = H(n.base);
85
87
  }
86
88
  }
87
89
  setPlaying(e) {
@@ -116,19 +118,19 @@ var Be = {
116
118
  destroy() {
117
119
  this.mat?.dispose(), this.geo?.dispose(), this.renderer &&= (this.renderer.dispose(), null);
118
120
  }
119
- }, Ke = "\n varying vec2 vUv;\n void main(){ vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", qe = "\n precision highp float;\n varying vec2 vUv;\n uniform float uTime, uAspect, uSize, uSpread, uIrid, uHue, uSheen, uGloss;\n uniform float uRelief, uWarp, uGrain, uSpectral, uAngle, uFreq;\n uniform float uWinds, uPitch, uPetals, uSpin, uMouth;\n uniform int uCat, uType, uCount;\n uniform vec3 uBg;\n uniform vec3 uColors[5];\n\n float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1,311.7)))*43758.5453); }\n float noise(vec2 p){\n vec2 i=floor(p), f=fract(p); vec2 u=f*f*(3.0-2.0*f);\n return mix(mix(hash(i),hash(i+vec2(1.0,0.0)),u.x),\n mix(hash(i+vec2(0.0,1.0)),hash(i+vec2(1.0,1.0)),u.x), u.y);\n }\n float fbm(vec2 p){ float v=0.0,a=0.5; for(int i=0;i<4;i++){ v+=a*noise(p); p*=2.0; a*=0.5; } return v; }\n\n vec3 spectral(float t){\n t = fract(t);\n return 0.5 + 0.5*cos(6.28318*(t + vec3(0.0, 0.33, 0.67)));\n }\n vec3 ramp(float t){\n t = fract(t) * 4.0;\n int i = int(floor(t));\n vec3 a = uColors[i];\n vec3 b = uColors[i + 1 < 5 ? i + 1 : 4];\n return mix(a, b, fract(t));\n }\n vec3 tint(float ci){ return mix(ramp(fract(ci)), spectral(ci), uSpectral); }\n vec3 poleColor(int i){\n int idx = i < 5 ? i : 4;\n return mix(uColors[idx], spectral(uHue + float(i) * 0.18), uSpectral);\n }\n\n // Shared surface lighting: soft key light + broad glossy specular + rim lift.\n vec3 applyLight(vec3 col, vec3 n){\n vec3 viewDir = vec3(0.0, 0.0, 1.0);\n vec3 L = normalize(vec3(0.35, 0.55, 0.85));\n vec3 H = normalize(L + viewDir);\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), 2.4);\n col *= 0.58 + 0.42 * max(dot(n, L), 0.0);\n col += pow(max(dot(n, H), 0.0), uGloss) * uSheen;\n col += col * fres * 0.35;\n return col;\n }\n\n vec2 blobPos(int i){\n float fi = float(i);\n return vec2(sin(uTime*0.30 + fi*2.10)*uSpread,\n cos(uTime*0.26 + fi*1.70)*uSpread*0.82);\n }\n float field(vec2 q){\n float s = 0.0;\n for(int i=0;i<6;i++){\n if(i>=uCount) break;\n vec2 d = q - blobPos(i);\n s += (uSize*uSize) / (dot(d,d) + 0.0009);\n }\n return s;\n }\n float heightOf(float v){ return smoothstep(0.65, 3.2, v); }\n\n vec4 blobLayer(vec2 q){\n float e = 0.014;\n float h = heightOf(field(q));\n float hx = heightOf(field(q + vec2(e, 0.0)));\n float hy = heightOf(field(q + vec2(0.0, e)));\n vec2 g = vec2(hx - h, hy - h) / e;\n vec3 n = normalize(vec3(-g * uRelief, 1.0));\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), 2.4);\n float ci = uHue + uIrid * (fres * 1.25 + (n.x * 0.5 + 0.5) * 0.55 + h * 0.45) + uTime * 0.018;\n return vec4(applyLight(tint(ci), n), smoothstep(0.015, 0.22, h));\n }\n\n vec3 coreGlow(vec2 q){\n float d = length(q);\n float m = smoothstep(uMouth * 1.25, 0.0, d);\n vec3 n = normalize(vec3(-q * 1.6, 1.0));\n float ci = uHue + uIrid * ((q.x * 0.5 + 0.5) * 0.6 + d * 0.6) + uTime * 0.05;\n return applyLight(tint(ci), n) * m;\n }\n\n vec3 spiralLayer(vec2 c){\n float r = length(c) + 1e-4;\n float ang = atan(c.y, c.x);\n float scallop = 0.07 * sin(ang * uPetals + uTime * 0.1);\n float sp = ang * (uWinds * 0.159155) + log(r) * uPitch + scallop - uTime * 0.15 * uSpin;\n float cell = fract(sp);\n float fid = floor(sp);\n float bump = sin(cell * 3.14159);\n float seam = smoothstep(0.0, 0.10, cell) * smoothstep(1.0, 0.90, cell);\n vec2 gdir = (uWinds * 0.159155) * vec2(-c.y, c.x) / (r * r) + uPitch * c / (r * r);\n float slope = cos(cell * 3.14159) * 3.14159;\n vec3 n = normalize(vec3(-gdir * slope * uRelief * 0.05, 1.0));\n float ci = uHue + uIrid * 0.5 * (fid * 0.10 + (n.x * 0.5 + 0.5) * 0.5);\n vec3 plate = applyLight(tint(ci), n) * (0.35 + 0.65 * bump);\n plate = mix(uBg, plate, seam);\n float mouth = smoothstep(0.0, uMouth, r);\n return mix(uBg, plate, mouth) + coreGlow(c) * (1.0 - mouth * 0.6);\n }\n\n // ── Field — flat colour gradients ──\n vec3 fieldCol(vec2 q, vec2 p){\n float s;\n vec2 dir = vec2(cos(uAngle), sin(uAngle));\n if (uType == 0) s = clamp(dot(q, dir) * 0.6 + 0.5, 0.0, 1.0); // linear\n else if (uType == 1) { float x = dot(q, dir) * uFreq - uTime * 0.1 * uSpin; s = abs(fract(x) * 2.0 - 1.0); } // stripe\n else if (uType == 2) s = clamp(length(q) * uFreq * 0.6, 0.0, 1.0); // radial\n else s = fract(atan(q.y, q.x) * 0.159155 + 0.5 + uAngle * 0.159155 - uTime * 0.05 * uSpin); // conic\n vec3 col = tint(uHue + s * uIrid);\n col *= mix(1.0, smoothstep(1.75, 0.1, length(p)), 0.22); // soft vignette\n return col;\n }\n\n // ── Pole — influence fields ──\n vec3 poleCol(vec2 q){\n if (uType == 0) { // monopole\n vec2 src = vec2(sin(uTime * 0.2) * uSpread, cos(uTime * 0.17) * uSpread);\n float d = length(q - src);\n float infl = 1.0 / (1.0 + d * d * uFreq * 1.5);\n return tint(uHue + (1.0 - infl) * uIrid) + infl * infl * uSheen * 0.4;\n } else if (uType == 1) { // multipole (inverse-distance blend)\n vec3 acc = vec3(0.0); float wsum = 0.0;\n for (int i = 0; i < 5; i++) {\n if (i >= uCount) break;\n vec2 pp = blobPos(i);\n float d = distance(q, pp);\n float w = 1.0 / (d * d + 0.02);\n acc += poleColor(i) * w; wsum += w;\n }\n vec3 col = acc / max(wsum, 1e-4);\n float sh = pow(max(0.0, 0.5 + 0.5 * sin((q.x + q.y) * 3.1416 - uTime * 0.2)), 3.0);\n return col + sh * uSheen * 0.2;\n } else if (uType == 2) { // bilinear mesh (4 palette corners)\n vec2 g = clamp(q * 0.5 + 0.5, 0.0, 1.0);\n return mix(mix(poleColor(0), poleColor(1), g.x), mix(poleColor(2), poleColor(3), g.x), g.y);\n } else { // aurora — domain-warped fbm\n vec2 sp = q * 0.7;\n vec2 a = vec2(fbm(sp + vec2(0.0, uTime * 0.08)), fbm(sp + vec2(5.2, 1.3) - uTime * 0.08));\n vec2 b = vec2(fbm(sp + 1.6 * a + uTime * 0.06), fbm(sp + 1.6 * a + vec2(8.3, 2.8) - uTime * 0.06));\n float f = fbm(sp + 2.2 * b);\n return tint(uHue + (f * 0.5 + 0.5) * uIrid);\n }\n }\n\n // ── Volume — glossy 3D-reading forms ──\n vec3 volumeCol(vec2 q, vec2 p){\n if (uType == 0) { vec4 bl = blobLayer(q); return mix(uBg, bl.rgb, bl.a); }\n if (uType == 1) return spiralLayer(q);\n if (uType == 2) { // dome — glossy iridescent orb\n float R = uSize * 1.6;\n float rr = length(q) / R;\n vec3 col = uBg;\n if (rr < 1.0) {\n float h = sqrt(max(0.0, 1.0 - rr * rr));\n vec3 n = normalize(vec3(q / R, h));\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), 2.4);\n float ci = uHue + uIrid * (fres * 1.1 + (n.x * 0.5 + 0.5) * 0.5 + h * 0.4) + uTime * 0.05;\n col = applyLight(tint(ci), n);\n }\n return mix(uBg, col, smoothstep(1.02, 0.96, rr));\n }\n // ripple — concentric glossy ridges\n float e = 0.01;\n float k = uFreq * 3.0; float ph = uTime * uSpin * 1.5;\n float hC = 0.5 + 0.5 * sin(length(q) * k - ph);\n float hX = 0.5 + 0.5 * sin(length(q + vec2(e, 0.0)) * k - ph);\n float hY = 0.5 + 0.5 * sin(length(q + vec2(0.0, e)) * k - ph);\n vec2 gg = vec2(hX - hC, hY - hC) / e;\n vec3 n = normalize(vec3(-gg * uRelief * 0.15, 1.0));\n float ci = uHue + uIrid * (length(q) * 0.5 + hC * 0.4) + uTime * 0.04;\n vec3 col = applyLight(tint(ci), n);\n return col * mix(1.0, smoothstep(1.75, 0.1, length(p)), 0.3);\n }\n\n void main(){\n vec2 p = vUv * 2.0 - 1.0;\n p.x *= uAspect;\n vec2 wv = vec2(fbm(p*1.4 + uTime*0.05), fbm(p*1.4 + 7.3 - uTime*0.05));\n vec2 q = p + (wv - 0.5) * uWarp;\n\n vec3 col;\n if (uCat == 0) col = fieldCol(q, p);\n else if (uCat == 1) col = poleCol(q);\n else col = volumeCol(q, p);\n\n col += (hash(vUv * vec2(1920.0, 1080.0) + uTime) - 0.5) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n", W = (e) => {
121
+ }, Qe = "\n varying vec2 vUv;\n void main(){ vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", $e = "\n precision highp float;\n varying vec2 vUv;\n uniform float uTime, uAspect, uSize, uSpread, uIrid, uHue, uSheen, uGloss;\n uniform float uRelief, uWarp, uGrain, uSpectral, uAngle, uFreq;\n uniform float uWinds, uPitch, uPetals, uSpin, uMouth;\n uniform float uSquash, uDrop, uPosX, uSoft, uLines, uSides;\n uniform int uShape;\n uniform int uCat, uType, uCount;\n uniform vec3 uBg;\n uniform vec3 uColors[5];\n\n float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1,311.7)))*43758.5453); }\n float noise(vec2 p){\n vec2 i=floor(p), f=fract(p); vec2 u=f*f*(3.0-2.0*f);\n return mix(mix(hash(i),hash(i+vec2(1.0,0.0)),u.x),\n mix(hash(i+vec2(0.0,1.0)),hash(i+vec2(1.0,1.0)),u.x), u.y);\n }\n float fbm(vec2 p){ float v=0.0,a=0.5; for(int i=0;i<4;i++){ v+=a*noise(p); p*=2.0; a*=0.5; } return v; }\n\n vec3 spectral(float t){\n t = fract(t);\n return 0.5 + 0.5*cos(6.28318*(t + vec3(0.0, 0.33, 0.67)));\n }\n vec3 ramp(float t){\n t = fract(t) * 4.0;\n int i = int(floor(t));\n vec3 a = uColors[i];\n vec3 b = uColors[i + 1 < 5 ? i + 1 : 4];\n return mix(a, b, fract(t));\n }\n vec3 tint(float ci){ return mix(ramp(fract(ci)), spectral(ci), uSpectral); }\n vec3 poleColor(int i){\n int idx = i < 5 ? i : 4;\n return mix(uColors[idx], spectral(uHue + float(i) * 0.18), uSpectral);\n }\n\n // Shared surface lighting: soft key light + broad glossy specular + rim lift.\n vec3 applyLight(vec3 col, vec3 n){\n vec3 viewDir = vec3(0.0, 0.0, 1.0);\n vec3 L = normalize(vec3(0.35, 0.55, 0.85));\n vec3 H = normalize(L + viewDir);\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), 2.4);\n col *= 0.58 + 0.42 * max(dot(n, L), 0.0);\n col += pow(max(dot(n, H), 0.0), uGloss) * uSheen;\n col += col * fres * 0.35;\n return col;\n }\n\n vec2 blobPos(int i){\n float fi = float(i);\n return vec2(sin(uTime*0.30 + fi*2.10)*uSpread,\n cos(uTime*0.26 + fi*1.70)*uSpread*0.82);\n }\n float field(vec2 q){\n float s = 0.0;\n for(int i=0;i<6;i++){\n if(i>=uCount) break;\n vec2 d = q - blobPos(i);\n s += (uSize*uSize) / (dot(d,d) + 0.0009);\n }\n return s;\n }\n float heightOf(float v){ return smoothstep(0.65, 3.2, v); }\n\n vec4 blobLayer(vec2 q){\n float e = 0.014;\n float h = heightOf(field(q));\n float hx = heightOf(field(q + vec2(e, 0.0)));\n float hy = heightOf(field(q + vec2(0.0, e)));\n vec2 g = vec2(hx - h, hy - h) / e;\n vec3 n = normalize(vec3(-g * uRelief, 1.0));\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), 2.4);\n float ci = uHue + uIrid * (fres * 1.25 + (n.x * 0.5 + 0.5) * 0.55 + h * 0.45) + uTime * 0.018;\n return vec4(applyLight(tint(ci), n), smoothstep(0.015, 0.22, h));\n }\n\n vec3 coreGlow(vec2 q){\n float d = length(q);\n float m = smoothstep(uMouth * 1.25, 0.0, d);\n vec3 n = normalize(vec3(-q * 1.6, 1.0));\n float ci = uHue + uIrid * ((q.x * 0.5 + 0.5) * 0.6 + d * 0.6) + uTime * 0.05;\n return applyLight(tint(ci), n) * m;\n }\n\n vec3 spiralLayer(vec2 c){\n float r = length(c) + 1e-4;\n float ang = atan(c.y, c.x);\n float scallop = 0.07 * sin(ang * uPetals + uTime * 0.1);\n float sp = ang * (uWinds * 0.159155) + log(r) * uPitch + scallop - uTime * 0.15 * uSpin;\n float cell = fract(sp);\n float fid = floor(sp);\n float bump = sin(cell * 3.14159);\n float seam = smoothstep(0.0, 0.10, cell) * smoothstep(1.0, 0.90, cell);\n vec2 gdir = (uWinds * 0.159155) * vec2(-c.y, c.x) / (r * r) + uPitch * c / (r * r);\n float slope = cos(cell * 3.14159) * 3.14159;\n vec3 n = normalize(vec3(-gdir * slope * uRelief * 0.05, 1.0));\n float ci = uHue + uIrid * 0.5 * (fid * 0.10 + (n.x * 0.5 + 0.5) * 0.5);\n vec3 plate = applyLight(tint(ci), n) * (0.35 + 0.65 * bump);\n plate = mix(uBg, plate, seam);\n float mouth = smoothstep(0.0, uMouth, r);\n return mix(uBg, plate, mouth) + coreGlow(c) * (1.0 - mouth * 0.6);\n }\n\n // ── Field — flat colour gradients ──\n vec3 fieldCol(vec2 q, vec2 p){\n float s;\n vec2 dir = vec2(cos(uAngle), sin(uAngle));\n if (uType == 0) s = clamp(dot(q, dir) * 0.6 + 0.5, 0.0, 1.0); // linear\n else if (uType == 1) { float x = dot(q, dir) * uFreq - uTime * 0.1 * uSpin; s = abs(fract(x) * 2.0 - 1.0); } // stripe\n else if (uType == 2) s = clamp(length(q) * uFreq * 0.6, 0.0, 1.0); // radial\n else s = fract(atan(q.y, q.x) * 0.159155 + 0.5 + uAngle * 0.159155 - uTime * 0.05 * uSpin); // conic\n vec3 col = tint(uHue + s * uIrid);\n col *= mix(1.0, smoothstep(1.75, 0.1, length(p)), 0.22); // soft vignette\n return col;\n }\n\n // ── Pole — influence fields ──\n vec3 poleCol(vec2 q){\n if (uType == 0) { // monopole\n vec2 src = vec2(sin(uTime * 0.2) * uSpread, cos(uTime * 0.17) * uSpread);\n float d = length(q - src);\n float infl = 1.0 / (1.0 + d * d * uFreq * 1.5);\n return tint(uHue + (1.0 - infl) * uIrid) + infl * infl * uSheen * 0.4;\n } else if (uType == 1) { // multipole (inverse-distance blend)\n vec3 acc = vec3(0.0); float wsum = 0.0;\n for (int i = 0; i < 5; i++) {\n if (i >= uCount) break;\n vec2 pp = blobPos(i);\n float d = distance(q, pp);\n float w = 1.0 / (d * d + 0.02);\n acc += poleColor(i) * w; wsum += w;\n }\n vec3 col = acc / max(wsum, 1e-4);\n float sh = pow(max(0.0, 0.5 + 0.5 * sin((q.x + q.y) * 3.1416 - uTime * 0.2)), 3.0);\n return col + sh * uSheen * 0.2;\n } else if (uType == 2) { // bilinear mesh (4 palette corners)\n vec2 g = clamp(q * 0.5 + 0.5, 0.0, 1.0);\n return mix(mix(poleColor(0), poleColor(1), g.x), mix(poleColor(2), poleColor(3), g.x), g.y);\n } else { // aurora — domain-warped fbm\n vec2 sp = q * 0.7;\n vec2 a = vec2(fbm(sp + vec2(0.0, uTime * 0.08)), fbm(sp + vec2(5.2, 1.3) - uTime * 0.08));\n vec2 b = vec2(fbm(sp + 1.6 * a + uTime * 0.06), fbm(sp + 1.6 * a + vec2(8.3, 2.8) - uTime * 0.06));\n float f = fbm(sp + 2.2 * b);\n return tint(uHue + (f * 0.5 + 0.5) * uIrid);\n }\n }\n\n // ── Volume — glossy 3D-reading forms ──\n vec3 volumeCol(vec2 q, vec2 p){\n if (uType == 0) { vec4 bl = blobLayer(q); return mix(uBg, bl.rgb, bl.a); }\n if (uType == 1) return spiralLayer(q);\n if (uType == 2) { // dome — glossy iridescent orb\n float R = uSize * 1.6;\n float rr = length(q) / R;\n vec3 col = uBg;\n if (rr < 1.0) {\n float h = sqrt(max(0.0, 1.0 - rr * rr));\n vec3 n = normalize(vec3(q / R, h));\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), 2.4);\n float ci = uHue + uIrid * (fres * 1.1 + (n.x * 0.5 + 0.5) * 0.5 + h * 0.4) + uTime * 0.05;\n col = applyLight(tint(ci), n);\n }\n return mix(uBg, col, smoothstep(1.02, 0.96, rr));\n }\n // ripple — concentric glossy ridges\n float e = 0.01;\n float k = uFreq * 3.0; float ph = uTime * uSpin * 1.5;\n float hC = 0.5 + 0.5 * sin(length(q) * k - ph);\n float hX = 0.5 + 0.5 * sin(length(q + vec2(e, 0.0)) * k - ph);\n float hY = 0.5 + 0.5 * sin(length(q + vec2(0.0, e)) * k - ph);\n vec2 gg = vec2(hX - hC, hY - hC) / e;\n vec3 n = normalize(vec3(-gg * uRelief * 0.15, 1.0));\n float ci = uHue + uIrid * (length(q) * 0.5 + hC * 0.4) + uTime * 0.04;\n vec3 col = applyLight(tint(ci), n);\n return col * mix(1.0, smoothstep(1.75, 0.1, length(p)), 0.3);\n }\n\n // ── Tunnel — soft gradient rings in depth ──\n // Ring index i paints tint(uHue + i * 0.25 * uIrid); at irid 2 that steps\n // two palette stops per ring, so the rings alternate. One ring passes per\n // 4s at spin 1, so the 8s loop is seamless at whole-number spins.\n vec3 bands(float t){\n float i = floor(t);\n float k = smoothstep(1.0 - uSoft, 1.0, fract(t));\n return mix(tint(uHue + i * 0.25 * uIrid), tint(uHue + (i + 1.0) * 0.25 * uIrid), k);\n }\n // The ring's form = how distance from the centre is measured; its level sets are the rings.\n float shapeR(vec2 d){\n if (uShape == 1) return pow(pow(abs(d.x), 4.0) + pow(abs(d.y), 4.0), 0.25); // rounded square\n float a = atan(d.y, d.x) - 1.5708; // a vertex / point straight up\n // polygon — inscribed in the circle of the same size (vertex at r), so the forms read the same scale\n if (uShape == 2) { float s = 6.28318 / uSides; return length(d) * cos(mod(a, s) - s * 0.5) / cos(s * 0.5); }\n if (uShape == 3) return length(d) * (1.0 - 0.35 * cos(uSides * a)) / 0.65; // star, tips at r\n return length(d); // circle\n }\n vec3 tunnelCol(vec2 q){\n vec2 d = (q - vec2(uPosX, uDrop)) * vec2(1.0, uSquash);\n float r = shapeR(d) + 1e-3;\n float run = uTime * 0.25 * uSpin;\n vec3 far = tint(uHue + 0.75);\n if (uType == 0) { // tunnel — depth = 1/r, rings fly toward the camera\n vec3 col = bands(uSize / r * uFreq * 0.5 + run);\n return mix(far, col, smoothstep(0.05, 0.45 * uSize, r)); // vanishing point fades to light\n }\n if (uType == 1) { // halo — one breathing disc, inside and outside swap colour\n float ph = uTime * 0.785398 * uSpin;\n float e = r / (uSize * 0.6 * (1.0 + 0.12 * sin(ph)));\n float k = 0.5 + 0.5 * cos(ph);\n vec3 a = tint(uHue), b = tint(uHue + 0.5 * uIrid);\n vec3 col = mix(mix(a, b, k), mix(b, a, k), smoothstep(1.0 - uSoft, 1.0 + uSoft, e));\n float rim = exp(-pow((e - 1.0) / (uSoft * 0.5 + 0.02), 2.0));\n return col + rim * uSheen * 0.6 * far;\n }\n // horizon — a floor of bands rolling toward the viewer, sky above\n float below = uDrop - q.y;\n vec3 sky = tint(uHue + 0.75 - clamp(-below, 0.0, 1.0) * 0.5); // light at the line, deep overhead, never wraps\n if (below <= 0.0) return sky;\n vec3 floorCol = bands(uSize / (below * uSquash) * uFreq * 0.25 + run);\n return mix(far, floorCol, smoothstep(0.0, 0.6 * uSize + 0.1 * uSoft, below)); // haze at the line\n }\n\n void main(){\n vec2 p = vUv * 2.0 - 1.0;\n p.x *= uAspect;\n vec2 wv = vec2(fbm(p*1.4 + uTime*0.05), fbm(p*1.4 + 7.3 - uTime*0.05));\n vec2 q = p + (wv - 0.5) * uWarp;\n\n vec3 col;\n if (uCat == 0) col = fieldCol(q, p);\n else if (uCat == 1) col = poleCol(q);\n else if (uCat == 2) col = volumeCol(q, p);\n else col = tunnelCol(q);\n\n col *= 1.0 - uLines * (0.5 + 0.5 * sin(vUv.y * 2200.0)); // VHS scanlines\n\n col += (hash(vUv * vec2(1920.0, 1080.0) + uTime) - 0.5) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n", U = (e) => {
120
122
  let t = parseInt(e.slice(1), 16);
121
- return new I((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
122
- }, Je = class {
123
+ return new E((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
124
+ }, et = class {
123
125
  constructor() {
124
126
  this.renderer = null, this.time = 0, this.playing = !0, this.speed = 1;
125
127
  }
126
128
  init(e) {
127
- this.renderer = new D({
129
+ this.renderer = new N({
128
130
  canvas: e,
129
131
  antialias: !0,
130
132
  preserveDrawingBuffer: !0
131
- }), this.scene = new E(), this.cam = new j(), this.uniforms = {
133
+ }), this.scene = new w(), this.cam = new R(), this.uniforms = {
132
134
  uTime: { value: 0 },
133
135
  uAspect: { value: 1 },
134
136
  uCat: { value: 2 },
@@ -151,37 +153,44 @@ var Be = {
151
153
  uPetals: { value: 9 },
152
154
  uSpin: { value: 1 },
153
155
  uMouth: { value: .5 },
154
- uBg: { value: W("#000000") },
155
- uColors: { value: s[0].cols.map(W) }
156
- }, this.mat = new T({
157
- vertexShader: Ke,
158
- fragmentShader: qe,
156
+ uSquash: { value: 1.4 },
157
+ uDrop: { value: -.15 },
158
+ uPosX: { value: 0 },
159
+ uSoft: { value: .4 },
160
+ uLines: { value: 0 },
161
+ uShape: { value: 0 },
162
+ uSides: { value: 6 },
163
+ uBg: { value: U("#000000") },
164
+ uColors: { value: m[0].cols.map(U) }
165
+ }, this.mat = new C({
166
+ vertexShader: Qe,
167
+ fragmentShader: $e,
159
168
  uniforms: this.uniforms
160
- }), this.geo = new S(2, 2), this.scene.add(new C(this.geo, this.mat));
169
+ }), this.geo = new M(2, 2), this.scene.add(new F(this.geo, this.mat));
161
170
  }
162
171
  resize(e, t) {
163
- this.renderer && (this.renderer.setSize(e, t, !1), this.uniforms.uAspect.value = e / t);
172
+ this.renderer && (this.renderer.setPixelRatio(re()), this.renderer.setSize(e, t, !1), this.uniforms.uAspect.value = e / t);
164
173
  }
165
174
  setPointer(e) {
166
175
  if (!this.uniforms || !e) return;
167
176
  let t = this.uniforms;
168
- t.uHue.value = ((t.uHue.value + (e.x - .5) * .5) % 1 + 1) % 1, e.down && (t.uWarp.value = t.uWarp.value + .6);
177
+ t.uHue.value = ((t.uHue.value + (e.x - .5) * .125) % 1 + 1) % 1, e.down && (t.uWarp.value = t.uWarp.value + .6);
169
178
  }
170
179
  setParams(e) {
171
180
  if (!this.uniforms) return;
172
- let t = e.look ? i.find((t) => t.value === e.look) : null;
181
+ let t = e.look ? a.find((t) => t.value === e.look) : null;
173
182
  t?.p && (e = {
174
183
  ...e,
175
184
  ...t.p
176
185
  });
177
186
  let n = this.uniforms;
178
- if (e.cat != null && (n.uCat.value = Math.round(e.cat)), e.form != null && (n.uType.value = Math.round(e.form)), e.count != null && (n.uCount.value = Math.max(1, Math.min(6, Math.round(e.count)))), e.size != null && (n.uSize.value = e.size), e.spread != null && (n.uSpread.value = e.spread), e.irid != null && (n.uIrid.value = e.irid), e.hue != null && (n.uHue.value = e.hue), e.sheen != null && (n.uSheen.value = e.sheen), e.gloss != null && (n.uGloss.value = e.gloss), n.uRelief.value = e.relief ?? .9, e.warp != null && (n.uWarp.value = e.warp), e.grain != null && (n.uGrain.value = e.grain), e.spectral != null && (n.uSpectral.value = +!!e.spectral), e.angle != null && (n.uAngle.value = e.angle), n.uFreq.value = e.freq ?? 2, e.winds != null && (n.uWinds.value = e.winds), e.pitch != null && (n.uPitch.value = e.pitch), e.petals != null && (n.uPetals.value = e.petals), n.uSpin.value = e.spin ?? 1, e.mouth != null && (n.uMouth.value = e.mouth), e.speed != null && (this.speed = e.speed), e.palette != null) {
179
- let t = s.find((t) => t.value === e.palette) || s[0];
180
- n.uColors.value = t.cols.map(W);
187
+ if (e.cat != null && (n.uCat.value = Math.round(e.cat)), e.form != null && (n.uType.value = Math.round(e.form)), e.count != null && (n.uCount.value = Math.max(1, Math.min(6, Math.round(e.count)))), e.size != null && (n.uSize.value = e.size), e.spread != null && (n.uSpread.value = e.spread), e.irid != null && (n.uIrid.value = e.irid), e.hue != null && (n.uHue.value = e.hue), e.sheen != null && (n.uSheen.value = e.sheen), e.gloss != null && (n.uGloss.value = e.gloss), n.uRelief.value = e.relief ?? .9, e.warp != null && (n.uWarp.value = e.warp), e.grain != null && (n.uGrain.value = e.grain), e.spectral != null && (n.uSpectral.value = +!!e.spectral), e.angle != null && (n.uAngle.value = e.angle), n.uFreq.value = e.freq ?? 2, e.winds != null && (n.uWinds.value = e.winds), e.pitch != null && (n.uPitch.value = e.pitch), e.petals != null && (n.uPetals.value = e.petals), n.uSpin.value = e.spin ?? 1, e.mouth != null && (n.uMouth.value = e.mouth), n.uSquash.value = e.squash ?? 1.4, n.uDrop.value = e.drop ?? -.15, n.uPosX.value = e.posX ?? 0, n.uSoft.value = e.soft ?? .4, n.uLines.value = e.lines ?? 0, n.uShape.value = Math.max(0, g.indexOf(e.shape ?? "circle")), n.uSides.value = e.sides ?? 6, e.speed != null && (this.speed = e.speed), e.palette != null) {
188
+ let t = m.find((t) => t.value === e.palette) || m[0];
189
+ n.uColors.value = t.cols.map(U);
181
190
  }
182
191
  if (e.backdrop != null) {
183
- let t = a.find((t) => t.value === e.backdrop) || a[0];
184
- n.uBg.value = W(t.col);
192
+ let t = h.find((t) => t.value === e.backdrop) || h[0];
193
+ n.uBg.value = U(t.col);
185
194
  }
186
195
  }
187
196
  setPlaying(e) {
@@ -208,25 +217,25 @@ var Be = {
208
217
  destroy() {
209
218
  this.mat?.dispose(), this.geo?.dispose(), this.renderer &&= (this.renderer.dispose(), null);
210
219
  }
211
- }, G = 5, Ye = {
220
+ }, W = 5, tt = {
212
221
  teardrop: 0,
213
222
  pill: 1,
214
223
  dome: 2,
215
224
  super: 3,
216
225
  orb: 2
217
- }, Xe = "\n varying vec2 vUv;\n void main(){ vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", Ze = "\n precision highp float;\n varying vec2 vUv;\n uniform float uTime, uAspect, uCount;\n uniform float uHue, uIrid, uSheen, uGloss, uRim, uRimPow, uRimShift, uSSS;\n uniform float uBulge, uRelief, uMotion, uGrain, uSpectral, uEdge;\n uniform vec2 uDir, uBgFade;\n uniform vec3 uBg;\n uniform vec3 uColors[5];\n uniform float uType[5];\n uniform vec2 uPos[5];\n uniform vec2 uScale[5];\n uniform float uRot[5];\n uniform float uHueOff[5];\n\n float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1,311.7)))*43758.5453); }\n\n vec3 spectral(float t){\n t = fract(t);\n return 0.5 + 0.5*cos(6.28318*(t + vec3(0.0, 0.33, 0.67)));\n }\n vec3 ramp(float t){\n t = fract(t) * 4.0;\n int i = int(floor(t));\n vec3 a = uColors[i];\n vec3 b = uColors[i + 1 < 5 ? i + 1 : 4];\n return mix(a, b, fract(t));\n }\n vec3 tint(float ci){ return mix(ramp(fract(ci)), spectral(ci), uSpectral); }\n\n vec2 rot2(vec2 v, float a){ float c = cos(a), s = sin(a); return mat2(c, -s, s, c) * v; }\n\n // Signed-ish distance for each form (negative inside). q is form-local\n // (centred, unrotated, divided by the form's scale → \"radius 1\" forms).\n float formDist(float ty, vec2 q){\n if (ty < 0.5) { // teardrop — ellipse tapered toward +y\n float taper = mix(1.0, 0.36, clamp(q.y * 0.5 + 0.5, 0.0, 1.0));\n return length(vec2(q.x / taper, q.y)) - 1.0;\n } else if (ty < 1.5) { // pill — horizontal capsule\n vec2 d = q; d.x = max(abs(d.x) - 0.58, 0.0);\n return length(d) - 0.5;\n } else if (ty < 2.5) { // dome / orb — ellipse\n return length(q) - 1.0;\n }\n vec2 e = pow(abs(q), vec2(3.4)); // superellipse — soft-cornered lozenge\n return pow(e.x + e.y, 1.0/3.4) - 1.0;\n }\n\n // Inside a form (d<0) the surface bulges up; sqrt gives spherical edge falloff.\n float heightOf(float d){ float t = clamp(-d / uBulge, 0.0, 1.0); return sqrt(t * (2.0 - t)); }\n\n // Procedural matcap: hue swept across the surface normal (the broad gradient\n // that flows over the volume) + baked soft key light + glossy hotspot +\n // coloured fresnel rim + a touch of subsurface glow at thin edges.\n vec3 shade(vec3 n, float hueOff, float h){\n float ci = uHue + hueOff + uIrid * (dot(n.xy, uDir) * 0.5 + 0.5);\n vec3 base = tint(ci);\n vec3 L = normalize(vec3(-0.35, 0.55, 0.85));\n float key = 0.5 + 0.5 * dot(n, L);\n base *= mix(0.6, 1.18, key);\n vec3 H = normalize(L + vec3(0.0, 0.0, 1.0));\n base += pow(max(dot(n, H), 0.0), uGloss) * uSheen;\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), uRimPow);\n base += tint(ci + uRimShift) * fres * uRim;\n base += base * (1.0 - clamp(h, 0.0, 1.0)) * uSSS;\n return base;\n }\n\n void main(){\n vec2 p = vUv * 2.0 - 1.0;\n p.x *= uAspect;\n vec3 col = uBg;\n const float E = 0.012;\n\n for (int i = 0; i < 5; i++){\n if (float(i) >= uCount) break;\n vec2 pos = uPos[i] + uMotion * vec2(sin(uTime*0.40 + float(i)*1.7),\n cos(uTime*0.33 + float(i)*2.1)) * 0.05;\n float ty = uType[i];\n vec2 sc = uScale[i];\n float rt = uRot[i];\n\n vec2 q = rot2(p - pos, -rt) / sc;\n vec2 qx = rot2(p + vec2(E, 0.0) - pos, -rt) / sc;\n vec2 qy = rot2(p + vec2(0.0, E) - pos, -rt) / sc;\n float d = formDist(ty, q);\n float h = heightOf(d);\n vec2 g = vec2(heightOf(formDist(ty, qx)) - h,\n heightOf(formDist(ty, qy)) - h) / E;\n vec3 n = normalize(vec3(-g * uRelief, 1.0));\n\n float a = smoothstep(uEdge, -uEdge, d);\n col = mix(col, shade(n, uHueOff[i], h), a);\n }\n\n col *= mix(1.0, smoothstep(uBgFade.y, uBgFade.x, length(p)), 0.18); // soft vignette\n col += (hash(vUv * vec2(1920.0, 1080.0) + uTime) - 0.5) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n", Qe = (e) => {
226
+ }, nt = "\n varying vec2 vUv;\n void main(){ vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", rt = "\n precision highp float;\n varying vec2 vUv;\n uniform float uTime, uAspect, uCount;\n uniform float uHue, uIrid, uSheen, uGloss, uRim, uRimPow, uRimShift, uSSS;\n uniform float uBulge, uRelief, uMotion, uGrain, uSpectral, uEdge;\n uniform vec2 uDir, uBgFade;\n uniform vec3 uBg;\n uniform vec3 uColors[5];\n uniform float uType[5];\n uniform vec2 uPos[5];\n uniform vec2 uScale[5];\n uniform float uRot[5];\n uniform float uHueOff[5];\n\n float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1,311.7)))*43758.5453); }\n\n vec3 spectral(float t){\n t = fract(t);\n return 0.5 + 0.5*cos(6.28318*(t + vec3(0.0, 0.33, 0.67)));\n }\n vec3 ramp(float t){\n t = fract(t) * 4.0;\n int i = int(floor(t));\n vec3 a = uColors[i];\n vec3 b = uColors[i + 1 < 5 ? i + 1 : 4];\n return mix(a, b, fract(t));\n }\n vec3 tint(float ci){ return mix(ramp(fract(ci)), spectral(ci), uSpectral); }\n\n vec2 rot2(vec2 v, float a){ float c = cos(a), s = sin(a); return mat2(c, -s, s, c) * v; }\n\n // Signed-ish distance for each form (negative inside). q is form-local\n // (centred, unrotated, divided by the form's scale → \"radius 1\" forms).\n float formDist(float ty, vec2 q){\n if (ty < 0.5) { // teardrop — ellipse tapered toward +y\n float taper = mix(1.0, 0.36, clamp(q.y * 0.5 + 0.5, 0.0, 1.0));\n return length(vec2(q.x / taper, q.y)) - 1.0;\n } else if (ty < 1.5) { // pill — horizontal capsule\n vec2 d = q; d.x = max(abs(d.x) - 0.58, 0.0);\n return length(d) - 0.5;\n } else if (ty < 2.5) { // dome / orb — ellipse\n return length(q) - 1.0;\n }\n vec2 e = pow(abs(q), vec2(3.4)); // superellipse — soft-cornered lozenge\n return pow(e.x + e.y, 1.0/3.4) - 1.0;\n }\n\n // Inside a form (d<0) the surface bulges up; sqrt gives spherical edge falloff.\n float heightOf(float d){ float t = clamp(-d / uBulge, 0.0, 1.0); return sqrt(t * (2.0 - t)); }\n\n // Procedural matcap: hue swept across the surface normal (the broad gradient\n // that flows over the volume) + baked soft key light + glossy hotspot +\n // coloured fresnel rim + a touch of subsurface glow at thin edges.\n vec3 shade(vec3 n, float hueOff, float h){\n float ci = uHue + hueOff + uIrid * (dot(n.xy, uDir) * 0.5 + 0.5);\n vec3 base = tint(ci);\n vec3 L = normalize(vec3(-0.35, 0.55, 0.85));\n float key = 0.5 + 0.5 * dot(n, L);\n base *= mix(0.6, 1.18, key);\n vec3 H = normalize(L + vec3(0.0, 0.0, 1.0));\n base += pow(max(dot(n, H), 0.0), uGloss) * uSheen;\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), uRimPow);\n base += tint(ci + uRimShift) * fres * uRim;\n base += base * (1.0 - clamp(h, 0.0, 1.0)) * uSSS;\n return base;\n }\n\n void main(){\n vec2 p = vUv * 2.0 - 1.0;\n p.x *= uAspect;\n vec3 col = uBg;\n const float E = 0.012;\n\n for (int i = 0; i < 5; i++){\n if (float(i) >= uCount) break;\n vec2 pos = uPos[i] + uMotion * vec2(sin(uTime*0.40 + float(i)*1.7),\n cos(uTime*0.33 + float(i)*2.1)) * 0.05;\n float ty = uType[i];\n vec2 sc = uScale[i];\n float rt = uRot[i];\n\n vec2 q = rot2(p - pos, -rt) / sc;\n vec2 qx = rot2(p + vec2(E, 0.0) - pos, -rt) / sc;\n vec2 qy = rot2(p + vec2(0.0, E) - pos, -rt) / sc;\n float d = formDist(ty, q);\n float h = heightOf(d);\n vec2 g = vec2(heightOf(formDist(ty, qx)) - h,\n heightOf(formDist(ty, qy)) - h) / E;\n vec3 n = normalize(vec3(-g * uRelief, 1.0));\n\n float a = smoothstep(uEdge, -uEdge, d);\n col = mix(col, shade(n, uHueOff[i], h), a);\n }\n\n col *= mix(1.0, smoothstep(uBgFade.y, uBgFade.x, length(p)), 0.18); // soft vignette\n col += (hash(vUv * vec2(1920.0, 1080.0) + uTime) - 0.5) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n", G = (e) => {
218
227
  let t = parseInt(e.slice(1), 16);
219
- return new I((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
220
- }, $e = class {
228
+ return new E((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
229
+ }, it = class {
221
230
  constructor() {
222
231
  this.renderer = null, this.time = 0, this.playing = !0, this.speed = 1;
223
232
  }
224
233
  init(e) {
225
- this.renderer = new D({
234
+ this.renderer = new N({
226
235
  canvas: e,
227
236
  antialias: !0,
228
237
  preserveDrawingBuffer: !0
229
- }), this.scene = new E(), this.cam = new j(), this.uniforms = {
238
+ }), this.scene = new w(), this.cam = new R(), this.uniforms = {
230
239
  uTime: { value: 0 },
231
240
  uAspect: { value: 1 },
232
241
  uCount: { value: 3 },
@@ -244,31 +253,31 @@ var Be = {
244
253
  uGrain: { value: .02 },
245
254
  uSpectral: { value: 0 },
246
255
  uEdge: { value: .02 },
247
- uDir: { value: new O(.3, .95) },
248
- uBgFade: { value: new O(.2, 1.9) },
249
- uBg: { value: Qe("#000000") },
250
- uColors: { value: s[0].cols.map(Qe) },
251
- uType: { value: Array(G).fill(2) },
252
- uPos: { value: Array.from({ length: G }, () => new O()) },
253
- uScale: { value: Array.from({ length: G }, () => new O(.6, .6)) },
254
- uRot: { value: Array(G).fill(0) },
255
- uHueOff: { value: Array(G).fill(0) }
256
- }, this.mat = new T({
257
- vertexShader: Xe,
258
- fragmentShader: Ze,
256
+ uDir: { value: new j(.3, .95) },
257
+ uBgFade: { value: new j(.2, 1.9) },
258
+ uBg: { value: G("#000000") },
259
+ uColors: { value: m[0].cols.map(G) },
260
+ uType: { value: Array(W).fill(2) },
261
+ uPos: { value: Array.from({ length: W }, () => new j()) },
262
+ uScale: { value: Array.from({ length: W }, () => new j(.6, .6)) },
263
+ uRot: { value: Array(W).fill(0) },
264
+ uHueOff: { value: Array(W).fill(0) }
265
+ }, this.mat = new C({
266
+ vertexShader: nt,
267
+ fragmentShader: rt,
259
268
  uniforms: this.uniforms
260
- }), this.geo = new S(2, 2), this.scene.add(new C(this.geo, this.mat));
269
+ }), this.geo = new M(2, 2), this.scene.add(new F(this.geo, this.mat));
261
270
  }
262
271
  resize(e, t) {
263
- this.renderer && (this.renderer.setSize(e, t, !1), this.uniforms.uAspect.value = e / t);
272
+ this.renderer && (this.renderer.setPixelRatio(re()), this.renderer.setSize(e, t, !1), this.uniforms.uAspect.value = e / t);
264
273
  }
265
274
  setForms(e) {
266
275
  if (!this.uniforms || !e) return;
267
- let t = this.uniforms, n = e.slice(0, G);
276
+ let t = this.uniforms, n = e.slice(0, W);
268
277
  t.uCount.value = n.length || 1;
269
- for (let e = 0; e < G; e++) {
278
+ for (let e = 0; e < W; e++) {
270
279
  let r = n[e] || n[n.length - 1] || {};
271
- t.uType.value[e] = Ye[r.t] ?? 2, t.uPos.value[e].set(r.x ?? 0, r.y ?? 0);
280
+ t.uType.value[e] = tt[r.t] ?? 2, t.uPos.value[e].set(r.x ?? 0, r.y ?? 0);
272
281
  let i = r.sx ?? .6;
273
282
  t.uScale.value[e].set(i, r.sy ?? i), t.uRot.value[e] = (r.rot ?? 0) * Math.PI / 180, t.uHueOff.value[e] = r.hue ?? 0;
274
283
  }
@@ -300,12 +309,12 @@ var Be = {
300
309
  t.uDir.value.set(Math.sin(n), Math.cos(n));
301
310
  }
302
311
  if (e.speed != null && (this.speed = e.speed), e.forms && this.setForms(e.forms), e.palette != null) {
303
- let n = s.find((t) => t.value === e.palette) || s[0];
304
- t.uColors.value = n.cols.map(Qe);
312
+ let n = m.find((t) => t.value === e.palette) || m[0];
313
+ t.uColors.value = n.cols.map(G);
305
314
  }
306
315
  if (e.backdrop != null) {
307
- let n = a.find((t) => t.value === e.backdrop) || a[0];
308
- t.uBg.value = Qe(n.col);
316
+ let n = h.find((t) => t.value === e.backdrop) || h[0];
317
+ t.uBg.value = G(n.col);
309
318
  }
310
319
  }
311
320
  setPlaying(e) {
@@ -332,7 +341,7 @@ var Be = {
332
341
  destroy() {
333
342
  this.mat?.dispose(), this.geo?.dispose(), this.renderer &&= (this.renderer.dispose(), null);
334
343
  }
335
- }, K = 5, et = {
344
+ }, K = 5, at = {
336
345
  sphere: 0,
337
346
  orb: 0,
338
347
  capsule: 1,
@@ -340,19 +349,19 @@ var Be = {
340
349
  teardrop: 2,
341
350
  lozenge: 3,
342
351
  super: 3
343
- }, tt = "varying vec2 vUv; void main(){ vUv = uv; gl_Position = vec4(position.xy,0.,1.); }", nt = "\nprecision highp float;\nvarying vec2 vUv;\n\nuniform float uTime, uAspect, uCount;\nuniform float uTheta, uPhi, uDist;\nuniform float uHue, uIrid, uSheen, uGloss;\nuniform float uRim, uRimPow, uRimShift, uSSS;\nuniform float uMotion, uGrain, uSpectral, uMetaball;\nuniform vec2 uDir;\nuniform vec3 uBg;\nuniform vec3 uColors[5];\nuniform float uType[5];\nuniform vec3 uPos3[5];\nuniform vec3 uScale3[5];\nuniform float uRot3[5];\nuniform float uHueOff[5];\n\nfloat hash(vec2 p){ return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453); }\n\nvec3 spectral(float t){\n t = fract(t);\n return 0.5 + 0.5*cos(6.28318*(t+vec3(0.,0.333,0.667)));\n}\nvec3 ramp(float t){\n t = fract(t)*4.;\n int i = int(floor(t));\n return mix(uColors[i], uColors[i+1<5?i+1:4], fract(t));\n}\nvec3 tint(float ci){ return mix(ramp(fract(ci)), spectral(ci), uSpectral); }\n\nvec3 rotY(vec3 p, float a){ float c=cos(a),s=sin(a); return vec3(c*p.x+s*p.z,p.y,-s*p.x+c*p.z); }\n\nfloat sdSphere(vec3 q){ return length(q)-1.; }\nfloat sdCapsule(vec3 q){ q.y-=clamp(q.y,-0.5,0.5); return length(q)-0.5; }\nfloat sdTeardrop(vec3 q){\n float tp = mix(1.,0.36,clamp(q.y*0.5+0.5,0.,1.));\n return length(vec3(q.x/tp,q.y,q.z/tp))-1.;\n}\nfloat sdLozenge(vec3 q){\n vec3 a = pow(abs(q),vec3(3.4));\n return pow(a.x+a.y+a.z,1./3.4)-1.;\n}\n\n// Forms: return (dist, hueOff_of_nearest). Loop-index access of uHueOff[] is\n// safe in GLSL ES 1.00 (loop induction variable, not a dynamic expression).\nvec2 mapForms(vec3 p){\n vec2 res = vec2(1e9, 0.);\n for(int i=0;i<5;i++){\n if(float(i)>=uCount) break;\n float fi=float(i);\n vec3 anim = uMotion*vec3(sin(uTime*.38+fi*1.7),cos(uTime*.31+fi*2.3),sin(uTime*.43+fi*1.1))*0.06;\n vec3 sc = uScale3[i];\n vec3 q = rotY(p-uPos3[i]-anim,-uRot3[i])/sc;\n float ty=uType[i],d;\n if (ty<.5) d=sdSphere(q);\n else if(ty<1.5)d=sdCapsule(q);\n else if(ty<2.5)d=sdTeardrop(q);\n else d=sdLozenge(q);\n d*=min(sc.x,min(sc.y,sc.z));\n if(d<res.x) res=vec2(d,uHueOff[i]);\n }\n return res;\n}\n\n// Metaballs: potential = Σ r²/(|p-c|²+ε); isosurface at potential = 1.\n// Animation amplitude 0.35 per axis so balls visibly cycle separated→merged.\nvec2 mapMeta(vec3 p){\n float field=0.,wh=0.,wsum=0.;\n for(int i=0;i<5;i++){\n if(float(i)>=uCount) break;\n float fi=float(i);\n vec3 anim = uMotion*vec3(sin(uTime*.38+fi*1.7),cos(uTime*.31+fi*2.3),sin(uTime*.43+fi*1.1))*0.35;\n float r = uScale3[i].x;\n vec3 dv= p-uPos3[i]-anim;\n float w = r*r/(dot(dv,dv)+0.0001);\n field+=w; wh+=uHueOff[i]*w; wsum+=w;\n }\n return vec2(1.-field, wsum>0.?wh/wsum:0.);\n}\n\nvec2 map(vec3 p){ return uMetaball>.5 ? mapMeta(p) : mapForms(p); }\n\n// World-space surface normal via central difference\nvec3 calcNormal(vec3 p){\n const float E=0.002;\n return normalize(vec3(\n map(p+vec3(E,0,0)).x-map(p-vec3(E,0,0)).x,\n map(p+vec3(0,E,0)).x-map(p-vec3(0,E,0)).x,\n map(p+vec3(0,0,E)).x-map(p-vec3(0,0,E)).x\n ));\n}\n\n// AO: 6 samples along the world normal. Merge zones between metaballs have low\n// potential headroom → small d values → high occlusion → dark necks.\nfloat calcAO(vec3 p, vec3 n){\n float occ=0.,sca=1.;\n for(int i=1;i<=6;i++){\n float h = 0.006+0.08*float(i)/6.;\n float d = map(p+n*h).x;\n occ += max(h-d,0.)*sca;\n sca *= 0.87;\n }\n return clamp(1.-14.*occ, 0., 1.);\n}\n\n// Soft shadow: march from surface toward the world key light.\n// One metaball casts a soft shadow onto another → depth is unmistakable.\nfloat calcShadow(vec3 ro, vec3 rd){\n float sha=1.,t=0.02;\n for(int i=0;i<28;i++){\n float h=map(ro+rd*t).x;\n if(h<0.001) return 0.;\n sha=min(sha,8.*h/t);\n t+=clamp(h,0.01,0.18);\n if(sha<0.005||t>4.) break;\n }\n return clamp(sha,0.,1.);\n}\n\n// Shading: matcap iridescence (view-space) + world lighting (view-space L) + AO + shadow.\n// nv = view-space normal (n.z=1 faces camera).\n// Lv = world key light transformed to view space: diffuse changes as you orbit.\nvec3 shade(vec3 nv, float hueOff, float ao, float sha, vec3 Lv){\n float ci = uHue+hueOff+uIrid*(dot(nv.xy,uDir)*.5+.5);\n vec3 base = tint(ci);\n\n // Key: world-space light, so shading shifts as camera orbits\n float diff = max(dot(nv,Lv),0.);\n base *= mix(0.15,1.,diff*sha)*ao;\n\n // Cool fill from opposite quarter (unshadowed, softer)\n base += tint(ci+0.5)*max(dot(nv,normalize(-Lv+vec3(.2,-.1,0.))),0.)*0.09*ao;\n\n // Gloss specular\n vec3 H = normalize(Lv+vec3(0,0,1));\n base += pow(max(dot(nv,H),0.),uGloss)*uSheen*sha;\n\n // Coloured fresnel rim at silhouette\n float fres = pow(1.-clamp(nv.z,0.,1.),uRimPow);\n base += tint(ci+uRimShift)*fres*uRim;\n\n // SSS: scattered inner glow — most visible at metaball neck/thin spots\n base += tint(ci+0.5)*fres*fres*uSSS*0.5;\n\n return base;\n}\n\nvoid main(){\n vec2 uv = vUv*2.-1.;\n uv.x *= uAspect;\n\n // Orbit camera\n float cosPhi=cos(uPhi);\n vec3 ro = vec3(uDist*cosPhi*sin(uTheta), uDist*sin(uPhi), uDist*cosPhi*cos(uTheta));\n vec3 fwd = normalize(-ro);\n vec3 right = normalize(cross(fwd,vec3(0,1,0)));\n vec3 upV = cross(right,fwd);\n vec3 rd = normalize(fwd+uv.x*right*.9+uv.y*upV*.9);\n\n // World key light → view space (so diffuse changes as you orbit)\n vec3 L_w = normalize(vec3(-.4,.8,.6));\n vec3 Lv = normalize(vec3(dot(L_w,right),dot(L_w,upV),-dot(L_w,fwd)));\n\n vec3 col = uBg;\n float t = 0.1;\n float hitHue = 0.;\n bool didHit = false;\n\n for(int i=0;i<200;i++){\n vec3 p = ro+rd*t;\n vec2 r = map(p);\n if(r.x<0.0012){ hitHue=r.y; didHit=true; break; }\n float step = r.x*0.85;\n if(uMetaball>.5) step=clamp(r.x*0.45, 0.005, 0.13); // conservative: field isn't a true SDF\n t+=step;\n if(t>10.) break;\n }\n\n if(didHit){\n vec3 p = ro+rd*t;\n vec3 n = calcNormal(p); // world normal\n vec3 nv = normalize(vec3(dot(n,right),dot(n,upV),-dot(n,fwd))); // view normal\n\n float ao = calcAO(p, n);\n float sha = calcShadow(p+n*0.006, L_w);\n\n col = shade(nv, hitHue, ao, sha, Lv);\n }\n\n // Cinematic vignette\n col *= 1.-0.55*pow(dot(uv,uv)/2.,1.4);\n col += (hash(vUv*1920.+uTime)-.5)*uGrain;\n gl_FragColor = vec4(clamp(col,0.,1.),1.);\n}\n", rt = (e) => {
352
+ }, ot = "varying vec2 vUv; void main(){ vUv = uv; gl_Position = vec4(position.xy,0.,1.); }", st = "\nprecision highp float;\nvarying vec2 vUv;\n\nuniform float uTime, uAspect, uCount;\nuniform float uTheta, uPhi, uDist;\nuniform float uHue, uIrid, uSheen, uGloss;\nuniform float uRim, uRimPow, uRimShift, uSSS;\nuniform float uMotion, uGrain, uSpectral, uMetaball;\nuniform vec2 uDir;\nuniform vec3 uBg;\nuniform vec3 uColors[5];\nuniform float uType[5];\nuniform vec3 uPos3[5];\nuniform vec3 uScale3[5];\nuniform float uRot3[5];\nuniform float uHueOff[5];\n\nfloat hash(vec2 p){ return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453); }\n\nvec3 spectral(float t){\n t = fract(t);\n return 0.5 + 0.5*cos(6.28318*(t+vec3(0.,0.333,0.667)));\n}\nvec3 ramp(float t){\n t = fract(t)*4.;\n int i = int(floor(t));\n return mix(uColors[i], uColors[i+1<5?i+1:4], fract(t));\n}\nvec3 tint(float ci){ return mix(ramp(fract(ci)), spectral(ci), uSpectral); }\n\nvec3 rotY(vec3 p, float a){ float c=cos(a),s=sin(a); return vec3(c*p.x+s*p.z,p.y,-s*p.x+c*p.z); }\n\nfloat sdSphere(vec3 q){ return length(q)-1.; }\nfloat sdCapsule(vec3 q){ q.y-=clamp(q.y,-0.5,0.5); return length(q)-0.5; }\nfloat sdTeardrop(vec3 q){\n float tp = mix(1.,0.36,clamp(q.y*0.5+0.5,0.,1.));\n return length(vec3(q.x/tp,q.y,q.z/tp))-1.;\n}\nfloat sdLozenge(vec3 q){\n vec3 a = pow(abs(q),vec3(3.4));\n return pow(a.x+a.y+a.z,1./3.4)-1.;\n}\n\n// Forms: return (dist, hueOff_of_nearest). Loop-index access of uHueOff[] is\n// safe in GLSL ES 1.00 (loop induction variable, not a dynamic expression).\nvec2 mapForms(vec3 p){\n vec2 res = vec2(1e9, 0.);\n for(int i=0;i<5;i++){\n if(float(i)>=uCount) break;\n float fi=float(i);\n vec3 anim = uMotion*vec3(sin(uTime*.38+fi*1.7),cos(uTime*.31+fi*2.3),sin(uTime*.43+fi*1.1))*0.06;\n vec3 sc = uScale3[i];\n vec3 q = rotY(p-uPos3[i]-anim,-uRot3[i])/sc;\n float ty=uType[i],d;\n if (ty<.5) d=sdSphere(q);\n else if(ty<1.5)d=sdCapsule(q);\n else if(ty<2.5)d=sdTeardrop(q);\n else d=sdLozenge(q);\n d*=min(sc.x,min(sc.y,sc.z));\n if(d<res.x) res=vec2(d,uHueOff[i]);\n }\n return res;\n}\n\n// Metaballs: potential = Σ r²/(|p-c|²+ε); isosurface at potential = 1.\n// Animation amplitude 0.35 per axis so balls visibly cycle separated→merged.\nvec2 mapMeta(vec3 p){\n float field=0.,wh=0.,wsum=0.;\n for(int i=0;i<5;i++){\n if(float(i)>=uCount) break;\n float fi=float(i);\n vec3 anim = uMotion*vec3(sin(uTime*.38+fi*1.7),cos(uTime*.31+fi*2.3),sin(uTime*.43+fi*1.1))*0.35;\n float r = uScale3[i].x;\n vec3 dv= p-uPos3[i]-anim;\n float w = r*r/(dot(dv,dv)+0.0001);\n field+=w; wh+=uHueOff[i]*w; wsum+=w;\n }\n return vec2(1.-field, wsum>0.?wh/wsum:0.);\n}\n\nvec2 map(vec3 p){ return uMetaball>.5 ? mapMeta(p) : mapForms(p); }\n\n// World-space surface normal via central difference\nvec3 calcNormal(vec3 p){\n const float E=0.002;\n return normalize(vec3(\n map(p+vec3(E,0,0)).x-map(p-vec3(E,0,0)).x,\n map(p+vec3(0,E,0)).x-map(p-vec3(0,E,0)).x,\n map(p+vec3(0,0,E)).x-map(p-vec3(0,0,E)).x\n ));\n}\n\n// AO: 6 samples along the world normal. Merge zones between metaballs have low\n// potential headroom → small d values → high occlusion → dark necks.\nfloat calcAO(vec3 p, vec3 n){\n float occ=0.,sca=1.;\n for(int i=1;i<=6;i++){\n float h = 0.006+0.08*float(i)/6.;\n float d = map(p+n*h).x;\n occ += max(h-d,0.)*sca;\n sca *= 0.87;\n }\n return clamp(1.-14.*occ, 0., 1.);\n}\n\n// Soft shadow: march from surface toward the world key light.\n// One metaball casts a soft shadow onto another → depth is unmistakable.\nfloat calcShadow(vec3 ro, vec3 rd){\n float sha=1.,t=0.02;\n for(int i=0;i<28;i++){\n float h=map(ro+rd*t).x;\n if(h<0.001) return 0.;\n sha=min(sha,8.*h/t);\n t+=clamp(h,0.01,0.18);\n if(sha<0.005||t>4.) break;\n }\n return clamp(sha,0.,1.);\n}\n\n// Shading: matcap iridescence (view-space) + world lighting (view-space L) + AO + shadow.\n// nv = view-space normal (n.z=1 faces camera).\n// Lv = world key light transformed to view space: diffuse changes as you orbit.\nvec3 shade(vec3 nv, float hueOff, float ao, float sha, vec3 Lv){\n float ci = uHue+hueOff+uIrid*(dot(nv.xy,uDir)*.5+.5);\n vec3 base = tint(ci);\n\n // Key: world-space light, so shading shifts as camera orbits\n float diff = max(dot(nv,Lv),0.);\n base *= mix(0.15,1.,diff*sha)*ao;\n\n // Cool fill from opposite quarter (unshadowed, softer)\n base += tint(ci+0.5)*max(dot(nv,normalize(-Lv+vec3(.2,-.1,0.))),0.)*0.09*ao;\n\n // Gloss specular\n vec3 H = normalize(Lv+vec3(0,0,1));\n base += pow(max(dot(nv,H),0.),uGloss)*uSheen*sha;\n\n // Coloured fresnel rim at silhouette\n float fres = pow(1.-clamp(nv.z,0.,1.),uRimPow);\n base += tint(ci+uRimShift)*fres*uRim;\n\n // SSS: scattered inner glow — most visible at metaball neck/thin spots\n base += tint(ci+0.5)*fres*fres*uSSS*0.5;\n\n return base;\n}\n\nvoid main(){\n vec2 uv = vUv*2.-1.;\n uv.x *= uAspect;\n\n // Orbit camera\n float cosPhi=cos(uPhi);\n vec3 ro = vec3(uDist*cosPhi*sin(uTheta), uDist*sin(uPhi), uDist*cosPhi*cos(uTheta));\n vec3 fwd = normalize(-ro);\n vec3 right = normalize(cross(fwd,vec3(0,1,0)));\n vec3 upV = cross(right,fwd);\n vec3 rd = normalize(fwd+uv.x*right*.9+uv.y*upV*.9);\n\n // World key light → view space (so diffuse changes as you orbit)\n vec3 L_w = normalize(vec3(-.4,.8,.6));\n vec3 Lv = normalize(vec3(dot(L_w,right),dot(L_w,upV),-dot(L_w,fwd)));\n\n vec3 col = uBg;\n float t = 0.1;\n float hitHue = 0.;\n bool didHit = false;\n\n for(int i=0;i<200;i++){\n vec3 p = ro+rd*t;\n vec2 r = map(p);\n if(r.x<0.0012){ hitHue=r.y; didHit=true; break; }\n float step = r.x*0.85;\n if(uMetaball>.5) step=clamp(r.x*0.45, 0.005, 0.13); // conservative: field isn't a true SDF\n t+=step;\n if(t>10.) break;\n }\n\n if(didHit){\n vec3 p = ro+rd*t;\n vec3 n = calcNormal(p); // world normal\n vec3 nv = normalize(vec3(dot(n,right),dot(n,upV),-dot(n,fwd))); // view normal\n\n float ao = calcAO(p, n);\n float sha = calcShadow(p+n*0.006, L_w);\n\n col = shade(nv, hitHue, ao, sha, Lv);\n }\n\n // Cinematic vignette\n col *= 1.-0.55*pow(dot(uv,uv)/2.,1.4);\n col += (hash(vUv*1920.+uTime)-.5)*uGrain;\n gl_FragColor = vec4(clamp(col,0.,1.),1.);\n}\n", q = (e) => {
344
353
  let t = parseInt(e.slice(1), 16);
345
- return new I((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
346
- }, it = class {
354
+ return new E((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
355
+ }, ct = class {
347
356
  constructor() {
348
357
  this.renderer = null, this.time = 0, this.playing = !0, this.speed = 1;
349
358
  }
350
359
  init(e) {
351
- this.renderer = new D({
360
+ this.renderer = new N({
352
361
  canvas: e,
353
362
  antialias: !0,
354
363
  preserveDrawingBuffer: !0
355
- }), this.scene = new E(), this.cam = new j(), this.uniforms = {
364
+ }), this.scene = new w(), this.cam = new R(), this.uniforms = {
356
365
  uTime: { value: 0 },
357
366
  uAspect: { value: 1 },
358
367
  uCount: { value: 1 },
@@ -371,22 +380,22 @@ var Be = {
371
380
  uGrain: { value: .018 },
372
381
  uSpectral: { value: 1 },
373
382
  uMetaball: { value: 0 },
374
- uDir: { value: new O(.3, .95) },
375
- uBg: { value: rt("#000000") },
376
- uColors: { value: s[0].cols.map(rt) },
383
+ uDir: { value: new j(.3, .95) },
384
+ uBg: { value: q("#000000") },
385
+ uColors: { value: m[0].cols.map(q) },
377
386
  uType: { value: Array(K).fill(0) },
378
- uPos3: { value: Array.from({ length: K }, () => new I()) },
379
- uScale3: { value: Array.from({ length: K }, () => new I(.7, .7, .7)) },
387
+ uPos3: { value: Array.from({ length: K }, () => new E()) },
388
+ uScale3: { value: Array.from({ length: K }, () => new E(.7, .7, .7)) },
380
389
  uRot3: { value: Array(K).fill(0) },
381
390
  uHueOff: { value: Array(K).fill(0) }
382
- }, this.mat = new T({
383
- vertexShader: tt,
384
- fragmentShader: nt,
391
+ }, this.mat = new C({
392
+ vertexShader: ot,
393
+ fragmentShader: st,
385
394
  uniforms: this.uniforms
386
- }), this.geo = new S(2, 2), this.scene.add(new C(this.geo, this.mat));
395
+ }), this.geo = new M(2, 2), this.scene.add(new F(this.geo, this.mat));
387
396
  }
388
397
  resize(e, t) {
389
- this.renderer && (this.renderer.setSize(e, t, !1), this.uniforms.uAspect.value = e / t);
398
+ this.renderer && (this.renderer.setPixelRatio(re()), this.renderer.setSize(e, t, !1), this.uniforms.uAspect.value = e / t);
390
399
  }
391
400
  setCamera({ theta: e, phi: t, dist: n }) {
392
401
  this.uniforms && (this.uniforms.uTheta.value = e, this.uniforms.uPhi.value = t, this.uniforms.uDist.value = n);
@@ -397,7 +406,7 @@ var Be = {
397
406
  t.uCount.value = n.length || 1;
398
407
  for (let e = 0; e < K; e++) {
399
408
  let r = n[e] || {};
400
- t.uType.value[e] = et[r.t] ?? 0, t.uPos3.value[e].set(r.x ?? 0, r.y ?? 0, r.z ?? 0);
409
+ t.uType.value[e] = at[r.t] ?? 0, t.uPos3.value[e].set(r.x ?? 0, r.y ?? 0, r.z ?? 0);
401
410
  let i = r.sx ?? .7;
402
411
  t.uScale3.value[e].set(i, r.sy ?? i, r.sz ?? i), t.uRot3.value[e] = (r.rot ?? 0) * Math.PI / 180, t.uHueOff.value[e] = r.hue ?? 0;
403
412
  }
@@ -422,12 +431,12 @@ var Be = {
422
431
  t.uDir.value.set(Math.sin(n), Math.cos(n));
423
432
  }
424
433
  if (e.speed != null && (this.speed = e.speed), e.forms && this.setForms(e.forms), e.palette != null) {
425
- let n = s.find((t) => t.value === e.palette) || s[0];
426
- t.uColors.value = n.cols.map(rt);
434
+ let n = m.find((t) => t.value === e.palette) || m[0];
435
+ t.uColors.value = n.cols.map(q);
427
436
  }
428
437
  if (e.backdrop != null) {
429
- let n = a.find((t) => t.value === e.backdrop) || a[0];
430
- t.uBg.value = rt(n.col);
438
+ let n = h.find((t) => t.value === e.backdrop) || h[0];
439
+ t.uBg.value = q(n.col);
431
440
  }
432
441
  }
433
442
  setPlaying(e) {
@@ -454,14 +463,14 @@ var Be = {
454
463
  destroy() {
455
464
  this.mat?.dispose(), this.geo?.dispose(), this.renderer &&= (this.renderer.dispose(), null);
456
465
  }
457
- }, q = new I();
458
- function J(e, t, n, r, i, a) {
466
+ }, J = new E();
467
+ function Y(e, t, n, r, i, a) {
459
468
  let o = 2 * Math.PI * i / 4, s = Math.max(a - 2 * i, 0), c = Math.PI / 4;
460
- q.copy(t), q[r] = 0, q.normalize();
461
- let l = .5 * o / (o + s), u = 1 - q.angleTo(e) / c;
462
- return Math.sign(q[n]) === 1 ? u * l : s / (o + s) + l + l * (1 - u);
469
+ J.copy(t), J[r] = 0, J.normalize();
470
+ let l = .5 * o / (o + s), u = 1 - J.angleTo(e) / c;
471
+ return Math.sign(J[n]) === 1 ? u * l : s / (o + s) + l + l * (1 - u);
463
472
  }
464
- var at = class e extends F {
473
+ var lt = class e extends P {
465
474
  constructor(e = 1, t = 1, n = 1, r = 2, i = .1) {
466
475
  let a = r * 2 + 1;
467
476
  if (i = Math.min(e / 2, t / 2, n / 2, i), super(1, 1, 1, a, a, a), this.type = "RoundedBoxGeometry", this.parameters = {
@@ -473,32 +482,32 @@ var at = class e extends F {
473
482
  }, a === 1) return;
474
483
  let o = this.toNonIndexed();
475
484
  this.index = null, this.attributes.position = o.attributes.position, this.attributes.normal = o.attributes.normal, this.attributes.uv = o.attributes.uv;
476
- let s = new I(), c = new I(), l = new I(e, t, n).divideScalar(2).subScalar(i), u = this.attributes.position.array, d = this.attributes.normal.array, f = this.attributes.uv.array, p = u.length / 6, m = new I(), h = .5 / a;
485
+ let s = new E(), c = new E(), l = new E(e, t, n).divideScalar(2).subScalar(i), u = this.attributes.position.array, d = this.attributes.normal.array, f = this.attributes.uv.array, p = u.length / 6, m = new E(), h = .5 / a;
477
486
  for (let r = 0, a = 0; r < u.length; r += 3, a += 2) switch (s.fromArray(u, r), c.copy(s), c.x -= Math.sign(c.x) * h, c.y -= Math.sign(c.y) * h, c.z -= Math.sign(c.z) * h, c.normalize(), u[r + 0] = l.x * Math.sign(s.x) + c.x * i, u[r + 1] = l.y * Math.sign(s.y) + c.y * i, u[r + 2] = l.z * Math.sign(s.z) + c.z * i, d[r + 0] = c.x, d[r + 1] = c.y, d[r + 2] = c.z, Math.floor(r / p)) {
478
487
  case 0:
479
- m.set(1, 0, 0), f[a + 0] = J(m, c, "z", "y", i, n), f[a + 1] = 1 - J(m, c, "y", "z", i, t);
488
+ m.set(1, 0, 0), f[a + 0] = Y(m, c, "z", "y", i, n), f[a + 1] = 1 - Y(m, c, "y", "z", i, t);
480
489
  break;
481
490
  case 1:
482
- m.set(-1, 0, 0), f[a + 0] = 1 - J(m, c, "z", "y", i, n), f[a + 1] = 1 - J(m, c, "y", "z", i, t);
491
+ m.set(-1, 0, 0), f[a + 0] = 1 - Y(m, c, "z", "y", i, n), f[a + 1] = 1 - Y(m, c, "y", "z", i, t);
483
492
  break;
484
493
  case 2:
485
- m.set(0, 1, 0), f[a + 0] = 1 - J(m, c, "x", "z", i, e), f[a + 1] = J(m, c, "z", "x", i, n);
494
+ m.set(0, 1, 0), f[a + 0] = 1 - Y(m, c, "x", "z", i, e), f[a + 1] = Y(m, c, "z", "x", i, n);
486
495
  break;
487
496
  case 3:
488
- m.set(0, -1, 0), f[a + 0] = 1 - J(m, c, "x", "z", i, e), f[a + 1] = 1 - J(m, c, "z", "x", i, n);
497
+ m.set(0, -1, 0), f[a + 0] = 1 - Y(m, c, "x", "z", i, e), f[a + 1] = 1 - Y(m, c, "z", "x", i, n);
489
498
  break;
490
499
  case 4:
491
- m.set(0, 0, 1), f[a + 0] = 1 - J(m, c, "x", "y", i, e), f[a + 1] = 1 - J(m, c, "y", "x", i, t);
500
+ m.set(0, 0, 1), f[a + 0] = 1 - Y(m, c, "x", "y", i, e), f[a + 1] = 1 - Y(m, c, "y", "x", i, t);
492
501
  break;
493
502
  case 5:
494
- m.set(0, 0, -1), f[a + 0] = J(m, c, "x", "y", i, e), f[a + 1] = 1 - J(m, c, "y", "x", i, t);
503
+ m.set(0, 0, -1), f[a + 0] = Y(m, c, "x", "y", i, e), f[a + 1] = 1 - Y(m, c, "y", "x", i, t);
495
504
  break;
496
505
  }
497
506
  }
498
507
  static fromJSON(t) {
499
508
  return new e(t.width, t.height, t.depth, t.segments, t.radius);
500
509
  }
501
- }, ot = new we(), st = new I(), ct = class extends ae {
510
+ }, ut = new ze(), dt = new E(), ft = class extends fe {
502
511
  constructor() {
503
512
  super(), this.isLineSegmentsGeometry = !0, this.type = "LineSegmentsGeometry", this.setIndex([
504
513
  0,
@@ -519,7 +528,7 @@ var at = class e extends F {
519
528
  6,
520
529
  7,
521
530
  5
522
- ]), this.setAttribute("position", new V([
531
+ ]), this.setAttribute("position", new A([
523
532
  -1,
524
533
  2,
525
534
  0,
@@ -544,7 +553,7 @@ var at = class e extends F {
544
553
  1,
545
554
  -1,
546
555
  0
547
- ], 3)), this.setAttribute("uv", new V([
556
+ ], 3)), this.setAttribute("uv", new A([
548
557
  -1,
549
558
  2,
550
559
  1,
@@ -570,14 +579,14 @@ var at = class e extends F {
570
579
  setPositions(e) {
571
580
  let t;
572
581
  e instanceof Float32Array ? t = e : Array.isArray(e) && (t = new Float32Array(e));
573
- let n = new pe(t, 6, 1);
574
- return this.setAttribute("instanceStart", new x(n, 3, 0)), this.setAttribute("instanceEnd", new x(n, 3, 3)), this.instanceCount = this.attributes.instanceStart.count, this.computeBoundingBox(), this.computeBoundingSphere(), this;
582
+ let n = new me(t, 6, 1);
583
+ return this.setAttribute("instanceStart", new D(n, 3, 0)), this.setAttribute("instanceEnd", new D(n, 3, 3)), this.instanceCount = this.attributes.instanceStart.count, this.computeBoundingBox(), this.computeBoundingSphere(), this;
575
584
  }
576
585
  setColors(e) {
577
586
  let t;
578
587
  e instanceof Float32Array ? t = e : Array.isArray(e) && (t = new Float32Array(e));
579
- let n = new pe(t, 6, 1);
580
- return this.setAttribute("instanceColorStart", new x(n, 3, 0)), this.setAttribute("instanceColorEnd", new x(n, 3, 3)), this;
588
+ let n = new me(t, 6, 1);
589
+ return this.setAttribute("instanceColorStart", new D(n, 3, 0)), this.setAttribute("instanceColorEnd", new D(n, 3, 3)), this;
581
590
  }
582
591
  fromWireframeGeometry(e) {
583
592
  return this.setPositions(e.attributes.position.array), this;
@@ -586,54 +595,54 @@ var at = class e extends F {
586
595
  return this.setPositions(e.attributes.position.array), this;
587
596
  }
588
597
  fromMesh(e) {
589
- return this.fromWireframeGeometry(new De(e.geometry)), this;
598
+ return this.fromWireframeGeometry(new ue(e.geometry)), this;
590
599
  }
591
600
  fromLineSegments(e) {
592
601
  let t = e.geometry;
593
602
  return this.setPositions(t.attributes.position.array), this;
594
603
  }
595
604
  computeBoundingBox() {
596
- this.boundingBox === null && (this.boundingBox = new we());
605
+ this.boundingBox === null && (this.boundingBox = new ze());
597
606
  let e = this.attributes.instanceStart, t = this.attributes.instanceEnd;
598
- e !== void 0 && t !== void 0 && (this.boundingBox.setFromBufferAttribute(e), ot.setFromBufferAttribute(t), this.boundingBox.union(ot));
607
+ e !== void 0 && t !== void 0 && (this.boundingBox.setFromBufferAttribute(e), ut.setFromBufferAttribute(t), this.boundingBox.union(ut));
599
608
  }
600
609
  computeBoundingSphere() {
601
- this.boundingSphere === null && (this.boundingSphere = new xe()), this.boundingBox === null && this.computeBoundingBox();
610
+ this.boundingSphere === null && (this.boundingSphere = new ae()), this.boundingBox === null && this.computeBoundingBox();
602
611
  let e = this.attributes.instanceStart, t = this.attributes.instanceEnd;
603
612
  if (e !== void 0 && t !== void 0) {
604
613
  let n = this.boundingSphere.center;
605
614
  this.boundingBox.getCenter(n);
606
615
  let r = 0;
607
- for (let i = 0, a = e.count; i < a; i++) st.fromBufferAttribute(e, i), r = Math.max(r, n.distanceToSquared(st)), st.fromBufferAttribute(t, i), r = Math.max(r, n.distanceToSquared(st));
616
+ for (let i = 0, a = e.count; i < a; i++) dt.fromBufferAttribute(e, i), r = Math.max(r, n.distanceToSquared(dt)), dt.fromBufferAttribute(t, i), r = Math.max(r, n.distanceToSquared(dt));
608
617
  this.boundingSphere.radius = Math.sqrt(r), isNaN(this.boundingSphere.radius) && console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.", this);
609
618
  }
610
619
  }
611
620
  toJSON() {}
612
621
  };
613
- N.line = {
622
+ Te.line = {
614
623
  worldUnits: { value: 1 },
615
624
  linewidth: { value: 1 },
616
- resolution: { value: new O() },
625
+ resolution: { value: new j() },
617
626
  dashOffset: { value: 0 },
618
627
  dashScale: { value: 1 },
619
628
  dashSize: { value: 1 },
620
629
  gapSize: { value: 1 }
621
- }, L.line = {
622
- uniforms: P.merge([
623
- N.common,
624
- N.fog,
625
- N.line
630
+ }, Fe.line = {
631
+ uniforms: S.merge([
632
+ Te.common,
633
+ Te.fog,
634
+ Te.line
626
635
  ]),
627
636
  vertexShader: "\n #include <common>\n #include <color_pars_vertex>\n #include <fog_pars_vertex>\n #include <logdepthbuf_pars_vertex>\n #include <clipping_planes_pars_vertex>\n\n uniform float linewidth;\n uniform vec2 resolution;\n\n attribute vec3 instanceStart;\n attribute vec3 instanceEnd;\n\n attribute vec3 instanceColorStart;\n attribute vec3 instanceColorEnd;\n\n #ifdef WORLD_UNITS\n\n varying vec4 worldPos;\n varying vec3 worldStart;\n varying vec3 worldEnd;\n\n #ifdef USE_DASH\n\n varying vec2 vUv;\n\n #endif\n\n #else\n\n varying vec2 vUv;\n\n #endif\n\n #ifdef USE_DASH\n\n uniform float dashScale;\n attribute float instanceDistanceStart;\n attribute float instanceDistanceEnd;\n varying float vLineDistance;\n\n #endif\n\n float trimSegmentAlpha( const in vec4 start, const in vec4 end ) {\n\n // compute the interpolation factor needed to trim the segment so it terminates\n // between the camera plane and the near plane\n\n // conservative estimate of the near plane\n float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\n // we need different nearEstimate formula for reversed and default depth buffer\n // a is positive with a reversed depth buffer so it can be used for controlling the code flow\n float nearEstimate = ( a > 0.0 ) ? ( - b / ( a + 1.0 ) ) : ( - 0.5 * b / a );\n\n return ( nearEstimate - start.z ) / ( end.z - start.z );\n\n }\n\n void main() {\n\n #ifdef USE_COLOR\n\n vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n #endif\n\n float aspect = resolution.x / resolution.y;\n\n // camera space\n vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n #ifdef USE_DASH\n\n float lineDistanceStart = dashScale * instanceDistanceStart;\n float lineDistanceEnd = dashScale * instanceDistanceEnd;\n\n #endif\n\n #ifdef WORLD_UNITS\n\n worldStart = start.xyz;\n worldEnd = end.xyz;\n\n #else\n\n vUv = uv;\n\n #endif\n\n // special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n // but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n // perhaps there is a more elegant solution -- WestLangley\n\n bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n if ( perspective ) {\n\n if ( start.z < 0.0 && end.z >= 0.0 ) {\n\n float alpha = trimSegmentAlpha( start, end );\n end.xyz = mix( start.xyz, end.xyz, alpha );\n\n #ifdef USE_DASH\n\n lineDistanceEnd = mix( lineDistanceStart, lineDistanceEnd, alpha );\n\n #endif\n\n } else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n float alpha = trimSegmentAlpha( end, start );\n start.xyz = mix( end.xyz, start.xyz, alpha );\n\n #ifdef USE_DASH\n\n lineDistanceStart = mix( lineDistanceEnd, lineDistanceStart, alpha );\n\n #endif\n\n }\n\n }\n\n #ifdef USE_DASH\n\n vLineDistance = ( position.y < 0.5 ) ? lineDistanceStart : lineDistanceEnd;\n vUv = uv;\n\n #endif\n\n // clip space\n vec4 clipStart = projectionMatrix * start;\n vec4 clipEnd = projectionMatrix * end;\n\n // ndc space\n vec3 ndcStart = clipStart.xyz / clipStart.w;\n vec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n // direction\n vec2 dir = ndcEnd.xy - ndcStart.xy;\n\n // account for clip-space aspect ratio\n dir.x *= aspect;\n dir = normalize( dir );\n\n #ifdef WORLD_UNITS\n\n vec3 worldDir = normalize( end.xyz - start.xyz );\n vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );\n vec3 worldUp = normalize( cross( worldDir, tmpFwd ) );\n vec3 worldFwd = cross( worldDir, worldUp );\n worldPos = position.y < 0.5 ? start: end;\n\n // height offset\n float hw = linewidth * 0.5;\n worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;\n\n // don't extend the line if we're rendering dashes because we\n // won't be rendering the endcaps\n #ifndef USE_DASH\n\n // cap extension\n worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;\n\n // add width to the box\n worldPos.xyz += worldFwd * hw;\n\n // endcaps\n if ( position.y > 1.0 || position.y < 0.0 ) {\n\n worldPos.xyz -= worldFwd * 2.0 * hw;\n\n }\n\n #endif\n\n // project the worldpos\n vec4 clip = projectionMatrix * worldPos;\n\n // shift the depth of the projected points so the line\n // segments overlap neatly\n vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n clip.z = clipPose.z * clip.w;\n\n #else\n\n vec2 offset = vec2( dir.y, - dir.x );\n // undo aspect ratio adjustment\n dir.x /= aspect;\n offset.x /= aspect;\n\n // sign flip\n if ( position.x < 0.0 ) offset *= - 1.0;\n\n // endcaps\n if ( position.y < 0.0 ) {\n\n offset += - dir;\n\n } else if ( position.y > 1.0 ) {\n\n offset += dir;\n\n }\n\n // adjust for linewidth\n offset *= linewidth;\n\n // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n offset /= resolution.y;\n\n // select end\n vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n // back to clip space\n offset *= clip.w;\n\n clip.xy += offset;\n\n #endif\n\n gl_Position = clip;\n\n vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n\n }\n ",
628
637
  fragmentShader: "\n uniform vec3 diffuse;\n uniform float opacity;\n uniform float linewidth;\n\n #ifdef USE_DASH\n\n uniform float dashOffset;\n uniform float dashSize;\n uniform float gapSize;\n\n #endif\n\n varying float vLineDistance;\n\n #ifdef WORLD_UNITS\n\n varying vec4 worldPos;\n varying vec3 worldStart;\n varying vec3 worldEnd;\n\n #ifdef USE_DASH\n\n varying vec2 vUv;\n\n #endif\n\n #else\n\n varying vec2 vUv;\n\n #endif\n\n #include <common>\n #include <color_pars_fragment>\n #include <fog_pars_fragment>\n #include <logdepthbuf_pars_fragment>\n #include <clipping_planes_pars_fragment>\n\n vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n float mua;\n float mub;\n\n vec3 p13 = p1 - p3;\n vec3 p43 = p4 - p3;\n\n vec3 p21 = p2 - p1;\n\n float d1343 = dot( p13, p43 );\n float d4321 = dot( p43, p21 );\n float d1321 = dot( p13, p21 );\n float d4343 = dot( p43, p43 );\n float d2121 = dot( p21, p21 );\n\n float denom = d2121 * d4343 - d4321 * d4321;\n\n float numer = d1343 * d4321 - d1321 * d4343;\n\n mua = numer / denom;\n mua = clamp( mua, 0.0, 1.0 );\n mub = ( d1343 + d4321 * ( mua ) ) / d4343;\n mub = clamp( mub, 0.0, 1.0 );\n\n return vec2( mua, mub );\n\n }\n\n void main() {\n\n float alpha = opacity;\n vec4 diffuseColor = vec4( diffuse, alpha );\n\n #include <clipping_planes_fragment>\n\n #ifdef USE_DASH\n\n if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n #endif\n\n #ifdef WORLD_UNITS\n\n // Find the closest points on the view ray and the line segment\n vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n vec3 lineDir = worldEnd - worldStart;\n vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n vec3 p1 = worldStart + lineDir * params.x;\n vec3 p2 = rayEnd * params.y;\n vec3 delta = p1 - p2;\n float len = length( delta );\n float norm = len / linewidth;\n\n #ifndef USE_DASH\n\n #ifdef USE_ALPHA_TO_COVERAGE\n\n float dnorm = fwidth( norm );\n alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n #else\n\n if ( norm > 0.5 ) {\n\n discard;\n\n }\n\n #endif\n\n #endif\n\n #else\n\n #ifdef USE_ALPHA_TO_COVERAGE\n\n // artifacts appear on some hardware if a derivative is taken within a conditional\n float a = vUv.x;\n float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n float len2 = a * a + b * b;\n float dlen = fwidth( len2 );\n\n if ( abs( vUv.y ) > 1.0 ) {\n\n alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n }\n\n #else\n\n if ( abs( vUv.y ) > 1.0 ) {\n\n float a = vUv.x;\n float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n float len2 = a * a + b * b;\n\n if ( len2 > 1.0 ) discard;\n\n }\n\n #endif\n\n #endif\n\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n\n gl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n\n }\n "
629
638
  };
630
- var lt = class extends T {
639
+ var pt = class extends C {
631
640
  constructor(e) {
632
641
  super({
633
642
  type: "LineMaterial",
634
- uniforms: P.clone(L.line.uniforms),
635
- vertexShader: L.line.vertexShader,
636
- fragmentShader: L.line.fragmentShader,
643
+ uniforms: S.clone(Fe.line.uniforms),
644
+ vertexShader: Fe.line.vertexShader,
645
+ fragmentShader: Fe.line.fragmentShader,
637
646
  clipping: !0
638
647
  }), this.isLineMaterial = !0, this.setValues(e);
639
648
  }
@@ -703,46 +712,46 @@ var lt = class extends T {
703
712
  set alphaToCoverage(e) {
704
713
  this.defines && (e === !0 !== this.alphaToCoverage && (this.needsUpdate = !0), e === !0 ? this.defines.USE_ALPHA_TO_COVERAGE = "" : delete this.defines.USE_ALPHA_TO_COVERAGE);
705
714
  }
706
- }, ut = new I(), dt = new I(), ft = new Ie(), pt = class extends C {
707
- constructor(e = new ct(), t = new lt({ color: Math.random() * 16777215 })) {
715
+ }, mt = new E(), ht = new E(), gt = new _e(), _t = class extends F {
716
+ constructor(e = new ft(), t = new pt({ color: Math.random() * 16777215 })) {
708
717
  super(e, t), this.isWireframe = !0, this.type = "Wireframe";
709
718
  }
710
719
  computeLineDistances() {
711
720
  let e = this.geometry, t = e.attributes.instanceStart, n = e.attributes.instanceEnd, r = new Float32Array(2 * t.count);
712
- for (let e = 0, i = 0, a = t.count; e < a; e++, i += 2) ut.fromBufferAttribute(t, e), dt.fromBufferAttribute(n, e), r[i] = i === 0 ? 0 : r[i - 1], r[i + 1] = r[i] + ut.distanceTo(dt);
713
- let i = new pe(r, 2, 1);
714
- return e.setAttribute("instanceDistanceStart", new x(i, 1, 0)), e.setAttribute("instanceDistanceEnd", new x(i, 1, 1)), this;
721
+ for (let e = 0, i = 0, a = t.count; e < a; e++, i += 2) mt.fromBufferAttribute(t, e), ht.fromBufferAttribute(n, e), r[i] = i === 0 ? 0 : r[i - 1], r[i + 1] = r[i] + mt.distanceTo(ht);
722
+ let i = new me(r, 2, 1);
723
+ return e.setAttribute("instanceDistanceStart", new D(i, 1, 0)), e.setAttribute("instanceDistanceEnd", new D(i, 1, 1)), this;
715
724
  }
716
725
  onBeforeRender(e) {
717
726
  let t = this.material.uniforms;
718
- t && t.resolution && (e.getViewport(ft), this.material.uniforms.resolution.value.set(ft.z, ft.w));
727
+ t && t.resolution && (e.getViewport(gt), this.material.uniforms.resolution.value.set(gt.z, gt.w));
719
728
  }
720
- }, mt = class extends ct {
729
+ }, vt = class extends ft {
721
730
  constructor(e) {
722
- super(), this.isWireframeGeometry2 = !0, this.type = "WireframeGeometry2", this.fromWireframeGeometry(new De(e));
731
+ super(), this.isWireframeGeometry2 = !0, this.type = "WireframeGeometry2", this.fromWireframeGeometry(new ue(e));
723
732
  }
724
- }, ht = class extends E {
733
+ }, yt = class extends w {
725
734
  constructor() {
726
735
  super(), this.name = "RoomEnvironment", this.position.y = -3.5;
727
- let e = new F();
736
+ let e = new P();
728
737
  e.deleteAttribute("uv");
729
- let t = new ze({ side: 1 }), n = new ze(), r = new de(16777215, 900, 28, 2);
738
+ let t = new Ne({ side: 1 }), n = new Ne(), r = new Be(16777215, 900, 28, 2);
730
739
  r.position.set(.418, 16.199, .3), this.add(r);
731
- let i = new C(e, t);
740
+ let i = new F(e, t);
732
741
  i.position.set(-.757, 13.219, .717), i.scale.set(31.713, 28.305, 28.591), this.add(i);
733
- let a = new Ee(e, n, 6), o = new be();
742
+ let a = new le(e, n, 6), o = new Pe();
734
743
  o.position.set(-10.906, 2.009, 1.846), o.rotation.set(0, -.195, 0), o.scale.set(2.328, 7.905, 4.651), o.updateMatrix(), a.setMatrixAt(0, o.matrix), o.position.set(-5.607, -.754, -.758), o.rotation.set(0, .994, 0), o.scale.set(1.97, 1.534, 3.955), o.updateMatrix(), a.setMatrixAt(1, o.matrix), o.position.set(6.167, .857, 7.803), o.rotation.set(0, .561, 0), o.scale.set(3.927, 6.285, 3.687), o.updateMatrix(), a.setMatrixAt(2, o.matrix), o.position.set(-2.017, .018, 6.124), o.rotation.set(0, .333, 0), o.scale.set(2.002, 4.566, 2.064), o.updateMatrix(), a.setMatrixAt(3, o.matrix), o.position.set(2.291, -.756, -2.621), o.rotation.set(0, -.286, 0), o.scale.set(1.546, 1.552, 1.496), o.updateMatrix(), a.setMatrixAt(4, o.matrix), o.position.set(-2.193, -.369, -5.547), o.rotation.set(0, .516, 0), o.scale.set(3.875, 3.487, 2.986), o.updateMatrix(), a.setMatrixAt(5, o.matrix), this.add(a);
735
- let s = new C(e, Y(50));
744
+ let s = new F(e, X(50));
736
745
  s.position.set(-16.116, 14.37, 8.208), s.scale.set(.1, 2.428, 2.739), this.add(s);
737
- let c = new C(e, Y(50));
746
+ let c = new F(e, X(50));
738
747
  c.position.set(-16.109, 18.021, -8.207), c.scale.set(.1, 2.425, 2.751), this.add(c);
739
- let l = new C(e, Y(17));
748
+ let l = new F(e, X(17));
740
749
  l.position.set(14.904, 12.198, -1.832), l.scale.set(.15, 4.265, 6.331), this.add(l);
741
- let u = new C(e, Y(43));
750
+ let u = new F(e, X(43));
742
751
  u.position.set(-.462, 8.89, 14.52), u.scale.set(4.38, 5.441, .088), this.add(u);
743
- let d = new C(e, Y(20));
752
+ let d = new F(e, X(20));
744
753
  d.position.set(3.235, 11.486, -12.541), d.scale.set(2.5, 2, .1), this.add(d);
745
- let f = new C(e, Y(100));
754
+ let f = new F(e, X(100));
746
755
  f.position.set(0, 20, 0), f.scale.set(1, .1, 1), this.add(f);
747
756
  }
748
757
  dispose() {
@@ -753,8 +762,8 @@ var lt = class extends T {
753
762
  for (let t of e) t.dispose();
754
763
  }
755
764
  };
756
- function Y(e) {
757
- return new se({
765
+ function X(e) {
766
+ return new je({
758
767
  color: 0,
759
768
  emissive: 16777215,
760
769
  emissiveIntensity: e
@@ -762,31 +771,27 @@ function Y(e) {
762
771
  }
763
772
  //#endregion
764
773
  //#region src/loops/gl/PrimitiveEngine.js
765
- var gt = "#0b0b0e", _t = .004, vt = 24, yt = class {
774
+ var bt = "#0b0b0e", xt = .004, St = 24, Ct = class {
766
775
  constructor(e, { autoLoop: t = !1 } = {}) {
767
- this.canvas = e, this.autoLoop = t, this.renderer = new D({
776
+ this.canvas = e, this.autoLoop = t, this.renderer = new N({
768
777
  canvas: e,
769
778
  antialias: !0,
770
779
  preserveDrawingBuffer: !0,
771
780
  alpha: !0
772
- }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new M(gt), 1), this.scene = new E(), this.camera = new w(38, 1, .1, 100), this.camera.position.set(0, .6, 4), this.camera.lookAt(0, 0, 0), this.controls = new R(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 2, this.controls.maxDistance = 14, this.scene.add(new je(16777215, .35)), this.scene.add(new ve(13424383, 2105384, .5));
773
- let r = new H(16777215, 1.5);
774
- r.position.set(3, 4, 2), this.scene.add(r);
775
- let i = new H(10070783, .5);
776
- i.position.set(-3, -1, -2), this.scene.add(i), this.pmrem = new ke(this.renderer), this.envTex = null, this.color = "#b9c2d0", this.roughness = .38, this.metalness = .18, this.flat = !1, this.matType = "standard", this.material = this.makeMaterial("standard"), this.lineMat = new lt({
781
+ }), this.renderer.setPixelRatio(x()), this.renderer.setClearColor(new V(bt), 1), this.scene = new w(), this.camera = new L(38, 1, .1, 100), this.camera.position.set(0, .6, 4), this.camera.lookAt(0, 0, 0), this.controls = new B(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 2, this.controls.maxDistance = 14, this.ambient = new Me(16777215, .35), this.hemi = new Oe(13424383, 2105384, .5), this.key = new k(16777215, 1.5), this.key.position.set(3, 4, 2), this.fill = new k(10070783, .5), this.fill.position.set(-3, -1, -2), this.rim = new k(16777215, 0), this.rim.position.set(0, 2, -4), this.scene.add(this.ambient, this.hemi, this.key, this.fill, this.rim), this.pmrem = new Ae(this.renderer), this.envTex = null, this.color = "#b9c2d0", this.roughness = .38, this.metalness = .18, this.flat = !1, this.matType = "standard", this.material = this.makeMaterial("standard"), this.lineMat = new pt({
777
782
  color: 12174032,
778
- linewidth: 3 * _t,
783
+ linewidth: 3 * xt,
779
784
  worldUnits: !0
780
785
  }), this.primId = "box", this.params = {
781
786
  tube: .32,
782
787
  p: 2,
783
788
  q: 3,
784
789
  detail: 0
785
- }, this.rounding = .22, this.activeGeom = this.buildGeometry(this.primId), this.wireGeom = new mt(this.activeGeom), this.items = [], this.layoutPos = [[
790
+ }, this.rounding = .22, this.activeGeom = this.buildGeometry(this.primId), this.wireGeom = new vt(this.activeGeom), this.items = [], this.layoutPos = [[
786
791
  0,
787
792
  0,
788
793
  0
789
- ]], this.setCount(1), this.axes = new Fe(1), this.axes.material.transparent = !0, this.axes.material.opacity = .7, this.axes.visible = !1, this.scene.add(this.axes), this.presets = Object.fromEntries(n.map((e) => [e.id, e.sample])), this.dur = 8, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
794
+ ]], this.setCount(1), this.axes = new xe(1), this.axes.material.transparent = !0, this.axes.material.opacity = .7, this.axes.visible = !1, this.scene.add(this.axes), this.presets = Object.fromEntries(c.map((e) => [e.id, e.sample])), this.dur = 8, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
790
795
  preset: "spin",
791
796
  animMode: "preset",
792
797
  keyframes: [],
@@ -820,36 +825,73 @@ var gt = "#0b0b0e", _t = .004, vt = 24, yt = class {
820
825
  switch (e) {
821
826
  case "box": {
822
827
  let e = Math.min(Math.max(this.rounding, 0), .7);
823
- return e > 0 ? new at(1.5, 1.5, 1.5, 6, e) : new F(1.5, 1.5, 1.5);
828
+ return e > 0 ? new lt(1.5, 1.5, 1.5, 6, e) : new P(1.5, 1.5, 1.5);
824
829
  }
825
- case "sphere": return new he(1, 64, 48);
826
- case "torus": return new Ae(.78, t.tube ?? .32, 48, 96);
827
- case "torusKnot": return new Pe(.7, .26, 160, 32, t.p ?? 2, t.q ?? 3);
828
- case "cone": return new Se(.95, 1.7, 64);
829
- case "cylinder": return new Re(.8, .8, 1.6, 64);
830
- case "icosahedron": return new oe(1.1, t.detail ?? 0);
831
- case "octahedron": return new ce(1.15, t.detail ?? 0);
832
- case "dodecahedron": return new Ce(1.05, t.detail ?? 0);
833
- default: return new F(1.5, 1.5, 1.5);
830
+ case "sphere": return new De(1, 64, 48);
831
+ case "torus": return new ge(.78, t.tube ?? .32, 48, 96);
832
+ case "torusKnot": return new Ue(.7, .26, 160, 32, t.p ?? 2, t.q ?? 3);
833
+ case "cone": return new ye(.95, 1.7, 64);
834
+ case "cylinder": return new Ve(.8, .8, 1.6, 64);
835
+ case "icosahedron": return new ie(1.1, t.detail ?? 0);
836
+ case "octahedron": return new ke(1.15, t.detail ?? 0);
837
+ case "dodecahedron": return new oe(1.05, t.detail ?? 0);
838
+ case "mesh": return this.meshGeom ?? new ie(.6, 1);
839
+ default: return new P(1.5, 1.5, 1.5);
834
840
  }
835
841
  }
836
842
  rebuildGeometry() {
837
843
  let e = this.activeGeom, t = this.wireGeom;
838
- this.activeGeom = this.buildGeometry(this.primId), this.wireGeom = new mt(this.activeGeom);
844
+ this.activeGeom = this.buildGeometry(this.primId), this.wireGeom = new vt(this.activeGeom);
839
845
  for (let e of this.items) e.mesh.geometry = this.activeGeom, e.wire.geometry = this.wireGeom;
840
- e.dispose(), t.dispose();
846
+ e !== this.meshGeom && e.dispose(), t.dispose();
847
+ }
848
+ async setMeshSrc(e, t = null) {
849
+ if (e === this.meshSrc || (this.meshSrc = e, !e)) return;
850
+ let n = (t || (e.split("?")[0].match(/\.([a-z0-9]+)$/i)?.[1] ?? "")).toLowerCase();
851
+ try {
852
+ let t = [];
853
+ if (n === "stl") {
854
+ let { STLLoader: n } = await import("./STLLoader-C6DGLf6r.js");
855
+ t.push(await new n().loadAsync(e));
856
+ } else {
857
+ let r = n === "glb" || n === "gltf" ? (await new (await (import("./GLTFLoader-BFir8PCc.js"))).GLTFLoader().loadAsync(e)).scene : await new (await (import("./OBJLoader-BgqC_-Jn.js"))).OBJLoader().loadAsync(e);
858
+ r.updateMatrixWorld(!0), r.traverse((e) => {
859
+ e.isMesh && e.geometry && t.push(e.geometry.clone().applyMatrix4(e.matrixWorld));
860
+ });
861
+ }
862
+ if (e !== this.meshSrc || !t.length) return;
863
+ let r = t.map((e) => {
864
+ let t = e.index ? e.toNonIndexed() : e, n = new z();
865
+ if (n.setAttribute("position", t.getAttribute("position")), t.getAttribute("normal")) return n.setAttribute("normal", t.getAttribute("normal")), n;
866
+ let r = We(n, 1e-6);
867
+ return r.computeVertexNormals(), r.toNonIndexed();
868
+ }), i = r.length > 1 ? Ge(r, !1) : r[0];
869
+ i.computeBoundingBox();
870
+ let a = new E(), o = new E();
871
+ i.boundingBox.getSize(a), i.boundingBox.getCenter(o), i.translate(-o.x, -o.y, -o.z);
872
+ let s = 1.7 / Math.max(a.x, a.y, a.z, 1e-6);
873
+ i.scale(s, s, s);
874
+ let c = this.meshGeom;
875
+ this.meshGeom = i, this.primId === "mesh" && this.rebuildGeometry(), c && c !== this.activeGeom && c.dispose(), this.step(0);
876
+ } catch (t) {
877
+ console.warn("[scene] mesh load failed", e, t?.message ?? t);
878
+ }
879
+ }
880
+ placeLights(e) {
881
+ let t = this.light ?? {}, n = (t.keyAngle ?? 37) * Math.PI / 180 + e * Math.PI * 2 * Math.round(t.orbit ?? 0), r = (t.keyElevation ?? 42) * Math.PI / 180;
882
+ this.key.position.set(Math.sin(n) * Math.cos(r) * 5, Math.sin(r) * 5, Math.cos(n) * Math.cos(r) * 5), this.fill.position.set(-this.key.position.x, -1, -this.key.position.z * .5), this.rim.position.set(-Math.sin(n) * 4, 2, -Math.cos(n) * 4);
841
883
  }
842
884
  makeMaterial(e) {
843
- let t = new M(this.color);
885
+ let t = new V(this.color);
844
886
  switch (e) {
845
- case "normal": return new le({ flatShading: this.flat });
846
- case "phong": return new fe({
887
+ case "normal": return new Ie({ flatShading: this.flat });
888
+ case "phong": return new Ee({
847
889
  color: t,
848
890
  flatShading: this.flat,
849
891
  shininess: 60
850
892
  });
851
- case "toon": return new re({ color: t });
852
- case "glass": return new ge({
893
+ case "toon": return new Le({ color: t });
894
+ case "glass": return new ve({
853
895
  color: t,
854
896
  metalness: 0,
855
897
  roughness: this.roughness,
@@ -858,7 +900,7 @@ var gt = "#0b0b0e", _t = .004, vt = 24, yt = class {
858
900
  ior: 1.4,
859
901
  flatShading: this.flat
860
902
  });
861
- case "dispersion": return new ge({
903
+ case "dispersion": return new ve({
862
904
  color: t,
863
905
  metalness: 0,
864
906
  roughness: this.roughness,
@@ -868,7 +910,7 @@ var gt = "#0b0b0e", _t = .004, vt = 24, yt = class {
868
910
  dispersion: 6,
869
911
  flatShading: this.flat
870
912
  });
871
- default: return new ze({
913
+ default: return new Ne({
872
914
  color: t,
873
915
  roughness: this.roughness,
874
916
  metalness: this.metalness,
@@ -888,8 +930,8 @@ var gt = "#0b0b0e", _t = .004, vt = 24, yt = class {
888
930
  e.color && this.matType !== "normal" && e.color.set(this.color), "roughness" in e && (e.roughness = this.roughness), "metalness" in e && this.matType !== "glass" && this.matType !== "dispersion" && (e.metalness = this.metalness), "flatShading" in e && e.flatShading !== this.flat && (e.flatShading = this.flat, e.needsUpdate = !0), this.lineMat.color.set(this.color);
889
931
  }
890
932
  setCount(e) {
891
- for (e = Math.max(1, Math.min(vt, Math.round(e))); this.items.length < e;) {
892
- let e = new C(this.activeGeom, this.material), t = new pt(this.wireGeom, this.lineMat);
933
+ for (e = Math.max(1, Math.min(St, Math.round(e))); this.items.length < e;) {
934
+ let e = new F(this.activeGeom, this.material), t = new _t(this.wireGeom, this.lineMat);
893
935
  t.visible = !1, this.scene.add(e), this.scene.add(t), this.items.push({
894
936
  mesh: e,
895
937
  wire: t
@@ -901,7 +943,7 @@ var gt = "#0b0b0e", _t = .004, vt = 24, yt = class {
901
943
  }
902
944
  }
903
945
  ensureEnv() {
904
- return this.envTex ||= this.pmrem.fromScene(new ht(), .04).texture, this.envTex;
946
+ return this.envTex ||= this.pmrem.fromScene(new yt(), .04).texture, this.envTex;
905
947
  }
906
948
  update({ globals: e, primitive: t, params: n } = {}) {
907
949
  let r = !1;
@@ -909,32 +951,36 @@ var gt = "#0b0b0e", _t = .004, vt = 24, yt = class {
909
951
  ...this.params,
910
952
  ...n
911
953
  }, r = !0), e) {
912
- this.globals = e, this.color = e.color || this.color, this.roughness = e.roughness ?? this.roughness, this.metalness = e.metalness ?? this.metalness, this.flat = !!e.flatShading, this.setMaterialType(e.materialType || "standard"), this.applyMaterialProps();
954
+ if (this.globals = e, (this.primId === "mesh" || e.meshSrc) && this.setMeshSrc(e.meshSrc ?? null, e.meshType ?? null), this.light = e.light ?? this.light, this.light) {
955
+ let e = this.light;
956
+ this.key.intensity = e.key ?? 1.5, this.fill.intensity = e.fill ?? .5, this.rim.intensity = e.rim ?? 0, this.ambient.intensity = e.ambient ?? .35, this.hemi.intensity = (e.ambient ?? .35) * (.5 / .35);
957
+ }
958
+ this.color = e.color || this.color, this.roughness = e.roughness ?? this.roughness, this.metalness = e.metalness ?? this.metalness, this.flat = !!e.flatShading, this.setMaterialType(e.materialType || "standard"), this.applyMaterialProps();
913
959
  let t = !!e.wireframe;
914
960
  for (let e of this.items) e.mesh.visible = !t, e.wire.visible = t;
915
- this.lineMat.linewidth = (e.strokeWidth ?? 3) * _t, e.rounding != null && e.rounding !== this.rounding && (this.rounding = e.rounding, this.primId === "box" && (r = !0)), this.setCount(e.count ?? 1), this.layoutPos = m(e.arrangement || "single", e.count ?? 1, e.spread ?? 2.2), e.duration && (this.dur = e.duration), e.fov != null && e.fov !== this.camera.fov && (this.camera.fov = e.fov, this.camera.updateProjectionMatrix()), this.scene.environment = e.environment ? this.ensureEnv() : null, this.axes.visible = !!e.showAxis, this.axes.scale.setScalar(e.axisLength ?? 1.5), this.axes.material.opacity = e.axisOpacity ?? .7;
961
+ this.lineMat.linewidth = (e.strokeWidth ?? 3) * xt, e.rounding != null && e.rounding !== this.rounding && (this.rounding = e.rounding, this.primId === "box" && (r = !0)), this.setCount(e.count ?? 1), this.layoutPos = i(e.arrangement || "single", e.count ?? 1, e.spread ?? 2.2), e.duration && (this.dur = e.duration), e.fov != null && e.fov !== this.camera.fov && (this.camera.fov = e.fov, this.camera.updateProjectionMatrix()), this.scene.environment = e.environment ? this.ensureEnv() : null, this.axes.visible = !!e.showAxis, this.axes.scale.setScalar(e.axisLength ?? 1.5), this.axes.material.opacity = e.axisOpacity ?? .7;
916
962
  }
917
963
  r && this.rebuildGeometry();
918
964
  }
919
965
  resize(e, t) {
920
- this.renderer.setSize(e, t, !1), this.camera.aspect = e / t, this.camera.updateProjectionMatrix(), this.lineMat.resolution.set(e, t), this.w = e, this.h = t;
966
+ this.renderer.setPixelRatio(x()), this.renderer.setSize(e, t, !1), this.camera.aspect = e / t, this.camera.updateProjectionMatrix(), this.lineMat.resolution.set(e, t), this.w = e, this.h = t;
921
967
  }
922
968
  seek(e) {
923
969
  this.accum = Math.max(0, Math.min(1, e)) * this.dur;
924
970
  }
925
971
  setBackground(e) {
926
- this.renderer.setClearColor(new M(e), 1);
972
+ this.renderer.setClearColor(new V(e), 1);
927
973
  }
928
974
  resetCamera() {
929
975
  this.camera.position.set(0, .6, 4), this.controls.target.set(0, 0, 0), this.controls.update();
930
976
  }
931
977
  poseAt(e) {
932
978
  let t = this.globals;
933
- return t.animMode === "keyframe" ? te(t.keyframes, e) : (this.presets[t.preset] || this.presets.spin)(e);
979
+ return t.animMode === "keyframe" ? ne(t.keyframes, e) : (this.presets[t.preset] || this.presets.spin)(e);
934
980
  }
935
981
  _applyLive(e) {
936
982
  let t = this.material;
937
- Number.isFinite(e.roughness) && "roughness" in t && (t.roughness = e.roughness), Number.isFinite(e.metalness) && "metalness" in t && this.matType !== "glass" && this.matType !== "dispersion" && (t.metalness = e.metalness), Number.isFinite(e.strokeWidth) && (this.lineMat.linewidth = e.strokeWidth * _t), Number.isFinite(e.fov) && e.fov !== this.camera.fov && (this.camera.fov = e.fov, this.camera.updateProjectionMatrix()), Number.isFinite(e.axisLength) && this.axes.scale.setScalar(e.axisLength), Number.isFinite(e.axisOpacity) && (this.axes.material.opacity = e.axisOpacity);
983
+ Number.isFinite(e.roughness) && "roughness" in t && (t.roughness = e.roughness), Number.isFinite(e.metalness) && "metalness" in t && this.matType !== "glass" && this.matType !== "dispersion" && (t.metalness = e.metalness), Number.isFinite(e.strokeWidth) && (this.lineMat.linewidth = e.strokeWidth * xt), Number.isFinite(e.fov) && e.fov !== this.camera.fov && (this.camera.fov = e.fov, this.camera.updateProjectionMatrix()), Number.isFinite(e.axisLength) && this.axes.scale.setScalar(e.axisLength), Number.isFinite(e.axisOpacity) && (this.axes.material.opacity = e.axisOpacity);
938
984
  }
939
985
  frame(e) {
940
986
  this.step(e);
@@ -950,7 +996,9 @@ var gt = "#0b0b0e", _t = .004, vt = 24, yt = class {
950
996
  t: n,
951
997
  dur: this.dur
952
998
  });
953
- let r = this.dur > 0 ? n / this.dur : 0, i = t, a = this.items.length, o = i.stagger ?? 0, s = i.objectSize ?? 1, c = 1 + 0 * (i.audioAmount ?? 1);
999
+ let r = this.dur > 0 ? n / this.dur : 0;
1000
+ this.placeLights(r);
1001
+ let i = t, a = this.items.length, o = i.stagger ?? 0, s = i.objectSize ?? 1, c = 1 + 0 * (i.audioAmount ?? 1);
954
1002
  for (let e = 0; e < a; e++) {
955
1003
  let t = this.items[e], n = a > 1 ? (r + e / a * o) % 1 : r, i = this.poseAt(n), l = i.rot || [
956
1004
  0,
@@ -1003,23 +1051,23 @@ var gt = "#0b0b0e", _t = .004, vt = 24, yt = class {
1003
1051
  dispose() {
1004
1052
  cancelAnimationFrame(this.raf), this.controls.dispose(), this.material.dispose(), this.lineMat.dispose(), this.activeGeom.dispose(), this.wireGeom.dispose(), this.axes.geometry.dispose(), this.axes.material.dispose(), this.envTex?.dispose(), this.pmrem.dispose(), this.renderer.dispose();
1005
1053
  }
1006
- }, bt = Math.PI * 2, xt = "#0b0b0e";
1007
- function St() {
1054
+ }, wt = Math.PI * 2, Tt = "#0b0b0e";
1055
+ function Et() {
1008
1056
  let e = document.createElement("canvas");
1009
1057
  e.width = e.height = 64;
1010
1058
  let t = e.getContext("2d"), n = t.createRadialGradient(64 / 2, 64 / 2, 0, 64 / 2, 64 / 2, 64 / 2);
1011
1059
  n.addColorStop(0, "rgba(255,255,255,1)"), n.addColorStop(.55, "rgba(255,255,255,0.85)"), n.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = n, t.fillRect(0, 0, 64, 64);
1012
- let r = new Me(e);
1060
+ let r = new Ce(e);
1013
1061
  return r.needsUpdate = !0, r;
1014
1062
  }
1015
- var Ct = class {
1063
+ var Dt = class {
1016
1064
  constructor(e, { autoLoop: t = !1 } = {}) {
1017
- this.autoLoop = t, this.canvas = e, this.renderer = new D({
1065
+ this.autoLoop = t, this.canvas = e, this.renderer = new N({
1018
1066
  canvas: e,
1019
1067
  antialias: !0,
1020
1068
  preserveDrawingBuffer: !0,
1021
1069
  alpha: !0
1022
- }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new M(xt), 1), this.scene = new E(), this.scene.fog = new _e(new M(xt), 3.2, 9.5), this.camera = new w(40, 1, .1, 100), this.camera.position.set(0, .4, 4.4), this.camera.lookAt(0, 0, 0), this.controls = new R(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 2, this.controls.maxDistance = 14, this.sprite = St(), this.material = new ue({
1070
+ }), this.renderer.setPixelRatio(x()), this.renderer.setClearColor(new V(Tt), 1), this.scene = new w(), this.scene.fog = new ce(new V(Tt), 3.2, 9.5), this.camera = new L(40, 1, .1, 100), this.camera.position.set(0, .4, 4.4), this.camera.lookAt(0, 0, 0), this.controls = new B(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 2, this.controls.maxDistance = 14, this.sprite = Et(), this.material = new be({
1023
1071
  map: this.sprite,
1024
1072
  vertexColors: !0,
1025
1073
  size: .05,
@@ -1027,7 +1075,7 @@ var Ct = class {
1027
1075
  transparent: !0,
1028
1076
  alphaTest: .4,
1029
1077
  depthWrite: !0
1030
- }), this.geometry = new A(), this.points = new Ne(this.geometry, this.material), this.scene.add(this.points), this.form = "helix", this.samples = 30, this.colFg = "#e5dfcf", this.colAccent = "#8b8fd6", this.posArr = null, this.colArr = null, this.vparArr = null, this.count = 0, this._rebuild(), this.dur = 8, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
1078
+ }), this.geometry = new z(), this.points = new He(this.geometry, this.material), this.scene.add(this.points), this.form = "helix", this.samples = 30, this.colFg = "#e5dfcf", this.colAccent = "#8b8fd6", this.posArr = null, this.colArr = null, this.vparArr = null, this.count = 0, this._rebuild(), this.dur = 8, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
1031
1079
  form: "helix",
1032
1080
  samples: 30,
1033
1081
  cycles: 2,
@@ -1048,14 +1096,14 @@ var Ct = class {
1048
1096
  }, this.onProgress = null, this.autoLoop && (this.raf = requestAnimationFrame(this.loop));
1049
1097
  }
1050
1098
  _rebuild() {
1051
- this.count = r(this.form, this.samples), this.posArr = new Float32Array(this.count * 3), this.colArr = new Float32Array(this.count * 3), this.vparArr = new Float32Array(this.count), l(this.form, this.samples, this.vparArr);
1052
- let e = new A();
1053
- e.setAttribute("position", new z(this.posArr, 3)), e.setAttribute("color", new z(this.colArr, 3));
1099
+ this.count = p(this.form, this.samples), this.posArr = new Float32Array(this.count * 3), this.colArr = new Float32Array(this.count * 3), this.vparArr = new Float32Array(this.count), n(this.form, this.samples, this.vparArr);
1100
+ let e = new z();
1101
+ e.setAttribute("position", new I(this.posArr, 3)), e.setAttribute("color", new I(this.colArr, 3));
1054
1102
  let t = this.geometry;
1055
1103
  this.geometry = e, this.points.geometry = e, t.dispose(), this._recolor();
1056
1104
  }
1057
1105
  _recolor() {
1058
- let e = new M(this.colFg), t = new M(this.colAccent), n = this.colArr;
1106
+ let e = new V(this.colFg), t = new V(this.colAccent), n = this.colArr;
1059
1107
  for (let r = 0; r < this.count; r++) {
1060
1108
  let i = this.vparArr[r];
1061
1109
  n[r * 3] = t.r + (e.r - t.r) * i, n[r * 3 + 1] = t.g + (e.g - t.g) * i, n[r * 3 + 2] = t.b + (e.b - t.b) * i;
@@ -1071,13 +1119,13 @@ var Ct = class {
1071
1119
  } else n && this._rebuild();
1072
1120
  }
1073
1121
  resize(e, t) {
1074
- this.renderer.setSize(e, t, !1), this.camera.aspect = e / t, this.camera.updateProjectionMatrix(), this.w = e, this.h = t;
1122
+ this.renderer.setPixelRatio(x()), this.renderer.setSize(e, t, !1), this.camera.aspect = e / t, this.camera.updateProjectionMatrix(), this.w = e, this.h = t;
1075
1123
  }
1076
1124
  seek(e) {
1077
1125
  this.accum = Math.max(0, Math.min(1, e)) * this.dur;
1078
1126
  }
1079
1127
  setBackground(e) {
1080
- let t = new M(e);
1128
+ let t = new V(e);
1081
1129
  this.renderer.setClearColor(t, 1), this.scene.fog && this.scene.fog.color.copy(t);
1082
1130
  }
1083
1131
  resetCamera() {
@@ -1097,8 +1145,8 @@ var Ct = class {
1097
1145
  t: n,
1098
1146
  dur: this.dur
1099
1147
  });
1100
- let r = (this.dur > 0 ? n / this.dur : 0) * bt * (t.cycles ?? 2);
1101
- if (g(this.form, this.samples, r, {
1148
+ let r = (this.dur > 0 ? n / this.dur : 0) * wt * (t.cycles ?? 2);
1149
+ if (y(this.form, this.samples, r, {
1102
1150
  amp: t.amp ?? .35,
1103
1151
  turns: t.turns,
1104
1152
  radius: t.radius,
@@ -1139,7 +1187,7 @@ var Ct = class {
1139
1187
  dispose() {
1140
1188
  cancelAnimationFrame(this.raf), this.controls.dispose(), this.material.dispose(), this.sprite.dispose(), this.geometry.dispose(), this.renderer.dispose();
1141
1189
  }
1142
- }, wt = Math.PI * 2, Tt = "#0b0b0e", Et = {
1190
+ }, Ot = Math.PI * 2, kt = "#0b0b0e", At = {
1143
1191
  mountain: {
1144
1192
  pos: [
1145
1193
  0,
@@ -1179,17 +1227,17 @@ var Ct = class {
1179
1227
  ],
1180
1228
  fov: 70
1181
1229
  }
1182
- }, Dt = class {
1230
+ }, jt = class {
1183
1231
  constructor(e, { autoLoop: t = !1 } = {}) {
1184
- this.autoLoop = t, this.canvas = e, this.renderer = new D({
1232
+ this.autoLoop = t, this.canvas = e, this.renderer = new N({
1185
1233
  canvas: e,
1186
1234
  antialias: !0,
1187
1235
  preserveDrawingBuffer: !0,
1188
1236
  alpha: !0
1189
- }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new M(Tt), 1), this.scene = new E(), this.scene.fog = new _e(new M(Tt), 3, 11), this.camera = new w(45, 1, .1, 100), this.controls = new R(this.camera, e), this.controls.enableDamping = !0, this.controls.minDistance = .1, this.controls.maxDistance = 16, this.material = new me({
1237
+ }), this.renderer.setPixelRatio(x()), this.renderer.setClearColor(new V(kt), 1), this.scene = new w(), this.scene.fog = new ce(new V(kt), 3, 11), this.camera = new L(45, 1, .1, 100), this.controls = new B(this.camera, e), this.controls.enableDamping = !0, this.controls.minDistance = .1, this.controls.maxDistance = 16, this.material = new Re({
1190
1238
  vertexColors: !0,
1191
1239
  side: 2
1192
- }), this.geometry = new A(), this.mesh = new C(this.geometry, this.material), this.scene.add(this.mesh), this.env = "mountain", this.samples = 48, this.colFg = "#e5dfcf", this.colAccent = "#8b8fd6", this.posArr = null, this.colArr = null, this.vparArr = null, this._rebuild(), this.resetCamera(), this.dur = 8, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
1240
+ }), this.geometry = new z(), this.mesh = new F(this.geometry, this.material), this.scene.add(this.mesh), this.env = "mountain", this.samples = 48, this.colFg = "#e5dfcf", this.colAccent = "#8b8fd6", this.posArr = null, this.colArr = null, this.vparArr = null, this._rebuild(), this.resetCamera(), this.dur = 8, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
1193
1241
  env: "mountain",
1194
1242
  samples: 48,
1195
1243
  cycles: 2,
@@ -1207,14 +1255,14 @@ var Ct = class {
1207
1255
  }
1208
1256
  _rebuild() {
1209
1257
  let e = this.samples * this.samples;
1210
- this.posArr = new Float32Array(e * 3), this.colArr = new Float32Array(e * 3), this.vparArr = new Float32Array(e), c(this.env, this.samples, this.vparArr);
1211
- let t = new A();
1212
- t.setAttribute("position", new z(this.posArr, 3)), t.setAttribute("color", new z(this.colArr, 3)), t.setIndex(new z(v(this.env, this.samples), 1));
1258
+ this.posArr = new Float32Array(e * 3), this.colArr = new Float32Array(e * 3), this.vparArr = new Float32Array(e), l(this.env, this.samples, this.vparArr);
1259
+ let t = new z();
1260
+ t.setAttribute("position", new I(this.posArr, 3)), t.setAttribute("color", new I(this.colArr, 3)), t.setIndex(new I(f(this.env, this.samples), 1));
1213
1261
  let n = this.geometry;
1214
1262
  this.geometry = t, this.mesh.geometry = t, n.dispose(), this._recolor();
1215
1263
  }
1216
1264
  _recolor() {
1217
- let e = new M(this.colFg), t = new M(this.colAccent), n = this.colArr, r = this.samples * this.samples;
1265
+ let e = new V(this.colFg), t = new V(this.colAccent), n = this.colArr, r = this.samples * this.samples;
1218
1266
  for (let i = 0; i < r; i++) {
1219
1267
  let r = this.vparArr[i];
1220
1268
  n[i * 3] = t.r + (e.r - t.r) * r, n[i * 3 + 1] = t.g + (e.g - t.g) * r, n[i * 3 + 2] = t.b + (e.b - t.b) * r;
@@ -1230,17 +1278,17 @@ var Ct = class {
1230
1278
  } else n && this._rebuild();
1231
1279
  }
1232
1280
  resize(e, t) {
1233
- this.renderer.setSize(e, t, !1), this.camera.aspect = e / t, this.camera.updateProjectionMatrix(), this.w = e, this.h = t;
1281
+ this.renderer.setPixelRatio(x()), this.renderer.setSize(e, t, !1), this.camera.aspect = e / t, this.camera.updateProjectionMatrix(), this.w = e, this.h = t;
1234
1282
  }
1235
1283
  seek(e) {
1236
1284
  this.accum = Math.max(0, Math.min(1, e)) * this.dur;
1237
1285
  }
1238
1286
  setBackground(e) {
1239
- let t = new M(e);
1287
+ let t = new V(e);
1240
1288
  this.renderer.setClearColor(t, 1), this.scene.fog && this.scene.fog.color.copy(t);
1241
1289
  }
1242
1290
  resetCamera() {
1243
- let e = Et[this.env] || Et.mountain;
1291
+ let e = At[this.env] || At.mountain;
1244
1292
  this.camera.position.set(...e.pos), this.camera.fov = this.globals?.fov ?? e.fov, this.camera.updateProjectionMatrix(), this.controls.target.set(...e.target), this.controls.update();
1245
1293
  }
1246
1294
  frame(e) {
@@ -1257,8 +1305,8 @@ var Ct = class {
1257
1305
  t: n,
1258
1306
  dur: this.dur
1259
1307
  });
1260
- let r = (this.dur > 0 ? n / this.dur : 0) * wt * (t.cycles ?? 2);
1261
- if (_(this.env, this.samples, r, { amp: t.amp ?? .5 }, this.posArr), this.geometry.attributes.position.needsUpdate = !0, this.geometry.computeVertexNormals(), this.controls.autoRotate = !this.recording && !!t.spin && !t.paused && !f(this.env), this.controls.autoRotateSpeed = 2 * (t.spinSpeed ?? 1), this.controls.update(), this.w && this.h && this.renderer.render(this.scene, this.camera), this.recording && this.accum >= this.dur && this._recStop) {
1308
+ let i = (this.dur > 0 ? n / this.dur : 0) * Ot * (t.cycles ?? 2);
1309
+ if (o(this.env, this.samples, i, { amp: t.amp ?? .5 }, this.posArr), this.geometry.attributes.position.needsUpdate = !0, this.geometry.computeVertexNormals(), this.controls.autoRotate = !this.recording && !!t.spin && !t.paused && !r(this.env), this.controls.autoRotateSpeed = 2 * (t.spinSpeed ?? 1), this.controls.update(), this.w && this.h && this.renderer.render(this.scene, this.camera), this.recording && this.accum >= this.dur && this._recStop) {
1262
1310
  let e = this._recStop;
1263
1311
  this._recStop = null, e();
1264
1312
  }
@@ -1294,7 +1342,7 @@ var Ct = class {
1294
1342
  dispose() {
1295
1343
  cancelAnimationFrame(this.raf), this.controls.dispose(), this.material.dispose(), this.geometry.dispose(), this.renderer.dispose();
1296
1344
  }
1297
- }, Ot = {
1345
+ }, Mt = {
1298
1346
  name: "CopyShader",
1299
1347
  uniforms: {
1300
1348
  tDiffuse: { value: null },
@@ -1302,7 +1350,7 @@ var Ct = class {
1302
1350
  },
1303
1351
  vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
1304
1352
  fragmentShader: "\n\n uniform float opacity;\n\n uniform sampler2D tDiffuse;\n\n varying vec2 vUv;\n\n void main() {\n\n vec4 texel = texture2D( tDiffuse, vUv );\n gl_FragColor = opacity * texel;\n\n\n }"
1305
- }, X = class {
1353
+ }, Z = class {
1306
1354
  constructor() {
1307
1355
  this.isPass = !0, this.enabled = !0, this.needsSwap = !0, this.clear = !1, this.renderToScreen = !1;
1308
1356
  }
@@ -1311,9 +1359,9 @@ var Ct = class {
1311
1359
  console.error("THREE.Pass: .render() must be implemented in derived pass.");
1312
1360
  }
1313
1361
  dispose() {}
1314
- }, kt = new ye(-1, 1, 1, -1, 0, 1), At = new class extends A {
1362
+ }, Nt = new we(-1, 1, 1, -1, 0, 1), Pt = new class extends z {
1315
1363
  constructor() {
1316
- super(), this.setAttribute("position", new V([
1364
+ super(), this.setAttribute("position", new A([
1317
1365
  -1,
1318
1366
  3,
1319
1367
  0,
@@ -1323,7 +1371,7 @@ var Ct = class {
1323
1371
  3,
1324
1372
  -1,
1325
1373
  0
1326
- ], 3)), this.setAttribute("uv", new V([
1374
+ ], 3)), this.setAttribute("uv", new A([
1327
1375
  0,
1328
1376
  2,
1329
1377
  0,
@@ -1332,15 +1380,15 @@ var Ct = class {
1332
1380
  0
1333
1381
  ], 2));
1334
1382
  }
1335
- }(), jt = class {
1383
+ }(), Ft = class {
1336
1384
  constructor(e) {
1337
- this._mesh = new C(At, e);
1385
+ this._mesh = new F(Pt, e);
1338
1386
  }
1339
1387
  dispose() {
1340
1388
  this._mesh.geometry.dispose();
1341
1389
  }
1342
1390
  render(e) {
1343
- e.render(this._mesh, kt);
1391
+ e.render(this._mesh, Nt);
1344
1392
  }
1345
1393
  get material() {
1346
1394
  return this._mesh.material;
@@ -1348,15 +1396,15 @@ var Ct = class {
1348
1396
  set material(e) {
1349
1397
  this._mesh.material = e;
1350
1398
  }
1351
- }, Mt = class extends X {
1399
+ }, It = class extends Z {
1352
1400
  constructor(e, t = "tDiffuse") {
1353
- super(), this.textureID = t, this.uniforms = null, this.material = null, e instanceof T ? (this.uniforms = e.uniforms, this.material = e) : e && (this.uniforms = P.clone(e.uniforms), this.material = new T({
1401
+ super(), this.textureID = t, this.uniforms = null, this.material = null, e instanceof C ? (this.uniforms = e.uniforms, this.material = e) : e && (this.uniforms = S.clone(e.uniforms), this.material = new C({
1354
1402
  name: e.name === void 0 ? "unspecified" : e.name,
1355
1403
  defines: Object.assign({}, e.defines),
1356
1404
  uniforms: this.uniforms,
1357
1405
  vertexShader: e.vertexShader,
1358
1406
  fragmentShader: e.fragmentShader
1359
- })), this._fsQuad = new jt(this.material);
1407
+ })), this._fsQuad = new Ft(this.material);
1360
1408
  }
1361
1409
  render(e, t, n) {
1362
1410
  this.uniforms[this.textureID] && (this.uniforms[this.textureID].value = n.texture), this._fsQuad.material = this.material, this.renderToScreen ? (e.setRenderTarget(null), this._fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), this._fsQuad.render(e));
@@ -1364,7 +1412,7 @@ var Ct = class {
1364
1412
  dispose() {
1365
1413
  this.material.dispose(), this._fsQuad.dispose();
1366
1414
  }
1367
- }, Nt = class extends X {
1415
+ }, Lt = class extends Z {
1368
1416
  constructor(e, t) {
1369
1417
  super(), this.scene = e, this.camera = t, this.clear = !0, this.needsSwap = !1, this.inverse = !1;
1370
1418
  }
@@ -1374,20 +1422,20 @@ var Ct = class {
1374
1422
  let a, o;
1375
1423
  this.inverse ? (a = 0, o = 1) : (a = 1, o = 0), i.buffers.stencil.setTest(!0), i.buffers.stencil.setOp(r.REPLACE, r.REPLACE, r.REPLACE), i.buffers.stencil.setFunc(r.ALWAYS, a, 4294967295), i.buffers.stencil.setClear(o), i.buffers.stencil.setLocked(!0), e.setRenderTarget(n), this.clear && e.clear(), e.render(this.scene, this.camera), e.setRenderTarget(t), this.clear && e.clear(), e.render(this.scene, this.camera), i.buffers.color.setLocked(!1), i.buffers.depth.setLocked(!1), i.buffers.color.setMask(!0), i.buffers.depth.setMask(!0), i.buffers.stencil.setLocked(!1), i.buffers.stencil.setFunc(r.EQUAL, 1, 4294967295), i.buffers.stencil.setOp(r.KEEP, r.KEEP, r.KEEP), i.buffers.stencil.setLocked(!0);
1376
1424
  }
1377
- }, Pt = class extends X {
1425
+ }, Rt = class extends Z {
1378
1426
  constructor() {
1379
1427
  super(), this.needsSwap = !1;
1380
1428
  }
1381
1429
  render(e) {
1382
1430
  e.state.buffers.stencil.setLocked(!1), e.state.buffers.stencil.setTest(!1);
1383
1431
  }
1384
- }, Ft = class {
1432
+ }, zt = class {
1385
1433
  constructor(e, t) {
1386
1434
  if (this.renderer = e, this._pixelRatio = e.getPixelRatio(), t === void 0) {
1387
- let n = e.getSize(new O());
1388
- this._width = n.width, this._height = n.height, t = new k(this._width * this._pixelRatio, this._height * this._pixelRatio, { type: B }), t.texture.name = "EffectComposer.rt1";
1435
+ let n = e.getSize(new j());
1436
+ this._width = n.width, this._height = n.height, t = new T(this._width * this._pixelRatio, this._height * this._pixelRatio, { type: O }), t.texture.name = "EffectComposer.rt1";
1389
1437
  } else this._width = t.width, this._height = t.height;
1390
- this.renderTarget1 = t, this.renderTarget2 = t.clone(), this.renderTarget2.texture.name = "EffectComposer.rt2", this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2, this.renderToScreen = !0, this.passes = [], this.copyPass = new Mt(Ot), this.copyPass.material.blending = 0, this.timer = new Le();
1438
+ this.renderTarget1 = t, this.renderTarget2 = t.clone(), this.renderTarget2.texture.name = "EffectComposer.rt2", this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2, this.renderToScreen = !0, this.passes = [], this.copyPass = new It(Mt), this.copyPass.material.blending = 0, this.timer = new de();
1391
1439
  }
1392
1440
  swapBuffers() {
1393
1441
  let e = this.readBuffer;
@@ -1420,14 +1468,14 @@ var Ct = class {
1420
1468
  }
1421
1469
  this.swapBuffers();
1422
1470
  }
1423
- Nt !== void 0 && (r instanceof Nt ? n = !0 : r instanceof Pt && (n = !1));
1471
+ Lt !== void 0 && (r instanceof Lt ? n = !0 : r instanceof Rt && (n = !1));
1424
1472
  }
1425
1473
  }
1426
1474
  this.renderer.setRenderTarget(t);
1427
1475
  }
1428
1476
  reset(e) {
1429
1477
  if (e === void 0) {
1430
- let t = this.renderer.getSize(new O());
1478
+ let t = this.renderer.getSize(new j());
1431
1479
  this._pixelRatio = this.renderer.getPixelRatio(), this._width = t.width, this._height = t.height, e = this.renderTarget1.clone(), e.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);
1432
1480
  }
1433
1481
  this.renderTarget1.dispose(), this.renderTarget2.dispose(), this.renderTarget1 = e, this.renderTarget2 = e.clone(), this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2;
@@ -1444,9 +1492,9 @@ var Ct = class {
1444
1492
  dispose() {
1445
1493
  this.renderTarget1.dispose(), this.renderTarget2.dispose(), this.copyPass.dispose();
1446
1494
  }
1447
- }, It = class extends X {
1495
+ }, Bt = class extends Z {
1448
1496
  constructor(e, t, n = null, r = null, i = null) {
1449
- super(), this.scene = e, this.camera = t, this.overrideMaterial = n, this.clearColor = r, this.clearAlpha = i, this.clear = !0, this.clearDepth = !1, this.needsSwap = !1, this.isRenderPass = !0, this._oldClearColor = new M();
1497
+ super(), this.scene = e, this.camera = t, this.overrideMaterial = n, this.clearColor = r, this.clearAlpha = i, this.clear = !0, this.clearDepth = !1, this.needsSwap = !1, this.isRenderPass = !0, this._oldClearColor = new V();
1450
1498
  }
1451
1499
  render(e, t, n) {
1452
1500
  let r = e.autoClear;
@@ -1454,30 +1502,30 @@ var Ct = class {
1454
1502
  let i, a;
1455
1503
  this.overrideMaterial !== null && (a = this.scene.overrideMaterial, this.scene.overrideMaterial = this.overrideMaterial), this.clearColor !== null && (e.getClearColor(this._oldClearColor), e.setClearColor(this.clearColor, e.getClearAlpha())), this.clearAlpha !== null && (i = e.getClearAlpha(), e.setClearAlpha(this.clearAlpha)), this.clearDepth == 1 && e.clearDepth(), e.setRenderTarget(this.renderToScreen ? null : n), this.clear === !0 && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), e.render(this.scene, this.camera), this.clearColor !== null && e.setClearColor(this._oldClearColor), this.clearAlpha !== null && e.setClearAlpha(i), this.overrideMaterial !== null && (this.scene.overrideMaterial = a), e.autoClear = r;
1456
1504
  }
1457
- }, Lt = {
1505
+ }, Vt = {
1458
1506
  name: "LuminosityHighPassShader",
1459
1507
  uniforms: {
1460
1508
  tDiffuse: { value: null },
1461
1509
  luminosityThreshold: { value: 1 },
1462
1510
  smoothWidth: { value: 1 },
1463
- defaultColor: { value: new M(0) },
1511
+ defaultColor: { value: new V(0) },
1464
1512
  defaultOpacity: { value: 0 }
1465
1513
  },
1466
1514
  vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
1467
1515
  fragmentShader: "\n\n uniform sampler2D tDiffuse;\n uniform vec3 defaultColor;\n uniform float defaultOpacity;\n uniform float luminosityThreshold;\n uniform float smoothWidth;\n\n varying vec2 vUv;\n\n void main() {\n\n vec4 texel = texture2D( tDiffuse, vUv );\n\n float v = luminance( texel.xyz );\n\n vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n gl_FragColor = mix( outputColor, texel, alpha );\n\n }"
1468
- }, Rt = class e extends X {
1516
+ }, Ht = class e extends Z {
1469
1517
  constructor(e, t = 1, n, r) {
1470
- super(), this.strength = t, this.radius = n, this.threshold = r, this.resolution = e === void 0 ? new O(256, 256) : new O(e.x, e.y), this.clearColor = new M(0, 0, 0), this.needsSwap = !1, this.renderTargetsHorizontal = [], this.renderTargetsVertical = [], this.nMips = 5;
1518
+ super(), this.strength = t, this.radius = n, this.threshold = r, this.resolution = e === void 0 ? new j(256, 256) : new j(e.x, e.y), this.clearColor = new V(0, 0, 0), this.needsSwap = !1, this.renderTargetsHorizontal = [], this.renderTargetsVertical = [], this.nMips = 5;
1471
1519
  let i = Math.round(this.resolution.x / 2), a = Math.round(this.resolution.y / 2);
1472
- this.renderTargetBright = new k(i, a, { type: B }), this.renderTargetBright.texture.name = "UnrealBloomPass.bright", this.renderTargetBright.texture.generateMipmaps = !1;
1520
+ this.renderTargetBright = new T(i, a, { type: O }), this.renderTargetBright.texture.name = "UnrealBloomPass.bright", this.renderTargetBright.texture.generateMipmaps = !1;
1473
1521
  for (let e = 0; e < this.nMips; e++) {
1474
- let t = new k(i, a, { type: B });
1522
+ let t = new T(i, a, { type: O });
1475
1523
  t.texture.name = "UnrealBloomPass.h" + e, t.texture.generateMipmaps = !1, this.renderTargetsHorizontal.push(t);
1476
- let n = new k(i, a, { type: B });
1524
+ let n = new T(i, a, { type: O });
1477
1525
  n.texture.name = "UnrealBloomPass.v" + e, n.texture.generateMipmaps = !1, this.renderTargetsVertical.push(n), i = Math.round(i / 2), a = Math.round(a / 2);
1478
1526
  }
1479
- let o = Lt;
1480
- this.highPassUniforms = P.clone(o.uniforms), this.highPassUniforms.luminosityThreshold.value = r, this.highPassUniforms.smoothWidth.value = .01, this.materialHighPassFilter = new T({
1527
+ let o = Vt;
1528
+ this.highPassUniforms = S.clone(o.uniforms), this.highPassUniforms.luminosityThreshold.value = r, this.highPassUniforms.smoothWidth.value = .01, this.materialHighPassFilter = new C({
1481
1529
  uniforms: this.highPassUniforms,
1482
1530
  vertexShader: o.vertexShader,
1483
1531
  fragmentShader: o.fragmentShader
@@ -1490,7 +1538,7 @@ var Ct = class {
1490
1538
  22
1491
1539
  ];
1492
1540
  i = Math.round(this.resolution.x / 2), a = Math.round(this.resolution.y / 2);
1493
- for (let e = 0; e < this.nMips; e++) this.separableBlurMaterials.push(this._getSeparableBlurMaterial(s[e])), this.separableBlurMaterials[e].uniforms.invSize.value = new O(1 / i, 1 / a), i = Math.round(i / 2), a = Math.round(a / 2);
1541
+ for (let e = 0; e < this.nMips; e++) this.separableBlurMaterials.push(this._getSeparableBlurMaterial(s[e])), this.separableBlurMaterials[e].uniforms.invSize.value = new j(1 / i, 1 / a), i = Math.round(i / 2), a = Math.round(a / 2);
1494
1542
  this.compositeMaterial = this._getCompositeMaterial(this.nMips), this.compositeMaterial.uniforms.blurTexture1.value = this.renderTargetsVertical[0].texture, this.compositeMaterial.uniforms.blurTexture2.value = this.renderTargetsVertical[1].texture, this.compositeMaterial.uniforms.blurTexture3.value = this.renderTargetsVertical[2].texture, this.compositeMaterial.uniforms.blurTexture4.value = this.renderTargetsVertical[3].texture, this.compositeMaterial.uniforms.blurTexture5.value = this.renderTargetsVertical[4].texture, this.compositeMaterial.uniforms.bloomStrength.value = t, this.compositeMaterial.uniforms.bloomRadius.value = .1;
1495
1543
  let c = [
1496
1544
  1,
@@ -1500,21 +1548,21 @@ var Ct = class {
1500
1548
  .2
1501
1549
  ];
1502
1550
  this.compositeMaterial.uniforms.bloomFactors.value = c, this.bloomTintColors = [
1503
- new I(1, 1, 1),
1504
- new I(1, 1, 1),
1505
- new I(1, 1, 1),
1506
- new I(1, 1, 1),
1507
- new I(1, 1, 1)
1508
- ], this.compositeMaterial.uniforms.bloomTintColors.value = this.bloomTintColors, this.copyUniforms = P.clone(Ot.uniforms), this.blendMaterial = new T({
1551
+ new E(1, 1, 1),
1552
+ new E(1, 1, 1),
1553
+ new E(1, 1, 1),
1554
+ new E(1, 1, 1),
1555
+ new E(1, 1, 1)
1556
+ ], this.compositeMaterial.uniforms.bloomTintColors.value = this.bloomTintColors, this.copyUniforms = S.clone(Mt.uniforms), this.blendMaterial = new C({
1509
1557
  uniforms: this.copyUniforms,
1510
- vertexShader: Ot.vertexShader,
1511
- fragmentShader: Ot.fragmentShader,
1558
+ vertexShader: Mt.vertexShader,
1559
+ fragmentShader: Mt.fragmentShader,
1512
1560
  premultipliedAlpha: !0,
1513
1561
  blending: 2,
1514
1562
  depthTest: !1,
1515
1563
  depthWrite: !1,
1516
1564
  transparent: !0
1517
- }), this._oldClearColor = new M(), this._oldClearAlpha = 1, this._basic = new me(), this._fsQuad = new jt(null);
1565
+ }), this._oldClearColor = new V(), this._oldClearAlpha = 1, this._basic = new Re(), this._fsQuad = new Ft(null);
1518
1566
  }
1519
1567
  dispose() {
1520
1568
  for (let e = 0; e < this.renderTargetsHorizontal.length; e++) this.renderTargetsHorizontal[e].dispose();
@@ -1526,7 +1574,7 @@ var Ct = class {
1526
1574
  setSize(e, t) {
1527
1575
  let n = Math.round(e / 2), r = Math.round(t / 2);
1528
1576
  this.renderTargetBright.setSize(n, r);
1529
- for (let e = 0; e < this.nMips; e++) this.renderTargetsHorizontal[e].setSize(n, r), this.renderTargetsVertical[e].setSize(n, r), this.separableBlurMaterials[e].uniforms.invSize.value = new O(1 / n, 1 / r), n = Math.round(n / 2), r = Math.round(r / 2);
1577
+ for (let e = 0; e < this.nMips; e++) this.renderTargetsHorizontal[e].setSize(n, r), this.renderTargetsVertical[e].setSize(n, r), this.separableBlurMaterials[e].uniforms.invSize.value = new j(1 / n, 1 / r), n = Math.round(n / 2), r = Math.round(r / 2);
1530
1578
  }
1531
1579
  render(t, n, r, i, a) {
1532
1580
  t.getClearColor(this._oldClearColor), this._oldClearAlpha = t.getClearAlpha();
@@ -1539,12 +1587,12 @@ var Ct = class {
1539
1587
  _getSeparableBlurMaterial(e) {
1540
1588
  let t = [], n = e / 3;
1541
1589
  for (let r = 0; r < e; r++) t.push(.39894 * Math.exp(-.5 * r * r / (n * n)) / n);
1542
- return new T({
1590
+ return new C({
1543
1591
  defines: { KERNEL_RADIUS: e },
1544
1592
  uniforms: {
1545
1593
  colorTexture: { value: null },
1546
- invSize: { value: new O(.5, .5) },
1547
- direction: { value: new O(.5, .5) },
1594
+ invSize: { value: new j(.5, .5) },
1595
+ direction: { value: new j(.5, .5) },
1548
1596
  gaussianCoefficients: { value: t }
1549
1597
  },
1550
1598
  vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
@@ -1552,7 +1600,7 @@ var Ct = class {
1552
1600
  });
1553
1601
  }
1554
1602
  _getCompositeMaterial(e) {
1555
- return new T({
1603
+ return new C({
1556
1604
  defines: { NUM_MIPS: e },
1557
1605
  uniforms: {
1558
1606
  blurTexture1: { value: null },
@@ -1570,10 +1618,10 @@ var Ct = class {
1570
1618
  });
1571
1619
  }
1572
1620
  };
1573
- Rt.BlurDirectionX = new O(1, 0), Rt.BlurDirectionY = new O(0, 1);
1621
+ Ht.BlurDirectionX = new j(1, 0), Ht.BlurDirectionY = new j(0, 1);
1574
1622
  //#endregion
1575
1623
  //#region src/loops/gl/ribbonGeometry.js
1576
- function zt(e, t, n, r) {
1624
+ function Ut(e, t, n, r) {
1577
1625
  n = Math.min(n, e, t);
1578
1626
  let i = Math.max(4, Math.round(r / 4)), a = [
1579
1627
  {
@@ -1606,32 +1654,32 @@ function zt(e, t, n, r) {
1606
1654
  }
1607
1655
  return o;
1608
1656
  }
1609
- function Bt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth: i = .35, curl: a = 1 } = {}) {
1610
- let o = u(e >>> 0 || 1), s = (e) => (o() - .5) * 2 * e, c = Math.max(1, Math.round(t)), l = -((c - 1) * r) / 2, d = n, f = [], p = 0, m = (t, n) => {
1611
- f.push(new I(t, n, Math.sin(p * 1.7 + e) * i)), p += 1;
1657
+ function Wt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth: i = .35, curl: a = 1 } = {}) {
1658
+ let o = _(e >>> 0 || 1), s = (e) => (o() - .5) * 2 * e, c = Math.max(1, Math.round(t)), l = -((c - 1) * r) / 2, u = n, d = [], f = 0, p = (t, n) => {
1659
+ d.push(new E(t, n, Math.sin(f * 1.7 + e) * i)), f += 1;
1612
1660
  };
1613
1661
  for (let e = 0; e < c; e++) {
1614
- let t = l + e * r + s(r * .06), n = e % 2 == 0, i = n ? -d / 2 : d / 2, a = n ? d / 2 : -d / 2;
1615
- for (let e = 0; e < 10; e++) m(t, i + (a - i) * e / 10);
1662
+ let t = l + e * r + s(r * .06), n = e % 2 == 0, i = n ? -u / 2 : u / 2, a = n ? u / 2 : -u / 2;
1663
+ for (let e = 0; e < 10; e++) p(t, i + (a - i) * e / 10);
1616
1664
  if (e < c - 1) {
1617
1665
  let i = l + (e + 1) * r, o = (t + i) / 2, s = (i - t) / 2, c = n ? 1 : -1;
1618
1666
  for (let e = 0; e <= 24; e++) {
1619
1667
  let t = e / 24 * Math.PI;
1620
- m(o - Math.cos(t) * s, a + c * Math.sin(t) * s);
1668
+ p(o - Math.cos(t) * s, a + c * Math.sin(t) * s);
1621
1669
  }
1622
1670
  }
1623
1671
  }
1624
- if (a > 0 && f.length >= 2) {
1625
- let t = f[f.length - 1], n = f[f.length - 2], o = t.clone().sub(n).setZ(0).normalize(), s = new I(-o.y, o.x, 0).normalize(), c = r * .5, l = t.clone().add(s.clone().multiplyScalar(c)), u = Math.atan2(t.y - l.y, t.x - l.x), d = 1.1 * a;
1672
+ if (a > 0 && d.length >= 2) {
1673
+ let t = d[d.length - 1], n = d[d.length - 2], o = t.clone().sub(n).setZ(0).normalize(), s = new E(-o.y, o.x, 0).normalize(), c = r * .5, l = t.clone().add(s.clone().multiplyScalar(c)), u = Math.atan2(t.y - l.y, t.x - l.x), f = 1.1 * a;
1626
1674
  for (let n = 1; n <= 44; n++) {
1627
- let r = n / 44, a = u - d * Math.PI * 2 * r, o = c * (1 - .7 * r);
1628
- f.push(new I(l.x + Math.cos(a) * o, l.y + Math.sin(a) * o, t.z + Math.sin(r * 3 + e) * i * .4));
1675
+ let r = n / 44, a = u - f * Math.PI * 2 * r, o = c * (1 - .7 * r);
1676
+ d.push(new E(l.x + Math.cos(a) * o, l.y + Math.sin(a) * o, t.z + Math.sin(r * 3 + e) * i * .4));
1629
1677
  }
1630
1678
  }
1631
- return new Oe(f, !1, "centripetal");
1679
+ return new Se(d, !1, "centripetal");
1632
1680
  }
1633
- function Vt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth: i = .35, curl: a = 1, width: o = .5, ribbonThickness: s = .12, corner: c = .045, tubularSegments: l = 800, radialSegments: u = 48 } = {}) {
1634
- let d = Bt({
1681
+ function Gt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth: i = .35, curl: a = 1, width: o = .5, ribbonThickness: s = .12, corner: c = .045, tubularSegments: l = 800, radialSegments: u = 48 } = {}) {
1682
+ let d = Wt({
1635
1683
  seed: e,
1636
1684
  loops: t,
1637
1685
  height: n,
@@ -1640,7 +1688,7 @@ function Vt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth: i
1640
1688
  curl: a
1641
1689
  });
1642
1690
  d.arcLengthDivisions = Math.max(400, l);
1643
- let f = d.computeFrenetFrames(l, !1), p = zt(o / 2, s / 2, c, u), m = p.length, h = m + 1, g = [], _ = [], v = [], y = new I();
1691
+ let f = d.computeFrenetFrames(l, !1), p = Ut(o / 2, s / 2, c, u), m = p.length, h = m + 1, g = [], _ = [], v = [], y = new E();
1644
1692
  for (let e = 0; e <= l; e++) {
1645
1693
  d.getPointAt(e / l, y);
1646
1694
  let t = f.normals[e], n = f.binormals[e];
@@ -1662,8 +1710,8 @@ function Vt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth: i
1662
1710
  let t = l * h;
1663
1711
  v.push(te, t + e, t + e + 1);
1664
1712
  }
1665
- let b = new A();
1666
- return b.setAttribute("position", new V(g, 3)), b.setAttribute("uv", new V(_, 2)), b.setIndex(v), b.computeVertexNormals(), b.computeBoundingSphere(), b.userData = {
1713
+ let b = new z();
1714
+ return b.setAttribute("position", new A(g, 3)), b.setAttribute("uv", new A(_, 2)), b.setIndex(v), b.computeVertexNormals(), b.computeBoundingSphere(), b.userData = {
1667
1715
  tubularSegments: l,
1668
1716
  ringIndexCount: m * 6,
1669
1717
  bodyIndexCount: l * m * 6,
@@ -1672,7 +1720,7 @@ function Vt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth: i
1672
1720
  }
1673
1721
  //#endregion
1674
1722
  //#region src/loops/gl/filterPass.js
1675
- var Ht = {
1723
+ var Kt = {
1676
1724
  uniforms: {
1677
1725
  tDiffuse: { value: null },
1678
1726
  uAberration: { value: 0 },
@@ -1682,20 +1730,20 @@ var Ht = {
1682
1730
  },
1683
1731
  vertexShader: "\n varying vec2 vUv;\n void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }\n ",
1684
1732
  fragmentShader: "\n uniform sampler2D tDiffuse;\n uniform float uAberration, uGrain, uVignette, uTime;\n varying vec2 vUv;\n float rand(vec2 p) { return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453); }\n void main() {\n vec2 uv = vUv;\n vec2 dir = uv - 0.5;\n // chromatic aberration — split R/B outward, scaled by distance from centre\n float a = uAberration * 0.02;\n vec3 col;\n col.r = texture2D(tDiffuse, uv + dir * a).r;\n col.g = texture2D(tDiffuse, uv).g;\n col.b = texture2D(tDiffuse, uv - dir * a).b;\n // grain\n if (uGrain > 0.0) col += (rand(uv + fract(uTime)) - 0.5) * uGrain;\n // vignette\n if (uVignette > 0.0) {\n float v = smoothstep(0.85, 0.25, length(dir));\n col *= mix(1.0, v, uVignette);\n }\n gl_FragColor = vec4(col, 1.0);\n }\n "
1685
- }, Ut = .004, Wt = class {
1733
+ }, qt = .004, Jt = class {
1686
1734
  constructor(e, { autoLoop: t = !1 } = {}) {
1687
- this.autoLoop = t, this.canvas = e, this.renderer = new D({
1735
+ this.autoLoop = t, this.canvas = e, this.renderer = new N({
1688
1736
  canvas: e,
1689
1737
  antialias: !0,
1690
1738
  preserveDrawingBuffer: !0,
1691
1739
  alpha: !0
1692
- }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new M("#000000"), 1), this.renderer.toneMapping = 4, this.renderer.toneMappingExposure = 1.1, this.scene = new E(), this.camera = new w(36, 1, .1, 100), this.camera.position.set(0, 0, 6), this.camera.lookAt(0, 0, 0), this.controls = new R(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 2.5, this.controls.maxDistance = 18, this.scene.add(new je(16777215, .25));
1693
- let n = new H(16777215, 2.2);
1740
+ }), this.renderer.setPixelRatio(x()), this.renderer.setClearColor(new V("#000000"), 1), this.renderer.toneMapping = 4, this.renderer.toneMappingExposure = 1.1, this.scene = new w(), this.camera = new L(36, 1, .1, 100), this.camera.position.set(0, 0, 6), this.camera.lookAt(0, 0, 0), this.controls = new B(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 2.5, this.controls.maxDistance = 18, this.scene.add(new Me(16777215, .25));
1741
+ let n = new k(16777215, 2.2);
1694
1742
  n.position.set(4, 5, 3), this.scene.add(n);
1695
- let r = new H(8956671, 1);
1696
- r.position.set(-4, -2, -3), this.scene.add(r), this.pmrem = new ke(this.renderer), this.envTex = this.pmrem.fromScene(new ht(), .01).texture, this.scene.environment = this.envTex, this.group = new ie(), this.scene.add(this.group), this.matType = "glass", this.color = "#cfe0ff", this.roughness = .06, this.metalness = 1, this.ior = 1.55, this.dispersion = 10, this.material = this.makeMaterial("glass"), this.lineMat = new lt({
1743
+ let r = new k(8956671, 1);
1744
+ r.position.set(-4, -2, -3), this.scene.add(r), this.pmrem = new Ae(this.renderer), this.envTex = this.pmrem.fromScene(new yt(), .01).texture, this.scene.environment = this.envTex, this.group = new se(), this.scene.add(this.group), this.matType = "glass", this.color = "#cfe0ff", this.roughness = .06, this.metalness = 1, this.ior = 1.55, this.dispersion = 10, this.material = this.makeMaterial("glass"), this.lineMat = new pt({
1697
1745
  color: 10466006,
1698
- linewidth: 2.5 * Ut,
1746
+ linewidth: 2.5 * qt,
1699
1747
  worldUnits: !0
1700
1748
  }), this.geomParams = {
1701
1749
  seed: 3,
@@ -1707,7 +1755,7 @@ var Ht = {
1707
1755
  width: .5,
1708
1756
  ribbonThickness: .12,
1709
1757
  corner: .045
1710
- }, this.geom = Vt(this.geomParams), this.wireGeom = new mt(this.geom), this.mesh = new C(this.geom, this.material), this.wire = new pt(this.wireGeom, this.lineMat), this.wire.visible = !1, this.group.add(this.mesh), this.group.add(this.wire), this.composer = new Ft(this.renderer), this.composer.addPass(new It(this.scene, this.camera)), this.bloom = new Rt(new O(1, 1), 0, .7, .85), this.composer.addPass(this.bloom), this.filter = new Mt(Ht), this.composer.addPass(this.filter), this.dur = 12, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
1758
+ }, this.geom = Gt(this.geomParams), this.wireGeom = new vt(this.geom), this.mesh = new F(this.geom, this.material), this.wire = new _t(this.wireGeom, this.lineMat), this.wire.visible = !1, this.group.add(this.mesh), this.group.add(this.wire), this.composer = new zt(this.renderer), this.composer.addPass(new Bt(this.scene, this.camera)), this.bloom = new Ht(new j(1, 1), 0, .7, .85), this.composer.addPass(this.bloom), this.filter = new It(Kt), this.composer.addPass(this.filter), this.dur = 12, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
1711
1759
  paused: !0,
1712
1760
  loop: !0,
1713
1761
  speed: 1,
@@ -1732,15 +1780,15 @@ var Ht = {
1732
1780
  }, this.onProgress = null, this.autoLoop && (this.raf = requestAnimationFrame(this.loop));
1733
1781
  }
1734
1782
  makeMaterial(e) {
1735
- let t = new M(this.color);
1736
- return e === "chrome" ? new ge({
1783
+ let t = new V(this.color);
1784
+ return e === "chrome" ? new ve({
1737
1785
  color: t,
1738
1786
  metalness: 1,
1739
1787
  roughness: this.roughness,
1740
1788
  clearcoat: 1,
1741
1789
  clearcoatRoughness: .04,
1742
1790
  envMapIntensity: 2.2
1743
- }) : new ge({
1791
+ }) : new ve({
1744
1792
  color: t,
1745
1793
  metalness: 0,
1746
1794
  roughness: this.roughness,
@@ -1765,7 +1813,7 @@ var Ht = {
1765
1813
  }
1766
1814
  rebuildGeometry() {
1767
1815
  let e = this.geom, t = this.wireGeom;
1768
- this.geom = Vt(this.geomParams), this.wireGeom = new mt(this.geom), this.mesh.geometry = this.geom, this.wire.geometry = this.wireGeom, e.dispose(), t.dispose();
1816
+ this.geom = Gt(this.geomParams), this.wireGeom = new vt(this.geom), this.mesh.geometry = this.geom, this.wire.geometry = this.wireGeom, e.dispose(), t.dispose();
1769
1817
  }
1770
1818
  update({ globals: e, geom: t } = {}) {
1771
1819
  let n = !1;
@@ -1781,18 +1829,18 @@ var Ht = {
1781
1829
  if (e) {
1782
1830
  this.globals = e, this.color = e.color || this.color, this.roughness = e.roughness ?? this.roughness, this.metalness = e.metalness ?? this.metalness, this.ior = e.ior ?? this.ior, this.dispersion = e.dispersion ?? this.dispersion, this.setMaterialType(e.materialType || "glass"), this.applyMaterialProps(), e.duration && (this.dur = e.duration), e.fov != null && e.fov !== this.camera.fov && (this.camera.fov = e.fov, this.camera.updateProjectionMatrix());
1783
1831
  let t = !!e.wireframe;
1784
- this.mesh.visible = !t, this.wire.visible = t, this.lineMat.linewidth = (e.strokeWidth ?? 2.5) * Ut, this.bloom.strength = e.bloom ?? 0, this.filter.uniforms.uAberration.value = e.aberration ?? 0, this.filter.uniforms.uVignette.value = e.vignette ?? 0, this.filter.uniforms.uGrain.value = e.grain ?? 0;
1832
+ this.mesh.visible = !t, this.wire.visible = t, this.lineMat.linewidth = (e.strokeWidth ?? 2.5) * qt, this.bloom.strength = e.bloom ?? 0, this.filter.uniforms.uAberration.value = e.aberration ?? 0, this.filter.uniforms.uVignette.value = e.vignette ?? 0, this.filter.uniforms.uGrain.value = e.grain ?? 0;
1785
1833
  }
1786
1834
  n && this.rebuildGeometry();
1787
1835
  }
1788
1836
  resize(e, t) {
1789
- this.renderer.setSize(e, t, !1), this.composer.setSize(e, t), this.camera.aspect = e / t, this.camera.updateProjectionMatrix(), this.lineMat.resolution.set(e, t), this.w = e, this.h = t;
1837
+ this.renderer.setPixelRatio(x()), this.renderer.setSize(e, t, !1), this.composer.setPixelRatio(x()), this.composer.setSize(e, t), this.camera.aspect = e / t, this.camera.updateProjectionMatrix(), this.lineMat.resolution.set(e, t), this.w = e, this.h = t;
1790
1838
  }
1791
1839
  seek(e) {
1792
1840
  this.accum = Math.max(0, Math.min(1, e)) * this.dur;
1793
1841
  }
1794
1842
  setBackground(e) {
1795
- this.renderer.setClearColor(new M(e), 1);
1843
+ this.renderer.setClearColor(new V(e), 1);
1796
1844
  }
1797
1845
  resetCamera() {
1798
1846
  this.camera.position.set(0, 0, 6), this.controls.target.set(0, 0, 0), this.controls.update();
@@ -1855,7 +1903,7 @@ var Ht = {
1855
1903
  dispose() {
1856
1904
  cancelAnimationFrame(this.raf), this.controls.dispose(), this.material.dispose(), this.lineMat.dispose(), this.geom.dispose(), this.wireGeom.dispose(), this.bloom.dispose(), this.composer.dispose?.(), this.envTex.dispose(), this.pmrem.dispose(), this.renderer.dispose();
1857
1905
  }
1858
- }, Gt = "\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 permute(vec4 x) { return mod289(((x * 34.0) + 10.0) * x); }\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\nfloat snoise(vec3 v) {\n const vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n vec3 i = floor(v + dot(v, C.yyy));\n vec3 x0 = v - i + dot(i, C.xxx);\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min(g.xyz, l.zxy);\n vec3 i2 = max(g.xyz, l.zxy);\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy;\n vec3 x3 = x0 - D.yyy;\n i = mod289(i);\n vec4 p = permute(permute(permute(i.z + vec4(0.0, i1.z, i2.z, 1.0))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0)) + i.x + vec4(0.0, i1.x, i2.x, 1.0));\n float n_ = 0.142857142857;\n vec3 ns = n_ * D.wyz - D.xzx;\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z);\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_);\n vec4 x = x_ * ns.x + ns.yyyy;\n vec4 y = y_ * ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n vec4 b0 = vec4(x.xy, y.xy);\n vec4 b1 = vec4(x.zw, y.zw);\n vec4 s0 = floor(b0) * 2.0 + 1.0;\n vec4 s1 = floor(b1) * 2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;\n vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;\n vec3 p0 = vec3(a0.xy, h.x);\n vec3 p1 = vec3(a0.zw, h.y);\n vec3 p2 = vec3(a1.xy, h.z);\n vec3 p3 = vec3(a1.zw, h.w);\n vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; p3 *= norm.w;\n vec4 m = max(0.5 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);\n m = m * m;\n return 105.0 * dot(m * m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));\n}\n", Kt = "\nvarying vec2 vUv;\nvoid main() { vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", qt = `
1906
+ }, Yt = "\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 permute(vec4 x) { return mod289(((x * 34.0) + 10.0) * x); }\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\nfloat snoise(vec3 v) {\n const vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n vec3 i = floor(v + dot(v, C.yyy));\n vec3 x0 = v - i + dot(i, C.xxx);\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min(g.xyz, l.zxy);\n vec3 i2 = max(g.xyz, l.zxy);\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy;\n vec3 x3 = x0 - D.yyy;\n i = mod289(i);\n vec4 p = permute(permute(permute(i.z + vec4(0.0, i1.z, i2.z, 1.0))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0)) + i.x + vec4(0.0, i1.x, i2.x, 1.0));\n float n_ = 0.142857142857;\n vec3 ns = n_ * D.wyz - D.xzx;\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z);\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_);\n vec4 x = x_ * ns.x + ns.yyyy;\n vec4 y = y_ * ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n vec4 b0 = vec4(x.xy, y.xy);\n vec4 b1 = vec4(x.zw, y.zw);\n vec4 s0 = floor(b0) * 2.0 + 1.0;\n vec4 s1 = floor(b1) * 2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;\n vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;\n vec3 p0 = vec3(a0.xy, h.x);\n vec3 p1 = vec3(a0.zw, h.y);\n vec3 p2 = vec3(a1.xy, h.z);\n vec3 p3 = vec3(a1.zw, h.w);\n vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; p3 *= norm.w;\n vec4 m = max(0.5 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);\n m = m * m;\n return 105.0 * dot(m * m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));\n}\n", Xt = "\nvarying vec2 vUv;\nvoid main() { vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", Zt = `
1859
1907
  uniform vec3 uColors[5];
1860
1908
  uniform int uCount;
1861
1909
  uniform float uTime;
@@ -1864,7 +1912,7 @@ uniform float uIntensity;
1864
1912
  uniform int uStyle;
1865
1913
  uniform vec3 uBase;
1866
1914
  varying vec2 vUv;
1867
- ${Gt}
1915
+ ${Yt}
1868
1916
  vec3 ramp(float t) {
1869
1917
  float ft = clamp(t, 0.0, 1.0) * float(uCount - 1);
1870
1918
  int i = int(floor(ft));
@@ -1906,14 +1954,14 @@ void main() {
1906
1954
  col = mix(uBase, col, uIntensity);
1907
1955
  gl_FragColor = vec4(col, 1.0);
1908
1956
  }
1909
- `, Jt = `
1957
+ `, Qt = `
1910
1958
  uniform float uTime;
1911
1959
  uniform float uDistort;
1912
1960
  uniform float uSeedOffset;
1913
1961
  varying vec3 vNormal;
1914
1962
  varying vec3 vWorldPos;
1915
1963
  varying vec3 vViewDir;
1916
- ${Gt}
1964
+ ${Yt}
1917
1965
  void main() {
1918
1966
  vec3 p = position;
1919
1967
  float n = snoise(position * 1.4 + vec3(uSeedOffset) + vec3(0.0, 0.0, uTime * 0.35));
@@ -1924,7 +1972,7 @@ void main() {
1924
1972
  vViewDir = cameraPosition - world.xyz;
1925
1973
  gl_Position = projectionMatrix * viewMatrix * world;
1926
1974
  }
1927
- `, Yt = `
1975
+ `, $t = `
1928
1976
  uniform vec3 uColors[5];
1929
1977
  uniform int uCount;
1930
1978
  uniform int uDriver;
@@ -1935,7 +1983,7 @@ uniform float uSeedOffset;
1935
1983
  varying vec3 vNormal;
1936
1984
  varying vec3 vWorldPos;
1937
1985
  varying vec3 vViewDir;
1938
- ${Gt}
1986
+ ${Yt}
1939
1987
  vec3 ramp(float t) {
1940
1988
  float ft = clamp(t, 0.0, 1.0) * float(uCount - 1);
1941
1989
  int i = int(floor(ft));
@@ -1961,20 +2009,20 @@ void main() {
1961
2009
  col += (hash(gl_FragCoord.xy) - 0.5) * uGrain;
1962
2010
  gl_FragColor = vec4(col, 1.0);
1963
2011
  }
1964
- `, Xt = "#0b0b0e", Z = 14, Q = 5, Zt = () => {
2012
+ `, en = "#0b0b0e", Q = 14, $ = 5, tn = () => {
1965
2013
  let e = document.createElement("canvas");
1966
2014
  e.width = e.height = 128;
1967
2015
  let t = e.getContext("2d"), n = t.createRadialGradient(64, 64, 0, 64, 64, 64);
1968
- return n.addColorStop(0, "rgba(255,255,255,0.85)"), n.addColorStop(.4, "rgba(255,255,255,0.25)"), n.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = n, t.fillRect(0, 0, 128, 128), new Me(e);
1969
- }, Qt = class {
2016
+ return n.addColorStop(0, "rgba(255,255,255,0.85)"), n.addColorStop(.4, "rgba(255,255,255,0.25)"), n.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = n, t.fillRect(0, 0, 128, 128), new Ce(e);
2017
+ }, nn = class {
1970
2018
  constructor(e, { autoLoop: t = !1 } = {}) {
1971
- this.autoLoop = t, this.canvas = e, this.renderer = new D({
2019
+ this.autoLoop = t, this.canvas = e, this.renderer = new N({
1972
2020
  canvas: e,
1973
2021
  antialias: !0,
1974
2022
  preserveDrawingBuffer: !0
1975
- }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new M(Xt), 1), this.camera = new w(32, 1, .1, 50), this.camera.position.set(0, .15, 4.2), this.camera.lookAt(0, 0, 0), this.controls = new R(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 1.6, this.controls.maxDistance = 12, this.glowTex = Zt(), this.bgGeo = new S(2, 2), this.bgCam = new j(), this.bgBase = new M(Xt), this.geoms = {
1976
- sphere: new he(1.02, 96, 96),
1977
- plane: new S(2.1, 1.5, 128, 96)
2023
+ }), this.renderer.setPixelRatio(x()), this.renderer.setClearColor(new V(en), 1), this.camera = new L(32, 1, .1, 50), this.camera.position.set(0, .15, 4.2), this.camera.lookAt(0, 0, 0), this.controls = new B(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 1.6, this.controls.maxDistance = 12, this.glowTex = tn(), this.bgGeo = new M(2, 2), this.bgCam = new R(), this.bgBase = new V(en), this.geoms = {
2024
+ sphere: new De(1.02, 96, 96),
2025
+ plane: new M(2.1, 1.5, 128, 96)
1978
2026
  }, this.tiles = [], this.rects = [], this.mode = "grid", this.idx = 0, this.globals = {
1979
2027
  glow: .6,
1980
2028
  grain: .06,
@@ -1985,21 +2033,21 @@ void main() {
1985
2033
  }, this.time = 0, this.last = performance.now(), this.autoLoop && (this.raf = requestAnimationFrame(this.loop));
1986
2034
  }
1987
2035
  buildTile(e) {
1988
- let t = new E(), n = new T({
1989
- vertexShader: Jt,
1990
- fragmentShader: Yt,
2036
+ let t = new w(), n = new C({
2037
+ vertexShader: Qt,
2038
+ fragmentShader: $t,
1991
2039
  side: 2,
1992
2040
  uniforms: {
1993
2041
  uTime: { value: 0 },
1994
2042
  uDistort: { value: 0 },
1995
2043
  uSeedOffset: { value: 0 },
1996
- uColors: { value: Array.from({ length: Q }, () => new M()) },
2044
+ uColors: { value: Array.from({ length: $ }, () => new V()) },
1997
2045
  uCount: { value: 2 },
1998
2046
  uDriver: { value: 0 },
1999
2047
  uGlow: { value: .6 },
2000
2048
  uGrain: { value: .06 }
2001
2049
  }
2002
- }), r = new C(this.geoms[e.shape], n), i = new ne(new Te({
2050
+ }), r = new F(this.geoms[e.shape], n), i = new pe(new he({
2003
2051
  map: this.glowTex,
2004
2052
  transparent: !0,
2005
2053
  depthWrite: !1,
@@ -2007,22 +2055,22 @@ void main() {
2007
2055
  opacity: .3
2008
2056
  }));
2009
2057
  i.position.set(0, -.5, -1.2), i.scale.set(3.6, 3.6, 1), t.add(i), t.add(r);
2010
- let a = new T({
2011
- vertexShader: Kt,
2012
- fragmentShader: qt,
2058
+ let a = new C({
2059
+ vertexShader: Xt,
2060
+ fragmentShader: Zt,
2013
2061
  depthTest: !1,
2014
2062
  depthWrite: !1,
2015
2063
  uniforms: {
2016
2064
  uTime: { value: 0 },
2017
- uColors: { value: Array.from({ length: Q }, () => new M()) },
2065
+ uColors: { value: Array.from({ length: $ }, () => new V()) },
2018
2066
  uCount: { value: 2 },
2019
2067
  uSeedOffset: { value: 0 },
2020
2068
  uIntensity: { value: .75 },
2021
2069
  uStyle: { value: 0 },
2022
2070
  uBase: { value: this.bgBase }
2023
2071
  }
2024
- }), o = new E();
2025
- return o.add(new C(this.bgGeo, a)), {
2072
+ }), o = new w();
2073
+ return o.add(new F(this.bgGeo, a)), {
2026
2074
  scene: t,
2027
2075
  mesh: r,
2028
2076
  material: n,
@@ -2034,9 +2082,9 @@ void main() {
2034
2082
  }
2035
2083
  applySpec(e, t) {
2036
2084
  let n = e.material.uniforms;
2037
- e.mesh.geometry = this.geoms[t.shape], e.mesh.rotation.set(t.shape === "plane" ? -.35 : .12, 0, 0), n.uDistort.value = t.distort, n.uSeedOffset.value = t.seed % 977, n.uDriver.value = t.driver, n.uCount.value = Math.min(t.colors.length, Q), t.colors.slice(0, Q).forEach((e, t) => n.uColors.value[t].set(e)), e.glow.material.color.set(t.colors[Math.floor(t.colors.length / 2)]);
2085
+ e.mesh.geometry = this.geoms[t.shape], e.mesh.rotation.set(t.shape === "plane" ? -.35 : .12, 0, 0), n.uDistort.value = t.distort, n.uSeedOffset.value = t.seed % 977, n.uDriver.value = t.driver, n.uCount.value = Math.min(t.colors.length, $), t.colors.slice(0, $).forEach((e, t) => n.uColors.value[t].set(e)), e.glow.material.color.set(t.colors[Math.floor(t.colors.length / 2)]);
2038
2086
  let r = e.bgMaterial.uniforms;
2039
- r.uCount.value = Math.min(t.colors.length, Q), t.colors.slice(0, Q).forEach((e, t) => r.uColors.value[t].set(e)), r.uSeedOffset.value = t.seed % 977, e.spec = t;
2087
+ r.uCount.value = Math.min(t.colors.length, $), t.colors.slice(0, $).forEach((e, t) => r.uColors.value[t].set(e)), r.uSeedOffset.value = t.seed % 977, e.spec = t;
2040
2088
  }
2041
2089
  update({ specs: e, mode: t, idx: n, globals: r }) {
2042
2090
  if (e) {
@@ -2046,7 +2094,7 @@ void main() {
2046
2094
  t && (this.mode = t), n != null && (this.idx = n), r && (this.globals = r);
2047
2095
  }
2048
2096
  resize(e, t) {
2049
- this.renderer.setSize(e, t, !1), this.w = e, this.h = t;
2097
+ this.renderer.setPixelRatio(x()), this.renderer.setSize(e, t, !1), this.w = e, this.h = t;
2050
2098
  }
2051
2099
  tileAt(e, t) {
2052
2100
  return this.rects.findIndex((n) => e >= n.x && e <= n.x + n.w && t >= n.y && t <= n.y + n.h);
@@ -2084,10 +2132,10 @@ void main() {
2084
2132
  };
2085
2133
  this.rects = [e], this.renderTile(this.tiles[this.idx], e);
2086
2134
  } else {
2087
- let e = this.tiles.length, t = Math.ceil(e / 3), n = (this.w - Z * 4) / 3, r = (this.h - Z * (t + 1)) / t;
2135
+ let e = this.tiles.length, t = Math.ceil(e / 3), n = (this.w - Q * 4) / 3, r = (this.h - Q * (t + 1)) / t;
2088
2136
  this.rects = this.tiles.map((e, t) => ({
2089
- x: Z + t % 3 * (n + Z),
2090
- y: Z + Math.floor(t / 3) * (r + Z),
2137
+ x: Q + t % 3 * (n + Q),
2138
+ y: Q + Math.floor(t / 3) * (r + Q),
2091
2139
  w: n,
2092
2140
  h: r
2093
2141
  })), this.tiles.forEach((e, t) => this.renderTile(e, this.rects[t]));
@@ -2096,7 +2144,7 @@ void main() {
2096
2144
  }
2097
2145
  };
2098
2146
  setBackground(e) {
2099
- this.renderer.setClearColor(new M(e), 1), this.bgBase.set(e);
2147
+ this.renderer.setClearColor(new V(e), 1), this.bgBase.set(e);
2100
2148
  }
2101
2149
  resetCamera() {
2102
2150
  this.camera.position.set(0, .15, 4.2), this.controls.target.set(0, 0, 0), this.controls.update();
@@ -2113,53 +2161,53 @@ void main() {
2113
2161
  for (let e of Object.values(this.geoms)) e.dispose();
2114
2162
  this.bgGeo.dispose(), this.glowTex.dispose(), this.renderer.dispose();
2115
2163
  }
2116
- }, $ = /* @__PURE__ */ new Map(), $t = /* @__PURE__ */ new WeakMap(), en = /* @__PURE__ */ new WeakMap();
2117
- function tn(e, t) {
2118
- let n = an(e, t);
2164
+ }, rn = /* @__PURE__ */ new Map(), an = /* @__PURE__ */ new WeakMap(), on = /* @__PURE__ */ new WeakMap();
2165
+ function sn(e, t) {
2166
+ let n = un(e, t);
2119
2167
  n.controls && (n.controls.enabled = !1);
2120
2168
  let r = t?.dataset?.layerId;
2121
- return r && $.set(r, n), n;
2169
+ return r && rn.set(r, n), n;
2122
2170
  }
2123
- function nn(e, t) {
2124
- let n = $.get(e);
2171
+ function cn(e, t) {
2172
+ let n = rn.get(e);
2125
2173
  return n && t === "resetCamera" ? (n.resetCamera?.(), !0) : !1;
2126
2174
  }
2127
- function rn(e, t, n) {
2175
+ function ln(e, t, n) {
2128
2176
  t?.controls && (t.controls.enabled = !!n);
2129
2177
  }
2130
- function an(e, t) {
2178
+ function un(e, t) {
2131
2179
  switch (e.engine) {
2132
2180
  case "drift": {
2133
- let n = new Ge(e.family);
2181
+ let n = new Ze(e.family);
2134
2182
  return n.init(t), n;
2135
2183
  }
2136
2184
  case "iridescent": {
2137
- let e = new Je();
2185
+ let e = new et();
2138
2186
  return e.init(t), e;
2139
2187
  }
2140
2188
  case "softforms": {
2141
- let e = new $e();
2189
+ let e = new it();
2142
2190
  return e.init(t), e;
2143
2191
  }
2144
2192
  case "softforms3d": {
2145
- let e = new it();
2193
+ let e = new ct();
2146
2194
  return e.init(t), e;
2147
2195
  }
2148
- case "scene": return new yt(t);
2149
- case "forms": return new Ct(t);
2150
- case "environment": return new Dt(t);
2151
- case "ribbon": return new Wt(t);
2152
- case "mesh": return new Qt(t);
2196
+ case "scene": return new Ct(t);
2197
+ case "forms": return new Dt(t);
2198
+ case "environment": return new jt(t);
2199
+ case "ribbon": return new Jt(t);
2200
+ case "mesh": return new nn(t);
2153
2201
  default: throw Error(`unknown gl engine "${e.engine}"`);
2154
2202
  }
2155
2203
  }
2156
- var on = {
2204
+ var dn = {
2157
2205
  loop: !0,
2158
2206
  paused: !1,
2159
2207
  speed: 0
2160
2208
  };
2161
- function sn(e, n, r) {
2162
- if (cn(e, n, r), typeof n.setPointer == "function") {
2209
+ function fn(e, n, r) {
2210
+ if (pn(e, n, r), typeof n.setPointer == "function") {
2163
2211
  let e = t.getCtx().stage, i = r.w ?? 0, a = r.h ?? 0, o = null;
2164
2212
  if (e && i > 0 && a > 0) {
2165
2213
  let t = (e.x - (r.x ?? 0)) / i, n = (e.y - (r.y ?? 0)) / a;
@@ -2169,27 +2217,27 @@ function sn(e, n, r) {
2169
2217
  down: !!e.down
2170
2218
  });
2171
2219
  }
2172
- n.setPointer(o);
2220
+ n.setPointer(r.mouse === !1 ? null : o);
2173
2221
  }
2174
2222
  e.bgToggle && n.renderer?.setClearAlpha(r.bgOn === !1 ? 0 : 1);
2175
2223
  }
2176
- function cn(t, n, r) {
2224
+ function pn(t, n, r) {
2177
2225
  switch (t.engine) {
2178
2226
  case "scene": {
2179
- $t.set(n, r.duration ?? 8);
2227
+ an.set(n, r.duration ?? 8);
2180
2228
  let e = {
2181
2229
  tube: r.tube ?? .32,
2182
2230
  p: r.pWinds ?? 2,
2183
2231
  q: r.qWinds ?? 3,
2184
2232
  detail: r.detail ?? 0
2185
- }, t = `${e.tube}|${e.p}|${e.q}|${e.detail}`, i = en.get(n) !== t;
2186
- i && en.set(n, t), n.update({
2233
+ }, t = `${e.tube}|${e.p}|${e.q}|${e.detail}`, i = on.get(n) !== t;
2234
+ i && on.set(n, t), n.update({
2187
2235
  primitive: r.primitive,
2188
2236
  ...i ? { params: e } : {},
2189
2237
  globals: {
2190
2238
  preset: r.pose,
2191
2239
  animMode: r.animMode === "keyframes" || r.animMode === "keyframe" ? "keyframe" : "preset",
2192
- keyframes: Array.isArray(r.keyframes) && r.keyframes.length ? r.keyframes : y,
2240
+ keyframes: Array.isArray(r.keyframes) && r.keyframes.length ? r.keyframes : b,
2193
2241
  loop: !0,
2194
2242
  paused: !1,
2195
2243
  speed: 0,
@@ -2213,7 +2261,18 @@ function cn(t, n, r) {
2213
2261
  rounding: r.rounding,
2214
2262
  showAxis: !!r.showAxis,
2215
2263
  axisLength: r.axisLength,
2216
- axisOpacity: r.axisOpacity
2264
+ axisOpacity: r.axisOpacity,
2265
+ meshSrc: r.primitive === "mesh" ? r.meshSrc : null,
2266
+ meshType: r.meshType,
2267
+ light: {
2268
+ key: r.lightKey,
2269
+ keyAngle: r.lightAngle,
2270
+ keyElevation: r.lightElevation,
2271
+ fill: r.lightFill,
2272
+ rim: r.lightRim,
2273
+ ambient: r.lightAmbient,
2274
+ orbit: r.lightOrbit
2275
+ }
2217
2276
  }
2218
2277
  });
2219
2278
  return;
@@ -2229,7 +2288,7 @@ function cn(t, n, r) {
2229
2288
  n.update({
2230
2289
  form: r.form,
2231
2290
  globals: {
2232
- ...on,
2291
+ ...dn,
2233
2292
  duration: 8,
2234
2293
  samples: r.samples,
2235
2294
  cycles: r.cycles,
@@ -2250,7 +2309,7 @@ function cn(t, n, r) {
2250
2309
  n.update({
2251
2310
  env: r.env,
2252
2311
  globals: {
2253
- ...on,
2312
+ ...dn,
2254
2313
  duration: 8,
2255
2314
  samples: r.samples,
2256
2315
  cycles: r.cycles,
@@ -2264,7 +2323,7 @@ function cn(t, n, r) {
2264
2323
  });
2265
2324
  return;
2266
2325
  case "ribbon":
2267
- $t.set(n, r.duration ?? 12), n.update({
2326
+ an.set(n, r.duration ?? 12), n.update({
2268
2327
  geom: {
2269
2328
  seed: r.seed,
2270
2329
  loops: r.loops,
@@ -2277,7 +2336,7 @@ function cn(t, n, r) {
2277
2336
  corner: r.corner ?? .045
2278
2337
  },
2279
2338
  globals: {
2280
- ...on,
2339
+ ...dn,
2281
2340
  duration: r.duration ?? 12,
2282
2341
  flow: r.flow,
2283
2342
  cameraOrbit: r.cameraOrbit,
@@ -2303,7 +2362,7 @@ function cn(t, n, r) {
2303
2362
  n.update({
2304
2363
  mode: t,
2305
2364
  idx: 0,
2306
- specs: a.map((e) => ln(e, r)),
2365
+ specs: a.map((e) => mn(e, r)),
2307
2366
  globals: {
2308
2367
  glow: r.glow,
2309
2368
  grain: r.grain,
@@ -2318,30 +2377,30 @@ function cn(t, n, r) {
2318
2377
  default: n.setParams(r);
2319
2378
  }
2320
2379
  }
2321
- function ln(e, t) {
2322
- let n = u(e);
2380
+ function mn(e, t) {
2381
+ let n = _(e);
2323
2382
  n(), n(), n();
2324
- let r = n(), i = .12 + n() * .3, a = n() * Math.PI * 2, o = d.find((e) => e.id === t.palette) || d[0];
2383
+ let r = n(), i = .12 + n() * .3, a = n() * Math.PI * 2, o = u.find((e) => e.id === t.palette) || u[0];
2325
2384
  return {
2326
2385
  seed: e,
2327
2386
  shape: t.shape || "sphere",
2328
- colors: o.colors.map((e) => h(e, t.hueShift || 0)),
2387
+ colors: o.colors.map((e) => d(e, t.hueShift || 0)),
2329
2388
  driver: t.driver ?? 0,
2330
2389
  distort: (t.distort ?? .5) * (.6 + r * .5),
2331
2390
  rotSpeed: i,
2332
2391
  phase: a
2333
2392
  };
2334
2393
  }
2335
- function un(e, n, { u: r, dt: i }) {
2394
+ function hn(e, n, { u: r, dt: i }) {
2336
2395
  if (e.drive === "phase") n.renderAtPhase(r);
2337
2396
  else if (e.drive === "seek") {
2338
- let e = $t.get(n), i = e ? ee(r, b(e, t.getLoopSeconds())) : r;
2397
+ let e = an.get(n), i = e ? ee(r, te(e, t.getLoopSeconds())) : r;
2339
2398
  n.seek(i), n.frame(0);
2340
2399
  } else n.frame(i);
2341
2400
  }
2342
- function dn(e) {
2401
+ function gn(e) {
2343
2402
  if (!e) return;
2344
- for (let [t, n] of $) n === e && $.delete(t);
2403
+ for (let [t, n] of rn) n === e && rn.delete(t);
2345
2404
  let t = e.renderer;
2346
2405
  try {
2347
2406
  typeof e.dispose == "function" ? e.dispose() : typeof e.destroy == "function" && e.destroy();
@@ -2353,4 +2412,4 @@ function dn(e) {
2353
2412
  } catch {}
2354
2413
  }
2355
2414
  //#endregion
2356
- export { sn as applyParams, tn as createEngine, dn as destroyEngine, un as driveEngine, nn as hostAction, rn as setCameraDrag };
2415
+ export { fn as applyParams, sn as createEngine, gn as destroyEngine, hn as driveEngine, cn as hostAction, ln as setCameraDrag };