cos-design 3.7.11 → 3.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +13 -8
  3. package/dist/index.cjs +159 -3
  4. package/dist/index.css +1 -1
  5. package/dist/index.js +4461 -2013
  6. package/dist/src/components/auroraVeil/index.d.ts +19 -0
  7. package/dist/src/components/dandelionField/constants.d.ts +72 -0
  8. package/dist/src/components/dandelionField/draw.d.ts +33 -0
  9. package/dist/src/components/dandelionField/frame-cache.d.ts +22 -0
  10. package/dist/src/components/dandelionField/index.d.ts +5 -0
  11. package/dist/src/components/dandelionField/plant.d.ts +106 -0
  12. package/dist/src/components/dandelionField/scene.d.ts +13 -0
  13. package/dist/src/components/dandelionField/seed.d.ts +15 -0
  14. package/dist/src/components/dandelionField/types.d.ts +193 -0
  15. package/dist/src/components/dandelionField/utils.d.ts +18 -0
  16. package/dist/src/components/index.d.ts +10 -0
  17. package/dist/src/components/inkBloom/index.d.ts +21 -0
  18. package/dist/src/components/lavaBubble/gl.d.ts +3 -0
  19. package/dist/src/components/lavaBubble/index.d.ts +24 -0
  20. package/dist/src/components/lavaBubble/shaders.d.ts +2 -0
  21. package/dist/src/components/lavaBubble/sim.d.ts +60 -0
  22. package/dist/src/components/soapBubbles/draw-bubble.d.ts +20 -0
  23. package/dist/src/components/soapBubbles/film.d.ts +8 -0
  24. package/dist/src/components/soapBubbles/index.d.ts +20 -0
  25. package/dist/src/components/soapBubbles/lighting.d.ts +34 -0
  26. package/dist/src/components/soapBubbles/merge.d.ts +50 -0
  27. package/dist/src/components/soapBubbles/sky.d.ts +2 -0
  28. package/dist/src/components/soapBubbles/types.d.ts +40 -0
  29. package/dist/src/components/soapBubbles/utils.d.ts +12 -0
  30. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,11 +1,167 @@
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"),u=require("three");u=s(u,1);var d={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`},f=({children:e,scanColor:t=`#22c55e`,speed:n=2.5})=>(0,l.jsxs)(`div`,{className:d.barcodeScan,style:{"--scan-color":t,"--scan-speed":`${n}s`},children:[(0,l.jsx)(`div`,{className:d.content,children:e??(0,l.jsx)(`span`,{className:d.placeholder,children:`SCAN ME`})}),(0,l.jsxs)(`div`,{className:d.overlay,children:[(0,l.jsx)(`div`,{className:d.scanLine}),(0,l.jsx)(`div`,{className:d.glitchLayer})]}),(0,l.jsxs)(`div`,{className:d.corners,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]})]}),p={blurText:`cos-blurText-I8PNq`,text:`cos-text-t-IfM`,unit:`cos-unit-8HSAb`,idle:`cos-idle-OqUeJ`,top:`cos-top-j8xKn`,enter:`cos-enter-ZtGBp`,blurFromTop:`cos-blurFromTop-7baxF`,bottom:`cos-bottom-s-Evv`,blurFromBottom:`cos-blurFromBottom-UMwhj`},m=({text:e=`BLUR TEXT`,animateBy:t=`words`,direction:n=`top`,stagger:r=120,duration:i=500,fontSize:a=56,color:o=`#f8fafc`,onAnimationComplete:s})=>{let[u,d]=(0,c.useState)(!1),f=(0,c.useRef)(null),m=(0,c.useRef)(!1),h=(0,c.useMemo)(()=>t===`words`?e.split(` `):e.split(``),[t,e]);return(0,c.useEffect)(()=>{let e=f.current;if(!e)return;let t=new IntersectionObserver(([e])=>{e.isIntersecting&&(d(!0),t.disconnect())},{threshold:.15});return t.observe(e),()=>t.disconnect()},[]),(0,c.useEffect)(()=>{if(!u||m.current||!s)return;let e=h.length*r+i,t=window.setTimeout(()=>{m.current=!0,s()},e);return()=>window.clearTimeout(t)},[i,h.length,u,s,r]),(0,l.jsx)(`div`,{className:p.blurText,ref:f,children:(0,l.jsx)(`p`,{className:p.text,style:{fontSize:a,"--blur-color":o,"--blur-duration":`${i}ms`},children:h.map((e,i)=>(0,l.jsxs)(`span`,{className:`${p.unit} ${p[n]} ${u?p.enter:p.idle}`,style:{animationDelay:`${i*r}ms`},children:[e===` `?`\xA0`:e,t===`words`&&i<h.length-1?`\xA0`:null]},`${e}-${i}`))})})},h={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`},g=({text:e=`BURN`,fontSize:t=64,onComplete:n,completedText:r=`Gone.`})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)(null),[o,s]=(0,c.useState)(!1),[u,d]=(0,c.useState)(!1),f=(0,c.useRef)(!1),p=(0,c.useRef)(n);(0,c.useEffect)(()=>{p.current=n},[n]);let m=(0,c.useCallback)(()=>{o||u||s(!0)},[o,u]);return(0,c.useEffect)(()=>{if(!o||u)return;let n=i.current,r=a.current;if(!n||!r)return;let s=n.getBoundingClientRect(),c=window.devicePixelRatio||1,l=Math.ceil(s.width),m=Math.ceil(s.height);r.width=l*c,r.height=m*c,r.style.width=`${l}px`,r.style.height=`${m}px`;let h=r.getContext(`2d`);if(!h)return;h.scale(c,c);let g=document.createElement(`canvas`);g.width=l*c,g.height=m*c;let _=g.getContext(`2d`);if(!_)return;_.scale(c,c),_.font=`900 ${t}px system-ui, sans-serif`,_.textAlign=`center`,_.textBaseline=`middle`,_.fillStyle=`#f8fafc`,_.fillText(e,l/2,m/2);let v=_.getImageData(0,0,l*c,m*c).data,y=[];for(let e=0;e<m;e+=4)for(let t=0;t<l;t+=4)v[(Math.floor(e*c)*l*c+Math.floor(t*c))*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,l,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||(d(!0),f.current||(f.current=!0,p.current?.()))};return b=requestAnimationFrame(e=>C(e,e)),()=>{S=!0,cancelAnimationFrame(b)}},[o,u,e,t]),(0,l.jsxs)(`div`,{className:h.burnAway,children:[(0,l.jsxs)(`div`,{ref:i,className:h.stage,children:[!u&&(0,l.jsx)(`span`,{className:h.text,style:{fontSize:t,opacity:+!o},children:e}),(0,l.jsx)(`canvas`,{ref:a,className:h.canvas})]}),!o&&!u&&(0,l.jsx)(`button`,{type:`button`,className:h.trigger,onClick:m,children:`Ignite`}),u&&(0,l.jsx)(`p`,{className:h.hint,children:r})]})},_=(e,t,n)=>Math.min(n,Math.max(t,e)),v=e=>{let t=()=>e(document.hidden);return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},y=()=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,b=e=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return e(!1),()=>void 0;let t=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=()=>e(t.matches);return n(),typeof t.addEventListener==`function`?(t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)):(t.addListener(n),()=>t.removeListener(n))},x=(e,t,n)=>{let r=()=>{if(e instanceof HTMLElement){t({width:e.clientWidth,height:e.clientHeight});return}let n=e.getBoundingClientRect();t({width:Math.round(n.width),height:Math.round(n.height)})};if(r(),typeof ResizeObserver>`u`)return typeof window>`u`?()=>void 0:(window.addEventListener(`resize`,r),()=>window.removeEventListener(`resize`,r));let i=new ResizeObserver(e=>{let n=e[0];n&&t({width:Math.round(n.contentRect.width),height:Math.round(n.contentRect.height)})});return i.observe(e,n),()=>i.disconnect()},S=(e,t)=>{let n=e.getBoundingClientRect(),r;return`clientX`in t&&typeof t.clientX==`number`?r=t:`touches`in t&&t.touches&&t.touches.length>0?r=t.touches[0]:`changedTouches`in t&&t.changedTouches&&t.changedTouches.length>0&&(r=t.changedTouches[0]),r?{x:r.clientX-n.left,y:r.clientY-n.top}:null},C=(e,t={})=>{let{enabled:n=!0}=t,[r,i]=(0,c.useState)({width:0,height:0});return(0,c.useEffect)(()=>{if(!n)return;let t=e.current;if(t)return x(t,i)},[n,e]),r},w=({fill:e=!1,width:t,height:n,defaultWidth:r,defaultHeight:i,measured:a})=>{if(e){let e=Math.max(0,a.width),t=Math.max(0,a.height);return e<1||t<1?{width:r,height:i,pending:!0}:{width:e,height:t,pending:!1}}return{width:t??r,height:n??i,pending:!1}},T=({fill:e=!1,width:t,height:n,defaultWidth:r,defaultHeight:i})=>{let a=(0,c.useRef)(null),{width:o,height:s,pending:l}=w({fill:e,width:t,height:n,defaultWidth:r,defaultHeight:i,measured:C(a,{enabled:e})});return{hostRef:a,width:o,height:s,hostStyle:e?{width:`100%`,height:`100%`}:{width:o,height:s},fill:e,pending:l}},E={aurora:`cos-aurora-dJJb8`,band:`cos-band-S5CoR`,"aurora-flow":`cos-aurora-flow-wU8TY`},D=[`#00ff87`,`#60efff`,`#7b2ff7`,`#f107a3`],O=({width:e,height:t,fill:n=!1,colors:r=D})=>{let{hostRef:i,hostStyle:a}=T({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),o=r.length>=2?r:D,[s,u]=(0,c.useState)(()=>typeof document<`u`&&document.hidden);return(0,c.useEffect)(()=>v(u),[]),(0,l.jsx)(`div`,{ref:i,className:E.aurora,style:a,children:o.map((e,t)=>(0,l.jsx)(`div`,{className:E.band,style:{"--aurora-color":e,"--aurora-delay":`${t*-3}s`,"--aurora-duration":`${12+t*2}s`,animationPlayState:s?`paused`:`running`}},e+t))})},k={audioVisualizer:`cos-audioVisualizer-r5dHp`,canvas:`cos-canvas-UNEea`},A=({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=v(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 _=()=>{if(c=requestAnimationFrame(_),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 _(),()=>{h=!0,cancelAnimationFrame(c),g(),p?.getTracks().forEach(e=>e.stop()),u?.close()}},[n,t,r,e]),(0,l.jsx)(`div`,{className:k.audioVisualizer,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:k.canvas,style:{width:e,height:t}})})},j={canvasClock:`cos-canvasClock-QvdV3`,canvasTarget:`cos-canvasTarget-x-odC`},M=({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=v(e=>{s=e}),l=()=>{s||o(i),a=requestAnimationFrame(l)};return l(),()=>{cancelAnimationFrame(a),c()}},[o,r]),(0,l.jsx)(`div`,{className:j.canvasClock,style:{width:r,height:r},children:(0,l.jsx)(`canvas`,{ref:n,className:j.canvasTarget,style:{width:r,height:r}})})},N={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`},P=15,F=258,I=e=>{let{initQuantity:t=0,value:n,onChange:r,onComplete:i,autoCharge:a=!0,interval:o=500,step:s=.01}=e,u=(0,c.useRef)(null),d=n!==void 0,[f,p]=(0,c.useState)(()=>_(t,0,100)),m=_(d?n:f,0,100),h=(0,c.useRef)(m),g=(0,c.useRef)(r),v=(0,c.useRef)(i),y=(0,c.useRef)(m>=100);(0,c.useEffect)(()=>{g.current=r},[r]),(0,c.useEffect)(()=>{v.current=i},[i]),(0,c.useEffect)(()=>{if(h.current=m,m<100){y.current=!1;return}y.current||(y.current=!0,v.current?.())},[m]),(0,c.useEffect)(()=>{let e=u.current;if(!e)return;let t=()=>{let t=Math.max(0,e.clientHeight-F);e.style.setProperty(`--charge-rise-max`,`${t}px`)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,c.useEffect)(()=>{if(!a)return;let e=window.setInterval(()=>{if(h.current>=100)return;let e=Math.min(100,Number((h.current+s).toFixed(2)));g.current?.(e),d||p(e)},o);return()=>clearInterval(e)},[a,o,d,s]);let b=m.toFixed(2);return(0,l.jsxs)(`div`,{ref:u,className:N.chargeContainer,"data-auto":a?`true`:`false`,style:{"--charge-pct":m},children:[(0,l.jsxs)(`div`,{className:N.contrast,children:[Array.from({length:P},(e,t)=>(0,l.jsx)(`span`,{className:N.bubble,"data-index":t+1},t)),(0,l.jsx)(`div`,{className:N.circle}),(0,l.jsx)(`div`,{className:N.button})]}),(0,l.jsxs)(`div`,{className:N.text,children:[b,`%`]})]})},L={circularText:`cos-circularText--zmER`,scaleWrap:`cos-scaleWrap-LiyQK`,bonkers:`cos-bonkers-Wovjy`,ring:`cos-ring-2amY8`,spin:`cos-spin-9njNq`,char:`cos-char-oPqHL`},R=({text:e=`COS DESIGN • REACT BITS • `,spinDuration:t=20,onHover:n=`speedUp`,fontSize:r=22,radius:i=90,color:a=`#f8fafc`})=>{let[o,s]=(0,c.useState)(!1),u=(0,c.useMemo)(()=>Array.from(e),[e]),d=(0,c.useMemo)(()=>{if(!o)return t;switch(n){case`slowDown`:return t*2;case`speedUp`:return t/4;case`pause`:return 0;case`goBonkers`:return Math.max(t/20,.2);default:return t}},[o,n,t]),f=i*2+r*2;return(0,l.jsx)(`div`,{className:L.circularText,children:(0,l.jsx)(`div`,{className:`${L.scaleWrap} ${o&&n===`goBonkers`?L.bonkers:``}`,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:(0,l.jsx)(`div`,{className:L.ring,style:{width:f,height:f,color:a,fontSize:r,animationDuration:d>0?`${d}s`:void 0,animationPlayState:d===0?`paused`:`running`},children:u.map((e,t)=>{let n=360/u.length*t;return(0,l.jsx)(`span`,{className:L.char,style:{transform:`rotate(${n}deg) translateY(-${i}px)`},children:e===` `?`\xA0`:e},`${e}-${t}`)})})})})},z={clickSpark:`cos-clickSpark-db9Om`,canvas:`cos-canvas-p9fnQ`,content:`cos-content-7uE4T`,hint:`cos-hint-UqpWX`},B=({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=v(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:z.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:z.canvas}),e&&(0,l.jsx)(`div`,{className:z.content,children:e}),!e&&(0,l.jsx)(`p`,{className:z.hint,children:`点击任意位置产生火花`})]})},V={confetti:`cos-confetti-MeNtU`,canvas:`cos-canvas-0T3Vs`,canvasPassthrough:`cos-canvasPassthrough-3xF83`,hint:`cos-hint-sGHEi`},H=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`,`#38bdf8`],U=()=>H[Math.floor(Math.random()*H.length)],W=(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:U(),width:Math.random()*8+4,height:Math.random()*6+3,alpha:1,gravity:Math.random()*.15+.12}})},G=(0,c.forwardRef)(({width:e,height:t,fill:n=!1,auto:r=!0,interactive:i,particleCount:a=120,hint:o=`点击画布再次喷射`,onComplete:s},u)=>{let d=i??r,f=(0,c.useRef)(null),{width:p,height:m}=w({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:400,measured:C(f,{enabled:n})}),h=(0,c.useRef)(null),g=(0,c.useRef)([]),_=(0,c.useRef)(0),x=(0,c.useRef)(!1),S=(0,c.useRef)(s),T=(0,c.useRef)({width:p,height:m,particleCount:a});T.current={width:p,height:m,particleCount:a},(0,c.useEffect)(()=>{S.current=s},[s]);let E=(0,c.useCallback)(()=>{let{width:e,height:t,particleCount:n}=T.current,r=y();g.current.push(...W(e,t,r?Math.min(24,n):n)),x.current=!0},[]);return(0,c.useImperativeHandle)(u,()=>({burst:E}),[E]),(0,c.useEffect)(()=>{r&&E()},[r,E]),(0,c.useEffect)(()=>{let e=h.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=p*t,e.height=m*t;let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let r=document.hidden,i=y(),a=v(e=>{r=e}),o=b(e=>{i=e}),s=()=>{if(_.current=requestAnimationFrame(s),r)return;n.clearRect(0,0,p,m);let e=i?.03:.008;g.current=g.current.filter(t=>(t.x+=t.vx,t.y+=t.vy,t.vy+=t.gravity,t.vx*=.99,t.rotation+=t.rotationSpeed,t.alpha-=e,t.alpha<=0||t.y>m+20?!1:(n.save(),n.translate(t.x,t.y),n.rotate(t.rotation*Math.PI/180),n.globalAlpha=t.alpha,n.fillStyle=t.color,n.fillRect(-t.width/2,-t.height/2,t.width,t.height),n.restore(),!0))),x.current&&g.current.length===0&&(x.current=!1,S.current?.())};return s(),()=>{cancelAnimationFrame(_.current),a(),o()}},[m,p]),(0,l.jsxs)(`div`,{ref:f,className:V.confetti,style:n?{width:`100%`,height:`100%`}:{width:p,height:m},children:[(0,l.jsx)(`canvas`,{ref:h,className:`${V.canvas} ${d?``:V.canvasPassthrough}`,style:{width:p,height:m,touchAction:d?`none`:`auto`},onPointerDown:d?E:void 0}),d&&o?(0,l.jsx)(`p`,{className:V.hint,children:o}):null]})});G.displayName=`Confetti`;var K={curvedLoop:`cos-curvedLoop-dtMD7`,svg:`cos-svg-YDyYF`,measure:`cos-measure-1lmnX`,pathText:`cos-pathText-SKIrW`},q=({text:e=`COS DESIGN ✦ CURVED LOOP ✦ `,speed:t=2,curveAmount:n=80,direction:r=`left`,interactive:i=!0,color:a=`#f8fafc`,fontSize:o=56})=>{let s=(0,c.useMemo)(()=>(/\s|\u00A0$/.test(e)?e.replace(/\s+$/,``):e)+`\xA0`,[e]),u=(0,c.useRef)(null),d=(0,c.useRef)(null),[f,p]=(0,c.useState)(0),[m,h]=(0,c.useState)(0),g=`curve-${(0,c.useId)().replace(/:/g,``)}`,_=`M-100,40 Q500,${40+n} 1540,40`,v=(0,c.useRef)(!1),y=(0,c.useRef)(0),b=(0,c.useRef)(r),x=(0,c.useRef)(0),S=f?Array(Math.ceil(1800/f)+2).fill(s).join(``):s,C=f>0;(0,c.useEffect)(()=>{b.current=r},[r]),(0,c.useEffect)(()=>{u.current&&p(u.current.getComputedTextLength())},[s,o]),(0,c.useEffect)(()=>{if(!f||!d.current)return;let e=-f;d.current.setAttribute(`startOffset`,`${e}px`),h(e)},[f]),(0,c.useEffect)(()=>{if(!f||!C)return;let e=0,n=()=>{if(!v.current&&d.current){let e=b.current===`right`?t:-t,n=Number.parseFloat(d.current.getAttribute(`startOffset`)||`0`)+e;n<=-f&&(n+=f),n>0&&(n-=f),d.current.setAttribute(`startOffset`,`${n}px`),h(n)}e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>cancelAnimationFrame(e)},[C,f,t]);let w=e=>{i&&(v.current=!0,y.current=e.clientX,x.current=0,e.target.setPointerCapture(e.pointerId))},T=e=>{if(!i||!v.current||!d.current)return;let t=e.clientX-y.current;y.current=e.clientX,x.current=t;let n=Number.parseFloat(d.current.getAttribute(`startOffset`)||`0`)+t;n<=-f&&(n+=f),n>0&&(n-=f),d.current.setAttribute(`startOffset`,`${n}px`),h(n)},E=()=>{i&&(v.current=!1,b.current=x.current>0?`right`:`left`)};return(0,l.jsx)(`div`,{className:K.curvedLoop,style:{visibility:C?`visible`:`hidden`,cursor:i?`grab`:`default`,"--curve-color":a,"--curve-font-size":`${o}px`},onPointerDown:w,onPointerMove:T,onPointerUp:E,onPointerLeave:E,children:(0,l.jsxs)(`svg`,{className:K.svg,viewBox:`0 0 1440 120`,children:[(0,l.jsx)(`text`,{ref:u,xmlSpace:`preserve`,className:K.measure,children:s}),(0,l.jsx)(`defs`,{children:(0,l.jsx)(`path`,{id:g,d:_,fill:`none`,stroke:`transparent`})}),C&&(0,l.jsx)(`text`,{xmlSpace:`preserve`,className:K.pathText,children:(0,l.jsx)(`textPath`,{ref:d,href:`#${g}`,startOffset:`${m}px`,xmlSpace:`preserve`,children:S})})]})})},ee={cyberGrid:`cos-cyberGrid-VgJwl`,canvas:`cos-canvas--Mq-O`},J=({width:e,height:t,fill:n=!1,color:r=`#00f0ff`,speed:i=1})=>{let{hostRef:a,width:o,height:s,hostStyle:u}=T({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),d=(0,c.useRef)(null),f=(0,c.useRef)(0),p=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let e=d.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=o*t,e.height=s*t;let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let a=s*.45,c=document.hidden,l=y(),u=v(e=>{c=e}),m=b(e=>{l=e}),h=e=>{e&&(p.current=(p.current+i*1.5)%40),n.fillStyle=`#050510`,n.fillRect(0,0,o,s);let t=n.createLinearGradient(0,0,0,a);t.addColorStop(0,`#0a0a20`),t.addColorStop(1,`#050510`),n.fillStyle=t,n.fillRect(0,0,o,a);let c=o/2;n.strokeStyle=r,n.shadowColor=r,n.shadowBlur=8,n.lineWidth=1;for(let e=-12;e<=12;e++){let t=e/12*o*1.2;n.beginPath(),n.moveTo(c+t*.05,a),n.lineTo(c+t,s),n.globalAlpha=.3+(1-Math.abs(e)/12)*.5,n.stroke()}n.globalAlpha=1;let l=Math.ceil(s/40)+2;for(let e=0;e<l;e++){let t=a+(e*40+p.current)/(s-a)*(s-a)%(s-a),r=(t-a)/(s-a)*.8;n.beginPath(),n.moveTo(0,t),n.lineTo(o,t),n.globalAlpha=r,n.stroke()}n.shadowBlur=0,n.globalAlpha=1;let u=n.createRadialGradient(c,a,0,c,a,o*.4);u.addColorStop(0,`${r}33`),u.addColorStop(1,`transparent`),n.fillStyle=u,n.fillRect(0,0,o,s)};if(l)return h(!1),()=>{u(),m()};let g=()=>{f.current=requestAnimationFrame(g),!c&&(l||h(!0))};return g(),()=>{cancelAnimationFrame(f.current),u(),m()}},[r,s,i,o]),(0,l.jsx)(`div`,{ref:a,className:ee.cyberGrid,style:u,children:(0,l.jsx)(`canvas`,{ref:d,className:ee.canvas,style:{width:o,height:s}})})},te={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(),Y=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}},X={days:`天`,hours:`时`,minutes:`分`,seconds:`秒`},re=[{key:`days`},{key:`hours`},{key:`minutes`},{key:`seconds`}],ie=({targetDate:e,onEnd:t,showLabels:n=!0,color:r=`#f472b6`,labels:i,invalidText:a=`无效的目标时间`,endedText:o=`时间到!`})=>{let s=(0,c.useMemo)(()=>ne(e),[e]),u=!Number.isNaN(s),[,d]=(0,c.useState)(0),f=(0,c.useRef)(!1),p=(0,c.useRef)(t),m=u?Y(s):{days:0,hours:0,minutes:0,seconds:0,total:0};return(0,c.useEffect)(()=>{p.current=t},[t]),(0,c.useEffect)(()=>{if(!u)return;if(f.current=!1,Date.now()>=s){f.current=!0,p.current?.();return}let e=window.setInterval(()=>{d(e=>e+1),Date.now()>=s&&!f.current&&(f.current=!0,p.current?.(),clearInterval(e))},1e3);return()=>clearInterval(e)},[u,s]),u?(0,l.jsxs)(`div`,{className:te.countdown,style:{"--countdown-color":r},children:[re.map(({key:e})=>(0,l.jsxs)(`div`,{className:te.unit,children:[(0,l.jsx)(`div`,{className:te.value,children:String(m[e]).padStart(2,`0`)}),n&&(0,l.jsx)(`span`,{className:te.label,children:i?.[e]??X[e]})]},e)),m.total<=0&&(0,l.jsx)(`p`,{className:te.ended,children:o})]}):(0,l.jsx)(`div`,{className:te.countdown,children:(0,l.jsx)(`p`,{className:te.invalid,children:a})})},ae={countUp:`cos-countUp-PKMgo`,glow:`cos-glow-oAz5z`,value:`cos-value-WDAyV`,valueWrap:`cos-valueWrap-AQoM4`,measure:`cos-measure-ZGRt4`,display:`cos-display-JHXA2`},oe=e=>1-(1-e)**3,se=(e,t)=>e.toLocaleString(`en-US`,{minimumFractionDigits:t,maximumFractionDigits:t}),ce=({value:e,start:t=0,duration:n=1400,decimals:r=0,prefix:i=``,suffix:a=``,color:o=`#34d399`})=>{let[s,u]=(0,c.useState)(t),d=(0,c.useRef)(0),f=(0,c.useRef)(t);(0,c.useEffect)(()=>{let t=f.current,r=e,i=performance.now();cancelAnimationFrame(d.current);let a=e=>{let o=Math.min(1,(e-i)/Math.max(n,16)),s=oe(o);u(t+(r-t)*s),o<1?d.current=requestAnimationFrame(a):f.current=r};return d.current=requestAnimationFrame(a),()=>cancelAnimationFrame(d.current)},[n,e]);let p=(0,c.useMemo)(()=>`${i}${se(s,r)}${a}`,[r,s,i,a]),m=(0,c.useMemo)(()=>{let n=[t,e].map(e=>`${i}${se(e,r)}${a}`);return n.reduce((e,t)=>t.length>e.length?t:e,n[0])},[r,i,t,a,e]);return(0,l.jsxs)(`div`,{className:ae.countUp,style:{"--count-up-color":o},children:[(0,l.jsx)(`div`,{className:ae.glow}),(0,l.jsxs)(`div`,{className:ae.valueWrap,children:[(0,l.jsx)(`span`,{className:`${ae.value} ${ae.measure}`,children:m}),(0,l.jsx)(`span`,{className:`${ae.value} ${ae.display}`,children:p})]})]})},le={dnaHelix:`cos-dnaHelix-nEQLW`,canvas:`cos-canvas-uEV8B`},ue=({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=v(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:le.dnaHelix,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:le.canvas,style:{width:e,height:t}})})},de={electricArc:`cos-electricArc-BFlY3`,canvas:`cos-canvas-iowDx`},fe=(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=fe(e,t,o+f,s+p,i*.6,a-1),h=fe(o+f,s+p,n,r,i*.6,a-1);return[...m.slice(0,-1),...h]},pe=({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=v(e=>{d=e}),p=()=>{if(u=requestAnimationFrame(p),d)return;o.fillStyle=`#0f172a`,o.fillRect(0,0,e,t);let r=fe(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:de.electricArc,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:de.canvas,style:{width:e,height:t}})})},me={cursorTrail:`cos-cursorTrail-fpz5p`,canvas:`cos-canvas-Iuyp3`,hint:`cos-hint-9GLHx`},he=({color:e=`#38bdf8`,length:t=20,width:n=800,height:r=400,hint:i=`移动鼠标查看粒子轨迹`})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)([]),s=(0,c.useRef)({x:n/2,y:r/2}),u=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let i=a.current;if(!i)return;let c=window.devicePixelRatio||1;i.width=n*c,i.height=r*c;let l=i.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let d=document.hidden,f=v(e=>{d=e}),p=()=>{if(u.current=requestAnimationFrame(p),d)return;let{x:i,y:a}=s.current;o.current.unshift({x:i,y:a,life:1}),o.current.length>t&&(o.current.length=t),l.fillStyle=`rgb(15 23 42 / 15%)`,l.fillRect(0,0,n,r);let c=o.current;for(let t=0;t<c.length;t++){let n=c[t],r=1-t/c.length,i=(1-t/c.length)*8+2;l.beginPath(),l.arc(n.x,n.y,i,0,Math.PI*2),l.fillStyle=e,l.globalAlpha=r*.8,l.fill()}l.globalAlpha=1};return p(),()=>{cancelAnimationFrame(u.current),f()}},[e,r,t,n]),(0,l.jsxs)(`div`,{className:me.cursorTrail,style:{width:n,height:r},children:[(0,l.jsx)(`canvas`,{ref:a,className:me.canvas,style:{width:n,height:r},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect();s.current={x:e.clientX-t.left,y:e.clientY-t.top}}}),(0,l.jsx)(`p`,{className:me.hint,children:i})]})},ge={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`},_e={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}},ve=({onRoll:e,sides:t=6,rollText:n=`掷骰子`,rollingText:r=`掷骰中...`,resultPrefix:i=`点数:`})=>{let[a,o]=(0,c.useState)(!1),[s,u]=(0,c.useState)(1),[d,f]=(0,c.useState)({x:0,y:0,z:0}),p=(0,c.useRef)(e),m=(0,c.useRef)(0);(0,c.useEffect)(()=>{p.current=e},[e]),(0,c.useEffect)(()=>()=>clearTimeout(m.current),[]);let h=()=>{if(a)return;o(!0);let e=Math.floor(Math.random()*t)+1,n=_e[e]??_e[1],r=360*(3+Math.floor(Math.random()*3)),i=360*(3+Math.floor(Math.random()*3));f({x:n.x+r,y:n.y+i,z:Math.random()*360}),clearTimeout(m.current),m.current=window.setTimeout(()=>{u(e),o(!1),p.current?.(e)},1200)},g=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:ge.dot,style:{left:`${e}%`,top:`${t}%`}},n));return(0,l.jsxs)(`div`,{className:ge.diceRoll,children:[(0,l.jsx)(`div`,{className:ge.scene,children:(0,l.jsx)(`div`,{className:`${ge.cube} ${a?ge.rolling:``}`,style:{transform:`rotateX(${d.x}deg) rotateY(${d.y}deg) rotateZ(${d.z}deg)`},children:[1,2,3,4,5,6].map(e=>(0,l.jsx)(`div`,{className:`${ge.face} ${ge[`face${e}`]}`,children:g(e)},e))})}),(0,l.jsx)(`button`,{type:`button`,className:ge.rollBtn,onClick:h,disabled:a,children:a?r:n}),!a&&(0,l.jsxs)(`p`,{className:ge.result,children:[i,` `,s]})]})},ye={doublePendulum:`cos-doublePendulum-FUEeK`,canvas:`cos-canvas-OVkhW`},be=({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,_=0,y=document.hidden,b=v(e=>{y=e}),x=()=>{if(_=requestAnimationFrame(x),y)return;let a=o.current,{theta1:c,theta2:l,omega1:v,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+v*v*p*w))/E,O=2*C*(v*v*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(_),b()}},[r,i,t,n,e]),(0,l.jsx)(`div`,{className:ye.doublePendulum,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:ye.canvas,style:{width:e,height:t}})})},xe={fireworks:`cos-fireworks-fsSqL`,canvas:`cos-canvas-spL8G`,canvasPassthrough:`cos-canvasPassthrough-jCNke`,hint:`cos-hint-5XDRH`},Se=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`],Ce=.12,we=240,Te=()=>Se[Math.floor(Math.random()*Se.length)],Ee=(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:Te(),decay:Math.random()*.015+.01}})},De=(0,c.forwardRef)((e,t)=>{let{width:n,height:r,fill:i=!1,auto:a=!0,interactive:o,hint:s=`点击画布燃放烟花`,onComplete:u}=e,d=o??a,f=(0,c.useRef)(null),{width:p,height:m}=w({fill:i,width:n,height:r,defaultWidth:800,defaultHeight:500,measured:C(f,{enabled:i})}),h=(0,c.useRef)(null),g=(0,c.useRef)([]),_=(0,c.useRef)(0),x=(0,c.useRef)(!1),T=(0,c.useRef)(u);(0,c.useEffect)(()=>{T.current=u},[u]);let E=(0,c.useCallback)(e=>{let t=e??Math.random()*p*.6+p*.2;g.current.push({x:t,y:m,vy:-(Math.random()*4+6),targetY:Math.random()*m*.35+m*.15,color:Te(),exploded:!1,particles:[],age:0}),x.current=!0},[m,p]);return(0,c.useImperativeHandle)(t,()=>({launch:E}),[E]),(0,c.useEffect)(()=>{let e=h.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=p*t,e.height=m*t;let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let r=0,i=document.hidden,o=y(),s=v(e=>{i=e}),c=b(e=>{o=e}),l=()=>{if(_.current=requestAnimationFrame(l),!i){if(n.fillStyle=`rgb(15 23 42 / 25%)`,n.fillRect(0,0,p,m),o){x.current&&g.current.length===0&&(x.current=!1,T.current?.());return}g.current=g.current.filter(e=>{if(!e.exploded){e.age+=1,e.y+=e.vy,e.vy+=Ce,n.beginPath(),n.arc(e.x,e.y,2.5,0,Math.PI*2),n.fillStyle=e.color,n.fill();let t=e.vy>=0,r=e.y<=e.targetY,i=e.y<0,a=e.age>=we;return(t||r||i||a)&&(e.exploded=!0,e.particles=Ee(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:(n.beginPath(),n.arc(e.x,e.y,2,0,Math.PI*2),n.fillStyle=e.color,n.globalAlpha=e.alpha,n.fill(),n.globalAlpha=1,!0))),e.particles.length>0}),x.current&&g.current.length===0&&(x.current=!1,T.current?.())}};return l(),a&&!o?r=window.setInterval(()=>E(),1200):a&&o&&E(),()=>{cancelAnimationFrame(_.current),clearInterval(r),s(),c()}},[a,m,E,p]),(0,l.jsxs)(`div`,{ref:f,className:xe.fireworks,style:i?{width:`100%`,height:`100%`}:{width:p,height:m},children:[(0,l.jsx)(`canvas`,{ref:h,className:`${xe.canvas} ${d?``:xe.canvasPassthrough}`,style:{width:p,height:m,touchAction:d?`none`:`auto`},onPointerDown:d?e=>{let t=S(e.currentTarget,e.nativeEvent);t&&E(t.x)}:void 0}),d&&s?(0,l.jsx)(`p`,{className:xe.hint,children:s}):null]})});De.displayName=`Fireworks`;var Oe={flipCard:`cos-flipCard-9GNUU`,inner:`cos-inner-fETXF`,flipped:`cos-flipped-DjOGt`,face:`cos-face-jfAlI`,front:`cos-front-K4swo`,back:`cos-back-yrnnD`,kicker:`cos-kicker-H-OGk`,title:`cos-title-XTDn7`,subtitle:`cos-subtitle-2YmXW`},ke=(0,c.forwardRef)(({frontTitle:e=`签到翻牌`,frontSubtitle:t=`点击翻开今日奖励`,backTitle:n=`恭喜获得`,backSubtitle:r=`积分 +20`,flipped:i,defaultFlipped:a=!1,onReveal:o,onFlipChange:s,disabled:u=!1},d)=>{let[f,p]=(0,c.useState)(a),m=typeof i==`boolean`,h=m?!!i:f,g=(e,t)=>{m||p(e),s?.(e),e&&t&&o?.()};return(0,c.useImperativeHandle)(d,()=>({flip:()=>{u||h||g(!0,!0)},reset:()=>g(!1,!1)}),[u,h,m,s,o]),(0,l.jsx)(`button`,{type:`button`,className:`${Oe.flipCard} ${h?Oe.flipped:``}`,onClick:()=>{u||h||g(!0,!0)},disabled:u,"aria-pressed":h,children:(0,l.jsxs)(`span`,{className:Oe.inner,children:[(0,l.jsxs)(`span`,{className:`${Oe.face} ${Oe.front}`,children:[(0,l.jsx)(`span`,{className:Oe.kicker,children:`CHECK-IN`}),(0,l.jsx)(`span`,{className:Oe.title,children:e}),(0,l.jsx)(`span`,{className:Oe.subtitle,children:t})]}),(0,l.jsxs)(`span`,{className:`${Oe.face} ${Oe.back}`,children:[(0,l.jsx)(`span`,{className:Oe.kicker,children:`REWARD`}),(0,l.jsx)(`span`,{className:Oe.title,children:n}),(0,l.jsx)(`span`,{className:Oe.subtitle,children:r})]})]})})});ke.displayName=`FlipCard`;var Ae={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`},je=(e,t)=>Math.max(0,Math.floor(e)).toString().padStart(t,`0`).slice(-t),Me=({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:Ae.digit,style:{"--flip-color":t,"--flip-duration":`${n}ms`},children:(0,l.jsxs)(`div`,{className:`${Ae.digitCard} ${i?Ae.isFlipping:``}`,children:[(0,l.jsx)(`div`,{className:Ae.staticTop,children:(0,l.jsx)(`span`,{children:u})}),(0,l.jsx)(`div`,{className:Ae.staticBottom,children:(0,l.jsx)(`span`,{children:u})}),i&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`${Ae.flap} ${Ae.flapTop}`,children:(0,l.jsx)(`span`,{children:o})}),(0,l.jsx)(`div`,{className:`${Ae.flap} ${Ae.flapBottom}`,children:(0,l.jsx)(`span`,{children:e})})]})]})})},Ne=({value:e,digits:t=4,color:n=`#38bdf8`,duration:r=600})=>{let i=je(e,t).split(``);return(0,l.jsx)(`div`,{className:Ae.flipCounter,children:i.map((e,t)=>(0,l.jsx)(Me,{digit:e,color:n,duration:r},t))})},Pe={fuzzyText:`cos-fuzzyText-AgND-`,canvas:`cos-canvas-CiG0H`},Fe=({text:e=`FUZZY`,fontSize:t=72,fontWeight:n=900,color:r=`#f8fafc`,baseIntensity:i=.18,hoverIntensity:a=.5,enableHover:o=!0,fuzzRange:s=30})=>{let u=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let c=0,l=!1,d=u.current;return d?((async()=>{let u=d.getContext(`2d`);if(!u)return;let f=window.getComputedStyle(d).fontFamily||`sans-serif`,p=`${n} ${`${t}px`} ${f}`;try{await document.fonts.load(p)}catch{await document.fonts.ready}if(l)return;let m=document.createElement(`canvas`),h=m.getContext(`2d`);if(!h)return;h.font=p,h.textBaseline=`alphabetic`;let g=h.measureText(e),_=g.actualBoundingBoxLeft??0,v=g.actualBoundingBoxRight??g.width,y=g.actualBoundingBoxAscent??t,b=g.actualBoundingBoxDescent??t*.2,x=Math.ceil(_+v),S=Math.ceil(y+b),C=x+10;m.width=C,m.height=S,h.font=p,h.textBaseline=`alphabetic`,h.fillStyle=r,h.fillText(e,10/2-_,y);let w=s+20;d.width=C+w*2,d.height=S,u.setTransform(1,0,0,1,0,0),u.translate(w,0);let T=w+10/2,E=T+x,D=S,O=!1,k=()=>{if(l)return;let e=O?a:i;u.clearRect(-s-20,-10,C+2*(s+20),S+20);for(let t=0;t<S;t++){let n=Math.floor(e*(Math.random()-.5)*s);u.drawImage(m,0,t,C,1,n,t,C,1)}c=window.requestAnimationFrame(k)};c=window.requestAnimationFrame(k);let A=(e,t)=>e>=T&&e<=E&&t>=0&&t<=D,j=e=>{if(!o)return;let t=d.getBoundingClientRect();O=A(e.clientX-t.left,e.clientY-t.top)},M=()=>{O=!1};o&&(d.addEventListener(`mousemove`,j),d.addEventListener(`mouseleave`,M)),d.cleanupFuzzyText=()=>{window.cancelAnimationFrame(c),o&&(d.removeEventListener(`mousemove`,j),d.removeEventListener(`mouseleave`,M))}})(),()=>{l=!0,window.cancelAnimationFrame(c),d.cleanupFuzzyText?.()}):void 0},[i,r,o,t,n,s,a,e]),(0,l.jsx)(`div`,{className:Pe.fuzzyText,children:(0,l.jsx)(`canvas`,{ref:u,className:Pe.canvas})})},Ie={gradientFlow:`cos-gradientFlow-XhN16`,text:`cos-text-ORuqk`,flow:`cos-flow-9FzMA`},Le=[`#ff00de`,`#7c3aed`,`#00f0ff`,`#38bdf8`,`#ff00de`],Re=({text:e=`GRADIENT`,colors:t=Le,fontSize:n=64})=>{let r=t.length>=2?t.join(`, `):Le.join(`, `);return(0,l.jsx)(`div`,{className:Ie.gradientFlow,children:(0,l.jsx)(`h1`,{className:Ie.text,style:{fontSize:n,backgroundImage:`linear-gradient(90deg, ${r})`},children:e})})},ze={gameOfLife:`cos-gameOfLife-1i2nu`,canvas:`cos-canvas-urOjh`,toolbar:`cos-toolbar-GmcD1`,meta:`cos-meta-KLxCp`,actions:`cos-actions-l3sAu`,button:`cos-button-g0tCm`},Be=(e,t,n)=>Math.min(n,Math.max(t,e)),Ve=(e,t,n)=>Array.from({length:e},()=>Array.from({length:t},()=>+(Math.random()<n))),He=e=>{let t=e.length,n=e[0]?.length||0,r=Array.from({length:t},()=>Array(n).fill(0));for(let i=0;i<t;i++)for(let a=0;a<n;a++){let o=0;for(let r=-1;r<=1;r++)for(let s=-1;s<=1;s++){if(s===0&&r===0)continue;let c=i+r,l=a+s;c<0||c>=t||l<0||l>=n||(o+=e[c][l])}e[i][a]?r[i][a]=+(o===2||o===3):o===3&&(r[i][a]=1)}return r},Ue=({width:e=560,height:t=420,cellSize:n=14,speed:r=120,density:i=.28,aliveColor:a=`#a3e635`,gridColor:o=`rgb(148 163 184 / 14%)`,labels:s})=>{let u=(0,c.useRef)(null),d=Math.max(6,Math.floor(t/n)),f=Math.max(6,Math.floor(e/n)),p=Be(i,.05,.7),[m,h]=(0,c.useState)(!0),[g,_]=(0,c.useState)(0),y=(0,c.useRef)(document.hidden),[b,x]=(0,c.useState)(()=>Ve(d,f,p)),[S,C]=(0,c.useState)({rows:d,cols:f,density:p});(S.rows!==d||S.cols!==f||S.density!==p)&&(C({rows:d,cols:f,density:p}),x(Ve(d,f,p)),_(0)),(0,c.useEffect)(()=>{let r=u.current;if(!r)return;let i=window.devicePixelRatio||1;r.width=e*i,r.height=t*i;let s=r.getContext(`2d`);if(!s)return;s.setTransform(i,0,0,i,0,0);let c=0,l=v(e=>{y.current=e}),p=()=>{s.fillStyle=`#020617`,s.fillRect(0,0,e,t);for(let e=0;e<d;e++)for(let t=0;t<f;t++){if(!b[e][t])continue;let r=t*n,i=e*n;s.fillStyle=a,s.fillRect(r+1,i+1,n-2,n-2);let o=s.createRadialGradient(r+n/2,i+n/2,0,r+n/2,i+n/2,n*.8);o.addColorStop(0,`rgb(255 255 255 / 28%)`),o.addColorStop(1,`transparent`),s.fillStyle=o,s.fillRect(r,i,n,n)}s.strokeStyle=o,s.lineWidth=1;for(let e=0;e<=f;e++)s.beginPath(),s.moveTo(e*n+.5,0),s.lineTo(e*n+.5,t),s.stroke();for(let t=0;t<=d;t++)s.beginPath(),s.moveTo(0,t*n+.5),s.lineTo(e,t*n+.5),s.stroke()},m=()=>{c=requestAnimationFrame(m),p()};return c=requestAnimationFrame(m),()=>{cancelAnimationFrame(c),l()}},[a,n,f,b,o,t,d,e]),(0,c.useEffect)(()=>{if(!m)return;let e=window.setInterval(()=>{y.current||(x(e=>He(e)),_(e=>e+1))},r);return()=>clearInterval(e)},[m,r]);let w=(0,c.useMemo)(()=>b.reduce((e,t)=>e+t.reduce((e,t)=>e+t,0),0),[b]),T=()=>{x(Ve(d,f,p)),_(0)},E=(e,t,r)=>{let i=Math.floor((e-r.left)/n),a=Math.floor((t-r.top)/n);a<0||a>=d||i<0||i>=f||(x(e=>e.map((e,t)=>t===a?e.map((e,t)=>t===i?+!e:e):e)),_(e=>e+1))};return(0,l.jsxs)(`div`,{className:ze.gameOfLife,style:{width:e},children:[(0,l.jsx)(`canvas`,{ref:u,className:ze.canvas,style:{width:e,height:t},onClick:e=>E(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())}),(0,l.jsxs)(`div`,{className:ze.toolbar,children:[(0,l.jsxs)(`div`,{className:ze.meta,children:[(0,l.jsxs)(`span`,{children:[s?.generation??`Generation`,` `,g]}),(0,l.jsxs)(`span`,{children:[w,` `,s?.alive??`alive`]})]}),(0,l.jsxs)(`div`,{className:ze.actions,children:[(0,l.jsx)(`button`,{type:`button`,className:ze.button,onClick:()=>h(e=>!e),children:m?s?.pause??`Pause`:s?.play??`Play`}),(0,l.jsx)(`button`,{type:`button`,className:ze.button,onClick:T,children:s?.randomize??`Randomize`})]})]})]})},We={glitchText:`cos-glitchText-dZ-sR`,text:`cos-text-JsPHN`,"glitch-1":`cos-glitch-1-s9pqH`,"glitch-2":`cos-glitch-2-GhFB-`},Ge=({text:e=`GLITCH`,color:t=`#f8fafc`,glitchColor1:n=`#ff00de`,glitchColor2:r=`#00f0ff`,fontSize:i=64})=>(0,l.jsx)(`div`,{className:We.glitchText,children:(0,l.jsx)(`h1`,{className:We.text,"data-text":e,style:{fontSize:i,"--glitch-color":t,"--glitch-c1":n,"--glitch-c2":r},children:e})}),Ke={gravityBalls:`cos-gravityBalls-LdwFo`,canvas:`cos-canvas-n7esd`},qe=[`#38bdf8`,`#a78bfa`,`#f472b6`,`#4ade80`,`#fbbf24`],Je=({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:qe[Math.floor(Math.random()*qe.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=v(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:Ke.gravityBalls,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:Ke.canvas,style:{width:e,height:t}})})},Ye={wrap:`cos-wrap-r1gGL`,card:`cos-card-3W10s`,shine:`cos-shine-0xjID`,image:`cos-image-AV2XG`,placeholder:`cos-placeholder-wuuL3`,info:`cos-info-CNR0r`},Xe=({title:e=`全息卡片`,subtitle:t=`移动鼠标体验 3D 效果`,image:n})=>{let r=(0,c.useRef)(null);return(0,l.jsx)(`div`,{className:Ye.wrap,children:(0,l.jsxs)(`div`,{ref:r,className:Ye.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:Ye.shine}),n?(0,l.jsx)(`img`,{src:n,alt:e,className:Ye.image}):(0,l.jsx)(`div`,{className:Ye.placeholder,children:(0,l.jsx)(`span`,{children:`✦`})}),(0,l.jsxs)(`div`,{className:Ye.info,children:[(0,l.jsx)(`h3`,{children:e}),(0,l.jsx)(`p`,{children:t})]})]})})},Ze={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`},Qe=({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=_(t>0?e/t*100:0,0,100),s=100-o;return(0,c.useEffect)(()=>{let e=0,t=0,n=document.hidden,r=v(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:Ze.liquidProgress,style:{width:n,height:n,"--liquid-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 100 100`,className:Ze.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:Ze.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:Ze.fillBg}),(0,l.jsx)(`path`,{ref:i,className:Ze.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:Ze.ring,strokeWidth:10,fill:`none`})]}),(0,l.jsxs)(`span`,{className:Ze.label,children:[Math.round(o),`%`]})]})},$e={lorenzAttractor:`cos-lorenzAttractor--UAI7`,canvas:`cos-canvas-oeXce`},et=({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),_()}},[r,t,i,n,e]),(0,l.jsx)(`div`,{className:$e.lorenzAttractor,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:$e.canvas,style:{width:e,height:t}})})},tt={liquidGlass:`cos-liquidGlass-Z3bQg`,panel:`cos-panel-XYboD`,content:`cos-content-MHfkS`},nt=({children:e=`液态玻璃面板`,blur:t=16,borderRadius:n=20})=>(0,l.jsx)(`div`,{className:tt.liquidGlass,children:(0,l.jsx)(`div`,{className:tt.panel,style:{"--glass-blur":`${t}px`,"--glass-radius":`${n}px`},children:(0,l.jsx)(`div`,{className:tt.content,children:e})})}),rt={magneticButton:`cos-magneticButton-GbRkE`,btn:`cos-btn--b2BJ`},it=({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:rt.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:rt.btn,style:{"--btn-color":n},children:e})})},at={matrixRain:`cos-matrixRain-qg9HC`,canvas:`cos-canvas--AvpG`,overlay:`cos-overlay-knj3b`,title:`cos-title-sDfhs`,flicker:`cos-flicker-smHxl`,subtitle:`cos-subtitle-CWheW`},ot=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ`,st=({width:e,height:t,fill:n=!1,density:r=.6,color:i=`#00ff41`,showOverlay:a=!0,title:o=`MATRIX`,subtitle:s=`数字雨效果`})=>{let u=(0,c.useRef)(null),{width:d,height:f}=w({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500,measured:C(u,{enabled:n})}),p=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let e=p.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=d*t,e.height=f*t;let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let a=Math.floor(d/16*r),o=Array.from({length:a},()=>Math.random()*-50),s=0,c=document.hidden,l=y(),u=v(e=>{c=e}),m=b(e=>{l=e}),h=e=>{e?(n.fillStyle=`rgb(0 0 0 / 8%)`,n.fillRect(0,0,d,f)):(n.fillStyle=`#000`,n.fillRect(0,0,d,f)),n.font=`16px monospace`,o.forEach((t,a)=>{let s=ot[Math.floor(Math.random()*53)],c=a/r*16;n.fillStyle=i,n.fillText(s,c,t*16),e&&(t*16>f&&Math.random()>.975&&(o[a]=0),o[a]+=1)})};if(l){for(let e=0;e<o.length;e++)o[e]=f/16*Math.random();return h(!1),()=>{u(),m()}}let g=()=>{s=requestAnimationFrame(g),!c&&(l||h(!0))};return g(),()=>{cancelAnimationFrame(s),u(),m()}},[i,r,f,d]),(0,l.jsxs)(`div`,{ref:u,className:at.matrixRain,style:n?{width:`100%`,height:`100%`}:{width:d,height:f},children:[(0,l.jsx)(`canvas`,{ref:p,className:at.canvas,style:{width:d,height:f}}),a&&(0,l.jsxs)(`div`,{className:at.overlay,children:[(0,l.jsx)(`h2`,{className:at.title,children:o}),(0,l.jsx)(`p`,{className:at.subtitle,children:s})]})]})},ct={metaballPool:`cos-metaballPool-JJaI9`,canvas:`cos-canvas-S7fDD`},lt=({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=v(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+_((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:ct.metaballPool,style:{width:e,height:t,"--pool-color":r},children:(0,l.jsx)(`canvas`,{ref:i,className:ct.canvas,style:{width:e,height:t}})})},ut={mazeGenerator:`cos-mazeGenerator-QEa0s`,canvas:`cos-canvas-emhxb`},dt=({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,_=document.hidden,y=v(e=>{_=e}),b=()=>{if(_){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:ut.mazeGenerator,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:ut.canvas,style:{width:e,height:t}})})},ft={meteorRain:`cos-meteorRain-v8RNI`,canvas:`cos-canvas-hyFMr`},pt=({width:e,height:t,fill:n=!1,meteorCount:r=8})=>{let{hostRef:i,width:a,height:o,hostStyle:s}=T({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),u=(0,c.useRef)(null),d=(0,c.useRef)([]),f=(0,c.useRef)(0);return(0,c.useEffect)(()=>{d.current=Array.from({length:r},()=>({x:Math.random()*a,y:Math.random()*o*.5,length:Math.random()*60+40,speed:Math.random()*6+4,opacity:Math.random()*.5+.3}))},[o,r,a]),(0,c.useEffect)(()=>{let e=u.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=a*t,e.height=o*t;let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let r=document.hidden,i=y(),s=v(e=>{r=e}),c=b(e=>{i=e}),l=e=>{e?(n.fillStyle=`rgb(15 23 42 / 15%)`,n.fillRect(0,0,a,o)):(n.fillStyle=`#0f172a`,n.fillRect(0,0,a,o)),d.current.forEach(t=>{e&&(t.x+=t.speed,t.y+=t.speed*.6,(t.x>a+t.length||t.y>o+t.length)&&(t.x=-t.length,t.y=Math.random()*o*.4,t.length=Math.random()*60+40,t.speed=Math.random()*6+4,t.opacity=Math.random()*.5+.3));let r=t.x-t.length,i=t.y-t.length*.6;n.beginPath(),n.strokeStyle=`rgb(255 255 255 / ${t.opacity})`,n.lineWidth=2,n.moveTo(t.x,t.y),n.lineTo(r,i),n.stroke(),n.beginPath(),n.fillStyle=`rgb(255 255 255 / ${Math.min(1,t.opacity+.2)})`,n.arc(t.x,t.y,1.5,0,Math.PI*2),n.fill()})};if(i)return l(!1),()=>{s(),c()};let p=()=>{f.current=requestAnimationFrame(p),!r&&(i||l(!0))};return p(),()=>{cancelAnimationFrame(f.current),s(),c()}},[o,a]),(0,l.jsx)(`div`,{ref:i,className:ft.meteorRain,style:s,children:(0,l.jsx)(`canvas`,{ref:u,className:ft.canvas,style:{width:a,height:o}})})},mt={networkGraph:`cos-networkGraph-4jjqg`,canvas:`cos-canvas-F17fx`,cursorDefault:`cos-cursorDefault-pUq31`,cursorGrab:`cos-cursorGrab-clAFY`,cursorGrabbing:`cos-cursorGrabbing-Bzm-F`,hint:`cos-hint-19aNc`},ht=[{id:`react`,label:`React`,color:`#61dafb`},{id:`vue`,label:`Vue`,color:`#42b883`},{id:`angular`,label:`Angular`,color:`#dd0031`},{id:`svelte`,label:`Svelte`,color:`#ff3e00`},{id:`ts`,label:`TypeScript`,color:`#3178c6`},{id:`vite`,label:`Vite`,color:`#bd34fe`},{id:`next`,label:`Next.js`,color:`#f8fafc`}],gt=[{source:`react`,target:`ts`},{source:`react`,target:`next`},{source:`react`,target:`vite`},{source:`vue`,target:`ts`},{source:`vue`,target:`vite`},{source:`angular`,target:`ts`},{source:`svelte`,target:`vite`},{source:`ts`,target:`vite`}],_t=6,vt=`ui-sans-serif, system-ui, -apple-system, sans-serif`,yt=(e,t,n)=>{let r=e=>{let t=e.replace(`#`,``),n=t.length===3?t.split(``).map(e=>e+e).join(``):t;return n.length===6?[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16)]:[148,163,184]},[i,a,o]=r(e),[s,c,l]=r(t);return`rgb(${Math.round(i+(s-i)*n)} ${Math.round(a+(c-a)*n)} ${Math.round(o+(l-o)*n)})`},bt=(e,t)=>{if(e.startsWith(`#`)){let n=e.replace(`#`,``),r=n.length===3?n.split(``).map(e=>e+e).join(``):n;if(r.length===6)return`rgb(${parseInt(r.slice(0,2),16)} ${parseInt(r.slice(2,4),16)} ${parseInt(r.slice(4,6),16)} / ${t})`}let n=e.match(/rgba?\(([^)]+)\)/i);if(n){let e=n[1].split(/[,\s/]+/).filter(Boolean).map(Number);if(e.length>=3)return`rgb(${e[0]} ${e[1]} ${e[2]} / ${t})`}return e},xt=({width:e=600,height:t=420,nodes:n=ht,edges:r=gt,linkColor:i=`rgb(148 163 184 / 35%)`,nodeRadius:a=20,hint:o=`拖拽节点 · 悬停查看关联`})=>{let s=(0,c.useRef)(null),u=(0,c.useRef)([]),d=(0,c.useRef)(null),f=(0,c.useRef)(null),[p,m]=(0,c.useState)(`default`),[h,g]=(0,c.useState)(o);(0,c.useEffect)(()=>{d.current||g(o)},[o]);let _=(0,c.useMemo)(()=>{let e=new Map;for(let t of n)e.set(t.id,new Set);for(let t of r)e.get(t.source)?.add(t.target),e.get(t.target)?.add(t.source);return e},[r,n]);(0,c.useEffect)(()=>{if(!n.length){u.current=[];return}let r=new Map(u.current.map(e=>[e.id,e]));u.current=n.map((i,a)=>{let o=r.get(i.id);return o?{...o,label:i.label||i.id,color:i.color||`#38bdf8`}:{id:i.id,label:i.label||i.id,color:i.color||`#38bdf8`,x:e/2+Math.cos(a/n.length*Math.PI*2)*140,y:t/2+Math.sin(a/n.length*Math.PI*2)*120,vx:0,vy:0}})},[t,n,e]),(0,c.useEffect)(()=>{let n=s.current;if(!n)return;let o=Math.min(window.devicePixelRatio||1,2);n.width=e*o,n.height=t*o;let c=n.getContext(`2d`);if(!c)return;c.setTransform(o,0,0,o,0,0);let l=0,p=document.hidden,m=v(e=>{p=e}),h=()=>{let e=new Map;return u.current.forEach(t=>e.set(t.id,t)),e},g=(e,t)=>!t||e===t?!0:_.get(t)?.has(e)??!1,y=()=>{let n=u.current,i=h(),o=.92,s=.003;for(let e=0;e<n.length;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let e=n[r],i=t.x-e.x,a=t.y-e.y,o=i*i+a*a||1,s=2400/o,c=Math.sqrt(o);i/=c,a/=c,t.vx+=i*s,t.vy+=a*s,e.vx-=i*s,e.vy-=a*s}}for(let e of r){let t=i.get(e.source),n=i.get(e.target);if(!t||!n)continue;let r=n.x-t.x,a=n.y-t.y,o=Math.sqrt(r*r+a*a)||1,s=.012*(o-120),c=r/o*s,l=a/o*s;t.vx+=c,t.vy+=l,n.vx-=c,n.vy-=l}for(let r of n)r.vx+=(e/2-r.x)*s,r.vy+=(t/2-r.y)*s,r.vx*=o,r.vy*=o,f.current?.node!==r&&(r.x+=r.vx,r.y+=r.vy,r.x=Math.max(a,Math.min(e-a,r.x)),r.y=Math.max(a,Math.min(t-a,r.y)))},b=()=>{let n=c.createRadialGradient(e*.5,t*.42,20,e*.5,t*.5,Math.max(e,t)*.72);n.addColorStop(0,`#1a2744`),n.addColorStop(.55,`#0f172a`),n.addColorStop(1,`#020617`),c.fillStyle=n,c.fillRect(0,0,e,t),c.fillStyle=`rgb(148 163 184 / 7%)`;for(let n=28;n<e;n+=28)for(let e=28;e<t;e+=28)c.beginPath(),c.arc(n,e,.7,0,Math.PI*2),c.fill();let r=c.createRadialGradient(e/2,t/2,Math.min(e,t)*.25,e/2,t/2,Math.max(e,t)*.7);r.addColorStop(0,`rgb(0 0 0 / 0%)`),r.addColorStop(1,`rgb(2 6 23 / 55%)`),c.fillStyle=r,c.fillRect(0,0,e,t)},x=(e,t,n,r)=>{let o=t.x-e.x,s=t.y-e.y,l=Math.sqrt(o*o+s*s)||1,u=o/l,d=s/l,f=a*.55,p=e.x+u*f,m=e.y+d*f,h=t.x-u*f,g=t.y-d*f,_=(p+h)/2,v=(m+g)/2,y=c.createLinearGradient(p,m,h,g);n?(y.addColorStop(0,bt(e.color,.85)),y.addColorStop(.5,bt(yt(e.color,t.color,.5),.55)),y.addColorStop(1,bt(t.color,.85)),c.lineWidth=2.4,c.shadowColor=bt(yt(e.color,t.color,.5),.45),c.shadowBlur=10):r?(y.addColorStop(0,bt(i,.12)),y.addColorStop(.5,bt(i,.08)),y.addColorStop(1,bt(i,.12)),c.lineWidth=1,c.shadowBlur=0):(y.addColorStop(0,bt(i,.15)),y.addColorStop(.5,i),y.addColorStop(1,bt(i,.15)),c.lineWidth=1.35,c.shadowBlur=0),c.strokeStyle=y,c.lineCap=`round`,c.beginPath(),c.moveTo(p,m),c.quadraticCurveTo(_+d*4,v-u*4,h,g),c.stroke(),c.shadowBlur=0},S=(e,n,r)=>{let i=g(e.id,n),o=n===e.id,s=r&&f.current?.node===e,l=a*(o||s?1.12:i||!n?1:.94),u=!n||i?1:.28;c.save(),c.globalAlpha=u,c.beginPath(),c.arc(e.x,e.y,l+(o||s?10:6),0,Math.PI*2),c.fillStyle=bt(e.color,o||s?.22:.12),c.fill(),c.shadowColor=bt(e.color,o||s?.75:.45),c.shadowBlur=o||s?22:14;let d=c.createRadialGradient(e.x-l*.28,e.y-l*.32,l*.1,e.x,e.y,l);d.addColorStop(0,yt(e.color,`#ffffff`,.55)),d.addColorStop(.55,e.color),d.addColorStop(1,yt(e.color,`#0f172a`,.35)),c.beginPath(),c.arc(e.x,e.y,l,0,Math.PI*2),c.fillStyle=d,c.fill(),c.shadowBlur=0,c.strokeStyle=o||s?`rgb(255 255 255 / 70%)`:`rgb(255 255 255 / 28%)`,c.lineWidth=o||s?1.6:1.1,c.stroke();let p=Math.max(10,Math.min(13,Math.round(a*.58)));c.font=`500 ${p}px ${vt}`,c.textAlign=`center`,c.textBaseline=`middle`;let m=e.label,h=c.measureText(m).width+16,_=p+8,v=e.x-h/2,y=Math.min(t-_-4,e.y+l+8);c.beginPath();let b=_/2;c.moveTo(v+b,y),c.arcTo(v+h,y,v+h,y+_,b),c.arcTo(v+h,y+_,v,y+_,b),c.arcTo(v,y+_,v,y,b),c.arcTo(v,y,v+h,y,b),c.closePath(),c.fillStyle=o||s?`rgb(15 23 42 / 78%)`:`rgb(15 23 42 / 55%)`,c.fill(),c.strokeStyle=`rgb(255 255 255 / 10%)`,c.lineWidth=1,c.stroke(),c.fillStyle=`#f8fafc`,c.fillText(m,e.x,y+_/2),c.restore()},C=()=>{b();let e=h(),t=f.current?.node.id??d.current,n=!!f.current;for(let n of r){let r=e.get(n.source),i=e.get(n.target);if(!r||!i)continue;let a=!!(t&&(n.source===t||n.target===t));x(r,i,a,!!(t&&!a))}let i=[...u.current].sort((e,n)=>(e.id===t?2:+!!g(e.id,t))-(n.id===t?2:+!!g(n.id,t)));for(let e of i)S(e,t,n)},w=()=>{l=requestAnimationFrame(w),!p&&(y(),C())};return l=requestAnimationFrame(w),()=>{cancelAnimationFrame(l),m()}},[_,r,t,i,a,e]);let y=(e,t,n)=>{let r=e-n.left,i=t-n.top,o=a+_t,s=null,c=o*o;for(let e of u.current){let t=(e.x-r)**2+(e.y-i)**2;t<=c&&(c=t,s=e)}return s},b=e=>{d.current=e?.id??null,g(e?e.label:o)},x=e=>{if(e.pointerType===`mouse`&&e.button!==0)return;let t=e.currentTarget.getBoundingClientRect(),n=y(e.clientX,e.clientY,t);if(!n)return;e.currentTarget.setPointerCapture(e.pointerId),e.pointerType===`touch`&&e.preventDefault();let r=e.clientX-t.left,i=e.clientY-t.top;f.current={node:n,offsetX:n.x-r,offsetY:n.y-i,lastX:r,lastY:i,vx:0,vy:0},n.vx=0,n.vy=0,b(n),m(`grabbing`)},S=n=>{let r=n.currentTarget.getBoundingClientRect(),i=n.clientX-r.left,o=n.clientY-r.top;if(f.current){n.pointerType===`touch`&&n.preventDefault();let{node:r,offsetX:s,offsetY:c}=f.current,l=Math.max(a,Math.min(e-a,i+s)),u=Math.max(a,Math.min(t-a,o+c));f.current.vx=l-f.current.lastX,f.current.vy=u-f.current.lastY,f.current.lastX=l,f.current.lastY=u,r.x=l,r.y=u,r.vx=0,r.vy=0,m(`grabbing`);return}let s=y(n.clientX,n.clientY,r);b(s),m(s?`grab`:`default`)},C=e=>{let t=f.current;t&&(t.node.vx=t.vx*.85,t.node.vy=t.vy*.85,f.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId));let n=e.currentTarget.getBoundingClientRect(),r=y(e.clientX,e.clientY,n);b(r),m(r?`grab`:`default`)},w=()=>{f.current||(b(null),m(`default`))},T=p===`grabbing`?mt.cursorGrabbing:p===`grab`?mt.cursorGrab:mt.cursorDefault;return(0,l.jsxs)(`div`,{className:mt.networkGraph,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:s,className:`${mt.canvas} ${T}`,style:{width:e,height:t},onPointerDown:x,onPointerMove:S,onPointerUp:C,onPointerCancel:C,onPointerLeave:w}),(0,l.jsx)(`div`,{className:mt.hint,children:h})]})},St={neonText:`cos-neonText-JMP7i`,text:`cos-text-GTO-0`,flicker:`cos-flicker-nXceV`,"neon-flicker":`cos-neon-flicker-uDkmM`,reflection:`cos-reflection-aEYj6`},Ct=({text:e=`NEON`,color:t=`#ff00de`,fontSize:n=72,flicker:r=!0})=>(0,l.jsxs)(`div`,{className:St.neonText,children:[(0,l.jsx)(`h1`,{className:`${St.text} ${r?St.flicker:``}`,style:{fontSize:n,"--neon-color":t},children:e}),(0,l.jsx)(`p`,{className:St.reflection,style:{fontSize:n*.35,color:t},children:e})]}),wt={newtonCradle:`cos-newtonCradle-mFl-b`,canvas:`cos-canvas-TWKl5`},Tt=({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))},_=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&&_(f[a-1].omega)},b=0,x=document.hidden,S=v(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:wt.newtonCradle,style:{width:n,height:r,"--ball-color":t},children:(0,l.jsx)(`canvas`,{ref:i,className:wt.canvas,style:{width:n,height:r}})})},Et={nineGrid:`cos-nineGrid-hLIVA`,board:`cos-board-En2Pj`,cell:`cos-cell-dfXUm`,icon:`cos-icon-WiUcH`,label:`cos-label-n9ieY`,active:`cos-active-wgm5K`,winner:`cos-winner-44oAG`,button:`cos-button-lKJfV`},Dt=[{icon:`🎁`,label:`谢谢参与`},{icon:`🧧`,label:`红包 1 元`},{icon:`🎫`,label:`优惠券`},{icon:`☕`,label:`咖啡券`},{icon:`💎`,label:`钻石`},{icon:`🎧`,label:`耳机`},{icon:`📦`,label:`神秘礼`},{icon:`⭐`,label:`积分 x10`},{icon:`🏆`,label:`大奖`}],Ot=e=>{let t=[...e?.length?e:Dt];for(;t.length<9;)t.push({label:`奖品 ${t.length+1}`});return t.slice(0,9)},kt=(0,c.forwardRef)(({items:e=Dt,targetIndex:t,buttonText:n=`开始抽奖`,spinningText:r=`抽奖中…`,onDrawEnd:i,disabled:a=!1},o)=>{let s=Ot(e),[u,d]=(0,c.useState)(null),[f,p]=(0,c.useState)(null),[m,h]=(0,c.useState)(!1),g=(0,c.useRef)([]),_=(0,c.useRef)(i),v=(0,c.useRef)(t);(0,c.useEffect)(()=>{_.current=i},[i]),(0,c.useEffect)(()=>{v.current=t},[t]);let y=(0,c.useCallback)(()=>{g.current.forEach(e=>window.clearTimeout(e)),g.current=[]},[]);(0,c.useEffect)(()=>y,[y]);let b=(0,c.useCallback)(()=>{y(),h(!1),d(null),p(null)},[y]),x=(0,c.useCallback)(e=>{if(m||a)return;y(),p(null),h(!0);let t=((typeof e==`number`?e:typeof v.current==`number`?v.current:Math.floor(Math.random()*9))%9+9)%9,n=18+t,r=0,i=()=>{if(d(r%9),r+=1,r>n){d(t),p(t),h(!1),_.current?.(s[t],t);return}let e=60+Math.floor(r*12);g.current.push(window.setTimeout(i,e))};i()},[s,y,a,m]);return(0,c.useImperativeHandle)(o,()=>({draw:x,reset:b}),[x,b]),(0,l.jsxs)(`div`,{className:Et.nineGrid,children:[(0,l.jsx)(`div`,{className:Et.board,role:`grid`,"aria-label":`九宫格抽奖`,children:s.map((e,t)=>{let n=u===t,r=f===t;return(0,l.jsxs)(`div`,{role:`gridcell`,className:`${Et.cell} ${n?Et.active:``} ${r?Et.winner:``}`,children:[e.icon?(0,l.jsx)(`span`,{className:Et.icon,children:e.icon}):null,(0,l.jsx)(`span`,{className:Et.label,children:e.label})]},`${e.label}-${t}`)})}),(0,l.jsx)(`button`,{type:`button`,className:Et.button,"data-testid":`nine-grid-draw`,onClick:()=>x(),disabled:m||a,"aria-busy":m,children:m?r:n})]})});kt.displayName=`NineGrid`;var At={orbitalChart:`cos-orbitalChart-XLORB`,canvas:`cos-canvas-hGVud`,legend:`cos-legend-Np9Mm`,swatch:`cos-swatch-xEKvA`},jt=[{label:`A`,value:30,color:`#38bdf8`},{label:`B`,value:25,color:`#a78bfa`},{label:`C`,value:20,color:`#f472b6`},{label:`D`,value:25,color:`#4ade80`}],Mt=({data:e=jt,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=v(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=_(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:At.orbitalChart,style:{width:t,height:t},children:[(0,l.jsx)(`canvas`,{ref:n,className:At.canvas,style:{width:t,height:t}}),(0,l.jsx)(`ul`,{className:At.legend,children:e.map(e=>(0,l.jsxs)(`li`,{children:[(0,l.jsx)(`span`,{className:At.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`},Pt=({width:e,height:t,fill:n=!1,particleCount:r=60,linkDistance:i=120,repelRadius:a=150,color:o=`#38bdf8`,hint:s=`移动鼠标或手指与粒子互动`})=>{let u=(0,c.useRef)(null),{width:d,height:f}=w({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500,measured:C(u,{enabled:n})}),p=(0,c.useRef)(null),m=(0,c.useRef)([]),h=(0,c.useRef)({x:-1e3,y:-1e3}),g=(0,c.useCallback)(()=>{m.current=Array.from({length:r},()=>({x:Math.random()*d,y:Math.random()*f,vx:(Math.random()-.5)*1.2,vy:(Math.random()-.5)*1.2,radius:Math.random()*2+1}))},[f,r,d]);(0,c.useEffect)(()=>{g()},[g]),(0,c.useEffect)(()=>{let e=p.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=d*t,e.height=f*t;let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let r=0,s=document.hidden,c=y(),l=v(e=>{s=e}),u=b(e=>{c=e}),g=e=>{n.fillStyle=`#0f172a`,n.fillRect(0,0,d,f);let t=m.current,r=h.current,s=a*a;e&&t.forEach(e=>{e.x+=e.vx,e.y+=e.vy,(e.x<0||e.x>d)&&(e.vx*=-1),(e.y<0||e.y>f)&&(e.vy*=-1);let t=r.x-e.x,n=r.y-e.y,i=t*t+n*n;if(i<s&&i>0){let r=Math.sqrt(i);e.vx-=t/r*.15,e.vy-=n/r*.15}});for(let e=0;e<t.length;e++)for(let r=e+1;r<t.length;r++){let a=t[e].x-t[r].x,s=t[e].y-t[r].y,c=a*a+s*s;if(c<i*i){let a=Math.sqrt(c);n.beginPath(),n.moveTo(t[e].x,t[e].y),n.lineTo(t[r].x,t[r].y),n.strokeStyle=o,n.globalAlpha=1-a/i,n.lineWidth=.8,n.stroke(),n.globalAlpha=1}}t.forEach(e=>{n.beginPath(),n.arc(e.x,e.y,e.radius,0,Math.PI*2),n.fillStyle=o,n.fill()})};if(c)return g(!1),()=>{l(),u()};let _=()=>{r=requestAnimationFrame(_),!s&&(c||g(!0))};return _(),()=>{cancelAnimationFrame(r),l(),u()}},[o,f,g,i,a,d]);let _=(e,t,n)=>{h.current={x:e-n.left,y:t-n.top}},x=e=>{_(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())},S=e=>{let t=e.touches[0];t&&_(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},T=()=>{h.current={x:-1e3,y:-1e3}};return(0,l.jsxs)(`div`,{ref:u,className:Nt.particleNetwork,style:n?{width:`100%`,height:`100%`}:{width:d,height:f},children:[(0,l.jsx)(`canvas`,{ref:p,className:Nt.canvas,style:{width:d,height:f},onMouseMove:x,onMouseLeave:T,onTouchMove:S,onTouchEnd:T}),(0,l.jsx)(`p`,{className:Nt.hint,children:s})]})},Z={album:`cos-album-YDP44`,bookShadow:`cos-bookShadow-OTRJk`,stage:`cos-stage-0AOoU`,cover:`cos-cover-NgXqj`,coverEdgeTop:`cos-coverEdgeTop-6c9-Y`,coverEdgeSide:`cos-coverEdgeSide-P3osy`,pageStackLeft:`cos-pageStackLeft-tSbY2`,pageStackRight:`cos-pageStackRight-LHEJf`,book:`cos-book-KzrR1`,bookGutter:`cos-bookGutter-Wzw-P`,staticPage:`cos-staticPage-FxIfo`,turningPage:`cos-turningPage-dHWFc`,leftPage:`cos-leftPage-4Mlvj`,rightPage:`cos-rightPage-F4FGx`,gutterShade:`cos-gutterShade-KRm-E`,punchHoles:`cos-punchHoles-wFJEa`,punchLeft:`cos-punchLeft-GqHzv`,punchRight:`cos-punchRight-mjt9r`,punchHole:`cos-punchHole-f103b`,pageContent:`cos-pageContent-zI3p7`,photoMount:`cos-photoMount-xpDXf`,front:`cos-front-UroYj`,caption:`cos-caption-I0FZJ`,pageNumber:`cos-pageNumber-lEKVd`,back:`cos-back-8entC`,flyleaf:`cos-flyleaf-BiH6K`,flyleafCorner:`cos-flyleafCorner--pzLp`,flyleafCornerTl:`cos-flyleafCornerTl-AN5MS`,flyleafCornerTr:`cos-flyleafCornerTr-cbwv-`,flyleafCornerBl:`cos-flyleafCornerBl-iE60j`,flyleafCornerBr:`cos-flyleafCornerBr-QOzhA`,flyleafInner:`cos-flyleafInner-VJVEj`,flyleafMotif:`cos-flyleafMotif-TC3K5`,flyleafTitle:`cos-flyleafTitle-IIuP4`,flyleafSubtitle:`cos-flyleafSubtitle-jCr9V`,flyleafRule:`cos-flyleafRule-d7XA2`,face:`cos-face-lgVVG`,faceSheet:`cos-faceSheet--UI-p`,turnNextReady:`cos-turnNextReady-cvD3P`,turnPreviousReady:`cos-turnPreviousReady-kIHfq`,turnNext:`cos-turnNext-xt9ZK`,turnPrevious:`cos-turnPrevious-jjvaP`,wireBindingBack:`cos-wireBindingBack-kw-Ci`,wireBindingFront:`cos-wireBindingFront-bK9x5`,wireRingBack:`cos-wireRingBack-R26lf`,wireRingFront:`cos-wireRingFront-i2S1H`,hitArea:`cos-hitArea-NoHZa`,previousArea:`cos-previousArea-ZHppX`,nextArea:`cos-nextArea-eDUTE`,empty:`cos-empty-DOpsx`},Ft=new Set,It=e=>{if(!e||typeof Image>`u`||Ft.has(e))return;Ft.add(e);let t=new Image;t.src=e,t.decode?.().catch(()=>{})},Lt=e=>typeof e==`number`?`${e}px`:e,Rt=(e,t)=>Math.max(0,Math.min(Math.floor(e),Math.max(0,t))),zt=()=>(0,l.jsx)(`svg`,{className:Z.flyleafMotif,viewBox:`0 0 120 120`,"aria-hidden":`true`,children:(0,l.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,l.jsx)(`circle`,{cx:`60`,cy:`60`,r:`46`}),(0,l.jsx)(`path`,{d:`M60 14 L106 60 L60 106 L14 60 Z`}),(0,l.jsx)(`circle`,{cx:`60`,cy:`60`,r:`28`}),(0,l.jsx)(`path`,{d:`M60 32 L88 60 L60 88 L32 60 Z`}),(0,l.jsx)(`path`,{d:`M60 20 V40 M60 80 V100 M20 60 H40 M80 60 H100`}),(0,l.jsx)(`path`,{d:`M34 34 L46 46 M86 34 L74 46 M34 86 L46 74 M86 86 L74 74`}),(0,l.jsx)(`path`,{d:`M60 50 L70 60 L60 70 L50 60 Z`}),(0,l.jsx)(`path`,{d:`M60 8 L63 14 L60 20 L57 14 Z`}),(0,l.jsx)(`path`,{d:`M60 100 L63 106 L60 112 L57 106 Z`}),(0,l.jsx)(`path`,{d:`M8 60 L14 63 L20 60 L14 57 Z`}),(0,l.jsx)(`path`,{d:`M100 60 L106 63 L112 60 L106 57 Z`})]})}),Bt=32,Vt=4,Ht=28,Ut=.916,Wt={previous:`Previous photo`,next:`Next photo`,empty:`No photos`,flyleafTitle:`Photo Album`,flyleafSubtitle:`Turn the page to begin`,flyleafEndTitle:`The End`,flyleafEndSubtitle:`Thank you for browsing`},Gt=e=>{if(!Number.isFinite(e)||e<=0)return 16;let t=e*Ut;return Math.max(Vt,Math.min(Ht,Math.round(t/Bt)))},Kt=(e,t)=>`${(e+.55)/t*100}%`,qt=({photo:e,index:t,total:n,objectFit:r,showPageNumber:i,pageColor:a,flyleafTitle:o,flyleafSubtitle:s,flyleafEndTitle:c,flyleafEndSubtitle:u})=>{let d=t<0,f=d?o:c,p=d?s:u;return(0,l.jsx)(`div`,{className:Z.pageContent,style:{backgroundColor:a},children:e?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:Z.photoMount,children:(0,l.jsx)(`img`,{src:e.src,alt:e.alt??e.title??``,draggable:!1,style:{objectFit:r}})}),(e.title||e.description)&&(0,l.jsxs)(`div`,{className:Z.caption,children:[e.title&&(0,l.jsx)(`strong`,{children:e.title}),e.description&&(0,l.jsx)(`span`,{children:e.description})]}),i&&(0,l.jsx)(`span`,{className:Z.pageNumber,children:`${t+1} / ${n}`})]}):(0,l.jsxs)(`div`,{className:Z.flyleaf,children:[(0,l.jsx)(`span`,{className:`${Z.flyleafCorner} ${Z.flyleafCornerTl}`,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`${Z.flyleafCorner} ${Z.flyleafCornerTr}`,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`${Z.flyleafCorner} ${Z.flyleafCornerBl}`,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`${Z.flyleafCorner} ${Z.flyleafCornerBr}`,"aria-hidden":`true`}),(0,l.jsxs)(`div`,{className:Z.flyleafInner,children:[(0,l.jsx)(`span`,{className:Z.flyleafRule,"aria-hidden":`true`}),(0,l.jsx)(zt,{}),(0,l.jsx)(`p`,{className:Z.flyleafTitle,children:f}),(0,l.jsx)(`p`,{className:Z.flyleafSubtitle,children:p}),(0,l.jsx)(`span`,{className:Z.flyleafRule,"aria-hidden":`true`})]})]})})},Jt=({side:e,count:t})=>(0,l.jsx)(`div`,{className:`${Z.punchHoles} ${e===`left`?Z.punchLeft:Z.punchRight}`,"aria-hidden":`true`,children:Array.from({length:t},(e,n)=>(0,l.jsx)(`span`,{className:Z.punchHole,style:{top:Kt(n,t)}},n))}),Yt=({count:e,variant:t})=>{let n=t===`back`?Z.wireRingBack:Z.wireRingFront;return(0,l.jsx)(`div`,{className:t===`back`?Z.wireBindingBack:Z.wireBindingFront,"aria-hidden":`true`,children:Array.from({length:e},(t,r)=>(0,l.jsx)(`span`,{className:n,style:{top:Kt(r,e)}},r))})},Xt=({photos:e,width:t=920,height:n=560,initialIndex:r=0,pageTurnDuration:i=760,objectFit:a=`cover`,showPageNumber:o=!0,pageColor:s=`#f2ead8`,coverColor:u=`#4a3025`,ariaLabel:d=`Photo album`,labels:f,onPageChange:p,onIndexChange:m,className:h,style:g})=>{let[_,v]=(0,c.useState)(()=>Rt(r,e.length)),[y,b]=(0,c.useState)(null),[x,S]=(0,c.useState)(()=>typeof n==`number`?Gt(n):16),C=Rt(_,e.length),w=Math.max(180,i),T={previous:f?.previous??Wt.previous,next:f?.next??Wt.next,empty:f?.empty??Wt.empty,flyleafTitle:f?.flyleafTitle??Wt.flyleafTitle,flyleafSubtitle:f?.flyleafSubtitle??Wt.flyleafSubtitle,flyleafEndTitle:f?.flyleafEndTitle??Wt.flyleafEndTitle,flyleafEndSubtitle:f?.flyleafEndSubtitle??Wt.flyleafEndSubtitle},E=(0,c.useRef)(y),D=(0,c.useRef)(!1),O=(0,c.useRef)(0),k=(0,c.useRef)(null),A=(0,c.useRef)(null),j=(0,c.useRef)([]),M=(0,c.useCallback)(()=>{j.current.forEach(e=>window.cancelAnimationFrame(e)),j.current=[]},[]);(0,c.useEffect)(()=>{E.current=y},[y]),(0,c.useEffect)(()=>()=>M(),[M]),(0,c.useEffect)(()=>{let e=A.current;if(!e)return;let t=e=>{let t=Gt(e);S(e=>e===t?e:t)};if(t(e.getBoundingClientRect().height),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(e=>{let n=e[0];n&&t(n.contentRect.height)});return n.observe(e),()=>n.disconnect()},[n,t]);let N=(0,c.useCallback)(t=>{if(E.current||D.current||e.length<2)return;let n=C,r=t===`next`?n+2:n-2;t===`next`&&n+1>=e.length||t===`previous`&&n<=0||(D.current=!1,O.current+=1,M(),b({direction:t,fromIndex:n,targetIndex:r,phase:`cover`}))},[M,e.length,C]);(0,c.useEffect)(()=>{if(!y||y.phase!==`cover`)return;let e=O.current,t=!1,n=0,r=0;return n=window.requestAnimationFrame(()=>{r=window.requestAnimationFrame(()=>{t||e!==O.current||b(e=>e&&e.phase===`cover`?{...e,phase:`run`}:e)})}),()=>{t=!0,window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[y]);let P=(0,c.useCallback)(()=>{let t=E.current;if(!t||D.current||t.phase===`settle`)return;D.current=!0;let n=Rt(t.targetIndex,e.length),r=O.current,i=()=>{if(r!==O.current)return;D.current=!1;let t=e[n]??e[n-1],i=e[n]?n:n-1;t&&i>=0&&(p?.(i,t),m?.(i,t))},a=k.current,o=t.direction===`next`?`translateZ(0) rotateY(-180deg)`:`translateZ(0) rotateY(0deg)`;a&&(a.style.animation=`none`,a.style.transition=`none`,a.style.willChange=`auto`,a.style.transform=o,a.style.opacity=`1`),v(n),b({...t,phase:`settle`,underlaySynced:!0}),M();let s=window.requestAnimationFrame(()=>{let e=window.requestAnimationFrame(()=>{if(r!==O.current)return;let e=k.current;e&&(e.style.visibility=`hidden`);let t=window.requestAnimationFrame(()=>{r===O.current&&(b(null),i())});j.current.push(t)});j.current.push(e)});j.current.push(s)},[M,m,p,e]);(0,c.useEffect)(()=>{if(!y||y.phase!==`run`)return;let e=O.current,t=window.setTimeout(()=>{e===O.current&&P()},w+120);return()=>window.clearTimeout(t)},[P,w,y]),(0,c.useEffect)(()=>{if(!y||y.phase!==`run`||y.underlaySynced)return;let e=O.current,t=window.setTimeout(()=>{e===O.current&&b(e=>e&&e.phase===`run`&&!e.underlaySynced?{...e,underlaySynced:!0}:e)},Math.round(w*.52));return()=>window.clearTimeout(t)},[w,y]),(0,c.useEffect)(()=>{for(let t=-2;t<=2;t+=1)It(e[C+t]?.src)},[e,C]);let F=(0,c.useMemo)(()=>{if(!y)return{left:C-1,right:C};let{fromIndex:e,targetIndex:t,direction:n,phase:r}=y;return r===`cover`?{left:e-1,right:e}:r===`settle`?{left:t-1,right:t}:n===`next`?{left:y.underlaySynced?t-1:e-1,right:t}:{left:t-1,right:y.underlaySynced?t:e}},[C,y]),I=(0,c.useMemo)(()=>y?y.direction===`next`?{front:y.fromIndex,back:y.fromIndex+1}:{front:y.targetIndex,back:y.targetIndex+1}:{front:C,back:C+1},[C,y]),L={...g,"--album-width":Lt(t),"--album-height":Lt(n),"--album-ratio":typeof t==`number`&&typeof n==`number`?t/n:1.6429,"--turn-duration":`${w}ms`,"--cover-color":u},R=e=>{e.target===e.currentTarget&&(e.key===`ArrowRight`||e.key===`Enter`||e.key===` `?(e.preventDefault(),N(`next`)):e.key===`ArrowLeft`&&(e.preventDefault(),N(`previous`)))},z=e=>{if(e.target!==e.currentTarget)return;let t=e.animationName||``;t&&!/turnNext|turnPrevious/i.test(t)||P()};if(e.length===0)return(0,l.jsx)(`div`,{className:`${Z.album} ${Z.empty} ${h??``}`,style:L,role:`region`,"aria-label":d,children:T.empty});let B={total:e.length,objectFit:a,showPageNumber:o,pageColor:s,flyleafTitle:T.flyleafTitle,flyleafSubtitle:T.flyleafSubtitle,flyleafEndTitle:T.flyleafEndTitle,flyleafEndSubtitle:T.flyleafEndSubtitle},V=y?y.phase===`settle`?Z.turningPage:y.direction===`next`?`${Z.turningPage} ${y.phase===`cover`?Z.turnNextReady:Z.turnNext}`:`${Z.turningPage} ${y.phase===`cover`?Z.turnPreviousReady:Z.turnPrevious}`:null;return(0,l.jsxs)(`div`,{ref:A,className:`${Z.album} ${h??``}`,style:L,role:`region`,"aria-label":d,"aria-roledescription":`photo album`,tabIndex:0,onKeyDown:R,children:[(0,l.jsx)(`div`,{className:Z.bookShadow,"aria-hidden":`true`}),(0,l.jsxs)(`div`,{className:Z.stage,"aria-hidden":`true`,children:[(0,l.jsxs)(`div`,{className:Z.cover,children:[(0,l.jsx)(`span`,{className:Z.coverEdgeTop}),(0,l.jsx)(`span`,{className:Z.coverEdgeSide})]}),(0,l.jsx)(`div`,{className:Z.pageStackLeft}),(0,l.jsx)(`div`,{className:Z.pageStackRight})]}),(0,l.jsx)(Yt,{count:x,variant:`back`}),(0,l.jsxs)(`div`,{className:Z.book,children:[(0,l.jsxs)(`div`,{className:`${Z.staticPage} ${Z.leftPage}`,children:[(0,l.jsx)(Jt,{side:`left`,count:x}),(0,l.jsx)(`div`,{className:Z.gutterShade,"aria-hidden":`true`}),(0,l.jsx)(qt,{photo:e[F.left],index:F.left,...B})]}),(0,l.jsxs)(`div`,{className:`${Z.staticPage} ${Z.rightPage}`,children:[(0,l.jsx)(Jt,{side:`right`,count:x}),(0,l.jsx)(`div`,{className:Z.gutterShade,"aria-hidden":`true`}),(0,l.jsx)(qt,{photo:e[F.right],index:F.right,...B})]}),y&&V&&(0,l.jsxs)(`div`,{ref:k,className:V,onAnimationEnd:z,"aria-hidden":`true`,children:[(0,l.jsx)(`div`,{className:`${Z.face} ${Z.front}`,children:(0,l.jsxs)(`div`,{className:Z.faceSheet,style:{backgroundColor:s},children:[(0,l.jsx)(Jt,{side:`right`,count:x}),(0,l.jsx)(qt,{photo:e[I.front],index:I.front,...B})]})}),(0,l.jsx)(`div`,{className:`${Z.face} ${Z.back}`,children:(0,l.jsxs)(`div`,{className:Z.faceSheet,style:{backgroundColor:s},children:[(0,l.jsx)(Jt,{side:`left`,count:x}),(0,l.jsx)(qt,{photo:e[I.back],index:I.back,...B})]})})]})]}),(0,l.jsx)(`div`,{className:Z.bookGutter,"aria-hidden":`true`}),(0,l.jsx)(Yt,{count:x,variant:`front`}),(0,l.jsx)(`button`,{type:`button`,className:`${Z.hitArea} ${Z.previousArea}`,onClick:()=>N(`previous`),disabled:C<=0||!!y,"aria-label":T.previous}),(0,l.jsx)(`button`,{type:`button`,className:`${Z.hitArea} ${Z.nextArea}`,onClick:()=>N(`next`),disabled:C+1>=e.length||!!y,"aria-label":T.next})]})},Zt={carousel:`cos-carousel-47YCI`,groundShadow:`cos-groundShadow-HsXpl`,perspective:`cos-perspective-3y-IL`,scene:`cos-scene-fAgTN`,tray:`cos-tray-Op-wW`,trayRim:`cos-trayRim--l707`,ring:`cos-ring--iRg-`,card:`cos-card-pWo53`,frame:`cos-frame-hegBO`,imageWrap:`cos-imageWrap-QPOEy`,image:`cos-image-fvzWr`,cardFront:`cos-cardFront-vPlWj`,cardBack:`cos-cardBack-PgUQH`,caption:`cos-caption-SrLR0`,captionTitle:`cos-captionTitle-n8MP5`,captionDesc:`cos-captionDesc-30qul`,empty:`cos-empty-dkNyz`},Qt=e=>typeof e==`number`?`${e}px`:e,$t=(e,t)=>t<=0?0:(e%t+t)%t,en=(e,t,n)=>n<=0?0:$t(Math.round(e/t),n),tn=({photos:e,width:t=420,height:n=360,radius:r=180,cardWidth:i=120,cardHeight:a=160,autoRotate:o=!0,autoRotateSpeed:s=12,dragSensitivity:u=.35,friction:d=2.2,showCaption:f=!1,initialAngle:p=0,onPhotoClick:m,onFaceChange:h,onIndexChange:g,ariaLabel:_=`Photo carousel`,className:v,style:y})=>{let b=e.length,x=b>0?360/b:360,S=(0,c.useRef)(null),C=(0,c.useRef)(p),w=(0,c.useRef)(0),T=(0,c.useRef)(!1),E=(0,c.useRef)(null),D=(0,c.useRef)(0),O=(0,c.useRef)(0),k=(0,c.useRef)(en(p,x,b)),A=(0,c.useRef)(!1),j=(0,c.useRef)(0),M=(0,c.useRef)(e),N=(0,c.useRef)(m),P=(0,c.useRef)(h),F=(0,c.useRef)(g),I=(0,c.useRef)(o),L=(0,c.useRef)(s),R=(0,c.useRef)(d),z=(0,c.useRef)(u),B=(0,c.useRef)(x),V=(0,c.useRef)(b),[H,U]=(0,c.useState)(()=>en(p,x,b));(0,c.useEffect)(()=>{M.current=e,N.current=m,P.current=h,F.current=g,I.current=o,L.current=s,R.current=d,z.current=u,B.current=x,V.current=b},[e,m,h,g,o,s,d,u,x,b]);let W=(0,c.useCallback)(e=>{C.current=e,S.current&&(S.current.style.transform=`rotateY(${-e}deg)`);let t=en(e,B.current,V.current);if(t!==k.current){k.current=t,U(t);let e=M.current[t];P.current?.(t,e),e&&F.current?.(t,e)}},[]);(0,c.useEffect)(()=>{C.current=p,w.current=0,W(p)},[W,b,p,x]),(0,c.useEffect)(()=>{let e=0,t=null,n=r=>{if(e=requestAnimationFrame(n),t==null){t=r;return}let i=Math.min(.05,(r-t)/1e3);if(t=r,T.current)return;let a=C.current,o=w.current,s=!1;Math.abs(o)>.01?(a+=o*i,o*=Math.exp(-R.current*i),Math.abs(o)<.02&&(o=0),w.current=o,s=!0):I.current&&(a+=L.current*i,s=!0),s&&W(a)};return e=requestAnimationFrame(n),()=>cancelAnimationFrame(e)},[W]);let G=(0,c.useCallback)(e=>{V.current<=0||e.button!==0||(T.current=!0,A.current=!1,E.current=e.pointerId,j.current=e.clientX,D.current=e.clientX,O.current=performance.now(),w.current=0,e.currentTarget.setPointerCapture(e.pointerId))},[]),K=(0,c.useCallback)(e=>{if(!T.current||E.current!==e.pointerId)return;let t=performance.now(),n=e.clientX-D.current,r=Math.max(.008,(t-O.current)/1e3);D.current=e.clientX,O.current=t,Math.abs(e.clientX-j.current)>6&&(A.current=!0);let i=-n*z.current;w.current=i/r,W(C.current+i)},[W]),q=(0,c.useCallback)(e=>{if(E.current===e.pointerId){T.current=!1,E.current=null,w.current=Math.max(-720,Math.min(720,w.current));try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}},[]),ee=(0,c.useCallback)(t=>{let n=!A.current;if(q(t),n){let t=e[k.current];t&&N.current?.(k.current,t)}},[q,e]),J=(0,c.useCallback)(e=>{w.current=0,q(e)},[q]),te=e[H],ne=f&&te&&(te.title||te.description),Y=(0,c.useMemo)(()=>e.map((e,t)=>`rotateY(${t*x}deg) translateZ(${r}px)`),[e,r,x]);return b===0?(0,l.jsx)(`div`,{className:[Zt.carousel,v].filter(Boolean).join(` `),style:{width:Qt(t),height:Qt(n),...y},role:`img`,"aria-label":_,children:(0,l.jsx)(`div`,{className:Zt.empty,children:`暂无照片`})}):(0,l.jsxs)(`div`,{className:[Zt.carousel,v].filter(Boolean).join(` `),style:{width:Qt(t),height:Qt(n),...y},role:`region`,"aria-label":_,"aria-roledescription":`carousel`,tabIndex:0,children:[(0,l.jsx)(`div`,{className:Zt.groundShadow,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:Zt.perspective,onPointerDown:G,onPointerMove:K,onPointerUp:ee,onPointerCancel:J,children:(0,l.jsxs)(`div`,{className:Zt.scene,children:[(0,l.jsx)(`div`,{className:Zt.tray,"aria-hidden":`true`,children:(0,l.jsx)(`div`,{className:Zt.trayRim})}),(0,l.jsx)(`div`,{ref:S,className:Zt.ring,style:{width:i,height:a,transform:`rotateY(${-p}deg)`},children:e.map((e,t)=>{let n=t===H;return(0,l.jsx)(`div`,{className:[Zt.card,n?Zt.cardFront:Zt.cardBack].join(` `),style:{"--card-width":`${i}px`,"--card-height":`${a}px`,transform:Y[t]},"aria-hidden":!n,children:(0,l.jsx)(`div`,{className:Zt.frame,children:(0,l.jsx)(`div`,{className:Zt.imageWrap,children:(0,l.jsx)(`img`,{className:Zt.image,src:e.src,alt:e.alt??e.title??`Photo ${t+1}`,draggable:!1})})})},`${e.src}-${t}`)})})]})}),ne?(0,l.jsxs)(`div`,{className:Zt.caption,children:[te?.title?(0,l.jsx)(`p`,{className:Zt.captionTitle,children:te.title}):null,te?.description?(0,l.jsx)(`p`,{className:Zt.captionDesc,children:te.description}):null]}):null]})},nn=1e3/120,rn=nn/1e3,an=.42,on=3800,sn=2600,cn=2900,ln=.05,un=(e,t,n)=>Math.min(n,Math.max(t,e)),dn=e=>{let t=Math.sin(e*127.1+31.7)*43758.5453;return t-Math.floor(t)},fn=e=>typeof e==`number`?`${e}px`:e,pn=(e,t)=>t*Math.tanh(e/t),mn=({count:e,viewportWidth:t,viewportHeight:n,photoWidth:r,photoHeight:i,photoGap:a,ropeTop:o,ropeSag:s,bandLength:c,maxPull:l,tilt:u})=>{let d=e>0?e*r+(e-1)*a:0,f=Math.round(r*.55),p=Math.max(d+f*2,t,r*2),m=(p-d)/2,h=r+a,g=[];for(let t=0;t<e;t+=1)g.push(m+t*h+r*(.4+dn(t*5.13)*.2));let _=e=>{let t=p>0?un(e/p,0,1):0;return o+s*4*t*(1-t)},v=Math.min(20,a*.24+5),y=[],b=[],x=[],S=[],C=[],w=[];for(let t=0;t<e;t+=1){let e=m+t*h,n=g[t],i=_(n);y.push(e),x.push(n-e),S.push(i),b.push(i+c+13),C.push((dn(t*3.71)*2-1)*u),w.push(e+r/2)}let T=[{x:0,baseY:_(0),pulls:[]}];for(let t=0;t<e;t+=1){let e=((t===0?0:g[t-1])+g[t])/2,n=t===0;T.push({x:e,baseY:_(e)+v*(n?.5:1),pulls:n?[{index:t,weight:.3}]:[{index:t-1,weight:.45},{index:t,weight:.45}]}),T.push({x:g[t],baseY:_(g[t]),pulls:[{index:t,weight:1}]})}if(e>0){let t=(g[e-1]+p)/2;T.push({x:t,baseY:_(t)+v*.5,pulls:[{index:e-1,weight:.3}]})}return T.push({x:p,baseY:_(p),pulls:[]}),{railWidth:p,stageHeight:Math.max(n,Math.ceil(o+s+c+13+i+l+40)),cardLefts:y,cardTops:b,pinOffsets:x,pinXs:g,anchorYs:S,baseRots:C,centers:w,anchors:T}},hn=({bandLength:e,damping:t,maxPull:n,stiffness:r,tension:i})=>{let a=420*un(r,.1,3),o=un(t,.02,1),s=Math.max(8,e);return{bandLength:s,segLength:s/5,gravityAccel:cn,chainKeep:Math.exp(-(.6+o*6)*rn),swingDamp:2*un(.28+o,.1,1)*Math.sqrt(165),spinDamp:2*un(.35+o,.1,1.2)*Math.sqrt(60),bandK:a*.9,bandRecover:11,springK:a,springC:2*un(.45+o,.1,1.2)*Math.sqrt(a),neighborK:a*un(i,0,1),maxPull:Math.max(16,n)}},gn=(e,t,n,r)=>({x:e?.pinXs[n]??0,y:(e?.anchorYs[n]??0)+(t?.segLength??0)*r}),_n=(e,t,n)=>Array.from({length:6},(r,i)=>{let a=gn(e,t,n,i);return{x:a.x,y:a.y,px:a.x,py:a.y,sx:a.x,sy:a.y,rx:a.x,ry:a.y}}),vn=(e,t,n)=>{let r=e.baseRots[n]??0;return{chain:_n(e,t,n),rot:r,vRot:0,spin:0,vSpin:0,swayVx:0,slack:0,ropeY:0,ropeVy:0,sRot:r,sSpin:0,sRopeY:0}},yn=(e,t,n,r)=>{e.chain.forEach((e,i)=>{let a=gn(t,n,r,i);e.x=a.x,e.y=a.y,e.px=a.x,e.py=a.y,e.sx=a.x,e.sy=a.y,e.rx=a.x,e.ry=a.y}),e.rot=t?.baseRots[r]??0,e.vRot=0,e.spin=0,e.vSpin=0,e.swayVx=0,e.slack=0,e.ropeY=0,e.ropeVy=0,e.sRot=e.rot,e.sSpin=0,e.sRopeY=0},bn=(e,t=e.length)=>{if(t<2)return``;let n=`M ${e[0].x.toFixed(2)} ${e[0].y.toFixed(2)}`;for(let r=0;r<t-1;r+=1){let i=e[r],a=e[r+1],o=r>0?e[r-1]:i,s=r+2<t?e[r+2]:a,c=i.x+(a.x-o.x)/6,l=i.y+(a.y-o.y)/6,u=a.x-(s.x-i.x)/6,d=a.y-(s.y-i.y)/6;n+=` C ${c.toFixed(2)} ${l.toFixed(2)} ${u.toFixed(2)} ${d.toFixed(2)} ${a.x.toFixed(2)} ${a.y.toFixed(2)}`}return n},xn=(e,t)=>{for(;e.length<t;)e.push({x:0,y:0});return e},Sn=(e,t)=>({min:Math.min(0,e-t),max:0}),Cn=(e,t,n,r,i)=>{let{layout:a,physics:o,nodes:s}=e;if(!a||!o)return;let c=`translate3d(${e.offset.toFixed(2)}px, 0, 0)`;t.rail&&c!==n.rail&&(t.rail.style.transform=c,n.rail=c);let l=i>0?1-Math.exp(-i*34):1;for(let i=0;i<s.length;i+=1){let c=s[i];if(!c)continue;let u=c.chain,d=u.length-1,f=xn(e.buffer,u.length);for(let e=0;e<=d;e+=1){let t=u[e],n=t.sx+(t.x-t.sx)*r,i=t.sy+(t.y-t.sy)*r;e===0||e===d?(t.rx=n,t.ry=i):(t.rx+=(n-t.rx)*l,t.ry+=(i-t.ry)*l),f[e].x=t.rx,f[e].y=t.ry}let p=t.cards[i];if(p){let e=u[d],t=a.pinXs[i]??0,s=(a.anchorYs[i]??0)+o.bandLength,l=c.sRot+(c.rot-c.sRot)*r,f=c.sSpin+(c.spin-c.sSpin)*r,m=`translate3d(${(e.rx-t).toFixed(2)}px, ${(e.ry-s).toFixed(2)}px, 0) rotate(${l.toFixed(2)}deg) rotateY(${f.toFixed(2)}deg)`;m!==n.cards[i]&&(p.style.transform=m,n.cards[i]=m)}let m=bn(f,u.length);if(m!==n.bands[i]){n.bands[i]=m,t.bandPaths[i]?.setAttribute(`d`,m),t.bandGloss[i]?.setAttribute(`d`,m);let e=t.knots[i];e&&(e.setAttribute(`cx`,u[0].rx.toFixed(2)),e.setAttribute(`cy`,u[0].ry.toFixed(2)))}}let u=a.anchors,d=xn(e.buffer,u.length);for(let e=0;e<u.length;e+=1){let t=u[e],n=t.baseY;for(let e of t.pulls){let t=s[e.index];t&&(n+=(t.sRopeY+(t.ropeY-t.sRopeY)*r)*e.weight)}d[e].x=t.x,d[e].y=n}let f=bn(d,u.length);if(f!==n.rope){n.rope=f;for(let e of t.ropePaths)e?.setAttribute(`d`,f)}},wn=(e,t,n)=>{let{physics:r,layout:i,nodes:a}=e;if(!r||!i)return;let o=e.drag,s=o?.mode===`photo`?o.photoIndex:-1,c=e.impulse;if(e.impulse=null,o){let e=Math.exp(-n*6);o.vx*=e,o.vy*=e;let t=1-Math.exp(-n*110);o.smoothX+=(o.pointerX-o.smoothX)*t,o.smoothY+=(o.pointerY-o.smoothY)*t}for(let e=0;e<a.length;e+=1){let t=a[e],l=t.chain,u=l.length-1;for(let e=0;e<=u;e+=1)l[e].sx=l[e].x,l[e].sy=l[e].y;t.sRot=t.rot,t.sSpin=t.spin,t.sRopeY=t.ropeY;let d=i.pinXs[e]??0,f=(i.anchorYs[e]??0)+t.ropeY,p=r.maxPull,m=e===s&&o?o:null,h=0,g=0,_=0;if(m){g=m.smoothX-m.grabDx,_=m.smoothY-m.grabDy;let e=Math.hypot(g-d,_-f);h=Math.max(0,pn(e-r.bandLength,p))}t.slack=h>=t.slack?h:t.slack+(h-t.slack)*(1-Math.exp(-n*r.bandRecover)),t.slack<.02&&(t.slack=0);let v=r.bandLength+t.slack,y=v/5;c&&c.index===e&&(l[u].px=l[u].x-c.vx*n,l[u].py=l[u].y-c.vy*n);let b=r.gravityAccel*n*n;for(let e=1;e<=u;e+=1){let t=l[e],n=(t.x-t.px)*r.chainKeep,i=(t.y-t.py)*r.chainKeep;t.px=t.x,t.py=t.y,t.x+=n,t.y+=i+b}let x=null;if(m){let e=g-d,t=_-f,n=Math.hypot(e,t);x=n>v&&n>.001?{x:d+e/n*v,y:f+t/n*v}:{x:g,y:_}}for(let e=0;e<8;e+=1){l[0].x=d,l[0].y=f,x&&(l[u].x=x.x,l[u].y=x.y);for(let e=0;e<u;e+=1){let t=l[e],n=l[e+1],r=n.x-t.x,i=n.y-t.y,a=Math.hypot(r,i)||1e-4;if(a<=y)continue;let o=(a-y)/a,s=e===0,c=e+1===u&&x!==null,d=s?0:c?1:.5,f=c?0:s?1:.5;t.x+=r*o*d,t.y+=i*o*d,n.x-=r*o*f,n.y-=i*o*f}}let S=l[u],C=-(Math.atan2(S.x-l[0].x,S.y-l[0].y)*180)/Math.PI,w=76*Math.tanh(C/76),T=(i.baseRots[e]??0)+w;t.vRot+=((T-t.rot)*165-t.vRot*r.swingDamp)*n,t.rot=un(t.rot+t.vRot*n,-108,108);let E=(S.x-S.px)/n;t.swayVx+=(E-t.swayVx)*(1-Math.exp(-n*18));let D=un(-t.swayVx*ln,-34,34);t.vSpin+=((D-t.spin)*60-t.vSpin*r.spinDamp)*n,t.spin+=t.vSpin*n;let O=-r.springK*t.ropeY-r.springC*t.ropeVy;if(t.slack>0){let e=S.y-f,n=Math.hypot(S.x-d,e)||1;O+=r.bandK*t.slack*Math.max(e/n,0)}let k=a[e-1],A=a[e+1];k&&(O+=r.neighborK*(k.ropeY-t.ropeY)),A&&(O+=r.neighborK*(A.ropeY-t.ropeY)),t.ropeVy+=O*n,t.ropeY=un(t.ropeY+t.ropeVy*n,-r.maxPull,r.maxPull*1.2)}if(o?.mode===`pan`)return;let{min:l,max:u}=Sn(t,i.railWidth),d=e.snapTarget;if(d!==null){let t=d-e.offset;e.offset+=t*(1-Math.exp(-n*12)),e.offsetVelocity=0,Math.abs(t)<.4&&(e.offset=d,e.snapTarget=null);return}if(o)return;let f=e.offset;if(f>u||f<l){let t=f>u?u:l;e.offsetVelocity+=((t-f)*220-e.offsetVelocity*15)*n,e.offset+=e.offsetVelocity*n,Math.abs(t-e.offset)<.4&&Math.abs(e.offsetVelocity)<24&&(e.offset=t,e.offsetVelocity=0);return}e.offsetVelocity!==0&&(e.offset+=e.offsetVelocity*n,e.offsetVelocity*=Math.exp(-n*2.8),Math.abs(e.offsetVelocity)<12&&(e.offsetVelocity=0),e.offset=un(e.offset,l,u))},Tn=(e,t)=>{if(e.drag||e.snapTarget!==null||e.impulse||Math.abs(e.offsetVelocity)>.5)return!1;let n=e.layout;if(!n)return!1;let{min:r,max:i}=Sn(t,n.railWidth);return e.offset>i+.4||e.offset<r-.4?!1:e.nodes.every((t,r)=>{let i=n.baseRots[r]??0;return t.slack>0||Math.abs(t.rot-i)>1||Math.abs(t.vRot)>4||Math.abs(t.spin)>.6||Math.abs(t.vSpin)>4||Math.abs(t.ropeY)>.3||Math.abs(t.ropeVy)>3?!1:t.chain.every((t,i)=>{let a=gn(n,e.physics,r,i);return Math.hypot(t.x-a.x,t.y-a.y)<.6&&Math.abs(t.x-t.px)<.02&&Math.abs(t.y-t.py)<.02})})},En=e=>{e.nodes.forEach((t,n)=>{yn(t,e.layout,e.physics,n)}),e.offsetVelocity=0},Dn={clothesline:`cos-clothesline-sgTFe`,viewport:`cos-viewport-TH-gR`,pannable:`cos-pannable-sEcjn`,rail:`cos-rail-eTBFj`,strings:`cos-strings-HDBn-`,ropeShadow:`cos-ropeShadow-79mEA`,ropeShadowCore:`cos-ropeShadowCore-L3p8G`,ropeBody:`cos-ropeBody-pEvRS`,ropeTwist:`cos-ropeTwist-shhPx`,bandBody:`cos-bandBody-DScGJ`,bandGloss:`cos-bandGloss-I-wXr`,bandKnot:`cos-bandKnot-raqsN`,hanger:`cos-hanger-8FbKZ`,frame:`cos-frame-TORk3`,pin:`cos-pin-wNwv2`,pinSpring:`cos-pinSpring-1-6dJ`,photo:`cos-photo-90x94`,caption:`cos-caption-VM5T4`},On=({photos:e,width:t=`100%`,height:n=480,photoWidth:r=150,photoHeight:i=200,photoGap:a=46,ropeTop:o=66,ropeSag:s=26,bandLength:u=34,bandWidth:d=5,maxPull:f=110,stiffness:p=1,damping:m=.16,tension:h=.35,tilt:g=5,ropeColor:_=`#8d7a5c`,bandColor:v,pinColor:y=`#d8a761`,frameColor:b=`#fffdf7`,background:x,objectFit:S=`cover`,showCaption:C=!0,initialIndex:w=0,onIndexChange:T,onPhotoClick:E,ariaLabel:D=`Photo clothesline`,className:O,style:k})=>{let A=(0,c.useRef)(null),j=(0,c.useRef)(null),M=(0,c.useRef)([]),N=(0,c.useRef)([]),P=(0,c.useRef)([]),F=(0,c.useRef)([]),I=(0,c.useRef)([]),L=(0,c.useRef)({bands:[],cards:[],rope:``,rail:``}),R=(0,c.useRef)({nodes:[],layout:null,physics:null,offset:0,offsetVelocity:0,snapTarget:null,drag:null,impulse:null,buffer:[]}),z=(0,c.useRef)(null),B=(0,c.useRef)(null),V=(0,c.useRef)(0),H=(0,c.useRef)(0),U=(0,c.useRef)(!1),W=(0,c.useRef)(w),G=(0,c.useRef)(w),K=(0,c.useRef)(T),q=(0,c.useRef)(E),ee=(0,c.useRef)(e),[J,te]=(0,c.useState)({width:0,height:0}),ne=e.length,Y=C&&e.some(e=>e.title||e.description);(0,c.useEffect)(()=>{K.current=T,q.current=E,ee.current=e},[T,E,e]);let X=(0,c.useMemo)(()=>mn({count:ne,viewportWidth:J.width,viewportHeight:J.height,photoWidth:r,photoHeight:i,photoGap:a,ropeTop:o,ropeSag:s,bandLength:u,maxPull:f,tilt:g}),[u,ne,f,a,i,r,s,o,g,J.height,J.width]),re=(0,c.useMemo)(()=>hn({bandLength:u,damping:m,maxPull:f,stiffness:p,tension:h}),[u,m,f,p,h]),ie=Math.min(0,J.width-X.railWidth)<-.5,ae=(0,c.useCallback)(()=>A.current?.clientWidth??J.width,[J.width]),oe=(0,c.useCallback)(()=>({rail:j.current,ropePaths:M.current,bandPaths:N.current,bandGloss:P.current,knots:F.current,cards:I.current}),[]),se=(0,c.useCallback)((e,t)=>{Cn(R.current,oe(),L.current,e,t)},[oe]),ce=(0,c.useCallback)(()=>{if(B.current!==null||typeof window>`u`)return;let e=z.current;e&&(V.current=0,H.current=0,B.current=window.requestAnimationFrame(e))},[]);(0,c.useEffect)(()=>{let e=t=>{B.current=null;let n=V.current||t;V.current=t;let r=Math.min(t-n,64);H.current+=r;let i=R.current,a=ae(),o=0;for(;H.current>=8.333333333333334&&o<12;)wn(i,a,rn),H.current-=nn,o+=1;if(o>=12&&(H.current=0),Tn(i,a)){En(i),se(1,0),V.current=0,H.current=0;let e=i.layout?.centers;if(e&&e.length>0){let t=a/2-i.offset,n=0,r=1/0;for(let i=0;i<e.length;i++){let a=Math.abs(e[i]-t);a<r&&(r=a,n=i)}if(n!==G.current){G.current=n;let e=ee.current[n];e&&K.current?.(n,e)}}return}se(H.current/nn,r/1e3),B.current=window.requestAnimationFrame(e)};return z.current=e,()=>{z.current=null}},[se,ae]),(0,c.useEffect)(()=>{let e=R.current;e.layout=X,e.physics=re},[X,re]),(0,c.useEffect)(()=>{let e=R.current;e.nodes=Array.from({length:ne},(e,t)=>vn(X,re,t)),I.current.length=ne,L.current.rope=``,L.current.rail=``},[ne,X,re]),(0,c.useEffect)(()=>{let e=A.current;if(!e)return;let t=(e,t)=>te(n=>n.width===e&&n.height===t?n:{width:e,height:t});if(t(e.clientWidth,e.clientHeight),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(e=>{let n=e[0];n&&t(Math.round(n.contentRect.width),Math.round(n.contentRect.height))});return n.observe(e),()=>n.disconnect()},[]);let le=(0,c.useCallback)(e=>{let t=ae(),n=R.current.layout?.centers[un(e,0,Math.max(0,ne-1))];if(n===void 0)return 0;let{min:r,max:i}=Sn(t,R.current.layout?.railWidth??0);return un(t/2-n,r,i)},[ne,ae]);(0,c.useEffect)(()=>{if(J.width<=0)return;let e=R.current;if(!U.current){U.current=!0,W.current=w,e.offset=le(w),se(1,0);return}if(W.current!==w){W.current=w,e.snapTarget=le(w),ce();return}let{min:t,max:n}=Sn(ae(),e.layout?.railWidth??0);e.offset=un(e.offset,t,n),se(1,0)},[ne,w,X,le,se,ce,ae,J.width]),(0,c.useEffect)(()=>()=>{B.current!==null&&window.cancelAnimationFrame(B.current),B.current=null},[]);let ue=(0,c.useCallback)(e=>{if(e.button!==0&&e.pointerType===`mouse`)return;let t=e.target?.closest?.(`[data-photo-index]`),n=t?Number(t.dataset.photoIndex):-1,r=Number.isFinite(n)?n:-1,i=A.current?.getBoundingClientRect(),a=i?.left??0,o=i?.top??0,s=R.current,c=e.clientX-a-s.offset,l=e.clientY-o,u=r>=0?s.nodes[r]:void 0,d=u?.chain[u.chain.length-1];s.snapTarget=null,s.offsetVelocity=0,s.drag={pointerId:e.pointerId,mode:d?`photo`:`pan`,photoIndex:r,grabDx:d?c-d.x:0,grabDy:d?l-d.y:0,pointerX:c,pointerY:l,smoothX:c,smoothY:l,rectLeft:a,rectTop:o,startX:e.clientX,startY:e.clientY,startOffset:s.offset,lastX:e.clientX,lastY:e.clientY,lastTime:e.timeStamp,vx:0,vy:0,moved:0},e.currentTarget.setPointerCapture(e.pointerId),ce()},[ce]),de=(0,c.useCallback)(e=>{let t=R.current,n=t.drag;if(!n||n.pointerId!==e.pointerId)return;let r=e.clientX-n.startX,i=e.clientY-n.startY;n.moved=Math.max(n.moved,Math.hypot(r,i));let a=Math.max(e.timeStamp-n.lastTime,1)/1e3;if(n.vx=.7*((e.clientX-n.lastX)/a)+.3*n.vx,n.vy=.7*((e.clientY-n.lastY)/a)+.3*n.vy,n.lastX=e.clientX,n.lastY=e.clientY,n.lastTime=e.timeStamp,n.mode===`pan`){let{min:e,max:i}=Sn(ae(),t.layout?.railWidth??0),a=n.startOffset+r;t.offset=a-(a>i?a-i:a<e?a-e:0)*(1-an),ce();return}n.pointerX=e.clientX-n.rectLeft-t.offset,n.pointerY=e.clientY-n.rectTop,ce()},[ce,ae]),fe=(0,c.useCallback)(e=>{let t=R.current,n=t.drag;if(!(!n||n.pointerId!==e.pointerId)){if(t.drag=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),n.mode===`pan`)t.offsetVelocity=un(n.vx,-on,on);else if(n.moved<=4&&n.photoIndex>=0){let e=ee.current[n.photoIndex];e&&q.current?.(n.photoIndex,e)}else n.photoIndex>=0&&(t.impulse={index:n.photoIndex,vx:un(n.vx,-sn,sn),vy:un(n.vy,-sn,sn)});ce()}},[ce]),pe=(0,c.useCallback)(e=>{let t=R.current,n=t.drag;!n||n.pointerId!==e.pointerId||(t.drag=null,ce())},[ce]);(0,c.useEffect)(()=>{let e=A.current;if(!e)return;let t=e=>{let t=Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.shiftKey?e.deltaY:0;if(t===0)return;let n=R.current,{min:r,max:i}=Sn(ae(),n.layout?.railWidth??0);r>=i||(e.preventDefault(),n.snapTarget=null,n.offsetVelocity=0,n.offset=un(n.offset-t,r,i),ce())};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[ce,ae]);let me=(0,c.useCallback)(e=>{let t=e.target?.closest?.(`[data-photo-index]`),n=t?Number(t.dataset.photoIndex):-1,i=R.current;if(e.key===`ArrowRight`||e.key===`ArrowLeft`){let{min:t,max:n}=Sn(ae(),i.layout?.railWidth??0);if(t>=n)return;e.preventDefault();let o=r+a;i.snapTarget=un((i.snapTarget??i.offset)+(e.key===`ArrowLeft`?o:-o),t,n),ce();return}if(!(n<0)){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),i.impulse={index:n,vx:0,vy:e.key===`ArrowDown`?1500:-1e3},ce();return}if(e.key===`Enter`||e.key===` `){let t=ee.current[n];if(!t||!q.current)return;e.preventDefault(),q.current(n,t)}}},[a,r,ce,ae]),he=e=>({left:X.cardLefts[e],top:X.cardTops[e],width:r,height:i,transform:`translate3d(0, 0, 0) rotate(${X.baseRots[e]}deg)`,"--pin-x":`${X.pinOffsets[e]}px`,"--pin-grip":`-13px`}),ge={...k,width:fn(t),height:fn(n),"--rope-color":_,"--band-color":v??_,"--band-width":`${Math.max(1,d)}px`,"--pin-color":y,"--frame-color":b,...x?{"--clothesline-bg":x}:null};return(0,l.jsx)(`div`,{className:`${Dn.clothesline} ${O??``}`,style:ge,role:`region`,"aria-label":D,children:(0,l.jsx)(`div`,{ref:A,className:`${Dn.viewport} ${ie?Dn.pannable:``}`,onPointerDown:ue,onPointerMove:de,onPointerUp:fe,onPointerCancel:pe,onKeyDown:me,children:(0,l.jsxs)(`div`,{ref:j,className:Dn.rail,style:{width:X.railWidth},children:[(0,l.jsxs)(`svg`,{className:Dn.strings,width:X.railWidth,height:X.stageHeight,viewBox:`0 0 ${X.railWidth} ${X.stageHeight}`,"aria-hidden":`true`,children:[(0,l.jsx)(`path`,{ref:e=>{M.current[0]=e},className:Dn.ropeShadow}),(0,l.jsx)(`path`,{ref:e=>{M.current[1]=e},className:Dn.ropeShadowCore}),(0,l.jsx)(`path`,{ref:e=>{M.current[2]=e},className:Dn.ropeBody}),(0,l.jsx)(`path`,{ref:e=>{M.current[3]=e},className:Dn.ropeTwist}),e.map((e,t)=>(0,l.jsxs)(`g`,{children:[(0,l.jsx)(`path`,{ref:e=>{N.current[t]=e,L.current.bands[t]=``},className:Dn.bandBody}),(0,l.jsx)(`path`,{ref:e=>{P.current[t]=e},className:Dn.bandGloss}),(0,l.jsx)(`circle`,{ref:e=>{F.current[t]=e},className:Dn.bandKnot,r:4.2})]},`band-${e.src}-${t}`))]}),e.map((e,t)=>(0,l.jsx)(kn,{photo:e,index:t,style:he(t),objectFit:S,hasCaption:Y,clickable:!!E,onCardRef:e=>{I.current[t]=e,L.current.cards[t]=``}},`${e.src}-${t}`))]})})})},kn=c.default.memo(({photo:e,index:t,style:n,objectFit:r,hasCaption:i,clickable:a,onCardRef:o})=>(0,l.jsxs)(`div`,{ref:o,className:Dn.hanger,"data-photo-index":t,style:n,tabIndex:0,role:a?`button`:`group`,"aria-label":e.title??e.alt??void 0,children:[(0,l.jsx)(`span`,{className:Dn.pin,"aria-hidden":`true`,children:(0,l.jsx)(`span`,{className:Dn.pinSpring})}),(0,l.jsxs)(`figure`,{className:Dn.frame,children:[(0,l.jsx)(`span`,{className:Dn.photo,children:(0,l.jsx)(`img`,{src:e.src,alt:e.alt??e.title??``,draggable:!1,style:{objectFit:r}})}),i&&(0,l.jsxs)(`figcaption`,{className:Dn.caption,children:[e.title&&(0,l.jsx)(`strong`,{children:e.title}),e.description&&(0,l.jsx)(`span`,{children:e.description})]})]})]}));kn.displayName=`PhotoHanger`;var An={filmstrip:`cos-filmstrip-xRvDi`,sprocketBand:`cos-sprocketBand-Md1u6`,sprocketBandBottom:`cos-sprocketBandBottom-KyDcg`,viewport:`cos-viewport-qraxB`,strip:`cos-strip-qvNaQ`,frameCell:`cos-frameCell-ZyVRT`,frameNumber:`cos-frameNumber-1pHpP`,frameWindow:`cos-frameWindow-GiJp4`,caption:`cos-caption-RBarX`,empty:`cos-empty-ql-mT`},jn=6,Mn=8,Nn=2600,Pn=14,Fn=e=>typeof e==`number`?`${e}px`:e,In=(e,t,n)=>Math.min(n,Math.max(t,e)),Ln=e=>String(e+1).padStart(2,`0`),Rn=({photos:e,width:t=`100%`,height:n=280,frameWidth:r=160,frameHeight:i=120,frameGap:a=14,showCaption:o=!0,friction:s=2.8,dragSensitivity:u=1,initialIndex:d=0,onPhotoClick:f,onIndexChange:p,ariaLabel:m=`Photo filmstrip`,className:h,style:g})=>{let _=(0,c.useRef)(null),v=(0,c.useRef)(null),y=(0,c.useRef)(null),b=(0,c.useRef)({offset:0,velocity:0,drag:null,snapTarget:null}),x=(0,c.useRef)(null),S=(0,c.useRef)(0),C=(0,c.useRef)(0),w=(0,c.useRef)(!1),T=(0,c.useRef)(d),E=(0,c.useRef)(f),D=(0,c.useRef)(p),O=(0,c.useRef)(e),k=(0,c.useRef)(s),A=(0,c.useRef)(u),[j,M]=(0,c.useState)(0),[N,P]=(0,c.useState)(d),F=e.length,I=r+a,L=o&&e.some(e=>e.title||e.description);(0,c.useEffect)(()=>{E.current=f,D.current=p,O.current=e,k.current=s,A.current=u},[u,s,p,f,e]);let R=(0,c.useMemo)(()=>j>0?j/2-r/2:0,[r,j]),z=(0,c.useMemo)(()=>F<=0?0:R*2+F*r+Math.max(0,F-1)*a,[F,a,r,R]),B=(0,c.useCallback)(e=>{if(j<=0||F<=0)return 0;let t=R+In(Math.floor(e),0,F-1)*I+r/2;return j/2-t},[F,I,r,R,j]),V=(0,c.useCallback)(e=>{if(F<=0||j<=0)return 0;let t=(j/2-e-R-r/2)/I;return In(Math.round(t),0,F-1)},[F,I,r,R,j]),H=(0,c.useCallback)(()=>F<=0?{min:0,max:0}:{min:B(F-1),max:B(0)},[F,B]),U=(0,c.useCallback)(e=>{let t=y.current;t&&(t.style.transform=`translate3d(${e}px, 0, 0)`)},[]),W=(0,c.useCallback)(e=>{if(e===C.current)return;C.current=e,P(e);let t=O.current[e];t&&D.current?.(e,t)},[]),G=(0,c.useCallback)(()=>{x.current!==null&&(window.cancelAnimationFrame(x.current),x.current=null),S.current=0},[]),K=(0,c.useCallback)(()=>{if(x.current!==null||typeof window>`u`)return;let e=t=>{x.current=null;let n=S.current||t;S.current=t;let r=Math.min(.05,(t-n)/1e3),i=b.current,{min:a,max:o}=H(),s=!1;if(i.drag)U(i.offset),s=!0;else if(i.snapTarget!==null){let e=i.snapTarget-i.offset;Math.abs(e)<=.35?(i.offset=i.snapTarget,i.snapTarget=null,i.velocity=0,W(V(i.offset)),U(i.offset)):(i.offset+=e*Math.min(1,Pn*r),i.velocity=0,U(i.offset),s=!0)}else{let e=i.velocity;if(Math.abs(e)>Mn)e*=Math.exp(-k.current*r),Math.abs(e)<=Mn&&(e=0),i.velocity=e,i.offset+=e*r,(i.offset<a||i.offset>o)&&(i.offset=In(i.offset,a,o),i.velocity=0),U(i.offset),s=!0;else{i.velocity=0;let e=B(V(i.offset));Math.abs(i.offset-e)>.35?(i.snapTarget=e,s=!0):(i.offset=e,W(V(i.offset)),U(i.offset))}}s?x.current=window.requestAnimationFrame(e):S.current=0};x.current=window.requestAnimationFrame(e)},[U,V,W,H,B]);(0,c.useEffect)(()=>{let e=v.current;if(!e)return;let t=e=>{M(t=>t===e?t:e)};if(t(e.clientWidth),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(e=>{let n=e[0];n&&t(Math.round(n.contentRect.width))});return n.observe(e),()=>n.disconnect()},[]),(0,c.useEffect)(()=>{if(j<=0||F<=0)return;let e=b.current;if(!w.current){w.current=!0,T.current=d,e.offset=B(d),e.velocity=0,e.snapTarget=null,e.drag=null,C.current=In(d,0,F-1),P(C.current),U(e.offset);return}if(T.current!==d){T.current=d,e.velocity=0,e.drag=null,e.snapTarget=B(d),K();return}let{min:t,max:n}=H();e.offset=In(e.offset,t,n),U(e.offset)},[U,F,d,H,B,K,j]),(0,c.useEffect)(()=>()=>{G()},[G]);let q=(0,c.useCallback)(e=>{let t=b.current,n=t.drag;if(!n||n.pointerId!==e.pointerId)return;t.drag=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId);let r=Math.max(.008,(e.timeStamp-n.lastTime)/1e3);if(t.velocity=In((e.clientX-n.lastX)/r*A.current,-2600,Nn),t.snapTarget=null,n.moved<=jn){t.velocity=0;let e=V(t.offset),n=O.current[e];n&&E.current?.(e,n),t.snapTarget=B(e)}K()},[V,B,K]),ee=(0,c.useCallback)(e=>{if(e.button!==0&&e.pointerType===`mouse`||F<=0)return;let t=b.current;t.drag={pointerId:e.pointerId,startX:e.clientX,startOffset:t.offset,lastX:e.clientX,lastTime:e.timeStamp,vx:0,moved:0},t.velocity=0,t.snapTarget=null,e.currentTarget.setPointerCapture(e.pointerId),K()},[F,K]),J=(0,c.useCallback)(e=>{let t=b.current,n=t.drag;if(!n||n.pointerId!==e.pointerId)return;let r=e.clientX-n.startX;n.moved=Math.max(n.moved,Math.abs(r));let i=Math.max(e.timeStamp-n.lastTime,1)/1e3;n.vx=.7*((e.clientX-n.lastX)/i)+.3*n.vx,n.lastX=e.clientX,n.lastTime=e.timeStamp;let{min:a,max:o}=H();t.offset=In(n.startOffset+r*A.current,a,o),U(t.offset),K()},[U,H,K]),te=(0,c.useCallback)(e=>{q(e)},[q]),ne=(0,c.useCallback)(e=>{q(e)},[q]),Y=(0,c.useCallback)(e=>{if(F<=0||e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=b.current,n=e.key===`ArrowLeft`?I:-I,{min:r,max:i}=H(),a=t.snapTarget??t.offset;t.velocity=0,t.drag=null,t.snapTarget=In(a+n,r,i),K()},[F,I,H,K]),X=e[N],re=o&&X?.title?`,当前:${X.title}${X.description?`,${X.description}`:``}`:``;return(0,l.jsxs)(`div`,{ref:_,className:[An.filmstrip,h].filter(Boolean).join(` `),style:{width:Fn(t),height:Fn(n),...g},role:`region`,"aria-label":m+re,tabIndex:F>0?0:-1,onKeyDown:Y,children:[(0,l.jsx)(`div`,{className:An.sprocketBand,"aria-hidden":`true`}),(0,l.jsx)(`div`,{ref:v,className:An.viewport,onPointerDown:ee,onPointerMove:J,onPointerUp:te,onPointerCancel:ne,children:F>0?(0,l.jsx)(`div`,{ref:y,className:An.strip,style:{minWidth:z,paddingLeft:R,paddingRight:R,boxSizing:`border-box`},children:e.map((e,t)=>(0,l.jsxs)(`div`,{className:An.frameCell,style:{width:r,marginRight:t<F-1?a:0},"data-photo-index":t,children:[(0,l.jsx)(`span`,{className:An.frameNumber,children:Ln(t)}),(0,l.jsx)(`div`,{className:An.frameWindow,style:{width:r,height:i},children:(0,l.jsx)(`img`,{src:e.src,alt:e.alt??e.title??``,draggable:!1})}),L&&(e.title||e.description)&&(0,l.jsxs)(`div`,{className:An.caption,children:[e.title&&(0,l.jsx)(`strong`,{children:e.title}),e.description&&(0,l.jsx)(`span`,{children:e.description})]})]},`${e.src}-${t}`))}):(0,l.jsx)(`div`,{className:An.empty,children:`No photos`})}),(0,l.jsx)(`div`,{className:[An.sprocketBand,An.sprocketBandBottom].join(` `),"aria-hidden":`true`})]})},zn={fridge:`cos-fridge-3RQp4`,handle:`cos-handle-Qr-U3`,stage:`cos-stage-Aw2rq`,card:`cos-card-SefXh`,cardDragging:`cos-cardDragging-UA1W-`,magnetRow:`cos-magnetRow-Q9nXm`,magnet:`cos-magnet-PiJ8m`,magnetRed:`cos-magnetRed-eIhOH`,magnetBlue:`cos-magnetBlue-BHgCS`,magnetGreen:`cos-magnetGreen-L7iFW`,magnetYellow:`cos-magnetYellow-gKTmk`,photoFrame:`cos-photoFrame-g1FoK`,image:`cos-image-wyaBh`,caption:`cos-caption-M-HQN`,title:`cos-title-ziJT2`,description:`cos-description-xaZI-`,empty:`cos-empty-gHMtw`},Bn=6,Vn=1200,Hn=.08,Un=1.05,Wn=10,Gn=32,Kn=.24,qn=[`magnetRed`,`magnetBlue`,`magnetGreen`,`magnetYellow`],Jn=e=>typeof e==`number`?`${e}px`:e,Yn=(e,t,n)=>Math.min(n,Math.max(t,e)),Xn=e=>{let t=Math.sin(e*127.1+31.7)*43758.5453;return t-Math.floor(t)},Zn=(e,t,n,r,i,a)=>{if(e<=0||t<=0||n<=0)return[];let o=Math.max(Wn,t-r-Wn-Gn),s=Math.max(Wn,n-i-Wn),c=Math.max(0,o-Wn)*.55*a,l=Math.max(0,s-Wn)*.5*a,u=Wn+(o-Wn)*.5-r*.5,d=Wn+(s-Wn)*.5-i*.5;return Array.from({length:e},(t,n)=>{let r=e<=1?.5:n/(e-1),i=(r-.5)*c*1.4,f=Math.sin(r*Math.PI*1.2)*l*.35,p=(Xn(n*7.13+2.1)*2-1)*c*.45,m=(Xn(n*11.37+5.9)*2-1)*l*.42,h=(Xn(n*3.71+1.4)*2-1)*12*a;return{x:Yn(u+i+p,Wn,o),y:Yn(d+f+m,Wn,s),rot:h}})},Qn=(e,t,n,r,i)=>{let a=Math.max(Wn,r-t-Wn-Gn),o=Math.max(Wn,i-n-Wn);e.x=Yn(e.x,Wn,a),e.y=Yn(e.y,Wn,o)},$n=({photos:e,width:t=`100%`,height:n=480,cardWidth:r=120,cardHeight:i=140,scatter:a=1,friction:o=2,showCaption:s=!0,initialIndex:u=0,onPhotoClick:d,ariaLabel:f=`冰箱磁贴照片墙`,className:p,style:m})=>{let h=(0,c.useRef)(null),g=(0,c.useRef)([]),_=(0,c.useRef)([]),v=(0,c.useRef)([]),y=(0,c.useRef)(0),b=(0,c.useRef)(null),x=(0,c.useRef)(null),S=(0,c.useRef)(null),C=(0,c.useRef)(0),w=(0,c.useRef)(-1),T=(0,c.useRef)(d),E=(0,c.useRef)(e),D=(0,c.useRef)(o),O=(0,c.useRef)({w:r,h:i}),k=(0,c.useRef)({width:0,height:0}),[A,j]=(0,c.useState)({width:0,height:0}),[M,N]=(0,c.useState)(null),P=e.length,F=Yn(a,0,2.5),I=Math.round(i*(s?1-Kn:1)),L=s&&e.some(e=>e.title||e.description);(0,c.useEffect)(()=>{T.current=d,E.current=e,D.current=o,O.current={w:r,h:i}},[d,e,o,r,i]),(0,c.useEffect)(()=>{k.current=A},[A]);let R=(0,c.useMemo)(()=>Zn(P,A.width,A.height,r,i,F),[i,r,P,F,A.height,A.width]),z=(0,c.useCallback)(e=>{let t=g.current[e],n=_.current[e],r=v.current[e]??e;if(!t||!n)return;let i=x.current===e?Un:1;t.style.zIndex=String(r),t.style.transform=`translate3d(${n.x}px, ${n.y}px, 0) rotate(${n.rot}deg) scale(${i})`},[]),B=(0,c.useCallback)(()=>{for(let e=0;e<_.current.length;e+=1)z(e)},[z]),V=(0,c.useCallback)(()=>{let{w:e,h:t}=O.current,n=k.current;_.current=R.map(e=>({x:e.x,y:e.y,rot:e.rot,vx:0,vy:0,vRot:0})),v.current=Array.from({length:P},(e,t)=>t),y.current=Math.max(P-1,0);let r=Yn(Math.floor(u),0,Math.max(0,P-1));P>0&&(y.current+=1,v.current[r]=y.current),_.current.forEach(r=>Qn(r,e,t,n.width,n.height)),w.current=P,B()},[P,u,B,R]),H=(0,c.useCallback)(()=>{let{w:e,h:t}=O.current,n=k.current;n.width<=0||n.height<=0||_.current.forEach((r,i)=>{Qn(r,e,t,n.width,n.height),z(i)})},[z]);(0,c.useEffect)(()=>{A.width<=0||A.height<=0||(w.current!==P||_.current.length!==P?V():H())},[V,H,P,A.height,A.width]),(0,c.useEffect)(()=>{let e=h.current;if(!e)return;let t=new ResizeObserver(([e])=>{let{width:t,height:n}=e.contentRect;j({width:t,height:n})});return t.observe(e),j({width:e.clientWidth,height:e.clientHeight}),()=>t.disconnect()},[]);let U=(0,c.useCallback)(()=>{S.current!==null&&(cancelAnimationFrame(S.current),S.current=null)},[]),W=(0,c.useRef)(()=>void 0);(0,c.useEffect)(()=>{W.current=e=>{let t=C.current?Math.min((e-C.current)/1e3,.032):.016;C.current=e;let{w:n,h:r}=O.current,i=k.current,a=Math.exp(-D.current*t*60),o=!1,s=_.current;for(let e=0;e<s.length;e+=1){if(x.current===e)continue;let c=s[e];c.x+=c.vx*t,c.y+=c.vy*t,c.rot+=c.vRot*t,c.vx*=a,c.vy*=a,c.vRot*=a,Qn(c,n,r,i.width,i.height),Math.abs(c.vx)>Hn||Math.abs(c.vy)>Hn||Math.abs(c.vRot)>Hn*.3?o=!0:(c.vx=0,c.vy=0,c.vRot=0),z(e)}o?S.current=requestAnimationFrame(e=>W.current(e)):S.current=null}},[z]);let G=(0,c.useCallback)(()=>{S.current===null&&(C.current=0,S.current=requestAnimationFrame(e=>W.current(e)))},[]);(0,c.useEffect)(()=>()=>U(),[U]);let K=(0,c.useCallback)(e=>{y.current+=1,v.current[e]=y.current,z(e)},[z]),q=e=>t=>{if(t.button!==0)return;let n=_.current[e];if(!n)return;let r=h.current?.getBoundingClientRect();if(!r)return;t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),K(e),x.current=e,N(e);let i=t.clientX-r.left,a=t.clientY-r.top;b.current={pointerId:t.pointerId,index:e,grabDx:i-n.x,grabDy:a-n.y,startX:t.clientX,startY:t.clientY,lastX:t.clientX,lastY:t.clientY,lastTime:t.timeStamp,moved:0,vx:0,vy:0},n.vx=0,n.vy=0,n.vRot=0,z(e)},ee=e=>{let t=b.current;if(!t||t.pointerId!==e.pointerId)return;let n=h.current?.getBoundingClientRect();if(!n)return;let r=e.clientX-t.startX,i=e.clientY-t.startY;t.moved=Math.max(t.moved,Math.hypot(r,i));let a=Math.max(e.timeStamp-t.lastTime,1)/1e3;t.vx=Yn(.65*((e.clientX-t.lastX)/a)+.35*t.vx,-1200,Vn),t.vy=Yn(.65*((e.clientY-t.lastY)/a)+.35*t.vy,-1200,Vn),t.lastX=e.clientX,t.lastY=e.clientY,t.lastTime=e.timeStamp;let o=_.current[t.index];if(!o)return;let{w:s,h:c}=O.current;o.x=e.clientX-n.left-t.grabDx,o.y=e.clientY-n.top-t.grabDy,o.rot+=t.vx*.0035,Qn(o,s,c,k.current.width,k.current.height),z(t.index)},J=e=>{let t=b.current;if(!t||t.pointerId!==e.pointerId)return;b.current=null,x.current=null,N(null),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId);let n=_.current[t.index];if(n){if(t.moved<=Bn){let e=E.current[t.index];e&&T.current?.(t.index,e),z(t.index);return}n.vx=t.vx*.5,n.vy=t.vy*.5,n.vRot=t.vx*.008,G(),z(t.index)}},te=e=>{J(e)},ne=e=>{J(e)};return(0,l.jsxs)(`div`,{className:[zn.fridge,p].filter(Boolean).join(` `),style:{width:Jn(t),height:Jn(n),...m},role:`region`,"aria-label":f,children:[(0,l.jsx)(`div`,{className:zn.handle,"aria-hidden":`true`}),(0,l.jsx)(`div`,{ref:h,className:zn.stage,children:P===0?(0,l.jsx)(`div`,{className:zn.empty,children:`暂无照片`}):e.map((e,t)=>{let n=L&&(e.title||e.description),a=zn[qn[t%qn.length]];return(0,l.jsxs)(`div`,{ref:e=>{g.current[t]=e},className:[zn.card,M===t?zn.cardDragging:``].filter(Boolean).join(` `),style:{width:r,height:i},onPointerDown:q(t),onPointerMove:ee,onPointerUp:te,onPointerCancel:ne,children:[(0,l.jsxs)(`div`,{className:zn.magnetRow,"aria-hidden":`true`,children:[(0,l.jsx)(`span`,{className:`${zn.magnet} ${a}`}),(0,l.jsx)(`span`,{className:`${zn.magnet} ${zn[qn[(t+1)%qn.length]]}`})]}),(0,l.jsx)(`div`,{className:zn.photoFrame,style:{height:I},children:(0,l.jsx)(`img`,{className:zn.image,src:e.src,alt:e.alt??e.title??``,draggable:!1})}),n?(0,l.jsxs)(`div`,{className:zn.caption,children:[e.title?(0,l.jsx)(`p`,{className:zn.title,children:e.title}):null,e.description?(0,l.jsx)(`p`,{className:zn.description,children:e.description}):null]}):null]},`${e.src}-${t}`)})})]})},er=Math.PI*2/6,tr=1.12,nr=2.05,rr=.84,ir=(e,t,n,r)=>{let{accentMat:i,trimMat:a,beadMat:o,silkMat:s}=t,c=nr,l=new u.Group;l.position.y=c/2+.16,e.add(l),l.add(new u.Mesh(new u.CylinderGeometry(.1,.14,.05,20),i));let d=new u.Mesh(new u.CylinderGeometry(.016,.02,.32,12),a);d.position.y=.2,l.add(d);let f=new u.Mesh(new u.SphereGeometry(.055,20,20),a);f.position.y=.38,l.add(f);let p=.012,m=new u.Mesh(new u.TorusGeometry(.06,p,12,36),a);m.position.y=.48,l.add(m);let h=new u.Mesh(new u.CylinderGeometry(.007,.007,.24,8),a);h.position.y=.672-p*.55,l.add(h);let g=new u.CylinderGeometry(.038,.048,.028,16),_=new u.SphereGeometry(.026,16,16);for(let t=0;t<6;t++){let r=t*er+er/2,o=n*.98*Math.sin(r),s=n*.98*Math.cos(r),l=new u.Group;l.position.set(o,c/2+.145,s);let d=new u.Mesh(g,i);d.castShadow=!0,l.add(d);let f=new u.Mesh(_,a);f.position.y=.03,f.castShadow=!0,l.add(f),e.add(l)}let v=new u.SphereGeometry(.032,14,14),y=new u.CylinderGeometry(.006,.006,.1,8),b=new u.SphereGeometry(.038,14,14),x=new u.CylinderGeometry(.01,.004,c*.4,6),S=c*.4;for(let t=0;t<6;t++){let r=t*er+er/2,i=new u.Group;i.position.set(Math.sin(r)*(n+.04),c/2-.02,Math.cos(r)*(n+.04)),i.add(new u.Mesh(v,o));let a=new u.Mesh(y,o);a.position.y=-.065,i.add(a);let l=new u.Mesh(b,s);l.position.y=-.13,i.add(l);for(let e=0;e<5;e++){let t=new u.Mesh(x,s);t.position.set((e-2)*.012,-.13-S/2,0),i.add(t)}e.add(i)}for(let t=0;t<18;t++){let n=t/18*Math.PI*2,i=new u.Mesh(new u.CylinderGeometry(.008,.003,.14+t%3*.02,6),s);i.position.set(r*.88*Math.sin(n),-c/2-.2,r*.88*Math.cos(n)),e.add(i)}},ar=e=>{let t=e;t.map?.dispose(),t.emissiveMap?.dispose(),t.alphaMap?.dispose()},or=e=>{(Array.isArray(e)?e:[e]).forEach(e=>{ar(e),e.dispose()})},sr=(e,t=new Set)=>{e.traverse(e=>{let n=e;n.isMesh&&(n.geometry?.dispose(),(Array.isArray(n.material)?n.material:[n.material]).forEach(e=>{!e||t.has(e)||(t.add(e),or(e))}))})},cr=e=>{let t=new u.Shape;for(let n=0;n<6;n++){let r=-Math.PI/6+n*er,i=Math.cos(r)*e,a=Math.sin(r)*e;n===0?t.moveTo(i,a):t.lineTo(i,a)}return t.closePath(),t},lr=(e,t,n)=>{let r=new u.Shape,i=e/2,a=t/2,o=Math.min(n,i,a);return r.moveTo(-i+o,-a),r.lineTo(i-o,-a),r.quadraticCurveTo(i,-a,i,-a+o),r.lineTo(i,a-o),r.quadraticCurveTo(i,a,i-o,a),r.lineTo(-i+o,a),r.quadraticCurveTo(-i,a,-i,a-o),r.lineTo(-i,-a+o),r.quadraticCurveTo(-i,-a,-i+o,-a),r},ur=(e,t,n,r,i,a)=>{let o=lr(e,t,n);return o.holes.push(lr(r,i,a)),o},dr=e=>new u.Color(e),fr=()=>{let e=document.createElement(`canvas`);e.width=256,e.height=256;let t=e.getContext(`2d`),n=t.createRadialGradient(256/2,256/2,8,256/2,256/2,256/2);n.addColorStop(0,`rgba(90, 48, 22, 0.32)`),n.addColorStop(.35,`rgba(90, 48, 22, 0.13)`),n.addColorStop(.7,`rgba(90, 48, 22, 0.04)`),n.addColorStop(1,`rgba(90, 48, 22, 0)`),t.fillStyle=n,t.fillRect(0,0,256,256);let r=new u.CanvasTexture(e);return r.colorSpace=u.SRGBColorSpace,r},pr=(e,t,n=512)=>{let r=document.createElement(`canvas`);r.width=n,r.height=n;let i=r.getContext(`2d`);i.fillStyle=e,i.fillRect(0,0,n,n);for(let e=0;e<56;e++){let r=(e+.5)/56*n;i.beginPath(),i.moveTo(r+Math.sin(e*.9)*10,0);for(let t=0;t<=n;t+=6)i.lineTo(r+Math.sin(t*.035+e*.7)*9+Math.sin(t*.01)*3,t);i.strokeStyle=t,i.globalAlpha=.06+e%7*.018,i.lineWidth=.8+e%4*.55,i.stroke()}for(let e=0;e<8;e++){let r=e/8*n+18;i.beginPath(),i.moveTo(r,0);for(let t=0;t<=n;t+=8)i.lineTo(r+Math.sin(t*.028+e)*14,t);i.strokeStyle=t,i.globalAlpha=.16,i.lineWidth=2.2,i.stroke()}i.globalAlpha=.045;for(let r=0;r<1800;r++)i.fillStyle=r%2==0?t:e,i.fillRect(Math.random()*n,Math.random()*n,1.2,1.2);i.globalAlpha=1;let a=new u.CanvasTexture(r);return a.colorSpace=u.SRGBColorSpace,a.wrapS=u.RepeatWrapping,a.wrapT=u.RepeatWrapping,a.needsUpdate=!0,a},mr=(e,t,n,r,i)=>{let a=pr(e,t);return a.repeat.set(n,r),a.anisotropy=i,a},hr=(e,t,n,r)=>{e.colorSpace=u.SRGBColorSpace,e.anisotropy=r,e.wrapS=u.ClampToEdgeWrapping,e.wrapT=u.ClampToEdgeWrapping,e.center.set(.5,.5),e.generateMipmaps=!0,e.minFilter=u.LinearMipmapLinearFilter,e.magFilter=u.LinearFilter;let i=e.image,a=(i?.width||1)/(i?.height||1);t===`contain`?a>n?e.repeat.set(1,n/a):e.repeat.set(a/n,1):t===`fill`?e.repeat.set(1,1):a>n?e.repeat.set(n/a,1):e.repeat.set(1,a/n)},gr=`"PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif`,_r=e=>{if(`naturalWidth`in e){let t=e;return{w:t.naturalWidth||t.width,h:t.naturalHeight||t.height}}let t=e;return{w:t.width,h:t.height}},vr=(e,t,n)=>{let{w:r,h:i}=_r(e),a=Math.max(512,r||1024),o=Math.max(512,i||1024),s=document.createElement(`canvas`);s.width=a,s.height=o;let c=s.getContext(`2d`);if(c.drawImage(e,0,0,a,o),t||n){let e=o*.3,r=c.createLinearGradient(0,o-e,0,o);r.addColorStop(0,`rgba(8, 14, 22, 0)`),r.addColorStop(.45,`rgba(8, 14, 22, 0.42)`),r.addColorStop(1,`rgba(8, 14, 22, 0.78)`),c.fillStyle=r,c.fillRect(0,o-e,a,e),c.textAlign=`center`,c.textBaseline=`bottom`;let i=a*.88,s=Math.max(22,Math.round(o*.048)),l=Math.max(16,Math.round(o*.032));t&&(c.fillStyle=`#ffffff`,c.font=`600 ${s}px ${gr}`,c.shadowColor=`rgba(0,0,0,0.45)`,c.shadowBlur=8,c.shadowOffsetY=2,c.fillText(t,a/2,n?o-o*.085:o-o*.05,i)),n&&(c.fillStyle=`rgba(255,255,255,0.88)`,c.font=`400 ${l}px ${gr}`,c.shadowColor=`rgba(0,0,0,0.35)`,c.shadowBlur=6,c.fillText(n,a/2,o-o*.038,i)),c.shadowBlur=0,c.shadowOffsetY=0}let l=new u.CanvasTexture(s);return l.colorSpace=u.SRGBColorSpace,l.needsUpdate=!0,l},yr=(e,t,n,r,i)=>new u.MeshPhysicalMaterial({color:e,map:t,metalness:0,roughness:n,clearcoat:r,clearcoatRoughness:i}),br=(e,t,n)=>{let r=mr(`#c4a07a`,`#5a3a22`,1.4,2.2,n),i=mr(`#d4b896`,`#6a4a30`,1.2,1.8,n),a=mr(`#e0c6a0`,`#7a5638`,1,2.4,n),o=a.clone();return o.repeat.set(1.6,1.6),o.anisotropy=n,{frameMat:yr(e,r,.62,.22,.55),accentMat:yr(new u.Color(e).offsetHSL(.02,-.04,.1),i,.58,.28,.5),trimMat:yr(new u.Color(e).offsetHSL(.03,-.08,.18),a,.48,.35,.4),beadMat:yr(13211226,o,.42,.4,.35),silkMat:new u.MeshPhysicalMaterial({color:t,metalness:0,roughness:.62,sheen:1,sheenRoughness:.45,sheenColor:new u.Color(t).offsetHSL(0,-.1,.25)})}},xr=e=>{e.add(new u.HemisphereLight(16774891,12888202,.72));let t=new u.DirectionalLight(16774632,.85);t.position.set(4.2,6.5,5),t.castShadow=!0,t.shadow.mapSize.set(1024,1024),t.shadow.camera.near=1,t.shadow.camera.far=20,t.shadow.camera.left=-5,t.shadow.camera.right=5,t.shadow.camera.top=5,t.shadow.camera.bottom=-5,t.shadow.radius=3,t.shadow.bias=-8e-4,e.add(t);let n=new u.DirectionalLight(15783344,.34);n.position.set(-4,2.5,-2.5),e.add(n);let r=new u.DirectionalLight(16771280,.24);r.position.set(0,3,-5),e.add(r)},Sr=(e,t,n,r)=>{let i=new u.ExtrudeGeometry(cr(e),{depth:t,bevelEnabled:!0,bevelThickness:.025,bevelSize:.02,bevelSegments:3});i.rotateX(-Math.PI/2);let a=new u.Mesh(i,r);return a.position.y=n,a.castShadow=!0,a.receiveShadow=!0,a},Cr=(e,t)=>{let n=new u.Scene;if(t.background)try{n.background=dr(t.background)}catch{n.background=null}else n.background=null;let r=new u.PerspectiveCamera(34,t.width/t.height,.1,100);r.position.set(0,1.35,6.6),r.lookAt(0,.08,0);let i=new u.WebGLRenderer({canvas:e,antialias:!0,alpha:!0,powerPreference:`high-performance`});i.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),i.setSize(t.width,t.height,!1),i.setClearColor(0,0),i.outputColorSpace=u.SRGBColorSpace,i.toneMapping=u.ACESFilmicToneMapping,i.toneMappingExposure=1.12,i.shadowMap.enabled=!0,i.shadowMap.type=u.PCFSoftShadowMap;let a=tr,o=nr,s=a*rr,c=o*rr,l=s/c,d=a/(2*Math.tan(Math.PI/6)),f=a/(2*Math.sin(Math.PI/6)),p=f*1.12,m=dr(t.frameColor),h=dr(t.paperColor),g=dr(t.lightColor),_=dr(t.tasselColor),v=new u.Group;v.rotation.x=u.MathUtils.degToRad(14),n.add(v);let y=new u.Group;v.add(y),xr(n);let b=i.capabilities.getMaxAnisotropy(),x=br(m,_,b),{frameMat:S,accentMat:C}=x,w=[],T=new u.TextureLoader,E=new u.PlaneGeometry(s,c),D=new u.ExtrudeGeometry(ur(a*.96,o*.96,.04,s+.02,c+.02,.025),{depth:.07,bevelEnabled:!0,bevelThickness:.012,bevelSize:.01,bevelSegments:2}),O=new u.ShapeGeometry(ur(s+.05,c+.05,.028,s,c,.02));for(let e=0;e<6;e++){let t=e*er,n=new u.Group;n.position.set(Math.sin(t)*d,0,Math.cos(t)*d),n.rotation.y=t;let r=new u.Mesh(D,S);r.position.z=-.01,r.castShadow=!0,r.receiveShadow=!0,n.add(r);let i=new u.Mesh(O,C);i.position.z=.02,n.add(i);let a=new u.MeshBasicMaterial({color:h,map:null,toneMapped:!1,side:u.FrontSide,transparent:!0,opacity:1}),o=new u.Mesh(E,a);o.position.z=.032,o.userData.fadeTo=1,n.add(o),w.push(o),y.add(n)}let k=new u.CylinderGeometry(.038,.042,o-.12,20),A=new u.CylinderGeometry(.052,.048,.06,20);for(let e=0;e<6;e++){let t=e*er+er/2,n=Math.sin(t)*f,r=Math.cos(t)*f,i=new u.Mesh(k,S);i.position.set(n,0,r),i.castShadow=!0,y.add(i);let a=new u.Mesh(A,C);a.position.set(n,o/2-.05,r),a.castShadow=!0,y.add(a);let s=new u.Mesh(A,C);s.position.set(n,-o/2+.05,r),s.castShadow=!0,y.add(s)}y.add(Sr(p,.1,o/2+.02,S)),y.add(Sr(p*.78,.06,o/2+.12,S)),y.add(Sr(p,.1,-o/2-.1,S)),y.add(Sr(p*.62,.12,-o/2-.24,S));let j=new u.PointLight(g,3.2,7.5,1.35);j.position.set(0,-.08,0),j.castShadow=!1,y.add(j),j.add(new u.Mesh(new u.SphereGeometry(.07,24,24),new u.MeshBasicMaterial({color:16775408})));let M=new u.Mesh(new u.SphereGeometry(.14,24,24),new u.MeshBasicMaterial({color:g,transparent:!0,opacity:.35}));j.add(M);let N=new u.Mesh(new u.SphereGeometry(.32,24,24),new u.MeshBasicMaterial({color:g,transparent:!0,opacity:.12}));j.add(N),t.showAccessories&&ir(y,x,f,d);let P=fr(),F=new u.Mesh(new u.PlaneGeometry(3.6,3.6),new u.MeshBasicMaterial({map:P,transparent:!0,depthWrite:!1,opacity:1}));F.rotation.x=-Math.PI/2,F.position.y=-o/2-.42,v.add(F);let I=t.initialAngleDeg;y.rotation.y=-u.MathUtils.degToRad(I);let L=new Map,R=new Map,z=new Map,B=0,V=!1,H=0,U=()=>{V||(V=!0,H&&=(window.clearTimeout(H),0),i.render(n,r),t.onReady?.())},W=()=>{B+=1},G=()=>{B=Math.max(0,B-1),B===0&&U()},K=(e,t,n)=>{let r=L.get(e);if(r){t(r);return}let i=z.get(e);if(i){i.resolve.push(t),i.reject.push(n);return}z.set(e,{resolve:[t],reject:[n]}),W(),T.load(e,t=>{L.set(e,t);let n=z.get(e);z.delete(e),n?.resolve.forEach(e=>e(t)),G()},void 0,()=>{let t=z.get(e);z.delete(e),t?.reject.forEach(e=>e()),G()})},q=(e,t)=>{e.map=null,e.color.copy(h),e.transparent=!0,e.opacity=1,e.needsUpdate=!0,t.userData.fadeTo=1},ee=(e,t,n,r)=>{w.forEach((i,a)=>{let o=i.material,s=e[a];if(!s?.src){q(o,i);return}let c=(e,a)=>{let c=r?s.title:void 0,u=r?s.description:void 0,d=`${s.src}::${c||``}::${u||``}::${+!!r}`,f=R.get(d);f||(r&&(c||u)&&e.image?(f=vr(e.image,c,u),R.set(d,f)):f=e),hr(f,n,l,b),o.map=f,o.color.set(t?5592405:16777215),o.transparent=!0,o.opacity=+!a,i.userData.fadeTo=1,o.needsUpdate=!0};if(L.has(s.src)){c(L.get(s.src),!1);return}o.map=null,o.color.copy(h),o.opacity=1,o.needsUpdate=!0,K(s.src,e=>c(e,V),()=>q(o,i))})};ee(t.photos,t.silhouette,t.objectFit,t.showCaption),B===0?U():H=window.setTimeout(U,1600);let J=()=>{for(let e=0;e<w.length;e++){let t=w[e],n=t.material,r=t.userData.fadeTo;if(n.opacity===r)continue;let i=n.opacity+(r-n.opacity)*.22;n.opacity=Math.abs(i-r)<.02?r:i,n.opacity>=1&&r>=1&&n.map&&(n.transparent=!1)}};return{renderer:i,setAngleDeg:e=>{I=e,y.rotation.y=-u.MathUtils.degToRad(e)},getAngleDeg:()=>I,setLightSway:(e,t)=>{let n=Math.max(0,Math.min(1,t)),r=(Math.sin(e*1.55)*.16+Math.sin(e*2.6)*.08)*n,i=(Math.cos(e*1.2)*.1+Math.sin(e*2.9)*.07)*n-.06,a=(Math.sin(e*.85)*.09+Math.cos(e*2.1)*.05)*n,o=.88+Math.sin(e*5.1)*.07*n+Math.sin(e*9.2)*.04*n;j.position.set(r,i,a),j.intensity=1.6*o,M.material.opacity=.18*o,N.material.opacity=.06*o},setSize:(e,t)=>{r.aspect=e/Math.max(t,1),r.updateProjectionMatrix(),i.setSize(e,t,!1)},updatePhotos:ee,render:()=>{J(),i.render(n,r)},dispose:()=>{H&&window.clearTimeout(H),w.forEach(e=>{let t=e.material;t.map=null}),sr(n),L.forEach(e=>e.dispose()),L.clear(),R.forEach(e=>e.dispose()),R.clear(),z.clear(),i.dispose()}}},wr=e=>{let t=(e%360+360)%360;return Math.round(t/60)%6},Tr={root:`cos-root-6stAx`,canvas:`cos-canvas-xXFVP`,canvasReady:`cos-canvasReady-3z5WA`},Er=6,Dr=720,Or=2.5,kr=90,Ar=.045,jr=360,Mr=480,Nr=e=>typeof e==`number`?`${e}px`:e,Pr=(e,t,n)=>Math.max(t,Math.min(n,e)),Fr=(e,t,n)=>{if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`){let t=e.trim();if(t.endsWith(`%`)){let e=Number.parseFloat(t);if(Number.isFinite(e))return n*e/100}let r=Number.parseFloat(t);if(Number.isFinite(r))return r}return t},Ir=e=>typeof e==`string`&&e.startsWith(`#`)?e:void 0,Lr=({photos:e,width:t=jr,height:n=Mr,autoRotate:r=!0,autoRotateSpeed:i=14,dragSensitivity:a=.42,friction:o=1.4,frameColor:s=`#5c4033`,paperColor:u=`#faf4e8`,lightColor:d=`#f0b35a`,background:f,lightSway:p=1,showAccessories:m=!0,tasselColor:h=`#c94b3a`,objectFit:g=`cover`,silhouette:_=!1,showCaption:y=!1,initialAngle:b=0,onFaceChange:x,onIndexChange:S,onPhotoClick:C,ariaLabel:w=`走马灯图片预览`,className:T,style:E})=>{let D=(0,c.useRef)(null),O=(0,c.useRef)(null),k=(0,c.useRef)(null),A=(0,c.useRef)(b),j=(0,c.useRef)(0),M=(0,c.useRef)(!1),N=(0,c.useRef)(null),P=(0,c.useRef)(0),F=(0,c.useRef)(0),I=(0,c.useRef)(!1),L=(0,c.useRef)(0),R=(0,c.useRef)(!1),z=(0,c.useRef)(wr(b)),B=(0,c.useRef)(x),V=(0,c.useRef)(S),H=(0,c.useRef)(C),U=(0,c.useRef)([]),W=(0,c.useRef)(r),G=(0,c.useRef)(i),K=(0,c.useRef)(o),q=(0,c.useRef)(p),ee=(0,c.useRef)(a),[J,te]=(0,c.useState)(()=>wr(b)),[ne,Y]=(0,c.useState)({w:jr,h:Mr}),[X,re]=(0,c.useState)(!1),ie=(0,c.useMemo)(()=>Array.from({length:6},(t,n)=>e[n]),[e]);(0,c.useEffect)(()=>{U.current=ie,B.current=x,V.current=S,H.current=C,W.current=r,G.current=i,K.current=o,q.current=p,ee.current=a},[ie,x,S,C,r,i,o,p,a]),(0,c.useEffect)(()=>{let e=D.current;if(!e)return;let r=()=>{let r=e.parentElement,i=r?.clientWidth||window.innerWidth,a=r?.clientHeight||window.innerHeight;Y({w:Fr(t,jr,i),h:Fr(n,Mr,a)})};r();let i=new ResizeObserver(r);return i.observe(e),e.parentElement&&i.observe(e.parentElement),()=>i.disconnect()},[t,n]),(0,c.useEffect)(()=>{let e=O.current;if(!e||ne.w<=0||ne.h<=0)return;let t=Cr(e,{width:ne.w,height:ne.h,photos:U.current,frameColor:s,paperColor:u,lightColor:d,tasselColor:h,showAccessories:m,showCaption:y,silhouette:_,objectFit:g||`cover`,background:Ir(f),initialAngleDeg:A.current,onReady:()=>re(!0)});return k.current=t,()=>{t.dispose(),k.current=null}},[ne.w,ne.h,s,u,d,h,m,f]),(0,c.useEffect)(()=>{k.current?.updatePhotos(ie,_,g||`cover`,y)},[ie,_,g,y]),(0,c.useEffect)(()=>{let e=v(e=>{R.current=e}),t=0,n=performance.now(),r=e=>{t=requestAnimationFrame(r);let i=k.current;if(!i||R.current){n=e;return}let a=Math.min(.05,(e-n)/1e3);if(n=e,!M.current){let e=j.current;Math.abs(e)>Or?(e*=Math.exp(-K.current*a),Math.abs(e)<=Or&&(e=0),j.current=e,A.current+=e*a,i.setAngleDeg(A.current)):W.current&&(A.current+=G.current*a,i.setAngleDeg(A.current))}let o=wr(A.current);if(o!==z.current){z.current=o,te(o);let e=U.current[o];B.current?.(o,e),e&&V.current?.(o,e)}i.setLightSway(e/1e3,q.current),i.render()};return t=requestAnimationFrame(r),()=>{cancelAnimationFrame(t),e()}},[]);let ae=(e,t)=>{if(M.current){if(M.current=!1,N.current=null,!t||e-F.current>kr){j.current=0;return}j.current=Pr(j.current,-720,Dr)}},oe=e=>{e.button===0&&(M.current=!0,I.current=!1,N.current=e.pointerId,L.current=e.clientX,P.current=e.clientX,F.current=e.timeStamp,j.current=0,e.currentTarget.setPointerCapture(e.pointerId))},se=e=>{if(!M.current||N.current!==e.pointerId)return;let t=e.clientX-P.current,n=Math.max(.008,(e.timeStamp-F.current)/1e3);Math.abs(e.clientX-L.current)>Er&&(I.current=!0);let r=ee.current;A.current-=t*r,k.current?.setAngleDeg(A.current);let i=-t/n*r,a=1-Math.exp(-n/Ar);j.current+=(i-j.current)*a,P.current=e.clientX,F.current=e.timeStamp},ce=e=>{if(N.current!==e.pointerId)return;let t=!I.current;ae(e.timeStamp,!0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}if(t){let e=U.current[z.current];e&&H.current?.(z.current,e)}},le=e=>{N.current===e.pointerId&&ae(e.timeStamp,!1)},ue=ie[J],de=y&&ue?.title?`,当前:${ue.title}${ue.description?`,${ue.description}`:``}`:``;return(0,l.jsx)(`div`,{ref:D,className:[Tr.root,T].filter(Boolean).join(` `),style:{width:Nr(t),height:Nr(n),...f===void 0?null:{background:f},...E},role:`img`,"aria-label":w+de,onPointerDown:oe,onPointerMove:se,onPointerUp:ce,onPointerCancel:le,children:(0,l.jsx)(`canvas`,{ref:O,className:[Tr.canvas,X?Tr.canvasReady:``].filter(Boolean).join(` `)})})},Rr={lightbox:`cos-lightbox-bqk2N`,stage:`cos-stage-D827Z`,table:`cos-table-mnUIm`,slot:`cos-slot-vt-ci`,slide:`cos-slide-RMjUk`,slideBehind:`cos-slideBehind-WGhIm`,slideActive:`cos-slideActive-ESL-9`,slideExiting:`cos-slideExiting-CPoNN`,slideImageWrap:`cos-slideImageWrap-NuRq7`,slideImage:`cos-slideImage--AcPS`,caption:`cos-caption-QLSVi`,captionTitle:`cos-captionTitle-a3aRv`,captionDesc:`cos-captionDesc-GQ6bR`,empty:`cos-empty-jO5QV`},zr=6,Br=260,Vr=320,Hr=e=>typeof e==`number`?`${e}px`:e,Ur=(e,t)=>t<=0?0:Math.max(0,Math.min(t-1,Math.floor(e))),Wr=({photos:e,width:t=360,height:n=480,slideWidth:r=200,slideHeight:i=280,pullThreshold:a=100,showCaption:o=!0,initialIndex:s=0,onPhotoClick:u,onIndexChange:d,ariaLabel:f=`Photo lightbox`,className:p,style:m})=>{let h=(0,c.useRef)(null),g=(0,c.useRef)(null),_=(0,c.useRef)(Ur(s,e.length)),v=(0,c.useRef)(u),y=(0,c.useRef)(d),b=(0,c.useRef)(e),x=(0,c.useRef)(null),[S,C]=(0,c.useState)(()=>Ur(s,e.length)),[w,T]=(0,c.useState)(0),[E,D]=(0,c.useState)(`idle`),O=e.length,k=e[S],A=S<O-1?e[S+1]:void 0,j=S>0,M=S<O-1;(0,c.useEffect)(()=>{v.current=u,y.current=d,b.current=e},[u,d,e]),(0,c.useEffect)(()=>{_.current=S},[S]),(0,c.useEffect)(()=>()=>{x.current!=null&&window.clearTimeout(x.current)},[]);let N=(0,c.useCallback)(e=>{let t=b.current,n=Ur(e,t.length);C(n),_.current=n;let r=t[n];r&&y.current?.(n,r)},[]),P=(0,c.useCallback)(e=>{N(e),T(0),D(`idle`)},[N]),F=(0,c.useCallback)(e=>{let t=e*(r+72);D(`exiting`),T(t),x.current!=null&&window.clearTimeout(x.current),x.current=window.setTimeout(()=>{P(Ur(_.current+e,b.current.length))},Br)},[P,r]),I=(0,c.useCallback)(()=>{D(`snapping`),T(0),window.setTimeout(()=>D(`idle`),Vr)},[]),L=(0,c.useCallback)(e=>{Ur(_.current+e,b.current.length)!==_.current&&F(e>0?1:-1)},[F]),R=(0,c.useCallback)(e=>{E===`exiting`||O===0||(g.current={pointerId:e.pointerId,startX:e.clientX,moved:!1},D(`dragging`),e.currentTarget.setPointerCapture(e.pointerId))},[O,E]),z=(0,c.useCallback)(e=>{let t=g.current;if(!t||t.pointerId!==e.pointerId||E===`exiting`)return;let n=e.clientX-t.startX;Math.abs(n)>zr&&(t.moved=!0),T(n>0&&!M||n<0&&!j?n*.28:n)},[M,j,E]),B=(0,c.useCallback)(e=>{let t=g.current;if(!t||t.pointerId!==e.pointerId||(g.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),E===`exiting`))return;let n=e.clientX-t.startX;if(!t.moved){D(`idle`),T(0);let e=b.current[_.current];e&&v.current?.(_.current,e);return}if(Math.abs(n)>=a){let e=n>0?1:-1;if(e>0&&M||e<0&&j){F(e);return}}I()},[F,M,j,E,a,I]),V=(0,c.useCallback)(e=>{let t=g.current;!t||t.pointerId!==e.pointerId||(g.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),E!==`exiting`&&I())},[E,I]);(0,c.useEffect)(()=>{let e=h.current;if(!e)return;let t=e=>{e.key===`ArrowRight`?(e.preventDefault(),L(1)):e.key===`ArrowLeft`&&(e.preventDefault(),L(-1))};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[L]);let H=Math.max(24,(typeof t==`number`?t:r+48)*.08),U=Math.max(28,(typeof n==`number`?n:i+56)*.1),W=r+H*2,G=i+U*2,K=`translate(-50%, -50%) translateX(${w}px)`,q=E===`snapping`||E===`exiting`?`transform ${E===`exiting`?Br:Vr}ms cubic-bezier(0.22, 1, 0.36, 1), opacity ${Br}ms ease`:`none`,ee=e=>!o||!e.title&&!e.description?null:(0,l.jsxs)(`div`,{className:Rr.caption,children:[e.title?(0,l.jsx)(`div`,{className:Rr.captionTitle,children:e.title}):null,e.description?(0,l.jsx)(`div`,{className:Rr.captionDesc,children:e.description}):null]}),J=(e,t,n,a,s)=>{let c=i-(o&&(e.title||e.description)?44:0);return(0,l.jsxs)(`div`,{className:[Rr.slide,n===`active`?Rr.slideActive:Rr.slideBehind,s].filter(Boolean).join(` `),style:{width:r,height:i,transform:a,transition:q,opacity:n===`active`&&E===`exiting`?.35:void 0},onPointerDown:n===`active`?R:void 0,onPointerMove:n===`active`?z:void 0,onPointerUp:n===`active`?B:void 0,onPointerCancel:n===`active`?V:void 0,role:n===`active`?`button`:void 0,"aria-label":n===`active`?e.alt||e.title||`Slide ${t+1} of ${O}`:void 0,children:[(0,l.jsx)(`div`,{className:Rr.slideImageWrap,style:{height:c},children:(0,l.jsx)(`img`,{className:Rr.slideImage,src:e.src,alt:e.alt||e.title||``,draggable:!1})}),ee(e)]})};return(0,l.jsx)(`div`,{ref:h,className:[Rr.lightbox,p].filter(Boolean).join(` `),style:{width:Hr(t),height:Hr(n),...m},role:`region`,"aria-label":f,tabIndex:0,children:(0,l.jsx)(`div`,{className:Rr.stage,children:O===0?(0,l.jsx)(`div`,{className:Rr.empty,children:`No photos`}):(0,l.jsx)(`div`,{className:Rr.table,style:{width:W,height:G},children:(0,l.jsxs)(`div`,{className:Rr.slot,style:{width:r,height:i},children:[A?J(A,S+1,`behind`,`translate(-50%, calc(-50% + 14px)) scale(0.94)`):null,k?J(k,S,`active`,K,E===`exiting`?Rr.slideExiting:void 0):null]})})})})},Gr={polaroid:`cos-polaroid-ouSvd`,stage:`cos-stage-VPNlO`,card:`cos-card-J8utI`,cardDragging:`cos-cardDragging-0Gy8K`,imageWrap:`cos-imageWrap-vGQwm`,image:`cos-image-gNSgv`,caption:`cos-caption-Bewfy`,title:`cos-title-eUY1D`,description:`cos-description-dFhlF`,empty:`cos-empty-Zk3rN`},Kr=6,qr=1400,Jr=.12,Yr=.86,Xr=.88,Zr=1.04,Qr=.22,$r=e=>typeof e==`number`?`${e}px`:e,ei=(e,t,n)=>Math.min(n,Math.max(t,e)),ti=e=>{let t=Math.sin(e*127.1+31.7)*43758.5453;return t-Math.floor(t)},ni=(e,t,n,r,i,a)=>{if(e<=0||t<=0||n<=0)return[];let o=Math.max(0,t-r)*.38*a,s=Math.max(0,n-i)*.28*a,c=t*.5-r*.5,l=n*.5-i*.5;return Array.from({length:e},(t,n)=>{let r=e<=1?.5:n/(e-1),i=Math.sin(r*Math.PI)*s*.28,u=(r-.5)*o*1.65,d=(ti(n*7.13+2.1)*2-1)*o*.42,f=(ti(n*11.37+5.9)*2-1)*s*.38,p=(ti(n*3.71+1.4)*2-1)*14*a;return{restX:c+u+d,restY:l-i+f,restRot:p}})},ri=({photos:e,width:t=`100%`,height:n=420,cardWidth:r=150,cardHeight:i=180,scatter:a=1,showCaption:o=!0,initialIndex:s=0,onPhotoClick:u,ariaLabel:d=`拍立得照片堆叠`,className:f,style:p})=>{let m=(0,c.useRef)(null),h=(0,c.useRef)([]),g=(0,c.useRef)([]),_=(0,c.useRef)([]),v=(0,c.useRef)([]),y=(0,c.useRef)(0),b=(0,c.useRef)(null),x=(0,c.useRef)(null),S=(0,c.useRef)(null),C=(0,c.useRef)(0),w=(0,c.useRef)(u),T=(0,c.useRef)(e),[E,D]=(0,c.useState)({width:0,height:0}),[O,k]=(0,c.useState)(null),A=e.length,j=ei(a,0,2.5),M=Math.round(i*(1-Qr)),N=o&&e.some(e=>e.title||e.description);(0,c.useEffect)(()=>{w.current=u,T.current=e},[u,e]);let P=(0,c.useMemo)(()=>ni(A,E.width,E.height,r,i,j),[i,r,A,j,E.height,E.width]),F=(0,c.useCallback)(e=>{let t=h.current[e],n=_.current[e],r=v.current[e]??e;if(!t||!n)return;let i=x.current===e?Zr:1;t.style.zIndex=String(r),t.style.transform=`translate3d(${n.x}px, ${n.y}px, 0) rotate(${n.rot}deg) scale(${i})`},[]),I=(0,c.useCallback)(()=>{for(let e=0;e<_.current.length;e+=1)F(e)},[F]),L=(0,c.useCallback)(()=>{g.current=P,_.current=P.map(e=>({x:e.restX,y:e.restY,rot:e.restRot,vx:0,vy:0,vRot:0})),v.current=Array.from({length:A},(e,t)=>t),y.current=Math.max(A-1,0);let e=ei(Math.floor(s),0,Math.max(0,A-1));A>0&&(y.current+=1,v.current[e]=y.current),I()},[A,s,I,P]);(0,c.useEffect)(()=>{L()},[L]),(0,c.useEffect)(()=>{let e=m.current;if(!e)return;let t=new ResizeObserver(([e])=>{let{width:t,height:n}=e.contentRect;D({width:t,height:n})});return t.observe(e),D({width:e.clientWidth,height:e.clientHeight}),()=>t.disconnect()},[]);let R=(0,c.useCallback)(()=>{S.current!==null&&(cancelAnimationFrame(S.current),S.current=null)},[]),z=(0,c.useRef)(()=>void 0);(0,c.useEffect)(()=>{z.current=e=>{let t=C.current?Math.min((e-C.current)/1e3,.032):.016;C.current=e;let n=!1,r=_.current;for(let e=0;e<r.length;e+=1){if(x.current===e)continue;let i=r[e];i.x+=i.vx*t,i.y+=i.vy*t,i.rot+=i.vRot*t;let a=Yr**(t*60),o=Xr**(t*60);i.vx*=a,i.vy*=a,i.vRot*=o,Math.abs(i.vx)>Jr||Math.abs(i.vy)>Jr||Math.abs(i.vRot)>Jr*.35?n=!0:(i.vx=0,i.vy=0,i.vRot=0),F(e)}n?S.current=requestAnimationFrame(e=>z.current(e)):S.current=null}},[F]);let B=(0,c.useCallback)(()=>{S.current===null&&(C.current=0,S.current=requestAnimationFrame(e=>z.current(e)))},[]);(0,c.useEffect)(()=>()=>R(),[R]);let V=(0,c.useCallback)(e=>{y.current+=1,v.current[e]=y.current,F(e)},[F]),H=e=>t=>{if(t.button!==0)return;let n=_.current[e];if(!n)return;let r=m.current?.getBoundingClientRect();if(!r)return;t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),V(e),x.current=e,k(e);let i=t.clientX-r.left,a=t.clientY-r.top;b.current={pointerId:t.pointerId,index:e,grabDx:i-n.x,grabDy:a-n.y,startX:t.clientX,startY:t.clientY,lastX:t.clientX,lastY:t.clientY,lastTime:t.timeStamp,moved:0,vx:0,vy:0},n.vx=0,n.vy=0,n.vRot=0,F(e)},U=e=>{let t=b.current;if(!t||t.pointerId!==e.pointerId)return;let n=m.current?.getBoundingClientRect();if(!n)return;let r=e.clientX-t.startX,i=e.clientY-t.startY;t.moved=Math.max(t.moved,Math.hypot(r,i));let a=Math.max(e.timeStamp-t.lastTime,1)/1e3;t.vx=ei(.65*((e.clientX-t.lastX)/a)+.35*t.vx,-1400,qr),t.vy=ei(.65*((e.clientY-t.lastY)/a)+.35*t.vy,-1400,qr),t.lastX=e.clientX,t.lastY=e.clientY,t.lastTime=e.timeStamp;let o=_.current[t.index];o&&(o.x=e.clientX-n.left-t.grabDx,o.y=e.clientY-n.top-t.grabDy,o.rot+=t.vx*.0045,F(t.index))},W=e=>{let t=b.current;if(!t||t.pointerId!==e.pointerId)return;b.current=null,x.current=null,k(null),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId);let n=_.current[t.index];if(n){if(t.moved<=Kr){let e=T.current[t.index];e&&w.current?.(t.index,e),F(t.index);return}n.vx=t.vx*.55,n.vy=t.vy*.55,n.vRot=t.vx*.012,B(),F(t.index)}},G=e=>{W(e)},K=e=>{W(e)};return(0,l.jsx)(`div`,{className:[Gr.polaroid,f].filter(Boolean).join(` `),style:{width:$r(t),height:$r(n),...p},role:`region`,"aria-label":d,children:(0,l.jsx)(`div`,{ref:m,className:Gr.stage,children:A===0?(0,l.jsx)(`div`,{className:Gr.empty,children:`暂无照片`}):e.map((e,t)=>{let n=N&&(e.title||e.description);return(0,l.jsxs)(`div`,{ref:e=>{h.current[t]=e},className:[Gr.card,O===t?Gr.cardDragging:``].filter(Boolean).join(` `),style:{width:r,height:i},onPointerDown:H(t),onPointerMove:U,onPointerUp:G,onPointerCancel:K,children:[(0,l.jsx)(`div`,{className:Gr.imageWrap,style:{height:M},children:(0,l.jsx)(`img`,{className:Gr.image,src:e.src,alt:e.alt??e.title??``,draggable:!1})}),n?(0,l.jsxs)(`div`,{className:Gr.caption,children:[e.title?(0,l.jsx)(`p`,{className:Gr.title,children:e.title}):null,e.description?(0,l.jsx)(`p`,{className:Gr.description,children:e.description}):null]}):null]},`${e.src}-${t}`)})})})},Q={postcard:`cos-postcard-g2207`,stage:`cos-stage-jZQ8g`,stack:`cos-stack-fblvy`,stackCard:`cos-stackCard-vGX-D`,cardSlot:`cos-cardSlot-r9iP9`,cardActive:`cos-cardActive-oxk4p`,cardExiting:`cos-cardExiting-PLlYP`,flipInner:`cos-flipInner--e4Ib`,flipped:`cos-flipped-IIL2I`,face:`cos-face-5lB6h`,front:`cos-front-C--cv`,back:`cos-back-3zraM`,photoFrame:`cos-photoFrame-HWolG`,photoFrameWithCaption:`cos-photoFrameWithCaption-4crS0`,photoWrap:`cos-photoWrap-WK92L`,photo:`cos-photo-bdRgi`,cornerStamp:`cos-cornerStamp-Xq-fF`,frontCaption:`cos-frontCaption-w8czv`,frontCaptionTitle:`cos-frontCaptionTitle-rVeaq`,frontCaptionDesc:`cos-frontCaptionDesc-i7PGX`,linedPaper:`cos-linedPaper-iYgmF`,greeting:`cos-greeting-MkrH1`,bodyText:`cos-bodyText-2YX8O`,bodyPlaceholder:`cos-bodyPlaceholder-qovIN`,backFooter:`cos-backFooter-3Dn0w`,stampSquare:`cos-stampSquare-fGd3a`,postmark:`cos-postmark-1FaXp`,postmarkText:`cos-postmarkText-1Ewtv`,divider:`cos-divider-Wgj-N`,empty:`cos-empty-Ys5A1`,hint:`cos-hint-JGozg`},ii=6,ai=280,oi=320,si=e=>typeof e==`number`?`${e}px`:e,ci=(e,t)=>t<=0?0:(e%t+t)%t,li=(e,t)=>t<=0?0:Math.max(0,Math.min(t-1,Math.floor(e))),ui=e=>{let t=Math.sin(e*127.1+31.7)*43758.5453;return t-Math.floor(t)},di=({photo:e,showCaption:t})=>{let n=t&&(e.title||e.description),r=e.title?e.title:`Greetings from the road`;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`${Q.face} ${Q.front}`,children:[(0,l.jsx)(`div`,{className:`${Q.photoFrame} ${n?Q.photoFrameWithCaption:``}`,children:(0,l.jsx)(`div`,{className:Q.photoWrap,children:(0,l.jsx)(`img`,{className:Q.photo,src:e.src,alt:e.alt??e.title??``,draggable:!1})})}),(0,l.jsx)(`div`,{className:Q.cornerStamp,"aria-hidden":`true`}),n?(0,l.jsxs)(`div`,{className:Q.frontCaption,children:[e.title?(0,l.jsx)(`p`,{className:Q.frontCaptionTitle,children:e.title}):null,e.description?(0,l.jsx)(`p`,{className:Q.frontCaptionDesc,children:e.description}):null]}):null]}),(0,l.jsxs)(`div`,{className:`${Q.face} ${Q.back}`,children:[(0,l.jsx)(`div`,{className:Q.divider,"aria-hidden":`true`}),(0,l.jsxs)(`div`,{className:Q.linedPaper,children:[(0,l.jsx)(`p`,{className:Q.greeting,children:r}),e.description?(0,l.jsx)(`p`,{className:Q.bodyText,children:e.description}):(0,l.jsx)(`p`,{className:Q.bodyPlaceholder,children:`Wish you were here…`})]}),(0,l.jsxs)(`div`,{className:Q.backFooter,children:[(0,l.jsx)(`div`,{className:Q.postmark,"aria-hidden":`true`,children:(0,l.jsxs)(`span`,{className:Q.postmarkText,children:[`TRAVEL`,(0,l.jsx)(`br`,{}),`POST`]})}),(0,l.jsx)(`div`,{className:Q.stampSquare,"aria-hidden":`true`})]})]})]})},fi=({photos:e,width:t=360,height:n=420,cardWidth:r=260,cardHeight:i=170,pullThreshold:a=80,showCaption:o=!0,initialIndex:s=0,initialFlipped:u=!1,onPhotoClick:d,onIndexChange:f,onFlipChange:p,ariaLabel:m=`明信片`,className:h,style:g})=>{let _=(0,c.useRef)(null),v=(0,c.useRef)(null),y=(0,c.useRef)(li(s,e.length)),b=(0,c.useRef)(d),x=(0,c.useRef)(f),S=(0,c.useRef)(p),C=(0,c.useRef)(e),w=(0,c.useRef)(null),[T,E]=(0,c.useState)(()=>li(s,e.length)),[D,O]=(0,c.useState)(u),[k,A]=(0,c.useState)(0),[j,M]=(0,c.useState)(`idle`),N=e.length,P=e[T];(0,c.useEffect)(()=>{b.current=d,x.current=f,S.current=p,C.current=e},[d,f,p,e]),(0,c.useEffect)(()=>{y.current=T},[T]),(0,c.useEffect)(()=>()=>{w.current!=null&&window.clearTimeout(w.current)},[]);let F=(0,c.useMemo)(()=>N<=1?[]:[1,2].slice(0,Math.min(2,N-1)).map(e=>{let t=T*13.7+e*5.3;return{depth:e,rot:(ui(t)*2-1)*5.5,dx:e*5+ui(t+1.1)*4,dy:e*3+ui(t+2.4)*3}}),[N,T]),I=(0,c.useCallback)(e=>{let t=C.current,n=li(e,t.length);E(n),y.current=n,O(!1),S.current?.(!1);let r=t[n];r&&x.current?.(n,r)},[]),L=(0,c.useCallback)(e=>{I(e),A(0),M(`idle`)},[I]),R=(0,c.useCallback)(e=>{let t=e*(r*.55+48);M(`exiting`),A(t),w.current!=null&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>{let t=C.current;L(ci(y.current+e,t.length))},ai)},[r,L]),z=(0,c.useCallback)(()=>{M(`snapping`),A(0),window.setTimeout(()=>M(`idle`),oi)},[]),B=(0,c.useCallback)(e=>{C.current.length<=1||R(e>0?1:-1)},[R]),V=(0,c.useCallback)(()=>{O(e=>{let t=!e;return S.current?.(t),t})},[]),H=(0,c.useCallback)(e=>{j===`exiting`||N===0||(v.current={pointerId:e.pointerId,startX:e.clientX,moved:!1},M(`dragging`),e.currentTarget.setPointerCapture(e.pointerId))},[N,j]),U=(0,c.useCallback)(e=>{let t=v.current;if(!t||t.pointerId!==e.pointerId||j===`exiting`)return;let n=e.clientX-t.startX;Math.abs(n)>ii&&(t.moved=!0),A(N<=1?n*.22:n)},[N,j]),W=(0,c.useCallback)(e=>{let t=v.current;if(!t||t.pointerId!==e.pointerId||(v.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),j===`exiting`))return;let n=e.clientX-t.startX;if(!t.moved){M(`idle`),A(0),V();let e=C.current[y.current];e&&b.current?.(y.current,e);return}if(Math.abs(n)>=a&&N>1){R(n>0?1:-1);return}z()},[R,N,j,a,z,V]),G=(0,c.useCallback)(e=>{let t=v.current;!t||t.pointerId!==e.pointerId||(v.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),j!==`exiting`&&z())},[j,z]);(0,c.useEffect)(()=>{let e=_.current;if(!e)return;let t=e=>{e.key===`ArrowRight`?(e.preventDefault(),B(1)):e.key===`ArrowLeft`?(e.preventDefault(),B(-1)):(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),V())};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[B,V]);let K=`translateX(${k}px)`,q=j===`snapping`||j===`exiting`?`transform ${j===`exiting`?ai:oi}ms cubic-bezier(0.22, 1, 0.36, 1), opacity ${ai}ms ease`:`none`,ee=[Q.postcard,h].filter(Boolean).join(` `),J=[Q.cardActive,D?Q.flipped:``,j===`exiting`?Q.cardExiting:``].filter(Boolean).join(` `);return(0,l.jsx)(`div`,{ref:_,className:ee,style:{width:si(t),height:si(n),...g},role:`region`,"aria-label":m,tabIndex:0,children:(0,l.jsx)(`div`,{className:Q.stage,children:N===0?(0,l.jsx)(`div`,{className:Q.empty,children:`暂无明信片`}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:Q.stack,style:{width:r,height:i},children:[F.map(({depth:e,rot:t,dx:n,dy:a})=>(0,l.jsx)(`div`,{className:Q.stackCard,style:{width:r,height:i,transform:`translate(calc(-50% + ${n}px), calc(-50% + ${a}px)) rotate(${t}deg)`,opacity:e===1?.92:.78},"aria-hidden":`true`},e)),(0,l.jsx)(`div`,{className:Q.cardSlot,style:{width:r,height:i},children:(0,l.jsx)(`div`,{className:J,style:{width:r,height:i,transform:K,transition:q,opacity:j===`exiting`?.55:1},onPointerDown:H,onPointerMove:U,onPointerUp:W,onPointerCancel:G,role:`button`,"aria-label":P?`${D?`背面`:`正面`}:${P.alt??P.title??`明信片 ${T+1}`}`:void 0,"aria-pressed":D,children:P?(0,l.jsx)(`div`,{className:Q.flipInner,children:(0,l.jsx)(di,{photo:P,showCaption:o})}):null})})]}),N>1?(0,l.jsx)(`div`,{className:Q.hint,children:`拖拽切换 · 点击查看背面`}):null]})})})},pi={root:`cos-root-2T188`,stage:`cos-stage-C0Wkx`,floatWrap:`cos-floatWrap-XWQUl`,cube:`cos-cube-TPTSs`,face:`cos-face-Am85d`,front:`cos-front-QMqKk`,back:`cos-back-AXzOG`,right:`cos-right-m-nHP`,left:`cos-left-2UKCq`,top:`cos-top-9GHQa`,bottom:`cos-bottom-HI67S`,photo:`cos-photo-CbyrW`,placeholder:`cos-placeholder-i9IG0`,caption:`cos-caption-LkGpj`,glow:`cos-glow-1fpVK`},mi=6,hi=6,gi=640,_i=2.2,vi=90,yi=.045,bi=7.5,xi=5,Si=4.8,Ci=(e,t,n)=>Math.max(t,Math.min(n,e)),wi=380,Ti=380,Ei=200,Di=e=>typeof e==`number`?`${e}px`:e,Oi=[`front`,`back`,`right`,`left`,`top`,`bottom`],ki=e=>{let t=(e%360+360)%360;return t>180&&(t-=360),t},Ai=(e,t)=>{let n=ki(e),r=(t%360+360)%360;return n>45?4:n<-45?5:r>=315||r<45?0:r>=45&&r<135?2:r>=135&&r<225?1:3},ji=({photos:e,width:t=wi,height:n=Ti,size:r=Ei,autoRotate:i=!0,dragSensitivity:a=.4,friction:o=1.35,showCaption:s=!0,onPhotoClick:u,ariaLabel:d=`照片棱镜`,className:f,style:p})=>{let m=(0,c.useRef)(null),h=(0,c.useRef)(null),g=(0,c.useRef)(null),_=(0,c.useRef)(-12),y=(0,c.useRef)(-28),b=(0,c.useRef)(0),x=(0,c.useRef)(0),S=(0,c.useRef)(!1),C=(0,c.useRef)(null),w=(0,c.useRef)(0),T=(0,c.useRef)(0),E=(0,c.useRef)(0),D=(0,c.useRef)(!1),O=(0,c.useRef)(0),k=(0,c.useRef)(0),A=(0,c.useRef)(!1),j=(0,c.useRef)(Ai(-12,-28)),M=(0,c.useRef)(u),N=(0,c.useRef)([]),P=(0,c.useRef)(i),F=(0,c.useRef)(o),I=(0,c.useRef)(a),[L,R]=(0,c.useState)(()=>Ai(-12,-28)),z=(0,c.useMemo)(()=>Array.from({length:mi},(t,n)=>e[n]),[e]);(0,c.useEffect)(()=>{N.current=z,M.current=u,P.current=i,F.current=o,I.current=a},[z,u,i,o,a]),(0,c.useEffect)(()=>{let e=v(e=>{A.current=e}),t=0,n=performance.now(),r=0,i=e=>{let t=h.current,n=g.current;if(!t||!n)return;t.style.transform=`rotateX(${_.current}deg) rotateY(${y.current}deg)`,n.style.transform=`translateY(${e}px)`;let r=Ai(_.current,y.current);r!==j.current&&(j.current=r,R(r))},a=e=>{if(t=requestAnimationFrame(a),A.current){n=e;return}let o=Math.min(.05,(e-n)/1e3);if(n=e,r+=o,!S.current){let e=b.current,t=x.current;if(Math.abs(e)>_i||Math.abs(t)>_i){let n=Math.exp(-F.current*o);e*=n,t*=n,Math.abs(e)<=_i&&(e=0),Math.abs(t)<=_i&&(t=0),b.current=e,x.current=t,_.current+=t*o,y.current+=e*o}else P.current&&(y.current+=bi*o)}i(S.current||Math.abs(b.current)>_i||Math.abs(x.current)>_i?0:Math.sin(r/Si*Math.PI*2)*xi)};return t=requestAnimationFrame(a),i(0),()=>{cancelAnimationFrame(t),e()}},[]);let B=(e,t)=>{if(S.current){if(S.current=!1,C.current=null,!t||e-E.current>vi){b.current=0,x.current=0;return}b.current=Ci(b.current,-640,gi),x.current=Ci(x.current,-640,gi)}},V=e=>{e.button===0&&(S.current=!0,D.current=!1,C.current=e.pointerId,O.current=e.clientX,k.current=e.clientY,w.current=e.clientX,T.current=e.clientY,E.current=e.timeStamp,b.current=0,x.current=0,e.currentTarget.setPointerCapture(e.pointerId))},H=e=>{if(!S.current||C.current!==e.pointerId)return;let t=e.clientX-w.current,n=e.clientY-T.current,r=Math.max(.008,(e.timeStamp-E.current)/1e3);Math.hypot(e.clientX-O.current,e.clientY-k.current)>hi&&(D.current=!0);let i=I.current;y.current-=t*i,_.current-=n*i;let a=-t/r*i,o=-n/r*i,s=1-Math.exp(-r/yi);b.current+=(a-b.current)*s,x.current+=(o-x.current)*s,w.current=e.clientX,T.current=e.clientY,E.current=e.timeStamp;let c=h.current;c&&(c.style.transform=`rotateX(${_.current}deg) rotateY(${y.current}deg)`);let l=Ai(_.current,y.current);l!==j.current&&(j.current=l,R(l))},U=e=>{if(C.current!==e.pointerId)return;let t=!D.current;B(e.timeStamp,!0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}if(t){let t=e.target?.closest?.(`[data-face-index]`),n=t?Number(t.dataset.faceIndex):j.current,r=Number.isFinite(n)?n:j.current,i=N.current[r];i&&M.current?.(r,i)}},W=e=>{C.current===e.pointerId&&B(e.timeStamp,!1)},G=z[L],K=s&&G?.title?`,当前:${G.title}${G.description?`,${G.description}`:``}`:``;return(0,l.jsxs)(`div`,{ref:m,className:[pi.root,f].filter(Boolean).join(` `),style:{width:Di(t),height:Di(n),"--prism-size":`${r}px`,...p},role:`img`,"aria-label":d+K,onPointerDown:V,onPointerMove:H,onPointerUp:U,onPointerCancel:W,children:[(0,l.jsx)(`div`,{className:pi.glow,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:pi.stage,children:(0,l.jsx)(`div`,{ref:g,className:pi.floatWrap,children:(0,l.jsx)(`div`,{ref:h,className:pi.cube,children:Oi.map((e,t)=>{let n=z[t],r=s&&n&&(n.title||n.description);return(0,l.jsxs)(`div`,{className:[pi.face,pi[e]].join(` `),"data-face-index":t,children:[n?(0,l.jsx)(`img`,{className:pi.photo,src:n.src,alt:n.alt??n.title??`Photo ${t+1}`,draggable:!1}):(0,l.jsx)(`div`,{className:pi.placeholder,"aria-hidden":`true`}),r?(0,l.jsxs)(`div`,{className:pi.caption,children:[n?.title?(0,l.jsx)(`strong`,{children:n.title}):null,n?.description?(0,l.jsx)(`span`,{children:n.description}):null]}):null]},e)})})})})]})},Mi={scroll:`cos-scroll-8mfVT`,roller:`cos-roller-m5TKG`,rollerLeft:`cos-rollerLeft-5C7e9`,rollerRight:`cos-rollerRight-qKsHt`,center:`cos-center-TvM9I`,paperViewport:`cos-paperViewport-gDTEb`,paper:`cos-paper-gG1pz`,paperSurface:`cos-paperSurface-c0iGA`,frameCell:`cos-frameCell-GIuyW`,frame:`cos-frame-Rpb6t`,caption:`cos-caption-n6kN6`,empty:`cos-empty--2nS5`},Ni=6,Pi=.045,Fi=90,Ii=8,Li=2600,Ri=14,zi=e=>typeof e==`number`?`${e}px`:e,Bi=(e,t,n)=>Math.min(n,Math.max(t,e)),Vi=({photos:e,width:t=520,height:n=280,frameWidth:r=160,frameHeight:i=200,frameGap:a=20,dragSensitivity:o=1,friction:s=1.5,showCaption:u=!0,initialIndex:d=0,onPhotoClick:f,onIndexChange:p,ariaLabel:m=`卷轴照片`,className:h,style:g})=>{let _=(0,c.useRef)(null),y=(0,c.useRef)(null),b=(0,c.useRef)({offset:0,velocity:0,drag:null,snapTarget:null}),x=(0,c.useRef)(null),S=(0,c.useRef)(0),C=(0,c.useRef)(!1),w=(0,c.useRef)(0),T=(0,c.useRef)(!1),E=(0,c.useRef)(d),D=(0,c.useRef)(f),O=(0,c.useRef)(p),k=(0,c.useRef)(e),A=(0,c.useRef)(s),j=(0,c.useRef)(o),[M,N]=(0,c.useState)(0),[P,F]=(0,c.useState)(d),I=e.length,L=r+a;(0,c.useEffect)(()=>{D.current=f,O.current=p,k.current=e,A.current=s,j.current=o},[o,s,p,f,e]);let R=(0,c.useMemo)(()=>M>0?M/2-r/2:0,[r,M]),z=(0,c.useMemo)(()=>I<=0?0:R*2+I*r+Math.max(0,I-1)*a,[I,a,r,R]),B=(0,c.useCallback)(e=>{if(M<=0||I<=0)return 0;let t=R+Bi(Math.floor(e),0,I-1)*L+r/2;return M/2-t},[I,L,r,R,M]),V=(0,c.useCallback)(e=>{if(I<=0||M<=0)return 0;let t=(M/2-e-R-r/2)/L;return Bi(Math.round(t),0,I-1)},[I,L,r,R,M]),H=(0,c.useCallback)(()=>I<=0?{min:0,max:0}:{min:B(I-1),max:B(0)},[I,B]),U=(0,c.useCallback)(e=>{let t=y.current;t&&(t.style.transform=`translate3d(${e}px, 0, 0)`)},[]),W=(0,c.useCallback)(e=>{if(e===w.current)return;w.current=e,F(e);let t=k.current[e];t&&O.current?.(e,t)},[]),G=(0,c.useCallback)(()=>{x.current!==null&&(window.cancelAnimationFrame(x.current),x.current=null),S.current=0},[]),K=(0,c.useCallback)(()=>{if(x.current!==null||typeof window>`u`)return;let e=t=>{if(x.current=null,C.current)return;let n=S.current||t;S.current=t;let r=Math.min(.05,(t-n)/1e3),i=b.current,{min:a,max:o}=H(),s=!1;if(i.drag)U(i.offset),s=!0;else if(i.snapTarget!==null){let e=i.snapTarget-i.offset;Math.abs(e)<=.35?(i.offset=i.snapTarget,i.snapTarget=null,i.velocity=0,W(V(i.offset)),U(i.offset)):(i.offset+=e*Math.min(1,Ri*r),i.velocity=0,U(i.offset),s=!0)}else{let e=i.velocity;if(Math.abs(e)>Ii)e*=Math.exp(-A.current*r),Math.abs(e)<=Ii&&(e=0),i.velocity=e,i.offset+=e*r,(i.offset<a||i.offset>o)&&(i.offset=Bi(i.offset,a,o),i.velocity=0),U(i.offset),s=!0;else{i.velocity=0;let e=B(V(i.offset));Math.abs(i.offset-e)>.35?(i.snapTarget=e,s=!0):(i.offset=e,W(V(i.offset)),U(i.offset))}}s?x.current=window.requestAnimationFrame(e):S.current=0};x.current=window.requestAnimationFrame(e)},[U,V,W,H,B]);(0,c.useEffect)(()=>v(e=>{C.current=e,e||K()}),[K]),(0,c.useEffect)(()=>{let e=_.current;if(!e)return;let t=e=>{N(t=>t===e?t:e)};if(t(e.clientWidth),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(e=>{let n=e[0];n&&t(Math.round(n.contentRect.width))});return n.observe(e),()=>n.disconnect()},[]),(0,c.useEffect)(()=>{if(M<=0||I<=0)return;let e=b.current;if(!T.current){T.current=!0,E.current=d,e.offset=B(d),e.velocity=0,e.snapTarget=null,e.drag=null,w.current=Bi(d,0,I-1),F(w.current),U(e.offset);return}if(E.current!==d){E.current=d,e.velocity=0,e.drag=null,e.snapTarget=B(d),K();return}let{min:t,max:n}=H();e.offset=Bi(e.offset,t,n),U(e.offset)},[U,I,d,H,B,K,M]),(0,c.useEffect)(()=>()=>{G()},[G]);let q=(0,c.useCallback)(e=>{let t=b.current,n=t.drag;if(!(!n||n.pointerId!==e.pointerId)){if(t.drag=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),e.timeStamp-n.lastMoveTime>Fi?t.velocity=0:t.velocity=Bi(n.vx*j.current,-2600,Li),t.snapTarget=null,n.moved<=Ni){t.velocity=0;let e=V(t.offset),n=k.current[e];n&&D.current?.(e,n),t.snapTarget=B(e)}K()}},[V,B,K]),ee=(0,c.useCallback)(e=>{if(e.button!==0&&e.pointerType===`mouse`||I<=0)return;let t=e.timeStamp,n=b.current;n.drag={pointerId:e.pointerId,startX:e.clientX,startOffset:n.offset,lastX:e.clientX,lastTime:t,lastMoveTime:t,vx:0,moved:0},n.velocity=0,n.snapTarget=null,e.currentTarget.setPointerCapture(e.pointerId),K()},[I,K]),J=(0,c.useCallback)(e=>{let t=b.current,n=t.drag;if(!n||n.pointerId!==e.pointerId)return;let r=e.clientX-n.startX;n.moved=Math.max(n.moved,Math.abs(r)),n.lastMoveTime=e.timeStamp;let i=Math.max(e.timeStamp-n.lastTime,1)/1e3,a=(e.clientX-n.lastX)/i,o=1-Math.exp(-i/Pi);n.vx=o*a+(1-o)*n.vx,n.lastX=e.clientX,n.lastTime=e.timeStamp;let{min:s,max:c}=H();t.offset=Bi(n.startOffset+r*j.current,s,c),U(t.offset),W(V(t.offset)),K()},[U,V,W,H,K]),te=(0,c.useCallback)(e=>{q(e)},[q]),ne=(0,c.useCallback)(e=>{q(e)},[q]),Y=(0,c.useCallback)(e=>{if(I<=0||e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=b.current,n=e.key===`ArrowLeft`?L:-L,{min:r,max:i}=H(),a=t.snapTarget??t.offset;t.velocity=0,t.drag=null,t.snapTarget=Bi(a+n,r,i),K()},[I,L,H,K]),X=e[P],re=u&&X?.title?`,当前:${X.title}${X.description?`,${X.description}`:``}`:``;return I===0?(0,l.jsxs)(`div`,{className:[Mi.scroll,h].filter(Boolean).join(` `),style:{width:zi(t),height:zi(n),...g},role:`img`,"aria-label":m,children:[(0,l.jsx)(`div`,{className:[Mi.roller,Mi.rollerLeft].join(` `),"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:Mi.center,children:(0,l.jsx)(`div`,{className:Mi.empty,children:`暂无照片`})}),(0,l.jsx)(`div`,{className:[Mi.roller,Mi.rollerRight].join(` `),"aria-hidden":`true`})]}):(0,l.jsxs)(`div`,{className:[Mi.scroll,h].filter(Boolean).join(` `),style:{width:zi(t),height:zi(n),...g},role:`region`,"aria-label":m+re,tabIndex:0,onKeyDown:Y,children:[(0,l.jsx)(`div`,{className:[Mi.roller,Mi.rollerLeft].join(` `),"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:Mi.center,children:(0,l.jsx)(`div`,{ref:_,className:Mi.paperViewport,onPointerDown:ee,onPointerMove:J,onPointerUp:te,onPointerCancel:ne,children:(0,l.jsx)(`div`,{ref:y,className:Mi.paper,style:{minWidth:z,boxSizing:`border-box`},children:(0,l.jsx)(`div`,{className:Mi.paperSurface,style:{paddingLeft:R,paddingRight:R,minWidth:z},children:e.map((e,t)=>{let n=u&&(e.title||e.description);return(0,l.jsx)(`div`,{className:Mi.frameCell,style:{width:r,marginRight:t<I-1?a:0},"data-active":t===P?`true`:`false`,"data-photo-index":t,children:(0,l.jsxs)(`div`,{className:Mi.frame,style:{width:r,height:i},children:[(0,l.jsx)(`img`,{src:e.src,alt:e.alt??e.title??`Photo ${t+1}`,draggable:!1}),n?(0,l.jsxs)(`div`,{className:Mi.caption,children:[e.title?(0,l.jsx)(`strong`,{children:e.title}):null,e.description?(0,l.jsx)(`span`,{children:e.description}):null]}):null]})},`${e.src}-${t}`)})})})})}),(0,l.jsx)(`div`,{className:[Mi.roller,Mi.rollerRight].join(` `),"aria-hidden":`true`})]})},Hi={tunnel:`cos-tunnel-esly-`,vignette:`cos-vignette-P8ZI-`,depthFog:`cos-depthFog-E0b-c`,stage:`cos-stage--T1Yo`,track:`cos-track-u0COO`,frame:`cos-frame-N6-20`,frameInner:`cos-frameInner-CYOXO`,imageWrap:`cos-imageWrap-Xkdph`,image:`cos-image-Rj-YX`,frameCurrent:`cos-frameCurrent-xEe4Y`,caption:`cos-caption-FTJST`,captionTitle:`cos-captionTitle-BBveQ`,captionDesc:`cos-captionDesc-WhlOz`,empty:`cos-empty-mRm15`},Ui=6,Wi=.35,Gi=8,Ki=10,qi=90,Ji=.045,Yi=e=>typeof e==`number`?`${e}px`:e,Xi=(e,t,n)=>Math.min(n,Math.max(t,e)),Zi=(e,t)=>t<=0?0:Xi(Math.round(e),0,t-1),Qi=({photos:e,width:t=380,height:n=480,depthStep:r=180,dragSensitivity:i=.008,friction:a=1.5,autoAdvance:o=!1,autoAdvanceSpeed:s=.15,showCaption:u=!0,initialIndex:d=0,onPhotoClick:f,onIndexChange:p,ariaLabel:m=`纵深照片隧道`,className:h,style:g})=>{let _=e.length,y=(0,c.useRef)(null),b=(0,c.useRef)([]),x=(0,c.useRef)(d),S=(0,c.useRef)(0),C=(0,c.useRef)(null),w=(0,c.useRef)(!1),T=(0,c.useRef)(null),E=(0,c.useRef)(0),D=(0,c.useRef)(0),O=(0,c.useRef)(0),k=(0,c.useRef)(0),A=(0,c.useRef)(0),j=(0,c.useRef)(0),M=(0,c.useRef)(!1),N=(0,c.useRef)(!1),P=(0,c.useRef)(Zi(d,_)),F=(0,c.useRef)(f),I=(0,c.useRef)(p),L=(0,c.useRef)(e),R=(0,c.useRef)(r),z=(0,c.useRef)(i),B=(0,c.useRef)(a),V=(0,c.useRef)(o),H=(0,c.useRef)(s),U=(0,c.useRef)(_),[W,G]=(0,c.useState)(()=>Zi(d,_));(0,c.useEffect)(()=>{F.current=f,I.current=p,L.current=e,R.current=r,z.current=i,B.current=a,V.current=o,H.current=s,U.current=_},[o,s,_,r,i,a,p,f,e]);let K=(0,c.useCallback)(e=>{if(e===P.current)return;P.current=e,G(e);let t=L.current[e];t&&I.current?.(e,t)},[]),q=(0,c.useCallback)(e=>{x.current=e;let t=R.current,n=U.current;for(let r=0;r<n;r+=1){let n=b.current[r];if(!n)continue;let i=r-e,a=Math.abs(i),o=i*t,s=Math.max(.52,1-a*.14),c=Math.max(.12,1-a*.32),l=a>.45?Math.min(4,(a-.45)*2.4):0,u=a<.55;n.style.transform=`translate3d(-50%, -50%, ${o}px) scale(${s})`,n.style.opacity=String(c),n.style.filter=l>.05?`blur(${l}px)`:`none`,n.classList.toggle(Hi.frameCurrent,u),n.setAttribute(`aria-hidden`,u?`false`:`true`)}},[]);(0,c.useEffect)(()=>{let e=Zi(d,_);x.current=e,S.current=0,C.current=null,P.current=e,q(e);let t=requestAnimationFrame(()=>{G(e)});return()=>cancelAnimationFrame(t)},[q,_,d]),(0,c.useEffect)(()=>{let e=v(e=>{N.current=e}),t=0,n=performance.now(),r=e=>{if(t=requestAnimationFrame(r),N.current){n=e;return}let i=Math.min(.05,(e-n)/1e3);if(n=e,w.current)return;let a=Math.max(0,U.current-1),o=x.current,s=S.current,c=!1;if(C.current!==null){let e=C.current-o;Math.abs(e)<=.004?(o=C.current,C.current=null,s=0,K(Zi(o,U.current)),c=!0):(o+=e*Math.min(1,Ki*i),s=0,c=!0)}else if(Math.abs(s)>Wi)s*=Math.exp(-B.current*i),Math.abs(s)<=Wi&&(s=0),o=Xi(o+s*i,0,a),c=!0,(s===0||o<=0||o>=a)&&(C.current=Zi(o,U.current));else if(V.current&&U.current>1){o+=H.current*i,o>=a?o=a:c=!0;let e=Zi(o,U.current);e!==P.current&&K(e)}else{let e=Zi(o,U.current);Math.abs(o-e)>.004?(C.current=e,c=!0):o!==e&&(o=e,K(e),c=!0)}S.current=s,c&&q(o)};return t=requestAnimationFrame(r),q(x.current),()=>{cancelAnimationFrame(t),e()}},[q,K]);let ee=(0,c.useCallback)((e,t)=>{w.current&&(w.current=!1,T.current=null,!t||e-j.current>qi?S.current=0:S.current=Xi(S.current,-8,Gi),C.current=null)},[]),J=(0,c.useCallback)(e=>{U.current<=0||e.button!==0||(w.current=!0,M.current=!1,T.current=e.pointerId,E.current=e.clientX,D.current=e.clientY,O.current=x.current,k.current=e.clientX,A.current=e.clientY,j.current=e.timeStamp,S.current=0,C.current=null,e.currentTarget.setPointerCapture(e.pointerId))},[]),te=(0,c.useCallback)(e=>{if(!w.current||T.current!==e.pointerId)return;let t=e.clientX-E.current,n=e.clientY-D.current;Math.hypot(t,n)>Ui&&(M.current=!0);let r=e.clientX-k.current,i=e.clientY-A.current,a=Math.max(.008,(e.timeStamp-j.current)/1e3),o=z.current,s=(Math.abs(i)>=Math.abs(r)?-i*o:-r*o)/a,c=1-Math.exp(-a/Ji);S.current+=(s-S.current)*c;let l=Math.abs(n)>=Math.abs(t)?-n*o:-t*o,u=Math.max(0,U.current-1),d=Xi(O.current+l,0,u);k.current=e.clientX,A.current=e.clientY,j.current=e.timeStamp,q(d),K(Zi(d,U.current))},[q,K]),ne=(0,c.useCallback)(e=>{if(T.current!==e.pointerId)return;let t=!M.current;ee(e.timeStamp,!0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}if(t){let e=P.current,t=L.current[e];t&&F.current?.(e,t)}},[ee]),Y=(0,c.useCallback)(e=>{if(T.current===e.pointerId){ee(e.timeStamp,!1);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}},[ee]),X=e[W],re=u&&X&&(X.title||X.description),ie=re&&X?.title?`,当前:${X.title}${X.description?`,${X.description}`:``}`:``;return _===0?(0,l.jsx)(`div`,{className:[Hi.tunnel,h].filter(Boolean).join(` `),style:{width:Yi(t),height:Yi(n),...g},role:`img`,"aria-label":m,children:(0,l.jsx)(`div`,{className:Hi.empty,children:`暂无照片`})}):(0,l.jsxs)(`div`,{className:[Hi.tunnel,h].filter(Boolean).join(` `),style:{width:Yi(t),height:Yi(n),...g},role:`region`,"aria-label":m+ie,"aria-roledescription":`carousel`,tabIndex:0,children:[(0,l.jsx)(`div`,{className:Hi.depthFog,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:Hi.vignette,"aria-hidden":`true`}),(0,l.jsx)(`div`,{ref:y,className:Hi.stage,onPointerDown:J,onPointerMove:te,onPointerUp:ne,onPointerCancel:Y,children:(0,l.jsx)(`div`,{className:Hi.track,children:e.map((e,t)=>(0,l.jsx)(`div`,{ref:e=>{b.current[t]=e},className:Hi.frame,"data-photo-index":t,"aria-hidden":t!==W,children:(0,l.jsx)(`div`,{className:Hi.frameInner,children:(0,l.jsx)(`div`,{className:Hi.imageWrap,children:(0,l.jsx)(`img`,{className:Hi.image,src:e.src,alt:e.alt??e.title??`Photo ${t+1}`,draggable:!1})})})},`${e.src}-${t}`))})}),re?(0,l.jsxs)(`div`,{className:Hi.caption,children:[X?.title?(0,l.jsx)(`p`,{className:Hi.captionTitle,children:X.title}):null,X?.description?(0,l.jsx)(`p`,{className:Hi.captionDesc,children:X.description}):null]}):null]})},$={root:`cos-root-qGq-T`,body:`cos-body-8jOJ0`,bodyRidge:`cos-bodyRidge-88Vkq`,topBulb:`cos-topBulb-M3wyM`,sideGrip:`cos-sideGrip-jL6g7`,left:`cos-left-mXvTL`,right:`cos-right-Q4Ozn`,discStage:`cos-discStage-HZPMB`,disc:`cos-disc-SkhwL`,slot:`cos-slot-AubzH`,slotFrame:`cos-slotFrame-AbvoX`,slotImage:`cos-slotImage-RfkHp`,peepStack:`cos-peepStack-KseMg`,peepRing:`cos-peepRing-8SSr0`,peepWindow:`cos-peepWindow-9dosU`,peepImage:`cos-peepImage-YxDtE`,peepGlare:`cos-peepGlare-vmPru`,peepVignette:`cos-peepVignette-MSiRk`,caption:`cos-caption-e--JN`,captionTitle:`cos-captionTitle-lSCbX`,captionDesc:`cos-captionDesc-qUIGe`,empty:`cos-empty-s8TJ0`},$i=380,ea=420,ta=300,na=160,ra=6,ia=640,aa=2.2,oa=90,sa=.045,ca=.35,la=14,ua=e=>typeof e==`number`?`${e}px`:e,da=(e,t,n)=>Math.max(t,Math.min(n,e)),fa=(e,t)=>t<=0?0:(e%t+t)%t,pa=(e,t,n)=>n<=0?0:fa(Math.round(-e/t),n),ma=(e,t,n)=>{let r=-t*n;return r+Math.round((e-r)/360)*360},ha=({photos:e,width:t=$i,height:n=ea,discSize:r=ta,peepSize:i=na,dragSensitivity:a=.45,friction:o=1.4,autoRotate:s=!0,autoRotateSpeed:u=8,showCaption:d=!0,initialIndex:f=0,onPhotoClick:p,onIndexChange:m,ariaLabel:h=`观景器`,className:g,style:_})=>{let y=e.length,b=y>0?360/y:360,x=(r-i)/4+i/2,S=(0,c.useRef)(null),C=(0,c.useRef)(null),w=(0,c.useRef)(-f*b),T=(0,c.useRef)(0),E=(0,c.useRef)(!1),D=(0,c.useRef)(null),O=(0,c.useRef)(0),k=(0,c.useRef)(0),A=(0,c.useRef)(!1),j=(0,c.useRef)(0),M=(0,c.useRef)(!1),N=(0,c.useRef)(pa(-f*b,b,y)),P=(0,c.useRef)(p),F=(0,c.useRef)(m),I=(0,c.useRef)(e),L=(0,c.useRef)(s),R=(0,c.useRef)(u),z=(0,c.useRef)(o),B=(0,c.useRef)(a),V=(0,c.useRef)(b),H=(0,c.useRef)(y),[U,W]=(0,c.useState)(()=>fa(f,y)),G=(0,c.useMemo)(()=>e.map((e,t)=>`rotate(${t*b}deg) translateY(-${x}px)`),[e,x,b]);(0,c.useEffect)(()=>{P.current=p,F.current=m,I.current=e,L.current=s,R.current=u,z.current=o,B.current=a,V.current=b,H.current=y},[p,m,e,s,u,o,a,b,y]);let K=e=>{w.current=e,C.current&&(C.current.style.transform=`rotate(${e}deg)`);let t=pa(e,V.current,H.current);if(t!==N.current){N.current=t,W(t);let e=I.current[t];e&&F.current?.(t,e)}};(0,c.useEffect)(()=>{let e=fa(f,y),t=-e*b;T.current=0,N.current=e,w.current=t,C.current&&(C.current.style.transform=`rotate(${t}deg)`);let n=requestAnimationFrame(()=>{W(e)});return()=>cancelAnimationFrame(n)},[y,f,b]),(0,c.useEffect)(()=>{let e=v(e=>{M.current=e}),t=0,n=performance.now(),r=e=>{if(t=requestAnimationFrame(r),M.current){n=e;return}let i=Math.min(.05,(e-n)/1e3);if(n=e,E.current||H.current<=0)return;let a=w.current,o=T.current,s=V.current;if(Math.abs(o)>aa)a+=o*i,o*=Math.exp(-z.current*i),Math.abs(o)<=aa&&(o=0);else{o=0;let e=pa(a,s,H.current),t=ma(a,e,s),n=t-a;Math.abs(n)>ca?a+=n*Math.min(1,la*i):(a=t,L.current&&(a-=R.current*i))}T.current=o,K(a)};return t=requestAnimationFrame(r),K(w.current),()=>{cancelAnimationFrame(t),e()}},[]);let q=(e,t)=>{if(E.current){if(E.current=!1,D.current=null,!t||e-k.current>oa){T.current=0;return}T.current=da(T.current,-640,ia)}},ee=e=>{e.button!==0||y<=0||(E.current=!0,A.current=!1,D.current=e.pointerId,j.current=e.clientX,O.current=e.clientX,k.current=e.timeStamp,T.current=0,e.currentTarget.setPointerCapture(e.pointerId))},J=e=>{if(!E.current||D.current!==e.pointerId)return;let t=e.clientX-O.current,n=Math.max(.008,(e.timeStamp-k.current)/1e3);Math.abs(e.clientX-j.current)>ra&&(A.current=!0);let r=B.current;K(w.current-t*r);let i=-t/n*r,a=1-Math.exp(-n/sa);T.current+=(i-T.current)*a,O.current=e.clientX,k.current=e.timeStamp},te=e=>{if(D.current!==e.pointerId)return;let t=!A.current;q(e.timeStamp,!0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}if(t){let e=I.current[N.current];e&&P.current?.(N.current,e)}},ne=e=>{D.current===e.pointerId&&q(e.timeStamp,!1)},Y=e[U],X=d&&Y&&(Y.title||Y.description),re=X&&Y?.title?`,当前:${Y.title}${Y.description?`,${Y.description}`:``}`:``;return y===0?(0,l.jsx)(`div`,{ref:S,className:[$.root,g].filter(Boolean).join(` `),style:{width:ua(t),height:ua(n),"--pvm-disc-size":`${r}px`,"--pvm-peep-size":`${i}px`,..._},role:`img`,"aria-label":h,children:(0,l.jsx)(`div`,{className:$.empty,children:`暂无照片`})}):(0,l.jsxs)(`div`,{ref:S,className:[$.root,g].filter(Boolean).join(` `),style:{width:ua(t),height:ua(n),"--pvm-disc-size":`${r}px`,"--pvm-peep-size":`${i}px`,..._},role:`img`,"aria-label":h+re,onPointerDown:ee,onPointerMove:J,onPointerUp:te,onPointerCancel:ne,children:[(0,l.jsxs)(`div`,{className:$.body,children:[(0,l.jsx)(`div`,{className:$.topBulb,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:[$.sideGrip,$.left].join(` `),"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:[$.sideGrip,$.right].join(` `),"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:$.bodyRidge,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:$.discStage,children:(0,l.jsx)(`div`,{ref:C,className:$.disc,style:{transform:`rotate(${-f*b}deg)`},"aria-hidden":`true`,children:e.map((e,t)=>(0,l.jsx)(`div`,{className:$.slot,style:{transform:G[t]},children:(0,l.jsx)(`div`,{className:$.slotFrame,children:(0,l.jsx)(`img`,{className:$.slotImage,src:e.src,alt:``,draggable:!1})})},`${e.src}-${t}`))})}),(0,l.jsxs)(`div`,{className:$.peepStack,children:[(0,l.jsx)(`div`,{className:$.peepRing,"aria-hidden":`true`}),(0,l.jsxs)(`div`,{className:$.peepWindow,children:[Y?(0,l.jsx)(`img`,{className:$.peepImage,src:Y.src,alt:Y.alt??Y.title??`Photo ${U+1}`,draggable:!1}):null,(0,l.jsx)(`div`,{className:$.peepVignette,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:$.peepGlare,"aria-hidden":`true`})]})]})]}),X?(0,l.jsxs)(`div`,{className:$.caption,children:[Y?.title?(0,l.jsx)(`p`,{className:$.captionTitle,children:Y.title}):null,Y?.description?(0,l.jsx)(`p`,{className:$.captionDesc,children:Y.description}):null]}):null]})},ga={plasmaBall:`cos-plasmaBall-xGHSj`,canvas:`cos-canvas-V1CgL`},_a=({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,_=document.hidden,y=v(e=>{_=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),_)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:ga.plasmaBall,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:ga.canvas,style:{width:e,height:t}})})},va={smokeFog:`cos-smokeFog-SYlts`,canvas:`cos-canvas-iOJV7`},ya=10,ba=128,xa=`#d2d4d8`,Sa=[`#14151c`,`#1a1b24`,`#0e0f14`],Ca=(e,t)=>{let n=Math.sin(e*127.1+t*311.7)*43758.5453;return n-Math.floor(n)},wa=(e,t)=>{let n=Math.floor(e),r=Math.floor(t),i=e-n,a=t-r,o=i*i*(3-2*i),s=a*a*(3-2*a),c=Ca(n,r),l=Ca(n+1,r),u=Ca(n,r+1),d=Ca(n+1,r+1);return c+(l-c)*o+(u-c)*s+(c-l-u+d)*o*s},Ta=(e,t)=>{let n=0,r=.5,i=1;for(let a=0;a<4;a++)n+=r*wa(e*i,t*i),i*=2.05,r*=.5;return n},Ea=(e,t)=>{let n=e.replace(`#`,``).trim(),r=n.length===3?n.split(``).map(e=>e+e).join(``):n;if(r.length!==6)return t;let i=Number.parseInt(r,16);return Number.isNaN(i)?t:[i>>16&255,i>>8&255,i&255]},Da=(e,t,n)=>[Math.round(e[0]+(t[0]-e[0])*n),Math.round(e[1]+(t[1]-e[1])*n),Math.round(e[2]+(t[2]-e[2])*n)],Oa=(e,t=1)=>t>=1?`rgb(${e[0]} ${e[1]} ${e[2]})`:`rgb(${e[0]} ${e[1]} ${e[2]} / ${t})`,ka=e=>{if(Array.isArray(e)&&e.length>=3)return[e[0],e[1],e[2]];let t=Ea(typeof e==`string`?e:Sa[2],[14,15,20]),n=Da(t,[255,255,255],.06);return[Oa(Da(t,[255,255,255],.1)),Oa(n),Oa(t)]},Aa=(e,t)=>{let n=document.createElement(`canvas`);n.width=ba,n.height=ba;let r=n.getContext(`2d`),i=r.createImageData(ba,ba),a=i.data,o=ba/2,s=ba/2,c=ba*.48;for(let n=0;n<ba;n++)for(let r=0;r<ba;r++){let i=(r-o)/c,l=(n-s)/c,u=Math.hypot(i,l);if(u>1.15)continue;let d=Ta(r*.045+e*17.1,n*.045+e*9.3)*.7+Ta(r*.09-e*3.2,n*.09+e*5.7)*.3,f=u+(d-.45)*.55,p=1-Math.max(0,f);if(p=Math.max(0,p)**1.35,p*=.55+d*.7,p<.01)continue;let m=(n*ba+r)*4,h=.88+d*.18;a[m]=Math.min(255,t[0]*h),a[m+1]=Math.min(255,t[1]*h+1),a[m+2]=Math.min(255,t[2]*h+3),a[m+3]=Math.min(255,p*210)}return r.putImageData(i,0,0),n},ja=e=>Array.from({length:ya},(t,n)=>Aa(n+1,e)),Ma=(e,t,n=0)=>{let r=70+Math.random()*110,i=Math.min(.92,n*.88),a=t*(1-n*.92)+r*(.15-n*.1),o=(.32+Math.random()*.28)*(1-n*.55);return{x:Math.random()*e,y:a,vx:(Math.random()-.5)*.18,vy:-(.08+Math.random()*.16),size:r*(.7+i*.55),birthSize:r,maxSize:r*(1.8+Math.random()*1.4),rotation:Math.random()*Math.PI*2,spin:(Math.random()-.5)*.004,age:i,ageSpeed:4e-4+Math.random()*65e-5,opacity:o,sprite:Math.floor(Math.random()*ya),stretch:.85+Math.random()*.55+n*.25,receptivity:.5+Math.random()*.85,mass:.5+Math.random()*.9,phase:Math.random()*Math.PI*2,warmth:Math.random()}},Na=(e,t)=>{let n=Math.hypot(e.vx,e.vy);if(n<=t)return;let r=t/n;e.vx*=r,e.vy*=r},Pa=e=>e<.06?e/.06:e>.55?Math.max(0,1-(e-.55)/.45):1,Fa=(e,t)=>.22+Math.min(1,Math.max(0,e/t))**1.15*.78,Ia=({width:e,height:t,fill:n=!1,density:r=.5,color:i=xa,backgroundColor:a=Sa,speed:o=1,disperseStrength:s=1,disperseRadius:u=1,interactive:d=!0,ariaLabel:f})=>{let{hostRef:p,width:m,height:h,hostStyle:g}=T({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),x=(0,c.useRef)(null),S=(0,c.useRef)([]),C=(0,c.useRef)([]),w=(0,c.useRef)(null),E=(0,c.useRef)(``),D=(0,c.useRef)(0),O=(0,c.useRef)({speed:o,disperseStrength:s,disperseRadius:u,interactive:d,color:i,backgroundColor:a});(0,c.useEffect)(()=>{O.current={speed:o,disperseStrength:s,disperseRadius:u,interactive:d,color:i,backgroundColor:a}},[o,s,u,d,i,a]),(0,c.useEffect)(()=>{w.current=ja(Ea(i,[210,212,216])),E.current=i},[i]),(0,c.useEffect)(()=>{let e=Math.floor(56+r*100);S.current=Array.from({length:e},()=>Ma(m,h,Math.random()**1.75))},[r,h,m]);let k=(0,c.useCallback)((e,t)=>{let n=O.current;if(!n.interactive)return;let r=x.current;if(!r)return;let i=r.getBoundingClientRect(),a=(e-i.left)/i.width*m,o=(t-i.top)/i.height*h,s=_(n.disperseRadius,0,3),c=_(n.disperseStrength,0,3);C.current.length>3&&C.current.shift(),C.current.push({x:a,y:o,life:1,swirl:Math.random()<.5?-1:1,radius:Math.min(m,h)*.08*s,maxRadius:Math.min(m,h)*(.42+Math.random()*.12)*s,strength:(.7+Math.random()*.25)*c})},[h,m]);return(0,c.useEffect)(()=>{let e=x.current;if(!e)return;let t=e=>{e.pointerType===`mouse`&&e.button!==0||k(e.clientX,e.clientY)};return e.addEventListener(`pointerdown`,t),()=>e.removeEventListener(`pointerdown`,t)},[k]),(0,c.useEffect)(()=>{let e=x.current;if(!e)return;let t=Math.min(window.devicePixelRatio||1,2);e.width=Math.floor(m*t),e.height=Math.floor(h*t);let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let r=Ea(O.current.color,[210,212,216]);w.current||(w.current=ja(r),E.current=O.current.color);let i=w.current,a=0,o=document.hidden,s=y(),c=v(e=>{o=e}),l=b(e=>{s=e}),u=()=>{let[e,t,r]=ka(O.current.backgroundColor),i=n.createLinearGradient(0,0,0,h);i.addColorStop(0,e),i.addColorStop(.45,t),i.addColorStop(1,r),n.fillStyle=i,n.fillRect(0,0,m,h);let a=Ea(r,[14,15,20]),o=Da(a,[255,255,255],.22),s=n.createRadialGradient(m*.5,h*.75,0,m*.5,h,m*.55);s.addColorStop(0,Oa(o,.35)),s.addColorStop(1,Oa(a,0)),n.fillStyle=s,n.fillRect(0,0,m,h)},d=e=>{let t=Pa(e.age)*Fa(e.y,h);if(t<=.01)return;let r=i[e.sprite],a=e.birthSize+(e.maxSize-e.birthSize)*Math.min(1,e.age*1.15),o=e.size+(a-e.size)*.35,s=o,c=o*e.stretch;n.save(),n.translate(e.x,e.y),n.rotate(e.rotation),n.globalAlpha=e.opacity*t*(.85+e.warmth*.2),n.globalCompositeOperation=`screen`,n.drawImage(r,-s/2,-c/2,s,c),n.restore()},f=()=>{if(D.current=requestAnimationFrame(f),o||s)return;let e=_(O.current.speed,0,3),t=_(O.current.disperseStrength,0,3);a+=.01*Math.max(e,.001),u(),E.current!==O.current.color&&(w.current=ja(Ea(O.current.color,[210,212,216])),E.current=O.current.color);let r=w.current??i,c=S.current,l=C.current;for(let e=l.length-1;e>=0;e--){let n=l[e],r=1-n.life,i=Math.sin(Math.PI*Math.min(1,r*1.05))*n.strength;n.radius+=(n.maxRadius-n.radius)*.055;for(let e of c){let r=e.x-n.x,o=e.y-n.y,s=Math.hypot(r,o)||.001;if(s>n.radius)continue;let c=s/n.radius,l=Math.exp(-c*c*2.2)*(1-c*.35),u=Math.exp(-(((c-.72)/.32)**2)),d=l*.55+u*.45,f=.72+.28*Math.sin(e.phase*2.7+a*1.2+s*.03),p=d*e.receptivity*f*i;if(p<.02)continue;let m=r/s,h=o/s,g=-h*n.swirl,_=m*n.swirl,v=1/(.65+e.mass*.7),y=Math.sin(e.phase*4.2+a*1.6)*.35;e.vx+=(m*.55+g*.22+y*.12)*p*v,e.vy+=(h*.48+_*.22-.06)*p*v,e.opacity*=1-p*.028,e.maxSize*=1+p*.02,e.stretch+=p*.012,e.spin+=y*p*.004,Na(e,2.4*Math.max(t,.35))}n.life*=.972,n.life<.04&&l.splice(e,1)}n.save();for(let t=0;t<c.length;t++){let i=c[t],o=Math.sin(a*.55+i.phase)*.16,s=Math.cos(a*.4+i.phase*1.3)*.05;i.vx+=o*.018*e,i.vy+=s*.01*e-.0035*e;let l=Math.hypot(i.vx,i.vy),u=l>.8?.975:.99;i.vx*=u,i.vy*=u,i.x+=i.vx*e,i.y+=i.vy*e,i.rotation+=(i.spin+i.vx*.002)*e,i.age+=i.ageSpeed*e;let d=i.birthSize+(i.maxSize-i.birthSize)*Math.min(1,i.age*1.15);i.size+=(d-i.size)*.04;let f=(.3+i.warmth*.1)*Fa(i.y,h),p=.006+.008*Math.max(0,1-l/2.2);if(i.opacity+=(f-i.opacity)*p,i.stretch+=(1.05+(1-i.y/h)*.55-i.stretch)*.01,i.age>=1||i.y<-i.size||i.opacity<.02){c[t]=Ma(m,h,0);continue}i.x<-i.size&&(i.x=m+i.size*.5),i.x>m+i.size&&(i.x=-i.size*.5);let g=Pa(i.age)*Fa(i.y,h);if(g<=.01)continue;let _=r[i.sprite],v=i.birthSize+(i.maxSize-i.birthSize)*Math.min(1,i.age*1.15),y=i.size+(v-i.size)*.35,b=y,x=y*i.stretch;n.save(),n.translate(i.x,i.y),n.rotate(i.rotation),n.globalAlpha=i.opacity*g*(.85+i.warmth*.2),n.globalCompositeOperation=`screen`,n.drawImage(_,-b/2,-x/2,b,x),n.restore()}n.restore(),n.globalCompositeOperation=`source-over`,n.globalAlpha=1};if(s){u();for(let e of S.current)d(e);return n.globalCompositeOperation=`source-over`,n.globalAlpha=1,()=>{c(),l()}}return f(),()=>{cancelAnimationFrame(D.current),c(),l()}},[h,m]),(0,l.jsx)(`div`,{ref:p,className:va.smokeFog,style:g,children:(0,l.jsx)(`canvas`,{ref:x,className:va.canvas,style:{width:m,height:h,cursor:d?`pointer`:`default`},role:`img`,"aria-label":f??(d?`烟雾背景,点击可驱散`:`烟雾背景`)})})},La=.82,Ra=.08,za=1e3/60,Ba=46*2.6,Va=()=>({x:-1e3,y:-1e3,prevX:-1e3,prevY:-1e3,vx:0,vy:0,speed:0,active:!1,lastTs:0}),Ha=e=>e<.5?2*e*e:1-(-2*e+2)**2/2,Ua=e=>1-(1-e)**3,Wa=(e,t,n)=>{let r=Math.min(1,Math.max(0,(n-e)/(t-e)));return r*r*(3-2*r)},Ga=(e,t)=>e**t,Ka=e=>{let t=Math.sin(e*127.1+311.7)*43758.5453;return t-Math.floor(t)},qa=(e,t,n=!0)=>{let r=.18+(e/18)**.5*.52,i=n?.8+Math.random()*.35:1;return r*t*i},Ja=(e,t,n,r,i)=>{let a=e.createRadialGradient(t,n,0,t,n,r);for(let[e,t]of i)a.addColorStop(e,t);e.fillStyle=a,e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fill()},Ya=(e,t,n,r,i,a,o)=>{e.save(),e.translate(t,n),e.rotate(r),e.scale(a,1);let s=e.createRadialGradient(0,0,0,0,i*.15,i);s.addColorStop(0,`rgb(170 220 240 / ${o*100}%)`),s.addColorStop(.2,`rgb(90 170 200 / ${o*45}%)`),s.addColorStop(.55,`rgb(40 110 150 / ${o*12}%)`),s.addColorStop(1,`rgb(10 40 60 / 0%)`),e.fillStyle=s,e.beginPath(),e.arc(0,i*.15,i,0,Math.PI*2),e.fill(),e.restore()},Xa=(e,t,n,r,i)=>{let a=Math.min(70,Math.floor(t*n/22e3));for(let o=0;o<a;o++){let a=Ka(o+1),s=Ka(o+57),c=Ka(o+131),l=.3+c*1.1,u=5+s*16,d=Math.sin(r*(.1+a*.28)+o*.7)*(5+s*14),f=(a*t+r*(1.5+c*5)+d)%(t+24)-12,p=(s*n+r*u*.22)%(n+24)-12,m=Math.min(1,Math.max(0,p/n)),h=(.02+c*.07)*(.35+m*.55),g=l*4.4;e.globalAlpha=h,e.drawImage(i,f-g*.5,p-g*.5,g,g)}e.globalAlpha=1},Za=(e,t,n,r)=>{let i=e.createLinearGradient(0,0,0,n);i.addColorStop(0,`#0c4558`),i.addColorStop(.08,`#0a3c50`),i.addColorStop(.18,`#083445`),i.addColorStop(.32,`#062a38`),i.addColorStop(.48,`#041f2b`),i.addColorStop(.64,`#03161f`),i.addColorStop(.8,`#020e15`),i.addColorStop(.92,`#01080c`),i.addColorStop(1,`#000406`),e.fillStyle=i,e.fillRect(0,0,t,n),Ja(e,t*.55,-n*.05,n*1.05,[[0,`rgb(150 215 235 / 26%)`],[.18,`rgb(80 170 200 / 14%)`],[.4,`${r}12`],[.65,`rgb(30 90 120 / 4%)`],[1,`rgb(5 20 30 / 0%)`]]),Ja(e,t*.18,n*.12,t*.7,[[0,`rgb(70 150 175 / 8%)`],[.45,`rgb(30 90 120 / 3%)`],[1,`rgb(10 30 45 / 0%)`]]),Ja(e,t*.88,n*.22,t*.55,[[0,`rgb(50 120 150 / 6%)`],[.5,`rgb(20 70 100 / 2%)`],[1,`rgb(5 20 30 / 0%)`]]);for(let r=0;r<4;r++){let i=Ka(r+3),a=Ka(r+11);Ja(e,t*(.2+i*.6),n*(.28+a*.4),n*(.28+a*.18),[[0,`rgb(25 70 95 / ${4+i*3}%)`],[.5,`rgb(15 45 65 / ${2+a*2}%)`],[1,`rgb(5 20 30 / 0%)`]])}let a=e.createLinearGradient(0,0,0,n);a.addColorStop(0,`rgb(0 10 16 / 0%)`),a.addColorStop(.35,`rgb(0 8 14 / 6%)`),a.addColorStop(.65,`rgb(0 5 10 / 22%)`),a.addColorStop(.85,`rgb(0 3 7 / 42%)`),a.addColorStop(1,`rgb(0 1 3 / 62%)`),e.fillStyle=a,e.fillRect(0,0,t,n),Ja(e,t*.5,n*1.05,n*.55,[[0,`rgb(0 2 5 / 70%)`],[.45,`rgb(0 4 8 / 35%)`],[1,`rgb(0 6 10 / 0%)`]]),Ja(e,t*.28,n*1.02,t*.4,[[0,`rgb(0 3 6 / 28%)`],[1,`rgb(0 3 6 / 0%)`]]),Ja(e,t*.75,n*1.04,t*.35,[[0,`rgb(0 2 5 / 24%)`],[1,`rgb(0 2 5 / 0%)`]]);let o=e.createRadialGradient(t*.5,n*.4,Math.min(t,n)*.35,t*.5,n*.48,Math.max(t,n)*.78);o.addColorStop(0,`rgb(0 0 0 / 0%)`),o.addColorStop(.55,`rgb(0 6 10 / 6%)`),o.addColorStop(.8,`rgb(0 3 6 / 18%)`),o.addColorStop(1,`rgb(0 1 3 / 36%)`),e.fillStyle=o,e.fillRect(0,0,t,n)},Qa=(e,t,n,r,i,a)=>{let o=t*(.55+Math.sin(r*.07)*.03);e.save(),e.globalCompositeOperation=`screen`;for(let i=0;i<5;i++){let o=r*.11+i*1.35,s=t*(.22+i*.14)+Math.sin(o)*t*(a?.015:.04),c=.12+Math.sin(o*.6+i)*(a?.02:.05),l=.045+i%3*.012+Math.sin(r*.2+i)*.008;Ya(e,s,-n*.02,c,n*(.7+i%2*.12),.12+i%3*.04,l)}Ya(e,o+t*.02,-n*.04,.08+Math.sin(r*.09)*(a?.012:.03),n*.78,.2,.07+Math.sin(r*.15)*.012),e.restore(),Xa(e,t,n,r,i)},$a=()=>{let e=document.createElement(`canvas`);e.width=48,e.height=48;let t=e.getContext(`2d`);if(!t)return e;let n=t.createRadialGradient(48/2,48/2,0,48/2,48/2,48/2);return n.addColorStop(0,`rgb(220 240 250 / 90%)`),n.addColorStop(.3,`rgb(180 220 240 / 42%)`),n.addColorStop(1,`rgb(180 220 240 / 0%)`),t.fillStyle=n,t.beginPath(),t.arc(48/2,48/2,48/2,0,Math.PI*2),t.fill(),e},eo=(e,t)=>e.find(e=>e.id===t),to=e=>{let t=e.progress,n=Ha(Wa(0,.72,t)),r=Ua(Wa(.28,1,t)),i=e.startSecondaryX-e.startPrimaryX,a=e.startSecondaryY-e.startPrimaryY,o=Math.hypot(i,a)||1,s=i/o,c=a/o,l=e.startPrimaryRadius,u=e.startSecondaryRadius,d=l+u,f=d*(1-n),p=e.startPrimaryX+s*(d-f)*(u/(l+u)),m=e.startPrimaryY+c*(d-f)*(u/(l+u)),h=p+s*f,g=m+c*f;return{ax:p,ay:m,ar:l+(e.targetRadius-l)*r,bx:h,by:g,br:Math.max(.8,u*(1-r*.97)),approach:n,absorb:r}},no=(e,t)=>{let n=new Map;for(let t of e){let e=`${Math.floor(t.x/Ba)},${Math.floor(t.y/Ba)}`,r=n.get(e);r?r.push(t):n.set(e,[t])}for(let r of e){let e=Math.floor(r.x/Ba),i=Math.floor(r.y/Ba);for(let a=-1;a<=1;a++)for(let o=-1;o<=1;o++){let s=n.get(`${e+a},${i+o}`);if(s)for(let e of s)e.id<=r.id||t(r,e)}}},ro=e=>{no(e,(e,t)=>{let n=t.x-e.x,r=t.y-e.y,i=Math.hypot(n,r)||1,a=i-(e.radius+t.radius),o=Math.min(8,(e.radius+t.radius)*.14);if(a>o||a<0)return;let s=(1-a/o)*.01,c=n/i,l=r/i;e.vx+=c*s,e.vy+=l*s*.55,t.vx-=c*s,t.vy-=l*s*.55})},io=(e,t,n)=>{no(e,(e,r)=>{if(n.has(e.id)||n.has(r.id)||Math.hypot(e.x-r.x,e.y-r.y)>e.radius+r.radius-Math.min(e.radius,r.radius)*.12)return;let i=e.radius>=r.radius?e:r,a=e.radius>=r.radius?r:e,o=Math.min(46,Math.cbrt(i.radius**3+a.radius**3));t.push({primaryId:i.id,secondaryId:a.id,progress:0,targetRadius:o,startPrimaryRadius:i.radius,startSecondaryRadius:a.radius,startPrimaryX:i.x,startPrimaryY:i.y,startSecondaryX:a.x,startSecondaryY:a.y}),n.add(i.id),n.add(a.id)})},ao=(e,t,n,r)=>{let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=eo(e,o.primaryId),c=eo(e,o.secondaryId);if(!s||!c){i.push(a);continue}o.progress=Math.min(1,o.progress+.018*r);let l=(s.vy+c.vy)*.5-.12,u=(s.vx+c.vx)*.5;o.startPrimaryX+=u*r,o.startPrimaryY+=l*r,o.startSecondaryX+=u*r,o.startSecondaryY+=l*r;let d=to(o);if(o.pose=d,s.x=d.ax,s.y=d.ay,s.radius=d.ar,c.x=d.bx,c.y=d.by,c.radius=d.br,s.vx=u,s.vy=l,c.vx=u,c.vy=l,o.progress>=1){s.x=(d.ax*d.ar+d.bx*d.br)/Math.max(1,d.ar+d.br),s.y=(d.ay*d.ar+d.by*d.br)/Math.max(1,d.ar+d.br),s.radius=o.targetRadius,s.terminalRise=Math.min(2.2,qa(s.radius,n,!1)*1.04),s.settle=.7,s.aspect=.94;let t=e.findIndex(e=>e.id===c.id);t>=0&&e.splice(t,1),i.push(a)}}for(let e=i.length-1;e>=0;e--)t.splice(i[e],1)},oo=(e,t,n,r,i=!1)=>{let a=i?2.5+Math.random()*9:4+Math.random()*(Math.random()<.25?18:10),o=a+8,s=qa(a,r),c=a<10?.985+Math.random()*.02:.96+Math.random()*.03;return{id:e,x:o+Math.random()*Math.max(1,t-o*2),y:n+a+Math.random()*(i?120:36),radius:a,terminalRise:s,drift:(Math.random()-.5)*.22,vx:(Math.random()-.5)*.15,vy:-s*(.04+Math.random()*.14),phase:Math.random()*Math.PI*2,alpha:.42+Math.random()*.38,aspect:c,deformAmp:.008+Math.random()*.012+Math.min(.015,a*6e-4),deformPhase:Math.random()*Math.PI*2,deformSpeed:.7+Math.random()*.5,tilt:Math.random()*Math.PI*2,pulseBoost:0,streamStretch:0,streamAngle:0,mode2:0,mode2Vel:0,mode2Angle:Math.random()*Math.PI,mode3:0,mode3Vel:0,mode3Phase:Math.random()*Math.PI*2,settle:0}},so=(e,t,n)=>({x:Math.sin(t*.009+n*.48)*.12+Math.cos(e*.006-n*.32)*.09,y:Math.cos(e*.008+n*.38)*.05}),co=(e,t,n,r,i)=>{let a=1+(1-Math.min(1,Math.max(0,e.y/n)))*.12,o=(e.terminalRise*r*a- -e.vy)*(.022+e.radius*.0011);e.vy-=o*i;let s=.03+e.radius*.0025,c=Math.sin(t*(1.1+e.deformSpeed)+e.phase)*s+Math.sin(t*2.1+e.deformPhase)*s*.35;e.vy-=c*.02*i;let l=Math.sin(t*.85+e.deformPhase)*(.05+e.radius*.003)+Math.cos(t*.5+e.phase)*.03;e.vx+=l*.015*i;let u=so(e.x,e.y,t);e.vx+=(e.drift*.015+u.x*.05)*i,e.vy+=u.y*.025*i,e.vx*=Ga(.968,i),e.vy*=Ga(.994,i),e.x+=(e.vx+u.x*.22)*i,e.y+=e.vy*i},lo=(e,t,n,r,i,a,o)=>{let s=e-n,c=t-r,l=Math.hypot(s,c)||1,u=70+Math.min(140,o*3.8),d=l/u;if(d>1.35)return{fx:0,fy:0,strain:0,strainAngle:0,excite:0};let f=Math.exp(-d*d*2.1),p=s/l,m=c/l,h=Math.max(.001,Math.hypot(i,a)),g=i/h,_=a/h,v=-_,y=g,b=s*v+c*y,x=s*g+c*_,S=f*Math.min(1.15,o/22),C=x<0?1.35:.72,w=f*Math.min(1,o/18)*Math.tanh(b/(u*.35)),T=f*Math.min(.85,o/30)*(1-Math.abs(x)/(u+1)),E=g*S*1.55*C+v*w*1.25+p*T*.55,D=_*S*1.55*C+y*w*1.25+m*T*.55;return{fx:E,fy:D,strain:f*Math.min(1,o/16)*(.55+Math.abs(w)*.45),strainAngle:Math.atan2(D+_*.4,E+g*.4),excite:f*Math.min(1.2,o/14)}},uo=(e,t)=>{let n=.22+3.4/Math.sqrt(Math.max(6,e.radius)),r=n*1.55,i=.045+e.radius*9e-4,a=.055+e.radius*.001;e.mode2Vel+=(-n*n*e.mode2-i*e.mode2Vel)*t,e.mode2+=e.mode2Vel*t,e.mode2=Math.max(-1.1,Math.min(1.1,e.mode2)),e.mode2*=Ga(.998,t),e.mode3Vel+=(-r*r*e.mode3-a*e.mode3Vel)*t,e.mode3+=e.mode3Vel*t,e.mode3=Math.max(-.9,Math.min(.9,e.mode3)),e.mode3*=Ga(.997,t),e.mode3Phase+=(.04+Math.abs(e.mode3Vel)*.8)*t,e.streamStretch*=Ga(.88,t),Math.abs(e.streamStretch)<.004&&(e.streamStretch=0),Math.abs(e.mode2)<.002&&Math.abs(e.mode2Vel)<.002&&(e.mode2=0,e.mode2Vel=0),Math.abs(e.mode3)<.002&&Math.abs(e.mode3Vel)<.002&&(e.mode3=0,e.mode3Vel=0)},fo=(e,t,n,r,i,a)=>{if(t<.02&&r<.02)return;let o=Math.min(.55,t*.65);e.streamStretch=e.streamStretch*(1-o)+t*o,e.streamAngle=e.streamAngle*(1-o)+n*o;let s=r*(.06+Math.min(.05,e.radius*.0014));e.mode2Vel+=s*(.75+Math.random()*.85),e.mode2Angle=e.mode2Angle*.7+n*.3,e.mode3Vel+=s*.45*(Math.random()-.3),e.pulseBoost=Math.min(1.35,e.pulseBoost+r*.08),e.tilt+=(i*.002-a*.0015)*r},po=(e,t,n)=>{let r=Math.sin(n*e.deformSpeed+e.deformPhase)*e.deformAmp+(Math.sin(t*2+e.phase+n*.4)*e.deformAmp*.55+Math.sin(t*3+e.deformPhase)*e.deformAmp*.25)+e.pulseBoost*.035+e.settle*.06;if(Math.abs(e.streamStretch)>.01){let n=Math.cos(t-e.streamAngle),i=e.streamStretch*(.14+Math.min(.08,e.radius*.0025));r+=n*n*i,r-=(1-n*n)*i*.55}return Math.abs(e.mode2)>.002&&(r+=e.mode2*Math.cos(2*(t-e.mode2Angle))*.28),Math.abs(e.mode3)>.002&&(r+=e.mode3*Math.cos(3*(t-e.mode3Phase))*.16),e.radius*(1+r)},mo=(e,t)=>{let n=e.x,r=e.y,i=e.aspect-e.settle*.04,a=e.tilt,o=Math.abs(e.streamStretch)*.7+Math.abs(e.mode2)*.9+Math.abs(e.mode3)*.35;if(o>.03){let t=Math.min(1,o),n=e.streamStretch>.02?e.streamAngle:e.mode2Angle;a=a*(1-t*.55)+n*t*.55,i-=Math.min(.12,e.streamStretch*.1+Math.abs(e.mode2)*.08)}let s=Math.cos(a),c=Math.sin(a),l=new Path2D;for(let a=0;a<=48;a++){let o=Math.PI*2*a/48,u=po(e,o,t),d=Math.cos(o)*u,f=Math.sin(o)*u*i,p=n+d*s-f*c,m=r+d*c+f*s;a===0?l.moveTo(p,m):l.lineTo(p,m)}return l.closePath(),l},ho=(e,t,n,r,i,a,o,s)=>{let c=(e-n)*(e-n)+(t-r)*(t-r)+.35,l=(e-a)*(e-a)+(t-o)*(t-o)+.35;return i*i/c+s*s/l},go=(e,t,n,r,i,a,o,s,c)=>{let l=Math.cos(e),u=Math.sin(e),d=Math.hypot(t-s,n-c)+Math.hypot(i-s,a-c)+r+o+8,f=0,p=d;for(let e=0;e<14;e++){let e=(f+p)*.5;ho(s+l*e,c+u*e,t,n,r,i,a,o)>=1?f=e:p=e}let m=(f+p)*.5;return{x:s+l*m,y:c+u*m}},_o=(e,t,n,r,i,a)=>{let o=n+a||1,s=(e*n+r*a)/o,c=(t*n+i*a)/o,l=new Path2D;for(let o=0;o<=56;o++){let u=go(Math.PI*2*o/56,e,t,n,r,i,a,s,c);o===0?l.moveTo(u.x,u.y):l.lineTo(u.x,u.y)}return l.closePath(),{path:l,cx:s,cy:c,radius:Math.max(n,a)}},vo=(e,t,n,r,i,a)=>{let o=mo(t,n),s=Math.min(1,Math.max(0,t.y/a)),c=i*La,l=a*Ra,u=Math.atan2(l-t.y,c-t.x),d=t.x+Math.cos(u)*t.radius*.38,f=t.y+Math.sin(u)*t.radius*.38,p=t.x-Math.cos(u)*t.radius*.42,m=t.y-Math.sin(u)*t.radius*.42,h=t.alpha*(.55+(1-s)*.55),g=e.createRadialGradient(d,f,t.radius*.04,t.x,t.y,t.radius*1.45);g.addColorStop(0,`rgb(255 255 255 / 72%)`),g.addColorStop(.12,`rgb(186 230 253 / 42%)`),g.addColorStop(.35,`${r}30`),g.addColorStop(.62,`rgb(14 116 144 / 22%)`),g.addColorStop(.85,`rgb(2 12 27 / 48%)`),g.addColorStop(1,`rgb(1 4 12 / 78%)`),e.fillStyle=g,e.globalAlpha=h,e.fill(o),e.save(),e.clip(o);let _=e.createRadialGradient(p,m,0,p,m,t.radius*.95);_.addColorStop(0,`rgb(1 8 20 / 58%)`),_.addColorStop(.55,`rgb(2 12 27 / 28%)`),_.addColorStop(1,`rgb(2 12 27 / 0%)`),e.fillStyle=_,e.fillRect(t.x-t.radius*1.2,t.y-t.radius*1.2,t.radius*2.4,t.radius*2.4),e.beginPath(),e.ellipse(d,f,t.radius*.2,t.radius*.11,u-.25,0,Math.PI*2),e.fillStyle=`rgb(255 255 255 / 78%)`,e.fill(),e.beginPath(),e.ellipse(t.x+Math.cos(u+.9)*t.radius*.15,t.y+Math.sin(u+.9)*t.radius*.15,t.radius*.07,t.radius*.04,u,0,Math.PI*2),e.fillStyle=`rgb(255 255 255 / 22%)`,e.fill(),e.restore();let v=e.createRadialGradient(t.x,t.y,t.radius*.68,t.x,t.y,t.radius*1.06);v.addColorStop(0,`rgb(255 255 255 / 0%)`),v.addColorStop(.5,`rgb(186 230 253 / 24%)`),v.addColorStop(1,`rgb(224 242 254 / 55%)`),e.strokeStyle=v,e.lineWidth=.8+t.radius*.028,e.stroke(o),e.globalAlpha=1},yo=(e,t,n,r,i,a,o,s,c,l,u)=>{let d=_o(t,n,r,i,a,o),f=Math.min(1,Math.max(0,d.cy/l)),p=c*La,m=l*Ra,h=Math.atan2(m-d.cy,p-d.cx),g=d.cx+Math.cos(h)*d.radius*.32,_=d.cy+Math.sin(h)*d.radius*.32,v=Math.hypot(t-i,n-a)+r+o,y=e.createRadialGradient(g,_,d.radius*.05,d.cx,d.cy,v*.75);y.addColorStop(0,`rgb(255 255 255 / 70%)`),y.addColorStop(.14,`rgb(186 230 253 / 40%)`),y.addColorStop(.4,`${s}32`),y.addColorStop(.75,`rgb(2 12 27 / 45%)`),y.addColorStop(1,`rgb(1 4 12 / 75%)`),e.fillStyle=y,e.globalAlpha=u*(.55+(1-f)*.5),e.fill(d.path),e.save(),e.clip(d.path),e.beginPath(),e.ellipse(g,_,d.radius*.22,d.radius*.12,h-.2,0,Math.PI*2),e.fillStyle=`rgb(255 255 255 / 72%)`,e.fill(),e.restore(),e.strokeStyle=`rgb(224 242 254 / 42%)`,e.lineWidth=1+d.radius*.02,e.stroke(d.path),e.globalAlpha=1},bo={bubbleField:`cos-bubbleField-i9211`,canvas:`cos-canvas-8vKsT`},xo=({width:e,height:t,fill:n=!1,bubbleCount:r=36,speed:i=1,color:a=`#7dd3fc`,interactive:o=!0})=>{let{hostRef:s,width:u,height:d,hostStyle:f}=T({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),p=(0,c.useRef)(null),m=(0,c.useRef)([]),h=(0,c.useRef)([]),g=(0,c.useRef)(Va()),_=(0,c.useRef)(0),x=(0,c.useRef)(0),S=(0,c.useRef)(1),C=(0,c.useRef)(0),w=(0,c.useRef)(null),E=(0,c.useRef)(null),D=(0,c.useRef)({width:u,height:d,speed:i,color:a,interactive:o,bubbleCount:r});return(0,c.useEffect)(()=>{D.current={width:u,height:d,speed:i,color:a,interactive:o,bubbleCount:r}},[u,d,i,a,o,r]),(0,c.useEffect)(()=>{m.current=Array.from({length:r},()=>{let e=oo(S.current++,u,d,i,!0);return e.y=d*(.15+Math.random()*.85),e.vy=-e.terminalRise*(.35+Math.random()*.35),e}),h.current=[],g.current=Va(),_.current=0,x.current=0,C.current=0},[r,d,i,u]),(0,c.useEffect)(()=>{let e=p.current;if(!e)return;let t=Math.min(window.devicePixelRatio||1,2);e.width=Math.floor(u*t),e.height=Math.floor(d*t);let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let r=0,i=0,a=document.hidden,o=y(),s=v(e=>{a=e}),c=b(e=>{o=e});E.current||=$a();let l=E.current,f=(t,n)=>{let r=e.getBoundingClientRect(),i=u/Math.max(r.width,1),a=d/Math.max(r.height,1);return{x:(t-r.left)*i,y:(n-r.top)*a}},T=(e,t)=>{if(!D.current.interactive)return;let{x:n,y:r}=f(e,t),i=g.current,a=performance.now(),o=i.lastTs>0?Math.max(1,a-i.lastTs):16;if(i.active){let e=n-i.x,t=r-i.y,a=16/o,s=e*a,c=t*a,l=Math.hypot(s,c);i.vx=i.vx*.55+s*.45,i.vy=i.vy*.55+c*.45,i.speed=i.speed*.55+l*.45}else i.vx=0,i.vy=0,i.speed=0;i.prevX=i.x,i.prevY=i.y,i.x=n,i.y=r,i.active=!0,i.lastTs=a},O=()=>{g.current=Va()},k=e=>{T(e.clientX,e.clientY)},A=e=>{T(e.clientX,e.clientY)},j=e=>{T(e.clientX,e.clientY)};e.addEventListener(`pointermove`,k),e.addEventListener(`pointerenter`,A),e.addEventListener(`pointerdown`,j),e.addEventListener(`pointerleave`,O);let M=r=>{let i=`${u}x${d}@${t}:${r}`;if(w.current?.key!==i){let n=document.createElement(`canvas`);n.width=e.width,n.height=e.height;let a=n.getContext(`2d`);a&&(a.setTransform(t,0,0,t,0,0),Za(a,u,d,r),w.current={key:i,canvas:n})}w.current&&n.drawImage(w.current.canvas,0,0,u,d)},N=()=>{let{color:e}=D.current;M(e),Qa(n,u,d,_.current,l,!0);let t=[...m.current].sort((e,t)=>t.y-e.y);for(let r of t)vo(n,r,_.current,e,u,d)};if(o)return N(),()=>{e.removeEventListener(`pointermove`,k),e.removeEventListener(`pointerenter`,A),e.removeEventListener(`pointerdown`,j),e.removeEventListener(`pointerleave`,O),s(),c()};let P=(e=0)=>{if(i=requestAnimationFrame(P),a||o)return;r||=e;let t=Math.min(40,Math.max(8,e-r||16.666666666666668));r=e;let s=t/za,c=t/1e3;_.current+=c;let f=_.current,{color:p,speed:v,bubbleCount:y,interactive:b}=D.current;M(p),Qa(n,u,d,f,l,!1),x.current+=c,x.current>.2&&m.current.length<y&&(x.current=0,m.current.push(oo(S.current++,u,d,v)));let w=g.current;w.active&&(w.speed*=Ga(.94,s),w.vx*=Ga(.94,s),w.vy*=Ga(.94,s));let T=new Set;for(let e of h.current)T.add(e.primaryId),T.add(e.secondaryId);for(let e of m.current){if(e.phase+=.008*s,e.tilt+=Math.sin(f*.2+e.deformPhase)*.0012*s,e.pulseBoost*=Ga(.92,s),e.settle*=Ga(.93,s),e.settle>0&&(e.aspect+=(.985-e.aspect)*.08*s),e.settle<.01&&(e.settle=0),T.has(e.id))uo(e,s);else{co(e,f,d,v,s),uo(e,s);let t=Math.hypot(e.vx,e.vy+e.terminalRise*.35);if(t>.55){let n=Math.atan2(e.vy,e.vx);e.streamStretch=Math.min(.85,e.streamStretch*Ga(.9,s)+Math.min(.35,(t-.55)*.08)*s),e.streamAngle=e.streamAngle*Ga(.85,s)+n*(1-Ga(.85,s))}}if(b&&w.active&&w.speed>.2&&!T.has(e.id)){let t=lo(e.x,e.y,w.x,w.y,w.vx,w.vy,w.speed);if(t.excite>.01||Math.hypot(t.fx,t.fy)>.01){let n=1/(.75+e.radius*.035);e.vx+=t.fx*n*s,e.vy+=t.fy*n*.82*s,fo(e,t.strain,t.strainAngle,t.excite,t.fx,t.fy)}}if(e.y+e.radius<-12){let t=oo(S.current++,u,d,v);Object.assign(e,t,{y:d+t.radius+ C.current++*.01})}e.x<-e.radius*1.5&&(e.x=u+e.radius),e.x>u+e.radius*1.5&&(e.x=-e.radius)}let E=m.current.filter(e=>!T.has(e.id));ro(E),io(E,h.current,T),ao(m.current,h.current,v,s),T.clear();for(let e of h.current)T.add(e.primaryId),T.add(e.secondaryId);for(let e of h.current){let t=e.pose??to(e),r=Math.min(.9,.55+t.absorb*.2);yo(n,t.ax,t.ay,t.ar,t.bx,t.by,t.br,p,u,d,r)}let O=[...m.current].sort((e,t)=>t.y-e.y);for(let e of O)T.has(e.id)||vo(n,e,f,p,u,d)};return P(),()=>{cancelAnimationFrame(i),e.removeEventListener(`pointermove`,k),e.removeEventListener(`pointerenter`,A),e.removeEventListener(`pointerdown`,j),e.removeEventListener(`pointerleave`,O),s(),c()}},[d,u]),(0,l.jsx)(`div`,{ref:s,className:bo.bubbleField,style:f,children:(0,l.jsx)(`canvas`,{ref:p,className:bo.canvas,style:{width:u,height:d}})})},So={solarSystem:`cos-solarSystem-27h8F`,canvas:`cos-canvas-C0nRa`},Co=[{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}],wo=({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=Co.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=v(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:So.solarSystem,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:So.canvas,style:{width:e,height:t}})})},To={snowfall:`cos-snowfall-Q-Dhg`,canvas:`cos-canvas-bJVF8`},Eo=({width:e,height:t,fill:n=!1,mode:r=`snow`,count:i=120})=>{let{hostRef:a,width:o,height:s,hostStyle:u}=T({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),d=(0,c.useRef)(null),f=(0,c.useRef)([]),p=(0,c.useRef)(0),m=(0,c.useCallback)(e=>({x:Math.random()*o,y:e??Math.random()*s,size:r===`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}),[s,r,o]);return(0,c.useEffect)(()=>{f.current=Array.from({length:i},()=>m())},[i,m]),(0,c.useEffect)(()=>{let e=d.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=o*t,e.height=s*t;let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let i=document.hidden,a=y(),c=v(e=>{i=e}),l=b(e=>{a=e}),u=e=>{n.globalAlpha=e.opacity,n.fillStyle=`#fff`,n.beginPath(),n.arc(e.x,e.y,e.size,0,Math.PI*2),n.fill()},h=e=>{n.save(),n.translate(e.x,e.y),n.rotate(e.rotation),n.globalAlpha=e.opacity;let t=e.size;n.fillStyle=`#ffb7c5`,n.beginPath(),n.ellipse(0,0,t,t*.6,0,0,Math.PI*2),n.fill(),n.fillStyle=`#ff8fa3`,n.beginPath(),n.ellipse(t*.3,0,t*.5,t*.35,.5,0,Math.PI*2),n.fill(),n.restore()},g=e=>{n.fillStyle=r===`sakura`?`#1a1020`:`#0f172a`,n.fillRect(0,0,o,s),f.current.forEach(t=>{e&&(t.y+=t.speed,t.x+=t.drift+Math.sin(t.y*.02)*.3,t.rotation+=t.rotationSpeed,t.y>s+10&&Object.assign(t,m(-10))),r===`sakura`?h(t):u(t)}),n.globalAlpha=1};if(a)return g(!1),()=>{c(),l()};let _=()=>{p.current=requestAnimationFrame(_),!i&&(a||g(!0))};return _(),()=>{cancelAnimationFrame(p.current),c(),l()}},[m,s,r,o]),(0,l.jsx)(`div`,{ref:a,className:To.snowfall,style:u,children:(0,l.jsx)(`canvas`,{ref:d,className:To.canvas,style:{width:o,height:s}})})},Do={starfield:`cos-starfield-QTwia`,canvas:`cos-canvas-C2t3g`},Oo=({width:e,height:t,fill:n=!1,starCount:r=400,speed:i=1})=>{let{hostRef:a,width:o,height:s,hostStyle:u}=T({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),d=(0,c.useRef)(null),f=(0,c.useRef)([]),p=(0,c.useRef)(0);return(0,c.useEffect)(()=>{f.current=Array.from({length:r},()=>({x:(Math.random()-.5)*o,y:(Math.random()-.5)*s,z:Math.random()*o}))},[s,r,o]),(0,c.useEffect)(()=>{let e=d.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=o*t,e.height=s*t;let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let r=o/2,a=s/2,c=document.hidden,l=y(),u=v(e=>{c=e}),m=b(e=>{l=e}),h=e=>{n.fillStyle=`rgb(0 0 0 / 25%)`,n.fillRect(0,0,o,s),f.current.forEach(t=>{e&&(t.z-=i*2,t.z<=0&&(t.x=(Math.random()-.5)*o,t.y=(Math.random()-.5)*s,t.z=o));let c=128/t.z,l=t.x*c+r,u=t.y*c+a;if(l<0||l>=o||u<0||u>=s)return;let d=(1-t.z/o)*3,f=(1-t.z/o)*255;if(e&&d>.5){let e=128/(t.z+i*4),o=t.x*e+r,s=t.y*e+a;n.beginPath(),n.strokeStyle=`rgb(${f} ${f} ${f+30})`,n.lineWidth=d,n.moveTo(o,s),n.lineTo(l,u),n.stroke()}else n.fillStyle=`rgb(${f} ${f} ${f+30})`,n.fillRect(l,u,Math.max(d,.5),Math.max(d,.5))})};if(l)return n.fillStyle=`#000`,n.fillRect(0,0,o,s),h(!1),()=>{u(),m()};let g=()=>{p.current=requestAnimationFrame(g),!c&&(l||h(!0))};return g(),()=>{cancelAnimationFrame(p.current),u(),m()}},[s,i,r,o]),(0,l.jsx)(`div`,{ref:a,className:Do.starfield,style:u,children:(0,l.jsx)(`canvas`,{ref:d,className:Do.canvas,style:{width:o,height:s}})})},ko={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`},Ao=({progress:e=0,onOpen:t,label:n=`开启宝箱`,openedLabel:r=`宝箱已开启!`})=>{let i=(0,c.useRef)(!1),a=(0,c.useRef)(t),o=_(e,0,100),s=o>=100;return(0,c.useEffect)(()=>{a.current=t},[t]),(0,c.useEffect)(()=>{s&&!i.current&&(i.current=!0,a.current?.()),s||(i.current=!1)},[s]),(0,l.jsxs)(`div`,{className:ko.progressChest,children:[(0,l.jsxs)(`div`,{className:ko.barWrap,children:[(0,l.jsx)(`div`,{className:ko.barTrack,children:(0,l.jsx)(`div`,{className:ko.barFill,style:{width:`${o}%`}})}),(0,l.jsxs)(`span`,{className:ko.pct,children:[o.toFixed(0),`%`]})]}),(0,l.jsxs)(`div`,{className:`${ko.chest} ${s?ko.open:``}`,children:[(0,l.jsxs)(`div`,{className:ko.lid,children:[(0,l.jsx)(`div`,{className:ko.lidTop}),(0,l.jsx)(`div`,{className:ko.lock})]}),(0,l.jsx)(`div`,{className:ko.body,children:s&&(0,l.jsxs)(`div`,{className:ko.treasure,children:[(0,l.jsx)(`span`,{children:`💎`}),(0,l.jsx)(`span`,{children:`✨`}),(0,l.jsx)(`span`,{children:`🪙`})]})})]}),(0,l.jsx)(`p`,{className:ko.label,children:s?r:n})]})},jo={radarScan:`cos-radarScan-PZaG8`,canvas:`cos-canvas-fUw5N`},Mo=({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=v(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:jo.radarScan,style:{width:e,height:e},children:(0,l.jsx)(`canvas`,{ref:r,className:jo.canvas,style:{width:e,height:e}})})},No={redPacketRain:`cos-redPacketRain-eJ7FW`,canvas:`cos-canvas-direH`,hud:`cos-hud-InqMq`,end:`cos-end-u0J7o`,hint:`cos-hint-sO6ld`},Po=(0,c.forwardRef)(({width:e,height:t,fill:n=!1,duration:r=1e4,auto:i=!0,onGrab:a,onEnd:o,grabbedLabel:s=`已抢:`,endedText:u=`红包雨结束`,hint:d=`点击红包抢夺`},f)=>{let p=(0,c.useRef)(null),{width:m,height:h}=w({fill:n,width:e,height:t,defaultWidth:400,defaultHeight:500,measured:C(p,{enabled:n})}),g=(0,c.useRef)(null),_=(0,c.useRef)([]),x=(0,c.useRef)(0),T=(0,c.useRef)(0),E=(0,c.useRef)(0),D=(0,c.useRef)(0),O=(0,c.useRef)(0),[k,A]=(0,c.useState)(0),[j,M]=(0,c.useState)(i),N=(0,c.useRef)(i),P=(0,c.useRef)(a),F=(0,c.useRef)(o),I=(0,c.useRef)({width:m,height:h});I.current={width:m,height:h},(0,c.useEffect)(()=>{P.current=a},[a]),(0,c.useEffect)(()=>{F.current=o},[o]),(0,c.useEffect)(()=>{N.current=j},[j]);let L=(0,c.useCallback)(()=>{N.current&&(N.current=!1,M(!1),F.current?.())},[]),R=(0,c.useCallback)(()=>{O.current+=1;let e=O.current;_.current=[],E.current=0,N.current=!0,M(!0),window.clearTimeout(D.current),D.current=window.setTimeout(()=>{e===O.current&&L()},r)},[r,L]),z=(0,c.useCallback)(()=>{window.clearTimeout(D.current),L()},[L]),B=(0,c.useCallback)(()=>{window.clearTimeout(D.current),O.current+=1,_.current=[],E.current=0,N.current=!1,M(!1),A(0)},[]);(0,c.useImperativeHandle)(f,()=>({start:R,stop:z,reset:B}),[B,R,z]);let V=(0,c.useCallback)(()=>{let{width:e}=I.current;_.current.push({id:T.current++,x:Math.random()*(e-50)+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})},[]);(0,c.useEffect)(()=>(i&&R(),()=>{window.clearTimeout(D.current)}),[i,R]),(0,c.useEffect)(()=>{let e=g.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=m*t,e.height=h*t;let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let r=document.hidden,i=y(),a=v(e=>{r=e}),o=b(e=>{i=e}),s=()=>{if(x.current=requestAnimationFrame(s),r)return;let{width:e,height:t}=I.current;!i&&N.current&&(E.current++,E.current%20==0&&V()),n.fillStyle=`rgb(15 23 42 / 20%)`,n.fillRect(0,0,e,t),_.current=_.current.filter(e=>e.grabbed?!1:(i||(e.y+=e.speed,e.x+=Math.sin(e.y*.02)*.5),n.save(),n.translate(e.x,e.y),n.rotate(e.rotation),n.fillStyle=`#dc2626`,n.beginPath(),n.roundRect(-22,-28,44,56,6),n.fill(),n.fillStyle=`#fbbf24`,n.beginPath(),n.arc(0,-10,8,0,Math.PI*2),n.fill(),n.fillStyle=`#fde68a`,n.font=`bold 12px system-ui`,n.textAlign=`center`,n.fillText(`¥${e.amount}`,0,12),n.restore(),i?!0:e.y<t+60))};return s(),()=>{cancelAnimationFrame(x.current),a(),o()}},[h,V,m]);let H=(e,t)=>{if(!N.current)return;let n=!1;_.current=_.current.map(r=>r.grabbed||n?r:Math.abs(e-r.x)<30&&Math.abs(t-r.y)<35?(n=!0,A(e=>e+r.amount),P.current?.(r.amount),{...r,grabbed:!0}):r)};return(0,l.jsxs)(`div`,{ref:p,className:No.redPacketRain,style:n?{width:`100%`,height:`100%`}:void 0,children:[(0,l.jsx)(`canvas`,{ref:g,className:No.canvas,style:{width:m,height:h,touchAction:`none`},onPointerDown:e=>{let t=S(e.currentTarget,e.nativeEvent);t&&H(t.x,t.y)}}),(0,l.jsxs)(`div`,{className:No.hud,children:[(0,l.jsxs)(`span`,{children:[s,` ¥`,k]}),!j&&(0,l.jsx)(`span`,{className:No.end,children:u})]}),(0,l.jsx)(`p`,{className:No.hint,children:d})]})});Po.displayName=`RedPacketRain`;var Fo={returnCityContainer:`cos-returnCityContainer-6XTxj`,star:`cos-star-a59Dx`,glassWrap:`cos-glassWrap-golMO`,rotate:`cos-rotate-7X9Jj`,glassItem:`cos-glassItem-OwlFI`},Io=({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=Fo.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=Fo.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:Fo.returnCityContainer,children:(0,l.jsx)(`div`,{ref:i,className:Fo.glassWrap})})},Lo={ropeChain:`cos-ropeChain-gYaSK`,canvas:`cos-canvas-5i95N`},Ro=({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}},_=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`,_),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=v(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`,_),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:Lo.ropeChain,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:Lo.canvas,style:{width:e,height:t}})})},zo={rotatingText:`cos-rotatingText-uIUt4`,badge:`cos-badge-kZAc-`,char:`cos-char-B5HUV`,enter:`cos-enter-JqV3n`,slideIn:`cos-slideIn-4B5cg`,exit:`cos-exit-5rJ34`,slideOut:`cos-slideOut-YeYDC`},Bo=[`React`,`Motion`,`Design`,`COS`],Vo=e=>{let t=Intl;if(t.Segmenter){let n=new t.Segmenter(`en`,{granularity:`grapheme`});return Array.from(n.segment(e),e=>e.segment)}return Array.from(e)},Ho=({texts:e=Bo,interval:t=2200,stagger:n=40,duration:r=420,fontSize:i=56,color:a=`#0f172a`,highlightColor:o=`#38bdf8`})=>{let s=(0,c.useMemo)(()=>e.length>0?e:Bo,[e]),[u,d]=(0,c.useState)(0),[f,p]=(0,c.useState)(`enter`),m=(0,c.useMemo)(()=>Vo(s[u]),[u,s]);return(0,c.useEffect)(()=>{let e,i;return e=setTimeout(()=>{p(`exit`),i=setTimeout(()=>{d(e=>(e+1)%s.length),p(`enter`)},m.length*n+r)},t),()=>{e&&clearTimeout(e),i&&clearTimeout(i)}},[m.length,r,u,t,s.length,n]),(0,l.jsx)(`div`,{className:zo.rotatingText,children:(0,l.jsx)(`div`,{className:zo.badge,style:{fontSize:i,color:a,"--rt-bg":o,"--rt-duration":`${r}ms`},children:m.map((e,t)=>(0,l.jsx)(`span`,{className:`${zo.char} ${f===`enter`?zo.enter:zo.exit}`,style:{animationDelay:`${f===`enter`?t*n:(m.length-1-t)*n}ms`},children:e===` `?`\xA0`:e},`${s[u]}-${e}-${t}-${f}`))})})},Uo={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`},Wo=(e,t,n,r)=>{let i=(r-90)*Math.PI/180;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}},Go=({value:e=0,max:t=100,label:n=`SPEED`,color:r=`#f97316`})=>{let i=-120+_(t>0?e/t:0,0,1)*240,a=(0,c.useMemo)(()=>{let e=Wo(100,100,72,-120),t=Wo(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=Wo(100,100,72,-120),t=Wo(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=Wo(100,100,58,i);return(0,l.jsxs)(`div`,{className:Uo.speedometer,style:{"--gauge-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 200 130`,className:Uo.svg,children:[(0,l.jsx)(`path`,{d:a,className:Uo.track,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),(0,l.jsx)(`path`,{d:o,className:Uo.valueArc,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),[-120,-60,0,60,120].map(e=>{let t=Wo(100,100,58,e),n=Wo(100,100,66,e);return(0,l.jsx)(`line`,{x1:t.x,y1:t.y,x2:n.x,y2:n.y,className:Uo.tick},e)}),(0,l.jsx)(`line`,{x1:`100`,y1:`100`,x2:s.x,y2:s.y,className:Uo.needle}),(0,l.jsx)(`circle`,{cx:`100`,cy:`100`,r:`6`,className:Uo.hub}),(0,l.jsx)(`text`,{x:`100`,y:`118`,className:Uo.valueText,children:Math.round(e)})]}),(0,l.jsx)(`span`,{className:Uo.label,children:n})]})},Ko={shinyText:`cos-shinyText-L0KoE`,text:`cos-text-J5KhP`,"shine-sweep":`cos-shine-sweep-jIufI`,paused:`cos-paused-dqgKu`},qo=({text:e=`SHINY TEXT`,speed:t=2,color:n=`#94a3b8`,shineColor:r=`#ffffff`,fontSize:i=64,disabled:a=!1})=>(0,l.jsx)(`div`,{className:Ko.shinyText,children:(0,l.jsx)(`span`,{className:`${Ko.text} ${a?Ko.paused:``}`,style:{fontSize:i,"--shiny-color":n,"--shiny-shine":r,"--shiny-duration":`${Math.max(t,.4)}s`},children:e})}),Jo={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`},Yo=({steps:e=[`Start`,`Process`,`Review`,`Done`],current:t=0,color:n=`#22d3ee`})=>{let r=_(t,0,Math.max(0,e.length-1)),i=e.length>1?r/(e.length-1):0;return(0,l.jsx)(`div`,{className:Jo.timelinePulse,style:{"--pulse-color":n,"--step-count":e.length,"--progress-ratio":i},children:(0,l.jsxs)(`div`,{className:Jo.axis,children:[(0,l.jsx)(`div`,{className:Jo.track}),(0,l.jsx)(`div`,{className:Jo.progress}),(0,l.jsx)(`ul`,{className:Jo.steps,children:e.map((e,t)=>{let n=t<r?`done`:t===r?`current`:`pending`;return(0,l.jsxs)(`li`,{className:Jo.step,"data-state":n,children:[(0,l.jsx)(`span`,{className:Jo.dot}),(0,l.jsx)(`span`,{className:Jo.name,children:e})]},e+t)})})]})})},Xo={rippleWater:`cos-rippleWater-wsinI`,canvas:`cos-canvas-XOdSF`,hint:`cos-hint-0JH5D`},Zo=`
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"),u=require("three");u=s(u,1);var d={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`},f=({children:e,scanColor:t=`#22c55e`,speed:n=2.5})=>(0,l.jsxs)(`div`,{className:d.barcodeScan,style:{"--scan-color":t,"--scan-speed":`${n}s`},children:[(0,l.jsx)(`div`,{className:d.content,children:e??(0,l.jsx)(`span`,{className:d.placeholder,children:`SCAN ME`})}),(0,l.jsxs)(`div`,{className:d.overlay,children:[(0,l.jsx)(`div`,{className:d.scanLine}),(0,l.jsx)(`div`,{className:d.glitchLayer})]}),(0,l.jsxs)(`div`,{className:d.corners,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]})]}),p={blurText:`cos-blurText-I8PNq`,text:`cos-text-t-IfM`,unit:`cos-unit-8HSAb`,idle:`cos-idle-OqUeJ`,top:`cos-top-j8xKn`,enter:`cos-enter-ZtGBp`,blurFromTop:`cos-blurFromTop-7baxF`,bottom:`cos-bottom-s-Evv`,blurFromBottom:`cos-blurFromBottom-UMwhj`},m=({text:e=`BLUR TEXT`,animateBy:t=`words`,direction:n=`top`,stagger:r=120,duration:i=500,fontSize:a=56,color:o=`#f8fafc`,onAnimationComplete:s})=>{let[u,d]=(0,c.useState)(!1),f=(0,c.useRef)(null),m=(0,c.useRef)(!1),h=(0,c.useMemo)(()=>t===`words`?e.split(` `):e.split(``),[t,e]);return(0,c.useEffect)(()=>{let e=f.current;if(!e)return;let t=new IntersectionObserver(([e])=>{e.isIntersecting&&(d(!0),t.disconnect())},{threshold:.15});return t.observe(e),()=>t.disconnect()},[]),(0,c.useEffect)(()=>{if(!u||m.current||!s)return;let e=h.length*r+i,t=window.setTimeout(()=>{m.current=!0,s()},e);return()=>window.clearTimeout(t)},[i,h.length,u,s,r]),(0,l.jsx)(`div`,{className:p.blurText,ref:f,children:(0,l.jsx)(`p`,{className:p.text,style:{fontSize:a,"--blur-color":o,"--blur-duration":`${i}ms`},children:h.map((e,i)=>(0,l.jsxs)(`span`,{className:`${p.unit} ${p[n]} ${u?p.enter:p.idle}`,style:{animationDelay:`${i*r}ms`},children:[e===` `?`\xA0`:e,t===`words`&&i<h.length-1?`\xA0`:null]},`${e}-${i}`))})})},h={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`},g=({text:e=`BURN`,fontSize:t=64,onComplete:n,completedText:r=`Gone.`})=>{let i=(0,c.useRef)(null),a=(0,c.useRef)(null),[o,s]=(0,c.useState)(!1),[u,d]=(0,c.useState)(!1),f=(0,c.useRef)(!1),p=(0,c.useRef)(n);(0,c.useEffect)(()=>{p.current=n},[n]);let m=(0,c.useCallback)(()=>{o||u||s(!0)},[o,u]);return(0,c.useEffect)(()=>{if(!o||u)return;let n=i.current,r=a.current;if(!n||!r)return;let s=n.getBoundingClientRect(),c=window.devicePixelRatio||1,l=Math.ceil(s.width),m=Math.ceil(s.height);r.width=l*c,r.height=m*c,r.style.width=`${l}px`,r.style.height=`${m}px`;let h=r.getContext(`2d`);if(!h)return;h.scale(c,c);let g=document.createElement(`canvas`);g.width=l*c,g.height=m*c;let _=g.getContext(`2d`);if(!_)return;_.scale(c,c),_.font=`900 ${t}px system-ui, sans-serif`,_.textAlign=`center`,_.textBaseline=`middle`,_.fillStyle=`#f8fafc`,_.fillText(e,l/2,m/2);let v=_.getImageData(0,0,l*c,m*c).data,y=[];for(let e=0;e<m;e+=4)for(let t=0;t<l;t+=4)v[(Math.floor(e*c)*l*c+Math.floor(t*c))*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,l,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||(d(!0),f.current||(f.current=!0,p.current?.()))};return b=requestAnimationFrame(e=>C(e,e)),()=>{S=!0,cancelAnimationFrame(b)}},[o,u,e,t]),(0,l.jsxs)(`div`,{className:h.burnAway,children:[(0,l.jsxs)(`div`,{ref:i,className:h.stage,children:[!u&&(0,l.jsx)(`span`,{className:h.text,style:{fontSize:t,opacity:+!o},children:e}),(0,l.jsx)(`canvas`,{ref:a,className:h.canvas})]}),!o&&!u&&(0,l.jsx)(`button`,{type:`button`,className:h.trigger,onClick:m,children:`Ignite`}),u&&(0,l.jsx)(`p`,{className:h.hint,children:r})]})},_=(e,t,n)=>Math.min(n,Math.max(t,e)),v=(e,t,n)=>e+(t-e)*n,y=e=>{let t=()=>e(document.hidden);return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},b=()=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,x=e=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return e(!1),()=>void 0;let t=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=()=>e(t.matches);return n(),typeof t.addEventListener==`function`?(t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)):(t.addListener(n),()=>t.removeListener(n))},S=(e,t,n)=>{let r=()=>{if(e instanceof HTMLElement){t({width:e.clientWidth,height:e.clientHeight});return}let n=e.getBoundingClientRect();t({width:Math.round(n.width),height:Math.round(n.height)})};if(r(),typeof ResizeObserver>`u`)return typeof window>`u`?()=>void 0:(window.addEventListener(`resize`,r),()=>window.removeEventListener(`resize`,r));let i=new ResizeObserver(e=>{let n=e[0];n&&t({width:Math.round(n.contentRect.width),height:Math.round(n.contentRect.height)})});return i.observe(e,n),()=>i.disconnect()},C=(e,t)=>{let n=e.getBoundingClientRect(),r;return`clientX`in t&&typeof t.clientX==`number`?r=t:`touches`in t&&t.touches&&t.touches.length>0?r=t.touches[0]:`changedTouches`in t&&t.changedTouches&&t.changedTouches.length>0&&(r=t.changedTouches[0]),r?{x:r.clientX-n.left,y:r.clientY-n.top}:null},w=(e,t={})=>{let{enabled:n=!0}=t,[r,i]=(0,c.useState)({width:0,height:0});return(0,c.useEffect)(()=>{if(!n)return;let t=e.current;if(t)return S(t,i)},[n,e]),r},T=({fill:e=!1,width:t,height:n,defaultWidth:r,defaultHeight:i,measured:a})=>{if(e){let e=Math.max(0,a.width),t=Math.max(0,a.height);return e<1||t<1?{width:r,height:i,pending:!0}:{width:e,height:t,pending:!1}}return{width:t??r,height:n??i,pending:!1}},E=({fill:e=!1,width:t,height:n,defaultWidth:r,defaultHeight:i})=>{let a=(0,c.useRef)(null),{width:o,height:s,pending:l}=T({fill:e,width:t,height:n,defaultWidth:r,defaultHeight:i,measured:w(a,{enabled:e})});return{hostRef:a,width:o,height:s,hostStyle:e?{width:`100%`,height:`100%`}:{width:o,height:s},fill:e,pending:l}},D={aurora:`cos-aurora-dJJb8`,band:`cos-band-S5CoR`,"aurora-flow":`cos-aurora-flow-wU8TY`},O=[`#00ff87`,`#60efff`,`#7b2ff7`,`#f107a3`],k=({width:e,height:t,fill:n=!1,colors:r=O})=>{let{hostRef:i,hostStyle:a}=E({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),o=r.length>=2?r:O,[s,u]=(0,c.useState)(()=>typeof document<`u`&&document.hidden);return(0,c.useEffect)(()=>y(u),[]),(0,l.jsx)(`div`,{ref:i,className:D.aurora,style:a,children:o.map((e,t)=>(0,l.jsx)(`div`,{className:D.band,style:{"--aurora-color":e,"--aurora-delay":`${t*-3}s`,"--aurora-duration":`${12+t*2}s`,animationPlayState:s?`paused`:`running`}},e+t))})},A={audioVisualizer:`cos-audioVisualizer-r5dHp`,canvas:`cos-canvas-UNEea`},j=({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=y(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 _=()=>{if(c=requestAnimationFrame(_),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 _(),()=>{h=!0,cancelAnimationFrame(c),g(),p?.getTracks().forEach(e=>e.stop()),u?.close()}},[n,t,r,e]),(0,l.jsx)(`div`,{className:A.audioVisualizer,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:A.canvas,style:{width:e,height:t}})})},M={canvasClock:`cos-canvasClock-QvdV3`,canvasTarget:`cos-canvasTarget-x-odC`},N=({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=y(e=>{s=e}),l=()=>{s||o(i),a=requestAnimationFrame(l)};return l(),()=>{cancelAnimationFrame(a),c()}},[o,r]),(0,l.jsx)(`div`,{className:M.canvasClock,style:{width:r,height:r},children:(0,l.jsx)(`canvas`,{ref:n,className:M.canvasTarget,style:{width:r,height:r}})})},P={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`},F=15,I=258,L=e=>{let{initQuantity:t=0,value:n,onChange:r,onComplete:i,autoCharge:a=!0,interval:o=500,step:s=.01}=e,u=(0,c.useRef)(null),d=n!==void 0,[f,p]=(0,c.useState)(()=>_(t,0,100)),m=_(d?n:f,0,100),h=(0,c.useRef)(m),g=(0,c.useRef)(r),v=(0,c.useRef)(i),y=(0,c.useRef)(m>=100);(0,c.useEffect)(()=>{g.current=r},[r]),(0,c.useEffect)(()=>{v.current=i},[i]),(0,c.useEffect)(()=>{if(h.current=m,m<100){y.current=!1;return}y.current||(y.current=!0,v.current?.())},[m]),(0,c.useEffect)(()=>{let e=u.current;if(!e)return;let t=()=>{let t=Math.max(0,e.clientHeight-I);e.style.setProperty(`--charge-rise-max`,`${t}px`)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,c.useEffect)(()=>{if(!a)return;let e=window.setInterval(()=>{if(h.current>=100)return;let e=Math.min(100,Number((h.current+s).toFixed(2)));g.current?.(e),d||p(e)},o);return()=>clearInterval(e)},[a,o,d,s]);let b=m.toFixed(2);return(0,l.jsxs)(`div`,{ref:u,className:P.chargeContainer,"data-auto":a?`true`:`false`,style:{"--charge-pct":m},children:[(0,l.jsxs)(`div`,{className:P.contrast,children:[Array.from({length:F},(e,t)=>(0,l.jsx)(`span`,{className:P.bubble,"data-index":t+1},t)),(0,l.jsx)(`div`,{className:P.circle}),(0,l.jsx)(`div`,{className:P.button})]}),(0,l.jsxs)(`div`,{className:P.text,children:[b,`%`]})]})},R={circularText:`cos-circularText--zmER`,scaleWrap:`cos-scaleWrap-LiyQK`,bonkers:`cos-bonkers-Wovjy`,ring:`cos-ring-2amY8`,spin:`cos-spin-9njNq`,char:`cos-char-oPqHL`},z=({text:e=`COS DESIGN • REACT BITS • `,spinDuration:t=20,onHover:n=`speedUp`,fontSize:r=22,radius:i=90,color:a=`#f8fafc`})=>{let[o,s]=(0,c.useState)(!1),u=(0,c.useMemo)(()=>Array.from(e),[e]),d=(0,c.useMemo)(()=>{if(!o)return t;switch(n){case`slowDown`:return t*2;case`speedUp`:return t/4;case`pause`:return 0;case`goBonkers`:return Math.max(t/20,.2);default:return t}},[o,n,t]),f=i*2+r*2;return(0,l.jsx)(`div`,{className:R.circularText,children:(0,l.jsx)(`div`,{className:`${R.scaleWrap} ${o&&n===`goBonkers`?R.bonkers:``}`,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:(0,l.jsx)(`div`,{className:R.ring,style:{width:f,height:f,color:a,fontSize:r,animationDuration:d>0?`${d}s`:void 0,animationPlayState:d===0?`paused`:`running`},children:u.map((e,t)=>{let n=360/u.length*t;return(0,l.jsx)(`span`,{className:R.char,style:{transform:`rotate(${n}deg) translateY(-${i}px)`},children:e===` `?`\xA0`:e},`${e}-${t}`)})})})})},B={clickSpark:`cos-clickSpark-db9Om`,canvas:`cos-canvas-p9fnQ`,content:`cos-content-7uE4T`,hint:`cos-hint-UqpWX`},V=({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=y(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:B.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:B.canvas}),e&&(0,l.jsx)(`div`,{className:B.content,children:e}),!e&&(0,l.jsx)(`p`,{className:B.hint,children:`点击任意位置产生火花`})]})},H={confetti:`cos-confetti-MeNtU`,canvas:`cos-canvas-0T3Vs`,canvasPassthrough:`cos-canvasPassthrough-3xF83`,hint:`cos-hint-sGHEi`},U=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`,`#38bdf8`],W=()=>U[Math.floor(Math.random()*U.length)],ee=(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:W(),width:Math.random()*8+4,height:Math.random()*6+3,alpha:1,gravity:Math.random()*.15+.12}})},G=(0,c.forwardRef)(({width:e,height:t,fill:n=!1,auto:r=!0,interactive:i,particleCount:a=120,hint:o=`点击画布再次喷射`,onComplete:s},u)=>{let d=i??r,f=(0,c.useRef)(null),{width:p,height:m}=T({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:400,measured:w(f,{enabled:n})}),h=(0,c.useRef)(null),g=(0,c.useRef)([]),_=(0,c.useRef)(0),v=(0,c.useRef)(!1),S=(0,c.useRef)(s),C=(0,c.useRef)({width:p,height:m,particleCount:a});C.current={width:p,height:m,particleCount:a},(0,c.useEffect)(()=>{S.current=s},[s]);let E=(0,c.useCallback)(()=>{let{width:e,height:t,particleCount:n}=C.current,r=b();g.current.push(...ee(e,t,r?Math.min(24,n):n)),v.current=!0},[]);return(0,c.useImperativeHandle)(u,()=>({burst:E}),[E]),(0,c.useEffect)(()=>{r&&E()},[r,E]),(0,c.useEffect)(()=>{let e=h.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=p*t,e.height=m*t;let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let r=document.hidden,i=b(),a=y(e=>{r=e}),o=x(e=>{i=e}),s=()=>{if(_.current=requestAnimationFrame(s),r)return;n.clearRect(0,0,p,m);let e=i?.03:.008;g.current=g.current.filter(t=>(t.x+=t.vx,t.y+=t.vy,t.vy+=t.gravity,t.vx*=.99,t.rotation+=t.rotationSpeed,t.alpha-=e,t.alpha<=0||t.y>m+20?!1:(n.save(),n.translate(t.x,t.y),n.rotate(t.rotation*Math.PI/180),n.globalAlpha=t.alpha,n.fillStyle=t.color,n.fillRect(-t.width/2,-t.height/2,t.width,t.height),n.restore(),!0))),v.current&&g.current.length===0&&(v.current=!1,S.current?.())};return s(),()=>{cancelAnimationFrame(_.current),a(),o()}},[m,p]),(0,l.jsxs)(`div`,{ref:f,className:H.confetti,style:n?{width:`100%`,height:`100%`}:{width:p,height:m},children:[(0,l.jsx)(`canvas`,{ref:h,className:`${H.canvas} ${d?``:H.canvasPassthrough}`,style:{width:p,height:m,touchAction:d?`none`:`auto`},onPointerDown:d?E:void 0}),d&&o?(0,l.jsx)(`p`,{className:H.hint,children:o}):null]})});G.displayName=`Confetti`;var K={curvedLoop:`cos-curvedLoop-dtMD7`,svg:`cos-svg-YDyYF`,measure:`cos-measure-1lmnX`,pathText:`cos-pathText-SKIrW`},te=({text:e=`COS DESIGN ✦ CURVED LOOP ✦ `,speed:t=2,curveAmount:n=80,direction:r=`left`,interactive:i=!0,color:a=`#f8fafc`,fontSize:o=56})=>{let s=(0,c.useMemo)(()=>(/\s|\u00A0$/.test(e)?e.replace(/\s+$/,``):e)+`\xA0`,[e]),u=(0,c.useRef)(null),d=(0,c.useRef)(null),[f,p]=(0,c.useState)(0),[m,h]=(0,c.useState)(0),g=`curve-${(0,c.useId)().replace(/:/g,``)}`,_=`M-100,40 Q500,${40+n} 1540,40`,v=(0,c.useRef)(!1),y=(0,c.useRef)(0),b=(0,c.useRef)(r),x=(0,c.useRef)(0),S=f?Array(Math.ceil(1800/f)+2).fill(s).join(``):s,C=f>0;(0,c.useEffect)(()=>{b.current=r},[r]),(0,c.useEffect)(()=>{u.current&&p(u.current.getComputedTextLength())},[s,o]),(0,c.useEffect)(()=>{if(!f||!d.current)return;let e=-f;d.current.setAttribute(`startOffset`,`${e}px`),h(e)},[f]),(0,c.useEffect)(()=>{if(!f||!C)return;let e=0,n=()=>{if(!v.current&&d.current){let e=b.current===`right`?t:-t,n=Number.parseFloat(d.current.getAttribute(`startOffset`)||`0`)+e;n<=-f&&(n+=f),n>0&&(n-=f),d.current.setAttribute(`startOffset`,`${n}px`),h(n)}e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>cancelAnimationFrame(e)},[C,f,t]);let w=e=>{i&&(v.current=!0,y.current=e.clientX,x.current=0,e.target.setPointerCapture(e.pointerId))},T=e=>{if(!i||!v.current||!d.current)return;let t=e.clientX-y.current;y.current=e.clientX,x.current=t;let n=Number.parseFloat(d.current.getAttribute(`startOffset`)||`0`)+t;n<=-f&&(n+=f),n>0&&(n-=f),d.current.setAttribute(`startOffset`,`${n}px`),h(n)},E=()=>{i&&(v.current=!1,b.current=x.current>0?`right`:`left`)};return(0,l.jsx)(`div`,{className:K.curvedLoop,style:{visibility:C?`visible`:`hidden`,cursor:i?`grab`:`default`,"--curve-color":a,"--curve-font-size":`${o}px`},onPointerDown:w,onPointerMove:T,onPointerUp:E,onPointerLeave:E,children:(0,l.jsxs)(`svg`,{className:K.svg,viewBox:`0 0 1440 120`,children:[(0,l.jsx)(`text`,{ref:u,xmlSpace:`preserve`,className:K.measure,children:s}),(0,l.jsx)(`defs`,{children:(0,l.jsx)(`path`,{id:g,d:_,fill:`none`,stroke:`transparent`})}),C&&(0,l.jsx)(`text`,{xmlSpace:`preserve`,className:K.pathText,children:(0,l.jsx)(`textPath`,{ref:d,href:`#${g}`,startOffset:`${m}px`,xmlSpace:`preserve`,children:S})})]})})},ne={cyberGrid:`cos-cyberGrid-VgJwl`,canvas:`cos-canvas--Mq-O`},re=({width:e,height:t,fill:n=!1,color:r=`#00f0ff`,speed:i=1})=>{let{hostRef:a,width:o,height:s,hostStyle:u}=E({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),d=(0,c.useRef)(null),f=(0,c.useRef)(0),p=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let e=d.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=o*t,e.height=s*t;let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let a=s*.45,c=document.hidden,l=b(),u=y(e=>{c=e}),m=x(e=>{l=e}),h=e=>{e&&(p.current=(p.current+i*1.5)%40),n.fillStyle=`#050510`,n.fillRect(0,0,o,s);let t=n.createLinearGradient(0,0,0,a);t.addColorStop(0,`#0a0a20`),t.addColorStop(1,`#050510`),n.fillStyle=t,n.fillRect(0,0,o,a);let c=o/2;n.strokeStyle=r,n.shadowColor=r,n.shadowBlur=8,n.lineWidth=1;for(let e=-12;e<=12;e++){let t=e/12*o*1.2;n.beginPath(),n.moveTo(c+t*.05,a),n.lineTo(c+t,s),n.globalAlpha=.3+(1-Math.abs(e)/12)*.5,n.stroke()}n.globalAlpha=1;let l=Math.ceil(s/40)+2;for(let e=0;e<l;e++){let t=a+(e*40+p.current)/(s-a)*(s-a)%(s-a),r=(t-a)/(s-a)*.8;n.beginPath(),n.moveTo(0,t),n.lineTo(o,t),n.globalAlpha=r,n.stroke()}n.shadowBlur=0,n.globalAlpha=1;let u=n.createRadialGradient(c,a,0,c,a,o*.4);u.addColorStop(0,`${r}33`),u.addColorStop(1,`transparent`),n.fillStyle=u,n.fillRect(0,0,o,s)};if(l)return h(!1),()=>{u(),m()};let g=()=>{f.current=requestAnimationFrame(g),!c&&(l||h(!0))};return g(),()=>{cancelAnimationFrame(f.current),u(),m()}},[r,s,i,o]),(0,l.jsx)(`div`,{ref:a,className:ne.cyberGrid,style:u,children:(0,l.jsx)(`canvas`,{ref:d,className:ne.canvas,style:{width:o,height:s}})})},ie={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`},ae=e=>e instanceof Date?e.getTime():typeof e==`number`?e:new Date(e).getTime(),q=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}},oe={days:`天`,hours:`时`,minutes:`分`,seconds:`秒`},se=[{key:`days`},{key:`hours`},{key:`minutes`},{key:`seconds`}],ce=({targetDate:e,onEnd:t,showLabels:n=!0,color:r=`#f472b6`,labels:i,invalidText:a=`无效的目标时间`,endedText:o=`时间到!`})=>{let s=(0,c.useMemo)(()=>ae(e),[e]),u=!Number.isNaN(s),[,d]=(0,c.useState)(0),f=(0,c.useRef)(!1),p=(0,c.useRef)(t),m=u?q(s):{days:0,hours:0,minutes:0,seconds:0,total:0};return(0,c.useEffect)(()=>{p.current=t},[t]),(0,c.useEffect)(()=>{if(!u)return;if(f.current=!1,Date.now()>=s){f.current=!0,p.current?.();return}let e=window.setInterval(()=>{d(e=>e+1),Date.now()>=s&&!f.current&&(f.current=!0,p.current?.(),clearInterval(e))},1e3);return()=>clearInterval(e)},[u,s]),u?(0,l.jsxs)(`div`,{className:ie.countdown,style:{"--countdown-color":r},children:[se.map(({key:e})=>(0,l.jsxs)(`div`,{className:ie.unit,children:[(0,l.jsx)(`div`,{className:ie.value,children:String(m[e]).padStart(2,`0`)}),n&&(0,l.jsx)(`span`,{className:ie.label,children:i?.[e]??oe[e]})]},e)),m.total<=0&&(0,l.jsx)(`p`,{className:ie.ended,children:o})]}):(0,l.jsx)(`div`,{className:ie.countdown,children:(0,l.jsx)(`p`,{className:ie.invalid,children:a})})},le={countUp:`cos-countUp-PKMgo`,glow:`cos-glow-oAz5z`,value:`cos-value-WDAyV`,valueWrap:`cos-valueWrap-AQoM4`,measure:`cos-measure-ZGRt4`,display:`cos-display-JHXA2`},ue=e=>1-(1-e)**3,de=(e,t)=>e.toLocaleString(`en-US`,{minimumFractionDigits:t,maximumFractionDigits:t}),fe=({value:e,start:t=0,duration:n=1400,decimals:r=0,prefix:i=``,suffix:a=``,color:o=`#34d399`})=>{let[s,u]=(0,c.useState)(t),d=(0,c.useRef)(0),f=(0,c.useRef)(t);(0,c.useEffect)(()=>{let t=f.current,r=e,i=performance.now();cancelAnimationFrame(d.current);let a=e=>{let o=Math.min(1,(e-i)/Math.max(n,16)),s=ue(o);u(t+(r-t)*s),o<1?d.current=requestAnimationFrame(a):f.current=r};return d.current=requestAnimationFrame(a),()=>cancelAnimationFrame(d.current)},[n,e]);let p=(0,c.useMemo)(()=>`${i}${de(s,r)}${a}`,[r,s,i,a]),m=(0,c.useMemo)(()=>{let n=[t,e].map(e=>`${i}${de(e,r)}${a}`);return n.reduce((e,t)=>t.length>e.length?t:e,n[0])},[r,i,t,a,e]);return(0,l.jsxs)(`div`,{className:le.countUp,style:{"--count-up-color":o},children:[(0,l.jsx)(`div`,{className:le.glow}),(0,l.jsxs)(`div`,{className:le.valueWrap,children:[(0,l.jsx)(`span`,{className:`${le.value} ${le.measure}`,children:m}),(0,l.jsx)(`span`,{className:`${le.value} ${le.display}`,children:p})]})]})},pe={dnaHelix:`cos-dnaHelix-nEQLW`,canvas:`cos-canvas-uEV8B`},me=({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=y(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:pe.dnaHelix,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:pe.canvas,style:{width:e,height:t}})})},he={electricArc:`cos-electricArc-BFlY3`,canvas:`cos-canvas-iowDx`},ge=(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=ge(e,t,o+f,s+p,i*.6,a-1),h=ge(o+f,s+p,n,r,i*.6,a-1);return[...m.slice(0,-1),...h]},_e=({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=y(e=>{d=e}),p=()=>{if(u=requestAnimationFrame(p),d)return;o.fillStyle=`#0f172a`,o.fillRect(0,0,e,t);let r=ge(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:he.electricArc,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:he.canvas,style:{width:e,height:t}})})},ve={cursorTrail:`cos-cursorTrail-fpz5p`,canvas:`cos-canvas-Iuyp3`,hint:`cos-hint-9GLHx`},ye=({color:e=`#38bdf8`,length:t=20,width:n=800,height:r=400,hint:i=`移动鼠标查看粒子轨迹`})=>{let a=(0,c.useRef)(null),o=(0,c.useRef)([]),s=(0,c.useRef)({x:n/2,y:r/2}),u=(0,c.useRef)(0);return(0,c.useEffect)(()=>{let i=a.current;if(!i)return;let c=window.devicePixelRatio||1;i.width=n*c,i.height=r*c;let l=i.getContext(`2d`);if(!l)return;l.setTransform(c,0,0,c,0,0);let d=document.hidden,f=y(e=>{d=e}),p=()=>{if(u.current=requestAnimationFrame(p),d)return;let{x:i,y:a}=s.current;o.current.unshift({x:i,y:a,life:1}),o.current.length>t&&(o.current.length=t),l.fillStyle=`rgb(15 23 42 / 15%)`,l.fillRect(0,0,n,r);let c=o.current;for(let t=0;t<c.length;t++){let n=c[t],r=1-t/c.length,i=(1-t/c.length)*8+2;l.beginPath(),l.arc(n.x,n.y,i,0,Math.PI*2),l.fillStyle=e,l.globalAlpha=r*.8,l.fill()}l.globalAlpha=1};return p(),()=>{cancelAnimationFrame(u.current),f()}},[e,r,t,n]),(0,l.jsxs)(`div`,{className:ve.cursorTrail,style:{width:n,height:r},children:[(0,l.jsx)(`canvas`,{ref:a,className:ve.canvas,style:{width:n,height:r},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect();s.current={x:e.clientX-t.left,y:e.clientY-t.top}}}),(0,l.jsx)(`p`,{className:ve.hint,children:i})]})},be={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`},xe={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}},Se=({onRoll:e,sides:t=6,rollText:n=`掷骰子`,rollingText:r=`掷骰中...`,resultPrefix:i=`点数:`})=>{let[a,o]=(0,c.useState)(!1),[s,u]=(0,c.useState)(1),[d,f]=(0,c.useState)({x:0,y:0,z:0}),p=(0,c.useRef)(e),m=(0,c.useRef)(0);(0,c.useEffect)(()=>{p.current=e},[e]),(0,c.useEffect)(()=>()=>clearTimeout(m.current),[]);let h=()=>{if(a)return;o(!0);let e=Math.floor(Math.random()*t)+1,n=xe[e]??xe[1],r=360*(3+Math.floor(Math.random()*3)),i=360*(3+Math.floor(Math.random()*3));f({x:n.x+r,y:n.y+i,z:Math.random()*360}),clearTimeout(m.current),m.current=window.setTimeout(()=>{u(e),o(!1),p.current?.(e)},1200)},g=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:be.dot,style:{left:`${e}%`,top:`${t}%`}},n));return(0,l.jsxs)(`div`,{className:be.diceRoll,children:[(0,l.jsx)(`div`,{className:be.scene,children:(0,l.jsx)(`div`,{className:`${be.cube} ${a?be.rolling:``}`,style:{transform:`rotateX(${d.x}deg) rotateY(${d.y}deg) rotateZ(${d.z}deg)`},children:[1,2,3,4,5,6].map(e=>(0,l.jsx)(`div`,{className:`${be.face} ${be[`face${e}`]}`,children:g(e)},e))})}),(0,l.jsx)(`button`,{type:`button`,className:be.rollBtn,onClick:h,disabled:a,children:a?r:n}),!a&&(0,l.jsxs)(`p`,{className:be.result,children:[i,` `,s]})]})},Ce={doublePendulum:`cos-doublePendulum-FUEeK`,canvas:`cos-canvas-OVkhW`},we=({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,_=0,v=document.hidden,b=y(e=>{v=e}),x=()=>{if(_=requestAnimationFrame(x),v)return;let a=o.current,{theta1:c,theta2:l,omega1:y,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+y*y*p*w))/E,O=2*C*(y*y*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(_),b()}},[r,i,t,n,e]),(0,l.jsx)(`div`,{className:Ce.doublePendulum,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:Ce.canvas,style:{width:e,height:t}})})},Te={fireworks:`cos-fireworks-fsSqL`,canvas:`cos-canvas-spL8G`,canvasPassthrough:`cos-canvasPassthrough-jCNke`,hint:`cos-hint-5XDRH`},Ee=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`],De=.12,Oe=240,ke=()=>Ee[Math.floor(Math.random()*Ee.length)],Ae=(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:ke(),decay:Math.random()*.015+.01}})},je=(0,c.forwardRef)((e,t)=>{let{width:n,height:r,fill:i=!1,auto:a=!0,interactive:o,hint:s=`点击画布燃放烟花`,onComplete:u}=e,d=o??a,f=(0,c.useRef)(null),{width:p,height:m}=T({fill:i,width:n,height:r,defaultWidth:800,defaultHeight:500,measured:w(f,{enabled:i})}),h=(0,c.useRef)(null),g=(0,c.useRef)([]),_=(0,c.useRef)(0),v=(0,c.useRef)(!1),S=(0,c.useRef)(u);(0,c.useEffect)(()=>{S.current=u},[u]);let E=(0,c.useCallback)(e=>{let t=e??Math.random()*p*.6+p*.2;g.current.push({x:t,y:m,vy:-(Math.random()*4+6),targetY:Math.random()*m*.35+m*.15,color:ke(),exploded:!1,particles:[],age:0}),v.current=!0},[m,p]);return(0,c.useImperativeHandle)(t,()=>({launch:E}),[E]),(0,c.useEffect)(()=>{let e=h.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=p*t,e.height=m*t;let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let r=0,i=document.hidden,o=b(),s=y(e=>{i=e}),c=x(e=>{o=e}),l=()=>{if(_.current=requestAnimationFrame(l),!i){if(n.fillStyle=`rgb(15 23 42 / 25%)`,n.fillRect(0,0,p,m),o){v.current&&g.current.length===0&&(v.current=!1,S.current?.());return}g.current=g.current.filter(e=>{if(!e.exploded){e.age+=1,e.y+=e.vy,e.vy+=De,n.beginPath(),n.arc(e.x,e.y,2.5,0,Math.PI*2),n.fillStyle=e.color,n.fill();let t=e.vy>=0,r=e.y<=e.targetY,i=e.y<0,a=e.age>=Oe;return(t||r||i||a)&&(e.exploded=!0,e.particles=Ae(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:(n.beginPath(),n.arc(e.x,e.y,2,0,Math.PI*2),n.fillStyle=e.color,n.globalAlpha=e.alpha,n.fill(),n.globalAlpha=1,!0))),e.particles.length>0}),v.current&&g.current.length===0&&(v.current=!1,S.current?.())}};return l(),a&&!o?r=window.setInterval(()=>E(),1200):a&&o&&E(),()=>{cancelAnimationFrame(_.current),clearInterval(r),s(),c()}},[a,m,E,p]),(0,l.jsxs)(`div`,{ref:f,className:Te.fireworks,style:i?{width:`100%`,height:`100%`}:{width:p,height:m},children:[(0,l.jsx)(`canvas`,{ref:h,className:`${Te.canvas} ${d?``:Te.canvasPassthrough}`,style:{width:p,height:m,touchAction:d?`none`:`auto`},onPointerDown:d?e=>{let t=C(e.currentTarget,e.nativeEvent);t&&E(t.x)}:void 0}),d&&s?(0,l.jsx)(`p`,{className:Te.hint,children:s}):null]})});je.displayName=`Fireworks`;var Me={flipCard:`cos-flipCard-9GNUU`,inner:`cos-inner-fETXF`,flipped:`cos-flipped-DjOGt`,face:`cos-face-jfAlI`,front:`cos-front-K4swo`,back:`cos-back-yrnnD`,kicker:`cos-kicker-H-OGk`,title:`cos-title-XTDn7`,subtitle:`cos-subtitle-2YmXW`},Ne=(0,c.forwardRef)(({frontTitle:e=`签到翻牌`,frontSubtitle:t=`点击翻开今日奖励`,backTitle:n=`恭喜获得`,backSubtitle:r=`积分 +20`,flipped:i,defaultFlipped:a=!1,onReveal:o,onFlipChange:s,disabled:u=!1},d)=>{let[f,p]=(0,c.useState)(a),m=typeof i==`boolean`,h=m?!!i:f,g=(e,t)=>{m||p(e),s?.(e),e&&t&&o?.()};return(0,c.useImperativeHandle)(d,()=>({flip:()=>{u||h||g(!0,!0)},reset:()=>g(!1,!1)}),[u,h,m,s,o]),(0,l.jsx)(`button`,{type:`button`,className:`${Me.flipCard} ${h?Me.flipped:``}`,onClick:()=>{u||h||g(!0,!0)},disabled:u,"aria-pressed":h,children:(0,l.jsxs)(`span`,{className:Me.inner,children:[(0,l.jsxs)(`span`,{className:`${Me.face} ${Me.front}`,children:[(0,l.jsx)(`span`,{className:Me.kicker,children:`CHECK-IN`}),(0,l.jsx)(`span`,{className:Me.title,children:e}),(0,l.jsx)(`span`,{className:Me.subtitle,children:t})]}),(0,l.jsxs)(`span`,{className:`${Me.face} ${Me.back}`,children:[(0,l.jsx)(`span`,{className:Me.kicker,children:`REWARD`}),(0,l.jsx)(`span`,{className:Me.title,children:n}),(0,l.jsx)(`span`,{className:Me.subtitle,children:r})]})]})})});Ne.displayName=`FlipCard`;var Pe={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`},Fe=(e,t)=>Math.max(0,Math.floor(e)).toString().padStart(t,`0`).slice(-t),Ie=({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:Pe.digit,style:{"--flip-color":t,"--flip-duration":`${n}ms`},children:(0,l.jsxs)(`div`,{className:`${Pe.digitCard} ${i?Pe.isFlipping:``}`,children:[(0,l.jsx)(`div`,{className:Pe.staticTop,children:(0,l.jsx)(`span`,{children:u})}),(0,l.jsx)(`div`,{className:Pe.staticBottom,children:(0,l.jsx)(`span`,{children:u})}),i&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`${Pe.flap} ${Pe.flapTop}`,children:(0,l.jsx)(`span`,{children:o})}),(0,l.jsx)(`div`,{className:`${Pe.flap} ${Pe.flapBottom}`,children:(0,l.jsx)(`span`,{children:e})})]})]})})},Le=({value:e,digits:t=4,color:n=`#38bdf8`,duration:r=600})=>{let i=Fe(e,t).split(``);return(0,l.jsx)(`div`,{className:Pe.flipCounter,children:i.map((e,t)=>(0,l.jsx)(Ie,{digit:e,color:n,duration:r},t))})},Re={fuzzyText:`cos-fuzzyText-AgND-`,canvas:`cos-canvas-CiG0H`},ze=({text:e=`FUZZY`,fontSize:t=72,fontWeight:n=900,color:r=`#f8fafc`,baseIntensity:i=.18,hoverIntensity:a=.5,enableHover:o=!0,fuzzRange:s=30})=>{let u=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let c=0,l=!1,d=u.current;return d?((async()=>{let u=d.getContext(`2d`);if(!u)return;let f=window.getComputedStyle(d).fontFamily||`sans-serif`,p=`${n} ${`${t}px`} ${f}`;try{await document.fonts.load(p)}catch{await document.fonts.ready}if(l)return;let m=document.createElement(`canvas`),h=m.getContext(`2d`);if(!h)return;h.font=p,h.textBaseline=`alphabetic`;let g=h.measureText(e),_=g.actualBoundingBoxLeft??0,v=g.actualBoundingBoxRight??g.width,y=g.actualBoundingBoxAscent??t,b=g.actualBoundingBoxDescent??t*.2,x=Math.ceil(_+v),S=Math.ceil(y+b),C=x+10;m.width=C,m.height=S,h.font=p,h.textBaseline=`alphabetic`,h.fillStyle=r,h.fillText(e,10/2-_,y);let w=s+20;d.width=C+w*2,d.height=S,u.setTransform(1,0,0,1,0,0),u.translate(w,0);let T=w+10/2,E=T+x,D=S,O=!1,k=()=>{if(l)return;let e=O?a:i;u.clearRect(-s-20,-10,C+2*(s+20),S+20);for(let t=0;t<S;t++){let n=Math.floor(e*(Math.random()-.5)*s);u.drawImage(m,0,t,C,1,n,t,C,1)}c=window.requestAnimationFrame(k)};c=window.requestAnimationFrame(k);let A=(e,t)=>e>=T&&e<=E&&t>=0&&t<=D,j=e=>{if(!o)return;let t=d.getBoundingClientRect();O=A(e.clientX-t.left,e.clientY-t.top)},M=()=>{O=!1};o&&(d.addEventListener(`mousemove`,j),d.addEventListener(`mouseleave`,M)),d.cleanupFuzzyText=()=>{window.cancelAnimationFrame(c),o&&(d.removeEventListener(`mousemove`,j),d.removeEventListener(`mouseleave`,M))}})(),()=>{l=!0,window.cancelAnimationFrame(c),d.cleanupFuzzyText?.()}):void 0},[i,r,o,t,n,s,a,e]),(0,l.jsx)(`div`,{className:Re.fuzzyText,children:(0,l.jsx)(`canvas`,{ref:u,className:Re.canvas})})},Be={gradientFlow:`cos-gradientFlow-XhN16`,text:`cos-text-ORuqk`,flow:`cos-flow-9FzMA`},Ve=[`#ff00de`,`#7c3aed`,`#00f0ff`,`#38bdf8`,`#ff00de`],He=({text:e=`GRADIENT`,colors:t=Ve,fontSize:n=64})=>{let r=t.length>=2?t.join(`, `):Ve.join(`, `);return(0,l.jsx)(`div`,{className:Be.gradientFlow,children:(0,l.jsx)(`h1`,{className:Be.text,style:{fontSize:n,backgroundImage:`linear-gradient(90deg, ${r})`},children:e})})},Ue={gameOfLife:`cos-gameOfLife-1i2nu`,canvas:`cos-canvas-urOjh`,toolbar:`cos-toolbar-GmcD1`,meta:`cos-meta-KLxCp`,actions:`cos-actions-l3sAu`,button:`cos-button-g0tCm`},We=(e,t,n)=>Math.min(n,Math.max(t,e)),Ge=(e,t,n)=>Array.from({length:e},()=>Array.from({length:t},()=>+(Math.random()<n))),Ke=e=>{let t=e.length,n=e[0]?.length||0,r=Array.from({length:t},()=>Array(n).fill(0));for(let i=0;i<t;i++)for(let a=0;a<n;a++){let o=0;for(let r=-1;r<=1;r++)for(let s=-1;s<=1;s++){if(s===0&&r===0)continue;let c=i+r,l=a+s;c<0||c>=t||l<0||l>=n||(o+=e[c][l])}e[i][a]?r[i][a]=+(o===2||o===3):o===3&&(r[i][a]=1)}return r},qe=({width:e=560,height:t=420,cellSize:n=14,speed:r=120,density:i=.28,aliveColor:a=`#a3e635`,gridColor:o=`rgb(148 163 184 / 14%)`,labels:s})=>{let u=(0,c.useRef)(null),d=Math.max(6,Math.floor(t/n)),f=Math.max(6,Math.floor(e/n)),p=We(i,.05,.7),[m,h]=(0,c.useState)(!0),[g,_]=(0,c.useState)(0),v=(0,c.useRef)(document.hidden),[b,x]=(0,c.useState)(()=>Ge(d,f,p)),[S,C]=(0,c.useState)({rows:d,cols:f,density:p});(S.rows!==d||S.cols!==f||S.density!==p)&&(C({rows:d,cols:f,density:p}),x(Ge(d,f,p)),_(0)),(0,c.useEffect)(()=>{let r=u.current;if(!r)return;let i=window.devicePixelRatio||1;r.width=e*i,r.height=t*i;let s=r.getContext(`2d`);if(!s)return;s.setTransform(i,0,0,i,0,0);let c=0,l=y(e=>{v.current=e}),p=()=>{s.fillStyle=`#020617`,s.fillRect(0,0,e,t);for(let e=0;e<d;e++)for(let t=0;t<f;t++){if(!b[e][t])continue;let r=t*n,i=e*n;s.fillStyle=a,s.fillRect(r+1,i+1,n-2,n-2);let o=s.createRadialGradient(r+n/2,i+n/2,0,r+n/2,i+n/2,n*.8);o.addColorStop(0,`rgb(255 255 255 / 28%)`),o.addColorStop(1,`transparent`),s.fillStyle=o,s.fillRect(r,i,n,n)}s.strokeStyle=o,s.lineWidth=1;for(let e=0;e<=f;e++)s.beginPath(),s.moveTo(e*n+.5,0),s.lineTo(e*n+.5,t),s.stroke();for(let t=0;t<=d;t++)s.beginPath(),s.moveTo(0,t*n+.5),s.lineTo(e,t*n+.5),s.stroke()},m=()=>{c=requestAnimationFrame(m),p()};return c=requestAnimationFrame(m),()=>{cancelAnimationFrame(c),l()}},[a,n,f,b,o,t,d,e]),(0,c.useEffect)(()=>{if(!m)return;let e=window.setInterval(()=>{v.current||(x(e=>Ke(e)),_(e=>e+1))},r);return()=>clearInterval(e)},[m,r]);let w=(0,c.useMemo)(()=>b.reduce((e,t)=>e+t.reduce((e,t)=>e+t,0),0),[b]),T=()=>{x(Ge(d,f,p)),_(0)},E=(e,t,r)=>{let i=Math.floor((e-r.left)/n),a=Math.floor((t-r.top)/n);a<0||a>=d||i<0||i>=f||(x(e=>e.map((e,t)=>t===a?e.map((e,t)=>t===i?+!e:e):e)),_(e=>e+1))};return(0,l.jsxs)(`div`,{className:Ue.gameOfLife,style:{width:e},children:[(0,l.jsx)(`canvas`,{ref:u,className:Ue.canvas,style:{width:e,height:t},onClick:e=>E(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())}),(0,l.jsxs)(`div`,{className:Ue.toolbar,children:[(0,l.jsxs)(`div`,{className:Ue.meta,children:[(0,l.jsxs)(`span`,{children:[s?.generation??`Generation`,` `,g]}),(0,l.jsxs)(`span`,{children:[w,` `,s?.alive??`alive`]})]}),(0,l.jsxs)(`div`,{className:Ue.actions,children:[(0,l.jsx)(`button`,{type:`button`,className:Ue.button,onClick:()=>h(e=>!e),children:m?s?.pause??`Pause`:s?.play??`Play`}),(0,l.jsx)(`button`,{type:`button`,className:Ue.button,onClick:T,children:s?.randomize??`Randomize`})]})]})]})},Je={glitchText:`cos-glitchText-dZ-sR`,text:`cos-text-JsPHN`,"glitch-1":`cos-glitch-1-s9pqH`,"glitch-2":`cos-glitch-2-GhFB-`},Ye=({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})}),Xe={gravityBalls:`cos-gravityBalls-LdwFo`,canvas:`cos-canvas-n7esd`},Ze=[`#38bdf8`,`#a78bfa`,`#f472b6`,`#4ade80`,`#fbbf24`],Qe=({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:Ze[Math.floor(Math.random()*Ze.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=y(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:Xe.gravityBalls,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:r,className:Xe.canvas,style:{width:e,height:t}})})},$e={wrap:`cos-wrap-r1gGL`,card:`cos-card-3W10s`,shine:`cos-shine-0xjID`,image:`cos-image-AV2XG`,placeholder:`cos-placeholder-wuuL3`,info:`cos-info-CNR0r`},et=({title:e=`全息卡片`,subtitle:t=`移动鼠标体验 3D 效果`,image:n})=>{let r=(0,c.useRef)(null);return(0,l.jsx)(`div`,{className:$e.wrap,children:(0,l.jsxs)(`div`,{ref:r,className:$e.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:$e.shine}),n?(0,l.jsx)(`img`,{src:n,alt:e,className:$e.image}):(0,l.jsx)(`div`,{className:$e.placeholder,children:(0,l.jsx)(`span`,{children:`✦`})}),(0,l.jsxs)(`div`,{className:$e.info,children:[(0,l.jsx)(`h3`,{children:e}),(0,l.jsx)(`p`,{children:t})]})]})})},tt={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`},nt=({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=_(t>0?e/t*100:0,0,100),s=100-o;return(0,c.useEffect)(()=>{let e=0,t=0,n=document.hidden,r=y(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:tt.liquidProgress,style:{width:n,height:n,"--liquid-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 100 100`,className:tt.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:tt.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:tt.fillBg}),(0,l.jsx)(`path`,{ref:i,className:tt.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:tt.ring,strokeWidth:10,fill:`none`})]}),(0,l.jsxs)(`span`,{className:tt.label,children:[Math.round(o),`%`]})]})},rt={lorenzAttractor:`cos-lorenzAttractor--UAI7`,canvas:`cos-canvas-oeXce`},it=({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,_=y(e=>{g=e}),v=(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=>v(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),_()}},[r,t,i,n,e]),(0,l.jsx)(`div`,{className:rt.lorenzAttractor,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:rt.canvas,style:{width:e,height:t}})})},at={liquidGlass:`cos-liquidGlass-Z3bQg`,panel:`cos-panel-XYboD`,content:`cos-content-MHfkS`},ot=({children:e=`液态玻璃面板`,blur:t=16,borderRadius:n=20})=>(0,l.jsx)(`div`,{className:at.liquidGlass,children:(0,l.jsx)(`div`,{className:at.panel,style:{"--glass-blur":`${t}px`,"--glass-radius":`${n}px`},children:(0,l.jsx)(`div`,{className:at.content,children:e})})}),st={magneticButton:`cos-magneticButton-GbRkE`,btn:`cos-btn--b2BJ`},ct=({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:st.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:st.btn,style:{"--btn-color":n},children:e})})},lt={matrixRain:`cos-matrixRain-qg9HC`,canvas:`cos-canvas--AvpG`,overlay:`cos-overlay-knj3b`,title:`cos-title-sDfhs`,flicker:`cos-flicker-smHxl`,subtitle:`cos-subtitle-CWheW`},ut=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ`,dt=({width:e,height:t,fill:n=!1,density:r=.6,color:i=`#00ff41`,showOverlay:a=!0,title:o=`MATRIX`,subtitle:s=`数字雨效果`})=>{let u=(0,c.useRef)(null),{width:d,height:f}=T({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500,measured:w(u,{enabled:n})}),p=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let e=p.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=d*t,e.height=f*t;let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let a=Math.floor(d/16*r),o=Array.from({length:a},()=>Math.random()*-50),s=0,c=document.hidden,l=b(),u=y(e=>{c=e}),m=x(e=>{l=e}),h=e=>{e?(n.fillStyle=`rgb(0 0 0 / 8%)`,n.fillRect(0,0,d,f)):(n.fillStyle=`#000`,n.fillRect(0,0,d,f)),n.font=`16px monospace`,o.forEach((t,a)=>{let s=ut[Math.floor(Math.random()*53)],c=a/r*16;n.fillStyle=i,n.fillText(s,c,t*16),e&&(t*16>f&&Math.random()>.975&&(o[a]=0),o[a]+=1)})};if(l){for(let e=0;e<o.length;e++)o[e]=f/16*Math.random();return h(!1),()=>{u(),m()}}let g=()=>{s=requestAnimationFrame(g),!c&&(l||h(!0))};return g(),()=>{cancelAnimationFrame(s),u(),m()}},[i,r,f,d]),(0,l.jsxs)(`div`,{ref:u,className:lt.matrixRain,style:n?{width:`100%`,height:`100%`}:{width:d,height:f},children:[(0,l.jsx)(`canvas`,{ref:p,className:lt.canvas,style:{width:d,height:f}}),a&&(0,l.jsxs)(`div`,{className:lt.overlay,children:[(0,l.jsx)(`h2`,{className:lt.title,children:o}),(0,l.jsx)(`p`,{className:lt.subtitle,children:s})]})]})},ft={metaballPool:`cos-metaballPool-JJaI9`,canvas:`cos-canvas-S7fDD`},pt=({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 v=0,b=document.hidden,x=y(e=>{b=e}),S=()=>{if(v=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+_((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(v),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:ft.metaballPool,style:{width:e,height:t,"--pool-color":r},children:(0,l.jsx)(`canvas`,{ref:i,className:ft.canvas,style:{width:e,height:t}})})},mt={mazeGenerator:`cos-mazeGenerator-QEa0s`,canvas:`cos-canvas-emhxb`},ht=({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,_=document.hidden,v=y(e=>{_=e}),b=()=>{if(_){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),v()}},[n,t,e]),(0,l.jsx)(`div`,{className:mt.mazeGenerator,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:mt.canvas,style:{width:e,height:t}})})},gt={meteorRain:`cos-meteorRain-v8RNI`,canvas:`cos-canvas-hyFMr`},_t=({width:e,height:t,fill:n=!1,meteorCount:r=8})=>{let{hostRef:i,width:a,height:o,hostStyle:s}=E({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),u=(0,c.useRef)(null),d=(0,c.useRef)([]),f=(0,c.useRef)(0);return(0,c.useEffect)(()=>{d.current=Array.from({length:r},()=>({x:Math.random()*a,y:Math.random()*o*.5,length:Math.random()*60+40,speed:Math.random()*6+4,opacity:Math.random()*.5+.3}))},[o,r,a]),(0,c.useEffect)(()=>{let e=u.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=a*t,e.height=o*t;let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let r=document.hidden,i=b(),s=y(e=>{r=e}),c=x(e=>{i=e}),l=e=>{e?(n.fillStyle=`rgb(15 23 42 / 15%)`,n.fillRect(0,0,a,o)):(n.fillStyle=`#0f172a`,n.fillRect(0,0,a,o)),d.current.forEach(t=>{e&&(t.x+=t.speed,t.y+=t.speed*.6,(t.x>a+t.length||t.y>o+t.length)&&(t.x=-t.length,t.y=Math.random()*o*.4,t.length=Math.random()*60+40,t.speed=Math.random()*6+4,t.opacity=Math.random()*.5+.3));let r=t.x-t.length,i=t.y-t.length*.6;n.beginPath(),n.strokeStyle=`rgb(255 255 255 / ${t.opacity})`,n.lineWidth=2,n.moveTo(t.x,t.y),n.lineTo(r,i),n.stroke(),n.beginPath(),n.fillStyle=`rgb(255 255 255 / ${Math.min(1,t.opacity+.2)})`,n.arc(t.x,t.y,1.5,0,Math.PI*2),n.fill()})};if(i)return l(!1),()=>{s(),c()};let p=()=>{f.current=requestAnimationFrame(p),!r&&(i||l(!0))};return p(),()=>{cancelAnimationFrame(f.current),s(),c()}},[o,a]),(0,l.jsx)(`div`,{ref:i,className:gt.meteorRain,style:s,children:(0,l.jsx)(`canvas`,{ref:u,className:gt.canvas,style:{width:a,height:o}})})},vt={networkGraph:`cos-networkGraph-4jjqg`,canvas:`cos-canvas-F17fx`,cursorDefault:`cos-cursorDefault-pUq31`,cursorGrab:`cos-cursorGrab-clAFY`,cursorGrabbing:`cos-cursorGrabbing-Bzm-F`,hint:`cos-hint-19aNc`},yt=[{id:`react`,label:`React`,color:`#61dafb`},{id:`vue`,label:`Vue`,color:`#42b883`},{id:`angular`,label:`Angular`,color:`#dd0031`},{id:`svelte`,label:`Svelte`,color:`#ff3e00`},{id:`ts`,label:`TypeScript`,color:`#3178c6`},{id:`vite`,label:`Vite`,color:`#bd34fe`},{id:`next`,label:`Next.js`,color:`#f8fafc`}],bt=[{source:`react`,target:`ts`},{source:`react`,target:`next`},{source:`react`,target:`vite`},{source:`vue`,target:`ts`},{source:`vue`,target:`vite`},{source:`angular`,target:`ts`},{source:`svelte`,target:`vite`},{source:`ts`,target:`vite`}],xt=6,St=`ui-sans-serif, system-ui, -apple-system, sans-serif`,Ct=(e,t,n)=>{let r=e=>{let t=e.replace(`#`,``),n=t.length===3?t.split(``).map(e=>e+e).join(``):t;return n.length===6?[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16)]:[148,163,184]},[i,a,o]=r(e),[s,c,l]=r(t);return`rgb(${Math.round(i+(s-i)*n)} ${Math.round(a+(c-a)*n)} ${Math.round(o+(l-o)*n)})`},wt=(e,t)=>{if(e.startsWith(`#`)){let n=e.replace(`#`,``),r=n.length===3?n.split(``).map(e=>e+e).join(``):n;if(r.length===6)return`rgb(${parseInt(r.slice(0,2),16)} ${parseInt(r.slice(2,4),16)} ${parseInt(r.slice(4,6),16)} / ${t})`}let n=e.match(/rgba?\(([^)]+)\)/i);if(n){let e=n[1].split(/[,\s/]+/).filter(Boolean).map(Number);if(e.length>=3)return`rgb(${e[0]} ${e[1]} ${e[2]} / ${t})`}return e},Tt=({width:e=600,height:t=420,nodes:n=yt,edges:r=bt,linkColor:i=`rgb(148 163 184 / 35%)`,nodeRadius:a=20,hint:o=`拖拽节点 · 悬停查看关联`})=>{let s=(0,c.useRef)(null),u=(0,c.useRef)([]),d=(0,c.useRef)(null),f=(0,c.useRef)(null),[p,m]=(0,c.useState)(`default`),[h,g]=(0,c.useState)(o);(0,c.useEffect)(()=>{d.current||g(o)},[o]);let _=(0,c.useMemo)(()=>{let e=new Map;for(let t of n)e.set(t.id,new Set);for(let t of r)e.get(t.source)?.add(t.target),e.get(t.target)?.add(t.source);return e},[r,n]);(0,c.useEffect)(()=>{if(!n.length){u.current=[];return}let r=new Map(u.current.map(e=>[e.id,e]));u.current=n.map((i,a)=>{let o=r.get(i.id);return o?{...o,label:i.label||i.id,color:i.color||`#38bdf8`}:{id:i.id,label:i.label||i.id,color:i.color||`#38bdf8`,x:e/2+Math.cos(a/n.length*Math.PI*2)*140,y:t/2+Math.sin(a/n.length*Math.PI*2)*120,vx:0,vy:0}})},[t,n,e]),(0,c.useEffect)(()=>{let n=s.current;if(!n)return;let o=Math.min(window.devicePixelRatio||1,2);n.width=e*o,n.height=t*o;let c=n.getContext(`2d`);if(!c)return;c.setTransform(o,0,0,o,0,0);let l=0,p=document.hidden,m=y(e=>{p=e}),h=()=>{let e=new Map;return u.current.forEach(t=>e.set(t.id,t)),e},g=(e,t)=>!t||e===t?!0:_.get(t)?.has(e)??!1,v=()=>{let n=u.current,i=h(),o=.92,s=.003;for(let e=0;e<n.length;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let e=n[r],i=t.x-e.x,a=t.y-e.y,o=i*i+a*a||1,s=2400/o,c=Math.sqrt(o);i/=c,a/=c,t.vx+=i*s,t.vy+=a*s,e.vx-=i*s,e.vy-=a*s}}for(let e of r){let t=i.get(e.source),n=i.get(e.target);if(!t||!n)continue;let r=n.x-t.x,a=n.y-t.y,o=Math.sqrt(r*r+a*a)||1,s=.012*(o-120),c=r/o*s,l=a/o*s;t.vx+=c,t.vy+=l,n.vx-=c,n.vy-=l}for(let r of n)r.vx+=(e/2-r.x)*s,r.vy+=(t/2-r.y)*s,r.vx*=o,r.vy*=o,f.current?.node!==r&&(r.x+=r.vx,r.y+=r.vy,r.x=Math.max(a,Math.min(e-a,r.x)),r.y=Math.max(a,Math.min(t-a,r.y)))},b=()=>{let n=c.createRadialGradient(e*.5,t*.42,20,e*.5,t*.5,Math.max(e,t)*.72);n.addColorStop(0,`#1a2744`),n.addColorStop(.55,`#0f172a`),n.addColorStop(1,`#020617`),c.fillStyle=n,c.fillRect(0,0,e,t),c.fillStyle=`rgb(148 163 184 / 7%)`;for(let n=28;n<e;n+=28)for(let e=28;e<t;e+=28)c.beginPath(),c.arc(n,e,.7,0,Math.PI*2),c.fill();let r=c.createRadialGradient(e/2,t/2,Math.min(e,t)*.25,e/2,t/2,Math.max(e,t)*.7);r.addColorStop(0,`rgb(0 0 0 / 0%)`),r.addColorStop(1,`rgb(2 6 23 / 55%)`),c.fillStyle=r,c.fillRect(0,0,e,t)},x=(e,t,n,r)=>{let o=t.x-e.x,s=t.y-e.y,l=Math.sqrt(o*o+s*s)||1,u=o/l,d=s/l,f=a*.55,p=e.x+u*f,m=e.y+d*f,h=t.x-u*f,g=t.y-d*f,_=(p+h)/2,v=(m+g)/2,y=c.createLinearGradient(p,m,h,g);n?(y.addColorStop(0,wt(e.color,.85)),y.addColorStop(.5,wt(Ct(e.color,t.color,.5),.55)),y.addColorStop(1,wt(t.color,.85)),c.lineWidth=2.4,c.shadowColor=wt(Ct(e.color,t.color,.5),.45),c.shadowBlur=10):r?(y.addColorStop(0,wt(i,.12)),y.addColorStop(.5,wt(i,.08)),y.addColorStop(1,wt(i,.12)),c.lineWidth=1,c.shadowBlur=0):(y.addColorStop(0,wt(i,.15)),y.addColorStop(.5,i),y.addColorStop(1,wt(i,.15)),c.lineWidth=1.35,c.shadowBlur=0),c.strokeStyle=y,c.lineCap=`round`,c.beginPath(),c.moveTo(p,m),c.quadraticCurveTo(_+d*4,v-u*4,h,g),c.stroke(),c.shadowBlur=0},S=(e,n,r)=>{let i=g(e.id,n),o=n===e.id,s=r&&f.current?.node===e,l=a*(o||s?1.12:i||!n?1:.94),u=!n||i?1:.28;c.save(),c.globalAlpha=u,c.beginPath(),c.arc(e.x,e.y,l+(o||s?10:6),0,Math.PI*2),c.fillStyle=wt(e.color,o||s?.22:.12),c.fill(),c.shadowColor=wt(e.color,o||s?.75:.45),c.shadowBlur=o||s?22:14;let d=c.createRadialGradient(e.x-l*.28,e.y-l*.32,l*.1,e.x,e.y,l);d.addColorStop(0,Ct(e.color,`#ffffff`,.55)),d.addColorStop(.55,e.color),d.addColorStop(1,Ct(e.color,`#0f172a`,.35)),c.beginPath(),c.arc(e.x,e.y,l,0,Math.PI*2),c.fillStyle=d,c.fill(),c.shadowBlur=0,c.strokeStyle=o||s?`rgb(255 255 255 / 70%)`:`rgb(255 255 255 / 28%)`,c.lineWidth=o||s?1.6:1.1,c.stroke();let p=Math.max(10,Math.min(13,Math.round(a*.58)));c.font=`500 ${p}px ${St}`,c.textAlign=`center`,c.textBaseline=`middle`;let m=e.label,h=c.measureText(m).width+16,_=p+8,v=e.x-h/2,y=Math.min(t-_-4,e.y+l+8);c.beginPath();let b=_/2;c.moveTo(v+b,y),c.arcTo(v+h,y,v+h,y+_,b),c.arcTo(v+h,y+_,v,y+_,b),c.arcTo(v,y+_,v,y,b),c.arcTo(v,y,v+h,y,b),c.closePath(),c.fillStyle=o||s?`rgb(15 23 42 / 78%)`:`rgb(15 23 42 / 55%)`,c.fill(),c.strokeStyle=`rgb(255 255 255 / 10%)`,c.lineWidth=1,c.stroke(),c.fillStyle=`#f8fafc`,c.fillText(m,e.x,y+_/2),c.restore()},C=()=>{b();let e=h(),t=f.current?.node.id??d.current,n=!!f.current;for(let n of r){let r=e.get(n.source),i=e.get(n.target);if(!r||!i)continue;let a=!!(t&&(n.source===t||n.target===t));x(r,i,a,!!(t&&!a))}let i=[...u.current].sort((e,n)=>(e.id===t?2:+!!g(e.id,t))-(n.id===t?2:+!!g(n.id,t)));for(let e of i)S(e,t,n)},w=()=>{l=requestAnimationFrame(w),!p&&(v(),C())};return l=requestAnimationFrame(w),()=>{cancelAnimationFrame(l),m()}},[_,r,t,i,a,e]);let v=(e,t,n)=>{let r=e-n.left,i=t-n.top,o=a+xt,s=null,c=o*o;for(let e of u.current){let t=(e.x-r)**2+(e.y-i)**2;t<=c&&(c=t,s=e)}return s},b=e=>{d.current=e?.id??null,g(e?e.label:o)},x=e=>{if(e.pointerType===`mouse`&&e.button!==0)return;let t=e.currentTarget.getBoundingClientRect(),n=v(e.clientX,e.clientY,t);if(!n)return;e.currentTarget.setPointerCapture(e.pointerId),e.pointerType===`touch`&&e.preventDefault();let r=e.clientX-t.left,i=e.clientY-t.top;f.current={node:n,offsetX:n.x-r,offsetY:n.y-i,lastX:r,lastY:i,vx:0,vy:0},n.vx=0,n.vy=0,b(n),m(`grabbing`)},S=n=>{let r=n.currentTarget.getBoundingClientRect(),i=n.clientX-r.left,o=n.clientY-r.top;if(f.current){n.pointerType===`touch`&&n.preventDefault();let{node:r,offsetX:s,offsetY:c}=f.current,l=Math.max(a,Math.min(e-a,i+s)),u=Math.max(a,Math.min(t-a,o+c));f.current.vx=l-f.current.lastX,f.current.vy=u-f.current.lastY,f.current.lastX=l,f.current.lastY=u,r.x=l,r.y=u,r.vx=0,r.vy=0,m(`grabbing`);return}let s=v(n.clientX,n.clientY,r);b(s),m(s?`grab`:`default`)},C=e=>{let t=f.current;t&&(t.node.vx=t.vx*.85,t.node.vy=t.vy*.85,f.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId));let n=e.currentTarget.getBoundingClientRect(),r=v(e.clientX,e.clientY,n);b(r),m(r?`grab`:`default`)},w=()=>{f.current||(b(null),m(`default`))},T=p===`grabbing`?vt.cursorGrabbing:p===`grab`?vt.cursorGrab:vt.cursorDefault;return(0,l.jsxs)(`div`,{className:vt.networkGraph,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:s,className:`${vt.canvas} ${T}`,style:{width:e,height:t},onPointerDown:x,onPointerMove:S,onPointerUp:C,onPointerCancel:C,onPointerLeave:w}),(0,l.jsx)(`div`,{className:vt.hint,children:h})]})},Et={neonText:`cos-neonText-JMP7i`,text:`cos-text-GTO-0`,flicker:`cos-flicker-nXceV`,"neon-flicker":`cos-neon-flicker-uDkmM`,reflection:`cos-reflection-aEYj6`},Dt=({text:e=`NEON`,color:t=`#ff00de`,fontSize:n=72,flicker:r=!0})=>(0,l.jsxs)(`div`,{className:Et.neonText,children:[(0,l.jsx)(`h1`,{className:`${Et.text} ${r?Et.flicker:``}`,style:{fontSize:n,"--neon-color":t},children:e}),(0,l.jsx)(`p`,{className:Et.reflection,style:{fontSize:n*.35,color:t},children:e})]}),Ot={newtonCradle:`cos-newtonCradle-mFl-b`,canvas:`cos-canvas-TWKl5`},kt=({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))},_=e=>{p===`right`&&(p=`left`,f[a-1].omega=0,f[a-1].theta=0,f[0].omega=-Math.abs(e))},v=()=>{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&&_(f[a-1].omega)},b=0,x=document.hidden,S=y(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}v();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:Ot.newtonCradle,style:{width:n,height:r,"--ball-color":t},children:(0,l.jsx)(`canvas`,{ref:i,className:Ot.canvas,style:{width:n,height:r}})})},At={nineGrid:`cos-nineGrid-hLIVA`,board:`cos-board-En2Pj`,cell:`cos-cell-dfXUm`,icon:`cos-icon-WiUcH`,label:`cos-label-n9ieY`,active:`cos-active-wgm5K`,winner:`cos-winner-44oAG`,button:`cos-button-lKJfV`},jt=[{icon:`🎁`,label:`谢谢参与`},{icon:`🧧`,label:`红包 1 元`},{icon:`🎫`,label:`优惠券`},{icon:`☕`,label:`咖啡券`},{icon:`💎`,label:`钻石`},{icon:`🎧`,label:`耳机`},{icon:`📦`,label:`神秘礼`},{icon:`⭐`,label:`积分 x10`},{icon:`🏆`,label:`大奖`}],Mt=e=>{let t=[...e?.length?e:jt];for(;t.length<9;)t.push({label:`奖品 ${t.length+1}`});return t.slice(0,9)},Nt=(0,c.forwardRef)(({items:e=jt,targetIndex:t,buttonText:n=`开始抽奖`,spinningText:r=`抽奖中…`,onDrawEnd:i,disabled:a=!1},o)=>{let s=Mt(e),[u,d]=(0,c.useState)(null),[f,p]=(0,c.useState)(null),[m,h]=(0,c.useState)(!1),g=(0,c.useRef)([]),_=(0,c.useRef)(i),v=(0,c.useRef)(t);(0,c.useEffect)(()=>{_.current=i},[i]),(0,c.useEffect)(()=>{v.current=t},[t]);let y=(0,c.useCallback)(()=>{g.current.forEach(e=>window.clearTimeout(e)),g.current=[]},[]);(0,c.useEffect)(()=>y,[y]);let x=(0,c.useCallback)(()=>{y(),h(!1),d(null),p(null)},[y]),S=(0,c.useCallback)(e=>{if(m||a)return;y(),p(null),h(!0);let t=((typeof e==`number`?e:typeof v.current==`number`?v.current:Math.floor(Math.random()*9))%9+9)%9;if(b()){d(t),p(t),h(!1),_.current?.(s[t],t);return}let n=18+t,r=0,i=()=>{if(d(r%9),r+=1,r>n){d(t),p(t),h(!1),_.current?.(s[t],t);return}let e=60+Math.floor(r*12);g.current.push(window.setTimeout(i,e))};i()},[s,y,a,m]);return(0,c.useImperativeHandle)(o,()=>({draw:S,reset:x}),[S,x]),(0,l.jsxs)(`div`,{className:At.nineGrid,children:[(0,l.jsx)(`div`,{className:At.board,role:`grid`,"aria-label":`九宫格抽奖`,children:s.map((e,t)=>{let n=u===t,r=f===t;return(0,l.jsxs)(`div`,{role:`gridcell`,className:`${At.cell} ${n?At.active:``} ${r?At.winner:``}`,children:[e.icon?(0,l.jsx)(`span`,{className:At.icon,children:e.icon}):null,(0,l.jsx)(`span`,{className:At.label,children:e.label})]},`${e.label}-${t}`)})}),(0,l.jsx)(`button`,{type:`button`,className:At.button,"data-testid":`nine-grid-draw`,onClick:()=>S(),disabled:m||a,"aria-busy":m,children:m?r:n})]})});Nt.displayName=`NineGrid`;var Pt={orbitalChart:`cos-orbitalChart-XLORB`,canvas:`cos-canvas-hGVud`,legend:`cos-legend-Np9Mm`,swatch:`cos-swatch-xEKvA`},Ft=[{label:`A`,value:30,color:`#38bdf8`},{label:`B`,value:25,color:`#a78bfa`},{label:`C`,value:20,color:`#f472b6`},{label:`D`,value:25,color:`#4ade80`}],It=({data:e=Ft,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=y(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=_(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:Pt.orbitalChart,style:{width:t,height:t},children:[(0,l.jsx)(`canvas`,{ref:n,className:Pt.canvas,style:{width:t,height:t}}),(0,l.jsx)(`ul`,{className:Pt.legend,children:e.map(e=>(0,l.jsxs)(`li`,{children:[(0,l.jsx)(`span`,{className:Pt.swatch,style:{background:e.color}}),e.label,` (`,e.value,`)`]},e.label))})]})},Lt={particleNetwork:`cos-particleNetwork-GSZq-`,canvas:`cos-canvas-E-BGP`,hint:`cos-hint-LEO5o`},Rt=({width:e,height:t,fill:n=!1,particleCount:r=60,linkDistance:i=120,repelRadius:a=150,color:o=`#38bdf8`,hint:s=`移动鼠标或手指与粒子互动`})=>{let u=(0,c.useRef)(null),{width:d,height:f}=T({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500,measured:w(u,{enabled:n})}),p=(0,c.useRef)(null),m=(0,c.useRef)([]),h=(0,c.useRef)({x:-1e3,y:-1e3}),g=(0,c.useCallback)(()=>{m.current=Array.from({length:r},()=>({x:Math.random()*d,y:Math.random()*f,vx:(Math.random()-.5)*1.2,vy:(Math.random()-.5)*1.2,radius:Math.random()*2+1}))},[f,r,d]);(0,c.useEffect)(()=>{g()},[g]),(0,c.useEffect)(()=>{let e=p.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=d*t,e.height=f*t;let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let r=0,s=document.hidden,c=b(),l=y(e=>{s=e}),u=x(e=>{c=e}),g=e=>{n.fillStyle=`#0f172a`,n.fillRect(0,0,d,f);let t=m.current,r=h.current,s=a*a;e&&t.forEach(e=>{e.x+=e.vx,e.y+=e.vy,(e.x<0||e.x>d)&&(e.vx*=-1),(e.y<0||e.y>f)&&(e.vy*=-1);let t=r.x-e.x,n=r.y-e.y,i=t*t+n*n;if(i<s&&i>0){let r=Math.sqrt(i);e.vx-=t/r*.15,e.vy-=n/r*.15}});for(let e=0;e<t.length;e++)for(let r=e+1;r<t.length;r++){let a=t[e].x-t[r].x,s=t[e].y-t[r].y,c=a*a+s*s;if(c<i*i){let a=Math.sqrt(c);n.beginPath(),n.moveTo(t[e].x,t[e].y),n.lineTo(t[r].x,t[r].y),n.strokeStyle=o,n.globalAlpha=1-a/i,n.lineWidth=.8,n.stroke(),n.globalAlpha=1}}t.forEach(e=>{n.beginPath(),n.arc(e.x,e.y,e.radius,0,Math.PI*2),n.fillStyle=o,n.fill()})};if(c)return g(!1),()=>{l(),u()};let _=()=>{r=requestAnimationFrame(_),!s&&(c||g(!0))};return _(),()=>{cancelAnimationFrame(r),l(),u()}},[o,f,g,i,a,d]);let _=(e,t,n)=>{h.current={x:e-n.left,y:t-n.top}},v=e=>{_(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())},S=e=>{let t=e.touches[0];t&&_(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},C=()=>{h.current={x:-1e3,y:-1e3}};return(0,l.jsxs)(`div`,{ref:u,className:Lt.particleNetwork,style:n?{width:`100%`,height:`100%`}:{width:d,height:f},children:[(0,l.jsx)(`canvas`,{ref:p,className:Lt.canvas,style:{width:d,height:f},onMouseMove:v,onMouseLeave:C,onTouchMove:S,onTouchEnd:C}),(0,l.jsx)(`p`,{className:Lt.hint,children:s})]})},J={album:`cos-album-YDP44`,bookShadow:`cos-bookShadow-OTRJk`,stage:`cos-stage-0AOoU`,cover:`cos-cover-NgXqj`,coverEdgeTop:`cos-coverEdgeTop-6c9-Y`,coverEdgeSide:`cos-coverEdgeSide-P3osy`,pageStackLeft:`cos-pageStackLeft-tSbY2`,pageStackRight:`cos-pageStackRight-LHEJf`,book:`cos-book-KzrR1`,bookGutter:`cos-bookGutter-Wzw-P`,staticPage:`cos-staticPage-FxIfo`,turningPage:`cos-turningPage-dHWFc`,leftPage:`cos-leftPage-4Mlvj`,rightPage:`cos-rightPage-F4FGx`,gutterShade:`cos-gutterShade-KRm-E`,punchHoles:`cos-punchHoles-wFJEa`,punchLeft:`cos-punchLeft-GqHzv`,punchRight:`cos-punchRight-mjt9r`,punchHole:`cos-punchHole-f103b`,pageContent:`cos-pageContent-zI3p7`,photoMount:`cos-photoMount-xpDXf`,front:`cos-front-UroYj`,caption:`cos-caption-I0FZJ`,pageNumber:`cos-pageNumber-lEKVd`,back:`cos-back-8entC`,flyleaf:`cos-flyleaf-BiH6K`,flyleafCorner:`cos-flyleafCorner--pzLp`,flyleafCornerTl:`cos-flyleafCornerTl-AN5MS`,flyleafCornerTr:`cos-flyleafCornerTr-cbwv-`,flyleafCornerBl:`cos-flyleafCornerBl-iE60j`,flyleafCornerBr:`cos-flyleafCornerBr-QOzhA`,flyleafInner:`cos-flyleafInner-VJVEj`,flyleafMotif:`cos-flyleafMotif-TC3K5`,flyleafTitle:`cos-flyleafTitle-IIuP4`,flyleafSubtitle:`cos-flyleafSubtitle-jCr9V`,flyleafRule:`cos-flyleafRule-d7XA2`,face:`cos-face-lgVVG`,faceSheet:`cos-faceSheet--UI-p`,turnNextReady:`cos-turnNextReady-cvD3P`,turnPreviousReady:`cos-turnPreviousReady-kIHfq`,turnNext:`cos-turnNext-xt9ZK`,turnPrevious:`cos-turnPrevious-jjvaP`,wireBindingBack:`cos-wireBindingBack-kw-Ci`,wireBindingFront:`cos-wireBindingFront-bK9x5`,wireRingBack:`cos-wireRingBack-R26lf`,wireRingFront:`cos-wireRingFront-i2S1H`,hitArea:`cos-hitArea-NoHZa`,previousArea:`cos-previousArea-ZHppX`,nextArea:`cos-nextArea-eDUTE`,empty:`cos-empty-DOpsx`},zt=new Set,Bt=e=>{if(!e||typeof Image>`u`||zt.has(e))return;zt.add(e);let t=new Image;t.src=e,t.decode?.().catch(()=>{})},Vt=e=>typeof e==`number`?`${e}px`:e,Ht=(e,t)=>Math.max(0,Math.min(Math.floor(e),Math.max(0,t))),Ut=()=>(0,l.jsx)(`svg`,{className:J.flyleafMotif,viewBox:`0 0 120 120`,"aria-hidden":`true`,children:(0,l.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,l.jsx)(`circle`,{cx:`60`,cy:`60`,r:`46`}),(0,l.jsx)(`path`,{d:`M60 14 L106 60 L60 106 L14 60 Z`}),(0,l.jsx)(`circle`,{cx:`60`,cy:`60`,r:`28`}),(0,l.jsx)(`path`,{d:`M60 32 L88 60 L60 88 L32 60 Z`}),(0,l.jsx)(`path`,{d:`M60 20 V40 M60 80 V100 M20 60 H40 M80 60 H100`}),(0,l.jsx)(`path`,{d:`M34 34 L46 46 M86 34 L74 46 M34 86 L46 74 M86 86 L74 74`}),(0,l.jsx)(`path`,{d:`M60 50 L70 60 L60 70 L50 60 Z`}),(0,l.jsx)(`path`,{d:`M60 8 L63 14 L60 20 L57 14 Z`}),(0,l.jsx)(`path`,{d:`M60 100 L63 106 L60 112 L57 106 Z`}),(0,l.jsx)(`path`,{d:`M8 60 L14 63 L20 60 L14 57 Z`}),(0,l.jsx)(`path`,{d:`M100 60 L106 63 L112 60 L106 57 Z`})]})}),Wt=32,Gt=4,Kt=28,qt=.916,Jt={previous:`Previous photo`,next:`Next photo`,empty:`No photos`,flyleafTitle:`Photo Album`,flyleafSubtitle:`Turn the page to begin`,flyleafEndTitle:`The End`,flyleafEndSubtitle:`Thank you for browsing`},Yt=e=>{if(!Number.isFinite(e)||e<=0)return 16;let t=e*qt;return Math.max(Gt,Math.min(Kt,Math.round(t/Wt)))},Xt=(e,t)=>`${(e+.55)/t*100}%`,Zt=({photo:e,index:t,total:n,objectFit:r,showPageNumber:i,pageColor:a,flyleafTitle:o,flyleafSubtitle:s,flyleafEndTitle:c,flyleafEndSubtitle:u})=>{let d=t<0,f=d?o:c,p=d?s:u;return(0,l.jsx)(`div`,{className:J.pageContent,style:{backgroundColor:a},children:e?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:J.photoMount,children:(0,l.jsx)(`img`,{src:e.src,alt:e.alt??e.title??``,draggable:!1,style:{objectFit:r}})}),(e.title||e.description)&&(0,l.jsxs)(`div`,{className:J.caption,children:[e.title&&(0,l.jsx)(`strong`,{children:e.title}),e.description&&(0,l.jsx)(`span`,{children:e.description})]}),i&&(0,l.jsx)(`span`,{className:J.pageNumber,children:`${t+1} / ${n}`})]}):(0,l.jsxs)(`div`,{className:J.flyleaf,children:[(0,l.jsx)(`span`,{className:`${J.flyleafCorner} ${J.flyleafCornerTl}`,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`${J.flyleafCorner} ${J.flyleafCornerTr}`,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`${J.flyleafCorner} ${J.flyleafCornerBl}`,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`${J.flyleafCorner} ${J.flyleafCornerBr}`,"aria-hidden":`true`}),(0,l.jsxs)(`div`,{className:J.flyleafInner,children:[(0,l.jsx)(`span`,{className:J.flyleafRule,"aria-hidden":`true`}),(0,l.jsx)(Ut,{}),(0,l.jsx)(`p`,{className:J.flyleafTitle,children:f}),(0,l.jsx)(`p`,{className:J.flyleafSubtitle,children:p}),(0,l.jsx)(`span`,{className:J.flyleafRule,"aria-hidden":`true`})]})]})})},Qt=({side:e,count:t})=>(0,l.jsx)(`div`,{className:`${J.punchHoles} ${e===`left`?J.punchLeft:J.punchRight}`,"aria-hidden":`true`,children:Array.from({length:t},(e,n)=>(0,l.jsx)(`span`,{className:J.punchHole,style:{top:Xt(n,t)}},n))}),$t=({count:e,variant:t})=>{let n=t===`back`?J.wireRingBack:J.wireRingFront;return(0,l.jsx)(`div`,{className:t===`back`?J.wireBindingBack:J.wireBindingFront,"aria-hidden":`true`,children:Array.from({length:e},(t,r)=>(0,l.jsx)(`span`,{className:n,style:{top:Xt(r,e)}},r))})},en=({photos:e,width:t=920,height:n=560,initialIndex:r=0,pageTurnDuration:i=760,objectFit:a=`cover`,showPageNumber:o=!0,pageColor:s=`#f2ead8`,coverColor:u=`#4a3025`,ariaLabel:d=`Photo album`,labels:f,onPageChange:p,onIndexChange:m,className:h,style:g})=>{let[_,v]=(0,c.useState)(()=>Ht(r,e.length)),[y,b]=(0,c.useState)(null),[x,S]=(0,c.useState)(()=>typeof n==`number`?Yt(n):16),C=Ht(_,e.length),w=Math.max(180,i),T={previous:f?.previous??Jt.previous,next:f?.next??Jt.next,empty:f?.empty??Jt.empty,flyleafTitle:f?.flyleafTitle??Jt.flyleafTitle,flyleafSubtitle:f?.flyleafSubtitle??Jt.flyleafSubtitle,flyleafEndTitle:f?.flyleafEndTitle??Jt.flyleafEndTitle,flyleafEndSubtitle:f?.flyleafEndSubtitle??Jt.flyleafEndSubtitle},E=(0,c.useRef)(y),D=(0,c.useRef)(!1),O=(0,c.useRef)(0),k=(0,c.useRef)(null),A=(0,c.useRef)(null),j=(0,c.useRef)([]),M=(0,c.useCallback)(()=>{j.current.forEach(e=>window.cancelAnimationFrame(e)),j.current=[]},[]);(0,c.useEffect)(()=>{E.current=y},[y]),(0,c.useEffect)(()=>()=>M(),[M]),(0,c.useEffect)(()=>{let e=A.current;if(!e)return;let t=e=>{let t=Yt(e);S(e=>e===t?e:t)};if(t(e.getBoundingClientRect().height),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(e=>{let n=e[0];n&&t(n.contentRect.height)});return n.observe(e),()=>n.disconnect()},[n,t]);let N=(0,c.useCallback)(t=>{if(E.current||D.current||e.length<2)return;let n=C,r=t===`next`?n+2:n-2;t===`next`&&n+1>=e.length||t===`previous`&&n<=0||(D.current=!1,O.current+=1,M(),b({direction:t,fromIndex:n,targetIndex:r,phase:`cover`}))},[M,e.length,C]);(0,c.useEffect)(()=>{if(!y||y.phase!==`cover`)return;let e=O.current,t=!1,n=0,r=0;return n=window.requestAnimationFrame(()=>{r=window.requestAnimationFrame(()=>{t||e!==O.current||b(e=>e&&e.phase===`cover`?{...e,phase:`run`}:e)})}),()=>{t=!0,window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[y]);let P=(0,c.useCallback)(()=>{let t=E.current;if(!t||D.current||t.phase===`settle`)return;D.current=!0;let n=Ht(t.targetIndex,e.length),r=O.current,i=()=>{if(r!==O.current)return;D.current=!1;let t=e[n]??e[n-1],i=e[n]?n:n-1;t&&i>=0&&(p?.(i,t),m?.(i,t))},a=k.current,o=t.direction===`next`?`translateZ(0) rotateY(-180deg)`:`translateZ(0) rotateY(0deg)`;a&&(a.style.animation=`none`,a.style.transition=`none`,a.style.willChange=`auto`,a.style.transform=o,a.style.opacity=`1`),v(n),b({...t,phase:`settle`,underlaySynced:!0}),M();let s=window.requestAnimationFrame(()=>{let e=window.requestAnimationFrame(()=>{if(r!==O.current)return;let e=k.current;e&&(e.style.visibility=`hidden`);let t=window.requestAnimationFrame(()=>{r===O.current&&(b(null),i())});j.current.push(t)});j.current.push(e)});j.current.push(s)},[M,m,p,e]);(0,c.useEffect)(()=>{if(!y||y.phase!==`run`)return;let e=O.current,t=window.setTimeout(()=>{e===O.current&&P()},w+120);return()=>window.clearTimeout(t)},[P,w,y]),(0,c.useEffect)(()=>{if(!y||y.phase!==`run`||y.underlaySynced)return;let e=O.current,t=window.setTimeout(()=>{e===O.current&&b(e=>e&&e.phase===`run`&&!e.underlaySynced?{...e,underlaySynced:!0}:e)},Math.round(w*.52));return()=>window.clearTimeout(t)},[w,y]),(0,c.useEffect)(()=>{for(let t=-2;t<=2;t+=1)Bt(e[C+t]?.src)},[e,C]);let F=(0,c.useMemo)(()=>{if(!y)return{left:C-1,right:C};let{fromIndex:e,targetIndex:t,direction:n,phase:r}=y;return r===`cover`?{left:e-1,right:e}:r===`settle`?{left:t-1,right:t}:n===`next`?{left:y.underlaySynced?t-1:e-1,right:t}:{left:t-1,right:y.underlaySynced?t:e}},[C,y]),I=(0,c.useMemo)(()=>y?y.direction===`next`?{front:y.fromIndex,back:y.fromIndex+1}:{front:y.targetIndex,back:y.targetIndex+1}:{front:C,back:C+1},[C,y]),L={...g,"--album-width":Vt(t),"--album-height":Vt(n),"--album-ratio":typeof t==`number`&&typeof n==`number`?t/n:1.6429,"--turn-duration":`${w}ms`,"--cover-color":u},R=e=>{e.target===e.currentTarget&&(e.key===`ArrowRight`||e.key===`Enter`||e.key===` `?(e.preventDefault(),N(`next`)):e.key===`ArrowLeft`&&(e.preventDefault(),N(`previous`)))},z=e=>{if(e.target!==e.currentTarget)return;let t=e.animationName||``;t&&!/turnNext|turnPrevious/i.test(t)||P()};if(e.length===0)return(0,l.jsx)(`div`,{className:`${J.album} ${J.empty} ${h??``}`,style:L,role:`region`,"aria-label":d,children:T.empty});let B={total:e.length,objectFit:a,showPageNumber:o,pageColor:s,flyleafTitle:T.flyleafTitle,flyleafSubtitle:T.flyleafSubtitle,flyleafEndTitle:T.flyleafEndTitle,flyleafEndSubtitle:T.flyleafEndSubtitle},V=y?y.phase===`settle`?J.turningPage:y.direction===`next`?`${J.turningPage} ${y.phase===`cover`?J.turnNextReady:J.turnNext}`:`${J.turningPage} ${y.phase===`cover`?J.turnPreviousReady:J.turnPrevious}`:null;return(0,l.jsxs)(`div`,{ref:A,className:`${J.album} ${h??``}`,style:L,role:`region`,"aria-label":d,"aria-roledescription":`photo album`,tabIndex:0,onKeyDown:R,children:[(0,l.jsx)(`div`,{className:J.bookShadow,"aria-hidden":`true`}),(0,l.jsxs)(`div`,{className:J.stage,"aria-hidden":`true`,children:[(0,l.jsxs)(`div`,{className:J.cover,children:[(0,l.jsx)(`span`,{className:J.coverEdgeTop}),(0,l.jsx)(`span`,{className:J.coverEdgeSide})]}),(0,l.jsx)(`div`,{className:J.pageStackLeft}),(0,l.jsx)(`div`,{className:J.pageStackRight})]}),(0,l.jsx)($t,{count:x,variant:`back`}),(0,l.jsxs)(`div`,{className:J.book,children:[(0,l.jsxs)(`div`,{className:`${J.staticPage} ${J.leftPage}`,children:[(0,l.jsx)(Qt,{side:`left`,count:x}),(0,l.jsx)(`div`,{className:J.gutterShade,"aria-hidden":`true`}),(0,l.jsx)(Zt,{photo:e[F.left],index:F.left,...B})]}),(0,l.jsxs)(`div`,{className:`${J.staticPage} ${J.rightPage}`,children:[(0,l.jsx)(Qt,{side:`right`,count:x}),(0,l.jsx)(`div`,{className:J.gutterShade,"aria-hidden":`true`}),(0,l.jsx)(Zt,{photo:e[F.right],index:F.right,...B})]}),y&&V&&(0,l.jsxs)(`div`,{ref:k,className:V,onAnimationEnd:z,"aria-hidden":`true`,children:[(0,l.jsx)(`div`,{className:`${J.face} ${J.front}`,children:(0,l.jsxs)(`div`,{className:J.faceSheet,style:{backgroundColor:s},children:[(0,l.jsx)(Qt,{side:`right`,count:x}),(0,l.jsx)(Zt,{photo:e[I.front],index:I.front,...B})]})}),(0,l.jsx)(`div`,{className:`${J.face} ${J.back}`,children:(0,l.jsxs)(`div`,{className:J.faceSheet,style:{backgroundColor:s},children:[(0,l.jsx)(Qt,{side:`left`,count:x}),(0,l.jsx)(Zt,{photo:e[I.back],index:I.back,...B})]})})]})]}),(0,l.jsx)(`div`,{className:J.bookGutter,"aria-hidden":`true`}),(0,l.jsx)($t,{count:x,variant:`front`}),(0,l.jsx)(`button`,{type:`button`,className:`${J.hitArea} ${J.previousArea}`,onClick:()=>N(`previous`),disabled:C<=0||!!y,"aria-label":T.previous}),(0,l.jsx)(`button`,{type:`button`,className:`${J.hitArea} ${J.nextArea}`,onClick:()=>N(`next`),disabled:C+1>=e.length||!!y,"aria-label":T.next})]})},tn={carousel:`cos-carousel-47YCI`,groundShadow:`cos-groundShadow-HsXpl`,perspective:`cos-perspective-3y-IL`,scene:`cos-scene-fAgTN`,tray:`cos-tray-Op-wW`,trayRim:`cos-trayRim--l707`,ring:`cos-ring--iRg-`,card:`cos-card-pWo53`,frame:`cos-frame-hegBO`,imageWrap:`cos-imageWrap-QPOEy`,image:`cos-image-fvzWr`,cardFront:`cos-cardFront-vPlWj`,cardBack:`cos-cardBack-PgUQH`,caption:`cos-caption-SrLR0`,captionTitle:`cos-captionTitle-n8MP5`,captionDesc:`cos-captionDesc-30qul`,empty:`cos-empty-dkNyz`},nn=e=>typeof e==`number`?`${e}px`:e,rn=(e,t)=>t<=0?0:(e%t+t)%t,an=(e,t,n)=>n<=0?0:rn(Math.round(e/t),n),on=({photos:e,width:t=420,height:n=360,radius:r=180,cardWidth:i=120,cardHeight:a=160,autoRotate:o=!0,autoRotateSpeed:s=12,dragSensitivity:u=.35,friction:d=2.2,showCaption:f=!1,initialAngle:p=0,onPhotoClick:m,onFaceChange:h,onIndexChange:g,ariaLabel:_=`Photo carousel`,className:v,style:y})=>{let b=e.length,x=b>0?360/b:360,S=(0,c.useRef)(null),C=(0,c.useRef)(p),w=(0,c.useRef)(0),T=(0,c.useRef)(!1),E=(0,c.useRef)(null),D=(0,c.useRef)(0),O=(0,c.useRef)(0),k=(0,c.useRef)(an(p,x,b)),A=(0,c.useRef)(!1),j=(0,c.useRef)(0),M=(0,c.useRef)(e),N=(0,c.useRef)(m),P=(0,c.useRef)(h),F=(0,c.useRef)(g),I=(0,c.useRef)(o),L=(0,c.useRef)(s),R=(0,c.useRef)(d),z=(0,c.useRef)(u),B=(0,c.useRef)(x),V=(0,c.useRef)(b),[H,U]=(0,c.useState)(()=>an(p,x,b));(0,c.useEffect)(()=>{M.current=e,N.current=m,P.current=h,F.current=g,I.current=o,L.current=s,R.current=d,z.current=u,B.current=x,V.current=b},[e,m,h,g,o,s,d,u,x,b]);let W=(0,c.useCallback)(e=>{C.current=e,S.current&&(S.current.style.transform=`rotateY(${-e}deg)`);let t=an(e,B.current,V.current);if(t!==k.current){k.current=t,U(t);let e=M.current[t];P.current?.(t,e),e&&F.current?.(t,e)}},[]);(0,c.useEffect)(()=>{C.current=p,w.current=0,W(p)},[W,b,p,x]),(0,c.useEffect)(()=>{let e=0,t=null,n=r=>{if(e=requestAnimationFrame(n),t==null){t=r;return}let i=Math.min(.05,(r-t)/1e3);if(t=r,T.current)return;let a=C.current,o=w.current,s=!1;Math.abs(o)>.01?(a+=o*i,o*=Math.exp(-R.current*i),Math.abs(o)<.02&&(o=0),w.current=o,s=!0):I.current&&(a+=L.current*i,s=!0),s&&W(a)};return e=requestAnimationFrame(n),()=>cancelAnimationFrame(e)},[W]);let ee=(0,c.useCallback)(e=>{V.current<=0||e.button!==0||(T.current=!0,A.current=!1,E.current=e.pointerId,j.current=e.clientX,D.current=e.clientX,O.current=performance.now(),w.current=0,e.currentTarget.setPointerCapture(e.pointerId))},[]),G=(0,c.useCallback)(e=>{if(!T.current||E.current!==e.pointerId)return;let t=performance.now(),n=e.clientX-D.current,r=Math.max(.008,(t-O.current)/1e3);D.current=e.clientX,O.current=t,Math.abs(e.clientX-j.current)>6&&(A.current=!0);let i=-n*z.current;w.current=i/r,W(C.current+i)},[W]),K=(0,c.useCallback)(e=>{if(E.current===e.pointerId){T.current=!1,E.current=null,w.current=Math.max(-720,Math.min(720,w.current));try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}},[]),te=(0,c.useCallback)(t=>{let n=!A.current;if(K(t),n){let t=e[k.current];t&&N.current?.(k.current,t)}},[K,e]),ne=(0,c.useCallback)(e=>{w.current=0,K(e)},[K]),re=e[H],ie=f&&re&&(re.title||re.description),ae=(0,c.useMemo)(()=>e.map((e,t)=>`rotateY(${t*x}deg) translateZ(${r}px)`),[e,r,x]);return b===0?(0,l.jsx)(`div`,{className:[tn.carousel,v].filter(Boolean).join(` `),style:{width:nn(t),height:nn(n),...y},role:`img`,"aria-label":_,children:(0,l.jsx)(`div`,{className:tn.empty,children:`暂无照片`})}):(0,l.jsxs)(`div`,{className:[tn.carousel,v].filter(Boolean).join(` `),style:{width:nn(t),height:nn(n),...y},role:`region`,"aria-label":_,"aria-roledescription":`carousel`,tabIndex:0,children:[(0,l.jsx)(`div`,{className:tn.groundShadow,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:tn.perspective,onPointerDown:ee,onPointerMove:G,onPointerUp:te,onPointerCancel:ne,children:(0,l.jsxs)(`div`,{className:tn.scene,children:[(0,l.jsx)(`div`,{className:tn.tray,"aria-hidden":`true`,children:(0,l.jsx)(`div`,{className:tn.trayRim})}),(0,l.jsx)(`div`,{ref:S,className:tn.ring,style:{width:i,height:a,transform:`rotateY(${-p}deg)`},children:e.map((e,t)=>{let n=t===H;return(0,l.jsx)(`div`,{className:[tn.card,n?tn.cardFront:tn.cardBack].join(` `),style:{"--card-width":`${i}px`,"--card-height":`${a}px`,transform:ae[t]},"aria-hidden":!n,children:(0,l.jsx)(`div`,{className:tn.frame,children:(0,l.jsx)(`div`,{className:tn.imageWrap,children:(0,l.jsx)(`img`,{className:tn.image,src:e.src,alt:e.alt??e.title??`Photo ${t+1}`,draggable:!1})})})},`${e.src}-${t}`)})})]})}),ie?(0,l.jsxs)(`div`,{className:tn.caption,children:[re?.title?(0,l.jsx)(`p`,{className:tn.captionTitle,children:re.title}):null,re?.description?(0,l.jsx)(`p`,{className:tn.captionDesc,children:re.description}):null]}):null]})},sn=1e3/120,cn=sn/1e3,ln=.42,un=3800,dn=2600,fn=2900,pn=.05,mn=(e,t,n)=>Math.min(n,Math.max(t,e)),hn=e=>{let t=Math.sin(e*127.1+31.7)*43758.5453;return t-Math.floor(t)},gn=e=>typeof e==`number`?`${e}px`:e,_n=(e,t)=>t*Math.tanh(e/t),vn=({count:e,viewportWidth:t,viewportHeight:n,photoWidth:r,photoHeight:i,photoGap:a,ropeTop:o,ropeSag:s,bandLength:c,maxPull:l,tilt:u})=>{let d=e>0?e*r+(e-1)*a:0,f=Math.round(r*.55),p=Math.max(d+f*2,t,r*2),m=(p-d)/2,h=r+a,g=[];for(let t=0;t<e;t+=1)g.push(m+t*h+r*(.4+hn(t*5.13)*.2));let _=e=>{let t=p>0?mn(e/p,0,1):0;return o+s*4*t*(1-t)},v=Math.min(20,a*.24+5),y=[],b=[],x=[],S=[],C=[],w=[];for(let t=0;t<e;t+=1){let e=m+t*h,n=g[t],i=_(n);y.push(e),x.push(n-e),S.push(i),b.push(i+c+13),C.push((hn(t*3.71)*2-1)*u),w.push(e+r/2)}let T=[{x:0,baseY:_(0),pulls:[]}];for(let t=0;t<e;t+=1){let e=((t===0?0:g[t-1])+g[t])/2,n=t===0;T.push({x:e,baseY:_(e)+v*(n?.5:1),pulls:n?[{index:t,weight:.3}]:[{index:t-1,weight:.45},{index:t,weight:.45}]}),T.push({x:g[t],baseY:_(g[t]),pulls:[{index:t,weight:1}]})}if(e>0){let t=(g[e-1]+p)/2;T.push({x:t,baseY:_(t)+v*.5,pulls:[{index:e-1,weight:.3}]})}return T.push({x:p,baseY:_(p),pulls:[]}),{railWidth:p,stageHeight:Math.max(n,Math.ceil(o+s+c+13+i+l+40)),cardLefts:y,cardTops:b,pinOffsets:x,pinXs:g,anchorYs:S,baseRots:C,centers:w,anchors:T}},yn=({bandLength:e,damping:t,maxPull:n,stiffness:r,tension:i})=>{let a=420*mn(r,.1,3),o=mn(t,.02,1),s=Math.max(8,e);return{bandLength:s,segLength:s/5,gravityAccel:fn,chainKeep:Math.exp(-(.6+o*6)*cn),swingDamp:2*mn(.28+o,.1,1)*Math.sqrt(165),spinDamp:2*mn(.35+o,.1,1.2)*Math.sqrt(60),bandK:a*.9,bandRecover:11,springK:a,springC:2*mn(.45+o,.1,1.2)*Math.sqrt(a),neighborK:a*mn(i,0,1),maxPull:Math.max(16,n)}},bn=(e,t,n,r)=>({x:e?.pinXs[n]??0,y:(e?.anchorYs[n]??0)+(t?.segLength??0)*r}),xn=(e,t,n)=>Array.from({length:6},(r,i)=>{let a=bn(e,t,n,i);return{x:a.x,y:a.y,px:a.x,py:a.y,sx:a.x,sy:a.y,rx:a.x,ry:a.y}}),Sn=(e,t,n)=>{let r=e.baseRots[n]??0;return{chain:xn(e,t,n),rot:r,vRot:0,spin:0,vSpin:0,swayVx:0,slack:0,ropeY:0,ropeVy:0,sRot:r,sSpin:0,sRopeY:0}},Cn=(e,t,n,r)=>{e.chain.forEach((e,i)=>{let a=bn(t,n,r,i);e.x=a.x,e.y=a.y,e.px=a.x,e.py=a.y,e.sx=a.x,e.sy=a.y,e.rx=a.x,e.ry=a.y}),e.rot=t?.baseRots[r]??0,e.vRot=0,e.spin=0,e.vSpin=0,e.swayVx=0,e.slack=0,e.ropeY=0,e.ropeVy=0,e.sRot=e.rot,e.sSpin=0,e.sRopeY=0},wn=(e,t=e.length)=>{if(t<2)return``;let n=`M ${e[0].x.toFixed(2)} ${e[0].y.toFixed(2)}`;for(let r=0;r<t-1;r+=1){let i=e[r],a=e[r+1],o=r>0?e[r-1]:i,s=r+2<t?e[r+2]:a,c=i.x+(a.x-o.x)/6,l=i.y+(a.y-o.y)/6,u=a.x-(s.x-i.x)/6,d=a.y-(s.y-i.y)/6;n+=` C ${c.toFixed(2)} ${l.toFixed(2)} ${u.toFixed(2)} ${d.toFixed(2)} ${a.x.toFixed(2)} ${a.y.toFixed(2)}`}return n},Tn=(e,t)=>{for(;e.length<t;)e.push({x:0,y:0});return e},En=(e,t)=>({min:Math.min(0,e-t),max:0}),Dn=(e,t,n,r,i)=>{let{layout:a,physics:o,nodes:s}=e;if(!a||!o)return;let c=`translate3d(${e.offset.toFixed(2)}px, 0, 0)`;t.rail&&c!==n.rail&&(t.rail.style.transform=c,n.rail=c);let l=i>0?1-Math.exp(-i*34):1;for(let i=0;i<s.length;i+=1){let c=s[i];if(!c)continue;let u=c.chain,d=u.length-1,f=Tn(e.buffer,u.length);for(let e=0;e<=d;e+=1){let t=u[e],n=t.sx+(t.x-t.sx)*r,i=t.sy+(t.y-t.sy)*r;e===0||e===d?(t.rx=n,t.ry=i):(t.rx+=(n-t.rx)*l,t.ry+=(i-t.ry)*l),f[e].x=t.rx,f[e].y=t.ry}let p=t.cards[i];if(p){let e=u[d],t=a.pinXs[i]??0,s=(a.anchorYs[i]??0)+o.bandLength,l=c.sRot+(c.rot-c.sRot)*r,f=c.sSpin+(c.spin-c.sSpin)*r,m=`translate3d(${(e.rx-t).toFixed(2)}px, ${(e.ry-s).toFixed(2)}px, 0) rotate(${l.toFixed(2)}deg) rotateY(${f.toFixed(2)}deg)`;m!==n.cards[i]&&(p.style.transform=m,n.cards[i]=m)}let m=wn(f,u.length);if(m!==n.bands[i]){n.bands[i]=m,t.bandPaths[i]?.setAttribute(`d`,m),t.bandGloss[i]?.setAttribute(`d`,m);let e=t.knots[i];e&&(e.setAttribute(`cx`,u[0].rx.toFixed(2)),e.setAttribute(`cy`,u[0].ry.toFixed(2)))}}let u=a.anchors,d=Tn(e.buffer,u.length);for(let e=0;e<u.length;e+=1){let t=u[e],n=t.baseY;for(let e of t.pulls){let t=s[e.index];t&&(n+=(t.sRopeY+(t.ropeY-t.sRopeY)*r)*e.weight)}d[e].x=t.x,d[e].y=n}let f=wn(d,u.length);if(f!==n.rope){n.rope=f;for(let e of t.ropePaths)e?.setAttribute(`d`,f)}},On=(e,t,n)=>{let{physics:r,layout:i,nodes:a}=e;if(!r||!i)return;let o=e.drag,s=o?.mode===`photo`?o.photoIndex:-1,c=e.impulse;if(e.impulse=null,o){let e=Math.exp(-n*6);o.vx*=e,o.vy*=e;let t=1-Math.exp(-n*110);o.smoothX+=(o.pointerX-o.smoothX)*t,o.smoothY+=(o.pointerY-o.smoothY)*t}for(let e=0;e<a.length;e+=1){let t=a[e],l=t.chain,u=l.length-1;for(let e=0;e<=u;e+=1)l[e].sx=l[e].x,l[e].sy=l[e].y;t.sRot=t.rot,t.sSpin=t.spin,t.sRopeY=t.ropeY;let d=i.pinXs[e]??0,f=(i.anchorYs[e]??0)+t.ropeY,p=r.maxPull,m=e===s&&o?o:null,h=0,g=0,_=0;if(m){g=m.smoothX-m.grabDx,_=m.smoothY-m.grabDy;let e=Math.hypot(g-d,_-f);h=Math.max(0,_n(e-r.bandLength,p))}t.slack=h>=t.slack?h:t.slack+(h-t.slack)*(1-Math.exp(-n*r.bandRecover)),t.slack<.02&&(t.slack=0);let v=r.bandLength+t.slack,y=v/5;c&&c.index===e&&(l[u].px=l[u].x-c.vx*n,l[u].py=l[u].y-c.vy*n);let b=r.gravityAccel*n*n;for(let e=1;e<=u;e+=1){let t=l[e],n=(t.x-t.px)*r.chainKeep,i=(t.y-t.py)*r.chainKeep;t.px=t.x,t.py=t.y,t.x+=n,t.y+=i+b}let x=null;if(m){let e=g-d,t=_-f,n=Math.hypot(e,t);x=n>v&&n>.001?{x:d+e/n*v,y:f+t/n*v}:{x:g,y:_}}for(let e=0;e<8;e+=1){l[0].x=d,l[0].y=f,x&&(l[u].x=x.x,l[u].y=x.y);for(let e=0;e<u;e+=1){let t=l[e],n=l[e+1],r=n.x-t.x,i=n.y-t.y,a=Math.hypot(r,i)||1e-4;if(a<=y)continue;let o=(a-y)/a,s=e===0,c=e+1===u&&x!==null,d=s?0:c?1:.5,f=c?0:s?1:.5;t.x+=r*o*d,t.y+=i*o*d,n.x-=r*o*f,n.y-=i*o*f}}let S=l[u],C=-(Math.atan2(S.x-l[0].x,S.y-l[0].y)*180)/Math.PI,w=76*Math.tanh(C/76),T=(i.baseRots[e]??0)+w;t.vRot+=((T-t.rot)*165-t.vRot*r.swingDamp)*n,t.rot=mn(t.rot+t.vRot*n,-108,108);let E=(S.x-S.px)/n;t.swayVx+=(E-t.swayVx)*(1-Math.exp(-n*18));let D=mn(-t.swayVx*pn,-34,34);t.vSpin+=((D-t.spin)*60-t.vSpin*r.spinDamp)*n,t.spin+=t.vSpin*n;let O=-r.springK*t.ropeY-r.springC*t.ropeVy;if(t.slack>0){let e=S.y-f,n=Math.hypot(S.x-d,e)||1;O+=r.bandK*t.slack*Math.max(e/n,0)}let k=a[e-1],A=a[e+1];k&&(O+=r.neighborK*(k.ropeY-t.ropeY)),A&&(O+=r.neighborK*(A.ropeY-t.ropeY)),t.ropeVy+=O*n,t.ropeY=mn(t.ropeY+t.ropeVy*n,-r.maxPull,r.maxPull*1.2)}if(o?.mode===`pan`)return;let{min:l,max:u}=En(t,i.railWidth),d=e.snapTarget;if(d!==null){let t=d-e.offset;e.offset+=t*(1-Math.exp(-n*12)),e.offsetVelocity=0,Math.abs(t)<.4&&(e.offset=d,e.snapTarget=null);return}if(o)return;let f=e.offset;if(f>u||f<l){let t=f>u?u:l;e.offsetVelocity+=((t-f)*220-e.offsetVelocity*15)*n,e.offset+=e.offsetVelocity*n,Math.abs(t-e.offset)<.4&&Math.abs(e.offsetVelocity)<24&&(e.offset=t,e.offsetVelocity=0);return}e.offsetVelocity!==0&&(e.offset+=e.offsetVelocity*n,e.offsetVelocity*=Math.exp(-n*2.8),Math.abs(e.offsetVelocity)<12&&(e.offsetVelocity=0),e.offset=mn(e.offset,l,u))},kn=(e,t)=>{if(e.drag||e.snapTarget!==null||e.impulse||Math.abs(e.offsetVelocity)>.5)return!1;let n=e.layout;if(!n)return!1;let{min:r,max:i}=En(t,n.railWidth);return e.offset>i+.4||e.offset<r-.4?!1:e.nodes.every((t,r)=>{let i=n.baseRots[r]??0;return t.slack>0||Math.abs(t.rot-i)>1||Math.abs(t.vRot)>4||Math.abs(t.spin)>.6||Math.abs(t.vSpin)>4||Math.abs(t.ropeY)>.3||Math.abs(t.ropeVy)>3?!1:t.chain.every((t,i)=>{let a=bn(n,e.physics,r,i);return Math.hypot(t.x-a.x,t.y-a.y)<.6&&Math.abs(t.x-t.px)<.02&&Math.abs(t.y-t.py)<.02})})},An=e=>{e.nodes.forEach((t,n)=>{Cn(t,e.layout,e.physics,n)}),e.offsetVelocity=0},jn={clothesline:`cos-clothesline-sgTFe`,viewport:`cos-viewport-TH-gR`,pannable:`cos-pannable-sEcjn`,rail:`cos-rail-eTBFj`,strings:`cos-strings-HDBn-`,ropeShadow:`cos-ropeShadow-79mEA`,ropeShadowCore:`cos-ropeShadowCore-L3p8G`,ropeBody:`cos-ropeBody-pEvRS`,ropeTwist:`cos-ropeTwist-shhPx`,bandBody:`cos-bandBody-DScGJ`,bandGloss:`cos-bandGloss-I-wXr`,bandKnot:`cos-bandKnot-raqsN`,hanger:`cos-hanger-8FbKZ`,frame:`cos-frame-TORk3`,pin:`cos-pin-wNwv2`,pinSpring:`cos-pinSpring-1-6dJ`,photo:`cos-photo-90x94`,caption:`cos-caption-VM5T4`},Mn=({photos:e,width:t=`100%`,height:n=480,photoWidth:r=150,photoHeight:i=200,photoGap:a=46,ropeTop:o=66,ropeSag:s=26,bandLength:u=34,bandWidth:d=5,maxPull:f=110,stiffness:p=1,damping:m=.16,tension:h=.35,tilt:g=5,ropeColor:_=`#8d7a5c`,bandColor:v,pinColor:y=`#d8a761`,frameColor:b=`#fffdf7`,background:x,objectFit:S=`cover`,showCaption:C=!0,initialIndex:w=0,onIndexChange:T,onPhotoClick:E,ariaLabel:D=`Photo clothesline`,className:O,style:k})=>{let A=(0,c.useRef)(null),j=(0,c.useRef)(null),M=(0,c.useRef)([]),N=(0,c.useRef)([]),P=(0,c.useRef)([]),F=(0,c.useRef)([]),I=(0,c.useRef)([]),L=(0,c.useRef)({bands:[],cards:[],rope:``,rail:``}),R=(0,c.useRef)({nodes:[],layout:null,physics:null,offset:0,offsetVelocity:0,snapTarget:null,drag:null,impulse:null,buffer:[]}),z=(0,c.useRef)(null),B=(0,c.useRef)(null),V=(0,c.useRef)(0),H=(0,c.useRef)(0),U=(0,c.useRef)(!1),W=(0,c.useRef)(w),ee=(0,c.useRef)(w),G=(0,c.useRef)(T),K=(0,c.useRef)(E),te=(0,c.useRef)(e),[ne,re]=(0,c.useState)({width:0,height:0}),ie=e.length,ae=C&&e.some(e=>e.title||e.description);(0,c.useEffect)(()=>{G.current=T,K.current=E,te.current=e},[T,E,e]);let q=(0,c.useMemo)(()=>vn({count:ie,viewportWidth:ne.width,viewportHeight:ne.height,photoWidth:r,photoHeight:i,photoGap:a,ropeTop:o,ropeSag:s,bandLength:u,maxPull:f,tilt:g}),[u,ie,f,a,i,r,s,o,g,ne.height,ne.width]),oe=(0,c.useMemo)(()=>yn({bandLength:u,damping:m,maxPull:f,stiffness:p,tension:h}),[u,m,f,p,h]),se=Math.min(0,ne.width-q.railWidth)<-.5,ce=(0,c.useCallback)(()=>A.current?.clientWidth??ne.width,[ne.width]),le=(0,c.useCallback)(()=>({rail:j.current,ropePaths:M.current,bandPaths:N.current,bandGloss:P.current,knots:F.current,cards:I.current}),[]),ue=(0,c.useCallback)((e,t)=>{Dn(R.current,le(),L.current,e,t)},[le]),de=(0,c.useCallback)(()=>{if(B.current!==null||typeof window>`u`)return;let e=z.current;e&&(V.current=0,H.current=0,B.current=window.requestAnimationFrame(e))},[]);(0,c.useEffect)(()=>{let e=t=>{B.current=null;let n=V.current||t;V.current=t;let r=Math.min(t-n,64);H.current+=r;let i=R.current,a=ce(),o=0;for(;H.current>=8.333333333333334&&o<12;)On(i,a,cn),H.current-=sn,o+=1;if(o>=12&&(H.current=0),kn(i,a)){An(i),ue(1,0),V.current=0,H.current=0;let e=i.layout?.centers;if(e&&e.length>0){let t=a/2-i.offset,n=0,r=1/0;for(let i=0;i<e.length;i++){let a=Math.abs(e[i]-t);a<r&&(r=a,n=i)}if(n!==ee.current){ee.current=n;let e=te.current[n];e&&G.current?.(n,e)}}return}ue(H.current/sn,r/1e3),B.current=window.requestAnimationFrame(e)};return z.current=e,()=>{z.current=null}},[ue,ce]),(0,c.useEffect)(()=>{let e=R.current;e.layout=q,e.physics=oe},[q,oe]),(0,c.useEffect)(()=>{let e=R.current;e.nodes=Array.from({length:ie},(e,t)=>Sn(q,oe,t)),I.current.length=ie,L.current.rope=``,L.current.rail=``},[ie,q,oe]),(0,c.useEffect)(()=>{let e=A.current;if(!e)return;let t=(e,t)=>re(n=>n.width===e&&n.height===t?n:{width:e,height:t});if(t(e.clientWidth,e.clientHeight),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(e=>{let n=e[0];n&&t(Math.round(n.contentRect.width),Math.round(n.contentRect.height))});return n.observe(e),()=>n.disconnect()},[]);let fe=(0,c.useCallback)(e=>{let t=ce(),n=R.current.layout?.centers[mn(e,0,Math.max(0,ie-1))];if(n===void 0)return 0;let{min:r,max:i}=En(t,R.current.layout?.railWidth??0);return mn(t/2-n,r,i)},[ie,ce]);(0,c.useEffect)(()=>{if(ne.width<=0)return;let e=R.current;if(!U.current){U.current=!0,W.current=w,e.offset=fe(w),ue(1,0);return}if(W.current!==w){W.current=w,e.snapTarget=fe(w),de();return}let{min:t,max:n}=En(ce(),e.layout?.railWidth??0);e.offset=mn(e.offset,t,n),ue(1,0)},[ie,w,q,fe,ue,de,ce,ne.width]),(0,c.useEffect)(()=>()=>{B.current!==null&&window.cancelAnimationFrame(B.current),B.current=null},[]);let pe=(0,c.useCallback)(e=>{if(e.button!==0&&e.pointerType===`mouse`)return;let t=e.target?.closest?.(`[data-photo-index]`),n=t?Number(t.dataset.photoIndex):-1,r=Number.isFinite(n)?n:-1,i=A.current?.getBoundingClientRect(),a=i?.left??0,o=i?.top??0,s=R.current,c=e.clientX-a-s.offset,l=e.clientY-o,u=r>=0?s.nodes[r]:void 0,d=u?.chain[u.chain.length-1];s.snapTarget=null,s.offsetVelocity=0,s.drag={pointerId:e.pointerId,mode:d?`photo`:`pan`,photoIndex:r,grabDx:d?c-d.x:0,grabDy:d?l-d.y:0,pointerX:c,pointerY:l,smoothX:c,smoothY:l,rectLeft:a,rectTop:o,startX:e.clientX,startY:e.clientY,startOffset:s.offset,lastX:e.clientX,lastY:e.clientY,lastTime:e.timeStamp,vx:0,vy:0,moved:0},e.currentTarget.setPointerCapture(e.pointerId),de()},[de]),me=(0,c.useCallback)(e=>{let t=R.current,n=t.drag;if(!n||n.pointerId!==e.pointerId)return;let r=e.clientX-n.startX,i=e.clientY-n.startY;n.moved=Math.max(n.moved,Math.hypot(r,i));let a=Math.max(e.timeStamp-n.lastTime,1)/1e3;if(n.vx=.7*((e.clientX-n.lastX)/a)+.3*n.vx,n.vy=.7*((e.clientY-n.lastY)/a)+.3*n.vy,n.lastX=e.clientX,n.lastY=e.clientY,n.lastTime=e.timeStamp,n.mode===`pan`){let{min:e,max:i}=En(ce(),t.layout?.railWidth??0),a=n.startOffset+r;t.offset=a-(a>i?a-i:a<e?a-e:0)*(1-ln),de();return}n.pointerX=e.clientX-n.rectLeft-t.offset,n.pointerY=e.clientY-n.rectTop,de()},[de,ce]),he=(0,c.useCallback)(e=>{let t=R.current,n=t.drag;if(!(!n||n.pointerId!==e.pointerId)){if(t.drag=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),n.mode===`pan`)t.offsetVelocity=mn(n.vx,-un,un);else if(n.moved<=4&&n.photoIndex>=0){let e=te.current[n.photoIndex];e&&K.current?.(n.photoIndex,e)}else n.photoIndex>=0&&(t.impulse={index:n.photoIndex,vx:mn(n.vx,-dn,dn),vy:mn(n.vy,-dn,dn)});de()}},[de]),ge=(0,c.useCallback)(e=>{let t=R.current,n=t.drag;!n||n.pointerId!==e.pointerId||(t.drag=null,de())},[de]);(0,c.useEffect)(()=>{let e=A.current;if(!e)return;let t=e=>{let t=Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.shiftKey?e.deltaY:0;if(t===0)return;let n=R.current,{min:r,max:i}=En(ce(),n.layout?.railWidth??0);r>=i||(e.preventDefault(),n.snapTarget=null,n.offsetVelocity=0,n.offset=mn(n.offset-t,r,i),de())};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[de,ce]);let _e=(0,c.useCallback)(e=>{let t=e.target?.closest?.(`[data-photo-index]`),n=t?Number(t.dataset.photoIndex):-1,i=R.current;if(e.key===`ArrowRight`||e.key===`ArrowLeft`){let{min:t,max:n}=En(ce(),i.layout?.railWidth??0);if(t>=n)return;e.preventDefault();let o=r+a;i.snapTarget=mn((i.snapTarget??i.offset)+(e.key===`ArrowLeft`?o:-o),t,n),de();return}if(!(n<0)){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),i.impulse={index:n,vx:0,vy:e.key===`ArrowDown`?1500:-1e3},de();return}if(e.key===`Enter`||e.key===` `){let t=te.current[n];if(!t||!K.current)return;e.preventDefault(),K.current(n,t)}}},[a,r,de,ce]),ve=e=>({left:q.cardLefts[e],top:q.cardTops[e],width:r,height:i,transform:`translate3d(0, 0, 0) rotate(${q.baseRots[e]}deg)`,"--pin-x":`${q.pinOffsets[e]}px`,"--pin-grip":`-13px`}),ye={...k,width:gn(t),height:gn(n),"--rope-color":_,"--band-color":v??_,"--band-width":`${Math.max(1,d)}px`,"--pin-color":y,"--frame-color":b,...x?{"--clothesline-bg":x}:null};return(0,l.jsx)(`div`,{className:`${jn.clothesline} ${O??``}`,style:ye,role:`region`,"aria-label":D,children:(0,l.jsx)(`div`,{ref:A,className:`${jn.viewport} ${se?jn.pannable:``}`,onPointerDown:pe,onPointerMove:me,onPointerUp:he,onPointerCancel:ge,onKeyDown:_e,children:(0,l.jsxs)(`div`,{ref:j,className:jn.rail,style:{width:q.railWidth},children:[(0,l.jsxs)(`svg`,{className:jn.strings,width:q.railWidth,height:q.stageHeight,viewBox:`0 0 ${q.railWidth} ${q.stageHeight}`,"aria-hidden":`true`,children:[(0,l.jsx)(`path`,{ref:e=>{M.current[0]=e},className:jn.ropeShadow}),(0,l.jsx)(`path`,{ref:e=>{M.current[1]=e},className:jn.ropeShadowCore}),(0,l.jsx)(`path`,{ref:e=>{M.current[2]=e},className:jn.ropeBody}),(0,l.jsx)(`path`,{ref:e=>{M.current[3]=e},className:jn.ropeTwist}),e.map((e,t)=>(0,l.jsxs)(`g`,{children:[(0,l.jsx)(`path`,{ref:e=>{N.current[t]=e,L.current.bands[t]=``},className:jn.bandBody}),(0,l.jsx)(`path`,{ref:e=>{P.current[t]=e},className:jn.bandGloss}),(0,l.jsx)(`circle`,{ref:e=>{F.current[t]=e},className:jn.bandKnot,r:4.2})]},`band-${e.src}-${t}`))]}),e.map((e,t)=>(0,l.jsx)(Nn,{photo:e,index:t,style:ve(t),objectFit:S,hasCaption:ae,clickable:!!E,onCardRef:e=>{I.current[t]=e,L.current.cards[t]=``}},`${e.src}-${t}`))]})})})},Nn=c.default.memo(({photo:e,index:t,style:n,objectFit:r,hasCaption:i,clickable:a,onCardRef:o})=>(0,l.jsxs)(`div`,{ref:o,className:jn.hanger,"data-photo-index":t,style:n,tabIndex:0,role:a?`button`:`group`,"aria-label":e.title??e.alt??void 0,children:[(0,l.jsx)(`span`,{className:jn.pin,"aria-hidden":`true`,children:(0,l.jsx)(`span`,{className:jn.pinSpring})}),(0,l.jsxs)(`figure`,{className:jn.frame,children:[(0,l.jsx)(`span`,{className:jn.photo,children:(0,l.jsx)(`img`,{src:e.src,alt:e.alt??e.title??``,draggable:!1,style:{objectFit:r}})}),i&&(0,l.jsxs)(`figcaption`,{className:jn.caption,children:[e.title&&(0,l.jsx)(`strong`,{children:e.title}),e.description&&(0,l.jsx)(`span`,{children:e.description})]})]})]}));Nn.displayName=`PhotoHanger`;var Pn={filmstrip:`cos-filmstrip-xRvDi`,sprocketBand:`cos-sprocketBand-Md1u6`,sprocketBandBottom:`cos-sprocketBandBottom-KyDcg`,viewport:`cos-viewport-qraxB`,strip:`cos-strip-qvNaQ`,frameCell:`cos-frameCell-ZyVRT`,frameNumber:`cos-frameNumber-1pHpP`,frameWindow:`cos-frameWindow-GiJp4`,caption:`cos-caption-RBarX`,empty:`cos-empty-ql-mT`},Fn=6,In=8,Ln=2600,Rn=14,zn=e=>typeof e==`number`?`${e}px`:e,Bn=(e,t,n)=>Math.min(n,Math.max(t,e)),Vn=e=>String(e+1).padStart(2,`0`),Hn=({photos:e,width:t=`100%`,height:n=280,frameWidth:r=160,frameHeight:i=120,frameGap:a=14,showCaption:o=!0,friction:s=2.8,dragSensitivity:u=1,initialIndex:d=0,onPhotoClick:f,onIndexChange:p,ariaLabel:m=`Photo filmstrip`,className:h,style:g})=>{let _=(0,c.useRef)(null),v=(0,c.useRef)(null),y=(0,c.useRef)(null),b=(0,c.useRef)({offset:0,velocity:0,drag:null,snapTarget:null}),x=(0,c.useRef)(null),S=(0,c.useRef)(0),C=(0,c.useRef)(0),w=(0,c.useRef)(!1),T=(0,c.useRef)(d),E=(0,c.useRef)(f),D=(0,c.useRef)(p),O=(0,c.useRef)(e),k=(0,c.useRef)(s),A=(0,c.useRef)(u),[j,M]=(0,c.useState)(0),[N,P]=(0,c.useState)(d),F=e.length,I=r+a,L=o&&e.some(e=>e.title||e.description);(0,c.useEffect)(()=>{E.current=f,D.current=p,O.current=e,k.current=s,A.current=u},[u,s,p,f,e]);let R=(0,c.useMemo)(()=>j>0?j/2-r/2:0,[r,j]),z=(0,c.useMemo)(()=>F<=0?0:R*2+F*r+Math.max(0,F-1)*a,[F,a,r,R]),B=(0,c.useCallback)(e=>{if(j<=0||F<=0)return 0;let t=R+Bn(Math.floor(e),0,F-1)*I+r/2;return j/2-t},[F,I,r,R,j]),V=(0,c.useCallback)(e=>{if(F<=0||j<=0)return 0;let t=(j/2-e-R-r/2)/I;return Bn(Math.round(t),0,F-1)},[F,I,r,R,j]),H=(0,c.useCallback)(()=>F<=0?{min:0,max:0}:{min:B(F-1),max:B(0)},[F,B]),U=(0,c.useCallback)(e=>{let t=y.current;t&&(t.style.transform=`translate3d(${e}px, 0, 0)`)},[]),W=(0,c.useCallback)(e=>{if(e===C.current)return;C.current=e,P(e);let t=O.current[e];t&&D.current?.(e,t)},[]),ee=(0,c.useCallback)(()=>{x.current!==null&&(window.cancelAnimationFrame(x.current),x.current=null),S.current=0},[]),G=(0,c.useCallback)(()=>{if(x.current!==null||typeof window>`u`)return;let e=t=>{x.current=null;let n=S.current||t;S.current=t;let r=Math.min(.05,(t-n)/1e3),i=b.current,{min:a,max:o}=H(),s=!1;if(i.drag)U(i.offset),s=!0;else if(i.snapTarget!==null){let e=i.snapTarget-i.offset;Math.abs(e)<=.35?(i.offset=i.snapTarget,i.snapTarget=null,i.velocity=0,W(V(i.offset)),U(i.offset)):(i.offset+=e*Math.min(1,Rn*r),i.velocity=0,U(i.offset),s=!0)}else{let e=i.velocity;if(Math.abs(e)>In)e*=Math.exp(-k.current*r),Math.abs(e)<=In&&(e=0),i.velocity=e,i.offset+=e*r,(i.offset<a||i.offset>o)&&(i.offset=Bn(i.offset,a,o),i.velocity=0),U(i.offset),s=!0;else{i.velocity=0;let e=B(V(i.offset));Math.abs(i.offset-e)>.35?(i.snapTarget=e,s=!0):(i.offset=e,W(V(i.offset)),U(i.offset))}}s?x.current=window.requestAnimationFrame(e):S.current=0};x.current=window.requestAnimationFrame(e)},[U,V,W,H,B]);(0,c.useEffect)(()=>{let e=v.current;if(!e)return;let t=e=>{M(t=>t===e?t:e)};if(t(e.clientWidth),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(e=>{let n=e[0];n&&t(Math.round(n.contentRect.width))});return n.observe(e),()=>n.disconnect()},[]),(0,c.useEffect)(()=>{if(j<=0||F<=0)return;let e=b.current;if(!w.current){w.current=!0,T.current=d,e.offset=B(d),e.velocity=0,e.snapTarget=null,e.drag=null,C.current=Bn(d,0,F-1),P(C.current),U(e.offset);return}if(T.current!==d){T.current=d,e.velocity=0,e.drag=null,e.snapTarget=B(d),G();return}let{min:t,max:n}=H();e.offset=Bn(e.offset,t,n),U(e.offset)},[U,F,d,H,B,G,j]),(0,c.useEffect)(()=>()=>{ee()},[ee]);let K=(0,c.useCallback)(e=>{let t=b.current,n=t.drag;if(!n||n.pointerId!==e.pointerId)return;t.drag=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId);let r=Math.max(.008,(e.timeStamp-n.lastTime)/1e3);if(t.velocity=Bn((e.clientX-n.lastX)/r*A.current,-2600,Ln),t.snapTarget=null,n.moved<=Fn){t.velocity=0;let e=V(t.offset),n=O.current[e];n&&E.current?.(e,n),t.snapTarget=B(e)}G()},[V,B,G]),te=(0,c.useCallback)(e=>{if(e.button!==0&&e.pointerType===`mouse`||F<=0)return;let t=b.current;t.drag={pointerId:e.pointerId,startX:e.clientX,startOffset:t.offset,lastX:e.clientX,lastTime:e.timeStamp,vx:0,moved:0},t.velocity=0,t.snapTarget=null,e.currentTarget.setPointerCapture(e.pointerId),G()},[F,G]),ne=(0,c.useCallback)(e=>{let t=b.current,n=t.drag;if(!n||n.pointerId!==e.pointerId)return;let r=e.clientX-n.startX;n.moved=Math.max(n.moved,Math.abs(r));let i=Math.max(e.timeStamp-n.lastTime,1)/1e3;n.vx=.7*((e.clientX-n.lastX)/i)+.3*n.vx,n.lastX=e.clientX,n.lastTime=e.timeStamp;let{min:a,max:o}=H();t.offset=Bn(n.startOffset+r*A.current,a,o),U(t.offset),G()},[U,H,G]),re=(0,c.useCallback)(e=>{K(e)},[K]),ie=(0,c.useCallback)(e=>{K(e)},[K]),ae=(0,c.useCallback)(e=>{if(F<=0||e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=b.current,n=e.key===`ArrowLeft`?I:-I,{min:r,max:i}=H(),a=t.snapTarget??t.offset;t.velocity=0,t.drag=null,t.snapTarget=Bn(a+n,r,i),G()},[F,I,H,G]),q=e[N],oe=o&&q?.title?`,当前:${q.title}${q.description?`,${q.description}`:``}`:``;return(0,l.jsxs)(`div`,{ref:_,className:[Pn.filmstrip,h].filter(Boolean).join(` `),style:{width:zn(t),height:zn(n),...g},role:`region`,"aria-label":m+oe,tabIndex:F>0?0:-1,onKeyDown:ae,children:[(0,l.jsx)(`div`,{className:Pn.sprocketBand,"aria-hidden":`true`}),(0,l.jsx)(`div`,{ref:v,className:Pn.viewport,onPointerDown:te,onPointerMove:ne,onPointerUp:re,onPointerCancel:ie,children:F>0?(0,l.jsx)(`div`,{ref:y,className:Pn.strip,style:{minWidth:z,paddingLeft:R,paddingRight:R,boxSizing:`border-box`},children:e.map((e,t)=>(0,l.jsxs)(`div`,{className:Pn.frameCell,style:{width:r,marginRight:t<F-1?a:0},"data-photo-index":t,children:[(0,l.jsx)(`span`,{className:Pn.frameNumber,children:Vn(t)}),(0,l.jsx)(`div`,{className:Pn.frameWindow,style:{width:r,height:i},children:(0,l.jsx)(`img`,{src:e.src,alt:e.alt??e.title??``,draggable:!1})}),L&&(e.title||e.description)&&(0,l.jsxs)(`div`,{className:Pn.caption,children:[e.title&&(0,l.jsx)(`strong`,{children:e.title}),e.description&&(0,l.jsx)(`span`,{children:e.description})]})]},`${e.src}-${t}`))}):(0,l.jsx)(`div`,{className:Pn.empty,children:`No photos`})}),(0,l.jsx)(`div`,{className:[Pn.sprocketBand,Pn.sprocketBandBottom].join(` `),"aria-hidden":`true`})]})},Un={fridge:`cos-fridge-3RQp4`,handle:`cos-handle-Qr-U3`,stage:`cos-stage-Aw2rq`,card:`cos-card-SefXh`,cardDragging:`cos-cardDragging-UA1W-`,magnetRow:`cos-magnetRow-Q9nXm`,magnet:`cos-magnet-PiJ8m`,magnetRed:`cos-magnetRed-eIhOH`,magnetBlue:`cos-magnetBlue-BHgCS`,magnetGreen:`cos-magnetGreen-L7iFW`,magnetYellow:`cos-magnetYellow-gKTmk`,photoFrame:`cos-photoFrame-g1FoK`,image:`cos-image-wyaBh`,caption:`cos-caption-M-HQN`,title:`cos-title-ziJT2`,description:`cos-description-xaZI-`,empty:`cos-empty-gHMtw`},Wn=6,Gn=1200,Kn=.08,qn=1.05,Jn=10,Yn=32,Xn=.24,Zn=[`magnetRed`,`magnetBlue`,`magnetGreen`,`magnetYellow`],Qn=e=>typeof e==`number`?`${e}px`:e,$n=(e,t,n)=>Math.min(n,Math.max(t,e)),er=e=>{let t=Math.sin(e*127.1+31.7)*43758.5453;return t-Math.floor(t)},tr=(e,t,n,r,i,a)=>{if(e<=0||t<=0||n<=0)return[];let o=Math.max(Jn,t-r-Jn-Yn),s=Math.max(Jn,n-i-Jn),c=Math.max(0,o-Jn)*.55*a,l=Math.max(0,s-Jn)*.5*a,u=Jn+(o-Jn)*.5-r*.5,d=Jn+(s-Jn)*.5-i*.5;return Array.from({length:e},(t,n)=>{let r=e<=1?.5:n/(e-1),i=(r-.5)*c*1.4,f=Math.sin(r*Math.PI*1.2)*l*.35,p=(er(n*7.13+2.1)*2-1)*c*.45,m=(er(n*11.37+5.9)*2-1)*l*.42,h=(er(n*3.71+1.4)*2-1)*12*a;return{x:$n(u+i+p,Jn,o),y:$n(d+f+m,Jn,s),rot:h}})},nr=(e,t,n,r,i)=>{let a=Math.max(Jn,r-t-Jn-Yn),o=Math.max(Jn,i-n-Jn);e.x=$n(e.x,Jn,a),e.y=$n(e.y,Jn,o)},rr=({photos:e,width:t=`100%`,height:n=480,cardWidth:r=120,cardHeight:i=140,scatter:a=1,friction:o=2,showCaption:s=!0,initialIndex:u=0,onPhotoClick:d,ariaLabel:f=`冰箱磁贴照片墙`,className:p,style:m})=>{let h=(0,c.useRef)(null),g=(0,c.useRef)([]),_=(0,c.useRef)([]),v=(0,c.useRef)([]),y=(0,c.useRef)(0),b=(0,c.useRef)(null),x=(0,c.useRef)(null),S=(0,c.useRef)(null),C=(0,c.useRef)(0),w=(0,c.useRef)(-1),T=(0,c.useRef)(d),E=(0,c.useRef)(e),D=(0,c.useRef)(o),O=(0,c.useRef)({w:r,h:i}),k=(0,c.useRef)({width:0,height:0}),[A,j]=(0,c.useState)({width:0,height:0}),[M,N]=(0,c.useState)(null),P=e.length,F=$n(a,0,2.5),I=Math.round(i*(s?1-Xn:1)),L=s&&e.some(e=>e.title||e.description);(0,c.useEffect)(()=>{T.current=d,E.current=e,D.current=o,O.current={w:r,h:i}},[d,e,o,r,i]),(0,c.useEffect)(()=>{k.current=A},[A]);let R=(0,c.useMemo)(()=>tr(P,A.width,A.height,r,i,F),[i,r,P,F,A.height,A.width]),z=(0,c.useCallback)(e=>{let t=g.current[e],n=_.current[e],r=v.current[e]??e;if(!t||!n)return;let i=x.current===e?qn:1;t.style.zIndex=String(r),t.style.transform=`translate3d(${n.x}px, ${n.y}px, 0) rotate(${n.rot}deg) scale(${i})`},[]),B=(0,c.useCallback)(()=>{for(let e=0;e<_.current.length;e+=1)z(e)},[z]),V=(0,c.useCallback)(()=>{let{w:e,h:t}=O.current,n=k.current;_.current=R.map(e=>({x:e.x,y:e.y,rot:e.rot,vx:0,vy:0,vRot:0})),v.current=Array.from({length:P},(e,t)=>t),y.current=Math.max(P-1,0);let r=$n(Math.floor(u),0,Math.max(0,P-1));P>0&&(y.current+=1,v.current[r]=y.current),_.current.forEach(r=>nr(r,e,t,n.width,n.height)),w.current=P,B()},[P,u,B,R]),H=(0,c.useCallback)(()=>{let{w:e,h:t}=O.current,n=k.current;n.width<=0||n.height<=0||_.current.forEach((r,i)=>{nr(r,e,t,n.width,n.height),z(i)})},[z]);(0,c.useEffect)(()=>{A.width<=0||A.height<=0||(w.current!==P||_.current.length!==P?V():H())},[V,H,P,A.height,A.width]),(0,c.useEffect)(()=>{let e=h.current;if(!e)return;let t=new ResizeObserver(([e])=>{let{width:t,height:n}=e.contentRect;j({width:t,height:n})});return t.observe(e),j({width:e.clientWidth,height:e.clientHeight}),()=>t.disconnect()},[]);let U=(0,c.useCallback)(()=>{S.current!==null&&(cancelAnimationFrame(S.current),S.current=null)},[]),W=(0,c.useRef)(()=>void 0);(0,c.useEffect)(()=>{W.current=e=>{let t=C.current?Math.min((e-C.current)/1e3,.032):.016;C.current=e;let{w:n,h:r}=O.current,i=k.current,a=Math.exp(-D.current*t*60),o=!1,s=_.current;for(let e=0;e<s.length;e+=1){if(x.current===e)continue;let c=s[e];c.x+=c.vx*t,c.y+=c.vy*t,c.rot+=c.vRot*t,c.vx*=a,c.vy*=a,c.vRot*=a,nr(c,n,r,i.width,i.height),Math.abs(c.vx)>Kn||Math.abs(c.vy)>Kn||Math.abs(c.vRot)>Kn*.3?o=!0:(c.vx=0,c.vy=0,c.vRot=0),z(e)}o?S.current=requestAnimationFrame(e=>W.current(e)):S.current=null}},[z]);let ee=(0,c.useCallback)(()=>{S.current===null&&(C.current=0,S.current=requestAnimationFrame(e=>W.current(e)))},[]);(0,c.useEffect)(()=>()=>U(),[U]);let G=(0,c.useCallback)(e=>{y.current+=1,v.current[e]=y.current,z(e)},[z]),K=e=>t=>{if(t.button!==0)return;let n=_.current[e];if(!n)return;let r=h.current?.getBoundingClientRect();if(!r)return;t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),G(e),x.current=e,N(e);let i=t.clientX-r.left,a=t.clientY-r.top;b.current={pointerId:t.pointerId,index:e,grabDx:i-n.x,grabDy:a-n.y,startX:t.clientX,startY:t.clientY,lastX:t.clientX,lastY:t.clientY,lastTime:t.timeStamp,moved:0,vx:0,vy:0},n.vx=0,n.vy=0,n.vRot=0,z(e)},te=e=>{let t=b.current;if(!t||t.pointerId!==e.pointerId)return;let n=h.current?.getBoundingClientRect();if(!n)return;let r=e.clientX-t.startX,i=e.clientY-t.startY;t.moved=Math.max(t.moved,Math.hypot(r,i));let a=Math.max(e.timeStamp-t.lastTime,1)/1e3;t.vx=$n(.65*((e.clientX-t.lastX)/a)+.35*t.vx,-1200,Gn),t.vy=$n(.65*((e.clientY-t.lastY)/a)+.35*t.vy,-1200,Gn),t.lastX=e.clientX,t.lastY=e.clientY,t.lastTime=e.timeStamp;let o=_.current[t.index];if(!o)return;let{w:s,h:c}=O.current;o.x=e.clientX-n.left-t.grabDx,o.y=e.clientY-n.top-t.grabDy,o.rot+=t.vx*.0035,nr(o,s,c,k.current.width,k.current.height),z(t.index)},ne=e=>{let t=b.current;if(!t||t.pointerId!==e.pointerId)return;b.current=null,x.current=null,N(null),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId);let n=_.current[t.index];if(n){if(t.moved<=Wn){let e=E.current[t.index];e&&T.current?.(t.index,e),z(t.index);return}n.vx=t.vx*.5,n.vy=t.vy*.5,n.vRot=t.vx*.008,ee(),z(t.index)}},re=e=>{ne(e)},ie=e=>{ne(e)};return(0,l.jsxs)(`div`,{className:[Un.fridge,p].filter(Boolean).join(` `),style:{width:Qn(t),height:Qn(n),...m},role:`region`,"aria-label":f,children:[(0,l.jsx)(`div`,{className:Un.handle,"aria-hidden":`true`}),(0,l.jsx)(`div`,{ref:h,className:Un.stage,children:P===0?(0,l.jsx)(`div`,{className:Un.empty,children:`暂无照片`}):e.map((e,t)=>{let n=L&&(e.title||e.description),a=Un[Zn[t%Zn.length]];return(0,l.jsxs)(`div`,{ref:e=>{g.current[t]=e},className:[Un.card,M===t?Un.cardDragging:``].filter(Boolean).join(` `),style:{width:r,height:i},onPointerDown:K(t),onPointerMove:te,onPointerUp:re,onPointerCancel:ie,children:[(0,l.jsxs)(`div`,{className:Un.magnetRow,"aria-hidden":`true`,children:[(0,l.jsx)(`span`,{className:`${Un.magnet} ${a}`}),(0,l.jsx)(`span`,{className:`${Un.magnet} ${Un[Zn[(t+1)%Zn.length]]}`})]}),(0,l.jsx)(`div`,{className:Un.photoFrame,style:{height:I},children:(0,l.jsx)(`img`,{className:Un.image,src:e.src,alt:e.alt??e.title??``,draggable:!1})}),n?(0,l.jsxs)(`div`,{className:Un.caption,children:[e.title?(0,l.jsx)(`p`,{className:Un.title,children:e.title}):null,e.description?(0,l.jsx)(`p`,{className:Un.description,children:e.description}):null]}):null]},`${e.src}-${t}`)})})]})},ir=Math.PI*2/6,ar=1.12,or=2.05,sr=.84,cr=(e,t,n,r)=>{let{accentMat:i,trimMat:a,beadMat:o,silkMat:s}=t,c=or,l=new u.Group;l.position.y=c/2+.16,e.add(l),l.add(new u.Mesh(new u.CylinderGeometry(.1,.14,.05,20),i));let d=new u.Mesh(new u.CylinderGeometry(.016,.02,.32,12),a);d.position.y=.2,l.add(d);let f=new u.Mesh(new u.SphereGeometry(.055,20,20),a);f.position.y=.38,l.add(f);let p=.012,m=new u.Mesh(new u.TorusGeometry(.06,p,12,36),a);m.position.y=.48,l.add(m);let h=new u.Mesh(new u.CylinderGeometry(.007,.007,.24,8),a);h.position.y=.672-p*.55,l.add(h);let g=new u.CylinderGeometry(.038,.048,.028,16),_=new u.SphereGeometry(.026,16,16);for(let t=0;t<6;t++){let r=t*ir+ir/2,o=n*.98*Math.sin(r),s=n*.98*Math.cos(r),l=new u.Group;l.position.set(o,c/2+.145,s);let d=new u.Mesh(g,i);d.castShadow=!0,l.add(d);let f=new u.Mesh(_,a);f.position.y=.03,f.castShadow=!0,l.add(f),e.add(l)}let v=new u.SphereGeometry(.032,14,14),y=new u.CylinderGeometry(.006,.006,.1,8),b=new u.SphereGeometry(.038,14,14),x=new u.CylinderGeometry(.01,.004,c*.4,6),S=c*.4;for(let t=0;t<6;t++){let r=t*ir+ir/2,i=new u.Group;i.position.set(Math.sin(r)*(n+.04),c/2-.02,Math.cos(r)*(n+.04)),i.add(new u.Mesh(v,o));let a=new u.Mesh(y,o);a.position.y=-.065,i.add(a);let l=new u.Mesh(b,s);l.position.y=-.13,i.add(l);for(let e=0;e<5;e++){let t=new u.Mesh(x,s);t.position.set((e-2)*.012,-.13-S/2,0),i.add(t)}e.add(i)}for(let t=0;t<18;t++){let n=t/18*Math.PI*2,i=new u.Mesh(new u.CylinderGeometry(.008,.003,.14+t%3*.02,6),s);i.position.set(r*.88*Math.sin(n),-c/2-.2,r*.88*Math.cos(n)),e.add(i)}},lr=e=>{let t=e;t.map?.dispose(),t.emissiveMap?.dispose(),t.alphaMap?.dispose()},ur=e=>{(Array.isArray(e)?e:[e]).forEach(e=>{lr(e),e.dispose()})},dr=(e,t=new Set)=>{e.traverse(e=>{let n=e;n.isMesh&&(n.geometry?.dispose(),(Array.isArray(n.material)?n.material:[n.material]).forEach(e=>{!e||t.has(e)||(t.add(e),ur(e))}))})},fr=e=>{let t=new u.Shape;for(let n=0;n<6;n++){let r=-Math.PI/6+n*ir,i=Math.cos(r)*e,a=Math.sin(r)*e;n===0?t.moveTo(i,a):t.lineTo(i,a)}return t.closePath(),t},pr=(e,t,n)=>{let r=new u.Shape,i=e/2,a=t/2,o=Math.min(n,i,a);return r.moveTo(-i+o,-a),r.lineTo(i-o,-a),r.quadraticCurveTo(i,-a,i,-a+o),r.lineTo(i,a-o),r.quadraticCurveTo(i,a,i-o,a),r.lineTo(-i+o,a),r.quadraticCurveTo(-i,a,-i,a-o),r.lineTo(-i,-a+o),r.quadraticCurveTo(-i,-a,-i+o,-a),r},mr=(e,t,n,r,i,a)=>{let o=pr(e,t,n);return o.holes.push(pr(r,i,a)),o},hr=e=>new u.Color(e),gr=()=>{let e=document.createElement(`canvas`);e.width=256,e.height=256;let t=e.getContext(`2d`),n=t.createRadialGradient(256/2,256/2,8,256/2,256/2,256/2);n.addColorStop(0,`rgba(90, 48, 22, 0.32)`),n.addColorStop(.35,`rgba(90, 48, 22, 0.13)`),n.addColorStop(.7,`rgba(90, 48, 22, 0.04)`),n.addColorStop(1,`rgba(90, 48, 22, 0)`),t.fillStyle=n,t.fillRect(0,0,256,256);let r=new u.CanvasTexture(e);return r.colorSpace=u.SRGBColorSpace,r},_r=(e,t,n=512)=>{let r=document.createElement(`canvas`);r.width=n,r.height=n;let i=r.getContext(`2d`);i.fillStyle=e,i.fillRect(0,0,n,n);for(let e=0;e<56;e++){let r=(e+.5)/56*n;i.beginPath(),i.moveTo(r+Math.sin(e*.9)*10,0);for(let t=0;t<=n;t+=6)i.lineTo(r+Math.sin(t*.035+e*.7)*9+Math.sin(t*.01)*3,t);i.strokeStyle=t,i.globalAlpha=.06+e%7*.018,i.lineWidth=.8+e%4*.55,i.stroke()}for(let e=0;e<8;e++){let r=e/8*n+18;i.beginPath(),i.moveTo(r,0);for(let t=0;t<=n;t+=8)i.lineTo(r+Math.sin(t*.028+e)*14,t);i.strokeStyle=t,i.globalAlpha=.16,i.lineWidth=2.2,i.stroke()}i.globalAlpha=.045;for(let r=0;r<1800;r++)i.fillStyle=r%2==0?t:e,i.fillRect(Math.random()*n,Math.random()*n,1.2,1.2);i.globalAlpha=1;let a=new u.CanvasTexture(r);return a.colorSpace=u.SRGBColorSpace,a.wrapS=u.RepeatWrapping,a.wrapT=u.RepeatWrapping,a.needsUpdate=!0,a},vr=(e,t,n,r,i)=>{let a=_r(e,t);return a.repeat.set(n,r),a.anisotropy=i,a},yr=(e,t,n,r)=>{e.colorSpace=u.SRGBColorSpace,e.anisotropy=r,e.wrapS=u.ClampToEdgeWrapping,e.wrapT=u.ClampToEdgeWrapping,e.center.set(.5,.5),e.generateMipmaps=!0,e.minFilter=u.LinearMipmapLinearFilter,e.magFilter=u.LinearFilter;let i=e.image,a=(i?.width||1)/(i?.height||1);t===`contain`?a>n?e.repeat.set(1,n/a):e.repeat.set(a/n,1):t===`fill`?e.repeat.set(1,1):a>n?e.repeat.set(n/a,1):e.repeat.set(1,a/n)},br=`"PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif`,xr=e=>{if(`naturalWidth`in e){let t=e;return{w:t.naturalWidth||t.width,h:t.naturalHeight||t.height}}let t=e;return{w:t.width,h:t.height}},Sr=(e,t,n)=>{let{w:r,h:i}=xr(e),a=Math.max(512,r||1024),o=Math.max(512,i||1024),s=document.createElement(`canvas`);s.width=a,s.height=o;let c=s.getContext(`2d`);if(c.drawImage(e,0,0,a,o),t||n){let e=o*.3,r=c.createLinearGradient(0,o-e,0,o);r.addColorStop(0,`rgba(8, 14, 22, 0)`),r.addColorStop(.45,`rgba(8, 14, 22, 0.42)`),r.addColorStop(1,`rgba(8, 14, 22, 0.78)`),c.fillStyle=r,c.fillRect(0,o-e,a,e),c.textAlign=`center`,c.textBaseline=`bottom`;let i=a*.88,s=Math.max(22,Math.round(o*.048)),l=Math.max(16,Math.round(o*.032));t&&(c.fillStyle=`#ffffff`,c.font=`600 ${s}px ${br}`,c.shadowColor=`rgba(0,0,0,0.45)`,c.shadowBlur=8,c.shadowOffsetY=2,c.fillText(t,a/2,n?o-o*.085:o-o*.05,i)),n&&(c.fillStyle=`rgba(255,255,255,0.88)`,c.font=`400 ${l}px ${br}`,c.shadowColor=`rgba(0,0,0,0.35)`,c.shadowBlur=6,c.fillText(n,a/2,o-o*.038,i)),c.shadowBlur=0,c.shadowOffsetY=0}let l=new u.CanvasTexture(s);return l.colorSpace=u.SRGBColorSpace,l.needsUpdate=!0,l},Cr=(e,t,n,r,i)=>new u.MeshPhysicalMaterial({color:e,map:t,metalness:0,roughness:n,clearcoat:r,clearcoatRoughness:i}),wr=(e,t,n)=>{let r=vr(`#c4a07a`,`#5a3a22`,1.4,2.2,n),i=vr(`#d4b896`,`#6a4a30`,1.2,1.8,n),a=vr(`#e0c6a0`,`#7a5638`,1,2.4,n),o=a.clone();return o.repeat.set(1.6,1.6),o.anisotropy=n,{frameMat:Cr(e,r,.62,.22,.55),accentMat:Cr(new u.Color(e).offsetHSL(.02,-.04,.1),i,.58,.28,.5),trimMat:Cr(new u.Color(e).offsetHSL(.03,-.08,.18),a,.48,.35,.4),beadMat:Cr(13211226,o,.42,.4,.35),silkMat:new u.MeshPhysicalMaterial({color:t,metalness:0,roughness:.62,sheen:1,sheenRoughness:.45,sheenColor:new u.Color(t).offsetHSL(0,-.1,.25)})}},Tr=e=>{e.add(new u.HemisphereLight(16774891,12888202,.72));let t=new u.DirectionalLight(16774632,.85);t.position.set(4.2,6.5,5),t.castShadow=!0,t.shadow.mapSize.set(1024,1024),t.shadow.camera.near=1,t.shadow.camera.far=20,t.shadow.camera.left=-5,t.shadow.camera.right=5,t.shadow.camera.top=5,t.shadow.camera.bottom=-5,t.shadow.radius=3,t.shadow.bias=-8e-4,e.add(t);let n=new u.DirectionalLight(15783344,.34);n.position.set(-4,2.5,-2.5),e.add(n);let r=new u.DirectionalLight(16771280,.24);r.position.set(0,3,-5),e.add(r)},Er=(e,t,n,r)=>{let i=new u.ExtrudeGeometry(fr(e),{depth:t,bevelEnabled:!0,bevelThickness:.025,bevelSize:.02,bevelSegments:3});i.rotateX(-Math.PI/2);let a=new u.Mesh(i,r);return a.position.y=n,a.castShadow=!0,a.receiveShadow=!0,a},Dr=(e,t)=>{let n=new u.Scene;if(t.background)try{n.background=hr(t.background)}catch{n.background=null}else n.background=null;let r=new u.PerspectiveCamera(34,t.width/t.height,.1,100);r.position.set(0,1.35,6.6),r.lookAt(0,.08,0);let i=new u.WebGLRenderer({canvas:e,antialias:!0,alpha:!0,powerPreference:`high-performance`});i.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),i.setSize(t.width,t.height,!1),i.setClearColor(0,0),i.outputColorSpace=u.SRGBColorSpace,i.toneMapping=u.ACESFilmicToneMapping,i.toneMappingExposure=1.12,i.shadowMap.enabled=!0,i.shadowMap.type=u.PCFSoftShadowMap;let a=ar,o=or,s=a*sr,c=o*sr,l=s/c,d=a/(2*Math.tan(Math.PI/6)),f=a/(2*Math.sin(Math.PI/6)),p=f*1.12,m=hr(t.frameColor),h=hr(t.paperColor),g=hr(t.lightColor),_=hr(t.tasselColor),v=new u.Group;v.rotation.x=u.MathUtils.degToRad(14),n.add(v);let y=new u.Group;v.add(y),Tr(n);let b=i.capabilities.getMaxAnisotropy(),x=wr(m,_,b),{frameMat:S,accentMat:C}=x,w=[],T=new u.TextureLoader,E=new u.PlaneGeometry(s,c),D=new u.ExtrudeGeometry(mr(a*.96,o*.96,.04,s+.02,c+.02,.025),{depth:.07,bevelEnabled:!0,bevelThickness:.012,bevelSize:.01,bevelSegments:2}),O=new u.ShapeGeometry(mr(s+.05,c+.05,.028,s,c,.02));for(let e=0;e<6;e++){let t=e*ir,n=new u.Group;n.position.set(Math.sin(t)*d,0,Math.cos(t)*d),n.rotation.y=t;let r=new u.Mesh(D,S);r.position.z=-.01,r.castShadow=!0,r.receiveShadow=!0,n.add(r);let i=new u.Mesh(O,C);i.position.z=.02,n.add(i);let a=new u.MeshBasicMaterial({color:h,map:null,toneMapped:!1,side:u.FrontSide,transparent:!0,opacity:1}),o=new u.Mesh(E,a);o.position.z=.032,o.userData.fadeTo=1,n.add(o),w.push(o),y.add(n)}let k=new u.CylinderGeometry(.038,.042,o-.12,20),A=new u.CylinderGeometry(.052,.048,.06,20);for(let e=0;e<6;e++){let t=e*ir+ir/2,n=Math.sin(t)*f,r=Math.cos(t)*f,i=new u.Mesh(k,S);i.position.set(n,0,r),i.castShadow=!0,y.add(i);let a=new u.Mesh(A,C);a.position.set(n,o/2-.05,r),a.castShadow=!0,y.add(a);let s=new u.Mesh(A,C);s.position.set(n,-o/2+.05,r),s.castShadow=!0,y.add(s)}y.add(Er(p,.1,o/2+.02,S)),y.add(Er(p*.78,.06,o/2+.12,S)),y.add(Er(p,.1,-o/2-.1,S)),y.add(Er(p*.62,.12,-o/2-.24,S));let j=new u.PointLight(g,3.2,7.5,1.35);j.position.set(0,-.08,0),j.castShadow=!1,y.add(j),j.add(new u.Mesh(new u.SphereGeometry(.07,24,24),new u.MeshBasicMaterial({color:16775408})));let M=new u.Mesh(new u.SphereGeometry(.14,24,24),new u.MeshBasicMaterial({color:g,transparent:!0,opacity:.35}));j.add(M);let N=new u.Mesh(new u.SphereGeometry(.32,24,24),new u.MeshBasicMaterial({color:g,transparent:!0,opacity:.12}));j.add(N),t.showAccessories&&cr(y,x,f,d);let P=gr(),F=new u.Mesh(new u.PlaneGeometry(3.6,3.6),new u.MeshBasicMaterial({map:P,transparent:!0,depthWrite:!1,opacity:1}));F.rotation.x=-Math.PI/2,F.position.y=-o/2-.42,v.add(F);let I=t.initialAngleDeg;y.rotation.y=-u.MathUtils.degToRad(I);let L=new Map,R=new Map,z=new Map,B=0,V=!1,H=0,U=()=>{V||(V=!0,H&&=(window.clearTimeout(H),0),i.render(n,r),t.onReady?.())},W=()=>{B+=1},ee=()=>{B=Math.max(0,B-1),B===0&&U()},G=(e,t,n)=>{let r=L.get(e);if(r){t(r);return}let i=z.get(e);if(i){i.resolve.push(t),i.reject.push(n);return}z.set(e,{resolve:[t],reject:[n]}),W(),T.load(e,t=>{L.set(e,t);let n=z.get(e);z.delete(e),n?.resolve.forEach(e=>e(t)),ee()},void 0,()=>{let t=z.get(e);z.delete(e),t?.reject.forEach(e=>e()),ee()})},K=(e,t)=>{e.map=null,e.color.copy(h),e.transparent=!0,e.opacity=1,e.needsUpdate=!0,t.userData.fadeTo=1},te=(e,t,n,r)=>{w.forEach((i,a)=>{let o=i.material,s=e[a];if(!s?.src){K(o,i);return}let c=(e,a)=>{let c=r?s.title:void 0,u=r?s.description:void 0,d=`${s.src}::${c||``}::${u||``}::${+!!r}`,f=R.get(d);f||(r&&(c||u)&&e.image?(f=Sr(e.image,c,u),R.set(d,f)):f=e),yr(f,n,l,b),o.map=f,o.color.set(t?5592405:16777215),o.transparent=!0,o.opacity=+!a,i.userData.fadeTo=1,o.needsUpdate=!0};if(L.has(s.src)){c(L.get(s.src),!1);return}o.map=null,o.color.copy(h),o.opacity=1,o.needsUpdate=!0,G(s.src,e=>c(e,V),()=>K(o,i))})};te(t.photos,t.silhouette,t.objectFit,t.showCaption),B===0?U():H=window.setTimeout(U,1600);let ne=()=>{for(let e=0;e<w.length;e++){let t=w[e],n=t.material,r=t.userData.fadeTo;if(n.opacity===r)continue;let i=n.opacity+(r-n.opacity)*.22;n.opacity=Math.abs(i-r)<.02?r:i,n.opacity>=1&&r>=1&&n.map&&(n.transparent=!1)}};return{renderer:i,setAngleDeg:e=>{I=e,y.rotation.y=-u.MathUtils.degToRad(e)},getAngleDeg:()=>I,setLightSway:(e,t)=>{let n=Math.max(0,Math.min(1,t)),r=(Math.sin(e*1.55)*.16+Math.sin(e*2.6)*.08)*n,i=(Math.cos(e*1.2)*.1+Math.sin(e*2.9)*.07)*n-.06,a=(Math.sin(e*.85)*.09+Math.cos(e*2.1)*.05)*n,o=.88+Math.sin(e*5.1)*.07*n+Math.sin(e*9.2)*.04*n;j.position.set(r,i,a),j.intensity=1.6*o,M.material.opacity=.18*o,N.material.opacity=.06*o},setSize:(e,t)=>{r.aspect=e/Math.max(t,1),r.updateProjectionMatrix(),i.setSize(e,t,!1)},updatePhotos:te,render:()=>{ne(),i.render(n,r)},dispose:()=>{H&&window.clearTimeout(H),w.forEach(e=>{let t=e.material;t.map=null}),dr(n),L.forEach(e=>e.dispose()),L.clear(),R.forEach(e=>e.dispose()),R.clear(),z.clear(),i.dispose()}}},Or=e=>{let t=(e%360+360)%360;return Math.round(t/60)%6},kr={root:`cos-root-6stAx`,canvas:`cos-canvas-xXFVP`,canvasReady:`cos-canvasReady-3z5WA`},Ar=6,jr=720,Mr=2.5,Nr=90,Pr=.045,Fr=360,Ir=480,Lr=e=>typeof e==`number`?`${e}px`:e,Rr=(e,t,n)=>Math.max(t,Math.min(n,e)),zr=(e,t,n)=>{if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`){let t=e.trim();if(t.endsWith(`%`)){let e=Number.parseFloat(t);if(Number.isFinite(e))return n*e/100}let r=Number.parseFloat(t);if(Number.isFinite(r))return r}return t},Br=e=>typeof e==`string`&&e.startsWith(`#`)?e:void 0,Vr=({photos:e,width:t=Fr,height:n=Ir,autoRotate:r=!0,autoRotateSpeed:i=14,dragSensitivity:a=.42,friction:o=1.4,frameColor:s=`#5c4033`,paperColor:u=`#faf4e8`,lightColor:d=`#f0b35a`,background:f,lightSway:p=1,showAccessories:m=!0,tasselColor:h=`#c94b3a`,objectFit:g=`cover`,silhouette:_=!1,showCaption:v=!1,initialAngle:b=0,onFaceChange:x,onIndexChange:S,onPhotoClick:C,ariaLabel:w=`走马灯图片预览`,className:T,style:E})=>{let D=(0,c.useRef)(null),O=(0,c.useRef)(null),k=(0,c.useRef)(null),A=(0,c.useRef)(b),j=(0,c.useRef)(0),M=(0,c.useRef)(!1),N=(0,c.useRef)(null),P=(0,c.useRef)(0),F=(0,c.useRef)(0),I=(0,c.useRef)(!1),L=(0,c.useRef)(0),R=(0,c.useRef)(!1),z=(0,c.useRef)(Or(b)),B=(0,c.useRef)(x),V=(0,c.useRef)(S),H=(0,c.useRef)(C),U=(0,c.useRef)([]),W=(0,c.useRef)(r),ee=(0,c.useRef)(i),G=(0,c.useRef)(o),K=(0,c.useRef)(p),te=(0,c.useRef)(a),[ne,re]=(0,c.useState)(()=>Or(b)),[ie,ae]=(0,c.useState)({w:Fr,h:Ir}),[q,oe]=(0,c.useState)(!1),se=(0,c.useMemo)(()=>Array.from({length:6},(t,n)=>e[n]),[e]);(0,c.useEffect)(()=>{U.current=se,B.current=x,V.current=S,H.current=C,W.current=r,ee.current=i,G.current=o,K.current=p,te.current=a},[se,x,S,C,r,i,o,p,a]),(0,c.useEffect)(()=>{let e=D.current;if(!e)return;let r=()=>{let r=e.parentElement,i=r?.clientWidth||window.innerWidth,a=r?.clientHeight||window.innerHeight;ae({w:zr(t,Fr,i),h:zr(n,Ir,a)})};r();let i=new ResizeObserver(r);return i.observe(e),e.parentElement&&i.observe(e.parentElement),()=>i.disconnect()},[t,n]),(0,c.useEffect)(()=>{let e=O.current;if(!e||ie.w<=0||ie.h<=0)return;let t=Dr(e,{width:ie.w,height:ie.h,photos:U.current,frameColor:s,paperColor:u,lightColor:d,tasselColor:h,showAccessories:m,showCaption:v,silhouette:_,objectFit:g||`cover`,background:Br(f),initialAngleDeg:A.current,onReady:()=>oe(!0)});return k.current=t,()=>{t.dispose(),k.current=null}},[ie.w,ie.h,s,u,d,h,m,f]),(0,c.useEffect)(()=>{k.current?.updatePhotos(se,_,g||`cover`,v)},[se,_,g,v]),(0,c.useEffect)(()=>{let e=y(e=>{R.current=e}),t=0,n=performance.now(),r=e=>{t=requestAnimationFrame(r);let i=k.current;if(!i||R.current){n=e;return}let a=Math.min(.05,(e-n)/1e3);if(n=e,!M.current){let e=j.current;Math.abs(e)>Mr?(e*=Math.exp(-G.current*a),Math.abs(e)<=Mr&&(e=0),j.current=e,A.current+=e*a,i.setAngleDeg(A.current)):W.current&&(A.current+=ee.current*a,i.setAngleDeg(A.current))}let o=Or(A.current);if(o!==z.current){z.current=o,re(o);let e=U.current[o];B.current?.(o,e),e&&V.current?.(o,e)}i.setLightSway(e/1e3,K.current),i.render()};return t=requestAnimationFrame(r),()=>{cancelAnimationFrame(t),e()}},[]);let ce=(e,t)=>{if(M.current){if(M.current=!1,N.current=null,!t||e-F.current>Nr){j.current=0;return}j.current=Rr(j.current,-720,jr)}},le=e=>{e.button===0&&(M.current=!0,I.current=!1,N.current=e.pointerId,L.current=e.clientX,P.current=e.clientX,F.current=e.timeStamp,j.current=0,e.currentTarget.setPointerCapture(e.pointerId))},ue=e=>{if(!M.current||N.current!==e.pointerId)return;let t=e.clientX-P.current,n=Math.max(.008,(e.timeStamp-F.current)/1e3);Math.abs(e.clientX-L.current)>Ar&&(I.current=!0);let r=te.current;A.current-=t*r,k.current?.setAngleDeg(A.current);let i=-t/n*r,a=1-Math.exp(-n/Pr);j.current+=(i-j.current)*a,P.current=e.clientX,F.current=e.timeStamp},de=e=>{if(N.current!==e.pointerId)return;let t=!I.current;ce(e.timeStamp,!0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}if(t){let e=U.current[z.current];e&&H.current?.(z.current,e)}},fe=e=>{N.current===e.pointerId&&ce(e.timeStamp,!1)},pe=se[ne],me=v&&pe?.title?`,当前:${pe.title}${pe.description?`,${pe.description}`:``}`:``;return(0,l.jsx)(`div`,{ref:D,className:[kr.root,T].filter(Boolean).join(` `),style:{width:Lr(t),height:Lr(n),...f===void 0?null:{background:f},...E},role:`img`,"aria-label":w+me,onPointerDown:le,onPointerMove:ue,onPointerUp:de,onPointerCancel:fe,children:(0,l.jsx)(`canvas`,{ref:O,className:[kr.canvas,q?kr.canvasReady:``].filter(Boolean).join(` `)})})},Hr={lightbox:`cos-lightbox-bqk2N`,stage:`cos-stage-D827Z`,table:`cos-table-mnUIm`,slot:`cos-slot-vt-ci`,slide:`cos-slide-RMjUk`,slideBehind:`cos-slideBehind-WGhIm`,slideActive:`cos-slideActive-ESL-9`,slideExiting:`cos-slideExiting-CPoNN`,slideImageWrap:`cos-slideImageWrap-NuRq7`,slideImage:`cos-slideImage--AcPS`,caption:`cos-caption-QLSVi`,captionTitle:`cos-captionTitle-a3aRv`,captionDesc:`cos-captionDesc-GQ6bR`,empty:`cos-empty-jO5QV`},Ur=6,Wr=260,Gr=320,Kr=e=>typeof e==`number`?`${e}px`:e,qr=(e,t)=>t<=0?0:Math.max(0,Math.min(t-1,Math.floor(e))),Jr=({photos:e,width:t=360,height:n=480,slideWidth:r=200,slideHeight:i=280,pullThreshold:a=100,showCaption:o=!0,initialIndex:s=0,onPhotoClick:u,onIndexChange:d,ariaLabel:f=`Photo lightbox`,className:p,style:m})=>{let h=(0,c.useRef)(null),g=(0,c.useRef)(null),_=(0,c.useRef)(qr(s,e.length)),v=(0,c.useRef)(u),y=(0,c.useRef)(d),b=(0,c.useRef)(e),x=(0,c.useRef)(null),[S,C]=(0,c.useState)(()=>qr(s,e.length)),[w,T]=(0,c.useState)(0),[E,D]=(0,c.useState)(`idle`),O=e.length,k=e[S],A=S<O-1?e[S+1]:void 0,j=S>0,M=S<O-1;(0,c.useEffect)(()=>{v.current=u,y.current=d,b.current=e},[u,d,e]),(0,c.useEffect)(()=>{_.current=S},[S]),(0,c.useEffect)(()=>()=>{x.current!=null&&window.clearTimeout(x.current)},[]);let N=(0,c.useCallback)(e=>{let t=b.current,n=qr(e,t.length);C(n),_.current=n;let r=t[n];r&&y.current?.(n,r)},[]),P=(0,c.useCallback)(e=>{N(e),T(0),D(`idle`)},[N]),F=(0,c.useCallback)(e=>{let t=e*(r+72);D(`exiting`),T(t),x.current!=null&&window.clearTimeout(x.current),x.current=window.setTimeout(()=>{P(qr(_.current+e,b.current.length))},Wr)},[P,r]),I=(0,c.useCallback)(()=>{D(`snapping`),T(0),window.setTimeout(()=>D(`idle`),Gr)},[]),L=(0,c.useCallback)(e=>{qr(_.current+e,b.current.length)!==_.current&&F(e>0?1:-1)},[F]),R=(0,c.useCallback)(e=>{E===`exiting`||O===0||(g.current={pointerId:e.pointerId,startX:e.clientX,moved:!1},D(`dragging`),e.currentTarget.setPointerCapture(e.pointerId))},[O,E]),z=(0,c.useCallback)(e=>{let t=g.current;if(!t||t.pointerId!==e.pointerId||E===`exiting`)return;let n=e.clientX-t.startX;Math.abs(n)>Ur&&(t.moved=!0),T(n>0&&!M||n<0&&!j?n*.28:n)},[M,j,E]),B=(0,c.useCallback)(e=>{let t=g.current;if(!t||t.pointerId!==e.pointerId||(g.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),E===`exiting`))return;let n=e.clientX-t.startX;if(!t.moved){D(`idle`),T(0);let e=b.current[_.current];e&&v.current?.(_.current,e);return}if(Math.abs(n)>=a){let e=n>0?1:-1;if(e>0&&M||e<0&&j){F(e);return}}I()},[F,M,j,E,a,I]),V=(0,c.useCallback)(e=>{let t=g.current;!t||t.pointerId!==e.pointerId||(g.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),E!==`exiting`&&I())},[E,I]);(0,c.useEffect)(()=>{let e=h.current;if(!e)return;let t=e=>{e.key===`ArrowRight`?(e.preventDefault(),L(1)):e.key===`ArrowLeft`&&(e.preventDefault(),L(-1))};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[L]);let H=Math.max(24,(typeof t==`number`?t:r+48)*.08),U=Math.max(28,(typeof n==`number`?n:i+56)*.1),W=r+H*2,ee=i+U*2,G=`translate(-50%, -50%) translateX(${w}px)`,K=E===`snapping`||E===`exiting`?`transform ${E===`exiting`?Wr:Gr}ms cubic-bezier(0.22, 1, 0.36, 1), opacity ${Wr}ms ease`:`none`,te=e=>!o||!e.title&&!e.description?null:(0,l.jsxs)(`div`,{className:Hr.caption,children:[e.title?(0,l.jsx)(`div`,{className:Hr.captionTitle,children:e.title}):null,e.description?(0,l.jsx)(`div`,{className:Hr.captionDesc,children:e.description}):null]}),ne=(e,t,n,a,s)=>{let c=i-(o&&(e.title||e.description)?44:0);return(0,l.jsxs)(`div`,{className:[Hr.slide,n===`active`?Hr.slideActive:Hr.slideBehind,s].filter(Boolean).join(` `),style:{width:r,height:i,transform:a,transition:K,opacity:n===`active`&&E===`exiting`?.35:void 0},onPointerDown:n===`active`?R:void 0,onPointerMove:n===`active`?z:void 0,onPointerUp:n===`active`?B:void 0,onPointerCancel:n===`active`?V:void 0,role:n===`active`?`button`:void 0,"aria-label":n===`active`?e.alt||e.title||`Slide ${t+1} of ${O}`:void 0,children:[(0,l.jsx)(`div`,{className:Hr.slideImageWrap,style:{height:c},children:(0,l.jsx)(`img`,{className:Hr.slideImage,src:e.src,alt:e.alt||e.title||``,draggable:!1})}),te(e)]})};return(0,l.jsx)(`div`,{ref:h,className:[Hr.lightbox,p].filter(Boolean).join(` `),style:{width:Kr(t),height:Kr(n),...m},role:`region`,"aria-label":f,tabIndex:0,children:(0,l.jsx)(`div`,{className:Hr.stage,children:O===0?(0,l.jsx)(`div`,{className:Hr.empty,children:`No photos`}):(0,l.jsx)(`div`,{className:Hr.table,style:{width:W,height:ee},children:(0,l.jsxs)(`div`,{className:Hr.slot,style:{width:r,height:i},children:[A?ne(A,S+1,`behind`,`translate(-50%, calc(-50% + 14px)) scale(0.94)`):null,k?ne(k,S,`active`,G,E===`exiting`?Hr.slideExiting:void 0):null]})})})})},Yr={polaroid:`cos-polaroid-ouSvd`,stage:`cos-stage-VPNlO`,card:`cos-card-J8utI`,cardDragging:`cos-cardDragging-0Gy8K`,imageWrap:`cos-imageWrap-vGQwm`,image:`cos-image-gNSgv`,caption:`cos-caption-Bewfy`,title:`cos-title-eUY1D`,description:`cos-description-dFhlF`,empty:`cos-empty-Zk3rN`},Xr=6,Zr=1400,Qr=.12,$r=.86,ei=.88,ti=1.04,ni=.22,ri=e=>typeof e==`number`?`${e}px`:e,ii=(e,t,n)=>Math.min(n,Math.max(t,e)),ai=e=>{let t=Math.sin(e*127.1+31.7)*43758.5453;return t-Math.floor(t)},oi=(e,t,n,r,i,a)=>{if(e<=0||t<=0||n<=0)return[];let o=Math.max(0,t-r)*.38*a,s=Math.max(0,n-i)*.28*a,c=t*.5-r*.5,l=n*.5-i*.5;return Array.from({length:e},(t,n)=>{let r=e<=1?.5:n/(e-1),i=Math.sin(r*Math.PI)*s*.28,u=(r-.5)*o*1.65,d=(ai(n*7.13+2.1)*2-1)*o*.42,f=(ai(n*11.37+5.9)*2-1)*s*.38,p=(ai(n*3.71+1.4)*2-1)*14*a;return{restX:c+u+d,restY:l-i+f,restRot:p}})},si=({photos:e,width:t=`100%`,height:n=420,cardWidth:r=150,cardHeight:i=180,scatter:a=1,showCaption:o=!0,initialIndex:s=0,onPhotoClick:u,ariaLabel:d=`拍立得照片堆叠`,className:f,style:p})=>{let m=(0,c.useRef)(null),h=(0,c.useRef)([]),g=(0,c.useRef)([]),_=(0,c.useRef)([]),v=(0,c.useRef)([]),y=(0,c.useRef)(0),b=(0,c.useRef)(null),x=(0,c.useRef)(null),S=(0,c.useRef)(null),C=(0,c.useRef)(0),w=(0,c.useRef)(u),T=(0,c.useRef)(e),[E,D]=(0,c.useState)({width:0,height:0}),[O,k]=(0,c.useState)(null),A=e.length,j=ii(a,0,2.5),M=Math.round(i*(1-ni)),N=o&&e.some(e=>e.title||e.description);(0,c.useEffect)(()=>{w.current=u,T.current=e},[u,e]);let P=(0,c.useMemo)(()=>oi(A,E.width,E.height,r,i,j),[i,r,A,j,E.height,E.width]),F=(0,c.useCallback)(e=>{let t=h.current[e],n=_.current[e],r=v.current[e]??e;if(!t||!n)return;let i=x.current===e?ti:1;t.style.zIndex=String(r),t.style.transform=`translate3d(${n.x}px, ${n.y}px, 0) rotate(${n.rot}deg) scale(${i})`},[]),I=(0,c.useCallback)(()=>{for(let e=0;e<_.current.length;e+=1)F(e)},[F]),L=(0,c.useCallback)(()=>{g.current=P,_.current=P.map(e=>({x:e.restX,y:e.restY,rot:e.restRot,vx:0,vy:0,vRot:0})),v.current=Array.from({length:A},(e,t)=>t),y.current=Math.max(A-1,0);let e=ii(Math.floor(s),0,Math.max(0,A-1));A>0&&(y.current+=1,v.current[e]=y.current),I()},[A,s,I,P]);(0,c.useEffect)(()=>{L()},[L]),(0,c.useEffect)(()=>{let e=m.current;if(!e)return;let t=new ResizeObserver(([e])=>{let{width:t,height:n}=e.contentRect;D({width:t,height:n})});return t.observe(e),D({width:e.clientWidth,height:e.clientHeight}),()=>t.disconnect()},[]);let R=(0,c.useCallback)(()=>{S.current!==null&&(cancelAnimationFrame(S.current),S.current=null)},[]),z=(0,c.useRef)(()=>void 0);(0,c.useEffect)(()=>{z.current=e=>{let t=C.current?Math.min((e-C.current)/1e3,.032):.016;C.current=e;let n=!1,r=_.current;for(let e=0;e<r.length;e+=1){if(x.current===e)continue;let i=r[e];i.x+=i.vx*t,i.y+=i.vy*t,i.rot+=i.vRot*t;let a=$r**(t*60),o=ei**(t*60);i.vx*=a,i.vy*=a,i.vRot*=o,Math.abs(i.vx)>Qr||Math.abs(i.vy)>Qr||Math.abs(i.vRot)>Qr*.35?n=!0:(i.vx=0,i.vy=0,i.vRot=0),F(e)}n?S.current=requestAnimationFrame(e=>z.current(e)):S.current=null}},[F]);let B=(0,c.useCallback)(()=>{S.current===null&&(C.current=0,S.current=requestAnimationFrame(e=>z.current(e)))},[]);(0,c.useEffect)(()=>()=>R(),[R]);let V=(0,c.useCallback)(e=>{y.current+=1,v.current[e]=y.current,F(e)},[F]),H=e=>t=>{if(t.button!==0)return;let n=_.current[e];if(!n)return;let r=m.current?.getBoundingClientRect();if(!r)return;t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),V(e),x.current=e,k(e);let i=t.clientX-r.left,a=t.clientY-r.top;b.current={pointerId:t.pointerId,index:e,grabDx:i-n.x,grabDy:a-n.y,startX:t.clientX,startY:t.clientY,lastX:t.clientX,lastY:t.clientY,lastTime:t.timeStamp,moved:0,vx:0,vy:0},n.vx=0,n.vy=0,n.vRot=0,F(e)},U=e=>{let t=b.current;if(!t||t.pointerId!==e.pointerId)return;let n=m.current?.getBoundingClientRect();if(!n)return;let r=e.clientX-t.startX,i=e.clientY-t.startY;t.moved=Math.max(t.moved,Math.hypot(r,i));let a=Math.max(e.timeStamp-t.lastTime,1)/1e3;t.vx=ii(.65*((e.clientX-t.lastX)/a)+.35*t.vx,-1400,Zr),t.vy=ii(.65*((e.clientY-t.lastY)/a)+.35*t.vy,-1400,Zr),t.lastX=e.clientX,t.lastY=e.clientY,t.lastTime=e.timeStamp;let o=_.current[t.index];o&&(o.x=e.clientX-n.left-t.grabDx,o.y=e.clientY-n.top-t.grabDy,o.rot+=t.vx*.0045,F(t.index))},W=e=>{let t=b.current;if(!t||t.pointerId!==e.pointerId)return;b.current=null,x.current=null,k(null),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId);let n=_.current[t.index];if(n){if(t.moved<=Xr){let e=T.current[t.index];e&&w.current?.(t.index,e),F(t.index);return}n.vx=t.vx*.55,n.vy=t.vy*.55,n.vRot=t.vx*.012,B(),F(t.index)}},ee=e=>{W(e)},G=e=>{W(e)};return(0,l.jsx)(`div`,{className:[Yr.polaroid,f].filter(Boolean).join(` `),style:{width:ri(t),height:ri(n),...p},role:`region`,"aria-label":d,children:(0,l.jsx)(`div`,{ref:m,className:Yr.stage,children:A===0?(0,l.jsx)(`div`,{className:Yr.empty,children:`暂无照片`}):e.map((e,t)=>{let n=N&&(e.title||e.description);return(0,l.jsxs)(`div`,{ref:e=>{h.current[t]=e},className:[Yr.card,O===t?Yr.cardDragging:``].filter(Boolean).join(` `),style:{width:r,height:i},onPointerDown:H(t),onPointerMove:U,onPointerUp:ee,onPointerCancel:G,children:[(0,l.jsx)(`div`,{className:Yr.imageWrap,style:{height:M},children:(0,l.jsx)(`img`,{className:Yr.image,src:e.src,alt:e.alt??e.title??``,draggable:!1})}),n?(0,l.jsxs)(`div`,{className:Yr.caption,children:[e.title?(0,l.jsx)(`p`,{className:Yr.title,children:e.title}):null,e.description?(0,l.jsx)(`p`,{className:Yr.description,children:e.description}):null]}):null]},`${e.src}-${t}`)})})})},Y={postcard:`cos-postcard-g2207`,stage:`cos-stage-jZQ8g`,stack:`cos-stack-fblvy`,stackCard:`cos-stackCard-vGX-D`,cardSlot:`cos-cardSlot-r9iP9`,cardActive:`cos-cardActive-oxk4p`,cardExiting:`cos-cardExiting-PLlYP`,flipInner:`cos-flipInner--e4Ib`,flipped:`cos-flipped-IIL2I`,face:`cos-face-5lB6h`,front:`cos-front-C--cv`,back:`cos-back-3zraM`,photoFrame:`cos-photoFrame-HWolG`,photoFrameWithCaption:`cos-photoFrameWithCaption-4crS0`,photoWrap:`cos-photoWrap-WK92L`,photo:`cos-photo-bdRgi`,cornerStamp:`cos-cornerStamp-Xq-fF`,frontCaption:`cos-frontCaption-w8czv`,frontCaptionTitle:`cos-frontCaptionTitle-rVeaq`,frontCaptionDesc:`cos-frontCaptionDesc-i7PGX`,linedPaper:`cos-linedPaper-iYgmF`,greeting:`cos-greeting-MkrH1`,bodyText:`cos-bodyText-2YX8O`,bodyPlaceholder:`cos-bodyPlaceholder-qovIN`,backFooter:`cos-backFooter-3Dn0w`,stampSquare:`cos-stampSquare-fGd3a`,postmark:`cos-postmark-1FaXp`,postmarkText:`cos-postmarkText-1Ewtv`,divider:`cos-divider-Wgj-N`,empty:`cos-empty-Ys5A1`,hint:`cos-hint-JGozg`},ci=6,li=280,ui=320,di=e=>typeof e==`number`?`${e}px`:e,fi=(e,t)=>t<=0?0:(e%t+t)%t,pi=(e,t)=>t<=0?0:Math.max(0,Math.min(t-1,Math.floor(e))),mi=e=>{let t=Math.sin(e*127.1+31.7)*43758.5453;return t-Math.floor(t)},hi=({photo:e,showCaption:t})=>{let n=t&&(e.title||e.description),r=e.title?e.title:`Greetings from the road`;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`${Y.face} ${Y.front}`,children:[(0,l.jsx)(`div`,{className:`${Y.photoFrame} ${n?Y.photoFrameWithCaption:``}`,children:(0,l.jsx)(`div`,{className:Y.photoWrap,children:(0,l.jsx)(`img`,{className:Y.photo,src:e.src,alt:e.alt??e.title??``,draggable:!1})})}),(0,l.jsx)(`div`,{className:Y.cornerStamp,"aria-hidden":`true`}),n?(0,l.jsxs)(`div`,{className:Y.frontCaption,children:[e.title?(0,l.jsx)(`p`,{className:Y.frontCaptionTitle,children:e.title}):null,e.description?(0,l.jsx)(`p`,{className:Y.frontCaptionDesc,children:e.description}):null]}):null]}),(0,l.jsxs)(`div`,{className:`${Y.face} ${Y.back}`,children:[(0,l.jsx)(`div`,{className:Y.divider,"aria-hidden":`true`}),(0,l.jsxs)(`div`,{className:Y.linedPaper,children:[(0,l.jsx)(`p`,{className:Y.greeting,children:r}),e.description?(0,l.jsx)(`p`,{className:Y.bodyText,children:e.description}):(0,l.jsx)(`p`,{className:Y.bodyPlaceholder,children:`Wish you were here…`})]}),(0,l.jsxs)(`div`,{className:Y.backFooter,children:[(0,l.jsx)(`div`,{className:Y.postmark,"aria-hidden":`true`,children:(0,l.jsxs)(`span`,{className:Y.postmarkText,children:[`TRAVEL`,(0,l.jsx)(`br`,{}),`POST`]})}),(0,l.jsx)(`div`,{className:Y.stampSquare,"aria-hidden":`true`})]})]})]})},gi=({photos:e,width:t=360,height:n=420,cardWidth:r=260,cardHeight:i=170,pullThreshold:a=80,showCaption:o=!0,initialIndex:s=0,initialFlipped:u=!1,onPhotoClick:d,onIndexChange:f,onFlipChange:p,ariaLabel:m=`明信片`,className:h,style:g})=>{let _=(0,c.useRef)(null),v=(0,c.useRef)(null),y=(0,c.useRef)(pi(s,e.length)),b=(0,c.useRef)(d),x=(0,c.useRef)(f),S=(0,c.useRef)(p),C=(0,c.useRef)(e),w=(0,c.useRef)(null),[T,E]=(0,c.useState)(()=>pi(s,e.length)),[D,O]=(0,c.useState)(u),[k,A]=(0,c.useState)(0),[j,M]=(0,c.useState)(`idle`),N=e.length,P=e[T];(0,c.useEffect)(()=>{b.current=d,x.current=f,S.current=p,C.current=e},[d,f,p,e]),(0,c.useEffect)(()=>{y.current=T},[T]),(0,c.useEffect)(()=>()=>{w.current!=null&&window.clearTimeout(w.current)},[]);let F=(0,c.useMemo)(()=>N<=1?[]:[1,2].slice(0,Math.min(2,N-1)).map(e=>{let t=T*13.7+e*5.3;return{depth:e,rot:(mi(t)*2-1)*5.5,dx:e*5+mi(t+1.1)*4,dy:e*3+mi(t+2.4)*3}}),[N,T]),I=(0,c.useCallback)(e=>{let t=C.current,n=pi(e,t.length);E(n),y.current=n,O(!1),S.current?.(!1);let r=t[n];r&&x.current?.(n,r)},[]),L=(0,c.useCallback)(e=>{I(e),A(0),M(`idle`)},[I]),R=(0,c.useCallback)(e=>{let t=e*(r*.55+48);M(`exiting`),A(t),w.current!=null&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>{let t=C.current;L(fi(y.current+e,t.length))},li)},[r,L]),z=(0,c.useCallback)(()=>{M(`snapping`),A(0),window.setTimeout(()=>M(`idle`),ui)},[]),B=(0,c.useCallback)(e=>{C.current.length<=1||R(e>0?1:-1)},[R]),V=(0,c.useCallback)(()=>{O(e=>{let t=!e;return S.current?.(t),t})},[]),H=(0,c.useCallback)(e=>{j===`exiting`||N===0||(v.current={pointerId:e.pointerId,startX:e.clientX,moved:!1},M(`dragging`),e.currentTarget.setPointerCapture(e.pointerId))},[N,j]),U=(0,c.useCallback)(e=>{let t=v.current;if(!t||t.pointerId!==e.pointerId||j===`exiting`)return;let n=e.clientX-t.startX;Math.abs(n)>ci&&(t.moved=!0),A(N<=1?n*.22:n)},[N,j]),W=(0,c.useCallback)(e=>{let t=v.current;if(!t||t.pointerId!==e.pointerId||(v.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),j===`exiting`))return;let n=e.clientX-t.startX;if(!t.moved){M(`idle`),A(0),V();let e=C.current[y.current];e&&b.current?.(y.current,e);return}if(Math.abs(n)>=a&&N>1){R(n>0?1:-1);return}z()},[R,N,j,a,z,V]),ee=(0,c.useCallback)(e=>{let t=v.current;!t||t.pointerId!==e.pointerId||(v.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),j!==`exiting`&&z())},[j,z]);(0,c.useEffect)(()=>{let e=_.current;if(!e)return;let t=e=>{e.key===`ArrowRight`?(e.preventDefault(),B(1)):e.key===`ArrowLeft`?(e.preventDefault(),B(-1)):(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),V())};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[B,V]);let G=`translateX(${k}px)`,K=j===`snapping`||j===`exiting`?`transform ${j===`exiting`?li:ui}ms cubic-bezier(0.22, 1, 0.36, 1), opacity ${li}ms ease`:`none`,te=[Y.postcard,h].filter(Boolean).join(` `),ne=[Y.cardActive,D?Y.flipped:``,j===`exiting`?Y.cardExiting:``].filter(Boolean).join(` `);return(0,l.jsx)(`div`,{ref:_,className:te,style:{width:di(t),height:di(n),...g},role:`region`,"aria-label":m,tabIndex:0,children:(0,l.jsx)(`div`,{className:Y.stage,children:N===0?(0,l.jsx)(`div`,{className:Y.empty,children:`暂无明信片`}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:Y.stack,style:{width:r,height:i},children:[F.map(({depth:e,rot:t,dx:n,dy:a})=>(0,l.jsx)(`div`,{className:Y.stackCard,style:{width:r,height:i,transform:`translate(calc(-50% + ${n}px), calc(-50% + ${a}px)) rotate(${t}deg)`,opacity:e===1?.92:.78},"aria-hidden":`true`},e)),(0,l.jsx)(`div`,{className:Y.cardSlot,style:{width:r,height:i},children:(0,l.jsx)(`div`,{className:ne,style:{width:r,height:i,transform:G,transition:K,opacity:j===`exiting`?.55:1},onPointerDown:H,onPointerMove:U,onPointerUp:W,onPointerCancel:ee,role:`button`,"aria-label":P?`${D?`背面`:`正面`}:${P.alt??P.title??`明信片 ${T+1}`}`:void 0,"aria-pressed":D,children:P?(0,l.jsx)(`div`,{className:Y.flipInner,children:(0,l.jsx)(hi,{photo:P,showCaption:o})}):null})})]}),N>1?(0,l.jsx)(`div`,{className:Y.hint,children:`拖拽切换 · 点击查看背面`}):null]})})})},_i={root:`cos-root-2T188`,stage:`cos-stage-C0Wkx`,floatWrap:`cos-floatWrap-XWQUl`,cube:`cos-cube-TPTSs`,face:`cos-face-Am85d`,front:`cos-front-QMqKk`,back:`cos-back-AXzOG`,right:`cos-right-m-nHP`,left:`cos-left-2UKCq`,top:`cos-top-9GHQa`,bottom:`cos-bottom-HI67S`,photo:`cos-photo-CbyrW`,placeholder:`cos-placeholder-i9IG0`,caption:`cos-caption-LkGpj`,glow:`cos-glow-1fpVK`},vi=6,yi=6,bi=640,xi=2.2,Si=90,Ci=.045,wi=7.5,Ti=5,Ei=4.8,Di=(e,t,n)=>Math.max(t,Math.min(n,e)),Oi=380,ki=380,Ai=200,ji=e=>typeof e==`number`?`${e}px`:e,Mi=[`front`,`back`,`right`,`left`,`top`,`bottom`],Ni=e=>{let t=(e%360+360)%360;return t>180&&(t-=360),t},Pi=(e,t)=>{let n=Ni(e),r=(t%360+360)%360;return n>45?4:n<-45?5:r>=315||r<45?0:r>=45&&r<135?2:r>=135&&r<225?1:3},Fi=({photos:e,width:t=Oi,height:n=ki,size:r=Ai,autoRotate:i=!0,dragSensitivity:a=.4,friction:o=1.35,showCaption:s=!0,onPhotoClick:u,ariaLabel:d=`照片棱镜`,className:f,style:p})=>{let m=(0,c.useRef)(null),h=(0,c.useRef)(null),g=(0,c.useRef)(null),_=(0,c.useRef)(-12),v=(0,c.useRef)(-28),b=(0,c.useRef)(0),x=(0,c.useRef)(0),S=(0,c.useRef)(!1),C=(0,c.useRef)(null),w=(0,c.useRef)(0),T=(0,c.useRef)(0),E=(0,c.useRef)(0),D=(0,c.useRef)(!1),O=(0,c.useRef)(0),k=(0,c.useRef)(0),A=(0,c.useRef)(!1),j=(0,c.useRef)(Pi(-12,-28)),M=(0,c.useRef)(u),N=(0,c.useRef)([]),P=(0,c.useRef)(i),F=(0,c.useRef)(o),I=(0,c.useRef)(a),[L,R]=(0,c.useState)(()=>Pi(-12,-28)),z=(0,c.useMemo)(()=>Array.from({length:vi},(t,n)=>e[n]),[e]);(0,c.useEffect)(()=>{N.current=z,M.current=u,P.current=i,F.current=o,I.current=a},[z,u,i,o,a]),(0,c.useEffect)(()=>{let e=y(e=>{A.current=e}),t=0,n=performance.now(),r=0,i=e=>{let t=h.current,n=g.current;if(!t||!n)return;t.style.transform=`rotateX(${_.current}deg) rotateY(${v.current}deg)`,n.style.transform=`translateY(${e}px)`;let r=Pi(_.current,v.current);r!==j.current&&(j.current=r,R(r))},a=e=>{if(t=requestAnimationFrame(a),A.current){n=e;return}let o=Math.min(.05,(e-n)/1e3);if(n=e,r+=o,!S.current){let e=b.current,t=x.current;if(Math.abs(e)>xi||Math.abs(t)>xi){let n=Math.exp(-F.current*o);e*=n,t*=n,Math.abs(e)<=xi&&(e=0),Math.abs(t)<=xi&&(t=0),b.current=e,x.current=t,_.current+=t*o,v.current+=e*o}else P.current&&(v.current+=wi*o)}i(S.current||Math.abs(b.current)>xi||Math.abs(x.current)>xi?0:Math.sin(r/Ei*Math.PI*2)*Ti)};return t=requestAnimationFrame(a),i(0),()=>{cancelAnimationFrame(t),e()}},[]);let B=(e,t)=>{if(S.current){if(S.current=!1,C.current=null,!t||e-E.current>Si){b.current=0,x.current=0;return}b.current=Di(b.current,-640,bi),x.current=Di(x.current,-640,bi)}},V=e=>{e.button===0&&(S.current=!0,D.current=!1,C.current=e.pointerId,O.current=e.clientX,k.current=e.clientY,w.current=e.clientX,T.current=e.clientY,E.current=e.timeStamp,b.current=0,x.current=0,e.currentTarget.setPointerCapture(e.pointerId))},H=e=>{if(!S.current||C.current!==e.pointerId)return;let t=e.clientX-w.current,n=e.clientY-T.current,r=Math.max(.008,(e.timeStamp-E.current)/1e3);Math.hypot(e.clientX-O.current,e.clientY-k.current)>yi&&(D.current=!0);let i=I.current;v.current-=t*i,_.current-=n*i;let a=-t/r*i,o=-n/r*i,s=1-Math.exp(-r/Ci);b.current+=(a-b.current)*s,x.current+=(o-x.current)*s,w.current=e.clientX,T.current=e.clientY,E.current=e.timeStamp;let c=h.current;c&&(c.style.transform=`rotateX(${_.current}deg) rotateY(${v.current}deg)`);let l=Pi(_.current,v.current);l!==j.current&&(j.current=l,R(l))},U=e=>{if(C.current!==e.pointerId)return;let t=!D.current;B(e.timeStamp,!0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}if(t){let t=e.target?.closest?.(`[data-face-index]`),n=t?Number(t.dataset.faceIndex):j.current,r=Number.isFinite(n)?n:j.current,i=N.current[r];i&&M.current?.(r,i)}},W=e=>{C.current===e.pointerId&&B(e.timeStamp,!1)},ee=z[L],G=s&&ee?.title?`,当前:${ee.title}${ee.description?`,${ee.description}`:``}`:``;return(0,l.jsxs)(`div`,{ref:m,className:[_i.root,f].filter(Boolean).join(` `),style:{width:ji(t),height:ji(n),"--prism-size":`${r}px`,...p},role:`img`,"aria-label":d+G,onPointerDown:V,onPointerMove:H,onPointerUp:U,onPointerCancel:W,children:[(0,l.jsx)(`div`,{className:_i.glow,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:_i.stage,children:(0,l.jsx)(`div`,{ref:g,className:_i.floatWrap,children:(0,l.jsx)(`div`,{ref:h,className:_i.cube,children:Mi.map((e,t)=>{let n=z[t],r=s&&n&&(n.title||n.description);return(0,l.jsxs)(`div`,{className:[_i.face,_i[e]].join(` `),"data-face-index":t,children:[n?(0,l.jsx)(`img`,{className:_i.photo,src:n.src,alt:n.alt??n.title??`Photo ${t+1}`,draggable:!1}):(0,l.jsx)(`div`,{className:_i.placeholder,"aria-hidden":`true`}),r?(0,l.jsxs)(`div`,{className:_i.caption,children:[n?.title?(0,l.jsx)(`strong`,{children:n.title}):null,n?.description?(0,l.jsx)(`span`,{children:n.description}):null]}):null]},e)})})})})]})},Ii={scroll:`cos-scroll-8mfVT`,roller:`cos-roller-m5TKG`,rollerLeft:`cos-rollerLeft-5C7e9`,rollerRight:`cos-rollerRight-qKsHt`,center:`cos-center-TvM9I`,paperViewport:`cos-paperViewport-gDTEb`,paper:`cos-paper-gG1pz`,paperSurface:`cos-paperSurface-c0iGA`,frameCell:`cos-frameCell-GIuyW`,frame:`cos-frame-Rpb6t`,caption:`cos-caption-n6kN6`,empty:`cos-empty--2nS5`},Li=6,Ri=.045,zi=90,Bi=8,Vi=2600,Hi=14,Ui=e=>typeof e==`number`?`${e}px`:e,Wi=(e,t,n)=>Math.min(n,Math.max(t,e)),Gi=({photos:e,width:t=520,height:n=280,frameWidth:r=160,frameHeight:i=200,frameGap:a=20,dragSensitivity:o=1,friction:s=1.5,showCaption:u=!0,initialIndex:d=0,onPhotoClick:f,onIndexChange:p,ariaLabel:m=`卷轴照片`,className:h,style:g})=>{let _=(0,c.useRef)(null),v=(0,c.useRef)(null),b=(0,c.useRef)({offset:0,velocity:0,drag:null,snapTarget:null}),x=(0,c.useRef)(null),S=(0,c.useRef)(0),C=(0,c.useRef)(!1),w=(0,c.useRef)(0),T=(0,c.useRef)(!1),E=(0,c.useRef)(d),D=(0,c.useRef)(f),O=(0,c.useRef)(p),k=(0,c.useRef)(e),A=(0,c.useRef)(s),j=(0,c.useRef)(o),[M,N]=(0,c.useState)(0),[P,F]=(0,c.useState)(d),I=e.length,L=r+a;(0,c.useEffect)(()=>{D.current=f,O.current=p,k.current=e,A.current=s,j.current=o},[o,s,p,f,e]);let R=(0,c.useMemo)(()=>M>0?M/2-r/2:0,[r,M]),z=(0,c.useMemo)(()=>I<=0?0:R*2+I*r+Math.max(0,I-1)*a,[I,a,r,R]),B=(0,c.useCallback)(e=>{if(M<=0||I<=0)return 0;let t=R+Wi(Math.floor(e),0,I-1)*L+r/2;return M/2-t},[I,L,r,R,M]),V=(0,c.useCallback)(e=>{if(I<=0||M<=0)return 0;let t=(M/2-e-R-r/2)/L;return Wi(Math.round(t),0,I-1)},[I,L,r,R,M]),H=(0,c.useCallback)(()=>I<=0?{min:0,max:0}:{min:B(I-1),max:B(0)},[I,B]),U=(0,c.useCallback)(e=>{let t=v.current;t&&(t.style.transform=`translate3d(${e}px, 0, 0)`)},[]),W=(0,c.useCallback)(e=>{if(e===w.current)return;w.current=e,F(e);let t=k.current[e];t&&O.current?.(e,t)},[]),ee=(0,c.useCallback)(()=>{x.current!==null&&(window.cancelAnimationFrame(x.current),x.current=null),S.current=0},[]),G=(0,c.useCallback)(()=>{if(x.current!==null||typeof window>`u`)return;let e=t=>{if(x.current=null,C.current)return;let n=S.current||t;S.current=t;let r=Math.min(.05,(t-n)/1e3),i=b.current,{min:a,max:o}=H(),s=!1;if(i.drag)U(i.offset),s=!0;else if(i.snapTarget!==null){let e=i.snapTarget-i.offset;Math.abs(e)<=.35?(i.offset=i.snapTarget,i.snapTarget=null,i.velocity=0,W(V(i.offset)),U(i.offset)):(i.offset+=e*Math.min(1,Hi*r),i.velocity=0,U(i.offset),s=!0)}else{let e=i.velocity;if(Math.abs(e)>Bi)e*=Math.exp(-A.current*r),Math.abs(e)<=Bi&&(e=0),i.velocity=e,i.offset+=e*r,(i.offset<a||i.offset>o)&&(i.offset=Wi(i.offset,a,o),i.velocity=0),U(i.offset),s=!0;else{i.velocity=0;let e=B(V(i.offset));Math.abs(i.offset-e)>.35?(i.snapTarget=e,s=!0):(i.offset=e,W(V(i.offset)),U(i.offset))}}s?x.current=window.requestAnimationFrame(e):S.current=0};x.current=window.requestAnimationFrame(e)},[U,V,W,H,B]);(0,c.useEffect)(()=>y(e=>{C.current=e,e||G()}),[G]),(0,c.useEffect)(()=>{let e=_.current;if(!e)return;let t=e=>{N(t=>t===e?t:e)};if(t(e.clientWidth),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(e=>{let n=e[0];n&&t(Math.round(n.contentRect.width))});return n.observe(e),()=>n.disconnect()},[]),(0,c.useEffect)(()=>{if(M<=0||I<=0)return;let e=b.current;if(!T.current){T.current=!0,E.current=d,e.offset=B(d),e.velocity=0,e.snapTarget=null,e.drag=null,w.current=Wi(d,0,I-1),F(w.current),U(e.offset);return}if(E.current!==d){E.current=d,e.velocity=0,e.drag=null,e.snapTarget=B(d),G();return}let{min:t,max:n}=H();e.offset=Wi(e.offset,t,n),U(e.offset)},[U,I,d,H,B,G,M]),(0,c.useEffect)(()=>()=>{ee()},[ee]);let K=(0,c.useCallback)(e=>{let t=b.current,n=t.drag;if(!(!n||n.pointerId!==e.pointerId)){if(t.drag=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),e.timeStamp-n.lastMoveTime>zi?t.velocity=0:t.velocity=Wi(n.vx*j.current,-2600,Vi),t.snapTarget=null,n.moved<=Li){t.velocity=0;let e=V(t.offset),n=k.current[e];n&&D.current?.(e,n),t.snapTarget=B(e)}G()}},[V,B,G]),te=(0,c.useCallback)(e=>{if(e.button!==0&&e.pointerType===`mouse`||I<=0)return;let t=e.timeStamp,n=b.current;n.drag={pointerId:e.pointerId,startX:e.clientX,startOffset:n.offset,lastX:e.clientX,lastTime:t,lastMoveTime:t,vx:0,moved:0},n.velocity=0,n.snapTarget=null,e.currentTarget.setPointerCapture(e.pointerId),G()},[I,G]),ne=(0,c.useCallback)(e=>{let t=b.current,n=t.drag;if(!n||n.pointerId!==e.pointerId)return;let r=e.clientX-n.startX;n.moved=Math.max(n.moved,Math.abs(r)),n.lastMoveTime=e.timeStamp;let i=Math.max(e.timeStamp-n.lastTime,1)/1e3,a=(e.clientX-n.lastX)/i,o=1-Math.exp(-i/Ri);n.vx=o*a+(1-o)*n.vx,n.lastX=e.clientX,n.lastTime=e.timeStamp;let{min:s,max:c}=H();t.offset=Wi(n.startOffset+r*j.current,s,c),U(t.offset),W(V(t.offset)),G()},[U,V,W,H,G]),re=(0,c.useCallback)(e=>{K(e)},[K]),ie=(0,c.useCallback)(e=>{K(e)},[K]),ae=(0,c.useCallback)(e=>{if(I<=0||e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=b.current,n=e.key===`ArrowLeft`?L:-L,{min:r,max:i}=H(),a=t.snapTarget??t.offset;t.velocity=0,t.drag=null,t.snapTarget=Wi(a+n,r,i),G()},[I,L,H,G]),q=e[P],oe=u&&q?.title?`,当前:${q.title}${q.description?`,${q.description}`:``}`:``;return I===0?(0,l.jsxs)(`div`,{className:[Ii.scroll,h].filter(Boolean).join(` `),style:{width:Ui(t),height:Ui(n),...g},role:`img`,"aria-label":m,children:[(0,l.jsx)(`div`,{className:[Ii.roller,Ii.rollerLeft].join(` `),"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:Ii.center,children:(0,l.jsx)(`div`,{className:Ii.empty,children:`暂无照片`})}),(0,l.jsx)(`div`,{className:[Ii.roller,Ii.rollerRight].join(` `),"aria-hidden":`true`})]}):(0,l.jsxs)(`div`,{className:[Ii.scroll,h].filter(Boolean).join(` `),style:{width:Ui(t),height:Ui(n),...g},role:`region`,"aria-label":m+oe,tabIndex:0,onKeyDown:ae,children:[(0,l.jsx)(`div`,{className:[Ii.roller,Ii.rollerLeft].join(` `),"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:Ii.center,children:(0,l.jsx)(`div`,{ref:_,className:Ii.paperViewport,onPointerDown:te,onPointerMove:ne,onPointerUp:re,onPointerCancel:ie,children:(0,l.jsx)(`div`,{ref:v,className:Ii.paper,style:{minWidth:z,boxSizing:`border-box`},children:(0,l.jsx)(`div`,{className:Ii.paperSurface,style:{paddingLeft:R,paddingRight:R,minWidth:z},children:e.map((e,t)=>{let n=u&&(e.title||e.description);return(0,l.jsx)(`div`,{className:Ii.frameCell,style:{width:r,marginRight:t<I-1?a:0},"data-active":t===P?`true`:`false`,"data-photo-index":t,children:(0,l.jsxs)(`div`,{className:Ii.frame,style:{width:r,height:i},children:[(0,l.jsx)(`img`,{src:e.src,alt:e.alt??e.title??`Photo ${t+1}`,draggable:!1}),n?(0,l.jsxs)(`div`,{className:Ii.caption,children:[e.title?(0,l.jsx)(`strong`,{children:e.title}):null,e.description?(0,l.jsx)(`span`,{children:e.description}):null]}):null]})},`${e.src}-${t}`)})})})})}),(0,l.jsx)(`div`,{className:[Ii.roller,Ii.rollerRight].join(` `),"aria-hidden":`true`})]})},Ki={tunnel:`cos-tunnel-esly-`,vignette:`cos-vignette-P8ZI-`,depthFog:`cos-depthFog-E0b-c`,stage:`cos-stage--T1Yo`,track:`cos-track-u0COO`,frame:`cos-frame-N6-20`,frameInner:`cos-frameInner-CYOXO`,imageWrap:`cos-imageWrap-Xkdph`,image:`cos-image-Rj-YX`,frameCurrent:`cos-frameCurrent-xEe4Y`,caption:`cos-caption-FTJST`,captionTitle:`cos-captionTitle-BBveQ`,captionDesc:`cos-captionDesc-WhlOz`,empty:`cos-empty-mRm15`},qi=6,Ji=.35,Yi=8,Xi=10,Zi=90,Qi=.045,$i=e=>typeof e==`number`?`${e}px`:e,ea=(e,t,n)=>Math.min(n,Math.max(t,e)),ta=(e,t)=>t<=0?0:ea(Math.round(e),0,t-1),na=({photos:e,width:t=380,height:n=480,depthStep:r=180,dragSensitivity:i=.008,friction:a=1.5,autoAdvance:o=!1,autoAdvanceSpeed:s=.15,showCaption:u=!0,initialIndex:d=0,onPhotoClick:f,onIndexChange:p,ariaLabel:m=`纵深照片隧道`,className:h,style:g})=>{let _=e.length,v=(0,c.useRef)(null),b=(0,c.useRef)([]),x=(0,c.useRef)(d),S=(0,c.useRef)(0),C=(0,c.useRef)(null),w=(0,c.useRef)(!1),T=(0,c.useRef)(null),E=(0,c.useRef)(0),D=(0,c.useRef)(0),O=(0,c.useRef)(0),k=(0,c.useRef)(0),A=(0,c.useRef)(0),j=(0,c.useRef)(0),M=(0,c.useRef)(!1),N=(0,c.useRef)(!1),P=(0,c.useRef)(ta(d,_)),F=(0,c.useRef)(f),I=(0,c.useRef)(p),L=(0,c.useRef)(e),R=(0,c.useRef)(r),z=(0,c.useRef)(i),B=(0,c.useRef)(a),V=(0,c.useRef)(o),H=(0,c.useRef)(s),U=(0,c.useRef)(_),[W,ee]=(0,c.useState)(()=>ta(d,_));(0,c.useEffect)(()=>{F.current=f,I.current=p,L.current=e,R.current=r,z.current=i,B.current=a,V.current=o,H.current=s,U.current=_},[o,s,_,r,i,a,p,f,e]);let G=(0,c.useCallback)(e=>{if(e===P.current)return;P.current=e,ee(e);let t=L.current[e];t&&I.current?.(e,t)},[]),K=(0,c.useCallback)(e=>{x.current=e;let t=R.current,n=U.current;for(let r=0;r<n;r+=1){let n=b.current[r];if(!n)continue;let i=r-e,a=Math.abs(i),o=i*t,s=Math.max(.52,1-a*.14),c=Math.max(.12,1-a*.32),l=a>.45?Math.min(4,(a-.45)*2.4):0,u=a<.55;n.style.transform=`translate3d(-50%, -50%, ${o}px) scale(${s})`,n.style.opacity=String(c),n.style.filter=l>.05?`blur(${l}px)`:`none`,n.classList.toggle(Ki.frameCurrent,u),n.setAttribute(`aria-hidden`,u?`false`:`true`)}},[]);(0,c.useEffect)(()=>{let e=ta(d,_);x.current=e,S.current=0,C.current=null,P.current=e,K(e);let t=requestAnimationFrame(()=>{ee(e)});return()=>cancelAnimationFrame(t)},[K,_,d]),(0,c.useEffect)(()=>{let e=y(e=>{N.current=e}),t=0,n=performance.now(),r=e=>{if(t=requestAnimationFrame(r),N.current){n=e;return}let i=Math.min(.05,(e-n)/1e3);if(n=e,w.current)return;let a=Math.max(0,U.current-1),o=x.current,s=S.current,c=!1;if(C.current!==null){let e=C.current-o;Math.abs(e)<=.004?(o=C.current,C.current=null,s=0,G(ta(o,U.current)),c=!0):(o+=e*Math.min(1,Xi*i),s=0,c=!0)}else if(Math.abs(s)>Ji)s*=Math.exp(-B.current*i),Math.abs(s)<=Ji&&(s=0),o=ea(o+s*i,0,a),c=!0,(s===0||o<=0||o>=a)&&(C.current=ta(o,U.current));else if(V.current&&U.current>1){o+=H.current*i,o>=a?o=a:c=!0;let e=ta(o,U.current);e!==P.current&&G(e)}else{let e=ta(o,U.current);Math.abs(o-e)>.004?(C.current=e,c=!0):o!==e&&(o=e,G(e),c=!0)}S.current=s,c&&K(o)};return t=requestAnimationFrame(r),K(x.current),()=>{cancelAnimationFrame(t),e()}},[K,G]);let te=(0,c.useCallback)((e,t)=>{w.current&&(w.current=!1,T.current=null,!t||e-j.current>Zi?S.current=0:S.current=ea(S.current,-8,Yi),C.current=null)},[]),ne=(0,c.useCallback)(e=>{U.current<=0||e.button!==0||(w.current=!0,M.current=!1,T.current=e.pointerId,E.current=e.clientX,D.current=e.clientY,O.current=x.current,k.current=e.clientX,A.current=e.clientY,j.current=e.timeStamp,S.current=0,C.current=null,e.currentTarget.setPointerCapture(e.pointerId))},[]),re=(0,c.useCallback)(e=>{if(!w.current||T.current!==e.pointerId)return;let t=e.clientX-E.current,n=e.clientY-D.current;Math.hypot(t,n)>qi&&(M.current=!0);let r=e.clientX-k.current,i=e.clientY-A.current,a=Math.max(.008,(e.timeStamp-j.current)/1e3),o=z.current,s=(Math.abs(i)>=Math.abs(r)?-i*o:-r*o)/a,c=1-Math.exp(-a/Qi);S.current+=(s-S.current)*c;let l=Math.abs(n)>=Math.abs(t)?-n*o:-t*o,u=Math.max(0,U.current-1),d=ea(O.current+l,0,u);k.current=e.clientX,A.current=e.clientY,j.current=e.timeStamp,K(d),G(ta(d,U.current))},[K,G]),ie=(0,c.useCallback)(e=>{if(T.current!==e.pointerId)return;let t=!M.current;te(e.timeStamp,!0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}if(t){let e=P.current,t=L.current[e];t&&F.current?.(e,t)}},[te]),ae=(0,c.useCallback)(e=>{if(T.current===e.pointerId){te(e.timeStamp,!1);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}},[te]),q=e[W],oe=u&&q&&(q.title||q.description),se=oe&&q?.title?`,当前:${q.title}${q.description?`,${q.description}`:``}`:``;return _===0?(0,l.jsx)(`div`,{className:[Ki.tunnel,h].filter(Boolean).join(` `),style:{width:$i(t),height:$i(n),...g},role:`img`,"aria-label":m,children:(0,l.jsx)(`div`,{className:Ki.empty,children:`暂无照片`})}):(0,l.jsxs)(`div`,{className:[Ki.tunnel,h].filter(Boolean).join(` `),style:{width:$i(t),height:$i(n),...g},role:`region`,"aria-label":m+se,"aria-roledescription":`carousel`,tabIndex:0,children:[(0,l.jsx)(`div`,{className:Ki.depthFog,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:Ki.vignette,"aria-hidden":`true`}),(0,l.jsx)(`div`,{ref:v,className:Ki.stage,onPointerDown:ne,onPointerMove:re,onPointerUp:ie,onPointerCancel:ae,children:(0,l.jsx)(`div`,{className:Ki.track,children:e.map((e,t)=>(0,l.jsx)(`div`,{ref:e=>{b.current[t]=e},className:Ki.frame,"data-photo-index":t,"aria-hidden":t!==W,children:(0,l.jsx)(`div`,{className:Ki.frameInner,children:(0,l.jsx)(`div`,{className:Ki.imageWrap,children:(0,l.jsx)(`img`,{className:Ki.image,src:e.src,alt:e.alt??e.title??`Photo ${t+1}`,draggable:!1})})})},`${e.src}-${t}`))})}),oe?(0,l.jsxs)(`div`,{className:Ki.caption,children:[q?.title?(0,l.jsx)(`p`,{className:Ki.captionTitle,children:q.title}):null,q?.description?(0,l.jsx)(`p`,{className:Ki.captionDesc,children:q.description}):null]}):null]})},ra={root:`cos-root-qGq-T`,body:`cos-body-8jOJ0`,bodyRidge:`cos-bodyRidge-88Vkq`,topBulb:`cos-topBulb-M3wyM`,sideGrip:`cos-sideGrip-jL6g7`,left:`cos-left-mXvTL`,right:`cos-right-Q4Ozn`,discStage:`cos-discStage-HZPMB`,disc:`cos-disc-SkhwL`,slot:`cos-slot-AubzH`,slotFrame:`cos-slotFrame-AbvoX`,slotImage:`cos-slotImage-RfkHp`,peepStack:`cos-peepStack-KseMg`,peepRing:`cos-peepRing-8SSr0`,peepWindow:`cos-peepWindow-9dosU`,peepImage:`cos-peepImage-YxDtE`,peepGlare:`cos-peepGlare-vmPru`,peepVignette:`cos-peepVignette-MSiRk`,caption:`cos-caption-e--JN`,captionTitle:`cos-captionTitle-lSCbX`,captionDesc:`cos-captionDesc-qUIGe`,empty:`cos-empty-s8TJ0`},ia=380,aa=420,oa=300,sa=160,ca=6,la=640,ua=2.2,da=90,fa=.045,pa=.35,ma=14,ha=e=>typeof e==`number`?`${e}px`:e,ga=(e,t,n)=>Math.max(t,Math.min(n,e)),_a=(e,t)=>t<=0?0:(e%t+t)%t,va=(e,t,n)=>n<=0?0:_a(Math.round(-e/t),n),ya=(e,t,n)=>{let r=-t*n;return r+Math.round((e-r)/360)*360},ba=({photos:e,width:t=ia,height:n=aa,discSize:r=oa,peepSize:i=sa,dragSensitivity:a=.45,friction:o=1.4,autoRotate:s=!0,autoRotateSpeed:u=8,showCaption:d=!0,initialIndex:f=0,onPhotoClick:p,onIndexChange:m,ariaLabel:h=`观景器`,className:g,style:_})=>{let v=e.length,b=v>0?360/v:360,x=(r-i)/4+i/2,S=(0,c.useRef)(null),C=(0,c.useRef)(null),w=(0,c.useRef)(-f*b),T=(0,c.useRef)(0),E=(0,c.useRef)(!1),D=(0,c.useRef)(null),O=(0,c.useRef)(0),k=(0,c.useRef)(0),A=(0,c.useRef)(!1),j=(0,c.useRef)(0),M=(0,c.useRef)(!1),N=(0,c.useRef)(va(-f*b,b,v)),P=(0,c.useRef)(p),F=(0,c.useRef)(m),I=(0,c.useRef)(e),L=(0,c.useRef)(s),R=(0,c.useRef)(u),z=(0,c.useRef)(o),B=(0,c.useRef)(a),V=(0,c.useRef)(b),H=(0,c.useRef)(v),[U,W]=(0,c.useState)(()=>_a(f,v)),ee=(0,c.useMemo)(()=>e.map((e,t)=>`rotate(${t*b}deg) translateY(-${x}px)`),[e,x,b]);(0,c.useEffect)(()=>{P.current=p,F.current=m,I.current=e,L.current=s,R.current=u,z.current=o,B.current=a,V.current=b,H.current=v},[p,m,e,s,u,o,a,b,v]);let G=e=>{w.current=e,C.current&&(C.current.style.transform=`rotate(${e}deg)`);let t=va(e,V.current,H.current);if(t!==N.current){N.current=t,W(t);let e=I.current[t];e&&F.current?.(t,e)}};(0,c.useEffect)(()=>{let e=_a(f,v),t=-e*b;T.current=0,N.current=e,w.current=t,C.current&&(C.current.style.transform=`rotate(${t}deg)`);let n=requestAnimationFrame(()=>{W(e)});return()=>cancelAnimationFrame(n)},[v,f,b]),(0,c.useEffect)(()=>{let e=y(e=>{M.current=e}),t=0,n=performance.now(),r=e=>{if(t=requestAnimationFrame(r),M.current){n=e;return}let i=Math.min(.05,(e-n)/1e3);if(n=e,E.current||H.current<=0)return;let a=w.current,o=T.current,s=V.current;if(Math.abs(o)>ua)a+=o*i,o*=Math.exp(-z.current*i),Math.abs(o)<=ua&&(o=0);else{o=0;let e=va(a,s,H.current),t=ya(a,e,s),n=t-a;Math.abs(n)>pa?a+=n*Math.min(1,ma*i):(a=t,L.current&&(a-=R.current*i))}T.current=o,G(a)};return t=requestAnimationFrame(r),G(w.current),()=>{cancelAnimationFrame(t),e()}},[]);let K=(e,t)=>{if(E.current){if(E.current=!1,D.current=null,!t||e-k.current>da){T.current=0;return}T.current=ga(T.current,-640,la)}},te=e=>{e.button!==0||v<=0||(E.current=!0,A.current=!1,D.current=e.pointerId,j.current=e.clientX,O.current=e.clientX,k.current=e.timeStamp,T.current=0,e.currentTarget.setPointerCapture(e.pointerId))},ne=e=>{if(!E.current||D.current!==e.pointerId)return;let t=e.clientX-O.current,n=Math.max(.008,(e.timeStamp-k.current)/1e3);Math.abs(e.clientX-j.current)>ca&&(A.current=!0);let r=B.current;G(w.current-t*r);let i=-t/n*r,a=1-Math.exp(-n/fa);T.current+=(i-T.current)*a,O.current=e.clientX,k.current=e.timeStamp},re=e=>{if(D.current!==e.pointerId)return;let t=!A.current;K(e.timeStamp,!0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}if(t){let e=I.current[N.current];e&&P.current?.(N.current,e)}},ie=e=>{D.current===e.pointerId&&K(e.timeStamp,!1)},ae=e[U],q=d&&ae&&(ae.title||ae.description),oe=q&&ae?.title?`,当前:${ae.title}${ae.description?`,${ae.description}`:``}`:``;return v===0?(0,l.jsx)(`div`,{ref:S,className:[ra.root,g].filter(Boolean).join(` `),style:{width:ha(t),height:ha(n),"--pvm-disc-size":`${r}px`,"--pvm-peep-size":`${i}px`,..._},role:`img`,"aria-label":h,children:(0,l.jsx)(`div`,{className:ra.empty,children:`暂无照片`})}):(0,l.jsxs)(`div`,{ref:S,className:[ra.root,g].filter(Boolean).join(` `),style:{width:ha(t),height:ha(n),"--pvm-disc-size":`${r}px`,"--pvm-peep-size":`${i}px`,..._},role:`img`,"aria-label":h+oe,onPointerDown:te,onPointerMove:ne,onPointerUp:re,onPointerCancel:ie,children:[(0,l.jsxs)(`div`,{className:ra.body,children:[(0,l.jsx)(`div`,{className:ra.topBulb,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:[ra.sideGrip,ra.left].join(` `),"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:[ra.sideGrip,ra.right].join(` `),"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:ra.bodyRidge,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:ra.discStage,children:(0,l.jsx)(`div`,{ref:C,className:ra.disc,style:{transform:`rotate(${-f*b}deg)`},"aria-hidden":`true`,children:e.map((e,t)=>(0,l.jsx)(`div`,{className:ra.slot,style:{transform:ee[t]},children:(0,l.jsx)(`div`,{className:ra.slotFrame,children:(0,l.jsx)(`img`,{className:ra.slotImage,src:e.src,alt:``,draggable:!1})})},`${e.src}-${t}`))})}),(0,l.jsxs)(`div`,{className:ra.peepStack,children:[(0,l.jsx)(`div`,{className:ra.peepRing,"aria-hidden":`true`}),(0,l.jsxs)(`div`,{className:ra.peepWindow,children:[ae?(0,l.jsx)(`img`,{className:ra.peepImage,src:ae.src,alt:ae.alt??ae.title??`Photo ${U+1}`,draggable:!1}):null,(0,l.jsx)(`div`,{className:ra.peepVignette,"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:ra.peepGlare,"aria-hidden":`true`})]})]})]}),q?(0,l.jsxs)(`div`,{className:ra.caption,children:[ae?.title?(0,l.jsx)(`p`,{className:ra.captionTitle,children:ae.title}):null,ae?.description?(0,l.jsx)(`p`,{className:ra.captionDesc,children:ae.description}):null]}):null]})},xa={plasmaBall:`cos-plasmaBall-xGHSj`,canvas:`cos-canvas-V1CgL`},Sa=({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,_=document.hidden,v=y(e=>{_=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),_)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),v(),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:xa.plasmaBall,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:xa.canvas,style:{width:e,height:t}})})},Ca={smokeFog:`cos-smokeFog-SYlts`,canvas:`cos-canvas-iOJV7`},wa=10,Ta=128,Ea=`#d2d4d8`,Da=[`#14151c`,`#1a1b24`,`#0e0f14`],Oa=(e,t)=>{let n=Math.sin(e*127.1+t*311.7)*43758.5453;return n-Math.floor(n)},ka=(e,t)=>{let n=Math.floor(e),r=Math.floor(t),i=e-n,a=t-r,o=i*i*(3-2*i),s=a*a*(3-2*a),c=Oa(n,r),l=Oa(n+1,r),u=Oa(n,r+1),d=Oa(n+1,r+1);return c+(l-c)*o+(u-c)*s+(c-l-u+d)*o*s},Aa=(e,t)=>{let n=0,r=.5,i=1;for(let a=0;a<4;a++)n+=r*ka(e*i,t*i),i*=2.05,r*=.5;return n},ja=(e,t)=>{let n=e.replace(`#`,``).trim(),r=n.length===3?n.split(``).map(e=>e+e).join(``):n;if(r.length!==6)return t;let i=Number.parseInt(r,16);return Number.isNaN(i)?t:[i>>16&255,i>>8&255,i&255]},Ma=(e,t,n)=>[Math.round(e[0]+(t[0]-e[0])*n),Math.round(e[1]+(t[1]-e[1])*n),Math.round(e[2]+(t[2]-e[2])*n)],Na=(e,t=1)=>t>=1?`rgb(${e[0]} ${e[1]} ${e[2]})`:`rgb(${e[0]} ${e[1]} ${e[2]} / ${t})`,Pa=e=>{if(Array.isArray(e)&&e.length>=3)return[e[0],e[1],e[2]];let t=ja(typeof e==`string`?e:Da[2],[14,15,20]),n=Ma(t,[255,255,255],.06);return[Na(Ma(t,[255,255,255],.1)),Na(n),Na(t)]},Fa=(e,t)=>{let n=document.createElement(`canvas`);n.width=Ta,n.height=Ta;let r=n.getContext(`2d`),i=r.createImageData(Ta,Ta),a=i.data,o=Ta/2,s=Ta/2,c=Ta*.48;for(let n=0;n<Ta;n++)for(let r=0;r<Ta;r++){let i=(r-o)/c,l=(n-s)/c,u=Math.hypot(i,l);if(u>1.15)continue;let d=Aa(r*.045+e*17.1,n*.045+e*9.3)*.7+Aa(r*.09-e*3.2,n*.09+e*5.7)*.3,f=u+(d-.45)*.55,p=1-Math.max(0,f);if(p=Math.max(0,p)**1.35,p*=.55+d*.7,p<.01)continue;let m=(n*Ta+r)*4,h=.88+d*.18;a[m]=Math.min(255,t[0]*h),a[m+1]=Math.min(255,t[1]*h+1),a[m+2]=Math.min(255,t[2]*h+3),a[m+3]=Math.min(255,p*210)}return r.putImageData(i,0,0),n},Ia=e=>Array.from({length:wa},(t,n)=>Fa(n+1,e)),La=(e,t,n=0)=>{let r=70+Math.random()*110,i=Math.min(.92,n*.88),a=t*(1-n*.92)+r*(.15-n*.1),o=(.32+Math.random()*.28)*(1-n*.55);return{x:Math.random()*e,y:a,vx:(Math.random()-.5)*.18,vy:-(.08+Math.random()*.16),size:r*(.7+i*.55),birthSize:r,maxSize:r*(1.8+Math.random()*1.4),rotation:Math.random()*Math.PI*2,spin:(Math.random()-.5)*.004,age:i,ageSpeed:4e-4+Math.random()*65e-5,opacity:o,sprite:Math.floor(Math.random()*wa),stretch:.85+Math.random()*.55+n*.25,receptivity:.5+Math.random()*.85,mass:.5+Math.random()*.9,phase:Math.random()*Math.PI*2,warmth:Math.random()}},Ra=(e,t)=>{let n=Math.hypot(e.vx,e.vy);if(n<=t)return;let r=t/n;e.vx*=r,e.vy*=r},za=e=>e<.06?e/.06:e>.55?Math.max(0,1-(e-.55)/.45):1,Ba=(e,t)=>.22+Math.min(1,Math.max(0,e/t))**1.15*.78,Va=({width:e,height:t,fill:n=!1,density:r=.5,color:i=Ea,backgroundColor:a=Da,speed:o=1,disperseStrength:s=1,disperseRadius:u=1,interactive:d=!0,ariaLabel:f})=>{let{hostRef:p,width:m,height:h,hostStyle:g}=E({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),v=(0,c.useRef)(null),S=(0,c.useRef)([]),C=(0,c.useRef)([]),w=(0,c.useRef)(null),T=(0,c.useRef)(``),D=(0,c.useRef)(0),O=(0,c.useRef)({speed:o,disperseStrength:s,disperseRadius:u,interactive:d,color:i,backgroundColor:a});(0,c.useEffect)(()=>{O.current={speed:o,disperseStrength:s,disperseRadius:u,interactive:d,color:i,backgroundColor:a}},[o,s,u,d,i,a]),(0,c.useEffect)(()=>{w.current=Ia(ja(i,[210,212,216])),T.current=i},[i]),(0,c.useEffect)(()=>{let e=Math.floor(56+r*100);S.current=Array.from({length:e},()=>La(m,h,Math.random()**1.75))},[r,h,m]);let k=(0,c.useCallback)((e,t)=>{let n=O.current;if(!n.interactive)return;let r=v.current;if(!r)return;let i=r.getBoundingClientRect(),a=(e-i.left)/i.width*m,o=(t-i.top)/i.height*h,s=_(n.disperseRadius,0,3),c=_(n.disperseStrength,0,3);C.current.length>3&&C.current.shift(),C.current.push({x:a,y:o,life:1,swirl:Math.random()<.5?-1:1,radius:Math.min(m,h)*.08*s,maxRadius:Math.min(m,h)*(.42+Math.random()*.12)*s,strength:(.7+Math.random()*.25)*c})},[h,m]);return(0,c.useEffect)(()=>{let e=v.current;if(!e)return;let t=e=>{e.pointerType===`mouse`&&e.button!==0||k(e.clientX,e.clientY)};return e.addEventListener(`pointerdown`,t),()=>e.removeEventListener(`pointerdown`,t)},[k]),(0,c.useEffect)(()=>{let e=v.current;if(!e)return;let t=Math.min(window.devicePixelRatio||1,2);e.width=Math.floor(m*t),e.height=Math.floor(h*t);let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let r=ja(O.current.color,[210,212,216]);w.current||(w.current=Ia(r),T.current=O.current.color);let i=w.current,a=0,o=document.hidden,s=b(),c=y(e=>{o=e}),l=x(e=>{s=e}),u=()=>{let[e,t,r]=Pa(O.current.backgroundColor),i=n.createLinearGradient(0,0,0,h);i.addColorStop(0,e),i.addColorStop(.45,t),i.addColorStop(1,r),n.fillStyle=i,n.fillRect(0,0,m,h);let a=ja(r,[14,15,20]),o=Ma(a,[255,255,255],.22),s=n.createRadialGradient(m*.5,h*.75,0,m*.5,h,m*.55);s.addColorStop(0,Na(o,.35)),s.addColorStop(1,Na(a,0)),n.fillStyle=s,n.fillRect(0,0,m,h)},d=e=>{let t=za(e.age)*Ba(e.y,h);if(t<=.01)return;let r=i[e.sprite],a=e.birthSize+(e.maxSize-e.birthSize)*Math.min(1,e.age*1.15),o=e.size+(a-e.size)*.35,s=o,c=o*e.stretch;n.save(),n.translate(e.x,e.y),n.rotate(e.rotation),n.globalAlpha=e.opacity*t*(.85+e.warmth*.2),n.globalCompositeOperation=`screen`,n.drawImage(r,-s/2,-c/2,s,c),n.restore()},f=()=>{if(D.current=requestAnimationFrame(f),o||s)return;let e=_(O.current.speed,0,3),t=_(O.current.disperseStrength,0,3);a+=.01*Math.max(e,.001),u(),T.current!==O.current.color&&(w.current=Ia(ja(O.current.color,[210,212,216])),T.current=O.current.color);let r=w.current??i,c=S.current,l=C.current;for(let e=l.length-1;e>=0;e--){let n=l[e],r=1-n.life,i=Math.sin(Math.PI*Math.min(1,r*1.05))*n.strength;n.radius+=(n.maxRadius-n.radius)*.055;for(let e of c){let r=e.x-n.x,o=e.y-n.y,s=Math.hypot(r,o)||.001;if(s>n.radius)continue;let c=s/n.radius,l=Math.exp(-c*c*2.2)*(1-c*.35),u=Math.exp(-(((c-.72)/.32)**2)),d=l*.55+u*.45,f=.72+.28*Math.sin(e.phase*2.7+a*1.2+s*.03),p=d*e.receptivity*f*i;if(p<.02)continue;let m=r/s,h=o/s,g=-h*n.swirl,_=m*n.swirl,v=1/(.65+e.mass*.7),y=Math.sin(e.phase*4.2+a*1.6)*.35;e.vx+=(m*.55+g*.22+y*.12)*p*v,e.vy+=(h*.48+_*.22-.06)*p*v,e.opacity*=1-p*.028,e.maxSize*=1+p*.02,e.stretch+=p*.012,e.spin+=y*p*.004,Ra(e,2.4*Math.max(t,.35))}n.life*=.972,n.life<.04&&l.splice(e,1)}n.save();for(let t=0;t<c.length;t++){let i=c[t],o=Math.sin(a*.55+i.phase)*.16,s=Math.cos(a*.4+i.phase*1.3)*.05;i.vx+=o*.018*e,i.vy+=s*.01*e-.0035*e;let l=Math.hypot(i.vx,i.vy),u=l>.8?.975:.99;i.vx*=u,i.vy*=u,i.x+=i.vx*e,i.y+=i.vy*e,i.rotation+=(i.spin+i.vx*.002)*e,i.age+=i.ageSpeed*e;let d=i.birthSize+(i.maxSize-i.birthSize)*Math.min(1,i.age*1.15);i.size+=(d-i.size)*.04;let f=(.3+i.warmth*.1)*Ba(i.y,h),p=.006+.008*Math.max(0,1-l/2.2);if(i.opacity+=(f-i.opacity)*p,i.stretch+=(1.05+(1-i.y/h)*.55-i.stretch)*.01,i.age>=1||i.y<-i.size||i.opacity<.02){c[t]=La(m,h,0);continue}i.x<-i.size&&(i.x=m+i.size*.5),i.x>m+i.size&&(i.x=-i.size*.5);let g=za(i.age)*Ba(i.y,h);if(g<=.01)continue;let _=r[i.sprite],v=i.birthSize+(i.maxSize-i.birthSize)*Math.min(1,i.age*1.15),y=i.size+(v-i.size)*.35,b=y,x=y*i.stretch;n.save(),n.translate(i.x,i.y),n.rotate(i.rotation),n.globalAlpha=i.opacity*g*(.85+i.warmth*.2),n.globalCompositeOperation=`screen`,n.drawImage(_,-b/2,-x/2,b,x),n.restore()}n.restore(),n.globalCompositeOperation=`source-over`,n.globalAlpha=1};if(s){u();for(let e of S.current)d(e);return n.globalCompositeOperation=`source-over`,n.globalAlpha=1,()=>{c(),l()}}return f(),()=>{cancelAnimationFrame(D.current),c(),l()}},[h,m]),(0,l.jsx)(`div`,{ref:p,className:Ca.smokeFog,style:g,children:(0,l.jsx)(`canvas`,{ref:v,className:Ca.canvas,style:{width:m,height:h,cursor:d?`pointer`:`default`},role:`img`,"aria-label":f??(d?`烟雾背景,点击可驱散`:`烟雾背景`)})})},Ha=.82,Ua=.08,Wa=1e3/60,Ga=46*2.6,Ka=()=>({x:-1e3,y:-1e3,prevX:-1e3,prevY:-1e3,vx:0,vy:0,speed:0,active:!1,lastTs:0}),qa=e=>e<.5?2*e*e:1-(-2*e+2)**2/2,Ja=e=>1-(1-e)**3,Ya=(e,t,n)=>{let r=Math.min(1,Math.max(0,(n-e)/(t-e)));return r*r*(3-2*r)},Xa=(e,t)=>e**t,Za=e=>{let t=Math.sin(e*127.1+311.7)*43758.5453;return t-Math.floor(t)},Qa=(e,t,n=!0)=>{let r=.18+(e/18)**.5*.52,i=n?.8+Math.random()*.35:1;return r*t*i},$a=(e,t,n,r,i)=>{let a=e.createRadialGradient(t,n,0,t,n,r);for(let[e,t]of i)a.addColorStop(e,t);e.fillStyle=a,e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fill()},eo=(e,t,n,r,i,a,o)=>{e.save(),e.translate(t,n),e.rotate(r),e.scale(a,1);let s=e.createRadialGradient(0,0,0,0,i*.15,i);s.addColorStop(0,`rgb(170 220 240 / ${o*100}%)`),s.addColorStop(.2,`rgb(90 170 200 / ${o*45}%)`),s.addColorStop(.55,`rgb(40 110 150 / ${o*12}%)`),s.addColorStop(1,`rgb(10 40 60 / 0%)`),e.fillStyle=s,e.beginPath(),e.arc(0,i*.15,i,0,Math.PI*2),e.fill(),e.restore()},to=(e,t,n,r,i)=>{let a=Math.min(70,Math.floor(t*n/22e3));for(let o=0;o<a;o++){let a=Za(o+1),s=Za(o+57),c=Za(o+131),l=.3+c*1.1,u=5+s*16,d=Math.sin(r*(.1+a*.28)+o*.7)*(5+s*14),f=(a*t+r*(1.5+c*5)+d)%(t+24)-12,p=(s*n+r*u*.22)%(n+24)-12,m=Math.min(1,Math.max(0,p/n)),h=(.02+c*.07)*(.35+m*.55),g=l*4.4;e.globalAlpha=h,e.drawImage(i,f-g*.5,p-g*.5,g,g)}e.globalAlpha=1},no=(e,t,n,r)=>{let i=e.createLinearGradient(0,0,0,n);i.addColorStop(0,`#0c4558`),i.addColorStop(.08,`#0a3c50`),i.addColorStop(.18,`#083445`),i.addColorStop(.32,`#062a38`),i.addColorStop(.48,`#041f2b`),i.addColorStop(.64,`#03161f`),i.addColorStop(.8,`#020e15`),i.addColorStop(.92,`#01080c`),i.addColorStop(1,`#000406`),e.fillStyle=i,e.fillRect(0,0,t,n),$a(e,t*.55,-n*.05,n*1.05,[[0,`rgb(150 215 235 / 26%)`],[.18,`rgb(80 170 200 / 14%)`],[.4,`${r}12`],[.65,`rgb(30 90 120 / 4%)`],[1,`rgb(5 20 30 / 0%)`]]),$a(e,t*.18,n*.12,t*.7,[[0,`rgb(70 150 175 / 8%)`],[.45,`rgb(30 90 120 / 3%)`],[1,`rgb(10 30 45 / 0%)`]]),$a(e,t*.88,n*.22,t*.55,[[0,`rgb(50 120 150 / 6%)`],[.5,`rgb(20 70 100 / 2%)`],[1,`rgb(5 20 30 / 0%)`]]);for(let r=0;r<4;r++){let i=Za(r+3),a=Za(r+11);$a(e,t*(.2+i*.6),n*(.28+a*.4),n*(.28+a*.18),[[0,`rgb(25 70 95 / ${4+i*3}%)`],[.5,`rgb(15 45 65 / ${2+a*2}%)`],[1,`rgb(5 20 30 / 0%)`]])}let a=e.createLinearGradient(0,0,0,n);a.addColorStop(0,`rgb(0 10 16 / 0%)`),a.addColorStop(.35,`rgb(0 8 14 / 6%)`),a.addColorStop(.65,`rgb(0 5 10 / 22%)`),a.addColorStop(.85,`rgb(0 3 7 / 42%)`),a.addColorStop(1,`rgb(0 1 3 / 62%)`),e.fillStyle=a,e.fillRect(0,0,t,n),$a(e,t*.5,n*1.05,n*.55,[[0,`rgb(0 2 5 / 70%)`],[.45,`rgb(0 4 8 / 35%)`],[1,`rgb(0 6 10 / 0%)`]]),$a(e,t*.28,n*1.02,t*.4,[[0,`rgb(0 3 6 / 28%)`],[1,`rgb(0 3 6 / 0%)`]]),$a(e,t*.75,n*1.04,t*.35,[[0,`rgb(0 2 5 / 24%)`],[1,`rgb(0 2 5 / 0%)`]]);let o=e.createRadialGradient(t*.5,n*.4,Math.min(t,n)*.35,t*.5,n*.48,Math.max(t,n)*.78);o.addColorStop(0,`rgb(0 0 0 / 0%)`),o.addColorStop(.55,`rgb(0 6 10 / 6%)`),o.addColorStop(.8,`rgb(0 3 6 / 18%)`),o.addColorStop(1,`rgb(0 1 3 / 36%)`),e.fillStyle=o,e.fillRect(0,0,t,n)},ro=(e,t,n,r,i,a)=>{let o=t*(.55+Math.sin(r*.07)*.03);e.save(),e.globalCompositeOperation=`screen`;for(let i=0;i<5;i++){let o=r*.11+i*1.35,s=t*(.22+i*.14)+Math.sin(o)*t*(a?.015:.04),c=.12+Math.sin(o*.6+i)*(a?.02:.05),l=.045+i%3*.012+Math.sin(r*.2+i)*.008;eo(e,s,-n*.02,c,n*(.7+i%2*.12),.12+i%3*.04,l)}eo(e,o+t*.02,-n*.04,.08+Math.sin(r*.09)*(a?.012:.03),n*.78,.2,.07+Math.sin(r*.15)*.012),e.restore(),to(e,t,n,r,i)},io=()=>{let e=document.createElement(`canvas`);e.width=48,e.height=48;let t=e.getContext(`2d`);if(!t)return e;let n=t.createRadialGradient(48/2,48/2,0,48/2,48/2,48/2);return n.addColorStop(0,`rgb(220 240 250 / 90%)`),n.addColorStop(.3,`rgb(180 220 240 / 42%)`),n.addColorStop(1,`rgb(180 220 240 / 0%)`),t.fillStyle=n,t.beginPath(),t.arc(48/2,48/2,48/2,0,Math.PI*2),t.fill(),e},ao=(e,t)=>e.find(e=>e.id===t),oo=e=>{let t=e.progress,n=qa(Ya(0,.72,t)),r=Ja(Ya(.28,1,t)),i=e.startSecondaryX-e.startPrimaryX,a=e.startSecondaryY-e.startPrimaryY,o=Math.hypot(i,a)||1,s=i/o,c=a/o,l=e.startPrimaryRadius,u=e.startSecondaryRadius,d=l+u,f=d*(1-n),p=e.startPrimaryX+s*(d-f)*(u/(l+u)),m=e.startPrimaryY+c*(d-f)*(u/(l+u)),h=p+s*f,g=m+c*f;return{ax:p,ay:m,ar:l+(e.targetRadius-l)*r,bx:h,by:g,br:Math.max(.8,u*(1-r*.97)),approach:n,absorb:r}},so=(e,t)=>{let n=new Map;for(let t of e){let e=`${Math.floor(t.x/Ga)},${Math.floor(t.y/Ga)}`,r=n.get(e);r?r.push(t):n.set(e,[t])}for(let r of e){let e=Math.floor(r.x/Ga),i=Math.floor(r.y/Ga);for(let a=-1;a<=1;a++)for(let o=-1;o<=1;o++){let s=n.get(`${e+a},${i+o}`);if(s)for(let e of s)e.id<=r.id||t(r,e)}}},co=e=>{so(e,(e,t)=>{let n=t.x-e.x,r=t.y-e.y,i=Math.hypot(n,r)||1,a=i-(e.radius+t.radius),o=Math.min(8,(e.radius+t.radius)*.14);if(a>o||a<0)return;let s=(1-a/o)*.01,c=n/i,l=r/i;e.vx+=c*s,e.vy+=l*s*.55,t.vx-=c*s,t.vy-=l*s*.55})},lo=(e,t,n)=>{so(e,(e,r)=>{if(n.has(e.id)||n.has(r.id)||Math.hypot(e.x-r.x,e.y-r.y)>e.radius+r.radius-Math.min(e.radius,r.radius)*.12)return;let i=e.radius>=r.radius?e:r,a=e.radius>=r.radius?r:e,o=Math.min(46,Math.cbrt(i.radius**3+a.radius**3));t.push({primaryId:i.id,secondaryId:a.id,progress:0,targetRadius:o,startPrimaryRadius:i.radius,startSecondaryRadius:a.radius,startPrimaryX:i.x,startPrimaryY:i.y,startSecondaryX:a.x,startSecondaryY:a.y}),n.add(i.id),n.add(a.id)})},uo=(e,t,n,r)=>{let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=ao(e,o.primaryId),c=ao(e,o.secondaryId);if(!s||!c){i.push(a);continue}o.progress=Math.min(1,o.progress+.018*r);let l=(s.vy+c.vy)*.5-.12,u=(s.vx+c.vx)*.5;o.startPrimaryX+=u*r,o.startPrimaryY+=l*r,o.startSecondaryX+=u*r,o.startSecondaryY+=l*r;let d=oo(o);if(o.pose=d,s.x=d.ax,s.y=d.ay,s.radius=d.ar,c.x=d.bx,c.y=d.by,c.radius=d.br,s.vx=u,s.vy=l,c.vx=u,c.vy=l,o.progress>=1){s.x=(d.ax*d.ar+d.bx*d.br)/Math.max(1,d.ar+d.br),s.y=(d.ay*d.ar+d.by*d.br)/Math.max(1,d.ar+d.br),s.radius=o.targetRadius,s.terminalRise=Math.min(2.2,Qa(s.radius,n,!1)*1.04),s.settle=.7,s.aspect=.94;let t=e.findIndex(e=>e.id===c.id);t>=0&&e.splice(t,1),i.push(a)}}for(let e=i.length-1;e>=0;e--)t.splice(i[e],1)},fo=(e,t,n,r,i=!1)=>{let a=i?2.5+Math.random()*9:4+Math.random()*(Math.random()<.25?18:10),o=a+8,s=Qa(a,r),c=a<10?.985+Math.random()*.02:.96+Math.random()*.03;return{id:e,x:o+Math.random()*Math.max(1,t-o*2),y:n+a+Math.random()*(i?120:36),radius:a,terminalRise:s,drift:(Math.random()-.5)*.22,vx:(Math.random()-.5)*.15,vy:-s*(.04+Math.random()*.14),phase:Math.random()*Math.PI*2,alpha:.42+Math.random()*.38,aspect:c,deformAmp:.008+Math.random()*.012+Math.min(.015,a*6e-4),deformPhase:Math.random()*Math.PI*2,deformSpeed:.7+Math.random()*.5,tilt:Math.random()*Math.PI*2,pulseBoost:0,streamStretch:0,streamAngle:0,mode2:0,mode2Vel:0,mode2Angle:Math.random()*Math.PI,mode3:0,mode3Vel:0,mode3Phase:Math.random()*Math.PI*2,settle:0}},po=(e,t,n)=>({x:Math.sin(t*.009+n*.48)*.12+Math.cos(e*.006-n*.32)*.09,y:Math.cos(e*.008+n*.38)*.05}),mo=(e,t,n,r,i)=>{let a=1+(1-Math.min(1,Math.max(0,e.y/n)))*.12,o=(e.terminalRise*r*a- -e.vy)*(.022+e.radius*.0011);e.vy-=o*i;let s=.03+e.radius*.0025,c=Math.sin(t*(1.1+e.deformSpeed)+e.phase)*s+Math.sin(t*2.1+e.deformPhase)*s*.35;e.vy-=c*.02*i;let l=Math.sin(t*.85+e.deformPhase)*(.05+e.radius*.003)+Math.cos(t*.5+e.phase)*.03;e.vx+=l*.015*i;let u=po(e.x,e.y,t);e.vx+=(e.drift*.015+u.x*.05)*i,e.vy+=u.y*.025*i,e.vx*=Xa(.968,i),e.vy*=Xa(.994,i),e.x+=(e.vx+u.x*.22)*i,e.y+=e.vy*i},ho=(e,t,n,r,i,a,o)=>{let s=e-n,c=t-r,l=Math.hypot(s,c)||1,u=70+Math.min(140,o*3.8),d=l/u;if(d>1.35)return{fx:0,fy:0,strain:0,strainAngle:0,excite:0};let f=Math.exp(-d*d*2.1),p=s/l,m=c/l,h=Math.max(.001,Math.hypot(i,a)),g=i/h,_=a/h,v=-_,y=g,b=s*v+c*y,x=s*g+c*_,S=f*Math.min(1.15,o/22),C=x<0?1.35:.72,w=f*Math.min(1,o/18)*Math.tanh(b/(u*.35)),T=f*Math.min(.85,o/30)*(1-Math.abs(x)/(u+1)),E=g*S*1.55*C+v*w*1.25+p*T*.55,D=_*S*1.55*C+y*w*1.25+m*T*.55;return{fx:E,fy:D,strain:f*Math.min(1,o/16)*(.55+Math.abs(w)*.45),strainAngle:Math.atan2(D+_*.4,E+g*.4),excite:f*Math.min(1.2,o/14)}},go=(e,t)=>{let n=.22+3.4/Math.sqrt(Math.max(6,e.radius)),r=n*1.55,i=.045+e.radius*9e-4,a=.055+e.radius*.001;e.mode2Vel+=(-n*n*e.mode2-i*e.mode2Vel)*t,e.mode2+=e.mode2Vel*t,e.mode2=Math.max(-1.1,Math.min(1.1,e.mode2)),e.mode2*=Xa(.998,t),e.mode3Vel+=(-r*r*e.mode3-a*e.mode3Vel)*t,e.mode3+=e.mode3Vel*t,e.mode3=Math.max(-.9,Math.min(.9,e.mode3)),e.mode3*=Xa(.997,t),e.mode3Phase+=(.04+Math.abs(e.mode3Vel)*.8)*t,e.streamStretch*=Xa(.88,t),Math.abs(e.streamStretch)<.004&&(e.streamStretch=0),Math.abs(e.mode2)<.002&&Math.abs(e.mode2Vel)<.002&&(e.mode2=0,e.mode2Vel=0),Math.abs(e.mode3)<.002&&Math.abs(e.mode3Vel)<.002&&(e.mode3=0,e.mode3Vel=0)},_o=(e,t,n,r,i,a)=>{if(t<.02&&r<.02)return;let o=Math.min(.55,t*.65);e.streamStretch=e.streamStretch*(1-o)+t*o,e.streamAngle=e.streamAngle*(1-o)+n*o;let s=r*(.06+Math.min(.05,e.radius*.0014));e.mode2Vel+=s*(.75+Math.random()*.85),e.mode2Angle=e.mode2Angle*.7+n*.3,e.mode3Vel+=s*.45*(Math.random()-.3),e.pulseBoost=Math.min(1.35,e.pulseBoost+r*.08),e.tilt+=(i*.002-a*.0015)*r},vo=(e,t,n)=>{let r=Math.sin(n*e.deformSpeed+e.deformPhase)*e.deformAmp+(Math.sin(t*2+e.phase+n*.4)*e.deformAmp*.55+Math.sin(t*3+e.deformPhase)*e.deformAmp*.25)+e.pulseBoost*.035+e.settle*.06;if(Math.abs(e.streamStretch)>.01){let n=Math.cos(t-e.streamAngle),i=e.streamStretch*(.14+Math.min(.08,e.radius*.0025));r+=n*n*i,r-=(1-n*n)*i*.55}return Math.abs(e.mode2)>.002&&(r+=e.mode2*Math.cos(2*(t-e.mode2Angle))*.28),Math.abs(e.mode3)>.002&&(r+=e.mode3*Math.cos(3*(t-e.mode3Phase))*.16),e.radius*(1+r)},yo=(e,t)=>{let n=e.x,r=e.y,i=e.aspect-e.settle*.04,a=e.tilt,o=Math.abs(e.streamStretch)*.7+Math.abs(e.mode2)*.9+Math.abs(e.mode3)*.35;if(o>.03){let t=Math.min(1,o),n=e.streamStretch>.02?e.streamAngle:e.mode2Angle;a=a*(1-t*.55)+n*t*.55,i-=Math.min(.12,e.streamStretch*.1+Math.abs(e.mode2)*.08)}let s=Math.cos(a),c=Math.sin(a),l=new Path2D;for(let a=0;a<=48;a++){let o=Math.PI*2*a/48,u=vo(e,o,t),d=Math.cos(o)*u,f=Math.sin(o)*u*i,p=n+d*s-f*c,m=r+d*c+f*s;a===0?l.moveTo(p,m):l.lineTo(p,m)}return l.closePath(),l},bo=(e,t,n,r,i,a,o,s)=>{let c=(e-n)*(e-n)+(t-r)*(t-r)+.35,l=(e-a)*(e-a)+(t-o)*(t-o)+.35;return i*i/c+s*s/l},xo=(e,t,n,r,i,a,o,s,c)=>{let l=Math.cos(e),u=Math.sin(e),d=Math.hypot(t-s,n-c)+Math.hypot(i-s,a-c)+r+o+8,f=0,p=d;for(let e=0;e<14;e++){let e=(f+p)*.5;bo(s+l*e,c+u*e,t,n,r,i,a,o)>=1?f=e:p=e}let m=(f+p)*.5;return{x:s+l*m,y:c+u*m}},So=(e,t,n,r,i,a)=>{let o=n+a||1,s=(e*n+r*a)/o,c=(t*n+i*a)/o,l=new Path2D;for(let o=0;o<=56;o++){let u=xo(Math.PI*2*o/56,e,t,n,r,i,a,s,c);o===0?l.moveTo(u.x,u.y):l.lineTo(u.x,u.y)}return l.closePath(),{path:l,cx:s,cy:c,radius:Math.max(n,a)}},Co=(e,t,n,r,i,a)=>{let o=yo(t,n),s=Math.min(1,Math.max(0,t.y/a)),c=i*Ha,l=a*Ua,u=Math.atan2(l-t.y,c-t.x),d=t.x+Math.cos(u)*t.radius*.38,f=t.y+Math.sin(u)*t.radius*.38,p=t.x-Math.cos(u)*t.radius*.42,m=t.y-Math.sin(u)*t.radius*.42,h=t.alpha*(.55+(1-s)*.55),g=e.createRadialGradient(d,f,t.radius*.04,t.x,t.y,t.radius*1.45);g.addColorStop(0,`rgb(255 255 255 / 72%)`),g.addColorStop(.12,`rgb(186 230 253 / 42%)`),g.addColorStop(.35,`${r}30`),g.addColorStop(.62,`rgb(14 116 144 / 22%)`),g.addColorStop(.85,`rgb(2 12 27 / 48%)`),g.addColorStop(1,`rgb(1 4 12 / 78%)`),e.fillStyle=g,e.globalAlpha=h,e.fill(o),e.save(),e.clip(o);let _=e.createRadialGradient(p,m,0,p,m,t.radius*.95);_.addColorStop(0,`rgb(1 8 20 / 58%)`),_.addColorStop(.55,`rgb(2 12 27 / 28%)`),_.addColorStop(1,`rgb(2 12 27 / 0%)`),e.fillStyle=_,e.fillRect(t.x-t.radius*1.2,t.y-t.radius*1.2,t.radius*2.4,t.radius*2.4),e.beginPath(),e.ellipse(d,f,t.radius*.2,t.radius*.11,u-.25,0,Math.PI*2),e.fillStyle=`rgb(255 255 255 / 78%)`,e.fill(),e.beginPath(),e.ellipse(t.x+Math.cos(u+.9)*t.radius*.15,t.y+Math.sin(u+.9)*t.radius*.15,t.radius*.07,t.radius*.04,u,0,Math.PI*2),e.fillStyle=`rgb(255 255 255 / 22%)`,e.fill(),e.restore();let v=e.createRadialGradient(t.x,t.y,t.radius*.68,t.x,t.y,t.radius*1.06);v.addColorStop(0,`rgb(255 255 255 / 0%)`),v.addColorStop(.5,`rgb(186 230 253 / 24%)`),v.addColorStop(1,`rgb(224 242 254 / 55%)`),e.strokeStyle=v,e.lineWidth=.8+t.radius*.028,e.stroke(o),e.globalAlpha=1},wo=(e,t,n,r,i,a,o,s,c,l,u)=>{let d=So(t,n,r,i,a,o),f=Math.min(1,Math.max(0,d.cy/l)),p=c*Ha,m=l*Ua,h=Math.atan2(m-d.cy,p-d.cx),g=d.cx+Math.cos(h)*d.radius*.32,_=d.cy+Math.sin(h)*d.radius*.32,v=Math.hypot(t-i,n-a)+r+o,y=e.createRadialGradient(g,_,d.radius*.05,d.cx,d.cy,v*.75);y.addColorStop(0,`rgb(255 255 255 / 70%)`),y.addColorStop(.14,`rgb(186 230 253 / 40%)`),y.addColorStop(.4,`${s}32`),y.addColorStop(.75,`rgb(2 12 27 / 45%)`),y.addColorStop(1,`rgb(1 4 12 / 75%)`),e.fillStyle=y,e.globalAlpha=u*(.55+(1-f)*.5),e.fill(d.path),e.save(),e.clip(d.path),e.beginPath(),e.ellipse(g,_,d.radius*.22,d.radius*.12,h-.2,0,Math.PI*2),e.fillStyle=`rgb(255 255 255 / 72%)`,e.fill(),e.restore(),e.strokeStyle=`rgb(224 242 254 / 42%)`,e.lineWidth=1+d.radius*.02,e.stroke(d.path),e.globalAlpha=1},To={bubbleField:`cos-bubbleField-i9211`,canvas:`cos-canvas-8vKsT`},Eo=({width:e,height:t,fill:n=!1,bubbleCount:r=36,speed:i=1,color:a=`#7dd3fc`,interactive:o=!0})=>{let{hostRef:s,width:u,height:d,hostStyle:f}=E({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),p=(0,c.useRef)(null),m=(0,c.useRef)([]),h=(0,c.useRef)([]),g=(0,c.useRef)(Ka()),_=(0,c.useRef)(0),v=(0,c.useRef)(0),S=(0,c.useRef)(1),C=(0,c.useRef)(0),w=(0,c.useRef)(null),T=(0,c.useRef)(null),D=(0,c.useRef)({width:u,height:d,speed:i,color:a,interactive:o,bubbleCount:r});return(0,c.useEffect)(()=>{D.current={width:u,height:d,speed:i,color:a,interactive:o,bubbleCount:r}},[u,d,i,a,o,r]),(0,c.useEffect)(()=>{m.current=Array.from({length:r},()=>{let e=fo(S.current++,u,d,i,!0);return e.y=d*(.15+Math.random()*.85),e.vy=-e.terminalRise*(.35+Math.random()*.35),e}),h.current=[],g.current=Ka(),_.current=0,v.current=0,C.current=0},[r,d,i,u]),(0,c.useEffect)(()=>{let e=p.current;if(!e)return;let t=Math.min(window.devicePixelRatio||1,2);e.width=Math.floor(u*t),e.height=Math.floor(d*t);let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let r=0,i=0,a=document.hidden,o=b(),s=y(e=>{a=e}),c=x(e=>{o=e});T.current||=io();let l=T.current,f=(t,n)=>{let r=e.getBoundingClientRect(),i=u/Math.max(r.width,1),a=d/Math.max(r.height,1);return{x:(t-r.left)*i,y:(n-r.top)*a}},E=(e,t)=>{if(!D.current.interactive)return;let{x:n,y:r}=f(e,t),i=g.current,a=performance.now(),o=i.lastTs>0?Math.max(1,a-i.lastTs):16;if(i.active){let e=n-i.x,t=r-i.y,a=16/o,s=e*a,c=t*a,l=Math.hypot(s,c);i.vx=i.vx*.55+s*.45,i.vy=i.vy*.55+c*.45,i.speed=i.speed*.55+l*.45}else i.vx=0,i.vy=0,i.speed=0;i.prevX=i.x,i.prevY=i.y,i.x=n,i.y=r,i.active=!0,i.lastTs=a},O=()=>{g.current=Ka()},k=e=>{E(e.clientX,e.clientY)},A=e=>{E(e.clientX,e.clientY)},j=e=>{E(e.clientX,e.clientY)};e.addEventListener(`pointermove`,k),e.addEventListener(`pointerenter`,A),e.addEventListener(`pointerdown`,j),e.addEventListener(`pointerleave`,O);let M=r=>{let i=`${u}x${d}@${t}:${r}`;if(w.current?.key!==i){let n=document.createElement(`canvas`);n.width=e.width,n.height=e.height;let a=n.getContext(`2d`);a&&(a.setTransform(t,0,0,t,0,0),no(a,u,d,r),w.current={key:i,canvas:n})}w.current&&n.drawImage(w.current.canvas,0,0,u,d)},N=()=>{let{color:e}=D.current;M(e),ro(n,u,d,_.current,l,!0);let t=[...m.current].sort((e,t)=>t.y-e.y);for(let r of t)Co(n,r,_.current,e,u,d)};if(o)return N(),()=>{e.removeEventListener(`pointermove`,k),e.removeEventListener(`pointerenter`,A),e.removeEventListener(`pointerdown`,j),e.removeEventListener(`pointerleave`,O),s(),c()};let P=(e=0)=>{if(i=requestAnimationFrame(P),a||o)return;r||=e;let t=Math.min(40,Math.max(8,e-r||16.666666666666668));r=e;let s=t/Wa,c=t/1e3;_.current+=c;let f=_.current,{color:p,speed:y,bubbleCount:b,interactive:x}=D.current;M(p),ro(n,u,d,f,l,!1),v.current+=c,v.current>.2&&m.current.length<b&&(v.current=0,m.current.push(fo(S.current++,u,d,y)));let w=g.current;w.active&&(w.speed*=Xa(.94,s),w.vx*=Xa(.94,s),w.vy*=Xa(.94,s));let T=new Set;for(let e of h.current)T.add(e.primaryId),T.add(e.secondaryId);for(let e of m.current){if(e.phase+=.008*s,e.tilt+=Math.sin(f*.2+e.deformPhase)*.0012*s,e.pulseBoost*=Xa(.92,s),e.settle*=Xa(.93,s),e.settle>0&&(e.aspect+=(.985-e.aspect)*.08*s),e.settle<.01&&(e.settle=0),T.has(e.id))go(e,s);else{mo(e,f,d,y,s),go(e,s);let t=Math.hypot(e.vx,e.vy+e.terminalRise*.35);if(t>.55){let n=Math.atan2(e.vy,e.vx);e.streamStretch=Math.min(.85,e.streamStretch*Xa(.9,s)+Math.min(.35,(t-.55)*.08)*s),e.streamAngle=e.streamAngle*Xa(.85,s)+n*(1-Xa(.85,s))}}if(x&&w.active&&w.speed>.2&&!T.has(e.id)){let t=ho(e.x,e.y,w.x,w.y,w.vx,w.vy,w.speed);if(t.excite>.01||Math.hypot(t.fx,t.fy)>.01){let n=1/(.75+e.radius*.035);e.vx+=t.fx*n*s,e.vy+=t.fy*n*.82*s,_o(e,t.strain,t.strainAngle,t.excite,t.fx,t.fy)}}if(e.y+e.radius<-12){let t=fo(S.current++,u,d,y);Object.assign(e,t,{y:d+t.radius+ C.current++*.01})}e.x<-e.radius*1.5&&(e.x=u+e.radius),e.x>u+e.radius*1.5&&(e.x=-e.radius)}let E=m.current.filter(e=>!T.has(e.id));co(E),lo(E,h.current,T),uo(m.current,h.current,y,s),T.clear();for(let e of h.current)T.add(e.primaryId),T.add(e.secondaryId);for(let e of h.current){let t=e.pose??oo(e),r=Math.min(.9,.55+t.absorb*.2);wo(n,t.ax,t.ay,t.ar,t.bx,t.by,t.br,p,u,d,r)}let O=[...m.current].sort((e,t)=>t.y-e.y);for(let e of O)T.has(e.id)||Co(n,e,f,p,u,d)};return P(),()=>{cancelAnimationFrame(i),e.removeEventListener(`pointermove`,k),e.removeEventListener(`pointerenter`,A),e.removeEventListener(`pointerdown`,j),e.removeEventListener(`pointerleave`,O),s(),c()}},[d,u]),(0,l.jsx)(`div`,{ref:s,className:To.bubbleField,style:f,children:(0,l.jsx)(`canvas`,{ref:p,className:To.canvas,style:{width:u,height:d}})})},Do=(e,t,n,r)=>{let i=n-e,a=r-t,o=Math.hypot(i,a)||1,s=i/o,c=a/o;return{toLight:Math.atan2(a,i),lx:s,ly:c,ax:-s,ay:-c}},Oo=(e,t,n,r,i=.36)=>({x:e+r.lx*n*i,y:t+r.ly*n*i}),ko=(e,t,n,r,i=.4)=>({x:e+r.ax*n*i,y:t+r.ay*n*i}),Ao=(e,t,n,r,i,a,o)=>{e.save(),e.translate(t,n),e.rotate(a),e.scale(r,i);let s=e.createRadialGradient(0,0,0,0,0,1);s.addColorStop(0,`rgba(255,255,255,${o})`),s.addColorStop(.12,`rgba(255,255,255,${o*.72})`),s.addColorStop(.28,`rgba(255,255,255,${o*.32})`),s.addColorStop(.48,`rgba(255,255,255,${o*.1})`),s.addColorStop(.68,`rgba(255,255,255,${o*.03})`),s.addColorStop(1,`rgba(255,255,255,0)`),e.fillStyle=s,e.beginPath(),e.arc(0,0,1,0,Math.PI*2),e.fill(),e.restore(),e.save(),e.translate(t,n),e.rotate(a),e.scale(r*1.55,i*1.45);let c=e.createRadialGradient(0,0,0,0,0,1);c.addColorStop(0,`rgba(220,240,255,${o*.22})`),c.addColorStop(.35,`rgba(220,240,255,${o*.08})`),c.addColorStop(1,`rgba(220,240,255,0)`),e.fillStyle=c,e.beginPath(),e.arc(0,0,1,0,Math.PI*2),e.fill(),e.restore()},jo=(e,t,n,r,i,a,o=1)=>{if(r<4)return;let s=r*(.38+a*.18),c=t+i.ax*s,l=n+i.ay*s,u=r*(.9+a*.2),d=r*(.34+a*.08);e.save(),e.translate(c,l),e.rotate(i.toLight),e.globalAlpha=o*(.14+a*.1);let f=e.createRadialGradient(0,0,0,0,0,1);f.addColorStop(0,`rgba(4,10,18,0.38)`),f.addColorStop(.5,`rgba(4,10,18,0.16)`),f.addColorStop(.78,`rgba(4,10,18,0.05)`),f.addColorStop(1,`rgba(4,10,18,0)`),e.fillStyle=f,e.scale(u,d),e.beginPath(),e.arc(0,0,1,0,Math.PI*2),e.fill(),e.restore()},Mo=(e,t,n,r,i,a,o)=>{let{shadeAmt:s,hash01:c,seed:l}=o,u=e.createRadialGradient(0,0,t*.08,0,0,t);u.addColorStop(0,`rgba(220,240,255,0.09)`),u.addColorStop(.55,`rgba(190,220,245,0.06)`),u.addColorStop(.82,`rgba(110,150,185,0.09)`),u.addColorStop(1,`rgba(200,225,248,0.14)`),e.fillStyle=u,e.beginPath(),e.arc(0,0,t,0,Math.PI*2),e.fill();let d=e.createRadialGradient(n,r,0,n*.35,r*.35,t*1.05);d.addColorStop(0,`rgba(255,255,255,${.26+c(l+15)*.12})`),d.addColorStop(.35,`rgba(245,252,255,0.14)`),d.addColorStop(.65,`rgba(210,235,255,0.04)`),d.addColorStop(1,`rgba(255,255,255,0)`),e.fillStyle=d,e.beginPath(),e.arc(0,0,t,0,Math.PI*2),e.fill();let f=e.createRadialGradient(i,a,0,i*.5,a*.5,t*1.02);f.addColorStop(0,`rgba(8,25,40,${.16+s*.38})`),f.addColorStop(.45,`rgba(8,25,40,${.08+s*.2})`),f.addColorStop(.75,`rgba(8,25,40,${s*.08})`),f.addColorStop(1,`rgba(8,25,40,0)`),e.fillStyle=f,e.beginPath(),e.arc(0,0,t,0,Math.PI*2),e.fill()},No=(e,t,n,r,i,a)=>{let o=e.createRadialGradient(n,r,t*.74,n,r,t*1.02);o.addColorStop(0,`rgba(255,255,255,0)`),o.addColorStop(.86,`rgba(255,255,255,0)`),o.addColorStop(.93,`rgba(235,248,255,${.12+i*.14})`),o.addColorStop(.98,`rgba(255,255,255,${.24+i*.26})`),e.fillStyle=o,a?e.fill(a):(e.beginPath(),e.arc(n,r,t,0,Math.PI*2),e.fill())},Po=(e,t,n,r)=>{let{rimPeak:i,specBright:a,hash01:o,seed:s}=r,c=Math.cos(n),l=Math.sin(n),u=c*t*.36,d=l*t*.36;Mo(e,t,u,d,-c*t*.38,-l*t*.38,r),e.save(),e.beginPath(),e.arc(0,0,t*.998,0,Math.PI*2),e.clip(),Ao(e,u,d,t*(.2+o(s+5.2)*.06),t*(.11+o(s+7.8)*.04),n-.3,a*.58),o(s+10.1)>.3&&Ao(e,c*t*.26,l*t*.26,t*.09,t*.05,n-.15,.12+o(s+28.4)*.14),e.restore(),No(e,t,0,0,i)},Fo=(e,t)=>.35+.65*Math.max(0,Math.cos(e-t)),Io=(e,t,n,r,i,a,o)=>{let{shadeAmt:s,rimPeak:c,specBright:l,hash01:u,seed:d}=o,f=Oo(n,r,i,a,.36),p=ko(n,r,i,a,.4),m=i*1.25,h=e.createRadialGradient(f.x,f.y,0,f.x,f.y,m);h.addColorStop(0,`rgba(255,255,255,${.2+u(d+15)*.1})`),h.addColorStop(.2,`rgba(220,240,255,0.1)`),h.addColorStop(.42,`rgba(190,220,245,0.05)`),h.addColorStop(.62,`rgba(130,165,190,0.04)`),h.addColorStop(.82,`rgba(50,80,105,${.06+s*.35})`),h.addColorStop(1,`rgba(25,45,60,${.08+s*.3})`),e.fillStyle=h,e.fill(t),e.save(),e.clip(t);let g=e.createRadialGradient(p.x,p.y,0,p.x,p.y,m*.92);g.addColorStop(0,`rgba(8,25,40,${.14+s*.32})`),g.addColorStop(.45,`rgba(8,25,40,${.06+s*.18})`),g.addColorStop(1,`rgba(8,25,40,0)`),e.fillStyle=g,e.fillRect(n-m,r-m,m*2,m*2);let _=i*(.2+u(d+5.2)*.06),v=i*(.11+u(d+7.8)*.04);Ao(e,f.x,f.y,_,v,a.toLight-.3,l*.55),e.restore(),No(e,i,n,r,c,t)},Lo=Math.PI*2,Ro=e=>{let t=Math.sin(e*127.1+311.7)*43758.5453;return t-Math.floor(t)},X=(e=0,t=1)=>e+Math.random()*(t-e),zo=(e,t=1)=>(.82+e*.18)*t,Bo=(e,t)=>({shadeOpts:{seed:e,depth:t,shadeAmt:.06+Ro(e+2.3)*.08,rimPeak:.36+Ro(e+3.1)*.28,specBright:.68+Ro(e+9.2)*.28,hash01:Ro},filmBias:Ro(e+11.6),envAmt:.06+Ro(e+13.3)*.09,envRgb:Ro(e+23)>.5?[35,70,55]:[40,65,95]}),Vo=e=>{let t=(e%1+1)%1,n=[[55,58,72],[200,150,55],[230,60,150],[30,185,230],[55,210,120],[235,195,70],[170,85,210],[55,58,72]],r=t*(n.length-1),i=Math.floor(r),a=r-i,o=n[i],s=n[Math.min(i+1,n.length-1)];return[Math.round(o[0]+(s[0]-o[0])*a),Math.round(o[1]+(s[1]-o[1])*a),Math.round(o[2]+(s[2]-o[2])*a)]},Ho=(e,t)=>{let[n,r,i]=Vo(e);return`rgba(${n},${r},${i},${t})`},Uo=(e,t,n,r,i,a,o,s)=>{e.save(),e.translate(t,n),e.rotate(a),e.scale(r,i);let c=e.createRadialGradient(0,0,0,0,0,1),[l,u,d]=o;c.addColorStop(0,`rgba(${l},${u},${d},${s})`),c.addColorStop(.22,`rgba(${l},${u},${d},${s*.62})`),c.addColorStop(.48,`rgba(${l},${u},${d},${s*.28})`),c.addColorStop(.72,`rgba(${l},${u},${d},${s*.08})`),c.addColorStop(1,`rgba(${l},${u},${d},0)`),e.fillStyle=c,e.beginPath(),e.arc(0,0,1,0,Lo),e.fill(),e.restore()},Wo=(e,t,n,r,i,a,o=1)=>{let s=t.seed;e.globalCompositeOperation=`lighter`;let c=7+Math.floor(Ro(s+16.2)*5);for(let l=0;l<c;l++){let c=t.phase*.7+l*(.55+Ro(s+l*3.1)*.35)+i*(.14+l%3*.04)+s*.01,u=Vo(a*.35+.12+.55*(.5+.5*Math.sin(s*.3+l*1.1+i*.32))+.22*Math.sin(c*1.4+i*.2)),d=n*(.38+Ro(s+l*2.7)*.4),f=Math.cos(c)*d,p=Math.sin(c)*d*(.85+Ro(s+l)*.2),m=n*(.22+Ro(s+l*4.1)*.22),h=(.2+t.depth*.18)*(.55+Ro(s+l*5.3)*.45)*Fo(c,r)*o;Uo(e,f,p,m,m*(.55+Ro(s+l*6)*.4),c*.4,u,h)}let l=6+Math.floor(Ro(s+17.5)*4);for(let c=0;c<l;c++){let u=t.phase+c/l*Lo+i*(.1+Ro(s+18)*.12)+a,d=Vo(a+.2+.6*(.5+.5*Math.sin(c*1.9+s+i*.45)));Uo(e,Math.cos(u)*n*.82,Math.sin(u)*n*.82,n*(.16+Ro(s+c*1.3)*.12),n*(.1+Ro(s+c*2.1)*.1),u+Math.PI/2,d,(.22+t.depth*.16+Ro(s+c)*.09)*Fo(u,r)*o)}e.globalCompositeOperation=`source-over`},Go=Math.PI*2,Ko=56,qo=e=>e<.5?2*e*e:1-(-2*e+2)**2/2,Jo=e=>1-(1-e)**3,Yo=(e,t,n)=>{let r=Math.min(1,Math.max(0,(n-e)/(t-e)));return r*r*(3-2*r)},Xo=.82,Zo=.08,Qo=(e,t)=>({x:e*Xo,y:t*Zo}),$o=e=>{let t=new Set;for(let n of e)t.add(n.primaryId),t.add(n.secondaryId);return t},es=e=>{let t=e.progress,n=qo(Yo(0,.72,t)),r=Jo(Yo(.28,1,t)),i=e.startSecondaryX-e.startPrimaryX,a=e.startSecondaryY-e.startPrimaryY,o=Math.hypot(i,a)||1,s=i/o,c=a/o,l=e.startPrimaryRadius,u=e.startSecondaryRadius,d=e.initialSep,f=d*(1-n),p=e.startPrimaryX+s*(d-f)*(u/(l+u)),m=e.startPrimaryY+c*(d-f)*(u/(l+u)),h=p+s*f,g=m+c*f,_=l+(e.targetRadius-l)*Jo(Yo(.38,1,r)),v=Jo(Yo(.4,.98,r));return{ax:p,ay:m,ar:_,bx:h+(p-h)*v,by:g+(m-g)*v,br:r>=.995?0:u*(1-r)**1.6*(1-v*.35),approach:n,absorb:r}},ts=(e,t,n,r,i,a,o,s)=>{let c=(e-n)*(e-n)+(t-r)*(t-r)+.35,l=(e-a)*(e-a)+(t-o)*(t-o)+.35;return i*i/c+s*s/l},ns=(e,t,n,r,i,a,o,s,c)=>{let l=Math.cos(e),u=Math.sin(e),d=Math.hypot(t-s,n-c)+Math.hypot(i-s,a-c)+r+o+8,f=0,p=d;for(let e=0;e<14;e++){let e=(f+p)*.5;ts(s+l*e,c+u*e,t,n,r,i,a,o)>=1?f=e:p=e}let m=(f+p)*.5;return{x:s+l*m,y:c+u*m}},rs=(e,t,n,r,i,a)=>{let o=n+a||1,s=(e*n+r*a)/o,c=(t*n+i*a)/o;if(a<.5||Math.hypot(r-e,i-t)<1.5){let e=new Path2D;return e.arc(s,c,n,0,Go),{path:e,cx:s,cy:c,radius:n}}let l=new Path2D;for(let o=0;o<=Ko;o++){let u=ns(Go*o/Ko,e,t,n,r,i,a,s,c);o===0?l.moveTo(u.x,u.y):l.lineTo(u.x,u.y)}return l.closePath(),{path:l,cx:s,cy:c,radius:Math.hypot(e-s,t-c)+Math.hypot(r-s,i-c)+Math.max(n,a)}},is=e=>1-Yo(0,.18,e),as=e=>Yo(.76,.96,e),os=(e,t,n,r,i,a,o,s,c=1)=>{let l=i+Math.PI+(Ro(a+19.2)-.5)*.3,u=.32+Ro(a+20.1)*.2;Uo(e,t+Math.cos(l)*r*u*c,n+Math.sin(l)*r*u*c,r*(.4+Ro(a+21)*.25)*c,r*(.28+Ro(a+22)*.18)*c,l,s,o)},ss=(e,t,n,r,i,a)=>{let o=Math.sin(n*1.8*t.wobble+t.phase),s=1+o*.05,c=1-o*.045,l=zo(t.depth,a?.alphaScale??1),u=Do(t.x,t.y,r,i),{shadeOpts:d,filmBias:f,envAmt:p,envRgb:m}=Bo(t.seed,t.depth);a?.skipShadow||jo(e,t.x,t.y,t.r,u,t.depth,l),e.save(),e.translate(t.x,t.y),e.globalAlpha=l,e.scale(s,c);let h=t.r;Po(e,h,u.toLight,d),e.save(),e.beginPath(),e.arc(0,0,h*.995,0,Lo),e.clip(),Wo(e,t,h,u.toLight,n,f),e.restore(),os(e,0,0,h,u.toLight,t.seed,p,m),e.restore()},cs=(e,t,n,r,i,a,o,s,c)=>{let{ax:l,ay:u,ar:d,bx:f,by:p,br:m,absorb:h}=t,g=Math.max(1,d+m),_=(l*d+f*m)/g,v=(u*d+p*m)/g,y=is(a),b=as(h),x=(1-y)*(1-b);if(y>.02&&i&&(ss(e,{...r,x:l,y:u,r:d},n,o,s,{skipShadow:!0,alphaScale:y}),ss(e,{...i,x:f,y:p,r:m},n,o,s,{skipShadow:!0,alphaScale:y})),b>.02&&ss(e,{...r,x:_,y:v,r:d},n,o,s,{skipShadow:!0,alphaScale:b}),x<.02)return;let S=rs(l,u,d,f,p,m),{shadeOpts:C,filmBias:w,envAmt:T,envRgb:E}=Bo(r.seed,r.depth),D=Do(S.cx,S.cy,o,s),O=zo(r.depth,x),k=S.radius;c?.skipShadow||jo(e,S.cx,S.cy,k*.85,D,r.depth,O),e.save(),e.globalAlpha=O,Io(e,S.path,S.cx,S.cy,k,D,C),e.save(),e.clip(S.path),e.translate(S.cx,S.cy),Wo(e,r,k,D.toLight,n,w,x),e.translate(-S.cx,-S.cy);let A=D.toLight+Math.PI+(Ro(r.seed+19.2)-.5)*.3;Uo(e,S.cx+Math.cos(A)*k*.28,S.cy+Math.sin(A)*k*.28,k*.34,k*.24,A,E,T*x),e.restore(),e.restore()},ls=(e,t,n,r,i,a,o)=>{let s=Math.max(1,n.ar+n.br),c=(n.ax*n.ar+n.bx*n.br)/s,l=(n.ay*n.ar+n.by*n.br)/s,u=is(t.progress),d=as(n.absorb),f=zo(r.depth),p=(1-u)*(1-d);if(u>.02&&i){let t=Do(n.ax,n.ay,a,o),s=Do(n.bx,n.by,a,o);jo(e,n.ax,n.ay,n.ar,t,r.depth,f*u),jo(e,n.bx,n.by,n.br,s,i.depth,f*u)}if(d>.02){let t=Do(c,l,a,o);jo(e,c,l,n.ar,t,r.depth,f*d)}if(p>.02){let t=rs(n.ax,n.ay,n.ar,n.bx,n.by,n.br),i=Do(t.cx,t.cy,a,o);jo(e,t.cx,t.cy,t.radius*.85,i,r.depth,f*p)}},us=(e,t)=>{let n=t.pop;if(e.save(),e.translate(t.x,t.y),n<.55){let r=1-Math.min(1,n/.35),i=Math.PI*r,a=t.popAng+Math.PI,o=t.r*(1-n*.15);e.globalAlpha=.55*r,e.beginPath(),e.arc(0,0,o,a-i,a+i),e.strokeStyle=Ho(.4+n,.5),e.lineWidth=Math.max(1.2,t.r*.035),e.stroke();let s=10+Math.floor(t.r/4);for(let n=0;n<s;n++){let c=n/Math.max(1,s-1),l=a-i+c*i*2,u=1.2+(1-Math.abs(c-.5)*2)*t.r*.04;e.beginPath(),e.arc(Math.cos(l)*o,Math.sin(l)*o,u,0,Lo),e.fillStyle=`rgba(230,245,255,${.45*r})`,e.fill()}}if(n<.2){let r=1-n/.2;e.globalAlpha=r*.35,e.beginPath(),e.arc(Math.cos(t.popAng)*t.r*.7,Math.sin(t.popAng)*t.r*.7,t.r*.15*r,0,Lo),e.fillStyle=`rgba(255,255,255,0.8)`,e.fill()}e.restore()},ds=(e,t)=>{let n=_(t.life/t.maxLife,0,1);e.save(),e.globalAlpha=n*(t.kind===0?.45:.75);let r=e.createRadialGradient(t.x-t.r*.3,t.y-t.r*.3,0,t.x,t.y,t.r);r.addColorStop(0,`rgba(255,255,255,0.9)`),r.addColorStop(.45,`rgba(210,235,255,0.55)`),r.addColorStop(1,`rgba(160,200,230,0.05)`),e.fillStyle=r,e.beginPath(),e.arc(t.x,t.y,t.r,0,Lo),e.fill(),e.restore()},fs=Math.PI*2,ps=(e,t,n)=>{let r=e.createLinearGradient(0,0,0,n);r.addColorStop(0,`#0a3d91`),r.addColorStop(.28,`#0d47a1`),r.addColorStop(.52,`#1565c0`),r.addColorStop(.72,`#1e78c8`),r.addColorStop(.88,`#3d93d4`),r.addColorStop(1,`#5eaae0`),e.fillStyle=r,e.fillRect(0,0,t,n);let i=e.createRadialGradient(t*.5,n*.04,0,t*.5,n*.18,n*.82);i.addColorStop(0,`rgba(7,40,120,0.32)`),i.addColorStop(.45,`rgba(13,71,161,0.1)`),i.addColorStop(1,`rgba(13,71,161,0)`),e.fillStyle=i,e.fillRect(0,0,t,n)},ms=(e,t,n,r)=>{let i=r*.19,a=e.createRadialGradient(t,n,0,t,n,i);a.addColorStop(0,`rgba(255,252,240,0.18)`),a.addColorStop(.4,`rgba(255,244,220,0.06)`),a.addColorStop(1,`rgba(255,230,190,0)`),e.fillStyle=a,e.beginPath(),e.arc(t,n,i,0,fs),e.fill();let o=e.createRadialGradient(t,n,0,t,n,r*.045);o.addColorStop(0,`rgba(255,255,252,0.62)`),o.addColorStop(.55,`rgba(255,248,230,0.2)`),o.addColorStop(1,`rgba(255,240,210,0)`),e.fillStyle=o,e.beginPath(),e.arc(t,n,r*.045,0,fs),e.fill()},hs=(e,t,n)=>{ps(e,t,n);let r=t*Xo,i=n*Zo;ms(e,r,i,t);let a=e.createLinearGradient(0,n*.75,0,n);a.addColorStop(0,`rgba(255,255,255,0)`),a.addColorStop(.65,`rgba(240,248,255,0.04)`),a.addColorStop(1,`rgba(230,245,255,0.08)`),e.fillStyle=a,e.fillRect(0,n*.75,t,n*.25);let o=e.createRadialGradient(r,i,0,r,i,t*.4);o.addColorStop(0,`rgba(255,252,245,0.022)`),o.addColorStop(.45,`rgba(255,246,232,0.006)`),o.addColorStop(1,`rgba(255,255,255,0)`),e.fillStyle=o,e.fillRect(0,0,t,n)},gs={soapBubbles:`cos-soapBubbles-QqL-3`,canvas:`cos-canvas-TmLIq`},_s=(e,t,n,r=!0)=>{let i=X(.25,1),a=(10+X()*46)*(.5+i*.75),o=X(12,55)*(.35+i*.8);return{id:n,x:X(a,Math.max(a+1,e-a)),y:r?t+a+X(0,t*.4):X(a,t-a),r:a,vx:X(-22,22),vy:-o*X(.5,1.2),phase:X(0,Lo),wobble:X(.55,1.35),seed:X(0,1e3),depth:i,pop:0,popAng:0,rise:o,gust:X(.55,1.35),gustT:X(.3,1.8),drift:X(-28,28),swayT:X(.4,2.2),coolT:r?X(.15,.55):X(.4,1.1)}},vs=({width:e,height:t,fill:n=!1,count:r=28,speed:i=1,interactive:a=!0,ariaLabel:o=`肥皂泡背景`})=>{let{hostRef:s,width:u,height:d,hostStyle:f}=E({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),p=(0,c.useRef)(null),m=(0,c.useRef)({count:r,speed:i,interactive:a}),h=(0,c.useRef)(null);return(0,c.useEffect)(()=>{m.current={count:r,speed:i,interactive:a}},[r,a,i]),(0,c.useEffect)(()=>{let e=p.current;if(!e)return;let t=t=>{if(!m.current.interactive||t.pointerType===`mouse`&&t.button!==0)return;let n=e.getBoundingClientRect();h.current={x:(t.clientX-n.left)/Math.max(n.width,1)*u,y:(t.clientY-n.top)/Math.max(n.height,1)*d}};return e.addEventListener(`pointerdown`,t),()=>e.removeEventListener(`pointerdown`,t)},[d,u]),(0,c.useEffect)(()=>{let e=p.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;let n=Math.min(window.devicePixelRatio||1,2);e.width=Math.floor(u*n),e.height=Math.floor(d*n),t.setTransform(n,0,0,n,0,0);let i=[],a=[],o=[],s=1,c=()=>s++,l=_(Math.round(r),8,80);for(let e=0;e<l;e++)i.push(_s(u,d,c(),e>l*.35));let f=e=>i.find(t=>t.id===e),g=0,v=0,S=0,C=document.hidden,w=b(),T=y(e=>{C=e}),E=x(e=>{w=e}),D=(e,t,n)=>{if(e.pop>0)return;e.pop=.001,e.popAng=Math.atan2(n-e.y,t-e.x);let r=14+Math.floor(e.r/3);for(let t=0;t<r;t++){let n=e.popAng+Math.PI+(t/r*2-1)*Math.PI*.85,i=X(30,90);a.push({x:e.x+Math.cos(n)*e.r*.95,y:e.y+Math.sin(n)*e.r*.95,vx:Math.cos(n)*i*.35+X(-20,20),vy:Math.sin(n)*i*.35+X(-10,30),r:X(1.4,3.2)*(.55+e.depth*.5),life:.45+X()*.35,maxLife:.8,kind:1})}let i=28+Math.floor(e.r*.9);for(let t=0;t<i;t++){let t=X(0,Lo),n=X(20,160);a.push({x:e.x+Math.cos(t)*e.r*X(.2,.9),y:e.y+Math.sin(t)*e.r*X(.2,.9),vx:Math.cos(t)*n,vy:Math.sin(t)*n-X(10,80),r:X(.6,1.8)*(.5+e.depth*.4),life:.25+X()*.4,maxLife:.65,kind:0})}},O=e=>{if(g=requestAnimationFrame(O),C)return;v||=e;let n=_((e-v)/1e3,.008,.033);v=e;let r=m.current.speed;hs(t,u,d);let{x:s,y:l}=Qo(u,d);if(w){for(let e of i)e.pop<=0&&ss(t,e,S,s,l,{skipShadow:!0});return}if(S+=n*r,h.current){let e=h.current;h.current=null;let t=null,n=1/0;for(let r of i){if(r.pop>0||o.some(e=>e.primaryId===r.id||e.secondaryId===r.id))continue;let i=Math.hypot(r.x-e.x,r.y-e.y);i<r.r*1.2&&i<n&&(n=i,t=r)}t&&D(t,e.x,e.y)}let p=_(Math.round(m.current.count),8,80);for(;i.length<p;)i.push(_s(u,d,c(),!0));let y=$o(o);for(let e of i){if(y.has(e.id))continue;if(e.coolT>0&&(e.coolT=Math.max(0,e.coolT-n*r)),e.pop>0){if(e.pop>=1){Object.assign(e,_s(u,d,c(),!0));continue}e.pop=Math.min(1,e.pop+n*r*2.6);continue}if(e.phase+=n*r*e.wobble,e.gustT-=n*r,e.gustT<=0){let t=Math.random();t<.18?e.gust=X(.12,.4):t<.3?e.gust=X(1.6,2.4):e.gust=X(.55,1.35),e.gustT=X(.35,2.4)}e.swayT-=n*r,e.swayT<=0&&(e.drift=X(-36,36)*(.4+Math.random()),Math.random()<.2&&(e.drift*=X(1.4,2.2)),e.swayT=X(.45,2.6));let t=Math.sin(e.phase*1.7+e.seed)*4+Math.cos(e.phase*.9)*3,i=e.drift+t,a=-e.rise*e.gust+Math.sin(e.phase*2.1+e.seed*.2)*6,o=1-Math.exp(-n*r*1.6);e.vx+=(i-e.vx)*o,e.vy+=(a-e.vy)*o,Math.random()<n*.35&&(e.vx+=X(-18,18)),e.x+=e.vx*n*r,e.y+=e.vy*n*r,e.x<-e.r&&(e.x=u+e.r),e.x>u+e.r&&(e.x=-e.r),e.y+e.r<0&&Object.assign(e,_s(u,d,c(),!0))}for(let e=0;e<i.length;e++){let t=i[e];if(!(t.pop>0||y.has(t.id)||t.coolT>0))for(let a=e+1;a<i.length;a++){let e=i[a];if(e.pop>0||y.has(e.id)||e.coolT>0)continue;let o=e.x-t.x,s=e.y-t.y,c=Math.hypot(o,s)||1,l=c-(t.r+e.r),u=Math.min(14,(t.r+e.r)*.18);if(l>u||l<-1)continue;let d=(1-Math.max(0,l)/u)*18*n*r,f=o/c,p=s/c;t.vx+=f*d,t.vy+=p*d*.55,e.vx-=f*d,e.vy-=p*d*.55}}for(let e=0;e<i.length;e++){let t=i[e];if(!(t.pop>0||t.coolT>0||y.has(t.id)))for(let n=e+1;n<i.length;n++){let e=i[n];if(e.pop>0||e.coolT>0||y.has(e.id))continue;let r=e.x-t.x,a=e.y-t.y,s=Math.hypot(r,a);if(s>=t.r+e.r-Math.min(t.r,e.r)*.1||s<.5)continue;let c=t.x+r*t.r/(t.r+e.r),l=t.y+a*t.r/(t.r+e.r);if(Math.random()<.3)D(t,c,l),D(e,c,l);else{let n=t.r>=e.r?t:e,r=t.r>=e.r?e:t,i=Math.min(72,Math.cbrt(n.r**3+r.r**3)),a=Math.max(.5,Math.hypot(r.x-n.x,r.y-n.y));o.push({primaryId:n.id,secondaryId:r.id,progress:0,initialSep:a,targetRadius:i,startPrimaryRadius:n.r,startSecondaryRadius:r.r,startPrimaryX:n.x,startPrimaryY:n.y,startSecondaryX:r.x,startSecondaryY:r.y,sharedVx:(n.vx+r.vx)*.5,sharedVy:(n.vy+r.vy)*.5,depth:Math.max(n.depth,r.depth),seed:n.seed}),y.add(n.id),y.add(r.id)}}}for(let e=o.length-1;e>=0;e--){let t=o[e],a=f(t.primaryId),s=f(t.secondaryId);if(!a||!s){o.splice(e,1);continue}t.progress=Math.min(1,t.progress+n*r*.92);let c=(a.vx+s.vx)*.5,l=(a.vy+s.vy)*.5;t.sharedVx=c,t.sharedVy=l;let u=n*r;t.startPrimaryX+=c*u,t.startPrimaryY+=l*u,t.startSecondaryX+=c*u,t.startSecondaryY+=l*u;let d=es(t);t.pose=d;let p=Math.max(1,d.ar+d.br),m=(d.ax*d.ar+d.bx*d.br)/p,h=(d.ay*d.ar+d.by*d.br)/p,g=Math.min(1,d.approach*.35+d.absorb*.65);if(a.x=d.ax+(m-d.ax)*g,a.y=d.ay+(h-d.ay)*g,a.r=d.ar,s.x=d.bx,s.y=d.by,s.r=d.br,a.vx=c,a.vy=l,s.vx=c,s.vy=l,t.progress>=1){let n=Math.max(1,d.ar+d.br);a.x=(d.ax*d.ar+d.bx*d.br)/n,a.y=(d.ay*d.ar+d.by*d.br)/n,a.r=t.targetRadius,a.depth=t.depth,a.rise=(a.rise+s.rise)*.5*.9,a.gust=(a.gust+s.gust)*.5,a.drift=(a.drift+s.drift)*.5,a.coolT=.35;let r=i.findIndex(e=>e.id===s.id);r>=0&&i.splice(r,1),o.splice(e,1)}}for(;i.length<p;)i.push(_s(u,d,c(),!0));if(i.length>p)for(let e=i.length-1;e>=0&&i.length>p;e--)!y.has(i[e].id)&&i[e].pop<=0&&i.splice(e,1);let b=$o(o),x=i.map((e,t)=>t).filter(e=>!b.has(i[e].id)).sort((e,t)=>i[e].depth-i[t].depth);for(let e of x){let n=i[e];if(n.pop>0)continue;let r=Do(n.x,n.y,s,l);jo(t,n.x,n.y,n.r,r,n.depth,.82+n.depth*.18)}for(let e of o){let n=e.pose??es(e),r=f(e.primaryId),i=f(e.secondaryId);r&&ls(t,e,n,r,i,s,l)}for(let e of x){let n=i[e];if(n.pop>0){n.pop<.22&&(t.save(),t.globalAlpha=1-n.pop/.22,ss(t,n,S,s,l,{skipShadow:!0}),t.restore()),us(t,n);continue}ss(t,n,S,s,l,{skipShadow:!0})}for(let e of o){let n=e.pose??es(e),r=f(e.primaryId),i=f(e.secondaryId);r&&cs(t,n,S,r,i,e.progress,s,l,{skipShadow:!0})}for(let e=a.length-1;e>=0;e--){let r=a[e];if(r.vy+=(r.kind===0?180:260)*n,r.vx*=Math.exp(-n*(r.kind===0?1.8:1.1)),r.x+=r.vx*n,r.y+=r.vy*n,r.life-=n*(r.kind===0?1.5:1.15),r.life<=0){a.splice(e,1);continue}ds(t,r)}};return O(0),()=>{cancelAnimationFrame(g),T(),E()}},[r,d,u]),(0,l.jsx)(`div`,{ref:s,className:gs.soapBubbles,style:f,role:`img`,"aria-label":o,children:(0,l.jsx)(`canvas`,{ref:p,className:gs.canvas,style:{width:u,height:d}})})},ys={WITHER:3.8,SPROUT:2.6,FLOWER:4.8,PUFFING:5.5},bs=1.05,xs=.05,Ss=.46,Cs=.54,ws=.82,Ts=.56,Es=.9,Ds=.2,Os=.06,ks=.14,As=.32,js=.38,Ms=.034,Ns=2.4,Ps=10.5,Fs=4.6,Is=6.5,Ls=.38,Rs=.46,zs=13.5,Bs=5.4,Vs=7.8,Hs=.038,Us=.32,Ws=Math.PI*(3-Math.sqrt(5)),Gs=.4,Ks=22*Math.PI/180,qs=.42,Js=.18,Ys=.58,Z=e=>{let t=Math.sin(e*127.1)*43758.5453;return t-Math.floor(t)},Xs=e=>1-(1-_(e,0,1))**3,Zs=e=>_(e,0,1)<.5?4*e*e*e:1-(-2*e+2)**3/2,Qs=(e,t,n)=>{let r=_((n-e)/Math.max(t-e,1e-4),0,1);return r*r*(3-2*r)},$s=(e,t)=>Math.tanh(e*t),Q=(e,t,n)=>e+(t-e)*n,ec=e=>_(e/14,0,1),tc=e=>_(Math.hypot(e.x,e.y)/4.2,0,1),nc=(e,t)=>_((e-t*.66)/Math.max(t*.28,1),.08,.96),rc=(e,t,n)=>n*(.66+t*.24+(Z(e*.031+t*7.1)-.5)*.035),ic=(e=0,t=0)=>({phase:`sprout`,phaseTime:t,grow:0,puffReveal:0,stemLenRatio:e,leafScale:e>0?.08+e*.92:.08,fade:e>0?Math.min(1,e*1.35):0,wilt:0,stemBrown:0}),ac=()=>({phase:`mature`,phaseTime:0,grow:bs,puffReveal:1,stemLenRatio:1,leafScale:1,fade:1,wilt:0,stemBrown:0}),oc=()=>1+Math.random()*4,sc=e=>3+Z(e*5.1)*2,cc=(e,t,n,r)=>Dc(e,t,n,r).map((t,n)=>({at:n===0?0:n/Math.max(e-1,1)*3+(Math.random()-.5)*.28,layout:t,spawned:!1})).sort((e,t)=>e.at-t.at),lc=(e,t,n)=>{let r=1-e/Math.max(t-1,1)*2,i=Math.sqrt(Math.max(0,1-r*r)),a=Ws*e;return{lx:Math.cos(a)*i*n,ly:r*n*.52,lz:Math.sin(a)*i*n*.38}},uc=e=>.58+e.depth*.42,dc=()=>1,fc=e=>{let t=_(e,0,1);return{budSize:0,budOpen:0,bloom:0,wilt:0,receptacle:1-Qs(.5,.95,t)*.32,puff:t,glow:Qs(.08,.42,t)*(1-Qs(.82,1,t)*.45)}},pc=(e,t,n)=>{let r=_(t/.94,0,1),i=Math.max(e.radius*.52,1),a=_(Math.hypot(n.lx,n.ly)/i,0,1),o=Z(n.hairPhase*2.7+n.lx*.03)*.022;if(a<.22)return{reveal:_(r/.045,0,1),expand:_((r-.008)/.065,0,1),fluffLen:_((r-.012)/.08,0,1)};let s=a*.28+o,c=.07+a*.3;return{reveal:Qs(s,s+c,r),expand:Qs(s+.006,s+c+.028,r),fluffLen:Qs(s+.012,s+c+.04,r)}},mc=e=>{let t=_(e.stemLen/Math.max(e.stem,.001),0,1);if(e.phase===`sprout`){let e=Zs(t);return{budSize:Qs(.04,.9,e),budOpen:0,bloom:Qs(.78,.97,e)*.08,wilt:0,receptacle:0,puff:0,glow:0}}if(e.phase===`flower`){let t=e.phaseTime/ys.FLOWER,n=Qs(xs,Ss,t),r=Qs(Cs,ws,t),i=Qs(Ts,Es,t),a=Qs(.02,.38,n)*(1-Qs(.55,.88,n)),o=n*(1-r)*Qs(.42,.72,n),s=r>=.7?_(e.puffReveal,0,1):0;return{budSize:1-n*.18,budOpen:a,bloom:n,wilt:r,receptacle:i,puff:s,glow:o}}return e.phase===`puffing`?fc(e.puffReveal):e.phase===`mature`?fc(1):{budSize:0,budOpen:0,bloom:0,wilt:0,receptacle:0,puff:0,glow:0}},hc=(e,t)=>Math.imul(e,7919)^Math.imul(Math.round(t*127.1),104729),gc=e=>{let t=.24+Z(e+23.1)*.42,n=.09+Z(e+51.2)*.24;return{stemBendX:(Z(e+37.9)-.5)*t*2.5,stemBendY:(Z(e+41.7)-.5)*t*1.55,stemBend2X:(Z(e+63.4)-.5)*n*2.6,stemBend2Y:(Z(e+67.2)-.5)*n*1.35}},_c=()=>gc(Math.floor(Math.random()*2147483647)),vc=e=>{let t=Xs(e.stemLen/Math.max(e.stem,.001));if(e.phase===`sprout`)return t;if(e.phase===`flower`){let n=mc(e).bloom;return t+(1-t)*Qs(0,.55,n)*.85}return 1},yc=(e,t,n)=>{let r=(e.stemBendX+e.stemBend2X*.42+e.lean*.1)*t*n,i=t*Math.tan(Ks);return _(r*.32,-i,i)},bc=(e,t,n,r)=>{let i=t.x*(1.28+Z(e.id*5.1)*.88)+n*.2,a=t.y*(.58+Z(e.id*7.3)*.32);e.swayVel+=((i-e.sway)*Ps-e.swayVel*Fs)*r,e.sway+=e.swayVel*r,e.sway=_(e.sway,-4.2,4.2),e.liftVel+=((a-e.windLift)*Is-e.liftVel*Fs)*r,e.windLift+=e.liftVel*r,e.windLift=_(e.windLift,-1.6,1.6)},xc=(e,t,n,r,i,a,o)=>{let s=Math.max(o*.52,1),c=_(Math.hypot(e.lx,e.ly)/s,0,1),l=tc(n),u=a?1:.32,d=3.8+c*7.5,f=4.6+c*8.2,p=Ls*(.55+c*.65)*u*(.35+l*.65),m=Rs*(.55+c*.65)*u*(.35+l*.65),h=n.x*p+$s(t.sway,.18)*o*.055*u,g=n.y*m+$s(t.windLift,.22)*o*.042*u,v=1-Math.exp(-i*d),y=1-Math.exp(-i*f);e.fluffOx+=(h-e.fluffOx)*v,e.fluffOy+=(g-e.fluffOy)*y;let b=o*(.16+c*.14),x=Math.hypot(e.fluffOx,e.fluffOy);if(x>b){let t=b/x;e.fluffOx*=t,e.fluffOy*=t}let S=(.012+l*.028)*u,C=Math.sin(r*(2.6+e.hairPhase*.25)+e.swayPhase)*S,w=Math.sin(r*(2.35+e.hairPhase*.31)+e.swayPhase*1.18)*S*1.12;return{offX:e.fluffOx+C,offY:e.fluffOy+w,tiltX:e.fluffOx*.42+C*.6,tiltY:e.fluffOy*.42+w*.6}},Sc=e=>{switch(e.phase){case`sprout`:return .45;case`flower`:return .62;default:return 1}},Cc=(e,t)=>{let n=Sc(e)*qs,r=Sc(e)*Js,i=t*Math.tan(Ks)*.66,a=t*.03;return{dx:$s(e.sway,.19)*i*n,dy:$s(e.windLift,.22)*a*r}},wc=e=>{let t=e.stemLen*(1-e.wilt*.12),n=dc(),r=e.x,i=e.ground,a={x:r,y:i},o=t*n,s=yc(e,o,vc(e)),{dx:c,dy:l}=Cc(e,o),u={x:r+s+c,y:i-o+l},d={x:r+c*.04,y:i-o*Gs+l*.03},f={x:r+s*.74+c*.48,y:i-o*.84+l*.12};if(e.phase!==`wither`)return{base:a,cp1:d,cp2:f,head:u};let p=e.wilt,m=s+c+(e.lean+e.stemBendX*.2)*o*.28*p,h=o*.34*p+l;return{base:a,cp1:{x:r+c*.08,y:i-o*Gs*(1-p*.15)+l*.06},cp2:{x:r+m*.62,y:i-o*.78+h*.28},head:{x:r+m,y:i-o+h}}},Tc=(e,t,n,r,i)=>{let a=nc(t,n),o=.82+Z(i+11.7)*.38,s=_(.48+a*.62+(Z(i+5.3)-.5)*.16,.42,1.38)*o,c=n*(.1+Z(i+9.4)*.26+a*.1)*(.68+Z(i+13.2)*.62),l=(8+Z(i+2.8)*16)*s,u=_(Math.round(r*(.55+Z(i+17.5)*.75)*(.75+s*.35)),20,96);return{x:e,ground:t,stem:c,radius:l,lean:(Z(i+41.3)-.5)*.42,...gc(hc(i,e)),depth:a,scale:s,seedQuota:u}},Ec=(e,t,n)=>({id:t,...e,stemLen:e.stem*n.stemLenRatio,sway:0,windLift:0,swayVel:0,liftVel:0,swayPhase:Math.random()*Math.PI*2,swayAmp:.8+Math.random()*1.6,grow:n.grow,phase:n.phase,phaseTime:n.phaseTime,wilt:n.wilt,fade:n.fade,puffReveal:n.puffReveal,leafScale:n.leafScale,stemBrown:n.stemBrown,matureHoldLeft:n.phase===`mature`?oc():-1,releaseDuration:n.phase===`mature`?sc(t):3,releaseElapsed:0,releaseSeedTotal:0,releasing:!1,releaseBoost:0}),Dc=(e,t,n,r)=>{let i=t*.05,a=[],o=t*.085;for(let n=0;n<e*50&&a.length<e;n++){let e=i+Math.random()*(t-i*2),n=_(.08+Math.random()*.92,0,1);a.every(t=>Math.abs(t.x-e)>o*(.65+(1-Math.abs(t.depth-n))*.35))&&a.push({x:e,depth:n})}for(;a.length<e;)a.push({x:i+Math.random()*(t-i*2),depth:Math.random()});return a.map(({x:e,depth:t})=>{let i=.82+Math.random()*.38,a=_(.48+t*.62+(Math.random()-.5)*.16,.42,1.38)*i,o=n*(.66+t*.24+(Math.random()-.5)*.035),s=n*(.1+Math.random()*.26+t*.1)*(.68+Math.random()*.62),c=(8+Math.random()*16)*a,l=_(Math.round(r*(.55+Math.random()*.75)*(.75+a*.35)),20,96);return{x:e,ground:o,stem:s,radius:c,lean:(Math.random()-.5)*.42,..._c(),depth:t,scale:a,seedQuota:l}})},Oc=(e,t)=>{if(t.fade<=.02||t.leafScale<=.02)return;let n=t.fade*uc(t);e.save(),e.globalAlpha=n*.92;let r=5+Math.floor(Z(t.x*3.7)*3);for(let n=0;n<r;n++){let i=n/r*Math.PI*2+Z(n+t.x)*.4,a=(14+Z(n+7)*16)*t.leafScale*t.scale,o=t.wilt*6,s=t.x+Math.cos(i)*a*.55,c=t.ground+Math.sin(i)*a*.18+2+o,l=t.x+Math.cos(i+t.wilt*.35)*a,u=t.ground+Math.sin(i)*a*.35-4+o*1.4,d=e.createLinearGradient(t.x,t.ground,l,u);d.addColorStop(0,`rgba(${Q(82,68,t.stemBrown)|0}, ${Q(58,48,t.stemBrown)|0}, ${Q(36,28,t.stemBrown)|0}, ${.85*t.leafScale})`),d.addColorStop(.6,`rgba(${Q(94,78,t.stemBrown)|0}, ${Q(72,58,t.stemBrown)|0}, ${Q(48,38,t.stemBrown)|0}, ${.72*t.leafScale})`),d.addColorStop(1,`rgba(${Q(108,88,t.stemBrown)|0}, ${Q(86,68,t.stemBrown)|0}, ${Q(56,44,t.stemBrown)|0}, ${.45*t.leafScale})`),e.fillStyle=d,e.beginPath(),e.moveTo(t.x,t.ground),e.quadraticCurveTo(s,c-3,l,u),e.quadraticCurveTo(s+(Z(n)-.5)*4,c+5,t.x,t.ground+2),e.fill(),e.strokeStyle=`rgba(42, 58, 30, ${.35*t.leafScale})`,e.lineWidth=.5,e.beginPath(),e.moveTo(t.x,t.ground),e.quadraticCurveTo((t.x+l)*.5,(t.ground+u)*.5-2,l,u),e.stroke()}e.restore()},kc=(e,t)=>{if(t.fade<=.02||t.stemLen<=.5)return;let{base:n,cp1:r,cp2:i,head:a}=wc(t),o=t.scale;e.save(),e.globalAlpha=t.fade*uc(t),e.lineCap=`round`,e.lineJoin=`round`;let s=t.stemBrown;e.strokeStyle=`rgba(${Q(36,52,s)|0}, ${Q(50,42,s)|0}, ${Q(28,22,s)|0}, 0.35)`,e.lineWidth=3.6*o*(1-s*.25),e.beginPath(),e.moveTo(n.x+.6,n.y),e.bezierCurveTo(r.x+.8,r.y,i.x+.5,i.y+1,a.x+.5,a.y+1),e.stroke();let c=e.createLinearGradient(n.x,n.y,a.x,a.y);c.addColorStop(0,`rgb(${Q(61,98,s)|0} ${Q(82,78,s)|0} ${Q(48,42,s)|0})`),c.addColorStop(.45,`rgb(${Q(90,120,s)|0} ${Q(115,95,s)|0} ${Q(68,58,s)|0})`),c.addColorStop(.85,`rgb(${Q(109,138,s)|0} ${Q(134,110,s)|0} ${Q(82,68,s)|0})`),c.addColorStop(1,`rgb(${Q(122,148,s)|0} ${Q(148,118,s)|0} ${Q(96,78,s)|0})`),e.strokeStyle=c,e.lineWidth=(2.4-s*.6)*o*(.6+t.stemLen/t.stem*.4),e.beginPath(),e.moveTo(n.x,n.y),e.bezierCurveTo(r.x,r.y,i.x,i.y,a.x,a.y),e.stroke(),s<.65&&(e.strokeStyle=`rgba(180, 200, 140, ${.25*(1-s)})`,e.lineWidth=.8,e.beginPath(),e.moveTo(n.x+.4,n.y-2),e.bezierCurveTo(r.x+.3,r.y-1,i.x-.2,i.y-1,a.x-.2,a.y-1),e.stroke()),e.restore()},Ac=(e,t,n,r,i,a,o)=>{let s=Xs(_(i,0,1)),c=_(a,0,1);if(r<=.02||s<=.04)return;e.save();let l=n,u=(2.4+s*3.8)*l,d=(5.5+s*9.5)*l,f=r*(1-Qs(.35,.92,c));for(let n=0;n<13;n++){let r=n/13*Math.PI*2-Math.PI/2+Z(o+n*1.7)*.12,i=Qs(.08,.82,c)*(.58+Z(o+n*2.3)*.2),a=r+i*.55,s=a+i*1.05+.08,p=(.85+Z(n+o)*.45)*l*(1-c*.3),m=t.x+Math.cos(a)*u*.42,h=t.y+Math.sin(a)*u*.18+l*.5,g=t.x+Math.cos(s)*d*.52,_=t.y-d*(.38-i*.12)+Math.sin(s)*d*.08,v=t.x+Math.cos(s)*d*.92,y=t.y-d*(.62-i*.22)+Math.sin(s)*d*.12,b=48+Z(o+n)*22;e.globalAlpha=f*(.82+Z(n)*.14),e.fillStyle=`rgba(${b-10}, ${b+32}, ${b-16}, 0.9)`,e.beginPath(),e.moveTo(m-Math.cos(a+Math.PI/2)*p,h-Math.sin(a+Math.PI/2)*p),e.quadraticCurveTo(g,_,v,y),e.quadraticCurveTo(g,_,m+Math.cos(a+Math.PI/2)*p,h+Math.sin(a+Math.PI/2)*p),e.closePath(),e.fill(),e.strokeStyle=`rgba(28, 48, 24, ${.32*(1-c*.55)})`,e.lineWidth=.32*l,e.beginPath(),e.moveTo(m,h),e.quadraticCurveTo(g,_,v,y),e.stroke()}if(c<.88){let n=r*(1-c*1.1)*.96;e.globalAlpha=n;let i=(2.2+s*3.4)*l*(1-c*.35),a=(4+s*6.5)*l*(1-c*.45),o=t.y-a*.4,u=e.createLinearGradient(t.x,o-a*.55,t.x,o+a*.35);u.addColorStop(0,`rgba(54, 86, 44, 0.95)`),u.addColorStop(.4,`rgba(44, 72, 36, 0.93)`),u.addColorStop(.75,`rgba(58, 90, 48, 0.9)`),u.addColorStop(1,`rgba(68, 102, 54, 0.86)`),e.fillStyle=u,e.beginPath(),e.ellipse(t.x,o,i*.46,a*.5,0,0,Math.PI*2),e.fill();let d=_((c-.04)*2.8+(s-.75)*1.8,0,1);if(d>.03){e.globalAlpha=n*d*.5;let r=e.createRadialGradient(t.x,o-a*.34,0,t.x,o-a*.34,i*.52);r.addColorStop(0,`rgba(255, 214, 52, 0.65)`),r.addColorStop(.55,`rgba(255, 198, 42, 0.22)`),r.addColorStop(1,`rgba(255, 198, 42, 0)`),e.fillStyle=r,e.beginPath(),e.arc(t.x,o-a*.3,i*.38,0,Math.PI*2),e.fill()}}e.restore()},jc=(e,t,n,r,i,a=0)=>{let o=_(i,0,1);if(r<=.01||o<=.01)return;e.save();let s=(2.2+o*1.3)*n*(1+a*.1);e.globalAlpha=r*Qs(0,.2,o)*(.58+a*.24);let c=e.createRadialGradient(t.x-.25*n,t.y-.3*n,0,t.x,t.y,s);c.addColorStop(0,`rgba(148, 118, 76, 0.68)`),c.addColorStop(.42,`rgba(116, 92, 60, 0.48)`),c.addColorStop(.76,`rgba(92, 76, 54, 0.22)`),c.addColorStop(1,`rgba(80, 68, 50, 0)`),e.fillStyle=c,e.beginPath(),e.arc(t.x,t.y,s,0,Math.PI*2),e.fill(),e.restore()},Mc=(e,t,n,r)=>{if(r<=.02)return;let i=14*n,a=e.createRadialGradient(t.x,t.y,0,t.x,t.y,i);a.addColorStop(0,`rgba(255, 232, 80, ${.22*r})`),a.addColorStop(.45,`rgba(255, 220, 60, ${.08*r})`),a.addColorStop(1,`rgba(255, 220, 60, 0)`),e.fillStyle=a,e.beginPath(),e.arc(t.x,t.y,i,0,Math.PI*2),e.fill()},Nc=(e,t,n,r,i=1,a=0)=>{let o=_(i,0,1),s=_(a,0,1);if(n<=.02||r<=.02||o<=.015)return;e.save(),e.globalAlpha=r*Qs(.08,.55,o)*(1-Qs(.45,1,s));let c=7.2*n*(.32+o*.68),l=Zs(o);for(let r=0;r<48;r++){let i=r/48*Math.PI*2,a=Z(r)*.24,o=Qs(a,a+.62,l),u=(10+Z(r)*5)*n*(.08+o*.92)*(1-s*.88),d=c*(.34+s*.32),f=t.x+Math.cos(i)*d,p=t.y+Math.sin(i)*d,m=d+u*(1-s*.8),h=t.x+Math.cos(i)*m,g=t.y+Math.sin(i)*m,v=1-s*.45,y=_(o*1.1-Z(r)*.06,0,1),b=e.createLinearGradient(f,p,h,g);b.addColorStop(0,`rgba(${Q(235,140,v)|0}, ${Q(195,118,v)|0}, ${Q(28,48,v)|0}, ${.94*n*y})`),b.addColorStop(.55,`rgba(${Q(255,210,v)|0}, ${Q(228,168,v)|0}, ${Q(52,72,v)|0}, ${.82*n*y})`),b.addColorStop(1,`rgba(${Q(255,228,v)|0}, ${Q(238,188,v)|0}, ${Q(78,88,v)|0}, ${.48*n*y})`),e.fillStyle=b,e.beginPath(),e.moveTo(f,p),e.quadraticCurveTo(f+Math.cos(i+.12+s*.28)*u*.52,p+Math.sin(i+.12+s*.28)*u*.52,h,g),e.quadraticCurveTo(f+Math.cos(i-.12-s*.28)*u*.52,p+Math.sin(i-.12-s*.28)*u*.52,f,p),e.fill()}if(s<.98){let r=1-Qs(.42,.86,s)*.68,i=(1-Qs(.48,.8,s))*Qs(.08,.55,o);if(i>.015&&r>.12){let a=c*r,o=e.createRadialGradient(t.x,t.y,0,t.x,t.y,a),l=s*.75,u=i*(1-s*.25);o.addColorStop(0,`rgba(${Q(210,128,l)|0}, ${Q(158,102,l)|0}, ${Q(38,58,l)|0}, ${.72*n*u})`),o.addColorStop(.65,`rgba(${Q(180,108,l)|0}, ${Q(128,92,l)|0}, ${Q(32,48,l)|0}, ${.48*n*u})`),o.addColorStop(1,`rgba(${Q(130,92,l)|0}, ${Q(96,76,l)|0}, ${Q(28,40,l)|0}, ${.18*n*u})`),e.fillStyle=o,e.beginPath(),e.arc(t.x,t.y,a,0,Math.PI*2),e.fill()}}e.restore()},Pc=(e,t,n)=>{let r=mc(t),i=t.fade*uc(t),a=t.scale;r.budSize>.015&&Ac(e,n,a,i*(1-Qs(.28,.82,r.bloom)),r.budSize,r.budOpen,t.id);let o=i*r.bloom*(1-r.wilt*.96);r.bloom>.012&&o>.015&&r.wilt<.7&&(r.glow>.02&&Mc(e,n,a,o*r.glow),Nc(e,n,bs*a,o,r.bloom,r.wilt)),r.receptacle>.012&&(t.phase===`flower`||t.phase===`puffing`||t.phase===`mature`)&&jc(e,n,a,i,r.receptacle,r.puff)},Fc=(e,t,n,r)=>{let i=e.createRadialGradient(t.x,t.y,0,t.x,t.y,n*1.35);i.addColorStop(0,`rgba(255, 252, 242, ${.14*r})`),i.addColorStop(.45,`rgba(255, 248, 235, ${.06*r})`),i.addColorStop(1,`rgba(255, 248, 235, 0)`),e.fillStyle=i,e.beginPath(),e.arc(t.x,t.y,n*1.35,0,Math.PI*2),e.fill()},Ic=(e,t,n)=>{let r=n.fade*uc(n)*_(1-n.puffReveal,0,1);if(r<=.02)return;let i=n.scale;e.save(),e.globalAlpha=r,e.fillStyle=`rgba(${74+n.stemBrown*30}, ${56+n.stemBrown*20}, ${38+n.stemBrown*10}, 0.72)`,e.beginPath(),e.ellipse(t.x,t.y+n.wilt*4*i,(2.2-n.wilt*.4)*i,(3.2-n.wilt*.5)*i,.1+n.wilt*.4,0,Math.PI*2),e.fill(),e.fillStyle=`rgba(110, 88, 62, ${.45*r})`,e.beginPath(),e.arc(t.x-.4*i+n.wilt*2*i,t.y-.6*i+n.wilt*5*i,(1.4-n.wilt*.3)*i,0,Math.PI*2),e.fill(),e.restore()},Lc=(e,t,n,r,i,a)=>{let o=Math.sin(a*3.4+t.hairPhase)*.14*(1-r),s=Math.atan2(t.ly,t.lx+.001)+o;e.rotate(s*.06);for(let a=0;a<7;a++){let o=s+(a-7/2)*.38+t.hairPhase*.02,c=n*(.35+r*1.55),l=(Z(a+t.hairPhase)-.5)*.35;e.strokeStyle=`rgba(255, 252, 246, ${i*(.22+r*.62)})`,e.lineWidth=.18+r*.22,e.lineCap=`round`,e.beginPath(),e.moveTo(0,0),e.quadraticCurveTo(Math.cos(o+l)*c*.42,Math.sin(o+l)*c*.42,Math.cos(o+l*.4)*c,Math.sin(o+l*.4)*c),e.stroke()}},Rc=(e,t,n,r,i,a,o,s=!1,c=1)=>{if(a<=.008)return;let l=n.attached?.42+_((n.lz+8)/20,0,1)*.48:.42+n.depth*.48,u=Math.max(0,n.life)*l*a*o;if(e.save(),e.translate(n.x,n.y),n.attached)e.rotate(n.rot);else if(e.globalAlpha=u,n.landed||n.settleT>=.85)e.rotate(n.rot),e.scale(1,.72);else{let t=n.vx*.42+n.vy*.022+Math.sin(r*2.1+n.swayPhase)*.07;e.rotate(t)}let d=n.size*(.88+n.life*.12)*(n.attached?1:.76+n.depth*.24);if(n.attached&&s){let i=u*Qs(.1,.42,c);i>.008&&(e.globalAlpha=i,e.drawImage(t,-d,-d,d*2,d*2));let a=u*(1-Qs(.38,.92,c));a>.008&&Lc(e,n,d,Math.max(c,.28),a,r)}else e.globalAlpha=u,e.drawImage(t,-d,-d,d*2,d*2);if(n.attached&&!i&&c>.42){let t=Math.sin(r*3.2+n.hairPhase)*.18;e.globalAlpha=u*Qs(.42,.72,c),e.strokeStyle=`rgba(255, 250, 240, ${.12+Z(n.hairPhase)*.1})`,e.lineWidth=.25;for(let r=0;r<3;r++){let i=n.hairPhase+r*2.1+t;e.beginPath(),e.moveTo(0,0),e.lineTo(Math.cos(i)*d*.9,Math.sin(i)*d*.9),e.stroke()}}e.restore()},zc=class{cache=new Map;get(e){let t=this.cache.get(e.id);if(!t){let n=wc(e);t={curve:n,head:n.head,life:mc(e)},this.cache.set(e.id,t)}return t}clear(){this.cache.clear()}},Bc=class{counts=new Map;increment(e,t=1){this.counts.set(e,(this.counts.get(e)??0)+t)}decrement(e){let t=(this.counts.get(e)??0)-1;t<=0?this.counts.delete(e):this.counts.set(e,t)}remove(e){this.counts.delete(e)}get(e){return this.counts.get(e)??0}has(e){return(this.counts.get(e)??0)>0}clear(){this.counts.clear()}},Vc=e=>mc(e).puff,Hc=(e,t)=>{if(e.phase===`mature`)return pc(e,1,t);let n=Vc(e);return e.phase===`puffing`||e.phase===`flower`&&n>0?pc(e,n,t):e.phase===`wither`?{reveal:e.puffReveal,expand:1,fluffLen:1}:{reveal:0,expand:0,fluffLen:0}},Uc=(e,t,n,r)=>{let i=e.terminalVy,a=Math.sin(t*e.fallFreqA+e.swayPhase),o=Math.sin(t*e.fallFreqB+e.hairPhase),s=Math.cos(t*e.fallFreqA*.52+e.swayPhase*1.35),c=i*_(.58+a*.3+o*.17+s*.15,.1,1.42);return c+=n.y*.82+r*i*.2+n.x*.05,_(c,-i*.55,i*1.85)},Wc=(e,t,n)=>{for(let r=0;r<t.seedQuota;r++){let i=lc(r,t.seedQuota,t.radius);e.push({plantId:t.id,attached:n,canGerminate:!1,lx:i.lx,ly:i.ly,lz:i.lz,x:t.x+i.lx,y:t.ground-t.stemLen+i.ly,vx:0,vy:0,rot:Z(t.id*80+r)*Math.PI*2,spin:0,life:1,size:(4.8+Z(r+t.id)*4.2)*t.scale,hairPhase:Z(r*2.3+t.id)*Math.PI*2,landed:!1,landedAt:-1,germinateDelay:0,germinateChecked:!1,settleT:0,restGroundY:-1,swayPhase:Z(r*2.3+t.id)*Math.PI*2,terminalVy:0,driftBias:(Z(r*5.3+t.id*1.1)-.5)*.22,depth:_(t.depth+i.lz*.0045,.05,.98),fallFreqA:0,fallFreqB:0,fluffOx:0,fluffOy:0})}},Gc=()=>{let e=document.createElement(`canvas`);e.width=72,e.height=72;let t=e.getContext(`2d`);for(let e=0;e<28;e++){let n=e/28*Math.PI*2+(Z(e*1.7)-.5)*.45,r=72*.34+Z(e+11)*72*.14,i=2.2+Z(e+13)*.8,a=(Z(e+17)-.5)*.22;t.strokeStyle=`rgba(248, 246, 238, ${.28+Z(e+19)*.42})`,t.lineWidth=.28+Z(e+23)*.32,t.lineCap=`round`,t.beginPath(),t.moveTo(36+Math.cos(n)*i,36+Math.sin(n)*i);let o=r*.52;t.quadraticCurveTo(36+Math.cos(n+a)*o,36+Math.sin(n+a)*o,36+Math.cos(n+a*.6)*r,36+Math.sin(n+a*.6)*r),t.stroke()}let n=t.createRadialGradient(36,36,0,36,36,72*.36);n.addColorStop(0,`rgba(255, 252, 244, 0.22)`),n.addColorStop(.55,`rgba(255, 250, 240, 0.08)`),n.addColorStop(1,`rgba(255, 250, 240, 0)`),t.fillStyle=n,t.beginPath(),t.arc(36,36,72*.36,0,Math.PI*2),t.fill();let r=t.createRadialGradient(35.4,35.2,0,36,36,3.2);return r.addColorStop(0,`#9a7b62`),r.addColorStop(.55,`#6b4f3a`),r.addColorStop(1,`#4a3528`),t.fillStyle=r,t.beginPath(),t.ellipse(36,36.4,1.6,2.6,.08,0,Math.PI*2),t.fill(),e},Kc=(e,t)=>{let n=document.createElement(`canvas`);n.width=e,n.height=t;let r=n.getContext(`2d`),i=e*.76,a=t*.1,o=t*.68,s=r.createLinearGradient(0,0,0,t);s.addColorStop(0,`#1a4f8c`),s.addColorStop(.22,`#2f6aad`),s.addColorStop(.36,`#5598c4`),s.addColorStop(.44,`#7eb0cc`),s.addColorStop(.49,`#94b8b4`),s.addColorStop(.53,`#8aab88`),s.addColorStop(.57,`#789a68`),s.addColorStop(.62,`#668856`),s.addColorStop(.7,`#547044`),s.addColorStop(.82,`#465c38`),s.addColorStop(1,`#384a2e`),r.fillStyle=s,r.fillRect(0,0,e,t);let c=r.createRadialGradient(e*.5,0,0,e*.5,t*.22,t*.65);c.addColorStop(0,`rgba(12, 42, 90, 0.32)`),c.addColorStop(.55,`rgba(30, 80, 140, 0.08)`),c.addColorStop(1,`rgba(30, 80, 140, 0)`),r.fillStyle=c,r.fillRect(0,0,e,t*.5);let l=r.createRadialGradient(i,a,0,i,a,e*.48);l.addColorStop(0,`rgba(255, 248, 228, 0.38)`),l.addColorStop(.22,`rgba(255, 238, 200, 0.14)`),l.addColorStop(.55,`rgba(255, 225, 180, 0.06)`),l.addColorStop(1,`rgba(255, 220, 170, 0)`),r.fillStyle=l,r.fillRect(0,0,e,t*.48);let u=r.createRadialGradient(i,a,0,i,a,e*.038);u.addColorStop(0,`rgba(255, 252, 245, 0.88)`),u.addColorStop(.55,`rgba(255, 246, 220, 0.35)`),u.addColorStop(1,`rgba(255, 235, 200, 0)`),r.fillStyle=u,r.beginPath(),r.arc(i,a,e*.038,0,Math.PI*2),r.fill();let d=(e,t,n,i)=>{let a=[{ox:0,oy:0,r:n},{ox:n*.72,oy:n*.08,r:n*.78},{ox:-n*.65,oy:n*.12,r:n*.68},{ox:n*.35,oy:-n*.22,r:n*.55},{ox:-n*.28,oy:-n*.18,r:n*.48}];r.save(),r.globalAlpha=i;for(let n of a){let i=r.createRadialGradient(e+n.ox,t+n.oy,0,e+n.ox,t+n.oy,n.r);i.addColorStop(0,`rgba(255, 255, 255, 0.92)`),i.addColorStop(.55,`rgba(248, 252, 255, 0.55)`),i.addColorStop(1,`rgba(240, 248, 255, 0)`),r.fillStyle=i,r.beginPath(),r.arc(e+n.ox,t+n.oy,n.r,0,Math.PI*2),r.fill()}r.restore()};d(e*.22,t*.14,e*.09,.72),d(e*.52,t*.08,e*.07,.58),d(e*.88,t*.18,e*.08,.65),d(e*.08,t*.26,e*.06,.48),d(e*.62,t*.22,e*.055,.42);for(let n=0;n<16;n++){let i=n*5.9+40,a=Z(i)*e,o=t*(.44+Z(i*1.3)*.16),s=80+Z(i+2)*220,c=18+Z(i+4)*42,l=Z(i+6)>.5,u=r.createRadialGradient(a,o,0,a,o,Math.max(s,c));l?(u.addColorStop(0,`rgba(130, 168, 148, 0.07)`),u.addColorStop(1,`rgba(130, 168, 148, 0)`)):(u.addColorStop(0,`rgba(88, 118, 98, 0.06)`),u.addColorStop(1,`rgba(88, 118, 98, 0)`)),r.fillStyle=u,r.beginPath(),r.ellipse(a,o,s,c,Z(i+8)*.4,0,Math.PI*2),r.fill()}let f=r.createRadialGradient(i,t*.64,0,i,t*.7,e*.68);f.addColorStop(0,`rgba(168, 188, 118, 0.14)`),f.addColorStop(.5,`rgba(138, 162, 98, 0.06)`),f.addColorStop(1,`rgba(100, 130, 80, 0)`),r.fillStyle=f,r.fillRect(0,0,e,t);let p=(e,t,n,i,a,o,s,c)=>{let l=r.createRadialGradient(e,t,0,e,t,Math.max(n,i));l.addColorStop(0,`rgba(${a}, ${o}, ${s}, ${c})`),l.addColorStop(.55,`rgba(${a}, ${o}, ${s}, ${c*.45})`),l.addColorStop(1,`rgba(${a}, ${o}, ${s}, 0)`),r.fillStyle=l,r.beginPath(),r.ellipse(e,t,n,i,Z(e+t)*.5,0,Math.PI*2),r.fill()};for(let n=0;n<44;n++){let r=n*4.17+90,i=Z(r)*e,a=o+Z(r*1.7)*(t-o),s=(a-o)/Math.max(t-o,1),c=(28+Z(r+3)*90)*(.55+s*.45),l=(10+Z(r+5)*32)*(.5+s*.5),u=Z(r+7);u<.34?p(i,a,c,l,72,98,52,.1+s*.06):u<.58?p(i,a,c*.85,l*.85,38,58,32,.12+s*.05):u<.78?p(i,a,c*.7,l*.65,118,128,68,.07+s*.04):p(i,a,c*.6,l*.55,92,82,48,.06+s*.03)}let m=r.createRadialGradient(e*.5,t*1.02,t*.08,e*.5,t*1.02,t*.55);m.addColorStop(0,`rgba(12, 20, 10, 0.16)`),m.addColorStop(.55,`rgba(12, 20, 10, 0.06)`),m.addColorStop(1,`rgba(12, 20, 10, 0)`),r.fillStyle=m,r.fillRect(0,t*.55,e,t*.45);let h=r.createRadialGradient(e*.5,t*.48,e*.28,e*.5,t*.5,e*.82);return h.addColorStop(0,`rgba(0, 0, 0, 0)`),h.addColorStop(1,`rgba(12, 22, 8, 0.12)`),r.fillStyle=h,r.fillRect(0,0,e,t),n},qc=(e,t,n)=>Qs(n-t*.04,n+t*.08,e),Jc=(e,t)=>{let n=t*.68,r=[],i=(i,a,o,s,c,l,u,d)=>{let f=t*i,p=t*(a-i),m=e/o,h=p/s;for(let e=0;e<s;e++)for(let a=0;a<o;a++){let o=a*17.3+e*23.9+i*100;if(Z(o)<d)continue;let s=(Z(o+1)-.5)*m*.75,p=(Z(o+2)-.5)*h*.75,g=a*m+m*.5+s,_=f+e*h+h*.5+p,v=(_-n)/Math.max(t-n,1),y=(c+Z(o+3)*(l-c))*(.55+v*.55),b=u*(.45+v*.65)*(.75+Z(o+4)*.5);r.push({x:g,y:_,size:y,alpha:b,depth:v,phase:Z(o+6)*Math.PI*2})}};return i(.68,.8,20,5,10,24,.42,.38),i(.74,.9,24,7,14,34,.55,.22),i(.82,.97,28,6,18,44,.68,.12),r},Yc=(e,t,n,r,i)=>{for(let a=0;a<t.length;a++){let o=t[a],s=e[a];if(!s)continue;let c=.32+o.depth*.68,l=.78+Z(o.phase*2.1)*.44,u=Math.sin(r*(.72+Z(o.phase)*.38)+o.phase)*Hs*(.45+o.depth*.55),d=(n.x*(.62+o.depth*.28)+$s(n.x,.12)*.45+n.speed*.22*Math.sin(r*1.65+o.phase*1.3)+u)*c*Us,f=(n.y*(.26+o.depth*.16)+u*.35)*c*Us;s.swayVel+=((d-s.sway)*zs*l-s.swayVel*Bs)*i,s.sway+=s.swayVel*i,s.sway=_(s.sway,-2.6*Us,2.6*Us),s.liftVel+=((f-s.lift)*Vs*l-s.liftVel*Bs)*i,s.lift+=s.liftVel*i,s.lift=_(s.lift,-.75*Us,.75*Us)}},Xc=(e,t,n,r,i)=>{let a=r*.68;for(let o=0;o<t.length;o++){let s=t[o],c=n[o];if(!c)continue;let l=qc(s.y,r,a);if(l<=.01)continue;let u=s.alpha*l,d=4+Math.floor(Z(s.x*.17+s.y*.23)*5),f=s.size*.55;for(let e=0;e<d;e++){let t=s.x*.31+s.y*.19+e*11.7;f=Math.max(f,s.size*(.65+Z(t+2)*.55))}for(let t=0;t<d;t++){let n=s.x*.31+s.y*.19+t*11.7,r=(Z(n+1)-.5)*.75,a=-Math.PI/2+r,o=s.size*(.65+Z(n+2)*.55),l=o/Math.max(f,1),d=.58+l*.42,p=.82+Z(n+12)*.28,m=c.sway*d*p,h=c.lift*d*p,g=Math.sin(i*(3.2+Z(n+14)*2.4)+s.phase+t*.7)*o*.028*l*l*Us,_=s.x+(Z(n+6)-.5)*s.size*.08,v=s.y,y=_+Math.cos(a)*o*.42+(Z(n+3)-.5)*s.size*.22,b=v+Math.sin(a)*o*.42+o*.06,x=_+Math.cos(a)*o,S=v+Math.sin(a)*o,C=m*o*.22*l*l,w=m*o*.58*l,T=y+C,E=b-h*o*.06*l-C*.08,D=x+w+g,O=S-h*o*.14*l+g*.15,k=Z(n+4)>.38,A=e.createLinearGradient(_,v,D,O);k?(A.addColorStop(0,`rgba(42, 62, 28, ${u})`),A.addColorStop(.55,`rgba(72, 98, 44, ${u*.92})`),A.addColorStop(1,`rgba(108, 128, 58, ${u*.72})`)):(A.addColorStop(0,`rgba(34, 52, 24, ${u})`),A.addColorStop(.6,`rgba(52, 74, 34, ${u*.88})`),A.addColorStop(1,`rgba(68, 88, 42, ${u*.65})`)),e.strokeStyle=A,e.lineWidth=.35+Z(n+5)*.55+s.size*.015,e.lineCap=`round`,e.beginPath(),e.moveTo(_,v),e.quadraticCurveTo(T,E,D,O),e.stroke()}}},Zc={dandelionField:`cos-dandelionField-YoGw-`,canvas:`cos-canvas-Wb2gG`},Qc=({width:e,height:t,fill:n=!1,plantCount:r=10,seedCount:i=32,speed:a=1,interactive:o=!0,ariaLabel:s=`蒲公英播种背景`})=>{let{hostRef:u,width:d,height:f,hostStyle:p}=E({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),m=(0,c.useRef)(null),h=(0,c.useRef)([]),g=(0,c.useRef)([]),S=(0,c.useRef)(1),C=(0,c.useRef)([]),w=(0,c.useRef)(0),T=(0,c.useRef)(!1),D=(0,c.useRef)(null),O=(0,c.useRef)({x:0,y:0,speed:0}),k=(0,c.useRef)({x:0,y:0,active:!1}),A=(0,c.useRef)(0),j=(0,c.useRef)(null),M=(0,c.useRef)({speed:a,interactive:o,plantCount:r,seedCount:i}),N=(0,c.useRef)(new Bc),P=(0,c.useRef)([]),F=(0,c.useRef)([]);return(0,c.useEffect)(()=>{M.current={speed:a,interactive:o,plantCount:r,seedCount:i}},[o,r,i,a]),(0,c.useEffect)(()=>{let e=_(Math.round(r),1,22),t=Math.max(24,Math.min(90,Math.round(i)));S.current=1,C.current=cc(e,d,f,t),w.current=0,T.current=!1,h.current=[],g.current=[],N.current.clear(),O.current={x:0,y:0,speed:0},j.current=null,A.current=0},[f,r,i,d]),(0,c.useEffect)(()=>{let e=m.current;if(!e)return;let t=Math.min(window.devicePixelRatio||1,2);e.width=Math.floor(d*t),e.height=Math.floor(f*t);let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0),D.current||=Gc();let r=D.current,i=N.current,a=0,o=0,s=document.hidden,c=b(),l=y(e=>{s=e}),u=x(e=>{c=e}),p=t=>{let n=e.getBoundingClientRect();return{x:(t.clientX-n.left)*(d/Math.max(n.width,1)),y:(t.clientY-n.top)*(f/Math.max(n.height,1))}},E=()=>new Map(h.current.map(e=>[e.id,e])),I=(e,t,n)=>{let r=d*Os;return h.current.some(i=>i.id===n?!1:Math.hypot(i.x-e,i.ground-t)<r)},L=(e,t=ic())=>{let n=S.current++,r=Ec({...e},n,t);return h.current.push(r),r},R=(e=!1)=>{for(let t of C.current){if(t.spawned)continue;let n=L(t.layout,e?ac():ic());e&&(Wc(g.current,n,!0),i.increment(n.id,n.seedQuota)),t.spawned=!0}T.current=!0,w.current=3},z=e=>{if(!T.current){w.current+=e;for(let e of C.current)e.spawned||w.current<e.at||(L(e.layout),e.spawned=!0);C.current.every(e=>e.spawned)&&(T.current=!0)}},B=()=>{if(T.current)return;let e=C.current.find(e=>!e.spawned&&e.at<=0);e&&(L(e.layout),e.spawned=!0)},V=(e,t)=>{if(h.current.length>=22)return null;let n=d*.04,r=_(e,n,d-n),i=_(t,f*.68,f*.93);if(I(r,i))return null;let a=S.current++,o=Ec(Tc(r,i,f,Math.max(24,Math.min(90,Math.round(M.current.seedCount))),a),a,ic(Z(a*7.3)*.12));return h.current.push(o),o},H=e=>{h.current=h.current.filter(t=>t.id!==e),g.current=g.current.filter(t=>t.plantId!==e||!t.attached),i.remove(e)},U=e=>{e.phase===`puffing`||e.phase===`mature`||(e.phase=`puffing`,e.phaseTime=_(e.puffReveal,0,1)*ys.PUFFING,e.grow=bs,i.has(e.id)||(Wc(g.current,e,!0),i.increment(e.id,e.seedQuota)))},W=e=>{let t=rc(e.x,e.depth,f);e.terminalVy=Math.max(14,t-e.y)/(4+Z(e.hairPhase*3.1+e.plantId)*5),e.vy=e.terminalVy*(.22+Z(e.hairPhase*1.9)*.22),e.fallFreqA=.62+Z(e.hairPhase*4.3)*1.25,e.fallFreqB=1.55+Z(e.hairPhase*6.7)*3.1},ee=(e,t,n,r,a)=>{e.attached=!1,i.decrement(e.plantId),e.canGerminate=!0,e.fluffOx=0,e.fluffOy=0,e.vx=t,e.spin=r,e.life=1,e.landed=!1,e.landedAt=-1,e.germinateDelay=1+Z(e.hairPhase*4.1)*1,e.germinateChecked=!1,e.settleT=0,e.restGroundY=-1,e.swayPhase=e.hairPhase,e.driftBias=(Z(e.hairPhase*5.3+e.rot)-.5)*.22,W(e),e.vy=e.terminalVy*(.22+Z(e.hairPhase*1.9)*.22)+n,a&&(e.originX=a.x,e.originGround=a.ground)},G=(e,t)=>{e.settleT>0||(e.restGroundY=t,e.settleT=.001)},K=(e,t,n,r,i)=>{let a=Math.sin(n*1.55+e.swayPhase),o=Math.cos(n*.95+e.swayPhase*1.4),s=Uc(e,n,i,a);e.vy+=(s-e.vy)*Ms;let c=t*60,l=tc(i);e.vx+=(i.x*(.022+l*.018)+e.driftBias*.014+a*.011+o*.006)*c,e.vy+=i.y*(.032+l*.028)*c,e.vx*=.992,e.vy=e.vy*.994+e.terminalVy*.006,e.spin*=.94,e.x+=e.vx*54*t*r,e.y+=e.vy*t*r,e.rot=e.vx*.42+e.vy*.018+a*.08+e.spin;let u=rc(e.x,e.depth,f);e.y>=u-.8&&(e.y=Math.min(e.y,u),G(e,u))},te=(e,t,n,r)=>{e.settleT=Math.min(1,e.settleT+t*Ns);let i=Xs(e.settleT),a=Math.sin(n*10+e.swayPhase)*(1-i)*.35;e.vx*=.75,e.x+=e.vx*4*t*r;let o=Math.min(.12,t*1.8+i*.06);e.y=v(e.y,e.restGroundY,o)+a,e.y>e.restGroundY&&(e.y=e.restGroundY+a),e.vy=0,e.spin*=.8,e.rot=v(e.rot,.08+Z(e.swayPhase*1.9)*.22,o*2.5),e.settleT>=1&&(e.y=e.restGroundY,e.vx=0,e.landed=!0,e.landedAt=n)},ne=e=>{e.y=e.restGroundY,e.vx=0,e.vy=0,e.rot=.08+Z(e.swayPhase*1.9)*.22},re=e=>{if(!e.canGerminate||e.attached||!e.landed)return!1;let t=rc(e.x,e.depth,f),n=e.originX!==void 0&&e.originGround!==void 0&&Math.hypot(e.x-e.originX,e.y-e.originGround)<d*.2,r=n?As:ks;return Z(e.x*.31+e.y*.17+e.hairPhase)>r?!1:V(n?_(e.originX+(Z(e.hairPhase*2.1)-.5)*d*.14,d*.04,d*.96):e.x,n?_(e.originGround+(Z(e.hairPhase*3.3)-.5)*f*.035,f*.68,f*.93):t)!==null},ie=e=>{let t=g.current.filter(t=>t.plantId===e.id&&t.attached).sort((e,t)=>Math.hypot(t.lx,t.ly)-Math.hypot(e.lx,e.ly)),n=t.length,r=e.releaseDuration;t.forEach((t,i)=>{let a=n<=1?1:i/(n-1),o=Z(i*2.71+e.id*1.3);t.scheduledRelease=_(.05+a*.8+o*.15,.05,1)*r})},ae=(e,t)=>{e.releaseElapsed+=t;let n=e.releaseBoost>.01?1+e.releaseBoost*14:1,r=e.releaseElapsed*n,i=e.releaseDuration,a=g.current.filter(t=>t.plantId===e.id&&t.attached).sort((e,t)=>(e.scheduledRelease??i)-(t.scheduledRelease??i));if(!a.length)return;let o={x:e.x,ground:e.ground},s=r>=i?a:a.filter(e=>r>=(e.scheduledRelease??i)),c=e.releaseBoost>.15?6:2;s.length>c&&(s=s.slice(0,c));for(let t=0;t<s.length;t++){let n=s[t],r=Z(n.hairPhase*2.3+t*1.7+e.id)*Math.PI*2,i=.12+Z(n.hairPhase*1.7+t*.9)*.34,a=(Z(n.lx*1.3+t*2.4)-.5)*.16,c=1+e.releaseBoost*.22;ee(n,(Math.cos(r)*i+O.current.x*.05+a)*c,(Math.sin(r)*i*.35+O.current.y*.05+.03+Z(n.hairPhase+t*.6)*.04)*c,(Z(n.rot+e.id+t)-.5)*.022,o),n.scheduledRelease=void 0}},q=e=>{e.releasing||(e.releasing=!0,e.releaseElapsed=0,e.releaseSeedTotal=i.get(e.id),ie(e))},oe=e=>(e.phase===`mature`||e.phase===`puffing`)&&e.puffReveal>=.85&&i.has(e.id),se=e=>!e.releasing||i.has(e.id)?!1:(e.phase=`wither`,e.phaseTime=0,e.releasing=!1,e.releaseBoost=0,e.releaseElapsed=0,e.releaseSeedTotal=0,!0),ce=(e,t)=>{oe(e)&&(e.phase===`mature`&&(e.matureHoldLeft=0),q(e),e.releaseBoost=_(e.releaseBoost+t,0,4),t>=1.2&&(e.releaseElapsed+=.12))},le=e=>{e.phase=`mature`,e.phaseTime=0,e.grow=bs,e.puffReveal=1,e.matureHoldLeft=oc(),e.releaseDuration=sc(e.id),e.releaseElapsed=0,e.releaseSeedTotal=0,e.releasing=!1,e.releaseBoost=0},ue=(e,t)=>{e.releaseBoost=Math.max(0,e.releaseBoost-t*.65)},de=(e,t)=>{switch(e.phaseTime+=t,e.phase){case`mature`:e.releasing||(e.matureHoldLeft>0&&(e.matureHoldLeft=Math.max(0,e.matureHoldLeft-t)),e.matureHoldLeft<=0&&q(e)),e.releasing&&ae(e,t),ue(e,t),se(e);break;case`wither`:{let t=Zs(e.phaseTime/ys.WITHER);e.wilt=t,e.stemBrown=t,e.fade=1-Xs(Math.max(0,(t-.35)/.65)),e.leafScale=1-t*.85,e.puffReveal=0,e.phaseTime>=ys.WITHER&&H(e.id);break}case`sprout`:{let t=Zs(e.phaseTime/ys.SPROUT);e.stemLen=e.stem*t,e.leafScale=.08+t*.92,e.fade=Math.min(1,Qs(.08,.72,t)*1.08),e.phaseTime>=ys.SPROUT&&(e.phase=`flower`,e.phaseTime=0,e.stemLen=e.stem,e.leafScale=1,e.fade=1,e.grow=0);break}case`flower`:{let t=mc(e);e.grow=t.bloom*bs,t.wilt>=.7&&(i.has(e.id)||(Wc(g.current,e,!0),i.increment(e.id,e.seedQuota)),e.puffReveal=Math.max(e.puffReveal,Ds),U(e));break}case`puffing`:e.grow=bs,e.releasing||(e.puffReveal=_(e.phaseTime/ys.PUFFING,0,1),e.phaseTime>=ys.PUFFING&&le(e)),e.releasing&&(ae(e,t),ue(e,t),se(e));break}},fe=e=>{if(!M.current.interactive)return;let{x:t,y:n}=p(e),r=k.current;if(!r.active){r.x=t,r.y=n,r.active=!0;return}let i=t-r.x,a=n-r.y;r.x=t,r.y=n;let o=Math.hypot(i,a),s=ec(o);O.current.speed=Math.max(s,O.current.speed*.72);let c=.06+s*.2;if(O.current.x=_(O.current.x*.82+i*c,-5.5,5.5),O.current.y=_(O.current.y*.82+a*c,-5.5,5.5),s>=.58&&o>=9){let e=o*.018*_((s-Ys)/(1-Ys),.35,1),r=new zc;for(let i of h.current){if(!oe(i))continue;let a=r.get(i).head;Math.hypot(a.x-t,a.y-n)<105*i.scale&&ce(i,e)}}},pe=e=>{if(!M.current.interactive)return;let{x:t,y:n}=p(e);k.current={x:t,y:n,active:!0};let r=null,i=1/0,a=new zc;for(let e of h.current){if(!oe(e))continue;let o=a.get(e).head,s=Math.hypot(o.x-t,o.y-n);s<i&&(i=s,r=e)}if(r&&i<130*r.scale){ce(r,2.8);let e=a.get(r).head;j.current={x:e.x,y:e.y,t:.35}}},me=e=>{let{x:t,y:n}=p(e);k.current={x:t,y:n,active:!0}},he=()=>{k.current.active=!1};e.addEventListener(`pointermove`,fe),e.addEventListener(`pointerdown`,pe),e.addEventListener(`pointerenter`,me),e.addEventListener(`pointerleave`,he);let ge=Kc(d,f),_e=Jc(d,f),ve=_e.map(()=>({sway:0,swayVel:0,lift:0,liftVel:0})),ye=(e,t=0,a,o=new zc)=>{let s=a??E();n.drawImage(ge,0,0,d,f),Xc(n,_e,ve,f,t);let c=P.current;c.length=0,c.push(...h.current),c.sort((e,t)=>e.ground+(1-e.depth)*8-(t.ground+(1-t.depth)*8));for(let e of c)Oc(n,e);for(let e of c){let{head:t}=o.get(e);if(kc(n,e),Pc(n,e,t),e.phase===`wither`)Ic(n,t,e);else if(e.phase===`mature`||e.phase===`puffing`){let r=o.get(e).life,a=e.fade*uc(e);i.get(e.id)>0&&r.puff>.02&&Fc(n,t,e.radius*(.08+r.puff*.92),r.glow*a*.65)}}let l=F.current;l.length=0,l.push(...g.current),l.sort((e,t)=>{let n=s.get(e.plantId),r=s.get(t.plantId),i=e.attached&&n?1-n.depth:1-e.depth,a=t.attached&&r?1-r.depth:1-t.depth;return e.y+i*12-(t.y+a*12)});for(let i of l){if(e&&!i.attached)continue;let a=s.get(i.plantId);if(i.attached){let e=a?o.get(a).life:null;if(!a||a.phase===`sprout`||a.phase===`flower`&&(!e||e.puff<=.008)||a.phase===`wither`&&a.puffReveal<=.02)continue}let c=i.attached&&a?uc(a):.58+i.depth*.42,l=i.attached?a?a.fade*c:.78:c,u=a?Hc(a,i):{reveal:1,fluffLen:1,expand:1};Rc(n,r,i,t,e,i.attached&&a?u.reveal:1,l,!!(a&&(a.phase===`puffing`||a.phase===`mature`||a.phase===`flower`&&a.puffReveal>.008)&&a.phase!==`mature`&&u.fluffLen<.995),u.fluffLen)}let u=j.current;if(u&&!e){let e=n.createRadialGradient(u.x,u.y,0,u.x,u.y,28);e.addColorStop(0,`rgba(255, 252, 240, ${.08*u.t})`),e.addColorStop(1,`rgba(255, 252, 240, 0)`),n.fillStyle=e,n.beginPath(),n.arc(u.x,u.y,28,0,Math.PI*2),n.fill()}},be=()=>{cancelAnimationFrame(a),e.removeEventListener(`pointermove`,fe),e.removeEventListener(`pointerdown`,pe),e.removeEventListener(`pointerenter`,me),e.removeEventListener(`pointerleave`,he),l(),u()};if(c)return R(!0),ye(!0),be;let xe=e=>{if(a=requestAnimationFrame(xe),s)return;o||=e;let t=_((e-o)/1e3,.008,.04);o=e;let n=M.current.speed;A.current+=t*n;let r=A.current,i=O.current;i.x*=Math.exp(-t*1.05),i.y*=Math.exp(-t*1.05),i.speed*=Math.exp(-t*2.6),j.current&&(j.current.t-=t*2.8,j.current.t<=0&&(j.current=null)),z(t*n),Yc(ve,_e,i,r,t);let c=new zc,l=E(),u=h.current.slice();for(let e of u)bc(e,i,Math.sin(r*(.85+Z(e.id*2.3)*.35)+e.swayPhase)*e.swayAmp,t),de(e,t);for(let e of g.current){let a=l.get(e.plantId);if(e.attached&&a){let n=c.get(a).head,o=a.phase===`puffing`||a.phase===`mature`||a.phase===`flower`&&a.puffReveal>.008,{offX:s,offY:l,tiltX:u,tiltY:d}=xc(e,a,i,r,t,o,a.radius),f=+!!o,{expand:p}=Hc(a,e),m=o?p:0,h=e.lx*f*m,g=e.ly*f*m;e.x=n.x+h+s,e.y=n.y+g+l,e.rot=Math.atan2(g+d,h+u)*.11+e.hairPhase*.02}else e.attached||(e.settleT<=0?K(e,t,r,n,i):e.landed?ne(e):te(e,t,r,n),e.landed&&e.landedAt>=0&&r-e.landedAt>=e.germinateDelay&&(e.germinateChecked?e.life>0&&(e.life-=t*js):(e.germinateChecked=!0,re(e)?e.life=0:e.canGerminate=!1)))}g.current=g.current.filter(e=>e.attached&&l.has(e.plantId)||!e.attached&&e.life>0),ye(!1,r,l,c)};return ye(!1,0),B(),xe(0),be},[f,d]),(0,l.jsx)(`div`,{ref:u,className:Zc.dandelionField,style:p,children:(0,l.jsx)(`canvas`,{ref:m,className:Zc.canvas,style:{width:d,height:f},role:`img`,"aria-label":s})})},$c=(e,t,n)=>{let r=e.createShader(t);return r?(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(console.error(e.getShaderInfoLog(r)),e.deleteShader(r),null)):null},el=(e,t,n)=>{let r=$c(e,e.VERTEX_SHADER,t),i=$c(e,e.FRAGMENT_SHADER,n);if(!r||!i)return null;let a=e.createProgram();return a?(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),e.deleteShader(r),e.deleteShader(i),e.getProgramParameter(a,e.LINK_STATUS)?a:(console.error(e.getProgramInfoLog(a)),e.deleteProgram(a),null)):null},tl=e=>{let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t},$=()=>Math.random(),nl=(e,t)=>{let n=3+Math.floor($()*5),r=[];for(let e=0;e<n;e++){let e=$()*Math.PI*2;r.push({a0:e,a1:e+(.3+$()*1.1)*($()<.5?1:-1),bend:($()-.5)*.5,width:.004+$()*.007})}return{u:e,v:t,r:.04,maxR:.08+$()*.1,z:0,phase:`inflate`,t:0,seed:$()*1e3,aspect:.72+$()*.5,rot:$()*Math.PI,inflate:.32+$()*.35,thinTime:.6+$()*.85,cracks:r,tear:$()*Math.PI*2,bias:.25+$()*.55}},rl=(e,t,n,r,i,a,o)=>{e.push({u:t.u+Math.cos(r)*t.r*i*t.aspect,v:t.v+Math.sin(r)*t.r*i,vu:o.vu??Math.cos(r)*a,vv:o.vv??Math.sin(r)*a,z:o.z??.2,vz:o.vz??1,life:o.life??.4,heat:o.heat??.2,size:o.size??.01,kind:n})},il=()=>{let e=$();return e<.5?1:e<.78?2:e<.93?3:4},al=(e,t,n)=>{let r=Math.floor(t),i=Math.floor(n),a=r+1,o=i+1,s=t-r,c=n-i;if(r<0||i<0||a>=192||o>=192)return 0;let l=r+i*192,u=a+i*192,d=r+o*192,f=a+o*192;return(1-s)*(1-c)*e[l]+s*(1-c)*e[u]+(1-s)*c*e[d]+s*c*e[f]},ol=()=>{let e=36864,t=new Float32Array(e),n=new Float32Array(e),r=new Float32Array(e),i=new Float32Array(e),a=new Float32Array(e),o=new Float32Array(e),s=new Uint8Array(e*4),c=[],l=[],u=.6+$()*1.4,d=(e,n,r,i,a,o,s=0)=>{let c=e*191,l=n*191,u=Math.max(r*192,1.5),d=Math.ceil(u*Math.max(a,1)*1.55),f=Math.cos(o),p=Math.sin(o);for(let e=-d;e<=d;e++)for(let n=-d;n<=d;n++){let r=Math.round(c+n),o=Math.round(l+e);if(r<=0||r>=191||o<=0||o>=191)continue;let d=f*n+p*e,m=(-p*n+f*e)/a,h=.9+.1*Math.sin(d*.28+s)*Math.cos(m*.22+s*.6),g=(d*d+m*m)/(u*u*Math.max(.75,h));if(g>1.2)continue;let _=Math.sqrt(Math.max(0,g)),v=Math.sqrt(Math.max(0,1-Math.min(1,_)*Math.min(1,_)))*(.55+.45*Math.max(0,1-_/1.15)**1.6);t[o*192+r]=Math.max(t[o*192+r],i*v)}},f=(e,t,r,i,a=`add`)=>{let o=e*191,s=t*191,c=Math.max(r*192,.6),l=c*c,u=Math.ceil(c*1.4);for(let e=-u;e<=u;e++)for(let t=-u;t<=u;t++){let r=Math.round(o+t),c=Math.round(s+e);if(r<0||r>=192||c<0||c>=192)continue;let u=t*t+e*e;if(u>l*1.6)continue;let d=i*Math.exp(-u/(l*.5)),f=c*192+r;a===`max`?n[f]=Math.max(n[f],d):n[f]=Math.min(.5,n[f]+d)}},p=(e,t,n,r,i,a)=>{let o=Math.hypot(n,r);if(o<1e-4){f(e,t,i,a,`max`);return}for(let s=0;s<=5;s++){let c=s/5,l=1-c*.65;f(e-n/o*i*2.2*c,t-r/o*i*2.2*c,i*(.7+c*.4),a*l,`max`)}},m=(e,t,r,i)=>{f(e,t,r*.55,i*.7,`add`);let a=e*191,o=t*191,s=Math.max(r*192,1.2),c=Math.ceil(s*1.6);for(let e=-c;e<=c;e++)for(let t=-c;t<=c;t++){let r=Math.round(a+t),c=Math.round(o+e);if(r<0||r>=192||c<0||c>=192)continue;let l=Math.sqrt(t*t+e*e),u=Math.exp(-((l-s*.85)**2)/(s*s*.12));n[c*192+r]=Math.min(.5,n[c*192+r]+i*.45*u)}},h=(e,t)=>{if(t<.02)return;let i=e.u*191,a=e.v*191,o=Math.max(e.r*192*(.48+e.bias*.2),2.2),s=o*(.42+e.bias*.18),c=Math.cos(e.tear),l=Math.sin(e.tear),u=Math.ceil(Math.max(o,s)*1.7);for(let d=-u;d<=u;d++)for(let f=-u;f<=u;f++){let u=Math.round(i+f),p=Math.round(a+d);if(u<0||u>=192||p<0||p>=192)continue;let m=c*f+l*d,h=-l*f+c*d,g=.7+.28*Math.sin(m*.55+e.seed)*Math.cos(h*.7+e.seed*.4)+.12*Math.sin(m*1.4-h*.9+e.seed),_=m*m/(o*o*g)+h*h/(s*s*g);if(_>1.4)continue;let v=Math.max(0,1-_)**.95*t,y=p*192+u;r[y]=Math.max(r[y],v),_>.45&&_<1.15&&(n[y]=Math.max(n[y],v*.22*(1.1-_)))}},g=(e,t)=>{if(!(t<.05))for(let n=0;n<28;n++){let r=n/28*Math.PI*2,i=.65+.45*Math.cos(r-e.tear),a=.85+.2*Math.sin(n*1.7+e.seed),o=e.r*(.55+.35*i)*a,s=e.u+Math.cos(r)*o*e.aspect,c=e.v+Math.sin(r)*o,l=.55+.25*Math.sin(n*2.1+e.seed*.3);d(s,c,e.r*.08,.22*t*i,l,r,e.seed+n),i>.85&&f(s,c,e.r*.05,.08*t,`max`)}},v=(e,t)=>{if(!(t<.1))for(let n of e.cracks)for(let r=0;r<=22;r++){let i=r/22,a=n.a0+(n.a1-n.a0)*i+Math.sin(i*Math.PI)*n.bend,o=e.r*(.18+i*.7);f(e.u+Math.cos(a+e.rot)*o*e.aspect,e.v+Math.sin(a+e.rot)*o,n.width*.22,t*.15*(.3+i*.7),`max`)}},y=e=>{e.phase=`burst`,e.t=0;let t=e.cracks[0];for(let n of e.cracks)Math.abs(n.a1-n.a0)>Math.abs(t.a1-t.a0)&&(t=n);e.tear=(t.a0+t.a1)*.5+($()-.5)*.25,h(e,1),f(e.u,e.v,e.r*.12,.16,`max`);for(let t of e.cracks)for(let n=0;n<=14;n++){let r=n/14,i=t.a0+(t.a1-t.a0)*r+Math.sin(r*Math.PI)*t.bend,a=e.r*(.2+r*.75);f(e.u+Math.cos(i+e.rot)*a*e.aspect,e.v+Math.sin(i+e.rot)*a,t.width*.4,.18*(.4+r*.6),`max`)}let n=10+Math.floor($()*8);for(let t=0;t<n;t++){let t=e.tear+($()-.5)*(.9+e.bias*.5),n=(.55+$()*.95)*(.9+e.bias*.25);rl(l,e,0,t,.2+$()*.55,n,{z:.15+$()*.35,vz:1.4+$()*1.8,life:.22+$()*.25,heat:.22+$()*.14,size:.003+$()*.006})}let r=3+Math.floor($()*4);for(let t=0;t<r;t++){let t=e.tear+($()-.5)*(.7+e.bias*.4),n=.18+$()*.42;rl(l,e,1,t,.15+$()*.4,n,{vu:Math.cos(t)*n*(.7+$()*.5),vv:Math.sin(t)*n*(.7+$()*.5),z:.35+$()*.5,vz:.55+$()*1.1,life:.6+$()*.55,heat:.2+$()*.14,size:.01+$()*.018})}let i=6+Math.floor($()*5);for(let t=0;t<i;t++){let t=e.tear+Math.PI+($()-.5)*2,n=.08+$()*.28;rl(l,e,2,t,.35+$()*.4,n,{z:.12+$()*.35,vz:.25+$()*.7,life:.55+$()*.5,heat:.03+$()*.06,size:.012+$()*.024})}},b=()=>{for(let e=0;e<8;e++){let e=.12+$()*.76,t=.12+$()*.76,n=!0;for(let r of c){let i=(r.u-e)*1.2,a=r.v-t;if(i*i+a*a<.045){n=!1;break}}if(n)return{u:e,v:t}}return{u:.2+$()*.6,v:.2+$()*.6}},x=(e,t,n)=>{if(e.t+=t*n,e.phase===`inflate`){e.z=_(e.z+t*n*e.inflate*(1.15-e.z*.55),0,1),e.r=e.maxR*(.22+e.z**.85*.78);let r=(Math.max(0,e.z-.28)/.72)**1.5;d(e.u,e.v,e.r,.7+e.z*.6,e.aspect,e.rot,e.seed),v(e,r),e.z>=1&&(e.phase=`thin`,e.t=0);return}if(e.phase===`thin`){e.r+=t*n*.008,d(e.u,e.v,e.r,1.18,e.aspect,e.rot,e.seed),v(e,.65+Math.min(.3,e.t*.35)),e.t>e.thinTime&&y(e);return}if(e.phase===`burst`){let t=Math.max(0,1-e.t*6);h(e,.9+t*.1),g(e,.7+t*.3),f(e.u,e.v,e.r*.1,t*.1,`max`),e.t>.1&&(e.phase=`cavity`,e.t=0);return}let r=_(e.t/1.55,0,1),i=(1-r)**1.05;if(h(e,i),g(e,i*(1-r*.6)),r>.2&&r<.4){let t=Math.sin((r-.2)/.2*Math.PI);f(e.u,e.v,e.r*.1,t*.14,`max`),d(e.u,e.v,e.r*.1,t*.22,.75,e.tear,e.seed)}r>.7&&f(e.u,e.v,e.r*.35,.04*(1-r),`max`),e.t>1.65&&(e.t=99)},S=(e,t)=>{let n=e.kind===0?2.2:1.5;if(e.vu*=Math.exp(-t*n),e.vv*=Math.exp(-t*n),e.u+=e.vu*t,e.v+=e.vv*t,e.vz-=(e.kind===0?5.2:e.kind===1?3.6:2.8)*t,e.z+=e.vz*t,e.z>0)e.kind!==2&&p(e.u,e.v,e.vu,e.vv,e.size*(.6+e.z*.55),e.heat*.1*Math.min(1,e.z+.15));else{if(e.z=0,e.kind===2)f(e.u,e.v,e.size*1.4,.035,`max`);else{let t=Math.hypot(e.vu,e.vv)||1;m(e.u,e.v,e.size*(e.kind===0?1.2:1.8),e.heat*(e.kind===0?.14:.22)),p(e.u,e.v,e.vu/t,e.vv/t,e.size*1.6,e.heat*.12)}e.life=0}e.life-=t*(e.kind===0?1.6:.9)},C=()=>{for(let e=1;e<191;e++)for(let t=1;t<191;t++){let r=t+e*192,i=(n[r-1]+n[r+1]+n[r-192]+n[r+192])*.25;n[r]=Math.min(.48,n[r]*.96+i*.04)}},w=(e,t,n,r)=>{let o=Math.hypot(n,r);if(o<1e-5)return;let s=e*191,c=t*191,l=(.055+o*.09)*192,u=l*l,d=Math.ceil(l*1.15),f=o*14;for(let e=-d;e<=d;e++)for(let t=-d;t<=d;t++){let n=t*t+e*e;if(n>u||n<.25)continue;let r=Math.round(s+t),l=Math.round(c+e);if(r<1||r>=191||l<1||l>=191)continue;let d=Math.sqrt(n),p=-e/d,m=t/d,h=Math.exp(-n/(u*.32)),g=l*192+r;i[g]+=p*f*h,a[g]+=m*f*h,i[g]-=t/d*o*1.8*h,a[g]-=e/d*o*1.8*h}},T=(e,t,r,i,a)=>{let o=Math.hypot(r,i);if(o<1e-5||a<.02)return;let s=e*191,c=t*191,l=(.04+o*.05)*192,u=l*l,d=Math.atan2(i,r),f=Math.ceil(l*1.2);for(let e=-f;e<=f;e++)for(let t=-f;t<=f;t++){let r=t*t+e*e;if(r>u)continue;let i=Math.atan2(e,t)+Math.sqrt(r)*.18-d*1.4,o=Math.abs(Math.sin(i*3))**.5,l=Math.exp(-r/(u*.38)),f=a*o*l*.24,p=Math.round(s+t),m=Math.round(c+e);if(p<0||p>=192||m<0||m>=192)continue;let h=m*192+p;n[h]=Math.min(.5,n[h]+f)}},E=(e,t,i,a,o)=>{let s=Math.hypot(i,a);if(s<1e-5||o<.02)return;p(e,t,i,a,.035+s*.025,o*.16),T(e,t,i,a,o);let c=e*191,l=t*191,u=(.028+s*.02)*192,d=u*.72,m=Math.atan2(a,i),h=Math.cos(m),g=Math.sin(m),_=Math.ceil(u*1.6);for(let i=-_;i<=_;i++)for(let a=-_;a<=_;a++){let s=Math.round(c+a),f=Math.round(l+i);if(s<0||s>=192||f<0||f>=192)continue;let p=h*a+g*i,m=-g*a+h*i,_=.72+.22*Math.sin(p*.9+e*40)*Math.cos(m*1.1+t*35)+.1*Math.sin(p*2.1-m*1.3),v=p*p/(u*u*_)+m*m/(d*d*_);if(v>1.35)continue;let y=Math.max(0,1-v)**1.1*o*.55,b=f*192+s;r[b]=Math.max(r[b],y),v>.35&&v<1.1?n[b]=Math.max(n[b],y*.42*(1.05-v)):v<=.35&&(n[b]=Math.max(n[b],y*.28))}let v=4+Math.floor(s*18);for(let n=0;n<v;n++){let r=n*1.7+e*31+t*17,i=m+n/v*Math.PI*2+Math.sin(r)*.35,a=i+(.35+(Math.sin(r*2.1)*.5+.5)*.85)*(Math.sin(r*3.3)<0?1:-1);for(let n=0;n<=16;n++){let c=n/16,l=i+(a-i)*c+Math.sin(c*Math.PI+r)*.25,u=(.012+c*.045)*(.85+s*.35);f(e+Math.cos(l)*u,t+Math.sin(l)*u,.004+c*.006,o*.14*(.25+c*.75),`max`)}}},D=(e,t,n,r,i,a)=>{let o=(e.u-t)*1.15,s=e.v-n,c=Math.hypot(o,s);if(c>e.r*1.35)return;let l=a*(.45+(1-c/Math.max(e.r*1.35,.01))*.55);if(e.phase===`inflate`||e.phase===`thin`){v(e,(Math.max(0,e.z-.15)/.85)**1.2*.35+l*.55),l>.12&&(h(e,l*.22),f(e.u,e.v,e.r*.08,l*.12,`max`));return}(e.phase===`burst`||e.phase===`cavity`)&&(h(e,l*.18),g(e,l*.25),f(e.u,e.v,e.r*.12,l*.08,`max`))},O=(t,r)=>{let s=t*r*.9;for(let e=1;e<191;e++)for(let t=1;t<191;t++){let r=t+e*192;o[r]=al(n,t-i[r]*s,e-a[r]*s)}for(let t=0;t<e;t++)n[t]=o[t]},k=(t,n)=>{let r=Math.exp(-t*n*2.8);for(let t=0;t<e;t++)i[t]*=r,a[t]*=r},A=e=>{let t=Math.hypot(e.vu,e.vv);if(t<4e-4)return;let n=_(t*28,.08,1);w(e.u,e.v,e.vu,e.vv),E(e.u,e.v,e.vu,e.vv,n);for(let t of c)D(t,e.u,e.v,e.vu,e.vv,n)};return{step:(i,a,o)=>{if(o.click&&c.push(nl(o.click.u,o.click.v)),o.autoSpawn){let e=_(o.activity,0,2);if(u-=i*a*(.55+e*.7),u<=0&&c.length<8){let t=Math.min(il(),8-c.length);for(let e=0;e<t;e++){let e=b();c.push(nl(e.u,e.v))}u=(1.1+$()*3.4)/Math.max(.35,e)}}t.fill(0),r.fill(0);for(let t=0;t<e;t++)n[t]*=Math.exp(-i*a*.75);for(let e of c)x(e,i,a);for(let e=c.length-1;e>=0;e--)c[e].t>=90&&c.splice(e,1);for(let e of l)S(e,i);for(let e=l.length-1;e>=0;e--)l[e].life<=0&&l.splice(e,1);o.stir&&A(o.stir),O(i,a),C(),k(i,a)},upload:(i,a)=>{for(let i=0;i<e;i++){let e=i*4;s[e]=Math.floor(_(t[i],0,1)*255),s[e+1]=Math.floor(_(n[i],0,1)*255),s[e+2]=Math.floor(_(r[i],0,1)*255),s[e+3]=255}i.bindTexture(i.TEXTURE_2D,a),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,192,192,0,i.RGBA,i.UNSIGNED_BYTE,s)}}},sl=`
2
2
  attribute vec2 a_pos;
3
3
  varying vec2 v_uv;
4
4
  void main() {
5
5
  v_uv = a_pos * 0.5 + 0.5;
6
6
  gl_Position = vec4(a_pos, 0.0, 1.0);
7
7
  }
8
- `,Qo=`
8
+ `,cl=`
9
+ precision highp float;
10
+
11
+ uniform float u_time;
12
+ uniform vec2 u_res;
13
+ uniform vec2 u_sim;
14
+ uniform float u_heat;
15
+ uniform sampler2D u_field;
16
+
17
+ varying vec2 v_uv;
18
+
19
+ float hash(vec2 p) {
20
+ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
21
+ }
22
+
23
+ float noise(vec2 p) {
24
+ vec2 i = floor(p);
25
+ vec2 f = fract(p);
26
+ vec2 u = f * f * (3.0 - 2.0 * f);
27
+ float a = hash(i);
28
+ float b = hash(i + vec2(1.0, 0.0));
29
+ float c = hash(i + vec2(0.0, 1.0));
30
+ float d = hash(i + vec2(1.0, 1.0));
31
+ return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
32
+ }
33
+
34
+ float fbm(vec2 p) {
35
+ float v = 0.0;
36
+ float a = 0.5;
37
+ for (int i = 0; i < 5; i++) {
38
+ v += a * noise(p);
39
+ p *= 2.05;
40
+ a *= 0.5;
41
+ }
42
+ return v;
43
+ }
44
+
45
+ vec3 heatColor(float t) {
46
+ // 最低也是暗红熔壳,绝不走到纯黑
47
+ t = clamp(t, 0.18, 1.0);
48
+ vec3 c0 = vec3(0.28, 0.07, 0.02);
49
+ vec3 c1 = vec3(0.48, 0.12, 0.03);
50
+ vec3 c2 = vec3(0.72, 0.2, 0.04);
51
+ vec3 c3 = vec3(0.95, 0.4, 0.08);
52
+ vec3 c4 = vec3(1.0, 0.7, 0.28);
53
+ vec3 c5 = vec3(1.0, 0.9, 0.58);
54
+ if (t < 0.35) return mix(c0, c1, (t - 0.18) / 0.17);
55
+ if (t < 0.52) return mix(c1, c2, (t - 0.35) / 0.17);
56
+ if (t < 0.7) return mix(c2, c3, (t - 0.52) / 0.18);
57
+ if (t < 0.88) return mix(c3, c4, (t - 0.7) / 0.18);
58
+ return mix(c4, c5, (t - 0.88) / 0.12);
59
+ }
60
+
61
+ float sampleH(vec2 uv) {
62
+ return texture2D(u_field, uv).r;
63
+ }
64
+
65
+ float sampleHeat(vec2 uv) {
66
+ return texture2D(u_field, uv).g;
67
+ }
68
+
69
+ float sampleCav(vec2 uv) {
70
+ return texture2D(u_field, uv).b;
71
+ }
72
+
73
+ vec3 calcNormal(vec2 uv) {
74
+ vec2 e = vec2(1.0 / u_sim.x, 1.0 / u_sim.y);
75
+ float hL = sampleH(uv - vec2(e.x, 0.0)) - sampleCav(uv - vec2(e.x, 0.0)) * 0.3;
76
+ float hR = sampleH(uv + vec2(e.x, 0.0)) - sampleCav(uv + vec2(e.x, 0.0)) * 0.3;
77
+ float hD = sampleH(uv - vec2(0.0, e.y)) - sampleCav(uv - vec2(0.0, e.y)) * 0.3;
78
+ float hU = sampleH(uv + vec2(0.0, e.y)) - sampleCav(uv + vec2(0.0, e.y)) * 0.3;
79
+ return normalize(vec3((hL - hR) * 8.2, (hD - hU) * 8.2, 1.6));
80
+ }
81
+
82
+ void main() {
83
+ vec2 uv = v_uv;
84
+ float aspect = u_res.x / max(u_res.y, 1.0);
85
+ vec2 p = (uv - 0.5) * vec2(aspect, 1.0);
86
+
87
+ float h = sampleH(uv);
88
+ float extra = min(sampleHeat(uv), 0.38);
89
+ float cav = sampleCav(uv);
90
+
91
+ vec3 N = calcNormal(uv);
92
+ vec2 stretchUv = uv - N.xy * h * 0.028;
93
+
94
+ float plate = fbm(stretchUv * vec2(4.0, 3.5) + u_time * 0.022);
95
+ float plate2 = fbm(stretchUv * vec2(8.0, 7.2) - u_time * 0.015);
96
+ float seam = pow(1.0 - abs(plate2 - 0.5) * 2.0, 3.0);
97
+ float micro = fbm(stretchUv * 16.0 + h * 1.5);
98
+
99
+ float dome = smoothstep(0.02, 0.28, h);
100
+ float domeCore = smoothstep(0.18, 0.88, h);
101
+ // 宽柔接触影:有深度但不描黑边
102
+ float contact = smoothstep(0.012, 0.12, h) * (1.0 - smoothstep(0.12, 0.42, h));
103
+ float shoulder = smoothstep(0.07, 0.22, h) * (1.0 - smoothstep(0.22, 0.55, h));
104
+ float apex = pow(domeCore, 1.35);
105
+ float thinSpot = pow(micro, 2.4) * domeCore;
106
+
107
+ float cavFloor = cav * 0.08;
108
+ float cavDeep = pow(cav, 1.4);
109
+ float cavRim = smoothstep(0.03, 0.14, cav) * (1.0 - smoothstep(0.14, 0.4, cav));
110
+
111
+ float t = plate * 0.5 * u_heat + 0.26 + seam * 0.18 + micro * 0.045;
112
+ t += extra * 0.7;
113
+ t -= contact * 0.025;
114
+ t += apex * 0.05;
115
+ t += thinSpot * 0.055;
116
+ t += cavFloor;
117
+ t = clamp(t, 0.26, 0.87);
118
+
119
+ vec3 col = heatColor(t);
120
+
121
+ vec3 L = normalize(vec3(-0.3, 0.42, 0.86));
122
+ vec3 V = vec3(0.0, 0.0, 1.0);
123
+ float wrap = clamp((dot(N, L) + 0.5) / 1.5, 0.0, 1.0);
124
+ float facing = clamp(N.z, 0.0, 1.0);
125
+ float softSpec = pow(max(dot(reflect(-L, N), V), 0.0), 8.5);
126
+ float broadSpec = pow(max(dot(reflect(-L, N), V), 0.0), 3.8);
127
+
128
+ // 中等凸感:顶亮 + 根部浅影 + 柔边
129
+ float volume = 0.92 + wrap * 0.12 + facing * apex * 0.13;
130
+ col *= volume;
131
+ col *= 1.0 + h * 0.1 * facing;
132
+ col *= 1.0 - contact * 0.16;
133
+ col = mix(col, heatColor(0.44), contact * 0.12);
134
+ col += heatColor(0.6) * shoulder * wrap * 0.13;
135
+ col += heatColor(0.68) * apex * 0.09;
136
+ col += vec3(1.0, 0.52, 0.16) * softSpec * dome * 0.22 * (0.35 + 0.65 * facing);
137
+ col += vec3(1.0, 0.42, 0.1) * broadSpec * dome * 0.08;
138
+ col += heatColor(0.6) * thinSpot * 0.08;
139
+
140
+ col += heatColor(min(0.76, 0.52 + extra)) * pow(extra, 1.35) * 0.22;
141
+
142
+ // 爆裂口:深井压暗 + 撕裂唇余温(不是中心白光团)
143
+ col *= 1.0 - cavDeep * 0.38;
144
+ col = mix(col, heatColor(0.34), cavDeep * 0.22);
145
+ col *= 1.0 - cavRim * 0.22;
146
+ col += vec3(1.0, 0.28, 0.04) * cavRim * 0.35;
147
+ col += heatColor(0.58) * pow(cav, 2.8) * 0.05;
148
+
149
+ col += (hash(uv * u_res + u_time) - 0.5) * 0.006;
150
+ col = max(col, vec3(0.18, 0.045, 0.015));
151
+
152
+ float vig = smoothstep(1.25, 0.35, length(p));
153
+ col *= 0.95 + 0.05 * vig;
154
+
155
+ gl_FragColor = vec4(col, 1.0);
156
+ }
157
+ `,ll={lavaBubble:`cos-lavaBubble-EglZd`,canvas:`cos-canvas-rIcPQ`},ul=({width:e,height:t,fill:n=!1,heat:r=1,speed:i=1,autoSpawn:a=!0,activity:o=1,interactive:s=!0,ariaLabel:u=`熔岩泡背景`})=>{let{hostRef:d,width:f,height:p,hostStyle:m}=E({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),h=(0,c.useRef)(null),g=(0,c.useRef)({heat:r,speed:i,interactive:s,autoSpawn:a,activity:o}),v=(0,c.useRef)(null),S=(0,c.useRef)(null),C=(0,c.useRef)(null);return(0,c.useEffect)(()=>{g.current={heat:r,speed:i,interactive:s,autoSpawn:a,activity:o}},[o,a,r,s,i]),(0,c.useEffect)(()=>{let e=h.current;if(!e)return;let t=(t,n)=>{let r=e.getBoundingClientRect();return{u:(t-r.left)/Math.max(r.width,1),v:1-(n-r.top)/Math.max(r.height,1)}},n=e=>{g.current.interactive&&(e.pointerType===`mouse`&&e.button!==0||(v.current=t(e.clientX,e.clientY)))},r=e=>{if(!g.current.interactive)return;let{u:n,v:r}=t(e.clientX,e.clientY),i=C.current;i?S.current={u:n,v:r,vu:n-i.u,vv:r-i.v}:S.current={u:n,v:r,vu:0,vv:0},C.current={u:n,v:r}},i=()=>{C.current=null,S.current=null};return e.addEventListener(`pointerdown`,n),e.addEventListener(`pointermove`,r),e.addEventListener(`pointerleave`,i),()=>{e.removeEventListener(`pointerdown`,n),e.removeEventListener(`pointermove`,r),e.removeEventListener(`pointerleave`,i)}},[]),(0,c.useEffect)(()=>{let e=h.current;if(!e)return;let t=Math.min(window.devicePixelRatio||1,2);e.width=Math.floor(f*t),e.height=Math.floor(p*t);let n=e.getContext(`webgl`,{alpha:!1,antialias:!1,depth:!1,stencil:!1,premultipliedAlpha:!1});if(!n)return;let r=el(n,sl,cl);if(!r)return;let i=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,i),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),n.STATIC_DRAW);let a=n.getAttribLocation(r,`a_pos`),o=n.getUniformLocation(r,`u_time`),s=n.getUniformLocation(r,`u_res`),c=n.getUniformLocation(r,`u_sim`),l=n.getUniformLocation(r,`u_heat`),u=n.getUniformLocation(r,`u_field`),d=tl(n);if(!d)return;let m=ol(),C=0,w=0,T=0,E=document.hidden,D=b(),O=y(e=>{E=e}),k=x(e=>{D=e}),A=t=>{m.upload(n,d),n.viewport(0,0,e.width,e.height),n.useProgram(r),n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(a),n.vertexAttribPointer(a,2,n.FLOAT,!1,0,0),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,d),n.uniform1i(u,0),n.uniform1f(o,t),n.uniform2f(s,e.width,e.height),n.uniform2f(c,192,192),n.uniform1f(l,g.current.heat),n.drawArrays(n.TRIANGLE_STRIP,0,4)},j=e=>{if(C=requestAnimationFrame(j),E)return;w||=e;let t=_((e-w)/1e3,.008,.033);if(w=e,D){A(0);return}let n=g.current.speed;T+=t*n;let r=v.current;v.current=null;let i=S.current,a=i&&Math.hypot(i.vu,i.vv)>3e-4?{u:i.u,v:i.v,vu:i.vu,vv:i.vv}:null;i&&(S.current={u:i.u,v:i.v,vu:0,vv:0}),m.step(t,n,{autoSpawn:g.current.autoSpawn,activity:g.current.activity,click:r,stir:a}),A(T)};return j(0),()=>{cancelAnimationFrame(C),O(),k(),n.deleteTexture(d),n.deleteBuffer(i),n.deleteProgram(r)}},[p,f]),(0,l.jsx)(`div`,{ref:d,className:ll.lavaBubble,style:m,role:`img`,"aria-label":u,children:(0,l.jsx)(`canvas`,{ref:h,className:ll.canvas,style:{width:f,height:p}})})},dl={inkBloom:`cos-inkBloom-bz-OV`,canvas:`cos-canvas-uX-Bl`},fl=2,pl=e=>{let t=e.replace(`#`,``).trim(),n=t.length===3?t.split(``).map(e=>e+e).join(``):t;if(n.length!==6)return[28,30,34];let r=Number.parseInt(n,16);return Number.isNaN(r)?[28,30,34]:[r>>16&255,r>>8&255,r&255]},ml=e=>{let t=Math.sin(e*127.1)*43758.5453;return t-Math.floor(t)},hl=(e,t)=>{let n=Math.floor(e),r=Math.floor(t),i=e-n,a=t-r,o=i*i*(3-2*i),s=a*a*(3-2*a),c=ml(n*12.9898+r*78.233),l=ml((n+1)*12.9898+r*78.233),u=ml(n*12.9898+(r+1)*78.233),d=ml((n+1)*12.9898+(r+1)*78.233);return c+(l-c)*o+(u-c)*s+(c-l-u+d)*o*s},gl=(e,t)=>{let n=0,r=.5,i=1;for(let a=0;a<3;a++)n+=r*hl(e*i,t*i),i*=2.05,r*=.5;return n},_l=({width:e,height:t,fill:n=!1,inkColor:r=`#0c0e12`,speed:i=1,interactive:a=!0,ariaLabel:o=`墨染清水背景`})=>{let{hostRef:s,width:u,height:d,hostStyle:f}=E({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),p=(0,c.useRef)(null),m=(0,c.useRef)({speed:i,interactive:a,inkColor:r});return(0,c.useEffect)(()=>{m.current={speed:i,interactive:a,inkColor:r}},[r,a,i]),(0,c.useEffect)(()=>{let e=p.current;if(!e)return;let t=Math.min(window.devicePixelRatio||1,fl);e.width=Math.floor(u*t),e.height=Math.floor(d*t);let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let r=Math.max(140,Math.floor(u/4)),i=Math.max(88,Math.floor(d/4)),a=r*i,o=new Float32Array(a),s=new Float32Array(a),c=new Float32Array(a),l=new Float32Array(a),f=new Float32Array(a),h=new Float32Array(a),g=new Float32Array(a),v=new Float32Array(a),S=new Float32Array(a),C=document.createElement(`canvas`);C.width=r,C.height=i;let w=C.getContext(`2d`);if(!w)return;let T=w.createImageData(r,i),E=0,D=0,O=0,k=document.hidden,A=b(),j=y(e=>{k=e}),M=x(e=>{A=e}),N=(e,t)=>_(Math.floor(e),0,r-1)+_(Math.floor(t),0,i-1)*r,P=(e,t,n)=>{let a=_(t,0,r-1.001),o=_(n,0,i-1.001),s=Math.floor(a),c=Math.floor(o),l=a-s,u=o-c,d=Math.min(s+1,r-1),f=Math.min(c+1,i-1),p=e[s+c*r],m=e[d+c*r],h=e[s+f*r],g=e[d+f*r];return p*(1-l)*(1-u)+m*l*(1-u)+h*(1-l)*u+g*l*u},F=(t,n)=>{let a=e.getBoundingClientRect();return{x:(t-a.left)/Math.max(a.width,1)*r,y:(n-a.top)/Math.max(a.height,1)*i}},I=(e,t,n,r)=>{let i=n*n,a=Math.ceil(n*1.4);for(let o=-a;o<=a;o++)for(let s=-a;s<=a;s++){let a=s*s+o*o;if(a<.25||a>i)continue;let c=Math.sqrt(a),l=Math.exp(-a/(i*.55))*(1-c/n),u=N(e+s,t+o);f[u]+=-o/c*r*l,h[u]+=s/c*r*l}},L=(e,t)=>{let n=()=>Math.random(),r=4.2+n()*2.8,i=1.35+n()*.55,a=1.4+n()*2.4,s=.5+n()*1.2,c=Math.ceil(r*3.2);for(let l=-c;l<=c;l++)for(let u=-c;u<=c;u++){let c=(gl(e*.18+u*.32,t*.18+l*.32)-.5)*r*.85,d=Math.hypot(u,l)+c;if(d>r*1.85)continue;let p=Math.exp(-(d*d)/(r*r*1.15)),m=N(e+u,t+l);o[m]=Math.min(2.4,o[m]+p*i),h[m]+=p*a*.4,f[m]+=(n()-.5)*p*s,h[m]+=(n()-.5)*p*s*.45}let l=3+Math.floor(n()*4);for(let r=0;r<l;r++){let r=n()*Math.PI*2,i=2+n()*5.5;I(e+Math.cos(r)*i,t+Math.sin(r)*i,4+n()*8,(n()<.5?-1:1)*(2.2+n()*4.8))}let u=6+n()*5;for(let r=0;r<22;r++){let i=r/22*Math.PI*2+n()*.35,a=N(e+Math.cos(i)*u*(.65+n()*.55),t+Math.sin(i)*u*(.65+n()*.55));o[a]=Math.min(2.4,o[a]+.18+n()*.22),f[a]+=Math.cos(i)*(.35+n()*1),h[a]+=Math.sin(i)*(.35+n()*1)}},R=(e,t,n,r)=>{let i=Math.hypot(n,r);if(i<.04)return;let a=4.5;for(let s=-6;s<=6;s++)for(let c=-6;c<=6;c++){let l=Math.hypot(c,s);if(l>a)continue;let u=Math.exp(-(l*l)/(a*a)),d=N(e+c,t+s);f[d]+=n*u*11,h[d]+=r*u*11,o[d]=Math.min(1.5,o[d]+u*.015*i)}},z=null,B=t=>{if(!m.current.interactive)return;let n=F(t.clientX,t.clientY);z=n,L(n.x,n.y),e.setPointerCapture(t.pointerId)},V=e=>{if(!m.current.interactive||!e.buttons||!z)return;let t=F(e.clientX,e.clientY);R(t.x,t.y,t.x-z.x,t.y-z.y),z=t},H=t=>{z=null,e.hasPointerCapture(t.pointerId)&&e.releasePointerCapture(t.pointerId)};e.addEventListener(`pointerdown`,B),e.addEventListener(`pointermove`,V),e.addEventListener(`pointerup`,H),e.addEventListener(`pointercancel`,H);let U=(e,t,n,a,o)=>{for(let s=0;s<i;s++)for(let i=0;i<r;i++){let c=i+s*r;t[c]=P(e,i-n[c]*o,s-a[c]*o)}},W=(e,t,n)=>{for(let a=0;a<i;a++)for(let i=0;i<r;i++){let o=i+a*r,s=e[o],c=n*(.28+(1-_(s/1.6,0,1))*.85),l=e[N(i-1,a)],u=e[N(i+1,a)],d=e[N(i,a-1)],f=e[N(i,a+1)];t[o]=s*(1-c)+(l+u+d+f)*.25*c}},ee=e=>{for(let e=1;e<i-1;e++)for(let t=1;t<r-1;t++){let n=t+e*r;S[n]=(h[n+1]-h[n-1])*.5-(f[n+r]-f[n-r])*.5}for(let t=1;t<i-1;t++)for(let n=1;n<r-1;n++){let i=n+t*r,a=o[i];if(a<.002&&Math.abs(S[i])<.001)continue;let s=4.5*a;h[i]+=s*e;let c=(S[i+1]-S[i-1])*.5,l=(S[i+r]-S[i-r])*.5,u=Math.hypot(c,l)+1e-5,d=12*e;f[i]+=l/u*S[i]*d,h[i]-=c/u*S[i]*d;let p=gl(n*.07+O*.15,t*.07-O*.11),m=gl(n*.11-O*.08,t*.11+40),g=a*3.2*e;f[i]+=(p-.5)*g*2,h[i]+=(m-.5)*g*2}},G=(e,t,n)=>{let[r,i,a]=pl(e),[o,s,c]=pl(t),l=_(n,0,1);return`rgb(${Math.round(r+(o-r)*l)} ${Math.round(i+(s-i)*l)} ${Math.round(a+(c-a)*l)})`},K=e=>{let t=_(1-Math.exp(-e*3.2),0,.92),r=G(`#c5dff0`,`#2a3038`,t*.85),i=G(`#9ec9e4`,`#232830`,t*.9),a=G(`#7eb0d4`,`#1a1e24`,t*.95),o=G(`#5f96bf`,`#12151a`,t),s=n.createRadialGradient(u*.5,d*.38,8,u*.5,d*.52,Math.max(u,d)*.78);s.addColorStop(0,r),s.addColorStop(.4,i),s.addColorStop(.75,a),s.addColorStop(1,o),n.fillStyle=s,n.fillRect(0,0,u,d);let c=Math.max(0,.28*(1-t*1.1));if(c>.02){let e=n.createLinearGradient(0,0,u*.35,d);e.addColorStop(0,`rgb(220 240 255 / ${c*100}%)`),e.addColorStop(.45,`rgb(180 215 240 / 0%)`),e.addColorStop(1,`rgb(90 140 180 / ${12*(1-t)}%)`),n.fillStyle=e,n.fillRect(0,0,u,d)}},te=()=>{let[e,t,r]=pl(m.current.inkColor),i=T.data;for(let n=0;n<a;n++){let a=c[n];if(a<.004){i[n*4+3]=0;continue}let o=1-Math.exp(-a*1.55),s=Math.min(255,o*200),l=1-o;i[n*4]=Math.round(e*(1-l*.35)+36*l),i[n*4+1]=Math.round(t*(1-l*.3)+42*l),i[n*4+2]=Math.round(r*(1-l*.22)+58*l),i[n*4+3]=s}w.putImageData(T,0,0),n.save(),n.imageSmoothingEnabled=!0,n.globalAlpha=.92,n.filter=`blur(2.8px)`,n.drawImage(C,0,0,u,d),n.globalAlpha=.55,n.filter=`blur(7px)`,n.drawImage(C,0,0,u,d),n.restore()},ne=()=>{let[e,t,r]=pl(m.current.inkColor),i=T.data;for(let n=0;n<a;n++){let a=o[n];if(a<.003){i[n*4+3]=0;continue}let s=1-Math.exp(-a*2.15),c=Math.min(255,s*255),l=1-s;i[n*4]=Math.round(e*(1-l*.18)+28*l),i[n*4+1]=Math.round(t*(1-l*.16)+32*l),i[n*4+2]=Math.round(r*(1-l*.12)+42*l),i[n*4+3]=c}w.putImageData(T,0,0),n.save(),n.imageSmoothingEnabled=!0,n.globalAlpha=1,n.globalCompositeOperation=`source-over`,n.filter=`none`,n.drawImage(C,0,0,u,d),n.globalAlpha=.38,n.filter=`blur(1.6px)`,n.drawImage(C,0,0,u,d),n.restore()};if(A)return K(0),()=>{e.removeEventListener(`pointerdown`,B),e.removeEventListener(`pointermove`,V),e.removeEventListener(`pointerup`,H),e.removeEventListener(`pointercancel`,H),j(),M()};let re=e=>{if(E=requestAnimationFrame(re),k)return;D||=e;let t=_((e-D)/1e3,.008,.033);D=e;let n=t*m.current.speed;O+=n,ee(n);let r=Math.exp(-n*.55);for(let e=0;e<a;e++)f[e]*=r,h[e]*=r;U(o,s,f,h,n*22),[o,s]=[s,o],W(o,s,.085),[o,s]=[s,o],U(f,g,f,h,n*16),U(h,v,f,h,n*16),[f,g]=[g,f],[h,v]=[v,h];let i=1-Math.exp(-n*.022),u=0;for(let e=0;e<a;e++){let t=o[e]*i;o[e]-=t,c[e]=Math.min(2.8,c[e]+t),u+=c[e]}W(c,l,.055),[c,l]=[l,c];for(let e=0;e<a;e++)c[e]*=Math.exp(-n*35e-5);K(u/a),te(),ne()};return re(0),()=>{cancelAnimationFrame(E),e.removeEventListener(`pointerdown`,B),e.removeEventListener(`pointermove`,V),e.removeEventListener(`pointerup`,H),e.removeEventListener(`pointercancel`,H),j(),M()}},[d,u]),(0,l.jsx)(`div`,{ref:s,className:dl.inkBloom,style:f,children:(0,l.jsx)(`canvas`,{ref:p,className:dl.canvas,style:{width:u,height:d},role:`img`,"aria-label":o})})},vl={auroraVeil:`cos-auroraVeil-miEkt`,canvas:`cos-canvas-94CRi`},yl=[`#7ee8d8`,`#4cc9f0`,`#9d8df1`,`#e8a0f0`,`#5eead4`],bl=2,xl=4,Sl=e=>{let t=Math.sin(e*127.1)*43758.5453;return t-Math.floor(t)},Cl=(e,t)=>{let n=e.replace(`#`,``).trim(),r=n.length===3?n.split(``).map(e=>e+e).join(``):n;if(r.length!==6)return t;let i=Number.parseInt(r,16);return Number.isNaN(i)?t:[i>>16&255,i>>8&255,i&255]},wl=(e,t,n)=>[v(e[0],t[0],n),v(e[1],t[1],n),v(e[2],t[2],n)],Tl=(e,t)=>wl(e,[255,255,255],t/255),El=e=>_(e/.035,0,1)*_((1-e)/.07,0,1),Dl=e=>1-(1-e)**3,Ol=({width:e,height:t,fill:n=!1,colors:r=yl,bandCount:i=5,speed:a=1,interactive:o=!0,ariaLabel:s=`极光帷幕背景`})=>{let{hostRef:u,width:d,height:f,hostStyle:p}=E({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),m=(0,c.useRef)(null),h=(0,c.useRef)([]),g=(0,c.useRef)([]),S=(0,c.useRef)([]),C=(0,c.useRef)(0),w=(0,c.useRef)(0),T=(0,c.useRef)({x:0,y:0,sx:0,sy:0,vx:0,svx:0,active:!1}),D=(0,c.useRef)(0),O=(0,c.useRef)({colors:r,bandCount:i,speed:a,interactive:o});return(0,c.useEffect)(()=>{O.current={colors:r,bandCount:i,speed:a,interactive:o}},[i,r,o,a]),(0,c.useEffect)(()=>{let e=r.length?r:yl,t=Math.max(3,Math.min(8,Math.round(i)));h.current=Array.from({length:t},(n,r)=>{let i=Cl(e[r%e.length],[126,232,216]);return{x:d*(.11+r/Math.max(t-1,1)*.78),width:d*(.058+Sl(r+2)*.072),amp:d*(.02+Sl(r+5)*.028),freq:.0038+Sl(r+8)*.0026,phase:Sl(r+11)*Math.PI*2,drift:d*(.012+Sl(r+13)*.022),depth:Sl(r+19),color:i,glow:Tl(i,62),sheets:2+Math.floor(Sl(r+17)*2)}}),h.current.sort((e,t)=>e.depth-t.depth),g.current=Array.from({length:260},(e,t)=>{let n=Sl(t*.91);return{x:Sl(t*1.71)*d,y:Sl(t*3.13+2)*f*.97,r:.15+n*1.2,a:.08+n*.48,tw:Sl(t*6.1),depth:n,warm:Sl(t*2.7)>.82}}),S.current=[],C.current=0,w.current=0,D.current=0;let n={x:d*.5,y:f*.5};T.current={x:n.x,y:n.y,sx:n.x,sy:n.y,vx:0,svx:0,active:!1}},[i,r,f,d]),(0,c.useEffect)(()=>{let e=m.current;if(!e)return;let t=Math.min(window.devicePixelRatio||1,bl);e.width=Math.floor(d*t),e.height=Math.floor(f*t);let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let r=document.createElement(`canvas`);r.width=Math.floor(d*t),r.height=Math.floor(f*t);let i=r.getContext(`2d`);if(!i)return;i.setTransform(t,0,0,t,0,0);let a=document.createElement(`canvas`);a.width=r.width,a.height=r.height;let o=a.getContext(`2d`);if(!o)return;o.setTransform(t,0,0,t,0,0);let s=Math.max(110,Math.floor(f/3.5)),c=new Float32Array(s+1),l=new Float32Array(s+1),u=new Float32Array(s+1),p=new Float32Array(s+1),E=0,k=0,A=document.hidden,j=b(),M=y(e=>{A=e}),N=x(e=>{j=e}),P=t=>{let n=e.getBoundingClientRect();return{x:(t.clientX-n.left)*(d/Math.max(n.width,1)),y:(t.clientY-n.top)*(f/Math.max(n.height,1))}},F=(e,t)=>{let n=T.current;n.vx=e-n.x,n.x=e,n.y=t,n.active=!0},I=e=>{if(!O.current.interactive)return;let{x:t,y:n}=P(e);F(t,n)},L=e=>{if(!O.current.interactive)return;let{x:t,y:n}=P(e);F(t,n)},R=e=>{if(!O.current.interactive)return;let{x:t,y:n}=P(e);T.current={...T.current,x:t,y:n,sx:t,sy:n,vx:0,svx:0,active:!0},C.current=1,w.current=.55,S.current.push({x:t,y:n,t:0}),S.current.length>xl&&S.current.shift()},z=()=>{T.current.active=!1};e.addEventListener(`pointermove`,I),e.addEventListener(`pointerenter`,L),e.addEventListener(`pointerdown`,R),e.addEventListener(`pointerleave`,z);let B=e=>{let t=T.current,n=1-Math.exp(-e*16);t.sx=v(t.sx,t.x,n),t.sy=v(t.sy,t.y,n),t.svx=v(t.svx,t.vx,n*.88),t.vx*=.84},V=e=>{let t=T.current;return t.active?t.svx*.042:Math.sin(e*.1)*.26},H=e=>{if(!T.current.active)return 1;let t=Math.abs(T.current.sx-e.x)/Math.max(d*.28,1);return 1+Math.exp(-t*t*1.6)*.22},U=(e,t,n,r)=>{let i=T.current,a=V(n),o=t/Math.max(f,1),s=Math.sin(t*e.freq+n*.28+e.phase+a*o*3.8)*e.amp+Math.sin(t*e.freq*1.55+n*.17+e.phase*1.15+a*o*2)*e.amp*.42+Math.sin(t*e.freq*.38+n*.11+r*.65)*e.amp*.18,c=Math.sin(n*.055+e.phase+r*.45)*e.drift+Math.sin(n*.032+e.phase*1.6)*e.drift*.34,l=e.x+s+c;if(i.active){let e=(t-i.sy)/f,n=Math.exp(-e*e*2);l+=(i.sx-l)*(.24+r*.04)*n,l+=i.svx*.28*n*(.35+o*.65)}for(let e of S.current){let n=Dl(1-e.t),r=Math.hypot(l-e.x,t-e.y);l+=Math.sin(r*.04-e.t*10)*Math.exp(-r/140)*n*15}return C.current>.02&&(l+=Math.sin(t*.05+n*38+e.phase)*C.current*12+Math.sin(t*.095-n*50+r)*C.current*6),l},W=(e,t,n,r)=>{let i=T.current,a=e.width*(.56+r*.12);if(a*=.93+.07*Math.sin(t*.0045+n*.15+e.phase+r),i.active){let e=(t-i.sy)/f;a*=1-.38*Math.exp(-e*e*2.6)}return C.current>.02&&(a*=1+C.current*.18*Math.abs(Math.sin(t*.085+n*44+r))),a},ee=(e,t,n)=>{for(let r=0;r<=s;r++){let i=r/s*f,a=U(e,i,t,n),o=W(e,i,t,n),u=Math.sin(i*.003+t*.1+e.phase+n*.8)*o*.05;c[r]=a-o-u,l[r]=a+o+u*.55}return{left:c,right:l}},G=(e,t)=>{e.beginPath();for(let n=0;n<=s;n++){let r=n/s*f;n===0?e.moveTo(t.left[n],r):e.lineTo(t.left[n],r)}for(let n=s;n>=0;n--){let r=n/s*f;e.lineTo(t.right[n],r)}e.closePath()},K=(e,t,n,r,i,a,o)=>{G(e,n);let[s,c,l]=t.color,[u,p,m]=t.glow,h=H(t),g=.62+t.depth*.38,_=(.38+r*.18)*a*h*g,v=.1*a*g,y=.9+.1*Math.sin(o*.65+t.phase),b=e.createLinearGradient(t.x-t.width*2.4,0,t.x+t.width*2.4,0);b.addColorStop(0,`rgb(${s} ${c} ${l} / 0%)`),b.addColorStop(.34,`rgb(${s} ${c} ${l} / ${v})`),b.addColorStop(.5,`rgb(${u} ${p} ${m} / ${_*i*y})`),b.addColorStop(.66,`rgb(${s} ${c} ${l} / ${v})`),b.addColorStop(1,`rgb(${s} ${c} ${l} / 0%)`),e.fillStyle=b,e.fill();let x=e.createLinearGradient(0,0,0,f);x.addColorStop(0,`rgb(${s} ${c} ${l} / 0%)`),x.addColorStop(.04,`rgb(${u} ${p} ${m} / ${(.62+r*.24)*h})`),x.addColorStop(.28,`rgb(${u} ${p} ${m} / ${(.82+r*.28)*h})`),x.addColorStop(.58,`rgb(${s} ${c} ${l} / ${(.48+r*.14)*h})`),x.addColorStop(.88,`rgb(${s} ${c} ${l} / 0.05)`),x.addColorStop(1,`rgb(${s} ${c} ${l} / 0%)`),e.save(),e.globalCompositeOperation=`source-atop`,e.fillStyle=x,e.fillRect(0,0,d,f),e.restore()},te=(e,t)=>{let r=n.createLinearGradient(0,0,0,f);r.addColorStop(0,`#000104`),r.addColorStop(.28,`#020810`),r.addColorStop(.62,`#040c14`),r.addColorStop(1,`#020508`),n.fillStyle=r,n.fillRect(0,0,d,f);let i=n.createLinearGradient(d*.1,f*.05,d*.9,f*.35);i.addColorStop(0,`rgb(0 0 0 / 0%)`),i.addColorStop(.45,`rgb(50 65 95 / 6%)`),i.addColorStop(.55,`rgb(60 75 110 / 7%)`),i.addColorStop(1,`rgb(0 0 0 / 0%)`),n.fillStyle=i,n.fillRect(0,0,d,f);let a=n.createRadialGradient(d*.52,f*.1,0,d*.48,f*.22,f*.7);a.addColorStop(0,`rgb(35 55 90 / 8%)`),a.addColorStop(1,`rgb(0 0 0 / 0%)`),n.fillStyle=a,n.fillRect(0,0,d,f);for(let r of g.current){let i=r.y/f,a=t?1:.5+.5*Math.sin(e*(.65+r.depth)+r.tw*10),o=r.a*a*El(i);if(o<.02)continue;let s=r.warm?`255 230 210`:`220 232 255`;n.fillStyle=`rgb(${s} / ${o})`,n.beginPath(),n.arc(r.x,r.y,r.r,0,Math.PI*2),n.fill(),r.depth>.88&&(n.strokeStyle=`rgb(${s} / ${o*.35})`,n.lineWidth=.5,n.beginPath(),n.moveTo(r.x-r.r*3.5,r.y),n.lineTo(r.x+r.r*3.5,r.y),n.moveTo(r.x,r.y-r.r*3.5),n.lineTo(r.x,r.y+r.r*3.5),n.stroke(),n.fillStyle=`rgb(${s} / ${o*.1})`,n.beginPath(),n.arc(r.x,r.y,r.r*2.6,0,Math.PI*2),n.fill())}let o=n.createLinearGradient(0,f*.82,0,f);o.addColorStop(0,`rgb(0 0 0 / 0%)`),o.addColorStop(.55,`rgb(20 40 55 / 12%)`),o.addColorStop(1,`rgb(10 25 35 / 28%)`),n.fillStyle=o,n.fillRect(0,f*.78,d,f*.22);let s=n.createRadialGradient(d*.5,f*.4,f*.14,d*.5,f*.5,f*.98);s.addColorStop(0,`rgb(0 0 0 / 0%)`),s.addColorStop(1,`rgb(0 0 0 / 42%)`),n.fillStyle=s,n.fillRect(0,0,d,f)},ne=e=>{let t=C.current;i.clearRect(0,0,d,f),o.clearRect(0,0,d,f),i.globalCompositeOperation=`lighter`,o.globalCompositeOperation=`lighter`;for(let n of h.current){for(let r=0;r<n.sheets;r++)K(i,n,ee(n,e,r),t,1,.88/n.sheets,e);let r=ee(n,e,0);for(let e=0;e<=s;e++){let t=(r.left[e]+r.right[e])*.5;u[e]=v(r.left[e],t,.58),p[e]=v(r.right[e],t,.58)}K(o,n,{left:u,right:p},t,1.35,.52,e)}n.save(),n.globalCompositeOperation=`screen`,n.globalAlpha=1,n.drawImage(r,0,0,d,f),n.globalAlpha=.42+t*.1,n.filter=`blur(1px)`,n.drawImage(r,0,0,d,f),n.filter=`none`,n.globalAlpha=.62+t*.12,n.filter=`blur(2.4px)`,n.drawImage(a,0,0,d,f),n.filter=`none`,n.globalAlpha=1,n.restore();for(let e of S.current){let t=Dl(1-e.t),r=20+e.t*Math.max(d,f)*.22,i=n.createRadialGradient(e.x,e.y,0,e.x,e.y,r);i.addColorStop(0,`rgb(140 220 190 / ${.12*t})`),i.addColorStop(.5,`rgb(80 180 150 / ${.05*t})`),i.addColorStop(1,`rgb(0 0 0 / 0%)`),n.fillStyle=i,n.fillRect(0,0,d,f)}w.current>.01&&(n.fillStyle=`rgb(180 230 210 / ${w.current*.06})`,n.fillRect(0,0,d,f))},re=e=>{te(D.current,e),ne(D.current)};if(j)return re(!0),()=>{e.removeEventListener(`pointermove`,I),e.removeEventListener(`pointerenter`,L),e.removeEventListener(`pointerdown`,R),e.removeEventListener(`pointerleave`,z),M(),N()};let ie=e=>{if(E=requestAnimationFrame(ie),A)return;k||=e;let t=_((e-k)/1e3,.008,.04);k=e,B(t),D.current+=t*O.current.speed,C.current*=Math.exp(-t*3.2),w.current*=Math.exp(-t*7);for(let e of S.current)e.t+=t*.95;S.current=S.current.filter(e=>e.t<1),re(!1)};return ie(0),()=>{cancelAnimationFrame(E),e.removeEventListener(`pointermove`,I),e.removeEventListener(`pointerenter`,L),e.removeEventListener(`pointerdown`,R),e.removeEventListener(`pointerleave`,z),M(),N()}},[f,d]),(0,l.jsx)(`div`,{ref:u,className:vl.auroraVeil,style:p,children:(0,l.jsx)(`canvas`,{ref:m,className:vl.canvas,style:{width:d,height:f},role:`img`,"aria-label":s})})},kl={solarSystem:`cos-solarSystem-27h8F`,canvas:`cos-canvas-C0nRa`},Al=[{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}],jl=({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=Al.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=y(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:kl.solarSystem,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:i,className:kl.canvas,style:{width:e,height:t}})})},Ml={snowfall:`cos-snowfall-Q-Dhg`,canvas:`cos-canvas-bJVF8`},Nl=({width:e,height:t,fill:n=!1,mode:r=`snow`,count:i=120})=>{let{hostRef:a,width:o,height:s,hostStyle:u}=E({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),d=(0,c.useRef)(null),f=(0,c.useRef)([]),p=(0,c.useRef)(0),m=(0,c.useCallback)(e=>({x:Math.random()*o,y:e??Math.random()*s,size:r===`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}),[s,r,o]);return(0,c.useEffect)(()=>{f.current=Array.from({length:i},()=>m())},[i,m]),(0,c.useEffect)(()=>{let e=d.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=o*t,e.height=s*t;let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let i=document.hidden,a=b(),c=y(e=>{i=e}),l=x(e=>{a=e}),u=e=>{n.globalAlpha=e.opacity,n.fillStyle=`#fff`,n.beginPath(),n.arc(e.x,e.y,e.size,0,Math.PI*2),n.fill()},h=e=>{n.save(),n.translate(e.x,e.y),n.rotate(e.rotation),n.globalAlpha=e.opacity;let t=e.size;n.fillStyle=`#ffb7c5`,n.beginPath(),n.ellipse(0,0,t,t*.6,0,0,Math.PI*2),n.fill(),n.fillStyle=`#ff8fa3`,n.beginPath(),n.ellipse(t*.3,0,t*.5,t*.35,.5,0,Math.PI*2),n.fill(),n.restore()},g=e=>{n.fillStyle=r===`sakura`?`#1a1020`:`#0f172a`,n.fillRect(0,0,o,s),f.current.forEach(t=>{e&&(t.y+=t.speed,t.x+=t.drift+Math.sin(t.y*.02)*.3,t.rotation+=t.rotationSpeed,t.y>s+10&&Object.assign(t,m(-10))),r===`sakura`?h(t):u(t)}),n.globalAlpha=1};if(a)return g(!1),()=>{c(),l()};let _=()=>{p.current=requestAnimationFrame(_),!i&&(a||g(!0))};return _(),()=>{cancelAnimationFrame(p.current),c(),l()}},[m,s,r,o]),(0,l.jsx)(`div`,{ref:a,className:Ml.snowfall,style:u,children:(0,l.jsx)(`canvas`,{ref:d,className:Ml.canvas,style:{width:o,height:s}})})},Pl={starfield:`cos-starfield-QTwia`,canvas:`cos-canvas-C2t3g`},Fl=({width:e,height:t,fill:n=!1,starCount:r=400,speed:i=1})=>{let{hostRef:a,width:o,height:s,hostStyle:u}=E({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),d=(0,c.useRef)(null),f=(0,c.useRef)([]),p=(0,c.useRef)(0);return(0,c.useEffect)(()=>{f.current=Array.from({length:r},()=>({x:(Math.random()-.5)*o,y:(Math.random()-.5)*s,z:Math.random()*o}))},[s,r,o]),(0,c.useEffect)(()=>{let e=d.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=o*t,e.height=s*t;let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let r=o/2,a=s/2,c=document.hidden,l=b(),u=y(e=>{c=e}),m=x(e=>{l=e}),h=e=>{n.fillStyle=`rgb(0 0 0 / 25%)`,n.fillRect(0,0,o,s),f.current.forEach(t=>{e&&(t.z-=i*2,t.z<=0&&(t.x=(Math.random()-.5)*o,t.y=(Math.random()-.5)*s,t.z=o));let c=128/t.z,l=t.x*c+r,u=t.y*c+a;if(l<0||l>=o||u<0||u>=s)return;let d=(1-t.z/o)*3,f=(1-t.z/o)*255;if(e&&d>.5){let e=128/(t.z+i*4),o=t.x*e+r,s=t.y*e+a;n.beginPath(),n.strokeStyle=`rgb(${f} ${f} ${f+30})`,n.lineWidth=d,n.moveTo(o,s),n.lineTo(l,u),n.stroke()}else n.fillStyle=`rgb(${f} ${f} ${f+30})`,n.fillRect(l,u,Math.max(d,.5),Math.max(d,.5))})};if(l)return n.fillStyle=`#000`,n.fillRect(0,0,o,s),h(!1),()=>{u(),m()};let g=()=>{p.current=requestAnimationFrame(g),!c&&(l||h(!0))};return g(),()=>{cancelAnimationFrame(p.current),u(),m()}},[s,i,r,o]),(0,l.jsx)(`div`,{ref:a,className:Pl.starfield,style:u,children:(0,l.jsx)(`canvas`,{ref:d,className:Pl.canvas,style:{width:o,height:s}})})},Il={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`},Ll=({progress:e=0,onOpen:t,label:n=`开启宝箱`,openedLabel:r=`宝箱已开启!`})=>{let i=(0,c.useRef)(!1),a=(0,c.useRef)(t),o=_(e,0,100),s=o>=100;return(0,c.useEffect)(()=>{a.current=t},[t]),(0,c.useEffect)(()=>{s&&!i.current&&(i.current=!0,a.current?.()),s||(i.current=!1)},[s]),(0,l.jsxs)(`div`,{className:Il.progressChest,children:[(0,l.jsxs)(`div`,{className:Il.barWrap,children:[(0,l.jsx)(`div`,{className:Il.barTrack,children:(0,l.jsx)(`div`,{className:Il.barFill,style:{width:`${o}%`}})}),(0,l.jsxs)(`span`,{className:Il.pct,children:[o.toFixed(0),`%`]})]}),(0,l.jsxs)(`div`,{className:`${Il.chest} ${s?Il.open:``}`,children:[(0,l.jsxs)(`div`,{className:Il.lid,children:[(0,l.jsx)(`div`,{className:Il.lidTop}),(0,l.jsx)(`div`,{className:Il.lock})]}),(0,l.jsx)(`div`,{className:Il.body,children:s&&(0,l.jsxs)(`div`,{className:Il.treasure,children:[(0,l.jsx)(`span`,{children:`💎`}),(0,l.jsx)(`span`,{children:`✨`}),(0,l.jsx)(`span`,{children:`🪙`})]})})]}),(0,l.jsx)(`p`,{className:Il.label,children:s?r:n})]})},Rl={radarScan:`cos-radarScan-PZaG8`,canvas:`cos-canvas-fUw5N`},zl=({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=y(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:Rl.radarScan,style:{width:e,height:e},children:(0,l.jsx)(`canvas`,{ref:r,className:Rl.canvas,style:{width:e,height:e}})})},Bl={redPacketRain:`cos-redPacketRain-eJ7FW`,canvas:`cos-canvas-direH`,hud:`cos-hud-InqMq`,end:`cos-end-u0J7o`,hint:`cos-hint-sO6ld`},Vl=(0,c.forwardRef)(({width:e,height:t,fill:n=!1,duration:r=1e4,auto:i=!0,onGrab:a,onEnd:o,grabbedLabel:s=`已抢:`,endedText:u=`红包雨结束`,hint:d=`点击红包抢夺`},f)=>{let p=(0,c.useRef)(null),{width:m,height:h}=T({fill:n,width:e,height:t,defaultWidth:400,defaultHeight:500,measured:w(p,{enabled:n})}),g=(0,c.useRef)(null),_=(0,c.useRef)([]),v=(0,c.useRef)(0),S=(0,c.useRef)(0),E=(0,c.useRef)(0),D=(0,c.useRef)(0),O=(0,c.useRef)(0),[k,A]=(0,c.useState)(0),[j,M]=(0,c.useState)(i),N=(0,c.useRef)(i),P=(0,c.useRef)(a),F=(0,c.useRef)(o),I=(0,c.useRef)({width:m,height:h});I.current={width:m,height:h},(0,c.useEffect)(()=>{P.current=a},[a]),(0,c.useEffect)(()=>{F.current=o},[o]),(0,c.useEffect)(()=>{N.current=j},[j]);let L=(0,c.useCallback)(()=>{N.current&&(N.current=!1,M(!1),F.current?.())},[]),R=(0,c.useCallback)(()=>{O.current+=1;let e=O.current;_.current=[],E.current=0,N.current=!0,M(!0),window.clearTimeout(D.current),D.current=window.setTimeout(()=>{e===O.current&&L()},r)},[r,L]),z=(0,c.useCallback)(()=>{window.clearTimeout(D.current),L()},[L]),B=(0,c.useCallback)(()=>{window.clearTimeout(D.current),O.current+=1,_.current=[],E.current=0,N.current=!1,M(!1),A(0)},[]);(0,c.useImperativeHandle)(f,()=>({start:R,stop:z,reset:B}),[B,R,z]);let V=(0,c.useCallback)(()=>{let{width:e}=I.current;_.current.push({id:S.current++,x:Math.random()*(e-50)+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})},[]);(0,c.useEffect)(()=>(i&&R(),()=>{window.clearTimeout(D.current)}),[i,R]),(0,c.useEffect)(()=>{let e=g.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=m*t,e.height=h*t;let n=e.getContext(`2d`);if(!n)return;n.setTransform(t,0,0,t,0,0);let r=document.hidden,i=b(),a=y(e=>{r=e}),o=x(e=>{i=e}),s=()=>{if(v.current=requestAnimationFrame(s),r)return;let{width:e,height:t}=I.current;!i&&N.current&&(E.current++,E.current%20==0&&V()),n.fillStyle=`rgb(15 23 42 / 20%)`,n.fillRect(0,0,e,t),_.current=_.current.filter(e=>e.grabbed?!1:(i||(e.y+=e.speed,e.x+=Math.sin(e.y*.02)*.5),n.save(),n.translate(e.x,e.y),n.rotate(e.rotation),n.fillStyle=`#dc2626`,n.beginPath(),n.roundRect(-22,-28,44,56,6),n.fill(),n.fillStyle=`#fbbf24`,n.beginPath(),n.arc(0,-10,8,0,Math.PI*2),n.fill(),n.fillStyle=`#fde68a`,n.font=`bold 12px system-ui`,n.textAlign=`center`,n.fillText(`¥${e.amount}`,0,12),n.restore(),i?!0:e.y<t+60))};return s(),()=>{cancelAnimationFrame(v.current),a(),o()}},[h,V,m]);let H=(e,t)=>{if(!N.current)return;let n=!1;_.current=_.current.map(r=>r.grabbed||n?r:Math.abs(e-r.x)<30&&Math.abs(t-r.y)<35?(n=!0,A(e=>e+r.amount),P.current?.(r.amount),{...r,grabbed:!0}):r)};return(0,l.jsxs)(`div`,{ref:p,className:Bl.redPacketRain,style:n?{width:`100%`,height:`100%`}:void 0,children:[(0,l.jsx)(`canvas`,{ref:g,className:Bl.canvas,style:{width:m,height:h,touchAction:`none`},onPointerDown:e=>{let t=C(e.currentTarget,e.nativeEvent);t&&H(t.x,t.y)}}),(0,l.jsxs)(`div`,{className:Bl.hud,children:[(0,l.jsxs)(`span`,{children:[s,` ¥`,k]}),!j&&(0,l.jsx)(`span`,{className:Bl.end,children:u})]}),(0,l.jsx)(`p`,{className:Bl.hint,children:d})]})});Vl.displayName=`RedPacketRain`;var Hl={returnCityContainer:`cos-returnCityContainer-6XTxj`,star:`cos-star-a59Dx`,glassWrap:`cos-glassWrap-golMO`,rotate:`cos-rotate-7X9Jj`,glassItem:`cos-glassItem-OwlFI`},Ul=({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=Hl.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=Hl.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:Hl.returnCityContainer,children:(0,l.jsx)(`div`,{ref:i,className:Hl.glassWrap})})},Wl={ropeChain:`cos-ropeChain-gYaSK`,canvas:`cos-canvas-5i95N`},Gl=({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}},_=e=>m(e.clientX,e.clientY),v=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`,_),c.addEventListener(`mousemove`,v),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=y(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`,_),c.removeEventListener(`mousemove`,v),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:Wl.ropeChain,style:{width:e,height:t},children:(0,l.jsx)(`canvas`,{ref:a,className:Wl.canvas,style:{width:e,height:t}})})},Kl={rotatingText:`cos-rotatingText-uIUt4`,badge:`cos-badge-kZAc-`,char:`cos-char-B5HUV`,enter:`cos-enter-JqV3n`,slideIn:`cos-slideIn-4B5cg`,exit:`cos-exit-5rJ34`,slideOut:`cos-slideOut-YeYDC`},ql=[`React`,`Motion`,`Design`,`COS`],Jl=e=>{let t=Intl;if(t.Segmenter){let n=new t.Segmenter(`en`,{granularity:`grapheme`});return Array.from(n.segment(e),e=>e.segment)}return Array.from(e)},Yl=({texts:e=ql,interval:t=2200,stagger:n=40,duration:r=420,fontSize:i=56,color:a=`#0f172a`,highlightColor:o=`#38bdf8`})=>{let s=(0,c.useMemo)(()=>e.length>0?e:ql,[e]),[u,d]=(0,c.useState)(0),[f,p]=(0,c.useState)(`enter`),m=(0,c.useMemo)(()=>Jl(s[u]),[u,s]);return(0,c.useEffect)(()=>{let e,i;return e=setTimeout(()=>{p(`exit`),i=setTimeout(()=>{d(e=>(e+1)%s.length),p(`enter`)},m.length*n+r)},t),()=>{e&&clearTimeout(e),i&&clearTimeout(i)}},[m.length,r,u,t,s.length,n]),(0,l.jsx)(`div`,{className:Kl.rotatingText,children:(0,l.jsx)(`div`,{className:Kl.badge,style:{fontSize:i,color:a,"--rt-bg":o,"--rt-duration":`${r}ms`},children:m.map((e,t)=>(0,l.jsx)(`span`,{className:`${Kl.char} ${f===`enter`?Kl.enter:Kl.exit}`,style:{animationDelay:`${f===`enter`?t*n:(m.length-1-t)*n}ms`},children:e===` `?`\xA0`:e},`${s[u]}-${e}-${t}-${f}`))})})},Xl={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`},Zl=(e,t,n,r)=>{let i=(r-90)*Math.PI/180;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}},Ql=({value:e=0,max:t=100,label:n=`SPEED`,color:r=`#f97316`})=>{let i=-120+_(t>0?e/t:0,0,1)*240,a=(0,c.useMemo)(()=>{let e=Zl(100,100,72,-120),t=Zl(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=Zl(100,100,72,-120),t=Zl(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=Zl(100,100,58,i);return(0,l.jsxs)(`div`,{className:Xl.speedometer,style:{"--gauge-color":r},children:[(0,l.jsxs)(`svg`,{viewBox:`0 0 200 130`,className:Xl.svg,children:[(0,l.jsx)(`path`,{d:a,className:Xl.track,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),(0,l.jsx)(`path`,{d:o,className:Xl.valueArc,fill:`none`,strokeWidth:`12`,strokeLinecap:`round`}),[-120,-60,0,60,120].map(e=>{let t=Zl(100,100,58,e),n=Zl(100,100,66,e);return(0,l.jsx)(`line`,{x1:t.x,y1:t.y,x2:n.x,y2:n.y,className:Xl.tick},e)}),(0,l.jsx)(`line`,{x1:`100`,y1:`100`,x2:s.x,y2:s.y,className:Xl.needle}),(0,l.jsx)(`circle`,{cx:`100`,cy:`100`,r:`6`,className:Xl.hub}),(0,l.jsx)(`text`,{x:`100`,y:`118`,className:Xl.valueText,children:Math.round(e)})]}),(0,l.jsx)(`span`,{className:Xl.label,children:n})]})},$l={shinyText:`cos-shinyText-L0KoE`,text:`cos-text-J5KhP`,"shine-sweep":`cos-shine-sweep-jIufI`,paused:`cos-paused-dqgKu`},eu=({text:e=`SHINY TEXT`,speed:t=2,color:n=`#94a3b8`,shineColor:r=`#ffffff`,fontSize:i=64,disabled:a=!1})=>(0,l.jsx)(`div`,{className:$l.shinyText,children:(0,l.jsx)(`span`,{className:`${$l.text} ${a?$l.paused:``}`,style:{fontSize:i,"--shiny-color":n,"--shiny-shine":r,"--shiny-duration":`${Math.max(t,.4)}s`},children:e})}),tu={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`},nu=({steps:e=[`Start`,`Process`,`Review`,`Done`],current:t=0,color:n=`#22d3ee`})=>{let r=_(t,0,Math.max(0,e.length-1)),i=e.length>1?r/(e.length-1):0;return(0,l.jsx)(`div`,{className:tu.timelinePulse,style:{"--pulse-color":n,"--step-count":e.length,"--progress-ratio":i},children:(0,l.jsxs)(`div`,{className:tu.axis,children:[(0,l.jsx)(`div`,{className:tu.track}),(0,l.jsx)(`div`,{className:tu.progress}),(0,l.jsx)(`ul`,{className:tu.steps,children:e.map((e,t)=>{let n=t<r?`done`:t===r?`current`:`pending`;return(0,l.jsxs)(`li`,{className:tu.step,"data-state":n,children:[(0,l.jsx)(`span`,{className:tu.dot}),(0,l.jsx)(`span`,{className:tu.name,children:e})]},e+t)})})]})})},ru={rippleWater:`cos-rippleWater-wsinI`,canvas:`cos-canvas-XOdSF`,hint:`cos-hint-0JH5D`},iu=`
158
+ attribute vec2 a_pos;
159
+ varying vec2 v_uv;
160
+ void main() {
161
+ v_uv = a_pos * 0.5 + 0.5;
162
+ gl_Position = vec4(a_pos, 0.0, 1.0);
163
+ }
164
+ `,au=`
9
165
  precision highp float;
10
166
 
11
167
  uniform float u_time;
@@ -90,4 +246,4 @@ void main() {
90
246
 
91
247
  gl_FragColor = vec4(water, 1.0);
92
248
  }
93
- `,$o=e=>{let t=e.replace(`#`,``),n=t.length===3?t.split(``).map(e=>e+e).join(``):t,r=Number.parseInt(n,16);return Number.isNaN(r)?[.22,.74,.97]:[(r>>16&255)/255,(r>>8&255)/255,(r&255)/255]},es=(e,t,n)=>{let r=e.createShader(t);return r?(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(e.deleteShader(r),null)):null},ts=(e,t,n)=>{let r=es(e,e.VERTEX_SHADER,t),i=es(e,e.FRAGMENT_SHADER,n);if(!r||!i)return null;let a=e.createProgram();return a?(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),e.deleteShader(r),e.deleteShader(i),e.getProgramParameter(a,e.LINK_STATUS)?a:(e.deleteProgram(a),null)):null},ns=192,rs=e=>({from:$o(e.fromColor),to:$o(e.toColor),tint:$o(e.color),waveAmplitude:e.waveAmplitude,waveSpeed:e.waveSpeed,shimmer:e.shimmer,reflection:e.reflection,rippleStrength:e.rippleStrength,rippleRadius:e.rippleRadius,damping:e.damping,spread:e.spread,interactive:e.interactive}),is=({width:e,height:t,fill:n=!1,fromColor:r=`#52ade3`,toColor:i=`#013565`,color:a=`#a8d8f5`,waveAmplitude:o=1,waveSpeed:s=1,shimmer:u=1,reflection:d=.38,rippleStrength:f=1,rippleRadius:p=6,damping:m=.985,spread:h=.5,interactive:g=!0,showHint:x=!0,hint:S=`点击水面产生涟漪`})=>{let{hostRef:C,width:w,height:E,hostStyle:D}=T({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),O=(0,c.useRef)(null),k=(0,c.useRef)(0),A=(0,c.useRef)(null),j=(0,c.useRef)(rs({fromColor:r,toColor:i,color:a,waveAmplitude:o,waveSpeed:s,shimmer:u,reflection:d,rippleStrength:f,rippleRadius:p,damping:m,spread:h,interactive:g}));(0,c.useEffect)(()=>{j.current=rs({fromColor:r,toColor:i,color:a,waveAmplitude:o,waveSpeed:s,shimmer:u,reflection:d,rippleStrength:f,rippleRadius:p,damping:m,spread:h,interactive:g})},[r,i,a,o,s,u,d,f,p,m,h,g]);let M=(0,c.useCallback)((e,t)=>{if(!j.current.interactive)return;let n=O.current;if(!n)return;let r=n.getBoundingClientRect();A.current={x:(e-r.left)/r.width,y:1-(t-r.top)/r.height,strength:j.current.rippleStrength}},[]);return(0,c.useEffect)(()=>{let e=O.current;if(!e)return;let t=e=>{e.pointerType===`mouse`&&e.button!==0||M(e.clientX,e.clientY)};return e.addEventListener(`pointerdown`,t),()=>e.removeEventListener(`pointerdown`,t)},[M]),(0,c.useEffect)(()=>{let e=O.current;if(!e)return;let t=Math.min(window.devicePixelRatio||1,2);e.width=Math.floor(w*t),e.height=Math.floor(E*t);let n=e.getContext(`webgl`,{alpha:!1,antialias:!1,depth:!1,stencil:!1,premultipliedAlpha:!1});if(!n)return;let r=ts(n,Zo,Qo);if(!r)return;let i=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,i),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),n.STATIC_DRAW);let a=n.getAttribLocation(r,`a_pos`),o=n.getUniformLocation(r,`u_time`),s=n.getUniformLocation(r,`u_res`),c=n.getUniformLocation(r,`u_tint`),l=n.getUniformLocation(r,`u_from`),u=n.getUniformLocation(r,`u_to`),d=n.getUniformLocation(r,`u_height`),f=n.getUniformLocation(r,`u_sim`),p=n.getUniformLocation(r,`u_waveAmp`),m=n.getUniformLocation(r,`u_waveSpeed`),h=n.getUniformLocation(r,`u_shimmer`),g=n.getUniformLocation(r,`u_reflection`),x=ns*ns,S=new Float32Array(x),C=new Float32Array(x),T=new Float32Array(x),D=n.createTexture();n.bindTexture(n.TEXTURE_2D,D),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);let M=new Uint8Array(x*4),N=()=>{for(let e=0;e<x;e++){let t=Math.max(0,Math.min(255,Math.floor((C[e]*.5+.5)*255))),n=e*4;M[n]=t,M[n+1]=t,M[n+2]=t,M[n+3]=255}n.bindTexture(n.TEXTURE_2D,D),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,ns,ns,0,n.RGBA,n.UNSIGNED_BYTE,M)},P=(e,t,n,r)=>{let i=e*(ns-1),a=t*(ns-1),o=_(r,2,12);for(let e=-o-1;e<=o+1;e++)for(let t=-o-1;t<=o+1;t++){let r=Math.round(i+t),s=Math.round(a+e);if(r<=0||r>=ns-1||s<=0||s>=ns-1)continue;let c=Math.sqrt(t*t+e*e),l=Math.exp(-c*c*.55)*-.35,u=Math.exp(-((c-o*.55)**2)*.9);C[s*ns+r]+=n*(l+u*1.1)}},F=(e,t)=>{let n=_(e,.9,.999),r=_(t,.3,.7);for(let e=0;e<2;e++){for(let e=1;e<ns-1;e++){let t=e*ns;for(let e=1;e<ns-1;e++){let i=t+e,a=C[i-1]+C[i+1]+C[i-ns]+C[i+ns];T[i]=(a*r-S[i])*n,T[i]>1.5?T[i]=1.5:T[i]<-1.5&&(T[i]=-1.5)}}let e=S;S=C,C=T,T=e,T.fill(0)}},I=t=>{let v=j.current;n.viewport(0,0,e.width,e.height),n.useProgram(r),n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(a),n.vertexAttribPointer(a,2,n.FLOAT,!1,0,0),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,D),n.uniform1i(d,0),n.uniform1f(o,t),n.uniform2f(s,e.width,e.height),n.uniform3f(c,v.tint[0],v.tint[1],v.tint[2]),n.uniform3f(l,v.from[0],v.from[1],v.from[2]),n.uniform3f(u,v.to[0],v.to[1],v.to[2]),n.uniform2f(f,ns,ns),n.uniform1f(p,_(v.waveAmplitude,0,2)),n.uniform1f(m,_(v.waveSpeed,0,3)),n.uniform1f(h,_(v.shimmer,0,2)),n.uniform1f(g,_(v.reflection,0,1)),n.drawArrays(n.TRIANGLE_STRIP,0,4)};N();let L=document.hidden,R=y(),z=v(e=>{L=e}),B=b(e=>{R=e});if(R)return I(0),()=>{z(),B(),n.deleteTexture(D),n.deleteBuffer(i),n.deleteProgram(r)};let V=performance.now(),H=e=>{if(k.current=requestAnimationFrame(H),L||R)return;let t=j.current;if(A.current){let e=A.current,n=_(e.strength,0,3),r=t.rippleRadius;P(e.x,e.y,n,r),P(e.x+.004,e.y-.003,n*.35,r),A.current=null}F(t.damping,t.spread),N(),I((e-V)/1e3)};return k.current=requestAnimationFrame(H),()=>{cancelAnimationFrame(k.current),z(),B(),n.deleteTexture(D),n.deleteBuffer(i),n.deleteProgram(r)}},[E,w]),(0,l.jsxs)(`div`,{ref:C,className:Xo.rippleWater,style:D,children:[(0,l.jsx)(`canvas`,{ref:O,className:Xo.canvas,style:{width:w,height:E,cursor:g?`pointer`:`default`},role:`img`,"aria-label":S||`涟漪水面`}),x?(0,l.jsx)(`span`,{className:Xo.hint,"aria-hidden":!0,children:S}):null]})},as={scrambleText:`cos-scrambleText-hN4Wm`,text:`cos-text-frsHs`,cursor:`cos-cursor-3zQOy`,blink:`cos-blink-OcKXu`},os=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*`,ss=({text:e=`DECRYPTED`,duration:t=2e3,charset:n=os})=>{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:os,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:as.scrambleText,children:(0,l.jsxs)(`p`,{className:as.text,children:[r,(0,l.jsx)(`span`,{className:as.cursor})]})})},cs={scratchCard:`cos-scratchCard-McIEK`,prize:`cos-prize-X0z5V`,canvas:`cos-canvas-JqIlr`,hidden:`cos-hidden-Lsfbt`},ls=(0,c.forwardRef)(({coverColor:e=`#94a3b8`,prize:t=`🎉 恭喜中奖!`,coverText:n=`刮开涂层`,revealThreshold:r=.45,onReveal:i,width:a=300,height:o=180},s)=>{let u=(0,c.useRef)(null),d=(0,c.useRef)(!1),f=(0,c.useRef)(!1),p=(0,c.useRef)(i),m=(0,c.useRef)(r),[h,g]=(0,c.useState)(!1);(0,c.useEffect)(()=>{p.current=i},[i]),(0,c.useEffect)(()=>{m.current=r},[r]);let _=(0,c.useCallback)(t=>{t.globalCompositeOperation=`source-over`,t.fillStyle=e,t.fillRect(0,0,a,o),t.fillStyle=`rgb(255 255 255 / 30%)`,t.font=`bold 16px system-ui, sans-serif`,t.textAlign=`center`,t.fillText(n,a/2,o/2)},[e,n,o,a]),v=(0,c.useCallback)(()=>{let e=u.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=a*t,e.height=o*t;let n=e.getContext(`2d`);n&&(n.setTransform(t,0,0,t,0,0),_(n))},[_,o,a]),y=(0,c.useCallback)(()=>{f.current||(f.current=!0,g(!0),p.current?.())},[]),b=(0,c.useCallback)(e=>{if(f.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)>m.current&&y()},[y]);(0,c.useEffect)(()=>{f.current=!1,g(!1),v()},[v]);let x=(e,t)=>{let n=u.current;if(!n||f.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(),b(n))},C=e=>{`touches`in e&&e.preventDefault(),d.current=!0;let t=u.current;if(!t)return;let n=S(t,e.nativeEvent);n&&x(n.x,n.y)},w=e=>{if(!d.current)return;`touches`in e&&e.preventDefault();let t=u.current;if(!t)return;let n=S(t,e.nativeEvent);n&&x(n.x,n.y)},T=()=>{d.current=!1};return(0,c.useImperativeHandle)(s,()=>({reset:()=>{f.current=!1,g(!1),v()},reveal:()=>{y()}}),[y,v]),(0,l.jsxs)(`div`,{className:cs.scratchCard,style:{width:a,height:o},children:[(0,l.jsx)(`div`,{className:cs.prize,children:t}),(0,l.jsx)(`canvas`,{ref:u,className:`${cs.canvas} ${h?cs.hidden:``}`,style:{width:a,height:o},onMouseDown:C,onMouseMove:w,onMouseUp:T,onMouseLeave:T,onTouchStart:C,onTouchMove:w,onTouchEnd:T})]})});ls.displayName=`ScratchCard`;var us={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`},ds=[`🍒`,`🍋`,`🍊`,`🍇`,`⭐`,`7️⃣`],fs=30,ps=8,ms=[0,350,700],hs=e=>1-(1-e)**3,gs=(e,t)=>{if(t===void 0)return Math.floor(Math.random()*e.length);let n=e.indexOf(t);return n>=0?n:Math.floor(Math.random()*e.length)},_s=(0,c.forwardRef)(({symbols:e=ds,spinDuration:t=3e3,targetResults:n,onSpinEnd:r,startText:i,buttonText:a,spinningText:o=`旋转中...`,jackpotText:s=`🎰 大奖!`,resultPrefix:u=`结果:`},d)=>{let f=a??i??`开始`,[p,m]=(0,c.useState)(!1),[h,g]=(0,c.useState)([0,0,0]),[_,v]=(0,c.useState)([]),y=(0,c.useRef)(0),b=(0,c.useRef)(!1),x=(0,c.useRef)(h),S=(0,c.useRef)(r),C=(0,c.useRef)(e),w=(0,c.useRef)(n),T=(0,c.useRef)(null);(0,c.useEffect)(()=>{S.current=r},[r]),(0,c.useEffect)(()=>{C.current=e},[e]),(0,c.useEffect)(()=>{w.current=n},[n]),(0,c.useEffect)(()=>{b.current=p},[p]),(0,c.useEffect)(()=>{x.current=h},[h]);let E=e.length*80,D=Math.floor(fs/2)*E,O=(0,c.useCallback)(()=>{let t=[];for(let n=0;n<fs;n++)t.push(...e);return t},[e])(),k=(e,t)=>-(e-1+t*C.current.length)*80,A=(0,c.useCallback)(e=>{let n=C.current;if(b.current||n.length===0)return;m(!0),v([]);let r=e??w.current,i=[0,1,2].map(e=>gs(n,r?.[e])),a=[...x.current],o=n.length*80,s=i.map((e,t)=>{let n=a[t],r=ps*o,i=Math.ceil((-n+r)/o)+1,s=k(e,i);for(;n-s<r;)i+=1,s=k(e,i);return s}),c=Math.max(t,16),l=performance.now(),u={cancelled:!1};T.current=u;let d=e=>{if(!u.cancelled){if(g(a.map((t,n)=>{let r=e-l-ms[n];if(r<0)return t;let i=hs(Math.min(r/c,1));return t+(s[n]-t)*i})),!ms.every(t=>e-l-t>=c))y.current=requestAnimationFrame(d);else if(!u.cancelled){let e=i.map(e=>n[e]);g(i.map(e=>k(e,Math.round(D/o)))),v(e),m(!1),S.current?.(e)}}};y.current=requestAnimationFrame(d)},[D,t]),j=(0,c.useCallback)(()=>{b.current||v([])},[]);return(0,c.useImperativeHandle)(d,()=>({spin:A,reset:j}),[A,j]),(0,c.useEffect)(()=>()=>{T.current&&(T.current.cancelled=!0),cancelAnimationFrame(y.current)},[]),(0,l.jsxs)(`div`,{className:us.slotMachine,children:[(0,l.jsx)(`div`,{className:us.machine,children:[0,1,2].map(e=>(0,l.jsxs)(`div`,{className:us.reel,style:{height:240},children:[(0,l.jsx)(`div`,{className:us.strip,style:{transform:`translateY(${h[e]}px)`},children:O.map((e,t)=>(0,l.jsx)(`div`,{className:us.item,style:{height:80},children:e},t))}),(0,l.jsx)(`div`,{className:us.mask})]},e))}),(0,l.jsx)(`button`,{type:`button`,className:us.spinBtn,"data-testid":`slot-machine-spin`,onClick:()=>A(),disabled:p,"aria-busy":p,children:p?o:f}),_.length>0&&!p&&(0,l.jsx)(`p`,{className:us.result,children:_[0]===_[1]&&_[1]===_[2]?s:`${u} ${_.join(` `)}`})]})});_s.displayName=`SlotMachine`;var vs={sandFall:`cos-sandFall-kgJeI`,canvas:`cos-canvas-9z6X1`,toolbar:`cos-toolbar-u8dLM`,hint:`cos-hint-DS8tY`,button:`cos-button-YhINe`},ys=[`#fbbf24`,`#f59e0b`,`#d97706`,`#b45309`,`#92400e`],bs=e=>{let t=e.trim().replace(`#`,``);if(!/^[0-9a-fA-F]{6}$/.test(t))return[251,191,36];let n=parseInt(t,16);return[n>>16&255,n>>8&255,n&255]},xs=({width:e=480,height:t=400,cellSize:n=4,colors:r=ys,spawnRate:i=3,hint:a=`按住鼠标绘制沙粒`,clearText:o=`Clear`})=>{let s=(0,c.useRef)(null),u=Math.max(1,Math.floor(e/n)),d=Math.max(1,Math.floor(t/n)),f=(0,c.useRef)(Array(u*d).fill(null)),p=(0,c.useRef)({x:-1,y:-1,down:!1}),m=(0,c.useMemo)(()=>(r.length>0?r:ys).map(bs),[r]),h=()=>{f.current=Array(u*d).fill(null)};(0,c.useEffect)(()=>{f.current=Array(u*d).fill(null)},[u,d]),(0,c.useEffect)(()=>{let r=s.current;if(!r)return;let a=window.devicePixelRatio||1;r.width=e*a,r.height=t*a;let o=r.getContext(`2d`);if(!o)return;o.setTransform(a,0,0,a,0,0);let c=0,l=document.hidden,h=v(e=>{l=e}),g=(e,t)=>t*u+e,_=()=>{let e=f.current;for(let t=d-2;t>=0;t--)for(let n=0;n<u;n++){let r=g(n,t);if(e[r]===null)continue;let i=g(n,t+1);if(e[i]===null){e[i]=e[r],e[r]=null;continue}let a=Math.random()<.5?-1:1,o=n+a,s=n-a;o>=0&&o<u&&e[g(o,t+1)]===null?(e[g(o,t+1)]=e[r],e[r]=null):s>=0&&s<u&&e[g(s,t+1)]===null&&(e[g(s,t+1)]=e[r],e[r]=null)}},y=()=>{let{x:e,y:t,down:r}=p.current;if(!r||e<0||t<0)return;let a=Math.floor(e/n),o=Math.floor(t/n),s=f.current;for(let e=0;e<i;e++){let e=a+Math.floor((Math.random()-.5)*6),t=o+Math.floor((Math.random()-.5)*3);if(e<0||e>=u||t<0||t>=d)continue;let n=g(e,t);s[n]===null&&(s[n]=Math.floor(Math.random()*m.length))}},b=()=>{o.fillStyle=`#0f172a`,o.fillRect(0,0,e,t);let r=f.current;for(let e=0;e<d;e++)for(let t=0;t<u;t++){let i=r[g(t,e)];if(i===null)continue;let[a,s,c]=m[i];o.fillStyle=`rgb(${a} ${s} ${c})`,o.fillRect(t*n,e*n,n,n)}},x=()=>{c=requestAnimationFrame(x),!l&&(y(),_(),b())};return c=requestAnimationFrame(x),()=>{cancelAnimationFrame(c),h()}},[n,u,t,m,d,i,e]);let g=(e,t,n,r)=>{p.current={x:e-n.left,y:t-n.top,down:r}};return(0,l.jsxs)(`div`,{className:vs.sandFall,style:{width:e},children:[(0,l.jsx)(`canvas`,{ref:s,className:vs.canvas,style:{width:e,height:t},onMouseDown:e=>g(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect(),!0),onMouseMove:e=>{p.current.down&&g(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect(),!0)},onMouseUp:()=>{p.current.down=!1},onMouseLeave:()=>{p.current.down=!1},onTouchStart:e=>{let t=e.touches[0];t&&g(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect(),!0)},onTouchMove:e=>{let t=e.touches[0];t&&g(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect(),!0)},onTouchEnd:()=>{p.current.down=!1}}),(0,l.jsxs)(`div`,{className:vs.toolbar,children:[(0,l.jsx)(`span`,{className:vs.hint,children:a}),(0,l.jsx)(`button`,{type:`button`,className:vs.button,onClick:h,children:o})]})]})},Ss={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`},Cs=[`fromTop`,`fromBottom`,`fromLeft`,`fromRight`],ws=({text:e=`REVEAL`,delay:t=80,color:n=`#f8fafc`})=>(0,l.jsx)(`div`,{className:Ss.splitReveal,children:(0,l.jsx)(`h1`,{className:Ss.text,style:{"--reveal-color":n},children:e.split(``).map((e,n)=>(0,l.jsx)(`span`,{className:`${Ss.char} ${Ss[Cs[n%Cs.length]]}`,style:{animationDelay:`${n*t}ms`},children:e===` `?`\xA0`:e},`${e}-${n}`))})}),Ts={splitText:`cos-splitText-hz-Wy`,text:`cos-text-E89BY`,char:`cos-char-Rmkag`,fadeUp:`cos-fadeUp-5VVYL`,enter:`cos-enter-Nt9F9`,fadeUpIn:`cos-fadeUpIn-eRcGj`,exit:`cos-exit-oGQWA`,fadeUpOut:`cos-fadeUpOut-YFnv-`,scale:`cos-scale-yrOq-`,scaleIn:`cos-scaleIn-0YN5q`,scaleOut:`cos-scaleOut-4Q-NP`,rotate:`cos-rotate-TXlZi`,rotateIn:`cos-rotateIn-ixK-d`,rotateOut:`cos-rotateOut-OA6Ys`,blur:`cos-blur-8VyzQ`,blurIn:`cos-blurIn-X-IdF`,blurOut:`cos-blurOut-ZBSbO`},Es=({text:e=`SPLIT TEXT`,animation:t=`fadeUp`,stagger:n=50,duration:r=500,loop:i=!0,loopPause:a=2400,fontSize:o=56,color:s=`#f8fafc`})=>{let[u,d]=(0,c.useState)(!0),f=(0,c.useMemo)(()=>e.split(``),[e]),p=f.length*n+r;return(0,c.useEffect)(()=>{if(!i)return;let e,t,n=!1,o=()=>{n||(d(!0),t=setTimeout(()=>{n||(d(!1),e=setTimeout(o,Math.max(r,600)))},p+a))};return o(),()=>{n=!0,e&&clearTimeout(e),t&&clearTimeout(t)}},[r,i,a,p]),(0,l.jsx)(`div`,{className:Ts.splitText,children:(0,l.jsx)(`div`,{className:Ts.text,style:{fontSize:o,"--split-color":s,"--split-duration":`${r}ms`},children:f.map((e,r)=>(0,l.jsx)(`span`,{className:`${Ts.char} ${Ts[t]} ${u?Ts.enter:Ts.exit}`,style:{animationDelay:`${r*n}ms`},children:e===` `?`\xA0`:e},`${e}-${r}`))})})},Ds={springMass:`cos-springMass-cYEt6`,canvas:`cos-canvas-mwL9l`,hint:`cos-hint-TKLm3`},Os=(e,t,n,r)=>{let i=Math.max(3,Math.min(n,10)),a=Math.max(3,Math.min(r,8)),o=e*.16,s=t*.18,c=(e-o*2)/(i-1),l=(t-s*2)/(a-1),u=[];for(let e=0;e<a;e++)for(let t=0;t<i;t++){let n=e===0&&(t===0||t===i-1)||e===a-1&&(t===0||t===i-1);u.push({x:o+t*c,y:s+e*l,vx:0,vy:0,pinned:n})}let d=[],f=(e,t)=>t*i+e;for(let e=0;e<a;e++)for(let t=0;t<i;t++)if(t<i-1&&d.push({a:f(t,e),b:f(t+1,e),rest:c}),e<a-1&&d.push({a:f(t,e),b:f(t,e+1),rest:l}),t<i-1&&e<a-1){let n=Math.hypot(c,l);d.push({a:f(t,e),b:f(t+1,e+1),rest:n}),d.push({a:f(t+1,e),b:f(t,e+1),rest:n})}return{nodes:u,springs:d,cols:i,rows:a}},ks=({width:e=560,height:t=400,cols:n=6,rows:r=5,stiffness:i=.22,damping:a=.9,color:o=`#a78bfa`,hint:s=`拖拽网格质点,观察弹簧回弹`})=>{let u=(0,c.useRef)(null),d=(0,c.useRef)(Os(e,t,n,r)),f=(0,c.useRef)(null),p=(0,c.useRef)({x:0,y:0});(0,c.useEffect)(()=>{d.current=Os(e,t,n,r),f.current=null},[n,t,r,e]),(0,c.useEffect)(()=>{let n=u.current;if(!n)return;let r=window.devicePixelRatio||1;n.width=e*r,n.height=t*r;let s=n.getContext(`2d`);if(!s)return;s.setTransform(r,0,0,r,0,0);let c=0,l=document.hidden,m=v(e=>{l=e}),h=Math.max(.04,Math.min(i,.8)),g=()=>{let{nodes:n,springs:r}=d.current,i=f.current;if(i){let e=n[i.index];e.x=p.current.x+i.ox,e.y=p.current.y+i.oy,e.vx=0,e.vy=0}for(let e of r){let t=n[e.a],r=n[e.b],a=r.x-t.x,o=r.y-t.y,s=Math.hypot(a,o)||.001,c=(s-e.rest)*h,l=a/s*c,u=o/s*c,d=i?.index===e.a,f=i?.index===e.b;!t.pinned&&!d&&(t.vx+=l,t.vy+=u),!r.pinned&&!f&&(r.vx-=l,r.vy-=u)}for(let r=0;r<n.length;r++){let o=n[r];if(o.pinned||i?.index===r){o.vx=0,o.vy=0;continue}o.vx*=a,o.vy*=a,o.x+=o.vx,o.y+=o.vy,o.x<10?(o.x=10,o.vx*=-.4):o.x>e-10&&(o.x=e-10,o.vx*=-.4),o.y<10?(o.y=10,o.vy*=-.4):o.y>t-10&&(o.y=t-10,o.vy*=-.4)}},_=()=>{let{nodes:n,springs:r}=d.current;s.fillStyle=`#0f172a`,s.fillRect(0,0,e,t);for(let i of r){let r=n[i.a],a=n[i.b],c=Math.hypot(a.x-r.x,a.y-r.y)||1,l=Math.min(1,Math.abs(c-i.rest)/i.rest);s.beginPath(),s.moveTo(r.x,r.y),s.lineTo(a.x,a.y),s.strokeStyle=o,s.globalAlpha=.22+l*.55,s.lineWidth=i.rest>Math.max(e,t)*.2?1:1.6,s.stroke(),s.globalAlpha=1}n.forEach((e,t)=>{s.beginPath(),s.arc(e.x,e.y,e.pinned?6:8,0,Math.PI*2),s.fillStyle=e.pinned?`#64748b`:o,s.fill(),s.strokeStyle=`rgb(255 255 255 / 28%)`,s.lineWidth=1,s.stroke(),f.current?.index===t&&(s.beginPath(),s.arc(e.x,e.y,13,0,Math.PI*2),s.strokeStyle=o,s.globalAlpha=.45,s.lineWidth=2,s.stroke(),s.globalAlpha=1)})},y=()=>{c=requestAnimationFrame(y),!l&&(g(),_())};return c=requestAnimationFrame(y),()=>{cancelAnimationFrame(c),m()}},[o,a,t,i,e]);let m=(e,t)=>{let{nodes:n}=d.current,r=-1,i=20;return n.forEach((n,a)=>{if(n.pinned)return;let o=Math.hypot(n.x-e,n.y-t);o<i&&(i=o,r=a)}),r},h=(e,t,n)=>{let r=e-n.left,i=t-n.top;p.current={x:r,y:i};let a=m(r,i);if(a<0)return;let o=d.current.nodes[a];f.current={index:a,ox:o.x-r,oy:o.y-i}},g=(e,t,n)=>{p.current={x:e-n.left,y:t-n.top}},_=()=>{f.current=null};return(0,l.jsxs)(`div`,{className:Ds.springMass,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:u,className:Ds.canvas,style:{width:e,height:t},onMouseDown:e=>h(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect()),onMouseMove:e=>g(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect()),onMouseUp:_,onMouseLeave:_,onTouchStart:e=>{let t=e.touches[0];t&&h(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},onTouchMove:e=>{let t=e.touches[0];t&&g(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},onTouchEnd:_}),(0,l.jsx)(`div`,{className:Ds.hint,children:s})]})},As={spotlight:`cos-spotlight-OddY1`,content:`cos-content-5I1Wy`,overlay:`cos-overlay-F6CJ5`},js=({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:As.spotlight,style:{"--spot-radius":`${t}px`,"--dim-color":n},onMouseMove:i,children:[(0,l.jsx)(`div`,{className:As.content,children:e}),(0,l.jsx)(`div`,{className:As.overlay})]})},Ms={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`},Ns=[`#FF6B6B`,`#4ECDC4`,`#FFE66D`,`#A78BFA`,`#60A5FA`,`#F472B6`,`#34D399`,`#FB923C`],Ps=[{label:`一等奖`},{label:`二等奖`},{label:`三等奖`},{label:`谢谢参与`},{label:`优惠券`},{label:`再来一次`}],Fs=e=>1-(1-e)**3,Is=(0,c.forwardRef)(({prizes:e=Ps,size:t=360,spinDuration:n=4e3,spinRounds:r=5,targetIndex:i,buttonText:a=`开始抽奖`,spinningText:o=`抽奖中...`,resultPrefix:s=`恭喜获得:`,onSpinEnd:u},d)=>{let f=(0,c.useRef)(null),p=(0,c.useRef)(0),m=(0,c.useRef)(0),h=(0,c.useRef)(1),g=(0,c.useRef)(!1),[_,v]=(0,c.useState)(!1),[y,b]=(0,c.useState)(null),x=(0,c.useRef)(u),S=(0,c.useRef)(e),C=(0,c.useRef)(i),w=(0,c.useRef)(null);(0,c.useEffect)(()=>{x.current=u},[u]),(0,c.useEffect)(()=>{S.current=e},[e]),(0,c.useEffect)(()=>{C.current=i},[i]),(0,c.useEffect)(()=>{g.current=_},[_]);let T=t+48,E=(e,t)=>t.color??Ns[e%Ns.length],D=(0,c.useCallback)(e=>{let n=f.current;if(!n)return;let r=n.getContext(`2d`);if(!r)return;let i=S.current,a=T/2,o=t/2,s=Math.PI*2/i.length;r.clearRect(0,0,T,T),r.save(),r.translate(a,a),r.rotate(e),i.forEach((e,n)=>{let i=n*s-Math.PI/2,a=i+s,c=E(n,e);r.beginPath(),r.moveTo(0,0),r.arc(0,0,o,i,a),r.closePath(),r.fillStyle=c,r.fill(),r.strokeStyle=`rgb(255 255 255 / 35%)`,r.lineWidth=2,r.stroke(),r.save(),r.rotate(i+s/2),r.textAlign=`right`,r.fillStyle=`#fff`,r.font=`bold ${Math.max(12,Math.floor(t/22))}px system-ui, sans-serif`,r.shadowColor=`rgb(0 0 0 / 30%)`,r.shadowBlur=4,r.fillText(e.label,o-18,6),r.restore()}),r.beginPath(),r.arc(0,0,o,0,Math.PI*2),r.strokeStyle=`#fbbf24`,r.lineWidth=6,r.stroke(),r.beginPath(),r.arc(0,0,o-4,0,Math.PI*2),r.strokeStyle=`#f59e0b`,r.lineWidth=2,r.stroke(),r.restore(),r.save(),r.translate(a,a);for(let e=0;e<12;e++){let t=e/12*Math.PI*2,n=Math.cos(t)*(o+14),i=Math.sin(t)*(o+14);r.beginPath(),r.arc(n,i,3,0,Math.PI*2),r.fillStyle=e%2==0?`#fde68a`:`#f59e0b`,r.fill()}r.restore()},[T,t]);(0,c.useEffect)(()=>{let e=f.current;if(!e)return;let t=window.devicePixelRatio||1;h.current=t,e.width=T*t,e.height=T*t;let n=e.getContext(`2d`);n&&n.setTransform(t,0,0,t,0,0),D(p.current)},[T,D,e]),(0,c.useEffect)(()=>()=>{w.current&&(w.current.cancelled=!0),m.current&&cancelAnimationFrame(m.current)},[]);let O=(0,c.useCallback)(e=>{let t=S.current;if(g.current||t.length===0)return;v(!0),b(null);let i=Math.PI*2/t.length,a=C.current,o=e??a,s=o===void 0?Math.floor(Math.random()*t.length):(Math.floor(o)%t.length+t.length)%t.length,c=s*i+i/2,l=p.current,u=l+r*Math.PI*2+(Math.PI*2-c)-l%(Math.PI*2),d=l,f=performance.now(),h={cancelled:!1};w.current=h;let _=e=>{if(h.cancelled)return;let r=e-f,i=Math.min(r/n,1),a=Fs(i),o=d+(u-d)*a;if(p.current=o,D(o),i<1)m.current=requestAnimationFrame(_);else if(!h.cancelled){let e=t[s];p.current=o,v(!1),b(e),x.current?.(e,s)}};m.current=requestAnimationFrame(_)},[D,n,r]),k=(0,c.useCallback)(()=>{g.current||b(null)},[]);return(0,c.useImperativeHandle)(d,()=>({spin:O,reset:k}),[O,k]),(0,l.jsxs)(`div`,{className:Ms.turntable,style:{width:T,height:T+80},children:[(0,l.jsxs)(`div`,{className:Ms.wheelWrap,style:{width:T,height:T},children:[(0,l.jsx)(`div`,{className:Ms.pointer}),(0,l.jsx)(`canvas`,{ref:f,className:Ms.canvas,style:{width:T,height:T}}),(0,l.jsx)(`button`,{type:`button`,className:Ms.spinBtn,"data-testid":`turntable-spin`,onClick:()=>O(),disabled:_,"aria-busy":_,children:_?o:a})]}),y&&!_&&(0,l.jsxs)(`p`,{className:Ms.result,children:[s,(0,l.jsx)(`strong`,{children:y.label})]})]})});Is.displayName=`Turntable`;var Ls={textMorph:`cos-textMorph-W-C1e`,stage:`cos-stage-AaMn6`,layer:`cos-layer-N-4oM`},Rs=[`COS DESIGN`,`TEXT MORPH`,`SMOOTH TRANSITION`],zs=(e,t,n)=>Math.min(n,Math.max(t,e)),Bs=({texts:e=Rs,interval:t=2200,duration:n=680,fontSize:r=64,color:i=`#f8fafc`})=>{let a=(0,c.useMemo)(()=>e.length>0?e:Rs,[e]),[o,s]=(0,c.useState)(0),[u,d]=(0,c.useState)(0),f=(0,c.useRef)(0),p=(0,c.useRef)(0);(0,c.useEffect)(()=>(p.current=window.setTimeout(()=>{let e=performance.now(),t=r=>{let i=zs((r-e)/Math.max(n,16),0,1);if(d(i),i<1){f.current=requestAnimationFrame(t);return}s(e=>(e+1)%a.length),d(0)};f.current=requestAnimationFrame(t)},t),()=>{window.clearTimeout(p.current),cancelAnimationFrame(f.current)}),[n,o,t,a]);let m=a[o],h=a[(o+1)%a.length],g=1-u,_=u,v=u*14,y=(1-u)*14,b=1-u*.08,x=.92+u*.08;return(0,l.jsx)(`div`,{className:Ls.textMorph,style:{"--morph-color":i},children:(0,l.jsxs)(`div`,{className:Ls.stage,style:{fontSize:r},children:[(0,l.jsx)(`span`,{className:`${Ls.layer} ${Ls.current}`,style:{opacity:g,filter:`blur(${v}px)`,transform:`scale(${b}) translateY(${u*-8}px)`},children:m}),(0,l.jsx)(`span`,{className:`${Ls.layer} ${Ls.next}`,style:{opacity:_,filter:`blur(${y}px)`,transform:`scale(${x}) translateY(${(1-u)*8}px)`},children:h})]})})},Vs={trueFocus:`cos-trueFocus-GX7IP`,stage:`cos-stage-epay6`,word:`cos-word-5pfV3`,focusFrame:`cos-focusFrame-o7brV`,corner:`cos-corner-PThvn`,tl:`cos-tl-maoq6`,tr:`cos-tr-KTph3`,bl:`cos-bl-JAm8m`,br:`cos-br-s9hq-`},Hs=({sentence:e=`True Focus`,separator:t=` `,manualMode:n=!1,blurAmount:r=5,borderColor:i=`#22c55e`,glowColor:a=`rgb(34 197 94 / 60%)`,animationDuration:o=.5,pauseBetweenAnimations:s=1,fontSize:u=48,color:d=`#f8fafc`})=>{let f=e.split(t).filter(Boolean),[p,m]=(0,c.useState)(0),[h,g]=(0,c.useState)(0),_=(0,c.useRef)(null),v=(0,c.useRef)([]),[y,b]=(0,c.useState)({x:0,y:0,width:0,height:0});(0,c.useEffect)(()=>{if(n||f.length===0)return;let e=window.setInterval(()=>{m(e=>(e+1)%f.length)},(o+s)*1e3);return()=>window.clearInterval(e)},[o,n,s,f.length]),(0,c.useEffect)(()=>{let e=_.current,t=v.current[p];if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();b({x:r.left-n.left,y:r.top-n.top,width:r.width,height:r.height})},[p,u,e,f.length]);let x=e=>{n&&(g(e),m(e))},S=()=>{n&&m(h)};return(0,l.jsx)(`div`,{className:Vs.trueFocus,children:(0,l.jsxs)(`div`,{className:Vs.stage,ref:_,style:{fontSize:u,"--focus-color":d,"--border-color":i,"--glow-color":a,"--focus-duration":`${o}s`},children:[f.map((e,t)=>{let i=t===p;return(0,l.jsx)(`span`,{ref:e=>{v.current[t]=e},className:Vs.word,style:{filter:i?`blur(0px)`:`blur(${r}px)`,cursor:n?`pointer`:`default`},onMouseEnter:()=>x(t),onMouseLeave:S,children:e},`${e}-${t}`)}),(0,l.jsxs)(`div`,{className:Vs.focusFrame,style:{transform:`translate(${y.x}px, ${y.y}px)`,width:y.width,height:y.height,opacity:+(p>=0)},children:[(0,l.jsx)(`span`,{className:`${Vs.corner} ${Vs.tl}`}),(0,l.jsx)(`span`,{className:`${Vs.corner} ${Vs.tr}`}),(0,l.jsx)(`span`,{className:`${Vs.corner} ${Vs.bl}`}),(0,l.jsx)(`span`,{className:`${Vs.corner} ${Vs.br}`})]})]})})},Us={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`},Ws=[`Hello, cos-design!`,`欢迎来到组件库 ✨`,`Build something fun 🚀`],Gs=({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:Us.typewriter,children:(0,l.jsxs)(`div`,{className:Us.terminal,children:[(0,l.jsxs)(`div`,{className:Us.dots,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]}),(0,l.jsxs)(`p`,{className:Us.text,children:[(0,l.jsx)(`span`,{className:Us.prompt,children:`>`}),i,(0,l.jsx)(`span`,{className:Us.cursor,children:`|`})]})]})})},Ks=({texts:e=Ws,speed:t=100,deleteSpeed:n=50,pause:r=2e3})=>{let i=e.length>0?e:Ws;return(0,l.jsx)(Gs,{texts:i,speed:t,deleteSpeed:n,pause:r},i.join(`\0`))},qs={waveButton:`cos-waveButton-Aa7G-`,btn:`cos-btn-WJrEN`,label:`cos-label-9BHOU`,wave:`cos-wave-GycLU`,ripple:`cos-ripple-5ZFpr`},Js=({text:e=`点我试试`,color:t=`#38bdf8`,className:n,style:r,...i})=>(0,l.jsx)(`div`,{className:qs.waveButton,children:(0,l.jsxs)(`button`,{type:`button`,className:`${qs.btn} ${n??``}`,style:{"--wave-color":t,...r},...i,children:[(0,l.jsx)(`span`,{className:qs.wave}),(0,l.jsx)(`span`,{className:qs.wave}),(0,l.jsx)(`span`,{className:qs.label,children:e})]})}),Ys=e=>Math.min(1,Math.max(0,e)),Xs=e=>{let t=e.replace(`#`,``).trim(),n=t.length===3?t.split(``).map(e=>e+e).join(``):t;if(n.length!==6)return[80,140,200];let r=Number.parseInt(n,16);return Number.isNaN(r)?[80,140,200]:[r>>16&255,r>>8&255,r&255]},Zs=([e,t,n])=>{let r=e=>Math.min(255,Math.max(0,Math.round(e))).toString(16).padStart(2,`0`);return`#${r(e)}${r(t)}${r(n)}`},Qs=(e,t,n)=>e+(t-e)*n,$s=(e,t,n)=>[Qs(e[0],t[0],n),Qs(e[1],t[1],n),Qs(e[2],t[2],n)],ec=(e,t,n)=>Zs($s(Xs(e),Xs(t),Ys(n))),tc=e=>{let t=Ys(e);return t*t*(3-2*t)},nc=(e=Date.now())=>{let t=new Date(e),n=new Date(t);n.setHours(6,0,0,0);let r=new Date(t);return r.setHours(18,0,0,0),{sunrise:n.getTime(),sunset:r.getTime()}},rc=(e,t=new Date)=>{let n=e.trim().match(/^(\d{1,2}):(\d{2})$/);if(!n)return null;let r=Number(n[1]),i=Number(n[2]);if(r<0||r>23||i<0||i>59)return null;let a=new Date(t);return a.setHours(r,i,0,0),a.getTime()},ic=(e,t=new Date)=>rc(e??`14:00`,t)??rc(`14:00`,t),ac=(e,t)=>{let{sunrise:n,sunset:r}=t;if(!(r>n)){let t=nc(e);n=t.sunrise,r=t.sunset}let i=Math.max(1,r-n),a=n+1440*60*1e3,o=r-1440*60*1e3,s=e>=n&&e<r,c;if(s)c=Ys((e-n)/i);else if(e>=r){let t=Math.max(1,a-r);c=Ys((e-r)/t)}else{let t=Math.max(1,n-o);c=Ys((e-o)/t)}let l=s?Math.sin(Math.PI*c):0,u=Math.abs(e-n),d=Math.abs(e-r),f=Ys(1-Math.min(u,d)/45e5);return{isDay:s,arcProgress:c,elevation:l,twilight:f}},oc=(e,t,n)=>{let r=Ys(n),i=Math.sin(Math.PI*r);return{x:e*(.1+.8*r),y:t*(.58-.4*i)}},sc=`#e8895c`,cc=`#f3c98a`,lc=`#2a1f4a`,uc=`#c4784a`,dc=(e,t,n)=>{if(n.isDay){let t=tc(n.elevation),r=(1-t)*.72;return[ec(ec(e[0],sc,r),`#1a2438`,(1-t)*.12),ec(ec(e[1],cc,r*.85),`#3a4558`,(1-t)*.08)]}let r=n.twilight;return[ec(t[0],ec(lc,sc,.35),r*.55),ec(t[1],ec(uc,cc,.4),r*.7)]},fc=(e,t,n)=>{let r=e.createLinearGradient(0,0,0,t);return r.addColorStop(0,n[0]),r.addColorStop(1,n[1]),r},pc=e=>{if(!e.isDay)return{scale:.92+e.twilight*.06,alpha:.75+e.twilight*.2};let t=e.elevation;return{scale:.82+t*.22,alpha:.65+t*.35}},mc=2,hc=[``,`薄雾`,`中雾`,`浓雾`],gc=e=>Math.min(3,Math.max(1,Math.round(e))),_c=e=>{let t=gc(e);return`${t} · ${hc[t]}`},vc=e=>e===`fog`,yc=(e,t)=>{let n=gc(t);return n===1?{...e,fogBanks:3,haze:.06,cloudAlpha:Math.min(e.cloudAlpha,.28),sun:`soft`}:n===3?{...e,fogBanks:12,haze:.3,cloudAlpha:.42,sun:`dim`}:{...e,fogBanks:5,haze:.11,cloudAlpha:.32,sun:`dim`}},bc=e=>{let t=gc(e);return t===1?.45:t===3?.95:.65},xc=e=>e===45?2:e===48?3:null,Sc=e=>e==null||!Number.isFinite(e)?null:e>=5e3?1:e>=1e3?2:3,Cc=2,wc=[``,`细雹`,`密雹`,`巨雹`],Tc=e=>Math.min(3,Math.max(1,Math.round(e))),Ec=e=>{let t=Tc(e);return`${t} · ${wc[t]}`},Dc=e=>e===`hail`,Oc=e=>{let t=Tc(e);return t===1?{count:75,sizeMin:.85,sizeMax:2.1,speedMul:.88}:t===3?{count:210,sizeMin:2.4,sizeMax:5.6,speedMul:1.22}:{count:145,sizeMin:1.4,sizeMax:3.8,speedMul:1}},kc=e=>e===96?2:e===99?3:null,Ac=1,jc=10,Mc=5,Nc=5,Pc=e=>Math.min(10,Math.max(1,Math.round(e))),Fc=(e,t,n)=>e+(t-e)*n,Ic=e=>{let t=Pc(e);return t<=2?1:t<=4?2:t<=6?3:t<=8?4:5},Lc=[`毛毛雨`,`小雨`,`中雨`,`暴雨`,`特大暴雨`],Rc=[`毛毛雪`,`小雪`,`中雪`,`暴雪`,`特大暴雪`],zc=(e,t)=>{let n=Ic(e);return(t===`rain`?Lc:Rc)[n-1]},Bc=(e,t)=>`${Pc(e)} · ${zc(e,t)}`,Vc=[``,...Lc],Hc=[``,...Rc],Uc=e=>e===`lightRain`||e===`moderateRain`||e===`heavyRain`?`rain`:e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`?`snow`:e,Wc=e=>e===`rain`||e===`lightRain`||e===`moderateRain`||e===`heavyRain`,Gc=e=>e===`snow`||e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`,Kc=e=>Wc(e)||e===`thunderstorm`||e===`sleet`,qc=e=>Gc(e)||e===`sleet`,Jc=(e,t=5)=>e===`lightRain`?3:e===`moderateRain`?5:e===`heavyRain`?8:Pc(t),Yc=(e,t=5)=>e===`lightSnow`?3:e===`moderateSnow`?5:e===`heavySnow`?8:Pc(t),Xc=(e,t)=>t===`rain`?e<=2?`lightRain`:e===3?`moderateRain`:`heavyRain`:e<=2?`lightSnow`:e===3?`moderateSnow`:`heavySnow`,Zc=(e,t=5,n=5)=>e===`rain`?Xc(Ic(t),`rain`):e===`lightRain`||e===`moderateRain`||e===`heavyRain`?Xc(Ic(Jc(e)),`rain`):e===`snow`?Xc(Ic(n),`snow`):e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`?Xc(Ic(Yc(e)),`snow`):e,Qc=(e,t)=>{let n=(Pc(t)-1)/9;return{count:Math.round(Fc(35,340,n)),speed:Fc(5.5,16,n),wind:Fc(-.4,-3.2,n),alpha:Fc(.28,.62,n),splash:Pc(t)>=5}},$c=e=>{let t=(Pc(e)-1)/9;return Math.round(Fc(30,360,t))},el=e=>[51,56].includes(e)?2:[61,66,80].includes(e)?3:[53,55,57,63,81].includes(e)?5:[65,67].includes(e)?8:[82].includes(e)?10:[95].includes(e)?7:null,tl=e=>[77].includes(e)?2:[71,85].includes(e)?3:[73].includes(e)?5:[75].includes(e)?8:[86].includes(e)?10:null,nl=2,rl=[``,`轻霾`,`中霾`,`重霾`],il=e=>Math.min(3,Math.max(1,Math.round(e))),al=e=>{let t=il(e);return`${t} · ${rl[t]}`},ol=e=>e===`smog`,sl=(e,t)=>{let n=il(t);return n===1?{...e,fogBanks:5,haze:.16,cloudAlpha:Math.min(e.cloudAlpha,.28),sun:`soft`}:n===3?{...e,fogBanks:16,haze:.48,cloudAlpha:.42,sun:`dim`}:{...e,fogBanks:12,haze:.34,cloudAlpha:.35,sun:`dim`}},cl=e=>{let t=il(e);return t===1?.55:t===3?1.05:.85},ll=e=>e==null||!Number.isFinite(e)?null:e>=5e3?1:e>=1e3?2:3,ul={0:`sunny`,1:`sunny`,2:`partlyCloudy`,3:`overcast`,45:`fog`,48:`fog`,51:`rain`,53:`rain`,55:`rain`,56:`rain`,57:`rain`,61:`rain`,63:`rain`,65:`rain`,66:`rain`,67:`rain`,80:`rain`,81:`rain`,82:`rain`,71:`snow`,73:`snow`,75:`snow`,77:`snow`,85:`snow`,86:`snow`,95:`thunderstorm`,96:`hail`,99:`hail`},dl=e=>Uc(ul[e]??`overcast`),fl={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`idle`,error:null,current:null},pl={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`locating`,error:null,current:null},ml={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`fetching`,error:null,current:null},hl=e=>e!=null&&Number.isFinite(e.latitude)&&Number.isFinite(e.longitude),gl=e=>{if(typeof e!=`string`||!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null},_l=e=>{if(typeof e!=`string`||!e)return null;let t=e.match(/T(\d{2}):(\d{2})/);return t?`${t[1]}:${t[2]}`:null},vl=(e,t)=>{if(e)try{let t=new Intl.DateTimeFormat(`en-GB`,{timeZone:e,hour:`2-digit`,minute:`2-digit`,hour12:!1}).formatToParts(new Date),n=t.find(e=>e.type===`hour`)?.value,r=t.find(e=>e.type===`minute`)?.value;if(n!=null&&r!=null)return`${n.padStart(2,`0`)}:${r.padStart(2,`0`)}`}catch{}return t??null},yl=(e=!0,t)=>{let n=hl(t),r=n?t.latitude:null,i=n?t.longitude:null,a=e?n?ml:pl:fl,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,visibility`,daily:`sunrise,sunset`,timezone:`auto`,forecast_days:`1`}),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),u=gl(o?.daily?.sunrise?.[0]),d=gl(o?.daily?.sunset?.[0]),f=typeof o?.timezone==`string`?o.timezone:null,p=_l(o?.current?.time)??vl(f),m=dl(s),h=el(s),g=tl(s),_=o?.current?.visibility,v=_!=null&&Number.isFinite(Number(_))?Number(_):null,y=m===`fog`?Sc(v)??xc(s)??2:null,b=m===`hail`?kc(s)??2:null,x=m===`smog`?ll(v)??2:null;if(t)return;l({weather:m,rainLevel:h,snowLevel:g,fogLevel:y,hailLevel:b,smogLevel:x,status:`success`,error:null,current:{weatherCode:s,windSpeed:c,isDay:o?.current?.is_day===1,latitude:e,longitude:r,timezone:f,localTime:p,visibility:v,rainLevel:h,snowLevel:g,fogLevel:y,hailLevel:b,smogLevel:x,sunrise:u,sunset:d}})}catch(e){if(t||e instanceof DOMException&&e.name===`AbortError`)return;l({weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel: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,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel: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,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`error`,error:e.message||`定位失败`,current:null})},{timeout:1e4,maximumAge:600*1e3}),()=>{t=!0,n.abort()})},[e,r,i]),s},bl=async(e,t,n)=>{let r=new URLSearchParams({latitude:String(e),longitude:String(t),daily:`sunrise,sunset`,timezone:`auto`,forecast_days:`1`}),i=await fetch(`https://api.open-meteo.com/v1/forecast?${r}`,{signal:n});if(!i.ok)return null;let a=await i.json(),o=gl(a?.daily?.sunrise?.[0]),s=gl(a?.daily?.sunset?.[0]);return o==null||s==null?null:{sunrise:o,sunset:s}},xl=e=>{let t=hl(e),n=t?e.latitude:null,r=t?e.longitude:null,i=`${n},${r}`,[a,o]=(0,c.useState)(null),[s,l]=(0,c.useState)(i);return s!==i&&(l(i),o(null)),(0,c.useEffect)(()=>{if(n==null||r==null)return;let e=!1,t=new AbortController;return bl(n,r,t.signal).then(t=>{e||o(t)}).catch(()=>{e||o(null)}),()=>{e=!0,t.abort()}},[n,r]),t?a:null},Sl=3,Cl=e=>Math.min(12,Math.max(0,Math.round(e))),wl=e=>Math.max(0,Cl(e)-2),Tl=.55,El=[0,3,8,16,24,33,44,55,68,81,95,110,125],Dl=[1,5,11,19,28,38,49,61,74,88,102,117,1/0],Ol=(e,t,n=0,r=0)=>{let i=t.gustiness,a=t.wander,o=n*.0017+r*.0024,s=e*Tl,c=Math.sin(s*.007+o),l=Math.sin(s*.021+1.37+o*1.4),u=Math.sin(s*.055+2.8+o*.6),d=1+(.5*c+.35*l+.15*u)*(.25+i*.75),f=Math.sin(s*.012+o*.8);f>.72&&(d+=(f-.72)*(.8+i*2.4)),Math.sin(s*.0095+.6+o)<-.55&&(d*=.45+i*.2),d=Math.max(.12,Math.min(2.25,d));let p=a*(.55*Math.sin(s*.0088+o)+.3*Math.sin(s*.026+1.9+o*1.1)+.15*Math.sin(s*.063+.4));return{intensity:d,angle:p,ux:Math.cos(p),uy:Math.sin(p)}},kl=e=>{let t=Cl(e);if(t<=0)return{count:0,alphaMul:0};let n=Math.min(1,(t/9)**1.15);return{count:Math.floor(3+n*n*50),alphaMul:.1+n*.9}},Al=e=>El[Cl(e)]??16,jl=e=>{let t=Math.max(0,e);for(let e=0;e<Dl.length;e++)if(t<=Dl[e])return e;return 12},Ml=e=>{let t=jl(e),n=wl(t),r=Al(n),i=Math.max(.04,Math.min(r/16,4.2)),{alphaMul:a}=kl(n),o=i**.82,s=Math.min(1,(n/8)**1.1),c=(.04+s*.32)*Math.PI;return{speedKmh:e,level:t,visualLevel:n,scale:i,cloud:.28+i*.72,rain:o,snowDrift:-(.04+o*.28),hail:.4+o*.85,fog:.32+o*.58,streak:.55+o*.95,streakVisibility:a,gustiness:s,wander:c}},Nl=e=>e.live&&e.liveWindKmh!=null&&Number.isFinite(e.liveWindKmh)?Math.max(0,e.liveWindKmh):Al(e.windLevel);function Pl(e){let t=e.windMotion.cloud,{intensity:n,angle:r,uy:i}=e.windField,a=-Math.cos(r);for(let r of e.state.clouds){let o=Math.abs(r.speed)*t*n;r.x+=o*a,r.y+=o*i*.12,r.y<-80&&(r.y=-80),r.y>e.height*.55&&(r.y=e.height*.55),r.x-140*r.scale>e.width&&(r.x=-160*r.scale),r.x+180*r.scale<0&&(r.x=e.width+40*r.scale),e.ctx.drawImage(r.sprite,r.x+r.ox,r.y+r.oy)}}function Fl(e){let t=e.fogSprite;if(!t||e.state.fogBanks.length===0)return;let{canvas:n,baseR:r}=t,i=e.windMotion.fog,{intensity:a,angle:o,uy:s}=e.windField,c=-Math.cos(o);for(let t of e.state.fogBanks){let o=Math.abs(t.speed)*i*a;t.x+=o*c,t.y+=o*s*.1,t.y<e.height*.02&&(t.y=e.height*.02),t.y>e.height*.95&&(t.y=e.height*.95),c<0&&t.x+t.rw<0&&(t.x=e.width+t.rw),c>0&&t.x-t.rw>e.width&&(t.x=-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 Il(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 Ll(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=Ll(e,t,o,s,i*.55,a-1),l=Ll(o,s,n,r,i*.55,a-1);return[...c.slice(0,-1),...l]}function Rl(e){if(e.state.windStreaks.length===0)return;let t=e.windMotion.streak,n=e.windMotion.streakVisibility;if(n<=.02)return;let r=e.state.t;for(let i of e.state.windStreaks){let a=Ol(r+i.phase*18,e.windMotion,i.x,i.y),o=a.intensity*(.55+.45*e.windField.intensity),s=a.angle*.65+e.windField.angle*.35,c=-1*Math.cos(s),l=Math.sin(s),u=i.speed*t*o;i.x+=u*c,i.y+=u*l*.45,i.wave+=.03+o*.025,(i.x<-i.length-40||i.x>e.width+i.length+40)&&(i.x=c<0?e.width+i.length+Math.random()*e.width*.25:-i.length-Math.random()*e.width*.25,i.y=Math.random()*e.height),i.y<-20&&(i.y=e.height+10),i.y>e.height+20&&(i.y=-10);let d=5+o*5,f=Math.sin(i.wave)*d,p=i.length*(.85+o*.2),m=i.x+c*p,h=i.y+l*p*.45,g=i.alpha*n*Math.min(1.35,.55+o*.55);if(e.ctx.beginPath(),e.ctx.moveTo(i.x,i.y),e.ctx.bezierCurveTo(i.x+c*p*.3,i.y+l*p*.3*.45+f,i.x+c*p*.7,i.y+l*p*.7*.45-f,m,h),e.ctx.strokeStyle=`rgba(235, 244, 250, ${g})`,e.ctx.lineWidth=i.width*(.85+o*.2),e.ctx.lineCap=`round`,e.ctx.stroke(),i.length>70&&n>.45&&o>.7){let t=i.x+c*p*.58,n=i.y+l*p*.58*.45-f*.4;e.ctx.save(),e.ctx.translate(t,n),e.ctx.rotate(s+i.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, ${g*1.4})`,e.ctx.fill(),e.ctx.restore()}}}function zl(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=Ll(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 Bl=3.2,Vl=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},Hl=(e=16)=>Array.from({length:e},()=>Vl(Bl)),Ul=e=>e[Math.floor(Math.random()*e.length)],Wl=(e,t,n,r,i=!0,a,o=1)=>{let s=a?.min??1.4,c=a?.max??4.8;e.r=s+Math.random()**1.35*(c-s),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)*o,e.vy=(5.5+Math.random()*11)*o,e.bounces=0,e.opacity=.45+Math.random()*.55,e.delay=Math.floor(Math.random()*(i?110:45)),e.gravity=(.11+Math.random()*.14)*(.9+o*.1),e.phase=Math.random()*Math.PI*2,e.gust=(Math.random()-.5)*1.4,e.maxBounces=+(Math.random()<.62),e.sprite=Ul(r),e.drawSize=e.r*2.8+4,e.rotation=Math.random()*Math.PI*2,e.rotationSpeed=(Math.random()-.5)*.06},Gl=(e,t,n,r,i=1)=>{let a={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 Wl(a,e,t,n,Math.random()<.72,r,i),a};function Kl(e){if(!e.cfg.rain)return;let{alpha:t,splash:n}=e.cfg.rain,r=e.cfg.rain.wind*e.windMotion.rain,{intensity:i,angle:a,uy:o}=e.windField,s=r*i*Math.cos(a),c=Math.abs(r)*i*o*.35;e.ctx.strokeStyle=`rgba(214, 228, 240, ${t})`,e.ctx.lineWidth=1.2,e.ctx.beginPath();for(let t of e.state.drops){let r=t.speed+c,i=Math.hypot(s,r)||1,a=s/i,o=r/i;e.ctx.moveTo(t.x,t.y),e.ctx.lineTo(t.x+a*t.len,t.y+o*t.len),t.x+=s,t.y+=r,t.y>e.height&&(n&&Math.random()<.3&&e.state.splashes.length<60&&e.state.splashes.push({x:t.x,r:1,alpha:.5}),t.y=-t.len,t.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 ql(e){let t=e.windMotion.snowDrift,{intensity:n,angle:r,uy:i}=e.windField,a=t*n*Math.cos(r),o=Math.abs(t)*n*i*.4;for(let t of e.state.flakes){t.y+=t.speed+o,t.x+=Math.sin(e.state.t*.02+t.phase)*(.3+t.size*.08)+t.drift+a,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 Jl(e){if(e.state.hailstones.length===0)return;let t=e.state.hailPool,n=e.windMotion.hail,r=e.state.t,i=e.windField;for(let a of e.state.hailstones){if(a.delay>0){--a.delay;continue}let o=Ol(r+a.phase*12,e.windMotion,a.x,a.y),s=o.intensity*(.4+.6*i.intensity),c=o.angle*.5+i.angle*.5,l=e.windMotion.snowDrift*.45*s*Math.cos(c),u=Math.abs(e.windMotion.snowDrift)*s*Math.sin(c)*.2,d=a.x,f=a.y;if(a.vy+=a.gravity+u*.02,a.vx+=a.gust*.004*n*s+l+(Math.random()-.5)*.08*n*s,a.x+=a.vx+Math.sin(r*.028+a.phase)*.35,a.y+=a.vy,e.ctx.beginPath(),e.ctx.moveTo(d,f),e.ctx.lineTo(a.x,a.y),e.ctx.strokeStyle=`rgba(225, 239, 250, ${a.opacity*.18})`,e.ctx.lineWidth=a.r*.35,e.ctx.stroke(),a.y+a.r>=e.height)if(a.bounces<a.maxBounces)a.y=e.height-a.r,a.vy*=-(.22+Math.random()*.28),a.vx=a.vx*(.55+Math.random()*.25)+(Math.random()-.5)*1.6,a.bounces+=1;else{Wl(a,e.width,e.height,t,!0,e.hailSpec?{min:e.hailSpec.sizeMin,max:e.hailSpec.sizeMax}:void 0,e.hailSpec?.speedMul??1);continue}let p=a.drawSize/2;a.rotation+=a.rotationSpeed,e.ctx.save(),e.ctx.globalAlpha=a.opacity,e.ctx.translate(a.x,a.y),e.ctx.rotate(a.rotation),e.ctx.drawImage(a.sprite,-p,-p,a.drawSize,a.drawSize),e.ctx.restore()}}function Yl(e){e.ctx.fillStyle=e.skyGradient,e.ctx.fillRect(0,0,e.width,e.height)}function Xl(e){if(e.state.stars.length===0)return;let t=1;if(e.dayCycle){if(e.dayCycle.isDay)return;t=.35+(1-e.dayCycle.twilight)*.65}else if(!e.activeNight)return;for(let n of e.state.stars){let r=.35+(Math.sin(e.state.t*n.speed+n.phase)+1)*.325;e.ctx.beginPath(),e.ctx.arc(n.x,n.y,n.r,0,Math.PI*2),e.ctx.fillStyle=`rgba(226, 235, 255, ${r*t})`,e.ctx.fill()}}function Zl(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=e.dayCycle?pc(e.dayCycle):{scale:1,alpha:1},c=t.half*o*s.scale,l=c*2;n.save(),n.globalAlpha=s.alpha,n.drawImage(t.canvas,r-c,i-c,l,l),n.restore()}function Ql(e){if(e.activeNight){Xl(e),Zl(e);return}Zl(e)}var $l={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},rain:{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},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}},eu={sunny:{sky:[`#0b1a33`,`#27476e`],stars:110},partlyCloudy:{sky:[`#0f1f38`,`#2c4666`],stars:60},overcast:{sky:[`#181f2a`,`#333e4e`],stars:0},rain:{sky:[`#11161f`,`#242c3a`],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},snow:{sky:[`#131a26`,`#333f4f`],stars:8},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}},tu=([e,t,n])=>[Math.round(e*.3+18),Math.round(t*.3+24),Math.round(n*.3+42)];function nu(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 ru(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}=nu(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 iu(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 au(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 ou(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 su=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},cu=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},lu=()=>({dots:[1.2,1.6,2,2.3].map(e=>su(e)),crystals:[2.6,3.2,3.8,4.4,5].map(e=>cu(e*2.4))}),uu=e=>e[Math.floor(Math.random()*e.length)],du=(e,t,n,r)=>{let i=1+Math.random()**1.6*4.2,a=i>=2.4,o=uu(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}},fu=(e,t)=>t?e===`smog`?`96, 88, 66`:`138, 150, 168`:e===`smog`?`168, 155, 126`:`226, 232, 238`;function pu(e){let{ctx:t,width:n,height:r,activeWeather:i,dayCycleTimes:a=null,sceneTimeMs:o,liveClock:s=!1,windMotion:c,rainLevel:l=5,snowLevel:u=5,hailLevel:d=2,fogLevel:f=2,smogLevel:p=2}=e,m=$l[i],h=(()=>{let e=m;return Kc(i)&&e.rain&&(e={...e,rain:Qc(e.rain,l)}),qc(i)&&(e={...e,snowCount:$c(u),fogBanks:u>=7?Math.max(e.fogBanks,3):e.fogBanks,haze:u>=7?Math.max(e.haze,.12):e.haze}),vc(i)&&(e=yc(e,f)),ol(i)&&(e=sl(e,p)),e})(),g=eu[i],_=a??null,v=_?ac(s?Date.now():o,_):null,y=v?!v.isDay:!1,b=v?dc(h.sky,g.sky,v):y?g.sky:h.sky,x=y?tu(h.cloudColor):h.cloudColor,S=Math.min(n,r)*.09,C=n*.72,w=r*.26;if(v){let e=oc(n,r,v.arcProgress);C=e.x,w=e.y}let T=fc(t,r,b),E=[{dx:-.32,dy:.08,r:.17},{dx:.24,dy:-.22,r:.12},{dx:.04,dy:.34,r:.1},{dx:.36,dy:.24,r:.07}],D=au(h,S),O=ou(h,S,E),k=y?O:D,A=y||_!=null?Array.from({length:g.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})):[],j=Array.from({length:h.cloudCount},()=>ru(n,r,h.cloudSpread,x,h.cloudAlpha)),M=h.rain?Array.from({length:h.rain.count},()=>({x:Math.random()*(n+160)-80,y:Math.random()*r,len:8+Math.random()*10,speed:h.rain.speed*(.75+Math.random()*.5)})):[],N=[],P=Array.from({length:h.fogBanks},(e,t)=>({x:Math.random()*n,y:t/Math.max(h.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:(.1+Math.random()*.1)*(vc(i)?bc(f):ol(i)?cl(p):1)})),F=h.fogBanks>0?iu(fu(i,y)):null,I=h.snowCount>0?lu():null,L=I==null?[]:Array.from({length:h.snowCount},()=>du(n,r,I)),R=Dc(i)?Oc(d):null,z=R==null?null:Hl(),B=z!=null&&R!=null?Array.from({length:R.count},()=>Gl(n,r,z,{min:R.sizeMin,max:R.sizeMax},R.speedMul)):[],V=(()=>{let{count:e}=kl(c.visualLevel);return e<=0?[]:Array.from({length:e},()=>({x:Math.random()*n,y:Math.random()*r,length:35+Math.random()*120,speed:6+Math.random()*10,wave:Math.random()*Math.PI*2,alpha:.1+Math.random()*.28,width:.5+Math.random()*1.1,phase:Math.random()*Math.PI*2}))})(),H=[],U=120+Math.random()*240;return{sky:b,cloudRgb:x,cfg:h,sunX:C,sunY:w,sunR:S,skyGradient:T,celestial:k,sunSprite:D,moonSprite:O,fogSprite:F,dayCycleTimes:_,dayCycle:v,sceneTimeMs:o,liveClock:s,hailSpec:R,state:{stars:A,moonCraters:E,clouds:j,drops:M,splashes:N,fogBanks:P,flakes:L,hailstones:B,hailPool:z??[],windStreaks:V,t:0,flashAlpha:0,boltLife:0,boltPoints:H,nextStrike:U}}}function mu(e,t){if(!e.dayCycleTimes)return;let n=ac(e.liveClock?t??Date.now():e.sceneTimeMs,e.dayCycleTimes),r=eu[e.activeWeather],i=dc(e.cfg.sky,r.sky,n),a=oc(e.width,e.height,n.arcProgress);e.dayCycle=n,e.activeNight=!n.isDay,e.sky=i,e.skyGradient=fc(e.ctx,e.height,i),e.sunX=a.x,e.sunY=a.y,e.celestial=n.isDay?e.sunSprite:e.moonSprite}function hu(e,t){t&&(e.state.t+=1),e.windField=Ol(e.state.t,e.windMotion),e.dayCycleTimes&&mu(e,e.liveClock?Date.now():e.sceneTimeMs),Yl(e),Ql(e),Pl(e),Fl(e),Il(e),Kl(e),ql(e),Jl(e),Rl(e),zl(e)}function gu(e){let{ctx:t,width:n,height:r,activeWeather:i,activeNight:a,windMotion:o}=e,s=pu(e),c={ctx:t,width:n,height:r,activeWeather:i,activeNight:s.dayCycle?!s.dayCycle.isDay:a,windMotion:o,windField:Ol(0,o),...s};c.dayCycleTimes&&mu(c,c.liveClock?Date.now():c.sceneTimeMs);let l=document.hidden,u=y(),d=v(e=>{l=e}),f=b(e=>{u=e});if(u)return hu(c,!1),()=>{d(),f()};let p=0,m=()=>{p=requestAnimationFrame(m),!l&&(u||hu(c,!0))};return m(),()=>{cancelAnimationFrame(p),d(),f()}}var _u={weatherBackground:`cos-weatherBackground-Mnm22`,canvas:`cos-canvas-nvqMt`,loadingOverlay:`cos-loadingOverlay-O58B7`,loadingSpinner:`cos-loadingSpinner-NQ9yG`,"weather-loading-spin":`cos-weather-loading-spin-IPFWZ`},vu=({width:e,height:t,fill:n=!1,weather:r=`partlyCloudy`,time:i=`14:00`,live:a=!1,latitude:o,longitude:s,windLevel:u=3,rainLevel:d=5,snowLevel:f=5,hailLevel:p=2,fogLevel:m=2,smogLevel:h=2,onLiveWeather:g,loading:_=!1,ariaLabel:v,loadingText:y=`天气加载中…`})=>{let{hostRef:b,width:x,height:S,hostStyle:C}=T({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:450}),w=(0,c.useRef)(null),E=yl(a,o!=null&&s!=null?{latitude:o,longitude:s}:void 0),D=Uc(a&&E.weather?E.weather:r),O=a&&E.rainLevel!=null?E.rainLevel:d,k=a&&E.snowLevel!=null?E.snowLevel:f,A=a&&E.fogLevel!=null?E.fogLevel:m,j=a&&E.hailLevel!=null?E.hailLevel:p,M=a&&E.smogLevel!=null?E.smogLevel:h,N=Zc(D,O,k),P=ic(i),F=E.current?.sunrise??null,I=E.current?.sunset??null,L=E.current?.windSpeed??null,R=(0,c.useMemo)(()=>a&&F!=null&&I!=null?{sunrise:F,sunset:I}:nc(P),[a,F,I,P]),z=Nl({live:a,windLevel:u,liveWindKmh:L}),B=(0,c.useMemo)(()=>Ml(z),[z]),V=a&&E.current?!E.current.isDay:!ac(P,R).isDay,H=_||a&&(E.status===`locating`||E.status===`fetching`),U=(0,c.useRef)(g);return(0,c.useEffect)(()=>{U.current=g}),(0,c.useEffect)(()=>{E.weather&&U.current?.(Uc(E.weather))},[E.weather]),(0,c.useEffect)(()=>{let e=w.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=x*t,e.height=S*t;let n=e.getContext(`2d`);if(n)return n.setTransform(t,0,0,t,0,0),gu({ctx:n,width:x,height:S,activeWeather:N,activeNight:V,dayCycleTimes:R,sceneTimeMs:P,liveClock:a,windMotion:B,rainLevel:O,snowLevel:k,fogLevel:A,hailLevel:j,smogLevel:M})},[V,N,R,O,k,A,j,M,S,a,P,x,B]),(0,l.jsxs)(`div`,{ref:b,className:_u.weatherBackground,style:C,children:[(0,l.jsx)(`canvas`,{ref:w,className:_u.canvas,style:{width:x,height:S},role:`img`,"aria-label":v??`天气背景:${D}${V?`(夜间)`:``},${B.level}级风`}),H&&(0,l.jsxs)(`div`,{className:_u.loadingOverlay,role:`status`,"aria-live":`polite`,children:[(0,l.jsx)(`div`,{className:_u.loadingSpinner,"aria-hidden":!0}),(0,l.jsx)(`span`,{children:y})]})]})},yu={waveText:`cos-waveText-Zy2Tp`,text:`cos-text-el-KR`,char:`cos-char-Y9-mV`,wave:`cos-wave-jVRCz`},bu=({text:e=`WAVE`,amplitude:t=12,color:n=`#38bdf8`,fontSize:r=56})=>(0,l.jsx)(`div`,{className:yu.waveText,children:(0,l.jsx)(`h1`,{className:yu.text,style:{fontSize:r,"--wave-color":n,"--wave-amp":`${t}px`},children:e.split(``).map((e,t)=>(0,l.jsx)(`span`,{className:yu.char,style:{animationDelay:`${t*.1}s`},children:e===` `?`\xA0`:e},`${e}-${t}`))})});exports.AudioVisualizer=A,exports.Aurora=O,exports.BarcodeScan=f,exports.BlurText=m,exports.BubbleField=xo,exports.BurnAway=g,exports.CanvasClock=M,exports.Charge=I,exports.CircularText=R,exports.ClickSpark=B,exports.Confetti=G,exports.CountUp=ce,exports.Countdown=ie,exports.CursorTrail=he,exports.CurvedLoop=q,exports.CyberGrid=J,exports.DEFAULT_FOG_LEVEL=mc,exports.DEFAULT_HAIL_LEVEL=Cc,exports.DEFAULT_RAIN_LEVEL=Mc,exports.DEFAULT_SMOG_LEVEL=nl,exports.DEFAULT_SNOW_LEVEL=Nc,exports.DEFAULT_WIND_LEVEL=Sl,exports.DiceRoll=ve,exports.DnaHelix=ue,exports.DoublePendulum=be,exports.ElectricArc=pe,exports.FOG_LEVEL_LABELS=hc,exports.Fireworks=De,exports.FlipCard=ke,exports.FlipCounter=Ne,exports.FuzzyText=Fe,exports.GameOfLife=Ue,exports.GlitchText=Ge,exports.GradientFlow=Re,exports.GravityBalls=Je,exports.HAIL_LEVEL_LABELS=wc,exports.HolographicCard=Xe,exports.LiquidGlass=nt,exports.LiquidProgress=Qe,exports.LorenzAttractor=et,exports.MAX_PRECIP_LEVEL=jc,exports.MIN_PRECIP_LEVEL=Ac,exports.MagneticButton=it,exports.MatrixRain=st,exports.MazeGenerator=dt,exports.MetaballPool=lt,exports.MeteorRain=pt,exports.NeonText=Ct,exports.NetworkGraph=xt,exports.NewtonCradle=Tt,exports.NineGrid=kt,exports.OrbitalChart=Mt,exports.ParticleNetwork=Pt,exports.PhotoAlbum=Xt,exports.PhotoCarousel=tn,exports.PhotoClothesline=On,exports.PhotoFilmstrip=Rn,exports.PhotoFridge=$n,exports.PhotoLantern=Lr,exports.PhotoLightbox=Wr,exports.PhotoPolaroid=ri,exports.PhotoPostcard=fi,exports.PhotoPrism=ji,exports.PhotoScroll=Vi,exports.PhotoTunnel=Qi,exports.PhotoViewMaster=ha,exports.PlasmaBall=_a,exports.ProgressChest=Ao,exports.RAIN_LEVEL_LABELS=Vc,exports.RadarScan=Mo,exports.RedPacketRain=Po,exports.ReturnCity=Io,exports.RippleWater=is,exports.RopeChain=Ro,exports.RotatingText=Ho,exports.SMOG_LEVEL_LABELS=rl,exports.SNOW_LEVEL_LABELS=Hc,exports.SandFall=xs,exports.ScrambleText=ss,exports.ScratchCard=ls,exports.ShinyText=qo,exports.SlotMachine=_s,exports.SmokeFog=Ia,exports.Snowfall=Eo,exports.SolarSystem=wo,exports.Speedometer=Go,exports.SplitReveal=ws,exports.SplitText=Es,exports.Spotlight=js,exports.SpringMass=ks,exports.Starfield=Oo,exports.TextMorph=Bs,exports.TimelinePulse=Yo,exports.TrueFocus=Hs,exports.Turntable=Is,exports.Typewriter=Ks,exports.WaveButton=Js,exports.WaveText=bu,exports.WeatherBackground=vu,exports.buildWindMotion=Ml,exports.clampFogLevel=gc,exports.clampHailLevel=Tc,exports.clampPrecipLevel=Pc,exports.clampSmogLevel=il,exports.fogBankAlphaScale=bc,exports.fogLevelFromVisibility=Sc,exports.fogLevelFromWmo=xc,exports.formatFogLevel=_c,exports.formatHailLevel=Ec,exports.formatLocalHm=vl,exports.formatPrecipLevel=Bc,exports.formatSmogLevel=al,exports.hailLevelFromWmo=kc,exports.hailSpec=Oc,exports.intensifyFogConfig=yc,exports.intensifyRainConfig=Qc,exports.intensifySmogConfig=sl,exports.intensifySnowCount=$c,exports.isRainWeather=Wc,exports.isSnowWeather=Gc,exports.kmhToWindLevel=jl,exports.mapWmoCodeToWeatherType=dl,exports.normalizeWeatherType=Uc,exports.precipBand=Ic,exports.precipLabel=zc,exports.rainLevelFromWeather=Jc,exports.rainLevelFromWmo=el,exports.resolveSceneWeather=Zc,exports.sampleWindField=Ol,exports.smogBankAlphaScale=cl,exports.smogLevelFromVisibility=ll,exports.snowLevelFromWeather=Yc,exports.snowLevelFromWmo=tl,exports.supportsFogLevel=vc,exports.supportsHailLevel=Dc,exports.supportsRainLevel=Kc,exports.supportsSmogLevel=ol,exports.supportsSnowLevel=qc,exports.useLiveWeather=yl,exports.useSunTimes=xl,exports.visualWindLevel=wl,exports.windLevelToKmh=Al,exports.windStreakSpec=kl;
249
+ `,ou=e=>{let t=e.replace(`#`,``),n=t.length===3?t.split(``).map(e=>e+e).join(``):t,r=Number.parseInt(n,16);return Number.isNaN(r)?[.22,.74,.97]:[(r>>16&255)/255,(r>>8&255)/255,(r&255)/255]},su=(e,t,n)=>{let r=e.createShader(t);return r?(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(e.deleteShader(r),null)):null},cu=(e,t,n)=>{let r=su(e,e.VERTEX_SHADER,t),i=su(e,e.FRAGMENT_SHADER,n);if(!r||!i)return null;let a=e.createProgram();return a?(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),e.deleteShader(r),e.deleteShader(i),e.getProgramParameter(a,e.LINK_STATUS)?a:(e.deleteProgram(a),null)):null},lu=192,uu=e=>({from:ou(e.fromColor),to:ou(e.toColor),tint:ou(e.color),waveAmplitude:e.waveAmplitude,waveSpeed:e.waveSpeed,shimmer:e.shimmer,reflection:e.reflection,rippleStrength:e.rippleStrength,rippleRadius:e.rippleRadius,damping:e.damping,spread:e.spread,interactive:e.interactive}),du=({width:e,height:t,fill:n=!1,fromColor:r=`#52ade3`,toColor:i=`#013565`,color:a=`#a8d8f5`,waveAmplitude:o=1,waveSpeed:s=1,shimmer:u=1,reflection:d=.38,rippleStrength:f=1,rippleRadius:p=6,damping:m=.985,spread:h=.5,interactive:g=!0,showHint:v=!0,hint:S=`点击水面产生涟漪`})=>{let{hostRef:C,width:w,height:T,hostStyle:D}=E({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:500}),O=(0,c.useRef)(null),k=(0,c.useRef)(0),A=(0,c.useRef)(null),j=(0,c.useRef)(uu({fromColor:r,toColor:i,color:a,waveAmplitude:o,waveSpeed:s,shimmer:u,reflection:d,rippleStrength:f,rippleRadius:p,damping:m,spread:h,interactive:g}));(0,c.useEffect)(()=>{j.current=uu({fromColor:r,toColor:i,color:a,waveAmplitude:o,waveSpeed:s,shimmer:u,reflection:d,rippleStrength:f,rippleRadius:p,damping:m,spread:h,interactive:g})},[r,i,a,o,s,u,d,f,p,m,h,g]);let M=(0,c.useCallback)((e,t)=>{if(!j.current.interactive)return;let n=O.current;if(!n)return;let r=n.getBoundingClientRect();A.current={x:(e-r.left)/r.width,y:1-(t-r.top)/r.height,strength:j.current.rippleStrength}},[]);return(0,c.useEffect)(()=>{let e=O.current;if(!e)return;let t=e=>{e.pointerType===`mouse`&&e.button!==0||M(e.clientX,e.clientY)};return e.addEventListener(`pointerdown`,t),()=>e.removeEventListener(`pointerdown`,t)},[M]),(0,c.useEffect)(()=>{let e=O.current;if(!e)return;let t=Math.min(window.devicePixelRatio||1,2);e.width=Math.floor(w*t),e.height=Math.floor(T*t);let n=e.getContext(`webgl`,{alpha:!1,antialias:!1,depth:!1,stencil:!1,premultipliedAlpha:!1});if(!n)return;let r=cu(n,iu,au);if(!r)return;let i=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,i),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),n.STATIC_DRAW);let a=n.getAttribLocation(r,`a_pos`),o=n.getUniformLocation(r,`u_time`),s=n.getUniformLocation(r,`u_res`),c=n.getUniformLocation(r,`u_tint`),l=n.getUniformLocation(r,`u_from`),u=n.getUniformLocation(r,`u_to`),d=n.getUniformLocation(r,`u_height`),f=n.getUniformLocation(r,`u_sim`),p=n.getUniformLocation(r,`u_waveAmp`),m=n.getUniformLocation(r,`u_waveSpeed`),h=n.getUniformLocation(r,`u_shimmer`),g=n.getUniformLocation(r,`u_reflection`),v=lu*lu,S=new Float32Array(v),C=new Float32Array(v),E=new Float32Array(v),D=n.createTexture();n.bindTexture(n.TEXTURE_2D,D),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);let M=new Uint8Array(v*4),N=()=>{for(let e=0;e<v;e++){let t=Math.max(0,Math.min(255,Math.floor((C[e]*.5+.5)*255))),n=e*4;M[n]=t,M[n+1]=t,M[n+2]=t,M[n+3]=255}n.bindTexture(n.TEXTURE_2D,D),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,lu,lu,0,n.RGBA,n.UNSIGNED_BYTE,M)},P=(e,t,n,r)=>{let i=e*(lu-1),a=t*(lu-1),o=_(r,2,12);for(let e=-o-1;e<=o+1;e++)for(let t=-o-1;t<=o+1;t++){let r=Math.round(i+t),s=Math.round(a+e);if(r<=0||r>=lu-1||s<=0||s>=lu-1)continue;let c=Math.sqrt(t*t+e*e),l=Math.exp(-c*c*.55)*-.35,u=Math.exp(-((c-o*.55)**2)*.9);C[s*lu+r]+=n*(l+u*1.1)}},F=(e,t)=>{let n=_(e,.9,.999),r=_(t,.3,.7);for(let e=0;e<2;e++){for(let e=1;e<lu-1;e++){let t=e*lu;for(let e=1;e<lu-1;e++){let i=t+e,a=C[i-1]+C[i+1]+C[i-lu]+C[i+lu];E[i]=(a*r-S[i])*n,E[i]>1.5?E[i]=1.5:E[i]<-1.5&&(E[i]=-1.5)}}let e=S;S=C,C=E,E=e,E.fill(0)}},I=t=>{let v=j.current;n.viewport(0,0,e.width,e.height),n.useProgram(r),n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(a),n.vertexAttribPointer(a,2,n.FLOAT,!1,0,0),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,D),n.uniform1i(d,0),n.uniform1f(o,t),n.uniform2f(s,e.width,e.height),n.uniform3f(c,v.tint[0],v.tint[1],v.tint[2]),n.uniform3f(l,v.from[0],v.from[1],v.from[2]),n.uniform3f(u,v.to[0],v.to[1],v.to[2]),n.uniform2f(f,lu,lu),n.uniform1f(p,_(v.waveAmplitude,0,2)),n.uniform1f(m,_(v.waveSpeed,0,3)),n.uniform1f(h,_(v.shimmer,0,2)),n.uniform1f(g,_(v.reflection,0,1)),n.drawArrays(n.TRIANGLE_STRIP,0,4)};N();let L=document.hidden,R=b(),z=y(e=>{L=e}),B=x(e=>{R=e});if(R)return I(0),()=>{z(),B(),n.deleteTexture(D),n.deleteBuffer(i),n.deleteProgram(r)};let V=performance.now(),H=e=>{if(k.current=requestAnimationFrame(H),L||R)return;let t=j.current;if(A.current){let e=A.current,n=_(e.strength,0,3),r=t.rippleRadius;P(e.x,e.y,n,r),P(e.x+.004,e.y-.003,n*.35,r),A.current=null}F(t.damping,t.spread),N(),I((e-V)/1e3)};return k.current=requestAnimationFrame(H),()=>{cancelAnimationFrame(k.current),z(),B(),n.deleteTexture(D),n.deleteBuffer(i),n.deleteProgram(r)}},[T,w]),(0,l.jsxs)(`div`,{ref:C,className:ru.rippleWater,style:D,children:[(0,l.jsx)(`canvas`,{ref:O,className:ru.canvas,style:{width:w,height:T,cursor:g?`pointer`:`default`},role:`img`,"aria-label":S||`涟漪水面`}),v?(0,l.jsx)(`span`,{className:ru.hint,"aria-hidden":!0,children:S}):null]})},fu={scrambleText:`cos-scrambleText-hN4Wm`,text:`cos-text-frsHs`,cursor:`cos-cursor-3zQOy`,blink:`cos-blink-OcKXu`},pu=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*`,mu=({text:e=`DECRYPTED`,duration:t=2e3,charset:n=pu})=>{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:pu,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:fu.scrambleText,children:(0,l.jsxs)(`p`,{className:fu.text,children:[r,(0,l.jsx)(`span`,{className:fu.cursor})]})})},hu={scratchCard:`cos-scratchCard-McIEK`,prize:`cos-prize-X0z5V`,canvas:`cos-canvas-JqIlr`,hidden:`cos-hidden-Lsfbt`},gu=(0,c.forwardRef)(({coverColor:e=`#94a3b8`,prize:t=`🎉 恭喜中奖!`,coverText:n=`刮开涂层`,revealThreshold:r=.45,onReveal:i,width:a=300,height:o=180},s)=>{let u=(0,c.useRef)(null),d=(0,c.useRef)(!1),f=(0,c.useRef)(!1),p=(0,c.useRef)(i),m=(0,c.useRef)(r),[h,g]=(0,c.useState)(!1);(0,c.useEffect)(()=>{p.current=i},[i]),(0,c.useEffect)(()=>{m.current=r},[r]);let _=(0,c.useCallback)(t=>{t.globalCompositeOperation=`source-over`,t.fillStyle=e,t.fillRect(0,0,a,o),t.fillStyle=`rgb(255 255 255 / 30%)`,t.font=`bold 16px system-ui, sans-serif`,t.textAlign=`center`,t.fillText(n,a/2,o/2)},[e,n,o,a]),v=(0,c.useCallback)(()=>{let e=u.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=a*t,e.height=o*t;let n=e.getContext(`2d`);n&&(n.setTransform(t,0,0,t,0,0),_(n))},[_,o,a]),y=(0,c.useCallback)(()=>{f.current||(f.current=!0,g(!0),p.current?.())},[]),b=(0,c.useCallback)(e=>{if(f.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)>m.current&&y()},[y]);(0,c.useEffect)(()=>{f.current=!1,g(!1),v()},[v]);let x=(e,t)=>{let n=u.current;if(!n||f.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(),b(n))},S=e=>{`touches`in e&&e.preventDefault(),d.current=!0;let t=u.current;if(!t)return;let n=C(t,e.nativeEvent);n&&x(n.x,n.y)},w=e=>{if(!d.current)return;`touches`in e&&e.preventDefault();let t=u.current;if(!t)return;let n=C(t,e.nativeEvent);n&&x(n.x,n.y)},T=()=>{d.current=!1};return(0,c.useImperativeHandle)(s,()=>({reset:()=>{f.current=!1,g(!1),v()},reveal:()=>{y()}}),[y,v]),(0,l.jsxs)(`div`,{className:hu.scratchCard,style:{width:a,height:o},children:[(0,l.jsx)(`div`,{className:hu.prize,children:t}),(0,l.jsx)(`canvas`,{ref:u,className:`${hu.canvas} ${h?hu.hidden:``}`,style:{width:a,height:o},"aria-label":n,"data-testid":`scratch-card-canvas`,onMouseDown:S,onMouseMove:w,onMouseUp:T,onMouseLeave:T,onTouchStart:S,onTouchMove:w,onTouchEnd:T})]})});gu.displayName=`ScratchCard`;var _u={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`},vu=[`🍒`,`🍋`,`🍊`,`🍇`,`⭐`,`7️⃣`],yu=30,bu=8,xu=[0,350,700],Su=e=>1-(1-e)**3,Cu=(e,t)=>{if(t===void 0)return Math.floor(Math.random()*e.length);let n=e.indexOf(t);return n>=0?n:Math.floor(Math.random()*e.length)},wu=(0,c.forwardRef)(({symbols:e=vu,spinDuration:t=3e3,targetResults:n,onSpinEnd:r,startText:i,buttonText:a,spinningText:o=`旋转中...`,jackpotText:s=`🎰 大奖!`,resultPrefix:u=`结果:`},d)=>{let f=a??i??`开始`,[p,m]=(0,c.useState)(!1),[h,g]=(0,c.useState)([0,0,0]),[_,v]=(0,c.useState)([]),y=(0,c.useRef)(0),x=(0,c.useRef)(!1),S=(0,c.useRef)(h),C=(0,c.useRef)(r),w=(0,c.useRef)(e),T=(0,c.useRef)(n),E=(0,c.useRef)(null);(0,c.useEffect)(()=>{C.current=r},[r]),(0,c.useEffect)(()=>{w.current=e},[e]),(0,c.useEffect)(()=>{T.current=n},[n]),(0,c.useEffect)(()=>{x.current=p},[p]),(0,c.useEffect)(()=>{S.current=h},[h]);let D=e.length*80,O=Math.floor(yu/2)*D,k=(0,c.useCallback)(()=>{let t=[];for(let n=0;n<yu;n++)t.push(...e);return t},[e])(),A=(e,t)=>-(e-1+t*w.current.length)*80,j=(0,c.useCallback)(e=>{let n=w.current;if(x.current||n.length===0)return;m(!0),v([]);let r=e??T.current,i=[0,1,2].map(e=>Cu(n,r?.[e])),a=[...S.current],o=n.length*80,s=i.map((e,t)=>{let n=a[t],r=bu*o,i=Math.ceil((-n+r)/o)+1,s=A(e,i);for(;n-s<r;)i+=1,s=A(e,i);return s}),c=Math.max(t,16),l=performance.now(),u={cancelled:!1};E.current=u;let d=()=>{if(u.cancelled)return;let e=i.map(e=>n[e]);g(i.map(e=>A(e,Math.round(O/o)))),v(e),m(!1),C.current?.(e)};if(b()){d();return}let f=e=>{u.cancelled||(g(a.map((t,n)=>{let r=e-l-xu[n];if(r<0)return t;let i=Su(Math.min(r/c,1));return t+(s[n]-t)*i})),xu.every(t=>e-l-t>=c)?d():y.current=requestAnimationFrame(f))};y.current=requestAnimationFrame(f)},[O,t]),M=(0,c.useCallback)(()=>{x.current||v([])},[]);return(0,c.useImperativeHandle)(d,()=>({spin:j,reset:M}),[j,M]),(0,c.useEffect)(()=>()=>{E.current&&(E.current.cancelled=!0),cancelAnimationFrame(y.current)},[]),(0,l.jsxs)(`div`,{className:_u.slotMachine,children:[(0,l.jsx)(`div`,{className:_u.machine,children:[0,1,2].map(e=>(0,l.jsxs)(`div`,{className:_u.reel,style:{height:240},children:[(0,l.jsx)(`div`,{className:_u.strip,style:{transform:`translateY(${h[e]}px)`},children:k.map((e,t)=>(0,l.jsx)(`div`,{className:_u.item,style:{height:80},children:e},t))}),(0,l.jsx)(`div`,{className:_u.mask})]},e))}),(0,l.jsx)(`button`,{type:`button`,className:_u.spinBtn,"data-testid":`slot-machine-spin`,onClick:()=>j(),disabled:p,"aria-busy":p,children:p?o:f}),_.length>0&&!p&&(0,l.jsx)(`p`,{className:_u.result,children:_[0]===_[1]&&_[1]===_[2]?s:`${u} ${_.join(` `)}`})]})});wu.displayName=`SlotMachine`;var Tu={sandFall:`cos-sandFall-kgJeI`,canvas:`cos-canvas-9z6X1`,toolbar:`cos-toolbar-u8dLM`,hint:`cos-hint-DS8tY`,button:`cos-button-YhINe`},Eu=[`#fbbf24`,`#f59e0b`,`#d97706`,`#b45309`,`#92400e`],Du=e=>{let t=e.trim().replace(`#`,``);if(!/^[0-9a-fA-F]{6}$/.test(t))return[251,191,36];let n=parseInt(t,16);return[n>>16&255,n>>8&255,n&255]},Ou=({width:e=480,height:t=400,cellSize:n=4,colors:r=Eu,spawnRate:i=3,hint:a=`按住鼠标绘制沙粒`,clearText:o=`Clear`})=>{let s=(0,c.useRef)(null),u=Math.max(1,Math.floor(e/n)),d=Math.max(1,Math.floor(t/n)),f=(0,c.useRef)(Array(u*d).fill(null)),p=(0,c.useRef)({x:-1,y:-1,down:!1}),m=(0,c.useMemo)(()=>(r.length>0?r:Eu).map(Du),[r]),h=()=>{f.current=Array(u*d).fill(null)};(0,c.useEffect)(()=>{f.current=Array(u*d).fill(null)},[u,d]),(0,c.useEffect)(()=>{let r=s.current;if(!r)return;let a=window.devicePixelRatio||1;r.width=e*a,r.height=t*a;let o=r.getContext(`2d`);if(!o)return;o.setTransform(a,0,0,a,0,0);let c=0,l=document.hidden,h=y(e=>{l=e}),g=(e,t)=>t*u+e,_=()=>{let e=f.current;for(let t=d-2;t>=0;t--)for(let n=0;n<u;n++){let r=g(n,t);if(e[r]===null)continue;let i=g(n,t+1);if(e[i]===null){e[i]=e[r],e[r]=null;continue}let a=Math.random()<.5?-1:1,o=n+a,s=n-a;o>=0&&o<u&&e[g(o,t+1)]===null?(e[g(o,t+1)]=e[r],e[r]=null):s>=0&&s<u&&e[g(s,t+1)]===null&&(e[g(s,t+1)]=e[r],e[r]=null)}},v=()=>{let{x:e,y:t,down:r}=p.current;if(!r||e<0||t<0)return;let a=Math.floor(e/n),o=Math.floor(t/n),s=f.current;for(let e=0;e<i;e++){let e=a+Math.floor((Math.random()-.5)*6),t=o+Math.floor((Math.random()-.5)*3);if(e<0||e>=u||t<0||t>=d)continue;let n=g(e,t);s[n]===null&&(s[n]=Math.floor(Math.random()*m.length))}},b=()=>{o.fillStyle=`#0f172a`,o.fillRect(0,0,e,t);let r=f.current;for(let e=0;e<d;e++)for(let t=0;t<u;t++){let i=r[g(t,e)];if(i===null)continue;let[a,s,c]=m[i];o.fillStyle=`rgb(${a} ${s} ${c})`,o.fillRect(t*n,e*n,n,n)}},x=()=>{c=requestAnimationFrame(x),!l&&(v(),_(),b())};return c=requestAnimationFrame(x),()=>{cancelAnimationFrame(c),h()}},[n,u,t,m,d,i,e]);let g=(e,t,n,r)=>{p.current={x:e-n.left,y:t-n.top,down:r}};return(0,l.jsxs)(`div`,{className:Tu.sandFall,style:{width:e},children:[(0,l.jsx)(`canvas`,{ref:s,className:Tu.canvas,style:{width:e,height:t},onMouseDown:e=>g(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect(),!0),onMouseMove:e=>{p.current.down&&g(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect(),!0)},onMouseUp:()=>{p.current.down=!1},onMouseLeave:()=>{p.current.down=!1},onTouchStart:e=>{let t=e.touches[0];t&&g(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect(),!0)},onTouchMove:e=>{let t=e.touches[0];t&&g(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect(),!0)},onTouchEnd:()=>{p.current.down=!1}}),(0,l.jsxs)(`div`,{className:Tu.toolbar,children:[(0,l.jsx)(`span`,{className:Tu.hint,children:a}),(0,l.jsx)(`button`,{type:`button`,className:Tu.button,onClick:h,children:o})]})]})},ku={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`},Au=[`fromTop`,`fromBottom`,`fromLeft`,`fromRight`],ju=({text:e=`REVEAL`,delay:t=80,color:n=`#f8fafc`})=>(0,l.jsx)(`div`,{className:ku.splitReveal,children:(0,l.jsx)(`h1`,{className:ku.text,style:{"--reveal-color":n},children:e.split(``).map((e,n)=>(0,l.jsx)(`span`,{className:`${ku.char} ${ku[Au[n%Au.length]]}`,style:{animationDelay:`${n*t}ms`},children:e===` `?`\xA0`:e},`${e}-${n}`))})}),Mu={splitText:`cos-splitText-hz-Wy`,text:`cos-text-E89BY`,char:`cos-char-Rmkag`,fadeUp:`cos-fadeUp-5VVYL`,enter:`cos-enter-Nt9F9`,fadeUpIn:`cos-fadeUpIn-eRcGj`,exit:`cos-exit-oGQWA`,fadeUpOut:`cos-fadeUpOut-YFnv-`,scale:`cos-scale-yrOq-`,scaleIn:`cos-scaleIn-0YN5q`,scaleOut:`cos-scaleOut-4Q-NP`,rotate:`cos-rotate-TXlZi`,rotateIn:`cos-rotateIn-ixK-d`,rotateOut:`cos-rotateOut-OA6Ys`,blur:`cos-blur-8VyzQ`,blurIn:`cos-blurIn-X-IdF`,blurOut:`cos-blurOut-ZBSbO`},Nu=({text:e=`SPLIT TEXT`,animation:t=`fadeUp`,stagger:n=50,duration:r=500,loop:i=!0,loopPause:a=2400,fontSize:o=56,color:s=`#f8fafc`})=>{let[u,d]=(0,c.useState)(!0),f=(0,c.useMemo)(()=>e.split(``),[e]),p=f.length*n+r;return(0,c.useEffect)(()=>{if(!i)return;let e,t,n=!1,o=()=>{n||(d(!0),t=setTimeout(()=>{n||(d(!1),e=setTimeout(o,Math.max(r,600)))},p+a))};return o(),()=>{n=!0,e&&clearTimeout(e),t&&clearTimeout(t)}},[r,i,a,p]),(0,l.jsx)(`div`,{className:Mu.splitText,children:(0,l.jsx)(`div`,{className:Mu.text,style:{fontSize:o,"--split-color":s,"--split-duration":`${r}ms`},children:f.map((e,r)=>(0,l.jsx)(`span`,{className:`${Mu.char} ${Mu[t]} ${u?Mu.enter:Mu.exit}`,style:{animationDelay:`${r*n}ms`},children:e===` `?`\xA0`:e},`${e}-${r}`))})})},Pu={springMass:`cos-springMass-cYEt6`,canvas:`cos-canvas-mwL9l`,hint:`cos-hint-TKLm3`},Fu=(e,t,n,r)=>{let i=Math.max(3,Math.min(n,10)),a=Math.max(3,Math.min(r,8)),o=e*.16,s=t*.18,c=(e-o*2)/(i-1),l=(t-s*2)/(a-1),u=[];for(let e=0;e<a;e++)for(let t=0;t<i;t++){let n=e===0&&(t===0||t===i-1)||e===a-1&&(t===0||t===i-1);u.push({x:o+t*c,y:s+e*l,vx:0,vy:0,pinned:n})}let d=[],f=(e,t)=>t*i+e;for(let e=0;e<a;e++)for(let t=0;t<i;t++)if(t<i-1&&d.push({a:f(t,e),b:f(t+1,e),rest:c}),e<a-1&&d.push({a:f(t,e),b:f(t,e+1),rest:l}),t<i-1&&e<a-1){let n=Math.hypot(c,l);d.push({a:f(t,e),b:f(t+1,e+1),rest:n}),d.push({a:f(t+1,e),b:f(t,e+1),rest:n})}return{nodes:u,springs:d,cols:i,rows:a}},Iu=({width:e=560,height:t=400,cols:n=6,rows:r=5,stiffness:i=.22,damping:a=.9,color:o=`#a78bfa`,hint:s=`拖拽网格质点,观察弹簧回弹`})=>{let u=(0,c.useRef)(null),d=(0,c.useRef)(Fu(e,t,n,r)),f=(0,c.useRef)(null),p=(0,c.useRef)({x:0,y:0});(0,c.useEffect)(()=>{d.current=Fu(e,t,n,r),f.current=null},[n,t,r,e]),(0,c.useEffect)(()=>{let n=u.current;if(!n)return;let r=window.devicePixelRatio||1;n.width=e*r,n.height=t*r;let s=n.getContext(`2d`);if(!s)return;s.setTransform(r,0,0,r,0,0);let c=0,l=document.hidden,m=y(e=>{l=e}),h=Math.max(.04,Math.min(i,.8)),g=()=>{let{nodes:n,springs:r}=d.current,i=f.current;if(i){let e=n[i.index];e.x=p.current.x+i.ox,e.y=p.current.y+i.oy,e.vx=0,e.vy=0}for(let e of r){let t=n[e.a],r=n[e.b],a=r.x-t.x,o=r.y-t.y,s=Math.hypot(a,o)||.001,c=(s-e.rest)*h,l=a/s*c,u=o/s*c,d=i?.index===e.a,f=i?.index===e.b;!t.pinned&&!d&&(t.vx+=l,t.vy+=u),!r.pinned&&!f&&(r.vx-=l,r.vy-=u)}for(let r=0;r<n.length;r++){let o=n[r];if(o.pinned||i?.index===r){o.vx=0,o.vy=0;continue}o.vx*=a,o.vy*=a,o.x+=o.vx,o.y+=o.vy,o.x<10?(o.x=10,o.vx*=-.4):o.x>e-10&&(o.x=e-10,o.vx*=-.4),o.y<10?(o.y=10,o.vy*=-.4):o.y>t-10&&(o.y=t-10,o.vy*=-.4)}},_=()=>{let{nodes:n,springs:r}=d.current;s.fillStyle=`#0f172a`,s.fillRect(0,0,e,t);for(let i of r){let r=n[i.a],a=n[i.b],c=Math.hypot(a.x-r.x,a.y-r.y)||1,l=Math.min(1,Math.abs(c-i.rest)/i.rest);s.beginPath(),s.moveTo(r.x,r.y),s.lineTo(a.x,a.y),s.strokeStyle=o,s.globalAlpha=.22+l*.55,s.lineWidth=i.rest>Math.max(e,t)*.2?1:1.6,s.stroke(),s.globalAlpha=1}n.forEach((e,t)=>{s.beginPath(),s.arc(e.x,e.y,e.pinned?6:8,0,Math.PI*2),s.fillStyle=e.pinned?`#64748b`:o,s.fill(),s.strokeStyle=`rgb(255 255 255 / 28%)`,s.lineWidth=1,s.stroke(),f.current?.index===t&&(s.beginPath(),s.arc(e.x,e.y,13,0,Math.PI*2),s.strokeStyle=o,s.globalAlpha=.45,s.lineWidth=2,s.stroke(),s.globalAlpha=1)})},v=()=>{c=requestAnimationFrame(v),!l&&(g(),_())};return c=requestAnimationFrame(v),()=>{cancelAnimationFrame(c),m()}},[o,a,t,i,e]);let m=(e,t)=>{let{nodes:n}=d.current,r=-1,i=20;return n.forEach((n,a)=>{if(n.pinned)return;let o=Math.hypot(n.x-e,n.y-t);o<i&&(i=o,r=a)}),r},h=(e,t,n)=>{let r=e-n.left,i=t-n.top;p.current={x:r,y:i};let a=m(r,i);if(a<0)return;let o=d.current.nodes[a];f.current={index:a,ox:o.x-r,oy:o.y-i}},g=(e,t,n)=>{p.current={x:e-n.left,y:t-n.top}},_=()=>{f.current=null};return(0,l.jsxs)(`div`,{className:Pu.springMass,style:{width:e,height:t},children:[(0,l.jsx)(`canvas`,{ref:u,className:Pu.canvas,style:{width:e,height:t},onMouseDown:e=>h(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect()),onMouseMove:e=>g(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect()),onMouseUp:_,onMouseLeave:_,onTouchStart:e=>{let t=e.touches[0];t&&h(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},onTouchMove:e=>{let t=e.touches[0];t&&g(t.clientX,t.clientY,e.currentTarget.getBoundingClientRect())},onTouchEnd:_}),(0,l.jsx)(`div`,{className:Pu.hint,children:s})]})},Lu={spotlight:`cos-spotlight-OddY1`,content:`cos-content-5I1Wy`,overlay:`cos-overlay-F6CJ5`},Ru=({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:Lu.spotlight,style:{"--spot-radius":`${t}px`,"--dim-color":n},onMouseMove:i,children:[(0,l.jsx)(`div`,{className:Lu.content,children:e}),(0,l.jsx)(`div`,{className:Lu.overlay})]})},zu={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`},Bu=[`#FF6B6B`,`#4ECDC4`,`#FFE66D`,`#A78BFA`,`#60A5FA`,`#F472B6`,`#34D399`,`#FB923C`],Vu=[{label:`一等奖`},{label:`二等奖`},{label:`三等奖`},{label:`谢谢参与`},{label:`优惠券`},{label:`再来一次`}],Hu=e=>1-(1-e)**3,Uu=(0,c.forwardRef)(({prizes:e=Vu,size:t=360,spinDuration:n=4e3,spinRounds:r=5,targetIndex:i,buttonText:a=`开始抽奖`,spinningText:o=`抽奖中...`,resultPrefix:s=`恭喜获得:`,onSpinEnd:u},d)=>{let f=(0,c.useRef)(null),p=(0,c.useRef)(0),m=(0,c.useRef)(0),h=(0,c.useRef)(1),g=(0,c.useRef)(!1),[_,v]=(0,c.useState)(!1),[y,x]=(0,c.useState)(null),S=(0,c.useRef)(u),C=(0,c.useRef)(e),w=(0,c.useRef)(i),T=(0,c.useRef)(null);(0,c.useEffect)(()=>{S.current=u},[u]),(0,c.useEffect)(()=>{C.current=e},[e]),(0,c.useEffect)(()=>{w.current=i},[i]),(0,c.useEffect)(()=>{g.current=_},[_]);let E=t+48,D=(e,t)=>t.color??Bu[e%Bu.length],O=(0,c.useCallback)(e=>{let n=f.current;if(!n)return;let r=n.getContext(`2d`);if(!r)return;let i=C.current,a=E/2,o=t/2,s=Math.PI*2/i.length;r.clearRect(0,0,E,E),r.save(),r.translate(a,a),r.rotate(e),i.forEach((e,n)=>{let i=n*s-Math.PI/2,a=i+s,c=D(n,e);r.beginPath(),r.moveTo(0,0),r.arc(0,0,o,i,a),r.closePath(),r.fillStyle=c,r.fill(),r.strokeStyle=`rgb(255 255 255 / 35%)`,r.lineWidth=2,r.stroke(),r.save(),r.rotate(i+s/2),r.textAlign=`right`,r.fillStyle=`#fff`,r.font=`bold ${Math.max(12,Math.floor(t/22))}px system-ui, sans-serif`,r.shadowColor=`rgb(0 0 0 / 30%)`,r.shadowBlur=4,r.fillText(e.label,o-18,6),r.restore()}),r.beginPath(),r.arc(0,0,o,0,Math.PI*2),r.strokeStyle=`#fbbf24`,r.lineWidth=6,r.stroke(),r.beginPath(),r.arc(0,0,o-4,0,Math.PI*2),r.strokeStyle=`#f59e0b`,r.lineWidth=2,r.stroke(),r.restore(),r.save(),r.translate(a,a);for(let e=0;e<12;e++){let t=e/12*Math.PI*2,n=Math.cos(t)*(o+14),i=Math.sin(t)*(o+14);r.beginPath(),r.arc(n,i,3,0,Math.PI*2),r.fillStyle=e%2==0?`#fde68a`:`#f59e0b`,r.fill()}r.restore()},[E,t]);(0,c.useEffect)(()=>{let e=f.current;if(!e)return;let t=window.devicePixelRatio||1;h.current=t,e.width=E*t,e.height=E*t;let n=e.getContext(`2d`);n&&n.setTransform(t,0,0,t,0,0),O(p.current)},[E,O,e]),(0,c.useEffect)(()=>()=>{T.current&&(T.current.cancelled=!0),m.current&&cancelAnimationFrame(m.current)},[]);let k=(0,c.useCallback)(e=>{let t=C.current;if(g.current||t.length===0)return;v(!0),x(null);let i=Math.PI*2/t.length,a=w.current,o=e??a,s=o===void 0?Math.floor(Math.random()*t.length):(Math.floor(o)%t.length+t.length)%t.length,c=s*i+i/2,l=p.current,u=l+r*Math.PI*2+(Math.PI*2-c)-l%(Math.PI*2),d=l,f=performance.now(),h={cancelled:!1};T.current=h;let _=e=>{if(h.cancelled)return;let n=t[s];p.current=e,O(e),v(!1),x(n),S.current?.(n,s)};if(b()){_(u);return}let y=e=>{if(h.cancelled)return;let t=e-f,r=Math.min(t/n,1),i=Hu(r),a=d+(u-d)*i;p.current=a,O(a),r<1?m.current=requestAnimationFrame(y):_(a)};m.current=requestAnimationFrame(y)},[O,n,r]),A=(0,c.useCallback)(()=>{g.current||x(null)},[]);return(0,c.useImperativeHandle)(d,()=>({spin:k,reset:A}),[k,A]),(0,l.jsxs)(`div`,{className:zu.turntable,style:{width:E,height:E+80},children:[(0,l.jsxs)(`div`,{className:zu.wheelWrap,style:{width:E,height:E},children:[(0,l.jsx)(`div`,{className:zu.pointer}),(0,l.jsx)(`canvas`,{ref:f,className:zu.canvas,style:{width:E,height:E}}),(0,l.jsx)(`button`,{type:`button`,className:zu.spinBtn,"data-testid":`turntable-spin`,onClick:()=>k(),disabled:_,"aria-busy":_,children:_?o:a})]}),y&&!_&&(0,l.jsxs)(`p`,{className:zu.result,children:[s,(0,l.jsx)(`strong`,{children:y.label})]})]})});Uu.displayName=`Turntable`;var Wu={textMorph:`cos-textMorph-W-C1e`,stage:`cos-stage-AaMn6`,layer:`cos-layer-N-4oM`},Gu=[`COS DESIGN`,`TEXT MORPH`,`SMOOTH TRANSITION`],Ku=(e,t,n)=>Math.min(n,Math.max(t,e)),qu=({texts:e=Gu,interval:t=2200,duration:n=680,fontSize:r=64,color:i=`#f8fafc`})=>{let a=(0,c.useMemo)(()=>e.length>0?e:Gu,[e]),[o,s]=(0,c.useState)(0),[u,d]=(0,c.useState)(0),f=(0,c.useRef)(0),p=(0,c.useRef)(0);(0,c.useEffect)(()=>(p.current=window.setTimeout(()=>{let e=performance.now(),t=r=>{let i=Ku((r-e)/Math.max(n,16),0,1);if(d(i),i<1){f.current=requestAnimationFrame(t);return}s(e=>(e+1)%a.length),d(0)};f.current=requestAnimationFrame(t)},t),()=>{window.clearTimeout(p.current),cancelAnimationFrame(f.current)}),[n,o,t,a]);let m=a[o],h=a[(o+1)%a.length],g=1-u,_=u,v=u*14,y=(1-u)*14,b=1-u*.08,x=.92+u*.08;return(0,l.jsx)(`div`,{className:Wu.textMorph,style:{"--morph-color":i},children:(0,l.jsxs)(`div`,{className:Wu.stage,style:{fontSize:r},children:[(0,l.jsx)(`span`,{className:`${Wu.layer} ${Wu.current}`,style:{opacity:g,filter:`blur(${v}px)`,transform:`scale(${b}) translateY(${u*-8}px)`},children:m}),(0,l.jsx)(`span`,{className:`${Wu.layer} ${Wu.next}`,style:{opacity:_,filter:`blur(${y}px)`,transform:`scale(${x}) translateY(${(1-u)*8}px)`},children:h})]})})},Ju={trueFocus:`cos-trueFocus-GX7IP`,stage:`cos-stage-epay6`,word:`cos-word-5pfV3`,focusFrame:`cos-focusFrame-o7brV`,corner:`cos-corner-PThvn`,tl:`cos-tl-maoq6`,tr:`cos-tr-KTph3`,bl:`cos-bl-JAm8m`,br:`cos-br-s9hq-`},Yu=({sentence:e=`True Focus`,separator:t=` `,manualMode:n=!1,blurAmount:r=5,borderColor:i=`#22c55e`,glowColor:a=`rgb(34 197 94 / 60%)`,animationDuration:o=.5,pauseBetweenAnimations:s=1,fontSize:u=48,color:d=`#f8fafc`})=>{let f=e.split(t).filter(Boolean),[p,m]=(0,c.useState)(0),[h,g]=(0,c.useState)(0),_=(0,c.useRef)(null),v=(0,c.useRef)([]),[y,b]=(0,c.useState)({x:0,y:0,width:0,height:0});(0,c.useEffect)(()=>{if(n||f.length===0)return;let e=window.setInterval(()=>{m(e=>(e+1)%f.length)},(o+s)*1e3);return()=>window.clearInterval(e)},[o,n,s,f.length]),(0,c.useEffect)(()=>{let e=_.current,t=v.current[p];if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();b({x:r.left-n.left,y:r.top-n.top,width:r.width,height:r.height})},[p,u,e,f.length]);let x=e=>{n&&(g(e),m(e))},S=()=>{n&&m(h)};return(0,l.jsx)(`div`,{className:Ju.trueFocus,children:(0,l.jsxs)(`div`,{className:Ju.stage,ref:_,style:{fontSize:u,"--focus-color":d,"--border-color":i,"--glow-color":a,"--focus-duration":`${o}s`},children:[f.map((e,t)=>{let i=t===p;return(0,l.jsx)(`span`,{ref:e=>{v.current[t]=e},className:Ju.word,style:{filter:i?`blur(0px)`:`blur(${r}px)`,cursor:n?`pointer`:`default`},onMouseEnter:()=>x(t),onMouseLeave:S,children:e},`${e}-${t}`)}),(0,l.jsxs)(`div`,{className:Ju.focusFrame,style:{transform:`translate(${y.x}px, ${y.y}px)`,width:y.width,height:y.height,opacity:+(p>=0)},children:[(0,l.jsx)(`span`,{className:`${Ju.corner} ${Ju.tl}`}),(0,l.jsx)(`span`,{className:`${Ju.corner} ${Ju.tr}`}),(0,l.jsx)(`span`,{className:`${Ju.corner} ${Ju.bl}`}),(0,l.jsx)(`span`,{className:`${Ju.corner} ${Ju.br}`})]})]})})},Xu={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`},Zu=[`Hello, cos-design!`,`欢迎来到组件库 ✨`,`Build something fun 🚀`],Qu=({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:Xu.typewriter,children:(0,l.jsxs)(`div`,{className:Xu.terminal,children:[(0,l.jsxs)(`div`,{className:Xu.dots,children:[(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{}),(0,l.jsx)(`span`,{})]}),(0,l.jsxs)(`p`,{className:Xu.text,children:[(0,l.jsx)(`span`,{className:Xu.prompt,children:`>`}),i,(0,l.jsx)(`span`,{className:Xu.cursor,children:`|`})]})]})})},$u=({texts:e=Zu,speed:t=100,deleteSpeed:n=50,pause:r=2e3})=>{let i=e.length>0?e:Zu;return(0,l.jsx)(Qu,{texts:i,speed:t,deleteSpeed:n,pause:r},i.join(`\0`))},ed={waveButton:`cos-waveButton-Aa7G-`,btn:`cos-btn-WJrEN`,label:`cos-label-9BHOU`,wave:`cos-wave-GycLU`,ripple:`cos-ripple-5ZFpr`},td=({text:e=`点我试试`,color:t=`#38bdf8`,className:n,style:r,...i})=>(0,l.jsx)(`div`,{className:ed.waveButton,children:(0,l.jsxs)(`button`,{type:`button`,className:`${ed.btn} ${n??``}`,style:{"--wave-color":t,...r},...i,children:[(0,l.jsx)(`span`,{className:ed.wave}),(0,l.jsx)(`span`,{className:ed.wave}),(0,l.jsx)(`span`,{className:ed.label,children:e})]})}),nd=e=>Math.min(1,Math.max(0,e)),rd=e=>{let t=e.replace(`#`,``).trim(),n=t.length===3?t.split(``).map(e=>e+e).join(``):t;if(n.length!==6)return[80,140,200];let r=Number.parseInt(n,16);return Number.isNaN(r)?[80,140,200]:[r>>16&255,r>>8&255,r&255]},id=([e,t,n])=>{let r=e=>Math.min(255,Math.max(0,Math.round(e))).toString(16).padStart(2,`0`);return`#${r(e)}${r(t)}${r(n)}`},ad=(e,t,n)=>e+(t-e)*n,od=(e,t,n)=>[ad(e[0],t[0],n),ad(e[1],t[1],n),ad(e[2],t[2],n)],sd=(e,t,n)=>id(od(rd(e),rd(t),nd(n))),cd=e=>{let t=nd(e);return t*t*(3-2*t)},ld=(e=Date.now())=>{let t=new Date(e),n=new Date(t);n.setHours(6,0,0,0);let r=new Date(t);return r.setHours(18,0,0,0),{sunrise:n.getTime(),sunset:r.getTime()}},ud=(e,t=new Date)=>{let n=e.trim().match(/^(\d{1,2}):(\d{2})$/);if(!n)return null;let r=Number(n[1]),i=Number(n[2]);if(r<0||r>23||i<0||i>59)return null;let a=new Date(t);return a.setHours(r,i,0,0),a.getTime()},dd=(e,t=new Date)=>ud(e??`14:00`,t)??ud(`14:00`,t),fd=(e,t)=>{let{sunrise:n,sunset:r}=t;if(!(r>n)){let t=ld(e);n=t.sunrise,r=t.sunset}let i=Math.max(1,r-n),a=n+1440*60*1e3,o=r-1440*60*1e3,s=e>=n&&e<r,c;if(s)c=nd((e-n)/i);else if(e>=r){let t=Math.max(1,a-r);c=nd((e-r)/t)}else{let t=Math.max(1,n-o);c=nd((e-o)/t)}let l=s?Math.sin(Math.PI*c):0,u=Math.abs(e-n),d=Math.abs(e-r),f=nd(1-Math.min(u,d)/45e5);return{isDay:s,arcProgress:c,elevation:l,twilight:f}},pd=(e,t,n)=>{let r=nd(n),i=Math.sin(Math.PI*r);return{x:e*(.1+.8*r),y:t*(.58-.4*i)}},md=`#e8895c`,hd=`#f3c98a`,gd=`#2a1f4a`,_d=`#c4784a`,vd=(e,t,n)=>{if(n.isDay){let t=cd(n.elevation),r=(1-t)*.72;return[sd(sd(e[0],md,r),`#1a2438`,(1-t)*.12),sd(sd(e[1],hd,r*.85),`#3a4558`,(1-t)*.08)]}let r=n.twilight;return[sd(t[0],sd(gd,md,.35),r*.55),sd(t[1],sd(_d,hd,.4),r*.7)]},yd=(e,t,n)=>{let r=e.createLinearGradient(0,0,0,t);return r.addColorStop(0,n[0]),r.addColorStop(1,n[1]),r},bd=e=>{if(!e.isDay)return{scale:.92+e.twilight*.06,alpha:.75+e.twilight*.2};let t=e.elevation;return{scale:.82+t*.22,alpha:.65+t*.35}},xd=2,Sd=[``,`薄雾`,`中雾`,`浓雾`],Cd=e=>Math.min(3,Math.max(1,Math.round(e))),wd=e=>{let t=Cd(e);return`${t} · ${Sd[t]}`},Td=e=>e===`fog`,Ed=(e,t)=>{let n=Cd(t);return n===1?{...e,fogBanks:3,haze:.06,cloudAlpha:Math.min(e.cloudAlpha,.28),sun:`soft`}:n===3?{...e,fogBanks:12,haze:.3,cloudAlpha:.42,sun:`dim`}:{...e,fogBanks:5,haze:.11,cloudAlpha:.32,sun:`dim`}},Dd=e=>{let t=Cd(e);return t===1?.45:t===3?.95:.65},Od=e=>e===45?2:e===48?3:null,kd=e=>e==null||!Number.isFinite(e)?null:e>=5e3?1:e>=1e3?2:3,Ad=2,jd=[``,`细雹`,`密雹`,`巨雹`],Md=e=>Math.min(3,Math.max(1,Math.round(e))),Nd=e=>{let t=Md(e);return`${t} · ${jd[t]}`},Pd=e=>e===`hail`,Fd=e=>{let t=Md(e);return t===1?{count:75,sizeMin:.85,sizeMax:2.1,speedMul:.88}:t===3?{count:210,sizeMin:2.4,sizeMax:5.6,speedMul:1.22}:{count:145,sizeMin:1.4,sizeMax:3.8,speedMul:1}},Id=e=>e===96?2:e===99?3:null,Ld=1,Rd=10,zd=5,Bd=5,Vd=e=>Math.min(10,Math.max(1,Math.round(e))),Hd=(e,t,n)=>e+(t-e)*n,Ud=e=>{let t=Vd(e);return t<=2?1:t<=4?2:t<=6?3:t<=8?4:5},Wd=[`毛毛雨`,`小雨`,`中雨`,`暴雨`,`特大暴雨`],Gd=[`毛毛雪`,`小雪`,`中雪`,`暴雪`,`特大暴雪`],Kd=(e,t)=>{let n=Ud(e);return(t===`rain`?Wd:Gd)[n-1]},qd=(e,t)=>`${Vd(e)} · ${Kd(e,t)}`,Jd=[``,...Wd],Yd=[``,...Gd],Xd=e=>e===`lightRain`||e===`moderateRain`||e===`heavyRain`?`rain`:e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`?`snow`:e,Zd=e=>e===`rain`||e===`lightRain`||e===`moderateRain`||e===`heavyRain`,Qd=e=>e===`snow`||e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`,$d=e=>Zd(e)||e===`thunderstorm`||e===`sleet`,ef=e=>Qd(e)||e===`sleet`,tf=(e,t=5)=>e===`lightRain`?3:e===`moderateRain`?5:e===`heavyRain`?8:Vd(t),nf=(e,t=5)=>e===`lightSnow`?3:e===`moderateSnow`?5:e===`heavySnow`?8:Vd(t),rf=(e,t)=>t===`rain`?e<=2?`lightRain`:e===3?`moderateRain`:`heavyRain`:e<=2?`lightSnow`:e===3?`moderateSnow`:`heavySnow`,af=(e,t=5,n=5)=>e===`rain`?rf(Ud(t),`rain`):e===`lightRain`||e===`moderateRain`||e===`heavyRain`?rf(Ud(tf(e)),`rain`):e===`snow`?rf(Ud(n),`snow`):e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`?rf(Ud(nf(e)),`snow`):e,of=(e,t)=>{let n=(Vd(t)-1)/9;return{count:Math.round(Hd(35,340,n)),speed:Hd(5.5,16,n),wind:Hd(-.4,-3.2,n),alpha:Hd(.28,.62,n),splash:Vd(t)>=5}},sf=e=>{let t=(Vd(e)-1)/9;return Math.round(Hd(30,360,t))},cf=e=>[51,56].includes(e)?2:[61,66,80].includes(e)?3:[53,55,57,63,81].includes(e)?5:[65,67].includes(e)?8:[82].includes(e)?10:[95].includes(e)?7:null,lf=e=>[77].includes(e)?2:[71,85].includes(e)?3:[73].includes(e)?5:[75].includes(e)?8:[86].includes(e)?10:null,uf=2,df=[``,`轻霾`,`中霾`,`重霾`],ff=e=>Math.min(3,Math.max(1,Math.round(e))),pf=e=>{let t=ff(e);return`${t} · ${df[t]}`},mf=e=>e===`smog`,hf=(e,t)=>{let n=ff(t);return n===1?{...e,fogBanks:5,haze:.16,cloudAlpha:Math.min(e.cloudAlpha,.28),sun:`soft`}:n===3?{...e,fogBanks:16,haze:.48,cloudAlpha:.42,sun:`dim`}:{...e,fogBanks:12,haze:.34,cloudAlpha:.35,sun:`dim`}},gf=e=>{let t=ff(e);return t===1?.55:t===3?1.05:.85},_f=e=>e==null||!Number.isFinite(e)?null:e>=5e3?1:e>=1e3?2:3,vf={0:`sunny`,1:`sunny`,2:`partlyCloudy`,3:`overcast`,45:`fog`,48:`fog`,51:`rain`,53:`rain`,55:`rain`,56:`rain`,57:`rain`,61:`rain`,63:`rain`,65:`rain`,66:`rain`,67:`rain`,80:`rain`,81:`rain`,82:`rain`,71:`snow`,73:`snow`,75:`snow`,77:`snow`,85:`snow`,86:`snow`,95:`thunderstorm`,96:`hail`,99:`hail`},yf=e=>Xd(vf[e]??`overcast`),bf={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`idle`,error:null,current:null},xf={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`locating`,error:null,current:null},Sf={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`fetching`,error:null,current:null},Cf=e=>e!=null&&Number.isFinite(e.latitude)&&Number.isFinite(e.longitude),wf=e=>{if(typeof e!=`string`||!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null},Tf=e=>{if(typeof e!=`string`||!e)return null;let t=e.match(/T(\d{2}):(\d{2})/);return t?`${t[1]}:${t[2]}`:null},Ef=(e,t)=>{if(e)try{let t=new Intl.DateTimeFormat(`en-GB`,{timeZone:e,hour:`2-digit`,minute:`2-digit`,hour12:!1}).formatToParts(new Date),n=t.find(e=>e.type===`hour`)?.value,r=t.find(e=>e.type===`minute`)?.value;if(n!=null&&r!=null)return`${n.padStart(2,`0`)}:${r.padStart(2,`0`)}`}catch{}return t??null},Df=(e=!0,t)=>{let n=Cf(t),r=n?t.latitude:null,i=n?t.longitude:null,a=e?n?Sf:xf:bf,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,visibility`,daily:`sunrise,sunset`,timezone:`auto`,forecast_days:`1`}),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),u=wf(o?.daily?.sunrise?.[0]),d=wf(o?.daily?.sunset?.[0]),f=typeof o?.timezone==`string`?o.timezone:null,p=Tf(o?.current?.time)??Ef(f),m=yf(s),h=cf(s),g=lf(s),_=o?.current?.visibility,v=_!=null&&Number.isFinite(Number(_))?Number(_):null,y=m===`fog`?kd(v)??Od(s)??2:null,b=m===`hail`?Id(s)??2:null,x=m===`smog`?_f(v)??2:null;if(t)return;l({weather:m,rainLevel:h,snowLevel:g,fogLevel:y,hailLevel:b,smogLevel:x,status:`success`,error:null,current:{weatherCode:s,windSpeed:c,isDay:o?.current?.is_day===1,latitude:e,longitude:r,timezone:f,localTime:p,visibility:v,rainLevel:h,snowLevel:g,fogLevel:y,hailLevel:b,smogLevel:x,sunrise:u,sunset:d}})}catch(e){if(t||e instanceof DOMException&&e.name===`AbortError`)return;l({weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel: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,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel: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,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`error`,error:e.message||`定位失败`,current:null})},{timeout:1e4,maximumAge:600*1e3}),()=>{t=!0,n.abort()})},[e,r,i]),s},Of=async(e,t,n)=>{let r=new URLSearchParams({latitude:String(e),longitude:String(t),daily:`sunrise,sunset`,timezone:`auto`,forecast_days:`1`}),i=await fetch(`https://api.open-meteo.com/v1/forecast?${r}`,{signal:n});if(!i.ok)return null;let a=await i.json(),o=wf(a?.daily?.sunrise?.[0]),s=wf(a?.daily?.sunset?.[0]);return o==null||s==null?null:{sunrise:o,sunset:s}},kf=e=>{let t=Cf(e),n=t?e.latitude:null,r=t?e.longitude:null,i=`${n},${r}`,[a,o]=(0,c.useState)(null),[s,l]=(0,c.useState)(i);return s!==i&&(l(i),o(null)),(0,c.useEffect)(()=>{if(n==null||r==null)return;let e=!1,t=new AbortController;return Of(n,r,t.signal).then(t=>{e||o(t)}).catch(()=>{e||o(null)}),()=>{e=!0,t.abort()}},[n,r]),t?a:null},Af=3,jf=e=>Math.min(12,Math.max(0,Math.round(e))),Mf=e=>Math.max(0,jf(e)-2),Nf=.55,Pf=[0,3,8,16,24,33,44,55,68,81,95,110,125],Ff=[1,5,11,19,28,38,49,61,74,88,102,117,1/0],If=(e,t,n=0,r=0)=>{let i=t.gustiness,a=t.wander,o=n*.0017+r*.0024,s=e*Nf,c=Math.sin(s*.007+o),l=Math.sin(s*.021+1.37+o*1.4),u=Math.sin(s*.055+2.8+o*.6),d=1+(.5*c+.35*l+.15*u)*(.25+i*.75),f=Math.sin(s*.012+o*.8);f>.72&&(d+=(f-.72)*(.8+i*2.4)),Math.sin(s*.0095+.6+o)<-.55&&(d*=.45+i*.2),d=Math.max(.12,Math.min(2.25,d));let p=a*(.55*Math.sin(s*.0088+o)+.3*Math.sin(s*.026+1.9+o*1.1)+.15*Math.sin(s*.063+.4));return{intensity:d,angle:p,ux:Math.cos(p),uy:Math.sin(p)}},Lf=e=>{let t=jf(e);if(t<=0)return{count:0,alphaMul:0};let n=Math.min(1,(t/9)**1.15);return{count:Math.floor(3+n*n*50),alphaMul:.1+n*.9}},Rf=e=>Pf[jf(e)]??16,zf=e=>{let t=Math.max(0,e);for(let e=0;e<Ff.length;e++)if(t<=Ff[e])return e;return 12},Bf=e=>{let t=zf(e),n=Mf(t),r=Rf(n),i=Math.max(.04,Math.min(r/16,4.2)),{alphaMul:a}=Lf(n),o=i**.82,s=Math.min(1,(n/8)**1.1),c=(.04+s*.32)*Math.PI;return{speedKmh:e,level:t,visualLevel:n,scale:i,cloud:.28+i*.72,rain:o,snowDrift:-(.04+o*.28),hail:.4+o*.85,fog:.32+o*.58,streak:.55+o*.95,streakVisibility:a,gustiness:s,wander:c}},Vf=e=>e.live&&e.liveWindKmh!=null&&Number.isFinite(e.liveWindKmh)?Math.max(0,e.liveWindKmh):Rf(e.windLevel);function Hf(e){let t=e.windMotion.cloud,{intensity:n,angle:r,uy:i}=e.windField,a=-Math.cos(r);for(let r of e.state.clouds){let o=Math.abs(r.speed)*t*n;r.x+=o*a,r.y+=o*i*.12,r.y<-80&&(r.y=-80),r.y>e.height*.55&&(r.y=e.height*.55),r.x-140*r.scale>e.width&&(r.x=-160*r.scale),r.x+180*r.scale<0&&(r.x=e.width+40*r.scale),e.ctx.drawImage(r.sprite,r.x+r.ox,r.y+r.oy)}}function Uf(e){let t=e.fogSprite;if(!t||e.state.fogBanks.length===0)return;let{canvas:n,baseR:r}=t,i=e.windMotion.fog,{intensity:a,angle:o,uy:s}=e.windField,c=-Math.cos(o);for(let t of e.state.fogBanks){let o=Math.abs(t.speed)*i*a;t.x+=o*c,t.y+=o*s*.1,t.y<e.height*.02&&(t.y=e.height*.02),t.y>e.height*.95&&(t.y=e.height*.95),c<0&&t.x+t.rw<0&&(t.x=e.width+t.rw),c>0&&t.x-t.rw>e.width&&(t.x=-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 Wf(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 Gf(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=Gf(e,t,o,s,i*.55,a-1),l=Gf(o,s,n,r,i*.55,a-1);return[...c.slice(0,-1),...l]}function Kf(e){if(e.state.windStreaks.length===0)return;let t=e.windMotion.streak,n=e.windMotion.streakVisibility;if(n<=.02)return;let r=e.state.t;for(let i of e.state.windStreaks){let a=If(r+i.phase*18,e.windMotion,i.x,i.y),o=a.intensity*(.55+.45*e.windField.intensity),s=a.angle*.65+e.windField.angle*.35,c=-1*Math.cos(s),l=Math.sin(s),u=i.speed*t*o;i.x+=u*c,i.y+=u*l*.45,i.wave+=.03+o*.025,(i.x<-i.length-40||i.x>e.width+i.length+40)&&(i.x=c<0?e.width+i.length+Math.random()*e.width*.25:-i.length-Math.random()*e.width*.25,i.y=Math.random()*e.height),i.y<-20&&(i.y=e.height+10),i.y>e.height+20&&(i.y=-10);let d=5+o*5,f=Math.sin(i.wave)*d,p=i.length*(.85+o*.2),m=i.x+c*p,h=i.y+l*p*.45,g=i.alpha*n*Math.min(1.35,.55+o*.55);if(e.ctx.beginPath(),e.ctx.moveTo(i.x,i.y),e.ctx.bezierCurveTo(i.x+c*p*.3,i.y+l*p*.3*.45+f,i.x+c*p*.7,i.y+l*p*.7*.45-f,m,h),e.ctx.strokeStyle=`rgba(235, 244, 250, ${g})`,e.ctx.lineWidth=i.width*(.85+o*.2),e.ctx.lineCap=`round`,e.ctx.stroke(),i.length>70&&n>.45&&o>.7){let t=i.x+c*p*.58,n=i.y+l*p*.58*.45-f*.4;e.ctx.save(),e.ctx.translate(t,n),e.ctx.rotate(s+i.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, ${g*1.4})`,e.ctx.fill(),e.ctx.restore()}}}function qf(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=Gf(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 Jf=3.2,Yf=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},Xf=(e=16)=>Array.from({length:e},()=>Yf(Jf)),Zf=e=>e[Math.floor(Math.random()*e.length)],Qf=(e,t,n,r,i=!0,a,o=1)=>{let s=a?.min??1.4,c=a?.max??4.8;e.r=s+Math.random()**1.35*(c-s),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)*o,e.vy=(5.5+Math.random()*11)*o,e.bounces=0,e.opacity=.45+Math.random()*.55,e.delay=Math.floor(Math.random()*(i?110:45)),e.gravity=(.11+Math.random()*.14)*(.9+o*.1),e.phase=Math.random()*Math.PI*2,e.gust=(Math.random()-.5)*1.4,e.maxBounces=+(Math.random()<.62),e.sprite=Zf(r),e.drawSize=e.r*2.8+4,e.rotation=Math.random()*Math.PI*2,e.rotationSpeed=(Math.random()-.5)*.06},$f=(e,t,n,r,i=1)=>{let a={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 Qf(a,e,t,n,Math.random()<.72,r,i),a};function ep(e){if(!e.cfg.rain)return;let{alpha:t,splash:n}=e.cfg.rain,r=e.cfg.rain.wind*e.windMotion.rain,{intensity:i,angle:a,uy:o}=e.windField,s=r*i*Math.cos(a),c=Math.abs(r)*i*o*.35;e.ctx.strokeStyle=`rgba(214, 228, 240, ${t})`,e.ctx.lineWidth=1.2,e.ctx.beginPath();for(let t of e.state.drops){let r=t.speed+c,i=Math.hypot(s,r)||1,a=s/i,o=r/i;e.ctx.moveTo(t.x,t.y),e.ctx.lineTo(t.x+a*t.len,t.y+o*t.len),t.x+=s,t.y+=r,t.y>e.height&&(n&&Math.random()<.3&&e.state.splashes.length<60&&e.state.splashes.push({x:t.x,r:1,alpha:.5}),t.y=-t.len,t.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 tp(e){let t=e.windMotion.snowDrift,{intensity:n,angle:r,uy:i}=e.windField,a=t*n*Math.cos(r),o=Math.abs(t)*n*i*.4;for(let t of e.state.flakes){t.y+=t.speed+o,t.x+=Math.sin(e.state.t*.02+t.phase)*(.3+t.size*.08)+t.drift+a,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 np(e){if(e.state.hailstones.length===0)return;let t=e.state.hailPool,n=e.windMotion.hail,r=e.state.t,i=e.windField;for(let a of e.state.hailstones){if(a.delay>0){--a.delay;continue}let o=If(r+a.phase*12,e.windMotion,a.x,a.y),s=o.intensity*(.4+.6*i.intensity),c=o.angle*.5+i.angle*.5,l=e.windMotion.snowDrift*.45*s*Math.cos(c),u=Math.abs(e.windMotion.snowDrift)*s*Math.sin(c)*.2,d=a.x,f=a.y;if(a.vy+=a.gravity+u*.02,a.vx+=a.gust*.004*n*s+l+(Math.random()-.5)*.08*n*s,a.x+=a.vx+Math.sin(r*.028+a.phase)*.35,a.y+=a.vy,e.ctx.beginPath(),e.ctx.moveTo(d,f),e.ctx.lineTo(a.x,a.y),e.ctx.strokeStyle=`rgba(225, 239, 250, ${a.opacity*.18})`,e.ctx.lineWidth=a.r*.35,e.ctx.stroke(),a.y+a.r>=e.height)if(a.bounces<a.maxBounces)a.y=e.height-a.r,a.vy*=-(.22+Math.random()*.28),a.vx=a.vx*(.55+Math.random()*.25)+(Math.random()-.5)*1.6,a.bounces+=1;else{Qf(a,e.width,e.height,t,!0,e.hailSpec?{min:e.hailSpec.sizeMin,max:e.hailSpec.sizeMax}:void 0,e.hailSpec?.speedMul??1);continue}let p=a.drawSize/2;a.rotation+=a.rotationSpeed,e.ctx.save(),e.ctx.globalAlpha=a.opacity,e.ctx.translate(a.x,a.y),e.ctx.rotate(a.rotation),e.ctx.drawImage(a.sprite,-p,-p,a.drawSize,a.drawSize),e.ctx.restore()}}function rp(e){e.ctx.fillStyle=e.skyGradient,e.ctx.fillRect(0,0,e.width,e.height)}function ip(e){if(e.state.stars.length===0)return;let t=1;if(e.dayCycle){if(e.dayCycle.isDay)return;t=.35+(1-e.dayCycle.twilight)*.65}else if(!e.activeNight)return;for(let n of e.state.stars){let r=.35+(Math.sin(e.state.t*n.speed+n.phase)+1)*.325;e.ctx.beginPath(),e.ctx.arc(n.x,n.y,n.r,0,Math.PI*2),e.ctx.fillStyle=`rgba(226, 235, 255, ${r*t})`,e.ctx.fill()}}function ap(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=e.dayCycle?bd(e.dayCycle):{scale:1,alpha:1},c=t.half*o*s.scale,l=c*2;n.save(),n.globalAlpha=s.alpha,n.drawImage(t.canvas,r-c,i-c,l,l),n.restore()}function op(e){if(e.activeNight){ip(e),ap(e);return}ap(e)}var sp={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},rain:{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},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}},cp={sunny:{sky:[`#0b1a33`,`#27476e`],stars:110},partlyCloudy:{sky:[`#0f1f38`,`#2c4666`],stars:60},overcast:{sky:[`#181f2a`,`#333e4e`],stars:0},rain:{sky:[`#11161f`,`#242c3a`],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},snow:{sky:[`#131a26`,`#333f4f`],stars:8},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}},lp=([e,t,n])=>[Math.round(e*.3+18),Math.round(t*.3+24),Math.round(n*.3+42)];function up(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 dp(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}=up(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 fp(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 pp(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 mp(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 hp=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},gp=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},_p=()=>({dots:[1.2,1.6,2,2.3].map(e=>hp(e)),crystals:[2.6,3.2,3.8,4.4,5].map(e=>gp(e*2.4))}),vp=e=>e[Math.floor(Math.random()*e.length)],yp=(e,t,n,r)=>{let i=1+Math.random()**1.6*4.2,a=i>=2.4,o=vp(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}},bp=(e,t)=>t?e===`smog`?`96, 88, 66`:`138, 150, 168`:e===`smog`?`168, 155, 126`:`226, 232, 238`;function xp(e){let{ctx:t,width:n,height:r,activeWeather:i,dayCycleTimes:a=null,sceneTimeMs:o,liveClock:s=!1,windMotion:c,rainLevel:l=5,snowLevel:u=5,hailLevel:d=2,fogLevel:f=2,smogLevel:p=2}=e,m=sp[i],h=(()=>{let e=m;return $d(i)&&e.rain&&(e={...e,rain:of(e.rain,l)}),ef(i)&&(e={...e,snowCount:sf(u),fogBanks:u>=7?Math.max(e.fogBanks,3):e.fogBanks,haze:u>=7?Math.max(e.haze,.12):e.haze}),Td(i)&&(e=Ed(e,f)),mf(i)&&(e=hf(e,p)),e})(),g=cp[i],_=a??null,v=_?fd(s?Date.now():o,_):null,y=v?!v.isDay:!1,b=v?vd(h.sky,g.sky,v):y?g.sky:h.sky,x=y?lp(h.cloudColor):h.cloudColor,S=Math.min(n,r)*.09,C=n*.72,w=r*.26;if(v){let e=pd(n,r,v.arcProgress);C=e.x,w=e.y}let T=yd(t,r,b),E=[{dx:-.32,dy:.08,r:.17},{dx:.24,dy:-.22,r:.12},{dx:.04,dy:.34,r:.1},{dx:.36,dy:.24,r:.07}],D=pp(h,S),O=mp(h,S,E),k=y?O:D,A=y||_!=null?Array.from({length:g.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})):[],j=Array.from({length:h.cloudCount},()=>dp(n,r,h.cloudSpread,x,h.cloudAlpha)),M=h.rain?Array.from({length:h.rain.count},()=>({x:Math.random()*(n+160)-80,y:Math.random()*r,len:8+Math.random()*10,speed:h.rain.speed*(.75+Math.random()*.5)})):[],N=[],P=Array.from({length:h.fogBanks},(e,t)=>({x:Math.random()*n,y:t/Math.max(h.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:(.1+Math.random()*.1)*(Td(i)?Dd(f):mf(i)?gf(p):1)})),F=h.fogBanks>0?fp(bp(i,y)):null,I=h.snowCount>0?_p():null,L=I==null?[]:Array.from({length:h.snowCount},()=>yp(n,r,I)),R=Pd(i)?Fd(d):null,z=R==null?null:Xf(),B=z!=null&&R!=null?Array.from({length:R.count},()=>$f(n,r,z,{min:R.sizeMin,max:R.sizeMax},R.speedMul)):[],V=(()=>{let{count:e}=Lf(c.visualLevel);return e<=0?[]:Array.from({length:e},()=>({x:Math.random()*n,y:Math.random()*r,length:35+Math.random()*120,speed:6+Math.random()*10,wave:Math.random()*Math.PI*2,alpha:.1+Math.random()*.28,width:.5+Math.random()*1.1,phase:Math.random()*Math.PI*2}))})(),H=[],U=120+Math.random()*240;return{sky:b,cloudRgb:x,cfg:h,sunX:C,sunY:w,sunR:S,skyGradient:T,celestial:k,sunSprite:D,moonSprite:O,fogSprite:F,dayCycleTimes:_,dayCycle:v,sceneTimeMs:o,liveClock:s,hailSpec:R,state:{stars:A,moonCraters:E,clouds:j,drops:M,splashes:N,fogBanks:P,flakes:L,hailstones:B,hailPool:z??[],windStreaks:V,t:0,flashAlpha:0,boltLife:0,boltPoints:H,nextStrike:U}}}function Sp(e,t){if(!e.dayCycleTimes)return;let n=fd(e.liveClock?t??Date.now():e.sceneTimeMs,e.dayCycleTimes),r=cp[e.activeWeather],i=vd(e.cfg.sky,r.sky,n),a=pd(e.width,e.height,n.arcProgress);e.dayCycle=n,e.activeNight=!n.isDay,e.sky=i,e.skyGradient=yd(e.ctx,e.height,i),e.sunX=a.x,e.sunY=a.y,e.celestial=n.isDay?e.sunSprite:e.moonSprite}function Cp(e,t){t&&(e.state.t+=1),e.windField=If(e.state.t,e.windMotion),e.dayCycleTimes&&Sp(e,e.liveClock?Date.now():e.sceneTimeMs),rp(e),op(e),Hf(e),Uf(e),Wf(e),ep(e),tp(e),np(e),Kf(e),qf(e)}function wp(e){let{ctx:t,width:n,height:r,activeWeather:i,activeNight:a,windMotion:o}=e,s=xp(e),c={ctx:t,width:n,height:r,activeWeather:i,activeNight:s.dayCycle?!s.dayCycle.isDay:a,windMotion:o,windField:If(0,o),...s};c.dayCycleTimes&&Sp(c,c.liveClock?Date.now():c.sceneTimeMs);let l=document.hidden,u=b(),d=y(e=>{l=e}),f=x(e=>{u=e});if(u)return Cp(c,!1),()=>{d(),f()};let p=0,m=()=>{p=requestAnimationFrame(m),!l&&(u||Cp(c,!0))};return m(),()=>{cancelAnimationFrame(p),d(),f()}}var Tp={weatherBackground:`cos-weatherBackground-Mnm22`,canvas:`cos-canvas-nvqMt`,loadingOverlay:`cos-loadingOverlay-O58B7`,loadingSpinner:`cos-loadingSpinner-NQ9yG`,"weather-loading-spin":`cos-weather-loading-spin-IPFWZ`},Ep=({width:e,height:t,fill:n=!1,weather:r=`partlyCloudy`,time:i=`14:00`,live:a=!1,latitude:o,longitude:s,windLevel:u=3,rainLevel:d=5,snowLevel:f=5,hailLevel:p=2,fogLevel:m=2,smogLevel:h=2,onLiveWeather:g,loading:_=!1,ariaLabel:v,loadingText:y=`天气加载中…`})=>{let{hostRef:b,width:x,height:S,hostStyle:C}=E({fill:n,width:e,height:t,defaultWidth:800,defaultHeight:450}),w=(0,c.useRef)(null),T=Df(a,o!=null&&s!=null?{latitude:o,longitude:s}:void 0),D=Xd(a&&T.weather?T.weather:r),O=a&&T.rainLevel!=null?T.rainLevel:d,k=a&&T.snowLevel!=null?T.snowLevel:f,A=a&&T.fogLevel!=null?T.fogLevel:m,j=a&&T.hailLevel!=null?T.hailLevel:p,M=a&&T.smogLevel!=null?T.smogLevel:h,N=af(D,O,k),P=dd(i),F=T.current?.sunrise??null,I=T.current?.sunset??null,L=T.current?.windSpeed??null,R=(0,c.useMemo)(()=>a&&F!=null&&I!=null?{sunrise:F,sunset:I}:ld(P),[a,F,I,P]),z=Vf({live:a,windLevel:u,liveWindKmh:L}),B=(0,c.useMemo)(()=>Bf(z),[z]),V=a&&T.current?!T.current.isDay:!fd(P,R).isDay,H=_||a&&(T.status===`locating`||T.status===`fetching`),U=(0,c.useRef)(g);return(0,c.useEffect)(()=>{U.current=g}),(0,c.useEffect)(()=>{T.weather&&U.current?.(Xd(T.weather))},[T.weather]),(0,c.useEffect)(()=>{let e=w.current;if(!e)return;let t=window.devicePixelRatio||1;e.width=x*t,e.height=S*t;let n=e.getContext(`2d`);if(n)return n.setTransform(t,0,0,t,0,0),wp({ctx:n,width:x,height:S,activeWeather:N,activeNight:V,dayCycleTimes:R,sceneTimeMs:P,liveClock:a,windMotion:B,rainLevel:O,snowLevel:k,fogLevel:A,hailLevel:j,smogLevel:M})},[V,N,R,O,k,A,j,M,S,a,P,x,B]),(0,l.jsxs)(`div`,{ref:b,className:Tp.weatherBackground,style:C,children:[(0,l.jsx)(`canvas`,{ref:w,className:Tp.canvas,style:{width:x,height:S},role:`img`,"aria-label":v??`天气背景:${D}${V?`(夜间)`:``},${B.level}级风`}),H&&(0,l.jsxs)(`div`,{className:Tp.loadingOverlay,role:`status`,"aria-live":`polite`,children:[(0,l.jsx)(`div`,{className:Tp.loadingSpinner,"aria-hidden":!0}),(0,l.jsx)(`span`,{children:y})]})]})},Dp={waveText:`cos-waveText-Zy2Tp`,text:`cos-text-el-KR`,char:`cos-char-Y9-mV`,wave:`cos-wave-jVRCz`},Op=({text:e=`WAVE`,amplitude:t=12,color:n=`#38bdf8`,fontSize:r=56})=>(0,l.jsx)(`div`,{className:Dp.waveText,children:(0,l.jsx)(`h1`,{className:Dp.text,style:{fontSize:r,"--wave-color":n,"--wave-amp":`${t}px`},children:e.split(``).map((e,t)=>(0,l.jsx)(`span`,{className:Dp.char,style:{animationDelay:`${t*.1}s`},children:e===` `?`\xA0`:e},`${e}-${t}`))})});exports.AudioVisualizer=j,exports.Aurora=k,exports.AuroraVeil=Ol,exports.BarcodeScan=f,exports.BlurText=m,exports.BubbleField=Eo,exports.BurnAway=g,exports.CanvasClock=N,exports.Charge=L,exports.CircularText=z,exports.ClickSpark=V,exports.Confetti=G,exports.CountUp=fe,exports.Countdown=ce,exports.CursorTrail=ye,exports.CurvedLoop=te,exports.CyberGrid=re,exports.DEFAULT_FOG_LEVEL=xd,exports.DEFAULT_HAIL_LEVEL=Ad,exports.DEFAULT_RAIN_LEVEL=zd,exports.DEFAULT_SMOG_LEVEL=uf,exports.DEFAULT_SNOW_LEVEL=Bd,exports.DEFAULT_WIND_LEVEL=Af,exports.DandelionField=Qc,exports.DiceRoll=Se,exports.DnaHelix=me,exports.DoublePendulum=we,exports.ElectricArc=_e,exports.FOG_LEVEL_LABELS=Sd,exports.Fireworks=je,exports.FlipCard=Ne,exports.FlipCounter=Le,exports.FuzzyText=ze,exports.GameOfLife=qe,exports.GlitchText=Ye,exports.GradientFlow=He,exports.GravityBalls=Qe,exports.HAIL_LEVEL_LABELS=jd,exports.HolographicCard=et,exports.InkBloom=_l,exports.LavaBubble=ul,exports.LiquidGlass=ot,exports.LiquidProgress=nt,exports.LorenzAttractor=it,exports.MAX_PRECIP_LEVEL=Rd,exports.MIN_PRECIP_LEVEL=Ld,exports.MagneticButton=ct,exports.MatrixRain=dt,exports.MazeGenerator=ht,exports.MetaballPool=pt,exports.MeteorRain=_t,exports.NeonText=Dt,exports.NetworkGraph=Tt,exports.NewtonCradle=kt,exports.NineGrid=Nt,exports.OrbitalChart=It,exports.ParticleNetwork=Rt,exports.PhotoAlbum=en,exports.PhotoCarousel=on,exports.PhotoClothesline=Mn,exports.PhotoFilmstrip=Hn,exports.PhotoFridge=rr,exports.PhotoLantern=Vr,exports.PhotoLightbox=Jr,exports.PhotoPolaroid=si,exports.PhotoPostcard=gi,exports.PhotoPrism=Fi,exports.PhotoScroll=Gi,exports.PhotoTunnel=na,exports.PhotoViewMaster=ba,exports.PlasmaBall=Sa,exports.ProgressChest=Ll,exports.RAIN_LEVEL_LABELS=Jd,exports.RadarScan=zl,exports.RedPacketRain=Vl,exports.ReturnCity=Ul,exports.RippleWater=du,exports.RopeChain=Gl,exports.RotatingText=Yl,exports.SMOG_LEVEL_LABELS=df,exports.SNOW_LEVEL_LABELS=Yd,exports.SandFall=Ou,exports.ScrambleText=mu,exports.ScratchCard=gu,exports.ShinyText=eu,exports.SlotMachine=wu,exports.SmokeFog=Va,exports.Snowfall=Nl,exports.SoapBubbles=vs,exports.SolarSystem=jl,exports.Speedometer=Ql,exports.SplitReveal=ju,exports.SplitText=Nu,exports.Spotlight=Ru,exports.SpringMass=Iu,exports.Starfield=Fl,exports.TextMorph=qu,exports.TimelinePulse=nu,exports.TrueFocus=Yu,exports.Turntable=Uu,exports.Typewriter=$u,exports.WaveButton=td,exports.WaveText=Op,exports.WeatherBackground=Ep,exports.buildWindMotion=Bf,exports.clampFogLevel=Cd,exports.clampHailLevel=Md,exports.clampPrecipLevel=Vd,exports.clampSmogLevel=ff,exports.fogBankAlphaScale=Dd,exports.fogLevelFromVisibility=kd,exports.fogLevelFromWmo=Od,exports.formatFogLevel=wd,exports.formatHailLevel=Nd,exports.formatLocalHm=Ef,exports.formatPrecipLevel=qd,exports.formatSmogLevel=pf,exports.hailLevelFromWmo=Id,exports.hailSpec=Fd,exports.intensifyFogConfig=Ed,exports.intensifyRainConfig=of,exports.intensifySmogConfig=hf,exports.intensifySnowCount=sf,exports.isRainWeather=Zd,exports.isSnowWeather=Qd,exports.kmhToWindLevel=zf,exports.mapWmoCodeToWeatherType=yf,exports.normalizeWeatherType=Xd,exports.precipBand=Ud,exports.precipLabel=Kd,exports.rainLevelFromWeather=tf,exports.rainLevelFromWmo=cf,exports.resolveSceneWeather=af,exports.sampleWindField=If,exports.smogBankAlphaScale=gf,exports.smogLevelFromVisibility=_f,exports.snowLevelFromWeather=nf,exports.snowLevelFromWmo=lf,exports.supportsFogLevel=Td,exports.supportsHailLevel=Pd,exports.supportsRainLevel=$d,exports.supportsSmogLevel=mf,exports.supportsSnowLevel=ef,exports.useLiveWeather=Df,exports.useSunTimes=kf,exports.visualWindLevel=Mf,exports.windLevelToKmh=Rf,exports.windStreakSpec=Lf;