voice-ring 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,25 +1,25 @@
1
- import { jsx as In } from "react/jsx-runtime";
2
- import { useState as _t, useEffect as kt, useRef as Rt, useCallback as En } from "react";
3
- let qt = null;
4
- function Nn() {
1
+ import { jsx as Wn } from "react/jsx-runtime";
2
+ import { useState as Bt, useEffect as It, useRef as Et, useCallback as Ln } from "react";
3
+ let Ut = null;
4
+ function Xn() {
5
5
  if (typeof window > "u") return null;
6
6
  const t = window;
7
7
  return t.AudioContext ?? t.webkitAudioContext ?? null;
8
8
  }
9
- function ce() {
10
- return Nn() != null;
9
+ function we() {
10
+ return Xn() != null;
11
11
  }
12
- function Bn() {
13
- const t = Nn();
14
- return t ? (qt || (qt = new t()), qt.state === "suspended" && qt.resume().catch(() => {
15
- }), qt) : null;
12
+ function Vn() {
13
+ const t = Xn();
14
+ return t ? (Ut || (Ut = new t()), Ut.state === "suspended" && Ut.resume().catch(() => {
15
+ }), Ut) : null;
16
16
  }
17
- const en = /* @__PURE__ */ new WeakMap();
18
- function ts(t) {
19
- const n = Bn();
17
+ const fn = /* @__PURE__ */ new WeakMap();
18
+ function ds(t) {
19
+ const n = Vn();
20
20
  if (!n || t.getAudioTracks().length === 0) return null;
21
- let e = en.get(t);
22
- e || (e = { node: n.createMediaStreamSource(t), refs: 0 }, en.set(t, e)), e.refs += 1;
21
+ let e = fn.get(t);
22
+ e || (e = { node: n.createMediaStreamSource(t), refs: 0 }, fn.set(t, e)), e.refs += 1;
23
23
  const s = n.createAnalyser();
24
24
  s.fftSize = 1024, s.smoothingTimeConstant = 0.5, e.node.connect(s);
25
25
  let o = !1;
@@ -37,36 +37,58 @@ function ts(t) {
37
37
  e.node.disconnect();
38
38
  } catch {
39
39
  }
40
- en.delete(t);
40
+ fn.delete(t);
41
41
  }
42
42
  }
43
43
  }
44
44
  };
45
45
  }
