@factorialco/f0-react 1.391.0 → 1.392.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/F0HILActionConfirmation-C_1UQkak.js +1937 -0
- package/dist/ai.d.ts +91 -0
- package/dist/ai.js +23 -22
- package/dist/f0.d.ts +91 -0
- package/dist/f0.js +10 -9
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/F0HILActionConfirmation-B5UWkFgg.js +0 -1386
|
@@ -1,1386 +0,0 @@
|
|
|
1
|
-
import { jsx as G, jsxs as le } from "react/jsx-runtime";
|
|
2
|
-
import { useInsertionEffect as Ge, createContext as ke, useContext as $e, useRef as _, useEffect as ne, useState as _e, useCallback as Ye, useMemo as ze } from "react";
|
|
3
|
-
import { G as qe, J as We, K as He, M as je, N as Ne, Q as Ke, R as Qe, V as Je, W as Ze, X as et, Y as Ce, Z as tt, _ as rt, $ as nt, a0 as it, a1 as ot, a2 as at, a3 as st, a4 as ie, a5 as ct, a6 as ut, a7 as lt, a8 as ft, a9 as mt, aa as dt, ab as fe, ac as ht } from "./F0AiChat-nPbqtFaA.js";
|
|
4
|
-
import { useTrackVolume as pt } from "@livekit/components-react";
|
|
5
|
-
function vt(t, e, r) {
|
|
6
|
-
Ge(() => 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 Et(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 Tt(t, e, r, n, l, f) {
|
|
34
|
-
Et(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 wt(t, e) {
|
|
43
|
-
for (let r = 0; r < t.length; r++)
|
|
44
|
-
t[r] = t[r] / (e + 1);
|
|
45
|
-
}
|
|
46
|
-
function At(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", xt = 20;
|
|
50
|
-
function bt(t, { defaultTransition: e = {}, ...r } = {}, n, l) {
|
|
51
|
-
const f = e.duration || 0.3, h = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), g = {}, b = /* @__PURE__ */ new Map();
|
|
52
|
-
let y = 0, E = 0, x = 0;
|
|
53
|
-
for (let c = 0; c < t.length; c++) {
|
|
54
|
-
const v = t[c];
|
|
55
|
-
if (typeof v == "string") {
|
|
56
|
-
b.set(v, E);
|
|
57
|
-
continue;
|
|
58
|
-
} else if (!Array.isArray(v)) {
|
|
59
|
-
b.set(v.name, me(E, v.at, y, b));
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
let [N, m, R = {}] = v;
|
|
63
|
-
R.at !== void 0 && (E = me(E, R.at, y, b));
|
|
64
|
-
let F = 0;
|
|
65
|
-
const C = (A, S, I, L = 0, V = 0) => {
|
|
66
|
-
const T = Rt(A), { delay: d = 0, times: P = Ke(T), 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(L, V) : d, Q = T.length, J = Ze(W) ? W : l?.[W];
|
|
69
|
-
if (Q <= 2 && J) {
|
|
70
|
-
let Y = 100;
|
|
71
|
-
if (Q === 2 && Ft(T)) {
|
|
72
|
-
const q = T[1] - T[0];
|
|
73
|
-
Y = Math.abs(q);
|
|
74
|
-
}
|
|
75
|
-
const z = { ...H };
|
|
76
|
-
M !== void 0 && (z.duration = et(M));
|
|
77
|
-
const j = Qe(z, Y, J);
|
|
78
|
-
U = j.ease, M = j.duration;
|
|
79
|
-
}
|
|
80
|
-
M ?? (M = f);
|
|
81
|
-
const Z = E + $;
|
|
82
|
-
P.length === 1 && P[0] === 0 && (P[1] = 1);
|
|
83
|
-
const ee = P.length - T.length;
|
|
84
|
-
if (ee > 0 && Je(P, ee), T.length === 1 && T.unshift(null), k) {
|
|
85
|
-
Ce(k < xt, "Repeat count too high, must be less than 20"), M = gt(M, k);
|
|
86
|
-
const Y = [...T], z = [...P];
|
|
87
|
-
U = Array.isArray(U) ? [...U] : [U];
|
|
88
|
-
const j = [...U];
|
|
89
|
-
for (let q = 0; q < k; q++) {
|
|
90
|
-
T.push(...Y);
|
|
91
|
-
for (let i = 0; i < Y.length; i++)
|
|
92
|
-
P.push(z[i] + (q + 1)), U.push(i === 0 ? "linear" : Oe(j, i - 1));
|
|
93
|
-
}
|
|
94
|
-
wt(P, k);
|
|
95
|
-
}
|
|
96
|
-
const te = Z + M;
|
|
97
|
-
Tt(I, T, U, P, Z, te), F = Math.max($ + M, F), x = Math.max(te, x);
|
|
98
|
-
};
|
|
99
|
-
if (Ne(N)) {
|
|
100
|
-
const A = de(N, w);
|
|
101
|
-
C(m, R, he("default", A));
|
|
102
|
-
} else {
|
|
103
|
-
const A = Ue(N, m, n, g), S = A.length;
|
|
104
|
-
for (let I = 0; I < S; I++) {
|
|
105
|
-
m = m, R = R;
|
|
106
|
-
const L = A[I], V = de(L, w);
|
|
107
|
-
for (const T in m)
|
|
108
|
-
C(m[T], It(R, T), he(T, V), I, S);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
y = E, E += F;
|
|
112
|
-
}
|
|
113
|
-
return w.forEach((c, v) => {
|
|
114
|
-
for (const N in c) {
|
|
115
|
-
const m = c[N];
|
|
116
|
-
m.sort(At);
|
|
117
|
-
const R = [], F = [], C = [];
|
|
118
|
-
for (let S = 0; S < m.length; S++) {
|
|
119
|
-
const { at: I, value: L, easing: V } = m[S];
|
|
120
|
-
R.push(L), F.push(tt(0, x, I)), C.push(V || "easeOut");
|
|
121
|
-
}
|
|
122
|
-
F[0] !== 0 && (F.unshift(0), R.unshift(R[0]), C.unshift(St)), F[F.length - 1] !== 1 && (F.push(1), R.push(null)), h.has(v) || h.set(v, {
|
|
123
|
-
keyframes: {},
|
|
124
|
-
transition: {}
|
|
125
|
-
});
|
|
126
|
-
const A = h.get(v);
|
|
127
|
-
A.keyframes[N] = R, A.transition[N] = {
|
|
128
|
-
...e,
|
|
129
|
-
duration: x,
|
|
130
|
-
ease: C,
|
|
131
|
-
times: F,
|
|
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 Lt = (t) => typeof t == "number", Ft = (t) => t.every(Lt);
|
|
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 w = 0; w < h; w++) {
|
|
226
|
-
const g = f[w], b = g instanceof Element ? Nt : Ct;
|
|
227
|
-
ie.has(g) || b(g);
|
|
228
|
-
const y = ie.get(g), E = { ...r };
|
|
229
|
-
"delay" in E && typeof E.delay == "function" && (E.delay = E.delay(w, h)), l.push(...ut(y, { ...e, transition: E }, {}));
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
return l;
|
|
233
|
-
}
|
|
234
|
-
function Ot(t, e, r) {
|
|
235
|
-
const n = [];
|
|
236
|
-
return bt(t, e, r, { spring: lt }).forEach(({ keyframes: f, transition: h }, w) => {
|
|
237
|
-
n.push(...De(w, 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 Xt = 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
|
-
responseStopped: "You stopped this response",
|
|
336
|
-
sendMessage: "Send message",
|
|
337
|
-
thoughtsGroupTitle: "Reflection",
|
|
338
|
-
resourcesGroupTitle: "Resources",
|
|
339
|
-
thinking: "Thinking...",
|
|
340
|
-
feedbackModal: {
|
|
341
|
-
positive: {
|
|
342
|
-
title: "What did you like about this response?",
|
|
343
|
-
label: "Your feedback helps us make Factorial AI better",
|
|
344
|
-
placeholder: "Share what worked well"
|
|
345
|
-
},
|
|
346
|
-
negative: {
|
|
347
|
-
title: "What could have been better?",
|
|
348
|
-
label: "Your feedback helps us improve future answers",
|
|
349
|
-
placeholder: "Share what didn't work"
|
|
350
|
-
}
|
|
351
|
-
},
|
|
352
|
-
dataDownloadPreview: "Preview {{shown}} of {{total}} rows — download the Excel to see all data.",
|
|
353
|
-
expandChat: "Expand chat",
|
|
354
|
-
collapseChat: "Collapse chat",
|
|
355
|
-
ask: "Ask One",
|
|
356
|
-
viewProfile: "View profile",
|
|
357
|
-
tools: "Tools"
|
|
358
|
-
}
|
|
359
|
-
}, Pe = ke(null);
|
|
360
|
-
function pr({
|
|
361
|
-
children: t,
|
|
362
|
-
translations: e
|
|
363
|
-
}) {
|
|
364
|
-
return /* @__PURE__ */ G(Pe.Provider, { value: e, children: t });
|
|
365
|
-
}
|
|
366
|
-
function vr() {
|
|
367
|
-
const t = $e(Pe);
|
|
368
|
-
if (t === null)
|
|
369
|
-
throw new Error(
|
|
370
|
-
"useAiChatTranslations must be used within an AiChatTranslationsProvider"
|
|
371
|
-
);
|
|
372
|
-
return t;
|
|
373
|
-
}
|
|
374
|
-
const pe = ["lowp", "mediump", "highp"], Gt = `
|
|
375
|
-
void main(void){
|
|
376
|
-
vec4 color = vec4(0.0,0.0,0.0,1.0);
|
|
377
|
-
mainImage( color, gl_FragCoord.xy );
|
|
378
|
-
gl_FragColor = color;
|
|
379
|
-
}`, kt = `void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
|
|
380
|
-
vec2 uv = fragCoord/iResolution.xy;
|
|
381
|
-
vec3 col = 0.5 + 0.5*cos(iTime+uv.xyx+vec3(0,2,4));
|
|
382
|
-
fragColor = vec4(col,1.0);
|
|
383
|
-
}`, ve = `attribute vec3 aVertexPosition;
|
|
384
|
-
void main(void) {
|
|
385
|
-
gl_Position = vec4(aVertexPosition, 1.0);
|
|
386
|
-
}`, ge = "iTime", ye = "iTimeDelta", Ee = "iDate", Te = "iFrame", we = "iMouse", Ae = "iResolution", $t = "iChannel", Se = "iChannelResolution", xe = "iDeviceOrientation";
|
|
387
|
-
function Yt(t, e) {
|
|
388
|
-
return t.includes("Matrix") && Array.isArray(e);
|
|
389
|
-
}
|
|
390
|
-
function zt(t, e) {
|
|
391
|
-
return t.includes("v") && Array.isArray(e) && e.length > Number.parseInt(t.charAt(0));
|
|
392
|
-
}
|
|
393
|
-
function qt(t, e) {
|
|
394
|
-
return !t.includes("v") && Array.isArray(e) && e.length > Number.parseInt(t.charAt(0));
|
|
395
|
-
}
|
|
396
|
-
const Wt = (t, e, r, n) => {
|
|
397
|
-
if (qt(r, n))
|
|
398
|
-
switch (r) {
|
|
399
|
-
case "2f":
|
|
400
|
-
return t.uniform2f(e, n[0], n[1]);
|
|
401
|
-
case "3f":
|
|
402
|
-
return t.uniform3f(e, n[0], n[1], n[2]);
|
|
403
|
-
case "4f":
|
|
404
|
-
return t.uniform4f(e, n[0], n[1], n[2], n[3]);
|
|
405
|
-
case "2i":
|
|
406
|
-
return t.uniform2i(e, n[0], n[1]);
|
|
407
|
-
case "3i":
|
|
408
|
-
return t.uniform3i(e, n[0], n[1], n[2]);
|
|
409
|
-
case "4i":
|
|
410
|
-
return t.uniform4i(e, n[0], n[1], n[2], n[3]);
|
|
411
|
-
}
|
|
412
|
-
if (typeof n == "number")
|
|
413
|
-
return r === "1i" ? t.uniform1i(e, n) : t.uniform1f(e, n);
|
|
414
|
-
switch (r) {
|
|
415
|
-
case "1iv":
|
|
416
|
-
return t.uniform1iv(e, n);
|
|
417
|
-
case "2iv":
|
|
418
|
-
return t.uniform2iv(e, n);
|
|
419
|
-
case "3iv":
|
|
420
|
-
return t.uniform3iv(e, n);
|
|
421
|
-
case "4iv":
|
|
422
|
-
return t.uniform4iv(e, n);
|
|
423
|
-
case "1fv":
|
|
424
|
-
return t.uniform1fv(e, n);
|
|
425
|
-
case "2fv":
|
|
426
|
-
return t.uniform2fv(e, n);
|
|
427
|
-
case "3fv":
|
|
428
|
-
return t.uniform3fv(e, n);
|
|
429
|
-
case "4fv":
|
|
430
|
-
return t.uniform4fv(e, n);
|
|
431
|
-
case "Matrix2fv":
|
|
432
|
-
return t.uniformMatrix2fv(e, !1, n);
|
|
433
|
-
case "Matrix3fv":
|
|
434
|
-
return t.uniformMatrix3fv(e, !1, n);
|
|
435
|
-
case "Matrix4fv":
|
|
436
|
-
return t.uniformMatrix4fv(e, !1, n);
|
|
437
|
-
}
|
|
438
|
-
}, Ht = (t) => {
|
|
439
|
-
switch (t) {
|
|
440
|
-
case "1f":
|
|
441
|
-
return "float";
|
|
442
|
-
case "2f":
|
|
443
|
-
return "vec2";
|
|
444
|
-
case "3f":
|
|
445
|
-
return "vec3";
|
|
446
|
-
case "4f":
|
|
447
|
-
return "vec4";
|
|
448
|
-
case "1i":
|
|
449
|
-
return "int";
|
|
450
|
-
case "2i":
|
|
451
|
-
return "ivec2";
|
|
452
|
-
case "3i":
|
|
453
|
-
return "ivec3";
|
|
454
|
-
case "4i":
|
|
455
|
-
return "ivec4";
|
|
456
|
-
case "1iv":
|
|
457
|
-
return "int";
|
|
458
|
-
case "2iv":
|
|
459
|
-
return "ivec2";
|
|
460
|
-
case "3iv":
|
|
461
|
-
return "ivec3";
|
|
462
|
-
case "4iv":
|
|
463
|
-
return "ivec4";
|
|
464
|
-
case "1fv":
|
|
465
|
-
return "float";
|
|
466
|
-
case "2fv":
|
|
467
|
-
return "vec2";
|
|
468
|
-
case "3fv":
|
|
469
|
-
return "vec3";
|
|
470
|
-
case "4fv":
|
|
471
|
-
return "vec4";
|
|
472
|
-
case "Matrix2fv":
|
|
473
|
-
return "mat2";
|
|
474
|
-
case "Matrix3fv":
|
|
475
|
-
return "mat3";
|
|
476
|
-
case "Matrix4fv":
|
|
477
|
-
return "mat4";
|
|
478
|
-
default:
|
|
479
|
-
console.error(
|
|
480
|
-
X(
|
|
481
|
-
`The uniform type "${t}" is not valid, please make sure your uniform type is valid`
|
|
482
|
-
)
|
|
483
|
-
);
|
|
484
|
-
}
|
|
485
|
-
}, se = 9729, be = 9728, jt = 9987, Re = 33071, Ie = 10497;
|
|
486
|
-
class Kt {
|
|
487
|
-
gl;
|
|
488
|
-
url;
|
|
489
|
-
wrapS;
|
|
490
|
-
wrapT;
|
|
491
|
-
minFilter;
|
|
492
|
-
magFilter;
|
|
493
|
-
source;
|
|
494
|
-
pow2canvas;
|
|
495
|
-
isLoaded = !1;
|
|
496
|
-
isVideo = !1;
|
|
497
|
-
flipY = -1;
|
|
498
|
-
width = 0;
|
|
499
|
-
height = 0;
|
|
500
|
-
_webglTexture = null;
|
|
501
|
-
constructor(e) {
|
|
502
|
-
this.gl = e;
|
|
503
|
-
}
|
|
504
|
-
updateTexture = (e, r, n) => {
|
|
505
|
-
const { gl: l } = this, f = 0, h = l.RGBA, w = l.RGBA, g = l.UNSIGNED_BYTE;
|
|
506
|
-
l.bindTexture(l.TEXTURE_2D, e), l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL, n), l.texImage2D(
|
|
507
|
-
l.TEXTURE_2D,
|
|
508
|
-
f,
|
|
509
|
-
h,
|
|
510
|
-
w,
|
|
511
|
-
g,
|
|
512
|
-
r
|
|
513
|
-
);
|
|
514
|
-
};
|
|
515
|
-
setupVideo = (e) => {
|
|
516
|
-
const r = document.createElement("video");
|
|
517
|
-
let n = !1, l = !1;
|
|
518
|
-
r.autoplay = !0, r.muted = !0, r.loop = !0, r.crossOrigin = "anonymous";
|
|
519
|
-
const f = () => {
|
|
520
|
-
n && l && (this.isLoaded = !0);
|
|
521
|
-
};
|
|
522
|
-
return r.addEventListener(
|
|
523
|
-
"playing",
|
|
524
|
-
() => {
|
|
525
|
-
n = !0, this.width = r.videoWidth || 0, this.height = r.videoHeight || 0, f();
|
|
526
|
-
},
|
|
527
|
-
!0
|
|
528
|
-
), r.addEventListener(
|
|
529
|
-
"timeupdate",
|
|
530
|
-
() => {
|
|
531
|
-
l = !0, f();
|
|
532
|
-
},
|
|
533
|
-
!0
|
|
534
|
-
), r.src = e, r;
|
|
535
|
-
};
|
|
536
|
-
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(
|
|
537
|
-
e,
|
|
538
|
-
0,
|
|
539
|
-
0,
|
|
540
|
-
this.pow2canvas.width,
|
|
541
|
-
this.pow2canvas.height
|
|
542
|
-
), console.warn(
|
|
543
|
-
X(
|
|
544
|
-
`Image is not power of two ${e.width} x ${e.height}. Resized to ${this.pow2canvas.width} x ${this.pow2canvas.height};`
|
|
545
|
-
)
|
|
546
|
-
), this.pow2canvas) : e;
|
|
547
|
-
load = async (e) => {
|
|
548
|
-
const { gl: r } = this, {
|
|
549
|
-
url: n,
|
|
550
|
-
wrapS: l,
|
|
551
|
-
wrapT: f,
|
|
552
|
-
minFilter: h,
|
|
553
|
-
magFilter: w,
|
|
554
|
-
flipY: g = -1
|
|
555
|
-
} = e;
|
|
556
|
-
if (!n)
|
|
557
|
-
return Promise.reject(
|
|
558
|
-
new Error(
|
|
559
|
-
X(
|
|
560
|
-
"Missing url, please make sure to pass the url of your texture { url: ... }"
|
|
561
|
-
)
|
|
562
|
-
)
|
|
563
|
-
);
|
|
564
|
-
const b = /(\.jpg|\.jpeg|\.png|\.gif|\.bmp)$/i.exec(n), y = /(\.mp4|\.3gp|\.webm|\.ogv)$/i.exec(n);
|
|
565
|
-
if (b === null && y === null)
|
|
566
|
-
return Promise.reject(
|
|
567
|
-
new Error(
|
|
568
|
-
X(
|
|
569
|
-
`Please upload a video or an image with a valid format (url: ${n})`
|
|
570
|
-
)
|
|
571
|
-
)
|
|
572
|
-
);
|
|
573
|
-
Object.assign(this, { url: n, wrapS: l, wrapT: f, minFilter: h, magFilter: w, flipY: g });
|
|
574
|
-
const E = 0, x = r.RGBA, c = 1, v = 1, N = 0, m = r.RGBA, R = r.UNSIGNED_BYTE, F = new Uint8Array([255, 255, 255, 0]), C = r.createTexture();
|
|
575
|
-
if (r.bindTexture(r.TEXTURE_2D, C), r.texImage2D(
|
|
576
|
-
r.TEXTURE_2D,
|
|
577
|
-
E,
|
|
578
|
-
x,
|
|
579
|
-
c,
|
|
580
|
-
v,
|
|
581
|
-
N,
|
|
582
|
-
m,
|
|
583
|
-
R,
|
|
584
|
-
F
|
|
585
|
-
), y) {
|
|
586
|
-
const L = this.setupVideo(n);
|
|
587
|
-
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 = L, this.isVideo = !0, L.play().then(() => this);
|
|
588
|
-
}
|
|
589
|
-
async function A() {
|
|
590
|
-
return new Promise((L, V) => {
|
|
591
|
-
const T = new Image();
|
|
592
|
-
T.crossOrigin = "anonymous", T.onload = () => {
|
|
593
|
-
L(T);
|
|
594
|
-
}, T.onerror = () => {
|
|
595
|
-
V(new Error(X(`failed loading url: ${n}`)));
|
|
596
|
-
}, T.src = n ?? "";
|
|
597
|
-
});
|
|
598
|
-
}
|
|
599
|
-
let S = await A(), I = (S.width & S.width - 1) === 0 && (S.height & S.height - 1) === 0;
|
|
600
|
-
return (e.wrapS !== Re || e.wrapT !== Re || e.minFilter !== be && 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(
|
|
601
|
-
r.TEXTURE_2D,
|
|
602
|
-
E,
|
|
603
|
-
x,
|
|
604
|
-
m,
|
|
605
|
-
R,
|
|
606
|
-
S
|
|
607
|
-
), I && e.minFilter !== be && e.minFilter !== se && r.generateMipmap(r.TEXTURE_2D), r.texParameteri(
|
|
608
|
-
r.TEXTURE_2D,
|
|
609
|
-
r.TEXTURE_WRAP_S,
|
|
610
|
-
this.wrapS || Ie
|
|
611
|
-
), r.texParameteri(
|
|
612
|
-
r.TEXTURE_2D,
|
|
613
|
-
r.TEXTURE_WRAP_T,
|
|
614
|
-
this.wrapT || Ie
|
|
615
|
-
), r.texParameteri(
|
|
616
|
-
r.TEXTURE_2D,
|
|
617
|
-
r.TEXTURE_MIN_FILTER,
|
|
618
|
-
this.minFilter || jt
|
|
619
|
-
), r.texParameteri(
|
|
620
|
-
r.TEXTURE_2D,
|
|
621
|
-
r.TEXTURE_MAG_FILTER,
|
|
622
|
-
this.magFilter || se
|
|
623
|
-
), this._webglTexture = C, this.source = S, this.isVideo = !1, this.isLoaded = !0, this.width = S.width || 0, this.height = S.height || 0, this;
|
|
624
|
-
};
|
|
625
|
-
}
|
|
626
|
-
const X = (t) => `react-shaders: ${t}`, Le = (t) => {
|
|
627
|
-
if ("changedTouches" in t) {
|
|
628
|
-
const e = t.changedTouches[0];
|
|
629
|
-
return [e?.clientX ?? 0, e?.clientY ?? 0];
|
|
630
|
-
}
|
|
631
|
-
return [t.clientX, t.clientY];
|
|
632
|
-
}, Fe = (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;
|
|
633
|
-
function Jt({
|
|
634
|
-
fs: t,
|
|
635
|
-
vs: e = ve,
|
|
636
|
-
textures: r = [],
|
|
637
|
-
uniforms: n,
|
|
638
|
-
clearColor: l = [0, 0, 0, 1],
|
|
639
|
-
precision: f = "highp",
|
|
640
|
-
style: h,
|
|
641
|
-
contextAttributes: w = {},
|
|
642
|
-
lerp: g = 1,
|
|
643
|
-
devicePixelRatio: b = 1,
|
|
644
|
-
onDoneLoadingTextures: y,
|
|
645
|
-
onError: E = console.error,
|
|
646
|
-
onWarning: x = console.warn
|
|
647
|
-
}) {
|
|
648
|
-
const c = _(null), v = _(null), N = _(null), m = _(null), R = _(void 0), F = _(void 0), C = _(!1), A = _(void 0), S = _(0), I = _([0, 0]), L = _([]), V = _(0), T = _(void 0), d = _({
|
|
649
|
-
[ge]: { type: "float", isNeeded: !1, value: 0 },
|
|
650
|
-
[ye]: { type: "float", isNeeded: !1, value: 0 },
|
|
651
|
-
[Ee]: { type: "vec4", isNeeded: !1, value: [0, 0, 0, 0] },
|
|
652
|
-
[we]: { type: "vec4", isNeeded: !1, value: [0, 0, 0, 0] },
|
|
653
|
-
[Ae]: { type: "vec2", isNeeded: !1, value: [0, 0] },
|
|
654
|
-
[Te]: { type: "int", isNeeded: !1, value: 0 },
|
|
655
|
-
[xe]: {
|
|
656
|
-
type: "vec4",
|
|
657
|
-
isNeeded: !1,
|
|
658
|
-
value: [0, 0, 0, 0]
|
|
659
|
-
}
|
|
660
|
-
}), P = _(n), W = (i, a) => {
|
|
661
|
-
const o = "width" in i ? i.width ?? 0 : 0, u = "height" in i ? i.height ?? 0 : 0, s = d.current.iChannelResolution;
|
|
662
|
-
if (!s) return;
|
|
663
|
-
const p = Array.isArray(s.value) ? s.value : s.value = [];
|
|
664
|
-
p[a * 3] = o * b, p[a * 3 + 1] = u * b, p[a * 3 + 2] = 0;
|
|
665
|
-
}, k = () => {
|
|
666
|
-
c.current && (v.current = c.current.getContext("webgl", w) || c.current.getContext(
|
|
667
|
-
"experimental-webgl",
|
|
668
|
-
w
|
|
669
|
-
), v.current?.getExtension("OES_standard_derivatives"), v.current?.getExtension("EXT_shader_texture_lod"));
|
|
670
|
-
}, ue = () => {
|
|
671
|
-
const i = v.current;
|
|
672
|
-
N.current = i?.createBuffer() ?? null, i?.bindBuffer(i.ARRAY_BUFFER, N.current);
|
|
673
|
-
const a = [
|
|
674
|
-
1,
|
|
675
|
-
1,
|
|
676
|
-
0,
|
|
677
|
-
-1,
|
|
678
|
-
1,
|
|
679
|
-
0,
|
|
680
|
-
1,
|
|
681
|
-
-1,
|
|
682
|
-
0,
|
|
683
|
-
-1,
|
|
684
|
-
-1,
|
|
685
|
-
0
|
|
686
|
-
];
|
|
687
|
-
i?.bufferData(i.ARRAY_BUFFER, new Float32Array(a), i.STATIC_DRAW);
|
|
688
|
-
}, oe = ({
|
|
689
|
-
alpha: i,
|
|
690
|
-
beta: a,
|
|
691
|
-
gamma: o
|
|
692
|
-
}) => {
|
|
693
|
-
d.current.iDeviceOrientation.value = [
|
|
694
|
-
i ?? 0,
|
|
695
|
-
a ?? 0,
|
|
696
|
-
o ?? 0,
|
|
697
|
-
window.orientation ?? 0
|
|
698
|
-
];
|
|
699
|
-
}, H = (i) => {
|
|
700
|
-
const [a = 0, o = 0] = Le(i), u = a - (A.current?.left ?? 0) - window.pageXOffset, s = (A.current?.height ?? 0) - o - (A.current?.top ?? 0) - window.pageYOffset;
|
|
701
|
-
C.current = !0;
|
|
702
|
-
const p = Array.isArray(d.current.iMouse?.value) ? d.current.iMouse.value : void 0;
|
|
703
|
-
p && (p[2] = u, p[3] = s), I.current[0] = u, I.current[1] = s;
|
|
704
|
-
}, U = (i) => {
|
|
705
|
-
A.current = c.current?.getBoundingClientRect();
|
|
706
|
-
const [a = 0, o = 0] = Le(i), u = a - (A.current?.left ?? 0), s = (A.current?.height ?? 0) - o - (A.current?.top ?? 0);
|
|
707
|
-
if (g !== 1)
|
|
708
|
-
I.current[0] = u, I.current[1] = s;
|
|
709
|
-
else {
|
|
710
|
-
const p = Array.isArray(d.current.iMouse?.value) ? d.current.iMouse.value : void 0;
|
|
711
|
-
p && (p[0] = u, p[1] = s);
|
|
712
|
-
}
|
|
713
|
-
}, M = () => {
|
|
714
|
-
const i = Array.isArray(d.current.iMouse?.value) ? d.current.iMouse.value : void 0;
|
|
715
|
-
i && (i[2] = 0, i[3] = 0);
|
|
716
|
-
}, $ = () => {
|
|
717
|
-
const i = v.current;
|
|
718
|
-
if (!i) return;
|
|
719
|
-
A.current = c.current?.getBoundingClientRect();
|
|
720
|
-
const a = b, o = Math.floor(
|
|
721
|
-
(A.current?.width ?? 1) * a
|
|
722
|
-
), u = Math.floor(
|
|
723
|
-
(A.current?.height ?? 1) * a
|
|
724
|
-
);
|
|
725
|
-
if (i.canvas.width = o, i.canvas.height = u, d.current.iResolution?.isNeeded && m.current) {
|
|
726
|
-
const s = i.getUniformLocation(
|
|
727
|
-
m.current,
|
|
728
|
-
Ae
|
|
729
|
-
);
|
|
730
|
-
i.uniform2fv(s, [i.canvas.width, i.canvas.height]);
|
|
731
|
-
}
|
|
732
|
-
}, Q = (i, a) => {
|
|
733
|
-
const o = v.current;
|
|
734
|
-
if (!o) return null;
|
|
735
|
-
const u = o.createShader(i);
|
|
736
|
-
if (!u) return null;
|
|
737
|
-
if (o.shaderSource(u, a), o.compileShader(u), !o.getShaderParameter(u, o.COMPILE_STATUS)) {
|
|
738
|
-
x?.(X(`Error compiling the shader:
|
|
739
|
-
${a}`));
|
|
740
|
-
const s = o.getShaderInfoLog(u);
|
|
741
|
-
o.deleteShader(u), E?.(X(`Shader compiler log: ${s}`));
|
|
742
|
-
}
|
|
743
|
-
return u;
|
|
744
|
-
}, J = (i, a) => {
|
|
745
|
-
const o = v.current;
|
|
746
|
-
if (!o) return;
|
|
747
|
-
const u = Q(o.FRAGMENT_SHADER, i), s = Q(o.VERTEX_SHADER, a);
|
|
748
|
-
if (m.current = o.createProgram(), !(!m.current || !s || !u)) {
|
|
749
|
-
if (o.attachShader(m.current, s), o.attachShader(m.current, u), o.linkProgram(m.current), !o.getProgramParameter(m.current, o.LINK_STATUS)) {
|
|
750
|
-
E?.(
|
|
751
|
-
X(
|
|
752
|
-
`Unable to initialize the shader program: ${o.getProgramInfoLog(
|
|
753
|
-
m.current
|
|
754
|
-
)}`
|
|
755
|
-
)
|
|
756
|
-
);
|
|
757
|
-
return;
|
|
758
|
-
}
|
|
759
|
-
o.useProgram(m.current), R.current = o.getAttribLocation(
|
|
760
|
-
m.current,
|
|
761
|
-
"aVertexPosition"
|
|
762
|
-
), o.enableVertexAttribArray(R.current);
|
|
763
|
-
}
|
|
764
|
-
}, Z = () => {
|
|
765
|
-
if (n)
|
|
766
|
-
for (const i of Object.keys(n)) {
|
|
767
|
-
const a = n[i];
|
|
768
|
-
if (!a) continue;
|
|
769
|
-
const { value: o, type: u } = a, s = Ht(u);
|
|
770
|
-
if (!s) continue;
|
|
771
|
-
const p = {};
|
|
772
|
-
if (Yt(u, o)) {
|
|
773
|
-
const O = u.length, B = Number.parseInt(u.charAt(O - 3)), K = Math.floor(o.length / (B * B));
|
|
774
|
-
o.length > B * B && (p.arraySize = `[${K}]`);
|
|
775
|
-
} else zt(u, o) && (p.arraySize = `[${Math.floor(o.length / Number.parseInt(u.charAt(0)))}]`);
|
|
776
|
-
d.current[i] = {
|
|
777
|
-
type: s,
|
|
778
|
-
isNeeded: !1,
|
|
779
|
-
value: o,
|
|
780
|
-
...p
|
|
781
|
-
};
|
|
782
|
-
}
|
|
783
|
-
}, ee = () => {
|
|
784
|
-
const i = v.current;
|
|
785
|
-
if (i)
|
|
786
|
-
if (r && r.length > 0) {
|
|
787
|
-
d.current[`${Se}`] = {
|
|
788
|
-
type: "vec3",
|
|
789
|
-
isNeeded: !1,
|
|
790
|
-
arraySize: `[${r.length}]`,
|
|
791
|
-
value: []
|
|
792
|
-
};
|
|
793
|
-
const a = r.map(
|
|
794
|
-
(o, u) => (d.current[`${$t}${u}`] = {
|
|
795
|
-
type: "sampler2D",
|
|
796
|
-
isNeeded: !1
|
|
797
|
-
}, W(o, u), L.current[u] = new Kt(i), L.current[u]?.load(o).then((s) => {
|
|
798
|
-
W(s, u);
|
|
799
|
-
}))
|
|
800
|
-
);
|
|
801
|
-
Promise.all(a).then(() => {
|
|
802
|
-
y && y();
|
|
803
|
-
}).catch((o) => {
|
|
804
|
-
E?.(o), y && y();
|
|
805
|
-
});
|
|
806
|
-
} else y && y();
|
|
807
|
-
}, te = (i) => {
|
|
808
|
-
const a = pe.includes(f ?? "highp"), o = `precision ${a ? f : pe[1]} float;
|
|
809
|
-
`;
|
|
810
|
-
a || x?.(
|
|
811
|
-
X(
|
|
812
|
-
`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.`
|
|
813
|
-
)
|
|
814
|
-
);
|
|
815
|
-
let u = o.concat(`#define DPR ${b.toFixed(1)}
|
|
816
|
-
`).concat(i.replace(/texture\(/g, "texture2D("));
|
|
817
|
-
for (const p of Object.keys(d.current))
|
|
818
|
-
if (i.includes(p)) {
|
|
819
|
-
const O = d.current[p];
|
|
820
|
-
if (!O) continue;
|
|
821
|
-
u = Qt(
|
|
822
|
-
u,
|
|
823
|
-
`uniform ${O.type} ${p}${O.arraySize || ""};
|
|
824
|
-
`,
|
|
825
|
-
u.lastIndexOf(o) + o.length
|
|
826
|
-
), O.isNeeded = !0;
|
|
827
|
-
}
|
|
828
|
-
return i.includes("mainImage") && (u = u.concat(Gt)), u;
|
|
829
|
-
}, Y = (i) => {
|
|
830
|
-
const a = v.current;
|
|
831
|
-
if (!a || !m.current) return;
|
|
832
|
-
const o = V.current ? (i - V.current) / 1e3 : 0;
|
|
833
|
-
V.current = i;
|
|
834
|
-
const u = P.current;
|
|
835
|
-
if (u)
|
|
836
|
-
for (const s of Object.keys(u)) {
|
|
837
|
-
const p = u[s];
|
|
838
|
-
if (p && d.current[s]?.isNeeded) {
|
|
839
|
-
if (!m.current) return;
|
|
840
|
-
const O = a.getUniformLocation(
|
|
841
|
-
m.current,
|
|
842
|
-
s
|
|
843
|
-
);
|
|
844
|
-
if (!O) return;
|
|
845
|
-
Wt(
|
|
846
|
-
a,
|
|
847
|
-
O,
|
|
848
|
-
p.type,
|
|
849
|
-
p.value
|
|
850
|
-
);
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
if (d.current.iMouse?.isNeeded) {
|
|
854
|
-
const s = a.getUniformLocation(
|
|
855
|
-
m.current,
|
|
856
|
-
we
|
|
857
|
-
);
|
|
858
|
-
a.uniform4fv(s, d.current.iMouse.value);
|
|
859
|
-
}
|
|
860
|
-
if (d.current.iChannelResolution?.isNeeded) {
|
|
861
|
-
const s = a.getUniformLocation(
|
|
862
|
-
m.current,
|
|
863
|
-
Se
|
|
864
|
-
);
|
|
865
|
-
a.uniform3fv(
|
|
866
|
-
s,
|
|
867
|
-
d.current.iChannelResolution.value
|
|
868
|
-
);
|
|
869
|
-
}
|
|
870
|
-
if (d.current.iDeviceOrientation?.isNeeded) {
|
|
871
|
-
const s = a.getUniformLocation(
|
|
872
|
-
m.current,
|
|
873
|
-
xe
|
|
874
|
-
);
|
|
875
|
-
a.uniform4fv(
|
|
876
|
-
s,
|
|
877
|
-
d.current.iDeviceOrientation.value
|
|
878
|
-
);
|
|
879
|
-
}
|
|
880
|
-
if (d.current.iTime?.isNeeded) {
|
|
881
|
-
const s = a.getUniformLocation(
|
|
882
|
-
m.current,
|
|
883
|
-
ge
|
|
884
|
-
);
|
|
885
|
-
a.uniform1f(s, S.current += o);
|
|
886
|
-
}
|
|
887
|
-
if (d.current.iTimeDelta?.isNeeded) {
|
|
888
|
-
const s = a.getUniformLocation(
|
|
889
|
-
m.current,
|
|
890
|
-
ye
|
|
891
|
-
);
|
|
892
|
-
a.uniform1f(s, o);
|
|
893
|
-
}
|
|
894
|
-
if (d.current.iDate?.isNeeded) {
|
|
895
|
-
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(
|
|
896
|
-
m.current,
|
|
897
|
-
Ee
|
|
898
|
-
);
|
|
899
|
-
a.uniform4fv(ae, [B, p, O, K]);
|
|
900
|
-
}
|
|
901
|
-
if (d.current.iFrame?.isNeeded) {
|
|
902
|
-
const s = a.getUniformLocation(
|
|
903
|
-
m.current,
|
|
904
|
-
Te
|
|
905
|
-
), p = d.current.iFrame.value;
|
|
906
|
-
a.uniform1i(s, p), d.current.iFrame.value = p + 1;
|
|
907
|
-
}
|
|
908
|
-
if (L.current.length > 0)
|
|
909
|
-
for (let s = 0; s < L.current.length; s++) {
|
|
910
|
-
const p = L.current[s];
|
|
911
|
-
if (!p) return;
|
|
912
|
-
const { isVideo: O, _webglTexture: B, source: K, flipY: ae, isLoaded: Be } = p;
|
|
913
|
-
if (!Be || !B || !K) return;
|
|
914
|
-
if (d.current[`iChannel${s}`]?.isNeeded) {
|
|
915
|
-
if (!m.current) return;
|
|
916
|
-
const Xe = a.getUniformLocation(
|
|
917
|
-
m.current,
|
|
918
|
-
`iChannel${s}`
|
|
919
|
-
);
|
|
920
|
-
a.activeTexture(a.TEXTURE0 + s), a.bindTexture(a.TEXTURE_2D, B), a.uniform1i(Xe, s), O && p.updateTexture(
|
|
921
|
-
B,
|
|
922
|
-
K,
|
|
923
|
-
ae
|
|
924
|
-
);
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
}, z = (i) => {
|
|
928
|
-
const a = v.current;
|
|
929
|
-
if (!a) return;
|
|
930
|
-
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(
|
|
931
|
-
R.current ?? 0,
|
|
932
|
-
3,
|
|
933
|
-
a.FLOAT,
|
|
934
|
-
!1,
|
|
935
|
-
0,
|
|
936
|
-
0
|
|
937
|
-
), Y(i), a.drawArrays(a.TRIANGLE_STRIP, 0, 4);
|
|
938
|
-
const o = d.current.iMouse?.value;
|
|
939
|
-
if (d.current.iMouse?.isNeeded && g !== 1 && Array.isArray(o)) {
|
|
940
|
-
const u = o[0] ?? 0, s = o[1] ?? 0;
|
|
941
|
-
o[0] = Fe(u, I.current[0] ?? 0, g), o[1] = Fe(s, I.current[1] ?? 0, g);
|
|
942
|
-
}
|
|
943
|
-
F.current = requestAnimationFrame(z);
|
|
944
|
-
}, j = () => {
|
|
945
|
-
const i = { passive: !0 };
|
|
946
|
-
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(
|
|
947
|
-
"deviceorientation",
|
|
948
|
-
oe,
|
|
949
|
-
i
|
|
950
|
-
), c.current && (T.current = new ResizeObserver($), T.current.observe(c.current), window.addEventListener("resize", $, i));
|
|
951
|
-
}, q = () => {
|
|
952
|
-
const i = { passive: !0 };
|
|
953
|
-
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(
|
|
954
|
-
"deviceorientation",
|
|
955
|
-
oe,
|
|
956
|
-
i
|
|
957
|
-
), T.current && (T.current.disconnect(), window.removeEventListener("resize", $, i));
|
|
958
|
-
};
|
|
959
|
-
return ne(() => {
|
|
960
|
-
P.current = n;
|
|
961
|
-
}, [n]), ne(() => {
|
|
962
|
-
const i = L.current;
|
|
963
|
-
function a() {
|
|
964
|
-
k();
|
|
965
|
-
const o = v.current;
|
|
966
|
-
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(z), j(), $());
|
|
967
|
-
}
|
|
968
|
-
return requestAnimationFrame(a), () => {
|
|
969
|
-
const o = v.current;
|
|
970
|
-
if (o) {
|
|
971
|
-
if (o.getExtension("WEBGL_lose_context")?.loseContext(), o.useProgram(null), o.deleteProgram(m.current ?? null), i.length > 0)
|
|
972
|
-
for (const u of i)
|
|
973
|
-
o.deleteTexture(u._webglTexture);
|
|
974
|
-
m.current = null;
|
|
975
|
-
}
|
|
976
|
-
q(), cancelAnimationFrame(F.current ?? 0);
|
|
977
|
-
};
|
|
978
|
-
}, []), /* @__PURE__ */ G(
|
|
979
|
-
"canvas",
|
|
980
|
-
{
|
|
981
|
-
ref: c,
|
|
982
|
-
style: { height: "100%", width: "100%", ...h }
|
|
983
|
-
}
|
|
984
|
-
);
|
|
985
|
-
}
|
|
986
|
-
const Zt = `
|
|
987
|
-
const float TAU = 6.283185;
|
|
988
|
-
|
|
989
|
-
// Noise for dithering
|
|
990
|
-
vec2 randFibo(vec2 p) {
|
|
991
|
-
p = fract(p * vec2(443.897, 441.423));
|
|
992
|
-
p += dot(p, p.yx + 19.19);
|
|
993
|
-
return fract((p.xx + p.yx) * p.xy);
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
// Tonemap
|
|
997
|
-
vec3 Tonemap(vec3 x) {
|
|
998
|
-
x *= 4.0;
|
|
999
|
-
return x / (1.0 + x);
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
// Luma for alpha
|
|
1003
|
-
float luma(vec3 color) {
|
|
1004
|
-
return dot(color, vec3(0.299, 0.587, 0.114));
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
// RGB to HSV
|
|
1008
|
-
vec3 rgb2hsv(vec3 c) {
|
|
1009
|
-
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
|
1010
|
-
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
|
1011
|
-
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
|
1012
|
-
float d = q.x - min(q.w, q.y);
|
|
1013
|
-
float e = 1.0e-10;
|
|
1014
|
-
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
// HSV to RGB
|
|
1018
|
-
vec3 hsv2rgb(vec3 c) {
|
|
1019
|
-
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
|
1020
|
-
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
|
1021
|
-
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
// SDF shapes
|
|
1025
|
-
float sdCircle(vec2 st, float r) {
|
|
1026
|
-
return length(st) - r;
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
float sdLine(vec2 p, float r) {
|
|
1030
|
-
float halfLen = r * 2.0;
|
|
1031
|
-
vec2 a = vec2(-halfLen, 0.0);
|
|
1032
|
-
vec2 b = vec2(halfLen, 0.0);
|
|
1033
|
-
vec2 pa = p - a;
|
|
1034
|
-
vec2 ba = b - a;
|
|
1035
|
-
float h = clamp(dot(pa, ba) / dot(ba, ba), 0.0, 1.0);
|
|
1036
|
-
return length(pa - ba * h);
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
float getSdf(vec2 st) {
|
|
1040
|
-
if(uShape == 1.0) return sdCircle(st, uScale);
|
|
1041
|
-
else if(uShape == 2.0) return sdLine(st, uScale);
|
|
1042
|
-
return sdCircle(st, uScale); // Default
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
vec2 turb(vec2 pos, float t, float it) {
|
|
1046
|
-
// Initial rotation matrix for swirl direction
|
|
1047
|
-
mat2 rotation = mat2(0.6, -0.25, 0.25, 0.9);
|
|
1048
|
-
// Secondary rotation applied each iteration (approx 53 degree rotation)
|
|
1049
|
-
mat2 layerRotation = mat2(0.6, -0.8, 0.8, 0.6);
|
|
1050
|
-
|
|
1051
|
-
float frequency = mix(2.0, 15.0, uFrequency);
|
|
1052
|
-
float amplitude = uAmplitude;
|
|
1053
|
-
float frequencyGrowth = 1.4;
|
|
1054
|
-
float animTime = t * 0.1 * uSpeed;
|
|
1055
|
-
|
|
1056
|
-
const int LAYERS = 4;
|
|
1057
|
-
for(int i = 0; i < LAYERS; i++) {
|
|
1058
|
-
// Calculate wave displacement for this layer
|
|
1059
|
-
vec2 rotatedPos = pos * rotation;
|
|
1060
|
-
vec2 wave = sin(frequency * rotatedPos + float(i) * animTime + it);
|
|
1061
|
-
|
|
1062
|
-
// Apply displacement along rotation direction
|
|
1063
|
-
pos += (amplitude / frequency) * rotation[0] * wave;
|
|
1064
|
-
|
|
1065
|
-
// Evolve parameters for next layer
|
|
1066
|
-
rotation *= layerRotation;
|
|
1067
|
-
amplitude *= mix(1.0, max(wave.x, wave.y), uVariance);
|
|
1068
|
-
frequency *= frequencyGrowth;
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
return pos;
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
const float ITERATIONS = 36.0;
|
|
1075
|
-
|
|
1076
|
-
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
|
|
1077
|
-
vec2 uv = fragCoord / iResolution.xy;
|
|
1078
|
-
|
|
1079
|
-
vec3 pp = vec3(0.0);
|
|
1080
|
-
vec3 bloom = vec3(0.0);
|
|
1081
|
-
float t = iTime * 0.5;
|
|
1082
|
-
vec2 pos = uv - 0.5;
|
|
1083
|
-
|
|
1084
|
-
vec2 prevPos = turb(pos, t, 0.0 - 1.0 / ITERATIONS);
|
|
1085
|
-
float spacing = mix(1.0, TAU, uSpacing);
|
|
1086
|
-
|
|
1087
|
-
for(float i = 1.0; i < ITERATIONS + 1.0; i++) {
|
|
1088
|
-
float iter = i / ITERATIONS;
|
|
1089
|
-
vec2 st = turb(pos, t, iter * spacing);
|
|
1090
|
-
float d = abs(getSdf(st));
|
|
1091
|
-
float pd = distance(st, prevPos);
|
|
1092
|
-
prevPos = st;
|
|
1093
|
-
float dynamicBlur = exp2(pd * 2.0 * 1.4426950408889634) - 1.0;
|
|
1094
|
-
float ds = smoothstep(0.0, uBlur * 0.05 + max(dynamicBlur * uSmoothing, 0.001), d);
|
|
1095
|
-
|
|
1096
|
-
// Shift color based on iteration using uColorScale
|
|
1097
|
-
vec3 color = uColor;
|
|
1098
|
-
if(uColorShift > 0.01) {
|
|
1099
|
-
vec3 hsv = rgb2hsv(color);
|
|
1100
|
-
// Shift hue by iteration
|
|
1101
|
-
hsv.x = fract(hsv.x + (1.0 - iter) * uColorShift * 0.3);
|
|
1102
|
-
color = hsv2rgb(hsv);
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
float invd = 1.0 / max(d + dynamicBlur, 0.001);
|
|
1106
|
-
pp += (ds - 1.0) * color;
|
|
1107
|
-
bloom += clamp(invd, 0.0, 250.0) * color;
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
pp *= 1.0 / ITERATIONS;
|
|
1111
|
-
|
|
1112
|
-
vec3 color;
|
|
1113
|
-
|
|
1114
|
-
// Dark mode (default)
|
|
1115
|
-
if(uMode < 0.5) {
|
|
1116
|
-
// use bloom effect
|
|
1117
|
-
bloom = bloom / (bloom + 2e4);
|
|
1118
|
-
color = (-pp + bloom * 3.0 * uBloom) * 1.2;
|
|
1119
|
-
color += (randFibo(fragCoord).x - 0.5) / 255.0;
|
|
1120
|
-
color = Tonemap(color);
|
|
1121
|
-
float alpha = luma(color) * uMix;
|
|
1122
|
-
fragColor = vec4(color * uMix, alpha);
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
// Light mode
|
|
1126
|
-
else {
|
|
1127
|
-
// no bloom effect
|
|
1128
|
-
color = -pp;
|
|
1129
|
-
color += (randFibo(fragCoord).x - 0.5) / 255.0;
|
|
1130
|
-
|
|
1131
|
-
// Preserve hue by tone mapping brightness only
|
|
1132
|
-
float brightness = length(color);
|
|
1133
|
-
vec3 direction = brightness > 0.0 ? color / brightness : color;
|
|
1134
|
-
|
|
1135
|
-
// Reinhard on brightness
|
|
1136
|
-
float factor = 2.0;
|
|
1137
|
-
float mappedBrightness = (brightness * factor) / (1.0 + brightness * factor);
|
|
1138
|
-
color = direction * mappedBrightness;
|
|
1139
|
-
|
|
1140
|
-
// Boost saturation to compensate for white background bleed-through
|
|
1141
|
-
// When alpha < 1.0, white bleeds through making colors look desaturated
|
|
1142
|
-
// So we increase saturation to maintain vibrant appearance
|
|
1143
|
-
float gray = dot(color, vec3(0.2, 0.5, 0.1));
|
|
1144
|
-
float saturationBoost = 3.0;
|
|
1145
|
-
color = mix(vec3(gray), color, saturationBoost);
|
|
1146
|
-
|
|
1147
|
-
// Clamp between 0-1
|
|
1148
|
-
color = clamp(color, 0.0, 1.0);
|
|
1149
|
-
|
|
1150
|
-
float alpha = mappedBrightness * clamp(uMix, 1.0, 2.0);
|
|
1151
|
-
fragColor = vec4(color, alpha);
|
|
1152
|
-
}
|
|
1153
|
-
}`, er = 10, tr = 2, rr = 0.5, nr = 0.2, ir = 1.5, D = {
|
|
1154
|
-
duration: 0.5,
|
|
1155
|
-
ease: "easeOut"
|
|
1156
|
-
}, Me = {
|
|
1157
|
-
duration: 0.35,
|
|
1158
|
-
ease: "easeOut",
|
|
1159
|
-
repeat: 1 / 0,
|
|
1160
|
-
repeatType: "mirror"
|
|
1161
|
-
};
|
|
1162
|
-
function re(t) {
|
|
1163
|
-
const [e, r] = _e(t), n = ft(t), l = _(null);
|
|
1164
|
-
vt(n, "change", (h) => r(h));
|
|
1165
|
-
const f = Ye(
|
|
1166
|
-
(h, w) => {
|
|
1167
|
-
l.current = Xt(n, h, w);
|
|
1168
|
-
},
|
|
1169
|
-
[n]
|
|
1170
|
-
);
|
|
1171
|
-
return { value: e, motionValue: n, controls: l, animate: f };
|
|
1172
|
-
}
|
|
1173
|
-
function or(t, e) {
|
|
1174
|
-
const [r, n] = _e(er), {
|
|
1175
|
-
value: l,
|
|
1176
|
-
animate: f,
|
|
1177
|
-
motionValue: h
|
|
1178
|
-
} = re(nr), { value: w, animate: g } = re(tr), { value: b, animate: y } = re(rr), { value: E, animate: x } = re(ir), c = pt(e, {
|
|
1179
|
-
fftSize: 512,
|
|
1180
|
-
smoothingTimeConstant: 0.55
|
|
1181
|
-
});
|
|
1182
|
-
return ne(() => {
|
|
1183
|
-
switch (t) {
|
|
1184
|
-
case "idle":
|
|
1185
|
-
case "failed":
|
|
1186
|
-
case "disconnected":
|
|
1187
|
-
n(10), f(0.2, D), g(1.2, D), y(0.4, D), x(1, D);
|
|
1188
|
-
return;
|
|
1189
|
-
case "listening":
|
|
1190
|
-
case "pre-connect-buffering":
|
|
1191
|
-
n(20), f(0.3, { type: "spring", duration: 1, bounce: 0.35 }), g(1, D), y(0.7, D), x([1.5, 2], Me);
|
|
1192
|
-
return;
|
|
1193
|
-
case "thinking":
|
|
1194
|
-
case "connecting":
|
|
1195
|
-
case "initializing":
|
|
1196
|
-
n(30), f(0.3, D), g(0.5, D), y(1, D), x([0.5, 2.5], Me);
|
|
1197
|
-
return;
|
|
1198
|
-
case "speaking":
|
|
1199
|
-
n(70), f(0.3, D), g(0.75, D), y(1.25, D), x(1.5, D);
|
|
1200
|
-
return;
|
|
1201
|
-
}
|
|
1202
|
-
}, [
|
|
1203
|
-
t,
|
|
1204
|
-
f,
|
|
1205
|
-
g,
|
|
1206
|
-
y,
|
|
1207
|
-
x
|
|
1208
|
-
]), ne(() => {
|
|
1209
|
-
t === "speaking" && c > 0 && !h.isAnimating() && f(0.2 + 0.2 * c, { duration: 0 });
|
|
1210
|
-
}, [
|
|
1211
|
-
t,
|
|
1212
|
-
c,
|
|
1213
|
-
h,
|
|
1214
|
-
f,
|
|
1215
|
-
g,
|
|
1216
|
-
y,
|
|
1217
|
-
x
|
|
1218
|
-
]), {
|
|
1219
|
-
speed: r,
|
|
1220
|
-
scale: l,
|
|
1221
|
-
amplitude: w,
|
|
1222
|
-
frequency: b,
|
|
1223
|
-
brightness: E
|
|
1224
|
-
};
|
|
1225
|
-
}
|
|
1226
|
-
const ar = dt({
|
|
1227
|
-
base: "aspect-square",
|
|
1228
|
-
variants: {
|
|
1229
|
-
size: {
|
|
1230
|
-
icon: "h-[24px]",
|
|
1231
|
-
sm: "h-[56px]",
|
|
1232
|
-
md: "h-[112px]",
|
|
1233
|
-
lg: "h-[224px]",
|
|
1234
|
-
xl: "h-[448px]"
|
|
1235
|
-
}
|
|
1236
|
-
},
|
|
1237
|
-
defaultVariants: {
|
|
1238
|
-
size: "lg"
|
|
1239
|
-
}
|
|
1240
|
-
});
|
|
1241
|
-
function sr(t) {
|
|
1242
|
-
const e = t.match(
|
|
1243
|
-
/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
1244
|
-
);
|
|
1245
|
-
if (e) {
|
|
1246
|
-
const [, r, n, l] = e;
|
|
1247
|
-
return [r, n, l].map((h = "00") => parseInt(h, 16) / 255);
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
function Ve({
|
|
1251
|
-
shape: t = 1,
|
|
1252
|
-
speed: e = 1,
|
|
1253
|
-
amplitude: r = 0.5,
|
|
1254
|
-
frequency: n = 0.5,
|
|
1255
|
-
scale: l = 0.2,
|
|
1256
|
-
blur: f = 1,
|
|
1257
|
-
color: h = "#FF355E",
|
|
1258
|
-
colorShift: w = 1,
|
|
1259
|
-
brightness: g = 1,
|
|
1260
|
-
themeMode: b = typeof window < "u" && document.documentElement.classList.contains("dark") ? "dark" : "light",
|
|
1261
|
-
ref: y,
|
|
1262
|
-
className: E,
|
|
1263
|
-
...x
|
|
1264
|
-
}) {
|
|
1265
|
-
const c = ze(() => sr(h), [h]);
|
|
1266
|
-
return /* @__PURE__ */ G("div", { ref: y, className: E, ...x, children: /* @__PURE__ */ G(
|
|
1267
|
-
Jt,
|
|
1268
|
-
{
|
|
1269
|
-
fs: Zt,
|
|
1270
|
-
devicePixelRatio: globalThis.devicePixelRatio ?? 1,
|
|
1271
|
-
uniforms: {
|
|
1272
|
-
// Aurora wave speed
|
|
1273
|
-
uSpeed: { type: "1f", value: e },
|
|
1274
|
-
// Edge blur/softness
|
|
1275
|
-
uBlur: { type: "1f", value: f },
|
|
1276
|
-
// Shape scale
|
|
1277
|
-
uScale: { type: "1f", value: l },
|
|
1278
|
-
// Shape type: 1=circle, 2=line
|
|
1279
|
-
uShape: { type: "1f", value: t },
|
|
1280
|
-
// Wave frequency and complexity
|
|
1281
|
-
uFrequency: { type: "1f", value: n },
|
|
1282
|
-
// Turbulence amplitude
|
|
1283
|
-
uAmplitude: { type: "1f", value: r },
|
|
1284
|
-
// Light intensity (bloom)
|
|
1285
|
-
uBloom: { type: "1f", value: 0 },
|
|
1286
|
-
// Brightness of the aurora (0-1)
|
|
1287
|
-
uMix: { type: "1f", value: g },
|
|
1288
|
-
// Color variation across layers (0-1)
|
|
1289
|
-
uSpacing: { type: "1f", value: 0.5 },
|
|
1290
|
-
// Color palette offset - shifts colors along the gradient (0-1)
|
|
1291
|
-
uColorShift: { type: "1f", value: w },
|
|
1292
|
-
// Color variation across layers (0-1)
|
|
1293
|
-
uVariance: { type: "1f", value: 0.1 },
|
|
1294
|
-
// Smoothing of the aurora (0-1)
|
|
1295
|
-
uSmoothing: { type: "1f", value: 1 },
|
|
1296
|
-
// Display mode: 0=dark background, 1=light background
|
|
1297
|
-
uMode: { type: "1f", value: b === "light" ? 1 : 0 },
|
|
1298
|
-
// Color
|
|
1299
|
-
uColor: { type: "3fv", value: c ?? [0, 0.7, 1] }
|
|
1300
|
-
},
|
|
1301
|
-
onError: (v) => {
|
|
1302
|
-
console.error("Shader error:", v);
|
|
1303
|
-
},
|
|
1304
|
-
onWarning: (v) => {
|
|
1305
|
-
console.warn("Shader warning:", v);
|
|
1306
|
-
},
|
|
1307
|
-
style: { width: "100%", height: "100%" }
|
|
1308
|
-
}
|
|
1309
|
-
) });
|
|
1310
|
-
}
|
|
1311
|
-
Ve.displayName = "AuraShader";
|
|
1312
|
-
function gr({
|
|
1313
|
-
size: t = "lg",
|
|
1314
|
-
state: e,
|
|
1315
|
-
color: r,
|
|
1316
|
-
colorShift: n = 0.05,
|
|
1317
|
-
audioTrack: l,
|
|
1318
|
-
themeMode: f,
|
|
1319
|
-
className: h,
|
|
1320
|
-
ref: w,
|
|
1321
|
-
...g
|
|
1322
|
-
}) {
|
|
1323
|
-
const { speed: b, scale: y, amplitude: E, frequency: x, brightness: c } = or(e, l);
|
|
1324
|
-
return /* @__PURE__ */ G(
|
|
1325
|
-
Ve,
|
|
1326
|
-
{
|
|
1327
|
-
ref: w,
|
|
1328
|
-
blur: 0.2,
|
|
1329
|
-
color: r,
|
|
1330
|
-
colorShift: n,
|
|
1331
|
-
speed: b,
|
|
1332
|
-
scale: y,
|
|
1333
|
-
themeMode: f,
|
|
1334
|
-
amplitude: E,
|
|
1335
|
-
frequency: x,
|
|
1336
|
-
brightness: c,
|
|
1337
|
-
className: mt(
|
|
1338
|
-
ar({ size: t }),
|
|
1339
|
-
"overflow-hidden rounded-full",
|
|
1340
|
-
h
|
|
1341
|
-
),
|
|
1342
|
-
...g
|
|
1343
|
-
}
|
|
1344
|
-
);
|
|
1345
|
-
}
|
|
1346
|
-
const yr = ({
|
|
1347
|
-
text: t,
|
|
1348
|
-
confirmationText: e,
|
|
1349
|
-
onConfirm: r,
|
|
1350
|
-
cancelText: n,
|
|
1351
|
-
onCancel: l
|
|
1352
|
-
}) => /* @__PURE__ */ le("div", { className: "flex flex-col gap-2", children: [
|
|
1353
|
-
t && /* @__PURE__ */ G("p", { children: t }),
|
|
1354
|
-
/* @__PURE__ */ le("div", { className: "flex gap-2", children: [
|
|
1355
|
-
/* @__PURE__ */ G(
|
|
1356
|
-
fe,
|
|
1357
|
-
{
|
|
1358
|
-
type: "button",
|
|
1359
|
-
variant: "outline",
|
|
1360
|
-
size: "sm",
|
|
1361
|
-
icon: ht,
|
|
1362
|
-
onClick: r,
|
|
1363
|
-
label: e
|
|
1364
|
-
}
|
|
1365
|
-
),
|
|
1366
|
-
/* @__PURE__ */ G(
|
|
1367
|
-
fe,
|
|
1368
|
-
{
|
|
1369
|
-
type: "button",
|
|
1370
|
-
variant: "ghost",
|
|
1371
|
-
size: "sm",
|
|
1372
|
-
onClick: l,
|
|
1373
|
-
label: n
|
|
1374
|
-
}
|
|
1375
|
-
)
|
|
1376
|
-
] })
|
|
1377
|
-
] });
|
|
1378
|
-
export {
|
|
1379
|
-
pr as A,
|
|
1380
|
-
gr as F,
|
|
1381
|
-
hr as a,
|
|
1382
|
-
dr as b,
|
|
1383
|
-
yr as c,
|
|
1384
|
-
mr as o,
|
|
1385
|
-
vr as u
|
|
1386
|
-
};
|