cos-design 2.4.1 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +203 -98
  3. package/dist/components/audioVisualizer/index.d.ts +9 -0
  4. package/dist/components/aurora/index.d.ts +9 -0
  5. package/dist/components/barcodeScan/index.d.ts +11 -0
  6. package/dist/components/burnAway/index.d.ts +11 -0
  7. package/dist/components/clickSpark/index.d.ts +10 -0
  8. package/dist/components/cursorTrail/index.d.ts +11 -0
  9. package/dist/components/cyberGrid/index.d.ts +11 -0
  10. package/dist/components/diceRoll/index.d.ts +9 -0
  11. package/dist/components/dnaHelix/index.d.ts +9 -0
  12. package/dist/components/electricArc/index.d.ts +8 -0
  13. package/dist/components/gradientFlow/index.d.ts +11 -0
  14. package/dist/components/gravityBalls/index.d.ts +8 -0
  15. package/dist/components/holographicCard/index.d.ts +8 -0
  16. package/dist/components/index.d.ts +68 -0
  17. package/dist/components/liquidGlass/index.d.ts +10 -0
  18. package/dist/components/liquidProgress/index.d.ts +9 -0
  19. package/dist/components/magneticButton/index.d.ts +10 -0
  20. package/dist/components/mazeGenerator/index.d.ts +9 -0
  21. package/dist/components/newtonCradle/index.d.ts +7 -0
  22. package/dist/components/orbitalChart/index.d.ts +12 -0
  23. package/dist/components/progressChest/index.d.ts +11 -0
  24. package/dist/components/radarScan/index.d.ts +9 -0
  25. package/dist/components/redPacketRain/index.d.ts +9 -0
  26. package/dist/components/rippleWater/index.d.ts +9 -0
  27. package/dist/components/scrambleText/index.d.ts +11 -0
  28. package/dist/components/scratchCard/index.d.ts +13 -0
  29. package/dist/components/slotMachine/index.d.ts +9 -0
  30. package/dist/components/smokeFog/index.d.ts +9 -0
  31. package/dist/components/snowfall/index.d.ts +11 -0
  32. package/dist/components/speedometer/index.d.ts +9 -0
  33. package/dist/components/splitReveal/index.d.ts +11 -0
  34. package/dist/components/spotlight/index.d.ts +10 -0
  35. package/dist/components/starfield/index.d.ts +11 -0
  36. package/dist/components/timelinePulse/index.d.ts +8 -0
  37. package/dist/components/waveText/index.d.ts +13 -0
  38. package/dist/index.cjs +1 -1
  39. package/dist/index.css +1 -1
  40. package/dist/index.js +2331 -367
  41. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,60 +1,285 @@
