cos-design 3.5.1 → 3.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.5.2] - 2026-07-23
9
+
10
+ ### Changed
11
+
12
+ - `WeatherBackground` 性能优化:天空 / 日夜 / 云 / 雾预烘焙贴图,雪花与冰雹复用贴图池,支持 `prefers-reduced-motion` 静态降级
13
+ - `SmokeFog` 支持点击 / 触摸驱散雾气
14
+
15
+ ### Fixed
16
+
17
+ - `WeatherBackground` 补充 canvas 语义标签与 loading 状态可读性
18
+
8
19
  ## [3.5.1] - 2026-07-22
9
20
 
10
21
  ### Fixed
package/README.md CHANGED
@@ -48,13 +48,15 @@ pnpm add @cos-design/weather-background
48
48
  pnpm add @cos-design/fireworks
49
49
  ```
50
50
 
51
+ > 目录 `weatherBackground` → `@cos-design/weather-background`;依赖 `@cos-design/shared` 的组件会自动安装工具包。
52
+
51
53
  ### 最简示例
52
54
 
53
55
  ```tsx
54
56
  // 全量包
55
57
  import { Fireworks, ScrambleText, ScratchCard } from 'cos-design';
56
58
 
57
- // 或按需安装的子包
59
+ // 按需子包
58
60
  // import { WeatherBackground } from '@cos-design/weather-background';
59
61
 
