@factorialco/f0-react 1.347.0 → 1.348.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.
@@ -0,0 +1,1205 @@
1
+ import { jsx as X, jsxs as le } from "react/jsx-runtime";
2
+ import { useInsertionEffect as Xe, createContext as ke, useContext as $e, useRef as _, useEffect as ne, useState as _e, useCallback as ze, useMemo as Ye } from "react";
3
+ import { y as qe, z as We, D as He, G as je, J as Ne, K as Ke, M as Qe, N as Je, Q as Ze, R as et, V as Ce, W as tt, X as rt, Y as nt, Z as it, _ as ot, $ as at, a0 as st, a1 as ie, a2 as ct, a3 as ut, a4 as lt, a5 as ft, a6 as mt, a7 as dt, a8 as fe, a9 as ht } from "./F0AiChat-CA1GA0lK.js";
4
+ import { useTrackVolume as pt } from "@livekit/components-react";
5
+ function vt(t, e, r) {
6
+ Xe(() => t.on(e, r), [t, e, r]);
7
+ }
8
+ function ce(t) {
9
+ return typeof t == "object" && !Array.isArray(t);
10
+ }
11
+ function Ue(t, e, r, n) {
12
+ return typeof t == "string" && ce(e) ? qe(t, r, n) : t instanceof NodeList ? Array.from(t) : Array.isArray(t) ? t : [t];
13
+ }
14
+ function gt(t, e, r) {
15
+ return t * (e + 1);
16
+ }
17
+ function me(t, e, r, n) {
18
+ return typeof e == "number" ? e : e.startsWith("-") || e.startsWith("+") ? Math.max(0, t + parseFloat(e)) : e === "<" ? r : n.get(e) ?? t;
19
+ }
20
+ const yt = (t, e, r) => {
21
+ const n = e - t;
22
+ return ((r - t) % n + n) % n + t;
23
+ };
24
+ function Oe(t, e) {
25
+ return We(t) ? t[yt(0, t.length, e)] : t;
26
+ }
27
+ function Tt(t, e, r) {
28
+ for (let n = 0; n < t.length; n++) {
29
+ const l = t[n];
30
+ l.at > e && l.at < r && (je(t, l), n--);
31
+ }
32
+ }
33
+ function Et(t, e, r, n, l, f) {
34
+ Tt(t, l, f);
35
+ for (let h = 0; h < e.length; h++)
36
+ t.push({
37
+ value: e[h],
38
+ at: He(l, f, n[h]),
39
+ easing: Oe(r, h)
40
+ });
41
+ }
42
+ function At(t, e) {
43
+ for (let r = 0; r < t.length; r++)
44
+ t[r] = t[r] / (e + 1);
45
+ }
46
+ function wt(t, e) {
47
+ return t.at === e.at ? t.value === null ? 1 : e.value === null ? -1 : 0 : t.at - e.at;
48
+ }
49
+ const St = "easeInOut", bt = 20;
50
+ function xt(t, { defaultTransition: e = {}, ...r } = {}, n, l) {
51
+ const f = e.duration || 0.3, h = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map(), g = {}, x = /* @__PURE__ */ new Map();
52
+ let y = 0, T = 0, b = 0;
53
+ for (let c = 0; c < t.length; c++) {
54
+ const v = t[c];
55
+ if (typeof v == "string") {
56
+ x.set(v, T);
57
+ continue;
58
+ } else if (!Array.isArray(v)) {
59
+ x.set(v.name, me(T, v.at, y, x));
60
+ continue;
61
+ }
62
+ let [N, m, R = {}] = v;
63
+ R.at !== void 0 && (T = me(T, R.at, y, x));
64
+ let L = 0;
65
+ const C = (w, S, I, F = 0, V = 0) => {
66
+ const E = Rt(w), { delay: d = 0, times: P = Ke(E), type: W = "keyframes", repeat: k, repeatType: ue, repeatDelay: oe = 0, ...H } = S;
67
+ let { ease: U = e.ease || "easeOut", duration: M } = S;
68
+ const $ = typeof d == "function" ? d(F, V) : d, Q = E.length, J = Ze(W) ? W : l?.[W];
69
+ if (Q <= 2 && J) {
70
+ let z = 100;
71
+ if (Q === 2 && Lt(E)) {
72
+ const q = E[1] - E[0];
73
+ z = Math.abs(q);
74
+ }
75
+ const Y = { ...H };
76
+ M !== void 0 && (Y.duration = et(M));
77
+ const j = Qe(Y, z, J);
78
+ U = j.ease, M = j.duration;
79
+ }
80
+ M ?? (M = f);
81
+ const Z = T + $;
82
+ P.length === 1 && P[0] === 0 && (P[1] = 1);
83
+ const ee = P.length - E.length;
84
+ if (ee > 0 && Je(P, ee), E.length === 1 && E.unshift(null), k) {
85
+ Ce(k < bt, "Repeat count too high, must be less than 20"), M = gt(M, k);
86
+ const z = [...E], Y = [...P];
87
+ U = Array.isArray(U) ? [...U] : [U];
88
+ const j = [...U];
89
+ for (let q = 0; q < k; q++) {
90
+ E.push(...z);
91
+ for (let i = 0; i < z.length; i++)
92
+ P.push(Y[i] + (q + 1)), U.push(i === 0 ? "linear" : Oe(j, i - 1));
93
+ }
94
+ At(P, k);
95
+ }
96
+ const te = Z + M;
97
+ Et(I, E, U, P, Z, te), L = Math.max($ + M, L), b = Math.max(te, b);
98
+ };
99
+ if (Ne(N)) {
100
+ const w = de(N, A);
101
+ C(m, R, he("default", w));
102
+ } else {
103
+ const w = Ue(N, m, n, g), S = w.length;
104
+ for (let I = 0; I < S; I++) {
105
+ m = m, R = R;
106
+ const F = w[I], V = de(F, A);
107
+ for (const E in m)
108
+ C(m[E], It(R, E), he(E, V), I, S);
109
+ }
110
+ }
111
+ y = T, T += L;
112
+ }
113
+ return A.forEach((c, v) => {
114
+ for (const N in c) {
115
+ const m = c[N];
116
+ m.sort(wt);
117
+ const R = [], L = [], C = [];
118
+ for (let S = 0; S < m.length; S++) {
119
+ const { at: I, value: F, easing: V } = m[S];
120
+ R.push(F), L.push(tt(0, b, I)), C.push(V || "easeOut");
121
+ }
122
+ L[0] !== 0 && (L.unshift(0), R.unshift(R[0]), C.unshift(St)), L[L.length - 1] !== 1 && (L.push(1), R.push(null)), h.has(v) || h.set(v, {
123
+ keyframes: {},
124
+ transition: {}
125
+ });
126
+ const w = h.get(v);
127
+ w.keyframes[N] = R, w.transition[N] = {
128
+ ...e,
129
+ duration: b,
130
+ ease: C,
131
+ times: L,
132
+ ...r
133
+ };
134
+ }
135
+ }), h;
136
+ }
137
+ function de(t, e) {
138
+ return !e.has(t) && e.set(t, {}), e.get(t);
139
+ }
140
+ function he(t, e) {
141
+ return e[t] || (e[t] = []), e[t];
142
+ }
143
+ function Rt(t) {
144
+ return Array.isArray(t) ? t : [t];
145
+ }
146
+ function It(t, e) {
147
+ return t && t[e] ? {
148
+ ...t,
149
+ ...t[e]
150
+ } : { ...t };
151
+ }
152
+ const Ft = (t) => typeof t == "number", Lt = (t) => t.every(Ft);
153
+ function Mt(t, e) {
154
+ return t in e;
155
+ }
156
+ class _t extends rt {
157
+ constructor() {
158
+ super(...arguments), this.type = "object";
159
+ }
160
+ readValueFromInstance(e, r) {
161
+ if (Mt(r, e)) {
162
+ const n = e[r];
163
+ if (typeof n == "string" || typeof n == "number")
164
+ return n;
165
+ }
166
+ }
167
+ getBaseTargetFromProps() {
168
+ }
169
+ removeValueFromRenderState(e, r) {
170
+ delete r.output[e];
171
+ }
172
+ measureInstanceViewportBox() {
173
+ return nt();
174
+ }
175
+ build(e, r) {
176
+ Object.assign(e.output, r);
177
+ }
178
+ renderInstance(e, { output: r }) {
179
+ Object.assign(e, r);
180
+ }
181
+ sortInstanceNodePosition() {
182
+ return 0;
183
+ }
184
+ }
185
+ function Nt(t) {
186
+ const e = {
187
+ presenceContext: null,
188
+ props: {},
189
+ visualState: {
190
+ renderState: {
191
+ transform: {},
192
+ transformOrigin: {},
193
+ style: {},
194
+ vars: {},
195
+ attrs: {}
196
+ },
197
+ latestValues: {}
198
+ }
199
+ }, r = it(t) && !ot(t) ? new at(e) : new st(e);
200
+ r.mount(t), ie.set(t, r);
201
+ }
202
+ function Ct(t) {
203
+ const e = {
204
+ presenceContext: null,
205
+ props: {},
206
+ visualState: {
207
+ renderState: {
208
+ output: {}
209
+ },
210
+ latestValues: {}
211
+ }
212
+ }, r = new _t(e);
213
+ r.mount(t), ie.set(t, r);
214
+ }
215
+ function Ut(t, e) {
216
+ return Ne(t) || typeof t == "number" || typeof t == "string" && !ce(e);
217
+ }
218
+ function De(t, e, r, n) {
219
+ const l = [];
220
+ if (Ut(t, e))
221
+ l.push(ct(t, ce(e) && e.default || e, r && (r.default || r)));
222
+ else {
223
+ const f = Ue(t, e, n), h = f.length;
224
+ Ce(!!h, "No valid elements provided.");
225
+ for (let A = 0; A < h; A++) {
226
+ const g = f[A], x = g instanceof Element ? Nt : Ct;
227
+ ie.has(g) || x(g);
228
+ const y = ie.get(g), T = { ...r };
229
+ "delay" in T && typeof T.delay == "function" && (T.delay = T.delay(A, h)), l.push(...ut(y, { ...e, transition: T }, {}));
230
+ }
231
+ }
232
+ return l;
233
+ }
234
+ function Ot(t, e, r) {
235
+ const n = [];
236
+ return xt(t, e, r, { spring: lt }).forEach(({ keyframes: f, transition: h }, A) => {
237
+ n.push(...De(A, f, h));
238
+ }), n;
239
+ }
240
+ class Dt {
241
+ constructor(e) {
242
+ this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean);
243
+ }
244
+ get finished() {
245
+ return Promise.all(this.animations.map((e) => e.finished));
246
+ }
247
+ /**
248
+ * TODO: Filter out cancelled or stopped animations before returning
249
+ */
250
+ getAll(e) {
251
+ return this.animations[0][e];
252
+ }
253
+ setAll(e, r) {
254
+ for (let n = 0; n < this.animations.length; n++)
255
+ this.animations[n][e] = r;
256
+ }
257
+ attachTimeline(e) {
258
+ const r = this.animations.map((n) => n.attachTimeline(e));
259
+ return () => {
260
+ r.forEach((n, l) => {
261
+ n && n(), this.animations[l].stop();
262
+ });
263
+ };
264
+ }
265
+ get time() {
266
+ return this.getAll("time");
267
+ }
268
+ set time(e) {
269
+ this.setAll("time", e);
270
+ }
271
+ get speed() {
272
+ return this.getAll("speed");
273
+ }
274
+ set speed(e) {
275
+ this.setAll("speed", e);
276
+ }
277
+ get state() {
278
+ return this.getAll("state");
279
+ }
280
+ get startTime() {
281
+ return this.getAll("startTime");
282
+ }
283
+ get duration() {
284
+ let e = 0;
285
+ for (let r = 0; r < this.animations.length; r++)
286
+ e = Math.max(e, this.animations[r].duration);
287
+ return e;
288
+ }
289
+ runAll(e) {
290
+ this.animations.forEach((r) => r[e]());
291
+ }
292
+ play() {
293
+ this.runAll("play");
294
+ }
295
+ pause() {
296
+ this.runAll("pause");
297
+ }
298
+ cancel() {
299
+ this.runAll("cancel");
300
+ }
301
+ complete() {
302
+ this.runAll("complete");
303
+ }
304
+ }
305
+ class Pt extends Dt {
306
+ then(e, r) {
307
+ return this.finished.finally(e).then(() => {
308
+ });
309
+ }
310
+ }
311
+ function Vt(t) {
312
+ return Array.isArray(t) && t.some(Array.isArray);
313
+ }
314
+ function Bt(t) {
315
+ function e(r, n, l) {
316
+ let f = [];
317
+ return Vt(r) ? f = Ot(r, n, t) : f = De(r, n, l, t), new Pt(f);
318
+ }
319
+ return e;
320
+ }
321
+ const Gt = Bt(), mr = ["xs", "sm", "md", "lg"], dr = [
322
+ "inProgress",
323
+ "executing",
324
+ "completed"
325
+ ], hr = {
326
+ ai: {
327
+ openChat: "Open Chat with One AI",
328
+ closeChat: "Close Chat with One AI",
329
+ startNewChat: "Start new chat",
330
+ scrollToBottom: "Scroll to bottom",
331
+ welcome: "Ask or create with One",
332
+ defaultInitialMessage: "How can I help you today?",
333
+ inputPlaceholder: "Ask about time, people, or company info and a lot of other things...",
334
+ stopAnswerGeneration: "Stop generating",
335
+ sendMessage: "Send message",
336
+ thoughtsGroupTitle: "Reflection",
337
+ resourcesGroupTitle: "Resources",
338
+ thinking: "Thinking...",
339
+ exportTable: "Download table",
340
+ generatedTableFilename: "OneGeneratedTable",
341
+ feedbackModal: {
342
+ positive: {
343
+ title: "What did you like about this response?",
344
+ label: "Your feedback helps us make Factorial AI better",
345
+ placeholder: "Share what worked well"
346
+ },
347
+ negative: {
348
+ title: "What could have been better?",
349
+ label: "Your feedback helps us improve future answers",
350
+ placeholder: "Share what didn't work"
351
+ }
352
+ },
353
+ ask: "Ask One"
354
+ }
355
+ }, Pe = ke(null);
356
+ function pr({ children: t, translations: e }) {
357
+ return X(Pe.Provider, {
358
+ value: e,
359
+ children: t
360
+ });
361
+ }
362
+ function vr() {
363
+ const t = $e(Pe);
364
+ if (t === null)
365
+ throw new Error("useAiChatTranslations must be used within an AiChatTranslationsProvider");
366
+ return t;
367
+ }
368
+ const pe = ["lowp", "mediump", "highp"], Xt = `
369
+ void main(void){
370
+ vec4 color = vec4(0.0,0.0,0.0,1.0);
371
+ mainImage( color, gl_FragCoord.xy );
372
+ gl_FragColor = color;
373
+ }`, kt = `void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
374
+ vec2 uv = fragCoord/iResolution.xy;
375
+ vec3 col = 0.5 + 0.5*cos(iTime+uv.xyx+vec3(0,2,4));
376
+ fragColor = vec4(col,1.0);
377
+ }`, ve = `attribute vec3 aVertexPosition;
378
+ void main(void) {
379
+ gl_Position = vec4(aVertexPosition, 1.0);
380
+ }`, ge = "iTime", ye = "iTimeDelta", Te = "iDate", Ee = "iFrame", Ae = "iMouse", we = "iResolution", $t = "iChannel", Se = "iChannelResolution", be = "iDeviceOrientation";
381
+ function zt(t, e) {
382
+ return t.includes("Matrix") && Array.isArray(e);
383
+ }
384
+ function Yt(t, e) {
385
+ return t.includes("v") && Array.isArray(e) && e.length > Number.parseInt(t.charAt(0));
386
+ }
387
+ function qt(t, e) {
388
+ return !t.includes("v") && Array.isArray(e) && e.length > Number.parseInt(t.charAt(0));
389
+ }
390
+ const Wt = (t, e, r, n) => {
391
+ if (qt(r, n))
392
+ switch (r) {
393
+ case "2f":
394
+ return t.uniform2f(e, n[0], n[1]);
395
+ case "3f":
396
+ return t.uniform3f(e, n[0], n[1], n[2]);
397
+ case "4f":
398
+ return t.uniform4f(e, n[0], n[1], n[2], n[3]);
399
+ case "2i":
400
+ return t.uniform2i(e, n[0], n[1]);
401
+ case "3i":
402
+ return t.uniform3i(e, n[0], n[1], n[2]);
403
+ case "4i":
404
+ return t.uniform4i(e, n[0], n[1], n[2], n[3]);
405
+ }
406
+ if (typeof n == "number")
407
+ return r === "1i" ? t.uniform1i(e, n) : t.uniform1f(e, n);
408
+ switch (r) {
409
+ case "1iv":
410
+ return t.uniform1iv(e, n);
411
+ case "2iv":
412
+ return t.uniform2iv(e, n);
413
+ case "3iv":
414
+ return t.uniform3iv(e, n);
415
+ case "4iv":
416
+ return t.uniform4iv(e, n);
417
+ case "1fv":
418
+ return t.uniform1fv(e, n);
419
+ case "2fv":
420
+ return t.uniform2fv(e, n);
421
+ case "3fv":
422
+ return t.uniform3fv(e, n);
423
+ case "4fv":
424
+ return t.uniform4fv(e, n);
425
+ case "Matrix2fv":
426
+ return t.uniformMatrix2fv(e, !1, n);
427
+ case "Matrix3fv":
428
+ return t.uniformMatrix3fv(e, !1, n);
429
+ case "Matrix4fv":
430
+ return t.uniformMatrix4fv(e, !1, n);
431
+ }
432
+ }, Ht = (t) => {
433
+ switch (t) {
434
+ case "1f":
435
+ return "float";
436
+ case "2f":
437
+ return "vec2";
438
+ case "3f":
439
+ return "vec3";
440
+ case "4f":
441
+ return "vec4";
442
+ case "1i":
443
+ return "int";
444
+ case "2i":
445
+ return "ivec2";
446
+ case "3i":
447
+ return "ivec3";
448
+ case "4i":
449
+ return "ivec4";
450
+ case "1iv":
451
+ return "int";
452
+ case "2iv":
453
+ return "ivec2";
454
+ case "3iv":
455
+ return "ivec3";
456
+ case "4iv":
457
+ return "ivec4";
458
+ case "1fv":
459
+ return "float";
460
+ case "2fv":
461
+ return "vec2";
462
+ case "3fv":
463
+ return "vec3";
464
+ case "4fv":
465
+ return "vec4";
466
+ case "Matrix2fv":
467
+ return "mat2";
468
+ case "Matrix3fv":
469
+ return "mat3";
470
+ case "Matrix4fv":
471
+ return "mat4";
472
+ default:
473
+ console.error(G(`The uniform type "${t}" is not valid, please make sure your uniform type is valid`));
474
+ }
475
+ }, se = 9729, xe = 9728, jt = 9987, Re = 33071, Ie = 10497;
476
+ class Kt {
477
+ gl;
478
+ url;
479
+ wrapS;
480
+ wrapT;
481
+ minFilter;
482
+ magFilter;
483
+ source;
484
+ pow2canvas;
485
+ isLoaded = !1;
486
+ isVideo = !1;
487
+ flipY = -1;
488
+ width = 0;
489
+ height = 0;
490
+ _webglTexture = null;
491
+ constructor(e) {
492
+ this.gl = e;
493
+ }
494
+ updateTexture = (e, r, n) => {
495
+ const { gl: l } = this, f = 0, h = l.RGBA, A = l.RGBA, g = l.UNSIGNED_BYTE;
496
+ l.bindTexture(l.TEXTURE_2D, e), l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL, n), l.texImage2D(l.TEXTURE_2D, f, h, A, g, r);
497
+ };
498
+ setupVideo = (e) => {
499
+ const r = document.createElement("video");
500
+ let n = !1, l = !1;
501
+ r.autoplay = !0, r.muted = !0, r.loop = !0, r.crossOrigin = "anonymous";
502
+ const f = () => {
503
+ n && l && (this.isLoaded = !0);
504
+ };
505
+ return r.addEventListener("playing", () => {
506
+ n = !0, this.width = r.videoWidth || 0, this.height = r.videoHeight || 0, f();
507
+ }, !0), r.addEventListener("timeupdate", () => {
508
+ l = !0, f();
509
+ }, !0), r.src = e, r;
510
+ };
511
+ makePowerOf2 = (e) => e instanceof HTMLImageElement || e instanceof HTMLCanvasElement || e instanceof ImageBitmap ? (this.pow2canvas === void 0 && (this.pow2canvas = document.createElement("canvas")), this.pow2canvas.width = 2 ** Math.floor(Math.log(e.width) / Math.LN2), this.pow2canvas.height = 2 ** Math.floor(Math.log(e.height) / Math.LN2), this.pow2canvas.getContext("2d")?.drawImage(e, 0, 0, this.pow2canvas.width, this.pow2canvas.height), console.warn(G(`Image is not power of two ${e.width} x ${e.height}. Resized to ${this.pow2canvas.width} x ${this.pow2canvas.height};`)), this.pow2canvas) : e;
512
+ load = async (e) => {
513
+ const { gl: r } = this, { url: n, wrapS: l, wrapT: f, minFilter: h, magFilter: A, flipY: g = -1 } = e;
514
+ if (!n)
515
+ return Promise.reject(new Error(G("Missing url, please make sure to pass the url of your texture { url: ... }")));
516
+ const x = /(\.jpg|\.jpeg|\.png|\.gif|\.bmp)$/i.exec(n), y = /(\.mp4|\.3gp|\.webm|\.ogv)$/i.exec(n);
517
+ if (x === null && y === null)
518
+ return Promise.reject(new Error(G(`Please upload a video or an image with a valid format (url: ${n})`)));
519
+ Object.assign(this, {
520
+ url: n,
521
+ wrapS: l,
522
+ wrapT: f,
523
+ minFilter: h,
524
+ magFilter: A,
525
+ flipY: g
526
+ });
527
+ const T = 0, b = r.RGBA, c = 1, v = 1, N = 0, m = r.RGBA, R = r.UNSIGNED_BYTE, L = new Uint8Array([255, 255, 255, 0]), C = r.createTexture();
528
+ if (r.bindTexture(r.TEXTURE_2D, C), r.texImage2D(r.TEXTURE_2D, T, b, c, v, N, m, R, L), y) {
529
+ const F = this.setupVideo(n);
530
+ return r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_S, r.CLAMP_TO_EDGE), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_T, r.CLAMP_TO_EDGE), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, r.LINEAR), this._webglTexture = C, this.source = F, this.isVideo = !0, F.play().then(() => this);
531
+ }
532
+ async function w() {
533
+ return new Promise((F, V) => {
534
+ const E = new Image();
535
+ E.crossOrigin = "anonymous", E.onload = () => {
536
+ F(E);
537
+ }, E.onerror = () => {
538
+ V(new Error(G(`failed loading url: ${n}`)));
539
+ }, E.src = n ?? "";
540
+ });
541
+ }
542
+ let S = await w(), I = (S.width & S.width - 1) === 0 && (S.height & S.height - 1) === 0;
543
+ return (e.wrapS !== Re || e.wrapT !== Re || e.minFilter !== xe && e.minFilter !== se) && !I && (S = this.makePowerOf2(S), I = !0), r.bindTexture(r.TEXTURE_2D, C), r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL, g), r.texImage2D(r.TEXTURE_2D, T, b, m, R, S), I && e.minFilter !== xe && e.minFilter !== se && r.generateMipmap(r.TEXTURE_2D), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_S, this.wrapS || Ie), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_T, this.wrapT || Ie), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, this.minFilter || jt), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, this.magFilter || se), this._webglTexture = C, this.source = S, this.isVideo = !1, this.isLoaded = !0, this.width = S.width || 0, this.height = S.height || 0, this;
544
+ };
545
+ }
546
+ const G = (t) => `react-shaders: ${t}`, Fe = (t) => {
547
+ if ("changedTouches" in t) {
548
+ const e = t.changedTouches[0];
549
+ return [e?.clientX ?? 0, e?.clientY ?? 0];
550
+ }
551
+ return [t.clientX, t.clientY];
552
+ }, Le = (t, e, r) => t * (1 - r) + e * r, Qt = (t, e, r) => r > 0 ? t.substring(0, r) + e + t.substring(r, t.length) : e + t;
553
+ function Jt({ fs: t, vs: e = ve, textures: r = [], uniforms: n, clearColor: l = [0, 0, 0, 1], precision: f = "highp", style: h, contextAttributes: A = {}, lerp: g = 1, devicePixelRatio: x = 1, onDoneLoadingTextures: y, onError: T = console.error, onWarning: b = console.warn }) {
554
+ const c = _(null), v = _(null), N = _(null), m = _(null), R = _(void 0), L = _(void 0), C = _(!1), w = _(void 0), S = _(0), I = _([0, 0]), F = _([]), V = _(0), E = _(void 0), d = _({
555
+ [ge]: {
556
+ type: "float",
557
+ isNeeded: !1,
558
+ value: 0
559
+ },
560
+ [ye]: {
561
+ type: "float",
562
+ isNeeded: !1,
563
+ value: 0
564
+ },
565
+ [Te]: {
566
+ type: "vec4",
567
+ isNeeded: !1,
568
+ value: [0, 0, 0, 0]
569
+ },
570
+ [Ae]: {
571
+ type: "vec4",
572
+ isNeeded: !1,
573
+ value: [0, 0, 0, 0]
574
+ },
575
+ [we]: {
576
+ type: "vec2",
577
+ isNeeded: !1,
578
+ value: [0, 0]
579
+ },
580
+ [Ee]: {
581
+ type: "int",
582
+ isNeeded: !1,
583
+ value: 0
584
+ },
585
+ [be]: {
586
+ type: "vec4",
587
+ isNeeded: !1,
588
+ value: [0, 0, 0, 0]
589
+ }
590
+ }), P = _(n), W = (i, a) => {
591
+ const o = "width" in i ? i.width ?? 0 : 0, u = "height" in i ? i.height ?? 0 : 0, s = d.current.iChannelResolution;
592
+ if (!s) return;
593
+ const p = Array.isArray(s.value) ? s.value : s.value = [];
594
+ p[a * 3] = o * x, p[a * 3 + 1] = u * x, p[a * 3 + 2] = 0;
595
+ }, k = () => {
596
+ c.current && (v.current = c.current.getContext("webgl", A) || c.current.getContext("experimental-webgl", A), v.current?.getExtension("OES_standard_derivatives"), v.current?.getExtension("EXT_shader_texture_lod"));
597
+ }, ue = () => {
598
+ const i = v.current;
599
+ N.current = i?.createBuffer() ?? null, i?.bindBuffer(i.ARRAY_BUFFER, N.current);
600
+ const a = [1, 1, 0, -1, 1, 0, 1, -1, 0, -1, -1, 0];
601
+ i?.bufferData(i.ARRAY_BUFFER, new Float32Array(a), i.STATIC_DRAW);
602
+ }, oe = ({ alpha: i, beta: a, gamma: o }) => {
603
+ d.current.iDeviceOrientation.value = [i ?? 0, a ?? 0, o ?? 0, window.orientation ?? 0];
604
+ }, H = (i) => {
605
+ const [a = 0, o = 0] = Fe(i), u = a - (w.current?.left ?? 0) - window.pageXOffset, s = (w.current?.height ?? 0) - o - (w.current?.top ?? 0) - window.pageYOffset;
606
+ C.current = !0;
607
+ const p = Array.isArray(d.current.iMouse?.value) ? d.current.iMouse.value : void 0;
608
+ p && (p[2] = u, p[3] = s), I.current[0] = u, I.current[1] = s;
609
+ }, U = (i) => {
610
+ w.current = c.current?.getBoundingClientRect();
611
+ const [a = 0, o = 0] = Fe(i), u = a - (w.current?.left ?? 0), s = (w.current?.height ?? 0) - o - (w.current?.top ?? 0);
612
+ if (g !== 1)
613
+ I.current[0] = u, I.current[1] = s;
614
+ else {
615
+ const p = Array.isArray(d.current.iMouse?.value) ? d.current.iMouse.value : void 0;
616
+ p && (p[0] = u, p[1] = s);
617
+ }
618
+ }, M = () => {
619
+ const i = Array.isArray(d.current.iMouse?.value) ? d.current.iMouse.value : void 0;
620
+ i && (i[2] = 0, i[3] = 0);
621
+ }, $ = () => {
622
+ const i = v.current;
623
+ if (!i) return;
624
+ w.current = c.current?.getBoundingClientRect();
625
+ const a = x, o = Math.floor((w.current?.width ?? 1) * a), u = Math.floor((w.current?.height ?? 1) * a);
626
+ if (i.canvas.width = o, i.canvas.height = u, d.current.iResolution?.isNeeded && m.current) {
627
+ const s = i.getUniformLocation(m.current, we);
628
+ i.uniform2fv(s, [i.canvas.width, i.canvas.height]);
629
+ }
630
+ }, Q = (i, a) => {
631
+ const o = v.current;
632
+ if (!o) return null;
633
+ const u = o.createShader(i);
634
+ if (!u) return null;
635
+ if (o.shaderSource(u, a), o.compileShader(u), !o.getShaderParameter(u, o.COMPILE_STATUS)) {
636
+ b?.(G(`Error compiling the shader:
637
+ ${a}`));
638
+ const s = o.getShaderInfoLog(u);
639
+ o.deleteShader(u), T?.(G(`Shader compiler log: ${s}`));
640
+ }
641
+ return u;
642
+ }, J = (i, a) => {
643
+ const o = v.current;
644
+ if (!o) return;
645
+ const u = Q(o.FRAGMENT_SHADER, i), s = Q(o.VERTEX_SHADER, a);
646
+ if (m.current = o.createProgram(), !(!m.current || !s || !u)) {
647
+ if (o.attachShader(m.current, s), o.attachShader(m.current, u), o.linkProgram(m.current), !o.getProgramParameter(m.current, o.LINK_STATUS)) {
648
+ T?.(G(`Unable to initialize the shader program: ${o.getProgramInfoLog(m.current)}`));
649
+ return;
650
+ }
651
+ o.useProgram(m.current), R.current = o.getAttribLocation(m.current, "aVertexPosition"), o.enableVertexAttribArray(R.current);
652
+ }
653
+ }, Z = () => {
654
+ if (n)
655
+ for (const i of Object.keys(n)) {
656
+ const a = n[i];
657
+ if (!a) continue;
658
+ const { value: o, type: u } = a, s = Ht(u);
659
+ if (!s) continue;
660
+ const p = {};
661
+ if (zt(u, o)) {
662
+ const O = u.length, B = Number.parseInt(u.charAt(O - 3)), K = Math.floor(o.length / (B * B));
663
+ o.length > B * B && (p.arraySize = `[${K}]`);
664
+ } else Yt(u, o) && (p.arraySize = `[${Math.floor(o.length / Number.parseInt(u.charAt(0)))}]`);
665
+ d.current[i] = {
666
+ type: s,
667
+ isNeeded: !1,
668
+ value: o,
669
+ ...p
670
+ };
671
+ }
672
+ }, ee = () => {
673
+ const i = v.current;
674
+ if (i)
675
+ if (r && r.length > 0) {
676
+ d.current[`${Se}`] = {
677
+ type: "vec3",
678
+ isNeeded: !1,
679
+ arraySize: `[${r.length}]`,
680
+ value: []
681
+ };
682
+ const a = r.map((o, u) => (d.current[`${$t}${u}`] = {
683
+ type: "sampler2D",
684
+ isNeeded: !1
685
+ }, W(o, u), F.current[u] = new Kt(i), F.current[u]?.load(o).then((s) => {
686
+ W(s, u);
687
+ })));
688
+ Promise.all(a).then(() => {
689
+ y && y();
690
+ }).catch((o) => {
691
+ T?.(o), y && y();
692
+ });
693
+ } else y && y();
694
+ }, te = (i) => {
695
+ const a = pe.includes(f ?? "highp"), o = `precision ${a ? f : pe[1]} float;
696
+ `;
697
+ a || b?.(G(`wrong precision type ${f}, please make sure to pass one of a valid precision lowp, mediump, highp, by default you shader precision will be set to highp.`));
698
+ let u = o.concat(`#define DPR ${x.toFixed(1)}
699
+ `).concat(i.replace(/texture\(/g, "texture2D("));
700
+ for (const p of Object.keys(d.current))
701
+ if (i.includes(p)) {
702
+ const O = d.current[p];
703
+ if (!O) continue;
704
+ u = Qt(u, `uniform ${O.type} ${p}${O.arraySize || ""};
705
+ `, u.lastIndexOf(o) + o.length), O.isNeeded = !0;
706
+ }
707
+ return i.includes("mainImage") && (u = u.concat(Xt)), u;
708
+ }, z = (i) => {
709
+ const a = v.current;
710
+ if (!a || !m.current) return;
711
+ const o = V.current ? (i - V.current) / 1e3 : 0;
712
+ V.current = i;
713
+ const u = P.current;
714
+ if (u)
715
+ for (const s of Object.keys(u)) {
716
+ const p = u[s];
717
+ if (p && d.current[s]?.isNeeded) {
718
+ if (!m.current) return;
719
+ const O = a.getUniformLocation(m.current, s);
720
+ if (!O) return;
721
+ Wt(a, O, p.type, p.value);
722
+ }
723
+ }
724
+ if (d.current.iMouse?.isNeeded) {
725
+ const s = a.getUniformLocation(m.current, Ae);
726
+ a.uniform4fv(s, d.current.iMouse.value);
727
+ }
728
+ if (d.current.iChannelResolution?.isNeeded) {
729
+ const s = a.getUniformLocation(m.current, Se);
730
+ a.uniform3fv(s, d.current.iChannelResolution.value);
731
+ }
732
+ if (d.current.iDeviceOrientation?.isNeeded) {
733
+ const s = a.getUniformLocation(m.current, be);
734
+ a.uniform4fv(s, d.current.iDeviceOrientation.value);
735
+ }
736
+ if (d.current.iTime?.isNeeded) {
737
+ const s = a.getUniformLocation(m.current, ge);
738
+ a.uniform1f(s, S.current += o);
739
+ }
740
+ if (d.current.iTimeDelta?.isNeeded) {
741
+ const s = a.getUniformLocation(m.current, ye);
742
+ a.uniform1f(s, o);
743
+ }
744
+ if (d.current.iDate?.isNeeded) {
745
+ const s = /* @__PURE__ */ new Date(), p = s.getMonth() + 1, O = s.getDate(), B = s.getFullYear(), K = s.getHours() * 60 * 60 + s.getMinutes() * 60 + s.getSeconds() + s.getMilliseconds() * 1e-3, ae = a.getUniformLocation(m.current, Te);
746
+ a.uniform4fv(ae, [B, p, O, K]);
747
+ }
748
+ if (d.current.iFrame?.isNeeded) {
749
+ const s = a.getUniformLocation(m.current, Ee), p = d.current.iFrame.value;
750
+ a.uniform1i(s, p), d.current.iFrame.value = p + 1;
751
+ }
752
+ if (F.current.length > 0)
753
+ for (let s = 0; s < F.current.length; s++) {
754
+ const p = F.current[s];
755
+ if (!p) return;
756
+ const { isVideo: O, _webglTexture: B, source: K, flipY: ae, isLoaded: Be } = p;
757
+ if (!Be || !B || !K) return;
758
+ if (d.current[`iChannel${s}`]?.isNeeded) {
759
+ if (!m.current) return;
760
+ const Ge = a.getUniformLocation(m.current, `iChannel${s}`);
761
+ a.activeTexture(a.TEXTURE0 + s), a.bindTexture(a.TEXTURE_2D, B), a.uniform1i(Ge, s), O && p.updateTexture(B, K, ae);
762
+ }
763
+ }
764
+ }, Y = (i) => {
765
+ const a = v.current;
766
+ if (!a) return;
767
+ a.viewport(0, 0, a.drawingBufferWidth, a.drawingBufferHeight), a.clear(a.COLOR_BUFFER_BIT | a.DEPTH_BUFFER_BIT), a.bindBuffer(a.ARRAY_BUFFER, N.current), a.vertexAttribPointer(R.current ?? 0, 3, a.FLOAT, !1, 0, 0), z(i), a.drawArrays(a.TRIANGLE_STRIP, 0, 4);
768
+ const o = d.current.iMouse?.value;
769
+ if (d.current.iMouse?.isNeeded && g !== 1 && Array.isArray(o)) {
770
+ const u = o[0] ?? 0, s = o[1] ?? 0;
771
+ o[0] = Le(u, I.current[0] ?? 0, g), o[1] = Le(s, I.current[1] ?? 0, g);
772
+ }
773
+ L.current = requestAnimationFrame(Y);
774
+ }, j = () => {
775
+ const i = {
776
+ passive: !0
777
+ };
778
+ d.current.iMouse?.isNeeded && c.current && (c.current.addEventListener("mousemove", U, i), c.current.addEventListener("mouseout", M, i), c.current.addEventListener("mouseup", M, i), c.current.addEventListener("mousedown", H, i), c.current.addEventListener("touchmove", U, i), c.current.addEventListener("touchend", M, i), c.current.addEventListener("touchstart", H, i)), d.current.iDeviceOrientation?.isNeeded && window.addEventListener("deviceorientation", oe, i), c.current && (E.current = new ResizeObserver($), E.current.observe(c.current), window.addEventListener("resize", $, i));
779
+ }, q = () => {
780
+ const i = {
781
+ passive: !0
782
+ };
783
+ d.current.iMouse?.isNeeded && c.current && (c.current.removeEventListener("mousemove", U, i), c.current.removeEventListener("mouseout", M, i), c.current.removeEventListener("mouseup", M, i), c.current.removeEventListener("mousedown", H, i), c.current.removeEventListener("touchmove", U, i), c.current.removeEventListener("touchend", M, i), c.current.removeEventListener("touchstart", H, i)), d.current.iDeviceOrientation?.isNeeded && window.removeEventListener("deviceorientation", oe, i), E.current && (E.current.disconnect(), window.removeEventListener("resize", $, i));
784
+ };
785
+ return ne(() => {
786
+ P.current = n;
787
+ }, [n]), ne(() => {
788
+ const i = F.current;
789
+ function a() {
790
+ k();
791
+ const o = v.current;
792
+ o && c.current && (o.clearColor(...l), o.clearDepth(1), o.enable(o.DEPTH_TEST), o.depthFunc(o.LEQUAL), o.viewport(0, 0, c.current.width, c.current.height), c.current.height = c.current.clientHeight, c.current.width = c.current.clientWidth, Z(), ee(), J(te(t || kt), e || ve), ue(), requestAnimationFrame(Y), j(), $());
793
+ }
794
+ return requestAnimationFrame(a), () => {
795
+ const o = v.current;
796
+ if (o) {
797
+ if (o.getExtension("WEBGL_lose_context")?.loseContext(), o.useProgram(null), o.deleteProgram(m.current ?? null), i.length > 0)
798
+ for (const u of i)
799
+ o.deleteTexture(u._webglTexture);
800
+ m.current = null;
801
+ }
802
+ q(), cancelAnimationFrame(L.current ?? 0);
803
+ };
804
+ }, []), X("canvas", {
805
+ ref: c,
806
+ style: {
807
+ height: "100%",
808
+ width: "100%",
809
+ ...h
810
+ }
811
+ });
812
+ }
813
+ const Zt = `
814
+ const float TAU = 6.283185;
815
+
816
+ // Noise for dithering
817
+ vec2 randFibo(vec2 p) {
818
+ p = fract(p * vec2(443.897, 441.423));
819
+ p += dot(p, p.yx + 19.19);
820
+ return fract((p.xx + p.yx) * p.xy);
821
+ }
822
+
823
+ // Tonemap
824
+ vec3 Tonemap(vec3 x) {
825
+ x *= 4.0;
826
+ return x / (1.0 + x);
827
+ }
828
+
829
+ // Luma for alpha
830
+ float luma(vec3 color) {
831
+ return dot(color, vec3(0.299, 0.587, 0.114));
832
+ }
833
+
834
+ // RGB to HSV
835
+ vec3 rgb2hsv(vec3 c) {
836
+ vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
837
+ vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
838
+ vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
839
+ float d = q.x - min(q.w, q.y);
840
+ float e = 1.0e-10;
841
+ return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
842
+ }
843
+
844
+ // HSV to RGB
845
+ vec3 hsv2rgb(vec3 c) {
846
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
847
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
848
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
849
+ }
850
+
851
+ // SDF shapes
852
+ float sdCircle(vec2 st, float r) {
853
+ return length(st) - r;
854
+ }
855
+
856
+ float sdLine(vec2 p, float r) {
857
+ float halfLen = r * 2.0;
858
+ vec2 a = vec2(-halfLen, 0.0);
859
+ vec2 b = vec2(halfLen, 0.0);
860
+ vec2 pa = p - a;
861
+ vec2 ba = b - a;
862
+ float h = clamp(dot(pa, ba) / dot(ba, ba), 0.0, 1.0);
863
+ return length(pa - ba * h);
864
+ }
865
+
866
+ float getSdf(vec2 st) {
867
+ if(uShape == 1.0) return sdCircle(st, uScale);
868
+ else if(uShape == 2.0) return sdLine(st, uScale);
869
+ return sdCircle(st, uScale); // Default
870
+ }
871
+
872
+ vec2 turb(vec2 pos, float t, float it) {
873
+ // Initial rotation matrix for swirl direction
874
+ mat2 rotation = mat2(0.6, -0.25, 0.25, 0.9);
875
+ // Secondary rotation applied each iteration (approx 53 degree rotation)
876
+ mat2 layerRotation = mat2(0.6, -0.8, 0.8, 0.6);
877
+
878
+ float frequency = mix(2.0, 15.0, uFrequency);
879
+ float amplitude = uAmplitude;
880
+ float frequencyGrowth = 1.4;
881
+ float animTime = t * 0.1 * uSpeed;
882
+
883
+ const int LAYERS = 4;
884
+ for(int i = 0; i < LAYERS; i++) {
885
+ // Calculate wave displacement for this layer
886
+ vec2 rotatedPos = pos * rotation;
887
+ vec2 wave = sin(frequency * rotatedPos + float(i) * animTime + it);
888
+
889
+ // Apply displacement along rotation direction
890
+ pos += (amplitude / frequency) * rotation[0] * wave;
891
+
892
+ // Evolve parameters for next layer
893
+ rotation *= layerRotation;
894
+ amplitude *= mix(1.0, max(wave.x, wave.y), uVariance);
895
+ frequency *= frequencyGrowth;
896
+ }
897
+
898
+ return pos;
899
+ }
900
+
901
+ const float ITERATIONS = 36.0;
902
+
903
+ void mainImage(out vec4 fragColor, in vec2 fragCoord) {
904
+ vec2 uv = fragCoord / iResolution.xy;
905
+
906
+ vec3 pp = vec3(0.0);
907
+ vec3 bloom = vec3(0.0);
908
+ float t = iTime * 0.5;
909
+ vec2 pos = uv - 0.5;
910
+
911
+ vec2 prevPos = turb(pos, t, 0.0 - 1.0 / ITERATIONS);
912
+ float spacing = mix(1.0, TAU, uSpacing);
913
+
914
+ for(float i = 1.0; i < ITERATIONS + 1.0; i++) {
915
+ float iter = i / ITERATIONS;
916
+ vec2 st = turb(pos, t, iter * spacing);
917
+ float d = abs(getSdf(st));
918
+ float pd = distance(st, prevPos);
919
+ prevPos = st;
920
+ float dynamicBlur = exp2(pd * 2.0 * 1.4426950408889634) - 1.0;
921
+ float ds = smoothstep(0.0, uBlur * 0.05 + max(dynamicBlur * uSmoothing, 0.001), d);
922
+
923
+ // Shift color based on iteration using uColorScale
924
+ vec3 color = uColor;
925
+ if(uColorShift > 0.01) {
926
+ vec3 hsv = rgb2hsv(color);
927
+ // Shift hue by iteration
928
+ hsv.x = fract(hsv.x + (1.0 - iter) * uColorShift * 0.3);
929
+ color = hsv2rgb(hsv);
930
+ }
931
+
932
+ float invd = 1.0 / max(d + dynamicBlur, 0.001);
933
+ pp += (ds - 1.0) * color;
934
+ bloom += clamp(invd, 0.0, 250.0) * color;
935
+ }
936
+
937
+ pp *= 1.0 / ITERATIONS;
938
+
939
+ vec3 color;
940
+
941
+ // Dark mode (default)
942
+ if(uMode < 0.5) {
943
+ // use bloom effect
944
+ bloom = bloom / (bloom + 2e4);
945
+ color = (-pp + bloom * 3.0 * uBloom) * 1.2;
946
+ color += (randFibo(fragCoord).x - 0.5) / 255.0;
947
+ color = Tonemap(color);
948
+ float alpha = luma(color) * uMix;
949
+ fragColor = vec4(color * uMix, alpha);
950
+ }
951
+
952
+ // Light mode
953
+ else {
954
+ // no bloom effect
955
+ color = -pp;
956
+ color += (randFibo(fragCoord).x - 0.5) / 255.0;
957
+
958
+ // Preserve hue by tone mapping brightness only
959
+ float brightness = length(color);
960
+ vec3 direction = brightness > 0.0 ? color / brightness : color;
961
+
962
+ // Reinhard on brightness
963
+ float factor = 2.0;
964
+ float mappedBrightness = (brightness * factor) / (1.0 + brightness * factor);
965
+ color = direction * mappedBrightness;
966
+
967
+ // Boost saturation to compensate for white background bleed-through
968
+ // When alpha < 1.0, white bleeds through making colors look desaturated
969
+ // So we increase saturation to maintain vibrant appearance
970
+ float gray = dot(color, vec3(0.2, 0.5, 0.1));
971
+ float saturationBoost = 3.0;
972
+ color = mix(vec3(gray), color, saturationBoost);
973
+
974
+ // Clamp between 0-1
975
+ color = clamp(color, 0.0, 1.0);
976
+
977
+ float alpha = mappedBrightness * clamp(uMix, 1.0, 2.0);
978
+ fragColor = vec4(color, alpha);
979
+ }
980
+ }`, er = 10, tr = 2, rr = 0.5, nr = 0.2, ir = 1.5, D = {
981
+ duration: 0.5,
982
+ ease: "easeOut"
983
+ }, Me = {
984
+ duration: 0.35,
985
+ ease: "easeOut",
986
+ repeat: 1 / 0,
987
+ repeatType: "mirror"
988
+ };
989
+ function re(t) {
990
+ const [e, r] = _e(t), n = ft(t), l = _(null);
991
+ vt(n, "change", (h) => r(h));
992
+ const f = ze(
993
+ (h, A) => {
994
+ l.current = Gt(n, h, A);
995
+ },
996
+ [n]
997
+ );
998
+ return { value: e, motionValue: n, controls: l, animate: f };
999
+ }
1000
+ function or(t, e) {
1001
+ const [r, n] = _e(er), {
1002
+ value: l,
1003
+ animate: f,
1004
+ motionValue: h
1005
+ } = re(nr), { value: A, animate: g } = re(tr), { value: x, animate: y } = re(rr), { value: T, animate: b } = re(ir), c = pt(e, {
1006
+ fftSize: 512,
1007
+ smoothingTimeConstant: 0.55
1008
+ });
1009
+ return ne(() => {
1010
+ switch (t) {
1011
+ case "idle":
1012
+ case "failed":
1013
+ case "disconnected":
1014
+ n(10), f(0.2, D), g(1.2, D), y(0.4, D), b(1, D);
1015
+ return;
1016
+ case "listening":
1017
+ case "pre-connect-buffering":
1018
+ n(20), f(0.3, { type: "spring", duration: 1, bounce: 0.35 }), g(1, D), y(0.7, D), b([1.5, 2], Me);
1019
+ return;
1020
+ case "thinking":
1021
+ case "connecting":
1022
+ case "initializing":
1023
+ n(30), f(0.3, D), g(0.5, D), y(1, D), b([0.5, 2.5], Me);
1024
+ return;
1025
+ case "speaking":
1026
+ n(70), f(0.3, D), g(0.75, D), y(1.25, D), b(1.5, D);
1027
+ return;
1028
+ }
1029
+ }, [
1030
+ t,
1031
+ f,
1032
+ g,
1033
+ y,
1034
+ b
1035
+ ]), ne(() => {
1036
+ t === "speaking" && c > 0 && !h.isAnimating() && f(0.2 + 0.2 * c, { duration: 0 });
1037
+ }, [
1038
+ t,
1039
+ c,
1040
+ h,
1041
+ f,
1042
+ g,
1043
+ y,
1044
+ b
1045
+ ]), {
1046
+ speed: r,
1047
+ scale: l,
1048
+ amplitude: A,
1049
+ frequency: x,
1050
+ brightness: T
1051
+ };
1052
+ }
1053
+ const ar = dt({
1054
+ base: "aspect-square",
1055
+ variants: {
1056
+ size: {
1057
+ icon: "h-[24px]",
1058
+ sm: "h-[56px]",
1059
+ md: "h-[112px]",
1060
+ lg: "h-[224px]",
1061
+ xl: "h-[448px]"
1062
+ }
1063
+ },
1064
+ defaultVariants: {
1065
+ size: "lg"
1066
+ }
1067
+ });
1068
+ function sr(t) {
1069
+ const e = t.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);
1070
+ if (e) {
1071
+ const [, r, n, l] = e;
1072
+ return [r, n, l].map((h = "00") => parseInt(h, 16) / 255);
1073
+ }
1074
+ }
1075
+ function Ve({ shape: t = 1, speed: e = 1, amplitude: r = 0.5, frequency: n = 0.5, scale: l = 0.2, blur: f = 1, color: h = "#FF355E", colorShift: A = 1, brightness: g = 1, themeMode: x = typeof window < "u" && document.documentElement.classList.contains("dark") ? "dark" : "light", ref: y, className: T, ...b }) {
1076
+ const c = Ye(() => sr(h), [h]);
1077
+ return X("div", {
1078
+ ref: y,
1079
+ className: T,
1080
+ ...b,
1081
+ children: X(Jt, {
1082
+ fs: Zt,
1083
+ devicePixelRatio: globalThis.devicePixelRatio ?? 1,
1084
+ uniforms: {
1085
+ uSpeed: {
1086
+ type: "1f",
1087
+ value: e
1088
+ },
1089
+ uBlur: {
1090
+ type: "1f",
1091
+ value: f
1092
+ },
1093
+ uScale: {
1094
+ type: "1f",
1095
+ value: l
1096
+ },
1097
+ uShape: {
1098
+ type: "1f",
1099
+ value: t
1100
+ },
1101
+ uFrequency: {
1102
+ type: "1f",
1103
+ value: n
1104
+ },
1105
+ uAmplitude: {
1106
+ type: "1f",
1107
+ value: r
1108
+ },
1109
+ uBloom: {
1110
+ type: "1f",
1111
+ value: 0
1112
+ },
1113
+ uMix: {
1114
+ type: "1f",
1115
+ value: g
1116
+ },
1117
+ uSpacing: {
1118
+ type: "1f",
1119
+ value: 0.5
1120
+ },
1121
+ uColorShift: {
1122
+ type: "1f",
1123
+ value: A
1124
+ },
1125
+ uVariance: {
1126
+ type: "1f",
1127
+ value: 0.1
1128
+ },
1129
+ uSmoothing: {
1130
+ type: "1f",
1131
+ value: 1
1132
+ },
1133
+ uMode: {
1134
+ type: "1f",
1135
+ value: x === "light" ? 1 : 0
1136
+ },
1137
+ uColor: {
1138
+ type: "3fv",
1139
+ value: c ?? [0, 0.7, 1]
1140
+ }
1141
+ },
1142
+ onError: (v) => {
1143
+ console.error("Shader error:", v);
1144
+ },
1145
+ onWarning: (v) => {
1146
+ console.warn("Shader warning:", v);
1147
+ },
1148
+ style: {
1149
+ width: "100%",
1150
+ height: "100%"
1151
+ }
1152
+ })
1153
+ });
1154
+ }
1155
+ Ve.displayName = "AuraShader";
1156
+ function gr({ size: t = "lg", state: e, color: r, colorShift: n = 0.05, audioTrack: l, themeMode: f, className: h, ref: A, ...g }) {
1157
+ const { speed: x, scale: y, amplitude: T, frequency: b, brightness: c } = or(e, l);
1158
+ return X(Ve, {
1159
+ ref: A,
1160
+ blur: 0.2,
1161
+ color: r,
1162
+ colorShift: n,
1163
+ speed: x,
1164
+ scale: y,
1165
+ themeMode: f,
1166
+ amplitude: T,
1167
+ frequency: b,
1168
+ brightness: c,
1169
+ className: mt(ar({
1170
+ size: t
1171
+ }), "overflow-hidden rounded-full", h),
1172
+ ...g
1173
+ });
1174
+ }
1175
+ const yr = ({ text: t, confirmationText: e, onConfirm: r, cancelText: n, onCancel: l }) => le("div", {
1176
+ className: "flex flex-col gap-2",
1177
+ children: [t && X("p", {
1178
+ children: t
1179
+ }), le("div", {
1180
+ className: "flex gap-2",
1181
+ children: [X(fe, {
1182
+ type: "button",
1183
+ variant: "outline",
1184
+ size: "sm",
1185
+ icon: ht,
1186
+ onClick: r,
1187
+ label: e
1188
+ }), X(fe, {
1189
+ type: "button",
1190
+ variant: "ghost",
1191
+ size: "sm",
1192
+ onClick: l,
1193
+ label: n
1194
+ })]
1195
+ })]
1196
+ });
1197
+ export {
1198
+ pr as A,
1199
+ gr as F,
1200
+ hr as a,
1201
+ dr as b,
1202
+ yr as c,
1203
+ mr as o,
1204
+ vr as u
1205
+ };