1
- import { forwardRef as e, useCallback as t, useEffect as n, useImperativeHandle as r, useMemo as i, useRef as a, useState as o } from "react";
2
- import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
3
- import './index.css';var u = {
1
+ import { forwardRef as e, useCallback as t, useEffect as n, useId as r, useImperativeHandle as i, useMemo as a, useRef as o, useState as s } from "react";
2
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
3
+ import './index.css';var d = {
4
+ barcodeScan: "cos-barcodeScan-aH9Ad",
5
+ content: "cos-content-F73ZD",
6
+ "glitch-skew": "cos-glitch-skew-inh6a",
7
+ placeholder: "cos-placeholder-yYVB8",
8
+ overlay: "cos-overlay-4AiY5",
9
+ scanLine: "cos-scanLine-VBsRv",
10
+ scan: "cos-scan-JD4wO",
11
+ glitchLayer: "cos-glitchLayer-nzkIa",
12
+ flicker: "cos-flicker-P0jQE",
13
+ corners: "cos-corners-1bjak"
14
+ }, f = ({ children: e, scanColor: t = "#22c55e", speed: n = 2.5 }) => /* @__PURE__ */ u("div", {
15
+ className: d.barcodeScan,
16
+ style: {
17
+ "--scan-color": t,
18
+ "--scan-speed": `${n}s`
19
+ },
20
+ children: [
21
+ /* @__PURE__ */ l("div", {
22
+ className: d.content,
23
+ children: e ?? /* @__PURE__ */ l("span", {
24
+ className: d.placeholder,
25
+ children: "SCAN ME"
26
+ })
27
+ }),
28
+ /* @__PURE__ */ u("div", {
29
+ className: d.overlay,
30
+ children: [/* @__PURE__ */ l("div", { className: d.scanLine }), /* @__PURE__ */ l("div", { className: d.glitchLayer })]
31
+ }),
32
+ /* @__PURE__ */ u("div", {
33
+ className: d.corners,
34
+ children: [
35
+ /* @__PURE__ */ l("span", {}),
36
+ /* @__PURE__ */ l("span", {}),
37
+ /* @__PURE__ */ l("span", {}),
38
+ /* @__PURE__ */ l("span", {})
39
+ ]
40
+ })
41
+ ]
42
+ }), p = {
43
+ burnAway: "cos-burnAway-QWIjy",
44
+ stage: "cos-stage-8VIfE",
45
+ text: "cos-text-0guk-",
46
+ canvas: "cos-canvas-Bwc-u",
47
+ trigger: "cos-trigger-UDZqV",
48
+ hint: "cos-hint-XQUfv"
49
+ }, m = ({ text: e = "BURN", fontSize: r = 64, onComplete: i }) => {
50
+ let a = o(null), c = o(null), [d, f] = s(!1), [m, h] = s(!1), g = o(!1), _ = o(i);
51
+ n(() => {
52
+ _.current = i;
53
+ }, [i]);
54
+ let v = t(() => {
55
+ d || m || f(!0);
56
+ }, [d, m]);
57
+ return n(() => {
58
+ if (!d || m) return;
59
+ let t = a.current, n = c.current;
60
+ if (!t || !n) return;
61
+ let i = t.getBoundingClientRect(), o = window.devicePixelRatio || 1, s = Math.ceil(i.width), l = Math.ceil(i.height);
62
+ n.width = s * o, n.height = l * o, n.style.width = `${s}px`, n.style.height = `${l}px`;
63
+ let u = n.getContext("2d");
64
+ if (!u) return;
65
+ u.scale(o, o);
66
+ let f = document.createElement("canvas");
67
+ f.width = s * o, f.height = l * o;
68
+ let p = f.getContext("2d");
69
+ if (!p) return;
70
+ p.scale(o, o), p.font = `900 ${r}px system-ui, sans-serif`, p.textAlign = "center", p.textBaseline = "middle", p.fillStyle = "#f8fafc", p.fillText(e, s / 2, l / 2);
71
+ let v = p.getImageData(0, 0, s * o, l * o).data, y = [];
72
+ for (let e = 0; e < l; e += 4) for (let t = 0; t < s; t += 4) v[(Math.floor(e * o) * s * o + Math.floor(t * o)) * 4 + 3] > 128 && y.push({
73
+ x: t,
74
+ y: e,
75
+ vx: (Math.random() - .5) * 2,
76
+ vy: -Math.random() * 3 - 1,
77
+ life: 1,
78
+ maxLife: .6 + Math.random() * .6,
79
+ size: 2 + Math.random() * 3
80
+ });
81
+ let b = 0, x = 0, S = !1, C = (e, t) => {
82
+ if (S) return;
83
+ let n = Math.min((e - t) / 16, 2);
84
+ x += n * 16, u.clearRect(0, 0, s, l);
85
+ let r = 0;
86
+ for (let e of y) {
87
+ if (e.life -= n * .012 / e.maxLife, e.life <= 0) continue;
88
+ r++, e.x += e.vx * n, e.y += e.vy * n, e.vy += .04 * n;
89
+ let t = e.life, i = 1 - e.life, a = Math.max(0, 200 - i * 200), o = Math.max(0, 80 - i * 80);
90
+ u.globalAlpha = t, u.fillStyle = `rgb(255,${a},${o})`, u.beginPath(), u.arc(e.x, e.y, e.size * t, 0, Math.PI * 2), u.fill();
91
+ }
92
+ u.globalAlpha = 1, x < 2500 && r > 0 ? b = requestAnimationFrame((t) => C(t, e)) : S || (h(!0), g.current || (g.current = !0, _.current?.()));
93
+ };
94
+ return b = requestAnimationFrame((e) => C(e, e)), () => {
95
+ S = !0, cancelAnimationFrame(b);
96
+ };
97
+ }, [
98
+ d,
99
+ m,
100
+ e,
101
+ r
102
+ ]), /* @__PURE__ */ u("div", {
103
+ className: p.burnAway,
104
+ children: [
105
+ /* @__PURE__ */ u("div", {
106
+ ref: a,
107
+ className: p.stage,
108
+ children: [!m && /* @__PURE__ */ l("span", {
109
+ className: p.text,
110
+ style: {
111
+ fontSize: r,
112
+ opacity: +!d
113
+ },
114
+ children: e
115
+ }), /* @__PURE__ */ l("canvas", {
116
+ ref: c,
117
+ className: p.canvas
118
+ })]
119
+ }),
120
+ !d && !m && /* @__PURE__ */ l("button", {
121
+ type: "button",
122
+ className: p.trigger,
123
+ onClick: v,
124
+ children: "Ignite"
125
+ }),
126
+ m && /* @__PURE__ */ l("p", {
127
+ className: p.hint,
128
+ children: "Gone."
129
+ })
130
+ ]
131
+ });
132
+ }, h = {
133
+ aurora: "cos-aurora-dJJb8",
134
+ band: "cos-band-S5CoR",
135
+ "aurora-flow": "cos-aurora-flow-wU8TY"
136
+ }, g = [
137
+ "#00ff87",
138
+ "#60efff",
139
+ "#7b2ff7",
140
+ "#f107a3"
141
+ ], _ = ({ width: e = 800, height: t = 500, colors: n = g }) => {
142
+ let r = n.length >= 2 ? n : g;
143
+ return /* @__PURE__ */ l("div", {
144
+ className: h.aurora,
145
+ style: {
146
+ width: e,
147
+ height: t
148
+ },
149
+ children: r.map((e, t) => /* @__PURE__ */ l("div", {
150
+ className: h.band,
151
+ style: {
152
+ "--aurora-color": e,
153
+ "--aurora-delay": `${t * -3}s`,
154
+ "--aurora-duration": `${12 + t * 2}s`
155
+ }
156
+ }, e + t))
157
+ });
158
+ }, v = (e) => {
159
+ let t = () => e(document.hidden);
160
+ return document.addEventListener("visibilitychange", t), () => document.removeEventListener("visibilitychange", t);
161
+ }, y = (e, t, n) => Math.min(n, Math.max(t, e)), b = {
162
+ audioVisualizer: "cos-audioVisualizer-r5dHp",
163
+ canvas: "cos-canvas-UNEea"
164
+ }, x = ({ width: e = 400, height: t = 120, barCount: r = 32, useMic: i = !1 }) => {
165
+ let a = o(null);
166
+ return n(() => {
167
+ let n = a.current;
168
+ if (!n) return;
169
+ let o = window.devicePixelRatio || 1;
170
+ n.width = e * o, n.height = t * o;
171
+ let s = n.getContext("2d");
172
+ if (!s) return;
173
+ s.setTransform(o, 0, 0, o, 0, 0);
174
+ let c = 0, l = document.hidden, u = null, d = null, f = null, p = null, m = 0, h = !1, g = v((e) => {
175
+ l = e;
176
+ });
177
+ (async () => {
178
+ if (!(!i || !navigator.mediaDevices?.getUserMedia)) try {
179
+ if (p = await navigator.mediaDevices.getUserMedia({ audio: !0 }), h) {
180
+ p.getTracks().forEach((e) => e.stop()), p = null;
181
+ return;
182
+ }
183
+ u = new AudioContext(), d = u.createAnalyser(), d.fftSize = 256, u.createMediaStreamSource(p).connect(d), f = new Uint8Array(d.frequencyBinCount);
184
+ } catch {}
185
+ })();
186
+ let _ = () => {
187
+ if (c = requestAnimationFrame(_), l) return;
188
+ let n = Array(r).fill(0);
189
+ if (d && f) {
190
+ d.getByteFrequencyData(f);
191
+ let e = Math.floor(f.length / r);
192
+ for (let t = 0; t < r; t++) n[t] = f[t * e] / 255;
193
+ } else {
194
+ m += .08;
195
+ for (let e = 0; e < r; e++) n[e] = (Math.sin(m + e * .35) + 1) * .35 + Math.random() * .15;
196
+ }
197
+ s.fillStyle = "#0f172a", s.fillRect(0, 0, e, t);
198
+ let i = (e - 3 * (r - 1)) / r;
199
+ for (let e = 0; e < r; e++) {
200
+ let r = Math.max(4, n[e] * t * .9), a = e * (i + 3), o = t - r, c = s.createLinearGradient(0, o, 0, t);
201
+ c.addColorStop(0, "#a78bfa"), c.addColorStop(1, "#38bdf8"), s.fillStyle = c, s.beginPath(), s.roundRect(a, o, i, r, 2), s.fill();
202
+ }
203
+ };
204
+ return _(), () => {
205
+ h = !0, cancelAnimationFrame(c), g(), p?.getTracks().forEach((e) => e.stop()), u?.close();
206
+ };
207
+ }, [
208
+ r,
209
+ t,
210
+ i,
211
+ e
212
+ ]), /* @__PURE__ */ l("div", {
213
+ className: b.audioVisualizer,
214
+ style: {
215
+ width: e,
216
+ height: t
217
+ },
218
+ children: /* @__PURE__ */ l("canvas", {
219
+ ref: a,
220
+ className: b.canvas,
221
+ style: {
222
+ width: e,
223
+ height: t
224
+ }
225
+ })
226
+ });
227
+ }, S = {
4
228
  canvasClock: "cos-canvasClock-QvdV3",
5
229
  canvasTarget: "cos-canvasTarget-x-odC"
6
- }, d = ({ width: e = 400, height: r = 400 }) => {
7
- let i = a(null), o = Math.min(e, r), s = o / 2 - 16, l = o / 2, d = t((e) => {
8
- e.clearRect(0, 0, o, o), e.save(), e.translate(l, l), e.beginPath(), e.arc(0, 0, s, 0, Math.PI * 2), e.fillStyle = "#fff", e.fill(), e.strokeStyle = "#d1d5db", e.lineWidth = 2, e.stroke();
230
+ }, C = ({ width: e = 400, height: r = 400 }) => {
231
+ let i = o(null), a = Math.min(e, r), s = a / 2 - 16, c = a / 2, u = t((e) => {
232
+ e.clearRect(0, 0, a, a), e.save(), e.translate(c, c), e.beginPath(), e.arc(0, 0, s, 0, Math.PI * 2), e.fillStyle = "#fff", e.fill(), e.strokeStyle = "#d1d5db", e.lineWidth = 2, e.stroke();
9
233
  for (let t = 0; t < 60; t++) {
10
234
  let n = t / 60 * Math.PI * 2, r = s - (t % 5 == 0 ? 14 : 8);
11
235
  e.beginPath(), e.moveTo(Math.cos(n) * r, Math.sin(n) * r), e.lineTo(Math.cos(n) * s, Math.sin(n) * s), e.strokeStyle = t % 5 == 0 ? "#374151" : "#9ca3af", e.lineWidth = t % 5 == 0 ? 2 : 1, e.stroke();
12
236
  }
13
- e.fillStyle = "#111827", e.font = `bold ${Math.floor(o / 22)}px system-ui, sans-serif`, e.textAlign = "center", e.textBaseline = "middle";
237
+ e.fillStyle = "#111827", e.font = `bold ${Math.floor(a / 22)}px system-ui, sans-serif`, e.textAlign = "center", e.textBaseline = "middle";
14
238
  for (let t = 1; t <= 12; t++) {
15
239
  let n = t / 12 * Math.PI * 2 - Math.PI / 2, r = s - 32;
16
240
  e.fillText(String(t), Math.cos(n) * r, Math.sin(n) * r);
17
241
  }
18
- let t = /* @__PURE__ */ new Date(), n = t.getHours() % 12, r = t.getMinutes(), i = t.getSeconds(), a = t.getMilliseconds(), c = (t, n, r, i, a) => {
242
+ let t = /* @__PURE__ */ new Date(), n = t.getHours() % 12, r = t.getMinutes(), i = t.getSeconds(), o = t.getMilliseconds(), l = (t, n, r, i, a) => {
19
243
  e.save(), e.rotate(t), e.beginPath(), e.moveTo(0, r), e.lineTo(n, 0), e.lineTo(0, -r), e.closePath(), e.fillStyle = i, e.shadowColor = a, e.shadowBlur = 4, e.fill(), e.restore();
20
- }, u = (n + r / 60) / 12 * Math.PI * 2 - Math.PI / 2, d = (r + i / 60) / 60 * Math.PI * 2 - Math.PI / 2, f = (i + a / 1e3) / 60 * Math.PI * 2 - Math.PI / 2;
21
- c(u, s * .5, 4, "#111827", "rgb(0 0 0 / 40%)"), c(d, s * .72, 3, "#1e80ff", "rgb(30 128 255 / 40%)"), c(f, s * .85, 2, "#e9686b", "rgb(233 104 107 / 40%)"), e.beginPath(), e.arc(0, 0, 5, 0, Math.PI * 2), e.fillStyle = "#111827", e.fill(), e.restore();
244
+ }, u = (n + r / 60) / 12 * Math.PI * 2 - Math.PI / 2, d = (r + i / 60) / 60 * Math.PI * 2 - Math.PI / 2, f = (i + o / 1e3) / 60 * Math.PI * 2 - Math.PI / 2;
245
+ l(u, s * .5, 4, "#111827", "rgb(0 0 0 / 40%)"), l(d, s * .72, 3, "#1e80ff", "rgb(30 128 255 / 40%)"), l(f, s * .85, 2, "#e9686b", "rgb(233 104 107 / 40%)"), e.beginPath(), e.arc(0, 0, 5, 0, Math.PI * 2), e.fillStyle = "#111827", e.fill(), e.restore();
22
246
  }, [
23
- l,
247
+ c,
24
248
  s,
25
- o
249
+ a
26
250
  ]);
27
251
  return n(() => {
28
252
  let e = i.current;
29
253
  if (!e) return;
30
254
  let t = window.devicePixelRatio || 1;
31
- e.width = o * t, e.height = o * t;
255
+ e.width = a * t, e.height = a * t;
32
256
  let n = e.getContext("2d");
33
257
  if (!n) return;
34
258
  n.setTransform(t, 0, 0, t, 0, 0);
35
- let r = 0, a = () => {
36
- d(n), r = requestAnimationFrame(a);
259
+ let r = 0, o = document.hidden, s = v((e) => {
260
+ o = e;
261
+ }), c = () => {
262
+ o || u(n), r = requestAnimationFrame(c);
37
263
  };
38
- return a(), () => cancelAnimationFrame(r);
39
- }, [d, o]), /* @__PURE__ */ c("div", {
40
- className: u.canvasClock,
264
+ return c(), () => {
265
+ cancelAnimationFrame(r), s();
266
+ };
267
+ }, [u, a]), /* @__PURE__ */ l("div", {
268
+ className: S.canvasClock,
41
269
  style: {
42
- width: o,
43
- height: o
270
+ width: a,
271
+ height: a
44
272
  },
45
- children: /* @__PURE__ */ c("canvas", {
273
+ children: /* @__PURE__ */ l("canvas", {
46
274
  ref: i,
47
- className: u.canvasTarget,
275
+ className: S.canvasTarget,
48
276
  style: {
49
- width: o,
50
- height: o
277
+ width: a,
278
+ height: a
51
279
  }
52
280
  })
53
281
  });
54
- }, f = (e) => {
55
- let t = () => e(document.hidden);
56
- return document.addEventListener("visibilitychange", t), () => document.removeEventListener("visibilitychange", t);
57
- }, p = (e, t, n) => Math.min(n, Math.max(t, e)), m = {
282
+ }, w = {
58
283
  chargeContainer: "cos-chargeContainer-4t9qo",
59
284
  contrast: "cos-contrast-PNep9",
60
285
  hueRotate: "cos-hueRotate-bMJ-k",
@@ -63,13 +288,13 @@ import './index.css';var u = {
63
288
  circle: "cos-circle-m4vwX",
64
289
  circleRotate: "cos-circleRotate-bgFw5",
65
290
  button: "cos-button-myCst"
66
- }, h = (e) => {
67
- let { initQuantity: t = 0, value: r, onChange: i, autoCharge: s = !0, interval: u = 500, step: d = .01 } = e, f = a(null), h = r !== void 0, [g, _] = o(() => p(t, 0, 100)), v = p(h ? r : g, 0, 100), y = a(v), b = a(i);
291
+ }, ee = (e) => {
292
+ let { initQuantity: t = 0, value: r, onChange: i, autoCharge: a = !0, interval: c = 500, step: d = .01 } = e, f = o(null), p = r !== void 0, [m, h] = s(() => y(t, 0, 100)), g = y(p ? r : m, 0, 100), _ = o(g), v = o(i);
68
293
  n(() => {
69
- b.current = i;
294
+ v.current = i;
70
295
  }, [i]), n(() => {
71
- y.current = v;
72
- }, [v]), n(() => {
296
+ _.current = g;
297
+ }, [g]), n(() => {
73
298
  let e = f.current;
74
299
  if (!e) return;
75
300
  let t = () => {
@@ -79,55 +304,118 @@ import './index.css';var u = {
79
304
  let n = new ResizeObserver(t);
80
305
  return n.observe(e), () => n.disconnect();
81
306
  }, []), n(() => {
82
- if (!s) return;
307
+ if (!a) return;
83
308
  let e = window.setInterval(() => {
84
- if (y.current >= 100) return;
85
- let e = Math.min(100, Number((y.current + d).toFixed(2)));
86
- h ? b.current?.(e) : _(e);
87
- }, u);
309
+ if (_.current >= 100) return;
310
+ let e = Math.min(100, Number((_.current + d).toFixed(2)));
311
+ p ? v.current?.(e) : h(e);
312
+ }, c);
88
313
  return () => clearInterval(e);
89
314
  }, [
90
- s,
91
- u,
92
- h,
315
+ a,
316
+ c,
317
+ p,
93
318
  d
94
319
  ]);
95
- let x = v.toFixed(2);
96
- return /* @__PURE__ */ c("div", {
320
+ let b = g.toFixed(2);
321
+ return /* @__PURE__ */ l("div", {
97
322
  ref: f,
98
- className: m.chargeContainer,
99
- children: /* @__PURE__ */ l("div", {
100
- className: m.contrast,
323
+ className: w.chargeContainer,
324
+ children: /* @__PURE__ */ u("div", {
325
+ className: w.contrast,
101
326
  children: [
102
- /* @__PURE__ */ l("div", {
103
- className: m.text,
104
- children: [x, "%"]
327
+ /* @__PURE__ */ u("div", {
328
+ className: w.text,
329
+ children: [b, "%"]
105
330
  }),
106
- /* @__PURE__ */ c("span", {}),
107
- /* @__PURE__ */ c("span", {}),
108
- /* @__PURE__ */ c("span", {}),
109
- /* @__PURE__ */ c("span", {}),
110
- /* @__PURE__ */ c("span", {}),
111
- /* @__PURE__ */ c("span", {}),
112
- /* @__PURE__ */ c("span", {}),
113
- /* @__PURE__ */ c("span", {}),
114
- /* @__PURE__ */ c("span", {}),
115
- /* @__PURE__ */ c("span", {}),
116
- /* @__PURE__ */ c("span", {}),
117
- /* @__PURE__ */ c("span", {}),
118
- /* @__PURE__ */ c("span", {}),
119
- /* @__PURE__ */ c("span", {}),
120
- /* @__PURE__ */ c("span", {}),
121
- /* @__PURE__ */ c("div", { className: m.circle }),
122
- /* @__PURE__ */ c("div", { className: m.button })
331
+ /* @__PURE__ */ l("span", {}),
332
+ /* @__PURE__ */ l("span", {}),
333
+ /* @__PURE__ */ l("span", {}),
334
+ /* @__PURE__ */ l("span", {}),
335
+ /* @__PURE__ */ l("span", {}),
336
+ /* @__PURE__ */ l("span", {}),
337
+ /* @__PURE__ */ l("span", {}),
338
+ /* @__PURE__ */ l("span", {}),
339
+ /* @__PURE__ */ l("span", {}),
340
+ /* @__PURE__ */ l("span", {}),
341
+ /* @__PURE__ */ l("span", {}),
342
+ /* @__PURE__ */ l("span", {}),
343
+ /* @__PURE__ */ l("span", {}),
344
+ /* @__PURE__ */ l("span", {}),
345
+ /* @__PURE__ */ l("span", {}),
346
+ /* @__PURE__ */ l("div", { className: w.circle }),
347
+ /* @__PURE__ */ l("div", { className: w.button })
123
348
  ]
124
349
  })
125
350
  });
126
- }, g = {
351
+ }, T = {
352
+ clickSpark: "cos-clickSpark-db9Om",
353
+ canvas: "cos-canvas-p9fnQ",
354
+ content: "cos-content-7uE4T",
355
+ hint: "cos-hint-UqpWX"
356
+ }, te = ({ children: e, color: r = "#fbbf24", count: i = 16 }) => {
357
+ let a = o(null), s = o(null), c = o([]), d = o(0), f = t((e, t) => {
358
+ for (let n = 0; n < i; n++) {
359
+ let r = Math.PI * 2 * n / i + Math.random() * .3, a = Math.random() * 4 + 2;
360
+ c.current.push({
361
+ x: e,
362
+ y: t,
363
+ vx: Math.cos(r) * a,
364
+ vy: Math.sin(r) * a,
365
+ alpha: 1,
366
+ size: Math.random() * 3 + 2
367
+ });
368
+ }
369
+ }, [i]);
370
+ return n(() => {
371
+ let e = s.current, t = a.current;
372
+ if (!e || !t) return;
373
+ let n = e.getContext("2d");
374
+ if (!n) return;
375
+ let i = () => {
376
+ let r = window.devicePixelRatio || 1, { width: i, height: a } = t.getBoundingClientRect();
377
+ e.width = i * r, e.height = a * r, n.setTransform(r, 0, 0, r, 0, 0);
378
+ };
379
+ i();
380
+ let o = new ResizeObserver(i);
381
+ o.observe(t);
382
+ let l = document.hidden, u = v((e) => {
383
+ l = e;
384
+ }), f = () => {
385
+ if (d.current = requestAnimationFrame(f), l) return;
386
+ let { width: e, height: i } = t.getBoundingClientRect();
387
+ n.clearRect(0, 0, e, i), c.current = c.current.filter((e) => (e.x += e.vx, e.y += e.vy, e.vy += .15, e.alpha -= .03, e.alpha <= 0 ? !1 : (n.beginPath(), n.arc(e.x, e.y, e.size, 0, Math.PI * 2), n.fillStyle = r, n.globalAlpha = e.alpha, n.fill(), n.globalAlpha = 1, !0)));
388
+ };
389
+ return f(), () => {
390
+ cancelAnimationFrame(d.current), o.disconnect(), u();
391
+ };
392
+ }, [r]), /* @__PURE__ */ u("div", {
393
+ ref: a,
394
+ className: T.clickSpark,
395
+ onClick: (e) => {
396
+ let t = a.current?.getBoundingClientRect();
397
+ t && f(e.clientX - t.left, e.clientY - t.top);
398
+ },
399
+ children: [
400
+ /* @__PURE__ */ l("canvas", {
401
+ ref: s,
402
+ className: T.canvas
403
+ }),
404
+ e && /* @__PURE__ */ l("div", {
405
+ className: T.content,
406
+ children: e
407
+ }),
408
+ !e && /* @__PURE__ */ l("p", {
409
+ className: T.hint,
410
+ children: "点击任意位置产生火花"
411
+ })
412
+ ]
413
+ });
414
+ }, E = {
127
415
  confetti: "cos-confetti-MeNtU",
128
416
  canvas: "cos-canvas-0T3Vs",
129
417
  hint: "cos-hint-sGHEi"
130
- }, _ = [
418
+ }, ne = [
131
419
  "#ff6b6b",
132
420
  "#ffd93d",
133
421
  "#6bcb77",
@@ -135,7 +423,7 @@ import './index.css';var u = {
135
423
  "#a66cff",
136
424
  "#ff85c0",
137
425
  "#38bdf8"
138
- ], v = () => _[Math.floor(Math.random() * _.length)], y = (e, t, n) => {
426
+ ], re = () => ne[Math.floor(Math.random() * ne.length)], ie = (e, t, n) => {
139
427
  let r = e / 2, i = t * .6;
140
428
  return Array.from({ length: n }, () => {
141
429
  let e = (Math.random() - .5) * Math.PI, t = Math.random() * 12 + 6;
@@ -146,68 +434,127 @@ import './index.css';var u = {
146
434
  vy: Math.sin(e) * t - Math.random() * 8,
147
435
  rotation: Math.random() * 360,
148
436
  rotationSpeed: (Math.random() - .5) * 12,
149
- color: v(),
437
+ color: re(),
150
438
  width: Math.random() * 8 + 4,
151
439
  height: Math.random() * 6 + 3,
152
440
  alpha: 1,
153
441
  gravity: Math.random() * .15 + .12
154
442
  };
155
443
  });
156
- }, b = e(({ width: e = 800, height: i = 400, auto: o = !0, particleCount: s = 120 }, u) => {
157
- let d = a(null), p = a([]), m = a(0), h = a({
444
+ }, ae = e(({ width: e = 800, height: r = 400, auto: a = !0, particleCount: s = 120 }, c) => {
445
+ let d = o(null), f = o([]), p = o(0), m = o({
158
446
  width: e,
159
- height: i,
447
+ height: r,
160
448
  particleCount: s
161
449
  });
162
- h.current = {
450
+ m.current = {
163
451
  width: e,
164
- height: i,
452
+ height: r,
165
453
  particleCount: s
166
454
  };
167
- let _ = t(() => {
168
- let { width: e, height: t, particleCount: n } = h.current;
169
- p.current.push(...y(e, t, n));
455
+ let h = t(() => {
456
+ let { width: e, height: t, particleCount: n } = m.current;
457
+ f.current.push(...ie(e, t, n));
170
458
  }, []);
171
- return r(u, () => ({ burst: _ }), [_]), n(() => {
172
- o && _();
173
- }, [o, _]), n(() => {
459
+ return i(c, () => ({ burst: h }), [h]), n(() => {
460
+ a && h();
461
+ }, [a, h]), n(() => {
174
462
  let t = d.current;
175
463
  if (!t) return;
176
464
  let n = window.devicePixelRatio || 1;
177
- t.width = e * n, t.height = i * n;
178
- let r = t.getContext("2d");
179
- if (!r) return;
180
- r.setTransform(n, 0, 0, n, 0, 0);
181
- let a = document.hidden, o = f((e) => {
465
+ t.width = e * n, t.height = r * n;
466
+ let i = t.getContext("2d");
467
+ if (!i) return;
468
+ i.setTransform(n, 0, 0, n, 0, 0);
469
+ let a = document.hidden, o = v((e) => {
182
470
  a = e;
183
471
  }), s = () => {
184
- m.current = requestAnimationFrame(s), !a && (r.clearRect(0, 0, e, i), p.current = p.current.filter((e) => (e.x += e.vx, e.y += e.vy, e.vy += e.gravity, e.vx *= .99, e.rotation += e.rotationSpeed, e.alpha -= .008, e.alpha <= 0 || e.y > i + 20 ? !1 : (r.save(), r.translate(e.x, e.y), r.rotate(e.rotation * Math.PI / 180), r.globalAlpha = e.alpha, r.fillStyle = e.color, r.fillRect(-e.width / 2, -e.height / 2, e.width, e.height), r.restore(), !0))));
472
+ p.current = requestAnimationFrame(s), !a && (i.clearRect(0, 0, e, r), f.current = f.current.filter((e) => (e.x += e.vx, e.y += e.vy, e.vy += e.gravity, e.vx *= .99, e.rotation += e.rotationSpeed, e.alpha -= .008, e.alpha <= 0 || e.y > r + 20 ? !1 : (i.save(), i.translate(e.x, e.y), i.rotate(e.rotation * Math.PI / 180), i.globalAlpha = e.alpha, i.fillStyle = e.color, i.fillRect(-e.width / 2, -e.height / 2, e.width, e.height), i.restore(), !0))));
185
473
  };
186
474
  return s(), () => {
187
- cancelAnimationFrame(m.current), o();
475
+ cancelAnimationFrame(p.current), o();
188
476
  };
189
- }, [i, e]), /* @__PURE__ */ l("div", {
190
- className: g.confetti,
477
+ }, [r, e]), /* @__PURE__ */ u("div", {
478
+ className: E.confetti,
191
479
  style: {
192
480
  width: e,
193
- height: i
481
+ height: r
194
482
  },
195
- children: [/* @__PURE__ */ c("canvas", {
483
+ children: [/* @__PURE__ */ l("canvas", {
196
484
  ref: d,
197
- className: g.canvas,
485
+ className: E.canvas,
198
486
  style: {
199
487
  width: e,
200
- height: i
488
+ height: r
201
489
  },
202
- onClick: _
203
- }), /* @__PURE__ */ c("p", {
204
- className: g.hint,
490
+ onClick: h
491
+ }), /* @__PURE__ */ l("p", {
492
+ className: E.hint,
205
493
  children: "点击画布再次喷射"
206
494
  })]
207
495
  });
208
496
  });
209
- b.displayName = "Confetti";
210
- var x = {
497
+ ae.displayName = "Confetti";
498
+ var oe = {
499
+ cyberGrid: "cos-cyberGrid-VgJwl",
500
+ canvas: "cos-canvas--Mq-O"
501
+ }, se = ({ width: e = 800, height: t = 500, color: r = "#00f0ff", speed: i = 1 }) => {
502
+ let a = o(null), s = o(0), c = o(0);
503
+ return n(() => {
504
+ let n = a.current;
505
+ if (!n) return;
506
+ let o = window.devicePixelRatio || 1;
507
+ n.width = e * o, n.height = t * o;
508
+ let l = n.getContext("2d");
509
+ if (!l) return;
510
+ l.setTransform(o, 0, 0, o, 0, 0);
511
+ let u = t * .45, d = document.hidden, f = v((e) => {
512
+ d = e;
513
+ }), p = () => {
514
+ if (s.current = requestAnimationFrame(p), d) return;
515
+ c.current = (c.current + i * 1.5) % 40, l.fillStyle = "#050510", l.fillRect(0, 0, e, t);
516
+ let n = l.createLinearGradient(0, 0, 0, u);
517
+ n.addColorStop(0, "#0a0a20"), n.addColorStop(1, "#050510"), l.fillStyle = n, l.fillRect(0, 0, e, u);
518
+ let a = e / 2;
519
+ l.strokeStyle = r, l.shadowColor = r, l.shadowBlur = 8, l.lineWidth = 1;
520
+ for (let n = -12; n <= 12; n++) {
521
+ let r = n / 12 * e * 1.2;
522
+ l.beginPath(), l.moveTo(a + r * .05, u), l.lineTo(a + r, t), l.globalAlpha = .3 + (1 - Math.abs(n) / 12) * .5, l.stroke();
523
+ }
524
+ l.globalAlpha = 1;
525
+ let o = Math.ceil(t / 40) + 2;
526
+ for (let n = 0; n < o; n++) {
527
+ let r = u + (n * 40 + c.current) / (t - u) * (t - u) % (t - u), i = (r - u) / (t - u) * .8;
528
+ l.beginPath(), l.moveTo(0, r), l.lineTo(e, r), l.globalAlpha = i, l.stroke();
529
+ }
530
+ l.shadowBlur = 0, l.globalAlpha = 1;
531
+ let f = l.createRadialGradient(a, u, 0, a, u, e * .4);
532
+ f.addColorStop(0, `${r}33`), f.addColorStop(1, "transparent"), l.fillStyle = f, l.fillRect(0, 0, e, t);
533
+ };
534
+ return p(), () => {
535
+ cancelAnimationFrame(s.current), f();
536
+ };
537
+ }, [
538
+ r,
539
+ t,
540
+ i,
541
+ e
542
+ ]), /* @__PURE__ */ l("div", {
543
+ className: oe.cyberGrid,
544
+ style: {
545
+ width: e,
546
+ height: t
547
+ },
548
+ children: /* @__PURE__ */ l("canvas", {
549
+ ref: a,
550
+ className: oe.canvas,
551
+ style: {
552
+ width: e,
553
+ height: t
554
+ }
555
+ })
556
+ });
557
+ }, D = {
211
558
  countdown: "cos-countdown-5ZKKP",
212
559
  unit: "cos-unit-dth8N",
213
560
  value: "cos-value-yVzcP",
@@ -215,7 +562,7 @@ var x = {
215
562
  ended: "cos-ended-c0dsD",
216
563
  pulse: "cos-pulse-krQd-",
217
564
  invalid: "cos-invalid-d6t-L"
218
- }, S = (e) => e instanceof Date ? e.getTime() : typeof e == "number" ? e : new Date(e).getTime(), C = (e) => {
565
+ }, ce = (e) => e instanceof Date ? e.getTime() : typeof e == "number" ? e : new Date(e).getTime(), le = (e) => {
219
566
  let t = Math.max(0, e - Date.now()), n = Math.floor(t / 1e3);
220
567
  return {
221
568
  total: t,
@@ -224,7 +571,7 @@ var x = {
224
571
  minutes: Math.floor(n % 3600 / 60),
225
572
  seconds: n % 60
226
573
  };
227
- }, ee = [
574
+ }, ue = [
228
575
  {
229
576
  key: "days",
230
577
  label: "天"
@@ -241,8 +588,8 @@ var x = {
241
588
  key: "seconds",
242
589
  label: "秒"
243
590
  }
244
- ], w = ({ targetDate: e, onEnd: t, showLabels: r = !0, color: s = "#f472b6" }) => {
245
- let u = i(() => S(e), [e]), d = !Number.isNaN(u), [, f] = o(0), p = a(!1), m = a(t), h = d ? C(u) : {
591
+ ], de = ({ targetDate: e, onEnd: t, showLabels: r = !0, color: i = "#f472b6" }) => {
592
+ let c = a(() => ce(e), [e]), d = !Number.isNaN(c), [, f] = s(0), p = o(!1), m = o(t), h = d ? le(c) : {
246
593
  days: 0,
247
594
  hours: 0,
248
595
  minutes: 0,
@@ -255,44 +602,337 @@ var x = {
255
602
  if (!d) return;
256
603
  p.current = !1;
257
604
  let e = window.setInterval(() => {
258
- f((e) => e + 1), Date.now() >= u && !p.current && (p.current = !0, m.current?.(), clearInterval(e));
605
+ f((e) => e + 1), Date.now() >= c && !p.current && (p.current = !0, m.current?.(), clearInterval(e));
259
606
  }, 1e3);
260
607
  return () => clearInterval(e);
261
- }, [d, u]), d ? /* @__PURE__ */ l("div", {
262
- className: x.countdown,
263
- style: { "--countdown-color": s },
264
- children: [ee.map(({ key: e, label: t }) => /* @__PURE__ */ l("div", {
265
- className: x.unit,
266
- children: [/* @__PURE__ */ c("div", {
267
- className: x.value,
608
+ }, [d, c]), d ? /* @__PURE__ */ u("div", {
609
+ className: D.countdown,
610
+ style: { "--countdown-color": i },
611
+ children: [ue.map(({ key: e, label: t }) => /* @__PURE__ */ u("div", {
612
+ className: D.unit,
613
+ children: [/* @__PURE__ */ l("div", {
614
+ className: D.value,
268
615
  children: String(h[e]).padStart(2, "0")
269
- }), r && /* @__PURE__ */ c("span", {
270
- className: x.label,
616
+ }), r && /* @__PURE__ */ l("span", {
617
+ className: D.label,
271
618
  children: t
272
619
  })]
273
- }, e)), h.total <= 0 && /* @__PURE__ */ c("p", {
274
- className: x.ended,
620
+ }, e)), h.total <= 0 && /* @__PURE__ */ l("p", {
621
+ className: D.ended,
275
622
  children: "时间到!"
276
623
  })]
277
- }) : /* @__PURE__ */ c("div", {
278
- className: x.countdown,
279
- children: /* @__PURE__ */ c("p", {
280
- className: x.invalid,
624
+ }) : /* @__PURE__ */ l("div", {
625
+ className: D.countdown,
626
+ children: /* @__PURE__ */ l("p", {
627
+ className: D.invalid,
281
628
  children: "无效的目标时间"
282
629
  })
283
630
  });
284
- }, T = {
631
+ }, fe = {
632
+ dnaHelix: "cos-dnaHelix-nEQLW",
633
+ canvas: "cos-canvas-uEV8B"
634
+ }, pe = ({ width: e = 200, height: t = 360, speed: r = 1, color: i = "#38bdf8" }) => {
635
+ let a = o(null);
636
+ return n(() => {
637
+ let n = a.current;
638
+ if (!n) return;
639
+ let o = window.devicePixelRatio || 1;
640
+ n.width = e * o, n.height = t * o;
641
+ let s = n.getContext("2d");
642
+ if (!s) return;
643
+ s.setTransform(o, 0, 0, o, 0, 0);
644
+ let c = 0, l = 0, u = document.hidden, d = v((e) => {
645
+ u = e;
646
+ }), f = () => {
647
+ if (l = requestAnimationFrame(f), u) return;
648
+ c += .03 * r, s.fillStyle = "#0f172a", s.fillRect(0, 0, e, t);
649
+ let n = e / 2, a = e * .32;
650
+ for (let e = 0; e < 18; e++) {
651
+ let r = e / 17 * (t - 40) + 20, o = c + e * .4, l = n + Math.sin(o) * a, u = n + Math.sin(o + Math.PI) * a, d = Math.cos(o), f = 5 + d * 2;
652
+ s.beginPath(), s.moveTo(l, r), s.lineTo(u, r), s.strokeStyle = `rgb(148 163 184 / ${30 + Math.abs(d) * 30}%)`, s.lineWidth = 1.5, s.stroke(), s.beginPath(), s.arc(l, r, f, 0, Math.PI * 2), s.fillStyle = d > 0 ? i : "#a78bfa", s.fill(), s.beginPath(), s.arc(u, r, f, 0, Math.PI * 2), s.fillStyle = d > 0 ? "#a78bfa" : i, s.fill();
653
+ }
654
+ };
655
+ return f(), () => {
656
+ cancelAnimationFrame(l), d();
657
+ };
658
+ }, [
659
+ i,
660
+ t,
661
+ r,
662
+ e
663
+ ]), /* @__PURE__ */ l("div", {
664
+ className: fe.dnaHelix,
665
+ style: {
666
+ width: e,
667
+ height: t
668
+ },
669
+ children: /* @__PURE__ */ l("canvas", {
670
+ ref: a,
671
+ className: fe.canvas,
672
+ style: {
673
+ width: e,
674
+ height: t
675
+ }
676
+ })
677
+ });
678
+ }, me = {
679
+ electricArc: "cos-electricArc-BFlY3",
680
+ canvas: "cos-canvas-iowDx"
681
+ }, O = (e, t, n, r, i, a) => {
682
+ if (a <= 0) return [[e, t], [n, r]];
683
+ let o = (e + n) / 2, s = (t + r) / 2, c = n - e, l = r - t, u = Math.hypot(c, l) || 1, d = (Math.random() - .5) * i, f = -l / u * d, p = c / u * d, m = O(e, t, o + f, s + p, i * .6, a - 1), h = O(o + f, s + p, n, r, i * .6, a - 1);
684
+ return [...m.slice(0, -1), ...h];
685
+ }, he = ({ width: e = 320, height: t = 160, color: r = "#67e8f9" }) => {
686
+ let i = o(null);
687
+ return n(() => {
688
+ let n = i.current;
689
+ if (!n) return;
690
+ let a = window.devicePixelRatio || 1;
691
+ n.width = e * a, n.height = t * a;
692
+ let o = n.getContext("2d");
693
+ if (!o) return;
694
+ o.setTransform(a, 0, 0, a, 0, 0);
695
+ let s = t / 2, c = e - 40, l = t / 2, u = 0, d = document.hidden, f = v((e) => {
696
+ d = e;
697
+ }), p = () => {
698
+ if (u = requestAnimationFrame(p), d) return;
699
+ o.fillStyle = "#0f172a", o.fillRect(0, 0, e, t);
700
+ let n = O(40, s, c, l, 40, 5);
701
+ o.beginPath(), n.forEach(([e, t], n) => n === 0 ? o.moveTo(e, t) : o.lineTo(e, t)), o.strokeStyle = r, o.lineWidth = 2, o.shadowColor = r, o.shadowBlur = 12, o.stroke(), o.shadowBlur = 0, o.beginPath(), n.forEach(([e, t], n) => n === 0 ? o.moveTo(e, t) : o.lineTo(e, t)), o.strokeStyle = "#fff", o.lineWidth = .8, o.globalAlpha = .6, o.stroke(), o.globalAlpha = 1, [[40, s], [c, l]].forEach(([e, t]) => {
702
+ o.beginPath(), o.arc(e, t, 6, 0, Math.PI * 2), o.fillStyle = r, o.fill();
703
+ });
704
+ };
705
+ return p(), () => {
706
+ cancelAnimationFrame(u), f();
707
+ };
708
+ }, [
709
+ r,
710
+ t,
711
+ e
712
+ ]), /* @__PURE__ */ l("div", {
713
+ className: me.electricArc,
714
+ style: {
715
+ width: e,
716
+ height: t
717
+ },
718
+ children: /* @__PURE__ */ l("canvas", {
719
+ ref: i,
720
+ className: me.canvas,
721
+ style: {
722
+ width: e,
723
+ height: t
724
+ }
725
+ })
726
+ });
727
+ }, k = {
728
+ cursorTrail: "cos-cursorTrail-fpz5p",
729
+ canvas: "cos-canvas-Iuyp3",
730
+ hint: "cos-hint-9GLHx"
731
+ }, ge = ({ color: e = "#38bdf8", length: t = 20, width: r = 800, height: i = 400 }) => {
732
+ let a = o(null), s = o([]), c = o({
733
+ x: r / 2,
734
+ y: i / 2
735
+ }), d = o(0);
736
+ return n(() => {
737
+ let n = a.current;
738
+ if (!n) return;
739
+ let o = window.devicePixelRatio || 1;
740
+ n.width = r * o, n.height = i * o;
741
+ let l = n.getContext("2d");
742
+ if (!l) return;
743
+ l.setTransform(o, 0, 0, o, 0, 0);
744
+ let u = document.hidden, f = v((e) => {
745
+ u = e;
746
+ }), p = () => {
747
+ if (d.current = requestAnimationFrame(p), u) return;
748
+ let { x: n, y: a } = c.current;
749
+ s.current.unshift({
750
+ x: n,
751
+ y: a,
752
+ life: 1
753
+ }), s.current.length > t && (s.current.length = t), l.fillStyle = "rgb(15 23 42 / 15%)", l.fillRect(0, 0, r, i);
754
+ let o = s.current;
755
+ for (let t = 0; t < o.length; t++) {
756
+ let n = o[t], r = 1 - t / o.length, i = (1 - t / o.length) * 8 + 2;
757
+ l.beginPath(), l.arc(n.x, n.y, i, 0, Math.PI * 2), l.fillStyle = e, l.globalAlpha = r * .8, l.fill();
758
+ }
759
+ l.globalAlpha = 1;
760
+ };
761
+ return p(), () => {
762
+ cancelAnimationFrame(d.current), f();
763
+ };
764
+ }, [
765
+ e,
766
+ i,
767
+ t,
768
+ r
769
+ ]), /* @__PURE__ */ u("div", {
770
+ className: k.cursorTrail,
771
+ style: {
772
+ width: r,
773
+ height: i
774
+ },
775
+ children: [/* @__PURE__ */ l("canvas", {
776
+ ref: a,
777
+ className: k.canvas,
778
+ style: {
779
+ width: r,
780
+ height: i
781
+ },
782
+ onMouseMove: (e) => {
783
+ let t = e.currentTarget.getBoundingClientRect();
784
+ c.current = {
785
+ x: e.clientX - t.left,
786
+ y: e.clientY - t.top
787
+ };
788
+ }
789
+ }), /* @__PURE__ */ l("p", {
790
+ className: k.hint,
791
+ children: "移动鼠标查看粒子轨迹"
792
+ })]
793
+ });
794
+ }, A = {
795
+ diceRoll: "cos-diceRoll-GDwjV",
796
+ scene: "cos-scene-tmnKM",
797
+ cube: "cos-cube-RklEa",
798
+ rolling: "cos-rolling-2ocEq",
799
+ face: "cos-face-10eAF",
800
+ dot: "cos-dot-p5AzF",
801
+ face1: "cos-face1-Ev-x5",
802
+ face2: "cos-face2-2M17p",
803
+ face3: "cos-face3-Wd6T4",
804
+ face4: "cos-face4-RsRwQ",
805
+ face5: "cos-face5-PiJbu",
806
+ face6: "cos-face6-Yp-MX",
807
+ rollBtn: "cos-rollBtn-nXMWJ",
808
+ result: "cos-result-kXzu9"
809
+ }, _e = {
810
+ 1: {
811
+ x: 0,
812
+ y: 0
813
+ },
814
+ 2: {
815
+ x: 0,
816
+ y: 180
817
+ },
818
+ 3: {
819
+ x: 0,
820
+ y: -90
821
+ },
822
+ 4: {
823
+ x: 0,
824
+ y: 90
825
+ },
826
+ 5: {
827
+ x: -90,
828
+ y: 0
829
+ },
830
+ 6: {
831
+ x: 90,
832
+ y: 0
833
+ }
834
+ }, ve = ({ onRoll: e, sides: t = 6 }) => {
835
+ let [r, i] = s(!1), [a, c] = s(1), [d, f] = s({
836
+ x: 0,
837
+ y: 0,
838
+ z: 0
839
+ }), p = o(e), m = o(0);
840
+ n(() => {
841
+ p.current = e;
842
+ }, [e]), n(() => () => clearTimeout(m.current), []);
843
+ let h = () => {
844
+ if (r) return;
845
+ i(!0);
846
+ let e = Math.floor(Math.random() * t) + 1, n = _e[e] ?? _e[1], a = 360 * (3 + Math.floor(Math.random() * 3)), o = 360 * (3 + Math.floor(Math.random() * 3));
847
+ f({
848
+ x: n.x + a,
849
+ y: n.y + o,
850
+ z: Math.random() * 360
851
+ }), clearTimeout(m.current), m.current = window.setTimeout(() => {
852
+ c(e), i(!1), p.current?.(e);
853
+ }, 1200);
854
+ }, g = (e) => ({
855
+ 1: [[50, 50]],
856
+ 2: [[25, 25], [75, 75]],
857
+ 3: [
858
+ [25, 25],
859
+ [50, 50],
860
+ [75, 75]
861
+ ],
862
+ 4: [
863
+ [25, 25],
864
+ [75, 25],
865
+ [25, 75],
866
+ [75, 75]
867
+ ],
868
+ 5: [
869
+ [25, 25],
870
+ [75, 25],
871
+ [50, 50],
872
+ [25, 75],
873
+ [75, 75]
874
+ ],
875
+ 6: [
876
+ [25, 25],
877
+ [75, 25],
878
+ [25, 50],
879
+ [75, 50],
880
+ [25, 75],
881
+ [75, 75]
882
+ ]
883
+ }[e] ?? []).map(([e, t], n) => /* @__PURE__ */ l("span", {
884
+ className: A.dot,
885
+ style: {
886
+ left: `${e}%`,
887
+ top: `${t}%`
888
+ }
889
+ }, n));
890
+ return /* @__PURE__ */ u("div", {
891
+ className: A.diceRoll,
892
+ children: [
893
+ /* @__PURE__ */ l("div", {
894
+ className: A.scene,
895
+ children: /* @__PURE__ */ l("div", {
896
+ className: `${A.cube} ${r ? A.rolling : ""}`,
897
+ style: { transform: `rotateX(${d.x}deg) rotateY(${d.y}deg) rotateZ(${d.z}deg)` },
898
+ children: [
899
+ 1,
900
+ 2,
901
+ 3,
902
+ 4,
903
+ 5,
904
+ 6
905
+ ].map((e) => /* @__PURE__ */ l("div", {
906
+ className: `${A.face} ${A[`face${e}`]}`,
907
+ children: g(e)
908
+ }, e))
909
+ })
910
+ }),
911
+ /* @__PURE__ */ l("button", {
912
+ type: "button",
913
+ className: A.rollBtn,
914
+ onClick: h,
915
+ disabled: r,
916
+ children: r ? "掷骰中..." : "掷骰子"
917
+ }),
918
+ !r && /* @__PURE__ */ u("p", {
919
+ className: A.result,
920
+ children: ["点数: ", a]
921
+ })
922
+ ]
923
+ });
924
+ }, ye = {
285
925
  fireworks: "cos-fireworks-fsSqL",
286
926
  canvas: "cos-canvas-spL8G",
287
927
  hint: "cos-hint-5XDRH"
288
- }, E = [
928
+ }, be = [
289
929
  "#ff6b6b",
290
930
  "#ffd93d",
291
931
  "#6bcb77",
292
932
  "#4d96ff",
293
933
  "#a66cff",
294
934
  "#ff85c0"
295
- ], D = .12, O = 240, k = () => E[Math.floor(Math.random() * E.length)], A = (e, t, n) => {
935
+ ], xe = .12, Se = 240, Ce = () => be[Math.floor(Math.random() * be.length)], we = (e, t, n) => {
296
936
  let r = 60 + Math.floor(Math.random() * 30);
297
937
  return Array.from({ length: r }, () => {
298
938
  let r = Math.random() * Math.PI * 2, i = Math.random() * 4 + 2;
@@ -302,77 +942,77 @@ var x = {
302
942
  vx: Math.cos(r) * i,
303
943
  vy: Math.sin(r) * i,
304
944
  alpha: 1,
305
- color: Math.random() > .3 ? n : k(),
945
+ color: Math.random() > .3 ? n : Ce(),
306
946
  decay: Math.random() * .015 + .01
307
947
  };
308
948
  });
309
- }, j = e(({ width: e = 800, height: i = 500, auto: o = !0 }, s) => {
310
- let u = a(null), d = a([]), p = a(0), m = t((t) => {
949
+ }, Te = e(({ width: e = 800, height: r = 500, auto: a = !0 }, s) => {
950
+ let c = o(null), d = o([]), f = o(0), p = t((t) => {
311
951
  let n = t ?? Math.random() * e * .6 + e * .2;
312
952
  d.current.push({
313
953
  x: n,
314
- y: i,
954
+ y: r,
315
955
  vy: -(Math.random() * 4 + 6),
316
- targetY: Math.random() * i * .35 + i * .15,
317
- color: k(),
956
+ targetY: Math.random() * r * .35 + r * .15,
957
+ color: Ce(),
318
958
  exploded: !1,
319
959
  particles: [],
320
960
  age: 0
321
961
  });
322
- }, [i, e]);
323
- return r(s, () => ({ launch: m }), [m]), n(() => {
324
- let t = u.current;
962
+ }, [r, e]);
963
+ return i(s, () => ({ launch: p }), [p]), n(() => {
964
+ let t = c.current;
325
965
  if (!t) return;
326
966
  let n = window.devicePixelRatio || 1;
327
- t.width = e * n, t.height = i * n;
328
- let r = t.getContext("2d");
329
- if (!r) return;
330
- r.setTransform(n, 0, 0, n, 0, 0);
331
- let a = 0, s = document.hidden, c = f((e) => {
967
+ t.width = e * n, t.height = r * n;
968
+ let i = t.getContext("2d");
969
+ if (!i) return;
970
+ i.setTransform(n, 0, 0, n, 0, 0);
971
+ let o = 0, s = document.hidden, l = v((e) => {
332
972
  s = e;
333
- }), l = () => {
334
- p.current = requestAnimationFrame(l), !s && (r.fillStyle = "rgb(15 23 42 / 25%)", r.fillRect(0, 0, e, i), d.current = d.current.filter((e) => {
973
+ }), u = () => {
974
+ f.current = requestAnimationFrame(u), !s && (i.fillStyle = "rgb(15 23 42 / 25%)", i.fillRect(0, 0, e, r), d.current = d.current.filter((e) => {
335
975
  if (!e.exploded) {
336
- e.age += 1, e.y += e.vy, e.vy += D, r.beginPath(), r.arc(e.x, e.y, 2.5, 0, Math.PI * 2), r.fillStyle = e.color, r.fill();
337
- let t = e.vy >= 0, n = e.y <= e.targetY, i = e.y < 0, a = e.age >= O;
338
- return (t || n || i || a) && (e.exploded = !0, e.particles = A(e.x, e.y, e.color)), !0;
976
+ e.age += 1, e.y += e.vy, e.vy += xe, i.beginPath(), i.arc(e.x, e.y, 2.5, 0, Math.PI * 2), i.fillStyle = e.color, i.fill();
977
+ let t = e.vy >= 0, n = e.y <= e.targetY, r = e.y < 0, a = e.age >= Se;
978
+ return (t || n || r || a) && (e.exploded = !0, e.particles = we(e.x, e.y, e.color)), !0;
339
979
  }
340
- return e.particles = e.particles.filter((e) => (e.x += e.vx, e.y += e.vy, e.vy += .06, e.alpha -= e.decay, e.alpha <= 0 ? !1 : (r.beginPath(), r.arc(e.x, e.y, 2, 0, Math.PI * 2), r.fillStyle = e.color, r.globalAlpha = e.alpha, r.fill(), r.globalAlpha = 1, !0))), e.particles.length > 0;
980
+ return e.particles = e.particles.filter((e) => (e.x += e.vx, e.y += e.vy, e.vy += .06, e.alpha -= e.decay, e.alpha <= 0 ? !1 : (i.beginPath(), i.arc(e.x, e.y, 2, 0, Math.PI * 2), i.fillStyle = e.color, i.globalAlpha = e.alpha, i.fill(), i.globalAlpha = 1, !0))), e.particles.length > 0;
341
981
  }));
342
982
  };
343
- return l(), o && (a = window.setInterval(() => m(), 1200)), () => {
344
- cancelAnimationFrame(p.current), clearInterval(a), c();
983
+ return u(), a && (o = window.setInterval(() => p(), 1200)), () => {
984
+ cancelAnimationFrame(f.current), clearInterval(o), l();
345
985
  };
346
986
  }, [
347
- o,
348
- i,
349
- m,
987
+ a,
988
+ r,
989
+ p,
350
990
  e
351
- ]), /* @__PURE__ */ l("div", {
352
- className: T.fireworks,
991
+ ]), /* @__PURE__ */ u("div", {
992
+ className: ye.fireworks,
353
993
  style: {
354
994
  width: e,
355
- height: i
995
+ height: r
356
996
  },
357
- children: [/* @__PURE__ */ c("canvas", {
358
- ref: u,
359
- className: T.canvas,
997
+ children: [/* @__PURE__ */ l("canvas", {
998
+ ref: c,
999
+ className: ye.canvas,
360
1000
  style: {
361
1001
  width: e,
362
- height: i
1002
+ height: r
363
1003
  },
364
1004
  onClick: (e) => {
365
1005
  let t = e.currentTarget.getBoundingClientRect();
366
- m(e.clientX - t.left);
1006
+ p(e.clientX - t.left);
367
1007
  }
368
- }), /* @__PURE__ */ c("p", {
369
- className: T.hint,
1008
+ }), /* @__PURE__ */ l("p", {
1009
+ className: ye.hint,
370
1010
  children: "点击画布燃放烟花"
371
1011
  })]
372
1012
  });
373
1013
  });
374
- j.displayName = "Fireworks";
375
- var M = {
1014
+ Te.displayName = "Fireworks";
1015
+ var j = {
376
1016
  flipCounter: "cos-flipCounter-3LuI0",
377
1017
  digit: "cos-digit-yJRPy",
378
1018
  digitCard: "cos-digitCard-zZUzt",
@@ -384,61 +1024,84 @@ var M = {
384
1024
  isFlipping: "cos-isFlipping-EVEdI",
385
1025
  "fold-top": "cos-fold-top-v-6XJ",
386
1026
  "unfold-bottom": "cos-unfold-bottom-e2gzU"
387
- }, N = (e, t) => Math.max(0, Math.floor(e)).toString().padStart(t, "0").slice(-t), P = ({ digit: e, color: t, duration: r }) => {
388
- let i = a(e), [u, d] = o(!1), [f, p] = o(e);
1027
+ }, Ee = (e, t) => Math.max(0, Math.floor(e)).toString().padStart(t, "0").slice(-t), De = ({ digit: e, color: t, duration: r }) => {
1028
+ let i = o(e), [a, d] = s(!1), [f, p] = s(e);
389
1029
  n(() => {
390
1030
  if (e === i.current) return;
391
1031
  p(i.current), d(!0), i.current = e;
392
1032
  let t = window.setTimeout(() => d(!1), r);
393
1033
  return () => clearTimeout(t);
394
1034
  }, [e, r]);
395
- let m = u ? f : e;
396
- return /* @__PURE__ */ c("div", {
397
- className: M.digit,
1035
+ let m = a ? f : e;
1036
+ return /* @__PURE__ */ l("div", {
1037
+ className: j.digit,
398
1038
  style: {
399
1039
  "--flip-color": t,
400
1040
  "--flip-duration": `${r}ms`
401
1041
  },
402
- children: /* @__PURE__ */ l("div", {
403
- className: `${M.digitCard} ${u ? M.isFlipping : ""}`,
1042
+ children: /* @__PURE__ */ u("div", {
1043
+ className: `${j.digitCard} ${a ? j.isFlipping : ""}`,
404
1044
  children: [
405
- /* @__PURE__ */ c("div", {
406
- className: M.staticTop,
407
- children: /* @__PURE__ */ c("span", { children: m })
1045
+ /* @__PURE__ */ l("div", {
1046
+ className: j.staticTop,
1047
+ children: /* @__PURE__ */ l("span", { children: m })
408
1048
  }),
409
- /* @__PURE__ */ c("div", {
410
- className: M.staticBottom,
411
- children: /* @__PURE__ */ c("span", { children: m })
1049
+ /* @__PURE__ */ l("div", {
1050
+ className: j.staticBottom,
1051
+ children: /* @__PURE__ */ l("span", { children: m })
412
1052
  }),
413
- u && /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", {
414
- className: `${M.flap} ${M.flapTop}`,
415
- children: /* @__PURE__ */ c("span", { children: f })
416
- }), /* @__PURE__ */ c("div", {
417
- className: `${M.flap} ${M.flapBottom}`,
418
- children: /* @__PURE__ */ c("span", { children: e })
1053
+ a && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("div", {
1054
+ className: `${j.flap} ${j.flapTop}`,
1055
+ children: /* @__PURE__ */ l("span", { children: f })
1056
+ }), /* @__PURE__ */ l("div", {
1057
+ className: `${j.flap} ${j.flapBottom}`,
1058
+ children: /* @__PURE__ */ l("span", { children: e })
419
1059
  })] })
420
1060
  ]
421
1061
  })
422
1062
  });
423
- }, F = ({ value: e, digits: t = 4, color: n = "#38bdf8", duration: r = 600 }) => {
424
- let i = N(e, t).split("");
425
- return /* @__PURE__ */ c("div", {
426
- className: M.flipCounter,
427
- children: i.map((e, t) => /* @__PURE__ */ c(P, {
1063
+ }, Oe = ({ value: e, digits: t = 4, color: n = "#38bdf8", duration: r = 600 }) => {
1064
+ let i = Ee(e, t).split("");
1065
+ return /* @__PURE__ */ l("div", {
1066
+ className: j.flipCounter,
1067
+ children: i.map((e, t) => /* @__PURE__ */ l(De, {
428
1068
  digit: e,
429
1069
  color: n,
430
1070
  duration: r
431
1071
  }, t))
432
1072
  });
433
- }, I = {
1073
+ }, ke = {
1074
+ gradientFlow: "cos-gradientFlow-XhN16",
1075
+ text: "cos-text-ORuqk",
1076
+ flow: "cos-flow-9FzMA"
1077
+ }, Ae = [
1078
+ "#ff00de",
1079
+ "#7c3aed",
1080
+ "#00f0ff",
1081
+ "#38bdf8",
1082
+ "#ff00de"
1083
+ ], je = ({ text: e = "GRADIENT", colors: t = Ae, fontSize: n = 64 }) => {
1084
+ let r = t.length >= 2 ? t.join(", ") : Ae.join(", ");
1085
+ return /* @__PURE__ */ l("div", {
1086
+ className: ke.gradientFlow,
1087
+ children: /* @__PURE__ */ l("h1", {
1088
+ className: ke.text,
1089
+ style: {
1090
+ fontSize: n,
1091
+ backgroundImage: `linear-gradient(90deg, ${r})`
1092
+ },
1093
+ children: e
1094
+ })
1095
+ });
1096
+ }, Me = {
434
1097
  glitchText: "cos-glitchText-dZ-sR",
435
1098
  text: "cos-text-JsPHN",
436
1099
  "glitch-1": "cos-glitch-1-s9pqH",
437
1100
  "glitch-2": "cos-glitch-2-GhFB-"
438
- }, te = ({ text: e = "GLITCH", color: t = "#f8fafc", glitchColor1: n = "#ff00de", glitchColor2: r = "#00f0ff", fontSize: i = 64 }) => /* @__PURE__ */ c("div", {
439
- className: I.glitchText,
440
- children: /* @__PURE__ */ c("h1", {
441
- className: I.text,
1101
+ }, Ne = ({ text: e = "GLITCH", color: t = "#f8fafc", glitchColor1: n = "#ff00de", glitchColor2: r = "#00f0ff", fontSize: i = 64 }) => /* @__PURE__ */ l("div", {
1102
+ className: Me.glitchText,
1103
+ children: /* @__PURE__ */ l("h1", {
1104
+ className: Me.text,
442
1105
  "data-text": e,
443
1106
  style: {
444
1107
  fontSize: i,
@@ -448,70 +1111,409 @@ var M = {
448
1111
  },
449
1112
  children: e
450
1113
  })
451
- }), L = {
452
- matrixRain: "cos-matrixRain-qg9HC",
453
- canvas: "cos-canvas--AvpG",
454
- overlay: "cos-overlay-knj3b",
455
- title: "cos-title-sDfhs",
456
- flicker: "cos-flicker-smHxl",
457
- subtitle: "cos-subtitle-CWheW"
458
- }, ne = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ", R = ({ width: e = 800, height: t = 500, density: r = .6, color: i = "#00ff41", showOverlay: o = !0, title: s = "MATRIX", subtitle: u = "数字雨效果" }) => {
459
- let d = a(null);
1114
+ }), Pe = {
1115
+ gravityBalls: "cos-gravityBalls-LdwFo",
1116
+ canvas: "cos-canvas-n7esd"
1117
+ }, Fe = [
1118
+ "#38bdf8",
1119
+ "#a78bfa",
1120
+ "#f472b6",
1121
+ "#4ade80",
1122
+ "#fbbf24"
1123
+ ], Ie = ({ width: e = 400, height: t = 300, ballCount: r = 12 }) => {
1124
+ let i = o(null), a = o([]);
460
1125
  return n(() => {
461
- let n = d.current;
462
- if (!n) return;
463
- let a = window.devicePixelRatio || 1;
464
- n.width = e * a, n.height = t * a;
465
- let o = n.getContext("2d");
466
- if (!o) return;
467
- o.setTransform(a, 0, 0, a, 0, 0);
468
- let s = Math.floor(e / 16 * r), c = Array.from({ length: s }, () => Math.random() * -50), l = 0, u = document.hidden, p = f((e) => {
469
- u = e;
470
- }), m = () => {
471
- l = requestAnimationFrame(m), !u && (o.fillStyle = "rgb(0 0 0 / 8%)", o.fillRect(0, 0, e, t), o.font = "16px monospace", c.forEach((e, n) => {
472
- let a = ne[Math.floor(Math.random() * 53)], s = n / r * 16;
473
- o.fillStyle = i, o.fillText(a, s, e * 16), e * 16 > t && Math.random() > .975 && (c[n] = 0), c[n] += 1;
474
- }));
475
- };
476
- return m(), () => {
477
- cancelAnimationFrame(l), p();
478
- };
1126
+ a.current = Array.from({ length: r }, () => ({
1127
+ x: Math.random() * (e - 40) + 20,
1128
+ y: t * .5 * Math.random() + 10,
1129
+ vx: (Math.random() - .5) * 4,
1130
+ vy: Math.random() * 2,
1131
+ r: Math.random() * 10 + 8,
1132
+ color: Fe[Math.floor(Math.random() * Fe.length)]
1133
+ }));
479
1134
  }, [
480
- i,
481
1135
  r,
482
1136
  t,
483
1137
  e
484
- ]), /* @__PURE__ */ l("div", {
485
- className: L.matrixRain,
1138
+ ]), n(() => {
1139
+ let n = i.current;
1140
+ if (!n) return;
1141
+ let r = window.devicePixelRatio || 1;
1142
+ n.width = e * r, n.height = t * r;
1143
+ let o = n.getContext("2d");
1144
+ if (!o) return;
1145
+ o.setTransform(r, 0, 0, r, 0, 0);
1146
+ let s = 0, c = document.hidden, l = v((e) => {
1147
+ c = e;
1148
+ }), u = () => {
1149
+ if (s = requestAnimationFrame(u), c) return;
1150
+ let n = a.current;
1151
+ o.fillStyle = "#0f172a", o.fillRect(0, 0, e, t);
1152
+ for (let r of n) r.vy += .25, r.x += r.vx, r.y += r.vy, r.x - r.r < 0 ? (r.x = r.r, r.vx *= -.99) : r.x + r.r > e && (r.x = e - r.r, r.vx *= -.99), r.y + r.r > t && (r.y = t - r.r, r.vy *= -.99, r.vx *= .99), r.y - r.r < 0 && (r.y = r.r, r.vy *= -.99);
1153
+ for (let e = 0; e < n.length; e++) for (let t = e + 1; t < n.length; t++) {
1154
+ let r = n[e], i = n[t], a = i.x - r.x, o = i.y - r.y, s = Math.hypot(a, o) || .001, c = r.r + i.r;
1155
+ if (s < c) {
1156
+ let e = a / s, t = o / s, n = c - s;
1157
+ r.x -= e * n * .5, r.y -= t * n * .5, i.x += e * n * .5, i.y += t * n * .5;
1158
+ let l = (r.vx - i.vx) * e + (r.vy - i.vy) * t;
1159
+ l > 0 && (r.vx -= l * e, r.vy -= l * t, i.vx += l * e, i.vy += l * t);
1160
+ }
1161
+ }
1162
+ for (let e of n) {
1163
+ o.beginPath(), o.arc(e.x, e.y, e.r, 0, Math.PI * 2);
1164
+ let t = o.createRadialGradient(e.x - e.r * .3, e.y - e.r * .3, 0, e.x, e.y, e.r);
1165
+ t.addColorStop(0, "#fff"), t.addColorStop(.3, e.color), t.addColorStop(1, e.color), o.fillStyle = t, o.fill();
1166
+ }
1167
+ };
1168
+ return u(), () => {
1169
+ cancelAnimationFrame(s), l();
1170
+ };
1171
+ }, [t, e]), /* @__PURE__ */ l("div", {
1172
+ className: Pe.gravityBalls,
1173
+ style: {
1174
+ width: e,
1175
+ height: t
1176
+ },
1177
+ children: /* @__PURE__ */ l("canvas", {
1178
+ ref: i,
1179
+ className: Pe.canvas,
1180
+ style: {
1181
+ width: e,
1182
+ height: t
1183
+ }
1184
+ })
1185
+ });
1186
+ }, M = {
1187
+ wrap: "cos-wrap-r1gGL",
1188
+ card: "cos-card-3W10s",
1189
+ shine: "cos-shine-0xjID",
1190
+ image: "cos-image-AV2XG",
1191
+ placeholder: "cos-placeholder-wuuL3",
1192
+ info: "cos-info-CNR0r"
1193
+ }, Le = ({ title: e = "全息卡片", subtitle: t = "移动鼠标体验 3D 效果", image: n }) => {
1194
+ let r = o(null);
1195
+ return /* @__PURE__ */ l("div", {
1196
+ className: M.wrap,
1197
+ children: /* @__PURE__ */ u("div", {
1198
+ ref: r,
1199
+ className: M.card,
1200
+ onMouseMove: (e) => {
1201
+ let t = r.current;
1202
+ if (!t) return;
1203
+ let n = t.getBoundingClientRect(), i = (e.clientX - n.left) / n.width - .5, a = (e.clientY - n.top) / n.height - .5;
1204
+ t.style.setProperty("--rx", `${-a * 20}deg`), t.style.setProperty("--ry", `${i * 20}deg`), t.style.setProperty("--gx", `${(i + .5) * 100}%`), t.style.setProperty("--gy", `${(a + .5) * 100}%`);
1205
+ },
1206
+ onMouseLeave: () => {
1207
+ let e = r.current;
1208
+ e && (e.style.setProperty("--rx", "0deg"), e.style.setProperty("--ry", "0deg"), e.style.setProperty("--gx", "50%"), e.style.setProperty("--gy", "50%"));
1209
+ },
1210
+ children: [
1211
+ /* @__PURE__ */ l("div", { className: M.shine }),
1212
+ n ? /* @__PURE__ */ l("img", {
1213
+ src: n,
1214
+ alt: e,
1215
+ className: M.image
1216
+ }) : /* @__PURE__ */ l("div", {
1217
+ className: M.placeholder,
1218
+ children: /* @__PURE__ */ l("span", { children: "✦" })
1219
+ }),
1220
+ /* @__PURE__ */ u("div", {
1221
+ className: M.info,
1222
+ children: [/* @__PURE__ */ l("h3", { children: e }), /* @__PURE__ */ l("p", { children: t })]
1223
+ })
1224
+ ]
1225
+ })
1226
+ });
1227
+ }, N = {
1228
+ liquidProgress: "cos-liquidProgress-ABZZA",
1229
+ svg: "cos-svg-YdTvy",
1230
+ track: "cos-track-IhMjO",
1231
+ ring: "cos-ring-6PKMg",
1232
+ fillBg: "cos-fillBg-pwLI1",
1233
+ wave: "cos-wave-CBwgG",
1234
+ label: "cos-label-WYDqS"
1235
+ }, Re = ({ value: e = 0, max: t = 100, size: i = 160, color: a = "#38bdf8" }) => {
1236
+ let s = o(null), c = r().replace(/:/g, ""), d = y(t > 0 ? e / t * 100 : 0, 0, 100), f = 100 - d;
1237
+ return n(() => {
1238
+ let e = 0, t = 0, n = document.hidden, r = v((e) => {
1239
+ n = e;
1240
+ }), i = () => {
1241
+ if (!n) {
1242
+ t += .04;
1243
+ let e = s.current;
1244
+ if (e) {
1245
+ let n = f + Math.sin(t) * 2;
1246
+ e.setAttribute("d", `M0,${n} Q25,${n - 4 + Math.sin(t * 1.3) * 3} 50,${n} T100,${n} V100 H0 Z`);
1247
+ }
1248
+ }
1249
+ e = requestAnimationFrame(i);
1250
+ };
1251
+ return e = requestAnimationFrame(i), () => {
1252
+ cancelAnimationFrame(e), r();
1253
+ };
1254
+ }, [f]), /* @__PURE__ */ u("div", {
1255
+ className: N.liquidProgress,
1256
+ style: {
1257
+ width: i,
1258
+ height: i,
1259
+ "--liquid-color": a
1260
+ },
1261
+ children: [/* @__PURE__ */ u("svg", {
1262
+ viewBox: "0 0 100 100",
1263
+ className: N.svg,
1264
+ children: [
1265
+ /* @__PURE__ */ l("defs", { children: /* @__PURE__ */ l("clipPath", {
1266
+ id: `clip-${c}`,
1267
+ children: /* @__PURE__ */ l("circle", {
1268
+ cx: "50",
1269
+ cy: "50",
1270
+ r: 45
1271
+ })
1272
+ }) }),
1273
+ /* @__PURE__ */ l("circle", {
1274
+ cx: "50",
1275
+ cy: "50",
1276
+ r: 45,
1277
+ className: N.track,
1278
+ strokeWidth: 10,
1279
+ fill: "none"
1280
+ }),
1281
+ /* @__PURE__ */ u("g", {
1282
+ clipPath: `url(#clip-${c})`,
1283
+ children: [/* @__PURE__ */ l("rect", {
1284
+ x: "0",
1285
+ y: "0",
1286
+ width: "100",
1287
+ height: "100",
1288
+ className: N.fillBg
1289
+ }), /* @__PURE__ */ l("path", {
1290
+ ref: s,
1291
+ className: N.wave,
1292
+ d: `M0,${f} Q25,${f - 4} 50,${f} T100,${f} V100 H0 Z`
1293
+ })]
1294
+ }),
1295
+ /* @__PURE__ */ l("circle", {
1296
+ cx: "50",
1297
+ cy: "50",
1298
+ r: 45,
1299
+ className: N.ring,
1300
+ strokeWidth: 10,
1301
+ fill: "none"
1302
+ })
1303
+ ]
1304
+ }), /* @__PURE__ */ u("span", {
1305
+ className: N.label,
1306
+ children: [Math.round(d), "%"]
1307
+ })]
1308
+ });
1309
+ }, P = {
1310
+ liquidGlass: "cos-liquidGlass-Z3bQg",
1311
+ panel: "cos-panel-XYboD",
1312
+ content: "cos-content-MHfkS"
1313
+ }, ze = ({ children: e = "液态玻璃面板", blur: t = 16, borderRadius: n = 20 }) => /* @__PURE__ */ l("div", {
1314
+ className: P.liquidGlass,
1315
+ children: /* @__PURE__ */ l("div", {
1316
+ className: P.panel,
1317
+ style: {
1318
+ "--glass-blur": `${t}px`,
1319
+ "--glass-radius": `${n}px`
1320
+ },
1321
+ children: /* @__PURE__ */ l("div", {
1322
+ className: P.content,
1323
+ children: e
1324
+ })
1325
+ })
1326
+ }), Be = {
1327
+ magneticButton: "cos-magneticButton-GbRkE",
1328
+ btn: "cos-btn--b2BJ"
1329
+ }, Ve = ({ children: e = "磁吸按钮", strength: t = .4, color: n = "#6366f1" }) => {
1330
+ let r = o(null), i = o(null);
1331
+ return /* @__PURE__ */ l("div", {
1332
+ ref: r,
1333
+ className: Be.magneticButton,
1334
+ onMouseMove: (e) => {
1335
+ let n = r.current, a = i.current;
1336
+ if (!n || !a) return;
1337
+ let o = n.getBoundingClientRect(), s = o.left + o.width / 2, c = o.top + o.height / 2, l = (e.clientX - s) * t, u = (e.clientY - c) * t;
1338
+ a.style.transform = `translate(${l}px, ${u}px)`;
1339
+ },
1340
+ onMouseLeave: () => {
1341
+ let e = i.current;
1342
+ e && (e.style.transform = "translate(0, 0)");
1343
+ },
1344
+ children: /* @__PURE__ */ l("button", {
1345
+ ref: i,
1346
+ type: "button",
1347
+ className: Be.btn,
1348
+ style: { "--btn-color": n },
1349
+ children: e
1350
+ })
1351
+ });
1352
+ }, F = {
1353
+ matrixRain: "cos-matrixRain-qg9HC",
1354
+ canvas: "cos-canvas--AvpG",
1355
+ overlay: "cos-overlay-knj3b",
1356
+ title: "cos-title-sDfhs",
1357
+ flicker: "cos-flicker-smHxl",
1358
+ subtitle: "cos-subtitle-CWheW"
1359
+ }, He = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ", Ue = ({ width: e = 800, height: t = 500, density: r = .6, color: i = "#00ff41", showOverlay: a = !0, title: s = "MATRIX", subtitle: c = "数字雨效果" }) => {
1360
+ let d = o(null);
1361
+ return n(() => {
1362
+ let n = d.current;
1363
+ if (!n) return;
1364
+ let a = window.devicePixelRatio || 1;
1365
+ n.width = e * a, n.height = t * a;
1366
+ let o = n.getContext("2d");
1367
+ if (!o) return;
1368
+ o.setTransform(a, 0, 0, a, 0, 0);
1369
+ let s = Math.floor(e / 16 * r), c = Array.from({ length: s }, () => Math.random() * -50), l = 0, u = document.hidden, f = v((e) => {
1370
+ u = e;
1371
+ }), p = () => {
1372
+ l = requestAnimationFrame(p), !u && (o.fillStyle = "rgb(0 0 0 / 8%)", o.fillRect(0, 0, e, t), o.font = "16px monospace", c.forEach((e, n) => {
1373
+ let a = He[Math.floor(Math.random() * 53)], s = n / r * 16;
1374
+ o.fillStyle = i, o.fillText(a, s, e * 16), e * 16 > t && Math.random() > .975 && (c[n] = 0), c[n] += 1;
1375
+ }));
1376
+ };
1377
+ return p(), () => {
1378
+ cancelAnimationFrame(l), f();
1379
+ };
1380
+ }, [
1381
+ i,
1382
+ r,
1383
+ t,
1384
+ e
1385
+ ]), /* @__PURE__ */ u("div", {
1386
+ className: F.matrixRain,
486
1387
  style: {
487
1388
  width: e,
488
1389
  height: t
489
1390
  },
490
- children: [/* @__PURE__ */ c("canvas", {
1391
+ children: [/* @__PURE__ */ l("canvas", {
491
1392
  ref: d,
492
- className: L.canvas,
1393
+ className: F.canvas,
493
1394
  style: {
494
1395
  width: e,
495
1396
  height: t
496
1397
  }
497
- }), o && /* @__PURE__ */ l("div", {
498
- className: L.overlay,
499
- children: [/* @__PURE__ */ c("h2", {
500
- className: L.title,
1398
+ }), a && /* @__PURE__ */ u("div", {
1399
+ className: F.overlay,
1400
+ children: [/* @__PURE__ */ l("h2", {
1401
+ className: F.title,
501
1402
  children: s
502
- }), /* @__PURE__ */ c("p", {
503
- className: L.subtitle,
504
- children: u
1403
+ }), /* @__PURE__ */ l("p", {
1404
+ className: F.subtitle,
1405
+ children: c
505
1406
  })]
506
1407
  })]
507
1408
  });
508
- }, z = {
1409
+ }, We = {
1410
+ mazeGenerator: "cos-mazeGenerator-QEa0s",
1411
+ canvas: "cos-canvas-emhxb"
1412
+ }, Ge = ({ width: e = 400, height: t = 300, cellSize: r = 20, onGenerated: i }) => {
1413
+ let a = o(null), s = o(i);
1414
+ return n(() => {
1415
+ s.current = i;
1416
+ }, [i]), n(() => {
1417
+ let n = a.current;
1418
+ if (!n) return;
1419
+ let i = window.devicePixelRatio || 1;
1420
+ n.width = e * i, n.height = t * i;
1421
+ let o = n.getContext("2d");
1422
+ if (!o) return;
1423
+ o.setTransform(i, 0, 0, i, 0, 0);
1424
+ let c = Math.floor(e / r), l = Math.floor(t / r), u = Array.from({ length: l }, () => Array.from({ length: c }, () => ({
1425
+ top: !0,
1426
+ right: !0,
1427
+ bottom: !0,
1428
+ left: !0,
1429
+ visited: !1
1430
+ }))), d = [[0, 0]];
1431
+ u[0][0].visited = !0;
1432
+ let f = [
1433
+ [
1434
+ 0,
1435
+ -1,
1436
+ "top"
1437
+ ],
1438
+ [
1439
+ 1,
1440
+ 0,
1441
+ "right"
1442
+ ],
1443
+ [
1444
+ 0,
1445
+ 1,
1446
+ "bottom"
1447
+ ],
1448
+ [
1449
+ -1,
1450
+ 0,
1451
+ "left"
1452
+ ]
1453
+ ], p = {
1454
+ top: "bottom",
1455
+ right: "left",
1456
+ bottom: "top",
1457
+ left: "right"
1458
+ };
1459
+ for (; d.length;) {
1460
+ let [e, t] = d[d.length - 1], n = f.map(([n, r, i]) => {
1461
+ let a = e + n, o = t + r;
1462
+ return a < 0 || o < 0 || a >= c || o >= l || u[o][a].visited ? null : {
1463
+ nx: a,
1464
+ ny: o,
1465
+ wall: i
1466
+ };
1467
+ }).filter(Boolean);
1468
+ if (!n.length) {
1469
+ d.pop();
1470
+ continue;
1471
+ }
1472
+ let r = n[Math.floor(Math.random() * n.length)];
1473
+ u[t][e][r.wall] = !1, u[r.ny][r.nx][p[r.wall]] = !1, u[r.ny][r.nx].visited = !0, d.push([r.nx, r.ny]);
1474
+ }
1475
+ s.current?.(c, l);
1476
+ let m = 0, h = 0, g = c * l * 2, _ = document.hidden, y = v((e) => {
1477
+ _ = e;
1478
+ }), b = () => {
1479
+ if (m = requestAnimationFrame(b), _) return;
1480
+ h = Math.min(g, h + 2), o.fillStyle = "#0f172a", o.fillRect(0, 0, e, t), o.strokeStyle = "#38bdf8", o.lineWidth = 1.5, o.shadowColor = "#38bdf8", o.shadowBlur = 4;
1481
+ let n = 0;
1482
+ for (let e = 0; e < l; e++) for (let t = 0; t < c; t++) {
1483
+ let i = u[e][t], a = t * r, s = e * r;
1484
+ i.top && n++ < h && (o.beginPath(), o.moveTo(a, s), o.lineTo(a + r, s), o.stroke()), i.right && n++ < h && (o.beginPath(), o.moveTo(a + r, s), o.lineTo(a + r, s + r), o.stroke()), e === l - 1 && i.bottom && n++ < h && (o.beginPath(), o.moveTo(a, s + r), o.lineTo(a + r, s + r), o.stroke()), t === 0 && i.left && n++ < h && (o.beginPath(), o.moveTo(a, s), o.lineTo(a, s + r), o.stroke());
1485
+ }
1486
+ o.shadowBlur = 0;
1487
+ };
1488
+ return b(), () => {
1489
+ cancelAnimationFrame(m), y();
1490
+ };
1491
+ }, [
1492
+ r,
1493
+ t,
1494
+ e
1495
+ ]), /* @__PURE__ */ l("div", {
1496
+ className: We.mazeGenerator,
1497
+ style: {
1498
+ width: e,
1499
+ height: t
1500
+ },
1501
+ children: /* @__PURE__ */ l("canvas", {
1502
+ ref: a,
1503
+ className: We.canvas,
1504
+ style: {
1505
+ width: e,
1506
+ height: t
1507
+ }
1508
+ })
1509
+ });
1510
+ }, Ke = {
509
1511
  meteorRain: "cos-meteorRain-v8RNI",
510
1512
  canvas: "cos-canvas-hyFMr"
511
- }, B = ({ width: e = 800, height: t = 500, meteorCount: r = 8 }) => {
512
- let i = a(null), o = a([]), s = a(0);
1513
+ }, qe = ({ width: e = 800, height: t = 500, meteorCount: r = 8 }) => {
1514
+ let i = o(null), a = o([]), s = o(0);
513
1515
  return n(() => {
514
- o.current = Array.from({ length: r }, () => ({
1516
+ a.current = Array.from({ length: r }, () => ({
515
1517
  x: Math.random() * e,
516
1518
  y: Math.random() * t * .5,
517
1519
  length: Math.random() * 60 + 40,
@@ -527,69 +1529,172 @@ var M = {
527
1529
  if (!n) return;
528
1530
  let r = window.devicePixelRatio || 1;
529
1531
  n.width = e * r, n.height = t * r;
530
- let a = n.getContext("2d");
531
- if (!a) return;
532
- a.setTransform(r, 0, 0, r, 0, 0);
533
- let c = document.hidden, l = f((e) => {
1532
+ let o = n.getContext("2d");
1533
+ if (!o) return;
1534
+ o.setTransform(r, 0, 0, r, 0, 0);
1535
+ let c = document.hidden, l = v((e) => {
534
1536
  c = e;
535
1537
  }), u = () => {
536
- s.current = requestAnimationFrame(u), !c && (a.fillStyle = "rgb(15 23 42 / 15%)", a.fillRect(0, 0, e, t), o.current.forEach((n) => {
1538
+ s.current = requestAnimationFrame(u), !c && (o.fillStyle = "rgb(15 23 42 / 15%)", o.fillRect(0, 0, e, t), a.current.forEach((n) => {
537
1539
  n.x += n.speed, n.y += n.speed * .6, (n.x > e + n.length || n.y > t + n.length) && (n.x = -n.length, n.y = Math.random() * t * .4, n.length = Math.random() * 60 + 40, n.speed = Math.random() * 6 + 4, n.opacity = Math.random() * .5 + .3);
538
1540
  let r = n.x - n.length, i = n.y - n.length * .6;
539
- a.beginPath(), a.strokeStyle = `rgb(255 255 255 / ${n.opacity})`, a.lineWidth = 2, a.moveTo(n.x, n.y), a.lineTo(r, i), a.stroke(), a.beginPath(), a.fillStyle = `rgb(255 255 255 / ${Math.min(1, n.opacity + .2)})`, a.arc(n.x, n.y, 1.5, 0, Math.PI * 2), a.fill();
1541
+ o.beginPath(), o.strokeStyle = `rgb(255 255 255 / ${n.opacity})`, o.lineWidth = 2, o.moveTo(n.x, n.y), o.lineTo(r, i), o.stroke(), o.beginPath(), o.fillStyle = `rgb(255 255 255 / ${Math.min(1, n.opacity + .2)})`, o.arc(n.x, n.y, 1.5, 0, Math.PI * 2), o.fill();
540
1542
  }));
541
1543
  };
542
1544
  return u(), () => {
543
1545
  cancelAnimationFrame(s.current), l();
544
1546
  };
545
- }, [t, e]), /* @__PURE__ */ c("div", {
546
- className: z.meteorRain,
1547
+ }, [t, e]), /* @__PURE__ */ l("div", {
1548
+ className: Ke.meteorRain,
547
1549
  style: {
548
1550
  width: e,
549
1551
  height: t
550
1552
  },
551
- children: /* @__PURE__ */ c("canvas", {
1553
+ children: /* @__PURE__ */ l("canvas", {
552
1554
  ref: i,
553
- className: z.canvas,
1555
+ className: Ke.canvas,
554
1556
  style: {
555
1557
  width: e,
556
1558
  height: t
557
1559
  }
558
1560
  })
559
1561
  });
560
- }, V = {
1562
+ }, I = {
561
1563
  neonText: "cos-neonText-JMP7i",
562
1564
  text: "cos-text-GTO-0",
563
1565
  flicker: "cos-flicker-nXceV",
564
1566
  "neon-flicker": "cos-neon-flicker-uDkmM",
565
1567
  reflection: "cos-reflection-aEYj6"
566
- }, H = ({ text: e = "NEON", color: t = "#ff00de", fontSize: n = 72, flicker: r = !0 }) => /* @__PURE__ */ l("div", {
567
- className: V.neonText,
568
- children: [/* @__PURE__ */ c("h1", {
569
- className: `${V.text} ${r ? V.flicker : ""}`,
1568
+ }, Je = ({ text: e = "NEON", color: t = "#ff00de", fontSize: n = 72, flicker: r = !0 }) => /* @__PURE__ */ u("div", {
1569
+ className: I.neonText,
1570
+ children: [/* @__PURE__ */ l("h1", {
1571
+ className: `${I.text} ${r ? I.flicker : ""}`,
570
1572
  style: {
571
1573
  fontSize: n,
572
1574
  "--neon-color": t
573
1575
  },
574
1576
  children: e
575
- }), /* @__PURE__ */ c("p", {
576
- className: V.reflection,
1577
+ }), /* @__PURE__ */ l("p", {
1578
+ className: I.reflection,
577
1579
  style: {
578
1580
  fontSize: n * .35,
579
1581
  color: t
580
1582
  },
581
1583
  children: e
582
1584
  })]
583
- }), U = {
1585
+ }), L = {
1586
+ newtonCradle: "cos-newtonCradle-mFl-b",
1587
+ frame: "cos-frame-pp818",
1588
+ pendulum: "cos-pendulum-mC9Bq",
1589
+ "swing-left": "cos-swing-left-Mf5fy",
1590
+ "swing-right": "cos-swing-right-gEH1F",
1591
+ string: "cos-string-UpYWC",
1592
+ ball: "cos-ball-sj82r"
1593
+ }, Ye = ({ ballCount: e = 5, color: t = "#38bdf8" }) => {
1594
+ let n = Math.max(2, Math.min(e, 7));
1595
+ return /* @__PURE__ */ l("div", {
1596
+ className: L.newtonCradle,
1597
+ style: { "--ball-color": t },
1598
+ children: /* @__PURE__ */ l("div", {
1599
+ className: L.frame,
1600
+ children: Array.from({ length: n }, (e, t) => /* @__PURE__ */ u("div", {
1601
+ className: L.pendulum,
1602
+ "data-role": t === 0 ? "left" : t === n - 1 ? "right" : "middle",
1603
+ children: [/* @__PURE__ */ l("span", { className: L.string }), /* @__PURE__ */ l("span", { className: L.ball })]
1604
+ }, t))
1605
+ })
1606
+ });
1607
+ }, R = {
1608
+ orbitalChart: "cos-orbitalChart-XLORB",
1609
+ canvas: "cos-canvas-hGVud",
1610
+ legend: "cos-legend-Np9Mm",
1611
+ swatch: "cos-swatch-xEKvA"
1612
+ }, Xe = [
1613
+ {
1614
+ label: "A",
1615
+ value: 30,
1616
+ color: "#38bdf8"
1617
+ },
1618
+ {
1619
+ label: "B",
1620
+ value: 25,
1621
+ color: "#a78bfa"
1622
+ },
1623
+ {
1624
+ label: "C",
1625
+ value: 20,
1626
+ color: "#f472b6"
1627
+ },
1628
+ {
1629
+ label: "D",
1630
+ value: 25,
1631
+ color: "#4ade80"
1632
+ }
1633
+ ], Ze = ({ data: e = Xe, size: t = 240 }) => {
1634
+ let r = o(null);
1635
+ return n(() => {
1636
+ let n = r.current;
1637
+ if (!n || e.length === 0) return;
1638
+ let i = window.devicePixelRatio || 1;
1639
+ n.width = t * i, n.height = t * i;
1640
+ let a = n.getContext("2d");
1641
+ if (!a) return;
1642
+ a.setTransform(i, 0, 0, i, 0, 0);
1643
+ let o = e.reduce((e, t) => e + t.value, 0) || 1, s = t / 2, c = t / 2, l = (t / 2 - 20) / (e.length + 1), u = 0, d = 0, f = document.hidden, p = v((e) => {
1644
+ f = e;
1645
+ }), m = () => {
1646
+ if (u = requestAnimationFrame(m), f) return;
1647
+ d += .012, a.fillStyle = "#0f172a", a.fillRect(0, 0, t, t), e.forEach((e, t) => {
1648
+ let n = l * (t + 1), r = e.value / o, i = y(Math.round(r * 12) + 1, 1, 16), u = .4 + t * .15;
1649
+ a.beginPath(), a.arc(s, c, n, 0, Math.PI * 2), a.strokeStyle = "rgb(148 163 184 / 15%)", a.lineWidth = 1, a.stroke();
1650
+ for (let t = 0; t < i; t++) {
1651
+ let r = d * u + t / i * Math.PI * 2, o = s + Math.cos(r) * n, l = c + Math.sin(r) * n;
1652
+ a.beginPath(), a.arc(o, l, 4, 0, Math.PI * 2), a.fillStyle = e.color, a.shadowColor = e.color, a.shadowBlur = 6, a.fill(), a.shadowBlur = 0;
1653
+ }
1654
+ });
1655
+ let n = e.reduce((e, t) => t.value > e.value ? t : e, e[0]), r = Math.round(n.value / o * 100);
1656
+ a.fillStyle = "#e2e8f0", a.font = "bold 14px system-ui", a.textAlign = "center", a.fillText(`${r}%`, s, c + 2), a.font = "10px system-ui", a.fillStyle = "#94a3b8", a.fillText(n.label, s, c + 16);
1657
+ };
1658
+ return m(), () => {
1659
+ cancelAnimationFrame(u), p();
1660
+ };
1661
+ }, [e, t]), /* @__PURE__ */ u("div", {
1662
+ className: R.orbitalChart,
1663
+ style: {
1664
+ width: t,
1665
+ height: t
1666
+ },
1667
+ children: [/* @__PURE__ */ l("canvas", {
1668
+ ref: r,
1669
+ className: R.canvas,
1670
+ style: {
1671
+ width: t,
1672
+ height: t
1673
+ }
1674
+ }), /* @__PURE__ */ l("ul", {
1675
+ className: R.legend,
1676
+ children: e.map((e) => /* @__PURE__ */ u("li", { children: [
1677
+ /* @__PURE__ */ l("span", {
1678
+ className: R.swatch,
1679
+ style: { background: e.color }
1680
+ }),
1681
+ e.label,
1682
+ " (",
1683
+ e.value,
1684
+ ")"
1685
+ ] }, e.label))
1686
+ })]
1687
+ });
1688
+ }, z = {
584
1689
  particleNetwork: "cos-particleNetwork-GSZq-",
585
1690
  canvas: "cos-canvas-E-BGP",
586
1691
  hint: "cos-hint-LEO5o"
587
- }, W = ({ width: e = 800, height: r = 500, particleCount: i = 60, linkDistance: o = 120, repelRadius: s = 150, color: u = "#38bdf8" }) => {
588
- let d = a(null), p = a([]), m = a({
1692
+ }, Qe = ({ width: e = 800, height: r = 500, particleCount: i = 60, linkDistance: a = 120, repelRadius: s = 150, color: c = "#38bdf8" }) => {
1693
+ let d = o(null), f = o([]), p = o({
589
1694
  x: -1e3,
590
1695
  y: -1e3
591
- }), h = t(() => {
592
- p.current = Array.from({ length: i }, () => ({
1696
+ }), m = t(() => {
1697
+ f.current = Array.from({ length: i }, () => ({
593
1698
  x: Math.random() * e,
594
1699
  y: Math.random() * r,
595
1700
  vx: (Math.random() - .5) * 1.2,
@@ -602,8 +1707,8 @@ var M = {
602
1707
  e
603
1708
  ]);
604
1709
  n(() => {
605
- h();
606
- }, [h]), n(() => {
1710
+ m();
1711
+ }, [m]), n(() => {
607
1712
  let t = d.current;
608
1713
  if (!t) return;
609
1714
  let n = window.devicePixelRatio || 1;
@@ -611,105 +1716,478 @@ var M = {
611
1716
  let i = t.getContext("2d");
612
1717
  if (!i) return;
613
1718
  i.setTransform(n, 0, 0, n, 0, 0);
614
- let a = 0, c = document.hidden, l = f((e) => {
615
- c = e;
616
- }), h = () => {
617
- if (c) {
618
- a = requestAnimationFrame(h);
1719
+ let o = 0, l = document.hidden, u = v((e) => {
1720
+ l = e;
1721
+ }), m = () => {
1722
+ if (l) {
1723
+ o = requestAnimationFrame(m);
619
1724
  return;
620
1725
  }
621
1726
  i.fillStyle = "#0f172a", i.fillRect(0, 0, e, r);
622
- let t = p.current, n = m.current, l = s * s;
1727
+ let t = f.current, n = p.current, u = s * s;
623
1728
  t.forEach((t) => {
624
1729
  t.x += t.vx, t.y += t.vy, (t.x < 0 || t.x > e) && (t.vx *= -1), (t.y < 0 || t.y > r) && (t.vy *= -1);
625
1730
  let i = n.x - t.x, a = n.y - t.y, o = i * i + a * a;
626
- if (o < l && o > 0) {
1731
+ if (o < u && o > 0) {
627
1732
  let e = Math.sqrt(o);
628
1733
  t.vx -= i / e * .15, t.vy -= a / e * .15;
629
1734
  }
630
1735
  });
631
1736
  for (let e = 0; e < t.length; e++) for (let n = e + 1; n < t.length; n++) {
632
- let r = t[e].x - t[n].x, a = t[e].y - t[n].y, s = r * r + a * a;
633
- if (s < o * o) {
1737
+ let r = t[e].x - t[n].x, o = t[e].y - t[n].y, s = r * r + o * o;
1738
+ if (s < a * a) {
634
1739
  let r = Math.sqrt(s);
635
- i.beginPath(), i.moveTo(t[e].x, t[e].y), i.lineTo(t[n].x, t[n].y), i.strokeStyle = u, i.globalAlpha = 1 - r / o, i.lineWidth = .8, i.stroke(), i.globalAlpha = 1;
1740
+ i.beginPath(), i.moveTo(t[e].x, t[e].y), i.lineTo(t[n].x, t[n].y), i.strokeStyle = c, i.globalAlpha = 1 - r / a, i.lineWidth = .8, i.stroke(), i.globalAlpha = 1;
636
1741
  }
637
1742
  }
638
1743
  t.forEach((e) => {
639
- i.beginPath(), i.arc(e.x, e.y, e.radius, 0, Math.PI * 2), i.fillStyle = u, i.fill();
640
- }), a = requestAnimationFrame(h);
1744
+ i.beginPath(), i.arc(e.x, e.y, e.radius, 0, Math.PI * 2), i.fillStyle = c, i.fill();
1745
+ }), o = requestAnimationFrame(m);
641
1746
  };
642
- return h(), () => {
643
- cancelAnimationFrame(a), l();
1747
+ return m(), () => {
1748
+ cancelAnimationFrame(o), u();
644
1749
  };
645
1750
  }, [
646
- u,
1751
+ c,
647
1752
  r,
648
- h,
649
- o,
1753
+ m,
1754
+ a,
650
1755
  s,
651
1756
  e
652
1757
  ]);
653
- let g = (e, t, n) => {
654
- m.current = {
1758
+ let h = (e, t, n) => {
1759
+ p.current = {
655
1760
  x: e - n.left,
656
1761
  y: t - n.top
657
1762
  };
1763
+ }, g = (e) => {
1764
+ h(e.clientX, e.clientY, e.currentTarget.getBoundingClientRect());
658
1765
  }, _ = (e) => {
659
- g(e.clientX, e.clientY, e.currentTarget.getBoundingClientRect());
660
- }, v = (e) => {
661
1766
  let t = e.touches[0];
662
- t && g(t.clientX, t.clientY, e.currentTarget.getBoundingClientRect());
1767
+ t && h(t.clientX, t.clientY, e.currentTarget.getBoundingClientRect());
663
1768
  }, y = () => {
664
- m.current = {
1769
+ p.current = {
665
1770
  x: -1e3,
666
1771
  y: -1e3
667
1772
  };
668
1773
  };
669
- return /* @__PURE__ */ l("div", {
670
- className: U.particleNetwork,
1774
+ return /* @__PURE__ */ u("div", {
1775
+ className: z.particleNetwork,
671
1776
  style: {
672
1777
  width: e,
673
1778
  height: r
674
1779
  },
675
- children: [/* @__PURE__ */ c("canvas", {
1780
+ children: [/* @__PURE__ */ l("canvas", {
676
1781
  ref: d,
677
- className: U.canvas,
1782
+ className: z.canvas,
678
1783
  style: {
679
1784
  width: e,
680
1785
  height: r
681
1786
  },
682
- onMouseMove: _,
1787
+ onMouseMove: g,
683
1788
  onMouseLeave: y,
684
- onTouchMove: v,
1789
+ onTouchMove: _,
685
1790
  onTouchEnd: y
686
- }), /* @__PURE__ */ c("p", {
687
- className: U.hint,
1791
+ }), /* @__PURE__ */ l("p", {
1792
+ className: z.hint,
688
1793
  children: "移动鼠标或手指与粒子互动"
689
1794
  })]
690
1795
  });
691
- }, G = {
1796
+ }, $e = {
1797
+ smokeFog: "cos-smokeFog-SYlts",
1798
+ canvas: "cos-canvas-iOJV7"
1799
+ }, et = ({ width: e = 800, height: t = 500, density: r = .5 }) => {
1800
+ let i = o(null), a = o([]), s = o(0);
1801
+ return n(() => {
1802
+ let n = Math.floor(20 + r * 40);
1803
+ a.current = Array.from({ length: n }, () => ({
1804
+ x: Math.random() * e,
1805
+ y: Math.random() * t,
1806
+ radius: Math.random() * 80 + 40,
1807
+ vx: (Math.random() - .5) * .4,
1808
+ vy: (Math.random() - .5) * .3 - .1,
1809
+ alpha: Math.random() * .15 + .05
1810
+ }));
1811
+ }, [
1812
+ r,
1813
+ t,
1814
+ e
1815
+ ]), n(() => {
1816
+ let n = i.current;
1817
+ if (!n) return;
1818
+ let r = window.devicePixelRatio || 1;
1819
+ n.width = e * r, n.height = t * r;
1820
+ let o = n.getContext("2d");
1821
+ if (!o) return;
1822
+ o.setTransform(r, 0, 0, r, 0, 0);
1823
+ let c = 0, l = document.hidden, u = v((e) => {
1824
+ l = e;
1825
+ }), d = () => {
1826
+ if (s.current = requestAnimationFrame(d), l) return;
1827
+ c += .008, o.fillStyle = "#1a1a2e", o.fillRect(0, 0, e, t);
1828
+ let n = o.createRadialGradient(e * .5, t * .3, 0, e * .5, t * .5, e * .7);
1829
+ n.addColorStop(0, "#2d2d44"), n.addColorStop(1, "#1a1a2e"), o.fillStyle = n, o.fillRect(0, 0, e, t), a.current.forEach((n, r) => {
1830
+ n.x += n.vx + Math.sin(c + r) * .15, n.y += n.vy + Math.cos(c * .7 + r * .5) * .1, n.x < -n.radius && (n.x = e + n.radius), n.x > e + n.radius && (n.x = -n.radius), n.y < -n.radius && (n.y = t + n.radius), n.y > t + n.radius && (n.y = -n.radius);
1831
+ let i = o.createRadialGradient(n.x, n.y, 0, n.x, n.y, n.radius);
1832
+ i.addColorStop(0, `rgb(200 200 210 / ${n.alpha})`), i.addColorStop(.5, `rgb(160 160 175 / ${n.alpha * .5})`), i.addColorStop(1, "rgb(160 160 175 / 0)"), o.fillStyle = i, o.beginPath(), o.arc(n.x, n.y, n.radius, 0, Math.PI * 2), o.fill();
1833
+ });
1834
+ };
1835
+ return d(), () => {
1836
+ cancelAnimationFrame(s.current), u();
1837
+ };
1838
+ }, [t, e]), /* @__PURE__ */ l("div", {
1839
+ className: $e.smokeFog,
1840
+ style: {
1841
+ width: e,
1842
+ height: t
1843
+ },
1844
+ children: /* @__PURE__ */ l("canvas", {
1845
+ ref: i,
1846
+ className: $e.canvas,
1847
+ style: {
1848
+ width: e,
1849
+ height: t
1850
+ }
1851
+ })
1852
+ });
1853
+ }, tt = {
1854
+ snowfall: "cos-snowfall-Q-Dhg",
1855
+ canvas: "cos-canvas-bJVF8"
1856
+ }, nt = ({ width: e = 800, height: r = 500, mode: i = "snow", count: a = 120 }) => {
1857
+ let s = o(null), c = o([]), u = o(0), d = t((t) => ({
1858
+ x: Math.random() * e,
1859
+ y: t ?? Math.random() * r,
1860
+ size: i === "sakura" ? Math.random() * 6 + 4 : Math.random() * 3 + 1,
1861
+ speed: Math.random() * 1.5 + .5,
1862
+ drift: (Math.random() - .5) * .8,
1863
+ rotation: Math.random() * Math.PI * 2,
1864
+ rotationSpeed: (Math.random() - .5) * .04,
1865
+ opacity: Math.random() * .6 + .4
1866
+ }), [
1867
+ r,
1868
+ i,
1869
+ e
1870
+ ]);
1871
+ return n(() => {
1872
+ c.current = Array.from({ length: a }, () => d());
1873
+ }, [a, d]), n(() => {
1874
+ let t = s.current;
1875
+ if (!t) return;
1876
+ let n = window.devicePixelRatio || 1;
1877
+ t.width = e * n, t.height = r * n;
1878
+ let a = t.getContext("2d");
1879
+ if (!a) return;
1880
+ a.setTransform(n, 0, 0, n, 0, 0);
1881
+ let o = document.hidden, l = v((e) => {
1882
+ o = e;
1883
+ }), f = (e) => {
1884
+ a.globalAlpha = e.opacity, a.fillStyle = "#fff", a.beginPath(), a.arc(e.x, e.y, e.size, 0, Math.PI * 2), a.fill();
1885
+ }, p = (e) => {
1886
+ a.save(), a.translate(e.x, e.y), a.rotate(e.rotation), a.globalAlpha = e.opacity;
1887
+ let t = e.size;
1888
+ a.fillStyle = "#ffb7c5", a.beginPath(), a.ellipse(0, 0, t, t * .6, 0, 0, Math.PI * 2), a.fill(), a.fillStyle = "#ff8fa3", a.beginPath(), a.ellipse(t * .3, 0, t * .5, t * .35, .5, 0, Math.PI * 2), a.fill(), a.restore();
1889
+ }, m = () => {
1890
+ u.current = requestAnimationFrame(m), !o && (a.fillStyle = i === "sakura" ? "#1a1020" : "#0f172a", a.fillRect(0, 0, e, r), c.current.forEach((e) => {
1891
+ e.y += e.speed, e.x += e.drift + Math.sin(e.y * .02) * .3, e.rotation += e.rotationSpeed, e.y > r + 10 && Object.assign(e, d(-10)), i === "sakura" ? p(e) : f(e);
1892
+ }), a.globalAlpha = 1);
1893
+ };
1894
+ return m(), () => {
1895
+ cancelAnimationFrame(u.current), l();
1896
+ };
1897
+ }, [
1898
+ d,
1899
+ r,
1900
+ i,
1901
+ e
1902
+ ]), /* @__PURE__ */ l("div", {
1903
+ className: tt.snowfall,
1904
+ style: {
1905
+ width: e,
1906
+ height: r
1907
+ },
1908
+ children: /* @__PURE__ */ l("canvas", {
1909
+ ref: s,
1910
+ className: tt.canvas,
1911
+ style: {
1912
+ width: e,
1913
+ height: r
1914
+ }
1915
+ })
1916
+ });
1917
+ }, rt = {
1918
+ starfield: "cos-starfield-QTwia",
1919
+ canvas: "cos-canvas-C2t3g"
1920
+ }, it = ({ width: e = 800, height: t = 500, starCount: r = 400, speed: i = 1 }) => {
1921
+ let a = o(null), s = o([]), c = o(0);
1922
+ return n(() => {
1923
+ s.current = Array.from({ length: r }, () => ({
1924
+ x: (Math.random() - .5) * e,
1925
+ y: (Math.random() - .5) * t,
1926
+ z: Math.random() * e
1927
+ }));
1928
+ }, [
1929
+ t,
1930
+ r,
1931
+ e
1932
+ ]), n(() => {
1933
+ let n = a.current;
1934
+ if (!n) return;
1935
+ let r = window.devicePixelRatio || 1;
1936
+ n.width = e * r, n.height = t * r;
1937
+ let o = n.getContext("2d");
1938
+ if (!o) return;
1939
+ o.setTransform(r, 0, 0, r, 0, 0);
1940
+ let l = e / 2, u = t / 2, d = document.hidden, f = v((e) => {
1941
+ d = e;
1942
+ }), p = () => {
1943
+ c.current = requestAnimationFrame(p), !d && (o.fillStyle = "rgb(0 0 0 / 25%)", o.fillRect(0, 0, e, t), s.current.forEach((n) => {
1944
+ n.z -= i * 2, n.z <= 0 && (n.x = (Math.random() - .5) * e, n.y = (Math.random() - .5) * t, n.z = e);
1945
+ let r = 128 / n.z, a = n.x * r + l, s = n.y * r + u;
1946
+ if (a < 0 || a >= e || s < 0 || s >= t) return;
1947
+ let c = (1 - n.z / e) * 3, d = (1 - n.z / e) * 255;
1948
+ if (c > .5) {
1949
+ let e = 128 / (n.z + i * 4), t = n.x * e + l, r = n.y * e + u;
1950
+ o.beginPath(), o.strokeStyle = `rgb(${d} ${d} ${d + 30})`, o.lineWidth = c, o.moveTo(t, r), o.lineTo(a, s), o.stroke();
1951
+ } else o.fillStyle = `rgb(${d} ${d} ${d + 30})`, o.fillRect(a, s, c, c);
1952
+ }));
1953
+ };
1954
+ return p(), () => {
1955
+ cancelAnimationFrame(c.current), f();
1956
+ };
1957
+ }, [
1958
+ t,
1959
+ i,
1960
+ r,
1961
+ e
1962
+ ]), /* @__PURE__ */ l("div", {
1963
+ className: rt.starfield,
1964
+ style: {
1965
+ width: e,
1966
+ height: t
1967
+ },
1968
+ children: /* @__PURE__ */ l("canvas", {
1969
+ ref: a,
1970
+ className: rt.canvas,
1971
+ style: {
1972
+ width: e,
1973
+ height: t
1974
+ }
1975
+ })
1976
+ });
1977
+ }, B = {
1978
+ progressChest: "cos-progressChest-Bqcv1",
1979
+ barWrap: "cos-barWrap-E2pnl",
1980
+ barTrack: "cos-barTrack-dKLhs",
1981
+ barFill: "cos-barFill-NZJJe",
1982
+ pct: "cos-pct-D91IU",
1983
+ chest: "cos-chest-YebJO",
1984
+ lid: "cos-lid-K4GSD",
1985
+ open: "cos-open-eWo0Y",
1986
+ lidTop: "cos-lidTop-N-p2g",
1987
+ lock: "cos-lock--0AaQ",
1988
+ body: "cos-body-iqUt3",
1989
+ treasure: "cos-treasure-nx-6S",
1990
+ pop: "cos-pop-uRZvT",
1991
+ label: "cos-label-61hRe"
1992
+ }, at = ({ progress: e = 0, onOpen: t, label: r = "开启宝箱" }) => {
1993
+ let i = o(!1), a = y(e, 0, 100), s = a >= 100;
1994
+ return n(() => {
1995
+ s && !i.current && (i.current = !0, t?.()), s || (i.current = !1);
1996
+ }, [s, t]), /* @__PURE__ */ u("div", {
1997
+ className: B.progressChest,
1998
+ children: [
1999
+ /* @__PURE__ */ u("div", {
2000
+ className: B.barWrap,
2001
+ children: [/* @__PURE__ */ l("div", {
2002
+ className: B.barTrack,
2003
+ children: /* @__PURE__ */ l("div", {
2004
+ className: B.barFill,
2005
+ style: { width: `${a}%` }
2006
+ })
2007
+ }), /* @__PURE__ */ u("span", {
2008
+ className: B.pct,
2009
+ children: [a.toFixed(0), "%"]
2010
+ })]
2011
+ }),
2012
+ /* @__PURE__ */ u("div", {
2013
+ className: `${B.chest} ${s ? B.open : ""}`,
2014
+ children: [/* @__PURE__ */ u("div", {
2015
+ className: B.lid,
2016
+ children: [/* @__PURE__ */ l("div", { className: B.lidTop }), /* @__PURE__ */ l("div", { className: B.lock })]
2017
+ }), /* @__PURE__ */ l("div", {
2018
+ className: B.body,
2019
+ children: s && /* @__PURE__ */ u("div", {
2020
+ className: B.treasure,
2021
+ children: [
2022
+ /* @__PURE__ */ l("span", { children: "💎" }),
2023
+ /* @__PURE__ */ l("span", { children: "✨" }),
2024
+ /* @__PURE__ */ l("span", { children: "🪙" })
2025
+ ]
2026
+ })
2027
+ })]
2028
+ }),
2029
+ /* @__PURE__ */ l("p", {
2030
+ className: B.label,
2031
+ children: s ? "宝箱已开启!" : r
2032
+ })
2033
+ ]
2034
+ });
2035
+ }, ot = {
2036
+ radarScan: "cos-radarScan-PZaG8",
2037
+ canvas: "cos-canvas-fUw5N"
2038
+ }, st = ({ size: e = 300, color: t = "#22d3ee", blipCount: r = 5 }) => {
2039
+ let i = o(null), a = o(0), s = o([]), c = o(0);
2040
+ return n(() => {
2041
+ s.current = Array.from({ length: r }, () => ({
2042
+ angle: Math.random() * Math.PI * 2,
2043
+ dist: Math.random() * .7 + .15,
2044
+ alpha: Math.random() * .5 + .5
2045
+ }));
2046
+ }, [r]), n(() => {
2047
+ let n = i.current;
2048
+ if (!n) return;
2049
+ let r = window.devicePixelRatio || 1;
2050
+ n.width = e * r, n.height = e * r;
2051
+ let o = n.getContext("2d");
2052
+ if (!o) return;
2053
+ o.setTransform(r, 0, 0, r, 0, 0);
2054
+ let l = e / 2, u = e / 2, d = e / 2 - 10, f = document.hidden, p = v((e) => {
2055
+ f = e;
2056
+ }), m = () => {
2057
+ if (c.current = requestAnimationFrame(m), f) return;
2058
+ a.current += .03, o.fillStyle = "rgb(15 23 42 / 25%)", o.fillRect(0, 0, e, e);
2059
+ for (let e = 1; e <= 4; e++) o.beginPath(), o.arc(l, u, d / 4 * e, 0, Math.PI * 2), o.strokeStyle = `${t}33`, o.lineWidth = 1, o.stroke();
2060
+ o.beginPath(), o.moveTo(l, u - d), o.lineTo(l, u + d), o.moveTo(l - d, u), o.lineTo(l + d, u), o.strokeStyle = `${t}44`, o.stroke();
2061
+ let n = a.current, r = o.createConicGradient(n - .5, l, u);
2062
+ r.addColorStop(0, "transparent"), r.addColorStop(.15, `${t}66`), r.addColorStop(.3, "transparent"), o.beginPath(), o.moveTo(l, u), o.arc(l, u, d, n - .5, n), o.closePath(), o.fillStyle = r, o.fill(), o.beginPath(), o.moveTo(l, u), o.lineTo(l + Math.cos(n) * d, u + Math.sin(n) * d), o.strokeStyle = t, o.lineWidth = 2, o.stroke(), s.current.forEach((e) => {
2063
+ let r = e.angle, i = l + Math.cos(r) * d * e.dist, a = u + Math.sin(r) * d * e.dist;
2064
+ Math.abs((n - r + Math.PI) % (Math.PI * 2) - Math.PI) < .3 ? e.alpha = Math.min(1, e.alpha + .05) : e.alpha = Math.max(.2, e.alpha - .01), o.beginPath(), o.arc(i, a, 4, 0, Math.PI * 2), o.fillStyle = t, o.globalAlpha = e.alpha, o.fill(), o.globalAlpha = 1;
2065
+ }), o.beginPath(), o.arc(l, u, d, 0, Math.PI * 2), o.strokeStyle = t, o.lineWidth = 2, o.stroke();
2066
+ };
2067
+ return m(), () => {
2068
+ cancelAnimationFrame(c.current), p();
2069
+ };
2070
+ }, [
2071
+ r,
2072
+ t,
2073
+ e
2074
+ ]), /* @__PURE__ */ l("div", {
2075
+ className: ot.radarScan,
2076
+ style: {
2077
+ width: e,
2078
+ height: e
2079
+ },
2080
+ children: /* @__PURE__ */ l("canvas", {
2081
+ ref: i,
2082
+ className: ot.canvas,
2083
+ style: {
2084
+ width: e,
2085
+ height: e
2086
+ }
2087
+ })
2088
+ });
2089
+ }, V = {
2090
+ redPacketRain: "cos-redPacketRain-eJ7FW",
2091
+ canvas: "cos-canvas-direH",
2092
+ hud: "cos-hud-InqMq",
2093
+ end: "cos-end-u0J7o",
2094
+ hint: "cos-hint-sO6ld"
2095
+ }, ct = ({ duration: e = 1e4, onGrab: r }) => {
2096
+ let i = o(null), a = o([]), c = o(0), d = o(0), f = o(0), [p, m] = s(0), [h, g] = s(!0), _ = o(!0);
2097
+ n(() => {
2098
+ _.current = h;
2099
+ }, [h]);
2100
+ let y = t(() => {
2101
+ a.current.push({
2102
+ id: d.current++,
2103
+ x: Math.random() * 350 + 25,
2104
+ y: -60,
2105
+ speed: Math.random() * 2 + 2,
2106
+ rotation: (Math.random() - .5) * .1,
2107
+ amount: [
2108
+ 1,
2109
+ 2,
2110
+ 5,
2111
+ 8,
2112
+ 10,
2113
+ 18,
2114
+ 66,
2115
+ 88
2116
+ ][Math.floor(Math.random() * 8)],
2117
+ grabbed: !1
2118
+ });
2119
+ }, []);
2120
+ return n(() => {
2121
+ let t = i.current;
2122
+ if (!t) return;
2123
+ let n = window.devicePixelRatio || 1;
2124
+ t.width = 400 * n, t.height = 500 * n;
2125
+ let r = t.getContext("2d");
2126
+ if (!r) return;
2127
+ r.setTransform(n, 0, 0, n, 0, 0);
2128
+ let o = document.hidden, s = v((e) => {
2129
+ o = e;
2130
+ }), l = window.setTimeout(() => {
2131
+ _.current = !1, g(!1);
2132
+ }, e), u = () => {
2133
+ c.current = requestAnimationFrame(u), !o && (f.current++, _.current && f.current % 20 == 0 && y(), r.fillStyle = "rgb(15 23 42 / 20%)", r.fillRect(0, 0, 400, 500), a.current = a.current.filter((e) => e.grabbed ? !1 : (e.y += e.speed, e.x += Math.sin(e.y * .02) * .5, r.save(), r.translate(e.x, e.y), r.rotate(e.rotation), r.fillStyle = "#dc2626", r.beginPath(), r.roundRect(-22, -28, 44, 56, 6), r.fill(), r.fillStyle = "#fbbf24", r.beginPath(), r.arc(0, -10, 8, 0, Math.PI * 2), r.fill(), r.fillStyle = "#fde68a", r.font = "bold 12px system-ui", r.textAlign = "center", r.fillText(`¥${e.amount}`, 0, 12), r.restore(), e.y < 560)));
2134
+ };
2135
+ return u(), () => {
2136
+ cancelAnimationFrame(c.current), clearTimeout(l), s();
2137
+ };
2138
+ }, [e, y]), /* @__PURE__ */ u("div", {
2139
+ className: V.redPacketRain,
2140
+ children: [
2141
+ /* @__PURE__ */ l("canvas", {
2142
+ ref: i,
2143
+ className: V.canvas,
2144
+ style: {
2145
+ width: 400,
2146
+ height: 500
2147
+ },
2148
+ onClick: (e) => {
2149
+ let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, i = e.clientY - t.top, o = !1;
2150
+ a.current = a.current.map((e) => e.grabbed || o ? e : Math.abs(n - e.x) < 30 && Math.abs(i - e.y) < 35 ? (o = !0, m((t) => t + e.amount), r?.(e.amount), {
2151
+ ...e,
2152
+ grabbed: !0
2153
+ }) : e);
2154
+ }
2155
+ }),
2156
+ /* @__PURE__ */ u("div", {
2157
+ className: V.hud,
2158
+ children: [/* @__PURE__ */ u("span", { children: ["已抢: ¥", p] }), !h && /* @__PURE__ */ l("span", {
2159
+ className: V.end,
2160
+ children: "红包雨结束"
2161
+ })]
2162
+ }),
2163
+ /* @__PURE__ */ l("p", {
2164
+ className: V.hint,
2165
+ children: "点击红包抢夺"
2166
+ })
2167
+ ]
2168
+ });
2169
+ }, H = {
692
2170
  returnCityContainer: "cos-returnCityContainer-6XTxj",
693
2171
  star: "cos-star-a59Dx",
694
2172
  glassWrap: "cos-glassWrap-golMO",
695
2173
  rotate: "cos-rotate-7X9Jj",
696
2174
  glassItem: "cos-glassItem-OwlFI"
697
- }, K = ({ starCount: e, glassCount: t = 8, glassRadius: r = 150 }) => {
698
- let i = a(null), o = a(null);
2175
+ }, lt = ({ starCount: e, glassCount: t = 8, glassRadius: r = 150 }) => {
2176
+ let i = o(null), a = o(null);
699
2177
  return n(() => {
700
- let n = i.current, a = o.current;
701
- if (!n || !a) return;
2178
+ let n = i.current, o = a.current;
2179
+ if (!n || !o) return;
702
2180
  let s = [], c = [], l = [], { width: u, height: d } = n.getBoundingClientRect(), f = e ?? Math.max(20, Math.floor(u / 20));
703
2181
  for (let e = 0; e < f; e++) {
704
2182
  let e = window.setTimeout(() => {
705
2183
  let e = document.createElement("div");
706
- e.className = G.star, e.style.top = `${Math.random() * d}px`, e.style.left = `${Math.random() * u}px`, n.append(e), c.push(e);
2184
+ e.className = H.star, e.style.top = `${Math.random() * d}px`, e.style.left = `${Math.random() * u}px`, n.append(e), c.push(e);
707
2185
  }, Math.random() * 2e3);
708
2186
  s.push(e);
709
2187
  }
710
2188
  for (let e = 0; e < t; e++) {
711
2189
  let n = document.createElement("div");
712
- n.className = G.glassItem, n.style.transform = `rotateY(${360 / t * e}deg) translateZ(${r}px)`, a.appendChild(n), l.push(n);
2190
+ n.className = H.glassItem, n.style.transform = `rotateY(${360 / t * e}deg) translateZ(${r}px)`, o.appendChild(n), l.push(n);
713
2191
  let i = window.setTimeout(() => {
714
2192
  n.style.top = "0px", n.style.opacity = "1";
715
2193
  }, e * 300);
@@ -722,15 +2200,474 @@ var M = {
722
2200
  e,
723
2201
  t,
724
2202
  r
725
- ]), /* @__PURE__ */ c("div", {
2203
+ ]), /* @__PURE__ */ l("div", {
726
2204
  ref: i,
727
- className: G.returnCityContainer,
728
- children: /* @__PURE__ */ c("div", {
729
- ref: o,
730
- className: G.glassWrap
2205
+ className: H.returnCityContainer,
2206
+ children: /* @__PURE__ */ l("div", {
2207
+ ref: a,
2208
+ className: H.glassWrap
2209
+ })
2210
+ });
2211
+ }, U = {
2212
+ speedometer: "cos-speedometer-INc7F",
2213
+ svg: "cos-svg-HG-lE",
2214
+ track: "cos-track-5-922",
2215
+ valueArc: "cos-valueArc-eJn3E",
2216
+ tick: "cos-tick-vaiJh",
2217
+ needle: "cos-needle-PwRAD",
2218
+ hub: "cos-hub-4WaHw",
2219
+ valueText: "cos-valueText--q4Xi",
2220
+ label: "cos-label-hOPy1"
2221
+ }, W = (e, t, n, r) => {
2222
+ let i = (r - 90) * Math.PI / 180;
2223
+ return {
2224
+ x: e + n * Math.cos(i),
2225
+ y: t + n * Math.sin(i)
2226
+ };
2227
+ }, ut = ({ value: e = 0, max: t = 100, label: n = "SPEED", color: r = "#f97316" }) => {
2228
+ let i = -120 + y(t > 0 ? e / t : 0, 0, 1) * 240, o = a(() => {
2229
+ let e = W(100, 100, 72, -120), t = W(100, 100, 72, 120);
2230
+ return `M ${e.x} ${e.y} A 72 72 0 1 1 ${t.x} ${t.y}`;
2231
+ }, []), s = a(() => {
2232
+ let e = W(100, 100, 72, -120), t = W(100, 100, 72, i), n = +(i - -120 > 180);
2233
+ return `M ${e.x} ${e.y} A 72 72 0 ${n} 1 ${t.x} ${t.y}`;
2234
+ }, [i]), c = W(100, 100, 58, i);
2235
+ return /* @__PURE__ */ u("div", {
2236
+ className: U.speedometer,
2237
+ style: { "--gauge-color": r },
2238
+ children: [/* @__PURE__ */ u("svg", {
2239
+ viewBox: "0 0 200 130",
2240
+ className: U.svg,
2241
+ children: [
2242
+ /* @__PURE__ */ l("path", {
2243
+ d: o,
2244
+ className: U.track,
2245
+ fill: "none",
2246
+ strokeWidth: "12",
2247
+ strokeLinecap: "round"
2248
+ }),
2249
+ /* @__PURE__ */ l("path", {
2250
+ d: s,
2251
+ className: U.valueArc,
2252
+ fill: "none",
2253
+ strokeWidth: "12",
2254
+ strokeLinecap: "round"
2255
+ }),
2256
+ [
2257
+ -120,
2258
+ -60,
2259
+ 0,
2260
+ 60,
2261
+ 120
2262
+ ].map((e) => {
2263
+ let t = W(100, 100, 58, e), n = W(100, 100, 66, e);
2264
+ return /* @__PURE__ */ l("line", {
2265
+ x1: t.x,
2266
+ y1: t.y,
2267
+ x2: n.x,
2268
+ y2: n.y,
2269
+ className: U.tick
2270
+ }, e);
2271
+ }),
2272
+ /* @__PURE__ */ l("line", {
2273
+ x1: "100",
2274
+ y1: "100",
2275
+ x2: c.x,
2276
+ y2: c.y,
2277
+ className: U.needle
2278
+ }),
2279
+ /* @__PURE__ */ l("circle", {
2280
+ cx: "100",
2281
+ cy: "100",
2282
+ r: "6",
2283
+ className: U.hub
2284
+ }),
2285
+ /* @__PURE__ */ l("text", {
2286
+ x: "100",
2287
+ y: "118",
2288
+ className: U.valueText,
2289
+ children: Math.round(e)
2290
+ })
2291
+ ]
2292
+ }), /* @__PURE__ */ l("span", {
2293
+ className: U.label,
2294
+ children: n
2295
+ })]
2296
+ });
2297
+ }, G = {
2298
+ timelinePulse: "cos-timelinePulse-kcBM6",
2299
+ axis: "cos-axis-9DWis",
2300
+ track: "cos-track-jG-HV",
2301
+ progress: "cos-progress-gf7v1",
2302
+ steps: "cos-steps-Z-40O",
2303
+ step: "cos-step-UO2Ux",
2304
+ dot: "cos-dot-HJEVy",
2305
+ pulse: "cos-pulse-N6FD1",
2306
+ name: "cos-name-7zefJ"
2307
+ }, dt = ({ steps: e = [
2308
+ "Start",
2309
+ "Process",
2310
+ "Review",
2311
+ "Done"
2312
+ ], current: t = 0, color: n = "#22d3ee" }) => {
2313
+ let r = y(t, 0, Math.max(0, e.length - 1)), i = e.length > 1 ? r / (e.length - 1) : 0;
2314
+ return /* @__PURE__ */ l("div", {
2315
+ className: G.timelinePulse,
2316
+ style: {
2317
+ "--pulse-color": n,
2318
+ "--step-count": e.length,
2319
+ "--progress-ratio": i
2320
+ },
2321
+ children: /* @__PURE__ */ u("div", {
2322
+ className: G.axis,
2323
+ children: [
2324
+ /* @__PURE__ */ l("div", { className: G.track }),
2325
+ /* @__PURE__ */ l("div", { className: G.progress }),
2326
+ /* @__PURE__ */ l("ul", {
2327
+ className: G.steps,
2328
+ children: e.map((e, t) => {
2329
+ let n = t < r ? "done" : t === r ? "current" : "pending";
2330
+ return /* @__PURE__ */ u("li", {
2331
+ className: G.step,
2332
+ "data-state": n,
2333
+ children: [/* @__PURE__ */ l("span", { className: G.dot }), /* @__PURE__ */ l("span", {
2334
+ className: G.name,
2335
+ children: e
2336
+ })]
2337
+ }, e + t);
2338
+ })
2339
+ })
2340
+ ]
2341
+ })
2342
+ });
2343
+ }, K = {
2344
+ rippleWater: "cos-rippleWater-wsinI",
2345
+ canvas: "cos-canvas-XOdSF",
2346
+ hint: "cos-hint-0JH5D"
2347
+ }, ft = ({ width: e = 800, height: r = 500, color: i = "#38bdf8" }) => {
2348
+ let a = o(null), s = o([]), c = o(0), d = t((t, n) => {
2349
+ let i = a.current;
2350
+ if (!i) return;
2351
+ let o = i.getBoundingClientRect(), c = t - o.left, l = n - o.top, u = Math.max(e, r) * .45;
2352
+ s.current.push({
2353
+ x: c,
2354
+ y: l,
2355
+ radius: 0,
2356
+ maxRadius: u,
2357
+ alpha: .7
2358
+ });
2359
+ }, [r, e]);
2360
+ return n(() => {
2361
+ let e = a.current;
2362
+ if (!e) return;
2363
+ let t = (e) => d(e.clientX, e.clientY), n = (e) => {
2364
+ let t = e.touches[0];
2365
+ t && d(t.clientX, t.clientY);
2366
+ };
2367
+ return e.addEventListener("click", t), e.addEventListener("touchstart", n, { passive: !0 }), () => {
2368
+ e.removeEventListener("click", t), e.removeEventListener("touchstart", n);
2369
+ };
2370
+ }, [d]), n(() => {
2371
+ let t = a.current;
2372
+ if (!t) return;
2373
+ let n = window.devicePixelRatio || 1;
2374
+ t.width = e * n, t.height = r * n;
2375
+ let o = t.getContext("2d");
2376
+ if (!o) return;
2377
+ o.setTransform(n, 0, 0, n, 0, 0);
2378
+ let l = document.hidden, u = v((e) => {
2379
+ l = e;
2380
+ }), d = () => {
2381
+ if (c.current = requestAnimationFrame(d), l) return;
2382
+ o.fillStyle = "#0c1929", o.fillRect(0, 0, e, r);
2383
+ let t = o.createLinearGradient(0, 0, 0, r);
2384
+ t.addColorStop(0, "#0f2744"), t.addColorStop(1, "#061018"), o.fillStyle = t, o.fillRect(0, 0, e, r), s.current = s.current.filter((e) => (e.radius += 2.5, e.alpha -= .012, e.alpha <= 0 ? !1 : (o.beginPath(), o.arc(e.x, e.y, e.radius, 0, Math.PI * 2), o.strokeStyle = i, o.globalAlpha = e.alpha * (1 - e.radius / e.maxRadius), o.lineWidth = 2, o.stroke(), e.radius > 8 && (o.beginPath(), o.arc(e.x, e.y, e.radius * .6, 0, Math.PI * 2), o.strokeStyle = i, o.globalAlpha = e.alpha * .4, o.lineWidth = 1, o.stroke()), o.globalAlpha = 1, !0)));
2385
+ };
2386
+ return d(), () => {
2387
+ cancelAnimationFrame(c.current), u();
2388
+ };
2389
+ }, [
2390
+ i,
2391
+ r,
2392
+ e
2393
+ ]), /* @__PURE__ */ u("div", {
2394
+ className: K.rippleWater,
2395
+ style: {
2396
+ width: e,
2397
+ height: r
2398
+ },
2399
+ children: [/* @__PURE__ */ l("canvas", {
2400
+ ref: a,
2401
+ className: K.canvas,
2402
+ style: {
2403
+ width: e,
2404
+ height: r
2405
+ }
2406
+ }), /* @__PURE__ */ l("span", {
2407
+ className: K.hint,
2408
+ children: "点击水面产生涟漪"
2409
+ })]
2410
+ });
2411
+ }, pt = {
2412
+ scrambleText: "cos-scrambleText-hN4Wm",
2413
+ text: "cos-text-frsHs",
2414
+ cursor: "cos-cursor-3zQOy",
2415
+ blink: "cos-blink-OcKXu"
2416
+ }, mt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*", ht = ({ text: e = "DECRYPTED", duration: t = 2e3, charset: r = mt }) => {
2417
+ let [i, a] = s(""), c = o(0), d = o(0);
2418
+ return n(() => {
2419
+ let n = r.length > 0 ? r : mt, i = e;
2420
+ d.current = performance.now();
2421
+ let o = (e) => {
2422
+ let r = e - d.current, s = Math.min(r / t, 1), l = Math.floor(s * i.length);
2423
+ a(i.split("").map((e, t) => e === " " ? " " : t < l ? e : n[Math.floor(Math.random() * n.length)]).join("")), s < 1 ? c.current = requestAnimationFrame(o) : a(i);
2424
+ };
2425
+ return c.current = requestAnimationFrame(o), () => cancelAnimationFrame(c.current);
2426
+ }, [
2427
+ e,
2428
+ t,
2429
+ r
2430
+ ]), /* @__PURE__ */ l("div", {
2431
+ className: pt.scrambleText,
2432
+ children: /* @__PURE__ */ u("p", {
2433
+ className: pt.text,
2434
+ children: [i, /* @__PURE__ */ l("span", { className: pt.cursor })]
731
2435
  })
732
2436
  });
733
2437
  }, q = {
2438
+ scratchCard: "cos-scratchCard-McIEK",
2439
+ prize: "cos-prize-X0z5V",
2440
+ canvas: "cos-canvas-JqIlr",
2441
+ hidden: "cos-hidden-Lsfbt"
2442
+ }, gt = ({ coverColor: e = "#94a3b8", prize: r = "🎉 恭喜中奖!", onReveal: i, width: a = 300, height: c = 180 }) => {
2443
+ let d = o(null), f = o(!1), p = o(!1), [m, h] = s(!1), g = t((t) => {
2444
+ t.globalCompositeOperation = "source-over", t.fillStyle = e, t.fillRect(0, 0, a, c), t.fillStyle = "rgb(255 255 255 / 30%)", t.font = "bold 16px system-ui, sans-serif", t.textAlign = "center", t.fillText("刮开涂层", a / 2, c / 2);
2445
+ }, [
2446
+ e,
2447
+ c,
2448
+ a
2449
+ ]), _ = t((e) => {
2450
+ if (p.current) return;
2451
+ let t = e.getContext("2d");
2452
+ if (!t) return;
2453
+ let n = t.getImageData(0, 0, e.width, e.height), r = 0;
2454
+ for (let e = 3; e < n.data.length; e += 4) n.data[e] < 128 && r++;
2455
+ r / (e.width * e.height) > .45 && (p.current = !0, h(!0), i?.());
2456
+ }, [i]);
2457
+ n(() => {
2458
+ let e = d.current;
2459
+ if (!e) return;
2460
+ let t = window.devicePixelRatio || 1;
2461
+ e.width = a * t, e.height = c * t;
2462
+ let n = e.getContext("2d");
2463
+ n && (n.setTransform(t, 0, 0, t, 0, 0), g(n));
2464
+ }, [
2465
+ g,
2466
+ c,
2467
+ a
2468
+ ]);
2469
+ let v = (e, t) => {
2470
+ let n = d.current;
2471
+ if (!n || p.current) return;
2472
+ let r = n.getContext("2d");
2473
+ r && (r.globalCompositeOperation = "destination-out", r.beginPath(), r.arc(e, t, 20, 0, Math.PI * 2), r.fill(), _(n));
2474
+ }, y = (e) => {
2475
+ let t = d.current;
2476
+ if (!t) return null;
2477
+ let n = t.getBoundingClientRect();
2478
+ if ("touches" in e) {
2479
+ let t = e.touches[0];
2480
+ return {
2481
+ x: t.clientX - n.left,
2482
+ y: t.clientY - n.top
2483
+ };
2484
+ }
2485
+ return {
2486
+ x: e.clientX - n.left,
2487
+ y: e.clientY - n.top
2488
+ };
2489
+ }, b = (e) => {
2490
+ f.current = !0;
2491
+ let t = y(e);
2492
+ t && v(t.x, t.y);
2493
+ }, x = (e) => {
2494
+ if (!f.current) return;
2495
+ let t = y(e);
2496
+ t && v(t.x, t.y);
2497
+ }, S = () => {
2498
+ f.current = !1;
2499
+ };
2500
+ return /* @__PURE__ */ u("div", {
2501
+ className: q.scratchCard,
2502
+ style: {
2503
+ width: a,
2504
+ height: c
2505
+ },
2506
+ children: [/* @__PURE__ */ l("div", {
2507
+ className: q.prize,
2508
+ children: r
2509
+ }), /* @__PURE__ */ l("canvas", {
2510
+ ref: d,
2511
+ className: `${q.canvas} ${m ? q.hidden : ""}`,
2512
+ style: {
2513
+ width: a,
2514
+ height: c
2515
+ },
2516
+ onMouseDown: b,
2517
+ onMouseMove: x,
2518
+ onMouseUp: S,
2519
+ onMouseLeave: S,
2520
+ onTouchStart: b,
2521
+ onTouchMove: x,
2522
+ onTouchEnd: S
2523
+ })]
2524
+ });
2525
+ }, J = {
2526
+ slotMachine: "cos-slotMachine-P6FyZ",
2527
+ machine: "cos-machine-B066r",
2528
+ reel: "cos-reel-eEpJ3",
2529
+ strip: "cos-strip-L5Z-a",
2530
+ item: "cos-item-WYJ6q",
2531
+ mask: "cos-mask-jdrj3",
2532
+ spinBtn: "cos-spinBtn-DvDE7",
2533
+ result: "cos-result-dLN5b"
2534
+ }, _t = [
2535
+ "🍒",
2536
+ "🍋",
2537
+ "🍊",
2538
+ "🍇",
2539
+ "⭐",
2540
+ "7️⃣"
2541
+ ], vt = (e) => 1 - (1 - e) ** 3, yt = ({ symbols: e = _t, onSpinEnd: r }) => {
2542
+ let [i, a] = s(!1), [c, d] = s([
2543
+ 0,
2544
+ 0,
2545
+ 0
2546
+ ]), [f, p] = s([]), m = o(0), h = o(r), g = o(null);
2547
+ n(() => {
2548
+ h.current = r;
2549
+ }, [r]);
2550
+ let _ = t(() => {
2551
+ let t = [];
2552
+ for (let n = 0; n < 20; n++) t.push(...e);
2553
+ return t;
2554
+ }, [e])();
2555
+ return n(() => () => {
2556
+ g.current && (g.current.cancelled = !0), cancelAnimationFrame(m.current);
2557
+ }, []), /* @__PURE__ */ u("div", {
2558
+ className: J.slotMachine,
2559
+ children: [
2560
+ /* @__PURE__ */ l("div", {
2561
+ className: J.machine,
2562
+ children: [
2563
+ 0,
2564
+ 1,
2565
+ 2
2566
+ ].map((e) => /* @__PURE__ */ u("div", {
2567
+ className: J.reel,
2568
+ style: { height: 240 },
2569
+ children: [/* @__PURE__ */ l("div", {
2570
+ className: J.strip,
2571
+ style: { transform: `translateY(${c[e]}px)` },
2572
+ children: _.map((e, t) => /* @__PURE__ */ l("div", {
2573
+ className: J.item,
2574
+ style: { height: 80 },
2575
+ children: e
2576
+ }, t))
2577
+ }), /* @__PURE__ */ l("div", { className: J.mask })]
2578
+ }, e))
2579
+ }),
2580
+ /* @__PURE__ */ l("button", {
2581
+ type: "button",
2582
+ className: J.spinBtn,
2583
+ onClick: () => {
2584
+ if (i) return;
2585
+ a(!0), p([]);
2586
+ let t = [
2587
+ 0,
2588
+ 1,
2589
+ 2
2590
+ ].map(() => Math.floor(Math.random() * e.length)), n = t.map((t) => -(t - 1 + e.length * 10) * 80), r = [...c], o = 2e3, s = [
2591
+ 0,
2592
+ 300,
2593
+ 600
2594
+ ], l = performance.now(), u = { cancelled: !1 };
2595
+ g.current = u;
2596
+ let f = (i) => {
2597
+ if (!u.cancelled) {
2598
+ if (d(r.map((e, t) => {
2599
+ let r = i - l - s[t];
2600
+ if (r < 0) return e;
2601
+ let a = vt(Math.min(r / o, 1));
2602
+ return e + (n[t] - e) * a;
2603
+ })), !s.every((e) => i - l - e >= o)) m.current = requestAnimationFrame(f);
2604
+ else if (!u.cancelled) {
2605
+ let n = t.map((t) => e[t]);
2606
+ p(n), a(!1), h.current?.(n);
2607
+ }
2608
+ }
2609
+ };
2610
+ m.current = requestAnimationFrame(f);
2611
+ },
2612
+ disabled: i,
2613
+ children: i ? "旋转中..." : "开始"
2614
+ }),
2615
+ f.length > 0 && !i && /* @__PURE__ */ l("p", {
2616
+ className: J.result,
2617
+ children: f[0] === f[1] && f[1] === f[2] ? "🎰 大奖!" : `结果: ${f.join(" ")}`
2618
+ })
2619
+ ]
2620
+ });
2621
+ }, Y = {
2622
+ splitReveal: "cos-splitReveal-6W8-6",
2623
+ text: "cos-text-miTsj",
2624
+ char: "cos-char-0gPJV",
2625
+ reveal: "cos-reveal-YGzz-",
2626
+ fromTop: "cos-fromTop-YXHUa",
2627
+ fromBottom: "cos-fromBottom-24D6g",
2628
+ fromLeft: "cos-fromLeft-OMiPY",
2629
+ fromRight: "cos-fromRight-EcMOR"
2630
+ }, bt = [
2631
+ "fromTop",
2632
+ "fromBottom",
2633
+ "fromLeft",
2634
+ "fromRight"
2635
+ ], xt = ({ text: e = "REVEAL", delay: t = 80, color: n = "#f8fafc" }) => /* @__PURE__ */ l("div", {
2636
+ className: Y.splitReveal,
2637
+ children: /* @__PURE__ */ l("h1", {
2638
+ className: Y.text,
2639
+ style: { "--reveal-color": n },
2640
+ children: e.split("").map((e, n) => /* @__PURE__ */ l("span", {
2641
+ className: `${Y.char} ${Y[bt[n % bt.length]]}`,
2642
+ style: { animationDelay: `${n * t}ms` },
2643
+ children: e === " " ? "\xA0" : e
2644
+ }, `${e}-${n}`))
2645
+ })
2646
+ }), St = {
2647
+ spotlight: "cos-spotlight-OddY1",
2648
+ content: "cos-content-5I1Wy",
2649
+ overlay: "cos-overlay-F6CJ5"
2650
+ }, Ct = ({ children: e, radius: n = 120, dimColor: r = "rgba(0, 0, 0, 0.85)" }) => {
2651
+ let i = o(null), a = t((e) => {
2652
+ let t = i.current;
2653
+ if (!t) return;
2654
+ let n = t.getBoundingClientRect(), r = e.clientX - n.left, a = e.clientY - n.top;
2655
+ t.style.setProperty("--spot-x", `${r}px`), t.style.setProperty("--spot-y", `${a}px`);
2656
+ }, []);
2657
+ return /* @__PURE__ */ u("div", {
2658
+ ref: i,
2659
+ className: St.spotlight,
2660
+ style: {
2661
+ "--spot-radius": `${n}px`,
2662
+ "--dim-color": r
2663
+ },
2664
+ onMouseMove: a,
2665
+ children: [/* @__PURE__ */ l("div", {
2666
+ className: St.content,
2667
+ children: e
2668
+ }), /* @__PURE__ */ l("div", { className: St.overlay })]
2669
+ });
2670
+ }, X = {
734
2671
  turntable: "cos-turntable-dkc32",
735
2672
  wheelWrap: "cos-wheelWrap-n7lhc",
736
2673
  canvas: "cos-canvas-A1-4x",
@@ -738,7 +2675,7 @@ var M = {
738
2675
  spinBtn: "cos-spinBtn-l9JIC",
739
2676
  result: "cos-result-H8q2c",
740
2677
  "fade-in": "cos-fade-in-U9bUC"
741
- }, J = [
2678
+ }, wt = [
742
2679
  "#FF6B6B",
743
2680
  "#4ECDC4",
744
2681
  "#FFE66D",
@@ -747,22 +2684,26 @@ var M = {
747
2684
  "#F472B6",
748
2685
  "#34D399",
749
2686
  "#FB923C"
750
- ], Y = [
2687
+ ], Tt = [
751
2688
  { label: "一等奖" },
752
2689
  { label: "二等奖" },
753
2690
  { label: "三等奖" },
754
2691
  { label: "谢谢参与" },
755
2692
  { label: "优惠券" },
756
2693
  { label: "再来一次" }
757
- ], X = (e) => 1 - (1 - e) ** 3, re = ({ prizes: e = Y, size: r = 360, spinDuration: i = 4e3, spinRounds: s = 5, buttonText: u = "开始抽奖", onSpinEnd: d }) => {
758
- let f = a(null), p = a(0), m = a(0), h = a(1), [g, _] = o(!1), [v, y] = o(null), b = r + 48, x = (e, t) => t.color ?? J[e % J.length], S = t((t) => {
2694
+ ], Et = (e) => 1 - (1 - e) ** 3, Dt = ({ prizes: e = Tt, size: r = 360, spinDuration: i = 4e3, spinRounds: a = 5, buttonText: c = "开始抽奖", onSpinEnd: d }) => {
2695
+ let f = o(null), p = o(0), m = o(0), h = o(1), [g, _] = s(!1), [v, y] = s(null), b = o(d), x = o(null);
2696
+ n(() => {
2697
+ b.current = d;
2698
+ }, [d]);
2699
+ let S = r + 48, C = (e, t) => t.color ?? wt[e % wt.length], w = t((t) => {
759
2700
  let n = f.current;
760
2701
  if (!n) return;
761
2702
  let i = n.getContext("2d");
762
2703
  if (!i) return;
763
- let a = b / 2, o = r / 2, s = Math.PI * 2 / e.length;
764
- i.clearRect(0, 0, b, b), i.save(), i.translate(a, a), i.rotate(t), e.forEach((e, t) => {
765
- let n = t * s - Math.PI / 2, a = n + s, c = x(t, e);
2704
+ let a = S / 2, o = r / 2, s = Math.PI * 2 / e.length;
2705
+ i.clearRect(0, 0, S, S), i.save(), i.translate(a, a), i.rotate(t), e.forEach((e, t) => {
2706
+ let n = t * s - Math.PI / 2, a = n + s, c = C(t, e);
766
2707
  i.beginPath(), i.moveTo(0, 0), i.arc(0, 0, o, n, a), i.closePath(), i.fillStyle = c, i.fill(), i.strokeStyle = "rgb(255 255 255 / 35%)", i.lineWidth = 2, i.stroke(), i.save(), i.rotate(n + s / 2), i.textAlign = "right", i.fillStyle = "#fff", i.font = `bold ${Math.max(12, Math.floor(r / 22))}px system-ui, sans-serif`, i.shadowColor = "rgb(0 0 0 / 30%)", i.shadowBlur = 4, i.fillText(e.label, o - 18, 6), i.restore();
767
2708
  }), i.beginPath(), i.arc(0, 0, o, 0, Math.PI * 2), i.strokeStyle = "#fbbf24", i.lineWidth = 6, i.stroke(), i.beginPath(), i.arc(0, 0, o - 4, 0, Math.PI * 2), i.strokeStyle = "#f59e0b", i.lineWidth = 2, i.stroke(), i.restore(), i.save(), i.translate(a, a);
768
2709
  for (let e = 0; e < 12; e++) {
@@ -771,7 +2712,7 @@ var M = {
771
2712
  }
772
2713
  i.restore();
773
2714
  }, [
774
- b,
2715
+ S,
775
2716
  e,
776
2717
  r
777
2718
  ]);
@@ -779,61 +2720,64 @@ var M = {
779
2720
  let e = f.current;
780
2721
  if (!e) return;
781
2722
  let t = window.devicePixelRatio || 1;
782
- h.current = t, e.width = b * t, e.height = b * t;
2723
+ h.current = t, e.width = S * t, e.height = S * t;
783
2724
  let n = e.getContext("2d");
784
- n && n.setTransform(t, 0, 0, t, 0, 0), S(p.current);
785
- }, [b, S]), n(() => () => {
786
- m.current && cancelAnimationFrame(m.current);
2725
+ n && n.setTransform(t, 0, 0, t, 0, 0), w(p.current);
2726
+ }, [S, w]), n(() => () => {
2727
+ x.current && (x.current.cancelled = !0), m.current && cancelAnimationFrame(m.current);
787
2728
  }, []);
788
- let C = (t) => {
2729
+ let ee = (t) => {
789
2730
  let n = 360 / e.length, r = (180 / Math.PI * t % 360 + 360) % 360;
790
2731
  return Math.floor((360 - r + n / 2) % 360 / n) % e.length;
791
2732
  };
792
- return /* @__PURE__ */ l("div", {
793
- className: q.turntable,
2733
+ return /* @__PURE__ */ u("div", {
2734
+ className: X.turntable,
794
2735
  style: {
795
- width: b,
796
- height: b + 80
2736
+ width: S,
2737
+ height: S + 80
797
2738
  },
798
- children: [/* @__PURE__ */ l("div", {
799
- className: q.wheelWrap,
2739
+ children: [/* @__PURE__ */ u("div", {
2740
+ className: X.wheelWrap,
800
2741
  style: {
801
- width: b,
802
- height: b
2742
+ width: S,
2743
+ height: S
803
2744
  },
804
2745
  children: [
805
- /* @__PURE__ */ c("div", { className: q.pointer }),
806
- /* @__PURE__ */ c("canvas", {
2746
+ /* @__PURE__ */ l("div", { className: X.pointer }),
2747
+ /* @__PURE__ */ l("canvas", {
807
2748
  ref: f,
808
- className: q.canvas,
2749
+ className: X.canvas,
809
2750
  style: {
810
- width: b,
811
- height: b
2751
+ width: S,
2752
+ height: S
812
2753
  }
813
2754
  }),
814
- /* @__PURE__ */ c("button", {
2755
+ /* @__PURE__ */ l("button", {
815
2756
  type: "button",
816
- className: q.spinBtn,
2757
+ className: X.spinBtn,
817
2758
  onClick: () => {
818
2759
  if (g || e.length === 0) return;
819
2760
  _(!0), y(null);
820
- let t = Math.PI * 2 / e.length, n = Math.floor(Math.random() * e.length) * t + t / 2, r = p.current, a = r + s * Math.PI * 2 + (Math.PI * 2 - n) - r % (Math.PI * 2), o = r, c = performance.now(), l = (t) => {
821
- let n = t - c, r = Math.min(n / i, 1), s = X(r), u = o + (a - o) * s;
822
- if (p.current = u, S(u), r < 1) m.current = requestAnimationFrame(l);
2761
+ let t = Math.PI * 2 / e.length, n = Math.floor(Math.random() * e.length) * t + t / 2, r = p.current, o = r + a * Math.PI * 2 + (Math.PI * 2 - n) - r % (Math.PI * 2), s = r, c = performance.now(), l = { cancelled: !1 };
2762
+ x.current = l;
2763
+ let u = (t) => {
2764
+ if (l.cancelled) return;
2765
+ let n = t - c, r = Math.min(n / i, 1), a = Et(r), d = s + (o - s) * a;
2766
+ if (p.current = d, w(d), r < 1) m.current = requestAnimationFrame(u);
823
2767
  else {
824
- let t = C(u), n = e[t];
825
- p.current = u, _(!1), y(n), d?.(n, t);
2768
+ let t = ee(d), n = e[t];
2769
+ p.current = d, _(!1), y(n), b.current?.(n, t);
826
2770
  }
827
2771
  };
828
- m.current = requestAnimationFrame(l);
2772
+ m.current = requestAnimationFrame(u);
829
2773
  },
830
2774
  disabled: g,
831
- children: g ? "抽奖中..." : u
2775
+ children: g ? "抽奖中..." : c
832
2776
  })
833
2777
  ]
834
- }), v && !g && /* @__PURE__ */ l("p", {
835
- className: q.result,
836
- children: ["恭喜获得:", /* @__PURE__ */ c("strong", { children: v.label })]
2778
+ }), v && !g && /* @__PURE__ */ u("p", {
2779
+ className: X.result,
2780
+ children: ["恭喜获得:", /* @__PURE__ */ l("strong", { children: v.label })]
837
2781
  })]
838
2782
  });
839
2783
  }, Z = {
@@ -844,51 +2788,51 @@ var M = {
844
2788
  prompt: "cos-prompt-Y4hVD",
845
2789
  cursor: "cos-cursor-m8hGi",
846
2790
  blink: "cos-blink-XykM7"
847
- }, Q = [
2791
+ }, Ot = [
848
2792
  "Hello, cos-design!",
849
2793
  "欢迎来到组件库 ✨",
850
2794
  "Build something fun 🚀"
851
- ], ie = ({ texts: e, speed: t, deleteSpeed: r, pause: i }) => {
852
- let [a, s] = o(""), [u, d] = o(0), [f, p] = o(!1);
2795
+ ], kt = ({ texts: e, speed: t, deleteSpeed: r, pause: i }) => {
2796
+ let [a, o] = s(""), [c, d] = s(0), [f, p] = s(!1);
853
2797
  return n(() => {
854
- let n = e[u % e.length], o;
855
- if (!f && a === n) o = setTimeout(() => p(!0), i);
856
- else if (f && a === "") o = setTimeout(() => {
2798
+ let n = e[c % e.length], s;
2799
+ if (!f && a === n) s = setTimeout(() => p(!0), i);
2800
+ else if (f && a === "") s = setTimeout(() => {
857
2801
  p(!1), d((t) => (t + 1) % e.length);
858
2802
  }, 0);
859
2803
  else {
860
2804
  let e = f ? n.slice(0, a.length - 1) : n.slice(0, a.length + 1);
861
- o = setTimeout(() => s(e), f ? r : t);
2805
+ s = setTimeout(() => o(e), f ? r : t);
862
2806
  }
863
- return () => clearTimeout(o);
2807
+ return () => clearTimeout(s);
864
2808
  }, [
865
2809
  a,
866
2810
  f,
867
- u,
2811
+ c,
868
2812
  e,
869
2813
  t,
870
2814
  r,
871
2815
  i
872
- ]), /* @__PURE__ */ c("div", {
2816
+ ]), /* @__PURE__ */ l("div", {
873
2817
  className: Z.typewriter,
874
- children: /* @__PURE__ */ l("div", {
2818
+ children: /* @__PURE__ */ u("div", {
875
2819
  className: Z.terminal,
876
- children: [/* @__PURE__ */ l("div", {
2820
+ children: [/* @__PURE__ */ u("div", {
877
2821
  className: Z.dots,
878
2822
  children: [
879
- /* @__PURE__ */ c("span", {}),
880
- /* @__PURE__ */ c("span", {}),
881
- /* @__PURE__ */ c("span", {})
2823
+ /* @__PURE__ */ l("span", {}),
2824
+ /* @__PURE__ */ l("span", {}),
2825
+ /* @__PURE__ */ l("span", {})
882
2826
  ]
883
- }), /* @__PURE__ */ l("p", {
2827
+ }), /* @__PURE__ */ u("p", {
884
2828
  className: Z.text,
885
2829
  children: [
886
- /* @__PURE__ */ c("span", {
2830
+ /* @__PURE__ */ l("span", {
887
2831
  className: Z.prompt,
888
2832
  children: ">"
889
2833
  }),
890
2834
  a,
891
- /* @__PURE__ */ c("span", {
2835
+ /* @__PURE__ */ l("span", {
892
2836
  className: Z.cursor,
893
2837
  children: "|"
894
2838
  })
@@ -896,39 +2840,59 @@ var M = {
896
2840
  })]
897
2841
  })
898
2842
  });
899
- }, ae = ({ texts: e = Q, speed: t = 100, deleteSpeed: n = 50, pause: r = 2e3 }) => {
900
- let i = e.length > 0 ? e : Q;
901
- return /* @__PURE__ */ c(ie, {
2843
+ }, At = ({ texts: e = Ot, speed: t = 100, deleteSpeed: n = 50, pause: r = 2e3 }) => {
2844
+ let i = e.length > 0 ? e : Ot;
2845
+ return /* @__PURE__ */ l(kt, {
902
2846
  texts: i,
903
2847
  speed: t,
904
2848
  deleteSpeed: n,
905
2849
  pause: r
906
2850
  }, i.join("\0"));
907
- }, $ = {
2851
+ }, Q = {
908
2852
  waveButton: "cos-waveButton-Aa7G-",
909
2853
  btn: "cos-btn-WJrEN",
910
2854
  label: "cos-label-9BHOU",
911
2855
  wave: "cos-wave-GycLU",
912
2856
  ripple: "cos-ripple-5ZFpr"
913
- }, oe = ({ text: e = "点我试试", color: t = "#38bdf8", className: n, style: r, ...i }) => /* @__PURE__ */ c("div", {
914
- className: $.waveButton,
915
- children: /* @__PURE__ */ l("button", {
2857
+ }, jt = ({ text: e = "点我试试", color: t = "#38bdf8", className: n, style: r, ...i }) => /* @__PURE__ */ l("div", {
2858
+ className: Q.waveButton,
2859
+ children: /* @__PURE__ */ u("button", {
916
2860
  type: "button",
917
- className: `${$.btn} ${n ?? ""}`,
2861
+ className: `${Q.btn} ${n ?? ""}`,
918
2862
  style: {
919
2863
  "--wave-color": t,
920
2864
  ...r
921
2865
  },
922
2866
  ...i,
923
2867
  children: [
924
- /* @__PURE__ */ c("span", { className: $.wave }),
925
- /* @__PURE__ */ c("span", { className: $.wave }),
926
- /* @__PURE__ */ c("span", {
927
- className: $.label,
2868
+ /* @__PURE__ */ l("span", { className: Q.wave }),
2869
+ /* @__PURE__ */ l("span", { className: Q.wave }),
2870
+ /* @__PURE__ */ l("span", {
2871
+ className: Q.label,
928
2872
  children: e
929
2873
  })
930
2874
  ]
931
2875
  })
2876
+ }), $ = {
2877
+ waveText: "cos-waveText-Zy2Tp",
2878
+ text: "cos-text-el-KR",
2879
+ char: "cos-char-Y9-mV",
2880
+ wave: "cos-wave-jVRCz"
2881
+ }, Mt = ({ text: e = "WAVE", amplitude: t = 12, color: n = "#38bdf8", fontSize: r = 56 }) => /* @__PURE__ */ l("div", {
2882
+ className: $.waveText,
2883
+ children: /* @__PURE__ */ l("h1", {
2884
+ className: $.text,
2885
+ style: {
2886
+ fontSize: r,
2887
+ "--wave-color": n,
2888
+ "--wave-amp": `${t}px`
2889
+ },
2890
+ children: e.split("").map((e, t) => /* @__PURE__ */ l("span", {
2891
+ className: $.char,
2892
+ style: { animationDelay: `${t * .1}s` },
2893
+ children: e === " " ? "\xA0" : e
2894
+ }, `${e}-${t}`))
2895
+ })
932
2896
  });
933
2897
  //#endregion
934
- export { d as CanvasClock, h as Charge, b as Confetti, w as Countdown, j as Fireworks, F as FlipCounter, te as GlitchText, R as MatrixRain, B as MeteorRain, H as NeonText, W as ParticleNetwork, K as ReturnCity, re as Turntable, ae as Typewriter, oe as WaveButton };
2898
+ export { x as AudioVisualizer, _ as Aurora, f as BarcodeScan, m as BurnAway, C as CanvasClock, ee as Charge, te as ClickSpark, ae as Confetti, de as Countdown, ge as CursorTrail, se as CyberGrid, ve as DiceRoll, pe as DnaHelix, he as ElectricArc, Te as Fireworks, Oe as FlipCounter, Ne as GlitchText, je as GradientFlow, Ie as GravityBalls, Le as HolographicCard, ze as LiquidGlass, Re as LiquidProgress, Ve as MagneticButton, Ue as MatrixRain, Ge as MazeGenerator, qe as MeteorRain, Je as NeonText, Ye as NewtonCradle, Ze as OrbitalChart, Qe as ParticleNetwork, at as ProgressChest, st as RadarScan, ct as RedPacketRain, lt as ReturnCity, ft as RippleWater, ht as ScrambleText, gt as ScratchCard, yt as SlotMachine, et as SmokeFog, nt as Snowfall, ut as Speedometer, xt as SplitReveal, Ct as Spotlight, it as Starfield, dt as TimelinePulse, Dt as Turntable, At as Typewriter, jt as WaveButton, Mt as WaveText };