60
62
  export default function Page() {
@@ -91,16 +93,16 @@ export default function Page() {
91
93
 
92
94
  | 组件 | 说明 |
93
95
  | ------------------- | ---------------------------------------------- |
96
+ | `WeatherBackground` | 天气背景(15 种场景 · Open-Meteo 实况 · 日夜) |
97
+ | `SmokeFog` | 烟雾雾气飘动 |
94
98
  | `MatrixRain` | 黑客帝国数字雨 |
95
99
  | `MeteorRain` | 流星雨穿越 |
96
100
  | `ParticleNetwork` | 粒子连线网络(支持触摸) |
97
101
  | `Aurora` | 极光渐变光带 |
98
102
  | `RippleWater` | 点击水波纹 |
99
- | `SmokeFog` | 烟雾雾气飘动 |
100
103
  | `CyberGrid` | 赛博透视地面 |
101
104
  | `Snowfall` | 雪花 / 樱花飘落 |
102
105
  | `Starfield` | 3D 纵深星空 |
103
- | `WeatherBackground` | 天气背景(15 种场景 · Open-Meteo 实况 · 日夜) |
104
106
 
105
107
  </details>
106
108
 
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});require('./index.css');var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("react");c=s(c,1);let l=require("react/jsx-runtime");var u={barcodeScan:`cos-barcodeScan-aH9Ad`,content:`cos-content-F73ZD`,"glitch-skew":`cos-glitch-skew-inh6a`,placeholder:`cos-placeholder-yYVB8`,overlay:`cos-overlay-4AiY5`,scanLine:`cos-scanLine-VBsRv`,scan:`cos-scan-JD4wO`,glitchLayer:`cos-glitchLayer-nzkIa`,flicker:`cos-flicker-P0jQE`,corners:`cos-corners-1bjak`},d=({children:e,scanColor:t=`#22c55e`,speed:n=2.5})=>(0,l.jsxs)(`div`,{className:u.barcodeScan,style:{"--scan-color":t,"--scan-speed":`${n}s`},children:[(0,l.jsx)(`div`,{className:u.content,children:e??(0,l.jsx)(`span`,{className:u.placeholder,children:`SCAN ME`})}),(0,l.jsxs)(`div`,{className:u.overlay,children:[(0,l.jsx)(`div`,{className:u.scanLine}),(0,l.jsx)(`div`,{className:u.glitchLayer})]}),(0,l.jsxs)(`div`,{className:u.corners,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]})]}),f={burnAway:`cos-burnAway-QWIjy`,stage:`cos-stage-8VIfE`,text:`cos-text-0guk-`,canvas:`cos-canvas-Bwc-u`,trigger:`cos-trigger-UDZqV`,hint:`cos-hint-XQUfv`},p=({text:e=`BURN`,fontSize:t=64,onComplete:n})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(null),[a,o]=(0,c.useState)(!1),[s,u]=(0,c.useState)(!1),d=(0,c.useRef)(!1),p=(0,c.useRef)(n);(0,c.useEffect)(()=>{p.current=n},[n]);let m=(0,c.useCallback)(()=>{a||s||o(!0)},[a,s]);return(0,c.useEffect)(()=>{if(!a||s)return;let n=r.current,o=i.current;if(!n||!o)return;let c=n.getBoundingClientRect(),l=window.devicePixelRatio||1,f=Math.ceil(c.width),m=Math.ceil(c.height);o.width=f*l,o.height=m*l,o.style.width=`${f}px`,o.style.height=`${m}px`;let h=o.getContext(`2d`);if(!h)return;h.scale(l,l);let g=document.createElement(`canvas`);g.width=f*l,g.height=m*l;let _=g.getContext(`2d`);if(!_)return;_.scale(l,l),_.font=`900 ${t}px system-ui, sans-serif`,_.textAlign=`center`,_.textBaseline=`middle`,_.fillStyle=`#f8fafc`,_.fillText(e,f/2,m/2);let v=_.getImageData(0,0,f*l,m*l).data,y=[];for(let e=0;e<m;e+=4)for(let t=0;t<f;t+=4)v[(Math.floor(e*l)*f*l+Math.floor(t*l))*4+3]>128&&y.push({x:t,y:e,vx:(Math.random()-.5)*2,vy:-Math.random()*3-1,life:1,maxLife:.6+Math.random()*.6,size:2+Math.random()*3});let b=0,x=0,S=!1,C=(e,t)=>{if(S)return;let n=Math.min((e-t)/16,2);x+=n*16,h.clearRect(0,0,f,m);let r=0;for(let e of y){if(e.life-=n*.012/e.maxLife,e.life<=0)continue;r++,e.x+=e.vx*n,e.y+=e.vy*n,e.vy+=.04*n;let t=e.life,i=1-e.life,a=Math.max(0,200-i*200),o=Math.max(0,80-i*80);h.globalAlpha=t,h.fillStyle=`rgb(255,${a},${o})`,h.beginPath(),h.arc(e.x,e.y,e.size*t,0,Math.PI*2),h.fill()}h.globalAlpha=1,x<2500&&r>0?b=requestAnimationFrame(t=>C(t,e)):S||(u(!0),d.current||(d.current=!0,p.current?.()))};return b=requestAnimationFrame(e=>C(e,e)),()=>{S=!0,cancelAnimationFrame(b)}},[a,s,e,t]),(0,l.jsxs)(`div`,{className:f.burnAway,children:[(0,l.jsxs)(`div`,{ref:r,className:f.stage,children:[!s&&(0,l.jsx)(`span`,{className:f.text,style:{fontSize:t,opacity:+!a},children:e}),(0,l.jsx)(`canvas`,{ref:i,className:f.canvas})]}),!a&&!s&&(0,l.jsx)(`button`,{type:`button`,className:f.trigger,onClick:m,children:`Ignite`}),s&&(0,l.jsx)(`p`,{className:f.hint,children:`Gone.`})]})},m={aurora:`cos-aurora-dJJb8`,band:`cos-band-S5CoR`,"aurora-flow":`cos-aurora-flow-wU8TY`},h=[`#00ff87`,`#60efff`,`#7b2ff7`,`#f107a3`],g=({width:e=800,height:t=500,colors:n=h})=>{let r=n.length>=2?n:h;return(0,l.jsx)(`div`,{className:m.aurora,style:{width:e,height:t},children:r.map((e,t)=>(0,l.jsx)(`div`,{className:m.band,style:{"--aurora-color":e,"--aurora-delay":`${t*-3}s`,"--aurora-duration":`${12+t*2}s`}},e+t))})},_=e=>{let t=()=>e(document.hidden);return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},v=(e,t,n)=>Math.min(n,Math.max(t,e)),y={audioVisualizer:`cos-audioVisualizer-r5dHp`,canvas:`cos-canvas-UNEea`},b=({width:e=400,height:t=120,barCount:n=32,useMic:r=!1})=>{let i=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let a=i.current;if(!a)return;let o=window.devicePixelRatio||1;a.width=e*o,a.height=t*o;let s=a.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=0,l=document.hidden,u=null,d=null,f=null,p=null,m=0,h=!1,g=_(e=>{l=e});(async()=>{if(!(!r||!navigator.mediaDevices?.getUserMedia))try{if(p=await navigator.mediaDevices.getUserMedia({audio:!0}),h){p.getTracks().forEach(e=>e.stop()),p=null;return}u=new AudioContext,d=u.createAnalyser(),d.fftSize=256,u.createMediaStreamSource(p).connect(d),f=new Uint8Array(d.frequencyBinCount)}catch{}})();let v=()=>{if(c=requestAnimationFrame(v),l)return;let r=Array(n).fill(0);if(d&&f){d.getByteFrequencyData(f);let e=Math.floor(f.length/n);for(let t=0;t<n;t++)r[t]=f[t*e]/255}else{m+=.08;for(let e=0;e<n;e++)r[e]=(Math.sin(m+e*.35)+1)*.35+Math.random()*.15}s.fillStyle=`#0f172a`,s.fillRect(0,0,e,t);let i=(e-3*(n-1))/n;for(let e=0;e<n;e++){let n=Math.max(4,r[e]*t*.9),a=e*(i+3),o=t-n,c=s.createLinearGradient(0,o,0,t);c.addColorStop(0,`#a78bfa`),c.addColorStop(1,`#38bdf8`),s.fillStyle=c,s.beginPath(),s.roundRect(a,o,i,n,2),s.fill()}};return v(),()=>{h=!0,cancelAnimationFrame(c),g(),p?.getTracks().forEach(e=>e.stop()),u?.close()}},[n,t,r,e]),(0,l.jsx)(`div`,{className:y.audioVisualizer,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:y.canvas,style:{width:e,height:t}})})},x={canvasClock:`cos-canvasClock-QvdV3`,canvasTarget:`cos-canvasTarget-x-odC`},S=({width:e=400,height:t=400})=>{let n=(0,c.useRef)(null),r=Math.min(e,t),i=r/2-16,a=r/2,o=(0,c.useCallback)(e=>{e.clearRect(0,0,r,r),e.save(),e.translate(a,a),e.beginPath(),e.arc(0,0,i,0,Math.PI*2),e.fillStyle=`#fff`,e.fill(),e.strokeStyle=`#d1d5db`,e.lineWidth=2,e.stroke();for(let t=0;t<60;t++){let n=t/60*Math.PI*2,r=i-(t%5==0?14:8);e.beginPath(),e.moveTo(Math.cos(n)*r,Math.sin(n)*r),e.lineTo(Math.cos(n)*i,Math.sin(n)*i),e.strokeStyle=t%5==0?`#374151`:`#9ca3af`,e.lineWidth=t%5==0?2:1,e.stroke()}e.fillStyle=`#111827`,e.font=`bold ${Math.floor(r/22)}px system-ui, sans-serif`,e.textAlign=`center`,e.textBaseline=`middle`;for(let t=1;t<=12;t++){let n=t/12*Math.PI*2-Math.PI/2,r=i-32;e.fillText(String(t),Math.cos(n)*r,Math.sin(n)*r)}let t=new Date,n=t.getHours()%12,o=t.getMinutes(),s=t.getSeconds(),c=t.getMilliseconds(),l=(t,n,r,i,a)=>{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()},u=(n+o/60)/12*Math.PI*2-Math.PI/2,d=(o+s/60)/60*Math.PI*2-Math.PI/2,f=(s+c/1e3)/60*Math.PI*2-Math.PI/2;l(u,i*.5,4,`#111827`,`rgb(0 0 0 / 40%)`),l(d,i*.72,3,`#1e80ff`,`rgb(30 128 255 / 40%)`),l(f,i*.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()},[a,i,r]);return(0,c.useEffect)(()=>{let e=n.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=r*t,e.height=r*t;let i=e.getContext(`2d`);if(!i)return;i.setTransform(t,0,0,t,0,0);let a=0,s=document.hidden,c=_(e=>{s=e}),l=()=>{s||o(i),a=requestAnimationFrame(l)};return l(),()=>{cancelAnimationFrame(a),c()}},[o,r]),(0,l.jsx)(`div`,{className:x.canvasClock,style:{width:r,height:r},children:(0,l.jsx)(`canvas`,{ref:n,className:x.canvasTarget,style:{width:r,height:r}})})},C={chargeContainer:`cos-chargeContainer-4t9qo`,text:`cos-text-2k7eH`,contrast:`cos-contrast-PNep9`,hueRotate:`cos-hueRotate-bMJ-k`,bubble:`cos-bubble-VXfOd`,moveUp:`cos-moveUp-1Vz9j`,circle:`cos-circle-m4vwX`,circleRotate:`cos-circleRotate-bgFw5`,button:`cos-button-myCst`},w=15,T=258,E=e=>{let{initQuantity:t=0,value:n,onChange:r,autoCharge:i=!0,interval:a=500,step:o=.01}=e,s=(0,c.useRef)(null),u=n!==void 0,[d,f]=(0,c.useState)(()=>v(t,0,100)),p=v(u?n:d,0,100),m=(0,c.useRef)(p),h=(0,c.useRef)(r);(0,c.useEffect)(()=>{h.current=r},[r]),(0,c.useEffect)(()=>{m.current=p},[p]),(0,c.useEffect)(()=>{let e=s.current;if(!e)return;let t=()=>{let t=Math.max(0,e.clientHeight-T);e.style.setProperty(`--charge-rise-max`,`${t}px`)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,c.useEffect)(()=>{if(!i)return;let e=window.setInterval(()=>{if(m.current>=100)return;let e=Math.min(100,Number((m.current+o).toFixed(2)));u?h.current?.(e):f(e)},a);return()=>clearInterval(e)},[i,a,u,o]);let g=p.toFixed(2);return(0,l.jsxs)(`div`,{ref:s,className:C.chargeContainer,"data-auto":i?`true`:`false`,style:{"--charge-pct":p},children:[(0,l.jsxs)(`div`,{className:C.contrast,children:[Array.from({length:w},(e,t)=>(0,l.jsx)(`span`,{className:C.bubble,"data-index":t+1},t)),(0,l.jsx)(`div`,{className:C.circle}),(0,l.jsx)(`div`,{className:C.button})]}),(0,l.jsxs)(`div`,{className:C.text,children:[g,`%`]})]})},D={clickSpark:`cos-clickSpark-db9Om`,canvas:`cos-canvas-p9fnQ`,content:`cos-content-7uE4T`,hint:`cos-hint-UqpWX`},O=({children:e,color:t=`#fbbf24`,count:n=16})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)(0),s=(0,c.useCallback)((e,t)=>{for(let r=0;r<n;r++){let i=Math.PI*2*r/n+Math.random()*.3,o=Math.random()*4+2;a.current.push({x:e,y:t,vx:Math.cos(i)*o,vy:Math.sin(i)*o,alpha:1,size:Math.random()*3+2})}},[n]);return(0,c.useEffect)(()=>{let e=i.current,n=r.current;if(!e||!n)return;let s=e.getContext(`2d`);if(!s)return;let c=()=>{let t=window.devicePixelRatio||1,{width:r,height:i}=n.getBoundingClientRect();e.width=r*t,e.height=i*t,s.setTransform(t,0,0,t,0,0)};c();let l=new ResizeObserver(c);l.observe(n);let u=document.hidden,d=_(e=>{u=e}),f=()=>{if(o.current=requestAnimationFrame(f),u)return;let{width:e,height:r}=n.getBoundingClientRect();s.clearRect(0,0,e,r),a.current=a.current.filter(e=>(e.x+=e.vx,e.y+=e.vy,e.vy+=.15,e.alpha-=.03,e.alpha<=0?!1:(s.beginPath(),s.arc(e.x,e.y,e.size,0,Math.PI*2),s.fillStyle=t,s.globalAlpha=e.alpha,s.fill(),s.globalAlpha=1,!0)))};return f(),()=>{cancelAnimationFrame(o.current),l.disconnect(),d()}},[t]),(0,l.jsxs)(`div`,{ref:r,className:D.clickSpark,onClick:e=>{let t=r.current?.getBoundingClientRect();t&&s(e.clientX-t.left,e.clientY-t.top)},children:[(0,l.jsx)(`canvas`,{ref:i,className:D.canvas}),e&&(0,l.jsx)(`div`,{className:D.content,children:e}),!e&&(0,l.jsx)(`p`,{className:D.hint,children:`点击任意位置产生火花`})]})},k={confetti:`cos-confetti-MeNtU`,canvas:`cos-canvas-0T3Vs`,hint:`cos-hint-sGHEi`},A=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`,`#38bdf8`],j=()=>A[Math.floor(Math.random()*A.length)],M=(e,t,n)=>{let r=e/2,i=t*.6;return Array.from({length:n},()=>{let e=(Math.random()-.5)*Math.PI,t=Math.random()*12+6;return{x:r+(Math.random()-.5)*40,y:i,vx:Math.cos(e)*t,vy:Math.sin(e)*t-Math.random()*8,rotation:Math.random()*360,rotationSpeed:(Math.random()-.5)*12,color:j(),width:Math.random()*8+4,height:Math.random()*6+3,alpha:1,gravity:Math.random()*.15+.12}})},N=(0,c.forwardRef)(({width:e=800,height:t=400,auto:n=!0,particleCount:r=120},i)=>{let a=(0,c.useRef)(null),o=(0,c.useRef)([]),s=(0,c.useRef)(0),u=(0,c.useRef)({width:e,height:t,particleCount:r});u.current={width:e,height:t,particleCount:r};let d=(0,c.useCallback)(()=>{let{width:e,height:t,particleCount:n}=u.current;o.current.push(...M(e,t,n))},[]);return(0,c.useImperativeHandle)(i,()=>({burst:d}),[d]),(0,c.useEffect)(()=>{n&&d()},[n,d]),(0,c.useEffect)(()=>{let n=a.current;if(!n)return;let r=window.devicePixelRatio||1;n.width=e*r,n.height=t*r;let i=n.getContext(`2d`);if(!i)return;i.setTransform(r,0,0,r,0,0);let c=document.hidden,l=_(e=>{c=e}),u=()=>{s.current=requestAnimationFrame(u),!c&&(i.clearRect(0,0,e,t),o.current=o.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>t+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))))};return u(),()=>{cancelAnimationFrame(s.current),l()}},[t,e]),(0,l.jsxs)(`div`,{className:k.confetti,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:a,className:k.canvas,style:{width:e,height:t},onClick:d}),(0,l.jsx)(`p`,{className:k.hint,children:`点击画布再次喷射`})]})});N.displayName=`Confetti`;var ee={cyberGrid:`cos-cyberGrid-VgJwl`,canvas:`cos-canvas--Mq-O`},te=({width:e=800,height:t=500,color:n=`#00f0ff`,speed:r=1})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)(0),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let s=i.current;if(!s)return;let c=window.devicePixelRatio||1;s.width=e*c,s.height=t*c;let l=s.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=t*.45,d=document.hidden,f=_(e=>{d=e}),p=()=>{if(a.current=requestAnimationFrame(p),d)return;o.current=(o.current+r*1.5)%40,l.fillStyle=`#050510`,l.fillRect(0,0,e,t);let i=l.createLinearGradient(0,0,0,u);i.addColorStop(0,`#0a0a20`),i.addColorStop(1,`#050510`),l.fillStyle=i,l.fillRect(0,0,e,u);let s=e/2;l.strokeStyle=n,l.shadowColor=n,l.shadowBlur=8,l.lineWidth=1;for(let n=-12;n<=12;n++){let r=n/12*e*1.2;l.beginPath(),l.moveTo(s+r*.05,u),l.lineTo(s+r,t),l.globalAlpha=.3+(1-Math.abs(n)/12)*.5,l.stroke()}l.globalAlpha=1;let c=Math.ceil(t/40)+2;for(let n=0;n<c;n++){let r=u+(n*40+o.current)/(t-u)*(t-u)%(t-u),i=(r-u)/(t-u)*.8;l.beginPath(),l.moveTo(0,r),l.lineTo(e,r),l.globalAlpha=i,l.stroke()}l.shadowBlur=0,l.globalAlpha=1;let f=l.createRadialGradient(s,u,0,s,u,e*.4);f.addColorStop(0,`${n}33`),f.addColorStop(1,`transparent`),l.fillStyle=f,l.fillRect(0,0,e,t)};return p(),()=>{cancelAnimationFrame(a.current),f()}},[n,t,r,e]),(0,l.jsx)(`div`,{className:ee.cyberGrid,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:ee.canvas,style:{width:e,height:t}})})},P={countdown:`cos-countdown-5ZKKP`,unit:`cos-unit-dth8N`,value:`cos-value-yVzcP`,label:`cos-label-pAMEs`,ended:`cos-ended-c0dsD`,pulse:`cos-pulse-krQd-`,invalid:`cos-invalid-d6t-L`},ne=e=>e instanceof Date?e.getTime():typeof e==`number`?e:new Date(e).getTime(),re=e=>{let t=Math.max(0,e-Date.now()),n=Math.floor(t/1e3);return{total:t,days:Math.floor(n/86400),hours:Math.floor(n%86400/3600),minutes:Math.floor(n%3600/60),seconds:n%60}},ie=[{key:`days`,label:`天`},{key:`hours`,label:`时`},{key:`minutes`,label:`分`},{key:`seconds`,label:`秒`}],ae=({targetDate:e,onEnd:t,showLabels:n=!0,color:r=`#f472b6`})=>{let i=(0,c.useMemo)(()=>ne(e),[e]),a=!Number.isNaN(i),[,o]=(0,c.useState)(0),s=(0,c.useRef)(!1),u=(0,c.useRef)(t),d=a?re(i):{days:0,hours:0,minutes:0,seconds:0,total:0};return(0,c.useEffect)(()=>{u.current=t},[t]),(0,c.useEffect)(()=>{if(!a)return;if(s.current=!1,Date.now()>=i){s.current=!0,u.current?.();return}let e=window.setInterval(()=>{o(e=>e+1),Date.now()>=i&&!s.current&&(s.current=!0,u.current?.(),clearInterval(e))},1e3);return()=>clearInterval(e)},[a,i]),a?(0,l.jsxs)(`div`,{className:P.countdown,style:{"--countdown-color":r},children:[ie.map(({key:e,label:t})=>(0,l.jsxs)(`div`,{className:P.unit,children:[(0,l.jsx)(`div`,{className:P.value,children:String(d[e]).padStart(2,`0`)}),n&&(0,l.jsx)(`span`,{className:P.label,children:t})]},e)),d.total<=0&&(0,l.jsx)(`p`,{className:P.ended,children:`时间到!`})]}):(0,l.jsx)(`div`,{className:P.countdown,children:(0,l.jsx)(`p`,{className:P.invalid,children:`无效的目标时间`})})},oe={dnaHelix:`cos-dnaHelix-nEQLW`,canvas:`cos-canvas-uEV8B`},se=({width:e=200,height:t=360,speed:n=1,color:r=`#38bdf8`})=>{let i=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let a=i.current;if(!a)return;let o=window.devicePixelRatio||1;a.width=e*o,a.height=t*o;let s=a.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=0,l=0,u=document.hidden,d=_(e=>{u=e}),f=()=>{if(l=requestAnimationFrame(f),u)return;c+=.03*n,s.fillStyle=`#0f172a`,s.fillRect(0,0,e,t);let i=e/2,a=e*.32;for(let e=0;e<18;e++){let n=e/17*(t-40)+20,o=c+e*.4,l=i+Math.sin(o)*a,u=i+Math.sin(o+Math.PI)*a,d=Math.cos(o),f=5+d*2;s.beginPath(),s.moveTo(l,n),s.lineTo(u,n),s.strokeStyle=`rgb(148 163 184 / ${30+Math.abs(d)*30}%)`,s.lineWidth=1.5,s.stroke(),s.beginPath(),s.arc(l,n,f,0,Math.PI*2),s.fillStyle=d>0?r:`#a78bfa`,s.fill(),s.beginPath(),s.arc(u,n,f,0,Math.PI*2),s.fillStyle=d>0?`#a78bfa`:r,s.fill()}};return f(),()=>{cancelAnimationFrame(l),d()}},[r,t,n,e]),(0,l.jsx)(`div`,{className:oe.dnaHelix,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:oe.canvas,style:{width:e,height:t}})})},ce={electricArc:`cos-electricArc-BFlY3`,canvas:`cos-canvas-iowDx`},le=(e,t,n,r,i,a)=>{if(a<=0)return[[e,t],[n,r]];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=le(e,t,o+f,s+p,i*.6,a-1),h=le(o+f,s+p,n,r,i*.6,a-1);return[...m.slice(0,-1),...h]},ue=({width:e=320,height:t=160,color:n=`#67e8f9`})=>{let r=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let i=r.current;if(!i)return;let a=window.devicePixelRatio||1;i.width=e*a,i.height=t*a;let o=i.getContext(`2d`);if(!o)return;o.setTransform(a,0,0,a,0,0);let s=t/2,c=e-40,l=t/2,u=0,d=document.hidden,f=_(e=>{d=e}),p=()=>{if(u=requestAnimationFrame(p),d)return;o.fillStyle=`#0f172a`,o.fillRect(0,0,e,t);let r=le(40,s,c,l,40,5);o.beginPath(),r.forEach(([e,t],n)=>n===0?o.moveTo(e,t):o.lineTo(e,t)),o.strokeStyle=n,o.lineWidth=2,o.shadowColor=n,o.shadowBlur=12,o.stroke(),o.shadowBlur=0,o.beginPath(),r.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])=>{o.beginPath(),o.arc(e,t,6,0,Math.PI*2),o.fillStyle=n,o.fill()})};return p(),()=>{cancelAnimationFrame(u),f()}},[n,t,e]),(0,l.jsx)(`div`,{className:ce.electricArc,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:ce.canvas,style:{width:e,height:t}})})},de={cursorTrail:`cos-cursorTrail-fpz5p`,canvas:`cos-canvas-Iuyp3`,hint:`cos-hint-9GLHx`},fe=({color:e=`#38bdf8`,length:t=20,width:n=800,height:r=400})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)({x:n/2,y:r/2}),s=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let c=i.current;if(!c)return;let l=window.devicePixelRatio||1;c.width=n*l,c.height=r*l;let u=c.getContext(`2d`);if(!u)return;u.setTransform(l,0,0,l,0,0);let d=document.hidden,f=_(e=>{d=e}),p=()=>{if(s.current=requestAnimationFrame(p),d)return;let{x:i,y:c}=o.current;a.current.unshift({x:i,y:c,life:1}),a.current.length>t&&(a.current.length=t),u.fillStyle=`rgb(15 23 42 / 15%)`,u.fillRect(0,0,n,r);let l=a.current;for(let t=0;t<l.length;t++){let n=l[t],r=1-t/l.length,i=(1-t/l.length)*8+2;u.beginPath(),u.arc(n.x,n.y,i,0,Math.PI*2),u.fillStyle=e,u.globalAlpha=r*.8,u.fill()}u.globalAlpha=1};return p(),()=>{cancelAnimationFrame(s.current),f()}},[e,r,t,n]),(0,l.jsxs)(`div`,{className:de.cursorTrail,style:{width:n,height:r},children:[(0,l.jsx)(`canvas`,{ref:i,className:de.canvas,style:{width:n,height:r},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect();o.current={x:e.clientX-t.left,y:e.clientY-t.top}}}),(0,l.jsx)(`p`,{className:de.hint,children:`移动鼠标查看粒子轨迹`})]})},F={diceRoll:`cos-diceRoll-GDwjV`,scene:`cos-scene-tmnKM`,cube:`cos-cube-RklEa`,rolling:`cos-rolling-2ocEq`,face:`cos-face-10eAF`,dot:`cos-dot-p5AzF`,face1:`cos-face1-Ev-x5`,face2:`cos-face2-2M17p`,face3:`cos-face3-Wd6T4`,face4:`cos-face4-RsRwQ`,face5:`cos-face5-PiJbu`,face6:`cos-face6-Yp-MX`,rollBtn:`cos-rollBtn-nXMWJ`,result:`cos-result-kXzu9`},pe={1:{x:0,y:0},2:{x:0,y:180},3:{x:0,y:-90},4:{x:0,y:90},5:{x:-90,y:0},6:{x:90,y:0}},me=({onRoll:e,sides:t=6})=>{let[n,r]=(0,c.useState)(!1),[i,a]=(0,c.useState)(1),[o,s]=(0,c.useState)({x:0,y:0,z:0}),u=(0,c.useRef)(e),d=(0,c.useRef)(0);(0,c.useEffect)(()=>{u.current=e},[e]),(0,c.useEffect)(()=>()=>clearTimeout(d.current),[]);let f=()=>{if(n)return;r(!0);let e=Math.floor(Math.random()*t)+1,i=pe[e]??pe[1],o=360*(3+Math.floor(Math.random()*3)),c=360*(3+Math.floor(Math.random()*3));s({x:i.x+o,y:i.y+c,z:Math.random()*360}),clearTimeout(d.current),d.current=window.setTimeout(()=>{a(e),r(!1),u.current?.(e)},1200)},p=e=>({1:[[50,50]],2:[[25,25],[75,75]],3:[[25,25],[50,50],[75,75]],4:[[25,25],[75,25],[25,75],[75,75]],5:[[25,25],[75,25],[50,50],[25,75],[75,75]],6:[[25,25],[75,25],[25,50],[75,50],[25,75],[75,75]]}[e]??[]).map(([e,t],n)=>(0,l.jsx)(`span`,{className:F.dot,style:{left:`${e}%`,top:`${t}%`}},n));return(0,l.jsxs)(`div`,{className:F.diceRoll,children:[(0,l.jsx)(`div`,{className:F.scene,children:(0,l.jsx)(`div`,{className:`${F.cube} ${n?F.rolling:``}`,style:{transform:`rotateX(${o.x}deg) rotateY(${o.y}deg) rotateZ(${o.z}deg)`},children:[1,2,3,4,5,6].map(e=>(0,l.jsx)(`div`,{className:`${F.face} ${F[`face${e}`]}`,children:p(e)},e))})}),(0,l.jsx)(`button`,{type:`button`,className:F.rollBtn,onClick:f,disabled:n,children:n?`掷骰中...`:`掷骰子`}),!n&&(0,l.jsxs)(`p`,{className:F.result,children:[`点数: `,i]})]})},he={doublePendulum:`cos-doublePendulum-FUEeK`,canvas:`cos-canvas-OVkhW`},ge=({width:e=400,height:t=400,trailLength:n=120,color:r=`#38bdf8`,color2:i=`#a78bfa`})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)({theta1:Math.PI/2+.1,theta2:Math.PI/2-.2,omega1:0,omega2:0}),s=(0,c.useRef)([]);return(0,c.useEffect)(()=>{let c=a.current;if(!c)return;let l=window.devicePixelRatio||1;c.width=e*l,c.height=t*l;let u=c.getContext(`2d`);if(!u)return;u.setTransform(l,0,0,l,0,0);let d=e/2,f=t*.28,p=t*.28,m=t*.26,h=9.8,g=.016,v=0,y=document.hidden,b=_(e=>{y=e}),x=()=>{if(v=requestAnimationFrame(x),y)return;let a=o.current,{theta1:c,theta2:l,omega1:_,omega2:b}=a,S=Math.sin(c),C=Math.sin(c-l),w=Math.cos(c-l),T=Math.cos(c),E=p*(3-1*Math.cos(2*c-2*l)),D=(-9.8*3*S-1*h*Math.sin(c-2*l)-2*C*1*(b*b*m+_*_*p*w))/E,O=2*C*(_*_*p*2+h*2*T+b*b*m*1*w)/(m*(3-1*Math.cos(2*c-2*l)));a.omega1+=D*g,a.omega2+=O*g,a.theta1+=a.omega1*g,a.theta2+=a.omega2*g;let k=d+p*Math.sin(a.theta1),A=f+p*Math.cos(a.theta1),j=k+m*Math.sin(a.theta2),M=A+m*Math.cos(a.theta2),N=s.current;N.push({x:j,y:M}),N.length>n&&N.shift(),u.fillStyle=`rgba(15, 23, 42, 0.22)`,u.fillRect(0,0,e,t),N.length>1&&(u.beginPath(),N.forEach((e,t)=>t===0?u.moveTo(e.x,e.y):u.lineTo(e.x,e.y)),u.strokeStyle=i,u.lineWidth=1.5,u.globalAlpha=.7,u.stroke(),u.globalAlpha=1),u.beginPath(),u.moveTo(d,f),u.lineTo(k,A),u.lineTo(j,M),u.strokeStyle=`#64748b`,u.lineWidth=2,u.stroke(),u.beginPath(),u.arc(d,f,5,0,Math.PI*2),u.fillStyle=`#94a3b8`,u.fill(),u.beginPath(),u.arc(k,A,10,0,Math.PI*2),u.fillStyle=r,u.shadowColor=r,u.shadowBlur=10,u.fill(),u.shadowBlur=0,u.beginPath(),u.arc(j,M,10,0,Math.PI*2),u.fillStyle=i,u.shadowColor=i,u.shadowBlur=10,u.fill(),u.shadowBlur=0};return u.fillStyle=`#0f172a`,u.fillRect(0,0,e,t),x(),()=>{cancelAnimationFrame(v),b()}},[r,i,t,n,e]),(0,l.jsx)(`div`,{className:he.doublePendulum,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:he.canvas,style:{width:e,height:t}})})},_e={fireworks:`cos-fireworks-fsSqL`,canvas:`cos-canvas-spL8G`,hint:`cos-hint-5XDRH`},ve=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`],ye=.12,be=240,xe=()=>ve[Math.floor(Math.random()*ve.length)],Se=(e,t,n)=>{let r=60+Math.floor(Math.random()*30);return Array.from({length:r},()=>{let r=Math.random()*Math.PI*2,i=Math.random()*4+2;return{x:e,y:t,vx:Math.cos(r)*i,vy:Math.sin(r)*i,alpha:1,color:Math.random()>.3?n:xe(),decay:Math.random()*.015+.01}})},Ce=(0,c.forwardRef)(({width:e=800,height:t=500,auto:n=!0},r)=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)(0),s=(0,c.useCallback)(n=>{let r=n??Math.random()*e*.6+e*.2;a.current.push({x:r,y:t,vy:-(Math.random()*4+6),targetY:Math.random()*t*.35+t*.15,color:xe(),exploded:!1,particles:[],age:0})},[t,e]);return(0,c.useImperativeHandle)(r,()=>({launch:s}),[s]),(0,c.useEffect)(()=>{let r=i.current;if(!r)return;let c=window.devicePixelRatio||1;r.width=e*c,r.height=t*c;let l=r.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=0,d=document.hidden,f=_(e=>{d=e}),p=()=>{o.current=requestAnimationFrame(p),!d&&(l.fillStyle=`rgb(15 23 42 / 25%)`,l.fillRect(0,0,e,t),a.current=a.current.filter(e=>{if(!e.exploded){e.age+=1,e.y+=e.vy,e.vy+=ye,l.beginPath(),l.arc(e.x,e.y,2.5,0,Math.PI*2),l.fillStyle=e.color,l.fill();let t=e.vy>=0,n=e.y<=e.targetY,r=e.y<0,i=e.age>=be;return(t||n||r||i)&&(e.exploded=!0,e.particles=Se(e.x,e.y,e.color)),!0}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:(l.beginPath(),l.arc(e.x,e.y,2,0,Math.PI*2),l.fillStyle=e.color,l.globalAlpha=e.alpha,l.fill(),l.globalAlpha=1,!0))),e.particles.length>0}))};return p(),n&&(u=window.setInterval(()=>s(),1200)),()=>{cancelAnimationFrame(o.current),clearInterval(u),f()}},[n,t,s,e]),(0,l.jsxs)(`div`,{className:_e.fireworks,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:i,className:_e.canvas,style:{width:e,height:t},onClick:e=>{let t=e.currentTarget.getBoundingClientRect();s(e.clientX-t.left)}}),(0,l.jsx)(`p`,{className:_e.hint,children:`点击画布燃放烟花`})]})});Ce.displayName=`Fireworks`;var I={flipCounter:`cos-flipCounter-3LuI0`,digit:`cos-digit-yJRPy`,digitCard:`cos-digitCard-zZUzt`,staticTop:`cos-staticTop-aLQcm`,staticBottom:`cos-staticBottom-9y0gu`,flap:`cos-flap-i3YKR`,flapTop:`cos-flapTop-70z-k`,flapBottom:`cos-flapBottom-zhMZe`,isFlipping:`cos-isFlipping-EVEdI`,"fold-top":`cos-fold-top-v-6XJ`,"unfold-bottom":`cos-unfold-bottom-e2gzU`},we=(e,t)=>Math.max(0,Math.floor(e)).toString().padStart(t,`0`).slice(-t),Te=({digit:e,color:t,duration:n})=>{let r=(0,c.useRef)(e),[i,a]=(0,c.useState)(!1),[o,s]=(0,c.useState)(e);(0,c.useEffect)(()=>{if(e===r.current)return;s(r.current),a(!0),r.current=e;let t=window.setTimeout(()=>a(!1),n);return()=>clearTimeout(t)},[e,n]);let u=i?o:e;return(0,l.jsx)(`div`,{className:I.digit,style:{"--flip-color":t,"--flip-duration":`${n}ms`},children:(0,l.jsxs)(`div`,{className:`${I.digitCard} ${i?I.isFlipping:``}`,children:[(0,l.jsx)(`div`,{className:I.staticTop,children:(0,l.jsx)(`span`,{children:u})}),(0,l.jsx)(`div`,{className:I.staticBottom,children:(0,l.jsx)(`span`,{children:u})}),i&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`${I.flap} ${I.flapTop}`,children:(0,l.jsx)(`span`,{children:o})}),(0,l.jsx)(`div`,{className:`${I.flap} ${I.flapBottom}`,children:(0,l.jsx)(`span`,{children:e})})]})]})})},Ee=({value:e,digits:t=4,color:n=`#38bdf8`,duration:r=600})=>{let i=we(e,t).split(``);return(0,l.jsx)(`div`,{className:I.flipCounter,children:i.map((e,t)=>(0,l.jsx)(Te,{digit:e,color:n,duration:r},t))})},De={gradientFlow:`cos-gradientFlow-XhN16`,text:`cos-text-ORuqk`,flow:`cos-flow-9FzMA`},Oe=[`#ff00de`,`#7c3aed`,`#00f0ff`,`#38bdf8`,`#ff00de`],ke=({text:e=`GRADIENT`,colors:t=Oe,fontSize:n=64})=>{let r=t.length>=2?t.join(`, `):Oe.join(`, `);return(0,l.jsx)(`div`,{className:De.gradientFlow,children:(0,l.jsx)(`h1`,{className:De.text,style:{fontSize:n,backgroundImage:`linear-gradient(90deg, ${r})`},children:e})})},Ae={glitchText:`cos-glitchText-dZ-sR`,text:`cos-text-JsPHN`,"glitch-1":`cos-glitch-1-s9pqH`,"glitch-2":`cos-glitch-2-GhFB-`},je=({text:e=`GLITCH`,color:t=`#f8fafc`,glitchColor1:n=`#ff00de`,glitchColor2:r=`#00f0ff`,fontSize:i=64})=>(0,l.jsx)(`div`,{className:Ae.glitchText,children:(0,l.jsx)(`h1`,{className:Ae.text,"data-text":e,style:{fontSize:i,"--glitch-color":t,"--glitch-c1":n,"--glitch-c2":r},children:e})}),Me={gravityBalls:`cos-gravityBalls-LdwFo`,canvas:`cos-canvas-n7esd`},Ne=[`#38bdf8`,`#a78bfa`,`#f472b6`,`#4ade80`,`#fbbf24`],Pe=({width:e=400,height:t=300,ballCount:n=12})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)([]);return(0,c.useEffect)(()=>{i.current=Array.from({length:n},()=>({x:Math.random()*(e-40)+20,y:t*.5*Math.random()+10,vx:(Math.random()-.5)*4,vy:Math.random()*2,r:Math.random()*10+8,color:Ne[Math.floor(Math.random()*Ne.length)]}))},[n,t,e]),(0,c.useEffect)(()=>{let n=r.current;if(!n)return;let a=window.devicePixelRatio||1;n.width=e*a,n.height=t*a;let o=n.getContext(`2d`);if(!o)return;o.setTransform(a,0,0,a,0,0);let s=0,c=document.hidden,l=_(e=>{c=e}),u=()=>{if(s=requestAnimationFrame(u),c)return;let n=i.current;o.fillStyle=`#0f172a`,o.fillRect(0,0,e,t);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);for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++){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;if(s<c){let e=a/s,t=o/s,n=c-s;r.x-=e*n*.5,r.y-=t*n*.5,i.x+=e*n*.5,i.y+=t*n*.5;let l=(r.vx-i.vx)*e+(r.vy-i.vy)*t;l>0&&(r.vx-=l*e,r.vy-=l*t,i.vx+=l*e,i.vy+=l*t)}}for(let e of n){o.beginPath(),o.arc(e.x,e.y,e.r,0,Math.PI*2);let t=o.createRadialGradient(e.x-e.r*.3,e.y-e.r*.3,0,e.x,e.y,e.r);t.addColorStop(0,`#fff`),t.addColorStop(.3,e.color),t.addColorStop(1,e.color),o.fillStyle=t,o.fill()}};return u(),()=>{cancelAnimationFrame(s),l()}},[t,e]),(0,l.jsx)(`div`,{className:Me.gravityBalls,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:Me.canvas,style:{width:e,height:t}})})},L={wrap:`cos-wrap-r1gGL`,card:`cos-card-3W10s`,shine:`cos-shine-0xjID`,image:`cos-image-AV2XG`,placeholder:`cos-placeholder-wuuL3`,info:`cos-info-CNR0r`},Fe=({title:e=`全息卡片`,subtitle:t=`移动鼠标体验 3D 效果`,image:n})=>{let r=(0,c.useRef)(null);return(0,l.jsx)(`div`,{className:L.wrap,children:(0,l.jsxs)(`div`,{ref:r,className:L.card,onMouseMove:e=>{let t=r.current;if(!t)return;let n=t.getBoundingClientRect(),i=(e.clientX-n.left)/n.width-.5,a=(e.clientY-n.top)/n.height-.5;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}%`)},onMouseLeave:()=>{let e=r.current;e&&(e.style.setProperty(`--rx`,`0deg`),e.style.setProperty(`--ry`,`0deg`),e.style.setProperty(`--gx`,`50%`),e.style.setProperty(`--gy`,`50%`))},children:[(0,l.jsx)(`div`,{className:L.shine}),n?(0,l.jsx)(`img`,{src:n,alt:e,className:L.image}):(0,l.jsx)(`div`,{className:L.placeholder,children:(0,l.jsx)(`span`,{children:`✦`})}),(0,l.jsxs)(`div`,{className:L.info,children:[(0,l.jsx)(`h3`,{children:e}),(0,l.jsx)(`p`,{children:t})]})]})})},R={liquidProgress:`cos-liquidProgress-ABZZA`,svg:`cos-svg-YdTvy`,track:`cos-track-IhMjO`,ring:`cos-ring-6PKMg`,fillBg:`cos-fillBg-pwLI1`,wave:`cos-wave-CBwgG`,label:`cos-label-WYDqS`},Ie=({value:e=0,max:t=100,size:n=160,color:r=`#38bdf8`})=>{let i=(0,c.useRef)(null),a=(0,c.useId)().replace(/:/g,``),o=v(t>0?e/t*100:0,0,100),s=100-o;return(0,c.useEffect)(()=>{let e=0,t=0,n=document.hidden,r=_(e=>{n=e}),a=()=>{if(!n){t+=.04;let e=i.current;if(e){let n=s+Math.sin(t)*2;e.setAttribute(`d`,`M0,${n} Q25,${n-4+Math.sin(t*1.3)*3} 50,${n} T100,${n} V100 H0 Z`)}}e=requestAnimationFrame(a)};return e=requestAnimationFrame(a),()=>{cancelAnimationFrame(e),r()}},[s]),(0,l.jsxs)(`div`,{className:R.liquidProgress,style:{width:n,height:n,"--liquid-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 100 100`,className:R.svg,children:[(0,l.jsx)(`defs`,{children:(0,l.jsx)(`clipPath`,{id:`clip-${a}`,children:(0,l.jsx)(`circle`,{cx:`50`,cy:`50`,r:45})})}),(0,l.jsx)(`circle`,{cx:`50`,cy:`50`,r:45,className:R.track,strokeWidth:10,fill:`none`}),(0,l.jsxs)(`g`,{clipPath:`url(#clip-${a})`,children:[(0,l.jsx)(`rect`,{x:`0`,y:`0`,width:`100`,height:`100`,className:R.fillBg}),(0,l.jsx)(`path`,{ref:i,className:R.wave,d:`M0,${s} Q25,${s-4} 50,${s} T100,${s} V100 H0 Z`})]}),(0,l.jsx)(`circle`,{cx:`50`,cy:`50`,r:45,className:R.ring,strokeWidth:10,fill:`none`})]}),(0,l.jsxs)(`span`,{className:R.label,children:[Math.round(o),`%`]})]})},Le={lorenzAttractor:`cos-lorenzAttractor--UAI7`,canvas:`cos-canvas-oeXce`},Re=({width:e=400,height:t=360,speed:n=1,color:r=`#f472b6`,pointCount:i=2e3})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let s=a.current;if(!s)return;let c=window.devicePixelRatio||1;s.width=e*c,s.height=t*c;let l=s.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=.005,d=[],f=.1,p=0,m=0;for(let e=0;e<i;e++){let e=10*(p-f),t=f*(28-m)-p,n=f*p-2.6666666666666665*m;f+=e*u,p+=t*u,m+=n*u,d.push({x:f,y:p,z:m})}let h=0,g=document.hidden,v=_(e=>{g=e}),y=(n,r,i,a)=>{let o=Math.cos(a),s=Math.sin(a),c=n*o-i*s,l=n*s+i*o,u=r;return{x:e/2+c*6,y:t/2-u*6,depth:l}},b=()=>{if(h=requestAnimationFrame(b),g)return;o.current+=.004*n;let i=o.current;l.fillStyle=`rgba(15, 23, 42, 0.15)`,l.fillRect(0,0,e,t);let a=d.map(e=>y(e.x,e.y,e.z,i));l.beginPath(),a.forEach((e,t)=>t===0?l.moveTo(e.x,e.y):l.lineTo(e.x,e.y)),l.strokeStyle=r,l.globalAlpha=.75,l.lineWidth=.9,l.stroke(),l.globalAlpha=1,a.forEach((e,t)=>{if(t%50!=0)return;let n=.2+(e.depth+30)/60*.6;l.beginPath(),l.arc(e.x,e.y,1.5,0,Math.PI*2),l.fillStyle=`#fff`,l.globalAlpha=Math.max(.1,Math.min(n,.9)),l.fill()}),l.globalAlpha=1};return l.fillStyle=`#0f172a`,l.fillRect(0,0,e,t),b(),()=>{cancelAnimationFrame(h),v()}},[r,t,i,n,e]),(0,l.jsx)(`div`,{className:Le.lorenzAttractor,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:Le.canvas,style:{width:e,height:t}})})},ze={liquidGlass:`cos-liquidGlass-Z3bQg`,panel:`cos-panel-XYboD`,content:`cos-content-MHfkS`},Be=({children:e=`液态玻璃面板`,blur:t=16,borderRadius:n=20})=>(0,l.jsx)(`div`,{className:ze.liquidGlass,children:(0,l.jsx)(`div`,{className:ze.panel,style:{"--glass-blur":`${t}px`,"--glass-radius":`${n}px`},children:(0,l.jsx)(`div`,{className:ze.content,children:e})})}),Ve={magneticButton:`cos-magneticButton-GbRkE`,btn:`cos-btn--b2BJ`},He=({children:e=`磁吸按钮`,strength:t=.4,color:n=`#6366f1`})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(null);return(0,l.jsx)(`div`,{ref:r,className:Ve.magneticButton,onMouseMove:e=>{let n=r.current,a=i.current;if(!n||!a)return;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;a.style.transform=`translate(${l}px, ${u}px)`},onMouseLeave:()=>{let e=i.current;e&&(e.style.transform=`translate(0, 0)`)},children:(0,l.jsx)(`button`,{ref:i,type:`button`,className:Ve.btn,style:{"--btn-color":n},children:e})})},z={matrixRain:`cos-matrixRain-qg9HC`,canvas:`cos-canvas--AvpG`,overlay:`cos-overlay-knj3b`,title:`cos-title-sDfhs`,flicker:`cos-flicker-smHxl`,subtitle:`cos-subtitle-CWheW`},Ue=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ`,We=({width:e=800,height:t=500,density:n=.6,color:r=`#00ff41`,showOverlay:i=!0,title:a=`MATRIX`,subtitle:o=`数字雨效果`})=>{let s=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let i=s.current;if(!i)return;let a=window.devicePixelRatio||1;i.width=e*a,i.height=t*a;let o=i.getContext(`2d`);if(!o)return;o.setTransform(a,0,0,a,0,0);let c=Math.floor(e/16*n),l=Array.from({length:c},()=>Math.random()*-50),u=0,d=document.hidden,f=_(e=>{d=e}),p=()=>{u=requestAnimationFrame(p),!d&&(o.fillStyle=`rgb(0 0 0 / 8%)`,o.fillRect(0,0,e,t),o.font=`16px monospace`,l.forEach((e,i)=>{let a=Ue[Math.floor(Math.random()*53)],s=i/n*16;o.fillStyle=r,o.fillText(a,s,e*16),e*16>t&&Math.random()>.975&&(l[i]=0),l[i]+=1}))};return p(),()=>{cancelAnimationFrame(u),f()}},[r,n,t,e]),(0,l.jsxs)(`div`,{className:z.matrixRain,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:s,className:z.canvas,style:{width:e,height:t}}),i&&(0,l.jsxs)(`div`,{className:z.overlay,children:[(0,l.jsx)(`h2`,{className:z.title,children:a}),(0,l.jsx)(`p`,{className:z.subtitle,children:o})]})]})},Ge={metaballPool:`cos-metaballPool-JJaI9`,canvas:`cos-canvas-S7fDD`},Ke=({width:e=400,height:t=300,ballCount:n=5,color:r=`#38bdf8`})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)({x:-999,y:-999,active:!1});return(0,c.useEffect)(()=>{let r=Math.max(2,Math.min(n,10));a.current=Array.from({length:r},()=>({x:Math.random()*(e-80)+40,y:Math.random()*(t-80)+40,vx:(Math.random()-.5)*2,vy:(Math.random()-.5)*2,r:28+Math.random()*18}))},[n,t,e]),(0,c.useEffect)(()=>{let n=i.current;if(!n)return;let r=window.devicePixelRatio||1,s=.5,c=Math.floor(e*s),l=Math.floor(t*s);n.width=e*r,n.height=t*r;let u=n.getContext(`2d`);if(!u)return;u.setTransform(r,0,0,r,0,0);let d=document.createElement(`canvas`);d.width=c,d.height=l;let f=d.getContext(`2d`);if(!f)return;let p=(e,t)=>{let r=n.getBoundingClientRect();o.current={x:e-r.left,y:t-r.top,active:!0}},m=()=>{o.current.active=!1},h=e=>p(e.clientX,e.clientY),g=e=>{e.touches[0]&&p(e.touches[0].clientX,e.touches[0].clientY)};n.addEventListener(`mousemove`,h),n.addEventListener(`mouseleave`,m),n.addEventListener(`touchmove`,g,{passive:!0}),n.addEventListener(`touchend`,m);let y=0,b=document.hidden,x=_(e=>{b=e}),S=()=>{if(y=requestAnimationFrame(S),b)return;let n=a.current,r=o.current;for(let i of n){if(r.active){let e=i.x-r.x,t=i.y-r.y,n=Math.hypot(e,t)||1;if(n<120){let r=(120-n)*.04;i.vx+=e/n*r,i.vy+=t/n*r}}i.vx*=.98,i.vy*=.98,i.x+=i.vx,i.y+=i.vy,i.x-i.r<0?(i.x=i.r,i.vx*=-.8):i.x+i.r>e&&(i.x=e-i.r,i.vx*=-.8),i.y-i.r<0?(i.y=i.r,i.vy*=-.8):i.y+i.r>t&&(i.y=t-i.r,i.vy*=-.8)}for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++){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)*.55;if(s<c){let e=a/s,t=o/s,n=c-s;r.x-=e*n*.5,r.y-=t*n*.5,i.x+=e*n*.5,i.y+=t*n*.5}}let i=f.createImageData(c,l),p=i.data;for(let e=0;e<l;e++)for(let t=0;t<c;t++){let r=t/s,i=e/s,a=0;for(let e of n){let t=r-e.x,n=i-e.y,o=t*t+n*n;a+=e.r*e.r/(o+1)}let o=(e*c+t)*4;a>1?(p[o]=56+v((a-1)*.8,0,1)*40,p[o+1]=189,p[o+2]=248,p[o+3]=255):p[o+3]=0}f.putImageData(i,0,0),u.fillStyle=`#0f172a`,u.fillRect(0,0,e,t),u.save(),u.filter=`blur(8px)`,u.drawImage(d,0,0,e,t),u.restore(),u.globalCompositeOperation=`lighter`,u.drawImage(d,0,0,e,t),u.globalCompositeOperation=`source-over`;for(let e of n){let t=u.createRadialGradient(e.x-e.r*.3,e.y-e.r*.3,0,e.x,e.y,e.r*.6);t.addColorStop(0,`rgba(255,255,255,0.5)`),t.addColorStop(1,`rgba(56,189,248,0)`),u.beginPath(),u.arc(e.x,e.y,e.r*.5,0,Math.PI*2),u.fillStyle=t,u.fill()}};return S(),()=>{cancelAnimationFrame(y),x(),n.removeEventListener(`mousemove`,h),n.removeEventListener(`mouseleave`,m),n.removeEventListener(`touchmove`,g),n.removeEventListener(`touchend`,m)}},[r,t,e]),(0,l.jsx)(`div`,{className:Ge.metaballPool,style:{width:e,height:t,"--pool-color":r},children:(0,l.jsx)(`canvas`,{ref:i,className:Ge.canvas,style:{width:e,height:t}})})},qe={mazeGenerator:`cos-mazeGenerator-QEa0s`,canvas:`cos-canvas-emhxb`},Je=({width:e=400,height:t=300,cellSize:n=20,onGenerated:r})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)(r);return(0,c.useEffect)(()=>{a.current=r},[r]),(0,c.useEffect)(()=>{let r=i.current;if(!r)return;let o=window.devicePixelRatio||1;r.width=e*o,r.height=t*o;let s=r.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=Math.floor(e/n),l=Math.floor(t/n),u=Array.from({length:l},()=>Array.from({length:c},()=>({top:!0,right:!0,bottom:!0,left:!0,visited:!1}))),d=[[0,0]];u[0][0].visited=!0;let f=[[0,-1,`top`],[1,0,`right`],[0,1,`bottom`],[-1,0,`left`]],p={top:`bottom`,right:`left`,bottom:`top`,left:`right`};for(;d.length;){let[e,t]=d[d.length-1],n=f.map(([n,r,i])=>{let a=e+n,o=t+r;return a<0||o<0||a>=c||o>=l||u[o][a].visited?null:{nx:a,ny:o,wall:i}}).filter(Boolean);if(!n.length){d.pop();continue}let r=n[Math.floor(Math.random()*n.length)];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])}a.current?.(c,l);let m=0,h=0,g=c*l*2,v=document.hidden,y=_(e=>{v=e}),b=()=>{if(v){m=requestAnimationFrame(b);return}h=Math.min(g,h+2),s.fillStyle=`#0f172a`,s.fillRect(0,0,e,t),s.strokeStyle=`#38bdf8`,s.lineWidth=1.5,s.shadowColor=`#38bdf8`,s.shadowBlur=4;let r=0;for(let e=0;e<l;e++)for(let t=0;t<c;t++){let i=u[e][t],a=t*n,o=e*n;i.top&&r++<h&&(s.beginPath(),s.moveTo(a,o),s.lineTo(a+n,o),s.stroke()),i.right&&r++<h&&(s.beginPath(),s.moveTo(a+n,o),s.lineTo(a+n,o+n),s.stroke()),e===l-1&&i.bottom&&r++<h&&(s.beginPath(),s.moveTo(a,o+n),s.lineTo(a+n,o+n),s.stroke()),t===0&&i.left&&r++<h&&(s.beginPath(),s.moveTo(a,o),s.lineTo(a,o+n),s.stroke())}s.shadowBlur=0,h<g&&(m=requestAnimationFrame(b))};return b(),()=>{cancelAnimationFrame(m),y()}},[n,t,e]),(0,l.jsx)(`div`,{className:qe.mazeGenerator,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:qe.canvas,style:{width:e,height:t}})})},Ye={meteorRain:`cos-meteorRain-v8RNI`,canvas:`cos-canvas-hyFMr`},Xe=({width:e=800,height:t=500,meteorCount:n=8})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)([]),a=(0,c.useRef)(0);return(0,c.useEffect)(()=>{i.current=Array.from({length:n},()=>({x:Math.random()*e,y:Math.random()*t*.5,length:Math.random()*60+40,speed:Math.random()*6+4,opacity:Math.random()*.5+.3}))},[t,n,e]),(0,c.useEffect)(()=>{let n=r.current;if(!n)return;let o=window.devicePixelRatio||1;n.width=e*o,n.height=t*o;let s=n.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=document.hidden,l=_(e=>{c=e}),u=()=>{a.current=requestAnimationFrame(u),!c&&(s.fillStyle=`rgb(15 23 42 / 15%)`,s.fillRect(0,0,e,t),i.current.forEach(n=>{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);let r=n.x-n.length,i=n.y-n.length*.6;s.beginPath(),s.strokeStyle=`rgb(255 255 255 / ${n.opacity})`,s.lineWidth=2,s.moveTo(n.x,n.y),s.lineTo(r,i),s.stroke(),s.beginPath(),s.fillStyle=`rgb(255 255 255 / ${Math.min(1,n.opacity+.2)})`,s.arc(n.x,n.y,1.5,0,Math.PI*2),s.fill()}))};return u(),()=>{cancelAnimationFrame(a.current),l()}},[t,e]),(0,l.jsx)(`div`,{className:Ye.meteorRain,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:Ye.canvas,style:{width:e,height:t}})})},B={neonText:`cos-neonText-JMP7i`,text:`cos-text-GTO-0`,flicker:`cos-flicker-nXceV`,"neon-flicker":`cos-neon-flicker-uDkmM`,reflection:`cos-reflection-aEYj6`},Ze=({text:e=`NEON`,color:t=`#ff00de`,fontSize:n=72,flicker:r=!0})=>(0,l.jsxs)(`div`,{className:B.neonText,children:[(0,l.jsx)(`h1`,{className:`${B.text} ${r?B.flicker:``}`,style:{fontSize:n,"--neon-color":t},children:e}),(0,l.jsx)(`p`,{className:B.reflection,style:{fontSize:n*.35,color:t},children:e})]}),Qe={newtonCradle:`cos-newtonCradle-mFl-b`,canvas:`cos-canvas-TWKl5`},$e=({ballCount:e=5,color:t=`#38bdf8`,width:n=280,height:r=200})=>{let i=(0,c.useRef)(null),a=Math.max(2,Math.min(e,7));return(0,c.useEffect)(()=>{let e=i.current;if(!e)return;let o=window.devicePixelRatio||1;e.width=n*o,e.height=r*o;let s=e.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=r-28-28,l=(a-1)*28,u=(n-l)/2,d=1/60,f=Array.from({length:a},()=>({theta:0,omega:0}));f[0].theta=-.52;let p=`left`,m=e=>u+e*28,h=e=>{let t=f[e];return{x:m(e)+c*Math.sin(t.theta),y:16+c*Math.cos(t.theta)}},g=e=>{p===`left`&&(p=`right`,f[0].omega=0,f[0].theta=0,f[a-1].omega=Math.abs(e))},v=e=>{p===`right`&&(p=`left`,f[a-1].omega=0,f[a-1].theta=0,f[0].omega=-Math.abs(e))},y=()=>{let e=h(0),t=h(1);if(e.x+14>=t.x-14-.5&&f[0].omega>.02){g(f[0].omega);return}let n=h(a-1),r=h(a-2);n.x-14<=r.x+14+.5&&f[a-1].omega<-.02&&v(f[a-1].omega)},b=0,x=document.hidden,S=_(e=>{x=e}),C=()=>{if(b=requestAnimationFrame(C),!x){for(let e=0;e<a;e++){let t=f[e];if(Math.abs(t.omega)<1e-5&&Math.abs(t.theta)<1e-5)continue;let n=-(980/c)*Math.sin(t.theta);t.omega+=n*d,t.omega*=.9998,t.theta+=t.omega*d}y();for(let e=1;e<a-1;e++)f[e].theta=0,f[e].omega=0;s.fillStyle=`#0f172a`,s.fillRect(0,0,n,r),s.strokeStyle=`#475569`,s.lineWidth=3,s.beginPath(),s.moveTo(u-14,16),s.lineTo(u+l+14,16),s.stroke();for(let e=0;e<a;e++){let n=m(e),{x:r,y:i}=h(e);s.beginPath(),s.moveTo(n,16),s.lineTo(r,i),s.strokeStyle=`#64748b`,s.lineWidth=2,s.stroke(),s.beginPath(),s.arc(r,i,14,0,Math.PI*2);let a=s.createRadialGradient(r-14*.3,i-14*.3,0,r,i,14);a.addColorStop(0,`#fff`),a.addColorStop(.35,t),a.addColorStop(1,t),s.fillStyle=a,s.shadowColor=t,s.shadowBlur=6,s.fill(),s.shadowBlur=0}}};return C(),()=>{cancelAnimationFrame(b),S()}},[t,a,r,n]),(0,l.jsx)(`div`,{className:Qe.newtonCradle,style:{width:n,height:r,"--ball-color":t},children:(0,l.jsx)(`canvas`,{ref:i,className:Qe.canvas,style:{width:n,height:r}})})},V={orbitalChart:`cos-orbitalChart-XLORB`,canvas:`cos-canvas-hGVud`,legend:`cos-legend-Np9Mm`,swatch:`cos-swatch-xEKvA`},et=[{label:`A`,value:30,color:`#38bdf8`},{label:`B`,value:25,color:`#a78bfa`},{label:`C`,value:20,color:`#f472b6`},{label:`D`,value:25,color:`#4ade80`}],tt=({data:e=et,size:t=240})=>{let n=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let r=n.current;if(!r||e.length===0)return;let i=window.devicePixelRatio||1;r.width=t*i,r.height=t*i;let a=r.getContext(`2d`);if(!a)return;a.setTransform(i,0,0,i,0,0);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=_(e=>{f=e}),m=()=>{if(u=requestAnimationFrame(m),f)return;d+=.012,a.fillStyle=`#0f172a`,a.fillRect(0,0,t,t),e.forEach((e,t)=>{let n=l*(t+1),r=e.value/o,i=v(Math.round(r*12)+1,1,16),u=.4+t*.15;a.beginPath(),a.arc(s,c,n,0,Math.PI*2),a.strokeStyle=`rgb(148 163 184 / 15%)`,a.lineWidth=1,a.stroke();for(let t=0;t<i;t++){let r=d*u+t/i*Math.PI*2,o=s+Math.cos(r)*n,l=c+Math.sin(r)*n;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}});let n=e.reduce((e,t)=>t.value>e.value?t:e,e[0]),r=Math.round(n.value/o*100);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)};return m(),()=>{cancelAnimationFrame(u),p()}},[e,t]),(0,l.jsxs)(`div`,{className:V.orbitalChart,style:{width:t,height:t},children:[(0,l.jsx)(`canvas`,{ref:n,className:V.canvas,style:{width:t,height:t}}),(0,l.jsx)(`ul`,{className:V.legend,children:e.map(e=>(0,l.jsxs)(`li`,{children:[(0,l.jsx)(`span`,{className:V.swatch,style:{background:e.color}}),e.label,` (`,e.value,`)`]},e.label))})]})},nt={particleNetwork:`cos-particleNetwork-GSZq-`,canvas:`cos-canvas-E-BGP`,hint:`cos-hint-LEO5o`},rt=({width:e=800,height:t=500,particleCount:n=60,linkDistance:r=120,repelRadius:i=150,color:a=`#38bdf8`})=>{let o=(0,c.useRef)(null),s=(0,c.useRef)([]),u=(0,c.useRef)({x:-1e3,y:-1e3}),d=(0,c.useCallback)(()=>{s.current=Array.from({length:n},()=>({x:Math.random()*e,y:Math.random()*t,vx:(Math.random()-.5)*1.2,vy:(Math.random()-.5)*1.2,radius:Math.random()*2+1}))},[t,n,e]);(0,c.useEffect)(()=>{d()},[d]),(0,c.useEffect)(()=>{let n=o.current;if(!n)return;let c=window.devicePixelRatio||1;n.width=e*c,n.height=t*c;let l=n.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let d=0,f=document.hidden,p=_(e=>{f=e}),m=()=>{if(f){d=requestAnimationFrame(m);return}l.fillStyle=`#0f172a`,l.fillRect(0,0,e,t);let n=s.current,o=u.current,c=i*i;n.forEach(n=>{n.x+=n.vx,n.y+=n.vy,(n.x<0||n.x>e)&&(n.vx*=-1),(n.y<0||n.y>t)&&(n.vy*=-1);let r=o.x-n.x,i=o.y-n.y,a=r*r+i*i;if(a<c&&a>0){let e=Math.sqrt(a);n.vx-=r/e*.15,n.vy-=i/e*.15}});for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++){let i=n[e].x-n[t].x,o=n[e].y-n[t].y,s=i*i+o*o;if(s<r*r){let i=Math.sqrt(s);l.beginPath(),l.moveTo(n[e].x,n[e].y),l.lineTo(n[t].x,n[t].y),l.strokeStyle=a,l.globalAlpha=1-i/r,l.lineWidth=.8,l.stroke(),l.globalAlpha=1}}n.forEach(e=>{l.beginPath(),l.arc(e.x,e.y,e.radius,0,Math.PI*2),l.fillStyle=a,l.fill()}),d=requestAnimationFrame(m)};return m(),()=>{cancelAnimationFrame(d),p()}},[a,t,d,r,i,e]);let f=(e,t,n)=>{u.current={x:e-n.left,y:t-n.top}},p=e=>{f(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())},m=e=>{let t=e.touches[0];t&&f(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},h=()=>{u.current={x:-1e3,y:-1e3}};return(0,l.jsxs)(`div`,{className:nt.particleNetwork,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:o,className:nt.canvas,style:{width:e,height:t},onMouseMove:p,onMouseLeave:h,onTouchMove:m,onTouchEnd:h}),(0,l.jsx)(`p`,{className:nt.hint,children:`移动鼠标或手指与粒子互动`})]})},it={plasmaBall:`cos-plasmaBall-xGHSj`,canvas:`cos-canvas-V1CgL`},at=({width:e=320,height:t=320,color:n=`#a78bfa`,arcCount:r=8})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)({x:e/2,y:t/2,active:!1}),o=(0,c.useRef)([]);return(0,c.useEffect)(()=>{o.current=Array.from({length:r},(e,t)=>({angle:t/r*Math.PI*2,length:.6+Math.random()*.35,speed:.02+Math.random()*.03}))},[r]),(0,c.useEffect)(()=>{let r=i.current;if(!r)return;let s=window.devicePixelRatio||1;r.width=e*s,r.height=t*s;let c=r.getContext(`2d`);if(!c)return;c.setTransform(s,0,0,s,0,0);let l=e/2,u=t/2,d=Math.min(e,t)*.38,f=(e,t)=>{let n=r.getBoundingClientRect();a.current={x:e-n.left,y:t-n.top,active:!0}},p=()=>{a.current.active=!1},m=e=>f(e.clientX,e.clientY),h=e=>{e.touches[0]&&f(e.touches[0].clientX,e.touches[0].clientY)};r.addEventListener(`mousemove`,m),r.addEventListener(`mouseleave`,p),r.addEventListener(`touchmove`,h,{passive:!0}),r.addEventListener(`touchend`,p);let g=0,v=document.hidden,y=_(e=>{v=e}),b=(e,t,n,r,i,a)=>{if(a<=0)return[[e,t],[n,r]];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=b(e,t,o+f,s+p,i*.55,a-1),h=b(o+f,s+p,n,r,i*.55,a-1);return[...m.slice(0,-1),...h]},x=()=>{if(g=requestAnimationFrame(x),v)return;let r=a.current,i=o.current;c.fillStyle=`#0f172a`,c.fillRect(0,0,e,t);let s=c.createRadialGradient(l,u,d*.1,l,u,d*1.1);s.addColorStop(0,`rgba(30, 41, 59, 0.9)`),s.addColorStop(.7,`rgba(15, 23, 42, 0.6)`),s.addColorStop(1,`rgba(15, 23, 42, 0)`),c.beginPath(),c.arc(l,u,d*1.05,0,Math.PI*2),c.fillStyle=s,c.fill(),c.beginPath(),c.arc(l,u,d,0,Math.PI*2),c.strokeStyle=`rgba(148, 163, 184, 0.35)`,c.lineWidth=2,c.stroke(),i.forEach(e=>{e.angle+=e.speed*(Math.random()>.5?1:-1);let t=r.active?Math.atan2(r.y-u,r.x-l)+(e.angle-Math.PI)*.15:e.angle,i=d*e.length,a=b(l,u,l+Math.cos(t)*i,u+Math.sin(t)*i,18,4);c.beginPath(),a.forEach(([e,t],n)=>n===0?c.moveTo(e,t):c.lineTo(e,t)),c.strokeStyle=n,c.lineWidth=1.5,c.shadowColor=n,c.shadowBlur=14,c.globalAlpha=.85,c.stroke(),c.shadowBlur=0,c.globalAlpha=1}),c.beginPath(),c.arc(l,u,10,0,Math.PI*2);let f=c.createRadialGradient(l,u,0,l,u,10);f.addColorStop(0,`#fff`),f.addColorStop(.5,n),f.addColorStop(1,n),c.fillStyle=f,c.shadowColor=n,c.shadowBlur=20,c.fill(),c.shadowBlur=0};return x(),()=>{cancelAnimationFrame(g),y(),r.removeEventListener(`mousemove`,m),r.removeEventListener(`mouseleave`,p),r.removeEventListener(`touchmove`,h),r.removeEventListener(`touchend`,p)}},[r,n,t,e]),(0,l.jsx)(`div`,{className:it.plasmaBall,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:it.canvas,style:{width:e,height:t}})})},ot={smokeFog:`cos-smokeFog-SYlts`,canvas:`cos-canvas-iOJV7`},st=({width:e=800,height:t=500,density:n=.5})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)([]),a=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let r=Math.floor(20+n*40);i.current=Array.from({length:r},()=>({x:Math.random()*e,y:Math.random()*t,radius:Math.random()*80+40,vx:(Math.random()-.5)*.4,vy:(Math.random()-.5)*.3-.1,alpha:Math.random()*.15+.05}))},[n,t,e]),(0,c.useEffect)(()=>{let n=r.current;if(!n)return;let o=window.devicePixelRatio||1;n.width=e*o,n.height=t*o;let s=n.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=0,l=document.hidden,u=_(e=>{l=e}),d=()=>{if(a.current=requestAnimationFrame(d),l)return;c+=.008,s.fillStyle=`#1a1a2e`,s.fillRect(0,0,e,t);let n=s.createRadialGradient(e*.5,t*.3,0,e*.5,t*.5,e*.7);n.addColorStop(0,`#2d2d44`),n.addColorStop(1,`#1a1a2e`),s.fillStyle=n,s.fillRect(0,0,e,t),i.current.forEach((n,r)=>{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);let i=s.createRadialGradient(n.x,n.y,0,n.x,n.y,n.radius);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)`),s.fillStyle=i,s.beginPath(),s.arc(n.x,n.y,n.radius,0,Math.PI*2),s.fill()})};return d(),()=>{cancelAnimationFrame(a.current),u()}},[t,e]),(0,l.jsx)(`div`,{className:ot.smokeFog,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:ot.canvas,style:{width:e,height:t}})})},ct={solarSystem:`cos-solarSystem-27h8F`,canvas:`cos-canvas-C0nRa`},lt=[{name:`Mercury`,radius:0,orbit:42,speed:4.8,color:`#94a3b8`,size:3},{name:`Venus`,radius:0,orbit:58,speed:3.5,color:`#fbbf24`,size:5},{name:`Earth`,radius:0,orbit:78,speed:3,color:`#38bdf8`,size:5},{name:`Mars`,radius:0,orbit:98,speed:2.4,color:`#f87171`,size:4},{name:`Jupiter`,radius:0,orbit:130,speed:1.6,color:`#fb923c`,size:12},{name:`Saturn`,radius:0,orbit:160,speed:1.2,color:`#fcd34d`,size:10},{name:`Moon`,radius:0,orbit:14,speed:8,color:`#cbd5e1`,size:2,parent:2}],ut=({width:e=400,height:t=400,speed:n=1,showOrbits:r=!0})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)([]);return(0,c.useEffect)(()=>{a.current=lt.map(e=>({...e,angle:Math.random()*Math.PI*2})),o.current=Array.from({length:80},()=>({x:Math.random(),y:Math.random(),alpha:Math.random()*.6}))},[]),(0,c.useEffect)(()=>{let s=i.current;if(!s)return;let c=window.devicePixelRatio||1;s.width=e*c,s.height=t*c;let l=s.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=e/2,d=t/2,f=Math.min(e,t)/380,p=0,m=document.hidden,h=_(e=>{m=e}),g=()=>{if(p=requestAnimationFrame(g),m)return;let i=a.current,s=[];l.fillStyle=`#0f172a`,l.fillRect(0,0,e,t),o.current.forEach(n=>{l.fillStyle=`rgba(255,255,255,${n.alpha})`,l.fillRect(n.x*e,n.y*t,1,1)}),l.beginPath(),l.arc(u,d,18*f,0,Math.PI*2);let c=l.createRadialGradient(u,d,0,u,d,18*f);c.addColorStop(0,`#fef08a`),c.addColorStop(.5,`#fbbf24`),c.addColorStop(1,`#f97316`),l.fillStyle=c,l.shadowColor=`#fbbf24`,l.shadowBlur=24,l.fill(),l.shadowBlur=0,i.forEach((e,t)=>{e.angle+=e.speed*.008*n/Math.sqrt(e.orbit);let i=u,a=d;e.parent!==void 0&&s[e.parent]&&(i=s[e.parent].x,a=s[e.parent].y);let o=e.orbit*f,c=i+Math.cos(e.angle)*o,p=a+Math.sin(e.angle)*o;if(s[t]={x:c,y:p},r&&e.parent===void 0&&(l.beginPath(),l.arc(i,a,o,0,Math.PI*2),l.strokeStyle=`rgba(148, 163, 184, 0.15)`,l.lineWidth=1,l.stroke()),e.name===`Saturn`&&(l.beginPath(),l.ellipse(c,p,e.size*f*1.8,e.size*f*.5,e.angle*.3,0,Math.PI*2),l.strokeStyle=`rgba(252, 211, 77, 0.5)`,l.lineWidth=1.5,l.stroke()),l.beginPath(),l.arc(c,p,e.size*f,0,Math.PI*2),l.fillStyle=e.color,e.name===`Earth`){let t=l.createRadialGradient(c-2,p-2,0,c,p,e.size*f);t.addColorStop(0,`#4ade80`),t.addColorStop(.6,e.color),t.addColorStop(1,`#1d4ed8`),l.fillStyle=t}l.fill()})};return g(),()=>{cancelAnimationFrame(p),h()}},[t,r,n,e]),(0,l.jsx)(`div`,{className:ct.solarSystem,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:ct.canvas,style:{width:e,height:t}})})},dt={snowfall:`cos-snowfall-Q-Dhg`,canvas:`cos-canvas-bJVF8`},ft=({width:e=800,height:t=500,mode:n=`snow`,count:r=120})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)(0),s=(0,c.useCallback)(r=>({x:Math.random()*e,y:r??Math.random()*t,size:n===`sakura`?Math.random()*6+4:Math.random()*3+1,speed:Math.random()*1.5+.5,drift:(Math.random()-.5)*.8,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.04,opacity:Math.random()*.6+.4}),[t,n,e]);return(0,c.useEffect)(()=>{a.current=Array.from({length:r},()=>s())},[r,s]),(0,c.useEffect)(()=>{let r=i.current;if(!r)return;let c=window.devicePixelRatio||1;r.width=e*c,r.height=t*c;let l=r.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=document.hidden,d=_(e=>{u=e}),f=e=>{l.globalAlpha=e.opacity,l.fillStyle=`#fff`,l.beginPath(),l.arc(e.x,e.y,e.size,0,Math.PI*2),l.fill()},p=e=>{l.save(),l.translate(e.x,e.y),l.rotate(e.rotation),l.globalAlpha=e.opacity;let t=e.size;l.fillStyle=`#ffb7c5`,l.beginPath(),l.ellipse(0,0,t,t*.6,0,0,Math.PI*2),l.fill(),l.fillStyle=`#ff8fa3`,l.beginPath(),l.ellipse(t*.3,0,t*.5,t*.35,.5,0,Math.PI*2),l.fill(),l.restore()},m=()=>{o.current=requestAnimationFrame(m),!u&&(l.fillStyle=n===`sakura`?`#1a1020`:`#0f172a`,l.fillRect(0,0,e,t),a.current.forEach(e=>{e.y+=e.speed,e.x+=e.drift+Math.sin(e.y*.02)*.3,e.rotation+=e.rotationSpeed,e.y>t+10&&Object.assign(e,s(-10)),n===`sakura`?p(e):f(e)}),l.globalAlpha=1)};return m(),()=>{cancelAnimationFrame(o.current),d()}},[s,t,n,e]),(0,l.jsx)(`div`,{className:dt.snowfall,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:dt.canvas,style:{width:e,height:t}})})},pt={starfield:`cos-starfield-QTwia`,canvas:`cos-canvas-C2t3g`},mt=({width:e=800,height:t=500,starCount:n=400,speed:r=1})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{a.current=Array.from({length:n},()=>({x:(Math.random()-.5)*e,y:(Math.random()-.5)*t,z:Math.random()*e}))},[t,n,e]),(0,c.useEffect)(()=>{let n=i.current;if(!n)return;let s=window.devicePixelRatio||1;n.width=e*s,n.height=t*s;let c=n.getContext(`2d`);if(!c)return;c.setTransform(s,0,0,s,0,0);let l=e/2,u=t/2,d=document.hidden,f=_(e=>{d=e}),p=()=>{o.current=requestAnimationFrame(p),!d&&(c.fillStyle=`rgb(0 0 0 / 25%)`,c.fillRect(0,0,e,t),a.current.forEach(n=>{n.z-=r*2,n.z<=0&&(n.x=(Math.random()-.5)*e,n.y=(Math.random()-.5)*t,n.z=e);let i=128/n.z,a=n.x*i+l,o=n.y*i+u;if(a<0||a>=e||o<0||o>=t)return;let s=(1-n.z/e)*3,d=(1-n.z/e)*255;if(s>.5){let e=128/(n.z+r*4),t=n.x*e+l,i=n.y*e+u;c.beginPath(),c.strokeStyle=`rgb(${d} ${d} ${d+30})`,c.lineWidth=s,c.moveTo(t,i),c.lineTo(a,o),c.stroke()}else c.fillStyle=`rgb(${d} ${d} ${d+30})`,c.fillRect(a,o,s,s)}))};return p(),()=>{cancelAnimationFrame(o.current),f()}},[t,r,n,e]),(0,l.jsx)(`div`,{className:pt.starfield,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:pt.canvas,style:{width:e,height:t}})})},H={progressChest:`cos-progressChest-Bqcv1`,barWrap:`cos-barWrap-E2pnl`,barTrack:`cos-barTrack-dKLhs`,barFill:`cos-barFill-NZJJe`,pct:`cos-pct-D91IU`,chest:`cos-chest-YebJO`,lid:`cos-lid-K4GSD`,open:`cos-open-eWo0Y`,lidTop:`cos-lidTop-N-p2g`,lock:`cos-lock--0AaQ`,body:`cos-body-iqUt3`,treasure:`cos-treasure-nx-6S`,pop:`cos-pop-uRZvT`,label:`cos-label-61hRe`},ht=({progress:e=0,onOpen:t,label:n=`开启宝箱`})=>{let r=(0,c.useRef)(!1),i=(0,c.useRef)(t),a=v(e,0,100),o=a>=100;return(0,c.useEffect)(()=>{i.current=t},[t]),(0,c.useEffect)(()=>{o&&!r.current&&(r.current=!0,i.current?.()),o||(r.current=!1)},[o]),(0,l.jsxs)(`div`,{className:H.progressChest,children:[(0,l.jsxs)(`div`,{className:H.barWrap,children:[(0,l.jsx)(`div`,{className:H.barTrack,children:(0,l.jsx)(`div`,{className:H.barFill,style:{width:`${a}%`}})}),(0,l.jsxs)(`span`,{className:H.pct,children:[a.toFixed(0),`%`]})]}),(0,l.jsxs)(`div`,{className:`${H.chest} ${o?H.open:``}`,children:[(0,l.jsxs)(`div`,{className:H.lid,children:[(0,l.jsx)(`div`,{className:H.lidTop}),(0,l.jsx)(`div`,{className:H.lock})]}),(0,l.jsx)(`div`,{className:H.body,children:o&&(0,l.jsxs)(`div`,{className:H.treasure,children:[(0,l.jsx)(`span`,{children:`💎`}),(0,l.jsx)(`span`,{children:`✨`}),(0,l.jsx)(`span`,{children:`🪙`})]})})]}),(0,l.jsx)(`p`,{className:H.label,children:o?`宝箱已开启!`:n})]})},gt={radarScan:`cos-radarScan-PZaG8`,canvas:`cos-canvas-fUw5N`},_t=({size:e=300,color:t=`#22d3ee`,blipCount:n=5})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(0),a=(0,c.useRef)([]),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{a.current=Array.from({length:n},()=>({angle:Math.random()*Math.PI*2,dist:Math.random()*.7+.15,alpha:Math.random()*.5+.5}))},[n]),(0,c.useEffect)(()=>{let n=r.current;if(!n)return;let s=window.devicePixelRatio||1;n.width=e*s,n.height=e*s;let c=n.getContext(`2d`);if(!c)return;c.setTransform(s,0,0,s,0,0);let l=e/2,u=e/2,d=e/2-10,f=document.hidden,p=_(e=>{f=e}),m=()=>{if(o.current=requestAnimationFrame(m),f)return;i.current+=.03,c.fillStyle=`rgb(15 23 42 / 25%)`,c.fillRect(0,0,e,e);for(let e=1;e<=4;e++)c.beginPath(),c.arc(l,u,d/4*e,0,Math.PI*2),c.strokeStyle=`${t}33`,c.lineWidth=1,c.stroke();c.beginPath(),c.moveTo(l,u-d),c.lineTo(l,u+d),c.moveTo(l-d,u),c.lineTo(l+d,u),c.strokeStyle=`${t}44`,c.stroke();let n=i.current,r=c.createConicGradient(n-.5,l,u);r.addColorStop(0,`transparent`),r.addColorStop(.15,`${t}66`),r.addColorStop(.3,`transparent`),c.beginPath(),c.moveTo(l,u),c.arc(l,u,d,n-.5,n),c.closePath(),c.fillStyle=r,c.fill(),c.beginPath(),c.moveTo(l,u),c.lineTo(l+Math.cos(n)*d,u+Math.sin(n)*d),c.strokeStyle=t,c.lineWidth=2,c.stroke(),a.current.forEach(e=>{let r=e.angle,i=l+Math.cos(r)*d*e.dist,a=u+Math.sin(r)*d*e.dist;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),c.beginPath(),c.arc(i,a,4,0,Math.PI*2),c.fillStyle=t,c.globalAlpha=e.alpha,c.fill(),c.globalAlpha=1}),c.beginPath(),c.arc(l,u,d,0,Math.PI*2),c.strokeStyle=t,c.lineWidth=2,c.stroke()};return m(),()=>{cancelAnimationFrame(o.current),p()}},[n,t,e]),(0,l.jsx)(`div`,{className:gt.radarScan,style:{width:e,height:e},children:(0,l.jsx)(`canvas`,{ref:r,className:gt.canvas,style:{width:e,height:e}})})},U={redPacketRain:`cos-redPacketRain-eJ7FW`,canvas:`cos-canvas-direH`,hud:`cos-hud-InqMq`,end:`cos-end-u0J7o`,hint:`cos-hint-sO6ld`},vt=({duration:e=1e4,onGrab:t})=>{let n=(0,c.useRef)(null),r=(0,c.useRef)([]),i=(0,c.useRef)(0),a=(0,c.useRef)(0),o=(0,c.useRef)(0),[s,u]=(0,c.useState)(0),[d,f]=(0,c.useState)(!0),p=(0,c.useRef)(!0),m=(0,c.useRef)(t);(0,c.useEffect)(()=>{m.current=t},[t]),(0,c.useEffect)(()=>{p.current=d},[d]);let h=(0,c.useCallback)(()=>{r.current.push({id:a.current++,x:Math.random()*350+25,y:-60,speed:Math.random()*2+2,rotation:(Math.random()-.5)*.1,amount:[1,2,5,8,10,18,66,88][Math.floor(Math.random()*8)],grabbed:!1})},[]);return(0,c.useEffect)(()=>{let t=n.current;if(!t)return;let a=window.devicePixelRatio||1;t.width=400*a,t.height=500*a;let s=t.getContext(`2d`);if(!s)return;s.setTransform(a,0,0,a,0,0);let c=document.hidden,l=_(e=>{c=e}),u=window.setTimeout(()=>{p.current=!1,f(!1)},e),d=()=>{i.current=requestAnimationFrame(d),!c&&(o.current++,p.current&&o.current%20==0&&h(),s.fillStyle=`rgb(15 23 42 / 20%)`,s.fillRect(0,0,400,500),r.current=r.current.filter(e=>e.grabbed?!1:(e.y+=e.speed,e.x+=Math.sin(e.y*.02)*.5,s.save(),s.translate(e.x,e.y),s.rotate(e.rotation),s.fillStyle=`#dc2626`,s.beginPath(),s.roundRect(-22,-28,44,56,6),s.fill(),s.fillStyle=`#fbbf24`,s.beginPath(),s.arc(0,-10,8,0,Math.PI*2),s.fill(),s.fillStyle=`#fde68a`,s.font=`bold 12px system-ui`,s.textAlign=`center`,s.fillText(`¥${e.amount}`,0,12),s.restore(),e.y<560)))};return d(),()=>{cancelAnimationFrame(i.current),clearTimeout(u),l()}},[e,h]),(0,l.jsxs)(`div`,{className:U.redPacketRain,children:[(0,l.jsx)(`canvas`,{ref:n,className:U.canvas,style:{width:400,height:500},onClick:e=>{let t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left,i=e.clientY-t.top,a=!1;r.current=r.current.map(e=>e.grabbed||a?e:Math.abs(n-e.x)<30&&Math.abs(i-e.y)<35?(a=!0,u(t=>t+e.amount),m.current?.(e.amount),{...e,grabbed:!0}):e)}}),(0,l.jsxs)(`div`,{className:U.hud,children:[(0,l.jsxs)(`span`,{children:[`已抢: ¥`,s]}),!d&&(0,l.jsx)(`span`,{className:U.end,children:`红包雨结束`})]}),(0,l.jsx)(`p`,{className:U.hint,children:`点击红包抢夺`})]})},W={returnCityContainer:`cos-returnCityContainer-6XTxj`,star:`cos-star-a59Dx`,glassWrap:`cos-glassWrap-golMO`,rotate:`cos-rotate-7X9Jj`,glassItem:`cos-glassItem-OwlFI`},yt=({starCount:e,glassCount:t=8,glassRadius:n=150})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let a=r.current,o=i.current;if(!a||!o)return;let s=[],c=[],l=[],{width:u,height:d}=a.getBoundingClientRect(),f=e??Math.max(20,Math.floor(u/20));for(let e=0;e<f;e++){let e=window.setTimeout(()=>{let e=document.createElement(`div`);e.className=W.star,e.style.top=`${Math.random()*d}px`,e.style.left=`${Math.random()*u}px`,a.append(e),c.push(e)},Math.random()*2e3);s.push(e)}for(let e=0;e<t;e++){let r=document.createElement(`div`);r.className=W.glassItem,r.style.transform=`rotateY(${360/t*e}deg) translateZ(${n}px)`,o.appendChild(r),l.push(r);let i=window.setTimeout(()=>{r.style.top=`0px`,r.style.opacity=`1`},e*300);s.push(i)}return()=>{s.forEach(clearTimeout),c.forEach(e=>e.remove()),l.forEach(e=>e.remove())}},[e,t,n]),(0,l.jsx)(`div`,{ref:r,className:W.returnCityContainer,children:(0,l.jsx)(`div`,{ref:i,className:W.glassWrap})})},bt={ropeChain:`cos-ropeChain-gYaSK`,canvas:`cos-canvas-5i95N`},xt=({width:e=400,height:t=400,segments:n=16,color:r=`#38bdf8`,gravity:i=.4})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)([]),s=(0,c.useRef)({active:!1,index:-1});return(0,c.useEffect)(()=>{let r=Math.max(4,Math.min(n,30)),i=t*.7/r,a=e/2,s=t*.08;o.current=Array.from({length:r+1},(e,t)=>({x:a,y:s+t*i,prevX:a,prevY:s+t*i,pinned:t===0}))},[t,n,e]),(0,c.useEffect)(()=>{let c=a.current;if(!c)return;let l=window.devicePixelRatio||1;c.width=e*l,c.height=t*l;let u=c.getContext(`2d`);if(!u)return;u.setTransform(l,0,0,l,0,0);let d=Math.max(4,Math.min(n,30)),f=t*.7/d,p=(e,t)=>{let n=o.current,r=-1,i=30;return n.forEach((n,a)=>{let o=Math.hypot(n.x-e,n.y-t);o<i&&(i=o,r=a)}),r},m=(e,t)=>{let n=c.getBoundingClientRect(),r=e-n.left,i=t-n.top,a=p(r,i);if(a>=0){s.current={active:!0,index:a};let e=o.current[a];e.x=r,e.y=i,e.prevX=r,e.prevY=i}},h=(e,t)=>{if(!s.current.active)return;let n=c.getBoundingClientRect(),r=o.current[s.current.index];r.x=e-n.left,r.y=t-n.top},g=()=>{s.current={active:!1,index:-1}},v=e=>m(e.clientX,e.clientY),y=e=>h(e.clientX,e.clientY),b=e=>{e.touches[0]&&m(e.touches[0].clientX,e.touches[0].clientY)},x=e=>{e.touches[0]&&h(e.touches[0].clientX,e.touches[0].clientY)};c.addEventListener(`mousedown`,v),c.addEventListener(`mousemove`,y),window.addEventListener(`mouseup`,g),c.addEventListener(`touchstart`,b,{passive:!0}),c.addEventListener(`touchmove`,x,{passive:!0}),window.addEventListener(`touchend`,g);let S=0,C=document.hidden,w=_(e=>{C=e}),T=()=>{if(S=requestAnimationFrame(T),C)return;let n=o.current,a=s.current;for(let e of n){if(e.pinned||a.active&&n.indexOf(e)===a.index)continue;let t=(e.x-e.prevX)*.99,r=(e.y-e.prevY)*.99;e.prevX=e.x,e.prevY=e.y,e.x+=t,e.y+=r,e.y+=i}for(let e=0;e<6;e++)for(let e=0;e<n.length-1;e++){let t=n[e],r=n[e+1],i=r.x-t.x,o=r.y-t.y,s=Math.hypot(i,o)||.001,c=(s-f)/s,l=i*c*.5,u=o*c*.5;!t.pinned&&!(a.active&&e===a.index)&&(t.x+=l,t.y+=u),!r.pinned&&!(a.active&&e+1===a.index)&&(r.x-=l,r.y-=u)}u.fillStyle=`#0f172a`,u.fillRect(0,0,e,t),u.beginPath(),n.forEach((e,t)=>t===0?u.moveTo(e.x,e.y):u.lineTo(e.x,e.y)),u.strokeStyle=r,u.lineWidth=3,u.lineCap=`round`,u.lineJoin=`round`,u.shadowColor=r,u.shadowBlur=8,u.stroke(),u.shadowBlur=0,n.forEach((e,t)=>{(t===0||t===n.length-1||t%4==0)&&(u.beginPath(),u.arc(e.x,e.y,t===0?6:4,0,Math.PI*2),u.fillStyle=t===0?`#94a3b8`:r,u.fill())})};return T(),()=>{cancelAnimationFrame(S),w(),c.removeEventListener(`mousedown`,v),c.removeEventListener(`mousemove`,y),window.removeEventListener(`mouseup`,g),c.removeEventListener(`touchstart`,b),c.removeEventListener(`touchmove`,x),window.removeEventListener(`touchend`,g)}},[r,i,t,n,e]),(0,l.jsx)(`div`,{className:bt.ropeChain,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:bt.canvas,style:{width:e,height:t}})})},G={speedometer:`cos-speedometer-INc7F`,svg:`cos-svg-HG-lE`,track:`cos-track-5-922`,valueArc:`cos-valueArc-eJn3E`,tick:`cos-tick-vaiJh`,needle:`cos-needle-PwRAD`,hub:`cos-hub-4WaHw`,valueText:`cos-valueText--q4Xi`,label:`cos-label-hOPy1`},K=(e,t,n,r)=>{let i=(r-90)*Math.PI/180;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}},St=({value:e=0,max:t=100,label:n=`SPEED`,color:r=`#f97316`})=>{let i=-120+v(t>0?e/t:0,0,1)*240,a=(0,c.useMemo)(()=>{let e=K(100,100,72,-120),t=K(100,100,72,120);return`M ${e.x} ${e.y} A 72 72 0 1 1 ${t.x} ${t.y}`},[]),o=(0,c.useMemo)(()=>{let e=K(100,100,72,-120),t=K(100,100,72,i),n=+(i- -120>180);return`M ${e.x} ${e.y} A 72 72 0 ${n} 1 ${t.x} ${t.y}`},[i]),s=K(100,100,58,i);return(0,l.jsxs)(`div`,{className:G.speedometer,style:{"--gauge-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 200 130`,className:G.svg,children:[(0,l.jsx)(`path`,{d:a,className:G.track,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),(0,l.jsx)(`path`,{d:o,className:G.valueArc,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),[-120,-60,0,60,120].map(e=>{let t=K(100,100,58,e),n=K(100,100,66,e);return(0,l.jsx)(`line`,{x1:t.x,y1:t.y,x2:n.x,y2:n.y,className:G.tick},e)}),(0,l.jsx)(`line`,{x1:`100`,y1:`100`,x2:s.x,y2:s.y,className:G.needle}),(0,l.jsx)(`circle`,{cx:`100`,cy:`100`,r:`6`,className:G.hub}),(0,l.jsx)(`text`,{x:`100`,y:`118`,className:G.valueText,children:Math.round(e)})]}),(0,l.jsx)(`span`,{className:G.label,children:n})]})},q={timelinePulse:`cos-timelinePulse-kcBM6`,axis:`cos-axis-9DWis`,track:`cos-track-jG-HV`,progress:`cos-progress-gf7v1`,steps:`cos-steps-Z-40O`,step:`cos-step-UO2Ux`,dot:`cos-dot-HJEVy`,pulse:`cos-pulse-N6FD1`,name:`cos-name-7zefJ`},Ct=({steps:e=[`Start`,`Process`,`Review`,`Done`],current:t=0,color:n=`#22d3ee`})=>{let r=v(t,0,Math.max(0,e.length-1)),i=e.length>1?r/(e.length-1):0;return(0,l.jsx)(`div`,{className:q.timelinePulse,style:{"--pulse-color":n,"--step-count":e.length,"--progress-ratio":i},children:(0,l.jsxs)(`div`,{className:q.axis,children:[(0,l.jsx)(`div`,{className:q.track}),(0,l.jsx)(`div`,{className:q.progress}),(0,l.jsx)(`ul`,{className:q.steps,children:e.map((e,t)=>{let n=t<r?`done`:t===r?`current`:`pending`;return(0,l.jsxs)(`li`,{className:q.step,"data-state":n,children:[(0,l.jsx)(`span`,{className:q.dot}),(0,l.jsx)(`span`,{className:q.name,children:e})]},e+t)})})]})})},wt={rippleWater:`cos-rippleWater-wsinI`,canvas:`cos-canvas-XOdSF`,hint:`cos-hint-0JH5D`},Tt=({width:e=800,height:t=500,color:n=`#38bdf8`})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)([]),a=(0,c.useRef)(0),o=(0,c.useCallback)((n,a)=>{let o=r.current;if(!o)return;let s=o.getBoundingClientRect(),c=n-s.left,l=a-s.top,u=Math.max(e,t)*.45;i.current.push({x:c,y:l,radius:0,maxRadius:u,alpha:.7})},[t,e]);return(0,c.useEffect)(()=>{let e=r.current;if(!e)return;let t=e=>o(e.clientX,e.clientY),n=e=>{let t=e.touches[0];t&&o(t.clientX,t.clientY)};return e.addEventListener(`click`,t),e.addEventListener(`touchstart`,n,{passive:!0}),()=>{e.removeEventListener(`click`,t),e.removeEventListener(`touchstart`,n)}},[o]),(0,c.useEffect)(()=>{let o=r.current;if(!o)return;let s=window.devicePixelRatio||1;o.width=e*s,o.height=t*s;let c=o.getContext(`2d`);if(!c)return;c.setTransform(s,0,0,s,0,0);let l=document.hidden,u=_(e=>{l=e}),d=()=>{if(a.current=requestAnimationFrame(d),l)return;c.fillStyle=`#0c1929`,c.fillRect(0,0,e,t);let r=c.createLinearGradient(0,0,0,t);r.addColorStop(0,`#0f2744`),r.addColorStop(1,`#061018`),c.fillStyle=r,c.fillRect(0,0,e,t),i.current=i.current.filter(e=>(e.radius+=2.5,e.alpha-=.012,e.alpha<=0?!1:(c.beginPath(),c.arc(e.x,e.y,e.radius,0,Math.PI*2),c.strokeStyle=n,c.globalAlpha=e.alpha*(1-e.radius/e.maxRadius),c.lineWidth=2,c.stroke(),e.radius>8&&(c.beginPath(),c.arc(e.x,e.y,e.radius*.6,0,Math.PI*2),c.strokeStyle=n,c.globalAlpha=e.alpha*.4,c.lineWidth=1,c.stroke()),c.globalAlpha=1,!0)))};return d(),()=>{cancelAnimationFrame(a.current),u()}},[n,t,e]),(0,l.jsxs)(`div`,{className:wt.rippleWater,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:r,className:wt.canvas,style:{width:e,height:t}}),(0,l.jsx)(`span`,{className:wt.hint,children:`点击水面产生涟漪`})]})},Et={scrambleText:`cos-scrambleText-hN4Wm`,text:`cos-text-frsHs`,cursor:`cos-cursor-3zQOy`,blink:`cos-blink-OcKXu`},Dt=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*`,Ot=({text:e=`DECRYPTED`,duration:t=2e3,charset:n=Dt})=>{let[r,i]=(0,c.useState)(``),a=(0,c.useRef)(0),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let r=n.length>0?n:Dt,s=e;o.current=performance.now();let c=e=>{let n=e-o.current,l=Math.min(n/t,1),u=Math.floor(l*s.length);i(s.split(``).map((e,t)=>e===` `?` `:t<u?e:r[Math.floor(Math.random()*r.length)]).join(``)),l<1?a.current=requestAnimationFrame(c):i(s)};return a.current=requestAnimationFrame(c),()=>cancelAnimationFrame(a.current)},[e,t,n]),(0,l.jsx)(`div`,{className:Et.scrambleText,children:(0,l.jsxs)(`p`,{className:Et.text,children:[r,(0,l.jsx)(`span`,{className:Et.cursor})]})})},J={scratchCard:`cos-scratchCard-McIEK`,prize:`cos-prize-X0z5V`,canvas:`cos-canvas-JqIlr`,hidden:`cos-hidden-Lsfbt`},kt=({coverColor:e=`#94a3b8`,prize:t=`🎉 恭喜中奖!`,onReveal:n,width:r=300,height:i=180})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)(!1),s=(0,c.useRef)(!1),u=(0,c.useRef)(n),[d,f]=(0,c.useState)(!1);(0,c.useEffect)(()=>{u.current=n},[n]);let p=(0,c.useCallback)(t=>{t.globalCompositeOperation=`source-over`,t.fillStyle=e,t.fillRect(0,0,r,i),t.fillStyle=`rgb(255 255 255 / 30%)`,t.font=`bold 16px system-ui, sans-serif`,t.textAlign=`center`,t.fillText(`刮开涂层`,r/2,i/2)},[e,i,r]),m=(0,c.useCallback)(e=>{if(s.current)return;let t=e.getContext(`2d`);if(!t)return;let n=t.getImageData(0,0,e.width,e.height),r=0;for(let e=3;e<n.data.length;e+=4)n.data[e]<128&&r++;r/(e.width*e.height)>.45&&(s.current=!0,f(!0),u.current?.())},[]);(0,c.useEffect)(()=>{let e=a.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=r*t,e.height=i*t;let n=e.getContext(`2d`);n&&(n.setTransform(t,0,0,t,0,0),p(n))},[p,i,r]);let h=(e,t)=>{let n=a.current;if(!n||s.current)return;let r=n.getContext(`2d`);r&&(r.globalCompositeOperation=`destination-out`,r.beginPath(),r.arc(e,t,20,0,Math.PI*2),r.fill(),m(n))},g=e=>{let t=a.current;if(!t)return null;let n=t.getBoundingClientRect();if(`touches`in e){let t=e.touches[0];return{x:t.clientX-n.left,y:t.clientY-n.top}}return{x:e.clientX-n.left,y:e.clientY-n.top}},_=e=>{o.current=!0;let t=g(e);t&&h(t.x,t.y)},v=e=>{if(!o.current)return;let t=g(e);t&&h(t.x,t.y)},y=()=>{o.current=!1};return(0,l.jsxs)(`div`,{className:J.scratchCard,style:{width:r,height:i},children:[(0,l.jsx)(`div`,{className:J.prize,children:t}),(0,l.jsx)(`canvas`,{ref:a,className:`${J.canvas} ${d?J.hidden:``}`,style:{width:r,height:i},onMouseDown:_,onMouseMove:v,onMouseUp:y,onMouseLeave:y,onTouchStart:_,onTouchMove:v,onTouchEnd:y})]})},Y={slotMachine:`cos-slotMachine-P6FyZ`,machine:`cos-machine-B066r`,reel:`cos-reel-eEpJ3`,strip:`cos-strip-L5Z-a`,item:`cos-item-WYJ6q`,mask:`cos-mask-jdrj3`,spinBtn:`cos-spinBtn-DvDE7`,result:`cos-result-dLN5b`},At=[`🍒`,`🍋`,`🍊`,`🍇`,`⭐`,`7️⃣`],jt=e=>1-(1-e)**3,Mt=({symbols:e=At,onSpinEnd:t})=>{let[n,r]=(0,c.useState)(!1),[i,a]=(0,c.useState)([0,0,0]),[o,s]=(0,c.useState)([]),u=(0,c.useRef)(0),d=(0,c.useRef)(t),f=(0,c.useRef)(null);(0,c.useEffect)(()=>{d.current=t},[t]);let p=(0,c.useCallback)(()=>{let t=[];for(let n=0;n<20;n++)t.push(...e);return t},[e])();return(0,c.useEffect)(()=>()=>{f.current&&(f.current.cancelled=!0),cancelAnimationFrame(u.current)},[]),(0,l.jsxs)(`div`,{className:Y.slotMachine,children:[(0,l.jsx)(`div`,{className:Y.machine,children:[0,1,2].map(e=>(0,l.jsxs)(`div`,{className:Y.reel,style:{height:240},children:[(0,l.jsx)(`div`,{className:Y.strip,style:{transform:`translateY(${i[e]}px)`},children:p.map((e,t)=>(0,l.jsx)(`div`,{className:Y.item,style:{height:80},children:e},t))}),(0,l.jsx)(`div`,{className:Y.mask})]},e))}),(0,l.jsx)(`button`,{type:`button`,className:Y.spinBtn,onClick:()=>{if(n)return;r(!0),s([]);let t=[0,1,2].map(()=>Math.floor(Math.random()*e.length)),o=t.map(t=>-(t-1+e.length*10)*80),c=[...i],l=2e3,p=[0,300,600],m=performance.now(),h={cancelled:!1};f.current=h;let g=n=>{if(!h.cancelled){if(a(c.map((e,t)=>{let r=n-m-p[t];if(r<0)return e;let i=jt(Math.min(r/l,1));return e+(o[t]-e)*i})),!p.every(e=>n-m-e>=l))u.current=requestAnimationFrame(g);else if(!h.cancelled){let n=t.map(t=>e[t]);s(n),r(!1),d.current?.(n)}}};u.current=requestAnimationFrame(g)},disabled:n,children:n?`旋转中...`:`开始`}),o.length>0&&!n&&(0,l.jsx)(`p`,{className:Y.result,children:o[0]===o[1]&&o[1]===o[2]?`🎰 大奖!`:`结果: ${o.join(` `)}`})]})},Nt={splitReveal:`cos-splitReveal-6W8-6`,text:`cos-text-miTsj`,char:`cos-char-0gPJV`,reveal:`cos-reveal-YGzz-`,fromTop:`cos-fromTop-YXHUa`,fromBottom:`cos-fromBottom-24D6g`,fromLeft:`cos-fromLeft-OMiPY`,fromRight:`cos-fromRight-EcMOR`},Pt=[`fromTop`,`fromBottom`,`fromLeft`,`fromRight`],Ft=({text:e=`REVEAL`,delay:t=80,color:n=`#f8fafc`})=>(0,l.jsx)(`div`,{className:Nt.splitReveal,children:(0,l.jsx)(`h1`,{className:Nt.text,style:{"--reveal-color":n},children:e.split(``).map((e,n)=>(0,l.jsx)(`span`,{className:`${Nt.char} ${Nt[Pt[n%Pt.length]]}`,style:{animationDelay:`${n*t}ms`},children:e===` `?`\xA0`:e},`${e}-${n}`))})}),It={spotlight:`cos-spotlight-OddY1`,content:`cos-content-5I1Wy`,overlay:`cos-overlay-F6CJ5`},Lt=({children:e,radius:t=120,dimColor:n=`rgba(0, 0, 0, 0.85)`})=>{let r=(0,c.useRef)(null),i=(0,c.useCallback)(e=>{let t=r.current;if(!t)return;let n=t.getBoundingClientRect(),i=e.clientX-n.left,a=e.clientY-n.top;t.style.setProperty(`--spot-x`,`${i}px`),t.style.setProperty(`--spot-y`,`${a}px`)},[]);return(0,l.jsxs)(`div`,{ref:r,className:It.spotlight,style:{"--spot-radius":`${t}px`,"--dim-color":n},onMouseMove:i,children:[(0,l.jsx)(`div`,{className:It.content,children:e}),(0,l.jsx)(`div`,{className:It.overlay})]})},X={turntable:`cos-turntable-dkc32`,wheelWrap:`cos-wheelWrap-n7lhc`,canvas:`cos-canvas-A1-4x`,pointer:`cos-pointer-Rk1S9`,spinBtn:`cos-spinBtn-l9JIC`,result:`cos-result-H8q2c`,"fade-in":`cos-fade-in-U9bUC`},Rt=[`#FF6B6B`,`#4ECDC4`,`#FFE66D`,`#A78BFA`,`#60A5FA`,`#F472B6`,`#34D399`,`#FB923C`],zt=[{label:`一等奖`},{label:`二等奖`},{label:`三等奖`},{label:`谢谢参与`},{label:`优惠券`},{label:`再来一次`}],Bt=e=>1-(1-e)**3,Vt=({prizes:e=zt,size:t=360,spinDuration:n=4e3,spinRounds:r=5,buttonText:i=`开始抽奖`,onSpinEnd:a})=>{let o=(0,c.useRef)(null),s=(0,c.useRef)(0),u=(0,c.useRef)(0),d=(0,c.useRef)(1),[f,p]=(0,c.useState)(!1),[m,h]=(0,c.useState)(null),g=(0,c.useRef)(a),_=(0,c.useRef)(null);(0,c.useEffect)(()=>{g.current=a},[a]);let v=t+48,y=(e,t)=>t.color??Rt[e%Rt.length],b=(0,c.useCallback)(n=>{let r=o.current;if(!r)return;let i=r.getContext(`2d`);if(!i)return;let a=v/2,s=t/2,c=Math.PI*2/e.length;i.clearRect(0,0,v,v),i.save(),i.translate(a,a),i.rotate(n),e.forEach((e,n)=>{let r=n*c-Math.PI/2,a=r+c,o=y(n,e);i.beginPath(),i.moveTo(0,0),i.arc(0,0,s,r,a),i.closePath(),i.fillStyle=o,i.fill(),i.strokeStyle=`rgb(255 255 255 / 35%)`,i.lineWidth=2,i.stroke(),i.save(),i.rotate(r+c/2),i.textAlign=`right`,i.fillStyle=`#fff`,i.font=`bold ${Math.max(12,Math.floor(t/22))}px system-ui, sans-serif`,i.shadowColor=`rgb(0 0 0 / 30%)`,i.shadowBlur=4,i.fillText(e.label,s-18,6),i.restore()}),i.beginPath(),i.arc(0,0,s,0,Math.PI*2),i.strokeStyle=`#fbbf24`,i.lineWidth=6,i.stroke(),i.beginPath(),i.arc(0,0,s-4,0,Math.PI*2),i.strokeStyle=`#f59e0b`,i.lineWidth=2,i.stroke(),i.restore(),i.save(),i.translate(a,a);for(let e=0;e<12;e++){let t=e/12*Math.PI*2,n=Math.cos(t)*(s+14),r=Math.sin(t)*(s+14);i.beginPath(),i.arc(n,r,3,0,Math.PI*2),i.fillStyle=e%2==0?`#fde68a`:`#f59e0b`,i.fill()}i.restore()},[v,e,t]);(0,c.useEffect)(()=>{let e=o.current;if(!e)return;let t=window.devicePixelRatio||1;d.current=t,e.width=v*t,e.height=v*t;let n=e.getContext(`2d`);n&&n.setTransform(t,0,0,t,0,0),b(s.current)},[v,b]),(0,c.useEffect)(()=>()=>{_.current&&(_.current.cancelled=!0),u.current&&cancelAnimationFrame(u.current)},[]);let x=t=>{let n=360/e.length,r=(180/Math.PI*t%360+360)%360;return Math.floor((360-r+n/2)%360/n)%e.length};return(0,l.jsxs)(`div`,{className:X.turntable,style:{width:v,height:v+80},children:[(0,l.jsxs)(`div`,{className:X.wheelWrap,style:{width:v,height:v},children:[(0,l.jsx)(`div`,{className:X.pointer}),(0,l.jsx)(`canvas`,{ref:o,className:X.canvas,style:{width:v,height:v}}),(0,l.jsx)(`button`,{type:`button`,className:X.spinBtn,onClick:()=>{if(f||e.length===0)return;p(!0),h(null);let t=Math.PI*2/e.length,i=Math.floor(Math.random()*e.length)*t+t/2,a=s.current,o=a+r*Math.PI*2+(Math.PI*2-i)-a%(Math.PI*2),c=a,l=performance.now(),d={cancelled:!1};_.current=d;let m=t=>{if(d.cancelled)return;let r=t-l,i=Math.min(r/n,1),a=Bt(i),f=c+(o-c)*a;if(s.current=f,b(f),i<1)u.current=requestAnimationFrame(m);else if(!d.cancelled){let t=x(f),n=e[t];s.current=f,p(!1),h(n),g.current?.(n,t)}};u.current=requestAnimationFrame(m)},disabled:f,children:f?`抽奖中...`:i})]}),m&&!f&&(0,l.jsxs)(`p`,{className:X.result,children:[`恭喜获得:`,(0,l.jsx)(`strong`,{children:m.label})]})]})},Z={typewriter:`cos-typewriter-7UhOL`,terminal:`cos-terminal-NWNVN`,dots:`cos-dots-oulNg`,text:`cos-text-ICV5T`,prompt:`cos-prompt-Y4hVD`,cursor:`cos-cursor-m8hGi`,blink:`cos-blink-XykM7`},Ht=[`Hello, cos-design!`,`欢迎来到组件库 ✨`,`Build something fun 🚀`],Ut=({texts:e,speed:t,deleteSpeed:n,pause:r})=>{let[i,a]=(0,c.useState)(``),[o,s]=(0,c.useState)(0),[u,d]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{let c=e[o%e.length],l;if(!u&&i===c)l=setTimeout(()=>d(!0),r);else if(u&&i===``)l=setTimeout(()=>{d(!1),s(t=>(t+1)%e.length)},0);else{let e=u?c.slice(0,i.length-1):c.slice(0,i.length+1);l=setTimeout(()=>a(e),u?n:t)}return()=>clearTimeout(l)},[i,u,o,e,t,n,r]),(0,l.jsx)(`div`,{className:Z.typewriter,children:(0,l.jsxs)(`div`,{className:Z.terminal,children:[(0,l.jsxs)(`div`,{className:Z.dots,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]}),(0,l.jsxs)(`p`,{className:Z.text,children:[(0,l.jsx)(`span`,{className:Z.prompt,children:`>`}),i,(0,l.jsx)(`span`,{className:Z.cursor,children:`|`})]})]})})},Wt=({texts:e=Ht,speed:t=100,deleteSpeed:n=50,pause:r=2e3})=>{let i=e.length>0?e:Ht;return(0,l.jsx)(Ut,{texts:i,speed:t,deleteSpeed:n,pause:r},i.join(`\0`))},Q={waveButton:`cos-waveButton-Aa7G-`,btn:`cos-btn-WJrEN`,label:`cos-label-9BHOU`,wave:`cos-wave-GycLU`,ripple:`cos-ripple-5ZFpr`},Gt=({text:e=`点我试试`,color:t=`#38bdf8`,className:n,style:r,...i})=>(0,l.jsx)(`div`,{className:Q.waveButton,children:(0,l.jsxs)(`button`,{type:`button`,className:`${Q.btn} ${n??``}`,style:{"--wave-color":t,...r},...i,children:[(0,l.jsx)(`span`,{className:Q.wave}),(0,l.jsx)(`span`,{className:Q.wave}),(0,l.jsx)(`span`,{className:Q.label,children:e})]})}),Kt=39,qt={0:`sunny`,1:`sunny`,2:`partlyCloudy`,3:`overcast`,45:`fog`,48:`fog`,51:`lightRain`,53:`lightRain`,55:`moderateRain`,56:`sleet`,57:`sleet`,61:`lightRain`,63:`moderateRain`,65:`heavyRain`,66:`sleet`,67:`sleet`,71:`lightSnow`,73:`moderateSnow`,75:`heavySnow`,77:`lightSnow`,80:`lightRain`,81:`moderateRain`,82:`heavyRain`,85:`lightSnow`,86:`heavySnow`,95:`thunderstorm`,96:`thunderstorm`,99:`thunderstorm`},Jt=(e,t=0)=>{let n=qt[e]??`overcast`;return(n===`sunny`||n===`partlyCloudy`||n===`overcast`)&&t>=Kt?`gale`:n},Yt={weather:null,status:`idle`,error:null,current:null},Xt={weather:null,status:`locating`,error:null,current:null},Zt={weather:null,status:`fetching`,error:null,current:null},Qt=e=>e!=null&&Number.isFinite(e.latitude)&&Number.isFinite(e.longitude),$t=(e=!0,t)=>{let n=Qt(t),r=n?t.latitude:null,i=n?t.longitude:null,a=e?n?Zt:Xt:Yt,o=`${e}:${r},${i}`,[s,l]=(0,c.useState)(a),[u,d]=(0,c.useState)(o);return u!==o&&(d(o),l(t=>e&&t.weather?{...a,weather:t.weather,current:t.current}:a)),(0,c.useEffect)(()=>{if(!e)return;let t=!1,n=new AbortController,a=async(e,r)=>{try{let i=new URLSearchParams({latitude:String(e),longitude:String(r),current:`weather_code,wind_speed_10m,is_day`}),a=await fetch(`https://api.open-meteo.com/v1/forecast?${i}`,{signal:n.signal});if(!a.ok)throw Error(`Open-Meteo 请求失败(HTTP ${a.status})`);let o=await a.json(),s=Number(o?.current?.weather_code);if(Number.isNaN(s))throw Error(`Open-Meteo 返回数据缺少 weather_code`);let c=Number(o?.current?.wind_speed_10m??0);if(t)return;l({weather:Jt(s,c),status:`success`,error:null,current:{weatherCode:s,windSpeed:c,isDay:o?.current?.is_day===1,latitude:e,longitude:r}})}catch(e){if(t||e instanceof DOMException&&e.name===`AbortError`)return;l({weather:null,status:`error`,error:e instanceof Error?e.message:`天气获取失败`,current:null})}};return r!=null&&i!=null?(a(r,i),()=>{t=!0,n.abort()}):typeof navigator>`u`||!navigator.geolocation?(Promise.resolve().then(()=>{t||l({weather:null,status:`error`,error:`当前环境不支持定位`,current:null})}),()=>{t=!0}):(navigator.geolocation.getCurrentPosition(({coords:e})=>{t||(l(e=>({...e,status:`fetching`})),a(e.latitude,e.longitude))},e=>{t||l({weather:null,status:`error`,error:e.message||`定位失败`,current:null})},{timeout:1e4,maximumAge:600*1e3}),()=>{t=!0,n.abort()})},[e,r,i]),s},$={weatherBackground:`cos-weatherBackground-Mnm22`,canvas:`cos-canvas-nvqMt`,loadingOverlay:`cos-loadingOverlay-O58B7`,loadingSpinner:`cos-loadingSpinner-NQ9yG`,"weather-loading-spin":`cos-weather-loading-spin-IPFWZ`},en={sunny:{sky:[`#4a9fe0`,`#c8e8fb`],sun:`full`,cloudCount:1,cloudColor:[255,255,255],cloudAlpha:.5,cloudSpread:.12,rain:null,fogBanks:0,haze:0,snowCount:0,lightning:!1},partlyCloudy:{sky:[`#5b9bd0`,`#cfe6f3`],sun:`soft`,cloudCount:5,cloudColor:[255,255,255],cloudAlpha:.85,cloudSpread:.22,rain:null,fogBanks:0,haze:0,snowCount:0,lightning:!1},overcast:{sky:[`#8a97a8`,`#c3cbd6`],sun:`none`,cloudCount:9,cloudColor:[100,116,139],cloudAlpha:.55,cloudSpread:.3,rain:null,fogBanks:0,haze:.06,snowCount:0,lightning:!1},lightRain:{sky:[`#6b7a8f`,`#9aa7b8`],sun:`none`,cloudCount:7,cloudColor:[71,85,105],cloudAlpha:.6,cloudSpread:.24,rain:{count:70,speed:7,wind:-.8,alpha:.4,splash:!1},fogBanks:0,haze:.04,snowCount:0,lightning:!1},moderateRain:{sky:[`#55637a`,`#7e8ba0`],sun:`none`,cloudCount:8,cloudColor:[51,65,85],cloudAlpha:.65,cloudSpread:.26,rain:{count:150,speed:10,wind:-1.5,alpha:.5,splash:!0},fogBanks:0,haze:.06,snowCount:0,lightning:!1},heavyRain:{sky:[`#3d4a5f`,`#5d6a80`],sun:`none`,cloudCount:9,cloudColor:[30,41,59],cloudAlpha:.7,cloudSpread:.3,rain:{count:280,speed:14,wind:-2.8,alpha:.55,splash:!0},fogBanks:0,haze:.1,snowCount:0,lightning:!1},thunderstorm:{sky:[`#252f42`,`#43506a`],sun:`none`,cloudCount:10,cloudColor:[15,23,42],cloudAlpha:.75,cloudSpread:.32,rain:{count:240,speed:13,wind:-2.2,alpha:.55,splash:!0},fogBanks:0,haze:.08,snowCount:0,lightning:!0},fog:{sky:[`#aab4bf`,`#d5dbe1`],sun:`dim`,cloudCount:3,cloudColor:[203,213,225],cloudAlpha:.4,cloudSpread:.2,rain:null,fogBanks:10,haze:.28,snowCount:0,lightning:!1},lightSnow:{sky:[`#aab8c8`,`#e2e8ef`],sun:`none`,cloudCount:5,cloudColor:[166,180,196],cloudAlpha:.45,cloudSpread:.22,rain:null,fogBanks:0,haze:.05,snowCount:70,lightning:!1},moderateSnow:{sky:[`#9fb0c4`,`#dde5ee`],sun:`none`,cloudCount:6,cloudColor:[148,163,184],cloudAlpha:.5,cloudSpread:.24,rain:null,fogBanks:0,haze:.08,snowCount:160,lightning:!1},heavySnow:{sky:[`#8495aa`,`#c7d1dc`],sun:`none`,cloudCount:9,cloudColor:[100,116,139],cloudAlpha:.62,cloudSpread:.3,rain:null,fogBanks:3,haze:.14,snowCount:300,lightning:!1},sleet:{sky:[`#78899e`,`#b8c5d2`],sun:`none`,cloudCount:8,cloudColor:[71,85,105],cloudAlpha:.6,cloudSpread:.28,rain:{count:100,speed:9,wind:-1.4,alpha:.42,splash:!0},fogBanks:0,haze:.09,snowCount:100,lightning:!1},hail:{sky:[`#46566c`,`#77889d`],sun:`none`,cloudCount:9,cloudColor:[30,41,59],cloudAlpha:.68,cloudSpread:.3,rain:{count:80,speed:11,wind:-2.5,alpha:.38,splash:!0},fogBanks:0,haze:.1,snowCount:0,lightning:!1},smog:{sky:[`#8f8b7e`,`#c5bca8`],sun:`dim`,cloudCount:3,cloudColor:[142,136,119],cloudAlpha:.35,cloudSpread:.2,rain:null,fogBanks:12,haze:.34,snowCount:0,lightning:!1},gale:{sky:[`#587087`,`#a6b5c2`],sun:`soft`,cloudCount:8,cloudColor:[203,213,225],cloudAlpha:.72,cloudSpread:.3,rain:null,fogBanks:0,haze:.04,snowCount:0,lightning:!1},snow:{sky:[`#9fb0c4`,`#dde5ee`],sun:`none`,cloudCount:6,cloudColor:[148,163,184],cloudAlpha:.5,cloudSpread:.24,rain:null,fogBanks:0,haze:.08,snowCount:160,lightning:!1}},tn={sunny:{sky:[`#0b1a33`,`#27476e`],stars:110},partlyCloudy:{sky:[`#0f1f38`,`#2c4666`],stars:60},overcast:{sky:[`#181f2a`,`#333e4e`],stars:0},lightRain:{sky:[`#151b26`,`#2b3442`],stars:0},moderateRain:{sky:[`#11161f`,`#242c3a`],stars:0},heavyRain:{sky:[`#0c1017`,`#1c232e`],stars:0},thunderstorm:{sky:[`#0a0e18`,`#192132`],stars:0},fog:{sky:[`#1c222b`,`#3a434e`],stars:0},lightSnow:{sky:[`#161e2b`,`#3a4656`],stars:20},moderateSnow:{sky:[`#131a26`,`#333f4f`],stars:8},heavySnow:{sky:[`#101623`,`#2a3545`],stars:0},sleet:{sky:[`#121924`,`#2c3745`],stars:0},hail:{sky:[`#0e141d`,`#26303e`],stars:0},smog:{sky:[`#1a1812`,`#38321f`],stars:0},gale:{sky:[`#101a26`,`#2e3d4d`],stars:30},snow:{sky:[`#131a26`,`#333f4f`],stars:8}},nn=([e,t,n])=>[Math.round(e*.3+18),Math.round(t*.3+24),Math.round(n*.3+42)],rn=e=>{let t=Math.ceil(e*2+4),n=document.createElement(`canvas`);n.width=t,n.height=t;let r=n.getContext(`2d`),i=r.createRadialGradient(t/2,t/2,0,t/2,t/2,e+1);return i.addColorStop(0,`rgba(255, 255, 255, 1)`),i.addColorStop(.6,`rgba(255, 255, 255, 0.85)`),i.addColorStop(1,`rgba(255, 255, 255, 0)`),r.fillStyle=i,r.fillRect(0,0,t,t),n},an=e=>{let t=Math.ceil(e*2+6),n=document.createElement(`canvas`);n.width=t,n.height=t;let r=n.getContext(`2d`);r.translate(t/2,t/2),r.strokeStyle=`rgba(255, 255, 255, 0.95)`,r.lineCap=`round`,r.lineWidth=Math.max(e*.11,.7),r.shadowColor=`rgba(255, 255, 255, 0.5)`,r.shadowBlur=e*.25;let i=1+Math.floor(Math.random()*3),a=Array.from({length:i},()=>({pos:.3+Math.random()*.5,len:e*(.22+Math.random()*.34),angle:Math.PI/3*(.8+Math.random()*.45)})),o=Math.random()<.55,s=e*(.14+Math.random()*.12),c=Math.random()<.45,l=e*(.14+Math.random()*.14);for(let t=0;t<6;t++){r.save(),r.rotate(t*Math.PI/3),r.beginPath(),r.moveTo(0,0),r.lineTo(0,-e);for(let t of a){let n=-e*t.pos;r.moveTo(0,n),r.lineTo(Math.sin(t.angle)*t.len,n-Math.cos(t.angle)*t.len),r.moveTo(0,n),r.lineTo(-Math.sin(t.angle)*t.len,n-Math.cos(t.angle)*t.len)}o&&(r.moveTo(0,-e),r.lineTo(s*.7,-e-s*.5),r.moveTo(0,-e),r.lineTo(-s*.7,-e-s*.5)),r.stroke(),r.restore()}if(c){r.beginPath();for(let e=0;e<6;e++){let t=e*Math.PI/3-Math.PI/2,n=Math.cos(t)*l,i=Math.sin(t)*l;e===0?r.moveTo(n,i):r.lineTo(n,i)}r.closePath(),r.stroke()}return n},on=(e,t,n)=>{let r=1+Math.random()**1.6*4.2,i=r>=2.4;return{x:Math.random()*e,y:n??Math.random()*t,size:r,speed:.4+r*.28+Math.random()*.4,phase:Math.random()*Math.PI*2,drift:(Math.random()-.5)*.4,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.025,opacity:.55+Math.random()*.45,sprite:i?an(r*2.4):rn(r)}},sn=(e,t,n,r,i,a)=>{if(a<=0)return[[e,t],[n,r]];let o=(e+n)/2+(Math.random()-.5)*i,s=(t+r)/2,c=sn(e,t,o,s,i*.55,a-1),l=sn(o,s,n,r,i*.55,a-1);return[...c.slice(0,-1),...l]},cn=({width:e=800,height:t=450,weather:n=`sunny`,night:r=!1,live:i=!1,latitude:a,longitude:o,onLiveWeather:s,loading:u=!1})=>{let d=(0,c.useRef)(null),f=$t(i,a!=null&&o!=null?{latitude:a,longitude:o}:void 0),p=i&&f.weather?f.weather:n,m=i&&f.current?!f.current.isDay:r,h=u||i&&(f.status===`locating`||f.status===`fetching`),g=(0,c.useRef)(s);return(0,c.useEffect)(()=>{g.current=s}),(0,c.useEffect)(()=>{f.weather&&g.current?.(f.weather)},[f.weather]),(0,c.useEffect)(()=>{let n=d.current;if(!n)return;let r=window.devicePixelRatio||1;n.width=e*r,n.height=t*r;let i=n.getContext(`2d`);if(!i)return;i.setTransform(r,0,0,r,0,0);let a=en[p],o=tn[p],s=m?o.sky:a.sky,c=m?nn(a.cloudColor):a.cloudColor,l=e*.72,u=t*.26,f=Math.min(e,t)*.09,h=m?Array.from({length:o.stars},()=>({x:Math.random()*e,y:Math.random()*t*.72,r:.4+Math.random()*1.1,phase:Math.random()*Math.PI*2,speed:.015+Math.random()*.035})):[],g=[{dx:-.32,dy:.08,r:.17},{dx:.24,dy:-.22,r:.12},{dx:.04,dy:.34,r:.1},{dx:.36,dy:.24,r:.07}],v=Array.from({length:a.cloudCount},()=>{let n=.7+Math.random()*.9,r=4+Math.floor(Math.random()*3);return{x:Math.random()*(e+240)-120,y:t*.06+Math.random()*t*a.cloudSpread,scale:n,speed:.12+Math.random()*.22,puffs:Array.from({length:r},(e,t)=>({dx:(t-r/2)*26+(Math.random()-.5)*14,dy:(Math.random()-.5)*14,r:22+Math.random()*20}))}}),y=a.rain?Array.from({length:a.rain.count},()=>({x:Math.random()*(e+160)-80,y:Math.random()*t,len:8+Math.random()*10,speed:a.rain.speed*(.75+Math.random()*.5)})):[],b=[],x=Array.from({length:a.fogBanks},(n,r)=>({x:Math.random()*e,y:r/Math.max(a.fogBanks-1,1)*t*.9+t*.05,rw:e*(.25+Math.random()*.3),rh:t*(.08+Math.random()*.08),speed:(.1+Math.random()*.25)*(r%2==0?1:-1),alpha:.16+Math.random()*.14})),S=Array.from({length:a.snowCount},()=>on(e,t)),C=p===`hail`?Array.from({length:130},()=>({x:Math.random()*(e+180)-90,y:Math.random()*t,r:1.8+Math.random()*3,vx:-2.2-Math.random()*1.8,vy:8+Math.random()*5,bounces:0,opacity:.65+Math.random()*.35})):[],w=p===`gale`?Array.from({length:46},()=>({x:Math.random()*e,y:Math.random()*t,length:45+Math.random()*130,speed:8+Math.random()*10,wave:Math.random()*Math.PI*2,alpha:.12+Math.random()*.3,width:.6+Math.random()*1.2})):[],T=0,E=0,D=0,O=[],k=120+Math.random()*240,A=0,j=document.hidden,M=_(e=>{j=e}),N=()=>{let n=i.createLinearGradient(0,0,0,t);n.addColorStop(0,s[0]),n.addColorStop(1,s[1]),i.fillStyle=n,i.fillRect(0,0,e,t)},ee=()=>{for(let e of h){let t=.35+(Math.sin(T*e.speed+e.phase)+1)*.325;i.beginPath(),i.arc(e.x,e.y,e.r,0,Math.PI*2),i.fillStyle=`rgba(226, 235, 255, ${t})`,i.fill()}},te=()=>{if(a.sun===`none`)return;let n=f*.88,r=a.sun===`dim`,o=i.createRadialGradient(l,u,0,l,u,n*(r?1.8:2.8));o.addColorStop(0,`rgba(214, 226, 245, ${r?.18:.35})`),o.addColorStop(1,`rgba(214, 226, 245, 0)`),i.fillStyle=o,i.fillRect(0,0,e,t);let s=r?.5:1,c=i.createRadialGradient(l-n*.25,u-n*.25,0,l,u,n);c.addColorStop(0,`rgba(245, 248, 252, ${s})`),c.addColorStop(1,`rgba(196, 208, 226, ${s})`),i.beginPath(),i.arc(l,u,n,0,Math.PI*2),i.fillStyle=c,i.fill();for(let e of g)i.beginPath(),i.arc(l+e.dx*n,u+e.dy*n,e.r*n,0,Math.PI*2),i.fillStyle=`rgba(170, 184, 206, ${s*.55})`,i.fill()},P=()=>{if(m){ee(),te();return}if(a.sun===`none`)return;if(a.sun===`full`){let n=1+Math.sin(T*.02)*.04,r=i.createRadialGradient(l,u,0,l,u,f*3.4*n);r.addColorStop(0,`rgba(255, 236, 168, 0.9)`),r.addColorStop(.35,`rgba(255, 214, 112, 0.32)`),r.addColorStop(1,`rgba(255, 214, 112, 0)`),i.fillStyle=r,i.fillRect(0,0,e,t),i.save(),i.translate(l,u),i.rotate(T*.003);for(let e=0;e<12;e++){i.rotate(Math.PI/6);let e=i.createLinearGradient(f*1.2,0,f*2.4,0);e.addColorStop(0,`rgba(255, 230, 150, 0.5)`),e.addColorStop(1,`rgba(255, 230, 150, 0)`),i.strokeStyle=e,i.lineWidth=3,i.beginPath(),i.moveTo(f*1.2,0),i.lineTo(f*2.4,0),i.stroke()}i.restore()}if(a.sun===`soft`){let n=i.createRadialGradient(l,u,0,l,u,f*2.4);n.addColorStop(0,`rgba(255, 240, 190, 0.7)`),n.addColorStop(1,`rgba(255, 240, 190, 0)`),i.fillStyle=n,i.fillRect(0,0,e,t)}let n=a.sun===`dim`?.35:1,r=i.createRadialGradient(l-f*.2,u-f*.2,0,l,u,f);r.addColorStop(0,`rgba(255, 250, 224, ${n})`),r.addColorStop(1,`rgba(255, 214, 102, ${n})`),i.beginPath(),i.arc(l,u,f,0,Math.PI*2),i.fillStyle=r,i.fill()},ne=()=>{let[t,n,r]=c;for(let o of v){o.x+=o.speed*(p===`gale`?7:1),o.x-140*o.scale>e&&(o.x=-160*o.scale);for(let e of o.puffs){let s=o.x+e.dx*o.scale,c=o.y+e.dy*o.scale,l=e.r*o.scale,u=i.createRadialGradient(s,c,0,s,c,l);u.addColorStop(0,`rgba(${t}, ${n}, ${r}, ${a.cloudAlpha})`),u.addColorStop(1,`rgba(${t}, ${n}, ${r}, 0)`),i.beginPath(),i.arc(s,c,l,0,Math.PI*2),i.fillStyle=u,i.fill()}}},re=()=>{if(!a.rain)return;let{wind:n,alpha:r,splash:o}=a.rain;i.strokeStyle=`rgba(214, 228, 240, ${r})`,i.lineWidth=1.2,i.beginPath();for(let r of y){let a=Math.hypot(n,r.speed)||1,s=n/a,c=r.speed/a;i.moveTo(r.x,r.y),i.lineTo(r.x+s*r.len,r.y+c*r.len),r.x+=n,r.y+=r.speed,r.y>t&&(o&&Math.random()<.3&&b.length<60&&b.push({x:r.x,r:1,alpha:.5}),r.y=-r.len,r.x=Math.random()*(e+160)-80)}i.stroke();for(let e=b.length-1;e>=0;e--){let n=b[e];if(n.r+=.8,n.alpha-=.035,n.alpha<=0){b.splice(e,1);continue}i.beginPath(),i.ellipse(n.x,t-3,n.r,n.r*.35,0,Math.PI,Math.PI*2),i.strokeStyle=`rgba(214, 228, 240, ${n.alpha})`,i.lineWidth=1,i.stroke()}},ie=()=>{let t=p===`smog`?`168, 155, 126`:`226, 232, 238`;m&&(t=p===`smog`?`96, 88, 66`:`138, 150, 168`);for(let n of x){n.x+=n.speed,n.speed>0&&n.x-n.rw>e&&(n.x=-n.rw),n.speed<0&&n.x+n.rw<0&&(n.x=e+n.rw);let r=i.createRadialGradient(n.x,n.y,0,n.x,n.y,n.rw);r.addColorStop(0,`rgba(${t}, ${n.alpha})`),r.addColorStop(1,`rgba(${t}, 0)`),i.save(),i.translate(n.x,n.y),i.scale(1,n.rh/n.rw),i.translate(-n.x,-n.y),i.beginPath(),i.arc(n.x,n.y,n.rw,0,Math.PI*2),i.fillStyle=r,i.fill(),i.restore()}},ae=()=>{for(let n of S)n.y+=n.speed,n.x+=Math.sin(T*.02+n.phase)*(.3+n.size*.08)+n.drift,n.rotation+=n.rotationSpeed,n.y-n.sprite.height>t&&(n.y=-n.sprite.height,n.x=Math.random()*e,n.phase=Math.random()*Math.PI*2,n.drift=(Math.random()-.5)*.4,n.opacity=.55+Math.random()*.45),n.x>e+20&&(n.x=-20),n.x<-20&&(n.x=e+20),i.save(),i.globalAlpha=n.opacity,i.translate(n.x,n.y),i.rotate(n.rotation),i.drawImage(n.sprite,-n.sprite.width/2,-n.sprite.height/2),i.restore()},oe=()=>{if(C.length!==0)for(let n of C){let r=n.x,a=n.y;n.vy+=.16,n.x+=n.vx,n.y+=n.vy,i.beginPath(),i.moveTo(r,a),i.lineTo(n.x,n.y),i.strokeStyle=`rgba(225, 239, 250, ${n.opacity*.25})`,i.lineWidth=n.r*.65,i.stroke(),n.y+n.r>=t&&(n.bounces===0?(n.y=t-n.r,n.vy*=-.36,n.vx*=.72,n.bounces=1):(n.x=Math.random()*(e+180)-90,n.y=-10-Math.random()*t*.25,n.vx=-2.2-Math.random()*1.8,n.vy=8+Math.random()*5,n.bounces=0)),i.beginPath(),i.arc(n.x,n.y,n.r,0,Math.PI*2),i.fillStyle=`rgba(241, 248, 255, ${n.opacity})`,i.fill(),i.strokeStyle=`rgba(174, 207, 229, ${n.opacity*.75})`,i.lineWidth=.7,i.stroke(),i.beginPath(),i.arc(n.x-n.r*.3,n.y-n.r*.3,Math.max(.6,n.r*.24),0,Math.PI*2),i.fillStyle=`rgba(255, 255, 255, ${n.opacity})`,i.fill()}},se=()=>{if(w.length!==0)for(let n of w){n.x+=n.speed,n.wave+=.04,n.x-n.length>e&&(n.x=-n.length-Math.random()*e*.3,n.y=Math.random()*t);let r=Math.sin(n.wave)*8,a=n.x+n.length;if(i.beginPath(),i.moveTo(n.x,n.y),i.bezierCurveTo(n.x+n.length*.3,n.y+r,n.x+n.length*.7,n.y-r,a,n.y),i.strokeStyle=`rgba(235, 244, 250, ${n.alpha})`,i.lineWidth=n.width,i.lineCap=`round`,i.stroke(),n.length>100){let e=n.x+n.length*.58,t=n.y-r*.4;i.save(),i.translate(e,t),i.rotate(n.wave*2),i.beginPath(),i.ellipse(0,0,4,1.6,0,0,Math.PI*2),i.fillStyle=`rgba(91, 76, 52, ${n.alpha*1.6})`,i.fill(),i.restore()}}},ce=()=>{if(a.lightning){if(T>=k){k=T+150+Math.random()*300,E=.5,D=9;let n=e*(.15+Math.random()*.7);O=sn(n,t*.12,n+(Math.random()-.5)*e*.2,t*.92,60,6)}if(D>0){--D;let e=D/9;i.beginPath(),O.forEach(([e,t],n)=>n===0?i.moveTo(e,t):i.lineTo(e,t)),i.strokeStyle=`rgba(240, 246, 255, ${e})`,i.lineWidth=2.4,i.shadowColor=`#bcd7ff`,i.shadowBlur=16,i.stroke(),i.shadowBlur=0}E>.01&&(i.fillStyle=`rgba(226, 236, 255, ${E})`,i.fillRect(0,0,e,t),E*=.82)}},le=()=>{if(a.haze<=0)return;let n=p===`smog`?`177, 164, 135`:`220, 226, 232`;m&&(n=p===`smog`?`82, 74, 54`:`116, 128, 145`),i.fillStyle=`rgba(${n}, ${a.haze})`,i.fillRect(0,0,e,t)},ue=()=>{A=requestAnimationFrame(ue),!j&&(T+=1,N(),P(),ne(),ie(),le(),re(),ae(),oe(),se(),ce())};return ue(),()=>{cancelAnimationFrame(A),M()}},[m,p,t,e]),(0,l.jsxs)(`div`,{className:$.weatherBackground,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:d,className:$.canvas,style:{width:e,height:t}}),h&&(0,l.jsxs)(`div`,{className:$.loadingOverlay,children:[(0,l.jsx)(`div`,{className:$.loadingSpinner}),(0,l.jsx)(`span`,{children:`天气加载中…`})]})]})},ln={waveText:`cos-waveText-Zy2Tp`,text:`cos-text-el-KR`,char:`cos-char-Y9-mV`,wave:`cos-wave-jVRCz`},un=({text:e=`WAVE`,amplitude:t=12,color:n=`#38bdf8`,fontSize:r=56})=>(0,l.jsx)(`div`,{className:ln.waveText,children:(0,l.jsx)(`h1`,{className:ln.text,style:{fontSize:r,"--wave-color":n,"--wave-amp":`${t}px`},children:e.split(``).map((e,t)=>(0,l.jsx)(`span`,{className:ln.char,style:{animationDelay:`${t*.1}s`},children:e===` `?`\xA0`:e},`${e}-${t}`))})});exports.AudioVisualizer=b,exports.Aurora=g,exports.BarcodeScan=d,exports.BurnAway=p,exports.CanvasClock=S,exports.Charge=E,exports.ClickSpark=O,exports.Confetti=N,exports.Countdown=ae,exports.CursorTrail=fe,exports.CyberGrid=te,exports.DiceRoll=me,exports.DnaHelix=se,exports.DoublePendulum=ge,exports.ElectricArc=ue,exports.Fireworks=Ce,exports.FlipCounter=Ee,exports.GlitchText=je,exports.GradientFlow=ke,exports.GravityBalls=Pe,exports.HolographicCard=Fe,exports.LiquidGlass=Be,exports.LiquidProgress=Ie,exports.LorenzAttractor=Re,exports.MagneticButton=He,exports.MatrixRain=We,exports.MazeGenerator=Je,exports.MetaballPool=Ke,exports.MeteorRain=Xe,exports.NeonText=Ze,exports.NewtonCradle=$e,exports.OrbitalChart=tt,exports.ParticleNetwork=rt,exports.PlasmaBall=at,exports.ProgressChest=ht,exports.RadarScan=_t,exports.RedPacketRain=vt,exports.ReturnCity=yt,exports.RippleWater=Tt,exports.RopeChain=xt,exports.ScrambleText=Ot,exports.ScratchCard=kt,exports.SlotMachine=Mt,exports.SmokeFog=st,exports.Snowfall=ft,exports.SolarSystem=ut,exports.Speedometer=St,exports.SplitReveal=Ft,exports.Spotlight=Lt,exports.Starfield=mt,exports.TimelinePulse=Ct,exports.Turntable=Vt,exports.Typewriter=Wt,exports.WaveButton=Gt,exports.WaveText=un,exports.WeatherBackground=cn,exports.mapWmoCodeToWeatherType=Jt,exports.useLiveWeather=$t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});require('./index.css');var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("react");c=s(c,1);let l=require("react/jsx-runtime");var u={barcodeScan:`cos-barcodeScan-aH9Ad`,content:`cos-content-F73ZD`,"glitch-skew":`cos-glitch-skew-inh6a`,placeholder:`cos-placeholder-yYVB8`,overlay:`cos-overlay-4AiY5`,scanLine:`cos-scanLine-VBsRv`,scan:`cos-scan-JD4wO`,glitchLayer:`cos-glitchLayer-nzkIa`,flicker:`cos-flicker-P0jQE`,corners:`cos-corners-1bjak`},d=({children:e,scanColor:t=`#22c55e`,speed:n=2.5})=>(0,l.jsxs)(`div`,{className:u.barcodeScan,style:{"--scan-color":t,"--scan-speed":`${n}s`},children:[(0,l.jsx)(`div`,{className:u.content,children:e??(0,l.jsx)(`span`,{className:u.placeholder,children:`SCAN ME`})}),(0,l.jsxs)(`div`,{className:u.overlay,children:[(0,l.jsx)(`div`,{className:u.scanLine}),(0,l.jsx)(`div`,{className:u.glitchLayer})]}),(0,l.jsxs)(`div`,{className:u.corners,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]})]}),f={burnAway:`cos-burnAway-QWIjy`,stage:`cos-stage-8VIfE`,text:`cos-text-0guk-`,canvas:`cos-canvas-Bwc-u`,trigger:`cos-trigger-UDZqV`,hint:`cos-hint-XQUfv`},p=({text:e=`BURN`,fontSize:t=64,onComplete:n})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(null),[a,o]=(0,c.useState)(!1),[s,u]=(0,c.useState)(!1),d=(0,c.useRef)(!1),p=(0,c.useRef)(n);(0,c.useEffect)(()=>{p.current=n},[n]);let m=(0,c.useCallback)(()=>{a||s||o(!0)},[a,s]);return(0,c.useEffect)(()=>{if(!a||s)return;let n=r.current,o=i.current;if(!n||!o)return;let c=n.getBoundingClientRect(),l=window.devicePixelRatio||1,f=Math.ceil(c.width),m=Math.ceil(c.height);o.width=f*l,o.height=m*l,o.style.width=`${f}px`,o.style.height=`${m}px`;let h=o.getContext(`2d`);if(!h)return;h.scale(l,l);let g=document.createElement(`canvas`);g.width=f*l,g.height=m*l;let _=g.getContext(`2d`);if(!_)return;_.scale(l,l),_.font=`900 ${t}px system-ui, sans-serif`,_.textAlign=`center`,_.textBaseline=`middle`,_.fillStyle=`#f8fafc`,_.fillText(e,f/2,m/2);let v=_.getImageData(0,0,f*l,m*l).data,y=[];for(let e=0;e<m;e+=4)for(let t=0;t<f;t+=4)v[(Math.floor(e*l)*f*l+Math.floor(t*l))*4+3]>128&&y.push({x:t,y:e,vx:(Math.random()-.5)*2,vy:-Math.random()*3-1,life:1,maxLife:.6+Math.random()*.6,size:2+Math.random()*3});let b=0,x=0,S=!1,C=(e,t)=>{if(S)return;let n=Math.min((e-t)/16,2);x+=n*16,h.clearRect(0,0,f,m);let r=0;for(let e of y){if(e.life-=n*.012/e.maxLife,e.life<=0)continue;r++,e.x+=e.vx*n,e.y+=e.vy*n,e.vy+=.04*n;let t=e.life,i=1-e.life,a=Math.max(0,200-i*200),o=Math.max(0,80-i*80);h.globalAlpha=t,h.fillStyle=`rgb(255,${a},${o})`,h.beginPath(),h.arc(e.x,e.y,e.size*t,0,Math.PI*2),h.fill()}h.globalAlpha=1,x<2500&&r>0?b=requestAnimationFrame(t=>C(t,e)):S||(u(!0),d.current||(d.current=!0,p.current?.()))};return b=requestAnimationFrame(e=>C(e,e)),()=>{S=!0,cancelAnimationFrame(b)}},[a,s,e,t]),(0,l.jsxs)(`div`,{className:f.burnAway,children:[(0,l.jsxs)(`div`,{ref:r,className:f.stage,children:[!s&&(0,l.jsx)(`span`,{className:f.text,style:{fontSize:t,opacity:+!a},children:e}),(0,l.jsx)(`canvas`,{ref:i,className:f.canvas})]}),!a&&!s&&(0,l.jsx)(`button`,{type:`button`,className:f.trigger,onClick:m,children:`Ignite`}),s&&(0,l.jsx)(`p`,{className:f.hint,children:`Gone.`})]})},m={aurora:`cos-aurora-dJJb8`,band:`cos-band-S5CoR`,"aurora-flow":`cos-aurora-flow-wU8TY`},h=[`#00ff87`,`#60efff`,`#7b2ff7`,`#f107a3`],g=({width:e=800,height:t=500,colors:n=h})=>{let r=n.length>=2?n:h;return(0,l.jsx)(`div`,{className:m.aurora,style:{width:e,height:t},children:r.map((e,t)=>(0,l.jsx)(`div`,{className:m.band,style:{"--aurora-color":e,"--aurora-delay":`${t*-3}s`,"--aurora-duration":`${12+t*2}s`}},e+t))})},_=e=>{let t=()=>e(document.hidden);return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},v=(e,t,n)=>Math.min(n,Math.max(t,e)),y={audioVisualizer:`cos-audioVisualizer-r5dHp`,canvas:`cos-canvas-UNEea`},b=({width:e=400,height:t=120,barCount:n=32,useMic:r=!1})=>{let i=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let a=i.current;if(!a)return;let o=window.devicePixelRatio||1;a.width=e*o,a.height=t*o;let s=a.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=0,l=document.hidden,u=null,d=null,f=null,p=null,m=0,h=!1,g=_(e=>{l=e});(async()=>{if(!(!r||!navigator.mediaDevices?.getUserMedia))try{if(p=await navigator.mediaDevices.getUserMedia({audio:!0}),h){p.getTracks().forEach(e=>e.stop()),p=null;return}u=new AudioContext,d=u.createAnalyser(),d.fftSize=256,u.createMediaStreamSource(p).connect(d),f=new Uint8Array(d.frequencyBinCount)}catch{}})();let v=()=>{if(c=requestAnimationFrame(v),l)return;let r=Array(n).fill(0);if(d&&f){d.getByteFrequencyData(f);let e=Math.floor(f.length/n);for(let t=0;t<n;t++)r[t]=f[t*e]/255}else{m+=.08;for(let e=0;e<n;e++)r[e]=(Math.sin(m+e*.35)+1)*.35+Math.random()*.15}s.fillStyle=`#0f172a`,s.fillRect(0,0,e,t);let i=(e-3*(n-1))/n;for(let e=0;e<n;e++){let n=Math.max(4,r[e]*t*.9),a=e*(i+3),o=t-n,c=s.createLinearGradient(0,o,0,t);c.addColorStop(0,`#a78bfa`),c.addColorStop(1,`#38bdf8`),s.fillStyle=c,s.beginPath(),s.roundRect(a,o,i,n,2),s.fill()}};return v(),()=>{h=!0,cancelAnimationFrame(c),g(),p?.getTracks().forEach(e=>e.stop()),u?.close()}},[n,t,r,e]),(0,l.jsx)(`div`,{className:y.audioVisualizer,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:y.canvas,style:{width:e,height:t}})})},x={canvasClock:`cos-canvasClock-QvdV3`,canvasTarget:`cos-canvasTarget-x-odC`},S=({width:e=400,height:t=400})=>{let n=(0,c.useRef)(null),r=Math.min(e,t),i=r/2-16,a=r/2,o=(0,c.useCallback)(e=>{e.clearRect(0,0,r,r),e.save(),e.translate(a,a),e.beginPath(),e.arc(0,0,i,0,Math.PI*2),e.fillStyle=`#fff`,e.fill(),e.strokeStyle=`#d1d5db`,e.lineWidth=2,e.stroke();for(let t=0;t<60;t++){let n=t/60*Math.PI*2,r=i-(t%5==0?14:8);e.beginPath(),e.moveTo(Math.cos(n)*r,Math.sin(n)*r),e.lineTo(Math.cos(n)*i,Math.sin(n)*i),e.strokeStyle=t%5==0?`#374151`:`#9ca3af`,e.lineWidth=t%5==0?2:1,e.stroke()}e.fillStyle=`#111827`,e.font=`bold ${Math.floor(r/22)}px system-ui, sans-serif`,e.textAlign=`center`,e.textBaseline=`middle`;for(let t=1;t<=12;t++){let n=t/12*Math.PI*2-Math.PI/2,r=i-32;e.fillText(String(t),Math.cos(n)*r,Math.sin(n)*r)}let t=new Date,n=t.getHours()%12,o=t.getMinutes(),s=t.getSeconds(),c=t.getMilliseconds(),l=(t,n,r,i,a)=>{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()},u=(n+o/60)/12*Math.PI*2-Math.PI/2,d=(o+s/60)/60*Math.PI*2-Math.PI/2,f=(s+c/1e3)/60*Math.PI*2-Math.PI/2;l(u,i*.5,4,`#111827`,`rgb(0 0 0 / 40%)`),l(d,i*.72,3,`#1e80ff`,`rgb(30 128 255 / 40%)`),l(f,i*.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()},[a,i,r]);return(0,c.useEffect)(()=>{let e=n.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=r*t,e.height=r*t;let i=e.getContext(`2d`);if(!i)return;i.setTransform(t,0,0,t,0,0);let a=0,s=document.hidden,c=_(e=>{s=e}),l=()=>{s||o(i),a=requestAnimationFrame(l)};return l(),()=>{cancelAnimationFrame(a),c()}},[o,r]),(0,l.jsx)(`div`,{className:x.canvasClock,style:{width:r,height:r},children:(0,l.jsx)(`canvas`,{ref:n,className:x.canvasTarget,style:{width:r,height:r}})})},C={chargeContainer:`cos-chargeContainer-4t9qo`,text:`cos-text-2k7eH`,contrast:`cos-contrast-PNep9`,hueRotate:`cos-hueRotate-bMJ-k`,bubble:`cos-bubble-VXfOd`,moveUp:`cos-moveUp-1Vz9j`,circle:`cos-circle-m4vwX`,circleRotate:`cos-circleRotate-bgFw5`,button:`cos-button-myCst`},w=15,T=258,E=e=>{let{initQuantity:t=0,value:n,onChange:r,autoCharge:i=!0,interval:a=500,step:o=.01}=e,s=(0,c.useRef)(null),u=n!==void 0,[d,f]=(0,c.useState)(()=>v(t,0,100)),p=v(u?n:d,0,100),m=(0,c.useRef)(p),h=(0,c.useRef)(r);(0,c.useEffect)(()=>{h.current=r},[r]),(0,c.useEffect)(()=>{m.current=p},[p]),(0,c.useEffect)(()=>{let e=s.current;if(!e)return;let t=()=>{let t=Math.max(0,e.clientHeight-T);e.style.setProperty(`--charge-rise-max`,`${t}px`)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,c.useEffect)(()=>{if(!i)return;let e=window.setInterval(()=>{if(m.current>=100)return;let e=Math.min(100,Number((m.current+o).toFixed(2)));u?h.current?.(e):f(e)},a);return()=>clearInterval(e)},[i,a,u,o]);let g=p.toFixed(2);return(0,l.jsxs)(`div`,{ref:s,className:C.chargeContainer,"data-auto":i?`true`:`false`,style:{"--charge-pct":p},children:[(0,l.jsxs)(`div`,{className:C.contrast,children:[Array.from({length:w},(e,t)=>(0,l.jsx)(`span`,{className:C.bubble,"data-index":t+1},t)),(0,l.jsx)(`div`,{className:C.circle}),(0,l.jsx)(`div`,{className:C.button})]}),(0,l.jsxs)(`div`,{className:C.text,children:[g,`%`]})]})},D={clickSpark:`cos-clickSpark-db9Om`,canvas:`cos-canvas-p9fnQ`,content:`cos-content-7uE4T`,hint:`cos-hint-UqpWX`},ee=({children:e,color:t=`#fbbf24`,count:n=16})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)(0),s=(0,c.useCallback)((e,t)=>{for(let r=0;r<n;r++){let i=Math.PI*2*r/n+Math.random()*.3,o=Math.random()*4+2;a.current.push({x:e,y:t,vx:Math.cos(i)*o,vy:Math.sin(i)*o,alpha:1,size:Math.random()*3+2})}},[n]);return(0,c.useEffect)(()=>{let e=i.current,n=r.current;if(!e||!n)return;let s=e.getContext(`2d`);if(!s)return;let c=()=>{let t=window.devicePixelRatio||1,{width:r,height:i}=n.getBoundingClientRect();e.width=r*t,e.height=i*t,s.setTransform(t,0,0,t,0,0)};c();let l=new ResizeObserver(c);l.observe(n);let u=document.hidden,d=_(e=>{u=e}),f=()=>{if(o.current=requestAnimationFrame(f),u)return;let{width:e,height:r}=n.getBoundingClientRect();s.clearRect(0,0,e,r),a.current=a.current.filter(e=>(e.x+=e.vx,e.y+=e.vy,e.vy+=.15,e.alpha-=.03,e.alpha<=0?!1:(s.beginPath(),s.arc(e.x,e.y,e.size,0,Math.PI*2),s.fillStyle=t,s.globalAlpha=e.alpha,s.fill(),s.globalAlpha=1,!0)))};return f(),()=>{cancelAnimationFrame(o.current),l.disconnect(),d()}},[t]),(0,l.jsxs)(`div`,{ref:r,className:D.clickSpark,onClick:e=>{let t=r.current?.getBoundingClientRect();t&&s(e.clientX-t.left,e.clientY-t.top)},children:[(0,l.jsx)(`canvas`,{ref:i,className:D.canvas}),e&&(0,l.jsx)(`div`,{className:D.content,children:e}),!e&&(0,l.jsx)(`p`,{className:D.hint,children:`点击任意位置产生火花`})]})},O={confetti:`cos-confetti-MeNtU`,canvas:`cos-canvas-0T3Vs`,hint:`cos-hint-sGHEi`},k=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`,`#38bdf8`],A=()=>k[Math.floor(Math.random()*k.length)],j=(e,t,n)=>{let r=e/2,i=t*.6;return Array.from({length:n},()=>{let e=(Math.random()-.5)*Math.PI,t=Math.random()*12+6;return{x:r+(Math.random()-.5)*40,y:i,vx:Math.cos(e)*t,vy:Math.sin(e)*t-Math.random()*8,rotation:Math.random()*360,rotationSpeed:(Math.random()-.5)*12,color:A(),width:Math.random()*8+4,height:Math.random()*6+3,alpha:1,gravity:Math.random()*.15+.12}})},M=(0,c.forwardRef)(({width:e=800,height:t=400,auto:n=!0,particleCount:r=120},i)=>{let a=(0,c.useRef)(null),o=(0,c.useRef)([]),s=(0,c.useRef)(0),u=(0,c.useRef)({width:e,height:t,particleCount:r});u.current={width:e,height:t,particleCount:r};let d=(0,c.useCallback)(()=>{let{width:e,height:t,particleCount:n}=u.current;o.current.push(...j(e,t,n))},[]);return(0,c.useImperativeHandle)(i,()=>({burst:d}),[d]),(0,c.useEffect)(()=>{n&&d()},[n,d]),(0,c.useEffect)(()=>{let n=a.current;if(!n)return;let r=window.devicePixelRatio||1;n.width=e*r,n.height=t*r;let i=n.getContext(`2d`);if(!i)return;i.setTransform(r,0,0,r,0,0);let c=document.hidden,l=_(e=>{c=e}),u=()=>{s.current=requestAnimationFrame(u),!c&&(i.clearRect(0,0,e,t),o.current=o.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>t+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))))};return u(),()=>{cancelAnimationFrame(s.current),l()}},[t,e]),(0,l.jsxs)(`div`,{className:O.confetti,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:a,className:O.canvas,style:{width:e,height:t},onClick:d}),(0,l.jsx)(`p`,{className:O.hint,children:`点击画布再次喷射`})]})});M.displayName=`Confetti`;var te={cyberGrid:`cos-cyberGrid-VgJwl`,canvas:`cos-canvas--Mq-O`},ne=({width:e=800,height:t=500,color:n=`#00f0ff`,speed:r=1})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)(0),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let s=i.current;if(!s)return;let c=window.devicePixelRatio||1;s.width=e*c,s.height=t*c;let l=s.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=t*.45,d=document.hidden,f=_(e=>{d=e}),p=()=>{if(a.current=requestAnimationFrame(p),d)return;o.current=(o.current+r*1.5)%40,l.fillStyle=`#050510`,l.fillRect(0,0,e,t);let i=l.createLinearGradient(0,0,0,u);i.addColorStop(0,`#0a0a20`),i.addColorStop(1,`#050510`),l.fillStyle=i,l.fillRect(0,0,e,u);let s=e/2;l.strokeStyle=n,l.shadowColor=n,l.shadowBlur=8,l.lineWidth=1;for(let n=-12;n<=12;n++){let r=n/12*e*1.2;l.beginPath(),l.moveTo(s+r*.05,u),l.lineTo(s+r,t),l.globalAlpha=.3+(1-Math.abs(n)/12)*.5,l.stroke()}l.globalAlpha=1;let c=Math.ceil(t/40)+2;for(let n=0;n<c;n++){let r=u+(n*40+o.current)/(t-u)*(t-u)%(t-u),i=(r-u)/(t-u)*.8;l.beginPath(),l.moveTo(0,r),l.lineTo(e,r),l.globalAlpha=i,l.stroke()}l.shadowBlur=0,l.globalAlpha=1;let f=l.createRadialGradient(s,u,0,s,u,e*.4);f.addColorStop(0,`${n}33`),f.addColorStop(1,`transparent`),l.fillStyle=f,l.fillRect(0,0,e,t)};return p(),()=>{cancelAnimationFrame(a.current),f()}},[n,t,r,e]),(0,l.jsx)(`div`,{className:te.cyberGrid,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:te.canvas,style:{width:e,height:t}})})},N={countdown:`cos-countdown-5ZKKP`,unit:`cos-unit-dth8N`,value:`cos-value-yVzcP`,label:`cos-label-pAMEs`,ended:`cos-ended-c0dsD`,pulse:`cos-pulse-krQd-`,invalid:`cos-invalid-d6t-L`},re=e=>e instanceof Date?e.getTime():typeof e==`number`?e:new Date(e).getTime(),ie=e=>{let t=Math.max(0,e-Date.now()),n=Math.floor(t/1e3);return{total:t,days:Math.floor(n/86400),hours:Math.floor(n%86400/3600),minutes:Math.floor(n%3600/60),seconds:n%60}},ae=[{key:`days`,label:`天`},{key:`hours`,label:`时`},{key:`minutes`,label:`分`},{key:`seconds`,label:`秒`}],oe=({targetDate:e,onEnd:t,showLabels:n=!0,color:r=`#f472b6`})=>{let i=(0,c.useMemo)(()=>re(e),[e]),a=!Number.isNaN(i),[,o]=(0,c.useState)(0),s=(0,c.useRef)(!1),u=(0,c.useRef)(t),d=a?ie(i):{days:0,hours:0,minutes:0,seconds:0,total:0};return(0,c.useEffect)(()=>{u.current=t},[t]),(0,c.useEffect)(()=>{if(!a)return;if(s.current=!1,Date.now()>=i){s.current=!0,u.current?.();return}let e=window.setInterval(()=>{o(e=>e+1),Date.now()>=i&&!s.current&&(s.current=!0,u.current?.(),clearInterval(e))},1e3);return()=>clearInterval(e)},[a,i]),a?(0,l.jsxs)(`div`,{className:N.countdown,style:{"--countdown-color":r},children:[ae.map(({key:e,label:t})=>(0,l.jsxs)(`div`,{className:N.unit,children:[(0,l.jsx)(`div`,{className:N.value,children:String(d[e]).padStart(2,`0`)}),n&&(0,l.jsx)(`span`,{className:N.label,children:t})]},e)),d.total<=0&&(0,l.jsx)(`p`,{className:N.ended,children:`时间到!`})]}):(0,l.jsx)(`div`,{className:N.countdown,children:(0,l.jsx)(`p`,{className:N.invalid,children:`无效的目标时间`})})},se={dnaHelix:`cos-dnaHelix-nEQLW`,canvas:`cos-canvas-uEV8B`},ce=({width:e=200,height:t=360,speed:n=1,color:r=`#38bdf8`})=>{let i=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let a=i.current;if(!a)return;let o=window.devicePixelRatio||1;a.width=e*o,a.height=t*o;let s=a.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=0,l=0,u=document.hidden,d=_(e=>{u=e}),f=()=>{if(l=requestAnimationFrame(f),u)return;c+=.03*n,s.fillStyle=`#0f172a`,s.fillRect(0,0,e,t);let i=e/2,a=e*.32;for(let e=0;e<18;e++){let n=e/17*(t-40)+20,o=c+e*.4,l=i+Math.sin(o)*a,u=i+Math.sin(o+Math.PI)*a,d=Math.cos(o),f=5+d*2;s.beginPath(),s.moveTo(l,n),s.lineTo(u,n),s.strokeStyle=`rgb(148 163 184 / ${30+Math.abs(d)*30}%)`,s.lineWidth=1.5,s.stroke(),s.beginPath(),s.arc(l,n,f,0,Math.PI*2),s.fillStyle=d>0?r:`#a78bfa`,s.fill(),s.beginPath(),s.arc(u,n,f,0,Math.PI*2),s.fillStyle=d>0?`#a78bfa`:r,s.fill()}};return f(),()=>{cancelAnimationFrame(l),d()}},[r,t,n,e]),(0,l.jsx)(`div`,{className:se.dnaHelix,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:se.canvas,style:{width:e,height:t}})})},le={electricArc:`cos-electricArc-BFlY3`,canvas:`cos-canvas-iowDx`},ue=(e,t,n,r,i,a)=>{if(a<=0)return[[e,t],[n,r]];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=ue(e,t,o+f,s+p,i*.6,a-1),h=ue(o+f,s+p,n,r,i*.6,a-1);return[...m.slice(0,-1),...h]},de=({width:e=320,height:t=160,color:n=`#67e8f9`})=>{let r=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let i=r.current;if(!i)return;let a=window.devicePixelRatio||1;i.width=e*a,i.height=t*a;let o=i.getContext(`2d`);if(!o)return;o.setTransform(a,0,0,a,0,0);let s=t/2,c=e-40,l=t/2,u=0,d=document.hidden,f=_(e=>{d=e}),p=()=>{if(u=requestAnimationFrame(p),d)return;o.fillStyle=`#0f172a`,o.fillRect(0,0,e,t);let r=ue(40,s,c,l,40,5);o.beginPath(),r.forEach(([e,t],n)=>n===0?o.moveTo(e,t):o.lineTo(e,t)),o.strokeStyle=n,o.lineWidth=2,o.shadowColor=n,o.shadowBlur=12,o.stroke(),o.shadowBlur=0,o.beginPath(),r.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])=>{o.beginPath(),o.arc(e,t,6,0,Math.PI*2),o.fillStyle=n,o.fill()})};return p(),()=>{cancelAnimationFrame(u),f()}},[n,t,e]),(0,l.jsx)(`div`,{className:le.electricArc,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:le.canvas,style:{width:e,height:t}})})},fe={cursorTrail:`cos-cursorTrail-fpz5p`,canvas:`cos-canvas-Iuyp3`,hint:`cos-hint-9GLHx`},pe=({color:e=`#38bdf8`,length:t=20,width:n=800,height:r=400})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)({x:n/2,y:r/2}),s=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let c=i.current;if(!c)return;let l=window.devicePixelRatio||1;c.width=n*l,c.height=r*l;let u=c.getContext(`2d`);if(!u)return;u.setTransform(l,0,0,l,0,0);let d=document.hidden,f=_(e=>{d=e}),p=()=>{if(s.current=requestAnimationFrame(p),d)return;let{x:i,y:c}=o.current;a.current.unshift({x:i,y:c,life:1}),a.current.length>t&&(a.current.length=t),u.fillStyle=`rgb(15 23 42 / 15%)`,u.fillRect(0,0,n,r);let l=a.current;for(let t=0;t<l.length;t++){let n=l[t],r=1-t/l.length,i=(1-t/l.length)*8+2;u.beginPath(),u.arc(n.x,n.y,i,0,Math.PI*2),u.fillStyle=e,u.globalAlpha=r*.8,u.fill()}u.globalAlpha=1};return p(),()=>{cancelAnimationFrame(s.current),f()}},[e,r,t,n]),(0,l.jsxs)(`div`,{className:fe.cursorTrail,style:{width:n,height:r},children:[(0,l.jsx)(`canvas`,{ref:i,className:fe.canvas,style:{width:n,height:r},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect();o.current={x:e.clientX-t.left,y:e.clientY-t.top}}}),(0,l.jsx)(`p`,{className:fe.hint,children:`移动鼠标查看粒子轨迹`})]})},P={diceRoll:`cos-diceRoll-GDwjV`,scene:`cos-scene-tmnKM`,cube:`cos-cube-RklEa`,rolling:`cos-rolling-2ocEq`,face:`cos-face-10eAF`,dot:`cos-dot-p5AzF`,face1:`cos-face1-Ev-x5`,face2:`cos-face2-2M17p`,face3:`cos-face3-Wd6T4`,face4:`cos-face4-RsRwQ`,face5:`cos-face5-PiJbu`,face6:`cos-face6-Yp-MX`,rollBtn:`cos-rollBtn-nXMWJ`,result:`cos-result-kXzu9`},me={1:{x:0,y:0},2:{x:0,y:180},3:{x:0,y:-90},4:{x:0,y:90},5:{x:-90,y:0},6:{x:90,y:0}},he=({onRoll:e,sides:t=6})=>{let[n,r]=(0,c.useState)(!1),[i,a]=(0,c.useState)(1),[o,s]=(0,c.useState)({x:0,y:0,z:0}),u=(0,c.useRef)(e),d=(0,c.useRef)(0);(0,c.useEffect)(()=>{u.current=e},[e]),(0,c.useEffect)(()=>()=>clearTimeout(d.current),[]);let f=()=>{if(n)return;r(!0);let e=Math.floor(Math.random()*t)+1,i=me[e]??me[1],o=360*(3+Math.floor(Math.random()*3)),c=360*(3+Math.floor(Math.random()*3));s({x:i.x+o,y:i.y+c,z:Math.random()*360}),clearTimeout(d.current),d.current=window.setTimeout(()=>{a(e),r(!1),u.current?.(e)},1200)},p=e=>({1:[[50,50]],2:[[25,25],[75,75]],3:[[25,25],[50,50],[75,75]],4:[[25,25],[75,25],[25,75],[75,75]],5:[[25,25],[75,25],[50,50],[25,75],[75,75]],6:[[25,25],[75,25],[25,50],[75,50],[25,75],[75,75]]}[e]??[]).map(([e,t],n)=>(0,l.jsx)(`span`,{className:P.dot,style:{left:`${e}%`,top:`${t}%`}},n));return(0,l.jsxs)(`div`,{className:P.diceRoll,children:[(0,l.jsx)(`div`,{className:P.scene,children:(0,l.jsx)(`div`,{className:`${P.cube} ${n?P.rolling:``}`,style:{transform:`rotateX(${o.x}deg) rotateY(${o.y}deg) rotateZ(${o.z}deg)`},children:[1,2,3,4,5,6].map(e=>(0,l.jsx)(`div`,{className:`${P.face} ${P[`face${e}`]}`,children:p(e)},e))})}),(0,l.jsx)(`button`,{type:`button`,className:P.rollBtn,onClick:f,disabled:n,children:n?`掷骰中...`:`掷骰子`}),!n&&(0,l.jsxs)(`p`,{className:P.result,children:[`点数: `,i]})]})},ge={doublePendulum:`cos-doublePendulum-FUEeK`,canvas:`cos-canvas-OVkhW`},_e=({width:e=400,height:t=400,trailLength:n=120,color:r=`#38bdf8`,color2:i=`#a78bfa`})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)({theta1:Math.PI/2+.1,theta2:Math.PI/2-.2,omega1:0,omega2:0}),s=(0,c.useRef)([]);return(0,c.useEffect)(()=>{let c=a.current;if(!c)return;let l=window.devicePixelRatio||1;c.width=e*l,c.height=t*l;let u=c.getContext(`2d`);if(!u)return;u.setTransform(l,0,0,l,0,0);let d=e/2,f=t*.28,p=t*.28,m=t*.26,h=9.8,g=.016,v=0,y=document.hidden,b=_(e=>{y=e}),x=()=>{if(v=requestAnimationFrame(x),y)return;let a=o.current,{theta1:c,theta2:l,omega1:_,omega2:b}=a,S=Math.sin(c),C=Math.sin(c-l),w=Math.cos(c-l),T=Math.cos(c),E=p*(3-1*Math.cos(2*c-2*l)),D=(-9.8*3*S-1*h*Math.sin(c-2*l)-2*C*1*(b*b*m+_*_*p*w))/E,ee=2*C*(_*_*p*2+h*2*T+b*b*m*1*w)/(m*(3-1*Math.cos(2*c-2*l)));a.omega1+=D*g,a.omega2+=ee*g,a.theta1+=a.omega1*g,a.theta2+=a.omega2*g;let O=d+p*Math.sin(a.theta1),k=f+p*Math.cos(a.theta1),A=O+m*Math.sin(a.theta2),j=k+m*Math.cos(a.theta2),M=s.current;M.push({x:A,y:j}),M.length>n&&M.shift(),u.fillStyle=`rgba(15, 23, 42, 0.22)`,u.fillRect(0,0,e,t),M.length>1&&(u.beginPath(),M.forEach((e,t)=>t===0?u.moveTo(e.x,e.y):u.lineTo(e.x,e.y)),u.strokeStyle=i,u.lineWidth=1.5,u.globalAlpha=.7,u.stroke(),u.globalAlpha=1),u.beginPath(),u.moveTo(d,f),u.lineTo(O,k),u.lineTo(A,j),u.strokeStyle=`#64748b`,u.lineWidth=2,u.stroke(),u.beginPath(),u.arc(d,f,5,0,Math.PI*2),u.fillStyle=`#94a3b8`,u.fill(),u.beginPath(),u.arc(O,k,10,0,Math.PI*2),u.fillStyle=r,u.shadowColor=r,u.shadowBlur=10,u.fill(),u.shadowBlur=0,u.beginPath(),u.arc(A,j,10,0,Math.PI*2),u.fillStyle=i,u.shadowColor=i,u.shadowBlur=10,u.fill(),u.shadowBlur=0};return u.fillStyle=`#0f172a`,u.fillRect(0,0,e,t),x(),()=>{cancelAnimationFrame(v),b()}},[r,i,t,n,e]),(0,l.jsx)(`div`,{className:ge.doublePendulum,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:ge.canvas,style:{width:e,height:t}})})},ve={fireworks:`cos-fireworks-fsSqL`,canvas:`cos-canvas-spL8G`,hint:`cos-hint-5XDRH`},ye=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`],be=.12,xe=240,Se=()=>ye[Math.floor(Math.random()*ye.length)],Ce=(e,t,n)=>{let r=60+Math.floor(Math.random()*30);return Array.from({length:r},()=>{let r=Math.random()*Math.PI*2,i=Math.random()*4+2;return{x:e,y:t,vx:Math.cos(r)*i,vy:Math.sin(r)*i,alpha:1,color:Math.random()>.3?n:Se(),decay:Math.random()*.015+.01}})},we=(0,c.forwardRef)(({width:e=800,height:t=500,auto:n=!0},r)=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)(0),s=(0,c.useCallback)(n=>{let r=n??Math.random()*e*.6+e*.2;a.current.push({x:r,y:t,vy:-(Math.random()*4+6),targetY:Math.random()*t*.35+t*.15,color:Se(),exploded:!1,particles:[],age:0})},[t,e]);return(0,c.useImperativeHandle)(r,()=>({launch:s}),[s]),(0,c.useEffect)(()=>{let r=i.current;if(!r)return;let c=window.devicePixelRatio||1;r.width=e*c,r.height=t*c;let l=r.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=0,d=document.hidden,f=_(e=>{d=e}),p=()=>{o.current=requestAnimationFrame(p),!d&&(l.fillStyle=`rgb(15 23 42 / 25%)`,l.fillRect(0,0,e,t),a.current=a.current.filter(e=>{if(!e.exploded){e.age+=1,e.y+=e.vy,e.vy+=be,l.beginPath(),l.arc(e.x,e.y,2.5,0,Math.PI*2),l.fillStyle=e.color,l.fill();let t=e.vy>=0,n=e.y<=e.targetY,r=e.y<0,i=e.age>=xe;return(t||n||r||i)&&(e.exploded=!0,e.particles=Ce(e.x,e.y,e.color)),!0}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:(l.beginPath(),l.arc(e.x,e.y,2,0,Math.PI*2),l.fillStyle=e.color,l.globalAlpha=e.alpha,l.fill(),l.globalAlpha=1,!0))),e.particles.length>0}))};return p(),n&&(u=window.setInterval(()=>s(),1200)),()=>{cancelAnimationFrame(o.current),clearInterval(u),f()}},[n,t,s,e]),(0,l.jsxs)(`div`,{className:ve.fireworks,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:i,className:ve.canvas,style:{width:e,height:t},onClick:e=>{let t=e.currentTarget.getBoundingClientRect();s(e.clientX-t.left)}}),(0,l.jsx)(`p`,{className:ve.hint,children:`点击画布燃放烟花`})]})});we.displayName=`Fireworks`;var F={flipCounter:`cos-flipCounter-3LuI0`,digit:`cos-digit-yJRPy`,digitCard:`cos-digitCard-zZUzt`,staticTop:`cos-staticTop-aLQcm`,staticBottom:`cos-staticBottom-9y0gu`,flap:`cos-flap-i3YKR`,flapTop:`cos-flapTop-70z-k`,flapBottom:`cos-flapBottom-zhMZe`,isFlipping:`cos-isFlipping-EVEdI`,"fold-top":`cos-fold-top-v-6XJ`,"unfold-bottom":`cos-unfold-bottom-e2gzU`},Te=(e,t)=>Math.max(0,Math.floor(e)).toString().padStart(t,`0`).slice(-t),Ee=({digit:e,color:t,duration:n})=>{let r=(0,c.useRef)(e),[i,a]=(0,c.useState)(!1),[o,s]=(0,c.useState)(e);(0,c.useEffect)(()=>{if(e===r.current)return;s(r.current),a(!0),r.current=e;let t=window.setTimeout(()=>a(!1),n);return()=>clearTimeout(t)},[e,n]);let u=i?o:e;return(0,l.jsx)(`div`,{className:F.digit,style:{"--flip-color":t,"--flip-duration":`${n}ms`},children:(0,l.jsxs)(`div`,{className:`${F.digitCard} ${i?F.isFlipping:``}`,children:[(0,l.jsx)(`div`,{className:F.staticTop,children:(0,l.jsx)(`span`,{children:u})}),(0,l.jsx)(`div`,{className:F.staticBottom,children:(0,l.jsx)(`span`,{children:u})}),i&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`${F.flap} ${F.flapTop}`,children:(0,l.jsx)(`span`,{children:o})}),(0,l.jsx)(`div`,{className:`${F.flap} ${F.flapBottom}`,children:(0,l.jsx)(`span`,{children:e})})]})]})})},De=({value:e,digits:t=4,color:n=`#38bdf8`,duration:r=600})=>{let i=Te(e,t).split(``);return(0,l.jsx)(`div`,{className:F.flipCounter,children:i.map((e,t)=>(0,l.jsx)(Ee,{digit:e,color:n,duration:r},t))})},Oe={gradientFlow:`cos-gradientFlow-XhN16`,text:`cos-text-ORuqk`,flow:`cos-flow-9FzMA`},ke=[`#ff00de`,`#7c3aed`,`#00f0ff`,`#38bdf8`,`#ff00de`],Ae=({text:e=`GRADIENT`,colors:t=ke,fontSize:n=64})=>{let r=t.length>=2?t.join(`, `):ke.join(`, `);return(0,l.jsx)(`div`,{className:Oe.gradientFlow,children:(0,l.jsx)(`h1`,{className:Oe.text,style:{fontSize:n,backgroundImage:`linear-gradient(90deg, ${r})`},children:e})})},je={glitchText:`cos-glitchText-dZ-sR`,text:`cos-text-JsPHN`,"glitch-1":`cos-glitch-1-s9pqH`,"glitch-2":`cos-glitch-2-GhFB-`},Me=({text:e=`GLITCH`,color:t=`#f8fafc`,glitchColor1:n=`#ff00de`,glitchColor2:r=`#00f0ff`,fontSize:i=64})=>(0,l.jsx)(`div`,{className:je.glitchText,children:(0,l.jsx)(`h1`,{className:je.text,"data-text":e,style:{fontSize:i,"--glitch-color":t,"--glitch-c1":n,"--glitch-c2":r},children:e})}),Ne={gravityBalls:`cos-gravityBalls-LdwFo`,canvas:`cos-canvas-n7esd`},Pe=[`#38bdf8`,`#a78bfa`,`#f472b6`,`#4ade80`,`#fbbf24`],Fe=({width:e=400,height:t=300,ballCount:n=12})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)([]);return(0,c.useEffect)(()=>{i.current=Array.from({length:n},()=>({x:Math.random()*(e-40)+20,y:t*.5*Math.random()+10,vx:(Math.random()-.5)*4,vy:Math.random()*2,r:Math.random()*10+8,color:Pe[Math.floor(Math.random()*Pe.length)]}))},[n,t,e]),(0,c.useEffect)(()=>{let n=r.current;if(!n)return;let a=window.devicePixelRatio||1;n.width=e*a,n.height=t*a;let o=n.getContext(`2d`);if(!o)return;o.setTransform(a,0,0,a,0,0);let s=0,c=document.hidden,l=_(e=>{c=e}),u=()=>{if(s=requestAnimationFrame(u),c)return;let n=i.current;o.fillStyle=`#0f172a`,o.fillRect(0,0,e,t);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);for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++){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;if(s<c){let e=a/s,t=o/s,n=c-s;r.x-=e*n*.5,r.y-=t*n*.5,i.x+=e*n*.5,i.y+=t*n*.5;let l=(r.vx-i.vx)*e+(r.vy-i.vy)*t;l>0&&(r.vx-=l*e,r.vy-=l*t,i.vx+=l*e,i.vy+=l*t)}}for(let e of n){o.beginPath(),o.arc(e.x,e.y,e.r,0,Math.PI*2);let t=o.createRadialGradient(e.x-e.r*.3,e.y-e.r*.3,0,e.x,e.y,e.r);t.addColorStop(0,`#fff`),t.addColorStop(.3,e.color),t.addColorStop(1,e.color),o.fillStyle=t,o.fill()}};return u(),()=>{cancelAnimationFrame(s),l()}},[t,e]),(0,l.jsx)(`div`,{className:Ne.gravityBalls,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:Ne.canvas,style:{width:e,height:t}})})},I={wrap:`cos-wrap-r1gGL`,card:`cos-card-3W10s`,shine:`cos-shine-0xjID`,image:`cos-image-AV2XG`,placeholder:`cos-placeholder-wuuL3`,info:`cos-info-CNR0r`},Ie=({title:e=`全息卡片`,subtitle:t=`移动鼠标体验 3D 效果`,image:n})=>{let r=(0,c.useRef)(null);return(0,l.jsx)(`div`,{className:I.wrap,children:(0,l.jsxs)(`div`,{ref:r,className:I.card,onMouseMove:e=>{let t=r.current;if(!t)return;let n=t.getBoundingClientRect(),i=(e.clientX-n.left)/n.width-.5,a=(e.clientY-n.top)/n.height-.5;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}%`)},onMouseLeave:()=>{let e=r.current;e&&(e.style.setProperty(`--rx`,`0deg`),e.style.setProperty(`--ry`,`0deg`),e.style.setProperty(`--gx`,`50%`),e.style.setProperty(`--gy`,`50%`))},children:[(0,l.jsx)(`div`,{className:I.shine}),n?(0,l.jsx)(`img`,{src:n,alt:e,className:I.image}):(0,l.jsx)(`div`,{className:I.placeholder,children:(0,l.jsx)(`span`,{children:`✦`})}),(0,l.jsxs)(`div`,{className:I.info,children:[(0,l.jsx)(`h3`,{children:e}),(0,l.jsx)(`p`,{children:t})]})]})})},L={liquidProgress:`cos-liquidProgress-ABZZA`,svg:`cos-svg-YdTvy`,track:`cos-track-IhMjO`,ring:`cos-ring-6PKMg`,fillBg:`cos-fillBg-pwLI1`,wave:`cos-wave-CBwgG`,label:`cos-label-WYDqS`},Le=({value:e=0,max:t=100,size:n=160,color:r=`#38bdf8`})=>{let i=(0,c.useRef)(null),a=(0,c.useId)().replace(/:/g,``),o=v(t>0?e/t*100:0,0,100),s=100-o;return(0,c.useEffect)(()=>{let e=0,t=0,n=document.hidden,r=_(e=>{n=e}),a=()=>{if(!n){t+=.04;let e=i.current;if(e){let n=s+Math.sin(t)*2;e.setAttribute(`d`,`M0,${n} Q25,${n-4+Math.sin(t*1.3)*3} 50,${n} T100,${n} V100 H0 Z`)}}e=requestAnimationFrame(a)};return e=requestAnimationFrame(a),()=>{cancelAnimationFrame(e),r()}},[s]),(0,l.jsxs)(`div`,{className:L.liquidProgress,style:{width:n,height:n,"--liquid-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 100 100`,className:L.svg,children:[(0,l.jsx)(`defs`,{children:(0,l.jsx)(`clipPath`,{id:`clip-${a}`,children:(0,l.jsx)(`circle`,{cx:`50`,cy:`50`,r:45})})}),(0,l.jsx)(`circle`,{cx:`50`,cy:`50`,r:45,className:L.track,strokeWidth:10,fill:`none`}),(0,l.jsxs)(`g`,{clipPath:`url(#clip-${a})`,children:[(0,l.jsx)(`rect`,{x:`0`,y:`0`,width:`100`,height:`100`,className:L.fillBg}),(0,l.jsx)(`path`,{ref:i,className:L.wave,d:`M0,${s} Q25,${s-4} 50,${s} T100,${s} V100 H0 Z`})]}),(0,l.jsx)(`circle`,{cx:`50`,cy:`50`,r:45,className:L.ring,strokeWidth:10,fill:`none`})]}),(0,l.jsxs)(`span`,{className:L.label,children:[Math.round(o),`%`]})]})},Re={lorenzAttractor:`cos-lorenzAttractor--UAI7`,canvas:`cos-canvas-oeXce`},ze=({width:e=400,height:t=360,speed:n=1,color:r=`#f472b6`,pointCount:i=2e3})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let s=a.current;if(!s)return;let c=window.devicePixelRatio||1;s.width=e*c,s.height=t*c;let l=s.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=.005,d=[],f=.1,p=0,m=0;for(let e=0;e<i;e++){let e=10*(p-f),t=f*(28-m)-p,n=f*p-2.6666666666666665*m;f+=e*u,p+=t*u,m+=n*u,d.push({x:f,y:p,z:m})}let h=0,g=document.hidden,v=_(e=>{g=e}),y=(n,r,i,a)=>{let o=Math.cos(a),s=Math.sin(a),c=n*o-i*s,l=n*s+i*o,u=r;return{x:e/2+c*6,y:t/2-u*6,depth:l}},b=()=>{if(h=requestAnimationFrame(b),g)return;o.current+=.004*n;let i=o.current;l.fillStyle=`rgba(15, 23, 42, 0.15)`,l.fillRect(0,0,e,t);let a=d.map(e=>y(e.x,e.y,e.z,i));l.beginPath(),a.forEach((e,t)=>t===0?l.moveTo(e.x,e.y):l.lineTo(e.x,e.y)),l.strokeStyle=r,l.globalAlpha=.75,l.lineWidth=.9,l.stroke(),l.globalAlpha=1,a.forEach((e,t)=>{if(t%50!=0)return;let n=.2+(e.depth+30)/60*.6;l.beginPath(),l.arc(e.x,e.y,1.5,0,Math.PI*2),l.fillStyle=`#fff`,l.globalAlpha=Math.max(.1,Math.min(n,.9)),l.fill()}),l.globalAlpha=1};return l.fillStyle=`#0f172a`,l.fillRect(0,0,e,t),b(),()=>{cancelAnimationFrame(h),v()}},[r,t,i,n,e]),(0,l.jsx)(`div`,{className:Re.lorenzAttractor,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:Re.canvas,style:{width:e,height:t}})})},Be={liquidGlass:`cos-liquidGlass-Z3bQg`,panel:`cos-panel-XYboD`,content:`cos-content-MHfkS`},Ve=({children:e=`液态玻璃面板`,blur:t=16,borderRadius:n=20})=>(0,l.jsx)(`div`,{className:Be.liquidGlass,children:(0,l.jsx)(`div`,{className:Be.panel,style:{"--glass-blur":`${t}px`,"--glass-radius":`${n}px`},children:(0,l.jsx)(`div`,{className:Be.content,children:e})})}),He={magneticButton:`cos-magneticButton-GbRkE`,btn:`cos-btn--b2BJ`},Ue=({children:e=`磁吸按钮`,strength:t=.4,color:n=`#6366f1`})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(null);return(0,l.jsx)(`div`,{ref:r,className:He.magneticButton,onMouseMove:e=>{let n=r.current,a=i.current;if(!n||!a)return;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;a.style.transform=`translate(${l}px, ${u}px)`},onMouseLeave:()=>{let e=i.current;e&&(e.style.transform=`translate(0, 0)`)},children:(0,l.jsx)(`button`,{ref:i,type:`button`,className:He.btn,style:{"--btn-color":n},children:e})})},R={matrixRain:`cos-matrixRain-qg9HC`,canvas:`cos-canvas--AvpG`,overlay:`cos-overlay-knj3b`,title:`cos-title-sDfhs`,flicker:`cos-flicker-smHxl`,subtitle:`cos-subtitle-CWheW`},We=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ`,Ge=({width:e=800,height:t=500,density:n=.6,color:r=`#00ff41`,showOverlay:i=!0,title:a=`MATRIX`,subtitle:o=`数字雨效果`})=>{let s=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let i=s.current;if(!i)return;let a=window.devicePixelRatio||1;i.width=e*a,i.height=t*a;let o=i.getContext(`2d`);if(!o)return;o.setTransform(a,0,0,a,0,0);let c=Math.floor(e/16*n),l=Array.from({length:c},()=>Math.random()*-50),u=0,d=document.hidden,f=_(e=>{d=e}),p=()=>{u=requestAnimationFrame(p),!d&&(o.fillStyle=`rgb(0 0 0 / 8%)`,o.fillRect(0,0,e,t),o.font=`16px monospace`,l.forEach((e,i)=>{let a=We[Math.floor(Math.random()*53)],s=i/n*16;o.fillStyle=r,o.fillText(a,s,e*16),e*16>t&&Math.random()>.975&&(l[i]=0),l[i]+=1}))};return p(),()=>{cancelAnimationFrame(u),f()}},[r,n,t,e]),(0,l.jsxs)(`div`,{className:R.matrixRain,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:s,className:R.canvas,style:{width:e,height:t}}),i&&(0,l.jsxs)(`div`,{className:R.overlay,children:[(0,l.jsx)(`h2`,{className:R.title,children:a}),(0,l.jsx)(`p`,{className:R.subtitle,children:o})]})]})},Ke={metaballPool:`cos-metaballPool-JJaI9`,canvas:`cos-canvas-S7fDD`},qe=({width:e=400,height:t=300,ballCount:n=5,color:r=`#38bdf8`})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)({x:-999,y:-999,active:!1});return(0,c.useEffect)(()=>{let r=Math.max(2,Math.min(n,10));a.current=Array.from({length:r},()=>({x:Math.random()*(e-80)+40,y:Math.random()*(t-80)+40,vx:(Math.random()-.5)*2,vy:(Math.random()-.5)*2,r:28+Math.random()*18}))},[n,t,e]),(0,c.useEffect)(()=>{let n=i.current;if(!n)return;let r=window.devicePixelRatio||1,s=.5,c=Math.floor(e*s),l=Math.floor(t*s);n.width=e*r,n.height=t*r;let u=n.getContext(`2d`);if(!u)return;u.setTransform(r,0,0,r,0,0);let d=document.createElement(`canvas`);d.width=c,d.height=l;let f=d.getContext(`2d`);if(!f)return;let p=(e,t)=>{let r=n.getBoundingClientRect();o.current={x:e-r.left,y:t-r.top,active:!0}},m=()=>{o.current.active=!1},h=e=>p(e.clientX,e.clientY),g=e=>{e.touches[0]&&p(e.touches[0].clientX,e.touches[0].clientY)};n.addEventListener(`mousemove`,h),n.addEventListener(`mouseleave`,m),n.addEventListener(`touchmove`,g,{passive:!0}),n.addEventListener(`touchend`,m);let y=0,b=document.hidden,x=_(e=>{b=e}),S=()=>{if(y=requestAnimationFrame(S),b)return;let n=a.current,r=o.current;for(let i of n){if(r.active){let e=i.x-r.x,t=i.y-r.y,n=Math.hypot(e,t)||1;if(n<120){let r=(120-n)*.04;i.vx+=e/n*r,i.vy+=t/n*r}}i.vx*=.98,i.vy*=.98,i.x+=i.vx,i.y+=i.vy,i.x-i.r<0?(i.x=i.r,i.vx*=-.8):i.x+i.r>e&&(i.x=e-i.r,i.vx*=-.8),i.y-i.r<0?(i.y=i.r,i.vy*=-.8):i.y+i.r>t&&(i.y=t-i.r,i.vy*=-.8)}for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++){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)*.55;if(s<c){let e=a/s,t=o/s,n=c-s;r.x-=e*n*.5,r.y-=t*n*.5,i.x+=e*n*.5,i.y+=t*n*.5}}let i=f.createImageData(c,l),p=i.data;for(let e=0;e<l;e++)for(let t=0;t<c;t++){let r=t/s,i=e/s,a=0;for(let e of n){let t=r-e.x,n=i-e.y,o=t*t+n*n;a+=e.r*e.r/(o+1)}let o=(e*c+t)*4;a>1?(p[o]=56+v((a-1)*.8,0,1)*40,p[o+1]=189,p[o+2]=248,p[o+3]=255):p[o+3]=0}f.putImageData(i,0,0),u.fillStyle=`#0f172a`,u.fillRect(0,0,e,t),u.save(),u.filter=`blur(8px)`,u.drawImage(d,0,0,e,t),u.restore(),u.globalCompositeOperation=`lighter`,u.drawImage(d,0,0,e,t),u.globalCompositeOperation=`source-over`;for(let e of n){let t=u.createRadialGradient(e.x-e.r*.3,e.y-e.r*.3,0,e.x,e.y,e.r*.6);t.addColorStop(0,`rgba(255,255,255,0.5)`),t.addColorStop(1,`rgba(56,189,248,0)`),u.beginPath(),u.arc(e.x,e.y,e.r*.5,0,Math.PI*2),u.fillStyle=t,u.fill()}};return S(),()=>{cancelAnimationFrame(y),x(),n.removeEventListener(`mousemove`,h),n.removeEventListener(`mouseleave`,m),n.removeEventListener(`touchmove`,g),n.removeEventListener(`touchend`,m)}},[r,t,e]),(0,l.jsx)(`div`,{className:Ke.metaballPool,style:{width:e,height:t,"--pool-color":r},children:(0,l.jsx)(`canvas`,{ref:i,className:Ke.canvas,style:{width:e,height:t}})})},Je={mazeGenerator:`cos-mazeGenerator-QEa0s`,canvas:`cos-canvas-emhxb`},Ye=({width:e=400,height:t=300,cellSize:n=20,onGenerated:r})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)(r);return(0,c.useEffect)(()=>{a.current=r},[r]),(0,c.useEffect)(()=>{let r=i.current;if(!r)return;let o=window.devicePixelRatio||1;r.width=e*o,r.height=t*o;let s=r.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=Math.floor(e/n),l=Math.floor(t/n),u=Array.from({length:l},()=>Array.from({length:c},()=>({top:!0,right:!0,bottom:!0,left:!0,visited:!1}))),d=[[0,0]];u[0][0].visited=!0;let f=[[0,-1,`top`],[1,0,`right`],[0,1,`bottom`],[-1,0,`left`]],p={top:`bottom`,right:`left`,bottom:`top`,left:`right`};for(;d.length;){let[e,t]=d[d.length-1],n=f.map(([n,r,i])=>{let a=e+n,o=t+r;return a<0||o<0||a>=c||o>=l||u[o][a].visited?null:{nx:a,ny:o,wall:i}}).filter(Boolean);if(!n.length){d.pop();continue}let r=n[Math.floor(Math.random()*n.length)];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])}a.current?.(c,l);let m=0,h=0,g=c*l*2,v=document.hidden,y=_(e=>{v=e}),b=()=>{if(v){m=requestAnimationFrame(b);return}h=Math.min(g,h+2),s.fillStyle=`#0f172a`,s.fillRect(0,0,e,t),s.strokeStyle=`#38bdf8`,s.lineWidth=1.5,s.shadowColor=`#38bdf8`,s.shadowBlur=4;let r=0;for(let e=0;e<l;e++)for(let t=0;t<c;t++){let i=u[e][t],a=t*n,o=e*n;i.top&&r++<h&&(s.beginPath(),s.moveTo(a,o),s.lineTo(a+n,o),s.stroke()),i.right&&r++<h&&(s.beginPath(),s.moveTo(a+n,o),s.lineTo(a+n,o+n),s.stroke()),e===l-1&&i.bottom&&r++<h&&(s.beginPath(),s.moveTo(a,o+n),s.lineTo(a+n,o+n),s.stroke()),t===0&&i.left&&r++<h&&(s.beginPath(),s.moveTo(a,o),s.lineTo(a,o+n),s.stroke())}s.shadowBlur=0,h<g&&(m=requestAnimationFrame(b))};return b(),()=>{cancelAnimationFrame(m),y()}},[n,t,e]),(0,l.jsx)(`div`,{className:Je.mazeGenerator,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:Je.canvas,style:{width:e,height:t}})})},Xe={meteorRain:`cos-meteorRain-v8RNI`,canvas:`cos-canvas-hyFMr`},Ze=({width:e=800,height:t=500,meteorCount:n=8})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)([]),a=(0,c.useRef)(0);return(0,c.useEffect)(()=>{i.current=Array.from({length:n},()=>({x:Math.random()*e,y:Math.random()*t*.5,length:Math.random()*60+40,speed:Math.random()*6+4,opacity:Math.random()*.5+.3}))},[t,n,e]),(0,c.useEffect)(()=>{let n=r.current;if(!n)return;let o=window.devicePixelRatio||1;n.width=e*o,n.height=t*o;let s=n.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=document.hidden,l=_(e=>{c=e}),u=()=>{a.current=requestAnimationFrame(u),!c&&(s.fillStyle=`rgb(15 23 42 / 15%)`,s.fillRect(0,0,e,t),i.current.forEach(n=>{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);let r=n.x-n.length,i=n.y-n.length*.6;s.beginPath(),s.strokeStyle=`rgb(255 255 255 / ${n.opacity})`,s.lineWidth=2,s.moveTo(n.x,n.y),s.lineTo(r,i),s.stroke(),s.beginPath(),s.fillStyle=`rgb(255 255 255 / ${Math.min(1,n.opacity+.2)})`,s.arc(n.x,n.y,1.5,0,Math.PI*2),s.fill()}))};return u(),()=>{cancelAnimationFrame(a.current),l()}},[t,e]),(0,l.jsx)(`div`,{className:Xe.meteorRain,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:Xe.canvas,style:{width:e,height:t}})})},z={neonText:`cos-neonText-JMP7i`,text:`cos-text-GTO-0`,flicker:`cos-flicker-nXceV`,"neon-flicker":`cos-neon-flicker-uDkmM`,reflection:`cos-reflection-aEYj6`},Qe=({text:e=`NEON`,color:t=`#ff00de`,fontSize:n=72,flicker:r=!0})=>(0,l.jsxs)(`div`,{className:z.neonText,children:[(0,l.jsx)(`h1`,{className:`${z.text} ${r?z.flicker:``}`,style:{fontSize:n,"--neon-color":t},children:e}),(0,l.jsx)(`p`,{className:z.reflection,style:{fontSize:n*.35,color:t},children:e})]}),$e={newtonCradle:`cos-newtonCradle-mFl-b`,canvas:`cos-canvas-TWKl5`},et=({ballCount:e=5,color:t=`#38bdf8`,width:n=280,height:r=200})=>{let i=(0,c.useRef)(null),a=Math.max(2,Math.min(e,7));return(0,c.useEffect)(()=>{let e=i.current;if(!e)return;let o=window.devicePixelRatio||1;e.width=n*o,e.height=r*o;let s=e.getContext(`2d`);if(!s)return;s.setTransform(o,0,0,o,0,0);let c=r-28-28,l=(a-1)*28,u=(n-l)/2,d=1/60,f=Array.from({length:a},()=>({theta:0,omega:0}));f[0].theta=-.52;let p=`left`,m=e=>u+e*28,h=e=>{let t=f[e];return{x:m(e)+c*Math.sin(t.theta),y:16+c*Math.cos(t.theta)}},g=e=>{p===`left`&&(p=`right`,f[0].omega=0,f[0].theta=0,f[a-1].omega=Math.abs(e))},v=e=>{p===`right`&&(p=`left`,f[a-1].omega=0,f[a-1].theta=0,f[0].omega=-Math.abs(e))},y=()=>{let e=h(0),t=h(1);if(e.x+14>=t.x-14-.5&&f[0].omega>.02){g(f[0].omega);return}let n=h(a-1),r=h(a-2);n.x-14<=r.x+14+.5&&f[a-1].omega<-.02&&v(f[a-1].omega)},b=0,x=document.hidden,S=_(e=>{x=e}),C=()=>{if(b=requestAnimationFrame(C),!x){for(let e=0;e<a;e++){let t=f[e];if(Math.abs(t.omega)<1e-5&&Math.abs(t.theta)<1e-5)continue;let n=-(980/c)*Math.sin(t.theta);t.omega+=n*d,t.omega*=.9998,t.theta+=t.omega*d}y();for(let e=1;e<a-1;e++)f[e].theta=0,f[e].omega=0;s.fillStyle=`#0f172a`,s.fillRect(0,0,n,r),s.strokeStyle=`#475569`,s.lineWidth=3,s.beginPath(),s.moveTo(u-14,16),s.lineTo(u+l+14,16),s.stroke();for(let e=0;e<a;e++){let n=m(e),{x:r,y:i}=h(e);s.beginPath(),s.moveTo(n,16),s.lineTo(r,i),s.strokeStyle=`#64748b`,s.lineWidth=2,s.stroke(),s.beginPath(),s.arc(r,i,14,0,Math.PI*2);let a=s.createRadialGradient(r-14*.3,i-14*.3,0,r,i,14);a.addColorStop(0,`#fff`),a.addColorStop(.35,t),a.addColorStop(1,t),s.fillStyle=a,s.shadowColor=t,s.shadowBlur=6,s.fill(),s.shadowBlur=0}}};return C(),()=>{cancelAnimationFrame(b),S()}},[t,a,r,n]),(0,l.jsx)(`div`,{className:$e.newtonCradle,style:{width:n,height:r,"--ball-color":t},children:(0,l.jsx)(`canvas`,{ref:i,className:$e.canvas,style:{width:n,height:r}})})},B={orbitalChart:`cos-orbitalChart-XLORB`,canvas:`cos-canvas-hGVud`,legend:`cos-legend-Np9Mm`,swatch:`cos-swatch-xEKvA`},tt=[{label:`A`,value:30,color:`#38bdf8`},{label:`B`,value:25,color:`#a78bfa`},{label:`C`,value:20,color:`#f472b6`},{label:`D`,value:25,color:`#4ade80`}],nt=({data:e=tt,size:t=240})=>{let n=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let r=n.current;if(!r||e.length===0)return;let i=window.devicePixelRatio||1;r.width=t*i,r.height=t*i;let a=r.getContext(`2d`);if(!a)return;a.setTransform(i,0,0,i,0,0);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=_(e=>{f=e}),m=()=>{if(u=requestAnimationFrame(m),f)return;d+=.012,a.fillStyle=`#0f172a`,a.fillRect(0,0,t,t),e.forEach((e,t)=>{let n=l*(t+1),r=e.value/o,i=v(Math.round(r*12)+1,1,16),u=.4+t*.15;a.beginPath(),a.arc(s,c,n,0,Math.PI*2),a.strokeStyle=`rgb(148 163 184 / 15%)`,a.lineWidth=1,a.stroke();for(let t=0;t<i;t++){let r=d*u+t/i*Math.PI*2,o=s+Math.cos(r)*n,l=c+Math.sin(r)*n;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}});let n=e.reduce((e,t)=>t.value>e.value?t:e,e[0]),r=Math.round(n.value/o*100);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)};return m(),()=>{cancelAnimationFrame(u),p()}},[e,t]),(0,l.jsxs)(`div`,{className:B.orbitalChart,style:{width:t,height:t},children:[(0,l.jsx)(`canvas`,{ref:n,className:B.canvas,style:{width:t,height:t}}),(0,l.jsx)(`ul`,{className:B.legend,children:e.map(e=>(0,l.jsxs)(`li`,{children:[(0,l.jsx)(`span`,{className:B.swatch,style:{background:e.color}}),e.label,` (`,e.value,`)`]},e.label))})]})},rt={particleNetwork:`cos-particleNetwork-GSZq-`,canvas:`cos-canvas-E-BGP`,hint:`cos-hint-LEO5o`},it=({width:e=800,height:t=500,particleCount:n=60,linkDistance:r=120,repelRadius:i=150,color:a=`#38bdf8`})=>{let o=(0,c.useRef)(null),s=(0,c.useRef)([]),u=(0,c.useRef)({x:-1e3,y:-1e3}),d=(0,c.useCallback)(()=>{s.current=Array.from({length:n},()=>({x:Math.random()*e,y:Math.random()*t,vx:(Math.random()-.5)*1.2,vy:(Math.random()-.5)*1.2,radius:Math.random()*2+1}))},[t,n,e]);(0,c.useEffect)(()=>{d()},[d]),(0,c.useEffect)(()=>{let n=o.current;if(!n)return;let c=window.devicePixelRatio||1;n.width=e*c,n.height=t*c;let l=n.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let d=0,f=document.hidden,p=_(e=>{f=e}),m=()=>{if(f){d=requestAnimationFrame(m);return}l.fillStyle=`#0f172a`,l.fillRect(0,0,e,t);let n=s.current,o=u.current,c=i*i;n.forEach(n=>{n.x+=n.vx,n.y+=n.vy,(n.x<0||n.x>e)&&(n.vx*=-1),(n.y<0||n.y>t)&&(n.vy*=-1);let r=o.x-n.x,i=o.y-n.y,a=r*r+i*i;if(a<c&&a>0){let e=Math.sqrt(a);n.vx-=r/e*.15,n.vy-=i/e*.15}});for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++){let i=n[e].x-n[t].x,o=n[e].y-n[t].y,s=i*i+o*o;if(s<r*r){let i=Math.sqrt(s);l.beginPath(),l.moveTo(n[e].x,n[e].y),l.lineTo(n[t].x,n[t].y),l.strokeStyle=a,l.globalAlpha=1-i/r,l.lineWidth=.8,l.stroke(),l.globalAlpha=1}}n.forEach(e=>{l.beginPath(),l.arc(e.x,e.y,e.radius,0,Math.PI*2),l.fillStyle=a,l.fill()}),d=requestAnimationFrame(m)};return m(),()=>{cancelAnimationFrame(d),p()}},[a,t,d,r,i,e]);let f=(e,t,n)=>{u.current={x:e-n.left,y:t-n.top}},p=e=>{f(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())},m=e=>{let t=e.touches[0];t&&f(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},h=()=>{u.current={x:-1e3,y:-1e3}};return(0,l.jsxs)(`div`,{className:rt.particleNetwork,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:o,className:rt.canvas,style:{width:e,height:t},onMouseMove:p,onMouseLeave:h,onTouchMove:m,onTouchEnd:h}),(0,l.jsx)(`p`,{className:rt.hint,children:`移动鼠标或手指与粒子互动`})]})},at={plasmaBall:`cos-plasmaBall-xGHSj`,canvas:`cos-canvas-V1CgL`},ot=({width:e=320,height:t=320,color:n=`#a78bfa`,arcCount:r=8})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)({x:e/2,y:t/2,active:!1}),o=(0,c.useRef)([]);return(0,c.useEffect)(()=>{o.current=Array.from({length:r},(e,t)=>({angle:t/r*Math.PI*2,length:.6+Math.random()*.35,speed:.02+Math.random()*.03}))},[r]),(0,c.useEffect)(()=>{let r=i.current;if(!r)return;let s=window.devicePixelRatio||1;r.width=e*s,r.height=t*s;let c=r.getContext(`2d`);if(!c)return;c.setTransform(s,0,0,s,0,0);let l=e/2,u=t/2,d=Math.min(e,t)*.38,f=(e,t)=>{let n=r.getBoundingClientRect();a.current={x:e-n.left,y:t-n.top,active:!0}},p=()=>{a.current.active=!1},m=e=>f(e.clientX,e.clientY),h=e=>{e.touches[0]&&f(e.touches[0].clientX,e.touches[0].clientY)};r.addEventListener(`mousemove`,m),r.addEventListener(`mouseleave`,p),r.addEventListener(`touchmove`,h,{passive:!0}),r.addEventListener(`touchend`,p);let g=0,v=document.hidden,y=_(e=>{v=e}),b=(e,t,n,r,i,a)=>{if(a<=0)return[[e,t],[n,r]];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=b(e,t,o+f,s+p,i*.55,a-1),h=b(o+f,s+p,n,r,i*.55,a-1);return[...m.slice(0,-1),...h]},x=()=>{if(g=requestAnimationFrame(x),v)return;let r=a.current,i=o.current;c.fillStyle=`#0f172a`,c.fillRect(0,0,e,t);let s=c.createRadialGradient(l,u,d*.1,l,u,d*1.1);s.addColorStop(0,`rgba(30, 41, 59, 0.9)`),s.addColorStop(.7,`rgba(15, 23, 42, 0.6)`),s.addColorStop(1,`rgba(15, 23, 42, 0)`),c.beginPath(),c.arc(l,u,d*1.05,0,Math.PI*2),c.fillStyle=s,c.fill(),c.beginPath(),c.arc(l,u,d,0,Math.PI*2),c.strokeStyle=`rgba(148, 163, 184, 0.35)`,c.lineWidth=2,c.stroke(),i.forEach(e=>{e.angle+=e.speed*(Math.random()>.5?1:-1);let t=r.active?Math.atan2(r.y-u,r.x-l)+(e.angle-Math.PI)*.15:e.angle,i=d*e.length,a=b(l,u,l+Math.cos(t)*i,u+Math.sin(t)*i,18,4);c.beginPath(),a.forEach(([e,t],n)=>n===0?c.moveTo(e,t):c.lineTo(e,t)),c.strokeStyle=n,c.lineWidth=1.5,c.shadowColor=n,c.shadowBlur=14,c.globalAlpha=.85,c.stroke(),c.shadowBlur=0,c.globalAlpha=1}),c.beginPath(),c.arc(l,u,10,0,Math.PI*2);let f=c.createRadialGradient(l,u,0,l,u,10);f.addColorStop(0,`#fff`),f.addColorStop(.5,n),f.addColorStop(1,n),c.fillStyle=f,c.shadowColor=n,c.shadowBlur=20,c.fill(),c.shadowBlur=0};return x(),()=>{cancelAnimationFrame(g),y(),r.removeEventListener(`mousemove`,m),r.removeEventListener(`mouseleave`,p),r.removeEventListener(`touchmove`,h),r.removeEventListener(`touchend`,p)}},[r,n,t,e]),(0,l.jsx)(`div`,{className:at.plasmaBall,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:at.canvas,style:{width:e,height:t}})})},st={smokeFog:`cos-smokeFog-SYlts`,canvas:`cos-canvas-iOJV7`},ct=(e,t)=>{let n=Math.random()*80+40,r=(Math.random()-.5)*.4,i=(Math.random()-.5)*.3-.1,a=Math.random()*.15+.05;return{x:Math.random()*e,y:Math.random()*t,radius:n,baseRadius:n,vx:r,vy:i,baseVx:r,baseVy:i,alpha:a,baseAlpha:a,mass:.55+(n-40)/80*.9,receptivity:.45+Math.random()*.9,phase:Math.random()*Math.PI*2}},lt=(e,t,n,r)=>{let i=Math.cos(-n),a=Math.sin(-n),o=e*i-t*a,s=e*a+t*i;return Math.hypot(o/r,s*r)},ut=({width:e=800,height:t=500,density:n=.5})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)([]),a=(0,c.useRef)([]),o=(0,c.useRef)(0);(0,c.useEffect)(()=>{let r=Math.floor(20+n*40);i.current=Array.from({length:r},()=>ct(e,t))},[n,t,e]);let s=(0,c.useCallback)((n,i)=>{let o=r.current;if(!o)return;let s=o.getBoundingClientRect(),c=(n-s.left)/s.width*e,l=(i-s.top)/s.height*t;a.current.push({x:c,y:l,life:1,windAngle:Math.random()*Math.PI*2,swirl:Math.random()<.5?-1:1,stretch:1.15+Math.random()*.55,radius:Math.min(e,t)*(.28+Math.random()*.12)})},[t,e]);return(0,c.useEffect)(()=>{let e=r.current;if(!e)return;let t=e=>s(e.clientX,e.clientY),n=e=>{let t=e.touches[0];t&&s(t.clientX,t.clientY)};return e.addEventListener(`click`,t),e.addEventListener(`touchstart`,n,{passive:!0}),()=>{e.removeEventListener(`click`,t),e.removeEventListener(`touchstart`,n)}},[s]),(0,c.useEffect)(()=>{let n=r.current;if(!n)return;let s=window.devicePixelRatio||1;n.width=e*s,n.height=t*s;let c=n.getContext(`2d`);if(!c)return;c.setTransform(s,0,0,s,0,0);let l=0,u=document.hidden,d=_(e=>{u=e}),f=()=>{if(o.current=requestAnimationFrame(f),u)return;l+=.008,c.fillStyle=`#1a1a2e`,c.fillRect(0,0,e,t);let n=c.createRadialGradient(e*.5,t*.3,0,e*.5,t*.5,e*.7);n.addColorStop(0,`#2d2d44`),n.addColorStop(1,`#1a1a2e`),c.fillStyle=n,c.fillRect(0,0,e,t);let r=i.current,s=a.current;for(let e=s.length-1;e>=0;e--){let t=s[e],n=t.life*t.life,i=t.life>.92?1:.22;for(let e of r){let r=e.x-t.x,a=e.y-t.y,o=lt(r,a,t.windAngle,t.stretch);if(o>t.radius)continue;let s=(1-o/t.radius)**1.6,c=.55+.7*Math.sin(e.phase*3.1+o*.05+l*1.7),u=s*e.receptivity*c*i;if(u<.06)continue;let d=Math.hypot(r,a)||1,f=r/d,p=a/d,m=-p*t.swirl,h=f*t.swirl,g=Math.cos(t.windAngle),_=Math.sin(t.windAngle),v=1/e.mass,y=Math.sin(e.phase*5.3+l*3.2+o*.03),b=Math.cos(e.phase*2.7-l*2.1+o*.02),x=u*n*(2.4+y*.8)*v,S=u*n*(1.6+b*1.1)*v,C=u*n*(1.2+y*.6)*v,w=y*u*n*1.2*v,T=b*u*n*1.2*v;e.vx+=f*x+m*S+g*C+w,e.vy+=p*x+h*S+_*C+T,e.alpha*=1-u*n*(.28+Math.abs(y)*.18),e.radius+=e.baseRadius*u*n*(.1+Math.abs(b)*.16)}t.life*=.88,t.radius*=1.01,t.life<.05&&s.splice(e,1)}r.forEach((n,r)=>{n.x+=n.vx+Math.sin(l+r+n.phase)*.15,n.y+=n.vy+Math.cos(l*.7+r*.5+n.phase)*.1;let i=.014+n.mass*.01;n.vx+=(n.baseVx-n.vx)*i,n.vy+=(n.baseVy-n.vy)*i,n.alpha+=(n.baseAlpha-n.alpha)*.01,n.radius+=(n.baseRadius-n.radius)*.012,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);let a=c.createRadialGradient(n.x,n.y,0,n.x,n.y,n.radius);a.addColorStop(0,`rgb(200 200 210 / ${n.alpha})`),a.addColorStop(.5,`rgb(160 160 175 / ${n.alpha*.5})`),a.addColorStop(1,`rgb(160 160 175 / 0)`),c.fillStyle=a,c.beginPath(),c.arc(n.x,n.y,n.radius,0,Math.PI*2),c.fill()})};return f(),()=>{cancelAnimationFrame(o.current),d()}},[t,e]),(0,l.jsx)(`div`,{className:st.smokeFog,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:st.canvas,style:{width:e,height:t}})})},dt={solarSystem:`cos-solarSystem-27h8F`,canvas:`cos-canvas-C0nRa`},ft=[{name:`Mercury`,radius:0,orbit:42,speed:4.8,color:`#94a3b8`,size:3},{name:`Venus`,radius:0,orbit:58,speed:3.5,color:`#fbbf24`,size:5},{name:`Earth`,radius:0,orbit:78,speed:3,color:`#38bdf8`,size:5},{name:`Mars`,radius:0,orbit:98,speed:2.4,color:`#f87171`,size:4},{name:`Jupiter`,radius:0,orbit:130,speed:1.6,color:`#fb923c`,size:12},{name:`Saturn`,radius:0,orbit:160,speed:1.2,color:`#fcd34d`,size:10},{name:`Moon`,radius:0,orbit:14,speed:8,color:`#cbd5e1`,size:2,parent:2}],pt=({width:e=400,height:t=400,speed:n=1,showOrbits:r=!0})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)([]);return(0,c.useEffect)(()=>{a.current=ft.map(e=>({...e,angle:Math.random()*Math.PI*2})),o.current=Array.from({length:80},()=>({x:Math.random(),y:Math.random(),alpha:Math.random()*.6}))},[]),(0,c.useEffect)(()=>{let s=i.current;if(!s)return;let c=window.devicePixelRatio||1;s.width=e*c,s.height=t*c;let l=s.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=e/2,d=t/2,f=Math.min(e,t)/380,p=0,m=document.hidden,h=_(e=>{m=e}),g=()=>{if(p=requestAnimationFrame(g),m)return;let i=a.current,s=[];l.fillStyle=`#0f172a`,l.fillRect(0,0,e,t),o.current.forEach(n=>{l.fillStyle=`rgba(255,255,255,${n.alpha})`,l.fillRect(n.x*e,n.y*t,1,1)}),l.beginPath(),l.arc(u,d,18*f,0,Math.PI*2);let c=l.createRadialGradient(u,d,0,u,d,18*f);c.addColorStop(0,`#fef08a`),c.addColorStop(.5,`#fbbf24`),c.addColorStop(1,`#f97316`),l.fillStyle=c,l.shadowColor=`#fbbf24`,l.shadowBlur=24,l.fill(),l.shadowBlur=0,i.forEach((e,t)=>{e.angle+=e.speed*.008*n/Math.sqrt(e.orbit);let i=u,a=d;e.parent!==void 0&&s[e.parent]&&(i=s[e.parent].x,a=s[e.parent].y);let o=e.orbit*f,c=i+Math.cos(e.angle)*o,p=a+Math.sin(e.angle)*o;if(s[t]={x:c,y:p},r&&e.parent===void 0&&(l.beginPath(),l.arc(i,a,o,0,Math.PI*2),l.strokeStyle=`rgba(148, 163, 184, 0.15)`,l.lineWidth=1,l.stroke()),e.name===`Saturn`&&(l.beginPath(),l.ellipse(c,p,e.size*f*1.8,e.size*f*.5,e.angle*.3,0,Math.PI*2),l.strokeStyle=`rgba(252, 211, 77, 0.5)`,l.lineWidth=1.5,l.stroke()),l.beginPath(),l.arc(c,p,e.size*f,0,Math.PI*2),l.fillStyle=e.color,e.name===`Earth`){let t=l.createRadialGradient(c-2,p-2,0,c,p,e.size*f);t.addColorStop(0,`#4ade80`),t.addColorStop(.6,e.color),t.addColorStop(1,`#1d4ed8`),l.fillStyle=t}l.fill()})};return g(),()=>{cancelAnimationFrame(p),h()}},[t,r,n,e]),(0,l.jsx)(`div`,{className:dt.solarSystem,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:dt.canvas,style:{width:e,height:t}})})},mt={snowfall:`cos-snowfall-Q-Dhg`,canvas:`cos-canvas-bJVF8`},ht=({width:e=800,height:t=500,mode:n=`snow`,count:r=120})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)(0),s=(0,c.useCallback)(r=>({x:Math.random()*e,y:r??Math.random()*t,size:n===`sakura`?Math.random()*6+4:Math.random()*3+1,speed:Math.random()*1.5+.5,drift:(Math.random()-.5)*.8,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.04,opacity:Math.random()*.6+.4}),[t,n,e]);return(0,c.useEffect)(()=>{a.current=Array.from({length:r},()=>s())},[r,s]),(0,c.useEffect)(()=>{let r=i.current;if(!r)return;let c=window.devicePixelRatio||1;r.width=e*c,r.height=t*c;let l=r.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let u=document.hidden,d=_(e=>{u=e}),f=e=>{l.globalAlpha=e.opacity,l.fillStyle=`#fff`,l.beginPath(),l.arc(e.x,e.y,e.size,0,Math.PI*2),l.fill()},p=e=>{l.save(),l.translate(e.x,e.y),l.rotate(e.rotation),l.globalAlpha=e.opacity;let t=e.size;l.fillStyle=`#ffb7c5`,l.beginPath(),l.ellipse(0,0,t,t*.6,0,0,Math.PI*2),l.fill(),l.fillStyle=`#ff8fa3`,l.beginPath(),l.ellipse(t*.3,0,t*.5,t*.35,.5,0,Math.PI*2),l.fill(),l.restore()},m=()=>{o.current=requestAnimationFrame(m),!u&&(l.fillStyle=n===`sakura`?`#1a1020`:`#0f172a`,l.fillRect(0,0,e,t),a.current.forEach(e=>{e.y+=e.speed,e.x+=e.drift+Math.sin(e.y*.02)*.3,e.rotation+=e.rotationSpeed,e.y>t+10&&Object.assign(e,s(-10)),n===`sakura`?p(e):f(e)}),l.globalAlpha=1)};return m(),()=>{cancelAnimationFrame(o.current),d()}},[s,t,n,e]),(0,l.jsx)(`div`,{className:mt.snowfall,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:mt.canvas,style:{width:e,height:t}})})},gt={starfield:`cos-starfield-QTwia`,canvas:`cos-canvas-C2t3g`},_t=({width:e=800,height:t=500,starCount:n=400,speed:r=1})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)([]),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{a.current=Array.from({length:n},()=>({x:(Math.random()-.5)*e,y:(Math.random()-.5)*t,z:Math.random()*e}))},[t,n,e]),(0,c.useEffect)(()=>{let n=i.current;if(!n)return;let s=window.devicePixelRatio||1;n.width=e*s,n.height=t*s;let c=n.getContext(`2d`);if(!c)return;c.setTransform(s,0,0,s,0,0);let l=e/2,u=t/2,d=document.hidden,f=_(e=>{d=e}),p=()=>{o.current=requestAnimationFrame(p),!d&&(c.fillStyle=`rgb(0 0 0 / 25%)`,c.fillRect(0,0,e,t),a.current.forEach(n=>{n.z-=r*2,n.z<=0&&(n.x=(Math.random()-.5)*e,n.y=(Math.random()-.5)*t,n.z=e);let i=128/n.z,a=n.x*i+l,o=n.y*i+u;if(a<0||a>=e||o<0||o>=t)return;let s=(1-n.z/e)*3,d=(1-n.z/e)*255;if(s>.5){let e=128/(n.z+r*4),t=n.x*e+l,i=n.y*e+u;c.beginPath(),c.strokeStyle=`rgb(${d} ${d} ${d+30})`,c.lineWidth=s,c.moveTo(t,i),c.lineTo(a,o),c.stroke()}else c.fillStyle=`rgb(${d} ${d} ${d+30})`,c.fillRect(a,o,s,s)}))};return p(),()=>{cancelAnimationFrame(o.current),f()}},[t,r,n,e]),(0,l.jsx)(`div`,{className:gt.starfield,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:gt.canvas,style:{width:e,height:t}})})},V={progressChest:`cos-progressChest-Bqcv1`,barWrap:`cos-barWrap-E2pnl`,barTrack:`cos-barTrack-dKLhs`,barFill:`cos-barFill-NZJJe`,pct:`cos-pct-D91IU`,chest:`cos-chest-YebJO`,lid:`cos-lid-K4GSD`,open:`cos-open-eWo0Y`,lidTop:`cos-lidTop-N-p2g`,lock:`cos-lock--0AaQ`,body:`cos-body-iqUt3`,treasure:`cos-treasure-nx-6S`,pop:`cos-pop-uRZvT`,label:`cos-label-61hRe`},vt=({progress:e=0,onOpen:t,label:n=`开启宝箱`})=>{let r=(0,c.useRef)(!1),i=(0,c.useRef)(t),a=v(e,0,100),o=a>=100;return(0,c.useEffect)(()=>{i.current=t},[t]),(0,c.useEffect)(()=>{o&&!r.current&&(r.current=!0,i.current?.()),o||(r.current=!1)},[o]),(0,l.jsxs)(`div`,{className:V.progressChest,children:[(0,l.jsxs)(`div`,{className:V.barWrap,children:[(0,l.jsx)(`div`,{className:V.barTrack,children:(0,l.jsx)(`div`,{className:V.barFill,style:{width:`${a}%`}})}),(0,l.jsxs)(`span`,{className:V.pct,children:[a.toFixed(0),`%`]})]}),(0,l.jsxs)(`div`,{className:`${V.chest} ${o?V.open:``}`,children:[(0,l.jsxs)(`div`,{className:V.lid,children:[(0,l.jsx)(`div`,{className:V.lidTop}),(0,l.jsx)(`div`,{className:V.lock})]}),(0,l.jsx)(`div`,{className:V.body,children:o&&(0,l.jsxs)(`div`,{className:V.treasure,children:[(0,l.jsx)(`span`,{children:`💎`}),(0,l.jsx)(`span`,{children:`✨`}),(0,l.jsx)(`span`,{children:`🪙`})]})})]}),(0,l.jsx)(`p`,{className:V.label,children:o?`宝箱已开启!`:n})]})},yt={radarScan:`cos-radarScan-PZaG8`,canvas:`cos-canvas-fUw5N`},bt=({size:e=300,color:t=`#22d3ee`,blipCount:n=5})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(0),a=(0,c.useRef)([]),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{a.current=Array.from({length:n},()=>({angle:Math.random()*Math.PI*2,dist:Math.random()*.7+.15,alpha:Math.random()*.5+.5}))},[n]),(0,c.useEffect)(()=>{let n=r.current;if(!n)return;let s=window.devicePixelRatio||1;n.width=e*s,n.height=e*s;let c=n.getContext(`2d`);if(!c)return;c.setTransform(s,0,0,s,0,0);let l=e/2,u=e/2,d=e/2-10,f=document.hidden,p=_(e=>{f=e}),m=()=>{if(o.current=requestAnimationFrame(m),f)return;i.current+=.03,c.fillStyle=`rgb(15 23 42 / 25%)`,c.fillRect(0,0,e,e);for(let e=1;e<=4;e++)c.beginPath(),c.arc(l,u,d/4*e,0,Math.PI*2),c.strokeStyle=`${t}33`,c.lineWidth=1,c.stroke();c.beginPath(),c.moveTo(l,u-d),c.lineTo(l,u+d),c.moveTo(l-d,u),c.lineTo(l+d,u),c.strokeStyle=`${t}44`,c.stroke();let n=i.current,r=c.createConicGradient(n-.5,l,u);r.addColorStop(0,`transparent`),r.addColorStop(.15,`${t}66`),r.addColorStop(.3,`transparent`),c.beginPath(),c.moveTo(l,u),c.arc(l,u,d,n-.5,n),c.closePath(),c.fillStyle=r,c.fill(),c.beginPath(),c.moveTo(l,u),c.lineTo(l+Math.cos(n)*d,u+Math.sin(n)*d),c.strokeStyle=t,c.lineWidth=2,c.stroke(),a.current.forEach(e=>{let r=e.angle,i=l+Math.cos(r)*d*e.dist,a=u+Math.sin(r)*d*e.dist;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),c.beginPath(),c.arc(i,a,4,0,Math.PI*2),c.fillStyle=t,c.globalAlpha=e.alpha,c.fill(),c.globalAlpha=1}),c.beginPath(),c.arc(l,u,d,0,Math.PI*2),c.strokeStyle=t,c.lineWidth=2,c.stroke()};return m(),()=>{cancelAnimationFrame(o.current),p()}},[n,t,e]),(0,l.jsx)(`div`,{className:yt.radarScan,style:{width:e,height:e},children:(0,l.jsx)(`canvas`,{ref:r,className:yt.canvas,style:{width:e,height:e}})})},H={redPacketRain:`cos-redPacketRain-eJ7FW`,canvas:`cos-canvas-direH`,hud:`cos-hud-InqMq`,end:`cos-end-u0J7o`,hint:`cos-hint-sO6ld`},xt=({duration:e=1e4,onGrab:t})=>{let n=(0,c.useRef)(null),r=(0,c.useRef)([]),i=(0,c.useRef)(0),a=(0,c.useRef)(0),o=(0,c.useRef)(0),[s,u]=(0,c.useState)(0),[d,f]=(0,c.useState)(!0),p=(0,c.useRef)(!0),m=(0,c.useRef)(t);(0,c.useEffect)(()=>{m.current=t},[t]),(0,c.useEffect)(()=>{p.current=d},[d]);let h=(0,c.useCallback)(()=>{r.current.push({id:a.current++,x:Math.random()*350+25,y:-60,speed:Math.random()*2+2,rotation:(Math.random()-.5)*.1,amount:[1,2,5,8,10,18,66,88][Math.floor(Math.random()*8)],grabbed:!1})},[]);return(0,c.useEffect)(()=>{let t=n.current;if(!t)return;let a=window.devicePixelRatio||1;t.width=400*a,t.height=500*a;let s=t.getContext(`2d`);if(!s)return;s.setTransform(a,0,0,a,0,0);let c=document.hidden,l=_(e=>{c=e}),u=window.setTimeout(()=>{p.current=!1,f(!1)},e),d=()=>{i.current=requestAnimationFrame(d),!c&&(o.current++,p.current&&o.current%20==0&&h(),s.fillStyle=`rgb(15 23 42 / 20%)`,s.fillRect(0,0,400,500),r.current=r.current.filter(e=>e.grabbed?!1:(e.y+=e.speed,e.x+=Math.sin(e.y*.02)*.5,s.save(),s.translate(e.x,e.y),s.rotate(e.rotation),s.fillStyle=`#dc2626`,s.beginPath(),s.roundRect(-22,-28,44,56,6),s.fill(),s.fillStyle=`#fbbf24`,s.beginPath(),s.arc(0,-10,8,0,Math.PI*2),s.fill(),s.fillStyle=`#fde68a`,s.font=`bold 12px system-ui`,s.textAlign=`center`,s.fillText(`¥${e.amount}`,0,12),s.restore(),e.y<560)))};return d(),()=>{cancelAnimationFrame(i.current),clearTimeout(u),l()}},[e,h]),(0,l.jsxs)(`div`,{className:H.redPacketRain,children:[(0,l.jsx)(`canvas`,{ref:n,className:H.canvas,style:{width:400,height:500},onClick:e=>{let t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left,i=e.clientY-t.top,a=!1;r.current=r.current.map(e=>e.grabbed||a?e:Math.abs(n-e.x)<30&&Math.abs(i-e.y)<35?(a=!0,u(t=>t+e.amount),m.current?.(e.amount),{...e,grabbed:!0}):e)}}),(0,l.jsxs)(`div`,{className:H.hud,children:[(0,l.jsxs)(`span`,{children:[`已抢: ¥`,s]}),!d&&(0,l.jsx)(`span`,{className:H.end,children:`红包雨结束`})]}),(0,l.jsx)(`p`,{className:H.hint,children:`点击红包抢夺`})]})},U={returnCityContainer:`cos-returnCityContainer-6XTxj`,star:`cos-star-a59Dx`,glassWrap:`cos-glassWrap-golMO`,rotate:`cos-rotate-7X9Jj`,glassItem:`cos-glassItem-OwlFI`},St=({starCount:e,glassCount:t=8,glassRadius:n=150})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let a=r.current,o=i.current;if(!a||!o)return;let s=[],c=[],l=[],{width:u,height:d}=a.getBoundingClientRect(),f=e??Math.max(20,Math.floor(u/20));for(let e=0;e<f;e++){let e=window.setTimeout(()=>{let e=document.createElement(`div`);e.className=U.star,e.style.top=`${Math.random()*d}px`,e.style.left=`${Math.random()*u}px`,a.append(e),c.push(e)},Math.random()*2e3);s.push(e)}for(let e=0;e<t;e++){let r=document.createElement(`div`);r.className=U.glassItem,r.style.transform=`rotateY(${360/t*e}deg) translateZ(${n}px)`,o.appendChild(r),l.push(r);let i=window.setTimeout(()=>{r.style.top=`0px`,r.style.opacity=`1`},e*300);s.push(i)}return()=>{s.forEach(clearTimeout),c.forEach(e=>e.remove()),l.forEach(e=>e.remove())}},[e,t,n]),(0,l.jsx)(`div`,{ref:r,className:U.returnCityContainer,children:(0,l.jsx)(`div`,{ref:i,className:U.glassWrap})})},Ct={ropeChain:`cos-ropeChain-gYaSK`,canvas:`cos-canvas-5i95N`},wt=({width:e=400,height:t=400,segments:n=16,color:r=`#38bdf8`,gravity:i=.4})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)([]),s=(0,c.useRef)({active:!1,index:-1});return(0,c.useEffect)(()=>{let r=Math.max(4,Math.min(n,30)),i=t*.7/r,a=e/2,s=t*.08;o.current=Array.from({length:r+1},(e,t)=>({x:a,y:s+t*i,prevX:a,prevY:s+t*i,pinned:t===0}))},[t,n,e]),(0,c.useEffect)(()=>{let c=a.current;if(!c)return;let l=window.devicePixelRatio||1;c.width=e*l,c.height=t*l;let u=c.getContext(`2d`);if(!u)return;u.setTransform(l,0,0,l,0,0);let d=Math.max(4,Math.min(n,30)),f=t*.7/d,p=(e,t)=>{let n=o.current,r=-1,i=30;return n.forEach((n,a)=>{let o=Math.hypot(n.x-e,n.y-t);o<i&&(i=o,r=a)}),r},m=(e,t)=>{let n=c.getBoundingClientRect(),r=e-n.left,i=t-n.top,a=p(r,i);if(a>=0){s.current={active:!0,index:a};let e=o.current[a];e.x=r,e.y=i,e.prevX=r,e.prevY=i}},h=(e,t)=>{if(!s.current.active)return;let n=c.getBoundingClientRect(),r=o.current[s.current.index];r.x=e-n.left,r.y=t-n.top},g=()=>{s.current={active:!1,index:-1}},v=e=>m(e.clientX,e.clientY),y=e=>h(e.clientX,e.clientY),b=e=>{e.touches[0]&&m(e.touches[0].clientX,e.touches[0].clientY)},x=e=>{e.touches[0]&&h(e.touches[0].clientX,e.touches[0].clientY)};c.addEventListener(`mousedown`,v),c.addEventListener(`mousemove`,y),window.addEventListener(`mouseup`,g),c.addEventListener(`touchstart`,b,{passive:!0}),c.addEventListener(`touchmove`,x,{passive:!0}),window.addEventListener(`touchend`,g);let S=0,C=document.hidden,w=_(e=>{C=e}),T=()=>{if(S=requestAnimationFrame(T),C)return;let n=o.current,a=s.current;for(let e of n){if(e.pinned||a.active&&n.indexOf(e)===a.index)continue;let t=(e.x-e.prevX)*.99,r=(e.y-e.prevY)*.99;e.prevX=e.x,e.prevY=e.y,e.x+=t,e.y+=r,e.y+=i}for(let e=0;e<6;e++)for(let e=0;e<n.length-1;e++){let t=n[e],r=n[e+1],i=r.x-t.x,o=r.y-t.y,s=Math.hypot(i,o)||.001,c=(s-f)/s,l=i*c*.5,u=o*c*.5;!t.pinned&&!(a.active&&e===a.index)&&(t.x+=l,t.y+=u),!r.pinned&&!(a.active&&e+1===a.index)&&(r.x-=l,r.y-=u)}u.fillStyle=`#0f172a`,u.fillRect(0,0,e,t),u.beginPath(),n.forEach((e,t)=>t===0?u.moveTo(e.x,e.y):u.lineTo(e.x,e.y)),u.strokeStyle=r,u.lineWidth=3,u.lineCap=`round`,u.lineJoin=`round`,u.shadowColor=r,u.shadowBlur=8,u.stroke(),u.shadowBlur=0,n.forEach((e,t)=>{(t===0||t===n.length-1||t%4==0)&&(u.beginPath(),u.arc(e.x,e.y,t===0?6:4,0,Math.PI*2),u.fillStyle=t===0?`#94a3b8`:r,u.fill())})};return T(),()=>{cancelAnimationFrame(S),w(),c.removeEventListener(`mousedown`,v),c.removeEventListener(`mousemove`,y),window.removeEventListener(`mouseup`,g),c.removeEventListener(`touchstart`,b),c.removeEventListener(`touchmove`,x),window.removeEventListener(`touchend`,g)}},[r,i,t,n,e]),(0,l.jsx)(`div`,{className:Ct.ropeChain,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:Ct.canvas,style:{width:e,height:t}})})},W={speedometer:`cos-speedometer-INc7F`,svg:`cos-svg-HG-lE`,track:`cos-track-5-922`,valueArc:`cos-valueArc-eJn3E`,tick:`cos-tick-vaiJh`,needle:`cos-needle-PwRAD`,hub:`cos-hub-4WaHw`,valueText:`cos-valueText--q4Xi`,label:`cos-label-hOPy1`},G=(e,t,n,r)=>{let i=(r-90)*Math.PI/180;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}},Tt=({value:e=0,max:t=100,label:n=`SPEED`,color:r=`#f97316`})=>{let i=-120+v(t>0?e/t:0,0,1)*240,a=(0,c.useMemo)(()=>{let e=G(100,100,72,-120),t=G(100,100,72,120);return`M ${e.x} ${e.y} A 72 72 0 1 1 ${t.x} ${t.y}`},[]),o=(0,c.useMemo)(()=>{let e=G(100,100,72,-120),t=G(100,100,72,i),n=+(i- -120>180);return`M ${e.x} ${e.y} A 72 72 0 ${n} 1 ${t.x} ${t.y}`},[i]),s=G(100,100,58,i);return(0,l.jsxs)(`div`,{className:W.speedometer,style:{"--gauge-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 200 130`,className:W.svg,children:[(0,l.jsx)(`path`,{d:a,className:W.track,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),(0,l.jsx)(`path`,{d:o,className:W.valueArc,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),[-120,-60,0,60,120].map(e=>{let t=G(100,100,58,e),n=G(100,100,66,e);return(0,l.jsx)(`line`,{x1:t.x,y1:t.y,x2:n.x,y2:n.y,className:W.tick},e)}),(0,l.jsx)(`line`,{x1:`100`,y1:`100`,x2:s.x,y2:s.y,className:W.needle}),(0,l.jsx)(`circle`,{cx:`100`,cy:`100`,r:`6`,className:W.hub}),(0,l.jsx)(`text`,{x:`100`,y:`118`,className:W.valueText,children:Math.round(e)})]}),(0,l.jsx)(`span`,{className:W.label,children:n})]})},K={timelinePulse:`cos-timelinePulse-kcBM6`,axis:`cos-axis-9DWis`,track:`cos-track-jG-HV`,progress:`cos-progress-gf7v1`,steps:`cos-steps-Z-40O`,step:`cos-step-UO2Ux`,dot:`cos-dot-HJEVy`,pulse:`cos-pulse-N6FD1`,name:`cos-name-7zefJ`},Et=({steps:e=[`Start`,`Process`,`Review`,`Done`],current:t=0,color:n=`#22d3ee`})=>{let r=v(t,0,Math.max(0,e.length-1)),i=e.length>1?r/(e.length-1):0;return(0,l.jsx)(`div`,{className:K.timelinePulse,style:{"--pulse-color":n,"--step-count":e.length,"--progress-ratio":i},children:(0,l.jsxs)(`div`,{className:K.axis,children:[(0,l.jsx)(`div`,{className:K.track}),(0,l.jsx)(`div`,{className:K.progress}),(0,l.jsx)(`ul`,{className:K.steps,children:e.map((e,t)=>{let n=t<r?`done`:t===r?`current`:`pending`;return(0,l.jsxs)(`li`,{className:K.step,"data-state":n,children:[(0,l.jsx)(`span`,{className:K.dot}),(0,l.jsx)(`span`,{className:K.name,children:e})]},e+t)})})]})})},Dt={rippleWater:`cos-rippleWater-wsinI`,canvas:`cos-canvas-XOdSF`,hint:`cos-hint-0JH5D`},Ot=({width:e=800,height:t=500,color:n=`#38bdf8`})=>{let r=(0,c.useRef)(null),i=(0,c.useRef)([]),a=(0,c.useRef)(0),o=(0,c.useCallback)((n,a)=>{let o=r.current;if(!o)return;let s=o.getBoundingClientRect(),c=n-s.left,l=a-s.top,u=Math.max(e,t)*.45;i.current.push({x:c,y:l,radius:0,maxRadius:u,alpha:.7})},[t,e]);return(0,c.useEffect)(()=>{let e=r.current;if(!e)return;let t=e=>o(e.clientX,e.clientY),n=e=>{let t=e.touches[0];t&&o(t.clientX,t.clientY)};return e.addEventListener(`click`,t),e.addEventListener(`touchstart`,n,{passive:!0}),()=>{e.removeEventListener(`click`,t),e.removeEventListener(`touchstart`,n)}},[o]),(0,c.useEffect)(()=>{let o=r.current;if(!o)return;let s=window.devicePixelRatio||1;o.width=e*s,o.height=t*s;let c=o.getContext(`2d`);if(!c)return;c.setTransform(s,0,0,s,0,0);let l=document.hidden,u=_(e=>{l=e}),d=()=>{if(a.current=requestAnimationFrame(d),l)return;c.fillStyle=`#0c1929`,c.fillRect(0,0,e,t);let r=c.createLinearGradient(0,0,0,t);r.addColorStop(0,`#0f2744`),r.addColorStop(1,`#061018`),c.fillStyle=r,c.fillRect(0,0,e,t),i.current=i.current.filter(e=>(e.radius+=2.5,e.alpha-=.012,e.alpha<=0?!1:(c.beginPath(),c.arc(e.x,e.y,e.radius,0,Math.PI*2),c.strokeStyle=n,c.globalAlpha=e.alpha*(1-e.radius/e.maxRadius),c.lineWidth=2,c.stroke(),e.radius>8&&(c.beginPath(),c.arc(e.x,e.y,e.radius*.6,0,Math.PI*2),c.strokeStyle=n,c.globalAlpha=e.alpha*.4,c.lineWidth=1,c.stroke()),c.globalAlpha=1,!0)))};return d(),()=>{cancelAnimationFrame(a.current),u()}},[n,t,e]),(0,l.jsxs)(`div`,{className:Dt.rippleWater,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:r,className:Dt.canvas,style:{width:e,height:t}}),(0,l.jsx)(`span`,{className:Dt.hint,children:`点击水面产生涟漪`})]})},kt={scrambleText:`cos-scrambleText-hN4Wm`,text:`cos-text-frsHs`,cursor:`cos-cursor-3zQOy`,blink:`cos-blink-OcKXu`},At=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*`,jt=({text:e=`DECRYPTED`,duration:t=2e3,charset:n=At})=>{let[r,i]=(0,c.useState)(``),a=(0,c.useRef)(0),o=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let r=n.length>0?n:At,s=e;o.current=performance.now();let c=e=>{let n=e-o.current,l=Math.min(n/t,1),u=Math.floor(l*s.length);i(s.split(``).map((e,t)=>e===` `?` `:t<u?e:r[Math.floor(Math.random()*r.length)]).join(``)),l<1?a.current=requestAnimationFrame(c):i(s)};return a.current=requestAnimationFrame(c),()=>cancelAnimationFrame(a.current)},[e,t,n]),(0,l.jsx)(`div`,{className:kt.scrambleText,children:(0,l.jsxs)(`p`,{className:kt.text,children:[r,(0,l.jsx)(`span`,{className:kt.cursor})]})})},q={scratchCard:`cos-scratchCard-McIEK`,prize:`cos-prize-X0z5V`,canvas:`cos-canvas-JqIlr`,hidden:`cos-hidden-Lsfbt`},Mt=({coverColor:e=`#94a3b8`,prize:t=`🎉 恭喜中奖!`,onReveal:n,width:r=300,height:i=180})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)(!1),s=(0,c.useRef)(!1),u=(0,c.useRef)(n),[d,f]=(0,c.useState)(!1);(0,c.useEffect)(()=>{u.current=n},[n]);let p=(0,c.useCallback)(t=>{t.globalCompositeOperation=`source-over`,t.fillStyle=e,t.fillRect(0,0,r,i),t.fillStyle=`rgb(255 255 255 / 30%)`,t.font=`bold 16px system-ui, sans-serif`,t.textAlign=`center`,t.fillText(`刮开涂层`,r/2,i/2)},[e,i,r]),m=(0,c.useCallback)(e=>{if(s.current)return;let t=e.getContext(`2d`);if(!t)return;let n=t.getImageData(0,0,e.width,e.height),r=0;for(let e=3;e<n.data.length;e+=4)n.data[e]<128&&r++;r/(e.width*e.height)>.45&&(s.current=!0,f(!0),u.current?.())},[]);(0,c.useEffect)(()=>{let e=a.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=r*t,e.height=i*t;let n=e.getContext(`2d`);n&&(n.setTransform(t,0,0,t,0,0),p(n))},[p,i,r]);let h=(e,t)=>{let n=a.current;if(!n||s.current)return;let r=n.getContext(`2d`);r&&(r.globalCompositeOperation=`destination-out`,r.beginPath(),r.arc(e,t,20,0,Math.PI*2),r.fill(),m(n))},g=e=>{let t=a.current;if(!t)return null;let n=t.getBoundingClientRect();if(`touches`in e){let t=e.touches[0];return{x:t.clientX-n.left,y:t.clientY-n.top}}return{x:e.clientX-n.left,y:e.clientY-n.top}},_=e=>{o.current=!0;let t=g(e);t&&h(t.x,t.y)},v=e=>{if(!o.current)return;let t=g(e);t&&h(t.x,t.y)},y=()=>{o.current=!1};return(0,l.jsxs)(`div`,{className:q.scratchCard,style:{width:r,height:i},children:[(0,l.jsx)(`div`,{className:q.prize,children:t}),(0,l.jsx)(`canvas`,{ref:a,className:`${q.canvas} ${d?q.hidden:``}`,style:{width:r,height:i},onMouseDown:_,onMouseMove:v,onMouseUp:y,onMouseLeave:y,onTouchStart:_,onTouchMove:v,onTouchEnd:y})]})},J={slotMachine:`cos-slotMachine-P6FyZ`,machine:`cos-machine-B066r`,reel:`cos-reel-eEpJ3`,strip:`cos-strip-L5Z-a`,item:`cos-item-WYJ6q`,mask:`cos-mask-jdrj3`,spinBtn:`cos-spinBtn-DvDE7`,result:`cos-result-dLN5b`},Nt=[`🍒`,`🍋`,`🍊`,`🍇`,`⭐`,`7️⃣`],Pt=e=>1-(1-e)**3,Ft=({symbols:e=Nt,onSpinEnd:t})=>{let[n,r]=(0,c.useState)(!1),[i,a]=(0,c.useState)([0,0,0]),[o,s]=(0,c.useState)([]),u=(0,c.useRef)(0),d=(0,c.useRef)(t),f=(0,c.useRef)(null);(0,c.useEffect)(()=>{d.current=t},[t]);let p=(0,c.useCallback)(()=>{let t=[];for(let n=0;n<20;n++)t.push(...e);return t},[e])();return(0,c.useEffect)(()=>()=>{f.current&&(f.current.cancelled=!0),cancelAnimationFrame(u.current)},[]),(0,l.jsxs)(`div`,{className:J.slotMachine,children:[(0,l.jsx)(`div`,{className:J.machine,children:[0,1,2].map(e=>(0,l.jsxs)(`div`,{className:J.reel,style:{height:240},children:[(0,l.jsx)(`div`,{className:J.strip,style:{transform:`translateY(${i[e]}px)`},children:p.map((e,t)=>(0,l.jsx)(`div`,{className:J.item,style:{height:80},children:e},t))}),(0,l.jsx)(`div`,{className:J.mask})]},e))}),(0,l.jsx)(`button`,{type:`button`,className:J.spinBtn,onClick:()=>{if(n)return;r(!0),s([]);let t=[0,1,2].map(()=>Math.floor(Math.random()*e.length)),o=t.map(t=>-(t-1+e.length*10)*80),c=[...i],l=2e3,p=[0,300,600],m=performance.now(),h={cancelled:!1};f.current=h;let g=n=>{if(!h.cancelled){if(a(c.map((e,t)=>{let r=n-m-p[t];if(r<0)return e;let i=Pt(Math.min(r/l,1));return e+(o[t]-e)*i})),!p.every(e=>n-m-e>=l))u.current=requestAnimationFrame(g);else if(!h.cancelled){let n=t.map(t=>e[t]);s(n),r(!1),d.current?.(n)}}};u.current=requestAnimationFrame(g)},disabled:n,children:n?`旋转中...`:`开始`}),o.length>0&&!n&&(0,l.jsx)(`p`,{className:J.result,children:o[0]===o[1]&&o[1]===o[2]?`🎰 大奖!`:`结果: ${o.join(` `)}`})]})},Y={splitReveal:`cos-splitReveal-6W8-6`,text:`cos-text-miTsj`,char:`cos-char-0gPJV`,reveal:`cos-reveal-YGzz-`,fromTop:`cos-fromTop-YXHUa`,fromBottom:`cos-fromBottom-24D6g`,fromLeft:`cos-fromLeft-OMiPY`,fromRight:`cos-fromRight-EcMOR`},It=[`fromTop`,`fromBottom`,`fromLeft`,`fromRight`],Lt=({text:e=`REVEAL`,delay:t=80,color:n=`#f8fafc`})=>(0,l.jsx)(`div`,{className:Y.splitReveal,children:(0,l.jsx)(`h1`,{className:Y.text,style:{"--reveal-color":n},children:e.split(``).map((e,n)=>(0,l.jsx)(`span`,{className:`${Y.char} ${Y[It[n%It.length]]}`,style:{animationDelay:`${n*t}ms`},children:e===` `?`\xA0`:e},`${e}-${n}`))})}),Rt={spotlight:`cos-spotlight-OddY1`,content:`cos-content-5I1Wy`,overlay:`cos-overlay-F6CJ5`},zt=({children:e,radius:t=120,dimColor:n=`rgba(0, 0, 0, 0.85)`})=>{let r=(0,c.useRef)(null),i=(0,c.useCallback)(e=>{let t=r.current;if(!t)return;let n=t.getBoundingClientRect(),i=e.clientX-n.left,a=e.clientY-n.top;t.style.setProperty(`--spot-x`,`${i}px`),t.style.setProperty(`--spot-y`,`${a}px`)},[]);return(0,l.jsxs)(`div`,{ref:r,className:Rt.spotlight,style:{"--spot-radius":`${t}px`,"--dim-color":n},onMouseMove:i,children:[(0,l.jsx)(`div`,{className:Rt.content,children:e}),(0,l.jsx)(`div`,{className:Rt.overlay})]})},X={turntable:`cos-turntable-dkc32`,wheelWrap:`cos-wheelWrap-n7lhc`,canvas:`cos-canvas-A1-4x`,pointer:`cos-pointer-Rk1S9`,spinBtn:`cos-spinBtn-l9JIC`,result:`cos-result-H8q2c`,"fade-in":`cos-fade-in-U9bUC`},Bt=[`#FF6B6B`,`#4ECDC4`,`#FFE66D`,`#A78BFA`,`#60A5FA`,`#F472B6`,`#34D399`,`#FB923C`],Vt=[{label:`一等奖`},{label:`二等奖`},{label:`三等奖`},{label:`谢谢参与`},{label:`优惠券`},{label:`再来一次`}],Ht=e=>1-(1-e)**3,Ut=({prizes:e=Vt,size:t=360,spinDuration:n=4e3,spinRounds:r=5,buttonText:i=`开始抽奖`,onSpinEnd:a})=>{let o=(0,c.useRef)(null),s=(0,c.useRef)(0),u=(0,c.useRef)(0),d=(0,c.useRef)(1),[f,p]=(0,c.useState)(!1),[m,h]=(0,c.useState)(null),g=(0,c.useRef)(a),_=(0,c.useRef)(null);(0,c.useEffect)(()=>{g.current=a},[a]);let v=t+48,y=(e,t)=>t.color??Bt[e%Bt.length],b=(0,c.useCallback)(n=>{let r=o.current;if(!r)return;let i=r.getContext(`2d`);if(!i)return;let a=v/2,s=t/2,c=Math.PI*2/e.length;i.clearRect(0,0,v,v),i.save(),i.translate(a,a),i.rotate(n),e.forEach((e,n)=>{let r=n*c-Math.PI/2,a=r+c,o=y(n,e);i.beginPath(),i.moveTo(0,0),i.arc(0,0,s,r,a),i.closePath(),i.fillStyle=o,i.fill(),i.strokeStyle=`rgb(255 255 255 / 35%)`,i.lineWidth=2,i.stroke(),i.save(),i.rotate(r+c/2),i.textAlign=`right`,i.fillStyle=`#fff`,i.font=`bold ${Math.max(12,Math.floor(t/22))}px system-ui, sans-serif`,i.shadowColor=`rgb(0 0 0 / 30%)`,i.shadowBlur=4,i.fillText(e.label,s-18,6),i.restore()}),i.beginPath(),i.arc(0,0,s,0,Math.PI*2),i.strokeStyle=`#fbbf24`,i.lineWidth=6,i.stroke(),i.beginPath(),i.arc(0,0,s-4,0,Math.PI*2),i.strokeStyle=`#f59e0b`,i.lineWidth=2,i.stroke(),i.restore(),i.save(),i.translate(a,a);for(let e=0;e<12;e++){let t=e/12*Math.PI*2,n=Math.cos(t)*(s+14),r=Math.sin(t)*(s+14);i.beginPath(),i.arc(n,r,3,0,Math.PI*2),i.fillStyle=e%2==0?`#fde68a`:`#f59e0b`,i.fill()}i.restore()},[v,e,t]);(0,c.useEffect)(()=>{let e=o.current;if(!e)return;let t=window.devicePixelRatio||1;d.current=t,e.width=v*t,e.height=v*t;let n=e.getContext(`2d`);n&&n.setTransform(t,0,0,t,0,0),b(s.current)},[v,b]),(0,c.useEffect)(()=>()=>{_.current&&(_.current.cancelled=!0),u.current&&cancelAnimationFrame(u.current)},[]);let x=t=>{let n=360/e.length,r=(180/Math.PI*t%360+360)%360;return Math.floor((360-r+n/2)%360/n)%e.length};return(0,l.jsxs)(`div`,{className:X.turntable,style:{width:v,height:v+80},children:[(0,l.jsxs)(`div`,{className:X.wheelWrap,style:{width:v,height:v},children:[(0,l.jsx)(`div`,{className:X.pointer}),(0,l.jsx)(`canvas`,{ref:o,className:X.canvas,style:{width:v,height:v}}),(0,l.jsx)(`button`,{type:`button`,className:X.spinBtn,onClick:()=>{if(f||e.length===0)return;p(!0),h(null);let t=Math.PI*2/e.length,i=Math.floor(Math.random()*e.length)*t+t/2,a=s.current,o=a+r*Math.PI*2+(Math.PI*2-i)-a%(Math.PI*2),c=a,l=performance.now(),d={cancelled:!1};_.current=d;let m=t=>{if(d.cancelled)return;let r=t-l,i=Math.min(r/n,1),a=Ht(i),f=c+(o-c)*a;if(s.current=f,b(f),i<1)u.current=requestAnimationFrame(m);else if(!d.cancelled){let t=x(f),n=e[t];s.current=f,p(!1),h(n),g.current?.(n,t)}};u.current=requestAnimationFrame(m)},disabled:f,children:f?`抽奖中...`:i})]}),m&&!f&&(0,l.jsxs)(`p`,{className:X.result,children:[`恭喜获得:`,(0,l.jsx)(`strong`,{children:m.label})]})]})},Z={typewriter:`cos-typewriter-7UhOL`,terminal:`cos-terminal-NWNVN`,dots:`cos-dots-oulNg`,text:`cos-text-ICV5T`,prompt:`cos-prompt-Y4hVD`,cursor:`cos-cursor-m8hGi`,blink:`cos-blink-XykM7`},Wt=[`Hello, cos-design!`,`欢迎来到组件库 ✨`,`Build something fun 🚀`],Gt=({texts:e,speed:t,deleteSpeed:n,pause:r})=>{let[i,a]=(0,c.useState)(``),[o,s]=(0,c.useState)(0),[u,d]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{let c=e[o%e.length],l;if(!u&&i===c)l=setTimeout(()=>d(!0),r);else if(u&&i===``)l=setTimeout(()=>{d(!1),s(t=>(t+1)%e.length)},0);else{let e=u?c.slice(0,i.length-1):c.slice(0,i.length+1);l=setTimeout(()=>a(e),u?n:t)}return()=>clearTimeout(l)},[i,u,o,e,t,n,r]),(0,l.jsx)(`div`,{className:Z.typewriter,children:(0,l.jsxs)(`div`,{className:Z.terminal,children:[(0,l.jsxs)(`div`,{className:Z.dots,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]}),(0,l.jsxs)(`p`,{className:Z.text,children:[(0,l.jsx)(`span`,{className:Z.prompt,children:`>`}),i,(0,l.jsx)(`span`,{className:Z.cursor,children:`|`})]})]})})},Kt=({texts:e=Wt,speed:t=100,deleteSpeed:n=50,pause:r=2e3})=>{let i=e.length>0?e:Wt;return(0,l.jsx)(Gt,{texts:i,speed:t,deleteSpeed:n,pause:r},i.join(`\0`))},Q={waveButton:`cos-waveButton-Aa7G-`,btn:`cos-btn-WJrEN`,label:`cos-label-9BHOU`,wave:`cos-wave-GycLU`,ripple:`cos-ripple-5ZFpr`},qt=({text:e=`点我试试`,color:t=`#38bdf8`,className:n,style:r,...i})=>(0,l.jsx)(`div`,{className:Q.waveButton,children:(0,l.jsxs)(`button`,{type:`button`,className:`${Q.btn} ${n??``}`,style:{"--wave-color":t,...r},...i,children:[(0,l.jsx)(`span`,{className:Q.wave}),(0,l.jsx)(`span`,{className:Q.wave}),(0,l.jsx)(`span`,{className:Q.label,children:e})]})}),Jt=39,Yt={0:`sunny`,1:`sunny`,2:`partlyCloudy`,3:`overcast`,45:`fog`,48:`fog`,51:`lightRain`,53:`moderateRain`,55:`moderateRain`,56:`lightRain`,57:`moderateRain`,61:`lightRain`,63:`moderateRain`,65:`heavyRain`,66:`lightRain`,67:`heavyRain`,71:`lightSnow`,73:`moderateSnow`,75:`heavySnow`,77:`lightSnow`,80:`lightRain`,81:`moderateRain`,82:`heavyRain`,85:`lightSnow`,86:`heavySnow`,95:`thunderstorm`,96:`hail`,99:`hail`},Xt=(e,t=0)=>{let n=Yt[e]??`overcast`;return(n===`sunny`||n===`partlyCloudy`||n===`overcast`)&&t>=Jt?`gale`:n},Zt={weather:null,status:`idle`,error:null,current:null},Qt={weather:null,status:`locating`,error:null,current:null},$t={weather:null,status:`fetching`,error:null,current:null},en=e=>e!=null&&Number.isFinite(e.latitude)&&Number.isFinite(e.longitude),tn=(e=!0,t)=>{let n=en(t),r=n?t.latitude:null,i=n?t.longitude:null,a=e?n?$t:Qt:Zt,o=`${e}:${r},${i}`,[s,l]=(0,c.useState)(a),[u,d]=(0,c.useState)(o);return u!==o&&(d(o),l(t=>e&&t.weather?{...a,weather:t.weather,current:t.current}:a)),(0,c.useEffect)(()=>{if(!e)return;let t=!1,n=new AbortController,a=async(e,r)=>{try{let i=new URLSearchParams({latitude:String(e),longitude:String(r),current:`weather_code,wind_speed_10m,is_day`}),a=await fetch(`https://api.open-meteo.com/v1/forecast?${i}`,{signal:n.signal});if(!a.ok)throw Error(`Open-Meteo 请求失败(HTTP ${a.status})`);let o=await a.json(),s=Number(o?.current?.weather_code);if(Number.isNaN(s))throw Error(`Open-Meteo 返回数据缺少 weather_code`);let c=Number(o?.current?.wind_speed_10m??0);if(t)return;l({weather:Xt(s,c),status:`success`,error:null,current:{weatherCode:s,windSpeed:c,isDay:o?.current?.is_day===1,latitude:e,longitude:r}})}catch(e){if(t||e instanceof DOMException&&e.name===`AbortError`)return;l({weather:null,status:`error`,error:e instanceof Error?e.message:`天气获取失败`,current:null})}};return r!=null&&i!=null?(a(r,i),()=>{t=!0,n.abort()}):typeof navigator>`u`||!navigator.geolocation?(Promise.resolve().then(()=>{t||l({weather:null,status:`error`,error:`当前环境不支持定位`,current:null})}),()=>{t=!0}):(navigator.geolocation.getCurrentPosition(({coords:e})=>{t||(l(e=>({...e,status:`fetching`})),a(e.latitude,e.longitude))},e=>{t||l({weather:null,status:`error`,error:e.message||`定位失败`,current:null})},{timeout:1e4,maximumAge:600*1e3}),()=>{t=!0,n.abort()})},[e,r,i]),s};function nn(e){let t=e.activeWeather===`gale`?7:1;for(let n of e.state.clouds)n.x+=n.speed*t,n.x-140*n.scale>e.width&&(n.x=-160*n.scale),e.ctx.drawImage(n.sprite,n.x+n.ox,n.y+n.oy)}function rn(e){let t=e.fogSprite;if(!t||e.state.fogBanks.length===0)return;let{canvas:n,baseR:r}=t;for(let t of e.state.fogBanks)t.x+=t.speed,t.speed>0&&t.x-t.rw>e.width&&(t.x=-t.rw),t.speed<0&&t.x+t.rw<0&&(t.x=e.width+t.rw),e.ctx.save(),e.ctx.translate(t.x,t.y),e.ctx.scale(t.rw/r,t.rh/r),e.ctx.globalAlpha=t.alpha,e.ctx.drawImage(n,-r,-r),e.ctx.restore()}function an(e){if(e.cfg.haze<=0)return;let t=e.activeWeather===`smog`?`177, 164, 135`:`220, 226, 232`;e.activeNight&&(t=e.activeWeather===`smog`?`82, 74, 54`:`116, 128, 145`),e.ctx.fillStyle=`rgba(${t}, ${e.cfg.haze})`,e.ctx.fillRect(0,0,e.width,e.height)}function on(e,t,n,r,i,a){if(a<=0)return[[e,t],[n,r]];let o=(e+n)/2+(Math.random()-.5)*i,s=(t+r)/2,c=on(e,t,o,s,i*.55,a-1),l=on(o,s,n,r,i*.55,a-1);return[...c.slice(0,-1),...l]}function sn(e){if(e.state.windStreaks.length!==0)for(let t of e.state.windStreaks){t.x+=t.speed,t.wave+=.04,t.x-t.length>e.width&&(t.x=-t.length-Math.random()*e.width*.3,t.y=Math.random()*e.height);let n=Math.sin(t.wave)*8,r=t.x+t.length;if(e.ctx.beginPath(),e.ctx.moveTo(t.x,t.y),e.ctx.bezierCurveTo(t.x+t.length*.3,t.y+n,t.x+t.length*.7,t.y-n,r,t.y),e.ctx.strokeStyle=`rgba(235, 244, 250, ${t.alpha})`,e.ctx.lineWidth=t.width,e.ctx.lineCap=`round`,e.ctx.stroke(),t.length>100){let r=t.x+t.length*.58,i=t.y-n*.4;e.ctx.save(),e.ctx.translate(r,i),e.ctx.rotate(t.wave*2),e.ctx.beginPath(),e.ctx.ellipse(0,0,4,1.6,0,0,Math.PI*2),e.ctx.fillStyle=`rgba(91, 76, 52, ${t.alpha*1.6})`,e.ctx.fill(),e.ctx.restore()}}}function cn(e){if(e.cfg.lightning){if(e.state.t>=e.state.nextStrike){e.state.nextStrike=e.state.t+150+Math.random()*300,e.state.flashAlpha=.5,e.state.boltLife=9;let t=e.width*(.15+Math.random()*.7);e.state.boltPoints=on(t,e.height*.12,t+(Math.random()-.5)*e.width*.2,e.height*.92,60,6)}if(e.state.boltLife>0){--e.state.boltLife;let t=e.state.boltLife/9;e.ctx.beginPath(),e.state.boltPoints.forEach(([t,n],r)=>r===0?e.ctx.moveTo(t,n):e.ctx.lineTo(t,n)),e.ctx.strokeStyle=`rgba(240, 246, 255, ${t})`,e.ctx.lineWidth=2.4,e.ctx.shadowColor=`#bcd7ff`,e.ctx.shadowBlur=16,e.ctx.stroke(),e.ctx.shadowBlur=0}e.state.flashAlpha>.01&&(e.ctx.fillStyle=`rgba(226, 236, 255, ${e.state.flashAlpha})`,e.ctx.fillRect(0,0,e.width,e.height),e.state.flashAlpha*=.82)}}var ln=3.2,un=e=>{let t=Math.ceil(e*2.8+4),n=document.createElement(`canvas`);n.width=t,n.height=t;let r=n.getContext(`2d`),i=t/2,a=t/2,o=9+Math.floor(Math.random()*5),s=Array.from({length:o},(t,n)=>{let r=n/o*Math.PI*2+(Math.random()-.5)*.22,s=e*(.72+Math.random()*.44);return{x:i+Math.cos(r)*s,y:a+Math.sin(r)*s}}),c=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2});r.beginPath();let l=c(s[s.length-1],s[0]);r.moveTo(l.x,l.y);for(let e=0;e<s.length;e++){let t=c(s[e],s[(e+1)%s.length]);r.quadraticCurveTo(s[e].x,s[e].y,t.x,t.y)}r.closePath();let u=i-e*.3,d=a-e*.34,f=r.createRadialGradient(u,d,e*.06,i,a,e*1.2);f.addColorStop(0,`rgba(255, 255, 255, 0.98)`),f.addColorStop(.42,`rgba(228, 241, 252, 0.96)`),f.addColorStop(.82,`rgba(176, 203, 224, 0.93)`),f.addColorStop(1,`rgba(130, 162, 188, 0.9)`),r.fillStyle=f,r.fill(),r.strokeStyle=`rgba(155, 190, 215, 0.62)`,r.lineWidth=Math.max(.45,e*.11),r.stroke();let p=1+Math.floor(Math.random()*2);for(let t=0;t<p;t++){let t=Math.random()*Math.PI*2,n=i+Math.cos(t)*e*(.28+Math.random()*.35),o=a+Math.sin(t)*e*(.28+Math.random()*.35);r.beginPath(),r.ellipse(n,o,e*(.14+Math.random()*.1),e*(.1+Math.random()*.08),t,0,Math.PI*2),r.fillStyle=`rgba(105, 135, 165, 0.28)`,r.fill()}if(Math.random()<.75){let t=Math.random()*Math.PI*2,n=i+Math.cos(t)*e*(.38+Math.random()*.28),o=a+Math.sin(t)*e*(.38+Math.random()*.28);r.beginPath(),r.arc(n,o,e*(.1+Math.random()*.08),0,Math.PI*2),r.fillStyle=`rgba(255, 255, 255, 0.55)`,r.fill()}return r.beginPath(),r.ellipse(i-e*.34,a-e*.36,e*.24,e*.17,-.35,0,Math.PI*2),r.fillStyle=`rgba(255, 255, 255, 0.78)`,r.fill(),n},dn=(e=16)=>Array.from({length:e},()=>un(ln)),fn=e=>e[Math.floor(Math.random()*e.length)],pn=(e,t,n,r,i=!0)=>{e.r=1.4+Math.random()**1.35*3.4,e.x=Math.random()*(t+260)-130+(Math.random()-.5)*40,e.y=i?-e.r-Math.random()*n*.55:Math.random()*n,e.vx=-1.2-Math.random()*4.8+(Math.random()-.5)*1.2,e.vy=5.5+Math.random()*11,e.bounces=0,e.opacity=.45+Math.random()*.55,e.delay=Math.floor(Math.random()*(i?110:45)),e.gravity=.11+Math.random()*.14,e.phase=Math.random()*Math.PI*2,e.gust=(Math.random()-.5)*1.4,e.maxBounces=+(Math.random()<.62),e.sprite=fn(r),e.drawSize=e.r*2.8+4,e.rotation=Math.random()*Math.PI*2,e.rotationSpeed=(Math.random()-.5)*.06},mn=(e,t,n)=>{let r={x:0,y:0,r:2,vx:0,vy:0,bounces:0,opacity:1,delay:0,gravity:.16,phase:0,gust:0,maxBounces:1,sprite:n[0],drawSize:9.6,rotation:0,rotationSpeed:0};return pn(r,e,t,n,Math.random()<.72),r};function hn(e){if(!e.cfg.rain)return;let{wind:t,alpha:n,splash:r}=e.cfg.rain;e.ctx.strokeStyle=`rgba(214, 228, 240, ${n})`,e.ctx.lineWidth=1.2,e.ctx.beginPath();for(let n of e.state.drops){let i=Math.hypot(t,n.speed)||1,a=t/i,o=n.speed/i;e.ctx.moveTo(n.x,n.y),e.ctx.lineTo(n.x+a*n.len,n.y+o*n.len),n.x+=t,n.y+=n.speed,n.y>e.height&&(r&&Math.random()<.3&&e.state.splashes.length<60&&e.state.splashes.push({x:n.x,r:1,alpha:.5}),n.y=-n.len,n.x=Math.random()*(e.width+160)-80)}e.ctx.stroke();for(let t=e.state.splashes.length-1;t>=0;t--){let n=e.state.splashes[t];if(n.r+=.8,n.alpha-=.035,n.alpha<=0){e.state.splashes.splice(t,1);continue}e.ctx.beginPath(),e.ctx.ellipse(n.x,e.height-3,n.r,n.r*.35,0,Math.PI,Math.PI*2),e.ctx.strokeStyle=`rgba(214, 228, 240, ${n.alpha})`,e.ctx.lineWidth=1,e.ctx.stroke()}}function gn(e){for(let t of e.state.flakes){t.y+=t.speed,t.x+=Math.sin(e.state.t*.02+t.phase)*(.3+t.size*.08)+t.drift,t.rotation+=t.rotationSpeed,t.y-t.drawSize>e.height&&(t.y=-t.drawSize,t.x=Math.random()*e.width,t.phase=Math.random()*Math.PI*2,t.drift=(Math.random()-.5)*.4,t.opacity=.55+Math.random()*.45),t.x>e.width+20&&(t.x=-20),t.x<-20&&(t.x=e.width+20);let n=t.drawSize/2;e.ctx.save(),e.ctx.globalAlpha=t.opacity,e.ctx.translate(t.x,t.y),e.ctx.rotate(t.rotation),e.ctx.drawImage(t.sprite,-n,-n,t.drawSize,t.drawSize),e.ctx.restore()}}function _n(e){if(e.state.hailstones.length===0)return;let t=e.state.hailPool;for(let n of e.state.hailstones){if(n.delay>0){--n.delay;continue}let r=n.x,i=n.y;if(n.vy+=n.gravity,n.vx+=n.gust*.004+(Math.random()-.5)*.06,n.x+=n.vx+Math.sin(e.state.t*.028+n.phase)*.35,n.y+=n.vy,e.ctx.beginPath(),e.ctx.moveTo(r,i),e.ctx.lineTo(n.x,n.y),e.ctx.strokeStyle=`rgba(225, 239, 250, ${n.opacity*.18})`,e.ctx.lineWidth=n.r*.35,e.ctx.stroke(),n.y+n.r>=e.height)if(n.bounces<n.maxBounces)n.y=e.height-n.r,n.vy*=-(.22+Math.random()*.28),n.vx=n.vx*(.55+Math.random()*.25)+(Math.random()-.5)*1.6,n.bounces+=1;else{pn(n,e.width,e.height,t,!0);continue}let a=n.drawSize/2;n.rotation+=n.rotationSpeed,e.ctx.save(),e.ctx.globalAlpha=n.opacity,e.ctx.translate(n.x,n.y),e.ctx.rotate(n.rotation),e.ctx.drawImage(n.sprite,-a,-a,n.drawSize,n.drawSize),e.ctx.restore()}}function vn(e){e.ctx.fillStyle=e.skyGradient,e.ctx.fillRect(0,0,e.width,e.height)}function yn(e){if(e.state.stars.length!==0)for(let t of e.state.stars){let n=.35+(Math.sin(e.state.t*t.speed+t.phase)+1)*.325;e.ctx.beginPath(),e.ctx.arc(t.x,t.y,t.r,0,Math.PI*2),e.ctx.fillStyle=`rgba(226, 235, 255, ${n})`,e.ctx.fill()}}function bn(e){let t=e.celestial;if(!t)return;let{ctx:n,sunX:r,sunY:i,state:a}=e,o=1+Math.sin(a.t*t.breathSpeed)*t.breathAmp,s=t.half*o,c=s*2;n.drawImage(t.canvas,r-s,i-s,c,c)}function xn(e){if(e.activeNight){yn(e),bn(e);return}bn(e)}var Sn={sunny:{sky:[`#4a9fe0`,`#c8e8fb`],sun:`full`,cloudCount:1,cloudColor:[255,255,255],cloudAlpha:.5,cloudSpread:.12,rain:null,fogBanks:0,haze:0,snowCount:0,lightning:!1},partlyCloudy:{sky:[`#5b9bd0`,`#cfe6f3`],sun:`soft`,cloudCount:5,cloudColor:[255,255,255],cloudAlpha:.85,cloudSpread:.22,rain:null,fogBanks:0,haze:0,snowCount:0,lightning:!1},overcast:{sky:[`#8a97a8`,`#c3cbd6`],sun:`none`,cloudCount:9,cloudColor:[100,116,139],cloudAlpha:.55,cloudSpread:.3,rain:null,fogBanks:0,haze:.06,snowCount:0,lightning:!1},lightRain:{sky:[`#6b7a8f`,`#9aa7b8`],sun:`none`,cloudCount:7,cloudColor:[71,85,105],cloudAlpha:.6,cloudSpread:.24,rain:{count:70,speed:7,wind:-.8,alpha:.4,splash:!1},fogBanks:0,haze:.04,snowCount:0,lightning:!1},moderateRain:{sky:[`#55637a`,`#7e8ba0`],sun:`none`,cloudCount:8,cloudColor:[51,65,85],cloudAlpha:.65,cloudSpread:.26,rain:{count:150,speed:10,wind:-1.5,alpha:.5,splash:!0},fogBanks:0,haze:.06,snowCount:0,lightning:!1},heavyRain:{sky:[`#3d4a5f`,`#5d6a80`],sun:`none`,cloudCount:9,cloudColor:[30,41,59],cloudAlpha:.7,cloudSpread:.3,rain:{count:280,speed:14,wind:-2.8,alpha:.55,splash:!0},fogBanks:0,haze:.1,snowCount:0,lightning:!1},thunderstorm:{sky:[`#252f42`,`#43506a`],sun:`none`,cloudCount:10,cloudColor:[15,23,42],cloudAlpha:.75,cloudSpread:.32,rain:{count:240,speed:13,wind:-2.2,alpha:.55,splash:!0},fogBanks:0,haze:.08,snowCount:0,lightning:!0},fog:{sky:[`#aab4bf`,`#d5dbe1`],sun:`dim`,cloudCount:3,cloudColor:[203,213,225],cloudAlpha:.4,cloudSpread:.2,rain:null,fogBanks:10,haze:.28,snowCount:0,lightning:!1},lightSnow:{sky:[`#aab8c8`,`#e2e8ef`],sun:`none`,cloudCount:5,cloudColor:[166,180,196],cloudAlpha:.45,cloudSpread:.22,rain:null,fogBanks:0,haze:.05,snowCount:70,lightning:!1},moderateSnow:{sky:[`#9fb0c4`,`#dde5ee`],sun:`none`,cloudCount:6,cloudColor:[148,163,184],cloudAlpha:.5,cloudSpread:.24,rain:null,fogBanks:0,haze:.08,snowCount:160,lightning:!1},heavySnow:{sky:[`#8495aa`,`#c7d1dc`],sun:`none`,cloudCount:9,cloudColor:[100,116,139],cloudAlpha:.62,cloudSpread:.3,rain:null,fogBanks:3,haze:.14,snowCount:300,lightning:!1},sleet:{sky:[`#78899e`,`#b8c5d2`],sun:`none`,cloudCount:8,cloudColor:[71,85,105],cloudAlpha:.6,cloudSpread:.28,rain:{count:100,speed:9,wind:-1.4,alpha:.42,splash:!0},fogBanks:0,haze:.09,snowCount:100,lightning:!1},hail:{sky:[`#46566c`,`#77889d`],sun:`none`,cloudCount:9,cloudColor:[30,41,59],cloudAlpha:.68,cloudSpread:.3,rain:{count:80,speed:11,wind:-2.5,alpha:.38,splash:!0},fogBanks:0,haze:.1,snowCount:0,lightning:!1},smog:{sky:[`#8f8b7e`,`#c5bca8`],sun:`dim`,cloudCount:3,cloudColor:[142,136,119],cloudAlpha:.35,cloudSpread:.2,rain:null,fogBanks:12,haze:.34,snowCount:0,lightning:!1},gale:{sky:[`#587087`,`#a6b5c2`],sun:`soft`,cloudCount:8,cloudColor:[203,213,225],cloudAlpha:.72,cloudSpread:.3,rain:null,fogBanks:0,haze:.04,snowCount:0,lightning:!1},snow:{sky:[`#9fb0c4`,`#dde5ee`],sun:`none`,cloudCount:6,cloudColor:[148,163,184],cloudAlpha:.5,cloudSpread:.24,rain:null,fogBanks:0,haze:.08,snowCount:160,lightning:!1}};Sn.snow=Sn.moderateSnow;var Cn={sunny:{sky:[`#0b1a33`,`#27476e`],stars:110},partlyCloudy:{sky:[`#0f1f38`,`#2c4666`],stars:60},overcast:{sky:[`#181f2a`,`#333e4e`],stars:0},lightRain:{sky:[`#151b26`,`#2b3442`],stars:0},moderateRain:{sky:[`#11161f`,`#242c3a`],stars:0},heavyRain:{sky:[`#0c1017`,`#1c232e`],stars:0},thunderstorm:{sky:[`#0a0e18`,`#192132`],stars:0},fog:{sky:[`#1c222b`,`#3a434e`],stars:0},lightSnow:{sky:[`#161e2b`,`#3a4656`],stars:20},moderateSnow:{sky:[`#131a26`,`#333f4f`],stars:8},heavySnow:{sky:[`#101623`,`#2a3545`],stars:0},sleet:{sky:[`#121924`,`#2c3745`],stars:0},hail:{sky:[`#0e141d`,`#26303e`],stars:0},smog:{sky:[`#1a1812`,`#38321f`],stars:0},gale:{sky:[`#101a26`,`#2e3d4d`],stars:30},snow:{sky:[`#131a26`,`#333f4f`],stars:8}};Cn.snow=Cn.moderateSnow;var wn=([e,t,n])=>[Math.round(e*.3+18),Math.round(t*.3+24),Math.round(n*.3+42)];function Tn(e,t,n,r){let[i,a,o]=n,s=1/0,c=1/0,l=-1/0,u=-1/0;for(let n of t){let t=n.dx*e,r=n.dy*e,i=n.r*e;s=Math.min(s,t-i),c=Math.min(c,r-i),l=Math.max(l,t+i),u=Math.max(u,r+i)}let d=Math.floor(s-2),f=Math.floor(c-2),p=Math.ceil(l+2)-d,m=Math.ceil(u+2)-f,h=document.createElement(`canvas`);h.width=p,h.height=m;let g=h.getContext(`2d`);for(let n of t){let t=n.dx*e-d,s=n.dy*e-f,c=n.r*e,l=g.createRadialGradient(t,s,0,t,s,c);l.addColorStop(0,`rgba(${i}, ${a}, ${o}, ${r})`),l.addColorStop(1,`rgba(${i}, ${a}, ${o}, 0)`),g.beginPath(),g.arc(t,s,c,0,Math.PI*2),g.fillStyle=l,g.fill()}return{sprite:h,ox:d,oy:f}}function En(e,t,n,r,i){let a=.7+Math.random()*.9,o=4+Math.floor(Math.random()*3),s=Array.from({length:o},(e,t)=>({dx:(t-o/2)*26+(Math.random()-.5)*14,dy:(Math.random()-.5)*14,r:22+Math.random()*20})),{sprite:c,ox:l,oy:u}=Tn(a,s,r,i);return{x:Math.random()*(e+240)-120,y:t*.06+Math.random()*t*n,scale:a,speed:.12+Math.random()*.22,puffs:s,sprite:c,ox:l,oy:u}}function Dn(e,t=120){let n=t*2,r=document.createElement(`canvas`);r.width=n,r.height=n;let i=r.getContext(`2d`),a=i.createRadialGradient(t,t,0,t,t,t);return a.addColorStop(0,`rgba(${e}, 1)`),a.addColorStop(1,`rgba(${e}, 0)`),i.fillStyle=a,i.beginPath(),i.arc(t,t,t,0,Math.PI*2),i.fill(),{canvas:r,baseR:t}}function On(e,t){let n=e.sun;if(n===`none`)return null;let r=n===`full`?1:n===`soft`?.62:.32,i=t*(n===`full`?.72:n===`soft`?.62:.5),a=t*(n===`full`?7.2:n===`soft`?5.2:3.6),o=a;n===`full`&&(o=Math.max(o,1.55*t*5.5)),o=Math.ceil(o+2);let s=o*2,c=document.createElement(`canvas`);c.width=s,c.height=s;let l=c.getContext(`2d`),u=o,d=o;l.save(),l.globalCompositeOperation=`lighter`;let f=l.createRadialGradient(u,d,0,u,d,a);f.addColorStop(0,`rgba(255, 230, 170, ${.14*r})`),f.addColorStop(.22,`rgba(255, 210, 140, ${.07*r})`),f.addColorStop(.5,`rgba(255, 195, 120, ${.03*r})`),f.addColorStop(1,`rgba(255, 200, 130, 0)`),l.fillStyle=f,l.fillRect(0,0,s,s);let p=t*(n===`full`?3.4:2.6),m=l.createRadialGradient(u,d,i*.15,u,d,p);if(m.addColorStop(0,`rgba(255, 240, 200, ${.32*r})`),m.addColorStop(.4,`rgba(255, 220, 150, ${.16*r})`),m.addColorStop(.75,`rgba(255, 200, 120, ${.05*r})`),m.addColorStop(1,`rgba(255, 190, 110, 0)`),l.fillStyle=m,l.beginPath(),l.arc(u,d,p,0,Math.PI*2),l.fill(),n===`full`){l.translate(u,d),l.scale(1.55,.55);let e=l.createRadialGradient(0,0,0,0,0,t*5.5);e.addColorStop(0,`rgba(255, 225, 170, 0.08)`),e.addColorStop(.5,`rgba(255, 205, 140, 0.03)`),e.addColorStop(1,`rgba(255, 195, 130, 0)`),l.fillStyle=e,l.beginPath(),l.arc(0,0,t*5.5,0,Math.PI*2),l.fill()}l.restore();let h=i*2.05,g=l.createRadialGradient(u,d,0,u,d,h);g.addColorStop(0,`rgba(255, 245, 210, ${.7*r})`),g.addColorStop(.4,`rgba(255, 230, 170, ${.35*r})`),g.addColorStop(.75,`rgba(255, 210, 140, ${.1*r})`),g.addColorStop(1,`rgba(255, 200, 130, 0)`),l.fillStyle=g,l.beginPath(),l.arc(u,d,h,0,Math.PI*2),l.fill();let _=l.createRadialGradient(u,d,0,u,d,i);return n===`dim`?(_.addColorStop(0,`rgba(255, 240, 210, ${.5*r})`),_.addColorStop(.55,`rgba(255, 220, 170, ${.3*r})`),_.addColorStop(1,`rgba(255, 200, 140, 0)`)):(_.addColorStop(0,`rgba(255, 250, 230, ${.98*r})`),_.addColorStop(.4,`rgba(255, 240, 195, ${.92*r})`),_.addColorStop(.75,`rgba(255, 220, 150, ${.55*r})`),_.addColorStop(1,`rgba(255, 205, 130, 0)`)),l.fillStyle=_,l.beginPath(),l.arc(u,d,i,0,Math.PI*2),l.fill(),{canvas:c,half:o,breathSpeed:.018,breathAmp:.018}}function kn(e,t,n){if(e.sun===`none`)return null;let r=t*.82,i=e.sun===`dim`,a=i?.45:1,o=r*(i?4.2:6.2),s=Math.ceil(Math.max(o,r*2.6,r*1.35)+2),c=s*2,l=document.createElement(`canvas`);l.width=c,l.height=c;let u=l.getContext(`2d`),d=s,f=s;u.save(),u.globalCompositeOperation=`lighter`;let p=u.createRadialGradient(d,f,0,d,f,o);p.addColorStop(0,`rgba(200, 215, 240, ${.16*a})`),p.addColorStop(.25,`rgba(170, 190, 225, ${.07*a})`),p.addColorStop(.55,`rgba(140, 165, 210, ${.025*a})`),p.addColorStop(1,`rgba(130, 155, 200, 0)`),u.fillStyle=p,u.fillRect(0,0,c,c);let m=r*2.6,h=u.createRadialGradient(d,f,r*.2,d,f,m);h.addColorStop(0,`rgba(230, 236, 248, ${.28*a})`),h.addColorStop(.45,`rgba(190, 205, 230, ${.12*a})`),h.addColorStop(1,`rgba(160, 180, 220, 0)`),u.fillStyle=h,u.beginPath(),u.arc(d,f,m,0,Math.PI*2),u.fill(),u.restore();let g=u.createRadialGradient(d-r*.28,f-r*.3,0,d,f,r);g.addColorStop(0,`rgba(236, 240, 246, ${.96*a})`),g.addColorStop(.45,`rgba(214, 220, 230, ${.94*a})`),g.addColorStop(.82,`rgba(186, 196, 212, ${.9*a})`),g.addColorStop(1,`rgba(160, 172, 192, ${.75*a})`),u.beginPath(),u.arc(d,f,r,0,Math.PI*2),u.fillStyle=g,u.fill(),u.save(),u.beginPath(),u.arc(d,f,r*.98,0,Math.PI*2),u.clip();for(let e of[{dx:-.18,dy:.12,rx:.38,ry:.28,a:.14},{dx:.22,dy:-.08,rx:.26,ry:.2,a:.11},{dx:.05,dy:.32,rx:.2,ry:.14,a:.09}]){let t=d+e.dx*r,n=f+e.dy*r,i=u.createRadialGradient(t,n,0,t,n,e.rx*r);i.addColorStop(0,`rgba(140, 152, 170, ${e.a*a})`),i.addColorStop(.65,`rgba(150, 162, 178, ${e.a*.45*a})`),i.addColorStop(1,`rgba(160, 170, 185, 0)`),u.fillStyle=i,u.beginPath(),u.ellipse(t,n,e.rx*r,e.ry*r,.35,0,Math.PI*2),u.fill()}for(let e of n){let t=d+e.dx*r,n=f+e.dy*r,i=e.r*r,o=u.createRadialGradient(t-i*.25,n-i*.3,0,t,n,i);o.addColorStop(0,`rgba(155, 168, 186, ${.22*a})`),o.addColorStop(.55,`rgba(145, 158, 176, ${.28*a})`),o.addColorStop(.85,`rgba(200, 210, 224, ${.12*a})`),o.addColorStop(1,`rgba(210, 218, 230, 0)`),u.fillStyle=o,u.beginPath(),u.arc(t,n,i,0,Math.PI*2),u.fill()}let _=u.createRadialGradient(d-r*.35,f-r*.38,0,d-r*.1,f-r*.1,r*.7);_.addColorStop(0,`rgba(255, 255, 255, ${.28*a})`),_.addColorStop(.45,`rgba(245, 248, 252, ${.08*a})`),_.addColorStop(1,`rgba(240, 244, 250, 0)`),u.fillStyle=_,u.beginPath(),u.arc(d,f,r,0,Math.PI*2),u.fill(),u.restore();let v=u.createRadialGradient(d,f,r*.72,d,f,r*1.35);return v.addColorStop(0,`rgba(210, 220, 235, 0)`),v.addColorStop(.55,`rgba(200, 212, 232, ${.1*a})`),v.addColorStop(1,`rgba(180, 195, 220, 0)`),u.fillStyle=v,u.beginPath(),u.arc(d,f,r*1.35,0,Math.PI*2),u.fill(),{canvas:l,half:s,breathSpeed:.012,breathAmp:.012}}var An=e=>{let t=Math.ceil(e*2+4),n=document.createElement(`canvas`);n.width=t,n.height=t;let r=n.getContext(`2d`),i=r.createRadialGradient(t/2,t/2,0,t/2,t/2,e+1);return i.addColorStop(0,`rgba(255, 255, 255, 1)`),i.addColorStop(.6,`rgba(255, 255, 255, 0.85)`),i.addColorStop(1,`rgba(255, 255, 255, 0)`),r.fillStyle=i,r.fillRect(0,0,t,t),n},jn=e=>{let t=Math.ceil(e*2+6),n=document.createElement(`canvas`);n.width=t,n.height=t;let r=n.getContext(`2d`);r.translate(t/2,t/2),r.strokeStyle=`rgba(255, 255, 255, 0.95)`,r.lineCap=`round`,r.lineWidth=Math.max(e*.11,.7),r.shadowColor=`rgba(255, 255, 255, 0.5)`,r.shadowBlur=e*.25;let i=1+Math.floor(Math.random()*3),a=Array.from({length:i},()=>({pos:.3+Math.random()*.5,len:e*(.22+Math.random()*.34),angle:Math.PI/3*(.8+Math.random()*.45)})),o=Math.random()<.55,s=e*(.14+Math.random()*.12),c=Math.random()<.45,l=e*(.14+Math.random()*.14);for(let t=0;t<6;t++){r.save(),r.rotate(t*Math.PI/3),r.beginPath(),r.moveTo(0,0),r.lineTo(0,-e);for(let t of a){let n=-e*t.pos;r.moveTo(0,n),r.lineTo(Math.sin(t.angle)*t.len,n-Math.cos(t.angle)*t.len),r.moveTo(0,n),r.lineTo(-Math.sin(t.angle)*t.len,n-Math.cos(t.angle)*t.len)}o&&(r.moveTo(0,-e),r.lineTo(s*.7,-e-s*.5),r.moveTo(0,-e),r.lineTo(-s*.7,-e-s*.5)),r.stroke(),r.restore()}if(c){r.beginPath();for(let e=0;e<6;e++){let t=e*Math.PI/3-Math.PI/2,n=Math.cos(t)*l,i=Math.sin(t)*l;e===0?r.moveTo(n,i):r.lineTo(n,i)}r.closePath(),r.stroke()}return n},Mn=()=>({dots:[1.2,1.6,2,2.3].map(e=>An(e)),crystals:[2.6,3.2,3.8,4.4,5].map(e=>jn(e*2.4))}),Nn=e=>e[Math.floor(Math.random()*e.length)],Pn=(e,t,n,r)=>{let i=1+Math.random()**1.6*4.2,a=i>=2.4,o=Nn(a?n.crystals:n.dots),s=a?i*4.8+6:i*2+4;return{x:Math.random()*e,y:r??Math.random()*t,size:i,speed:.4+i*.28+Math.random()*.4,phase:Math.random()*Math.PI*2,drift:(Math.random()-.5)*.4,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.025,opacity:.55+Math.random()*.45,sprite:o,drawSize:s}},Fn=(e,t)=>t?e===`smog`?`96, 88, 66`:`138, 150, 168`:e===`smog`?`168, 155, 126`:`226, 232, 238`;function In(e){let{ctx:t,width:n,height:r,activeWeather:i,activeNight:a}=e,o=Sn[i],s=Cn[i],c=a?s.sky:o.sky,l=a?wn(o.cloudColor):o.cloudColor,u=n*.72,d=r*.26,f=Math.min(n,r)*.09,p=t.createLinearGradient(0,0,0,r);p.addColorStop(0,c[0]),p.addColorStop(1,c[1]);let m=a?Array.from({length:s.stars},()=>({x:Math.random()*n,y:Math.random()*r*.72,r:.4+Math.random()*1.1,phase:Math.random()*Math.PI*2,speed:.015+Math.random()*.035})):[],h=[{dx:-.32,dy:.08,r:.17},{dx:.24,dy:-.22,r:.12},{dx:.04,dy:.34,r:.1},{dx:.36,dy:.24,r:.07}],g=a?kn(o,f,h):On(o,f),_=Array.from({length:o.cloudCount},()=>En(n,r,o.cloudSpread,l,o.cloudAlpha)),v=o.rain?Array.from({length:o.rain.count},()=>({x:Math.random()*(n+160)-80,y:Math.random()*r,len:8+Math.random()*10,speed:o.rain.speed*(.75+Math.random()*.5)})):[],y=[],b=Array.from({length:o.fogBanks},(e,t)=>({x:Math.random()*n,y:t/Math.max(o.fogBanks-1,1)*r*.9+r*.05,rw:n*(.25+Math.random()*.3),rh:r*(.08+Math.random()*.08),speed:(.1+Math.random()*.25)*(t%2==0?1:-1),alpha:.16+Math.random()*.14})),x=o.fogBanks>0?Dn(Fn(i,a)):null,S=o.snowCount>0?Mn():null,C=S==null?[]:Array.from({length:o.snowCount},()=>Pn(n,r,S)),w=i===`hail`?dn():null,T=w==null?[]:Array.from({length:145},()=>mn(n,r,w)),E=i===`gale`?Array.from({length:46},()=>({x:Math.random()*n,y:Math.random()*r,length:45+Math.random()*130,speed:8+Math.random()*10,wave:Math.random()*Math.PI*2,alpha:.12+Math.random()*.3,width:.6+Math.random()*1.2})):[],D=[],ee=120+Math.random()*240;return{sky:c,cloudRgb:l,cfg:o,sunX:u,sunY:d,sunR:f,skyGradient:p,celestial:g,fogSprite:x,state:{stars:m,moonCraters:h,clouds:_,drops:v,splashes:y,fogBanks:b,flakes:C,hailstones:T,hailPool:w??[],windStreaks:E,t:0,flashAlpha:0,boltLife:0,boltPoints:D,nextStrike:ee}}}function Ln(e,t){t&&(e.state.t+=1),vn(e),xn(e),nn(e),rn(e),an(e),hn(e),gn(e),_n(e),sn(e),cn(e)}function Rn(e){let{ctx:t,width:n,height:r,activeWeather:i,activeNight:a}=e,o={ctx:t,width:n,height:r,activeWeather:i,activeNight:a,...In(e)};if(typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return Ln(o,!1),()=>void 0;let s=0,c=document.hidden,l=_(e=>{c=e}),u=()=>{s=requestAnimationFrame(u),!c&&Ln(o,!0)};return u(),()=>{cancelAnimationFrame(s),l()}}var $={weatherBackground:`cos-weatherBackground-Mnm22`,canvas:`cos-canvas-nvqMt`,loadingOverlay:`cos-loadingOverlay-O58B7`,loadingSpinner:`cos-loadingSpinner-NQ9yG`,"weather-loading-spin":`cos-weather-loading-spin-IPFWZ`},zn=({width:e=800,height:t=450,weather:n=`sunny`,night:r=!1,live:i=!1,latitude:a,longitude:o,onLiveWeather:s,loading:u=!1})=>{let d=(0,c.useRef)(null),f=tn(i,a!=null&&o!=null?{latitude:a,longitude:o}:void 0),p=i&&f.weather?f.weather:n,m=i&&f.current?!f.current.isDay:r,h=u||i&&(f.status===`locating`||f.status===`fetching`),g=(0,c.useRef)(s);return(0,c.useEffect)(()=>{g.current=s}),(0,c.useEffect)(()=>{f.weather&&g.current?.(f.weather)},[f.weather]),(0,c.useEffect)(()=>{let n=d.current;if(!n)return;let r=window.devicePixelRatio||1;n.width=e*r,n.height=t*r;let i=n.getContext(`2d`);if(i)return i.setTransform(r,0,0,r,0,0),Rn({ctx:i,width:e,height:t,activeWeather:p,activeNight:m})},[m,p,t,e]),(0,l.jsxs)(`div`,{className:$.weatherBackground,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:d,className:$.canvas,style:{width:e,height:t},role:`img`,"aria-label":`天气背景:${p}${m?`(夜间)`:``}`}),h&&(0,l.jsxs)(`div`,{className:$.loadingOverlay,role:`status`,"aria-live":`polite`,children:[(0,l.jsx)(`div`,{className:$.loadingSpinner,"aria-hidden":!0}),(0,l.jsx)(`span`,{children:`天气加载中…`})]})]})},Bn={waveText:`cos-waveText-Zy2Tp`,text:`cos-text-el-KR`,char:`cos-char-Y9-mV`,wave:`cos-wave-jVRCz`},Vn=({text:e=`WAVE`,amplitude:t=12,color:n=`#38bdf8`,fontSize:r=56})=>(0,l.jsx)(`div`,{className:Bn.waveText,children:(0,l.jsx)(`h1`,{className:Bn.text,style:{fontSize:r,"--wave-color":n,"--wave-amp":`${t}px`},children:e.split(``).map((e,t)=>(0,l.jsx)(`span`,{className:Bn.char,style:{animationDelay:`${t*.1}s`},children:e===` `?`\xA0`:e},`${e}-${t}`))})});exports.AudioVisualizer=b,exports.Aurora=g,exports.BarcodeScan=d,exports.BurnAway=p,exports.CanvasClock=S,exports.Charge=E,exports.ClickSpark=ee,exports.Confetti=M,exports.Countdown=oe,exports.CursorTrail=pe,exports.CyberGrid=ne,exports.DiceRoll=he,exports.DnaHelix=ce,exports.DoublePendulum=_e,exports.ElectricArc=de,exports.Fireworks=we,exports.FlipCounter=De,exports.GlitchText=Me,exports.GradientFlow=Ae,exports.GravityBalls=Fe,exports.HolographicCard=Ie,exports.LiquidGlass=Ve,exports.LiquidProgress=Le,exports.LorenzAttractor=ze,exports.MagneticButton=Ue,exports.MatrixRain=Ge,exports.MazeGenerator=Ye,exports.MetaballPool=qe,exports.MeteorRain=Ze,exports.NeonText=Qe,exports.NewtonCradle=et,exports.OrbitalChart=nt,exports.ParticleNetwork=it,exports.PlasmaBall=ot,exports.ProgressChest=vt,exports.RadarScan=bt,exports.RedPacketRain=xt,exports.ReturnCity=St,exports.RippleWater=Ot,exports.RopeChain=wt,exports.ScrambleText=jt,exports.ScratchCard=Mt,exports.SlotMachine=Ft,exports.SmokeFog=ut,exports.Snowfall=ht,exports.SolarSystem=pt,exports.Speedometer=Tt,exports.SplitReveal=Lt,exports.Spotlight=zt,exports.Starfield=_t,exports.TimelinePulse=Et,exports.Turntable=Ut,exports.Typewriter=Kt,exports.WaveButton=qt,exports.WaveText=Vn,exports.WeatherBackground=zn,exports.mapWmoCodeToWeatherType=Xt,exports.useLiveWeather=tn;