@aberhamm/liquid-glass-react 0.2.1 → 0.3.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/README.md +76 -618
- package/dist/index.cjs +87 -1
- package/dist/index.d.cts +103 -1150
- package/dist/index.d.ts +103 -1150
- package/dist/index.mjs +3280 -1230
- package/dist/liquid-glass-react.css +1 -1
- package/dist/native/index.native.d.ts +1 -1
- package/dist/native/index.native.js +1 -1
- package/licenses/samasante-liquid-glass-MIT.txt +21 -0
- package/package.json +8 -4
package/dist/index.mjs
CHANGED
|
@@ -1,1320 +1,3370 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
function sn() {
|
|
32
|
-
return typeof window.matchMedia != "function" ? !1 : window.matchMedia("(prefers-reduced-transparency: reduce)").matches;
|
|
33
|
-
}
|
|
34
|
-
function on() {
|
|
35
|
-
return typeof window.matchMedia != "function" ? !1 : window.matchMedia("(prefers-contrast: more)").matches;
|
|
36
|
-
}
|
|
37
|
-
function an() {
|
|
38
|
-
if (!Jt())
|
|
39
|
-
return xt();
|
|
40
|
-
const n = navigator.userAgent ?? "", t = en(), e = tn(n), r = nn(n, e), s = r, o = rn(), a = sn(), i = on();
|
|
1
|
+
"use client";
|
|
2
|
+
import Vt, { useMemo as ft, useRef as o, useState as Ke, useEffect as oe, useId as jt, useLayoutEffect as qe, useCallback as Rt, forwardRef as vr, useSyncExternalStore as Br } from "react";
|
|
3
|
+
import { jsx as a, jsxs as te, Fragment as ot } from "react/jsx-runtime";
|
|
4
|
+
var Jt = {
|
|
5
|
+
lensW: 95,
|
|
6
|
+
lensH: 95,
|
|
7
|
+
borderRadius: 95,
|
|
8
|
+
mapSize: 512,
|
|
9
|
+
clipToShape: !0,
|
|
10
|
+
softEdge: !0,
|
|
11
|
+
strength: 0.06,
|
|
12
|
+
depth: 0.65,
|
|
13
|
+
curvature: 0.6,
|
|
14
|
+
splay: 0,
|
|
15
|
+
dispersion: 0.5,
|
|
16
|
+
bend: 0,
|
|
17
|
+
bendWidth: 0.16,
|
|
18
|
+
frost: 0.5,
|
|
19
|
+
brightness: 0.1,
|
|
20
|
+
specular: 1,
|
|
21
|
+
sheenAngle: 45,
|
|
22
|
+
sheenDark: !1,
|
|
23
|
+
sheen: 0.3,
|
|
24
|
+
sheenWidth: 3,
|
|
25
|
+
sheenFalloff: 1.5,
|
|
26
|
+
glow: 0.12,
|
|
27
|
+
glowSpread: 1,
|
|
28
|
+
glowFalloff: 0.5
|
|
29
|
+
}, wr = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=", ht = 0.22, Gr = Math.sqrt(Math.PI), Pr = (t) => Math.tanh(Gr * t), cr = (t, e) => e > 0 ? (t - Math.sqrt(t * t - e * e)) / e : 0, Ur = (t, e, s) => {
|
|
30
|
+
const n = Math.max(0.01, Math.min(t, Math.min(e, s) - 1)), r = (e * e + n * n) / (2 * n), u = (s * s + n * n) / (2 * n), h = cr(r, e), f = cr(u, s);
|
|
41
31
|
return {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
prefersReducedMotion: o,
|
|
47
|
-
prefersReducedTransparency: a,
|
|
48
|
-
prefersContrastMore: i,
|
|
49
|
-
canRefract: t && s
|
|
32
|
+
Rx: r,
|
|
33
|
+
Ry: u,
|
|
34
|
+
scaleX: h > 0 ? 0.5 / h : 1,
|
|
35
|
+
scaleY: f > 0 ? 0.5 / f : 1
|
|
50
36
|
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
37
|
+
}, Or = (t, e, s) => {
|
|
38
|
+
const n = Math.min(t, e * 0.999);
|
|
39
|
+
return n / Math.sqrt(e * e - n * n) * s;
|
|
40
|
+
}, Qt = (t, e) => `${t} 0 0 0 ${0.5 * (1 - t)} 0 ${e} 0 0 ${0.5 * (1 - e)} 0 0 1 0 0 0 0 0 1 0`, lr = /* @__PURE__ */ new Map(), xr = (t, e, s) => {
|
|
41
|
+
const n = Math.max(1, Math.round(t)), r = Math.max(1, Math.round(e)), u = Math.max(
|
|
42
|
+
0,
|
|
43
|
+
Math.min(Math.round(s), Math.min(n, r) / 2)
|
|
44
|
+
), h = `rr·${n}·${r}·${u}`, f = lr.get(h);
|
|
45
|
+
if (f) return { uri: f, key: h };
|
|
46
|
+
const l = 0.5, i = Math.max(0, n - 2 * l), k = Math.max(0, r - 2 * l), I = Math.max(0, u - l), m = `<svg xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='none' viewBox='0 0 ${n} ${r}'><rect fill='black' rx='${I}' ry='${I}' x='${l}' y='${l}' width='${i}' height='${k}'/></svg>`, d = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(m)}`;
|
|
47
|
+
return lr.set(h, d), { uri: d, key: h };
|
|
48
|
+
}, Nr = (t, e, s) => {
|
|
49
|
+
const n = Math.max(1, Math.round(t)), r = Math.max(1, Math.round(e)), u = Math.max(
|
|
50
|
+
0,
|
|
51
|
+
Math.min(Math.round(s), Math.floor(Math.min(n, r) / 2))
|
|
55
52
|
);
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
53
|
+
return xr(n, r, u);
|
|
54
|
+
}, Xt = (t) => (0.5 + t) * 255 + 0.5 | 0, ur = (t) => 127 * t + 128 + 0.5 | 0, Zt = (t) => {
|
|
55
|
+
let e = null, s = null, n = null, r = null, u = -1 / 0, h = -1 / 0, f = -1 / 0, l = 0, i = !0, k = null;
|
|
56
|
+
return {
|
|
57
|
+
generate(I) {
|
|
58
|
+
e || (e = document.createElement("canvas"), e.width = t, e.height = t, s = e.getContext("2d"), n = s.createImageData(t, t));
|
|
59
|
+
const {
|
|
60
|
+
lensHalfWidth: m,
|
|
61
|
+
lensHalfHeight: d,
|
|
62
|
+
borderRadius: R,
|
|
63
|
+
depth: G,
|
|
64
|
+
clipToShape: $,
|
|
65
|
+
softEdge: F,
|
|
66
|
+
sheenAngle: Y = 45,
|
|
67
|
+
glow: H = 0,
|
|
68
|
+
glowSpread: x = 1,
|
|
69
|
+
glowFalloff: K = 1.5,
|
|
70
|
+
sheen: O = 0,
|
|
71
|
+
sheenWidth: S = 3,
|
|
72
|
+
sheenFalloff: E = 1.5,
|
|
73
|
+
curvature: y = 0,
|
|
74
|
+
splay: X = 0,
|
|
75
|
+
bend: C = 0,
|
|
76
|
+
bendWidth: N = 0.16
|
|
77
|
+
} = I, _ = n.data, W = t >> 1, B = Math.min(R, Math.min(m, d)), c = Math.min(m, d), V = Math.min(G * c, c - 1), J = Math.max(0, m - V), M = Math.max(0, d - V), T = Math.max(
|
|
78
|
+
0,
|
|
79
|
+
Math.min(R, Math.min(J, M))
|
|
80
|
+
), q = V > 0 ? Math.SQRT1_2 / V : 1e6, re = H > 0 || O > 0, ue = Y * Math.PI / 180, ne = Math.cos(ue), ee = Math.sin(ue), ge = S > 0 ? 1 / S : 0, me = 1 / Math.max(2, x * Math.min(m, d)), ye = 2 * m / t, D = 2 * d / t, j = 1 / m, g = 1 / d, Q = y > 0, se = y * Math.min(m, d), A = X > 0, De = C > 0, ve = 1 / Math.max(2, N * Math.min(m, d)), P = (he, de) => he > 0 || de > 0 ? Math.sqrt(he * he + de * de) : 0;
|
|
81
|
+
if (Q && ((!k || Math.abs(se - u) > 0.5 || Math.abs(m - h) > 1 || Math.abs(d - f) > 1) && (k = Ur(se, m, d), u = se, h = m, f = d, i = !0), l !== W && (r = new Float32Array(W), l = W, i = !0), i)) {
|
|
82
|
+
const he = r, de = k, Te = de.Rx * de.Rx, Ge = de.Rx * (1 - 1e-3);
|
|
83
|
+
for (let b = 0; b < W; b += 1) {
|
|
84
|
+
const Ae = -((b + 0.5) * ye - m), Xe = Ae < Ge ? Ae : Ge;
|
|
85
|
+
he[b] = Xe / Math.sqrt(Te - Xe * Xe) * de.scaleX;
|
|
86
|
+
}
|
|
87
|
+
i = !1;
|
|
87
88
|
}
|
|
88
|
-
const
|
|
89
|
-
|
|
89
|
+
const Z = Q ? r : null, Re = 0.5 * Math.min(m, d), Ne = Re > 0 ? 1 / Re : 0, Ve = Math.SQRT1_2;
|
|
90
|
+
for (let he = 0; he < W; he += 1) {
|
|
91
|
+
const de = t - 1 - he, Te = -((he + 0.5) * D - d), Ge = Te - d + B, b = F ? Te - M + T : 0, Ae = Q && Z ? Or(Te, k.Ry, k.scaleY) : Te * g > 1 ? 1 : Te * g, Xe = Te * g > 1 ? 1 : Te * g, $e = A ? Math.max(0, 1 - (d - Te) * Ne) : 0, _e = he * t, nt = de * t;
|
|
92
|
+
for (let Ue = 0; Ue < W; Ue += 1) {
|
|
93
|
+
const et = t - 1 - Ue, He = -((Ue + 0.5) * ye - m), ke = He - m + B, v = P(ke > 0 ? ke : 0, Ge > 0 ? Ge : 0) + (ke > Ge ? ke > 0 ? 0 : ke : Ge > 0 ? 0 : Ge) - B, fe = (_e + Ue) * 4, pe = (_e + et) * 4, we = (nt + Ue) * 4, je = (nt + et) * 4;
|
|
94
|
+
if ($ && v >= 0) {
|
|
95
|
+
for (const ce of [fe, pe, we, je])
|
|
96
|
+
_[ce] = 128, _[ce + 1] = 128, _[ce + 2] = 128, _[ce + 3] = 255;
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
let w = Z ? Z[Ue] : He * j > 1 ? 1 : He * j, z = Ae;
|
|
100
|
+
if (A) {
|
|
101
|
+
const ce = $e * X, Ce = Math.max(0, 1 - (m - He) * Ne) * X;
|
|
102
|
+
if (ce > 1e-3 || Ce > 1e-3) {
|
|
103
|
+
const st = w, Be = z;
|
|
104
|
+
w = st * (1 - ce), z = Be * (1 - Ce);
|
|
105
|
+
const it = Math.sqrt(st * st + Be * Be), gt = Math.sqrt(w * w + z * z);
|
|
106
|
+
if (gt > 1e-3) {
|
|
107
|
+
const Ct = it / gt;
|
|
108
|
+
w *= Ct, z *= Ct;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
let ae = 1;
|
|
113
|
+
if (F) {
|
|
114
|
+
const ce = He - J + T, Ce = P(ce > 0 ? ce : 0, b > 0 ? b : 0) + (ce > b ? ce > 0 ? 0 : ce : b > 0 ? 0 : b) - T;
|
|
115
|
+
ae = 0.5 * (1 + Pr(Ce * q));
|
|
116
|
+
}
|
|
117
|
+
let Ie = 0.5 * w * ae, We = 0.5 * z * ae;
|
|
118
|
+
if (De) {
|
|
119
|
+
const ce = v < 0 ? Math.max(0, 1 + v * ve) : 0;
|
|
120
|
+
if (ce > 0) {
|
|
121
|
+
const Ce = Math.sqrt(w * w + z * z);
|
|
122
|
+
if (Ce > 1e-4) {
|
|
123
|
+
const st = 6.75 * ce * ce * (1 - ce), Be = 0.5 * C * st * ae / Ce;
|
|
124
|
+
Ie += w * Be, We += z * Be;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
let Fe = 0, Le = 0;
|
|
129
|
+
if (re) {
|
|
130
|
+
const ce = He * j > 1 ? 1 : He * j, Ce = Math.min(
|
|
131
|
+
1,
|
|
132
|
+
Math.abs(ce * ne + Xe * ee) * Ve
|
|
133
|
+
), st = Math.min(
|
|
134
|
+
1,
|
|
135
|
+
Math.abs(ce * ne - Xe * ee) * Ve
|
|
136
|
+
);
|
|
137
|
+
if (O > 0) {
|
|
138
|
+
const Be = v < 0 ? Math.max(0, 1 + v * ge) : 0, it = O * Math.pow(Be, E);
|
|
139
|
+
Fe += it * (0.16 + 0.84 * Math.pow(Ce, 1.6)), Le += it * (0.16 + 0.84 * Math.pow(st, 1.6));
|
|
140
|
+
}
|
|
141
|
+
if (H > 0) {
|
|
142
|
+
const it = 1 - (v < 0 ? Math.min(1, -v * me) : 1), gt = H * Math.pow(it * it * (3 - 2 * it), K) * ae;
|
|
143
|
+
Fe += gt * (0.6 + 0.4 * Ce), Le += gt * (0.6 + 0.4 * st);
|
|
144
|
+
}
|
|
145
|
+
Fe > 1 ? Fe = 1 : Fe < -1 && (Fe = -1), Le > 1 ? Le = 1 : Le < -1 && (Le = -1);
|
|
146
|
+
}
|
|
147
|
+
const ze = Xt(Ie), pt = Xt(-Ie), Oe = Xt(We), wt = Xt(-We), tt = ur(Fe), at = ur(Le);
|
|
148
|
+
_[fe] = ze, _[fe + 1] = Oe, _[fe + 2] = tt, _[fe + 3] = 255, _[pe] = pt, _[pe + 1] = Oe, _[pe + 2] = at, _[pe + 3] = 255, _[we] = ze, _[we + 1] = wt, _[we + 2] = at, _[we + 3] = 255, _[je] = pt, _[je + 1] = wt, _[je + 2] = tt, _[je + 3] = 255;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return s.putImageData(n, 0, 0), e.toDataURL();
|
|
152
|
+
},
|
|
153
|
+
dispose() {
|
|
154
|
+
e && (e.width = 0, e.height = 0, e = null), s = null, n = null, r = null, k = null, u = -1 / 0, h = -1 / 0, f = -1 / 0, l = 0, i = !0;
|
|
90
155
|
}
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
for (let t = 0; t < 256; t++) {
|
|
96
|
-
let e = t;
|
|
97
|
-
for (let r = 0; r < 8; r++)
|
|
98
|
-
e = e & 1 ? 3988292384 ^ e >>> 1 : e >>> 1;
|
|
99
|
-
n[t] = e >>> 0;
|
|
100
|
-
}
|
|
101
|
-
return n;
|
|
102
|
-
})();
|
|
103
|
-
function dn(n) {
|
|
104
|
-
let t = 4294967295;
|
|
105
|
-
for (let e = 0; e < n.length; e++)
|
|
106
|
-
t = un[(t ^ n[e]) & 255] ^ t >>> 8;
|
|
107
|
-
return (t ^ 4294967295) >>> 0;
|
|
108
|
-
}
|
|
109
|
-
function fn(n) {
|
|
110
|
-
let t = 1, e = 0;
|
|
111
|
-
const r = 65521;
|
|
112
|
-
for (let s = 0; s < n.length; s++)
|
|
113
|
-
t = (t + n[s]) % r, e = (e + t) % r;
|
|
114
|
-
return (e << 16 | t) >>> 0;
|
|
115
|
-
}
|
|
116
|
-
function mn(n) {
|
|
117
|
-
const e = Math.max(1, Math.ceil(n.length / 65535)), r = new Uint8Array(2 + e * 5 + n.length + 4);
|
|
118
|
-
let s = 0;
|
|
119
|
-
r[s++] = 120, r[s++] = 1;
|
|
120
|
-
let o = 0;
|
|
121
|
-
do {
|
|
122
|
-
const i = Math.min(n.length - o, 65535), c = o + i >= n.length;
|
|
123
|
-
r[s++] = c ? 1 : 0, r[s++] = i & 255, r[s++] = i >>> 8 & 255;
|
|
124
|
-
const u = ~i & 65535;
|
|
125
|
-
r[s++] = u & 255, r[s++] = u >>> 8 & 255, r.set(n.subarray(o, o + i), s), s += i, o += i;
|
|
126
|
-
} while (o < n.length);
|
|
127
|
-
const a = fn(n);
|
|
128
|
-
return r[s++] = a >>> 24 & 255, r[s++] = a >>> 16 & 255, r[s++] = a >>> 8 & 255, r[s++] = a & 255, r;
|
|
129
|
-
}
|
|
130
|
-
function Ie(n, t) {
|
|
131
|
-
const e = t.length, r = new Uint8Array(12 + e);
|
|
132
|
-
r[0] = e >>> 24 & 255, r[1] = e >>> 16 & 255, r[2] = e >>> 8 & 255, r[3] = e & 255, r[4] = n.charCodeAt(0), r[5] = n.charCodeAt(1), r[6] = n.charCodeAt(2), r[7] = n.charCodeAt(3), r.set(t, 8);
|
|
133
|
-
const s = dn(r.subarray(4, 8 + e));
|
|
134
|
-
return r[8 + e] = s >>> 24 & 255, r[9 + e] = s >>> 16 & 255, r[10 + e] = s >>> 8 & 255, r[11 + e] = s & 255, r;
|
|
135
|
-
}
|
|
136
|
-
function At(n, t, e) {
|
|
137
|
-
const r = t * 4, s = new Uint8Array(e * (r + 1));
|
|
138
|
-
for (let l = 0; l < e; l++) {
|
|
139
|
-
const m = l * (r + 1);
|
|
140
|
-
s[m] = 0, s.set(n.subarray(l * r, l * r + r), m + 1);
|
|
156
|
+
};
|
|
157
|
+
}, xe = (t) => typeof t == "object" && t !== null && "get" in t && "on" in t, Pe = (t) => xe(t) ? t.get() : t, $r = class {
|
|
158
|
+
constructor(t) {
|
|
159
|
+
this.subscribers = [], this.current = t;
|
|
141
160
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const i = Uint8Array.from([137, 80, 78, 71, 13, 10, 26, 10]), c = Ie("IHDR", a), u = Ie("IDAT", o), g = Ie("IEND", new Uint8Array(0)), b = i.length + c.length + u.length + g.length, h = new Uint8Array(b);
|
|
145
|
-
let f = 0;
|
|
146
|
-
for (const l of [i, c, u, g])
|
|
147
|
-
h.set(l, f), f += l.length;
|
|
148
|
-
return h;
|
|
149
|
-
}
|
|
150
|
-
const D = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
151
|
-
function Ct(n) {
|
|
152
|
-
let t = "", e = 0;
|
|
153
|
-
for (; e + 2 < n.length; e += 3) {
|
|
154
|
-
const s = n[e] << 16 | n[e + 1] << 8 | n[e + 2];
|
|
155
|
-
t += D.charAt(s >>> 18 & 63) + D.charAt(s >>> 12 & 63) + D.charAt(s >>> 6 & 63) + D.charAt(s & 63);
|
|
161
|
+
get() {
|
|
162
|
+
return this.current;
|
|
156
163
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const s = n[e] << 16 | n[e + 1] << 8;
|
|
163
|
-
t += `${D.charAt(s >>> 18 & 63)}${D.charAt(s >>> 12 & 63)}${D.charAt(s >>> 6 & 63)}=`;
|
|
164
|
+
set(t) {
|
|
165
|
+
if (t !== this.current) {
|
|
166
|
+
this.current = t;
|
|
167
|
+
for (const e of this.subscribers.slice()) e(t);
|
|
168
|
+
}
|
|
164
169
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
const gn = 32, ke = 16, q = /* @__PURE__ */ new Map();
|
|
172
|
-
function st(n) {
|
|
173
|
-
return Math.max(ke, Math.round(n / ke) * ke);
|
|
174
|
-
}
|
|
175
|
-
function hn(n, t, e) {
|
|
176
|
-
if (!Number.isFinite(t) || !Number.isFinite(e) || t <= 0 || e <= 0)
|
|
177
|
-
return pn();
|
|
178
|
-
const r = st(t), s = st(e), o = `${n}:${r}x${s}`, a = q.get(o);
|
|
179
|
-
if (a !== void 0)
|
|
180
|
-
return q.delete(o), q.set(o, a), a;
|
|
181
|
-
const i = ln(n, r, s), c = `data:image/png;base64,${Ct(At(i, r, s))}`;
|
|
182
|
-
if (q.set(o, c), q.size > gn) {
|
|
183
|
-
const u = q.keys().next().value;
|
|
184
|
-
u !== void 0 && q.delete(u);
|
|
170
|
+
on(t, e) {
|
|
171
|
+
return this.subscribers.push(e), () => {
|
|
172
|
+
const s = this.subscribers.indexOf(e);
|
|
173
|
+
s !== -1 && this.subscribers.splice(s, 1);
|
|
174
|
+
};
|
|
185
175
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
function Et(n) {
|
|
209
|
-
return Number.isFinite(n) ? De(1 - n / Rn, 0, 1) : 0;
|
|
210
|
-
}
|
|
211
|
-
function vn(n, t, e, r, s) {
|
|
212
|
-
if (!(s > 0))
|
|
213
|
-
return { scaleX: 1, scaleY: 1 };
|
|
214
|
-
const o = n - e, a = t - r, i = Math.hypot(o, a);
|
|
215
|
-
if (i === 0 || !Number.isFinite(i))
|
|
216
|
-
return { scaleX: 1, scaleY: 1 };
|
|
217
|
-
const c = Et(i);
|
|
218
|
-
if (c === 0)
|
|
219
|
-
return { scaleX: 1, scaleY: 1 };
|
|
220
|
-
const u = o / i, g = a / i, b = Math.abs(u), h = Math.abs(g), f = Math.min(i / Sn, 1) * s * c, l = De(
|
|
221
|
-
1 + b * f * ot - h * f * at,
|
|
222
|
-
it,
|
|
223
|
-
Number.POSITIVE_INFINITY
|
|
224
|
-
), m = De(
|
|
225
|
-
1 + h * f * ot - b * f * at,
|
|
226
|
-
it,
|
|
227
|
-
Number.POSITIVE_INFINITY
|
|
228
|
-
);
|
|
229
|
-
return { scaleX: l, scaleY: m };
|
|
230
|
-
}
|
|
231
|
-
function xn(n, t, e, r, s) {
|
|
232
|
-
if (!(s > 0))
|
|
233
|
-
return { x: 0, y: 0 };
|
|
234
|
-
const o = n - e, a = t - r, i = Math.hypot(o, a);
|
|
235
|
-
if (i === 0 || !Number.isFinite(i))
|
|
236
|
-
return { x: 0, y: 0 };
|
|
237
|
-
const c = Et(i);
|
|
238
|
-
return c === 0 ? { x: 0, y: 0 } : {
|
|
239
|
-
x: o * s * ct * c,
|
|
240
|
-
y: a * s * ct * c
|
|
176
|
+
}, be = (t) => new $r(t), dt = (t, e) => {
|
|
177
|
+
const s = be(e()), n = () => s.set(e());
|
|
178
|
+
for (const r of t) r.on("change", n);
|
|
179
|
+
return s;
|
|
180
|
+
}, Lt = (t, e, s, n) => {
|
|
181
|
+
const r = 3 * t, u = 3 * (s - t) - r, h = 1 - r - u, f = 3 * e, l = 3 * (n - e) - f, i = 1 - f - l, k = (R) => ((h * R + u) * R + r) * R, I = (R) => ((i * R + l) * R + f) * R, m = (R) => (3 * h * R + 2 * u) * R + r, d = (R) => {
|
|
182
|
+
let G = R;
|
|
183
|
+
for (let Y = 0; Y < 8; Y += 1) {
|
|
184
|
+
const H = k(G) - R;
|
|
185
|
+
if (Math.abs(H) < 1e-6) return G;
|
|
186
|
+
const x = m(G);
|
|
187
|
+
if (Math.abs(x) < 1e-6) break;
|
|
188
|
+
G -= H / x;
|
|
189
|
+
}
|
|
190
|
+
let $ = 0, F = 1;
|
|
191
|
+
for (G = R; $ < F; ) {
|
|
192
|
+
const Y = k(G);
|
|
193
|
+
if (Math.abs(Y - R) < 1e-6 || (Y < R ? $ = G : F = G, F - $ < 1e-7)) break;
|
|
194
|
+
G = ($ + F) / 2;
|
|
195
|
+
}
|
|
196
|
+
return G;
|
|
241
197
|
};
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
light: "rgba(255, 255, 255, 0.92)",
|
|
263
|
-
dark: "rgba(22, 22, 26, 0.92)"
|
|
264
|
-
}, Tn = 100, he = {
|
|
265
|
-
light: "rgba(255, 255, 255, 0.96)",
|
|
266
|
-
dark: "rgba(17, 17, 20, 0.96)"
|
|
267
|
-
}, lt = "50%", ut = "0%", dt = { rest: 0.55, hover: 0.85 }, In = "70%", ft = 0.5, kn = "60%", mt = {
|
|
268
|
-
/** Conservative fallback: byte-for-byte the existing static shadow. */
|
|
269
|
-
static: 1,
|
|
270
|
-
/** Dark/dense backdrop ⇒ deeper, darker shadow. */
|
|
271
|
-
dark: 1.35,
|
|
272
|
-
/** Light/solid backdrop ⇒ shallower, lighter shadow. */
|
|
273
|
-
light: 0.7
|
|
274
|
-
}, pt = {
|
|
275
|
-
rest: [
|
|
276
|
-
{ y: 8, blur: 24, alpha: 0.22 },
|
|
277
|
-
{ y: 1, blur: 4, alpha: 0.14 }
|
|
278
|
-
],
|
|
279
|
-
hover: [
|
|
280
|
-
{ y: 12, blur: 32, alpha: 0.28 },
|
|
281
|
-
{ y: 2, blur: 8, alpha: 0.18 }
|
|
282
|
-
]
|
|
283
|
-
}, Ln = {
|
|
284
|
-
regular: {
|
|
285
|
-
/** Multiplier on the requested `saturation` (1 = unchanged). */
|
|
286
|
-
saturationFactor: 1,
|
|
287
|
-
/** Force the adaptive-tint path off regardless of `adaptiveTint`. */
|
|
288
|
-
forceNonAdaptive: !1,
|
|
289
|
-
/** Scheme-aware dimming-scrim color behind the content, or `null` for none. */
|
|
290
|
-
scrim: null
|
|
291
|
-
},
|
|
292
|
-
clear: {
|
|
293
|
-
// Reduce the tint/vibrancy so the material reads as clearer (more of the
|
|
294
|
-
// backdrop shows through), per the Clear aesthetic.
|
|
295
|
-
saturationFactor: 0.7,
|
|
296
|
-
// Clear has NO adaptive behavior by definition — it never samples.
|
|
297
|
-
forceNonAdaptive: !0,
|
|
298
|
-
// A subtle scheme-aware scrim so foreground labels stay readable over busy
|
|
299
|
-
// media even though the surface itself is more transparent.
|
|
300
|
-
scrim: {
|
|
301
|
-
light: "rgba(0, 0, 0, 0.18)",
|
|
302
|
-
dark: "rgba(0, 0, 0, 0.28)"
|
|
198
|
+
return (R) => R <= 0 ? 0 : R >= 1 ? 1 : I(d(R));
|
|
199
|
+
}, Hr = Lt(0.34, 1.36, 0.42, 1), It = /* @__PURE__ */ new WeakMap(), zr = (t, e, {
|
|
200
|
+
duration: s = 0.3,
|
|
201
|
+
ease: n = Hr,
|
|
202
|
+
onComplete: r
|
|
203
|
+
} = {}) => {
|
|
204
|
+
var I;
|
|
205
|
+
(I = It.get(t)) == null || I.stop();
|
|
206
|
+
const u = t.get();
|
|
207
|
+
if (u === e || s <= 0)
|
|
208
|
+
return t.set(e), r == null || r(), { stop() {
|
|
209
|
+
} };
|
|
210
|
+
const h = s * 1e3;
|
|
211
|
+
let f = 0, l = 0;
|
|
212
|
+
const i = (m) => {
|
|
213
|
+
l === 0 && (l = m);
|
|
214
|
+
const d = (m - l) / h;
|
|
215
|
+
if (d >= 1) {
|
|
216
|
+
t.set(e), It.delete(t), r == null || r();
|
|
217
|
+
return;
|
|
303
218
|
}
|
|
304
|
-
|
|
305
|
-
}, Fn = "rgba(255, 255, 255, 0.1)", gt = {
|
|
306
|
-
/** Inset ring color (translucent white). */
|
|
307
|
-
color: "rgba(255, 255, 255, 0.5)",
|
|
308
|
-
/** Ring width in px (hairline). */
|
|
309
|
-
width: 1
|
|
310
|
-
}, B = {
|
|
311
|
-
luminance: null,
|
|
312
|
-
scheme: null,
|
|
313
|
-
sampled: !1
|
|
314
|
-
}, _n = 0.5;
|
|
315
|
-
function Le(n) {
|
|
316
|
-
const t = n / 255;
|
|
317
|
-
return t <= 0.03928 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4;
|
|
318
|
-
}
|
|
319
|
-
function Dn(n, t, e) {
|
|
320
|
-
const r = Le(n), s = Le(t), o = Le(e);
|
|
321
|
-
return 0.2126 * r + 0.7152 * s + 0.0722 * o;
|
|
322
|
-
}
|
|
323
|
-
function $n(n) {
|
|
324
|
-
return n >= _n ? "light" : "dark";
|
|
325
|
-
}
|
|
326
|
-
function wt(n) {
|
|
327
|
-
const t = Dn(n.r, n.g, n.b);
|
|
328
|
-
return {
|
|
329
|
-
luminance: t,
|
|
330
|
-
scheme: $n(t),
|
|
331
|
-
sampled: !0
|
|
219
|
+
t.set(u + (e - u) * n(d)), f = requestAnimationFrame(i);
|
|
332
220
|
};
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
if (t === "transparent" || t === "none")
|
|
339
|
-
return { r: 0, g: 0, b: 0, a: 0 };
|
|
340
|
-
const e = t.match(/rgba?\(([^)]+)\)/);
|
|
341
|
-
if (!(e != null && e[1]))
|
|
342
|
-
return { r: 0, g: 0, b: 0, a: 0 };
|
|
343
|
-
const r = e[1].split(/[\s,/]+/).filter(Boolean);
|
|
344
|
-
if (r.length < 3)
|
|
345
|
-
return { r: 0, g: 0, b: 0, a: 0 };
|
|
346
|
-
const s = Fe(Number.parseFloat(r[0])), o = Fe(Number.parseFloat(r[1])), a = Fe(Number.parseFloat(r[2]));
|
|
347
|
-
let i = 1;
|
|
348
|
-
const c = r[3];
|
|
349
|
-
return c !== void 0 && (i = c.endsWith("%") ? Number.parseFloat(c) / 100 : Number.parseFloat(c), Number.isFinite(i) || (i = 1)), { r: s, g: o, b: a, a: Bn(i) };
|
|
350
|
-
}
|
|
351
|
-
function Fe(n) {
|
|
352
|
-
return Number.isFinite(n) ? Math.max(0, Math.min(255, Math.round(n))) : 0;
|
|
353
|
-
}
|
|
354
|
-
function Bn(n) {
|
|
355
|
-
return Math.max(0, Math.min(1, n));
|
|
356
|
-
}
|
|
357
|
-
function Gn(n, t) {
|
|
358
|
-
const e = n.a;
|
|
359
|
-
return {
|
|
360
|
-
r: n.r * e + t.r * (1 - e),
|
|
361
|
-
g: n.g * e + t.g * (1 - e),
|
|
362
|
-
b: n.b * e + t.b * (1 - e)
|
|
221
|
+
f = requestAnimationFrame(i);
|
|
222
|
+
const k = {
|
|
223
|
+
stop() {
|
|
224
|
+
cancelAnimationFrame(f), It.delete(t);
|
|
225
|
+
}
|
|
363
226
|
};
|
|
227
|
+
return It.set(t, k), k;
|
|
228
|
+
}, Ht = `#version 300 es
|
|
229
|
+
in vec2 a_pos;
|
|
230
|
+
out vec2 v_uv;
|
|
231
|
+
void main() {
|
|
232
|
+
// a_pos is a -1..1 fullscreen quad; v_uv is bottom-left-origin 0..1, which
|
|
233
|
+
// (with UNPACK_FLIP_Y on the textures) samples the source upright. The lens
|
|
234
|
+
// descriptor is supplied in this same bottom-left space by the component.
|
|
235
|
+
v_uv = a_pos * 0.5 + 0.5;
|
|
236
|
+
gl_Position = vec4(a_pos, 0.0, 1.0);
|
|
237
|
+
}`, Yr = `#version 300 es
|
|
238
|
+
precision highp float;
|
|
239
|
+
in vec2 v_uv;
|
|
240
|
+
out vec4 o;
|
|
241
|
+
uniform sampler2D u_src;
|
|
242
|
+
void main() { o = texture(u_src, v_uv); }`, qr = `#version 300 es
|
|
243
|
+
precision highp float;
|
|
244
|
+
in vec2 v_uv;
|
|
245
|
+
out vec4 o;
|
|
246
|
+
uniform sampler2D u_src;
|
|
247
|
+
uniform vec2 u_step;
|
|
248
|
+
void main() {
|
|
249
|
+
vec4 c = texture(u_src, v_uv) * 0.1857;
|
|
250
|
+
c += (texture(u_src, v_uv + u_step) + texture(u_src, v_uv - u_step)) * 0.1671;
|
|
251
|
+
c += (texture(u_src, v_uv + 2.0 * u_step) + texture(u_src, v_uv - 2.0 * u_step)) * 0.1227;
|
|
252
|
+
c += (texture(u_src, v_uv + 3.0 * u_step) + texture(u_src, v_uv - 3.0 * u_step)) * 0.0768;
|
|
253
|
+
c += (texture(u_src, v_uv + 4.0 * u_step) + texture(u_src, v_uv - 4.0 * u_step)) * 0.0414;
|
|
254
|
+
o = c;
|
|
255
|
+
}`, Kr = `#version 300 es
|
|
256
|
+
precision highp float;
|
|
257
|
+
in vec2 v_uv;
|
|
258
|
+
out vec4 o;
|
|
259
|
+
uniform sampler2D u_src;
|
|
260
|
+
uniform sampler2D u_blur;
|
|
261
|
+
uniform sampler2D u_disp;
|
|
262
|
+
uniform vec2 u_origin;
|
|
263
|
+
uniform vec2 u_size;
|
|
264
|
+
uniform vec2 u_scale;
|
|
265
|
+
uniform vec2 u_lenspx; // lens box size in device px (for an aspect-correct SDF)
|
|
266
|
+
uniform float u_radiuspx; // corner radius in device px
|
|
267
|
+
uniform float u_dispersion;
|
|
268
|
+
uniform float u_sheen;
|
|
269
|
+
uniform float u_frost; // 0 = sharp; >0 = blend toward the pre-blurred copy
|
|
270
|
+
uniform float u_opacity; // enter/exit fade (multiplies coverage)
|
|
271
|
+
uniform float u_brightness; // white(>0)/black(<0) veil over the lens
|
|
272
|
+
// Signed distance to a rounded rectangle (negative inside). Computed in pixel
|
|
273
|
+
// space so the corner radius stays circular on non-square lenses. NB: the half-
|
|
274
|
+
// extent arg must NOT be named \`half\` — that's a reserved word in GLSL ES and
|
|
275
|
+
// Safari's (stricter) WebGL2 compiler rejects it, throwing at renderer init.
|
|
276
|
+
float sdRoundRect(vec2 p, vec2 b, float r) {
|
|
277
|
+
vec2 q = abs(p) - b + r;
|
|
278
|
+
return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r;
|
|
364
279
|
}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
}
|
|
280
|
+
// Source sample, blended toward the frosted (pre-blurred) copy by mixAmt. The
|
|
281
|
+
// frost is what makes the glass read as liquid rather than a clear lens.
|
|
282
|
+
vec3 frosted(vec2 p, float mixAmt) {
|
|
283
|
+
vec3 raw = texture(u_src, p).rgb;
|
|
284
|
+
return mixAmt > 0.0 ? mix(raw, texture(u_blur, p).rgb, mixAmt) : raw;
|
|
371
285
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
286
|
+
void main() {
|
|
287
|
+
vec2 lensUV = (v_uv - u_origin) / u_size;
|
|
288
|
+
// Rounded-rect coverage. The SDF is in device px and a true distance field
|
|
289
|
+
// (gradient ~1), so a fixed ~1px feather anti-aliases the edge without fwidth
|
|
290
|
+
// (derivatives are handled inconsistently across WebGL2 backends).
|
|
291
|
+
vec2 p = (lensUV - 0.5) * u_lenspx;
|
|
292
|
+
float sdf = sdRoundRect(p, u_lenspx * 0.5, min(u_radiuspx, min(u_lenspx.x, u_lenspx.y) * 0.5));
|
|
293
|
+
float coverage = (1.0 - smoothstep(-1.0, 1.0, sdf)) * u_opacity;
|
|
294
|
+
if (coverage <= 0.0) discard;
|
|
295
|
+
vec4 d = texture(u_disp, clamp(lensUV, 0.0, 1.0));
|
|
296
|
+
vec2 disp = (d.rg - 0.5) * u_scale; // feDisplacementMap equivalent
|
|
297
|
+
// RGB split — red bent DISPERSION_SPREAD more than blue, green half that (keep
|
|
298
|
+
// in sync with DISPERSION_SPREAD in displacement.ts so DOM + WebGL match).
|
|
299
|
+
vec2 uvR = v_uv + disp * (1.0 + u_dispersion * 0.22);
|
|
300
|
+
vec2 uvG = v_uv + disp * (1.0 + u_dispersion * 0.11);
|
|
301
|
+
vec2 uvB = v_uv + disp;
|
|
302
|
+
vec3 lensCol = vec3(frosted(uvR, u_frost).r, frosted(uvG, u_frost).g, frosted(uvB, u_frost).b);
|
|
303
|
+
// Specular lift from B. The map encodes spec as B = 127·s + 128, so (B/255 − 0.5)
|
|
304
|
+
// = 0.498·s; this matches the DOM path's gain exactly (feColorMatrix 1× alpha
|
|
305
|
+
// then feComposite k2=specular → 0.498·specular·s). (NOT ×2 — that double-lifted it.)
|
|
306
|
+
lensCol += u_sheen * max(0.0, d.b - 0.5);
|
|
307
|
+
// Brightness veil (alpha-blend toward white/black, like the DOM path).
|
|
308
|
+
if (u_brightness > 0.0) lensCol = mix(lensCol, vec3(1.0), clamp(u_brightness, 0.0, 1.0));
|
|
309
|
+
else if (u_brightness < 0.0) lensCol = mix(lensCol, vec3(0.0), clamp(-u_brightness, 0.0, 1.0));
|
|
310
|
+
// Mix over the untouched backdrop by the coverage → an AA'd, frosted-clipping
|
|
311
|
+
// silhouette. Canvas stays fully opaque, so straight/premultiplied alpha is moot.
|
|
312
|
+
vec3 backdrop = texture(u_src, v_uv).rgb;
|
|
313
|
+
o = vec4(mix(backdrop, lensCol, coverage), 1.0);
|
|
314
|
+
}`, hr = (t, e, s) => {
|
|
315
|
+
const n = t.createShader(e);
|
|
316
|
+
if (t.shaderSource(n, s), t.compileShader(n), !t.getShaderParameter(n, t.COMPILE_STATUS)) {
|
|
317
|
+
const r = t.getShaderInfoLog(n);
|
|
318
|
+
throw t.deleteShader(n), new Error(`glass-webgl shader: ${r}`);
|
|
319
|
+
}
|
|
320
|
+
return n;
|
|
321
|
+
}, zt = (t, e, s) => {
|
|
322
|
+
const n = t.createProgram(), r = hr(t, t.VERTEX_SHADER, e), u = hr(t, t.FRAGMENT_SHADER, s);
|
|
323
|
+
if (t.attachShader(n, r), t.attachShader(n, u), t.bindAttribLocation(n, 0, "a_pos"), t.linkProgram(n), t.deleteShader(r), t.deleteShader(u), !t.getProgramParameter(n, t.LINK_STATUS)) {
|
|
324
|
+
const h = t.getProgramInfoLog(n);
|
|
325
|
+
throw t.deleteProgram(n), new Error(`glass-webgl link: ${h}`);
|
|
326
|
+
}
|
|
327
|
+
return n;
|
|
328
|
+
}, Vr = class {
|
|
329
|
+
constructor(t) {
|
|
330
|
+
this.dispCache = /* @__PURE__ */ new Map(), this.blurW = 0, this.blurH = 0, this.srcW = 0, this.srcH = 0, this.disposed = !1;
|
|
331
|
+
const e = t.getContext("webgl2", {
|
|
332
|
+
premultipliedAlpha: !1,
|
|
333
|
+
alpha: !0,
|
|
334
|
+
antialias: !1,
|
|
335
|
+
preserveDrawingBuffer: !1
|
|
336
|
+
});
|
|
337
|
+
if (!e) throw new Error("webgl2 unavailable");
|
|
338
|
+
this.gl = e, this.blit = zt(e, Ht, Yr), this.lens = zt(e, Ht, Kr), this.blur = zt(e, Ht, qr), this.quad = e.createBuffer(), e.bindBuffer(e.ARRAY_BUFFER, this.quad), e.bufferData(
|
|
339
|
+
e.ARRAY_BUFFER,
|
|
340
|
+
new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
|
|
341
|
+
e.STATIC_DRAW
|
|
342
|
+
);
|
|
343
|
+
const s = () => {
|
|
344
|
+
const n = e.createTexture();
|
|
345
|
+
return e.bindTexture(e.TEXTURE_2D, n), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), n;
|
|
346
|
+
};
|
|
347
|
+
this.srcTex = s(), this.dispTex = s(), this.blurTex = [s(), s()], this.fbo = [e.createFramebuffer(), e.createFramebuffer()], e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1), e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, !0), this.uBlitSrc = e.getUniformLocation(this.blit, "u_src"), this.uBlur = {
|
|
348
|
+
src: e.getUniformLocation(this.blur, "u_src"),
|
|
349
|
+
step: e.getUniformLocation(this.blur, "u_step")
|
|
350
|
+
}, this.uLens = {
|
|
351
|
+
src: e.getUniformLocation(this.lens, "u_src"),
|
|
352
|
+
blur: e.getUniformLocation(this.lens, "u_blur"),
|
|
353
|
+
disp: e.getUniformLocation(this.lens, "u_disp"),
|
|
354
|
+
origin: e.getUniformLocation(this.lens, "u_origin"),
|
|
355
|
+
size: e.getUniformLocation(this.lens, "u_size"),
|
|
356
|
+
scale: e.getUniformLocation(this.lens, "u_scale"),
|
|
357
|
+
lenspx: e.getUniformLocation(this.lens, "u_lenspx"),
|
|
358
|
+
radiuspx: e.getUniformLocation(this.lens, "u_radiuspx"),
|
|
359
|
+
dispersion: e.getUniformLocation(this.lens, "u_dispersion"),
|
|
360
|
+
specular: e.getUniformLocation(this.lens, "u_sheen"),
|
|
361
|
+
frost: e.getUniformLocation(this.lens, "u_frost"),
|
|
362
|
+
opacity: e.getUniformLocation(this.lens, "u_opacity"),
|
|
363
|
+
brightness: e.getUniformLocation(this.lens, "u_brightness")
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
/** (Re)allocate the ping-pong frost targets to the source size. */
|
|
367
|
+
ensureBlurTargets(t, e) {
|
|
368
|
+
if (t === this.blurW && e === this.blurH) return;
|
|
369
|
+
const s = this.gl;
|
|
370
|
+
for (let n = 0; n < 2; n += 1)
|
|
371
|
+
s.bindTexture(s.TEXTURE_2D, this.blurTex[n]), s.texImage2D(
|
|
372
|
+
s.TEXTURE_2D,
|
|
373
|
+
0,
|
|
374
|
+
s.RGBA,
|
|
375
|
+
t,
|
|
376
|
+
e,
|
|
377
|
+
0,
|
|
378
|
+
s.RGBA,
|
|
379
|
+
s.UNSIGNED_BYTE,
|
|
380
|
+
null
|
|
381
|
+
), s.bindFramebuffer(s.FRAMEBUFFER, this.fbo[n]), s.framebufferTexture2D(
|
|
382
|
+
s.FRAMEBUFFER,
|
|
383
|
+
s.COLOR_ATTACHMENT0,
|
|
384
|
+
s.TEXTURE_2D,
|
|
385
|
+
this.blurTex[n],
|
|
386
|
+
0
|
|
387
|
+
);
|
|
388
|
+
s.bindFramebuffer(s.FRAMEBUFFER, null), this.blurW = t, this.blurH = e;
|
|
389
|
+
}
|
|
390
|
+
/** Two-pass separable blur of the current source texture into blurTex[1]. */
|
|
391
|
+
renderFrost(t) {
|
|
392
|
+
const e = this.gl;
|
|
393
|
+
this.ensureBlurTargets(this.srcW, this.srcH), e.useProgram(this.blur), e.viewport(0, 0, this.srcW, this.srcH), e.activeTexture(e.TEXTURE0), e.uniform1i(this.uBlur.src, 0), e.bindFramebuffer(e.FRAMEBUFFER, this.fbo[0]), e.bindTexture(e.TEXTURE_2D, this.srcTex), e.uniform2f(this.uBlur.step, t / this.srcW, 0), e.drawArrays(e.TRIANGLE_STRIP, 0, 4), e.bindFramebuffer(e.FRAMEBUFFER, this.fbo[1]), e.bindTexture(e.TEXTURE_2D, this.blurTex[0]), e.uniform2f(this.uBlur.step, 0, t / this.srcH), e.drawArrays(e.TRIANGLE_STRIP, 0, 4), e.bindFramebuffer(e.FRAMEBUFFER, null);
|
|
394
|
+
}
|
|
395
|
+
/** Upload the displacement-map image (call only when the lens SHAPE changes). */
|
|
396
|
+
setDisplacementMap(t) {
|
|
397
|
+
if (this.disposed) return;
|
|
398
|
+
const e = this.gl;
|
|
399
|
+
e.bindTexture(e.TEXTURE_2D, this.dispTex), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, t);
|
|
400
|
+
}
|
|
401
|
+
/** Texture for a per-lens displacement map, uploaded once and cached by the
|
|
402
|
+
* image identity (a lens of a different shape supplies its own map). */
|
|
403
|
+
dispTexFor(t) {
|
|
404
|
+
const e = this.gl;
|
|
405
|
+
let s = this.dispCache.get(t);
|
|
406
|
+
return s || (s = e.createTexture(), e.bindTexture(e.TEXTURE_2D, s), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, t), this.dispCache.set(t, s)), s;
|
|
407
|
+
}
|
|
408
|
+
/** Free a per-lens map texture (its shape is no longer used) so the cache
|
|
409
|
+
* can't grow unbounded as a responsive lens re-keys. */
|
|
410
|
+
releaseDispMap(t) {
|
|
411
|
+
const e = this.dispCache.get(t);
|
|
412
|
+
e && (this.gl.deleteTexture(e), this.dispCache.delete(t));
|
|
413
|
+
}
|
|
414
|
+
/** Size the drawing buffer (CSS px × dpr). */
|
|
415
|
+
resize(t, e) {
|
|
416
|
+
const s = this.gl.canvas;
|
|
417
|
+
(s.width !== t || s.height !== e) && (s.width = t, s.height = e);
|
|
418
|
+
}
|
|
419
|
+
uploadSource(t, e, s) {
|
|
420
|
+
const n = this.gl;
|
|
421
|
+
n.bindTexture(n.TEXTURE_2D, this.srcTex), e !== this.srcW || s !== this.srcH ? (n.texImage2D(n.TEXTURE_2D, 0, n.RGBA, n.RGBA, n.UNSIGNED_BYTE, t), this.srcW = e, this.srcH = s) : n.texSubImage2D(n.TEXTURE_2D, 0, 0, 0, n.RGBA, n.UNSIGNED_BYTE, t);
|
|
422
|
+
}
|
|
423
|
+
/** Upload `source` once and draw every lens over it. */
|
|
424
|
+
render(t, e, s, n) {
|
|
425
|
+
if (this.disposed || e === 0 || s === 0) return;
|
|
426
|
+
const r = this.gl;
|
|
427
|
+
this.uploadSource(t, e, s), r.bindBuffer(r.ARRAY_BUFFER, this.quad), r.enableVertexAttribArray(0), r.vertexAttribPointer(0, 2, r.FLOAT, !1, 0, 0), r.disable(r.BLEND);
|
|
428
|
+
const u = n.reduce((l, i) => Math.max(l, i.blur), 0);
|
|
429
|
+
u > 0 && this.renderFrost(u);
|
|
430
|
+
const h = r.canvas.width, f = r.canvas.height;
|
|
431
|
+
r.viewport(0, 0, h, f), r.useProgram(this.blit), r.activeTexture(r.TEXTURE0), r.bindTexture(r.TEXTURE_2D, this.srcTex), r.uniform1i(this.uBlitSrc, 0), r.drawArrays(r.TRIANGLE_STRIP, 0, 4), r.useProgram(this.lens), r.activeTexture(r.TEXTURE0), r.bindTexture(r.TEXTURE_2D, this.srcTex), r.uniform1i(this.uLens.src, 0), r.activeTexture(r.TEXTURE1), r.bindTexture(r.TEXTURE_2D, this.dispTex), r.uniform1i(this.uLens.disp, 1), r.activeTexture(r.TEXTURE2), r.bindTexture(r.TEXTURE_2D, this.blurTex[1]), r.uniform1i(this.uLens.blur, 2);
|
|
432
|
+
for (const l of n) {
|
|
433
|
+
const i = l.opacity ?? 1;
|
|
434
|
+
i <= 0 || (r.activeTexture(r.TEXTURE1), r.bindTexture(
|
|
435
|
+
r.TEXTURE_2D,
|
|
436
|
+
l.dispMap ? this.dispTexFor(l.dispMap) : this.dispTex
|
|
437
|
+
), r.uniform2f(this.uLens.origin, l.originX, l.originY), r.uniform2f(this.uLens.size, l.sizeX, l.sizeY), r.uniform2f(this.uLens.scale, l.scaleX, l.scaleY), r.uniform2f(this.uLens.lenspx, l.sizeX * h, l.sizeY * f), r.uniform1f(this.uLens.radiuspx, (l.cornerRadius ?? 0) * h), r.uniform1f(this.uLens.dispersion, l.dispersion), r.uniform1f(this.uLens.specular, l.specular), r.uniform1f(this.uLens.frost, l.blur > 0 ? Math.min(1, l.blur / 8) : 0), r.uniform1f(this.uLens.opacity, i), r.uniform1f(this.uLens.brightness, l.brightness ?? 0), r.drawArrays(r.TRIANGLE_STRIP, 0, 4));
|
|
387
438
|
}
|
|
388
|
-
if (c.a > 0 && (s.push(c), c.a >= 1))
|
|
389
|
-
break;
|
|
390
439
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
440
|
+
dispose() {
|
|
441
|
+
if (this.disposed) return;
|
|
442
|
+
this.disposed = !0;
|
|
443
|
+
const t = this.gl;
|
|
444
|
+
t.deleteProgram(this.blit), t.deleteProgram(this.lens), t.deleteProgram(this.blur), t.deleteTexture(this.srcTex), t.deleteTexture(this.dispTex), this.dispCache.forEach((s) => t.deleteTexture(s)), this.dispCache.clear(), t.deleteTexture(this.blurTex[0]), t.deleteTexture(this.blurTex[1]), t.deleteFramebuffer(this.fbo[0]), t.deleteFramebuffer(this.fbo[1]), t.deleteBuffer(this.quad);
|
|
445
|
+
const e = t.getExtension("WEBGL_lose_context");
|
|
446
|
+
e == null || e.loseContext();
|
|
394
447
|
}
|
|
395
|
-
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
const
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
if (o) {
|
|
422
|
-
i((f) => f.sampled ? B : f);
|
|
448
|
+
}, jr = () => typeof window < "u" && window.devicePixelRatio || 1, Jr = (t) => ({
|
|
449
|
+
merged: { ...Jt, ...t.lens },
|
|
450
|
+
lensW: t.lensW,
|
|
451
|
+
lensH: t.lensH,
|
|
452
|
+
radius: t.borderRadius,
|
|
453
|
+
x: t.x,
|
|
454
|
+
y: t.y,
|
|
455
|
+
scale: t.scale ?? 1,
|
|
456
|
+
opacity: t.opacity ?? 1
|
|
457
|
+
}), Qr = (t, e, s, n, r, u) => {
|
|
458
|
+
const [h, f] = Ke(!1), l = o(null), i = o(null), k = n[0], I = o(n);
|
|
459
|
+
I.current = n;
|
|
460
|
+
const m = n.some(
|
|
461
|
+
(S) => xe(S.x) || xe(S.y) || xe(S.lensW) || xe(S.lensH) || S.radius != null && xe(S.radius)
|
|
462
|
+
);
|
|
463
|
+
qe(() => {
|
|
464
|
+
const S = t.current, E = e.current;
|
|
465
|
+
if (!S || !E) return;
|
|
466
|
+
let y;
|
|
467
|
+
try {
|
|
468
|
+
y = new Vr(S);
|
|
469
|
+
} catch (_) {
|
|
470
|
+
typeof console < "u" && console.warn(
|
|
471
|
+
"[liquid-glass] WebGL renderer unavailable, falling back:",
|
|
472
|
+
_
|
|
473
|
+
), f(!0);
|
|
423
474
|
return;
|
|
424
475
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
const f = n.current;
|
|
430
|
-
if (!f)
|
|
431
|
-
return;
|
|
432
|
-
const l = f.getBoundingClientRect(), m = {
|
|
433
|
-
x: l.left + l.width / 2,
|
|
434
|
-
y: l.top + l.height / 2
|
|
435
|
-
}, p = Yn(m, {
|
|
436
|
-
strategy: c.current,
|
|
437
|
-
ignore: f
|
|
438
|
-
});
|
|
439
|
-
g || i(
|
|
440
|
-
(R) => R.sampled === p.sampled && R.luminance === p.luminance && R.scheme === p.scheme ? R : p
|
|
441
|
-
);
|
|
442
|
-
}, h = () => {
|
|
443
|
-
u || (u = requestAnimationFrame(() => {
|
|
444
|
-
u = 0, b();
|
|
445
|
-
}));
|
|
476
|
+
l.current = y;
|
|
477
|
+
const X = Math.min(jr(), r), C = () => {
|
|
478
|
+
const _ = E.clientWidth, W = E.clientHeight;
|
|
479
|
+
S.style.width = `${_}px`, S.style.height = `${W}px`, y.resize(Math.round(_ * X), Math.round(W * X));
|
|
446
480
|
};
|
|
447
|
-
|
|
448
|
-
|
|
481
|
+
C();
|
|
482
|
+
const N = new ResizeObserver(C);
|
|
483
|
+
return N.observe(E), () => {
|
|
484
|
+
N.disconnect(), y.dispose(), l.current = null;
|
|
449
485
|
};
|
|
450
|
-
}, [
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
486
|
+
}, [t, e, r]);
|
|
487
|
+
const d = k.merged, R = Pe(k.lensW), G = Pe(k.lensH), $ = k.radius != null ? Pe(k.radius) : Math.min(R, G), F = JSON.stringify([
|
|
488
|
+
d.mapSize,
|
|
489
|
+
R,
|
|
490
|
+
G,
|
|
491
|
+
$,
|
|
492
|
+
d.depth,
|
|
493
|
+
d.clipToShape,
|
|
494
|
+
d.softEdge,
|
|
495
|
+
d.curvature,
|
|
496
|
+
d.splay,
|
|
497
|
+
d.glow,
|
|
498
|
+
d.glowSpread,
|
|
499
|
+
d.glowFalloff,
|
|
500
|
+
d.sheen,
|
|
501
|
+
d.sheenWidth,
|
|
502
|
+
d.sheenFalloff,
|
|
503
|
+
d.sheenAngle,
|
|
504
|
+
d.bend,
|
|
505
|
+
d.bendWidth
|
|
506
|
+
]);
|
|
507
|
+
oe(() => {
|
|
508
|
+
if (!l.current) return;
|
|
509
|
+
i.current || (i.current = Zt(d.mapSize));
|
|
510
|
+
const E = i.current.generate({
|
|
511
|
+
lensHalfWidth: R,
|
|
512
|
+
lensHalfHeight: G,
|
|
513
|
+
borderRadius: $,
|
|
514
|
+
depth: d.depth,
|
|
515
|
+
clipToShape: d.clipToShape,
|
|
516
|
+
softEdge: d.softEdge,
|
|
517
|
+
sheenAngle: d.sheenAngle,
|
|
518
|
+
glow: d.glow,
|
|
519
|
+
glowSpread: d.glowSpread,
|
|
520
|
+
glowFalloff: d.glowFalloff,
|
|
521
|
+
sheen: d.sheen,
|
|
522
|
+
sheenWidth: d.sheenWidth,
|
|
523
|
+
sheenFalloff: d.sheenFalloff,
|
|
524
|
+
curvature: d.curvature,
|
|
525
|
+
splay: d.splay,
|
|
526
|
+
bend: d.bend,
|
|
527
|
+
bendWidth: d.bendWidth
|
|
528
|
+
});
|
|
529
|
+
let y = !1;
|
|
530
|
+
const X = new Image();
|
|
531
|
+
return X.onload = () => {
|
|
532
|
+
var C;
|
|
533
|
+
y || (C = l.current) == null || C.setDisplacementMap(X);
|
|
534
|
+
}, X.src = E, () => {
|
|
535
|
+
y = !0;
|
|
461
536
|
};
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
|
|
537
|
+
}, [F, h]);
|
|
538
|
+
const Y = (S) => {
|
|
539
|
+
const E = S.merged, y = Pe(S.lensW), X = Pe(S.lensH), C = S.radius != null ? Pe(S.radius) : Math.min(y, X);
|
|
540
|
+
return JSON.stringify([
|
|
541
|
+
E.mapSize,
|
|
542
|
+
y,
|
|
543
|
+
X,
|
|
544
|
+
C,
|
|
545
|
+
E.depth,
|
|
546
|
+
E.clipToShape,
|
|
547
|
+
E.softEdge,
|
|
548
|
+
E.curvature,
|
|
549
|
+
E.splay,
|
|
550
|
+
E.glow,
|
|
551
|
+
E.glowSpread,
|
|
552
|
+
E.glowFalloff,
|
|
553
|
+
E.sheen,
|
|
554
|
+
E.sheenWidth,
|
|
555
|
+
E.sheenFalloff,
|
|
556
|
+
E.sheenAngle,
|
|
557
|
+
E.bend,
|
|
558
|
+
E.bendWidth
|
|
559
|
+
]);
|
|
560
|
+
}, H = n.map(Y), x = o(H);
|
|
561
|
+
x.current = H;
|
|
562
|
+
const K = o(/* @__PURE__ */ new Map()), O = H.join("|");
|
|
563
|
+
return oe(() => {
|
|
564
|
+
const S = i.current;
|
|
565
|
+
if (!S) return;
|
|
566
|
+
const E = new Set(x.current);
|
|
567
|
+
K.current.forEach((N, _) => {
|
|
568
|
+
var W;
|
|
569
|
+
E.has(_) || (K.current.delete(_), (W = l.current) == null || W.releaseDispMap(N));
|
|
570
|
+
});
|
|
571
|
+
const y = x.current[0], X = [], C = /* @__PURE__ */ new Set();
|
|
572
|
+
return n.forEach((N, _) => {
|
|
573
|
+
const W = x.current[_];
|
|
574
|
+
if (W === y || C.has(W) || K.current.has(W))
|
|
492
575
|
return;
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
576
|
+
C.add(W);
|
|
577
|
+
const B = N.merged, c = Pe(N.lensW), V = Pe(N.lensH), J = N.radius != null ? Pe(N.radius) : Math.min(c, V), M = S.generate({
|
|
578
|
+
lensHalfWidth: c,
|
|
579
|
+
lensHalfHeight: V,
|
|
580
|
+
borderRadius: J,
|
|
581
|
+
depth: B.depth,
|
|
582
|
+
clipToShape: B.clipToShape,
|
|
583
|
+
softEdge: B.softEdge,
|
|
584
|
+
sheenAngle: B.sheenAngle,
|
|
585
|
+
glow: B.glow,
|
|
586
|
+
glowSpread: B.glowSpread,
|
|
587
|
+
glowFalloff: B.glowFalloff,
|
|
588
|
+
sheen: B.sheen,
|
|
589
|
+
sheenWidth: B.sheenWidth,
|
|
590
|
+
sheenFalloff: B.sheenFalloff,
|
|
591
|
+
curvature: B.curvature,
|
|
592
|
+
splay: B.splay,
|
|
593
|
+
bend: B.bend,
|
|
594
|
+
bendWidth: B.bendWidth
|
|
595
|
+
});
|
|
596
|
+
let T = !1;
|
|
597
|
+
const q = new Image();
|
|
598
|
+
q.onload = () => {
|
|
599
|
+
T || K.current.set(W, q);
|
|
600
|
+
}, q.src = M, X.push(() => {
|
|
601
|
+
T = !0;
|
|
498
602
|
});
|
|
603
|
+
}), () => X.forEach((N) => N());
|
|
604
|
+
}, [O, h]), oe(
|
|
605
|
+
() => () => {
|
|
606
|
+
var S;
|
|
607
|
+
(S = i.current) == null || S.dispose(), i.current = null;
|
|
608
|
+
},
|
|
609
|
+
[]
|
|
610
|
+
), oe(() => {
|
|
611
|
+
if (h) return;
|
|
612
|
+
let S = 0, E = 0;
|
|
613
|
+
const y = u, X = !!y && !m && typeof y.requestVideoFrameCallback == "function", C = () => {
|
|
614
|
+
const N = l.current, _ = e.current;
|
|
615
|
+
if (!N || !_) return;
|
|
616
|
+
const W = s();
|
|
617
|
+
if (W && W.w > 0 && W.h > 0) {
|
|
618
|
+
const B = _.clientWidth, c = _.clientHeight, V = Math.sqrt((B * B + c * c) / 2), J = x.current, M = I.current.map((T, q) => {
|
|
619
|
+
const re = Pe(T.lensW), ue = Pe(T.lensH), ne = T.radius != null ? Pe(T.radius) : Math.min(re, ue), ee = Pe(T.x), ge = Pe(T.y), me = re * T.scale, ye = ue * T.scale, D = q > 0 && J[q] !== J[0], j = D ? K.current.get(J[q]) : void 0, g = D && !j;
|
|
620
|
+
return {
|
|
621
|
+
originX: (ee * B - me) / B,
|
|
622
|
+
originY: 1 - (ge * c + ye) / c,
|
|
623
|
+
sizeX: 2 * me / B,
|
|
624
|
+
sizeY: 2 * ye / c,
|
|
625
|
+
scaleX: g ? 0 : (T.merged.scaleX ?? T.merged.strength) * V / B,
|
|
626
|
+
scaleY: g ? 0 : (T.merged.scaleY ?? T.merged.strength) * V / c,
|
|
627
|
+
dispersion: T.merged.dispersion,
|
|
628
|
+
specular: T.merged.specular,
|
|
629
|
+
blur: T.merged.frost,
|
|
630
|
+
cornerRadius: ne * T.scale / B,
|
|
631
|
+
opacity: T.opacity,
|
|
632
|
+
brightness: T.merged.brightness,
|
|
633
|
+
dispMap: j
|
|
634
|
+
};
|
|
635
|
+
});
|
|
636
|
+
N.render(W.source, W.w, W.h, M);
|
|
637
|
+
}
|
|
638
|
+
X ? E = y.requestVideoFrameCallback(C) : S = requestAnimationFrame(C);
|
|
499
639
|
};
|
|
500
|
-
return
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
640
|
+
return X ? E = y.requestVideoFrameCallback(C) : S = requestAnimationFrame(C), () => {
|
|
641
|
+
var N;
|
|
642
|
+
cancelAnimationFrame(S), X && E && ((N = y.cancelVideoFrameCallback) == null || N.call(y, E));
|
|
643
|
+
};
|
|
644
|
+
}, [h, s, e, u, m]), h;
|
|
645
|
+
}, Zr = ({
|
|
646
|
+
src: t,
|
|
647
|
+
draw: e,
|
|
648
|
+
poster: s,
|
|
649
|
+
loop: n = !0,
|
|
650
|
+
muted: r = !0,
|
|
651
|
+
autoPlay: u = !0,
|
|
652
|
+
crossOrigin: h,
|
|
653
|
+
paused: f,
|
|
654
|
+
videoRef: l,
|
|
655
|
+
lenses: i,
|
|
656
|
+
width: k,
|
|
657
|
+
height: I,
|
|
658
|
+
lens: m,
|
|
659
|
+
lensW: d = 90,
|
|
660
|
+
lensH: R = 90,
|
|
661
|
+
borderRadius: G,
|
|
662
|
+
x: $ = 0.5,
|
|
663
|
+
y: F = 0.5,
|
|
664
|
+
maxDpr: Y = 1.5,
|
|
665
|
+
className: H,
|
|
666
|
+
style: x,
|
|
667
|
+
children: K
|
|
668
|
+
}) => {
|
|
669
|
+
const O = t != null, S = o(null), E = o(null), y = o(null), [X, C] = Ke(null), N = Vt.useCallback(
|
|
670
|
+
(M) => {
|
|
671
|
+
y.current = M, typeof l == "function" ? l(M) : l && (l.current = M);
|
|
672
|
+
},
|
|
673
|
+
[l]
|
|
674
|
+
), _ = o(null), W = o(e);
|
|
675
|
+
W.current = e;
|
|
676
|
+
const B = o(0);
|
|
677
|
+
!O && !_.current && typeof document < "u" && (_.current = document.createElement("canvas"));
|
|
678
|
+
const c = (i && i.length ? i.map((M) => ({
|
|
679
|
+
// Per-lens optics override the shared look (runtime knobs only — the
|
|
680
|
+
// shared MAP shape comes from lens 0; see GlassSurfaceLens.optics).
|
|
681
|
+
lens: M.optics ? { ...m, ...M.optics } : m,
|
|
682
|
+
lensW: M.w / 2,
|
|
683
|
+
lensH: M.h / 2,
|
|
684
|
+
borderRadius: M.radius,
|
|
685
|
+
x: M.x,
|
|
686
|
+
y: M.y,
|
|
687
|
+
scale: M.scale,
|
|
688
|
+
opacity: M.opacity
|
|
689
|
+
})) : [{ lens: m, lensW: d, lensH: R, borderRadius: G, x: $, y: F }]).map(Jr);
|
|
690
|
+
oe(() => {
|
|
691
|
+
O && C(y.current);
|
|
692
|
+
}, [O]), oe(() => {
|
|
693
|
+
const M = y.current;
|
|
694
|
+
!O || !M || f === void 0 || (f ? M.pause() : M.play().catch(() => {
|
|
695
|
+
}));
|
|
696
|
+
}, [O, f]);
|
|
697
|
+
const V = Vt.useCallback(() => {
|
|
698
|
+
if (O) {
|
|
699
|
+
const ne = y.current;
|
|
700
|
+
return !ne || ne.readyState < 2 ? null : { source: ne, w: ne.videoWidth, h: ne.videoHeight };
|
|
516
701
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
702
|
+
const M = _.current, T = S.current;
|
|
703
|
+
if (!M || !T || !W.current) return null;
|
|
704
|
+
const q = k ?? Math.round(T.clientWidth), re = I ?? Math.round(T.clientHeight);
|
|
705
|
+
if (q === 0 || re === 0) return null;
|
|
706
|
+
(M.width !== q || M.height !== re) && (M.width = q, M.height = re);
|
|
707
|
+
const ue = M.getContext("2d");
|
|
708
|
+
return ue ? (B.current === 0 && (B.current = performance.now()), W.current(ue, performance.now() - B.current), { source: M, w: q, h: re }) : null;
|
|
709
|
+
}, [O, k, I]), J = Qr(
|
|
710
|
+
E,
|
|
711
|
+
S,
|
|
712
|
+
V,
|
|
713
|
+
c,
|
|
714
|
+
Y,
|
|
715
|
+
O ? X : null
|
|
716
|
+
);
|
|
717
|
+
return /* @__PURE__ */ te(
|
|
718
|
+
"div",
|
|
719
|
+
{
|
|
720
|
+
ref: S,
|
|
721
|
+
className: H,
|
|
722
|
+
style: { position: "relative", overflow: "hidden", ...x },
|
|
723
|
+
children: [
|
|
724
|
+
O && /* @__PURE__ */ a(
|
|
725
|
+
"video",
|
|
726
|
+
{
|
|
727
|
+
ref: N,
|
|
728
|
+
src: t,
|
|
729
|
+
poster: s,
|
|
730
|
+
loop: n,
|
|
731
|
+
muted: r,
|
|
732
|
+
autoPlay: u,
|
|
733
|
+
playsInline: !0,
|
|
734
|
+
crossOrigin: h,
|
|
735
|
+
style: {
|
|
736
|
+
position: "absolute",
|
|
737
|
+
inset: 0,
|
|
738
|
+
width: "100%",
|
|
739
|
+
height: "100%",
|
|
740
|
+
objectFit: "cover",
|
|
741
|
+
// Hidden behind the (opaque) output canvas when WebGL works; shown as
|
|
742
|
+
// the graceful fallback when it doesn't.
|
|
743
|
+
visibility: J ? "visible" : "hidden"
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
),
|
|
747
|
+
/* @__PURE__ */ a(
|
|
748
|
+
"canvas",
|
|
749
|
+
{
|
|
750
|
+
ref: E,
|
|
751
|
+
style: {
|
|
752
|
+
position: "absolute",
|
|
753
|
+
inset: 0,
|
|
754
|
+
pointerEvents: "none",
|
|
755
|
+
display: J ? "none" : "block"
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
),
|
|
759
|
+
!O && J && /* @__PURE__ */ a(
|
|
760
|
+
"div",
|
|
761
|
+
{
|
|
762
|
+
style: {
|
|
763
|
+
position: "absolute",
|
|
764
|
+
inset: 0,
|
|
765
|
+
display: "grid",
|
|
766
|
+
placeItems: "center",
|
|
767
|
+
color: "#888",
|
|
768
|
+
font: "13px system-ui"
|
|
769
|
+
},
|
|
770
|
+
children: "WebGL unavailable"
|
|
771
|
+
}
|
|
772
|
+
),
|
|
773
|
+
K != null && /* @__PURE__ */ a("div", { style: { position: "absolute", inset: 0 }, children: K })
|
|
774
|
+
]
|
|
775
|
+
}
|
|
776
|
+
);
|
|
777
|
+
}, en = () => {
|
|
778
|
+
const [t, e] = Ke(!1);
|
|
779
|
+
return oe(() => {
|
|
780
|
+
if (typeof navigator > "u") return;
|
|
781
|
+
const s = navigator.userAgent, r = navigator.userAgentData != null || /\b(?:Chrome|Chromium|Edg)\//.test(s) && !/\b(?:CriOS|EdgiOS|FxiOS|OPiOS)\b/.test(s) && !/iPhone|iPad|iPod/.test(s);
|
|
782
|
+
e(r);
|
|
783
|
+
}, []), t;
|
|
784
|
+
}, tn = {
|
|
785
|
+
strength: 0.05,
|
|
786
|
+
depth: 0.5,
|
|
787
|
+
curvature: 0.3,
|
|
788
|
+
bend: 0.45,
|
|
789
|
+
bendWidth: 0.16,
|
|
790
|
+
dispersion: 0.32,
|
|
791
|
+
frost: 6,
|
|
792
|
+
saturate: 1.15,
|
|
793
|
+
sheen: 0.32,
|
|
794
|
+
sheenWidth: 3,
|
|
795
|
+
sheenFalloff: 1.5,
|
|
796
|
+
glow: 0.1,
|
|
797
|
+
glowSpread: 1,
|
|
798
|
+
glowFalloff: 0.5,
|
|
799
|
+
specular: 1,
|
|
800
|
+
sheenAngle: 45,
|
|
801
|
+
brightness: 0
|
|
802
|
+
}, rn = ({
|
|
803
|
+
dispScale: t,
|
|
804
|
+
dispersion: e,
|
|
805
|
+
specular: s,
|
|
806
|
+
hasSpecular: n,
|
|
807
|
+
mapMatrix: r,
|
|
808
|
+
width: u,
|
|
809
|
+
height: h,
|
|
810
|
+
mapUrl: f,
|
|
811
|
+
feImageRef: l
|
|
812
|
+
}) => {
|
|
813
|
+
const i = r ? "scaledMap" : "map";
|
|
814
|
+
return /* @__PURE__ */ te(ot, { children: [
|
|
815
|
+
/* @__PURE__ */ a("feFlood", { floodColor: "rgb(128,128,128)", floodOpacity: "1", result: "mapBg" }),
|
|
816
|
+
/* @__PURE__ */ a(
|
|
817
|
+
"feImage",
|
|
569
818
|
{
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
819
|
+
ref: l,
|
|
820
|
+
href: f || void 0,
|
|
821
|
+
x: 0,
|
|
822
|
+
y: 0,
|
|
823
|
+
width: u,
|
|
824
|
+
height: h,
|
|
825
|
+
preserveAspectRatio: "none",
|
|
826
|
+
result: "rawMap"
|
|
575
827
|
}
|
|
576
828
|
),
|
|
577
|
-
/* @__PURE__ */
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
829
|
+
/* @__PURE__ */ a("feComposite", { in: "rawMap", in2: "mapBg", operator: "over", result: "map" }),
|
|
830
|
+
r && /* @__PURE__ */ a(
|
|
831
|
+
"feColorMatrix",
|
|
832
|
+
{
|
|
833
|
+
in: "map",
|
|
834
|
+
type: "matrix",
|
|
835
|
+
values: r,
|
|
836
|
+
result: "scaledMap"
|
|
837
|
+
}
|
|
838
|
+
),
|
|
839
|
+
e > 0 ? /* @__PURE__ */ te(ot, { children: [
|
|
840
|
+
/* @__PURE__ */ a(
|
|
841
|
+
"feDisplacementMap",
|
|
842
|
+
{
|
|
843
|
+
in: "SourceGraphic",
|
|
844
|
+
in2: i,
|
|
845
|
+
scale: t * (1 + ht * e),
|
|
846
|
+
xChannelSelector: "R",
|
|
847
|
+
yChannelSelector: "G"
|
|
848
|
+
}
|
|
849
|
+
),
|
|
850
|
+
/* @__PURE__ */ a(
|
|
851
|
+
"feColorMatrix",
|
|
852
|
+
{
|
|
853
|
+
type: "matrix",
|
|
854
|
+
values: "1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0",
|
|
855
|
+
result: "refractR"
|
|
856
|
+
}
|
|
857
|
+
),
|
|
858
|
+
/* @__PURE__ */ a(
|
|
593
859
|
"feDisplacementMap",
|
|
594
860
|
{
|
|
595
861
|
in: "SourceGraphic",
|
|
596
|
-
in2:
|
|
597
|
-
scale:
|
|
862
|
+
in2: i,
|
|
863
|
+
scale: t * (1 + ht * 0.5 * e),
|
|
598
864
|
xChannelSelector: "R",
|
|
599
|
-
yChannelSelector: "
|
|
600
|
-
result: `${v}_disp`
|
|
865
|
+
yChannelSelector: "G"
|
|
601
866
|
}
|
|
602
867
|
),
|
|
603
|
-
/* @__PURE__ */
|
|
868
|
+
/* @__PURE__ */ a(
|
|
604
869
|
"feColorMatrix",
|
|
605
870
|
{
|
|
606
|
-
in: `${v}_disp`,
|
|
607
871
|
type: "matrix",
|
|
608
|
-
values:
|
|
609
|
-
result:
|
|
872
|
+
values: "0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0",
|
|
873
|
+
result: "refractG"
|
|
874
|
+
}
|
|
875
|
+
),
|
|
876
|
+
/* @__PURE__ */ a(
|
|
877
|
+
"feDisplacementMap",
|
|
878
|
+
{
|
|
879
|
+
in: "SourceGraphic",
|
|
880
|
+
in2: i,
|
|
881
|
+
scale: t,
|
|
882
|
+
xChannelSelector: "R",
|
|
883
|
+
yChannelSelector: "G"
|
|
884
|
+
}
|
|
885
|
+
),
|
|
886
|
+
/* @__PURE__ */ a(
|
|
887
|
+
"feColorMatrix",
|
|
888
|
+
{
|
|
889
|
+
type: "matrix",
|
|
890
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0",
|
|
891
|
+
result: "refractB"
|
|
892
|
+
}
|
|
893
|
+
),
|
|
894
|
+
/* @__PURE__ */ a(
|
|
895
|
+
"feComposite",
|
|
896
|
+
{
|
|
897
|
+
in: "refractR",
|
|
898
|
+
in2: "refractG",
|
|
899
|
+
operator: "arithmetic",
|
|
900
|
+
k1: "0",
|
|
901
|
+
k2: "1",
|
|
902
|
+
k3: "1",
|
|
903
|
+
k4: "0",
|
|
904
|
+
result: "refractRG"
|
|
905
|
+
}
|
|
906
|
+
),
|
|
907
|
+
/* @__PURE__ */ a(
|
|
908
|
+
"feComposite",
|
|
909
|
+
{
|
|
910
|
+
in: "refractRG",
|
|
911
|
+
in2: "refractB",
|
|
912
|
+
operator: "arithmetic",
|
|
913
|
+
k1: "0",
|
|
914
|
+
k2: "1",
|
|
915
|
+
k3: "1",
|
|
916
|
+
k4: "0",
|
|
917
|
+
result: "lensOut"
|
|
610
918
|
}
|
|
611
919
|
)
|
|
612
|
-
] })
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
920
|
+
] }) : /* @__PURE__ */ a(
|
|
921
|
+
"feDisplacementMap",
|
|
922
|
+
{
|
|
923
|
+
in: "SourceGraphic",
|
|
924
|
+
in2: i,
|
|
925
|
+
scale: t,
|
|
926
|
+
xChannelSelector: "R",
|
|
927
|
+
yChannelSelector: "G",
|
|
928
|
+
result: "lensOut"
|
|
929
|
+
}
|
|
930
|
+
),
|
|
931
|
+
n && /* @__PURE__ */ te(ot, { children: [
|
|
932
|
+
/* @__PURE__ */ a(
|
|
933
|
+
"feColorMatrix",
|
|
623
934
|
{
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
935
|
+
in: "map",
|
|
936
|
+
type: "matrix",
|
|
937
|
+
values: `0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 1 0 ${-128 / 255}`,
|
|
938
|
+
result: "sheenMask"
|
|
939
|
+
}
|
|
940
|
+
),
|
|
941
|
+
/* @__PURE__ */ a(
|
|
942
|
+
"feComposite",
|
|
943
|
+
{
|
|
944
|
+
in: "sheenMask",
|
|
945
|
+
in2: "lensOut",
|
|
946
|
+
operator: "arithmetic",
|
|
947
|
+
k1: "0",
|
|
948
|
+
k2: s,
|
|
949
|
+
k3: "1",
|
|
950
|
+
k4: "0"
|
|
951
|
+
}
|
|
952
|
+
)
|
|
953
|
+
] })
|
|
954
|
+
] });
|
|
955
|
+
}, Yt = (t) => t == null ? void 0 : xe(t) ? Pe(t) : t, nn = ({
|
|
956
|
+
children: t,
|
|
957
|
+
optics: e,
|
|
958
|
+
radius: s,
|
|
959
|
+
width: n,
|
|
960
|
+
height: r,
|
|
961
|
+
className: u,
|
|
962
|
+
style: h,
|
|
963
|
+
...f
|
|
964
|
+
}) => {
|
|
965
|
+
const l = en(), i = ft(
|
|
966
|
+
() => ({ ...Jt, ...tn, ...e }),
|
|
967
|
+
[e]
|
|
968
|
+
), k = jt().replace(/:/g, ""), I = o(null), m = o(null), d = o(null), R = o(
|
|
969
|
+
null
|
|
970
|
+
), G = o(""), $ = o(0), [F, Y] = Ke({
|
|
971
|
+
w: 0,
|
|
972
|
+
h: 0,
|
|
973
|
+
r: 0,
|
|
974
|
+
appliedR: void 0
|
|
975
|
+
}), [H, x] = Ke(!1), K = F.w > 0 && F.h > 0, O = Yt(s), S = Yt(n), E = Yt(r), y = (h == null ? void 0 : h.borderRadius) != null, X = o(!1);
|
|
976
|
+
qe(() => {
|
|
977
|
+
X.current = !1;
|
|
978
|
+
}, [O, y, u]), qe(() => {
|
|
979
|
+
const D = I.current;
|
|
980
|
+
if (!D) return;
|
|
981
|
+
const j = () => {
|
|
982
|
+
const Q = D.getBoundingClientRect(), se = typeof getComputedStyle < "u", A = se ? getComputedStyle(D) : null, De = A && parseFloat(A.borderTopLeftRadius) || 0;
|
|
983
|
+
if (A) {
|
|
984
|
+
const Z = A.position;
|
|
985
|
+
x(
|
|
986
|
+
(Re) => Z === "static" ? !0 : Z === "relative" ? Re : !1
|
|
987
|
+
);
|
|
988
|
+
}
|
|
989
|
+
let ve, P;
|
|
990
|
+
if (O != null)
|
|
991
|
+
ve = O, P = O;
|
|
992
|
+
else if (y || De > 0 && !X.current)
|
|
993
|
+
ve = De, P = void 0;
|
|
994
|
+
else {
|
|
995
|
+
let Z = D.firstElementChild;
|
|
996
|
+
for (; Z && Z.hasAttribute("data-lg-layer"); )
|
|
997
|
+
Z = Z.nextElementSibling;
|
|
998
|
+
const Re = Z && se && parseFloat(getComputedStyle(Z).borderTopLeftRadius) || 0;
|
|
999
|
+
ve = Re, P = Re, X.current = !0;
|
|
1000
|
+
}
|
|
1001
|
+
Y(
|
|
1002
|
+
(Z) => Z.w === Q.width && Z.h === Q.height && Z.r === ve && Z.appliedR === P ? Z : { w: Q.width, h: Q.height, r: ve, appliedR: P }
|
|
1003
|
+
);
|
|
1004
|
+
};
|
|
1005
|
+
j();
|
|
1006
|
+
const g = new ResizeObserver(j);
|
|
1007
|
+
return g.observe(D), window.addEventListener("resize", j), () => {
|
|
1008
|
+
g.disconnect(), window.removeEventListener("resize", j);
|
|
1009
|
+
};
|
|
1010
|
+
}, [O, y, u]);
|
|
1011
|
+
const C = JSON.stringify([
|
|
1012
|
+
F.w,
|
|
1013
|
+
F.h,
|
|
1014
|
+
F.r,
|
|
1015
|
+
i.mapSize,
|
|
1016
|
+
i.clipToShape,
|
|
1017
|
+
i.softEdge,
|
|
1018
|
+
i.depth,
|
|
1019
|
+
i.curvature,
|
|
1020
|
+
i.splay,
|
|
1021
|
+
i.bend,
|
|
1022
|
+
i.bendWidth,
|
|
1023
|
+
i.sheen,
|
|
1024
|
+
i.sheenWidth,
|
|
1025
|
+
i.sheenFalloff,
|
|
1026
|
+
i.sheenAngle,
|
|
1027
|
+
i.glow,
|
|
1028
|
+
i.glowSpread,
|
|
1029
|
+
i.glowFalloff
|
|
1030
|
+
]), N = i.scaleX ?? i.strength, _ = i.scaleY ?? i.strength, W = Math.max(N, _), B = K ? Math.sqrt((F.w * F.w + F.h * F.h) / 2) : 0, c = W * B, V = K ? Math.ceil(c * (i.dispersion > 0 ? 1.2 : 1) * 0.5 + 28) : 0, J = W > 0 ? N / W : 1, M = W > 0 ? _ / W : 1, T = J === 1 && M === 1 ? null : Qt(J, M), q = i.glow > 0 || i.sheen > 0;
|
|
1031
|
+
qe(() => {
|
|
1032
|
+
var g, Q;
|
|
1033
|
+
if (!K) return;
|
|
1034
|
+
const D = i.mapSize;
|
|
1035
|
+
(!R.current || R.current.size !== D) && ((g = R.current) == null || g.gen.dispose(), R.current = {
|
|
1036
|
+
gen: Zt(D),
|
|
1037
|
+
size: D
|
|
1038
|
+
});
|
|
1039
|
+
const j = R.current.gen.generate({
|
|
1040
|
+
lensHalfWidth: F.w / 2,
|
|
1041
|
+
lensHalfHeight: F.h / 2,
|
|
1042
|
+
borderRadius: F.r,
|
|
1043
|
+
depth: i.depth,
|
|
1044
|
+
clipToShape: i.clipToShape,
|
|
1045
|
+
softEdge: i.softEdge,
|
|
1046
|
+
sheenAngle: i.sheenAngle,
|
|
1047
|
+
glow: i.glow,
|
|
1048
|
+
glowSpread: i.glowSpread,
|
|
1049
|
+
glowFalloff: i.glowFalloff,
|
|
1050
|
+
sheen: i.sheen,
|
|
1051
|
+
sheenWidth: i.sheenWidth,
|
|
1052
|
+
sheenFalloff: i.sheenFalloff,
|
|
1053
|
+
curvature: i.curvature,
|
|
1054
|
+
splay: i.splay,
|
|
1055
|
+
bend: i.bend,
|
|
1056
|
+
bendWidth: i.bendWidth
|
|
1057
|
+
});
|
|
1058
|
+
G.current = j, (Q = d.current) == null || Q.setAttribute("href", j), re();
|
|
1059
|
+
}, [K, C]);
|
|
1060
|
+
const re = ft(
|
|
1061
|
+
() => () => {
|
|
1062
|
+
const D = I.current, j = m.current;
|
|
1063
|
+
if (!D) return;
|
|
1064
|
+
const g = Math.max(0, i.frost), Q = i.saturate ?? 1, se = [
|
|
1065
|
+
g > 0 ? `blur(${g}px)` : "",
|
|
1066
|
+
Q !== 1 ? `saturate(${Q})` : ""
|
|
1067
|
+
].filter(Boolean).join(" ");
|
|
1068
|
+
let A = se || "none";
|
|
1069
|
+
l && j && G.current && ($.current += 1, j.id = `lg-mat-${k}-v${$.current}`, A = `${se ? se + " " : ""}url(#${j.id})`), D.style.backdropFilter = A, D.style.setProperty("-webkit-backdrop-filter", A);
|
|
1070
|
+
},
|
|
1071
|
+
[i.frost, i.saturate, l, k]
|
|
1072
|
+
);
|
|
1073
|
+
oe(() => {
|
|
1074
|
+
K && re();
|
|
1075
|
+
}, [
|
|
1076
|
+
K,
|
|
1077
|
+
re,
|
|
1078
|
+
i.dispersion,
|
|
1079
|
+
i.strength,
|
|
1080
|
+
i.scaleX,
|
|
1081
|
+
i.scaleY,
|
|
1082
|
+
i.specular
|
|
1083
|
+
]), oe(
|
|
1084
|
+
() => () => {
|
|
1085
|
+
var D;
|
|
1086
|
+
(D = R.current) == null || D.gen.dispose(), R.current = null;
|
|
1087
|
+
},
|
|
1088
|
+
[]
|
|
1089
|
+
);
|
|
1090
|
+
const ue = o(!1);
|
|
1091
|
+
oe(() => {
|
|
1092
|
+
if (ue.current || !K || typeof getComputedStyle > "u" || typeof document > "u")
|
|
1093
|
+
return;
|
|
1094
|
+
const D = I.current;
|
|
1095
|
+
if (!D) return;
|
|
1096
|
+
const j = getComputedStyle(D).backgroundColor;
|
|
1097
|
+
let g = !1;
|
|
1098
|
+
try {
|
|
1099
|
+
const Q = document.createElement("canvas");
|
|
1100
|
+
Q.width = Q.height = 1;
|
|
1101
|
+
const se = Q.getContext("2d");
|
|
1102
|
+
se && (se.clearRect(0, 0, 1, 1), se.fillStyle = j, se.fillRect(0, 0, 1, 1), g = se.getImageData(0, 0, 1, 1).data[3] === 255);
|
|
1103
|
+
} catch {
|
|
1104
|
+
g = !1;
|
|
1105
|
+
}
|
|
1106
|
+
g && typeof console < "u" && (console.warn(
|
|
1107
|
+
"[liquid-glass] <Glass>: the wrapper's background is fully opaque, so it hides the refraction (no glass shows through). Give it an alpha (e.g. `bg-red-400/40` / `rgba(...,0.4)`). (An opaque `background-image` — a solid gradient or photo — hides it the same way.)"
|
|
1108
|
+
), ue.current = !0);
|
|
1109
|
+
}, [K]);
|
|
1110
|
+
const ne = ft(() => {
|
|
1111
|
+
const D = Math.max(0, Math.min(1.5, i.specular));
|
|
1112
|
+
return [
|
|
1113
|
+
`inset 0 1px 0 rgba(255,255,255,${(0.55 * D).toFixed(3)})`,
|
|
1114
|
+
`inset 0 0 0 1px rgba(255,255,255,${(0.12 * D).toFixed(3)})`
|
|
1115
|
+
].join(", ");
|
|
1116
|
+
}, [i.specular]), ee = h == null ? void 0 : h.position, me = ee != null && ee !== "static" && ee !== "unset" && ee !== "initial" ? ee : H ? "relative" : void 0, ye = i.brightness !== 0 ? /* @__PURE__ */ a(
|
|
1117
|
+
"div",
|
|
1118
|
+
{
|
|
1119
|
+
"aria-hidden": !0,
|
|
1120
|
+
"data-lg-layer": "",
|
|
1121
|
+
style: {
|
|
1122
|
+
position: "absolute",
|
|
1123
|
+
inset: 0,
|
|
1124
|
+
pointerEvents: "none",
|
|
1125
|
+
borderRadius: "inherit",
|
|
1126
|
+
background: i.brightness > 0 ? "#fff" : "#000",
|
|
1127
|
+
opacity: Math.min(1, Math.abs(i.brightness))
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
) : null;
|
|
1131
|
+
return /* @__PURE__ */ te(
|
|
1132
|
+
"div",
|
|
1133
|
+
{
|
|
1134
|
+
ref: I,
|
|
1135
|
+
"data-liquid-glass": "material",
|
|
1136
|
+
className: u,
|
|
1137
|
+
style: {
|
|
1138
|
+
// Shrink-wrap the content by default (a button-sized pill, matching the
|
|
1139
|
+
// acceptance examples) yet still honour a className/style/Tailwind width:
|
|
1140
|
+
// an inline-block box sizes to its content but obeys an explicit width
|
|
1141
|
+
// (unlike `width: fit-content`, which an inline style would pin past a
|
|
1142
|
+
// className). `style` / the `width`/`height` props win over all of it.
|
|
1143
|
+
display: "inline-block",
|
|
1144
|
+
...h,
|
|
1145
|
+
// Conditional so an `undefined` (className positions it) never strips the
|
|
1146
|
+
// user's own `style.position`.
|
|
1147
|
+
...me != null ? { position: me } : null,
|
|
1148
|
+
...S != null ? { width: S } : null,
|
|
1149
|
+
...E != null ? { height: E } : null,
|
|
1150
|
+
// Round the wrapper from the prop / adopted child radius (when the user
|
|
1151
|
+
// gave the box none); a className/style radius is left to the user's CSS.
|
|
1152
|
+
...F.appliedR != null ? { borderRadius: F.appliedR } : null
|
|
1153
|
+
},
|
|
1154
|
+
...f,
|
|
1155
|
+
children: [
|
|
1156
|
+
ye,
|
|
1157
|
+
t,
|
|
1158
|
+
/* @__PURE__ */ a(
|
|
1159
|
+
"div",
|
|
1160
|
+
{
|
|
1161
|
+
"aria-hidden": !0,
|
|
1162
|
+
"data-lg-layer": "",
|
|
1163
|
+
style: {
|
|
1164
|
+
position: "absolute",
|
|
1165
|
+
inset: 0,
|
|
1166
|
+
pointerEvents: "none",
|
|
1167
|
+
borderRadius: "inherit",
|
|
1168
|
+
boxShadow: ne
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
),
|
|
1172
|
+
/* @__PURE__ */ a(
|
|
1173
|
+
"svg",
|
|
1174
|
+
{
|
|
1175
|
+
"aria-hidden": !0,
|
|
1176
|
+
"data-lg-layer": "",
|
|
1177
|
+
width: 0,
|
|
1178
|
+
height: 0,
|
|
1179
|
+
style: { position: "absolute", width: 0, height: 0 },
|
|
1180
|
+
children: /* @__PURE__ */ a("defs", { children: /* @__PURE__ */ a(
|
|
1181
|
+
"filter",
|
|
671
1182
|
{
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
1183
|
+
ref: m,
|
|
1184
|
+
id: `lg-mat-${k}-v0`,
|
|
1185
|
+
filterUnits: "userSpaceOnUse",
|
|
1186
|
+
primitiveUnits: "userSpaceOnUse",
|
|
1187
|
+
colorInterpolationFilters: "sRGB",
|
|
1188
|
+
x: -V,
|
|
1189
|
+
y: -V,
|
|
1190
|
+
width: F.w + 2 * V,
|
|
1191
|
+
height: F.h + 2 * V,
|
|
1192
|
+
children: K && /* @__PURE__ */ a(
|
|
1193
|
+
rn,
|
|
1194
|
+
{
|
|
1195
|
+
dispScale: c,
|
|
1196
|
+
dispersion: i.dispersion,
|
|
1197
|
+
specular: i.specular,
|
|
1198
|
+
hasSpecular: q,
|
|
1199
|
+
mapMatrix: T,
|
|
1200
|
+
width: F.w,
|
|
1201
|
+
height: F.h,
|
|
1202
|
+
mapUrl: G.current || "",
|
|
1203
|
+
feImageRef: d
|
|
1204
|
+
}
|
|
1205
|
+
)
|
|
679
1206
|
}
|
|
680
|
-
)
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
/* @__PURE__ */ d("feColorMatrix", { in: "blurred", type: "saturate", values: `${i / 100}` })
|
|
685
|
-
]
|
|
686
|
-
}
|
|
687
|
-
) })
|
|
1207
|
+
) })
|
|
1208
|
+
}
|
|
1209
|
+
)
|
|
1210
|
+
]
|
|
688
1211
|
}
|
|
689
1212
|
);
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
1213
|
+
}, sn = () => {
|
|
1214
|
+
const [t, e] = Ke(!1);
|
|
1215
|
+
return oe(() => {
|
|
1216
|
+
e(
|
|
1217
|
+
typeof navigator < "u" && /^((?!chrome|chromium|android).)*safari/i.test(navigator.userAgent)
|
|
1218
|
+
);
|
|
1219
|
+
}, []), t;
|
|
1220
|
+
}, on = ({
|
|
1221
|
+
lens: t,
|
|
1222
|
+
mapHref: e,
|
|
1223
|
+
feImageRef: s,
|
|
1224
|
+
mapMatrixRef: n,
|
|
1225
|
+
blurStdDeviation: r,
|
|
1226
|
+
specularFromRawMap: u,
|
|
1227
|
+
brightnessInFilter: h,
|
|
1228
|
+
filterW: f,
|
|
1229
|
+
filterH: l,
|
|
1230
|
+
clipShapeRef: i
|
|
1231
|
+
}) => {
|
|
1232
|
+
const k = t.scaleX ?? t.strength, I = t.scaleY ?? t.strength, m = Math.max(k, I), d = f && l ? Math.sqrt((f * f + l * l) / 2) : 1, R = m * d, G = m > 0 ? k / m : 0, $ = m > 0 ? I / m : 0, F = !(G === 1 && $ === 1), Y = F ? "scaledMap" : "map", H = t.frost > 0 && !!r, x = H ? "blurred" : "SourceGraphic", K = t.glow > 0 || t.sheen > 0, O = t.specular, S = h && t.brightness !== 0, E = H || S;
|
|
1233
|
+
return /* @__PURE__ */ te(ot, { children: [
|
|
1234
|
+
/* @__PURE__ */ a("feFlood", { floodColor: "rgb(128,128,128)", floodOpacity: "1", result: "mapBg" }),
|
|
1235
|
+
/* @__PURE__ */ a(
|
|
1236
|
+
"feImage",
|
|
1237
|
+
{
|
|
1238
|
+
ref: s,
|
|
1239
|
+
"data-lens": "",
|
|
1240
|
+
href: e,
|
|
1241
|
+
preserveAspectRatio: "none",
|
|
1242
|
+
result: "rawMap"
|
|
1243
|
+
}
|
|
1244
|
+
),
|
|
1245
|
+
/* @__PURE__ */ a("feComposite", { in: "rawMap", in2: "mapBg", operator: "over", result: "map" }),
|
|
1246
|
+
F && /* @__PURE__ */ a(
|
|
1247
|
+
"feColorMatrix",
|
|
1248
|
+
{
|
|
1249
|
+
ref: n,
|
|
1250
|
+
in: "map",
|
|
1251
|
+
type: "matrix",
|
|
1252
|
+
values: Qt(G, $),
|
|
1253
|
+
result: "scaledMap"
|
|
1254
|
+
}
|
|
1255
|
+
),
|
|
1256
|
+
H && /* @__PURE__ */ a(
|
|
1257
|
+
"feGaussianBlur",
|
|
1258
|
+
{
|
|
1259
|
+
in: "SourceGraphic",
|
|
1260
|
+
stdDeviation: r,
|
|
1261
|
+
result: "blurred"
|
|
1262
|
+
}
|
|
1263
|
+
),
|
|
1264
|
+
E && /* @__PURE__ */ a(
|
|
1265
|
+
"feImage",
|
|
1266
|
+
{
|
|
1267
|
+
ref: i,
|
|
1268
|
+
"data-lens": "",
|
|
1269
|
+
href: wr,
|
|
1270
|
+
preserveAspectRatio: "none",
|
|
1271
|
+
result: "lensShape"
|
|
1272
|
+
}
|
|
1273
|
+
),
|
|
1274
|
+
t.dispersion > 0 ? /* @__PURE__ */ te(ot, { children: [
|
|
1275
|
+
/* @__PURE__ */ a(
|
|
1276
|
+
"feDisplacementMap",
|
|
1277
|
+
{
|
|
1278
|
+
"data-lens": "",
|
|
1279
|
+
in: x,
|
|
1280
|
+
in2: Y,
|
|
1281
|
+
scale: R * (1 + ht * 0.5 * t.dispersion),
|
|
1282
|
+
xChannelSelector: "R",
|
|
1283
|
+
yChannelSelector: "G"
|
|
1284
|
+
}
|
|
1285
|
+
),
|
|
1286
|
+
/* @__PURE__ */ a(
|
|
1287
|
+
"feColorMatrix",
|
|
1288
|
+
{
|
|
1289
|
+
type: "matrix",
|
|
1290
|
+
values: "1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0",
|
|
1291
|
+
result: "refractR"
|
|
1292
|
+
}
|
|
1293
|
+
),
|
|
1294
|
+
/* @__PURE__ */ a(
|
|
1295
|
+
"feDisplacementMap",
|
|
1296
|
+
{
|
|
1297
|
+
"data-lens": "",
|
|
1298
|
+
in: x,
|
|
1299
|
+
in2: Y,
|
|
1300
|
+
scale: R,
|
|
1301
|
+
xChannelSelector: "R",
|
|
1302
|
+
yChannelSelector: "G"
|
|
1303
|
+
}
|
|
1304
|
+
),
|
|
1305
|
+
/* @__PURE__ */ a(
|
|
1306
|
+
"feColorMatrix",
|
|
1307
|
+
{
|
|
1308
|
+
type: "matrix",
|
|
1309
|
+
values: "0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0",
|
|
1310
|
+
result: "refractG"
|
|
1311
|
+
}
|
|
1312
|
+
),
|
|
1313
|
+
/* @__PURE__ */ a(
|
|
1314
|
+
"feDisplacementMap",
|
|
1315
|
+
{
|
|
1316
|
+
"data-lens": "",
|
|
1317
|
+
in: x,
|
|
1318
|
+
in2: Y,
|
|
1319
|
+
scale: R * (1 - ht * 0.5 * t.dispersion),
|
|
1320
|
+
xChannelSelector: "R",
|
|
1321
|
+
yChannelSelector: "G"
|
|
1322
|
+
}
|
|
1323
|
+
),
|
|
1324
|
+
/* @__PURE__ */ a(
|
|
1325
|
+
"feColorMatrix",
|
|
1326
|
+
{
|
|
1327
|
+
type: "matrix",
|
|
1328
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0",
|
|
1329
|
+
result: "refractB"
|
|
1330
|
+
}
|
|
1331
|
+
),
|
|
1332
|
+
/* @__PURE__ */ a(
|
|
1333
|
+
"feComposite",
|
|
1334
|
+
{
|
|
1335
|
+
in: "refractR",
|
|
1336
|
+
in2: "refractG",
|
|
1337
|
+
operator: "arithmetic",
|
|
1338
|
+
k1: "0",
|
|
1339
|
+
k2: "1",
|
|
1340
|
+
k3: "1",
|
|
1341
|
+
k4: "0",
|
|
1342
|
+
result: "refractRG"
|
|
1343
|
+
}
|
|
1344
|
+
),
|
|
1345
|
+
/* @__PURE__ */ a(
|
|
1346
|
+
"feComposite",
|
|
1347
|
+
{
|
|
1348
|
+
in: "refractRG",
|
|
1349
|
+
in2: "refractB",
|
|
1350
|
+
operator: "arithmetic",
|
|
1351
|
+
k1: "0",
|
|
1352
|
+
k2: "1",
|
|
1353
|
+
k3: "1",
|
|
1354
|
+
k4: "0",
|
|
1355
|
+
result: "lensOut"
|
|
1356
|
+
}
|
|
1357
|
+
)
|
|
1358
|
+
] }) : /* @__PURE__ */ a(
|
|
1359
|
+
"feDisplacementMap",
|
|
1360
|
+
{
|
|
1361
|
+
"data-lens": "",
|
|
1362
|
+
in: x,
|
|
1363
|
+
in2: Y,
|
|
1364
|
+
scale: R,
|
|
1365
|
+
xChannelSelector: "R",
|
|
1366
|
+
yChannelSelector: "G",
|
|
1367
|
+
result: "lensOut"
|
|
1368
|
+
}
|
|
1369
|
+
),
|
|
1370
|
+
K && (t.sheenDark ? /* @__PURE__ */ te(ot, { children: [
|
|
1371
|
+
/* @__PURE__ */ a(
|
|
1372
|
+
"feColorMatrix",
|
|
1373
|
+
{
|
|
1374
|
+
in: u ? "rawMap" : "map",
|
|
1375
|
+
type: "matrix",
|
|
1376
|
+
values: `0 0 ${-O} 0 ${1 + 128 * O / 255} 0 0 ${-O} 0 ${1 + 128 * O / 255} 0 0 ${-O} 0 ${1 + 128 * O / 255} 0 0 0 0 1`,
|
|
1377
|
+
result: "sheenMask"
|
|
1378
|
+
}
|
|
1379
|
+
),
|
|
1380
|
+
/* @__PURE__ */ a(
|
|
1381
|
+
"feComposite",
|
|
1382
|
+
{
|
|
1383
|
+
in: "sheenMask",
|
|
1384
|
+
in2: "lensOut",
|
|
1385
|
+
operator: "arithmetic",
|
|
1386
|
+
k1: "1",
|
|
1387
|
+
k2: "0",
|
|
1388
|
+
k3: "0",
|
|
1389
|
+
k4: "0",
|
|
1390
|
+
result: "lensOut"
|
|
1391
|
+
}
|
|
1392
|
+
)
|
|
1393
|
+
] }) : /* @__PURE__ */ te(ot, { children: [
|
|
1394
|
+
/* @__PURE__ */ a(
|
|
1395
|
+
"feColorMatrix",
|
|
1396
|
+
{
|
|
1397
|
+
in: u ? "rawMap" : "map",
|
|
1398
|
+
type: "matrix",
|
|
1399
|
+
values: `0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 1 0 ${-128 / 255}`,
|
|
1400
|
+
result: "sheenMask"
|
|
1401
|
+
}
|
|
1402
|
+
),
|
|
1403
|
+
/* @__PURE__ */ a(
|
|
1404
|
+
"feComposite",
|
|
1405
|
+
{
|
|
1406
|
+
in: "sheenMask",
|
|
1407
|
+
in2: "lensOut",
|
|
1408
|
+
operator: "arithmetic",
|
|
1409
|
+
k1: "0",
|
|
1410
|
+
k2: O,
|
|
1411
|
+
k3: "1",
|
|
1412
|
+
k4: "0",
|
|
1413
|
+
result: "lensOut"
|
|
1414
|
+
}
|
|
1415
|
+
)
|
|
1416
|
+
] })),
|
|
1417
|
+
S && /* @__PURE__ */ te(ot, { children: [
|
|
1418
|
+
/* @__PURE__ */ a(
|
|
1419
|
+
"feFlood",
|
|
1420
|
+
{
|
|
1421
|
+
"data-lens": "",
|
|
1422
|
+
floodColor: t.brightness > 0 ? "white" : "black",
|
|
1423
|
+
floodOpacity: Math.abs(t.brightness),
|
|
1424
|
+
result: "brightnessFlood"
|
|
1425
|
+
}
|
|
1426
|
+
),
|
|
1427
|
+
/* @__PURE__ */ a(
|
|
1428
|
+
"feComposite",
|
|
1429
|
+
{
|
|
1430
|
+
in: "brightnessFlood",
|
|
1431
|
+
in2: "lensShape",
|
|
1432
|
+
operator: "in",
|
|
1433
|
+
result: "brightnessVeil"
|
|
1434
|
+
}
|
|
1435
|
+
),
|
|
1436
|
+
/* @__PURE__ */ a(
|
|
1437
|
+
"feComposite",
|
|
1438
|
+
{
|
|
1439
|
+
in: "brightnessVeil",
|
|
1440
|
+
in2: "lensOut",
|
|
1441
|
+
operator: "over",
|
|
1442
|
+
result: "lensOut"
|
|
1443
|
+
}
|
|
1444
|
+
)
|
|
1445
|
+
] }),
|
|
1446
|
+
E ? (
|
|
1447
|
+
// Shape-clipped composite: clip the lens result to the lens-shape alpha
|
|
1448
|
+
// (`lensShape`, declared above) and hole the SourceGraphic with the same
|
|
1449
|
+
// shape, so the lens follows the rounded silhouette instead of
|
|
1450
|
+
// the rectangular filter subregion. Used by the frosted blur and the
|
|
1451
|
+
// in-filter brightness veil.
|
|
1452
|
+
/* @__PURE__ */ te(ot, { children: [
|
|
1453
|
+
/* @__PURE__ */ a(
|
|
1454
|
+
"feComposite",
|
|
1455
|
+
{
|
|
1456
|
+
in: "lensOut",
|
|
1457
|
+
in2: "lensShape",
|
|
1458
|
+
operator: "in",
|
|
1459
|
+
result: "lensOut"
|
|
1460
|
+
}
|
|
1461
|
+
),
|
|
1462
|
+
/* @__PURE__ */ a(
|
|
1463
|
+
"feComposite",
|
|
1464
|
+
{
|
|
1465
|
+
in: "SourceGraphic",
|
|
1466
|
+
in2: "lensShape",
|
|
1467
|
+
operator: "out",
|
|
1468
|
+
result: "cutoutSrc"
|
|
1469
|
+
}
|
|
1470
|
+
),
|
|
1471
|
+
/* @__PURE__ */ a("feComposite", { in: "lensOut", in2: "cutoutSrc", operator: "over" })
|
|
1472
|
+
] })
|
|
1473
|
+
) : /* @__PURE__ */ te(ot, { children: [
|
|
1474
|
+
/* @__PURE__ */ a(
|
|
1475
|
+
"feFlood",
|
|
1476
|
+
{
|
|
1477
|
+
"data-lens": "",
|
|
1478
|
+
floodColor: "black",
|
|
1479
|
+
floodOpacity: "1",
|
|
1480
|
+
result: "lensMask"
|
|
1481
|
+
}
|
|
1482
|
+
),
|
|
1483
|
+
/* @__PURE__ */ a(
|
|
1484
|
+
"feComposite",
|
|
1485
|
+
{
|
|
1486
|
+
in: "SourceGraphic",
|
|
1487
|
+
in2: "lensMask",
|
|
1488
|
+
operator: "out",
|
|
1489
|
+
result: "cutoutSrc"
|
|
1490
|
+
}
|
|
1491
|
+
),
|
|
1492
|
+
/* @__PURE__ */ a("feComposite", { in: "lensOut", in2: "cutoutSrc", operator: "over" })
|
|
1493
|
+
] })
|
|
1494
|
+
] });
|
|
1495
|
+
}, an = ({
|
|
1496
|
+
children: t,
|
|
1497
|
+
lens: e,
|
|
1498
|
+
x: s = 0.5,
|
|
1499
|
+
y: n = 0.5,
|
|
1500
|
+
lensW: r,
|
|
1501
|
+
lensH: u,
|
|
1502
|
+
borderRadius: h,
|
|
1503
|
+
refractionTarget: f,
|
|
1504
|
+
refractionBackground: l = "transparent",
|
|
1505
|
+
overlay: i,
|
|
1506
|
+
tintColor: k,
|
|
1507
|
+
tintOpacity: I,
|
|
1508
|
+
tintBlur: m,
|
|
1509
|
+
shadowOpacity: d,
|
|
1510
|
+
restShadowOpacity: R,
|
|
1511
|
+
edgeBias: G,
|
|
1512
|
+
depth: $,
|
|
1513
|
+
scale: F,
|
|
1514
|
+
filterResolution: Y = 1,
|
|
1515
|
+
brightnessInFilter: H = !1,
|
|
1516
|
+
pixelUnits: x = !1,
|
|
1517
|
+
live: K = !1,
|
|
1518
|
+
onLensMapChange: O,
|
|
722
1519
|
className: S,
|
|
723
|
-
style:
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
1520
|
+
style: E,
|
|
1521
|
+
...y
|
|
1522
|
+
}) => {
|
|
1523
|
+
const X = sn(), C = o(X);
|
|
1524
|
+
C.current = X;
|
|
1525
|
+
const N = o(H);
|
|
1526
|
+
N.current = H;
|
|
1527
|
+
const _ = o(x);
|
|
1528
|
+
_.current = x;
|
|
1529
|
+
const W = o(K);
|
|
1530
|
+
W.current = K;
|
|
1531
|
+
const B = o(Y);
|
|
1532
|
+
B.current = Y;
|
|
1533
|
+
const c = ft(
|
|
1534
|
+
() => ({
|
|
1535
|
+
...Jt,
|
|
1536
|
+
...e
|
|
1537
|
+
}),
|
|
1538
|
+
[e]
|
|
1539
|
+
), V = o(c);
|
|
1540
|
+
V.current = c;
|
|
1541
|
+
const J = jt().replace(/:/g, ""), M = o(null), T = o(null), q = o(null), re = o(null), ue = o(null), ne = o(null), ee = o(null), ge = o(null), me = o(null), ye = o(null), D = o(null), j = o(null), g = o(null), Q = o([]), se = o([]), [A, De] = Ke({ w: 0, h: 0 }), ve = o(A);
|
|
1542
|
+
ve.current = A;
|
|
1543
|
+
const P = A.w > 0 && A.h > 0, Z = f != null, [Re, Ne] = Ke(null);
|
|
1544
|
+
qe(() => {
|
|
1545
|
+
var L, ie;
|
|
1546
|
+
if (!Z || l !== "transparent") {
|
|
1547
|
+
Ne(null);
|
|
1548
|
+
return;
|
|
1549
|
+
}
|
|
1550
|
+
if (typeof window > "u") return;
|
|
1551
|
+
let U = ((L = M.current) == null ? void 0 : L.parentElement) ?? null, p = null;
|
|
1552
|
+
for (; U; ) {
|
|
1553
|
+
const Je = getComputedStyle(U).backgroundColor, Se = (ie = Je.match(/rgba?\(([^)]+)\)/)) == null ? void 0 : ie[1].split(",");
|
|
1554
|
+
if ((Se && Se[3] != null ? parseFloat(Se[3]) : 1) > 0.95) {
|
|
1555
|
+
p = Je;
|
|
1556
|
+
break;
|
|
1557
|
+
}
|
|
1558
|
+
U = U.parentElement;
|
|
1559
|
+
}
|
|
1560
|
+
Ne(p);
|
|
1561
|
+
}, [Z, l]);
|
|
1562
|
+
const Ve = l !== "transparent" ? l : Re ?? "transparent", he = o(0.5), de = o(0.5), Te = o(c.lensW), Ge = o(c.lensH), b = o(c.borderRadius), Ae = o(r !== void 0);
|
|
1563
|
+
Ae.current = r !== void 0;
|
|
1564
|
+
const Xe = o(u !== void 0);
|
|
1565
|
+
Xe.current = u !== void 0;
|
|
1566
|
+
const $e = o(h !== void 0);
|
|
1567
|
+
$e.current = h !== void 0;
|
|
1568
|
+
const _e = o(0), nt = o(c.depth), Ue = o(c.scaleX ?? c.strength), et = o(c.scaleY ?? c.strength), He = o(1), ke = o(0), v = o(1), fe = o(0), pe = o(0.5), we = o(NaN), je = o(NaN), w = o(NaN), z = o(1), ae = o(0), Ie = o(""), We = o(!1), Fe = o(null), Le = o(null), ze = o(
|
|
1569
|
+
null
|
|
1570
|
+
), pt = o(k);
|
|
1571
|
+
pt.current = k;
|
|
1572
|
+
const Oe = o(O);
|
|
1573
|
+
Oe.current = O;
|
|
1574
|
+
const wt = A.w > 0 && A.h > 0 ? Math.sqrt((A.w * A.w + A.h * A.h) / 2) : 0;
|
|
1575
|
+
let tt = Math.max(
|
|
1576
|
+
c.scaleX ?? c.strength,
|
|
1577
|
+
c.scaleY ?? c.strength
|
|
1578
|
+
);
|
|
1579
|
+
if (wt > 0) {
|
|
1580
|
+
const U = typeof r == "number" ? r * 2 : A.w, p = typeof u == "number" ? u * 2 : A.h, L = 1 + ht * c.dispersion;
|
|
1581
|
+
tt = Math.min(
|
|
1582
|
+
tt,
|
|
1583
|
+
Math.max(U, p) * 0.6 / (wt * L)
|
|
1584
|
+
);
|
|
1585
|
+
}
|
|
1586
|
+
const at = x && f != null && A.w > 0 && A.h > 0 ? Math.ceil(
|
|
1587
|
+
tt * wt * (1 + ht * c.dispersion) * 0.5 + c.depth + 28
|
|
1588
|
+
) + 16 : 0, ce = o(at);
|
|
1589
|
+
ce.current = at, qe(() => {
|
|
1590
|
+
const U = M.current;
|
|
1591
|
+
if (!U) return;
|
|
1592
|
+
const p = () => {
|
|
1593
|
+
var Je;
|
|
1594
|
+
const ie = U.getBoundingClientRect();
|
|
1595
|
+
if (!$e.current && typeof getComputedStyle < "u") {
|
|
1596
|
+
let Se = parseFloat(getComputedStyle(U).borderTopLeftRadius) || 0;
|
|
1597
|
+
const Me = (Je = T.current) == null ? void 0 : Je.firstElementChild;
|
|
1598
|
+
!Se && Me && (Se = parseFloat(getComputedStyle(Me).borderTopLeftRadius) || 0), _e.current = Se;
|
|
1599
|
+
}
|
|
1600
|
+
De(
|
|
1601
|
+
(Se) => Se.w === ie.width && Se.h === ie.height ? Se : { w: ie.width, h: ie.height }
|
|
746
1602
|
);
|
|
747
1603
|
};
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
H = 0, le();
|
|
753
|
-
}));
|
|
754
|
-
});
|
|
755
|
-
return pe.observe(ce), () => {
|
|
756
|
-
H && cancelAnimationFrame(H), pe.disconnect();
|
|
1604
|
+
p();
|
|
1605
|
+
const L = new ResizeObserver(p);
|
|
1606
|
+
return L.observe(U), window.addEventListener("resize", p), () => {
|
|
1607
|
+
L.disconnect(), window.removeEventListener("resize", p);
|
|
757
1608
|
};
|
|
758
1609
|
}, []);
|
|
759
|
-
const
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
//
|
|
898
|
-
//
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
1610
|
+
const Ce = Rt(() => {
|
|
1611
|
+
const U = M.current;
|
|
1612
|
+
if (!U) return;
|
|
1613
|
+
let p = ve.current.w, L = ve.current.h;
|
|
1614
|
+
if (!(p > 0 && L > 0)) {
|
|
1615
|
+
const le = U.getBoundingClientRect();
|
|
1616
|
+
p = le.width, L = le.height;
|
|
1617
|
+
}
|
|
1618
|
+
if (!(p > 0 && L > 0)) return;
|
|
1619
|
+
const ie = V.current, Je = Ue.current, Se = et.current;
|
|
1620
|
+
let Me = Math.max(Je, Se);
|
|
1621
|
+
const xt = ie.dispersion, St = Ae.current ? Te.current : p / 2, Mt = Xe.current ? Ge.current : L / 2, mt = $e.current ? b.current : _e.current;
|
|
1622
|
+
let Ot = he.current * p, Nt = de.current * L;
|
|
1623
|
+
_.current && q.current && (Ot = Math.max(St, Math.min(p - St, Ot)), Nt = Math.max(Mt, Math.min(L - Mt, Nt)));
|
|
1624
|
+
const Qe = Ot - St, Ze = Nt - Mt, lt = 2 * St, ut = 2 * Mt;
|
|
1625
|
+
if (_.current) {
|
|
1626
|
+
const le = Math.sqrt((p * p + L * L) / 2), Ee = 1 + ht * xt, Et = Math.max(lt, ut) * 0.6;
|
|
1627
|
+
le > 0 && (Me = Math.min(Me, Et / (le * Ee)));
|
|
1628
|
+
}
|
|
1629
|
+
const sr = B.current, rt = sr !== 1 && !C.current ? sr : 1, bt = C.current ? rt * z.current : rt, Fr = Qe !== we.current || Ze !== je.current, ir = Me !== w.current;
|
|
1630
|
+
if (we.current = Qe, je.current = Ze, w.current = Me, Fr || ir || W.current) {
|
|
1631
|
+
const le = pe.current, Ee = _.current, Et = Math.sqrt((p * p + L * L) / 2), Lr = Me * Et * (1 + ht * xt) * 0.5, or = Math.ceil(Lr + nt.current + 28), yt = Ee && q.current ? ce.current : 0, Cr = String(Ee ? (Qe + yt + le) * bt : (Qe + le) / p), Dr = String(Ee ? (Ze + yt + le) * bt : (Ze + le) / L), Xr = String(
|
|
1632
|
+
Ee ? Math.max(0, lt - 2 * le) * bt : Math.max(0, lt - 2 * le) / p
|
|
1633
|
+
), Ir = String(
|
|
1634
|
+
Ee ? Math.max(0, ut - 2 * le) * bt : Math.max(0, ut - 2 * le) / L
|
|
1635
|
+
);
|
|
1636
|
+
for (const Ye of Q.current)
|
|
1637
|
+
Ye.setAttribute("x", Cr), Ye.setAttribute("y", Dr), Ye.setAttribute("width", Xr), Ye.setAttribute("height", Ir);
|
|
1638
|
+
if (ir) {
|
|
1639
|
+
const Ye = Ee ? Me * Et * bt : Me, Wr = xt > 0 ? [
|
|
1640
|
+
Ye * (1 + ht * 0.5 * xt),
|
|
1641
|
+
Ye,
|
|
1642
|
+
Ye * (1 - ht * 0.5 * xt)
|
|
1643
|
+
] : [Ye], ar = se.current;
|
|
1644
|
+
for (let Dt = 0; Dt < ar.length; Dt += 1)
|
|
1645
|
+
ar[Dt].setAttribute("scale", String(Wr[Dt] ?? 0));
|
|
1646
|
+
}
|
|
1647
|
+
const vt = ye.current;
|
|
1648
|
+
if (vt) {
|
|
1649
|
+
Ee && (vt.setAttribute("x", "0"), vt.setAttribute("y", "0"), q.current ? (vt.setAttribute(
|
|
1650
|
+
"width",
|
|
1651
|
+
String((Qe + yt + lt + or) * bt)
|
|
1652
|
+
), vt.setAttribute(
|
|
1653
|
+
"height",
|
|
1654
|
+
String((Ze + yt + ut + or) * bt)
|
|
1655
|
+
)) : (vt.setAttribute("width", String(p * bt)), vt.setAttribute("height", String(L * bt)))), ae.current += 1, vt.id = `lg-${J}-v${ae.current}`;
|
|
1656
|
+
const Ye = Fe.current ? `url(#${vt.id})` : "";
|
|
1657
|
+
q.current ? (q.current.style.filter !== Ye && (q.current.style.filter = Ye), q.current.style.clipPath = `inset(${Math.max(0, Ze + yt) * rt}px ${Math.max(0, p + yt - (Qe + lt)) * rt}px ${Math.max(0, L + yt - (Ze + ut)) * rt}px ${Math.max(0, Qe + yt) * rt}px round ${mt * rt}px)`, T.current && !re.current && (T.current.style.filter = "")) : T.current && T.current.style.filter !== Ye && (T.current.style.filter = Ye);
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
re.current && (re.current.style.clipPath = `inset(${Math.max(0, Ze) * rt}px ${Math.max(0, p - (Qe + lt)) * rt}px ${Math.max(0, L - (Ze + ut)) * rt}px ${Math.max(0, Qe) * rt}px round ${mt * rt}px)`), ue.current && !re.current && (ue.current.style.clipPath = `inset(${Math.max(0, Ze)}px ${Math.max(0, p - (Qe + lt))}px ${Math.max(0, L - (Ze + ut))}px ${Math.max(0, Qe)}px round ${mt}px)`);
|
|
1661
|
+
const $t = (le, Ee) => {
|
|
1662
|
+
le.style.transform = `translate(${Qe}px, ${Ze}px)`, le.style.width = `${lt}px`, le.style.height = `${ut}px`, le.style.borderRadius = `${mt}px`, Ee !== void 0 && (le.style.opacity = String(Ee));
|
|
1663
|
+
};
|
|
1664
|
+
if (ge.current && $t(ge.current, v.current), me.current && $t(me.current, fe.current), ee.current) {
|
|
1665
|
+
ee.current.style.transform = `translate3d(${Qe}px, ${Ze}px, 0)`, ee.current.style.width = `${lt}px`, ee.current.style.height = `${ut}px`, ee.current.style.borderRadius = `${mt}px`;
|
|
1666
|
+
const { uri: le, key: Ee } = xr(lt, ut, mt);
|
|
1667
|
+
if (Ie.current !== Ee) {
|
|
1668
|
+
const Et = `url("${le}")`;
|
|
1669
|
+
ee.current.style.maskImage = Et, ee.current.style.setProperty("-webkit-mask-image", Et), ee.current.style.maskSize = "100% 100%", ee.current.style.setProperty("-webkit-mask-size", "100% 100%"), Ie.current = Ee;
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
if (ne.current) {
|
|
1673
|
+
$t(ne.current);
|
|
1674
|
+
const le = pt.current ?? "white";
|
|
1675
|
+
ne.current.style.background = `color-mix(in srgb, ${le} ${100 * He.current}%, transparent)`, ne.current.style.opacity = "1";
|
|
1676
|
+
const Ee = ke.current > 0 ? `blur(${ke.current}px)` : "none";
|
|
1677
|
+
ne.current.style.backdropFilter = Ee, ne.current.style.setProperty("-webkit-backdrop-filter", Ee);
|
|
1678
|
+
}
|
|
1679
|
+
if (g.current) {
|
|
1680
|
+
const le = Me > 0 ? Je / Me : 0, Ee = Me > 0 ? Se / Me : 0;
|
|
1681
|
+
g.current.setAttribute("values", Qt(le, Ee));
|
|
1682
|
+
}
|
|
1683
|
+
}, [J]), st = Rt(() => {
|
|
1684
|
+
We.current || (We.current = !0, queueMicrotask(() => {
|
|
1685
|
+
We.current = !1, Ce();
|
|
1686
|
+
}));
|
|
1687
|
+
}, [Ce]), Be = Rt(() => {
|
|
1688
|
+
we.current = NaN, w.current = NaN, Ce();
|
|
1689
|
+
}, [Ce]);
|
|
1690
|
+
oe(() => {
|
|
1691
|
+
const U = () => {
|
|
1692
|
+
const L = window.innerWidth, ie = L > 0 ? window.outerWidth / L : 1;
|
|
1693
|
+
return ie > 0.2 && ie < 12 ? Math.abs(ie - 1) < 0.04 ? 1 : ie : 1;
|
|
1694
|
+
}, p = () => {
|
|
1695
|
+
const L = U();
|
|
1696
|
+
Math.abs(L - z.current) > 2e-3 && (z.current = L, Be());
|
|
1697
|
+
};
|
|
1698
|
+
return p(), window.addEventListener("resize", p), () => window.removeEventListener("resize", p);
|
|
1699
|
+
}, [Be]);
|
|
1700
|
+
const it = Rt(() => {
|
|
1701
|
+
var Me, xt, St, Mt;
|
|
1702
|
+
const U = V.current.mapSize;
|
|
1703
|
+
(!ze.current || ze.current.size !== U) && ((Me = ze.current) == null || Me.gen.dispose(), ze.current = {
|
|
1704
|
+
gen: Zt(U),
|
|
1705
|
+
size: U
|
|
1706
|
+
});
|
|
1707
|
+
const p = V.current, L = Ae.current ? Te.current : ve.current.w / 2, ie = Xe.current ? Ge.current : ve.current.h / 2, Je = $e.current ? b.current : _e.current, Se = ze.current.gen.generate({
|
|
1708
|
+
lensHalfWidth: L,
|
|
1709
|
+
lensHalfHeight: ie,
|
|
1710
|
+
borderRadius: Je,
|
|
1711
|
+
depth: nt.current,
|
|
1712
|
+
clipToShape: p.clipToShape,
|
|
1713
|
+
softEdge: p.softEdge,
|
|
1714
|
+
sheenAngle: p.sheenAngle,
|
|
1715
|
+
glow: p.glow,
|
|
1716
|
+
glowSpread: p.glowSpread,
|
|
1717
|
+
glowFalloff: p.glowFalloff,
|
|
1718
|
+
sheen: p.sheen,
|
|
1719
|
+
sheenWidth: p.sheenWidth,
|
|
1720
|
+
sheenFalloff: p.sheenFalloff,
|
|
1721
|
+
curvature: p.curvature,
|
|
1722
|
+
splay: p.splay,
|
|
1723
|
+
bend: p.bend,
|
|
1724
|
+
bendWidth: p.bendWidth
|
|
1725
|
+
});
|
|
1726
|
+
if (Fe.current = Se, (xt = D.current) == null || xt.setAttribute("href", Se), p.frost > 0 || N.current && p.brightness !== 0) {
|
|
1727
|
+
const mt = Nr(2 * L, 2 * ie, Je);
|
|
1728
|
+
Le.current = mt.uri, (St = j.current) == null || St.setAttribute("href", mt.uri);
|
|
1729
|
+
}
|
|
1730
|
+
(Mt = Oe.current) == null || Mt.call(Oe, Se), Be();
|
|
1731
|
+
}, [Be]), gt = o(it);
|
|
1732
|
+
gt.current = it;
|
|
1733
|
+
const Ct = JSON.stringify([
|
|
1734
|
+
c.mapSize,
|
|
1735
|
+
c.clipToShape,
|
|
1736
|
+
c.softEdge,
|
|
1737
|
+
c.sheenAngle,
|
|
1738
|
+
c.glow,
|
|
1739
|
+
c.glowSpread,
|
|
1740
|
+
c.glowFalloff,
|
|
1741
|
+
c.sheen,
|
|
1742
|
+
c.sheenWidth,
|
|
1743
|
+
c.sheenFalloff,
|
|
1744
|
+
c.curvature,
|
|
1745
|
+
c.splay,
|
|
1746
|
+
c.bend,
|
|
1747
|
+
c.bendWidth,
|
|
1748
|
+
// Auto-fit: when a geometry prop is omitted the effective extent is the
|
|
1749
|
+
// measured box, so fold the measured size into the shape key (regen on resize).
|
|
1750
|
+
xe(r) ? "mv" : r ?? (A.w / 2 || c.lensW),
|
|
1751
|
+
xe(u) ? "mv" : u ?? (A.h / 2 || c.lensH),
|
|
1752
|
+
xe(h) ? "mv" : h ?? _e.current,
|
|
1753
|
+
xe($) ? "mv" : $ ?? c.depth,
|
|
1754
|
+
H && c.brightness !== 0
|
|
1755
|
+
]);
|
|
1756
|
+
qe(() => {
|
|
1757
|
+
const U = [], p = (L, ie, Je, Se = () => {
|
|
1758
|
+
W.current || st();
|
|
1759
|
+
}) => {
|
|
1760
|
+
if (L === void 0) {
|
|
1761
|
+
ie.current = Je;
|
|
1762
|
+
return;
|
|
1763
|
+
}
|
|
1764
|
+
xe(L) ? (ie.current = L.get(), U.push(
|
|
1765
|
+
L.on("change", (Me) => {
|
|
1766
|
+
ie.current = Me, Se();
|
|
1767
|
+
})
|
|
1768
|
+
)) : ie.current = L;
|
|
1769
|
+
};
|
|
1770
|
+
return p(s, he, 0.5), p(n, de, 0.5), p(r ?? c.lensW, Te, c.lensW), p(u ?? c.lensH, Ge, c.lensH), p(h ?? c.borderRadius, b, c.borderRadius), p($ ?? c.depth, nt, c.depth), p(
|
|
1771
|
+
F ?? c.scaleX ?? c.strength,
|
|
1772
|
+
Ue,
|
|
1773
|
+
c.scaleX ?? c.strength
|
|
1774
|
+
), p(
|
|
1775
|
+
F ?? c.scaleY ?? c.strength,
|
|
1776
|
+
et,
|
|
1777
|
+
c.scaleY ?? c.strength
|
|
1778
|
+
), p(I, He, 1), p(m, ke, 0), p(d, v, 1), p(R, fe, 0), p(G, pe, 0.5), Ce(), () => U.forEach((L) => L());
|
|
1779
|
+
}, [
|
|
1780
|
+
s,
|
|
1781
|
+
n,
|
|
1782
|
+
r,
|
|
1783
|
+
u,
|
|
1784
|
+
h,
|
|
1785
|
+
$,
|
|
1786
|
+
F,
|
|
1787
|
+
I,
|
|
1788
|
+
m,
|
|
1789
|
+
d,
|
|
1790
|
+
R,
|
|
1791
|
+
G,
|
|
1792
|
+
c,
|
|
1793
|
+
st,
|
|
1794
|
+
Ce
|
|
1795
|
+
]);
|
|
1796
|
+
const Tr = c.dispersion > 0, Pt = c.frost > 0, Ar = c.glow > 0 || c.sheen > 0;
|
|
1797
|
+
qe(() => {
|
|
1798
|
+
const U = ye.current;
|
|
1799
|
+
Q.current = U ? Array.from(U.querySelectorAll("[data-lens]")) : [], se.current = U ? Array.from(U.querySelectorAll("feDisplacementMap")) : [], D.current && Fe.current && D.current.setAttribute("href", Fe.current), j.current && Le.current && j.current.setAttribute("href", Le.current), Be();
|
|
1800
|
+
}, [
|
|
1801
|
+
P,
|
|
1802
|
+
Tr,
|
|
1803
|
+
Pt,
|
|
1804
|
+
Ar,
|
|
1805
|
+
c.sheenDark,
|
|
1806
|
+
c.scaleX,
|
|
1807
|
+
c.scaleY,
|
|
1808
|
+
c.strength,
|
|
1809
|
+
c.brightness,
|
|
1810
|
+
H,
|
|
1811
|
+
x,
|
|
1812
|
+
X,
|
|
1813
|
+
f != null,
|
|
1814
|
+
i != null,
|
|
1815
|
+
Be
|
|
1816
|
+
]), qe(() => {
|
|
1817
|
+
P && Be();
|
|
1818
|
+
}, [A.w, A.h, at, Be]), qe(() => {
|
|
1819
|
+
P && gt.current();
|
|
1820
|
+
}, [P, Ct]), oe(() => {
|
|
1821
|
+
const U = [];
|
|
1822
|
+
let p;
|
|
1823
|
+
const L = () => {
|
|
1824
|
+
clearTimeout(p), p = setTimeout(() => gt.current(), 90);
|
|
1825
|
+
};
|
|
1826
|
+
for (const ie of [r, u, h, $])
|
|
1827
|
+
xe(ie) && U.push(ie.on("change", L));
|
|
1828
|
+
return () => {
|
|
1829
|
+
U.forEach((ie) => ie()), clearTimeout(p);
|
|
1830
|
+
};
|
|
1831
|
+
}, [r, u, h, $]), oe(
|
|
1832
|
+
() => () => {
|
|
1833
|
+
var U, p;
|
|
1834
|
+
(U = ze.current) == null || U.gen.dispose(), ze.current = null, (p = Oe.current) == null || p.call(Oe, null);
|
|
1835
|
+
},
|
|
1836
|
+
[]
|
|
1837
|
+
), oe(() => {
|
|
1838
|
+
if (!K || !P) return;
|
|
1839
|
+
let U = 0;
|
|
1840
|
+
const p = () => {
|
|
1841
|
+
U = requestAnimationFrame(p), Ce();
|
|
1842
|
+
};
|
|
1843
|
+
return U = requestAnimationFrame(p), () => cancelAnimationFrame(U);
|
|
1844
|
+
}, [K, P, Ce]);
|
|
1845
|
+
const _r = Y !== 1 && !X ? Y : 1, kr = Pt && P ? x ? `${c.frost * _r}` : `${c.frost / A.w} ${c.frost / A.h}` : void 0, ct = Y !== 1 && !X ? Y : 1, Ut = ct > 1 && i == null && f == null && P, er = i == null && f == null && !Ut && r === void 0, tr = (U, p, L) => /* @__PURE__ */ a(
|
|
1846
|
+
"div",
|
|
1847
|
+
{
|
|
1848
|
+
ref: U,
|
|
1849
|
+
style: {
|
|
1850
|
+
...L,
|
|
1851
|
+
position: "absolute",
|
|
1852
|
+
top: 0,
|
|
1853
|
+
left: 0,
|
|
1854
|
+
width: A.w * ct,
|
|
1855
|
+
height: A.h * ct,
|
|
1856
|
+
transform: `scale(${1 / ct})`,
|
|
1857
|
+
transformOrigin: "top left"
|
|
1858
|
+
},
|
|
1859
|
+
children: /* @__PURE__ */ a(
|
|
1860
|
+
"div",
|
|
1861
|
+
{
|
|
1862
|
+
style: {
|
|
1863
|
+
transform: `scale(${ct})`,
|
|
1864
|
+
transformOrigin: "top left",
|
|
1865
|
+
width: A.w,
|
|
1866
|
+
height: A.h
|
|
1867
|
+
},
|
|
1868
|
+
children: p
|
|
1869
|
+
}
|
|
1870
|
+
)
|
|
1871
|
+
}
|
|
1872
|
+
), rr = c.brightness !== 0 && !H ? /* @__PURE__ */ a(
|
|
1873
|
+
"div",
|
|
1874
|
+
{
|
|
1875
|
+
ref: ue,
|
|
1876
|
+
style: {
|
|
1877
|
+
position: "absolute",
|
|
1878
|
+
inset: 0,
|
|
1879
|
+
pointerEvents: "none",
|
|
1880
|
+
background: c.brightness > 0 ? "white" : "black",
|
|
1881
|
+
opacity: Math.abs(c.brightness)
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
) : null, nr = (U, p, L) => p || L ? /* @__PURE__ */ a(
|
|
1885
|
+
"div",
|
|
1886
|
+
{
|
|
1887
|
+
ref: U,
|
|
1888
|
+
style: {
|
|
1889
|
+
position: "absolute",
|
|
1890
|
+
top: 0,
|
|
1891
|
+
left: 0,
|
|
1892
|
+
pointerEvents: "none",
|
|
1893
|
+
willChange: "transform",
|
|
1894
|
+
boxSizing: "border-box",
|
|
1895
|
+
boxShadow: [p, L ? `inset ${L}` : null].filter(Boolean).join(", ")
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
) : null;
|
|
1899
|
+
return /* @__PURE__ */ te(
|
|
1900
|
+
"div",
|
|
1901
|
+
{
|
|
1902
|
+
ref: M,
|
|
1903
|
+
"data-liquid-glass": "",
|
|
1904
|
+
className: S,
|
|
1905
|
+
style: {
|
|
1906
|
+
contain: "layout",
|
|
1907
|
+
position: "relative",
|
|
1908
|
+
overflow: "visible",
|
|
1909
|
+
// Sizing: in auto-fit wrap mode the box shrinks to the wrapped element.
|
|
1910
|
+
// Otherwise impose NO width, so you can size <Glass> with CSS / className /
|
|
1911
|
+
// style (a block is 100% wide by default; the lens fits whatever size the
|
|
1912
|
+
// box ends up). `style` still wins over everything. Height is never forced,
|
|
1913
|
+
// so it's CSS-controllable too.
|
|
1914
|
+
...er ? { width: "fit-content" } : null,
|
|
1915
|
+
// children-mode supersampling makes the source absolute; reserve height
|
|
1916
|
+
...Ut ? { minHeight: A.h } : null,
|
|
1917
|
+
...E
|
|
1918
|
+
},
|
|
1919
|
+
...y,
|
|
1920
|
+
children: [
|
|
1921
|
+
Ut ? tr(T, t, { willChange: "filter" }) : i == null && f == null ? (
|
|
1922
|
+
// Wrap mode: the children ARE the refracted source. Two sizings:
|
|
1923
|
+
//
|
|
1924
|
+
// • AUTO-FIT (no explicit lens size): render in NORMAL FLOW so the
|
|
1925
|
+
// wrapped element dictates the container's intrinsic size and the lens
|
|
1926
|
+
// fits it. An absolute source would contribute no height → the
|
|
1927
|
+
// container collapses and the filter never engages.
|
|
1928
|
+
//
|
|
1929
|
+
// • EXPLICIT lens size (a "scene"/stage the consumer sizes with CSS):
|
|
1930
|
+
// FILL the container (absolute inset:0) and CLIP overflow. The obb bend
|
|
1931
|
+
// is normalized to the SOURCE's box, while the disc geometry uses the
|
|
1932
|
+
// measured CONTAINER box — if the source is left to size itself from the
|
|
1933
|
+
// content, free-flowing content (an unsized <img>, reflowing text)
|
|
1934
|
+
// makes those two boxes diverge, so the bend ovals and detaches from the
|
|
1935
|
+
// disc. Filling+clipping pins source box === container box, so the lens
|
|
1936
|
+
// stays round and locked to the disc no matter what content goes in.
|
|
1937
|
+
//
|
|
1938
|
+
// `will-change:filter` makes this the containing block for full-bleed
|
|
1939
|
+
// absolute children; the lens filter is applied imperatively (updateGeometry).
|
|
1940
|
+
/* @__PURE__ */ a(
|
|
1941
|
+
"div",
|
|
917
1942
|
{
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
1943
|
+
ref: T,
|
|
1944
|
+
style: er ? { willChange: "filter" } : {
|
|
1945
|
+
// Pin the source box to the MEASURED container size so the obb
|
|
1946
|
+
// bend (normalized to the source) can't diverge from the disc
|
|
1947
|
+
// (normalized to the container). If the source is left to size
|
|
1948
|
+
// itself, free content — an unsized <img>, reflowing text —
|
|
1949
|
+
// makes the two boxes diverge: the bend ovals and the veil
|
|
1950
|
+
// detaches from the disc (this was the "breaks with custom
|
|
1951
|
+
// content" bug). With the box pinned, oversized content simply
|
|
1952
|
+
// OVERFLOWS and is CLIPPED to the stage (so a full-res <img>
|
|
1953
|
+
// covers it instead of leaving a gap).
|
|
1954
|
+
//
|
|
1955
|
+
// Explicit PX height (not `100%`/`minHeight:100%`): WebKit won't
|
|
1956
|
+
// resolve a percentage height against a container whose height
|
|
1957
|
+
// comes from `inset`/abs-positioning rather than an explicit
|
|
1958
|
+
// `height`, so the percentage no-op'd in Safari and the source
|
|
1959
|
+
// stayed content-sized → oval+detached there (round in Blink).
|
|
1960
|
+
// The measured px value is unambiguous in every engine; `auto`
|
|
1961
|
+
// until measured so a content-sized container can't collapse.
|
|
1962
|
+
// `overflow:hidden` + `contain:paint` hard-clip overflow to that
|
|
1963
|
+
// box AND keep the filter's reference box at the stage size in
|
|
1964
|
+
// WebKit (so a huge <img> rasterizes at stage size, not its own).
|
|
1965
|
+
willChange: "filter",
|
|
1966
|
+
position: "relative",
|
|
1967
|
+
height: P ? A.h : void 0,
|
|
1968
|
+
overflow: "hidden",
|
|
1969
|
+
contain: "paint"
|
|
1970
|
+
},
|
|
1971
|
+
children: t
|
|
926
1972
|
}
|
|
927
|
-
)
|
|
928
|
-
|
|
1973
|
+
)
|
|
1974
|
+
) : i == null && x ? (
|
|
1975
|
+
// refractionTarget + pixelUnits (hero): the base layer is the crisp,
|
|
1976
|
+
// unfiltered content and must fill the container so full-bleed
|
|
1977
|
+
// absolute children resolve against it. (No will-change:filter — the
|
|
1978
|
+
// refraction copy carries the filter; an empty will-change:filter
|
|
1979
|
+
// wrapper would establish a 0-height containing block and collapse
|
|
1980
|
+
// absolute children.) `isolation:isolate` makes this a stacking
|
|
1981
|
+
// context so a positive `z-index` on the user's refracted content
|
|
1982
|
+
// can't leak out and paint OVER the refraction layer (which is the
|
|
1983
|
+
// next sibling, z-index:auto) — i.e. it guarantees the lens always
|
|
1984
|
+
// renders above the crisp content it refracts.
|
|
1985
|
+
/* @__PURE__ */ a(
|
|
929
1986
|
"div",
|
|
930
1987
|
{
|
|
931
|
-
|
|
932
|
-
style:
|
|
933
|
-
|
|
934
|
-
inert: "true",
|
|
935
|
-
children: [
|
|
936
|
-
/* @__PURE__ */ d(
|
|
937
|
-
St,
|
|
938
|
-
{
|
|
939
|
-
filterId: He,
|
|
940
|
-
mode: f,
|
|
941
|
-
width: xe,
|
|
942
|
-
height: Ae,
|
|
943
|
-
effectiveScale: Ue,
|
|
944
|
-
aberrationIntensity: Ye,
|
|
945
|
-
blurStdDeviation: Ce,
|
|
946
|
-
saturation: Se
|
|
947
|
-
}
|
|
948
|
-
),
|
|
949
|
-
/* @__PURE__ */ d("div", { "data-lg-refraction-copy": "", style: Vt, children: kt })
|
|
950
|
-
]
|
|
1988
|
+
ref: T,
|
|
1989
|
+
style: { position: "absolute", inset: 0, isolation: "isolate" },
|
|
1990
|
+
children: t
|
|
951
1991
|
}
|
|
952
|
-
)
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
1992
|
+
)
|
|
1993
|
+
) : /* @__PURE__ */ a(
|
|
1994
|
+
"div",
|
|
1995
|
+
{
|
|
1996
|
+
ref: i != null ? void 0 : T,
|
|
1997
|
+
style: i != null ? void 0 : { willChange: "filter" },
|
|
1998
|
+
children: t
|
|
1999
|
+
}
|
|
2000
|
+
),
|
|
2001
|
+
f != null && // A normal, untransformed copy of the content (never transformed or
|
|
2002
|
+
// repositioned per frame — real Safari drops the filter on a transformed
|
|
2003
|
+
// element; the lens moves only via the filter subregion). The region is
|
|
2004
|
+
// pinned at the copy origin and clip-path trims it to the lens silhouette.
|
|
2005
|
+
(x ? (
|
|
2006
|
+
// Bleed the copy `bleed` px beyond the surface, filled with the page
|
|
2007
|
+
// background, with the content offset back (inset:bleed) to stay aligned
|
|
2008
|
+
// with the base. So a lens near any edge still refracts solid source
|
|
2009
|
+
// instead of warping. Static offset — no per-frame transform.
|
|
2010
|
+
/* @__PURE__ */ a(
|
|
2011
|
+
"div",
|
|
2012
|
+
{
|
|
2013
|
+
ref: q,
|
|
2014
|
+
style: {
|
|
2015
|
+
position: "absolute",
|
|
2016
|
+
inset: -at,
|
|
2017
|
+
pointerEvents: "none",
|
|
2018
|
+
willChange: "filter, clip-path",
|
|
2019
|
+
background: Ve
|
|
2020
|
+
},
|
|
2021
|
+
children: /* @__PURE__ */ a("div", { style: { position: "absolute", inset: at }, children: f })
|
|
2022
|
+
}
|
|
2023
|
+
)
|
|
2024
|
+
) : ct > 1 ? tr(q, f, {
|
|
2025
|
+
pointerEvents: "none",
|
|
2026
|
+
willChange: "filter, clip-path",
|
|
2027
|
+
background: Ve
|
|
2028
|
+
}) : /* @__PURE__ */ a(
|
|
2029
|
+
"div",
|
|
2030
|
+
{
|
|
2031
|
+
ref: q,
|
|
2032
|
+
style: {
|
|
2033
|
+
position: "absolute",
|
|
2034
|
+
inset: 0,
|
|
2035
|
+
pointerEvents: "none",
|
|
2036
|
+
willChange: "filter, clip-path",
|
|
2037
|
+
background: Ve
|
|
2038
|
+
},
|
|
2039
|
+
children: f
|
|
2040
|
+
}
|
|
2041
|
+
)),
|
|
2042
|
+
i != null && /* @__PURE__ */ te(
|
|
2043
|
+
"div",
|
|
2044
|
+
{
|
|
2045
|
+
ref: re,
|
|
2046
|
+
style: { position: "absolute", inset: 0, pointerEvents: "none" },
|
|
2047
|
+
children: [
|
|
2048
|
+
/* @__PURE__ */ a("div", { ref: T, style: { willChange: "filter" }, children: i }),
|
|
2049
|
+
rr
|
|
2050
|
+
]
|
|
2051
|
+
}
|
|
2052
|
+
),
|
|
2053
|
+
/* @__PURE__ */ te("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" }, children: [
|
|
2054
|
+
/* @__PURE__ */ a(
|
|
2055
|
+
"svg",
|
|
2056
|
+
{
|
|
2057
|
+
viewBox: `0 0 ${A.w} ${A.h}`,
|
|
2058
|
+
width: "100%",
|
|
2059
|
+
height: "100%",
|
|
2060
|
+
style: { display: "block" },
|
|
2061
|
+
children: /* @__PURE__ */ a("defs", { children: /* @__PURE__ */ a(
|
|
2062
|
+
"filter",
|
|
2063
|
+
{
|
|
2064
|
+
ref: ye,
|
|
2065
|
+
id: `lg-${J}-v0`,
|
|
2066
|
+
filterUnits: x ? "userSpaceOnUse" : "objectBoundingBox",
|
|
2067
|
+
primitiveUnits: x ? "userSpaceOnUse" : "objectBoundingBox",
|
|
2068
|
+
colorInterpolationFilters: "sRGB",
|
|
2069
|
+
x: 0,
|
|
2070
|
+
y: 0,
|
|
2071
|
+
width: x ? A.w * ct : 1,
|
|
2072
|
+
height: x ? A.h * ct : 1,
|
|
2073
|
+
children: P && /* @__PURE__ */ a(
|
|
2074
|
+
on,
|
|
2075
|
+
{
|
|
2076
|
+
lens: {
|
|
2077
|
+
...c,
|
|
2078
|
+
scaleX: F !== void 0 ? Pe(F) : c.scaleX ?? c.strength,
|
|
2079
|
+
scaleY: F !== void 0 ? Pe(F) : c.scaleY ?? c.strength
|
|
2080
|
+
},
|
|
2081
|
+
mapHref: wr,
|
|
2082
|
+
feImageRef: D,
|
|
2083
|
+
mapMatrixRef: g,
|
|
2084
|
+
blurStdDeviation: kr,
|
|
2085
|
+
specularFromRawMap: X,
|
|
2086
|
+
brightnessInFilter: H,
|
|
2087
|
+
filterW: x ? A.w * ct : void 0,
|
|
2088
|
+
filterH: x ? A.h * ct : void 0,
|
|
2089
|
+
clipShapeRef: j
|
|
2090
|
+
}
|
|
2091
|
+
)
|
|
2092
|
+
}
|
|
2093
|
+
) })
|
|
2094
|
+
}
|
|
2095
|
+
),
|
|
2096
|
+
i == null && rr,
|
|
2097
|
+
k !== void 0 && /* @__PURE__ */ a(
|
|
2098
|
+
"div",
|
|
2099
|
+
{
|
|
2100
|
+
ref: ne,
|
|
2101
|
+
style: {
|
|
2102
|
+
position: "absolute",
|
|
2103
|
+
top: 0,
|
|
2104
|
+
left: 0,
|
|
2105
|
+
pointerEvents: "none",
|
|
2106
|
+
overflow: "hidden",
|
|
2107
|
+
willChange: "transform"
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
)
|
|
2111
|
+
] }),
|
|
2112
|
+
Pt && t == null && f == null && i == null && /* @__PURE__ */ a(
|
|
2113
|
+
"div",
|
|
2114
|
+
{
|
|
2115
|
+
ref: ee,
|
|
2116
|
+
style: {
|
|
2117
|
+
position: "absolute",
|
|
2118
|
+
top: 0,
|
|
2119
|
+
left: 0,
|
|
2120
|
+
pointerEvents: "none",
|
|
2121
|
+
willChange: "backdrop-filter, transform",
|
|
2122
|
+
backdropFilter: `blur(${c.frost}px)`,
|
|
2123
|
+
WebkitBackdropFilter: `blur(${c.frost}px)`
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
),
|
|
2127
|
+
nr(ge, c.edgeShadow, c.edgeInsetShadow),
|
|
2128
|
+
nr(
|
|
2129
|
+
me,
|
|
2130
|
+
c.restEdgeShadow,
|
|
2131
|
+
c.restEdgeInsetShadow
|
|
2132
|
+
)
|
|
2133
|
+
]
|
|
2134
|
+
}
|
|
963
2135
|
);
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
2136
|
+
}, dr = (t) => ft(
|
|
2137
|
+
() => t == null ? void 0 : xe(t) ? dt([t], () => t.get() / 2) : t / 2,
|
|
2138
|
+
[t]
|
|
2139
|
+
), _t = (t) => {
|
|
2140
|
+
const {
|
|
2141
|
+
children: e,
|
|
2142
|
+
width: s,
|
|
2143
|
+
height: n,
|
|
2144
|
+
size: r,
|
|
2145
|
+
radius: u,
|
|
2146
|
+
center: h,
|
|
2147
|
+
optics: f,
|
|
2148
|
+
refract: l,
|
|
2149
|
+
behind: i,
|
|
2150
|
+
src: k,
|
|
2151
|
+
draw: I,
|
|
2152
|
+
lenses: m,
|
|
2153
|
+
videoRef: d,
|
|
2154
|
+
paused: R,
|
|
2155
|
+
poster: G,
|
|
2156
|
+
loop: $,
|
|
2157
|
+
muted: F,
|
|
2158
|
+
autoPlay: Y,
|
|
2159
|
+
crossOrigin: H,
|
|
2160
|
+
maxDpr: x,
|
|
2161
|
+
unstable_lens: K,
|
|
2162
|
+
...O
|
|
2163
|
+
} = t, S = { ...O, ...K ?? {} }, E = h == null ? void 0 : h.x, y = h == null ? void 0 : h.y, [X, C] = Array.isArray(r) ? r : r != null ? [r, r] : [void 0, void 0], N = dr(s ?? X), _ = dr(n ?? C);
|
|
2164
|
+
if (k != null || I != null)
|
|
2165
|
+
return /* @__PURE__ */ a(
|
|
2166
|
+
Zr,
|
|
2167
|
+
{
|
|
2168
|
+
src: k,
|
|
2169
|
+
draw: I,
|
|
2170
|
+
lens: f,
|
|
2171
|
+
lenses: m,
|
|
2172
|
+
videoRef: d,
|
|
2173
|
+
paused: R,
|
|
2174
|
+
poster: G,
|
|
2175
|
+
loop: $,
|
|
2176
|
+
muted: F,
|
|
2177
|
+
autoPlay: Y,
|
|
2178
|
+
crossOrigin: H,
|
|
2179
|
+
maxDpr: x,
|
|
2180
|
+
lensW: N,
|
|
2181
|
+
lensH: _,
|
|
2182
|
+
borderRadius: u,
|
|
2183
|
+
x: E,
|
|
2184
|
+
y,
|
|
2185
|
+
className: t.className,
|
|
2186
|
+
style: t.style,
|
|
2187
|
+
children: e
|
|
2188
|
+
}
|
|
994
2189
|
);
|
|
995
|
-
const
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
};
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
primary: { displacementScale: 80, blurAmount: 0.0625, saturation: 160 },
|
|
1015
|
-
secondary: { displacementScale: 60, blurAmount: 0.0625, saturation: 140 },
|
|
1016
|
-
subtle: { displacementScale: 40, blurAmount: 0.05, saturation: 120 }
|
|
1017
|
-
}, ir = {
|
|
1018
|
-
sm: { cornerRadius: 999, padding: 0 },
|
|
1019
|
-
md: { cornerRadius: 999, padding: 0 },
|
|
1020
|
-
lg: { cornerRadius: 999, padding: 0 },
|
|
1021
|
-
icon: { cornerRadius: 999, padding: 0 }
|
|
1022
|
-
}, cr = Pe({
|
|
1023
|
-
base: "lg-button",
|
|
1024
|
-
variants: {
|
|
1025
|
-
variant: {
|
|
1026
|
-
primary: "lg-button--primary",
|
|
1027
|
-
secondary: "lg-button--secondary",
|
|
1028
|
-
subtle: "lg-button--subtle"
|
|
1029
|
-
},
|
|
1030
|
-
size: {
|
|
1031
|
-
sm: "lg-button--sm",
|
|
1032
|
-
md: "lg-button--md",
|
|
1033
|
-
lg: "lg-button--lg",
|
|
1034
|
-
icon: "lg-button--icon"
|
|
1035
|
-
}
|
|
1036
|
-
},
|
|
1037
|
-
defaultVariants: { variant: "primary", size: "md" }
|
|
1038
|
-
}), yr = be(function({
|
|
1039
|
-
variant: t = "primary",
|
|
1040
|
-
size: e = "md",
|
|
1041
|
-
asChild: r = !1,
|
|
1042
|
-
shine: s = !0,
|
|
1043
|
-
contentClassName: o,
|
|
1044
|
-
glassProps: a,
|
|
1045
|
-
className: i,
|
|
1046
|
-
children: c,
|
|
1047
|
-
style: u,
|
|
1048
|
-
type: g,
|
|
1049
|
-
disabled: b,
|
|
1050
|
-
...h
|
|
1051
|
-
}, f) {
|
|
1052
|
-
const l = cr({ variant: t, size: e, className: i }), m = {
|
|
1053
|
-
"--lg-edge-shadow": ye("light"),
|
|
1054
|
-
...u
|
|
1055
|
-
}, p = /* @__PURE__ */ d("span", { className: ["lg-content", o].filter(Boolean).join(" "), children: c }), R = r ? /* @__PURE__ */ d(
|
|
1056
|
-
Nt,
|
|
2190
|
+
const {
|
|
2191
|
+
overlay: W,
|
|
2192
|
+
tintColor: B,
|
|
2193
|
+
tintOpacity: c,
|
|
2194
|
+
tintBlur: V,
|
|
2195
|
+
shadowOpacity: J,
|
|
2196
|
+
restShadowOpacity: M,
|
|
2197
|
+
edgeBias: T,
|
|
2198
|
+
brightnessInFilter: q,
|
|
2199
|
+
depth: re,
|
|
2200
|
+
scale: ue,
|
|
2201
|
+
filterResolution: ne,
|
|
2202
|
+
pixelUnits: ee,
|
|
2203
|
+
live: ge,
|
|
2204
|
+
onLensMapChange: me,
|
|
2205
|
+
...ye
|
|
2206
|
+
} = S, D = xe(s) || xe(n) || xe(u) || xe(X) || xe(C) || xe(E) || xe(y);
|
|
2207
|
+
return e != null && l == null && k == null && I == null && m == null && W == null && !ee && B == null && c == null && V == null && J == null && M == null && T == null && !q && ne == null && !ge && re == null && ue == null && me == null && E == null && y == null && !D ? /* @__PURE__ */ a(
|
|
2208
|
+
nn,
|
|
1057
2209
|
{
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
children:
|
|
2210
|
+
...ye,
|
|
2211
|
+
optics: f,
|
|
2212
|
+
radius: u,
|
|
2213
|
+
width: s ?? X,
|
|
2214
|
+
height: n ?? C,
|
|
2215
|
+
children: e
|
|
1064
2216
|
}
|
|
1065
|
-
) : /* @__PURE__ */
|
|
1066
|
-
|
|
2217
|
+
) : /* @__PURE__ */ a(
|
|
2218
|
+
an,
|
|
1067
2219
|
{
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
2220
|
+
...S,
|
|
2221
|
+
lensW: N,
|
|
2222
|
+
lensH: _,
|
|
2223
|
+
borderRadius: u,
|
|
2224
|
+
x: E,
|
|
2225
|
+
y,
|
|
2226
|
+
lens: f,
|
|
2227
|
+
refractionTarget: l,
|
|
2228
|
+
refractionBackground: i,
|
|
2229
|
+
children: e
|
|
1076
2230
|
}
|
|
1077
|
-
)
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
},
|
|
1106
|
-
const
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
2231
|
+
);
|
|
2232
|
+
}, cn = 176, ln = 13.6, Wt = 0.34, un = 0.75, hn = 84, fr = 0.033, pr = 8e-3, gr = 0.03, dn = (t, e, s, n) => {
|
|
2233
|
+
oe(() => {
|
|
2234
|
+
let r = 0, u = 0, h = 0, f = 0, l = t.get(), i = !1;
|
|
2235
|
+
const k = (G) => {
|
|
2236
|
+
const $ = Math.pow(G, un) / hn, F = $ < Wt ? $ : Wt, Y = s.current, H = F > Y ? F : Y;
|
|
2237
|
+
return H < Wt ? H : Wt;
|
|
2238
|
+
}, I = (G) => Math.abs(u) < 6e-4 && Math.abs(h) < 6e-3 && G < 6e-3 && s.current === 0, m = (G) => {
|
|
2239
|
+
const $ = (G - f) / 1e3, F = $ < fr ? $ : fr;
|
|
2240
|
+
f = G;
|
|
2241
|
+
const Y = t.get(), H = $ < pr ? pr : $ > gr ? gr : $, x = Math.abs((Y - l) / H);
|
|
2242
|
+
l = Y;
|
|
2243
|
+
const K = k(x), O = cn * (K - u) - ln * h;
|
|
2244
|
+
if (h += O * F, u += h * F, e.set(u), I(x)) {
|
|
2245
|
+
i = !1, e.set(0);
|
|
2246
|
+
return;
|
|
2247
|
+
}
|
|
2248
|
+
r = requestAnimationFrame(m);
|
|
2249
|
+
}, d = () => {
|
|
2250
|
+
i || (i = !0, f = performance.now(), l = t.get(), r = requestAnimationFrame(m));
|
|
2251
|
+
};
|
|
2252
|
+
n.current = d;
|
|
2253
|
+
const R = t.on("change", d);
|
|
2254
|
+
return () => {
|
|
2255
|
+
R(), cancelAnimationFrame(r), n.current = () => {
|
|
2256
|
+
};
|
|
2257
|
+
};
|
|
2258
|
+
}, [t, e, s, n]);
|
|
2259
|
+
}, Gt = (t, e, s) => {
|
|
2260
|
+
const n = t < s ? t / s : 1;
|
|
2261
|
+
return e * n * (3 + n * (n - 3));
|
|
2262
|
+
}, Ft = Vt.forwardRef(({ x: t, scaleX: e, scaleY: s, style: n, children: r, ...u }, h) => {
|
|
2263
|
+
const f = o(null);
|
|
2264
|
+
return oe(() => {
|
|
2265
|
+
const l = f.current;
|
|
2266
|
+
if (!l) return;
|
|
2267
|
+
const i = [t, e, s].filter(
|
|
2268
|
+
(m) => m != null
|
|
2269
|
+
), k = () => {
|
|
2270
|
+
let m = "";
|
|
2271
|
+
if (t && (m = `translateX(${t.get()}px)`), e || s) {
|
|
2272
|
+
const d = e ? e.get() : 1, R = s ? s.get() : 1;
|
|
2273
|
+
m += `${m ? " " : ""}scale(${d}, ${R})`;
|
|
2274
|
+
}
|
|
2275
|
+
l.style.transform = m;
|
|
2276
|
+
};
|
|
2277
|
+
k();
|
|
2278
|
+
const I = i.map((m) => m.on("change", k));
|
|
2279
|
+
return () => I.forEach((m) => m());
|
|
2280
|
+
}, [t, e, s]), /* @__PURE__ */ a(
|
|
2281
|
+
"div",
|
|
1111
2282
|
{
|
|
1112
|
-
ref:
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
...
|
|
1117
|
-
children:
|
|
2283
|
+
ref: (l) => {
|
|
2284
|
+
f.current = l, typeof h == "function" ? h(l) : h && (h.current = l);
|
|
2285
|
+
},
|
|
2286
|
+
style: n,
|
|
2287
|
+
...u,
|
|
2288
|
+
children: r
|
|
1118
2289
|
}
|
|
1119
|
-
)
|
|
2290
|
+
);
|
|
2291
|
+
});
|
|
2292
|
+
Ft.displayName = "GlassDiv";
|
|
2293
|
+
const Gn = vr(function({
|
|
2294
|
+
variant: e = "primary",
|
|
2295
|
+
size: s = "md",
|
|
2296
|
+
glassProps: n,
|
|
2297
|
+
contentClassName: r,
|
|
2298
|
+
className: u = "",
|
|
2299
|
+
type: h = "button",
|
|
2300
|
+
children: f,
|
|
2301
|
+
...l
|
|
2302
|
+
}, i) {
|
|
2303
|
+
return /* @__PURE__ */ te("span", { className: `matui-glass-button-shell matui-glass-button--${e}`, children: [
|
|
2304
|
+
/* @__PURE__ */ a(
|
|
2305
|
+
_t,
|
|
2306
|
+
{
|
|
2307
|
+
...n,
|
|
2308
|
+
"aria-hidden": !0,
|
|
2309
|
+
style: {
|
|
2310
|
+
...n == null ? void 0 : n.style,
|
|
2311
|
+
position: "absolute",
|
|
2312
|
+
inset: 0,
|
|
2313
|
+
width: "100%",
|
|
2314
|
+
height: "100%",
|
|
2315
|
+
borderRadius: "inherit",
|
|
2316
|
+
pointerEvents: "none"
|
|
2317
|
+
},
|
|
2318
|
+
children: /* @__PURE__ */ a("span", {})
|
|
2319
|
+
}
|
|
2320
|
+
),
|
|
2321
|
+
/* @__PURE__ */ a(
|
|
2322
|
+
"button",
|
|
2323
|
+
{
|
|
2324
|
+
...l,
|
|
2325
|
+
ref: i,
|
|
2326
|
+
type: h,
|
|
2327
|
+
className: `matui-glass-button matui-glass-button--${s} ${u}`,
|
|
2328
|
+
children: /* @__PURE__ */ a("span", { className: r, children: f })
|
|
2329
|
+
}
|
|
2330
|
+
)
|
|
2331
|
+
] });
|
|
2332
|
+
}), Pn = vr(function({ elevation: e = "raised", glassProps: s, className: n = "", children: r, ...u }, h) {
|
|
2333
|
+
return /* @__PURE__ */ a(
|
|
1120
2334
|
"div",
|
|
1121
2335
|
{
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
2336
|
+
...u,
|
|
2337
|
+
ref: h,
|
|
2338
|
+
className: `matui-glass-card matui-glass-card--${e} ${n}`,
|
|
2339
|
+
children: /* @__PURE__ */ a(
|
|
2340
|
+
_t,
|
|
2341
|
+
{
|
|
2342
|
+
...s,
|
|
2343
|
+
style: { width: "100%", padding: 28, borderRadius: "inherit", ...s == null ? void 0 : s.style },
|
|
2344
|
+
children: r
|
|
2345
|
+
}
|
|
2346
|
+
)
|
|
1128
2347
|
}
|
|
1129
2348
|
);
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
2349
|
+
});
|
|
2350
|
+
function Un({
|
|
2351
|
+
label: t,
|
|
2352
|
+
options: e,
|
|
2353
|
+
value: s,
|
|
2354
|
+
defaultValue: n,
|
|
2355
|
+
onValueChange: r,
|
|
2356
|
+
name: u,
|
|
2357
|
+
disabled: h,
|
|
2358
|
+
className: f = ""
|
|
2359
|
+
}) {
|
|
2360
|
+
var m;
|
|
2361
|
+
const l = jt(), [i, k] = Ke(
|
|
2362
|
+
n ?? ((m = e.find((d) => !d.disabled)) == null ? void 0 : m.value) ?? ""
|
|
2363
|
+
), I = s ?? i;
|
|
2364
|
+
return /* @__PURE__ */ te("fieldset", { disabled: h, className: `matui-glass-segmented ${f}`, children: [
|
|
2365
|
+
/* @__PURE__ */ a("legend", { className: "matui-glass-sr-only", children: t }),
|
|
2366
|
+
e.map((d) => /* @__PURE__ */ te("div", { className: "matui-glass-segment", children: [
|
|
2367
|
+
I === d.value && /* @__PURE__ */ a(
|
|
2368
|
+
_t,
|
|
2369
|
+
{
|
|
2370
|
+
"aria-hidden": !0,
|
|
2371
|
+
className: "matui-glass-segment-lens",
|
|
2372
|
+
style: {
|
|
2373
|
+
position: "absolute",
|
|
2374
|
+
inset: 0,
|
|
2375
|
+
borderRadius: 18,
|
|
2376
|
+
width: "100%",
|
|
2377
|
+
height: "100%",
|
|
2378
|
+
background: "#ffffff44",
|
|
2379
|
+
pointerEvents: "none"
|
|
2380
|
+
},
|
|
2381
|
+
children: /* @__PURE__ */ a("span", {})
|
|
2382
|
+
}
|
|
2383
|
+
),
|
|
2384
|
+
/* @__PURE__ */ te("label", { children: [
|
|
2385
|
+
/* @__PURE__ */ a(
|
|
2386
|
+
"input",
|
|
2387
|
+
{
|
|
2388
|
+
type: "radio",
|
|
2389
|
+
name: u ?? l,
|
|
2390
|
+
value: d.value,
|
|
2391
|
+
checked: I === d.value,
|
|
2392
|
+
disabled: d.disabled,
|
|
2393
|
+
onChange: () => {
|
|
2394
|
+
s === void 0 && k(d.value), r == null || r(d.value);
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
),
|
|
2398
|
+
/* @__PURE__ */ a("span", { children: d.label })
|
|
2399
|
+
] })
|
|
2400
|
+
] }, d.value))
|
|
2401
|
+
] });
|
|
2402
|
+
}
|
|
2403
|
+
const yr = "(prefers-reduced-motion: reduce)", fn = (t) => {
|
|
2404
|
+
const e = window.matchMedia(yr);
|
|
2405
|
+
return e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
2406
|
+
}, pn = () => window.matchMedia(yr).matches, gn = () => !1;
|
|
2407
|
+
function Rr() {
|
|
2408
|
+
return Br(fn, pn, gn);
|
|
2409
|
+
}
|
|
2410
|
+
function Sr() {
|
|
2411
|
+
const t = Rr();
|
|
2412
|
+
return Rt(
|
|
2413
|
+
(...[e, s, n]) => zr(e, s, t ? { ...n, duration: 0 } : n),
|
|
2414
|
+
[t]
|
|
2415
|
+
);
|
|
2416
|
+
}
|
|
2417
|
+
function Mr(...[t, e, s, n]) {
|
|
2418
|
+
const r = Rr(), u = ft(() => be(0), []), h = o(0), f = o(() => {
|
|
2419
|
+
});
|
|
2420
|
+
dn(
|
|
2421
|
+
r ? u : t,
|
|
2422
|
+
e,
|
|
2423
|
+
r ? h : s,
|
|
2424
|
+
r ? f : n
|
|
2425
|
+
), oe(() => {
|
|
2426
|
+
r && (e.set(0), n.current = () => {
|
|
2427
|
+
});
|
|
2428
|
+
}, [r, e, n]);
|
|
2429
|
+
}
|
|
2430
|
+
const Er = Lt(0.34, 1.36, 0.42, 1), mn = Lt(0.36, 0, 0.18, 1), Tt = { ease: Er, duration: 0.52 }, kt = { ease: Er, duration: 0.26 }, At = { ease: mn, duration: 0.46 }, bn = {
|
|
2431
|
+
mapSize: 256,
|
|
2432
|
+
// depth/curvature are 0..1 fractions of the thumb's expanded half-extent (~16.5px):
|
|
2433
|
+
// a gentle depth keeps a refractive rim, not a magnifying body dome; the glassy
|
|
2434
|
+
// character is the rim refraction + specular + bloom (raise depth toward 1 for a
|
|
2435
|
+
// true body dome).
|
|
2436
|
+
depth: 0.2,
|
|
2437
|
+
dispersion: 0.65,
|
|
2438
|
+
strength: 0.19,
|
|
2439
|
+
clipToShape: !0,
|
|
2440
|
+
softEdge: !0,
|
|
2441
|
+
curvature: 0.3,
|
|
2442
|
+
splay: 0.6,
|
|
2443
|
+
bend: 0.1,
|
|
2444
|
+
bendWidth: 0.06,
|
|
2445
|
+
frost: 0,
|
|
2446
|
+
brightness: 0.05,
|
|
2447
|
+
specular: 1.2,
|
|
2448
|
+
sheenAngle: 45,
|
|
2449
|
+
sheenDark: !1,
|
|
2450
|
+
glow: 0.05,
|
|
2451
|
+
glowSpread: 0.5,
|
|
2452
|
+
glowFalloff: 1.5,
|
|
2453
|
+
sheen: 0.45,
|
|
2454
|
+
sheenWidth: 2,
|
|
2455
|
+
sheenFalloff: 1.5,
|
|
2456
|
+
edgeShadow: "0 2px 6px rgba(0, 0, 0, 0.16)",
|
|
2457
|
+
edgeInsetShadow: "0 -4px 10px rgba(0, 0, 0, 0.12)",
|
|
2458
|
+
// Resting puck drop-shadow (the floating white thumb sits ABOVE the track) —
|
|
2459
|
+
// a tight contact shadow + a soft ambient one. Fades out as it expands into
|
|
2460
|
+
// the lens (which has its own `edgeShadow`).
|
|
2461
|
+
restEdgeShadow: "0 1px 3px rgba(0, 0, 0, 0.24), 0 4px 10px rgba(0, 0, 0, 0.14)"
|
|
2462
|
+
}, vn = {
|
|
2463
|
+
brightness: 0.12,
|
|
2464
|
+
glow: 0.4,
|
|
2465
|
+
sheen: 0.5
|
|
2466
|
+
}, wn = {
|
|
2467
|
+
brightness: -0.02,
|
|
2468
|
+
sheenAngle: 30,
|
|
2469
|
+
specular: 1.5,
|
|
2470
|
+
glow: 0.4,
|
|
2471
|
+
glowSpread: 0.5,
|
|
2472
|
+
glowFalloff: 2,
|
|
2473
|
+
sheen: 1,
|
|
2474
|
+
sheenWidth: 1.5,
|
|
2475
|
+
sheenFalloff: 1
|
|
2476
|
+
}, mr = "color-mix(in srgb, var(--glass-track), var(--glass-active) calc(var(--switch-progress, 0) * 100%))", On = ({
|
|
2477
|
+
checked: t,
|
|
2478
|
+
defaultChecked: e = !1,
|
|
2479
|
+
onCheckedChange: s,
|
|
2480
|
+
disabled: n,
|
|
2481
|
+
name: r,
|
|
2482
|
+
value: u,
|
|
2483
|
+
ariaLabel: h,
|
|
2484
|
+
width: f = 74,
|
|
2485
|
+
height: l = 28,
|
|
2486
|
+
lens: i,
|
|
2487
|
+
tintBlur: k,
|
|
2488
|
+
rubberOvershoot: I = 0.15,
|
|
2489
|
+
rubberDampening: m = 10,
|
|
2490
|
+
filterResolution: d = 2,
|
|
2491
|
+
forceExpanded: R = !1,
|
|
2492
|
+
onLensMapChange: G,
|
|
2493
|
+
scheme: $ = "light",
|
|
2494
|
+
trackColor: F,
|
|
2495
|
+
activeColor: Y,
|
|
2496
|
+
surface: H
|
|
2497
|
+
}) => {
|
|
2498
|
+
const x = Sr(), [K, O] = Ke(e), S = t ?? K, E = $ === "dark", y = Math.round(0.6 * f), X = l - 6, C = f - y - 6, N = f * I, _ = N * m, W = l / 2, B = X / 2, c = y / 2, V = X / 2, J = Math.round(0.75 * l), M = Math.ceil(0.5 * Math.max(c, V) + N) + 2, T = f + 2 * M, q = l + 2 * M, re = o(C), ue = o(y), ne = o(T), ee = o(M), ge = o(c), me = o(V), ye = o(B), D = o(k ?? 0);
|
|
2499
|
+
qe(() => {
|
|
2500
|
+
re.current = C, ue.current = y, ne.current = T, ee.current = M, ge.current = c, me.current = V, ye.current = B, D.current = k ?? 0;
|
|
2501
|
+
});
|
|
2502
|
+
const j = o(S), g = ft(() => {
|
|
2503
|
+
const v = be(j.current ? re.current : 0), fe = dt(
|
|
2504
|
+
[v],
|
|
2505
|
+
() => (ee.current + 3 + ue.current / 2 + v.get()) / ne.current
|
|
2506
|
+
), pe = be(ge.current), we = be(me.current), je = be(ye.current), w = be(1), z = be(0.85), ae = be(0.525), Ie = be(D.current), We = be(0), Fe = dt([We], () => 1 - We.get()), Le = be(0), ze = dt([pe, Le], () => pe.get() * (1 - 0.2 * Le.get()) * 2), pt = dt([we, Le], () => we.get() * (1 + 0.4 * Le.get()) * 2), Oe = dt([w], () => 0.5 * w.get());
|
|
2507
|
+
return {
|
|
2508
|
+
thumbX: v,
|
|
2509
|
+
lensX: fe,
|
|
2510
|
+
halfW: pe,
|
|
2511
|
+
halfH: we,
|
|
2512
|
+
radius: je,
|
|
2513
|
+
tintOpacity: w,
|
|
2514
|
+
trackScaleX: z,
|
|
2515
|
+
trackScaleY: ae,
|
|
2516
|
+
blur: Ie,
|
|
2517
|
+
shadowOpacity: We,
|
|
2518
|
+
restShadowOpacity: Fe,
|
|
2519
|
+
stretch: Le,
|
|
2520
|
+
lensW: ze,
|
|
2521
|
+
lensH: pt,
|
|
2522
|
+
edgeBias: Oe
|
|
2523
|
+
};
|
|
2524
|
+
}, []), Q = o(0), se = o(() => {
|
|
2525
|
+
});
|
|
2526
|
+
Mr(g.thumbX, g.stretch, Q, se);
|
|
2527
|
+
const A = (v) => {
|
|
2528
|
+
x(g.halfW, 1.5 * ge.current, v), x(g.halfH, 1.5 * me.current, v), x(g.radius, 1.5 * ye.current, v), x(g.tintOpacity, 0, v), x(g.blur, 0, v), x(g.trackScaleX, 0.95, v), x(g.trackScaleY, 0.975, v), x(g.shadowOpacity, 1, v);
|
|
2529
|
+
}, De = (v) => {
|
|
2530
|
+
x(g.halfW, ge.current, v), x(g.halfH, me.current, v), x(g.radius, ye.current, v), x(g.tintOpacity, 1, v), x(g.blur, D.current, v), x(g.trackScaleX, 0.85, v), x(g.trackScaleY, 0.525, v), x(g.shadowOpacity, 0, v);
|
|
2531
|
+
}, ve = o(!1);
|
|
2532
|
+
oe(() => {
|
|
2533
|
+
R !== ve.current && (ve.current = R, R ? (A(kt), Q.current = 0.175, se.current()) : (De(At), Q.current = 0));
|
|
2534
|
+
}, [R]);
|
|
2535
|
+
const P = o("idle"), Z = o(void 0), Re = o(void 0), Ne = o(!0), [Ve, he] = Ke(!1), de = o(!1), Te = o(null), Ge = o(null), b = o(null), Ae = o(0), Xe = o(0), $e = o(!1), _e = o(null);
|
|
2536
|
+
oe(() => {
|
|
2537
|
+
Ne.current = !0;
|
|
2538
|
+
const v = Ge.current;
|
|
2539
|
+
return () => {
|
|
2540
|
+
if (Ne.current = !1, clearTimeout(Z.current), clearTimeout(Re.current), b.current !== null && v) {
|
|
2541
|
+
try {
|
|
2542
|
+
v.releasePointerCapture(b.current);
|
|
2543
|
+
} catch {
|
|
2544
|
+
}
|
|
2545
|
+
b.current = null;
|
|
2546
|
+
}
|
|
2547
|
+
};
|
|
2548
|
+
}, []), oe(() => {
|
|
2549
|
+
Ve || P.current === "tap" || (_e.current = x(g.thumbX, S ? C : 0, Tt));
|
|
2550
|
+
}, [S, Ve, g.thumbX, C, x]), qe(() => {
|
|
2551
|
+
const v = (fe) => {
|
|
2552
|
+
var we;
|
|
2553
|
+
const pe = re.current;
|
|
2554
|
+
(we = Te.current) == null || we.style.setProperty(
|
|
2555
|
+
"--switch-progress",
|
|
2556
|
+
String(pe > 0 ? Math.max(0, Math.min(1, fe / pe)) : 0)
|
|
1174
2557
|
);
|
|
1175
|
-
}, [E]), U = te(V);
|
|
1176
|
-
U.current = V, dr(() => {
|
|
1177
|
-
V();
|
|
1178
|
-
}, [V]), N(() => {
|
|
1179
|
-
const y = G.current;
|
|
1180
|
-
if (!y || typeof ResizeObserver > "u") return;
|
|
1181
|
-
let x = 0;
|
|
1182
|
-
const M = new ResizeObserver(() => {
|
|
1183
|
-
x || (x = requestAnimationFrame(() => {
|
|
1184
|
-
x = 0, U.current();
|
|
1185
|
-
}));
|
|
1186
|
-
});
|
|
1187
|
-
return M.observe(y), () => {
|
|
1188
|
-
x && cancelAnimationFrame(x), M.disconnect();
|
|
1189
|
-
};
|
|
1190
|
-
}, []);
|
|
1191
|
-
const j = tt(
|
|
1192
|
-
(y) => {
|
|
1193
|
-
R || T(y), s == null || s(y);
|
|
1194
|
-
},
|
|
1195
|
-
[R, s]
|
|
1196
|
-
), I = fr[o], se = ye("light"), W = k !== null, oe = W ? {
|
|
1197
|
-
width: `${k.width}px`,
|
|
1198
|
-
transform: `translateX(${k.left}px)`
|
|
1199
|
-
} : {
|
|
1200
|
-
width: `${100 / ne}%`,
|
|
1201
|
-
transform: `translateX(${E * 100}%)`
|
|
1202
2558
|
};
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
2559
|
+
return v(g.thumbX.get()), g.thumbX.on("change", v);
|
|
2560
|
+
}, [g.thumbX]);
|
|
2561
|
+
const nt = ft(
|
|
2562
|
+
() => ({
|
|
2563
|
+
...bn,
|
|
2564
|
+
...E ? vn : wn,
|
|
2565
|
+
...i,
|
|
2566
|
+
sheenDark: !E
|
|
2567
|
+
}),
|
|
2568
|
+
[E, i]
|
|
2569
|
+
), Ue = (v) => {
|
|
2570
|
+
de.current || n || (t === void 0 && O(v), s == null || s(v), P.current === "idle" && (P.current = "tap", A(kt), clearTimeout(Re.current), Re.current = setTimeout(() => {
|
|
2571
|
+
De(At);
|
|
2572
|
+
}, 290), _e.current = x(g.thumbX, v ? C : 0, {
|
|
2573
|
+
...Tt,
|
|
2574
|
+
onComplete: () => {
|
|
2575
|
+
Ne.current && P.current === "tap" && (P.current = "idle");
|
|
1212
2576
|
}
|
|
1213
|
-
);
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
2577
|
+
})));
|
|
2578
|
+
}, et = H ?? (E ? "#1f1f24" : "#ffffff");
|
|
2579
|
+
return /* @__PURE__ */ te(
|
|
2580
|
+
"label",
|
|
2581
|
+
{
|
|
2582
|
+
ref: Te,
|
|
2583
|
+
className: "matui-glass-control",
|
|
2584
|
+
style: {
|
|
2585
|
+
flexShrink: 0,
|
|
2586
|
+
width: f,
|
|
2587
|
+
height: l,
|
|
2588
|
+
overflow: "visible",
|
|
2589
|
+
cursor: n ? "not-allowed" : "pointer",
|
|
2590
|
+
opacity: n ? 0.4 : void 0,
|
|
2591
|
+
borderRadius: 999,
|
|
2592
|
+
display: "block",
|
|
2593
|
+
position: "relative",
|
|
2594
|
+
"--glass-track": F ?? (E ? "#2a2828" : "#e1dfdf"),
|
|
2595
|
+
"--glass-active": Y ?? "#0a84ff"
|
|
2596
|
+
},
|
|
2597
|
+
children: [
|
|
2598
|
+
/* @__PURE__ */ a(
|
|
2599
|
+
"input",
|
|
2600
|
+
{
|
|
2601
|
+
type: "checkbox",
|
|
2602
|
+
role: "switch",
|
|
2603
|
+
"aria-checked": S,
|
|
2604
|
+
checked: S ?? !1,
|
|
2605
|
+
onChange: (v) => Ue(v.target.checked),
|
|
2606
|
+
onClick: (v) => {
|
|
2607
|
+
de.current && v.preventDefault();
|
|
2608
|
+
},
|
|
2609
|
+
onKeyDown: (v) => {
|
|
2610
|
+
v.key === "Enter" && (v.preventDefault(), Ue(!S));
|
|
2611
|
+
},
|
|
2612
|
+
disabled: n,
|
|
2613
|
+
name: r,
|
|
2614
|
+
value: u,
|
|
2615
|
+
"aria-label": h,
|
|
2616
|
+
style: {
|
|
2617
|
+
whiteSpace: "nowrap",
|
|
2618
|
+
clip: "rect(0 0 0 0)",
|
|
2619
|
+
clipPath: "inset(50%)",
|
|
2620
|
+
pointerEvents: "none",
|
|
2621
|
+
border: 0,
|
|
2622
|
+
width: 1,
|
|
2623
|
+
height: 1,
|
|
2624
|
+
margin: -1,
|
|
2625
|
+
padding: 0,
|
|
2626
|
+
position: "absolute",
|
|
2627
|
+
overflow: "hidden"
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
),
|
|
2631
|
+
/* @__PURE__ */ a(
|
|
2632
|
+
_t,
|
|
2633
|
+
{
|
|
2634
|
+
optics: nt,
|
|
2635
|
+
center: { x: g.lensX, y: 0.5 },
|
|
2636
|
+
size: [g.lensW, g.lensH],
|
|
2637
|
+
radius: g.radius,
|
|
2638
|
+
unstable_lens: {
|
|
2639
|
+
tintColor: "white",
|
|
2640
|
+
tintOpacity: g.tintOpacity,
|
|
2641
|
+
tintBlur: g.blur,
|
|
2642
|
+
shadowOpacity: g.shadowOpacity,
|
|
2643
|
+
restShadowOpacity: g.restShadowOpacity,
|
|
2644
|
+
edgeBias: g.edgeBias
|
|
2645
|
+
},
|
|
2646
|
+
filterResolution: d,
|
|
2647
|
+
onLensMapChange: G,
|
|
2648
|
+
behind: et,
|
|
2649
|
+
style: {
|
|
2650
|
+
width: T,
|
|
2651
|
+
height: q,
|
|
2652
|
+
overflow: "visible",
|
|
2653
|
+
margin: -M
|
|
2654
|
+
},
|
|
2655
|
+
refract: /* @__PURE__ */ a(
|
|
1227
2656
|
"div",
|
|
1228
2657
|
{
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
2658
|
+
style: {
|
|
2659
|
+
padding: M,
|
|
2660
|
+
height: l,
|
|
2661
|
+
display: "flex",
|
|
2662
|
+
alignItems: "center",
|
|
2663
|
+
boxSizing: "content-box"
|
|
2664
|
+
},
|
|
2665
|
+
children: /* @__PURE__ */ a(
|
|
2666
|
+
Ft,
|
|
1235
2667
|
{
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
children: /* @__PURE__ */ d("span", { "aria-hidden": "true", className: "lg-segmented-glass-fill" })
|
|
2668
|
+
scaleX: g.trackScaleX,
|
|
2669
|
+
scaleY: g.trackScaleY,
|
|
2670
|
+
style: {
|
|
2671
|
+
width: f,
|
|
2672
|
+
height: J,
|
|
2673
|
+
borderRadius: J / 2,
|
|
2674
|
+
background: mr
|
|
2675
|
+
}
|
|
1245
2676
|
}
|
|
1246
2677
|
)
|
|
1247
2678
|
}
|
|
1248
2679
|
),
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
"
|
|
2680
|
+
children: /* @__PURE__ */ a("div", { style: { padding: M }, children: /* @__PURE__ */ a(
|
|
2681
|
+
"div",
|
|
2682
|
+
{
|
|
2683
|
+
"aria-hidden": !0,
|
|
2684
|
+
style: {
|
|
2685
|
+
width: f,
|
|
2686
|
+
height: l,
|
|
2687
|
+
borderRadius: W,
|
|
2688
|
+
background: mr,
|
|
2689
|
+
display: "block",
|
|
2690
|
+
position: "relative",
|
|
2691
|
+
overflow: "visible"
|
|
2692
|
+
},
|
|
2693
|
+
children: /* @__PURE__ */ a(
|
|
2694
|
+
Ft,
|
|
2695
|
+
{
|
|
2696
|
+
ref: Ge,
|
|
2697
|
+
x: g.thumbX,
|
|
2698
|
+
style: {
|
|
2699
|
+
position: "absolute",
|
|
2700
|
+
willChange: "transform",
|
|
2701
|
+
userSelect: "none",
|
|
2702
|
+
WebkitUserSelect: "none",
|
|
2703
|
+
width: y,
|
|
2704
|
+
height: X,
|
|
2705
|
+
top: 3,
|
|
2706
|
+
left: 3,
|
|
2707
|
+
touchAction: "none"
|
|
2708
|
+
},
|
|
2709
|
+
onPointerDown: (v) => {
|
|
2710
|
+
b.current !== null || n || (b.current = v.pointerId, v.currentTarget.setPointerCapture(v.pointerId), Ae.current = v.clientX, Xe.current = g.thumbX.get(), $e.current = !1, he(!0), de.current = !0, clearTimeout(Z.current), clearTimeout(Re.current), P.current = "pending", Z.current = setTimeout(() => {
|
|
2711
|
+
var fe;
|
|
2712
|
+
P.current === "pending" && (P.current = "hold", (fe = _e.current) == null || fe.stop(), A(kt), Q.current = 0.175, se.current());
|
|
2713
|
+
}, 170));
|
|
2714
|
+
},
|
|
2715
|
+
onPointerMove: (v) => {
|
|
2716
|
+
var we;
|
|
2717
|
+
if (v.pointerId !== b.current) return;
|
|
2718
|
+
const fe = v.clientX - Ae.current;
|
|
2719
|
+
if (!$e.current) {
|
|
2720
|
+
if (Math.abs(fe) < 3) return;
|
|
2721
|
+
$e.current = !0, (we = _e.current) == null || we.stop(), Xe.current = g.thumbX.get(), Ae.current = v.clientX, clearTimeout(Z.current), Q.current = 0, P.current !== "hold" && (P.current = "hold", A(kt));
|
|
2722
|
+
}
|
|
2723
|
+
let pe = Xe.current + (v.clientX - Ae.current);
|
|
2724
|
+
pe < 0 ? pe = -Gt(-pe, N, _) : pe > C && (pe = C + Gt(pe - C, N, _)), g.thumbX.set(pe);
|
|
2725
|
+
},
|
|
2726
|
+
onPointerUp: (v) => {
|
|
2727
|
+
if (v.pointerId === b.current)
|
|
2728
|
+
if (b.current = null, clearTimeout(Z.current), $e.current) {
|
|
2729
|
+
he(!1), P.current = "idle", De(At);
|
|
2730
|
+
const fe = Math.max(0, Math.min(C, g.thumbX.get())) > C / 2;
|
|
2731
|
+
_e.current = x(
|
|
2732
|
+
g.thumbX,
|
|
2733
|
+
fe ? C : 0,
|
|
2734
|
+
Tt
|
|
2735
|
+
), fe !== S && (s == null || s(fe)), requestAnimationFrame(() => {
|
|
2736
|
+
de.current = !1;
|
|
2737
|
+
});
|
|
2738
|
+
} else if (P.current === "pending" || P.current === "tap") {
|
|
2739
|
+
P.current = "tap", de.current = !1, he(!1), A(kt), clearTimeout(Re.current), Re.current = setTimeout(() => {
|
|
2740
|
+
De(At);
|
|
2741
|
+
}, 290);
|
|
2742
|
+
const fe = S ? 0 : C;
|
|
2743
|
+
_e.current = x(g.thumbX, fe, {
|
|
2744
|
+
...Tt,
|
|
2745
|
+
onComplete: () => {
|
|
2746
|
+
Ne.current && P.current === "tap" && (P.current = "idle");
|
|
2747
|
+
}
|
|
2748
|
+
});
|
|
2749
|
+
} else P.current === "hold" ? (P.current = "idle", he(!1), Q.current = 0, De(At), _e.current = x(
|
|
2750
|
+
g.thumbX,
|
|
2751
|
+
S ? C : 0,
|
|
2752
|
+
Tt
|
|
2753
|
+
), requestAnimationFrame(() => {
|
|
2754
|
+
de.current = !1;
|
|
2755
|
+
})) : (he(!1), de.current = !1);
|
|
2756
|
+
},
|
|
2757
|
+
onPointerCancel: (v) => {
|
|
2758
|
+
v.pointerId === b.current && (b.current = null, clearTimeout(Z.current), Q.current = 0, he(!1), P.current = "idle", De(At), _e.current = x(
|
|
2759
|
+
g.thumbX,
|
|
2760
|
+
S ? C : 0,
|
|
2761
|
+
Tt
|
|
2762
|
+
), requestAnimationFrame(() => {
|
|
2763
|
+
de.current = !1;
|
|
2764
|
+
}));
|
|
2765
|
+
},
|
|
2766
|
+
onDragStart: (v) => v.preventDefault()
|
|
2767
|
+
}
|
|
2768
|
+
)
|
|
2769
|
+
}
|
|
2770
|
+
) })
|
|
2771
|
+
}
|
|
2772
|
+
)
|
|
2773
|
+
]
|
|
2774
|
+
}
|
|
2775
|
+
);
|
|
2776
|
+
}, br = { ease: Lt(0.34, 1.36, 0.42, 1), duration: 0.27 }, qt = { ease: Lt(0.36, 0, 0.18, 1), duration: 0.46 }, xn = {
|
|
2777
|
+
mapSize: 256,
|
|
2778
|
+
// depth/curvature are 0..1 fractions of the thumb's expanded half-extent (~16.5px):
|
|
2779
|
+
// depth ≈ 0.12 is a ~1.3–2px refractive rim; curvature ≈ 0.30 shapes the rim BEND
|
|
2780
|
+
// (strongest on the short vertical axis). At this depth the thumb body stays
|
|
2781
|
+
// near-neutral, so the bleed is the two-tone track (blue fill / grey track) showing
|
|
2782
|
+
// through a glassy-rimmed thumb — NOT a magnifying body dome. Per-axis scaleX/scaleY
|
|
2783
|
+
// (vs the switch's single `strength`): a wide thumb over a thin horizontal track
|
|
2784
|
+
// wants more vertical than horizontal bend (Safari more still — see SLIDER_SAFARI).
|
|
2785
|
+
depth: 0.2,
|
|
2786
|
+
dispersion: 0.5,
|
|
2787
|
+
scaleX: 0.06,
|
|
2788
|
+
scaleY: 0.06,
|
|
2789
|
+
clipToShape: !0,
|
|
2790
|
+
softEdge: !0,
|
|
2791
|
+
curvature: 0.55,
|
|
2792
|
+
splay: 0.5,
|
|
2793
|
+
bend: 0.1,
|
|
2794
|
+
bendWidth: 0.05,
|
|
2795
|
+
frost: 0,
|
|
2796
|
+
brightness: 0.06,
|
|
2797
|
+
specular: 1.5,
|
|
2798
|
+
sheenAngle: 45,
|
|
2799
|
+
sheenDark: !1,
|
|
2800
|
+
glow: 0.4,
|
|
2801
|
+
glowSpread: 0.5,
|
|
2802
|
+
glowFalloff: 1.5,
|
|
2803
|
+
sheen: 0,
|
|
2804
|
+
sheenWidth: 3,
|
|
2805
|
+
sheenFalloff: 1.5,
|
|
2806
|
+
edgeShadow: "0 2px 6px rgba(0, 0, 0, 0.16)",
|
|
2807
|
+
edgeInsetShadow: "0 -4px 10px rgba(0, 0, 0, 0.12)"
|
|
2808
|
+
// restEdgeShadow (the floating resting-puck shadow, fades out as the thumb
|
|
2809
|
+
// blooms) is themed per scheme — see SLIDER_DARK / SLIDER_LIGHT below.
|
|
2810
|
+
}, yn = {
|
|
2811
|
+
restEdgeShadow: "0 1.333px 5.333px rgba(0, 0, 0, 0.5)",
|
|
2812
|
+
scaleX: 0.133,
|
|
2813
|
+
scaleY: 0.135,
|
|
2814
|
+
brightness: 0.12,
|
|
2815
|
+
sheenAngle: 45,
|
|
2816
|
+
glowFalloff: 1.5,
|
|
2817
|
+
sheen: 0.5,
|
|
2818
|
+
sheenWidth: 1,
|
|
2819
|
+
sheenFalloff: 1.5
|
|
2820
|
+
}, Rn = {
|
|
2821
|
+
restEdgeShadow: "0 1.333px 5.333px rgba(46, 15, 15, 0.12)",
|
|
2822
|
+
scaleX: 0.1,
|
|
2823
|
+
scaleY: 0.1,
|
|
2824
|
+
brightness: -0.02,
|
|
2825
|
+
sheenAngle: 30,
|
|
2826
|
+
glowFalloff: 2,
|
|
2827
|
+
sheen: 1,
|
|
2828
|
+
sheenWidth: 1,
|
|
2829
|
+
sheenFalloff: 1
|
|
2830
|
+
}, Sn = { scaleY: 0.25 }, Mn = () => {
|
|
2831
|
+
const [t, e] = Ke(!1);
|
|
2832
|
+
return oe(() => {
|
|
2833
|
+
e(
|
|
2834
|
+
typeof navigator < "u" && /^((?!chrome|chromium|android).)*safari/i.test(navigator.userAgent)
|
|
2835
|
+
);
|
|
2836
|
+
}, []), t;
|
|
2837
|
+
}, Nn = ({
|
|
2838
|
+
value: t,
|
|
2839
|
+
defaultValue: e = 50,
|
|
2840
|
+
onValueChange: s,
|
|
2841
|
+
min: n = 0,
|
|
2842
|
+
max: r = 100,
|
|
2843
|
+
step: u = 1,
|
|
2844
|
+
disabled: h,
|
|
2845
|
+
width: f = 240,
|
|
2846
|
+
thumbHeight: l = 22,
|
|
2847
|
+
thumbWidth: i,
|
|
2848
|
+
height: k = 6,
|
|
2849
|
+
rubberOvershoot: I = 0.05,
|
|
2850
|
+
rubberDampening: m = 30,
|
|
2851
|
+
refractionTrackHeight: d,
|
|
2852
|
+
lens: R,
|
|
2853
|
+
tintBlur: G,
|
|
2854
|
+
filterResolution: $ = 2,
|
|
2855
|
+
name: F,
|
|
2856
|
+
ariaLabel: Y,
|
|
2857
|
+
forceExpanded: H = !1,
|
|
2858
|
+
onLensMapChange: x,
|
|
2859
|
+
scheme: K = "light",
|
|
2860
|
+
trackColor: O,
|
|
2861
|
+
activeColor: S,
|
|
2862
|
+
surface: E
|
|
2863
|
+
}) => {
|
|
2864
|
+
const y = Sr(), X = K === "dark", C = Mn(), N = t !== void 0, [_, W] = Ke(e), B = N ? t : _, c = Rt(
|
|
2865
|
+
(w) => {
|
|
2866
|
+
const z = u > 0 ? Math.round((w - n) / u) * u + n : w, ae = Math.max(n, Math.min(r, z));
|
|
2867
|
+
N || W(ae), s == null || s(ae);
|
|
2868
|
+
},
|
|
2869
|
+
[n, r, u, N, s]
|
|
2870
|
+
), V = i ?? Math.round(2 * l), J = f - V, M = V / 2, T = l / 2, q = l / 2, re = k / 2, ue = f * I, ne = ue * m, ee = d ?? Math.round(0.75 * l), ge = Math.ceil(0.5 * Math.max(M, T) + ue) + 2, me = f + 2 * ge, ye = l + 2 * ge, D = o(J), j = o(V), g = o(me), Q = o(ge), se = o(M), A = o(T), De = o(q), ve = o(!1), P = o(0), Z = o(0), Re = o(ue), Ne = o(ne), Ve = o(G ?? 0);
|
|
2871
|
+
qe(() => {
|
|
2872
|
+
D.current = J, j.current = V, g.current = me, Q.current = ge, se.current = M, A.current = T, De.current = q, Re.current = ue, Ne.current = ne, Ve.current = G ?? 0;
|
|
2873
|
+
});
|
|
2874
|
+
const he = Rt(
|
|
2875
|
+
(w) => r > n ? (w - n) / (r - n) * J : 0,
|
|
2876
|
+
[n, r, J]
|
|
2877
|
+
), de = Rt(
|
|
2878
|
+
(w) => {
|
|
2879
|
+
const z = Math.max(0, Math.min(J, w)), ae = J > 0 ? n + z / J * (r - n) : n;
|
|
2880
|
+
return Math.max(
|
|
2881
|
+
n,
|
|
2882
|
+
Math.min(r, u > 0 ? Math.round((ae - n) / u) * u + n : ae)
|
|
2883
|
+
);
|
|
2884
|
+
},
|
|
2885
|
+
[n, r, J, u]
|
|
2886
|
+
), Te = o(he), Ge = o(B), b = ft(() => {
|
|
2887
|
+
const w = be(Te.current(Ge.current)), z = dt(
|
|
2888
|
+
[w],
|
|
2889
|
+
() => (Q.current + j.current / 2 + w.get()) / g.current
|
|
2890
|
+
), ae = be(se.current), Ie = be(A.current), We = be(De.current), Fe = be(1), Le = be(0.85), ze = be(0.525), pt = be(Ve.current), Oe = be(0), wt = dt([Oe], () => 1 - Oe.get()), tt = be(0), at = dt([ae, tt], () => ae.get() * (1 - 0.2 * tt.get()) * 2), ce = dt([Ie, tt], () => Ie.get() * (1 + 0.4 * tt.get()) * 2);
|
|
2891
|
+
return {
|
|
2892
|
+
thumbX: w,
|
|
2893
|
+
lensX: z,
|
|
2894
|
+
halfW: ae,
|
|
2895
|
+
halfH: Ie,
|
|
2896
|
+
radius: We,
|
|
2897
|
+
tintOpacity: Fe,
|
|
2898
|
+
trackScaleX: Le,
|
|
2899
|
+
trackScaleY: ze,
|
|
2900
|
+
blur: pt,
|
|
2901
|
+
shadowOpacity: Oe,
|
|
2902
|
+
restShadowOpacity: wt,
|
|
2903
|
+
stretch: tt,
|
|
2904
|
+
lensW: at,
|
|
2905
|
+
lensH: ce
|
|
2906
|
+
};
|
|
2907
|
+
}, []);
|
|
2908
|
+
oe(() => {
|
|
2909
|
+
ve.current || (b.halfW.set(M), b.halfH.set(T), b.radius.set(q));
|
|
2910
|
+
}, [M, T, q, b]);
|
|
2911
|
+
const Ae = o(0), Xe = o(() => {
|
|
2912
|
+
});
|
|
2913
|
+
Mr(b.thumbX, b.stretch, Ae, Xe);
|
|
2914
|
+
const $e = (w) => {
|
|
2915
|
+
y(b.halfW, 1.5 * se.current, w), y(b.halfH, 1.5 * A.current, w), y(b.radius, 1.5 * De.current, w), y(b.tintOpacity, 0, w), y(b.blur, 0, w), y(b.trackScaleX, 0.95, w), y(b.trackScaleY, 0.975, w), y(b.shadowOpacity, 1, w);
|
|
2916
|
+
}, _e = (w) => {
|
|
2917
|
+
y(b.halfW, se.current, w), y(b.halfH, A.current, w), y(b.radius, De.current, w), y(b.tintOpacity, 1, w), y(b.blur, Ve.current, w), y(b.trackScaleX, 0.85, w), y(b.trackScaleY, 0.525, w), y(b.shadowOpacity, 0, w);
|
|
2918
|
+
}, nt = o(!1);
|
|
2919
|
+
oe(() => {
|
|
2920
|
+
H !== nt.current && (nt.current = H, H ? ($e(br), Ae.current = 0.175, Xe.current()) : (_e(qt), Ae.current = 0));
|
|
2921
|
+
}, [H]);
|
|
2922
|
+
const Ue = o(null), et = o(null), He = o(null), ke = o(null);
|
|
2923
|
+
oe(
|
|
2924
|
+
() => () => {
|
|
2925
|
+
if (ke.current !== null && et.current) {
|
|
2926
|
+
try {
|
|
2927
|
+
et.current.releasePointerCapture(ke.current);
|
|
2928
|
+
} catch {
|
|
2929
|
+
}
|
|
2930
|
+
ke.current = null;
|
|
2931
|
+
}
|
|
2932
|
+
},
|
|
2933
|
+
[]
|
|
2934
|
+
), oe(() => {
|
|
2935
|
+
ve.current || b.thumbX.set(he(B));
|
|
2936
|
+
}, [B, he, b.thumbX]), oe(() => {
|
|
2937
|
+
const w = (z) => {
|
|
2938
|
+
const ae = Ue.current;
|
|
2939
|
+
if (!ae) return;
|
|
2940
|
+
const Ie = j.current / 2 + z, We = D.current > 0 ? z / D.current : 0;
|
|
2941
|
+
ae.style.setProperty("--slider-fill", `${Ie}px`), ae.style.setProperty("--slider-progress", String(Math.max(0, Math.min(1, We))));
|
|
2942
|
+
};
|
|
2943
|
+
return w(b.thumbX.get()), b.thumbX.on("change", w);
|
|
2944
|
+
}, [b.thumbX]);
|
|
2945
|
+
const v = ft(() => ({
|
|
2946
|
+
...xn,
|
|
2947
|
+
...X ? yn : Rn,
|
|
2948
|
+
...C ? Sn : null,
|
|
2949
|
+
...R,
|
|
2950
|
+
sheenDark: !X
|
|
2951
|
+
}), [X, C, R]), fe = E ?? (X ? "#1f1f24" : "#ffffff"), pe = O ?? (X ? "#2a2828" : "#e1dfdf"), we = S ?? "#0a84ff", je = (w) => {
|
|
2952
|
+
if (w.pointerId !== ke.current) return;
|
|
2953
|
+
ke.current = null, ve.current = !1, Ae.current = 0;
|
|
2954
|
+
const z = Math.max(0, Math.min(D.current, b.thumbX.get()));
|
|
2955
|
+
y(b.thumbX, z, qt), _e(qt);
|
|
2956
|
+
};
|
|
2957
|
+
return /* @__PURE__ */ a(
|
|
2958
|
+
"div",
|
|
2959
|
+
{
|
|
2960
|
+
ref: Ue,
|
|
2961
|
+
className: "matui-glass-control",
|
|
2962
|
+
style: {
|
|
2963
|
+
flexShrink: 0,
|
|
2964
|
+
width: f,
|
|
2965
|
+
height: l,
|
|
2966
|
+
overflow: "visible",
|
|
2967
|
+
borderRadius: 999,
|
|
2968
|
+
position: "relative",
|
|
2969
|
+
opacity: h ? 0.4 : void 0,
|
|
2970
|
+
cursor: h ? "not-allowed" : void 0,
|
|
2971
|
+
"--glass-track": pe,
|
|
2972
|
+
"--glass-active": we
|
|
2973
|
+
},
|
|
2974
|
+
children: /* @__PURE__ */ a(
|
|
2975
|
+
_t,
|
|
2976
|
+
{
|
|
2977
|
+
optics: v,
|
|
2978
|
+
center: { x: b.lensX, y: 0.5 },
|
|
2979
|
+
size: [b.lensW, b.lensH],
|
|
2980
|
+
radius: b.radius,
|
|
2981
|
+
unstable_lens: {
|
|
2982
|
+
tintColor: "white",
|
|
2983
|
+
tintOpacity: b.tintOpacity,
|
|
2984
|
+
tintBlur: b.blur,
|
|
2985
|
+
shadowOpacity: b.shadowOpacity,
|
|
2986
|
+
restShadowOpacity: b.restShadowOpacity
|
|
2987
|
+
},
|
|
2988
|
+
filterResolution: $,
|
|
2989
|
+
onLensMapChange: x,
|
|
2990
|
+
behind: fe,
|
|
2991
|
+
style: {
|
|
2992
|
+
width: me,
|
|
2993
|
+
height: ye,
|
|
2994
|
+
overflow: "visible",
|
|
2995
|
+
margin: -ge
|
|
2996
|
+
},
|
|
2997
|
+
refract: /* @__PURE__ */ a(
|
|
2998
|
+
"div",
|
|
2999
|
+
{
|
|
3000
|
+
style: {
|
|
3001
|
+
padding: ge,
|
|
3002
|
+
height: l,
|
|
3003
|
+
display: "flex",
|
|
3004
|
+
alignItems: "center",
|
|
3005
|
+
boxSizing: "content-box"
|
|
3006
|
+
},
|
|
3007
|
+
children: /* @__PURE__ */ te(
|
|
3008
|
+
Ft,
|
|
1253
3009
|
{
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
3010
|
+
scaleX: b.trackScaleX,
|
|
3011
|
+
scaleY: b.trackScaleY,
|
|
3012
|
+
style: {
|
|
3013
|
+
position: "relative",
|
|
3014
|
+
width: f,
|
|
3015
|
+
height: ee,
|
|
3016
|
+
borderRadius: ee / 2,
|
|
3017
|
+
overflow: "hidden"
|
|
1260
3018
|
},
|
|
1261
3019
|
children: [
|
|
1262
|
-
/* @__PURE__ */
|
|
1263
|
-
"
|
|
3020
|
+
/* @__PURE__ */ a(
|
|
3021
|
+
"div",
|
|
1264
3022
|
{
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
checked: M,
|
|
1271
|
-
disabled: y.disabled,
|
|
1272
|
-
onChange: () => j(y.value)
|
|
3023
|
+
style: {
|
|
3024
|
+
position: "absolute",
|
|
3025
|
+
inset: 0,
|
|
3026
|
+
background: "var(--glass-track)"
|
|
3027
|
+
}
|
|
1273
3028
|
}
|
|
1274
3029
|
),
|
|
1275
|
-
|
|
1276
|
-
|
|
3030
|
+
/* @__PURE__ */ a(
|
|
3031
|
+
"div",
|
|
3032
|
+
{
|
|
3033
|
+
style: {
|
|
3034
|
+
position: "absolute",
|
|
3035
|
+
inset: 0,
|
|
3036
|
+
background: "var(--glass-active)",
|
|
3037
|
+
borderRadius: "inherit",
|
|
3038
|
+
transform: "translateX(calc((var(--slider-progress, 0) - 1) * 100%))"
|
|
3039
|
+
}
|
|
3040
|
+
}
|
|
3041
|
+
)
|
|
1277
3042
|
]
|
|
3043
|
+
}
|
|
3044
|
+
)
|
|
3045
|
+
}
|
|
3046
|
+
),
|
|
3047
|
+
children: /* @__PURE__ */ te("div", { style: { padding: ge }, children: [
|
|
3048
|
+
/* @__PURE__ */ a(
|
|
3049
|
+
"input",
|
|
3050
|
+
{
|
|
3051
|
+
ref: He,
|
|
3052
|
+
type: "range",
|
|
3053
|
+
min: n,
|
|
3054
|
+
max: r,
|
|
3055
|
+
step: u,
|
|
3056
|
+
value: B,
|
|
3057
|
+
disabled: h,
|
|
3058
|
+
name: F,
|
|
3059
|
+
"aria-label": Y,
|
|
3060
|
+
onChange: (w) => c(Number(w.target.value)),
|
|
3061
|
+
style: {
|
|
3062
|
+
whiteSpace: "nowrap",
|
|
3063
|
+
clip: "rect(0 0 0 0)",
|
|
3064
|
+
clipPath: "inset(50%)",
|
|
3065
|
+
pointerEvents: "none",
|
|
3066
|
+
border: 0,
|
|
3067
|
+
width: 1,
|
|
3068
|
+
height: 1,
|
|
3069
|
+
margin: -1,
|
|
3070
|
+
padding: 0,
|
|
3071
|
+
position: "absolute",
|
|
3072
|
+
overflow: "hidden"
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3075
|
+
),
|
|
3076
|
+
/* @__PURE__ */ te(
|
|
3077
|
+
"div",
|
|
3078
|
+
{
|
|
3079
|
+
ref: et,
|
|
3080
|
+
"aria-hidden": !0,
|
|
3081
|
+
style: {
|
|
3082
|
+
width: f,
|
|
3083
|
+
height: l,
|
|
3084
|
+
cursor: h ? "not-allowed" : "pointer",
|
|
3085
|
+
touchAction: "none",
|
|
3086
|
+
userSelect: "none",
|
|
3087
|
+
WebkitUserSelect: "none",
|
|
3088
|
+
alignItems: "center",
|
|
3089
|
+
display: "flex",
|
|
3090
|
+
position: "relative",
|
|
3091
|
+
overflow: "visible"
|
|
1278
3092
|
},
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
3093
|
+
onPointerDown: (w) => {
|
|
3094
|
+
var We, Fe;
|
|
3095
|
+
if (h || ke.current !== null) return;
|
|
3096
|
+
ke.current = w.pointerId, w.currentTarget.setPointerCapture(w.pointerId), ve.current = !0, (We = He.current) == null || We.focus({ preventScroll: !0 });
|
|
3097
|
+
const z = (Fe = et.current) == null ? void 0 : Fe.getBoundingClientRect(), ae = z ? w.clientX - z.left - j.current / 2 : 0, Ie = Math.max(0, Math.min(D.current, ae));
|
|
3098
|
+
b.thumbX.set(Ie), c(de(Ie)), P.current = w.clientX, Z.current = Ie, $e(br), Ae.current = 0.175, Xe.current();
|
|
3099
|
+
},
|
|
3100
|
+
onPointerMove: (w) => {
|
|
3101
|
+
if (w.pointerId !== ke.current) return;
|
|
3102
|
+
let z = Z.current + (w.clientX - P.current);
|
|
3103
|
+
z < 0 ? z = -Gt(-z, Re.current, Ne.current) : z > D.current && (z = D.current + Gt(z - D.current, Re.current, Ne.current)), b.thumbX.set(z), c(de(Math.max(0, Math.min(D.current, z))));
|
|
3104
|
+
},
|
|
3105
|
+
onPointerUp: je,
|
|
3106
|
+
onPointerCancel: je,
|
|
3107
|
+
onDragStart: (w) => w.preventDefault(),
|
|
3108
|
+
children: [
|
|
3109
|
+
/* @__PURE__ */ te(
|
|
3110
|
+
"div",
|
|
3111
|
+
{
|
|
3112
|
+
style: {
|
|
3113
|
+
width: "100%",
|
|
3114
|
+
position: "relative",
|
|
3115
|
+
overflow: "hidden",
|
|
3116
|
+
height: k,
|
|
3117
|
+
borderRadius: re
|
|
3118
|
+
},
|
|
3119
|
+
children: [
|
|
3120
|
+
/* @__PURE__ */ a(
|
|
3121
|
+
"div",
|
|
3122
|
+
{
|
|
3123
|
+
style: {
|
|
3124
|
+
position: "absolute",
|
|
3125
|
+
inset: 0,
|
|
3126
|
+
background: "var(--glass-track)",
|
|
3127
|
+
borderRadius: "inherit"
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
3130
|
+
),
|
|
3131
|
+
/* @__PURE__ */ a(
|
|
3132
|
+
"div",
|
|
3133
|
+
{
|
|
3134
|
+
style: {
|
|
3135
|
+
position: "absolute",
|
|
3136
|
+
top: 0,
|
|
3137
|
+
left: 0,
|
|
3138
|
+
bottom: 0,
|
|
3139
|
+
width: "var(--slider-fill)",
|
|
3140
|
+
background: "var(--glass-active)",
|
|
3141
|
+
borderRadius: re
|
|
3142
|
+
}
|
|
3143
|
+
}
|
|
3144
|
+
)
|
|
3145
|
+
]
|
|
3146
|
+
}
|
|
3147
|
+
),
|
|
3148
|
+
/* @__PURE__ */ a(
|
|
3149
|
+
Ft,
|
|
3150
|
+
{
|
|
3151
|
+
x: b.thumbX,
|
|
3152
|
+
style: {
|
|
3153
|
+
willChange: "transform",
|
|
3154
|
+
position: "absolute",
|
|
3155
|
+
top: 0,
|
|
3156
|
+
left: 0,
|
|
3157
|
+
width: V,
|
|
3158
|
+
height: l
|
|
3159
|
+
}
|
|
3160
|
+
}
|
|
3161
|
+
)
|
|
3162
|
+
]
|
|
3163
|
+
}
|
|
3164
|
+
)
|
|
1282
3165
|
] })
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
3166
|
+
}
|
|
3167
|
+
)
|
|
3168
|
+
}
|
|
3169
|
+
);
|
|
3170
|
+
}, En = "-apple-system, 'SF Pro Text', ui-sans-serif, system-ui, sans-serif", Tn = {
|
|
3171
|
+
mapSize: 256,
|
|
3172
|
+
clipToShape: !0,
|
|
3173
|
+
softEdge: !0,
|
|
3174
|
+
depth: 1,
|
|
3175
|
+
curvature: 0.5,
|
|
3176
|
+
dispersion: 0.6,
|
|
3177
|
+
strength: 0.17,
|
|
3178
|
+
bend: 0.7,
|
|
3179
|
+
bendWidth: 0.12,
|
|
3180
|
+
// Light frost so the bend + chroma stay visible (a heavy blur washes the
|
|
3181
|
+
// refraction out), with a soft veil + sheen for the glassy edge. Legibility comes
|
|
3182
|
+
// from the card overlay's top-lit white gradient, not a heavy lens veil.
|
|
3183
|
+
frost: 3,
|
|
3184
|
+
brightness: 0.22,
|
|
3185
|
+
specular: 1.3,
|
|
3186
|
+
sheenAngle: 50,
|
|
3187
|
+
glow: 0.32,
|
|
3188
|
+
glowSpread: 1,
|
|
3189
|
+
glowFalloff: 1,
|
|
3190
|
+
sheen: 1.3,
|
|
3191
|
+
sheenWidth: 3
|
|
3192
|
+
}, An = "#1c1c1e", _n = "rgba(0,0,0,0.5)", kn = "rgba(0,0,0,0.74)", Fn = "radial-gradient(120% 120% at 12% 18%, #ff9d4d 0%, transparent 46%),radial-gradient(120% 120% at 82% 14%, #4dc3ff 0%, transparent 44%),radial-gradient(130% 130% at 78% 88%, #ff5d8f 0%, transparent 50%),radial-gradient(140% 140% at 22% 86%, #7a5cff 0%, transparent 52%),linear-gradient(135deg, #b24bd8, #f0793b)", Ln = ({ bg: t }) => /* @__PURE__ */ a(
|
|
3193
|
+
"div",
|
|
3194
|
+
{
|
|
3195
|
+
"aria-hidden": !0,
|
|
3196
|
+
style: {
|
|
3197
|
+
position: "absolute",
|
|
3198
|
+
inset: 0,
|
|
3199
|
+
background: t,
|
|
3200
|
+
backgroundSize: "cover",
|
|
3201
|
+
backgroundPosition: "center"
|
|
3202
|
+
}
|
|
1286
3203
|
}
|
|
1287
|
-
),
|
|
3204
|
+
), Cn = 420, Dn = 48, Bt = 84, Kt = 20, Xn = () => {
|
|
3205
|
+
const t = o(null), [e, s] = Ke({ w: 0, h: 0 });
|
|
3206
|
+
return qe(() => {
|
|
3207
|
+
const n = t.current;
|
|
3208
|
+
if (!n) return;
|
|
3209
|
+
const r = () => s({ w: n.clientWidth, h: n.clientHeight });
|
|
3210
|
+
r();
|
|
3211
|
+
const u = new ResizeObserver(r);
|
|
3212
|
+
return u.observe(n), () => u.disconnect();
|
|
3213
|
+
}, []), [t, e];
|
|
3214
|
+
}, $n = ({
|
|
3215
|
+
title: t = "Priya Raman",
|
|
3216
|
+
time: e = "now",
|
|
3217
|
+
body: s = "Just landed — grabbing a cab. Save me a seat and order the usual?",
|
|
3218
|
+
avatar: n = "PR",
|
|
3219
|
+
wallpaper: r = Fn,
|
|
3220
|
+
lens: u
|
|
3221
|
+
}) => {
|
|
3222
|
+
const [h, { w: f, h: l }] = Xn(), i = Math.round(Math.min(f - Dn, Cn)), k = f > 0 && l > 0 && i > 0, I = Math.round((f - i) / 2), m = Math.round((l - Bt) / 2);
|
|
3223
|
+
return /* @__PURE__ */ te(
|
|
3224
|
+
"div",
|
|
3225
|
+
{
|
|
3226
|
+
ref: h,
|
|
3227
|
+
style: {
|
|
3228
|
+
position: "relative",
|
|
3229
|
+
width: "100%",
|
|
3230
|
+
height: "100%",
|
|
3231
|
+
overflow: "hidden",
|
|
3232
|
+
fontFamily: En,
|
|
3233
|
+
userSelect: "none"
|
|
3234
|
+
},
|
|
3235
|
+
children: [
|
|
3236
|
+
/* @__PURE__ */ a(Ln, { bg: r }),
|
|
3237
|
+
k && /* @__PURE__ */ te(ot, { children: [
|
|
3238
|
+
/* @__PURE__ */ a(
|
|
3239
|
+
_t,
|
|
3240
|
+
{
|
|
3241
|
+
optics: { ...Tn, ...u },
|
|
3242
|
+
brightnessInFilter: !0,
|
|
3243
|
+
width: i,
|
|
3244
|
+
height: Bt,
|
|
3245
|
+
radius: Kt,
|
|
3246
|
+
refract: /* @__PURE__ */ a(
|
|
3247
|
+
"div",
|
|
3248
|
+
{
|
|
3249
|
+
"aria-hidden": !0,
|
|
3250
|
+
style: {
|
|
3251
|
+
position: "absolute",
|
|
3252
|
+
left: -I,
|
|
3253
|
+
top: -m,
|
|
3254
|
+
width: f,
|
|
3255
|
+
height: l,
|
|
3256
|
+
background: r,
|
|
3257
|
+
backgroundSize: "cover",
|
|
3258
|
+
backgroundPosition: "center"
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3261
|
+
),
|
|
3262
|
+
behind: "#c8569f",
|
|
3263
|
+
style: {
|
|
3264
|
+
position: "absolute",
|
|
3265
|
+
left: I,
|
|
3266
|
+
top: m,
|
|
3267
|
+
width: i,
|
|
3268
|
+
height: Bt,
|
|
3269
|
+
borderRadius: Kt
|
|
3270
|
+
}
|
|
3271
|
+
}
|
|
3272
|
+
),
|
|
3273
|
+
/* @__PURE__ */ te(
|
|
3274
|
+
"div",
|
|
3275
|
+
{
|
|
3276
|
+
style: {
|
|
3277
|
+
position: "absolute",
|
|
3278
|
+
left: I,
|
|
3279
|
+
top: m,
|
|
3280
|
+
width: i,
|
|
3281
|
+
height: Bt,
|
|
3282
|
+
borderRadius: Kt,
|
|
3283
|
+
// A top-lit white gradient brightens the frosted glass (so it reads
|
|
3284
|
+
// light, not dark over a dark wallpaper) and gives it dimension —
|
|
3285
|
+
// the refraction still shows through the lower-opacity lower half.
|
|
3286
|
+
background: "linear-gradient(180deg, rgba(255,255,255,0.62) 0%, rgba(255,255,255,0.16) 100%)",
|
|
3287
|
+
// Edge stack: a bright top sheen, a 1px white inner highlight, a soft
|
|
3288
|
+
// inner glow blooming in from the rim, the dark hairline, + float shadow.
|
|
3289
|
+
boxShadow: "inset 0 1px 0 rgba(255,255,255,0.95), inset 0 0 0 1px rgba(255,255,255,0.5), inset 0 0 24px rgba(255,255,255,0.55), 0 0 0 0.5px rgba(0,0,0,0.18), 0 14px 36px rgba(0,0,0,0.22), 0 2px 5px rgba(0,0,0,0.14)",
|
|
3290
|
+
display: "flex",
|
|
3291
|
+
alignItems: "center",
|
|
3292
|
+
gap: 14,
|
|
3293
|
+
padding: "0 18px",
|
|
3294
|
+
boxSizing: "border-box",
|
|
3295
|
+
color: An
|
|
3296
|
+
},
|
|
3297
|
+
children: [
|
|
3298
|
+
/* @__PURE__ */ a(
|
|
3299
|
+
"div",
|
|
3300
|
+
{
|
|
3301
|
+
"aria-hidden": !0,
|
|
3302
|
+
style: {
|
|
3303
|
+
flexShrink: 0,
|
|
3304
|
+
width: 40,
|
|
3305
|
+
height: 40,
|
|
3306
|
+
borderRadius: "50%",
|
|
3307
|
+
display: "grid",
|
|
3308
|
+
placeItems: "center",
|
|
3309
|
+
background: "linear-gradient(160deg, #2e9bff 0%, #0a6cff 100%)",
|
|
3310
|
+
color: "#fff",
|
|
3311
|
+
fontSize: 14,
|
|
3312
|
+
fontWeight: 600,
|
|
3313
|
+
letterSpacing: 0.3,
|
|
3314
|
+
boxShadow: "inset 0 1px 1px rgba(255,255,255,0.4)"
|
|
3315
|
+
},
|
|
3316
|
+
children: n
|
|
3317
|
+
}
|
|
3318
|
+
),
|
|
3319
|
+
/* @__PURE__ */ te("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
3320
|
+
/* @__PURE__ */ te("div", { style: { display: "flex", alignItems: "baseline", gap: 8 }, children: [
|
|
3321
|
+
/* @__PURE__ */ a("span", { style: { fontSize: 14.5, fontWeight: 600 }, children: t }),
|
|
3322
|
+
/* @__PURE__ */ a(
|
|
3323
|
+
"span",
|
|
3324
|
+
{
|
|
3325
|
+
style: {
|
|
3326
|
+
marginLeft: "auto",
|
|
3327
|
+
fontSize: 12,
|
|
3328
|
+
color: _n,
|
|
3329
|
+
whiteSpace: "nowrap"
|
|
3330
|
+
},
|
|
3331
|
+
children: e
|
|
3332
|
+
}
|
|
3333
|
+
)
|
|
3334
|
+
] }),
|
|
3335
|
+
/* @__PURE__ */ a(
|
|
3336
|
+
"div",
|
|
3337
|
+
{
|
|
3338
|
+
style: {
|
|
3339
|
+
marginTop: 3,
|
|
3340
|
+
fontSize: 13.5,
|
|
3341
|
+
lineHeight: 1.35,
|
|
3342
|
+
color: kn,
|
|
3343
|
+
display: "-webkit-box",
|
|
3344
|
+
WebkitLineClamp: 2,
|
|
3345
|
+
WebkitBoxOrient: "vertical",
|
|
3346
|
+
overflow: "hidden"
|
|
3347
|
+
},
|
|
3348
|
+
children: s
|
|
3349
|
+
}
|
|
3350
|
+
)
|
|
3351
|
+
] })
|
|
3352
|
+
]
|
|
3353
|
+
}
|
|
3354
|
+
)
|
|
3355
|
+
] })
|
|
3356
|
+
]
|
|
3357
|
+
}
|
|
3358
|
+
);
|
|
3359
|
+
}, Hn = "0.3.0";
|
|
1288
3360
|
export {
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
wt as averageColorToSample,
|
|
1299
|
-
vn as calculateDirectionalScale,
|
|
1300
|
-
xn as calculateElasticTranslation,
|
|
1301
|
-
br as createCanvasSnapshotStrategy,
|
|
1302
|
-
an as detectGlassCapabilities,
|
|
1303
|
-
Un as domBackgroundStrategy,
|
|
1304
|
-
xt as getConservativeGlassCapabilities,
|
|
1305
|
-
hn as getDisplacementMap,
|
|
1306
|
-
ye as getGlassEdgeShadow,
|
|
1307
|
-
$n as luminanceToScheme,
|
|
1308
|
-
On as parseCssColor,
|
|
1309
|
-
Dn as relativeLuminance,
|
|
1310
|
-
ue as roundedRectSDF,
|
|
1311
|
-
Pn as safeSample,
|
|
1312
|
-
Yn as sampleBackdropLuminance,
|
|
1313
|
-
de as smoothStep,
|
|
1314
|
-
Mt as useBackdropLuminance,
|
|
1315
|
-
cn as useGlassCapabilities,
|
|
1316
|
-
qn as useMousePosition,
|
|
1317
|
-
jn as usePrefersContrast,
|
|
1318
|
-
Be as useReducedMotion,
|
|
1319
|
-
zn as useReducedTransparency
|
|
3361
|
+
_t as Glass,
|
|
3362
|
+
Gn as GlassButton,
|
|
3363
|
+
Pn as GlassCard,
|
|
3364
|
+
$n as GlassNotification,
|
|
3365
|
+
Un as GlassSegmentedControl,
|
|
3366
|
+
Nn as GlassSlider,
|
|
3367
|
+
On as GlassSwitch,
|
|
3368
|
+
_t as LiquidGlass,
|
|
3369
|
+
Hn as VERSION
|
|
1320
3370
|
};
|