46
- const Ht = {
46
+ const tn = {
47
47
  positive: { r: 92, g: 224, b: 150 },
48
48
  negative: { r: 255, g: 104, b: 104 },
49
49
  calm: { r: 104, g: 162, b: 255 }
50
- }, ns = {
51
- green: Ht.positive,
52
- red: Ht.negative,
53
- blue: Ht.calm
54
- }, ss = 0.7, es = 1.1, os = 0.6;
55
- class as {
50
+ }, ps = {
51
+ green: tn.positive,
52
+ red: tn.negative,
53
+ blue: tn.calm
54
+ }, ms = 0.7, Ms = 1.1, gs = 0.6;
55
+ class bs {
56
56
  constructor() {
57
57
  this.glow = { r: 0, g: 0, b: 0, amount: 0, t: 0, size: 0 };
58
58
  }
59
59
  /** Advance toward `target` (null: fade out). `still` jumps straight there. */
60
60
  step(n, e, s, o, r) {
61
61
  const c = this.glow, l = (a) => r ? 1 : 1 - Math.exp(-n / a), i = e ? 1 : 0;
62
- if (c.amount += (i - c.amount) * l(i > c.amount ? ss : es), e) {
63
- const a = c.amount < 0.03 ? 1 : l(os);
62
+ if (c.amount += (i - c.amount) * l(i > c.amount ? ms : Ms), e) {
63
+ const a = c.amount < 0.03 ? 1 : l(gs);
64
64
  c.r += (e.r - c.r) * a, c.g += (e.g - c.g) * a, c.b += (e.b - c.b) * a;
65
65
  }
66
66
  return c.t = s, c.size = o, c;
67
67
  }
68
68
  }
69
- const dt = {
69
+ const Kn = (t, n) => {
70
+ var e;
71
+ return ((e = t.light) == null ? void 0 : e.r) ?? n * 0.28;
72
+ };
73
+ function vs(t, n, e) {
74
+ const o = (Kn(t, n) * 0.7) ** 2, r = 0.9 * Math.min(1, Math.max(0, e.amount)), c = (l, i) => {
75
+ const a = e.x - l, p = e.y - i, h = r * Math.exp(-(a * a + p * p) / o);
76
+ return [l + a * h, i + p * h];
77
+ };
78
+ return {
79
+ ...t,
80
+ strokes: t.strokes.map((l) => {
81
+ const i = l.pts.slice();
82
+ for (let a = 0; a < i.length; a += 2) [i[a], i[a + 1]] = c(i[a], i[a + 1]);
83
+ return { ...l, pts: i };
84
+ }),
85
+ dots: t.dots.map((l) => {
86
+ const [i, a] = c(l.x, l.y);
87
+ return { ...l, x: i, y: a };
88
+ })
89
+ };
90
+ }
91
+ const xs = (t, n) => Math.min(1, Math.max(0, (0.8 * n - t) / (0.6 * n))), bt = {
70
92
  move: 2,
71
93
  pull: 0.7,
72
94
  deform: 0.1,
@@ -77,11 +99,11 @@ const dt = {
77
99
  blur: 1,
78
100
  bounce: 1
79
101
  };
80
- function cs(t, n) {
102
+ function ys(t, n) {
81
103
  const e = Math.abs(t.move) + Math.abs(t.pull) + 2 * Math.abs(t.deform);
82
104
  return e === 0 ? 0 : Math.ceil(n * 0.36 * e) + 2;
83
105
  }
84
- class rs {
106
+ class ws {
85
107
  constructor() {
86
108
  this.x = 0, this.v = 0, this.landed = !1;
87
109
  }
@@ -98,57 +120,57 @@ class rs {
98
120
  return n <= 0 ? this.landed = !1 : l >= 0 && (this.landed = !0), l < 0 && !this.landed ? 0 : l;
99
121
  }
100
122
  }
101
- function is(t, n, e, s, o = [1 / 0, 1 / 0], r = 0) {
123
+ function Ss(t, n, e, s, o = [1 / 0, 1 / 0], r = 0) {
102
124
  if (Math.abs(n) < 2e-3 || s.move === 0 && s.pull === 0 && s.deform === 0) return t;
103
- const c = e / 2, l = e * 0.36, i = n < 0 ? -1 : 1, a = Math.abs(n), M = (b, S) => {
104
- const x = (b - c) / l, F = (S - c) / l, A = Math.max(0, Math.min(1, (x * i + 1) / 2)), B = Math.max(0, x * i);
105
- return n * l * (s.move + s.pull * A * A + s.deform * B * B * Math.exp(-F * F * 1.5));
106
- }, h = Math.max(0, Math.min(2, s.lens ?? 1)), f = l * 0.9, p = i > 0 ? o[1] : o[0], d = Number.isFinite(p) ? Math.min(f * 0.45, l * 0.3 * h * Math.max(0, s.stretch ?? 1)) : 0;
107
- let m = 1, v = 1 / 0, _ = 1;
108
- if (Number.isFinite(p)) {
109
- v = i > 0 ? e + p : -p;
110
- const b = (S, x, F) => {
111
- _ = Math.max(_, F);
112
- const A = M(S, x) * i;
113
- A > 1e-9 && (m = Math.min(m, Math.max(0, ((v - S) * i - F - d) / A)));
125
+ const c = e / 2, l = e * 0.36, i = n < 0 ? -1 : 1, a = Math.abs(n), p = (b, S) => {
126
+ const y = (b - c) / l, I = (S - c) / l, R = Math.max(0, Math.min(1, (y * i + 1) / 2)), L = Math.max(0, y * i);
127
+ return n * l * (s.move + s.pull * R * R + s.deform * L * L * Math.exp(-I * I * 1.5));
128
+ }, h = Math.max(0, Math.min(2, s.lens ?? 1)), f = l * 0.9, m = i > 0 ? o[1] : o[0], d = Number.isFinite(m) ? Math.min(f * 0.45, l * 0.3 * h * Math.max(0, s.stretch ?? 1)) : 0;
129
+ let M = 1, v = 1 / 0, _ = 1;
130
+ if (Number.isFinite(m)) {
131
+ v = i > 0 ? e + m : -m;
132
+ const b = (S, y, I) => {
133
+ _ = Math.max(_, I);
134
+ const R = p(S, y) * i;
135
+ R > 1e-9 && (M = Math.min(M, Math.max(0, ((v - S) * i - I - d) / R)));
114
136
  };
115
137
  for (const S of t.dots) b(S.x, S.y, S.r);
116
- for (const S of t.strokes) for (let x = 0; x < S.pts.length; x += 2) b(S.pts[x], S.pts[x + 1], 1);
138
+ for (const S of t.strokes) for (let y = 0; y < S.pts.length; y += 2) b(S.pts[y], S.pts[y + 1], 1);
117
139
  }
118
- const u = m < 1 ? Math.min(1, (1 - m) / 0.35) : 0, g = u > 0 ? r * (s.bounce ?? 1) : 0, y = Math.min(1.4, u + Math.max(0, g)), N = l * 0.12 * Math.max(0, -g), T = v - i * _, z = T - i * d, w = l * 0.55 * y * (s.squash ?? 0);
119
- let k = 1 / 0, P = -1 / 0, D = !0;
120
- const O = (b, S) => {
121
- const x = Math.max(0, Math.min(1, ((b - c) / l * i + 1) / 2)), F = 1 - 0.15 * s.deform * a * m * x;
122
- let A = b + M(b, S) * m + i * (w * 0.5 - N), B = c + (S - c) * F;
140
+ const u = M < 1 ? Math.min(1, (1 - M) / 0.35) : 0, g = u > 0 ? r * (s.bounce ?? 1) : 0, x = Math.min(1.4, u + Math.max(0, g)), B = l * 0.12 * Math.max(0, -g), E = v - i * _, q = E - i * d, w = l * 0.55 * x * (s.squash ?? 0);
141
+ let k = 1 / 0, A = -1 / 0, O = !0;
142
+ const U = (b, S) => {
143
+ const y = Math.max(0, Math.min(1, ((b - c) / l * i + 1) / 2)), I = 1 - 0.15 * s.deform * a * M * y;
144
+ let R = b + p(b, S) * M + i * (w * 0.5 - B), L = c + (S - c) * I;
123
145
  if (w > 0) {
124
- const C = (A - (z - i * w)) * i;
146
+ const C = (R - (q - i * w)) * i;
125
147
  if (C > 0) {
126
- const I = C / w, E = w * (I / Math.sqrt(1 + I * I));
127
- A = z - i * w + i * E, B = c + (B - c) * (1 + 0.18 * y * (s.squash ?? 0) * (E / w));
148
+ const F = C / w, T = w * (F / Math.sqrt(1 + F * F));
149
+ R = q - i * w + i * T, L = c + (L - c) * (1 + 0.18 * x * (s.squash ?? 0) * (T / w));
128
150
  }
129
151
  }
130
- return D && (z - A) * i < Math.max(w, f * 0.3) && (k = Math.min(k, B), P = Math.max(P, B)), [A, B];
152
+ return O && (q - R) * i < Math.max(w, f * 0.3) && (k = Math.min(k, L), A = Math.max(A, L)), [R, L];
131
153
  };
132
154
  for (const b of t.dots)
133
- [b.x, b.y] = O(b.x, b.y);
155
+ [b.x, b.y] = U(b.x, b.y);
134
156
  for (const b of t.strokes)
135
157
  for (let S = 0; S < b.pts.length; S += 2) {
136
- const [x, F] = O(b.pts[S], b.pts[S + 1]);
137
- b.pts[S] = x, b.pts[S + 1] = F;
158
+ const [y, I] = U(b.pts[S], b.pts[S + 1]);
159
+ b.pts[S] = y, b.pts[S + 1] = I;
138
160
  }
139
- if (u > 0 && P > k) {
140
- const b = h * y;
161
+ if (u > 0 && A > k) {
162
+ const b = h * x;
141
163
  t.contact = {
142
164
  side: i,
143
- x: T,
165
+ x: E,
144
166
  y0: k,
145
- y1: P,
167
+ y1: A,
146
168
  depth: w,
147
169
  press: u,
148
170
  lens: b > 0.02 ? {
149
171
  zone: f,
150
172
  // drawn across the gap as it presses, all the way at full press
151
- gap: d * Math.min(1, y),
173
+ gap: d * Math.min(1, x),
152
174
  flare: 0.22 * b * Math.max(0, s.stretch ?? 1),
153
175
  split: f * 0.1 * b * Math.max(0, s.split ?? 1),
154
176
  blur: f * 0.075 * b * Math.max(0, s.blur ?? 1),
@@ -156,188 +178,188 @@ function is(t, n, e, s, o = [1 / 0, 1 / 0], r = 0) {
156
178
  } : void 0
157
179
  };
158
180
  }
159
- if (D = !1, t.light) {
181
+ if (O = !1, t.light) {
160
182
  const b = t.light;
161
- [b.cx, b.cy] = O(b.cx, b.cy);
162
- for (const S of b.spec) [S.x, S.y] = O(S.x, S.y);
183
+ [b.cx, b.cy] = U(b.cx, b.cy);
184
+ for (const S of b.spec) [S.x, S.y] = U(S.x, S.y);
163
185
  }
164
186
  return t;
165
187
  }
166
- const ht = Math.PI * 2;
167
- function Et(t, n, e) {
188
+ const Mt = Math.PI * 2;
189
+ function Ct(t, n, e) {
168
190
  return t + (n - t) * e;
169
191
  }
170
- function K(t) {
192
+ function j(t) {
171
193
  return t < 0 ? 0 : t > 1 ? 1 : t;
172
194
  }
173
- function pn(t, n, e) {
174
- const s = K((e - t) / (n - t));
195
+ function wn(t, n, e) {
196
+ const s = j((e - t) / (n - t));
175
197
  return s * s * (3 - 2 * s);
176
198
  }
177
- const Wt = (t) => t < 1e-6 ? 1 : Math.sin(t) / t, ls = Math.hypot(2.1, 1.3), hs = Math.hypot(1.9, 1.7), us = Math.hypot(4.3 - 2.9, -3.7, -3.1), fs = Math.hypot(4.3 + 2.9, 3.7, -3.1);
178
- function Mn(t, n, e, s = 1) {
179
- const o = 1 / Math.max(0.05, s), r = 0.9 * e, c = -0.7 * e + 1.3, l = 2.1 * e, i = -1.6 * e, a = t * (0.55 * Math.sin(r) * Wt(ls * o) + 0.45 * Math.sin(c) * Wt(hs * o)) + n * 0.5 * (Math.cos(l - i) * Wt(us * o) - Math.cos(l + i) * Wt(fs * o));
180
- return (M, h, f) => (M *= o, h *= o, f *= o, t * (0.55 * Math.sin(2.1 * M + 1.3 * h + r) + 0.45 * Math.sin(1.7 * f - 1.9 * h + c)) + n * Math.sin(4.3 * M - 3.1 * f + l) * Math.sin(3.7 * h + 2.9 * M + i) - a);
199
+ const jt = (t) => t < 1e-6 ? 1 : Math.sin(t) / t, Es = Math.hypot(2.1, 1.3), Ts = Math.hypot(1.9, 1.7), Rs = Math.hypot(4.3 - 2.9, -3.7, -3.1), As = Math.hypot(4.3 + 2.9, 3.7, -3.1);
200
+ function Sn(t, n, e, s = 1) {
201
+ const o = 1 / Math.max(0.05, s), r = 0.9 * e, c = -0.7 * e + 1.3, l = 2.1 * e, i = -1.6 * e, a = t * (0.55 * Math.sin(r) * jt(Es * o) + 0.45 * Math.sin(c) * jt(Ts * o)) + n * 0.5 * (Math.cos(l - i) * jt(Rs * o) - Math.cos(l + i) * jt(As * o));
202
+ return (p, h, f) => (p *= o, h *= o, f *= o, t * (0.55 * Math.sin(2.1 * p + 1.3 * h + r) + 0.45 * Math.sin(1.7 * f - 1.9 * h + c)) + n * Math.sin(4.3 * p - 3.1 * f + l) * Math.sin(3.7 * h + 2.9 * p + i) - a);
181
203
  }
182
- function xt(t, n) {
204
+ function Tt(t, n) {
183
205
  const e = Math.sin(t * 12.9898 + n * 78.233) * 43758.5453;
184
206
  return e - Math.floor(e);
185
207
  }
186
- function yt(t, n, e) {
208
+ function St(t, n, e) {
187
209
  const s = Math.sin(t * 127.1 + n * 311.7 + e * 74.7) * 43758.5453;
188
210
  return s - Math.floor(s);
189
211
  }
190
- function Gt(t, n, e) {
212
+ function zt(t, n, e) {
191
213
  const s = Math.floor(t), o = Math.floor(n), r = Math.floor(e);
192
214
  let c = t - s, l = n - o, i = e - r;
193
215
  c = c * c * (3 - 2 * c), l = l * l * (3 - 2 * l), i = i * i * (3 - 2 * i);
194
- const a = Et(yt(s, o, r), yt(s + 1, o, r), c), M = Et(yt(s, o + 1, r), yt(s + 1, o + 1, r), c), h = Et(yt(s, o, r + 1), yt(s + 1, o, r + 1), c), f = Et(yt(s, o + 1, r + 1), yt(s + 1, o + 1, r + 1), c);
195
- return Et(Et(a, M, l), Et(h, f, l), i);
216
+ const a = Ct(St(s, o, r), St(s + 1, o, r), c), p = Ct(St(s, o + 1, r), St(s + 1, o + 1, r), c), h = Ct(St(s, o, r + 1), St(s + 1, o, r + 1), c), f = Ct(St(s, o + 1, r + 1), St(s + 1, o + 1, r + 1), c);
217
+ return Ct(Ct(a, p, l), Ct(h, f, l), i);
196
218
  }
197
- function mn(t, n) {
219
+ function En(t, n) {
198
220
  const e = Math.PI * (3 - Math.sqrt(5)), s = 1 - 2 * (t + 0.5) / n, o = Math.sqrt(1 - s * s), r = t * e;
199
221
  return [o * Math.cos(r), s, o * Math.sin(r)];
200
222
  }
201
- function Yt(t, n, e, s, o) {
223
+ function nn(t, n, e, s, o) {
202
224
  const r = Math.sin(n), c = Math.cos(n), l = Math.sin(t), i = Math.cos(t);
203
- return (a, M, h) => {
204
- const f = a * i + h * l, p = -a * l + h * i, d = M * c - p * r, m = M * r + p * c;
205
- return [e + f * o, s - d * o, m];
225
+ return (a, p, h) => {
226
+ const f = a * i + h * l, m = -a * l + h * i, d = p * c - m * r, M = p * r + m * c;
227
+ return [e + f * o, s - d * o, M];
206
228
  };
207
229
  }
208
- function Lt(t, n = 0.6) {
230
+ function $t(t, n = 0.6) {
209
231
  return (t / 200) ** n;
210
232
  }
211
- function Ct(t, n, e = 0.3) {
233
+ function Lt(t, n, e = 0.3) {
212
234
  const s = [];
213
235
  for (const o of t)
214
236
  (o.a ?? 1) < 0.02 || (o.r = Math.max(e, o.r), s.push(o));
215
237
  return s.sort((o, r) => o.z - r.z), { dots: s, strokes: n };
216
238
  }
217
- const Xt = 32;
218
- function ds(t, n = 0, e = 0, s = 1) {
239
+ const Zt = 32;
240
+ function Ps(t, n = 0, e = 0, s = 1) {
219
241
  const o = t.r / 255, r = t.g / 255, c = t.b / 255, l = Math.max(o, r, c), i = Math.min(o, r, c);
220
- let a = (l + i) / 2, M = l === i ? 0 : (l - i) / (1 - Math.abs(2 * a - 1)), h = 0;
242
+ let a = (l + i) / 2, p = l === i ? 0 : (l - i) / (1 - Math.abs(2 * a - 1)), h = 0;
221
243
  if (l !== i) {
222
- const m = l - i;
223
- h = l === o ? (r - c) / m % 6 : l === r ? (c - o) / m + 2 : (o - r) / m + 4, h *= 60;
244
+ const M = l - i;
245
+ h = l === o ? (r - c) / M % 6 : l === r ? (c - o) / M + 2 : (o - r) / M + 4, h *= 60;
224
246
  }
225
- h = ((h + n) % 360 + 360) % 360, M = Math.min(1, M * (1 + e)), a = 0.5 + (a - 0.5) * (1 - 0.6 * e), a = Math.max(0, Math.min(1, a * s));
226
- const f = (m) => (m + h / 30) % 12, p = M * Math.min(a, 1 - a), d = (m) => a - p * Math.max(-1, Math.min(f(m) - 3, 9 - f(m), 1));
247
+ h = ((h + n) % 360 + 360) % 360, p = Math.min(1, p * (1 + e)), a = 0.5 + (a - 0.5) * (1 - 0.6 * e), a = Math.max(0, Math.min(1, a * s));
248
+ const f = (M) => (M + h / 30) % 12, m = p * Math.min(a, 1 - a), d = (M) => a - m * Math.max(-1, Math.min(f(M) - 3, 9 - f(M), 1));
227
249
  return [Math.round(d(0) * 255), Math.round(d(8) * 255), Math.round(d(4) * 255)];
228
250
  }
229
- function ps(t) {
251
+ function _s(t) {
230
252
  const n = Math.max(0, Math.min(1, t.saturation)), e = Math.max(0, Math.min(1, t.neutral)), s = t.start ?? 0.1, o = Math.max(0.05, t.width ?? 0.6), r = [];
231
- for (let h = 0; h < Xt; h++) {
232
- const f = h / (Xt - 1), p = Math.max(0, Math.min(1, (f - s) / o)), d = p * p * (3 - 2 * p);
253
+ for (let h = 0; h < Zt; h++) {
254
+ const f = h / (Zt - 1), m = Math.max(0, Math.min(1, (f - s) / o)), d = m * m * (3 - 2 * m);
233
255
  r.push(n * (1 - e * (1 - d)));
234
256
  }
235
- const c = t.angle * Math.PI / 180, l = Math.cos(c), i = Math.sin(c), a = t.size / 2, M = t.size * 0.8;
257
+ const c = t.angle * Math.PI / 180, l = Math.cos(c), i = Math.sin(c), a = t.size / 2, p = t.size * 0.8;
236
258
  return {
237
- rgb: ds(t.accent, t.hue, Math.max(0, Math.min(1, t.vivid ?? 0)), t.brightness),
259
+ rgb: Ps(t.accent, t.hue, Math.max(0, Math.min(1, t.vivid ?? 0)), t.brightness),
238
260
  mix: r,
239
261
  saturation: n,
240
262
  at: (h, f) => {
241
- const p = ((h - a) * l + (f - a) * i) / M + 0.5;
242
- return Math.max(0, Math.min(Xt - 1, Math.round(p * (Xt - 1))));
263
+ const m = ((h - a) * l + (f - a) * i) / p + 0.5;
264
+ return Math.max(0, Math.min(Zt - 1, Math.round(m * (Zt - 1))));
243
265
  }
244
266
  };
245
267
  }
246
- const Ms = [120, 232, 214], ms = [64, 72, 255];
247
- function An(t, n, e) {
268
+ const ks = [120, 232, 214], Cs = [64, 72, 255];
269
+ function Dn(t, n, e) {
248
270
  t /= 255, n /= 255, e /= 255;
249
271
  const s = Math.max(t, n, e), o = Math.min(t, n, e), r = (s + o) / 2;
250
272
  if (s === o) return [0, 0, r];
251
273
  const c = s - o, l = r > 0.5 ? c / (2 - s - o) : c / (s + o);
252
274
  return [(s === t ? (n - e) / c + (n < e ? 6 : 0) : s === n ? (e - t) / c + 2 : (t - n) / c + 4) / 6, l, r];
253
275
  }
254
- function gs(t, n, e) {
276
+ function Fs(t, n, e) {
255
277
  const s = (c) => (c + t * 12) % 12, o = n * Math.min(e, 1 - e), r = (c) => e - o * Math.max(-1, Math.min(s(c) - 3, 9 - s(c), 1));
256
278
  return [r(0) * 255, r(8) * 255, r(4) * 255];
257
279
  }
258
- const on = (t) => (t /= 255) <= 0.04045 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4, bs = (t) => 255 * (t <= 31308e-7 ? 12.92 * t : 1.055 * Math.max(0, t) ** (1 / 2.4) - 0.055);
259
- function dn(t, n, e) {
260
- const [s, o, r] = [on(t), on(n), on(e)], c = Math.cbrt(0.4122214708 * s + 0.5363325363 * o + 0.0514459929 * r), l = Math.cbrt(0.2119034982 * s + 0.6806995451 * o + 0.1073969566 * r), i = Math.cbrt(0.0883024619 * s + 0.2817188376 * o + 0.6299787005 * r);
280
+ const dn = (t) => (t /= 255) <= 0.04045 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4, Is = (t) => 255 * (t <= 31308e-7 ? 12.92 * t : 1.055 * Math.max(0, t) ** (1 / 2.4) - 0.055);
281
+ function yn(t, n, e) {
282
+ const [s, o, r] = [dn(t), dn(n), dn(e)], c = Math.cbrt(0.4122214708 * s + 0.5363325363 * o + 0.0514459929 * r), l = Math.cbrt(0.2119034982 * s + 0.6806995451 * o + 0.1073969566 * r), i = Math.cbrt(0.0883024619 * s + 0.2817188376 * o + 0.6299787005 * r);
261
283
  return [
262
284
  0.2104542553 * c + 0.793617785 * l - 0.0040720468 * i,
263
285
  1.9779984951 * c - 2.428592205 * l + 0.4505937099 * i,
264
286
  0.0259040371 * c + 0.7827717662 * l - 0.808675766 * i
265
287
  ];
266
288
  }
267
- function zn(t, n, e) {
268
- const s = (t + 0.3963377774 * n + 0.2158037573 * e) ** 3, o = (t - 0.1055613458 * n - 0.0638541728 * e) ** 3, r = (t - 0.0894841775 * n - 1.291485548 * e) ** 3, c = (l) => Math.max(0, Math.min(255, bs(l)));
289
+ function Hn(t, n, e) {
290
+ const s = (t + 0.3963377774 * n + 0.2158037573 * e) ** 3, o = (t - 0.1055613458 * n - 0.0638541728 * e) ** 3, r = (t - 0.0894841775 * n - 1.291485548 * e) ** 3, c = (l) => Math.max(0, Math.min(255, Is(l)));
269
291
  return [
270
292
  c(4.0767416621 * s - 3.3077115913 * o + 0.2309699292 * r),
271
293
  c(-1.2684380046 * s + 2.6097574011 * o - 0.3413193965 * r),
272
294
  c(-0.0041960863 * s - 0.7034186147 * o + 1.707614701 * r)
273
295
  ];
274
296
  }
275
- function vs(t, n, e, s) {
297
+ function Ns(t, n, e, s) {
276
298
  const o = s && s.amount > 5e-3 ? s : void 0;
277
299
  return t.map(([r, c, l, i]) => {
278
300
  if (e && (c += (e.r - c) * 0.85, l += (e.g - l) * 0.85, i += (e.b - i) * 0.85), o) {
279
- const [, M, h] = An(c, l, i), [f] = An(o.r, o.g, o.b), p = gs((f + 0.1 * Math.sin(2 * Math.PI * r) + 1) % 1, M, h), d = dn(c, l, i), m = dn(p[0], p[1], p[2]), v = o.amount;
280
- [c, l, i] = zn(d[0] + (m[0] - d[0]) * v, d[1] + (m[1] - d[1]) * v, d[2] + (m[2] - d[2]) * v);
301
+ const [, p, h] = Dn(c, l, i), [f] = Dn(o.r, o.g, o.b), m = Fs((f + 0.1 * Math.sin(2 * Math.PI * r) + 1) % 1, p, h), d = yn(c, l, i), M = yn(m[0], m[1], m[2]), v = o.amount;
302
+ [c, l, i] = Hn(d[0] + (M[0] - d[0]) * v, d[1] + (M[1] - d[1]) * v, d[2] + (M[2] - d[2]) * v);
281
303
  }
282
304
  const a = n ? 1 : 0.82;
283
305
  return [r, c * a, l * a, i * a];
284
306
  });
285
307
  }
286
- const Dn = (t, n, e) => `rgb(${Math.round(t)},${Math.round(n)},${Math.round(e)})`;
287
- function ys(t, n = 36) {
308
+ const Yn = (t, n, e) => `rgb(${Math.round(t)},${Math.round(n)},${Math.round(e)})`;
309
+ function Bs(t, n = 36) {
288
310
  const e = t.filter(([a]) => a < 1), s = e.length;
289
311
  if (s < 3) return t;
290
- const o = e.map(([, a, M, h]) => dn(a, M, h)), r = (a) => (a % s + s) % s, c = (a) => e[r(a)][0] + Math.floor(a / s), l = (a) => {
291
- const M = c(a + 1) - c(a - 1);
292
- return o[r(a + 1)].map((h, f) => (h - o[r(a - 1)][f]) / M);
312
+ const o = e.map(([, a, p, h]) => yn(a, p, h)), r = (a) => (a % s + s) % s, c = (a) => e[r(a)][0] + Math.floor(a / s), l = (a) => {
313
+ const p = c(a + 1) - c(a - 1);
314
+ return o[r(a + 1)].map((h, f) => (h - o[r(a - 1)][f]) / p);
293
315
  }, i = [];
294
316
  for (let a = 0; a <= n; a++) {
295
- const M = a / n;
317
+ const p = a / n;
296
318
  let h = -1;
297
- for (; h < s - 1 && c(h + 1) <= M; ) h++;
298
- const f = c(h + 1) - c(h), p = (M - c(h)) / f, d = p * p, m = d * p, v = o[r(h)], _ = o[r(h + 1)], u = l(h), g = l(h + 1), y = [0, 1, 2].map(
299
- (w) => (2 * m - 3 * d + 1) * v[w] + (m - 2 * d + p) * f * u[w] + (-2 * m + 3 * d) * _[w] + (m - d) * f * g[w]
300
- ), [N, T, z] = zn(y[0], y[1], y[2]);
301
- i.push([M, N, T, z]);
319
+ for (; h < s - 1 && c(h + 1) <= p; ) h++;
320
+ const f = c(h + 1) - c(h), m = (p - c(h)) / f, d = m * m, M = d * m, v = o[r(h)], _ = o[r(h + 1)], u = l(h), g = l(h + 1), x = [0, 1, 2].map(
321
+ (w) => (2 * M - 3 * d + 1) * v[w] + (M - 2 * d + m) * f * u[w] + (-2 * M + 3 * d) * _[w] + (M - d) * f * g[w]
322
+ ), [B, E, q] = Hn(x[0], x[1], x[2]);
323
+ i.push([p, B, E, q]);
302
324
  }
303
325
  return i;
304
326
  }
305
- const xs = 1.5, qn = typeof CanvasRenderingContext2D == "function" && "filter" in CanvasRenderingContext2D.prototype, Rn = /* @__PURE__ */ new WeakMap();
306
- function an(t, n) {
327
+ const Ls = 1.5, jn = typeof CanvasRenderingContext2D == "function" && "filter" in CanvasRenderingContext2D.prototype, qn = /* @__PURE__ */ new WeakMap();
328
+ function pn(t, n) {
307
329
  return (typeof OffscreenCanvas == "function" ? new OffscreenCanvas(t, n) : Object.assign(document.createElement("canvas"), { width: t, height: n })).getContext("2d");
308
330
  }
309
- function ws(t) {
331
+ function Ds(t) {
310
332
  const { width: n, height: e } = t.canvas;
311
- let s = Rn.get(t);
312
- return (!s || s.full.canvas.width !== n || s.full.canvas.height !== e) && (s = { full: an(n, e) }, qn || (s.half = an(Math.ceil(n / 2), Math.ceil(e / 2)), s.quarter = an(Math.ceil(n / 4), Math.ceil(e / 4))), Rn.set(t, s)), s.full.setTransform(1, 0, 0, 1, 0, 0), s.full.clearRect(0, 0, n, e), s.full.setTransform(t.getTransform()), s;
333
+ let s = qn.get(t);
334
+ return (!s || s.full.canvas.width !== n || s.full.canvas.height !== e) && (s = { full: pn(n, e) }, jn || (s.half = pn(Math.ceil(n / 2), Math.ceil(e / 2)), s.quarter = pn(Math.ceil(n / 4), Math.ceil(e / 4))), qn.set(t, s)), s.full.setTransform(1, 0, 0, 1, 0, 0), s.full.clearRect(0, 0, n, e), s.full.setTransform(t.getTransform()), s;
313
335
  }
314
- function cn(t, n) {
336
+ function mn(t, n) {
315
337
  t.globalCompositeOperation = "copy", t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high", t.drawImage(n.canvas, 0, 0, t.canvas.width, t.canvas.height);
316
338
  }
317
- function Ss(t, n, e) {
339
+ function qs(t, n, e) {
318
340
  const s = t.getTransform();
319
- t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.globalCompositeOperation = e, t.globalAlpha = 1, t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high", qn ? (t.filter = `blur(${xs * Math.hypot(s.a, s.b)}px)`, t.drawImage(n.full.canvas, 0, 0)) : n.half && n.quarter && (cn(n.half, n.full), cn(n.quarter, n.half), cn(n.half, n.quarter), t.drawImage(n.half.canvas, 0, 0, n.half.canvas.width * 2, n.half.canvas.height * 2)), t.restore();
341
+ t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.globalCompositeOperation = e, t.globalAlpha = 1, t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high", jn ? (t.filter = `blur(${Ls * Math.hypot(s.a, s.b)}px)`, t.drawImage(n.full.canvas, 0, 0)) : n.half && n.quarter && (mn(n.half, n.full), mn(n.quarter, n.half), mn(n.half, n.quarter), t.drawImage(n.half.canvas, 0, 0, n.half.canvas.width * 2, n.half.canvas.height * 2)), t.restore();
320
342
  }
321
- function Pn(t, n, e) {
343
+ function On(t, n, e) {
322
344
  const s = typeof t.createConicGradient == "function" ? t.createConicGradient(n.angle, n.cx, n.cy) : t.createLinearGradient(n.cx - n.r, n.cy - n.r, n.cx + n.r, n.cy + n.r);
323
- for (const [o, r, c, l] of e) s.addColorStop(K(o), Dn(r, c, l));
345
+ for (const [o, r, c, l] of e) s.addColorStop(j(o), Yn(r, c, l));
324
346
  return s;
325
347
  }
326
- function Ts(t, n, e, s, o, r) {
327
- const c = ys(vs(e.stops, s, o, r)), l = Pn(t, e, c), i = n.strokes.map((u) => {
328
- const g = new Path2D(), y = u.pts.length >> 1;
329
- let N = 0;
330
- for (let T = 0; T < y; T++)
331
- T === 0 ? g.moveTo(u.pts[0], u.pts[1]) : g.lineTo(u.pts[2 * T], u.pts[2 * T + 1]), N += u.a[T];
332
- return u.closed && g.closePath(), { p: g, a: y ? N / y : 1, w: u.w };
333
- }), a = Math.max(1, i.length), M = e.intensity, h = s ? "lighter" : "source-over", f = (u, g, y = t) => {
334
- for (const N of i)
335
- y.lineWidth = u(N.w), y.globalAlpha = K(g(N.a)), y.stroke(N.p);
336
- }, p = (u, g) => {
348
+ function Os(t, n, e, s, o, r) {
349
+ const c = Bs(Ns(e.stops, s, o, r)), l = On(t, e, c), i = n.strokes.map((u) => {
350
+ const g = new Path2D(), x = u.pts.length >> 1;
351
+ let B = 0;
352
+ for (let E = 0; E < x; E++)
353
+ E === 0 ? g.moveTo(u.pts[0], u.pts[1]) : g.lineTo(u.pts[2 * E], u.pts[2 * E + 1]), B += u.a[E];
354
+ return u.closed && g.closePath(), { p: g, a: x ? B / x : 1, w: u.w };
355
+ }), a = Math.max(1, i.length), p = e.intensity, h = s ? "lighter" : "source-over", f = (u, g, x = t) => {
356
+ for (const B of i)
357
+ x.lineWidth = u(B.w), x.globalAlpha = j(g(B.a)), x.stroke(B.p);
358
+ }, m = (u, g) => {
337
359
  u.lineCap = "round", u.lineJoin = "round", u.globalCompositeOperation = h, u.strokeStyle = g;
338
- }, d = ws(t), m = d.full;
339
- p(m, Pn(m, e, c));
340
- const v = e.halo * M * (s ? 1 : 0.2) / a;
360
+ }, d = Ds(t), M = d.full;
361
+ m(M, On(M, e, c));
362
+ const v = e.halo * p * (s ? 1 : 0.2) / a;
341
363
  for (const [u, g] of [
342
364
  [0.7, 0.045],
343
365
  [0.42, 0.075],
@@ -347,50 +369,50 @@ function Ts(t, n, e, s, o, r) {
347
369
  f(
348
370
  () => e.r * u,
349
371
  () => g * v,
350
- m
372
+ M
351
373
  );
352
- const _ = M * (s ? 1 : 0.6);
374
+ const _ = p * (s ? 1 : 0.6);
353
375
  for (const [u, g] of [
354
376
  [16, 0.05],
355
377
  [8, 0.11],
356
378
  [4, 0.2]
357
379
  ])
358
380
  f(
359
- (y) => y * u,
360
- (y) => g * _ * y,
361
- m
381
+ (x) => x * u,
382
+ (x) => g * _ * x,
383
+ M
362
384
  );
363
- if (Ss(t, d, h), t.save(), p(t, l), s && e.fringe > 0) {
364
- for (const [u, g, y] of [
365
- [1 + e.fringe, Ms, 0.16],
366
- [1 - e.fringe, ms, 0.22]
385
+ if (qs(t, d, h), t.save(), m(t, l), s && e.fringe > 0) {
386
+ for (const [u, g, x] of [
387
+ [1 + e.fringe, ks, 0.16],
388
+ [1 - e.fringe, Cs, 0.22]
367
389
  ])
368
- t.save(), t.translate(e.cx, e.cy), t.scale(u, u), t.translate(-e.cx, -e.cy), t.strokeStyle = Dn(g[0], g[1], g[2]), f(
369
- (N) => N * 1.4 / u,
370
- (N) => y * M * N
390
+ t.save(), t.translate(e.cx, e.cy), t.scale(u, u), t.translate(-e.cx, -e.cy), t.strokeStyle = Yn(g[0], g[1], g[2]), f(
391
+ (B) => B * 1.4 / u,
392
+ (B) => x * p * B
371
393
  ), t.restore();
372
394
  t.strokeStyle = l;
373
395
  }
374
396
  if (f(
375
397
  (u) => u,
376
- (u) => 0.7 * u * (0.75 + 0.25 * M)
398
+ (u) => 0.7 * u * (0.75 + 0.25 * p)
377
399
  ), s)
378
400
  for (const u of e.spec) {
379
401
  const g = t.createRadialGradient(u.x, u.y, 0, u.x, u.y, u.r);
380
402
  g.addColorStop(0, "rgba(255,255,255,1)"), g.addColorStop(0.35, "rgba(255,255,255,0.45)"), g.addColorStop(1, "rgba(255,255,255,0)"), t.strokeStyle = g, f(
381
- (y) => y * 2.2,
382
- (y) => u.a * y
403
+ (x) => x * 2.2,
404
+ (x) => u.a * x
383
405
  );
384
406
  }
385
407
  t.restore();
386
408
  }
387
- const Es = `
409
+ const Gs = `
388
410
  attribute vec2 aPos;
389
411
  varying vec2 vUv;
390
412
  void main() {
391
413
  vUv = vec2(aPos.x + 1.0, 1.0 - aPos.y) * 0.5;
392
414
  gl_Position = vec4(aPos, 0.0, 1.0);
393
- }`, As = `
415
+ }`, Us = `
394
416
  precision highp float;
395
417
  uniform sampler2D uTex;
396
418
  uniform vec2 uSize;
@@ -425,16 +447,16 @@ void main() {
425
447
  }
426
448
  gl_FragColor = vec4(rgb, a) / float(TAPS);
427
449
  }`;
428
- let Vt;
429
- function Rs() {
450
+ let Jt;
451
+ function zs() {
430
452
  if (typeof document > "u") return null;
431
453
  const t = document.createElement("canvas"), n = t.getContext("webgl", { premultipliedAlpha: !0, antialias: !1, depth: !1 });
432
454
  if (!n) return null;
433
455
  const e = (i, a) => {
434
- const M = n.createShader(i);
435
- return n.shaderSource(M, a), n.compileShader(M), M;
456
+ const p = n.createShader(i);
457
+ return n.shaderSource(p, a), n.compileShader(p), p;
436
458
  }, s = n.createProgram();
437
- if (n.attachShader(s, e(n.VERTEX_SHADER, Es)), n.attachShader(s, e(n.FRAGMENT_SHADER, As)), n.linkProgram(s), !n.getProgramParameter(s, n.LINK_STATUS)) return null;
459
+ if (n.attachShader(s, e(n.VERTEX_SHADER, Gs)), n.attachShader(s, e(n.FRAGMENT_SHADER, Us)), n.linkProgram(s), !n.getProgramParameter(s, n.LINK_STATUS)) return null;
438
460
  n.useProgram(s);
439
461
  const o = n.createBuffer();
440
462
  n.bindBuffer(n.ARRAY_BUFFER, o), n.bufferData(n.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]), n.STATIC_DRAW);
@@ -447,66 +469,66 @@ function Rs() {
447
469
  l[i] = n.getUniformLocation(s, i);
448
470
  return { gl: n, canvas: t, source: document.createElement("canvas"), tex: c, u: l };
449
471
  }
450
- function Ps(t, n, e, s) {
451
- if (Vt === void 0 && (Vt = Rs()), !Vt) return !1;
452
- const { gl: o, canvas: r, source: c, tex: l, u: i } = Vt, a = t.getTransform(), M = Math.hypot(a.a, a.b) || 1, h = t.canvas.width, f = t.canvas.height, p = a.a * e + a.e, d = s.zone * M, m = s.blur * M, v = Math.max(0, Math.floor(n > 0 ? p - d - 2 * m - 4 : 0)), u = Math.min(h, Math.ceil(n > 0 ? h : p + d + 2 * m + 4)) - v;
472
+ function $s(t, n, e, s) {
473
+ if (Jt === void 0 && (Jt = zs()), !Jt) return !1;
474
+ const { gl: o, canvas: r, source: c, tex: l, u: i } = Jt, a = t.getTransform(), p = Math.hypot(a.a, a.b) || 1, h = t.canvas.width, f = t.canvas.height, m = a.a * e + a.e, d = s.zone * p, M = s.blur * p, v = Math.max(0, Math.floor(n > 0 ? m - d - 2 * M - 4 : 0)), u = Math.min(h, Math.ceil(n > 0 ? h : m + d + 2 * M + 4)) - v;
453
475
  if (u < 2 || f < 2) return !1;
454
476
  (c.width !== u || c.height !== f) && (c.width = u, c.height = f);
455
477
  const g = c.getContext("2d");
456
- return g.clearRect(0, 0, u, f), g.drawImage(t.canvas, v, 0, u, f, 0, 0, u, f), (r.width !== u || r.height !== f) && (r.width = u, r.height = f), o.viewport(0, 0, u, f), o.bindTexture(o.TEXTURE_2D, l), o.texImage2D(o.TEXTURE_2D, 0, o.RGBA, o.RGBA, o.UNSIGNED_BYTE, c), o.uniform2f(i.uSize, u, f), o.uniform1f(i.uWall, p - v), o.uniform1f(i.uSide, n), o.uniform1f(i.uZone, d), o.uniform1f(i.uGap, s.gap * M), o.uniform1f(i.uFlare, s.flare), o.uniform1f(i.uSplit, s.split * M), o.uniform1f(i.uBlur, m), o.uniform1f(i.uCy, a.d * s.cy + a.f), o.clearColor(0, 0, 0, 0), o.clear(o.COLOR_BUFFER_BIT), o.drawArrays(o.TRIANGLE_STRIP, 0, 4), t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.globalCompositeOperation = "copy", t.beginPath(), t.rect(v, 0, u, f), t.clip(), t.drawImage(r, v, 0), t.restore(), !0;
478
+ return g.clearRect(0, 0, u, f), g.drawImage(t.canvas, v, 0, u, f, 0, 0, u, f), (r.width !== u || r.height !== f) && (r.width = u, r.height = f), o.viewport(0, 0, u, f), o.bindTexture(o.TEXTURE_2D, l), o.texImage2D(o.TEXTURE_2D, 0, o.RGBA, o.RGBA, o.UNSIGNED_BYTE, c), o.uniform2f(i.uSize, u, f), o.uniform1f(i.uWall, m - v), o.uniform1f(i.uSide, n), o.uniform1f(i.uZone, d), o.uniform1f(i.uGap, s.gap * p), o.uniform1f(i.uFlare, s.flare), o.uniform1f(i.uSplit, s.split * p), o.uniform1f(i.uBlur, M), o.uniform1f(i.uCy, a.d * s.cy + a.f), o.clearColor(0, 0, 0, 0), o.clear(o.COLOR_BUFFER_BIT), o.drawArrays(o.TRIANGLE_STRIP, 0, 4), t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.globalCompositeOperation = "copy", t.beginPath(), t.rect(v, 0, u, f), t.clip(), t.drawImage(r, v, 0), t.restore(), !0;
457
479
  }
458
- function Gn(t, n, e, s) {
459
- const o = 2.2 / s.size, r = Gt(t * o + s.t * 0.11, n * o - s.t * 0.08, s.t * 0.07), c = pn(0.3, 0.75, r);
460
- return s.amount * (0.2 + 0.75 * c) * K(1.3 - e);
480
+ function Zn(t, n, e, s) {
481
+ const o = 2.2 / s.size, r = zt(t * o + s.t * 0.11, n * o - s.t * 0.08, s.t * 0.07), c = wn(0.3, 0.75, r);
482
+ return s.amount * (0.2 + 0.75 * c) * j(1.3 - e);
461
483
  }
462
- function Ln(t, n, e, s, o, r = 0, c, l = 0) {
463
- const i = Math.round(n * 1e3) / 1e3, a = (d) => e ? d * (1 - t) : d + (255 - d) * t, M = (e ? 1 - t : t) * 255;
464
- let h = s ? a(s.r) : M, f = s ? a(s.g) : M, p = s ? a(s.b) : M;
465
- return c && l > 0 && (h += (a(c[0]) - h) * l, f += (a(c[1]) - f) * l, p += (a(c[2]) - p) * l), o && r > 0 && (h += (a(o.r) - h) * r, f += (a(o.g) - f) * r, p += (a(o.b) - p) * r), `rgba(${Math.round(h)},${Math.round(f)},${Math.round(p)},${i})`;
484
+ function Jn(t, n, e, s, o, r = 0, c, l = 0) {
485
+ const i = Math.round(n * 1e3) / 1e3, a = (d) => e ? d * (1 - t) : d + (255 - d) * t, p = (e ? 1 - t : t) * 255;
486
+ let h = s ? a(s.r) : p, f = s ? a(s.g) : p, m = s ? a(s.b) : p;
487
+ return c && l > 0 && (h += (a(c[0]) - h) * l, f += (a(c[1]) - f) * l, m += (a(c[2]) - m) * l), o && r > 0 && (h += (a(o.r) - h) * r, f += (a(o.g) - f) * r, m += (a(o.b) - m) * r), `rgba(${Math.round(h)},${Math.round(f)},${Math.round(m)},${i})`;
466
488
  }
467
- const _n = 24, kn = 8;
468
- function _s(t, n, e, s, o, r) {
489
+ const Gn = 24, Un = 8;
490
+ function Ws(t, n, e, s, o, r) {
469
491
  const c = o && o.amount > 5e-3 ? o : void 0, l = r && r.saturation > 0 ? r : void 0, i = /* @__PURE__ */ new Map();
470
492
  for (const a of n) {
471
- const M = a.pts.length >> 1, h = a.closed ? M : M - 1;
472
- let f = "", p;
493
+ const p = a.pts.length >> 1, h = a.closed ? p : p - 1;
494
+ let f = "", m;
473
495
  for (let d = 0; d < h; d++) {
474
- const m = d + 1 === M ? 0 : d + 1, v = Math.round(K((a.a[d] + a.a[m]) / 2) * _n);
496
+ const M = d + 1 === p ? 0 : d + 1, v = Math.round(j((a.a[d] + a.a[M]) / 2) * Gn);
475
497
  if (v === 0) {
476
498
  f = "";
477
499
  continue;
478
500
  }
479
501
  const _ = c ? Math.round(
480
- Gn((a.pts[2 * d] + a.pts[2 * m]) / 2, (a.pts[2 * d + 1] + a.pts[2 * m + 1]) / 2, a.white, c) * kn
481
- ) : 0, u = l ? l.at((a.pts[2 * d] + a.pts[2 * m]) / 2, (a.pts[2 * d + 1] + a.pts[2 * m + 1]) / 2) : 0, g = `${v}|${a.white}|${Math.round(a.w * 20)}|${_}|${u}`;
502
+ Zn((a.pts[2 * d] + a.pts[2 * M]) / 2, (a.pts[2 * d + 1] + a.pts[2 * M + 1]) / 2, a.white, c) * Un
503
+ ) : 0, u = l ? l.at((a.pts[2 * d] + a.pts[2 * M]) / 2, (a.pts[2 * d + 1] + a.pts[2 * M + 1]) / 2) : 0, g = `${v}|${a.white}|${Math.round(a.w * 20)}|${_}|${u}`;
482
504
  if (g !== f) {
483
- let y = i.get(g);
484
- y || (y = { path: new Path2D(), white: a.white, w: a.w, a: v / _n, gw: _ / kn, ci: u }, i.set(g, y)), p = y, f = g, y.path.moveTo(a.pts[2 * d], a.pts[2 * d + 1]);
505
+ let x = i.get(g);
506
+ x || (x = { path: new Path2D(), white: a.white, w: a.w, a: v / Gn, gw: _ / Un, ci: u }, i.set(g, x)), m = x, f = g, x.path.moveTo(a.pts[2 * d], a.pts[2 * d + 1]);
485
507
  }
486
- p.path.lineTo(a.pts[2 * m], a.pts[2 * m + 1]);
508
+ m.path.lineTo(a.pts[2 * M], a.pts[2 * M + 1]);
487
509
  }
488
510
  }
489
511
  t.lineCap = "round", t.lineJoin = "round";
490
512
  for (const a of i.values())
491
- t.strokeStyle = Ln(K(a.white), a.a, e, s, c, a.gw, l == null ? void 0 : l.rgb, l == null ? void 0 : l.mix[a.ci]), t.lineWidth = a.w, t.stroke(a.path);
513
+ t.strokeStyle = Jn(j(a.white), a.a, e, s, c, a.gw, l == null ? void 0 : l.rgb, l == null ? void 0 : l.mix[a.ci]), t.lineWidth = a.w, t.stroke(a.path);
492
514
  }
493
- function ks(t, n, e, s, o, r, c = !1) {
515
+ function Xs(t, n, e, s, o, r, c = !1) {
494
516
  const l = o && o.amount > 5e-3 ? o : void 0, i = r && r.saturation > 0 ? r : void 0;
495
517
  for (const a of n) {
496
- const M = K(a.white), h = l ? Gn(a.x, a.y, M, l) : 0, f = i ? i.at(a.x, a.y) : 0;
497
- if (t.fillStyle = Ln(M, K(a.a ?? 1), e, s, l, h, i == null ? void 0 : i.rgb, i == null ? void 0 : i.mix[f]), c) {
518
+ const p = j(a.white), h = l ? Zn(a.x, a.y, p, l) : 0, f = i ? i.at(a.x, a.y) : 0;
519
+ if (t.fillStyle = Jn(p, j(a.a ?? 1), e, s, l, h, i == null ? void 0 : i.rgb, i == null ? void 0 : i.mix[f]), c) {
498
520
  t.fillRect(a.x - a.r, a.y - a.r, 2 * a.r, 2 * a.r);
499
521
  continue;
500
522
  }
501
- t.beginPath(), t.arc(a.x, a.y, a.r, 0, ht), t.fill();
523
+ t.beginPath(), t.arc(a.x, a.y, a.r, 0, Mt), t.fill();
502
524
  }
503
525
  }
504
- function Cs(t, n, e, s, o, r) {
526
+ function Vs(t, n, e, s, o, r) {
505
527
  var l;
506
- const c = r && r.saturation > 0 && !n.light ? ps(r) : void 0;
507
- n.light ? Ts(t, n, n.light, e, s, o) : n.strokes.length && _s(t, n.strokes, e, s, o, c), ks(t, n.dots, e, s, o, c, n.square), (l = n.contact) != null && l.lens && Ps(t, n.contact.side, n.contact.x, n.contact.lens);
528
+ const c = r && r.saturation > 0 && !n.light ? _s(r) : void 0;
529
+ n.light ? Os(t, n, n.light, e, s, o) : n.strokes.length && Ws(t, n.strokes, e, s, o, c), Xs(t, n.dots, e, s, o, c, n.square), (l = n.contact) != null && l.lens && $s(t, n.contact.side, n.contact.x, n.contact.lens);
508
530
  }
509
- const Fs = [
531
+ const Ks = [
510
532
  [0, 255, 150, 90],
511
533
  [0.12, 255, 110, 120],
512
534
  [0.24, 255, 80, 170],
@@ -518,171 +540,171 @@ const Fs = [
518
540
  [0.84, 170, 90, 255],
519
541
  [0.93, 240, 104, 165],
520
542
  [1, 255, 150, 90]
521
- ], Is = (t, n, e, s) => {
522
- const o = t / 2, r = e.level, [c, l] = e.softBands, i = e.bands[2], a = e.drive, M = e.processing, h = 0.5 * r + 0.5 * e.soft, f = o * (s.radius ?? 0.56) * (1 + (s.zoom ?? 0.17) * e.soft) * (1 - 0.06 * M), p = s.deform ?? 1.45, d = 0.02 + (0.14 * c + 0.06 * r) * p, m = 0.01 + (0.07 * l + 0.03 * i) * p, v = Mn(d, m, a, s.deformRadius ?? 1.75), _ = Math.max(0.6, (s.lineW ?? 1.85) * Lt(t, 0.5)), u = Math.max(1, Math.round(s.rings ?? 6)), g = Math.max(24, Math.round(s.segs ?? 140)), y = s.lean ?? 0.91, N = s.ringGap ?? 0.02, T = [];
523
- let z = 0, w = 0;
524
- for (let x = 0; x < u; x++) {
525
- const F = 0.16 * (0.5 + xt(x, 2.1)) * (x % 2 ? 1 : -1), A = Math.max(
543
+ ], Hs = (t, n, e, s) => {
544
+ const o = t / 2, r = e.level, [c, l] = e.softBands, i = e.bands[2], a = e.drive, p = e.processing, h = 0.5 * r + 0.5 * e.soft, f = o * (s.radius ?? 0.56) * (1 + (s.zoom ?? 0.17) * e.soft) * (1 - 0.06 * p), m = s.deform ?? 1.45, d = 0.02 + (0.14 * c + 0.06 * r) * m, M = 0.01 + (0.07 * l + 0.03 * i) * m, v = Sn(d, M, a, s.deformRadius ?? 1.75), _ = Math.max(0.6, (s.lineW ?? 1.85) * $t(t, 0.5)), u = Math.max(1, Math.round(s.rings ?? 6)), g = Math.max(24, Math.round(s.segs ?? 140)), x = s.lean ?? 0.91, B = s.ringGap ?? 0.02, E = [];
545
+ let q = 0, w = 0;
546
+ for (let y = 0; y < u; y++) {
547
+ const I = 0.16 * (0.5 + Tt(y, 2.1)) * (y % 2 ? 1 : -1), R = Math.max(
526
548
  0.02,
527
- y * (0.2 + 0.8 * xt(x, 3.1)) + 0.03 * Math.sin(n * 0.27 + x * 1.3) + 0.08 * Math.sin(a * 0.35 + x * 1.7)
528
- ), B = xt(x, 7.7) * ht + n * 0.05 * (x % 2 ? 1 : -1) + a * F, C = Math.sin(A) * Math.cos(B), I = Math.sin(A) * Math.sin(B), E = Math.cos(A), R = Math.hypot(C, E), q = E / R, L = -C / R, U = I * L, $ = E * q - C * L, j = -I * q, tt = f * (1 + N * (x - (u - 1) / 2)), H = Math.sin(A), X = [], at = [], Z = [];
529
- for (let J = 0; J < g; J++) {
530
- const W = J / g * ht, ut = Math.cos(W), ct = Math.sin(W), rt = q * ut + U * ct, nt = $ * ct, Mt = L * ut + j * ct, lt = v(rt, nt, Mt);
531
- X.push(rt, nt), at.push(lt), z += lt, w++, Z.push(0.62 + 0.38 * K((Mt / H + 1) / 2));
549
+ x * (0.2 + 0.8 * Tt(y, 3.1)) + 0.03 * Math.sin(n * 0.27 + y * 1.3) + 0.08 * Math.sin(a * 0.35 + y * 1.7)
550
+ ), L = Tt(y, 7.7) * Mt + n * 0.05 * (y % 2 ? 1 : -1) + a * I, C = Math.sin(R) * Math.cos(L), F = Math.sin(R) * Math.sin(L), T = Math.cos(R), P = Math.hypot(C, T), N = T / P, G = -C / P, z = F * G, W = T * N - C * G, X = -F * N, Q = f * (1 + B * (y - (u - 1) / 2)), Z = Math.sin(R), V = [], at = [], nt = [];
551
+ for (let K = 0; K < g; K++) {
552
+ const st = K / g * Mt, $ = Math.cos(st), ht = Math.sin(st), ut = N * $ + z * ht, tt = W * ht, ft = G * $ + X * ht, dt = v(ut, tt, ft);
553
+ V.push(ut, tt), at.push(dt), q += dt, w++, nt.push(0.62 + 0.38 * j((ft / Z + 1) / 2));
532
554
  }
533
- T.push({ dirs: X, f: at, a: Z, rk: tt });
555
+ E.push({ dirs: V, f: at, a: nt, rk: Q });
534
556
  }
535
- const k = w ? z / w : 0;
536
- let P = 0, D = 0;
537
- for (const { dirs: x, f: F } of T)
538
- for (let A = 0; A < F.length; A++) {
539
- const B = x[2 * A], C = x[2 * A + 1], I = Math.hypot(B, C) || 1;
540
- P += (F[A] - k) * (B / I), D += (F[A] - k) * (C / I);
557
+ const k = w ? q / w : 0;
558
+ let A = 0, O = 0;
559
+ for (const { dirs: y, f: I } of E)
560
+ for (let R = 0; R < I.length; R++) {
561
+ const L = y[2 * R], C = y[2 * R + 1], F = Math.hypot(L, C) || 1;
562
+ A += (I[R] - k) * (L / F), O += (I[R] - k) * (C / F);
541
563
  }
542
- P = w ? 2 * P / w : 0, D = w ? 2 * D / w : 0;
543
- const O = T.map(({ dirs: x, f: F, a: A, rk: B }) => {
564
+ A = w ? 2 * A / w : 0, O = w ? 2 * O / w : 0;
565
+ const U = E.map(({ dirs: y, f: I, a: R, rk: L }) => {
544
566
  const C = [];
545
- for (let I = 0; I < F.length; I++) {
546
- const E = x[2 * I], R = x[2 * I + 1], q = Math.hypot(E, R) || 1, L = B * (1 + F[I] - k - P * (E / q) - D * (R / q));
547
- C.push(o + E * L, o - R * L);
567
+ for (let F = 0; F < I.length; F++) {
568
+ const T = y[2 * F], P = y[2 * F + 1], N = Math.hypot(T, P) || 1, G = L * (1 + I[F] - k - A * (T / N) - O * (P / N));
569
+ C.push(o + T * G, o - P * G);
548
570
  }
549
- return { pts: C, a: A, white: 0, w: _, closed: !0 };
571
+ return { pts: C, a: R, white: 0, w: _, closed: !0 };
550
572
  }), b = 2.3 + 0.25 * Math.sin(n * 0.21) + 2 * e.spin, S = {
551
573
  cx: o,
552
574
  cy: o,
553
575
  r: f,
554
- stops: Fs,
576
+ stops: Ks,
555
577
  // warm at the top, cool below, swaying rather than turning — the
556
578
  // spectrum flows with the voice but keeps its sense of up; processing
557
579
  // spins it all the way round
558
580
  angle: -Math.PI / 2 - 0.35 + 0.5 * Math.sin(n * 0.07) + 0.4 * Math.sin(a * 0.2) + e.spin,
559
581
  // processing lights the ring up: brighter bloom and a bigger halo
560
- intensity: 0.62 + 0.55 * h + 0.5 * M,
561
- halo: (s.halo ?? 0.5) * (1 + 0.6 * M),
582
+ intensity: 0.62 + 0.55 * h + 0.5 * p,
583
+ halo: (s.halo ?? 0.5) * (1 + 0.6 * p),
562
584
  spec: [
563
585
  {
564
586
  x: o + Math.cos(b) * f,
565
587
  y: o + Math.sin(b) * f,
566
- r: f * (0.5 + 0.25 * M),
567
- a: 0.5 + 0.35 * h + 0.4 * M
588
+ r: f * (0.5 + 0.25 * p),
589
+ a: 0.5 + 0.35 * h + 0.4 * p
568
590
  }
569
591
  ],
570
592
  fringe: 0.016 + 0.012 * h
571
593
  };
572
- return { ...Ct([], O), light: S };
573
- }, On = -0.45, Un = 0.55, $n = 0.7, Ns = Math.hypot(On, Un, $n), Bs = (t, n, e, s) => {
574
- const o = t / 2, r = e.level, [c, l, i] = e.bands, a = e.drive, M = e.processing, h = o * (s.radius ?? 0.72), f = h * (1 + (s.zoom ?? 0.3) * r) * (1 - 0.06 * M), p = s.rMul ?? 1, d = Math.max(4, Math.round(s.cells ?? 17)), m = 2 * h / d, v = m / 2 - Math.max(0.5, m * (s.gap ?? 0.24) / 2), _ = Math.ceil(f * 1.25 / m), u = (s.turn ?? 0.12) * n + 0.1 * a + 0.5 * e.spin, g = Math.sin(u), y = Math.cos(u), N = Math.sin(0.35), T = Math.cos(0.35), z = s.shade ?? 0.7, w = s.texture ?? 0.35, k = s.fade ?? 1.3, P = s.strength ?? 1.38, D = s.deform ?? 1.7, O = 0.012 + (0.09 * c + 0.03 * r) * D, b = (0.035 * l + 0.025 * i) * D, S = (C) => O * (0.55 * Math.sin(2 * C + 0.9 * a) + 0.45 * Math.sin(3 * C - 0.7 * a + 1.3)) + b * Math.sin(7 * C + 2.3 * a) * Math.sin(5 * C - 1.7 * a), x = 0.95 * Math.sin(n * 1.3), F = e.spectrum, A = F.length, B = [];
594
+ return { ...Lt([], U), light: S };
595
+ }, Qn = -0.45, ts = 0.55, ns = 0.7, Ys = Math.hypot(Qn, ts, ns), js = (t, n, e, s) => {
596
+ const o = t / 2, r = e.level, [c, l, i] = e.bands, a = e.drive, p = e.processing, h = o * (s.radius ?? 0.72), f = h * (1 + (s.zoom ?? 0.3) * r) * (1 - 0.06 * p), m = s.rMul ?? 1, d = Math.max(4, Math.round(s.cells ?? 17)), M = 2 * h / d, v = M / 2 - Math.max(0.5, M * (s.gap ?? 0.24) / 2), _ = Math.ceil(f * 1.25 / M), u = (s.turn ?? 0.12) * n + 0.1 * a + 0.5 * e.spin, g = Math.sin(u), x = Math.cos(u), B = Math.sin(0.35), E = Math.cos(0.35), q = s.shade ?? 0.7, w = s.texture ?? 0.35, k = s.fade ?? 1.3, A = s.strength ?? 1.38, O = s.deform ?? 1.7, U = 0.012 + (0.09 * c + 0.03 * r) * O, b = (0.035 * l + 0.025 * i) * O, S = (C) => U * (0.55 * Math.sin(2 * C + 0.9 * a) + 0.45 * Math.sin(3 * C - 0.7 * a + 1.3)) + b * Math.sin(7 * C + 2.3 * a) * Math.sin(5 * C - 1.7 * a), y = 0.95 * Math.sin(n * 1.3), I = e.spectrum, R = I.length, L = [];
575
597
  for (let C = -_; C <= _; C++)
576
- for (let I = -_; I <= _; I++) {
577
- const E = o + I * m, R = o + C * m, q = (E - o) / f, L = -(R - o) / f, U = S(Math.atan2(L, q)), $ = Math.hypot(q, L) / (1 + U);
578
- if ($ >= 1) continue;
579
- const j = 1 / (1 + U), tt = q * j, H = L * j, X = Math.sqrt(Math.max(0, 1 - tt * tt - H * H)), at = K((tt * On + H * Un + X * $n) / Ns), Z = 1 - z + z * at, J = H * T + X * N, W = -H * N + X * T, ut = tt * y - W * g, ct = tt * g + W * y, rt = 0.65 * Gt(ut * 2.2 + a * 0.15, J * 2.2, ct * 2.2 - a * 0.1) + 0.35 * Gt(ut * 4.6 - a * 0.2, J * 4.6 + 7.3, ct * 4.6), nt = 1 - w + w * pn(0.32, 0.68, rt), Mt = A ? F[Math.min(A - 1, Math.floor($ * A))] : r, lt = 0.35 * r + 0.85 * Mt, mt = Math.exp(-((H - x) ** 2) / 0.01) * M, it = 1 - 0.4 * k * (1 - X), wt = (0.35 + 0.75 * Z * nt + 0.3 * lt + 0.2 * mt) * it * p, Ft = 0.22 + 0.62 * Z * nt + 0.22 * lt + 0.3 * mt;
580
- B.push({
581
- x: E,
582
- y: R,
583
- z: X * f,
584
- r: v * Math.min(1, wt),
585
- white: K(1 - Ft * P),
586
- a: K((1 - 0.75 * k * (1 - Math.sqrt(X))) * P)
598
+ for (let F = -_; F <= _; F++) {
599
+ const T = o + F * M, P = o + C * M, N = (T - o) / f, G = -(P - o) / f, z = S(Math.atan2(G, N)), W = Math.hypot(N, G) / (1 + z);
600
+ if (W >= 1) continue;
601
+ const X = 1 / (1 + z), Q = N * X, Z = G * X, V = Math.sqrt(Math.max(0, 1 - Q * Q - Z * Z)), at = j((Q * Qn + Z * ts + V * ns) / Ys), nt = 1 - q + q * at, K = Z * E + V * B, st = -Z * B + V * E, $ = Q * x - st * g, ht = Q * g + st * x, ut = 0.65 * zt($ * 2.2 + a * 0.15, K * 2.2, ht * 2.2 - a * 0.1) + 0.35 * zt($ * 4.6 - a * 0.2, K * 4.6 + 7.3, ht * 4.6), tt = 1 - w + w * wn(0.32, 0.68, ut), ft = R ? I[Math.min(R - 1, Math.floor(W * R))] : r, dt = 0.35 * r + 0.85 * ft, Rt = Math.exp(-((Z - y) ** 2) / 0.01) * p, Wt = 1 - 0.4 * k * (1 - V), ct = (0.35 + 0.75 * nt * tt + 0.3 * dt + 0.2 * Rt) * Wt * m, At = 0.22 + 0.62 * nt * tt + 0.22 * dt + 0.3 * Rt;
602
+ L.push({
603
+ x: T,
604
+ y: P,
605
+ z: V * f,
606
+ r: v * Math.min(1, ct),
607
+ white: j(1 - At * A),
608
+ a: j((1 - 0.75 * k * (1 - Math.sqrt(V))) * A)
587
609
  });
588
610
  }
589
- return { ...Ct(B, [], s.rMin ?? 0.4), square: !0 };
590
- }, zs = (t, n, e, s) => {
591
- const o = t / 2, r = t / 2, c = 0.5 * e.level + 0.5 * e.soft, l = (1 + (s.swell ?? 0.49) * c) * (1 - 0.14 * e.processing), i = t / 2 * (s.radius ?? 0.56), a = s.persp ?? 0.25, M = Yt(n * 0.12 + e.drive * 0.03, 0.3, 0, 0, 1), h = Lt(t, s.rsPow ?? 0.9) * (s.rMul ?? 1), f = [], p = s.orbitN ?? 12, d = s.particles ?? 6;
592
- for (let m = 0; m < p; m++) {
593
- const v = xt(m, 1.7), _ = xt(m, 5.2), u = xt(m, 8.9), g = i * (0.45 + 0.52 * v), y = v * ht, N = Math.acos(2 * _ - 1), T = Math.sin(N) * Math.cos(y), z = Math.cos(N), w = Math.sin(N) * Math.sin(y);
594
- let k = -z, P = T;
595
- const D = Math.max(1e-6, Math.sqrt(k * k + P * P));
596
- k /= D, P /= D;
597
- const O = -w * P, b = w * k, S = T * P - z * k, x = (0.25 + 0.55 * u) * (u > 0.5 ? 1 : -1);
598
- for (let F = 0; F < d; F++) {
599
- const A = e.drive * x + F / d * ht + _ * 6, B = Math.cos(A), C = Math.sin(A), [I, E, R] = M((k * B + O * C) * g, (P * B + b * C) * g, S * C * g), q = K((R / i + 1) / 2), L = l / (1 - a * R / i);
611
+ return { ...Lt(L, [], s.rMin ?? 0.4), square: !0 };
612
+ }, Zs = (t, n, e, s) => {
613
+ const o = t / 2, r = t / 2, c = 0.5 * e.level + 0.5 * e.soft, l = (1 + (s.swell ?? 0.49) * c) * (1 - 0.14 * e.processing), i = t / 2 * (s.radius ?? 0.56), a = s.persp ?? 0.25, p = nn(n * 0.12 + e.drive * 0.03, 0.3, 0, 0, 1), h = $t(t, s.rsPow ?? 0.9) * (s.rMul ?? 1), f = [], m = s.orbitN ?? 12, d = s.particles ?? 6;
614
+ for (let M = 0; M < m; M++) {
615
+ const v = Tt(M, 1.7), _ = Tt(M, 5.2), u = Tt(M, 8.9), g = i * (0.45 + 0.52 * v), x = v * Mt, B = Math.acos(2 * _ - 1), E = Math.sin(B) * Math.cos(x), q = Math.cos(B), w = Math.sin(B) * Math.sin(x);
616
+ let k = -q, A = E;
617
+ const O = Math.max(1e-6, Math.sqrt(k * k + A * A));
618
+ k /= O, A /= O;
619
+ const U = -w * A, b = w * k, S = E * A - q * k, y = (0.25 + 0.55 * u) * (u > 0.5 ? 1 : -1);
620
+ for (let I = 0; I < d; I++) {
621
+ const R = e.drive * y + I / d * Mt + _ * 6, L = Math.cos(R), C = Math.sin(R), [F, T, P] = p((k * L + U * C) * g, (A * L + b * C) * g, S * C * g), N = j((P / i + 1) / 2), G = l / (1 - a * P / i);
600
622
  f.push({
601
- x: o + I * L,
602
- y: r + E * L,
603
- z: R,
604
- r: ((s.partR ?? 0.47) + (s.partRDepth ?? 0.65) * q) * h * L,
605
- white: 0.32 - 0.24 * q
623
+ x: o + F * G,
624
+ y: r + T * G,
625
+ z: P,
626
+ r: ((s.partR ?? 0.47) + (s.partRDepth ?? 0.65) * N) * h * G,
627
+ white: 0.32 - 0.24 * N
606
628
  });
607
629
  }
608
630
  }
609
- return Ct(f, [], s.rMin);
610
- }, Ds = (t, n, e, s) => {
611
- const o = t / 2, r = t / 2, c = e.soft, [l, i] = e.softBands, a = t / 2 * (s.radius ?? 0.66) * (1 + (s.zoom ?? 0.21) * e.level), M = e.drive, h = s.deform ?? 1, f = s.wave ?? 1, p = 0.015 + (0.1 * l + 0.05 * e.level) * h, d = 0.04 * i * h, m = Mn(p, d, M), v = 0.55 + 0.05 * Math.sin(n * 0.37), _ = Math.cos(v), u = Math.sin(v);
631
+ return Lt(f, [], s.rMin);
632
+ }, Js = (t, n, e, s) => {
633
+ const o = t / 2, r = t / 2, c = e.soft, [l, i] = e.softBands, a = t / 2 * (s.radius ?? 0.66) * (1 + (s.zoom ?? 0.21) * e.level), p = e.drive, h = s.deform ?? 1, f = s.wave ?? 1, m = 0.015 + (0.1 * l + 0.05 * e.level) * h, d = 0.04 * i * h, M = Sn(m, d, p), v = 0.55 + 0.05 * Math.sin(n * 0.37), _ = Math.cos(v), u = Math.sin(v);
612
634
  let g = 0;
613
- for (let E = 0; E < 48; E++) {
614
- const R = E / 48 * ht;
615
- g += m(Math.cos(R), Math.sin(R) * _, Math.sin(R) * u);
635
+ for (let T = 0; T < 48; T++) {
636
+ const P = T / 48 * Mt;
637
+ g += M(Math.cos(P), Math.sin(P) * _, Math.sin(P) * u);
616
638
  }
617
639
  g /= 48;
618
- const y = (E, R, q) => 1 + m(E, R, q) - g, T = Yt(0, 0.3, o, r, 1), z = Lt(t, s.rsPow ?? 0.6) * (s.rMul ?? 1), w = e.drive, k = [], P = s.ghostN ?? 60;
619
- for (let E = 0; E < P; E++) {
620
- const R = mn(E, P), q = a * y(R[0], R[1], R[2]), [L, U, $] = T(R[0] * q, R[1] * q, R[2] * q), j = ($ / a + 1) / 2;
621
- k.push({ x: L, y: U, z: $, r: 0.65 * z, white: 0.78, a: 0.1 + 0.22 * j });
640
+ const x = (T, P, N) => 1 + M(T, P, N) - g, E = nn(0, 0.3, o, r, 1), q = $t(t, s.rsPow ?? 0.6) * (s.rMul ?? 1), w = e.drive, k = [], A = s.ghostN ?? 60;
641
+ for (let T = 0; T < A; T++) {
642
+ const P = En(T, A), N = a * x(P[0], P[1], P[2]), [G, z, W] = E(P[0] * N, P[1] * N, P[2] * N), X = (W / a + 1) / 2;
643
+ k.push({ x: G, y: z, z: W, r: 0.65 * q, white: 0.78, a: 0.1 + 0.22 * X });
622
644
  }
623
- const D = -u, O = _, b = Math.max(1, Math.round(s.lanes ?? 10)), S = Math.max(8, Math.round(s.segs ?? 56)), x = e.processing, F = (s.laneGap ?? 0.062) * (1 + 0.25 * c) * (1 - 0.4 * x), A = w * 1.6, B = 0.15 * (0.55 + 0.9 * l * f) * (1 - 0.6 * x), C = 0.06 * (0.5 + 1.2 * i * f), I = 0.05 + 0.05 * c;
624
- for (let E = 0; E < b; E++) {
625
- const R = (E - (b - 1) / 2) * F, q = Math.abs(E - (b - 1) / 2) / Math.max(1, (b - 1) / 2);
626
- for (let L = 0; L < S; L++) {
627
- const U = L / S * ht, $ = B * Math.sin(U * 3 - w * 0.95 + E * 0.18) + C * Math.sin(U * 5 + w * 0.6) + I * Math.sin(U * 2 + n * 0.31 + Math.sin(n * 0.17) * 1.5), j = R + $, tt = Math.cos(U), H = Math.sin(U), X = tt, at = H * _ + D * j, Z = H * u + O * j, J = Math.sqrt(X * X + at * at + Z * Z), W = a * y(X / J, at / J, Z / J) / J, [ut, ct, rt] = T(X * W, at * W, Z * W), nt = (rt / a + 1) / 2, Mt = Math.max(0, $) * c, lt = Math.atan2(Math.sin(U - A), Math.cos(U - A)), mt = Math.exp(-(lt * lt) / 0.18) * x;
645
+ const O = -u, U = _, b = Math.max(1, Math.round(s.lanes ?? 10)), S = Math.max(8, Math.round(s.segs ?? 56)), y = e.processing, I = (s.laneGap ?? 0.062) * (1 + 0.25 * c) * (1 - 0.4 * y), R = w * 1.6, L = 0.15 * (0.55 + 0.9 * l * f) * (1 - 0.6 * y), C = 0.06 * (0.5 + 1.2 * i * f), F = 0.05 + 0.05 * c;
646
+ for (let T = 0; T < b; T++) {
647
+ const P = (T - (b - 1) / 2) * I, N = Math.abs(T - (b - 1) / 2) / Math.max(1, (b - 1) / 2);
648
+ for (let G = 0; G < S; G++) {
649
+ const z = G / S * Mt, W = L * Math.sin(z * 3 - w * 0.95 + T * 0.18) + C * Math.sin(z * 5 + w * 0.6) + F * Math.sin(z * 2 + n * 0.31 + Math.sin(n * 0.17) * 1.5), X = P + W, Q = Math.cos(z), Z = Math.sin(z), V = Q, at = Z * _ + O * X, nt = Z * u + U * X, K = Math.sqrt(V * V + at * at + nt * nt), st = a * x(V / K, at / K, nt / K) / K, [$, ht, ut] = E(V * st, at * st, nt * st), tt = (ut / a + 1) / 2, ft = Math.max(0, W) * c, dt = Math.atan2(Math.sin(z - R), Math.cos(z - R)), Rt = Math.exp(-(dt * dt) / 0.18) * y;
628
650
  k.push({
629
- x: ut,
630
- y: ct,
631
- z: rt,
632
- r: ((s.rBase ?? 0.49) + (s.rDepth ?? 0.78) * nt) * (1 - 0.25 * q) * (1 + 1.2 * Mt + 0.5 * mt) * z,
633
- white: 0.52 - 0.44 * nt + 0.18 * q - 0.3 * mt,
634
- a: 0.4 + 0.6 * nt
651
+ x: $,
652
+ y: ht,
653
+ z: ut,
654
+ r: ((s.rBase ?? 0.49) + (s.rDepth ?? 0.78) * tt) * (1 - 0.25 * N) * (1 + 1.2 * ft + 0.5 * Rt) * q,
655
+ white: 0.52 - 0.44 * tt + 0.18 * N - 0.3 * Rt,
656
+ a: 0.4 + 0.6 * tt
635
657
  });
636
658
  }
637
659
  }
638
- return Ct(k, [], s.rMin);
639
- }, qs = (t, n, e, s) => {
640
- const o = t / 2, r = e.level, [c, l] = e.softBands, i = e.bands[2], a = e.drive, M = o * (s.radius ?? 0.6) * (1 + (s.zoom ?? 0.06) * e.soft) * (1 - 0.08 * e.processing), h = Yt((s.yaw ?? 0.42) + 0.08 * Math.sin(n * 0.23), s.tilt ?? 0.32, o, o, 1), f = Math.max(0.4, (s.lineW ?? 0.6) * Lt(t, 0.5)), p = (T) => 0.06 + 0.94 * K((T / M + 1) / 2) ** 2, d = s.deform ?? 1, m = 0.02 + (0.14 * c + 0.06 * r) * d, v = 0.01 + (0.07 * l + 0.03 * i) * d, _ = Mn(m, v, a), u = [], g = Math.max(24, Math.round(s.segs ?? 96)), y = Math.max(0, Math.round(s.limbs ?? 2));
641
- for (let T = 0; T < y; T++) {
642
- const z = 0.1 + 0.05 * Math.sin(n * 0.31 + T * 2.1), w = n * 0.17 * (T % 2 ? 1 : -1) + T * 2.4, k = Math.sin(z) * Math.cos(w), P = Math.sin(z) * Math.sin(w), D = Math.cos(z), O = Math.hypot(k, D), b = D / O, S = -k / O, x = P * S, F = D * b - k * S, A = -P * b, B = [], C = [];
643
- for (let I = 0; I < g; I++) {
644
- const E = I / g * ht, R = b * Math.cos(E) + x * Math.sin(E), q = F * Math.sin(E), L = S * Math.cos(E) + A * Math.sin(E), U = M * (1 + 6e-3 * T + _(R, q, L));
645
- B.push(o + R * U, o - q * U), C.push(0.55 + 0.35 * K((L / Math.sin(z) + 1) / 2));
660
+ return Lt(k, [], s.rMin);
661
+ }, Qs = (t, n, e, s) => {
662
+ const o = t / 2, r = e.level, [c, l] = e.softBands, i = e.bands[2], a = e.drive, p = o * (s.radius ?? 0.6) * (1 + (s.zoom ?? 0.06) * e.soft) * (1 - 0.08 * e.processing), h = nn((s.yaw ?? 0.42) + 0.08 * Math.sin(n * 0.23), s.tilt ?? 0.32, o, o, 1), f = Math.max(0.4, (s.lineW ?? 0.6) * $t(t, 0.5)), m = (E) => 0.06 + 0.94 * j((E / p + 1) / 2) ** 2, d = s.deform ?? 1, M = 0.02 + (0.14 * c + 0.06 * r) * d, v = 0.01 + (0.07 * l + 0.03 * i) * d, _ = Sn(M, v, a), u = [], g = Math.max(24, Math.round(s.segs ?? 96)), x = Math.max(0, Math.round(s.limbs ?? 2));
663
+ for (let E = 0; E < x; E++) {
664
+ const q = 0.1 + 0.05 * Math.sin(n * 0.31 + E * 2.1), w = n * 0.17 * (E % 2 ? 1 : -1) + E * 2.4, k = Math.sin(q) * Math.cos(w), A = Math.sin(q) * Math.sin(w), O = Math.cos(q), U = Math.hypot(k, O), b = O / U, S = -k / U, y = A * S, I = O * b - k * S, R = -A * b, L = [], C = [];
665
+ for (let F = 0; F < g; F++) {
666
+ const T = F / g * Mt, P = b * Math.cos(T) + y * Math.sin(T), N = I * Math.sin(T), G = S * Math.cos(T) + R * Math.sin(T), z = p * (1 + 6e-3 * E + _(P, N, G));
667
+ L.push(o + P * z, o - N * z), C.push(0.55 + 0.35 * j((G / Math.sin(q) + 1) / 2));
646
668
  }
647
- u.push({ pts: B, a: C, white: 0, w: f, closed: !0 });
669
+ u.push({ pts: L, a: C, white: 0, w: f, closed: !0 });
648
670
  }
649
- const N = Math.max(2, Math.round(s.circles ?? 8));
650
- for (let T = 0; T < N; T++) {
651
- const [z, w, k] = mn(T, N), P = a * 0.16 * (0.5 + xt(T, 2.1)) * (T % 2 ? 1 : -1) + xt(T, 6.6) * ht, D = w * Math.cos(P) - k * Math.sin(P), O = w * Math.sin(P) + k * Math.cos(P), b = Math.max(1e-6, Math.hypot(O, z)), S = O / b, x = -z / b, F = D * x, A = O * S - z * x, B = -D * S, C = [], I = [];
652
- for (let E = 0; E < g; E++) {
653
- const R = E / g * ht, q = S * Math.cos(R) + F * Math.sin(R), L = A * Math.sin(R), U = x * Math.cos(R) + B * Math.sin(R), $ = M * (1 + _(q, L, U)), [j, tt, H] = h(q * $, L * $, U * $);
654
- C.push(j, tt), I.push(p(H));
671
+ const B = Math.max(2, Math.round(s.circles ?? 8));
672
+ for (let E = 0; E < B; E++) {
673
+ const [q, w, k] = En(E, B), A = a * 0.16 * (0.5 + Tt(E, 2.1)) * (E % 2 ? 1 : -1) + Tt(E, 6.6) * Mt, O = w * Math.cos(A) - k * Math.sin(A), U = w * Math.sin(A) + k * Math.cos(A), b = Math.max(1e-6, Math.hypot(U, q)), S = U / b, y = -q / b, I = O * y, R = U * S - q * y, L = -O * S, C = [], F = [];
674
+ for (let T = 0; T < g; T++) {
675
+ const P = T / g * Mt, N = S * Math.cos(P) + I * Math.sin(P), G = R * Math.sin(P), z = y * Math.cos(P) + L * Math.sin(P), W = p * (1 + _(N, G, z)), [X, Q, Z] = h(N * W, G * W, z * W);
676
+ C.push(X, Q), F.push(m(Z));
655
677
  }
656
- u.push({ pts: C, a: I, white: 0, w: f, closed: !0 });
678
+ u.push({ pts: C, a: F, white: 0, w: f, closed: !0 });
657
679
  }
658
- return Ct([], u, s.rMin);
659
- }, Gs = (t, n, e, s) => {
660
- const o = t / 2, r = e.level, [c, l, i] = e.bands, a = e.drive, M = e.processing, h = o * (s.radius ?? 0.6) * (1 + (s.zoom ?? 0.1) * r) * (1 - 0.08 * M), f = 0.95 * Math.sin(n * 1.3), p = Yt(n * 0.14, 0.32, o, o, 1), d = Lt(t, s.rsPow ?? 0.6) * (s.rMul ?? 1), m = Math.max(40, Math.round(s.dotN ?? 900)), v = s.cloudFreq ?? 2.3, _ = s.deform ?? 1, u = 0.018 + (0.12 * c + 0.04 * r) * _, g = (0.045 * l + 0.03 * i) * _, y = [], N = [];
661
- let T = 0;
662
- for (let w = 0; w < m; w++) {
663
- const k = mn(w, m), [P, D, O] = k, b = 0.55 * Math.sin(2.1 * P + 1.3 * D + 0.9 * a) + 0.45 * Math.sin(1.7 * O - 1.9 * D - 0.7 * a + 1.3), S = Math.sin(5.3 * P - 4.1 * O + 2.3 * a) * Math.sin(4.7 * D + 3.1 * P - 1.7 * a), x = u * b + g * S;
664
- y.push(k), N.push(x), T += x / m;
680
+ return Lt([], u, s.rMin);
681
+ }, te = (t, n, e, s) => {
682
+ const o = t / 2, r = e.level, [c, l, i] = e.bands, a = e.drive, p = e.processing, h = o * (s.radius ?? 0.6) * (1 + (s.zoom ?? 0.1) * r) * (1 - 0.08 * p), f = 0.95 * Math.sin(n * 1.3), m = nn(n * 0.14, 0.32, o, o, 1), d = $t(t, s.rsPow ?? 0.6) * (s.rMul ?? 1), M = Math.max(40, Math.round(s.dotN ?? 900)), v = s.cloudFreq ?? 2.3, _ = s.deform ?? 1, u = 0.018 + (0.12 * c + 0.04 * r) * _, g = (0.045 * l + 0.03 * i) * _, x = [], B = [];
683
+ let E = 0;
684
+ for (let w = 0; w < M; w++) {
685
+ const k = En(w, M), [A, O, U] = k, b = 0.55 * Math.sin(2.1 * A + 1.3 * O + 0.9 * a) + 0.45 * Math.sin(1.7 * U - 1.9 * O - 0.7 * a + 1.3), S = Math.sin(5.3 * A - 4.1 * U + 2.3 * a) * Math.sin(4.7 * O + 3.1 * A - 1.7 * a), y = u * b + g * S;
686
+ x.push(k), B.push(y), E += y / M;
665
687
  }
666
- const z = [];
667
- for (let w = 0; w < m; w++) {
668
- const [k, P, D] = y[w], O = N[w] - T, b = h * (1 + O), [S, x, F] = p(k * b, P * b, D * b), A = K((F / h + 1) / 2), B = 0.65 * Gt(k * v + a * 0.21, P * v - a * 0.15, D * v + a * 0.1) + 0.35 * Gt(k * v * 2.1 - a * 0.29, P * v * 2.1 + 7.3, D * v * 2.1 + a * 0.24), C = pn(0.34, 0.68, B), I = Math.exp(-((P - f) ** 2) / 0.012) * M, E = Math.max(0, O) / 0.16;
669
- z.push({
688
+ const q = [];
689
+ for (let w = 0; w < M; w++) {
690
+ const [k, A, O] = x[w], U = B[w] - E, b = h * (1 + U), [S, y, I] = m(k * b, A * b, O * b), R = j((I / h + 1) / 2), L = 0.65 * zt(k * v + a * 0.21, A * v - a * 0.15, O * v + a * 0.1) + 0.35 * zt(k * v * 2.1 - a * 0.29, A * v * 2.1 + 7.3, O * v * 2.1 + a * 0.24), C = wn(0.34, 0.68, L), F = Math.exp(-((A - f) ** 2) / 0.012) * p, T = Math.max(0, U) / 0.16;
691
+ q.push({
670
692
  x: S,
671
- y: x,
672
- z: F,
673
- r: ((s.rBase ?? 0.27) + (s.rDepth ?? 0.84) * A) * (0.22 + 0.95 * C + 0.6 * I) * (1 + 0.5 * E) * d,
674
- white: 0.62 - 0.52 * A - 0.16 * C - 0.3 * I,
675
- a: 0.3 + 0.7 * A
693
+ y,
694
+ z: I,
695
+ r: ((s.rBase ?? 0.27) + (s.rDepth ?? 0.84) * R) * (0.22 + 0.95 * C + 0.6 * F) * (1 + 0.5 * T) * d,
696
+ white: 0.62 - 0.52 * R - 0.16 * C - 0.3 * F,
697
+ a: 0.3 + 0.7 * R
676
698
  });
677
699
  }
678
- return Ct(z, [], s.rMin ?? 0.25);
679
- }, re = ["orbit", "sash", "signal", "swell", "pixel", "aura"], Ls = {
680
- orbit: zs,
681
- sash: Ds,
682
- signal: qs,
683
- swell: Gs,
684
- pixel: Bs,
685
- aura: Is
700
+ return Lt(q, [], s.rMin ?? 0.25);
701
+ }, Se = ["orbit", "sash", "signal", "swell", "pixel", "aura"], ne = {
702
+ orbit: Zs,
703
+ sash: Js,
704
+ signal: Qs,
705
+ swell: te,
706
+ pixel: js,
707
+ aura: Hs
686
708
  }, ot = {
687
709
  orbit: {
688
710
  speed: 1.05,
@@ -729,15 +751,15 @@ const Fs = [
729
751
  counts: { segs: 0.5 }
730
752
  }
731
753
  };
732
- function Os(t, n, e = 1, s = 1) {
754
+ function se(t, n, e = 1, s = 1) {
733
755
  const o = t in ot ? t : "orbit", r = ot[o], c = Math.min(1.4, Math.max(0.2, n / 200)) * Math.max(0.1, e), l = { ...r.opts };
734
756
  for (const [i, a] of Object.entries(r.counts)) {
735
- const M = l[i];
736
- M != null && (l[i] = Math.max(1, Math.round(M * c ** a)));
757
+ const p = l[i];
758
+ p != null && (l[i] = Math.max(1, Math.round(p * c ** a)));
737
759
  }
738
- return s !== 1 && (l.rMul = Math.max(0.1, s)), { frame: Ls[o], speed: r.speed, driveGain: r.driveGain, gain: r.gain ?? 1, opts: l };
760
+ return s !== 1 && (l.rMul = Math.max(0.1, s)), { frame: ne[o], speed: r.speed, driveGain: r.driveGain, gain: r.gain ?? 1, opts: l };
739
761
  }
740
- function Us(t) {
762
+ function ee(t) {
741
763
  let n = t;
742
764
  for (; n; ) {
743
765
  const e = n.getAttribute("data-theme");
@@ -749,12 +771,12 @@ function Us(t) {
749
771
  }
750
772
  return null;
751
773
  }
752
- function $s() {
774
+ function oe() {
753
775
  return typeof matchMedia > "u" || matchMedia("(prefers-color-scheme: dark)").matches;
754
776
  }
755
- function Ws(t, n) {
756
- const [e, s] = _t(!0);
757
- return kt(() => {
777
+ function ae(t, n) {
778
+ const [e, s] = Bt(!0);
779
+ return It(() => {
758
780
  if (t === "dark") {
759
781
  s(!0);
760
782
  return;
@@ -764,8 +786,8 @@ function Ws(t, n) {
764
786
  return;
765
787
  }
766
788
  const o = () => {
767
- const i = Us(n.current);
768
- s(i ?? $s());
789
+ const i = ee(n.current);
790
+ s(i ?? oe());
769
791
  };
770
792
  o();
771
793
  const r = typeof matchMedia < "u" ? matchMedia("(prefers-color-scheme: dark)") : null, c = () => o();
@@ -780,9 +802,9 @@ function Ws(t, n) {
780
802
  };
781
803
  }, [t, n]), e;
782
804
  }
783
- function Xs() {
784
- const [t, n] = _t(!1);
785
- return kt(() => {
805
+ function ce() {
806
+ const [t, n] = Bt(!1);
807
+ return It(() => {
786
808
  if (typeof matchMedia > "u") return;
787
809
  const e = matchMedia("(prefers-reduced-motion: reduce)");
788
810
  n(e.matches);
@@ -790,26 +812,26 @@ function Xs() {
790
812
  return e.addEventListener("change", s), () => e.removeEventListener("change", s);
791
813
  }, []), t;
792
814
  }
793
- const pt = 16, Vs = 2.1, Ks = 0.3, Hs = 2.5, Ys = 1.6, js = 5, Cn = 2.2, Fn = [
815
+ const vt = 16, re = 2.1, ie = 0.3, le = 2.5, he = 1.6, ue = 5, zn = 2.2, $n = [
794
816
  [80, 300],
795
817
  [300, 2e3],
796
818
  [2e3, 6e3]
797
- ], rn = 90, Zs = 7e3, ln = Math.PI * 2, hn = 0.35, un = 0.9;
798
- function Wn(t) {
819
+ ], Mn = 90, fe = 7e3, gn = Math.PI * 2, bn = 0.35, vn = 0.9;
820
+ function ss(t) {
799
821
  return t < 0 ? 0 : t > 1 ? 1 : t;
800
822
  }
801
- function fn(t, n) {
823
+ function xn(t, n) {
802
824
  if (t <= n) return 0;
803
825
  const e = (t - n) / Math.max(1e-3, 1 - n);
804
- return Wn((1 - Math.exp(-3 * e)) / (1 - Math.exp(-3)));
826
+ return ss((1 - Math.exp(-3 * e)) / (1 - Math.exp(-3)));
805
827
  }
806
- function At(t, n, e, s, o) {
828
+ function Ft(t, n, e, s, o) {
807
829
  const r = n > t ? s : o;
808
830
  return t + (n - t) * (1 - Math.exp(-e / Math.max(1e-3, r)));
809
831
  }
810
- class Js {
832
+ class de {
811
833
  constructor() {
812
- this.clock = 0, this.t = 0, this.drive = 0, this.level = 0, this.bands = [0, 0, 0], this.spectrum = new Float32Array(pt), this.floor = new Float32Array(pt + 3).fill(1), this.heard = 0, this.proc = 0, this.spin = 0, this.pan = 0, this.panVel = 0, this.raw = { level: 0, bands: [0, 0, 0], spectrum: new Float32Array(pt) }, this.timeBuf = null, this.freqBuf = null, this.out = {
834
+ this.clock = 0, this.t = 0, this.drive = 0, this.level = 0, this.bands = [0, 0, 0], this.spectrum = new Float32Array(vt), this.floor = new Float32Array(vt + 3).fill(1), this.heard = 0, this.proc = 0, this.spin = 0, this.pan = 0, this.panVel = 0, this.raw = { level: 0, bands: [0, 0, 0], spectrum: new Float32Array(vt) }, this.timeBuf = null, this.freqBuf = null, this.out = {
813
835
  level: 0,
814
836
  bands: [0, 0, 0],
815
837
  soft: 0,
@@ -828,22 +850,22 @@ class Js {
828
850
  n.getFloatTimeDomainData(o);
829
851
  let c = 0;
830
852
  for (let h = 0; h < o.length; h++) c += o[h] * o[h];
831
- this.raw.level = Math.sqrt(c / o.length) * js * e, n.getByteFrequencyData(r);
853
+ this.raw.level = Math.sqrt(c / o.length) * ue * e, n.getByteFrequencyData(r);
832
854
  const l = n.context.sampleRate / n.fftSize, i = (h, f) => {
833
- const p = Math.max(0, Math.floor(h / l)), d = Math.max(p, Math.min(r.length - 1, Math.ceil(f / l)));
834
- let m = 0;
835
- for (let v = p; v <= d; v++) m += r[v];
836
- return m / (d - p + 1) / 255;
855
+ const m = Math.max(0, Math.floor(h / l)), d = Math.max(m, Math.min(r.length - 1, Math.ceil(f / l)));
856
+ let M = 0;
857
+ for (let v = m; v <= d; v++) M += r[v];
858
+ return M / (d - m + 1) / 255;
837
859
  }, a = (h, f) => {
838
- const p = this.floor[h];
839
- return this.floor[h] = f < p ? f : p + (f - p) * (1 - Math.exp(-s / 8)), Math.max(0, f - this.floor[h]) / Math.max(0.05, 1 - this.floor[h]);
860
+ const m = this.floor[h];
861
+ return this.floor[h] = f < m ? f : m + (f - m) * (1 - Math.exp(-s / 8)), Math.max(0, f - this.floor[h]) / Math.max(0.05, 1 - this.floor[h]);
840
862
  };
841
863
  for (let h = 0; h < 3; h++)
842
- this.raw.bands[h] = a(h, i(Fn[h][0], Fn[h][1])) * Cn * e;
843
- const M = Zs / rn;
844
- for (let h = 0; h < pt; h++) {
845
- const f = rn * M ** (h / pt), p = rn * M ** ((h + 1) / pt);
846
- this.raw.spectrum[h] = a(3 + h, i(f, p)) * Cn * e;
864
+ this.raw.bands[h] = a(h, i($n[h][0], $n[h][1])) * zn * e;
865
+ const p = fe / Mn;
866
+ for (let h = 0; h < vt; h++) {
867
+ const f = Mn * p ** (h / vt), m = Mn * p ** ((h + 1) / vt);
868
+ this.raw.spectrum[h] = a(3 + h, i(f, m)) * zn * e;
847
869
  }
848
870
  }
849
871
  /**
@@ -853,11 +875,11 @@ class Js {
853
875
  * spectrum — so a level-driven orb still moves like a voice.
854
876
  */
855
877
  readLevel(n, e) {
856
- const s = Wn(n) * e, o = this.clock;
878
+ const s = ss(n) * e, o = this.clock;
857
879
  this.raw.level = s, this.raw.bands[0] = s, this.raw.bands[1] = s * (0.72 + 0.28 * Math.sin(o * 2.3)), this.raw.bands[2] = s * (0.6 + 0.4 * Math.sin(o * 3.7 + 2));
858
880
  const r = 0.28 + 0.1 * Math.sin(o * 2.3) + 0.05 * Math.sin(o * 5.1), c = 0.64 + 0.1 * Math.sin(o * 1.7 + 1);
859
- for (let l = 0; l < pt; l++) {
860
- const i = l / (pt - 1), a = Math.exp(-((i - r) ** 2) / 0.012) + 0.6 * Math.exp(-((i - c) ** 2) / 8e-3);
881
+ for (let l = 0; l < vt; l++) {
882
+ const i = l / (vt - 1), a = Math.exp(-((i - r) ** 2) / 0.012) + 0.6 * Math.exp(-((i - c) ** 2) / 8e-3);
861
883
  this.raw.spectrum[l] = s * (0.25 + 0.75 * a) * (1 - 0.4 * i);
862
884
  }
863
885
  }
@@ -867,29 +889,29 @@ class Js {
867
889
  }
868
890
  /** Advance by `dt` real seconds. `still` (reduced motion) holds the clocks. */
869
891
  step(n, e, s) {
870
- const { threshold: o, attack: r, release: c, rate: l } = e, i = this.proc = At(this.proc, e.processing ? 1 : 0, n, 0.35, 0.5), a = e.calm + (1 - e.calm) * Math.min(1, Math.max(this.heard * 2.5, i));
892
+ const { threshold: o, attack: r, release: c, rate: l } = e, i = this.proc = Ft(this.proc, e.processing ? 1 : 0, n, 0.35, 0.5), a = e.calm + (1 - e.calm) * Math.min(1, Math.max(this.heard * 2.5, i));
871
893
  s || (this.clock += n, this.t += n * l * a * (1 + 0.5 * i));
872
- const M = fn(this.raw.level, o);
873
- this.level = At(this.level, M, n, r, c), this.heard = At(this.heard, this.level, n, hn, un);
894
+ const p = xn(this.raw.level, o);
895
+ this.level = Ft(this.level, p, n, r, c), this.heard = Ft(this.heard, this.level, n, bn, vn);
874
896
  for (let u = 0; u < 3; u++)
875
- this.bands[u] = At(this.bands[u], fn(this.raw.bands[u], o * 0.6), n, r, c * 1.15);
876
- for (let u = 0; u < pt; u++)
877
- this.spectrum[u] = At(this.spectrum[u], fn(this.raw.spectrum[u], o * 0.6), n, r, c);
878
- const h = this.clock, f = s ? 0.5 : 0.5 + 0.5 * Math.sin(ln * h / 6), p = e.idle * f * (1 - i), d = this.out;
879
- d.level = this.level + (1 - this.level) * p;
880
- for (let u = 0; u < 3; u++) d.bands[u] = this.bands[u] + (1 - this.bands[u]) * p * 0.6;
881
- d.soft = At(d.soft, d.level, n, hn, un);
882
- for (let u = 0; u < 3; u++) d.softBands[u] = At(d.softBands[u], d.bands[u], n, hn, un);
897
+ this.bands[u] = Ft(this.bands[u], xn(this.raw.bands[u], o * 0.6), n, r, c * 1.15);
898
+ for (let u = 0; u < vt; u++)
899
+ this.spectrum[u] = Ft(this.spectrum[u], xn(this.raw.spectrum[u], o * 0.6), n, r, c);
900
+ const h = this.clock, f = s ? 0.5 : 0.5 + 0.5 * Math.sin(gn * h / 6), m = e.idle * f * (1 - i), d = this.out;
901
+ d.level = this.level + (1 - this.level) * m;
902
+ for (let u = 0; u < 3; u++) d.bands[u] = this.bands[u] + (1 - this.bands[u]) * m * 0.6;
903
+ d.soft = Ft(d.soft, d.level, n, bn, vn);
904
+ for (let u = 0; u < 3; u++) d.softBands[u] = Ft(d.softBands[u], d.bands[u], n, bn, vn);
883
905
  if (s || (this.drive += n * l * (a + e.driveGain * this.level + 1.3 * i)), d.drive = this.drive, d.processing = i, !s) {
884
- const u = Math.ceil(this.spin / ln - 1e-6) * ln, g = Math.min(Ks, (u - this.spin) * 0.6);
885
- this.spin += n * (Vs * l * i + g * (1 - i));
906
+ const u = Math.ceil(this.spin / gn - 1e-6) * gn, g = Math.min(ie, (u - this.spin) * 0.6);
907
+ this.spin += n * (re * l * i + g * (1 - i));
886
908
  }
887
909
  d.spin = this.spin;
888
- const m = Math.max(-1, Math.min(1, e.direction || 0)), v = this.heard > 0.06 && !e.processing ? m : 0, _ = Math.abs(v) > Math.abs(this.pan) ? Hs : Ys;
910
+ const M = Math.max(-1, Math.min(1, e.direction || 0)), v = this.heard > 0.06 && !e.processing ? M : 0, _ = Math.abs(v) > Math.abs(this.pan) ? le : he;
889
911
  return this.panVel += (_ * _ * (v - this.pan) - 2 * _ * this.panVel) * n, this.pan += this.panVel * n, d.pan = this.pan, d;
890
912
  }
891
913
  }
892
- function Qs(t) {
914
+ function pe(t) {
893
915
  if (!t) return;
894
916
  const n = t.trim().match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);
895
917
  if (n) {
@@ -901,13 +923,13 @@ function Qs(t) {
901
923
  const e = t.trim().match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);
902
924
  if (e) return { r: Number(e[1]), g: Number(e[2]), b: Number(e[3]) };
903
925
  }
904
- const te = {
926
+ const me = {
905
927
  idle: "Waiting",
906
928
  listening: "Listening",
907
929
  speaking: "Speaking",
908
930
  processing: "Thinking"
909
- }, ne = 1e3 / 62;
910
- function se({
931
+ }, Me = 0.55, ge = 1e3 / 62;
932
+ function be({
911
933
  type: t = "orbit",
912
934
  state: n = "listening",
913
935
  size: e = 160,
@@ -918,62 +940,63 @@ function se({
918
940
  threshold: l = 0.04,
919
941
  attack: i,
920
942
  release: a = 0.32,
921
- idle: M = 0.1,
943
+ idle: p = 0.1,
922
944
  calm: h = 0.4,
923
945
  voiceSpeed: f,
924
- emotion: p = null,
946
+ emotion: m = null,
925
947
  emotionColors: d,
926
- saturation: m = 2,
948
+ saturation: M = 2,
927
949
  accent: v = null,
928
950
  gradientAngle: _ = 99,
929
951
  gradientSpin: u = 12,
930
952
  neutral: g = 1,
931
- colorBrightness: y = 1.02,
932
- colorHue: N = 0,
933
- gradientStart: T = 0.1,
934
- gradientWidth: z = 0.6,
953
+ colorBrightness: x = 1.02,
954
+ colorHue: B = 0,
955
+ gradientStart: E = 0.1,
956
+ gradientWidth: q = 0.6,
935
957
  direction: w,
936
958
  directionMove: k,
937
- directionPull: P,
938
- directionDeform: D,
939
- directionSquash: O,
959
+ directionPull: A,
960
+ directionDeform: O,
961
+ directionSquash: U,
940
962
  directionLens: b,
941
963
  directionStretch: S,
942
- directionSplit: x,
943
- directionBlur: F,
944
- directionBounce: A,
945
- directionMargin: B,
964
+ directionSplit: y,
965
+ directionBlur: I,
966
+ directionBounce: R,
967
+ directionMargin: L,
946
968
  directionBounds: C,
947
- theme: I = "auto",
948
- speed: E = 1,
949
- paused: R = !1,
950
- color: q,
951
- dots: L = 1,
952
- dotSize: U,
953
- opts: $,
954
- frame: j,
955
- onLevel: tt,
956
- style: H,
957
- "aria-label": X,
958
- ...at
969
+ hoverBend: F = !1,
970
+ theme: T = "auto",
971
+ speed: P = 1,
972
+ paused: N = !1,
973
+ color: G,
974
+ dots: z = 1,
975
+ dotSize: W,
976
+ opts: X,
977
+ frame: Q,
978
+ onLevel: Z,
979
+ style: V,
980
+ "aria-label": at,
981
+ ...nt
959
982
  }) {
960
- const Z = Rt(null), J = Ws(I, Z), W = Xs(), ut = $ ? JSON.stringify($) : "", ct = !!(s || o || r != null || n === "processing"), rt = Rt(null);
961
- rt.current || (rt.current = new Js());
962
- const nt = Rt(null);
963
- nt.current || (nt.current = new as());
964
- const Mt = p ? (d == null ? void 0 : d[p]) ?? Ht[p] : null, lt = {
965
- saturation: Math.min(1, m),
966
- vivid: Math.max(0, Math.min(1, m - 1)),
967
- brightness: y,
968
- hue: N,
969
- start: T,
970
- width: z,
971
- accent: v ? ns[v] : null,
983
+ const K = Et(null), st = ae(T, K), $ = ce(), ht = X ? JSON.stringify(X) : "", ut = !!(s || o || r != null || n === "processing"), tt = Et(null);
984
+ tt.current || (tt.current = new de());
985
+ const ft = Et(null);
986
+ ft.current || (ft.current = new bs());
987
+ const dt = m ? (d == null ? void 0 : d[m]) ?? tn[m] : null, Rt = {
988
+ saturation: Math.min(1, M),
989
+ vivid: Math.max(0, Math.min(1, M - 1)),
990
+ brightness: x,
991
+ hue: B,
992
+ start: E,
993
+ width: q,
994
+ accent: v ? ps[v] : null,
972
995
  angle: _,
973
996
  spin: u,
974
997
  neutral: g,
975
998
  size: e
976
- }, mt = U ?? ot[t in ot ? t : "orbit"].dotSize ?? 1, it = ot[t in ot ? t : "orbit"].lean ?? {}, wt = B ?? ot[t in ot ? t : "orbit"].margin ?? 32, Ft = {
999
+ }, Wt = W ?? ot[t in ot ? t : "orbit"].dotSize ?? 1, ct = ot[t in ot ? t : "orbit"].lean ?? {}, At = L ?? ot[t in ot ? t : "orbit"].margin ?? 32, Xt = {
977
1000
  state: n,
978
1001
  level: r,
979
1002
  analyser: o,
@@ -981,206 +1004,230 @@ function se({
981
1004
  threshold: l,
982
1005
  attack: i ?? ot[t in ot ? t : "orbit"].attack ?? 0.06,
983
1006
  release: a,
984
- idle: M,
1007
+ idle: p,
985
1008
  calm: h,
986
1009
  voiceSpeed: f ?? ot[t in ot ? t : "orbit"].voiceSpeed ?? 1,
987
- onLevel: tt,
988
- emotionTint: Mt,
989
- colors: lt,
1010
+ onLevel: Z,
1011
+ emotionTint: dt,
1012
+ colors: Rt,
990
1013
  direction: w,
991
1014
  bounds: C,
1015
+ bend: F === !0 ? Me : typeof F == "number" ? Math.max(0, Math.min(1, F)) : 0,
992
1016
  // each amount: the prop, else the type's own, else the shared default
993
1017
  lean: {
994
- move: k ?? it.move ?? dt.move,
995
- pull: P ?? it.pull ?? dt.pull,
996
- deform: D ?? it.deform ?? dt.deform,
997
- squash: O ?? it.squash ?? dt.squash,
998
- lens: b ?? it.lens ?? dt.lens,
999
- stretch: S ?? it.stretch ?? dt.stretch,
1000
- split: x ?? it.split ?? dt.split,
1001
- blur: F ?? it.blur ?? dt.blur,
1002
- bounce: A ?? it.bounce ?? dt.bounce
1018
+ move: k ?? ct.move ?? bt.move,
1019
+ pull: A ?? ct.pull ?? bt.pull,
1020
+ deform: O ?? ct.deform ?? bt.deform,
1021
+ squash: U ?? ct.squash ?? bt.squash,
1022
+ lens: b ?? ct.lens ?? bt.lens,
1023
+ stretch: S ?? ct.stretch ?? bt.stretch,
1024
+ split: y ?? ct.split ?? bt.split,
1025
+ blur: I ?? ct.blur ?? bt.blur,
1026
+ bounce: R ?? ct.bounce ?? bt.bounce
1003
1027
  }
1004
- }, It = Rt(Ft);
1005
- It.current = Ft;
1006
- const Pt = w == null ? 0 : cs(Ft.lean, e), [gn, Xn] = _t([1 / 0, 1 / 0]), jt = Math.min(Pt, gn[0]), Zt = Math.min(Pt, gn[1]), gt = Pt ? jt + wt : 0, Nt = Pt ? Zt + wt : 0, Jt = Rt(null);
1007
- return kt(() => {
1028
+ }, xt = Et(Xt);
1029
+ xt.current = Xt;
1030
+ const Nt = w == null ? 0 : ys(Xt.lean, e), [Tn, es] = Bt([1 / 0, 1 / 0]), sn = Math.min(Nt, Tn[0]), en = Math.min(Nt, Tn[1]), rt = Nt ? sn + At : 0, Pt = Nt ? en + At : 0, Vt = Et({ x: 0, y: 0, over: !1 }), Rn = Xt.bend > 0 && !$;
1031
+ It(() => {
1032
+ const H = K.current;
1033
+ if (!Rn || !H || typeof matchMedia != "function" || !matchMedia("(hover: hover) and (pointer: fine)").matches) return;
1034
+ const yt = (it) => {
1035
+ if (it.pointerType === "touch") return;
1036
+ const Dt = H.getBoundingClientRect(), Kt = (e + rt + Pt) / (Dt.width || 1);
1037
+ Vt.current = { x: (it.clientX - Dt.left) * Kt - rt, y: (it.clientY - Dt.top) * Kt, over: !0 };
1038
+ }, _t = () => {
1039
+ Vt.current.over = !1;
1040
+ };
1041
+ return window.addEventListener("pointermove", yt, { passive: !0 }), document.documentElement.addEventListener("pointerleave", _t), () => {
1042
+ window.removeEventListener("pointermove", yt), document.documentElement.removeEventListener("pointerleave", _t), Vt.current.over = !1;
1043
+ };
1044
+ }, [Rn, e, rt, Pt]);
1045
+ const on = Et(null);
1046
+ return It(() => {
1008
1047
  if (!s) return;
1009
- const st = ts(s);
1010
- return Jt.current = (st == null ? void 0 : st.analyser) ?? null, () => {
1011
- Jt.current = null, st == null || st.release();
1048
+ const H = ds(s);
1049
+ return on.current = (H == null ? void 0 : H.analyser) ?? null, () => {
1050
+ on.current = null, H == null || H.release();
1012
1051
  };
1013
- }, [s]), kt(() => {
1014
- const st = Z.current;
1015
- if (!st) return;
1016
- const Bt = Math.min(2, typeof devicePixelRatio < "u" && devicePixelRatio || 1);
1017
- st.width = Math.round((e + gt + Nt) * Bt), st.height = Math.round(e * Bt);
1018
- const Ot = st.getContext("2d");
1019
- if (!Ot) return;
1020
- const St = Os(t, e, L, mt), Vn = $ ? { ...St.opts, ...$ } : St.opts, Kn = j ?? St.frame, Hn = Qs(q), bt = rt.current, Yn = nt.current, jn = new rs();
1021
- let bn = 0;
1022
- const Zn = (Y, V, G) => {
1023
- var Tn;
1024
- Ot.setTransform(Bt, 0, 0, Bt, gt * Bt, 0), Ot.clearRect(-gt, 0, e + gt + Nt, e);
1025
- const zt = R || W ? 0 : jn.step(bn, G), vt = is(Kn(e, bt.t, Y, Vn), Y.pan, e, It.current.lean, [jt, Zt], zt);
1026
- bn = ((Tn = vt.contact) == null ? void 0 : Tn.press) ?? 0;
1027
- const et = It.current.colors, ft = V.amount, Q = et.accent, Dt = Q ? { r: Q.r + (V.r - Q.r) * ft, g: Q.g + (V.g - Q.g) * ft, b: Q.b + (V.b - Q.b) * ft } : { r: V.r, g: V.g, b: V.b }, Qn = {
1028
- ...et,
1029
- accent: Dt,
1030
- saturation: et.saturation * (Q ? 1 : ft),
1031
- angle: et.angle + et.spin * bt.clock
1052
+ }, [s]), It(() => {
1053
+ const H = K.current;
1054
+ if (!H) return;
1055
+ const yt = Math.min(2, typeof devicePixelRatio < "u" && devicePixelRatio || 1);
1056
+ H.width = Math.round((e + rt + Pt) * yt), H.height = Math.round(e * yt);
1057
+ const _t = H.getContext("2d");
1058
+ if (!_t) return;
1059
+ const it = se(t, e, z, Wt), Dt = X ? { ...it.opts, ...X } : it.opts, Kt = Q ?? it.frame, os = pe(G), wt = tt.current, as = ft.current, cs = new ws();
1060
+ let An = 0, qt = 0, an = e / 2, cn = e / 2;
1061
+ const rs = (J, Y, D) => {
1062
+ var In;
1063
+ _t.setTransform(yt, 0, 0, yt, rt * yt, 0), _t.clearRect(-rt, 0, e + rt + Pt, e);
1064
+ const Ot = N || $ ? 0 : cs.step(An, D);
1065
+ let lt = Ss(Kt(e, wt.t, J, Dt), J.pan, e, xt.current.lean, [sn, en], Ot);
1066
+ An = ((In = lt.contact) == null ? void 0 : In.press) ?? 0;
1067
+ const gt = xt.current.bend;
1068
+ if (gt > 0) {
1069
+ const Gt = Vt.current, Nn = Kn(lt, e), us = xt.current.state === "idle" || xt.current.state === "processing", fs = Gt.over && us && !N && !$ ? xs(Math.hypot(Gt.x - e / 2, Gt.y - e / 2) - Nn, Nn) : 0;
1070
+ qt += (fs - qt) * (1 - Math.exp(-D / 0.14));
1071
+ const Bn = qt < 0.01 ? 1 : 1 - Math.exp(-D / 0.05);
1072
+ an += (Gt.x - an) * Bn, cn += (Gt.y - cn) * Bn, qt > 2e-3 && (lt = vs(lt, e, { x: an, y: cn, amount: qt * gt }));
1073
+ }
1074
+ const pt = xt.current.colors, mt = Y.amount, et = pt.accent, ls = et ? { r: et.r + (Y.r - et.r) * mt, g: et.g + (Y.g - et.g) * mt, b: et.b + (Y.b - et.b) * mt } : { r: Y.r, g: Y.g, b: Y.b }, hs = {
1075
+ ...pt,
1076
+ accent: ls,
1077
+ saturation: pt.saturation * (et ? 1 : mt),
1078
+ angle: pt.angle + pt.spin * wt.clock
1032
1079
  };
1033
- Cs(Ot, vt, J, Hn, vt.light ? V : void 0, Qn);
1080
+ Vs(_t, lt, st, os, lt.light ? Y : void 0, hs);
1034
1081
  };
1035
- let vn = -1 / 0;
1036
- const Jn = (Y) => {
1037
- var ft, Q;
1038
- if (!Pt || Y - vn < 500) return;
1039
- vn = Y;
1040
- const V = st.getBoundingClientRect().left + gt, G = (Q = (ft = It.current.bounds) == null ? void 0 : ft.current) == null ? void 0 : Q.getBoundingClientRect(), zt = G ? G.left : 0, vt = G ? G.right : document.documentElement.clientWidth, et = [
1041
- Math.max(0, Math.floor(V - zt - wt)),
1042
- Math.max(0, Math.floor(vt - V - e - wt))
1082
+ let Pn = -1 / 0;
1083
+ const is = (J) => {
1084
+ var pt, mt;
1085
+ if (!Nt || J - Pn < 500) return;
1086
+ Pn = J;
1087
+ const Y = H.getBoundingClientRect().left + rt, D = (mt = (pt = xt.current.bounds) == null ? void 0 : pt.current) == null ? void 0 : mt.getBoundingClientRect(), Ot = D ? D.left : 0, lt = D ? D.right : document.documentElement.clientWidth, gt = [
1088
+ Math.max(0, Math.floor(Y - Ot - At)),
1089
+ Math.max(0, Math.floor(lt - Y - e - At))
1043
1090
  ];
1044
- Xn((Dt) => Math.abs(Dt[0] - et[0]) > 1 || Math.abs(Dt[1] - et[1]) > 1 ? et : Dt);
1091
+ es((et) => Math.abs(et[0] - gt[0]) > 1 || Math.abs(et[1] - gt[1]) > 1 ? gt : et);
1045
1092
  };
1046
- let Ut = 0;
1047
- const yn = (Y) => {
1048
- var Q;
1049
- Jn(Y);
1050
- const V = Ut ? Math.min(0.05, (Y - Ut) / 1e3) : 1 / 60;
1051
- Ut = Y;
1052
- const G = It.current, zt = G.state === "listening" || G.state === "speaking", vt = Jt.current ?? G.analyser ?? null;
1053
- zt ? vt ? bt.readAnalyser(vt, G.sensitivity * St.gain, V) : G.level != null ? bt.readLevel(typeof G.level == "function" ? G.level() : G.level, G.sensitivity * St.gain) : bt.readSilence() : bt.readSilence();
1054
- const et = bt.step(
1055
- V,
1093
+ let Ht = 0;
1094
+ const _n = (J) => {
1095
+ var mt;
1096
+ is(J);
1097
+ const Y = Ht ? Math.min(0.05, (J - Ht) / 1e3) : 1 / 60;
1098
+ Ht = J;
1099
+ const D = xt.current, Ot = D.state === "listening" || D.state === "speaking", lt = on.current ?? D.analyser ?? null;
1100
+ Ot ? lt ? wt.readAnalyser(lt, D.sensitivity * it.gain, Y) : D.level != null ? wt.readLevel(typeof D.level == "function" ? D.level() : D.level, D.sensitivity * it.gain) : wt.readSilence() : wt.readSilence();
1101
+ const gt = wt.step(
1102
+ Y,
1056
1103
  {
1057
- sensitivity: G.sensitivity,
1058
- threshold: G.threshold,
1059
- attack: G.attack,
1060
- release: G.release,
1061
- idle: G.idle,
1062
- driveGain: St.driveGain * G.voiceSpeed,
1063
- calm: G.calm,
1064
- rate: St.speed * E,
1065
- processing: G.state === "processing",
1066
- direction: typeof G.direction == "function" ? G.direction() : G.direction ?? 0
1104
+ sensitivity: D.sensitivity,
1105
+ threshold: D.threshold,
1106
+ attack: D.attack,
1107
+ release: D.release,
1108
+ idle: D.idle,
1109
+ driveGain: it.driveGain * D.voiceSpeed,
1110
+ calm: D.calm,
1111
+ rate: it.speed * P,
1112
+ processing: D.state === "processing",
1113
+ direction: typeof D.direction == "function" ? D.direction() : D.direction ?? 0
1067
1114
  },
1068
- W
1115
+ $
1069
1116
  );
1070
- (Q = G.onLevel) == null || Q.call(G, et.level);
1071
- const ft = Yn.step(V, G.emotionTint, bt.clock, e, R || W);
1072
- Zn(et, ft, V);
1117
+ (mt = D.onLevel) == null || mt.call(D, gt.level);
1118
+ const pt = as.step(Y, D.emotionTint, wt.clock, e, N || $);
1119
+ rs(gt, pt, Y);
1073
1120
  };
1074
- if (yn(performance.now()), R || W && !ct) return;
1075
- let Qt = 0, $t = !1, xn = 0;
1076
- const wn = (Y) => {
1077
- $t && (Qt = requestAnimationFrame(wn), !(Y - xn < ne) && (xn = Y, yn(Y)));
1078
- }, tn = () => {
1079
- $t || ($t = !0, Ut = 0, Qt = requestAnimationFrame(wn));
1080
- }, nn = () => {
1081
- $t = !1, cancelAnimationFrame(Qt);
1121
+ if (_n(performance.now()), N || $ && !ut) return;
1122
+ let rn = 0, Yt = !1, kn = 0;
1123
+ const Cn = (J) => {
1124
+ Yt && (rn = requestAnimationFrame(Cn), !(J - kn < ge) && (kn = J, _n(J)));
1125
+ }, ln = () => {
1126
+ Yt || (Yt = !0, Ht = 0, rn = requestAnimationFrame(Cn));
1127
+ }, hn = () => {
1128
+ Yt = !1, cancelAnimationFrame(rn);
1082
1129
  };
1083
- let sn = !0;
1084
- const Tt = typeof IntersectionObserver < "u" ? new IntersectionObserver(([Y]) => {
1085
- sn = Y.isIntersecting, sn && document.visibilityState !== "hidden" ? tn() : nn();
1130
+ let un = !0;
1131
+ const kt = typeof IntersectionObserver < "u" ? new IntersectionObserver(([J]) => {
1132
+ un = J.isIntersecting, un && document.visibilityState !== "hidden" ? ln() : hn();
1086
1133
  }) : null;
1087
- Tt == null || Tt.observe(st);
1088
- const Sn = () => {
1089
- document.visibilityState === "hidden" ? nn() : sn && tn();
1134
+ kt == null || kt.observe(H);
1135
+ const Fn = () => {
1136
+ document.visibilityState === "hidden" ? hn() : un && ln();
1090
1137
  };
1091
- return document.addEventListener("visibilitychange", Sn), Tt || tn(), () => {
1092
- nn(), Tt == null || Tt.disconnect(), document.removeEventListener("visibilitychange", Sn);
1138
+ return document.addEventListener("visibilitychange", Fn), kt || ln(), () => {
1139
+ hn(), kt == null || kt.disconnect(), document.removeEventListener("visibilitychange", Fn);
1093
1140
  };
1094
1141
  }, [
1095
1142
  t,
1096
1143
  e,
1097
- Pt,
1098
- jt,
1099
- Zt,
1100
- gt,
1101
1144
  Nt,
1102
- wt,
1103
- J,
1104
- E,
1105
- R,
1106
- W,
1107
- ct,
1108
- q,
1109
- L,
1110
- mt,
1145
+ sn,
1146
+ en,
1147
+ rt,
1148
+ Pt,
1149
+ At,
1150
+ st,
1151
+ P,
1152
+ N,
1153
+ $,
1111
1154
  ut,
1112
- j,
1113
- R || W ? p : null,
1114
- R || W ? `${m}|${v}|${_}|${u}|${g}|${y}|${N}|${T}|${z}` : null
1115
- ]), /* @__PURE__ */ In(
1155
+ G,
1156
+ z,
1157
+ Wt,
1158
+ ht,
1159
+ Q,
1160
+ N || $ ? m : null,
1161
+ N || $ ? `${M}|${v}|${_}|${u}|${g}|${x}|${B}|${E}|${q}` : null
1162
+ ]), /* @__PURE__ */ Wn(
1116
1163
  "canvas",
1117
1164
  {
1118
- ref: Z,
1165
+ ref: K,
1119
1166
  role: "img",
1120
- "aria-label": X ?? te[n],
1121
- style: { width: e + gt + Nt, height: e, display: "block", marginLeft: -gt, marginRight: -Nt, ...H },
1122
- ...at
1167
+ "aria-label": at ?? me[n],
1168
+ style: { width: e + rt + Pt, height: e, display: "block", marginLeft: -rt, marginRight: -Pt, ...V },
1169
+ ...nt
1123
1170
  }
1124
1171
  );
1125
1172
  }
1126
- const ee = {
1173
+ const ve = {
1127
1174
  echoCancellation: !1,
1128
1175
  noiseSuppression: !1,
1129
1176
  autoGainControl: !1
1130
1177
  };
1131
- function Kt() {
1178
+ function Qt() {
1132
1179
  return typeof navigator < "u" && typeof navigator.mediaDevices < "u" && typeof navigator.mediaDevices.getUserMedia == "function";
1133
1180
  }
1134
- function ie(t = {}) {
1135
- const { constraints: n, autoStart: e = !1 } = t, [s, o] = _t(null), [r, c] = _t(() => Kt() ? "idle" : "unsupported"), [l, i] = _t(null), a = Rt(null), M = Rt(n);
1136
- M.current = n;
1137
- const h = En(() => {
1138
- const p = a.current;
1139
- a.current = null, p && p.getTracks().forEach((d) => d.stop()), o(null), c(Kt() ? "idle" : "unsupported");
1140
- }, []), f = En(async () => {
1141
- if (!Kt())
1181
+ function Ee(t = {}) {
1182
+ const { constraints: n, autoStart: e = !1 } = t, [s, o] = Bt(null), [r, c] = Bt(() => Qt() ? "idle" : "unsupported"), [l, i] = Bt(null), a = Et(null), p = Et(n);
1183
+ p.current = n;
1184
+ const h = Ln(() => {
1185
+ const m = a.current;
1186
+ a.current = null, m && m.getTracks().forEach((d) => d.stop()), o(null), c(Qt() ? "idle" : "unsupported");
1187
+ }, []), f = Ln(async () => {
1188
+ if (!Qt())
1142
1189
  return c("unsupported"), null;
1143
1190
  if (a.current) return a.current;
1144
- Bn(), c("requesting"), i(null);
1191
+ Vn(), c("requesting"), i(null);
1145
1192
  try {
1146
- const p = await navigator.mediaDevices.getUserMedia({
1147
- audio: { ...ee, ...M.current ?? {} }
1193
+ const m = await navigator.mediaDevices.getUserMedia({
1194
+ audio: { ...ve, ...p.current ?? {} }
1148
1195
  });
1149
- a.current = p, o(p), c("live");
1196
+ a.current = m, o(m), c("live");
1150
1197
  const d = () => {
1151
- a.current === p && (a.current = null, o(null), c("idle"));
1198
+ a.current === m && (a.current = null, o(null), c("idle"));
1152
1199
  };
1153
- return p.getAudioTracks().forEach((m) => m.addEventListener("ended", d)), p;
1154
- } catch (p) {
1155
- const d = p instanceof Error ? p : new Error(String(p));
1200
+ return m.getAudioTracks().forEach((M) => M.addEventListener("ended", d)), m;
1201
+ } catch (m) {
1202
+ const d = m instanceof Error ? m : new Error(String(m));
1156
1203
  return i(d), c(d.name === "NotAllowedError" || d.name === "SecurityError" ? "denied" : "error"), null;
1157
1204
  }
1158
1205
  }, []);
1159
- return kt(() => {
1206
+ return It(() => {
1160
1207
  e && f();
1161
- }, [e]), kt(
1208
+ }, [e]), It(
1162
1209
  () => () => {
1163
- const p = a.current;
1164
- a.current = null, p && p.getTracks().forEach((d) => d.stop());
1210
+ const m = a.current;
1211
+ a.current = null, m && m.getTracks().forEach((d) => d.stop());
1165
1212
  },
1166
1213
  []
1167
- ), { stream: s, state: r, error: l, supported: Kt(), start: f, stop: h };
1214
+ ), { stream: s, state: r, error: l, supported: Qt(), start: f, stop: h };
1168
1215
  }
1169
- function le(t) {
1170
- return /* @__PURE__ */ In(se, { ...t, type: "aura" });
1216
+ function Te(t) {
1217
+ return /* @__PURE__ */ Wn(be, { ...t, type: "aura" });
1171
1218
  }
1172
1219
  export {
1173
- ns as ACCENT_COLORS,
1174
- Ht as EMOTION_COLORS,
1220
+ ps as ACCENT_COLORS,
1221
+ tn as EMOTION_COLORS,
1175
1222
  ot as PRESETS,
1176
- pt as SPECTRUM_N,
1177
- re as VOICE_ORB_TYPES,
1178
- Js as VoiceFollower,
1179
- se as VoiceOrb,
1180
- le as VoiceRing,
1181
- ts as acquireAnalyser,
1182
- Bn as getAudioContext,
1183
- ce as isAudioSupported,
1184
- Os as resolvePreset,
1185
- ie as useMicrophone
1223
+ vt as SPECTRUM_N,
1224
+ Se as VOICE_ORB_TYPES,
1225
+ de as VoiceFollower,
1226
+ be as VoiceOrb,
1227
+ Te as VoiceRing,
1228
+ ds as acquireAnalyser,
1229
+ Vn as getAudioContext,
1230
+ we as isAudioSupported,
1231
+ se as resolvePreset,
1232
+ Ee as useMicrophone
1186
1233
  };