cos-design 3.8.1 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -6
- package/README.md +86 -50
- package/dist/core-CszjZZo9.cjs +1 -0
- package/dist/core-On5bp2VI.js +178 -0
- package/dist/core.cjs +1 -0
- package/dist/core.d.ts +1 -0
- package/dist/core.js +3 -0
- package/dist/elements.cjs +1 -0
- package/dist/elements.d.ts +1 -0
- package/dist/elements.js +3162 -0
- package/dist/engine-D2OC52jQ.cjs +246 -0
- package/dist/engine-Dh44m7ox.js +12755 -0
- package/dist/index.cjs +1 -249
- package/dist/index.js +2049 -13779
- package/dist/src/components/audioVisualizer/core/engine.d.ts +2 -0
- package/dist/src/components/audioVisualizer/core/index.d.ts +2 -0
- package/dist/src/components/audioVisualizer/core/types.d.ts +11 -0
- package/dist/src/components/audioVisualizer/element/index.d.ts +9 -0
- package/dist/src/components/audioVisualizer/index.d.ts +3 -9
- package/dist/src/components/audioVisualizer/react/index.d.ts +4 -0
- package/dist/src/components/aurora/core/engine.d.ts +2 -0
- package/dist/src/components/aurora/core/index.d.ts +2 -0
- package/dist/src/components/aurora/core/types.d.ts +11 -0
- package/dist/src/components/aurora/element/index.d.ts +13 -0
- package/dist/src/components/aurora/index.d.ts +3 -11
- package/dist/src/components/aurora/react/index.d.ts +4 -0
- package/dist/src/components/auroraVeil/core/engine.d.ts +2 -0
- package/dist/src/components/auroraVeil/core/index.d.ts +2 -0
- package/dist/src/components/auroraVeil/core/types.d.ts +15 -0
- package/dist/src/components/auroraVeil/element/index.d.ts +13 -0
- package/dist/src/components/auroraVeil/index.d.ts +3 -19
- package/dist/src/components/auroraVeil/react/index.d.ts +4 -0
- package/dist/src/components/barcodeScan/core/engine.d.ts +2 -0
- package/dist/src/components/barcodeScan/core/index.d.ts +2 -0
- package/dist/src/components/barcodeScan/core/types.d.ts +12 -0
- package/dist/src/components/barcodeScan/element/index.d.ts +14 -0
- package/dist/src/components/barcodeScan/index.d.ts +3 -11
- package/dist/src/components/barcodeScan/react/index.d.ts +6 -0
- package/dist/src/components/blurText/core/engine.d.ts +2 -0
- package/dist/src/components/blurText/core/index.d.ts +2 -0
- package/dist/src/components/blurText/core/types.d.ts +15 -0
- package/dist/src/components/blurText/element/index.d.ts +16 -0
- package/dist/src/components/blurText/index.d.ts +3 -21
- package/dist/src/components/blurText/react/index.d.ts +4 -0
- package/dist/src/components/bubbleField/core/engine.d.ts +2 -0
- package/dist/src/components/bubbleField/core/index.d.ts +2 -0
- package/dist/src/components/bubbleField/core/types.d.ts +14 -0
- package/dist/src/components/bubbleField/element/index.d.ts +9 -0
- package/dist/src/components/bubbleField/index.d.ts +3 -5
- package/dist/src/components/bubbleField/react/index.d.ts +4 -0
- package/dist/src/components/burnAway/core/engine.d.ts +2 -0
- package/dist/src/components/burnAway/core/index.d.ts +2 -0
- package/dist/src/components/burnAway/core/types.d.ts +13 -0
- package/dist/src/components/burnAway/element/index.d.ts +10 -0
- package/dist/src/components/burnAway/index.d.ts +3 -13
- package/dist/src/components/burnAway/react/index.d.ts +4 -0
- package/dist/src/components/canvasClock/core/engine.d.ts +2 -0
- package/dist/src/components/canvasClock/core/index.d.ts +2 -0
- package/dist/src/components/canvasClock/core/types.d.ts +9 -0
- package/dist/src/components/canvasClock/element/index.d.ts +9 -0
- package/dist/src/components/canvasClock/index.d.ts +3 -9
- package/dist/src/components/canvasClock/react/index.d.ts +4 -0
- package/dist/src/components/charge/core/engine.d.ts +2 -0
- package/dist/src/components/charge/core/index.d.ts +2 -0
- package/dist/src/components/charge/core/types.d.ts +14 -0
- package/dist/src/components/charge/element/index.d.ts +9 -0
- package/dist/src/components/charge/index.d.ts +3 -19
- package/dist/src/components/charge/react/index.d.ts +4 -0
- package/dist/src/components/circularText/core/engine.d.ts +2 -0
- package/dist/src/components/circularText/core/index.d.ts +2 -0
- package/dist/src/components/circularText/core/types.d.ts +13 -0
- package/dist/src/components/circularText/element/index.d.ts +13 -0
- package/dist/src/components/circularText/index.d.ts +3 -17
- package/dist/src/components/circularText/react/index.d.ts +4 -0
- package/dist/src/components/clickSpark/core/engine.d.ts +2 -0
- package/dist/src/components/clickSpark/core/index.d.ts +2 -0
- package/dist/src/components/clickSpark/core/types.d.ts +13 -0
- package/dist/src/components/clickSpark/element/index.d.ts +14 -0
- package/dist/src/components/clickSpark/index.d.ts +3 -10
- package/dist/src/components/clickSpark/react/index.d.ts +6 -0
- package/dist/src/components/confetti/core/engine.d.ts +2 -0
- package/dist/src/components/confetti/core/index.d.ts +2 -0
- package/dist/src/components/confetti/core/types.d.ts +19 -0
- package/dist/src/components/confetti/element/index.d.ts +10 -0
- package/dist/src/components/confetti/index.d.ts +3 -25
- package/dist/src/components/confetti/react/index.d.ts +5 -0
- package/dist/src/components/countUp/core/engine.d.ts +2 -0
- package/dist/src/components/countUp/core/index.d.ts +2 -0
- package/dist/src/components/countUp/core/types.d.ts +14 -0
- package/dist/src/components/countUp/element/index.d.ts +9 -0
- package/dist/src/components/countUp/index.d.ts +3 -19
- package/dist/src/components/countUp/react/index.d.ts +4 -0
- package/dist/src/components/countdown/core/engine.d.ts +2 -0
- package/dist/src/components/countdown/core/index.d.ts +2 -0
- package/dist/src/components/countdown/core/types.d.ts +14 -0
- package/dist/src/components/countdown/element/index.d.ts +13 -0
- package/dist/src/components/countdown/index.d.ts +3 -26
- package/dist/src/components/countdown/react/index.d.ts +4 -0
- package/dist/src/components/cursorTrail/core/engine.d.ts +2 -0
- package/dist/src/components/cursorTrail/core/index.d.ts +2 -0
- package/dist/src/components/cursorTrail/core/types.d.ts +12 -0
- package/dist/src/components/cursorTrail/element/index.d.ts +9 -0
- package/dist/src/components/cursorTrail/index.d.ts +3 -13
- package/dist/src/components/cursorTrail/react/index.d.ts +4 -0
- package/dist/src/components/curvedLoop/core/engine.d.ts +2 -0
- package/dist/src/components/curvedLoop/core/index.d.ts +2 -0
- package/dist/src/components/curvedLoop/core/types.d.ts +14 -0
- package/dist/src/components/curvedLoop/element/index.d.ts +13 -0
- package/dist/src/components/curvedLoop/index.d.ts +3 -19
- package/dist/src/components/curvedLoop/react/index.d.ts +4 -0
- package/dist/src/components/cyberGrid/core/engine.d.ts +2 -0
- package/dist/src/components/cyberGrid/core/index.d.ts +2 -0
- package/dist/src/components/cyberGrid/core/types.d.ts +12 -0
- package/dist/src/components/cyberGrid/element/index.d.ts +9 -0
- package/dist/src/components/cyberGrid/index.d.ts +3 -13
- package/dist/src/components/cyberGrid/react/index.d.ts +4 -0
- package/dist/src/components/dandelionField/core/engine.d.ts +2 -0
- package/dist/src/components/dandelionField/core/index.d.ts +2 -0
- package/dist/src/components/dandelionField/core/types.d.ts +15 -0
- package/dist/src/components/dandelionField/element/index.d.ts +9 -0
- package/dist/src/components/dandelionField/index.d.ts +3 -5
- package/dist/src/components/dandelionField/react/index.d.ts +4 -0
- package/dist/src/components/diceRoll/core/engine.d.ts +2 -0
- package/dist/src/components/diceRoll/core/index.d.ts +2 -0
- package/dist/src/components/diceRoll/core/types.d.ts +12 -0
- package/dist/src/components/diceRoll/element/index.d.ts +13 -0
- package/dist/src/components/diceRoll/index.d.ts +3 -15
- package/dist/src/components/diceRoll/react/index.d.ts +4 -0
- package/dist/src/components/dnaHelix/core/engine.d.ts +2 -0
- package/dist/src/components/dnaHelix/core/index.d.ts +2 -0
- package/dist/src/components/dnaHelix/core/types.d.ts +11 -0
- package/dist/src/components/dnaHelix/element/index.d.ts +9 -0
- package/dist/src/components/dnaHelix/index.d.ts +3 -9
- package/dist/src/components/dnaHelix/react/index.d.ts +4 -0
- package/dist/src/components/doublePendulum/core/engine.d.ts +2 -0
- package/dist/src/components/doublePendulum/core/index.d.ts +2 -0
- package/dist/src/components/doublePendulum/core/types.d.ts +12 -0
- package/dist/src/components/doublePendulum/element/index.d.ts +9 -0
- package/dist/src/components/doublePendulum/index.d.ts +3 -10
- package/dist/src/components/doublePendulum/react/index.d.ts +4 -0
- package/dist/src/components/electricArc/core/engine.d.ts +2 -0
- package/dist/src/components/electricArc/core/index.d.ts +2 -0
- package/dist/src/components/electricArc/core/types.d.ts +10 -0
- package/dist/src/components/electricArc/element/index.d.ts +9 -0
- package/dist/src/components/electricArc/index.d.ts +3 -8
- package/dist/src/components/electricArc/react/index.d.ts +4 -0
- package/dist/src/components/fireworks/core/engine.d.ts +2 -0
- package/dist/src/components/fireworks/core/index.d.ts +2 -0
- package/dist/src/components/fireworks/core/types.d.ts +23 -0
- package/dist/src/components/fireworks/element/index.d.ts +10 -0
- package/dist/src/components/fireworks/index.d.ts +3 -23
- package/dist/src/components/fireworks/react/index.d.ts +4 -0
- package/dist/src/components/flipCard/core/engine.d.ts +2 -0
- package/dist/src/components/flipCard/core/index.d.ts +2 -0
- package/dist/src/components/flipCard/core/types.d.ts +22 -0
- package/dist/src/components/flipCard/element/index.d.ts +11 -0
- package/dist/src/components/flipCard/index.d.ts +3 -29
- package/dist/src/components/flipCard/react/index.d.ts +5 -0
- package/dist/src/components/flipCounter/core/engine.d.ts +2 -0
- package/dist/src/components/flipCounter/core/index.d.ts +2 -0
- package/dist/src/components/flipCounter/core/types.d.ts +15 -0
- package/dist/src/components/flipCounter/element/index.d.ts +9 -0
- package/dist/src/components/flipCounter/index.d.ts +3 -13
- package/dist/src/components/flipCounter/react/index.d.ts +4 -0
- package/dist/src/components/fuzzyText/core/engine.d.ts +2 -0
- package/dist/src/components/fuzzyText/core/index.d.ts +2 -0
- package/dist/src/components/fuzzyText/core/types.d.ts +15 -0
- package/dist/src/components/fuzzyText/element/index.d.ts +9 -0
- package/dist/src/components/fuzzyText/index.d.ts +3 -21
- package/dist/src/components/fuzzyText/react/index.d.ts +4 -0
- package/dist/src/components/gameOfLife/core/engine.d.ts +2 -0
- package/dist/src/components/gameOfLife/core/index.d.ts +2 -0
- package/dist/src/components/gameOfLife/core/types.d.ts +21 -0
- package/dist/src/components/gameOfLife/element/index.d.ts +13 -0
- package/dist/src/components/gameOfLife/index.d.ts +3 -25
- package/dist/src/components/gameOfLife/react/index.d.ts +4 -0
- package/dist/src/components/glitchText/core/engine.d.ts +2 -0
- package/dist/src/components/glitchText/core/index.d.ts +2 -0
- package/dist/src/components/glitchText/core/types.d.ts +12 -0
- package/dist/src/components/glitchText/element/index.d.ts +9 -0
- package/dist/src/components/glitchText/index.d.ts +3 -15
- package/dist/src/components/glitchText/react/index.d.ts +4 -0
- package/dist/src/components/gradientFlow/core/engine.d.ts +2 -0
- package/dist/src/components/gradientFlow/core/index.d.ts +2 -0
- package/dist/src/components/gradientFlow/core/types.d.ts +10 -0
- package/dist/src/components/gradientFlow/element/index.d.ts +13 -0
- package/dist/src/components/gradientFlow/index.d.ts +3 -11
- package/dist/src/components/gradientFlow/react/index.d.ts +4 -0
- package/dist/src/components/gravityBalls/core/engine.d.ts +2 -0
- package/dist/src/components/gravityBalls/core/index.d.ts +2 -0
- package/dist/src/components/gravityBalls/core/types.d.ts +10 -0
- package/dist/src/components/gravityBalls/element/index.d.ts +9 -0
- package/dist/src/components/gravityBalls/index.d.ts +3 -8
- package/dist/src/components/gravityBalls/react/index.d.ts +4 -0
- package/dist/src/components/holographicCard/core/engine.d.ts +2 -0
- package/dist/src/components/holographicCard/core/index.d.ts +2 -0
- package/dist/src/components/holographicCard/core/types.d.ts +10 -0
- package/dist/src/components/holographicCard/element/index.d.ts +9 -0
- package/dist/src/components/holographicCard/index.d.ts +3 -8
- package/dist/src/components/holographicCard/react/index.d.ts +4 -0
- package/dist/src/components/index.d.ts +7 -7
- package/dist/src/components/inkBloom/core/engine.d.ts +6 -0
- package/dist/src/components/inkBloom/core/index.d.ts +2 -0
- package/dist/src/components/inkBloom/core/types.d.ts +14 -0
- package/dist/src/components/inkBloom/element/index.d.ts +9 -0
- package/dist/src/components/inkBloom/index.d.ts +3 -21
- package/dist/src/components/inkBloom/react/index.d.ts +4 -0
- package/dist/src/components/lavaBubble/core/engine.d.ts +2 -0
- package/dist/src/components/lavaBubble/core/index.d.ts +2 -0
- package/dist/src/components/lavaBubble/core/types.d.ts +16 -0
- package/dist/src/components/lavaBubble/element/index.d.ts +9 -0
- package/dist/src/components/lavaBubble/index.d.ts +3 -24
- package/dist/src/components/lavaBubble/react/index.d.ts +4 -0
- package/dist/src/components/liquidGlass/core/engine.d.ts +2 -0
- package/dist/src/components/liquidGlass/core/index.d.ts +2 -0
- package/dist/src/components/liquidGlass/core/types.d.ts +12 -0
- package/dist/src/components/liquidGlass/element/index.d.ts +14 -0
- package/dist/src/components/liquidGlass/index.d.ts +3 -10
- package/dist/src/components/liquidGlass/react/index.d.ts +6 -0
- package/dist/src/components/liquidProgress/core/engine.d.ts +2 -0
- package/dist/src/components/liquidProgress/core/index.d.ts +2 -0
- package/dist/src/components/liquidProgress/core/types.d.ts +11 -0
- package/dist/src/components/liquidProgress/element/index.d.ts +9 -0
- package/dist/src/components/liquidProgress/index.d.ts +3 -9
- package/dist/src/components/liquidProgress/react/index.d.ts +4 -0
- package/dist/src/components/lorenzAttractor/core/engine.d.ts +2 -0
- package/dist/src/components/lorenzAttractor/core/index.d.ts +2 -0
- package/dist/src/components/lorenzAttractor/core/types.d.ts +12 -0
- package/dist/src/components/lorenzAttractor/element/index.d.ts +9 -0
- package/dist/src/components/lorenzAttractor/index.d.ts +3 -10
- package/dist/src/components/lorenzAttractor/react/index.d.ts +4 -0
- package/dist/src/components/magneticButton/core/engine.d.ts +2 -0
- package/dist/src/components/magneticButton/core/index.d.ts +2 -0
- package/dist/src/components/magneticButton/core/types.d.ts +12 -0
- package/dist/src/components/magneticButton/element/index.d.ts +14 -0
- package/dist/src/components/magneticButton/index.d.ts +3 -10
- package/dist/src/components/magneticButton/react/index.d.ts +6 -0
- package/dist/src/components/matrixRain/core/engine.d.ts +2 -0
- package/dist/src/components/matrixRain/core/index.d.ts +2 -0
- package/dist/src/components/matrixRain/core/types.d.ts +15 -0
- package/dist/src/components/matrixRain/element/index.d.ts +9 -0
- package/dist/src/components/matrixRain/index.d.ts +3 -19
- package/dist/src/components/matrixRain/react/index.d.ts +4 -0
- package/dist/src/components/mazeGenerator/core/engine.d.ts +2 -0
- package/dist/src/components/mazeGenerator/core/index.d.ts +2 -0
- package/dist/src/components/mazeGenerator/core/types.d.ts +11 -0
- package/dist/src/components/mazeGenerator/element/index.d.ts +9 -0
- package/dist/src/components/mazeGenerator/index.d.ts +3 -9
- package/dist/src/components/mazeGenerator/react/index.d.ts +4 -0
- package/dist/src/components/metaballPool/core/engine.d.ts +2 -0
- package/dist/src/components/metaballPool/core/index.d.ts +2 -0
- package/dist/src/components/metaballPool/core/types.d.ts +11 -0
- package/dist/src/components/metaballPool/element/index.d.ts +9 -0
- package/dist/src/components/metaballPool/index.d.ts +3 -9
- package/dist/src/components/metaballPool/react/index.d.ts +4 -0
- package/dist/src/components/meteorRain/core/engine.d.ts +2 -0
- package/dist/src/components/meteorRain/core/index.d.ts +2 -0
- package/dist/src/components/meteorRain/core/types.d.ts +11 -0
- package/dist/src/components/meteorRain/element/index.d.ts +9 -0
- package/dist/src/components/meteorRain/index.d.ts +3 -11
- package/dist/src/components/meteorRain/react/index.d.ts +4 -0
- package/dist/src/components/neonText/core/engine.d.ts +2 -0
- package/dist/src/components/neonText/core/index.d.ts +2 -0
- package/dist/src/components/neonText/core/types.d.ts +11 -0
- package/dist/src/components/neonText/element/index.d.ts +9 -0
- package/dist/src/components/neonText/index.d.ts +3 -13
- package/dist/src/components/neonText/react/index.d.ts +4 -0
- package/dist/src/components/networkGraph/core/engine.d.ts +2 -0
- package/dist/src/components/networkGraph/core/index.d.ts +2 -0
- package/dist/src/components/networkGraph/core/types.d.ts +23 -0
- package/dist/src/components/networkGraph/element/index.d.ts +16 -0
- package/dist/src/components/networkGraph/index.d.ts +3 -26
- package/dist/src/components/networkGraph/react/index.d.ts +4 -0
- package/dist/src/components/newtonCradle/core/engine.d.ts +2 -0
- package/dist/src/components/newtonCradle/core/index.d.ts +2 -0
- package/dist/src/components/newtonCradle/core/types.d.ts +11 -0
- package/dist/src/components/newtonCradle/element/index.d.ts +9 -0
- package/dist/src/components/newtonCradle/index.d.ts +3 -9
- package/dist/src/components/newtonCradle/react/index.d.ts +4 -0
- package/dist/src/components/nineGrid/core/engine.d.ts +2 -0
- package/dist/src/components/nineGrid/core/index.d.ts +2 -0
- package/dist/src/components/nineGrid/core/types.d.ts +31 -0
- package/dist/src/components/nineGrid/element/index.d.ts +15 -0
- package/dist/src/components/nineGrid/index.d.ts +3 -29
- package/dist/src/components/nineGrid/react/index.d.ts +5 -0
- package/dist/src/components/orbitalChart/core/engine.d.ts +2 -0
- package/dist/src/components/orbitalChart/core/index.d.ts +2 -0
- package/dist/src/components/orbitalChart/core/types.d.ts +14 -0
- package/dist/src/components/orbitalChart/element/index.d.ts +13 -0
- package/dist/src/components/orbitalChart/index.d.ts +3 -12
- package/dist/src/components/orbitalChart/react/index.d.ts +4 -0
- package/dist/src/components/particleNetwork/core/engine.d.ts +2 -0
- package/dist/src/components/particleNetwork/core/index.d.ts +2 -0
- package/dist/src/components/particleNetwork/core/types.d.ts +15 -0
- package/dist/src/components/particleNetwork/element/index.d.ts +9 -0
- package/dist/src/components/particleNetwork/index.d.ts +3 -19
- package/dist/src/components/particleNetwork/react/index.d.ts +4 -0
- package/dist/src/components/photoAlbum/core/engine.d.ts +2 -0
- package/dist/src/components/photoAlbum/core/index.d.ts +2 -0
- package/dist/src/components/photoAlbum/core/types.d.ts +7 -0
- package/dist/src/components/photoAlbum/element/index.d.ts +16 -0
- package/dist/src/components/photoAlbum/index.d.ts +3 -5
- package/dist/src/components/photoAlbum/react/index.d.ts +3 -0
- package/dist/src/components/photoAlbum/types.d.ts +3 -3
- package/dist/src/components/photoCarousel/core/engine.d.ts +2 -0
- package/dist/src/components/photoCarousel/core/index.d.ts +2 -0
- package/dist/src/components/photoCarousel/core/types.d.ts +7 -0
- package/dist/src/components/photoCarousel/element/index.d.ts +13 -0
- package/dist/src/components/photoCarousel/index.d.ts +3 -9
- package/dist/src/components/photoCarousel/react/index.d.ts +3 -0
- package/dist/src/components/photoCarousel/types.d.ts +2 -2
- package/dist/src/components/photoClothesline/core/engine.d.ts +2 -0
- package/dist/src/components/photoClothesline/core/index.d.ts +2 -0
- package/dist/src/components/photoClothesline/core/types.d.ts +7 -0
- package/dist/src/components/photoClothesline/element/index.d.ts +13 -0
- package/dist/src/components/photoClothesline/index.d.ts +3 -5
- package/dist/src/components/photoClothesline/layout.d.ts +2 -2
- package/dist/src/components/photoClothesline/react/index.d.ts +3 -0
- package/dist/src/components/photoClothesline/types.d.ts +3 -3
- package/dist/src/components/photoFilmstrip/core/engine.d.ts +2 -0
- package/dist/src/components/photoFilmstrip/core/index.d.ts +2 -0
- package/dist/src/components/photoFilmstrip/core/types.d.ts +7 -0
- package/dist/src/components/photoFilmstrip/element/index.d.ts +13 -0
- package/dist/src/components/photoFilmstrip/index.d.ts +3 -5
- package/dist/src/components/photoFilmstrip/react/index.d.ts +3 -0
- package/dist/src/components/photoFilmstrip/types.d.ts +2 -2
- package/dist/src/components/photoFridge/core/engine.d.ts +2 -0
- package/dist/src/components/photoFridge/core/index.d.ts +2 -0
- package/dist/src/components/photoFridge/core/types.d.ts +7 -0
- package/dist/src/components/photoFridge/element/index.d.ts +13 -0
- package/dist/src/components/photoFridge/index.d.ts +3 -5
- package/dist/src/components/photoFridge/react/index.d.ts +3 -0
- package/dist/src/components/photoFridge/types.d.ts +2 -2
- package/dist/src/components/photoLantern/core/engine.d.ts +2 -0
- package/dist/src/components/photoLantern/core/index.d.ts +2 -0
- package/dist/src/components/photoLantern/core/types.d.ts +7 -0
- package/dist/src/components/photoLantern/element/index.d.ts +13 -0
- package/dist/src/components/photoLantern/index.d.ts +3 -5
- package/dist/src/components/photoLantern/react/index.d.ts +3 -0
- package/dist/src/components/photoLantern/types.d.ts +3 -3
- package/dist/src/components/photoLightbox/core/engine.d.ts +2 -0
- package/dist/src/components/photoLightbox/core/index.d.ts +2 -0
- package/dist/src/components/photoLightbox/core/types.d.ts +7 -0
- package/dist/src/components/photoLightbox/element/index.d.ts +13 -0
- package/dist/src/components/photoLightbox/index.d.ts +3 -5
- package/dist/src/components/photoLightbox/react/index.d.ts +3 -0
- package/dist/src/components/photoLightbox/types.d.ts +2 -2
- package/dist/src/components/photoPolaroid/core/engine.d.ts +2 -0
- package/dist/src/components/photoPolaroid/core/index.d.ts +2 -0
- package/dist/src/components/photoPolaroid/core/types.d.ts +7 -0
- package/dist/src/components/photoPolaroid/element/index.d.ts +13 -0
- package/dist/src/components/photoPolaroid/index.d.ts +3 -5
- package/dist/src/components/photoPolaroid/react/index.d.ts +3 -0
- package/dist/src/components/photoPolaroid/types.d.ts +2 -2
- package/dist/src/components/photoPostcard/core/engine.d.ts +6 -0
- package/dist/src/components/photoPostcard/core/index.d.ts +2 -0
- package/dist/src/components/photoPostcard/core/types.d.ts +7 -0
- package/dist/src/components/photoPostcard/element/index.d.ts +13 -0
- package/dist/src/components/photoPostcard/index.d.ts +3 -8
- package/dist/src/components/photoPostcard/react/index.d.ts +10 -0
- package/dist/src/components/photoPostcard/types.d.ts +2 -2
- package/dist/src/components/photoPrism/core/engine.d.ts +2 -0
- package/dist/src/components/photoPrism/core/index.d.ts +2 -0
- package/dist/src/components/photoPrism/core/types.d.ts +7 -0
- package/dist/src/components/photoPrism/element/index.d.ts +13 -0
- package/dist/src/components/photoPrism/index.d.ts +3 -9
- package/dist/src/components/photoPrism/react/index.d.ts +3 -0
- package/dist/src/components/photoPrism/types.d.ts +2 -2
- package/dist/src/components/photoScroll/core/engine.d.ts +2 -0
- package/dist/src/components/photoScroll/core/index.d.ts +2 -0
- package/dist/src/components/photoScroll/core/types.d.ts +7 -0
- package/dist/src/components/photoScroll/element/index.d.ts +13 -0
- package/dist/src/components/photoScroll/index.d.ts +3 -9
- package/dist/src/components/photoScroll/react/index.d.ts +3 -0
- package/dist/src/components/photoScroll/types.d.ts +2 -2
- package/dist/src/components/photoTunnel/core/engine.d.ts +2 -0
- package/dist/src/components/photoTunnel/core/index.d.ts +2 -0
- package/dist/src/components/photoTunnel/core/types.d.ts +7 -0
- package/dist/src/components/photoTunnel/element/index.d.ts +13 -0
- package/dist/src/components/photoTunnel/index.d.ts +3 -9
- package/dist/src/components/photoTunnel/react/index.d.ts +3 -0
- package/dist/src/components/photoTunnel/types.d.ts +2 -2
- package/dist/src/components/photoViewMaster/core/engine.d.ts +2 -0
- package/dist/src/components/photoViewMaster/core/index.d.ts +2 -0
- package/dist/src/components/photoViewMaster/core/types.d.ts +7 -0
- package/dist/src/components/photoViewMaster/element/index.d.ts +13 -0
- package/dist/src/components/photoViewMaster/index.d.ts +3 -9
- package/dist/src/components/photoViewMaster/react/index.d.ts +3 -0
- package/dist/src/components/photoViewMaster/types.d.ts +2 -2
- package/dist/src/components/plasmaBall/core/engine.d.ts +2 -0
- package/dist/src/components/plasmaBall/core/index.d.ts +2 -0
- package/dist/src/components/plasmaBall/core/types.d.ts +11 -0
- package/dist/src/components/plasmaBall/element/index.d.ts +9 -0
- package/dist/src/components/plasmaBall/index.d.ts +3 -9
- package/dist/src/components/plasmaBall/react/index.d.ts +4 -0
- package/dist/src/components/progressChest/core/engine.d.ts +2 -0
- package/dist/src/components/progressChest/core/index.d.ts +2 -0
- package/dist/src/components/progressChest/core/types.d.ts +14 -0
- package/dist/src/components/progressChest/element/index.d.ts +9 -0
- package/dist/src/components/progressChest/index.d.ts +3 -13
- package/dist/src/components/progressChest/react/index.d.ts +4 -0
- package/dist/src/components/radarScan/core/engine.d.ts +2 -0
- package/dist/src/components/radarScan/core/index.d.ts +2 -0
- package/dist/src/components/radarScan/core/types.d.ts +10 -0
- package/dist/src/components/radarScan/element/index.d.ts +9 -0
- package/dist/src/components/radarScan/index.d.ts +3 -9
- package/dist/src/components/radarScan/react/index.d.ts +4 -0
- package/dist/src/components/redPacketRain/core/engine.d.ts +2 -0
- package/dist/src/components/redPacketRain/core/index.d.ts +2 -0
- package/dist/src/components/redPacketRain/core/types.d.ts +25 -0
- package/dist/src/components/redPacketRain/element/index.d.ts +12 -0
- package/dist/src/components/redPacketRain/index.d.ts +3 -33
- package/dist/src/components/redPacketRain/react/index.d.ts +5 -0
- package/dist/src/components/returnCity/core/engine.d.ts +2 -0
- package/dist/src/components/returnCity/core/index.d.ts +2 -0
- package/dist/src/components/returnCity/core/types.d.ts +10 -0
- package/dist/src/components/returnCity/element/index.d.ts +9 -0
- package/dist/src/components/returnCity/index.d.ts +3 -11
- package/dist/src/components/returnCity/react/index.d.ts +4 -0
- package/dist/src/components/rippleWater/core/engine.d.ts +2 -0
- package/dist/src/components/rippleWater/core/index.d.ts +2 -0
- package/dist/src/components/rippleWater/core/types.d.ts +24 -0
- package/dist/src/components/rippleWater/element/index.d.ts +9 -0
- package/dist/src/components/rippleWater/index.d.ts +3 -37
- package/dist/src/components/rippleWater/react/index.d.ts +4 -0
- package/dist/src/components/ropeChain/core/engine.d.ts +2 -0
- package/dist/src/components/ropeChain/core/index.d.ts +2 -0
- package/dist/src/components/ropeChain/core/types.d.ts +12 -0
- package/dist/src/components/ropeChain/element/index.d.ts +9 -0
- package/dist/src/components/ropeChain/index.d.ts +3 -10
- package/dist/src/components/ropeChain/react/index.d.ts +4 -0
- package/dist/src/components/rotatingText/core/engine.d.ts +2 -0
- package/dist/src/components/rotatingText/core/index.d.ts +2 -0
- package/dist/src/components/rotatingText/core/types.d.ts +14 -0
- package/dist/src/components/rotatingText/element/index.d.ts +13 -0
- package/dist/src/components/rotatingText/index.d.ts +3 -19
- package/dist/src/components/rotatingText/react/index.d.ts +4 -0
- package/dist/src/components/sandFall/core/engine.d.ts +2 -0
- package/dist/src/components/sandFall/core/index.d.ts +2 -0
- package/dist/src/components/sandFall/core/types.d.ts +14 -0
- package/dist/src/components/sandFall/element/index.d.ts +13 -0
- package/dist/src/components/sandFall/index.d.ts +3 -17
- package/dist/src/components/sandFall/react/index.d.ts +4 -0
- package/dist/src/components/scrambleText/core/engine.d.ts +2 -0
- package/dist/src/components/scrambleText/core/index.d.ts +2 -0
- package/dist/src/components/scrambleText/core/types.d.ts +10 -0
- package/dist/src/components/scrambleText/element/index.d.ts +9 -0
- package/dist/src/components/scrambleText/index.d.ts +3 -11
- package/dist/src/components/scrambleText/react/index.d.ts +4 -0
- package/dist/src/components/scratchCard/core/engine.d.ts +2 -0
- package/dist/src/components/scratchCard/core/index.d.ts +2 -0
- package/dist/src/components/scratchCard/core/types.d.ts +25 -0
- package/dist/src/components/scratchCard/element/index.d.ts +11 -0
- package/dist/src/components/scratchCard/index.d.ts +3 -23
- package/dist/src/components/scratchCard/react/index.d.ts +5 -0
- package/dist/src/components/shinyText/core/engine.d.ts +2 -0
- package/dist/src/components/shinyText/core/index.d.ts +2 -0
- package/dist/src/components/shinyText/core/types.d.ts +13 -0
- package/dist/src/components/shinyText/element/index.d.ts +9 -0
- package/dist/src/components/shinyText/index.d.ts +3 -17
- package/dist/src/components/shinyText/react/index.d.ts +4 -0
- package/dist/src/components/slotMachine/core/engine.d.ts +2 -0
- package/dist/src/components/slotMachine/core/index.d.ts +2 -0
- package/dist/src/components/slotMachine/core/types.d.ts +31 -0
- package/dist/src/components/slotMachine/element/index.d.ts +18 -0
- package/dist/src/components/slotMachine/index.d.ts +3 -29
- package/dist/src/components/slotMachine/react/index.d.ts +5 -0
- package/dist/src/components/smokeFog/core/engine.d.ts +2 -0
- package/dist/src/components/smokeFog/core/index.d.ts +2 -0
- package/dist/src/components/smokeFog/core/types.d.ts +18 -0
- package/dist/src/components/smokeFog/element/index.d.ts +9 -0
- package/dist/src/components/smokeFog/index.d.ts +3 -25
- package/dist/src/components/smokeFog/react/index.d.ts +4 -0
- package/dist/src/components/snowfall/core/engine.d.ts +2 -0
- package/dist/src/components/snowfall/core/index.d.ts +2 -0
- package/dist/src/components/snowfall/core/types.d.ts +12 -0
- package/dist/src/components/snowfall/element/index.d.ts +13 -0
- package/dist/src/components/snowfall/index.d.ts +3 -13
- package/dist/src/components/snowfall/react/index.d.ts +4 -0
- package/dist/src/components/soapBubbles/core/engine.d.ts +2 -0
- package/dist/src/components/soapBubbles/core/index.d.ts +2 -0
- package/dist/src/components/soapBubbles/core/types.d.ts +14 -0
- package/dist/src/components/soapBubbles/element/index.d.ts +9 -0
- package/dist/src/components/soapBubbles/index.d.ts +3 -20
- package/dist/src/components/soapBubbles/react/index.d.ts +4 -0
- package/dist/src/components/solarSystem/core/engine.d.ts +2 -0
- package/dist/src/components/solarSystem/core/index.d.ts +2 -0
- package/dist/src/components/solarSystem/core/types.d.ts +11 -0
- package/dist/src/components/solarSystem/element/index.d.ts +9 -0
- package/dist/src/components/solarSystem/index.d.ts +3 -9
- package/dist/src/components/solarSystem/react/index.d.ts +4 -0
- package/dist/src/components/speedometer/core/engine.d.ts +2 -0
- package/dist/src/components/speedometer/core/index.d.ts +2 -0
- package/dist/src/components/speedometer/core/types.d.ts +11 -0
- package/dist/src/components/speedometer/element/index.d.ts +9 -0
- package/dist/src/components/speedometer/index.d.ts +3 -9
- package/dist/src/components/speedometer/react/index.d.ts +4 -0
- package/dist/src/components/splitReveal/core/engine.d.ts +2 -0
- package/dist/src/components/splitReveal/core/index.d.ts +2 -0
- package/dist/src/components/splitReveal/core/types.d.ts +10 -0
- package/dist/src/components/splitReveal/element/index.d.ts +9 -0
- package/dist/src/components/splitReveal/index.d.ts +3 -11
- package/dist/src/components/splitReveal/react/index.d.ts +4 -0
- package/dist/src/components/splitText/core/engine.d.ts +2 -0
- package/dist/src/components/splitText/core/index.d.ts +2 -0
- package/dist/src/components/splitText/core/types.d.ts +15 -0
- package/dist/src/components/splitText/element/index.d.ts +13 -0
- package/dist/src/components/splitText/index.d.ts +3 -21
- package/dist/src/components/splitText/react/index.d.ts +4 -0
- package/dist/src/components/spotlight/core/engine.d.ts +2 -0
- package/dist/src/components/spotlight/core/index.d.ts +2 -0
- package/dist/src/components/spotlight/core/types.d.ts +13 -0
- package/dist/src/components/spotlight/element/index.d.ts +14 -0
- package/dist/src/components/spotlight/index.d.ts +3 -10
- package/dist/src/components/spotlight/react/index.d.ts +6 -0
- package/dist/src/components/springMass/core/engine.d.ts +2 -0
- package/dist/src/components/springMass/core/index.d.ts +2 -0
- package/dist/src/components/springMass/core/types.d.ts +21 -0
- package/dist/src/components/springMass/element/index.d.ts +9 -0
- package/dist/src/components/springMass/index.d.ts +3 -19
- package/dist/src/components/springMass/react/index.d.ts +4 -0
- package/dist/src/components/starfield/core/engine.d.ts +2 -0
- package/dist/src/components/starfield/core/index.d.ts +2 -0
- package/dist/src/components/starfield/core/types.d.ts +12 -0
- package/dist/src/components/starfield/element/index.d.ts +9 -0
- package/dist/src/components/starfield/index.d.ts +3 -13
- package/dist/src/components/starfield/react/index.d.ts +4 -0
- package/dist/src/components/textMorph/core/engine.d.ts +2 -0
- package/dist/src/components/textMorph/core/index.d.ts +2 -0
- package/dist/src/components/textMorph/core/types.d.ts +12 -0
- package/dist/src/components/textMorph/element/index.d.ts +13 -0
- package/dist/src/components/textMorph/index.d.ts +3 -15
- package/dist/src/components/textMorph/react/index.d.ts +4 -0
- package/dist/src/components/timelinePulse/core/engine.d.ts +2 -0
- package/dist/src/components/timelinePulse/core/index.d.ts +2 -0
- package/dist/src/components/timelinePulse/core/types.d.ts +10 -0
- package/dist/src/components/timelinePulse/element/index.d.ts +13 -0
- package/dist/src/components/timelinePulse/index.d.ts +3 -8
- package/dist/src/components/timelinePulse/react/index.d.ts +4 -0
- package/dist/src/components/trueFocus/core/engine.d.ts +2 -0
- package/dist/src/components/trueFocus/core/index.d.ts +2 -0
- package/dist/src/components/trueFocus/core/types.d.ts +17 -0
- package/dist/src/components/trueFocus/element/index.d.ts +9 -0
- package/dist/src/components/trueFocus/index.d.ts +3 -25
- package/dist/src/components/trueFocus/react/index.d.ts +4 -0
- package/dist/src/components/turntable/core/engine.d.ts +2 -0
- package/dist/src/components/turntable/core/index.d.ts +2 -0
- package/dist/src/components/turntable/core/types.d.ts +35 -0
- package/dist/src/components/turntable/element/index.d.ts +15 -0
- package/dist/src/components/turntable/index.d.ts +3 -33
- package/dist/src/components/turntable/react/index.d.ts +5 -0
- package/dist/src/components/typewriter/core/engine.d.ts +2 -0
- package/dist/src/components/typewriter/core/index.d.ts +2 -0
- package/dist/src/components/typewriter/core/types.d.ts +11 -0
- package/dist/src/components/typewriter/element/index.d.ts +13 -0
- package/dist/src/components/typewriter/index.d.ts +3 -13
- package/dist/src/components/typewriter/react/index.d.ts +4 -0
- package/dist/src/components/waveButton/core/engine.d.ts +2 -0
- package/dist/src/components/waveButton/core/index.d.ts +2 -0
- package/dist/src/components/waveButton/core/types.d.ts +13 -0
- package/dist/src/components/waveButton/element/index.d.ts +14 -0
- package/dist/src/components/waveButton/index.d.ts +3 -9
- package/dist/src/components/waveButton/react/index.d.ts +4 -0
- package/dist/src/components/waveText/core/engine.d.ts +2 -0
- package/dist/src/components/waveText/core/index.d.ts +2 -0
- package/dist/src/components/waveText/core/types.d.ts +11 -0
- package/dist/src/components/waveText/element/index.d.ts +9 -0
- package/dist/src/components/waveText/index.d.ts +3 -13
- package/dist/src/components/waveText/react/index.d.ts +4 -0
- package/dist/src/components/weatherBackground/core/engine.d.ts +2 -0
- package/dist/src/components/weatherBackground/core/index.d.ts +14 -0
- package/dist/src/components/weatherBackground/core/types.d.ts +7 -0
- package/dist/src/components/weatherBackground/element/index.d.ts +13 -0
- package/dist/src/components/weatherBackground/index.d.ts +5 -5
- package/dist/src/components/weatherBackground/live-weather-core.d.ts +79 -0
- package/dist/src/components/weatherBackground/live-weather.d.ts +3 -69
- package/dist/src/components/weatherBackground/react/index.d.ts +3 -0
- package/dist/src/components/weatherBackground/vue/useLiveWeather.d.ts +15 -0
- package/dist/src/core.d.ts +91 -0
- package/dist/src/elements.d.ts +0 -0
- package/dist/src/vite-env.d.ts +6 -0
- package/dist/src/vue.d.ts +91 -0
- package/dist/style.css +1 -0
- package/dist/vue.cjs +1 -0
- package/dist/vue.d.ts +1 -0
- package/dist/vue.js +2405 -0
- package/package.json +40 -4
- package/dist/index.css +0 -1
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
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("@cos-design/shared"),l=require("three");l=s(l,1);var u=`cos-barcode-scan`;function d(e,t={}){let n={scanColor:`#22c55e`,speed:2.5,defaultContent:`SCAN ME`,...t},r=document.createElement(`div`);r.className=u;let i=document.createElement(`div`);i.className=`${u}__content`;let a=document.createElement(`div`);a.className=`${u}__overlay`;let o=document.createElement(`div`);o.className=`${u}__scan-line`;let s=document.createElement(`div`);s.className=`${u}__glitch-layer`,a.append(o,s);let c=document.createElement(`div`);c.className=`${u}__corners`;for(let e=0;e<4;e++)c.appendChild(document.createElement(`span`));r.append(i,a,c),e.appendChild(r);let l=()=>{if(n.slotElement){n.slotElement.parentElement!==i&&(i.replaceChildren(),i.appendChild(n.slotElement));return}if(i.childNodes.length>0||n.defaultContent==null)return;let e=document.createElement(`span`);e.className=`${r.className}__placeholder`,e.textContent=n.defaultContent,i.replaceChildren(e)},d=()=>{r.style.setProperty(`--scan-color`,n.scanColor??`#22c55e`),r.style.setProperty(`--scan-speed`,`${n.speed??2.5}s`),l()};return d(),{update(e){n={...n,...e},d()},getSlot:()=>i,destroy(){r.remove()}}}var f=`cos-blur-text`;function p(e,t={}){let n={text:`BLUR TEXT`,animateBy:`words`,direction:`top`,stagger:120,duration:500,fontSize:56,color:`#f8fafc`,...t},r=!1,i=!1,a=null,o=0,s={current:n.onAnimationComplete},c=document.createElement(`div`);c.className=f;let l=document.createElement(`p`);l.className=`${f}__text`,c.appendChild(l),e.appendChild(c);let u=()=>n.animateBy===`words`?(n.text??``).split(` `):(n.text??``).split(``),d=()=>{l.style.fontSize=`${n.fontSize??56}px`,l.style.setProperty(`--blur-color`,n.color??`#f8fafc`),l.style.setProperty(`--blur-duration`,`${n.duration??500}ms`),l.replaceChildren();let e=u(),t=n.direction??`top`;e.forEach((i,a)=>{let o=document.createElement(`span`);o.className=`${f}__unit ${f}__${t} ${r?`${f}__enter`:`${f}__idle`}`,o.style.animationDelay=`${a*(n.stagger??120)}ms`,o.textContent=i===` `?`\xA0`:i,l.appendChild(o),n.animateBy===`words`&&a<e.length-1&&l.appendChild(document.createTextNode(`\xA0`))})},p=()=>{if(o&&window.clearTimeout(o),!r||i||!s.current)return;let e=u().length*(n.stagger??120)+(n.duration??500);o=window.setTimeout(()=>{i=!0,s.current?.()},e)};return a=new IntersectionObserver(([e])=>{e.isIntersecting&&(r=!0,a?.disconnect(),a=null,d(),p())},{threshold:.15}),a.observe(c),d(),{update(e){n={...n,...e},e.onAnimationComplete!==void 0&&(s.current=e.onAnimationComplete),i=!1,d(),p()},destroy(){a?.disconnect(),o&&window.clearTimeout(o),c.remove()}}}var m=`cos-burn-away`;function h(e,t={}){let n={text:`BURN`,fontSize:64,completedText:`Gone.`,...t},r=!1,i=!1,a=!1,o=0,s=!1,c={current:n.onComplete},l=document.createElement(`div`);l.className=m;let u=document.createElement(`div`);u.className=`${m}__stage`;let d=document.createElement(`span`);d.className=`${m}__text`;let f=document.createElement(`canvas`);f.className=`${m}__canvas`;let p=document.createElement(`button`);p.type=`button`,p.className=`${m}__trigger`,p.textContent=`Ignite`;let h=document.createElement(`p`);h.className=`${m}__hint`,u.append(d,f),l.append(u,p,h),e.appendChild(l);let g=()=>{d.textContent=n.text??`BURN`,d.style.fontSize=`${n.fontSize??64}px`,d.style.opacity=r?`0`:`1`,d.hidden=i,p.hidden=r||i,h.hidden=!i,h.textContent=n.completedText??`Gone.`},_=()=>{s=!1;let e=u.getBoundingClientRect(),t=window.devicePixelRatio||1,r=Math.ceil(e.width),l=Math.ceil(e.height);f.width=r*t,f.height=l*t,f.style.width=`${r}px`,f.style.height=`${l}px`;let d=f.getContext(`2d`);if(!d)return;d.scale(t,t);let p=document.createElement(`canvas`);p.width=r*t,p.height=l*t;let m=p.getContext(`2d`);if(!m)return;m.scale(t,t),m.font=`900 ${n.fontSize??64}px system-ui, sans-serif`,m.textAlign=`center`,m.textBaseline=`middle`,m.fillStyle=`#f8fafc`,m.fillText(n.text??`BURN`,r/2,l/2);let h=m.getImageData(0,0,r*t,l*t).data,_=[];for(let e=0;e<l;e+=4)for(let n=0;n<r;n+=4)h[(Math.floor(e*t)*r*t+Math.floor(n*t))*4+3]>128&&_.push({x:n,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 v=0,y=(e,t)=>{if(s)return;let n=Math.min((e-t)/16,2);v+=n*16,d.clearRect(0,0,r,l);let u=0;for(let e of _){if(e.life-=n*.012/e.maxLife,e.life<=0)continue;u++,e.x+=e.vx*n,e.y+=e.vy*n,e.vy+=.04*n;let t=e.life,r=1-e.life;d.globalAlpha=t,d.fillStyle=`rgb(255,${Math.max(0,200-r*200)},${Math.max(0,80-r*80)})`,d.beginPath(),d.arc(e.x,e.y,e.size*t,0,Math.PI*2),d.fill()}d.globalAlpha=1,v<2500&&u>0?o=requestAnimationFrame(t=>y(t,e)):s||(i=!0,a||(a=!0,c.current?.()),g())};o=requestAnimationFrame(e=>y(e,e))},v=()=>{r||i||(r=!0,g(),_())};return p.addEventListener(`click`,v),g(),{update(e){n={...n,...e},e.onComplete!==void 0&&(c.current=e.onComplete),g()},ignite:v,destroy(){s=!0,cancelAnimationFrame(o),p.removeEventListener(`click`,v),l.remove()}}}var g=`cos-aurora`,_=[`#00ff87`,`#60efff`,`#7b2ff7`,`#f107a3`],v=800,y=500;function b(e,t={}){let n={fill:!1,colors:_,...t},r=!1,i=n.width??v,a=n.height??y,o=typeof document<`u`?document.hidden:!1,s=null,l=null,u=[],d=document.createElement(`div`);d.className=g,e.appendChild(d);let f=()=>{(n.fill??!1)||(i=n.width??v,a=n.height??y),(0,c.applyCanvasHostBox)(e,d,{fill:!!(n.fill??!1),width:i,height:a})},p=()=>{s?.(),s=null,f(),(n.fill??!1)&&(s=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:v,defaultHeight:y,measured:e});i=t.width,a=t.height,f()}))},m=()=>{u.forEach(e=>e.remove()),u.length=0,((n.colors?.length??0)>=2?n.colors:_).forEach((e,t)=>{let n=document.createElement(`div`);n.className=`${g}__band`,n.style.setProperty(`--aurora-color`,e),n.style.setProperty(`--aurora-delay`,`${t*-3}s`),n.style.setProperty(`--aurora-duration`,`${12+t*2}s`),n.style.animationPlayState=o?`paused`:`running`,d.appendChild(n),u.push(n)})};return l=(0,c.bindVisibilityPause)(e=>{o=e,u.forEach(t=>{t.style.animationPlayState=e?`paused`:`running`})}),p(),m(),{update(e){let t=n;n={...n,...e};let r=t.fill!==n.fill||t.width!==n.width||t.height!==n.height,i=JSON.stringify(t.colors)!==JSON.stringify(n.colors);r&&p(),(r||i)&&m()},destroy(){r||(r=!0,l?.(),s?.(),d.remove())}}}var x=`cos-audio-visualizer`,S=400,C=120;function w(e,t={}){let n={barCount:32,useMic:!1,...t},r=!1,i=n.width??S,a=n.height??C,o=0,s=typeof document<`u`?document.hidden:!1,l=null,u=null,d=null,f=null,p=null,m=0,h=document.createElement(`div`);h.className=x;let g=document.createElement(`canvas`);g.className=`${x}__canvas`,h.appendChild(g),e.appendChild(h);let _=()=>{i=n.width??S,a=n.height??C,h.style.width=`${i}px`,h.style.height=`${a}px`,g.style.width=`${i}px`,g.style.height=`${a}px`},v=()=>{let e=window.devicePixelRatio||1;g.width=i*e,g.height=a*e;let t=g.getContext(`2d`);return t&&t.setTransform(e,0,0,e,0,0),t},y=()=>{p?.getTracks().forEach(e=>e.stop()),p=null,u?.close(),u=null,d=null,f=null},b=async()=>{if(y(),!(!n.useMic||!navigator.mediaDevices?.getUserMedia))try{if(p=await navigator.mediaDevices.getUserMedia({audio:!0}),r){y();return}u=new AudioContext,d=u.createAnalyser(),d.fftSize=256,u.createMediaStreamSource(p).connect(d),f=new Uint8Array(d.frequencyBinCount)}catch{}},w=()=>{if(r||(o=requestAnimationFrame(w),s))return;let e=g.getContext(`2d`);if(!e)return;let t=n.barCount??32,c=Array(t).fill(0);if(d&&f){d.getByteFrequencyData(f);let e=Math.floor(f.length/t);for(let n=0;n<t;n++)c[n]=f[n*e]/255}else{m+=.08;for(let e=0;e<t;e++)c[e]=(Math.sin(m+e*.35)+1)*.35+Math.random()*.15}e.fillStyle=`#0f172a`,e.fillRect(0,0,i,a);let l=(i-3*(t-1))/t;for(let n=0;n<t;n++){let t=Math.max(4,c[n]*a*.9),r=n*(l+3),i=a-t,o=e.createLinearGradient(0,i,0,a);o.addColorStop(0,`#a78bfa`),o.addColorStop(1,`#38bdf8`),e.fillStyle=o,e.beginPath(),e.roundRect(r,i,l,t,2),e.fill()}};return _(),v(),l=(0,c.bindVisibilityPause)(e=>{s=e}),b(),w(),{update(e){n={...n,...e},_(),v(),b()},destroy(){r||(r=!0,cancelAnimationFrame(o),l?.(),y(),h.remove())}}}var T=`cos-canvas-clock`;function E(e,t={}){let n={width:400,height:400,...t},r=!1,i=0,a=typeof document<`u`?document.hidden:!1,o=null,s=document.createElement(`div`);s.className=T;let l=document.createElement(`canvas`);l.className=`${T}__canvas`,s.appendChild(l),e.appendChild(s);let u=()=>Math.min(n.width??400,n.height??400),d=()=>{let e=u();s.style.width=`${e}px`,s.style.height=`${e}px`,l.style.width=`${e}px`,l.style.height=`${e}px`},f=()=>{let e=u(),t=window.devicePixelRatio||1;l.width=e*t,l.height=e*t;let n=l.getContext(`2d`);return n&&n.setTransform(t,0,0,t,0,0),n},p=e=>{let t=u(),n=t/2-16,r=t/2;e.clearRect(0,0,t,t),e.save(),e.translate(r,r),e.beginPath(),e.arc(0,0,n,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 r=t/60*Math.PI*2,i=n-(t%5==0?14:8);e.beginPath(),e.moveTo(Math.cos(r)*i,Math.sin(r)*i),e.lineTo(Math.cos(r)*n,Math.sin(r)*n),e.strokeStyle=t%5==0?`#374151`:`#9ca3af`,e.lineWidth=t%5==0?2:1,e.stroke()}e.fillStyle=`#111827`,e.font=`bold ${Math.floor(t/22)}px system-ui, sans-serif`,e.textAlign=`center`,e.textBaseline=`middle`;for(let t=1;t<=12;t++){let r=t/12*Math.PI*2-Math.PI/2,i=n-32;e.fillText(String(t),Math.cos(r)*i,Math.sin(r)*i)}let i=new Date,a=i.getHours()%12,o=i.getMinutes(),s=i.getSeconds(),c=i.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()},d=(a+o/60)/12*Math.PI*2-Math.PI/2,f=(o+s/60)/60*Math.PI*2-Math.PI/2,p=(s+c/1e3)/60*Math.PI*2-Math.PI/2;l(d,n*.5,4,`#111827`,`rgb(0 0 0 / 40%)`),l(f,n*.72,3,`#1e80ff`,`rgb(30 128 255 / 40%)`),l(p,n*.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()},m=()=>{if(!r&&(i=requestAnimationFrame(m),!a)){let e=l.getContext(`2d`);e&&p(e)}};return d(),f(),o=(0,c.bindVisibilityPause)(e=>{a=e}),m(),{update(e){n={...n,...e},d(),f()},destroy(){r||(r=!0,cancelAnimationFrame(i),o?.(),s.remove())}}}var D=`cos-charge`,O=15,k=258;function A(e,t={}){let n={initQuantity:0,autoCharge:!0,interval:500,step:.01,...t},r=(0,c.clamp)(n.initQuantity??0,0,100),i=()=>n.value!==void 0,a=()=>(0,c.clamp)(i()?n.value:r,0,100),o=a()>=100,s=0,l=null,u={current:n.onChange},d={current:n.onComplete},f=document.createElement(`div`);f.className=D;let p=document.createElement(`div`);p.className=`${D}__contrast`;for(let e=0;e<O;e++){let t=document.createElement(`span`);t.className=`${D}__bubble`,t.dataset.index=String(e+1),p.appendChild(t)}let m=document.createElement(`div`);m.className=`${D}__circle`;let h=document.createElement(`div`);h.className=`${D}__button`,p.append(m,h);let g=document.createElement(`div`);g.className=`${D}__text`,f.append(p,g),e.appendChild(f);let _=()=>{let e=Math.max(0,f.clientHeight-k);f.style.setProperty(`--charge-rise-max`,`${e}px`)},v=()=>{let e=a();f.dataset.auto=n.autoCharge??!0?`true`:`false`,f.style.setProperty(`--charge-pct`,String(e)),g.textContent=`${e.toFixed(2)}%`,e<100?o=!1:o||(o=!0,d.current?.())},y=()=>{s&&clearInterval(s),(n.autoCharge??!0)&&(s=window.setInterval(()=>{if(a()>=100)return;let e=Math.min(100,Number((a()+(n.step??.01)).toFixed(2)));u.current?.(e),i()||(r=e),v()},n.interval??500))};return l=new ResizeObserver(_),l.observe(f),_(),v(),y(),{update(e){n={...n,...e},e.onChange!==void 0&&(u.current=e.onChange),e.onComplete!==void 0&&(d.current=e.onComplete),e.initQuantity!==void 0&&!i()&&(r=(0,c.clamp)(e.initQuantity,0,100)),v(),y()},destroy(){s&&clearInterval(s),l?.disconnect(),f.remove()}}}var j=`cos-circular-text`;function M(e,t={}){let n={text:`COS DESIGN • REACT BITS • `,spinDuration:20,onHover:`speedUp`,fontSize:22,radius:90,color:`#f8fafc`,...t},r=!1,i=document.createElement(`div`);i.className=j;let a=document.createElement(`div`);a.className=`${j}__scale-wrap`;let o=document.createElement(`div`);o.className=`${j}__ring`,a.appendChild(o),i.appendChild(a),e.appendChild(i);let s=()=>{if(!r)return n.spinDuration??20;switch(n.onHover){case`slowDown`:return(n.spinDuration??20)*2;case`speedUp`:return(n.spinDuration??20)/4;case`pause`:return 0;case`goBonkers`:return Math.max((n.spinDuration??20)/20,.2);default:return n.spinDuration??20}},c=()=>{let e=Array.from(n.text??``),t=n.radius??90,i=n.fontSize??22,c=t*2+i*2,l=s();a.classList.toggle(`${j}__bonkers`,r&&n.onHover===`goBonkers`),o.style.width=`${c}px`,o.style.height=`${c}px`,o.style.color=n.color??`#f8fafc`,o.style.fontSize=`${i}px`,o.style.animationDuration=l>0?`${l}s`:``,o.style.animationPlayState=l===0?`paused`:`running`,o.replaceChildren(),e.forEach((n,r)=>{let i=document.createElement(`span`);i.className=`${j}__char`;let a=360/e.length*r;i.style.transform=`rotate(${a}deg) translateY(-${t}px)`,i.textContent=n===` `?`\xA0`:n,o.appendChild(i)})},l=()=>{r=!0,c()},u=()=>{r=!1,c()};return a.addEventListener(`mouseenter`,l),a.addEventListener(`mouseleave`,u),c(),{update(e){n={...n,...e},c()},destroy(){a.removeEventListener(`mouseenter`,l),a.removeEventListener(`mouseleave`,u),i.remove()}}}var N=`cos-click-spark`;function P(e,t={}){let n={color:`#fbbf24`,count:16,defaultContent:`点击任意位置产生火花`,...t},r=!1,i=0,a=typeof document<`u`?document.hidden:!1,o=null,s=null,l=[],u=document.createElement(`div`);u.className=N;let d=document.createElement(`canvas`);d.className=`${N}__canvas`;let f=document.createElement(`div`);f.className=`${N}__content`;let p=document.createElement(`p`);p.className=`${N}__hint`,u.append(d,f,p),e.appendChild(u);let m=()=>{if(n.slotElement||f.children.length>0)return!0;for(let e of f.childNodes)if(e.nodeType===Node.TEXT_NODE&&(e.textContent??``).trim())return!0;return!1},h=()=>{if(m()){p.hidden=!0;return}p.hidden=!1,p.textContent=n.defaultContent??`点击任意位置产生火花`};n.slotElement&&n.slotElement.parentElement!==f&&f.appendChild(n.slotElement),h();let g=new MutationObserver(h);g.observe(f,{childList:!0,characterData:!0,subtree:!0});let _=()=>{let e=window.devicePixelRatio||1,{width:t,height:n}=u.getBoundingClientRect();d.width=t*e,d.height=n*e;let r=d.getContext(`2d`);r&&r.setTransform(e,0,0,e,0,0)},v=(e,t)=>{let r=n.count??16;for(let n=0;n<r;n++){let i=Math.PI*2*n/r+Math.random()*.3,a=Math.random()*4+2;l.push({x:e,y:t,vx:Math.cos(i)*a,vy:Math.sin(i)*a,alpha:1,size:Math.random()*3+2})}},y=e=>{let t=u.getBoundingClientRect();v(e.clientX-t.left,e.clientY-t.top)};u.addEventListener(`click`,y);let b=()=>{if(r||(i=requestAnimationFrame(b),a))return;let e=d.getContext(`2d`);if(!e)return;let{width:t,height:o}=u.getBoundingClientRect(),s=n.color??`#fbbf24`;e.clearRect(0,0,t,o);for(let t=l.length-1;t>=0;t--){let n=l[t];if(n.x+=n.vx,n.y+=n.vy,n.vy+=.15,n.alpha-=.03,n.alpha<=0){l.splice(t,1);continue}e.beginPath(),e.arc(n.x,n.y,n.size,0,Math.PI*2),e.fillStyle=s,e.globalAlpha=n.alpha,e.fill()}e.globalAlpha=1};return _(),s=new ResizeObserver(_),s.observe(u),o=(0,c.bindVisibilityPause)(e=>{a=e}),b(),{getSlot:()=>f,update(e){e.slotElement!==void 0&&e.slotElement!==n.slotElement&&(f.replaceChildren(),e.slotElement&&f.appendChild(e.slotElement)),n={...n,...e},h()},destroy(){r||(r=!0,cancelAnimationFrame(i),o?.(),s?.disconnect(),g.disconnect(),u.removeEventListener(`click`,y),u.remove())}}}var F=`cos-confetti`,I=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`,`#38bdf8`],L=800,R=400,z=()=>I[Math.floor(Math.random()*I.length)],B=(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:z(),width:Math.random()*8+4,height:Math.random()*6+3,alpha:1,gravity:Math.random()*.15+.12}})};function V(e,t={}){let n={fill:!1,auto:!0,particleCount:120,hint:`点击画布再次喷射`,...t},r=!1,i=n.width??L,a=n.height??R,o=0,s=typeof document<`u`?document.hidden:!1,l=(0,c.prefersReducedMotion)(),u=null,d=null,f=null,p=[],m=!1,h={current:n.onComplete},g=document.createElement(`div`);g.className=F;let _=document.createElement(`canvas`);_.className=`${F}__canvas`;let v=document.createElement(`p`);v.className=`${F}__hint`,g.appendChild(_),g.appendChild(v),e.appendChild(g);let y=()=>{let e=n.auto??!0,t=n.interactive??e;_.classList.toggle(`${F}__canvas--interactive`,t),_.classList.toggle(`${F}__canvas--passthrough`,!t),_.style.touchAction=t?`none`:`auto`;let r=n.hint??`点击画布再次喷射`;t&&r?(v.textContent=r,v.hidden=!1):v.hidden=!0},b=()=>{(0,c.applyCanvasHostBox)(e,g,{fill:!!n.fill,width:i,height:a}),_.style.width=`${i}px`,_.style.height=`${a}px`,y()},x=()=>{let e=window.devicePixelRatio||1;_.width=i*e,_.height=a*e;let t=_.getContext(`2d`);return t&&t.setTransform(e,0,0,e,0,0),t},S=()=>{if(u?.(),u=null,!(n.fill??!1)){i=n.width??L,a=n.height??R,b(),x();return}u=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:L,defaultHeight:R,measured:e});i=t.width,a=t.height,b(),x()})},C=()=>{let e=n.particleCount??120;p.push(...B(i,a,l?Math.min(24,e):e)),m=!0},w=()=>{let e=n.auto??!0;(n.interactive??e)&&C()};_.addEventListener(`pointerdown`,w);let T=()=>{if(r||(o=requestAnimationFrame(T),s))return;let e=_.getContext(`2d`);if(!e)return;e.clearRect(0,0,i,a);let t=l?.03:.008;for(let n=p.length-1;n>=0;n--){let r=p[n];if(r.x+=r.vx,r.y+=r.vy,r.vy+=r.gravity,r.vx*=.99,r.rotation+=r.rotationSpeed,r.alpha-=t,r.alpha<=0||r.y>a+20){p.splice(n,1);continue}e.save(),e.translate(r.x,r.y),e.rotate(r.rotation*Math.PI/180),e.globalAlpha=r.alpha,e.fillStyle=r.color,e.fillRect(-r.width/2,-r.height/2,r.width,r.height),e.restore()}m&&p.length===0&&(m=!1,h.current?.())};return d=(0,c.bindVisibilityPause)(e=>{s=e}),f=(0,c.bindPrefersReducedMotion)(e=>{l=e}),S(),(n.auto??!0)&&C(),T(),{update(e){n={...n,...e},h.current=n.onComplete,S()},burst:C,destroy(){r||(r=!0,cancelAnimationFrame(o),d?.(),f?.(),u?.(),_.removeEventListener(`pointerdown`,w),g.remove())}}}var H=`cos-curved-loop`;function ee(e,t={}){let n={text:`COS DESIGN ✦ CURVED LOOP ✦ `,speed:2,curveAmount:80,direction:`left`,interactive:!0,color:`#f8fafc`,fontSize:56,...t},r=0,i=0,a=!1,o=0,s=!1,c=0,l=n.direction??`left`,u=0,d=`curve-${Math.random().toString(36).slice(2,9)}`,f=document.createElement(`div`);f.className=H;let p=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);p.setAttribute(`class`,`${H}__svg`),p.setAttribute(`viewBox`,`0 0 1440 120`),f.appendChild(p),e.appendChild(f);let m=document.createElementNS(`http://www.w3.org/2000/svg`,`text`);m.setAttribute(`xml:space`,`preserve`),m.setAttribute(`class`,`${H}__measure`);let h=document.createElementNS(`http://www.w3.org/2000/svg`,`defs`),g=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);g.setAttribute(`id`,d),g.setAttribute(`fill`,`none`),g.setAttribute(`stroke`,`transparent`);let _=document.createElementNS(`http://www.w3.org/2000/svg`,`text`);_.setAttribute(`xml:space`,`preserve`),_.setAttribute(`class`,`${H}__path-text`);let v=document.createElementNS(`http://www.w3.org/2000/svg`,`textPath`);v.setAttribute(`href`,`#${d}`),v.setAttribute(`xml:space`,`preserve`),_.appendChild(v),p.append(m,h,_),h.appendChild(g);let y=()=>{let e=n.text??``;return(/\s|\u00A0$/.test(e)?e.replace(/\s+$/,``):e)+`\xA0`},b=()=>{l=n.direction??`left`;let e=n.curveAmount??80;g.setAttribute(`d`,`M-100,40 Q500,${40+e} 1540,40`),f.style.cursor=n.interactive??!0?`grab`:`default`,f.style.setProperty(`--curve-color`,n.color??`#f8fafc`),f.style.setProperty(`--curve-font-size`,`${n.fontSize??56}px`),m.textContent=y(),r=m.getComputedTextLength(),a=r>0,f.style.visibility=a?`visible`:`hidden`,a&&(i=-r,v.setAttribute(`startOffset`,`${i}px`),v.textContent=Array(Math.ceil(1800/r)+2).fill(y()).join(``))},x=()=>{if(!s&&a&&r>0){let e=l===`right`?n.speed??2:-(n.speed??2);i+=e,i<=-r&&(i+=r),i>0&&(i-=r),v.setAttribute(`startOffset`,`${i}px`)}o=requestAnimationFrame(x)},S=e=>{(n.interactive??!0)&&(s=!0,c=e.clientX,u=0,e.target.setPointerCapture(e.pointerId))},C=e=>{if(!(n.interactive??!0)||!s||!a)return;let t=e.clientX-c;c=e.clientX,u=t,i+=t,i<=-r&&(i+=r),i>0&&(i-=r),v.setAttribute(`startOffset`,`${i}px`)},w=()=>{(n.interactive??!0)&&(s=!1,l=u>0?`right`:`left`)};return f.addEventListener(`pointerdown`,S),f.addEventListener(`pointermove`,C),f.addEventListener(`pointerup`,w),f.addEventListener(`pointerleave`,w),b(),o=requestAnimationFrame(x),{update(e){n={...n,...e},b()},destroy(){cancelAnimationFrame(o),f.removeEventListener(`pointerdown`,S),f.removeEventListener(`pointermove`,C),f.removeEventListener(`pointerup`,w),f.removeEventListener(`pointerleave`,w),f.remove()}}}var U=`cos-cyber-grid`,te=800,ne=500;function re(e,t={}){let n={fill:!1,color:`#00f0ff`,speed:1,...t},r=!1,i=n.width??te,a=n.height??ne,o=0,s=0,l=typeof document<`u`?document.hidden:!1,u=(0,c.prefersReducedMotion)(),d=null,f=null,p=null,m=document.createElement(`div`);m.className=U;let h=document.createElement(`canvas`);h.className=`${U}__canvas`,m.appendChild(h),e.appendChild(m);let g=()=>{(0,c.applyCanvasHostBox)(e,m,{fill:!!n.fill,width:i,height:a}),h.style.width=`${i}px`,h.style.height=`${a}px`},_=()=>{let e=window.devicePixelRatio||1;h.width=i*e,h.height=a*e;let t=h.getContext(`2d`);return t&&t.setTransform(e,0,0,e,0,0),t},v=()=>{if(d?.(),d=null,!(n.fill??!1)){i=n.width??te,a=n.height??ne,g(),_();return}d=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:te,defaultHeight:ne,measured:e});i=t.width,a=t.height,g(),_()})},y=e=>{let t=h.getContext(`2d`);if(!t)return;let r=n.color??`#00f0ff`,o=n.speed??1,c=a*.45;e&&(s=(s+o*1.5)%40),t.fillStyle=`#050510`,t.fillRect(0,0,i,a);let l=t.createLinearGradient(0,0,0,c);l.addColorStop(0,`#0a0a20`),l.addColorStop(1,`#050510`),t.fillStyle=l,t.fillRect(0,0,i,c);let u=i/2;t.strokeStyle=r,t.shadowColor=r,t.shadowBlur=8,t.lineWidth=1;for(let e=-12;e<=12;e++){let n=e/12*i*1.2;t.beginPath(),t.moveTo(u+n*.05,c),t.lineTo(u+n,a),t.globalAlpha=.3+(1-Math.abs(e)/12)*.5,t.stroke()}t.globalAlpha=1;let d=Math.ceil(a/40)+2;for(let e=0;e<d;e++){let n=c+(e*40+s)/(a-c)*(a-c)%(a-c),r=(n-c)/(a-c);t.beginPath(),t.moveTo(0,n),t.lineTo(i,n),t.globalAlpha=r*.8,t.stroke()}t.shadowBlur=0,t.globalAlpha=1;let f=t.createRadialGradient(u,c,0,u,c,i*.4);f.addColorStop(0,`${r}33`),f.addColorStop(1,`transparent`),t.fillStyle=f,t.fillRect(0,0,i,a)},b=()=>{r||(o=requestAnimationFrame(b),!(l||u)&&y(!0))};return f=(0,c.bindVisibilityPause)(e=>{l=e}),p=(0,c.bindPrefersReducedMotion)(e=>{u=e,u&&y(!1)}),v(),u?y(!1):b(),{update(e){let t=n;n={...n,...e},(t.fill!==n.fill||t.width!==n.width||t.height!==n.height)&&v(),u&&y(!1)},destroy(){r||(r=!0,cancelAnimationFrame(o),f?.(),p?.(),d?.(),m.remove())}}}var ie=`cos-countdown`,ae={days:`天`,hours:`时`,minutes:`分`,seconds:`秒`},oe=[`days`,`hours`,`minutes`,`seconds`],se=e=>e instanceof Date?e.getTime():typeof e==`number`?e:new Date(e).getTime(),ce=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}};function le(e,t){let n={showLabels:!0,color:`#f472b6`,invalidText:`无效的目标时间`,endedText:`时间到!`,...t},r=!1,i=0,a=!1,o={current:n.onEnd},s=document.createElement(`div`);s.className=ie;let c=oe.map(e=>{let t=document.createElement(`div`);t.className=`${ie}__unit`;let n=document.createElement(`div`);n.className=`${ie}__value`;let r=document.createElement(`span`);return r.className=`${ie}__label`,t.append(n,r),s.appendChild(t),{key:e,value:n,label:r}}),l=document.createElement(`p`);l.className=`${ie}__invalid`;let u=document.createElement(`p`);u.className=`${ie}__ended`,s.append(l,u),e.appendChild(s);let d=()=>n.targetDate===void 0?NaN:se(n.targetDate),f=()=>!Number.isNaN(d()),p=()=>{if(s.style.setProperty(`--countdown-color`,n.color??`#f472b6`),!f()){l.textContent=n.invalidText??`无效的目标时间`,l.hidden=!1,c.forEach(({value:e,label:t})=>{e.hidden=!0,t.hidden=!0}),u.hidden=!0;return}l.hidden=!0;let e=ce(d()),t=n.showLabels??!0;c.forEach(({key:r,value:i,label:a})=>{i.hidden=!1,i.textContent=String(e[r]).padStart(2,`0`),a.hidden=!t,a.textContent=n.labels?.[r]??ae[r]}),u.textContent=n.endedText??`时间到!`,u.hidden=e.total>0},m=()=>{if(window.clearInterval(i),a=!1,!f()){p();return}if(Date.now()>=d()){a=!0,o.current?.(),p();return}i=window.setInterval(()=>{p(),Date.now()>=d()&&!a&&(a=!0,o.current?.(),window.clearInterval(i))},1e3)};return p(),m(),{update(e){n={...n,...e},o.current=n.onEnd,p(),m()},destroy(){r||(r=!0,window.clearInterval(i),s.remove())}}}var ue=`cos-count-up`,de=e=>1-(1-e)**3,fe=(e,t)=>e.toLocaleString(`en-US`,{minimumFractionDigits:t,maximumFractionDigits:t});function pe(e,t){let n={start:0,duration:1400,decimals:0,prefix:``,suffix:``,color:`#34d399`,...t},r=!1,i=0,a=n.start??0,o=document.createElement(`div`);o.className=ue;let s=document.createElement(`div`);s.className=`${ue}__glow`;let c=document.createElement(`div`);c.className=`${ue}__value-wrap`;let l=document.createElement(`span`);l.className=`${ue}__value ${ue}__measure`;let u=document.createElement(`span`);u.className=`${ue}__value ${ue}__display`,c.append(l,u),o.append(s,c),e.appendChild(o);let d=()=>{let e=n.decimals??0,t=n.prefix??``,r=n.suffix??``,i=[n.start??0,n.value??0].map(n=>`${t}${fe(n,e)}${r}`);return i.reduce((e,t)=>t.length>e.length?t:e,i[0])},f=e=>{let t=n.decimals??0,r=n.prefix??``,i=n.suffix??``;o.style.setProperty(`--count-up-color`,n.color??`#34d399`),l.textContent=d(),u.textContent=`${r}${fe(e,t)}${i}`},p=e=>{cancelAnimationFrame(i);let t=a,o=performance.now(),s=Math.max(n.duration??1400,16),c=n=>{if(r)return;let l=Math.min(1,(n-o)/s);f(t+(e-t)*de(l)),l<1?i=requestAnimationFrame(c):a=e};i=requestAnimationFrame(c)};return f(a),p(n.value??0),{update(e){n={...n,...e},e.value===void 0?f(a):p(e.value)},destroy(){r||(r=!0,cancelAnimationFrame(i),o.remove())}}}var me=`cos-dna-helix`;function he(e,t={}){let n={width:200,height:360,speed:1,color:`#38bdf8`,...t},r=!1,i=0,a=0,o=typeof document<`u`?document.hidden:!1,s=null,l=document.createElement(`div`);l.className=me;let u=document.createElement(`canvas`);u.className=`${me}__canvas`,l.appendChild(u),e.appendChild(l);let d=()=>{let e=n.width??200,t=n.height??360;l.style.width=`${e}px`,l.style.height=`${t}px`,u.style.width=`${e}px`,u.style.height=`${t}px`;let r=window.devicePixelRatio||1;u.width=e*r,u.height=t*r;let i=u.getContext(`2d`);i&&i.setTransform(r,0,0,r,0,0)},f=()=>{if(r||(i=requestAnimationFrame(f),o))return;let e=u.getContext(`2d`);if(!e)return;let t=n.width??200,s=n.height??360,c=n.speed??1,l=n.color??`#38bdf8`;a+=.03*c,e.fillStyle=`#0f172a`,e.fillRect(0,0,t,s);let d=t/2,p=t*.32;for(let t=0;t<18;t++){let n=t/17*(s-40)+20,r=a+t*.4,i=d+Math.sin(r)*p,o=d+Math.sin(r+Math.PI)*p,c=Math.cos(r),u=5+c*2;e.beginPath(),e.moveTo(i,n),e.lineTo(o,n),e.strokeStyle=`rgb(148 163 184 / ${30+Math.abs(c)*30}%)`,e.lineWidth=1.5,e.stroke(),e.beginPath(),e.arc(i,n,u,0,Math.PI*2),e.fillStyle=c>0?l:`#a78bfa`,e.fill(),e.beginPath(),e.arc(o,n,u,0,Math.PI*2),e.fillStyle=c>0?`#a78bfa`:l,e.fill()}};return d(),s=(0,c.bindVisibilityPause)(e=>{o=e}),f(),{update(e){n={...n,...e},d()},destroy(){r||(r=!0,cancelAnimationFrame(i),s?.(),l.remove())}}}var ge=`cos-electric-arc`,_e=320,ve=160,ye=(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=ye(e,t,o+f,s+p,i*.6,a-1),h=ye(o+f,s+p,n,r,i*.6,a-1);return[...m.slice(0,-1),...h]};function be(e,t={}){let n={color:`#67e8f9`,...t},r=!1,i=n.width??_e,a=n.height??ve,o=0,s=typeof document<`u`?document.hidden:!1,l=null,u=document.createElement(`div`);u.className=ge;let d=document.createElement(`canvas`);d.className=`${ge}__canvas`,u.appendChild(d),e.appendChild(u);let f=()=>{i=n.width??_e,a=n.height??ve,u.style.width=`${i}px`,u.style.height=`${a}px`,d.style.width=`${i}px`,d.style.height=`${a}px`},p=()=>{let e=window.devicePixelRatio||1;d.width=i*e,d.height=a*e;let t=d.getContext(`2d`);return t&&t.setTransform(e,0,0,e,0,0),t},m=()=>{if(r||(o=requestAnimationFrame(m),s))return;let e=d.getContext(`2d`);if(!e)return;let t=n.color??`#67e8f9`,c=a/2,l=i-40,u=a/2;e.fillStyle=`#0f172a`,e.fillRect(0,0,i,a);let f=ye(40,c,l,u,40,5);e.beginPath(),f.forEach(([t,n],r)=>r===0?e.moveTo(t,n):e.lineTo(t,n)),e.strokeStyle=t,e.lineWidth=2,e.shadowColor=t,e.shadowBlur=12,e.stroke(),e.shadowBlur=0,e.beginPath(),f.forEach(([t,n],r)=>r===0?e.moveTo(t,n):e.lineTo(t,n)),e.strokeStyle=`#fff`,e.lineWidth=.8,e.globalAlpha=.6,e.stroke(),e.globalAlpha=1;for(let[n,r]of[[40,c],[l,u]])e.beginPath(),e.arc(n,r,6,0,Math.PI*2),e.fillStyle=t,e.fill()};return f(),p(),l=(0,c.bindVisibilityPause)(e=>{s=e}),m(),{update(e){n={...n,...e},f(),p()},destroy(){r||(r=!0,cancelAnimationFrame(o),l?.(),u.remove())}}}var xe=`cos-cursor-trail`;function Se(e,t={}){let n={color:`#38bdf8`,length:20,width:800,height:400,hint:`移动鼠标查看粒子轨迹`,...t},r=!1,i=n.width??800,a=n.height??400,o=0,s=typeof document<`u`?document.hidden:!1,l=null,u=[],d={x:i/2,y:a/2},f=document.createElement(`div`);f.className=xe;let p=document.createElement(`canvas`);p.className=`${xe}__canvas`;let m=document.createElement(`p`);m.className=`${xe}__hint`,f.appendChild(p),f.appendChild(m),e.appendChild(f);let h=()=>{i=n.width??800,a=n.height??400,f.style.width=`${i}px`,f.style.height=`${a}px`,p.style.width=`${i}px`,p.style.height=`${a}px`,m.textContent=n.hint??``},g=()=>{let e=window.devicePixelRatio||1;p.width=i*e,p.height=a*e;let t=p.getContext(`2d`);return t&&t.setTransform(e,0,0,e,0,0),t},_=e=>{let t=p.getBoundingClientRect();d.x=e.clientX-t.left,d.y=e.clientY-t.top};p.addEventListener(`mousemove`,_);let v=()=>{if(r||(o=requestAnimationFrame(v),s))return;let e=p.getContext(`2d`);if(!e)return;let t=n.color??`#38bdf8`,c=n.length??20;u.unshift({x:d.x,y:d.y,life:1}),u.length>c&&(u.length=c),e.fillStyle=`rgb(15 23 42 / 15%)`,e.fillRect(0,0,i,a);for(let n=0;n<u.length;n++){let r=1-n/u.length,i=(1-n/u.length)*8+2;e.beginPath(),e.arc(u[n].x,u[n].y,i,0,Math.PI*2),e.fillStyle=t,e.globalAlpha=r*.8,e.fill()}e.globalAlpha=1};return h(),g(),l=(0,c.bindVisibilityPause)(e=>{s=e}),v(),{update(e){n={...n,...e},h(),g()},destroy(){r||(r=!0,cancelAnimationFrame(o),l?.(),p.removeEventListener(`mousemove`,_),f.remove())}}}var Ce=`cos-dice-roll`,we={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}},Te={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]]};function Ee(e,t={}){let n={sides:6,rollText:`掷骰子`,rollingText:`掷骰中...`,resultPrefix:`点数:`,...t},r=!1,i=!1,a=1,o={x:0,y:0,z:0},s=0,c={current:n.onRoll},l=document.createElement(`div`);l.className=Ce;let u=document.createElement(`div`);u.className=`${Ce}__scene`;let d=document.createElement(`div`);d.className=`${Ce}__cube`;let f={};for(let e=1;e<=6;e++){let t=document.createElement(`div`);t.className=`${Ce}__face ${Ce}__face${e}`;for(let[n,r]of Te[e]??[]){let e=document.createElement(`span`);e.className=`${Ce}__dot`,e.style.left=`${n}%`,e.style.top=`${r}%`,t.appendChild(e)}d.appendChild(t),f[e]=t}u.appendChild(d);let p=document.createElement(`button`);p.type=`button`,p.className=`${Ce}__roll-btn`;let m=document.createElement(`p`);m.className=`${Ce}__result`,l.append(u,p,m),e.appendChild(l);let h=()=>{p.textContent=i?n.rollingText??`掷骰中...`:n.rollText??`掷骰子`,p.disabled=i,d.classList.toggle(`${Ce}__cube--rolling`,i),d.style.transform=`rotateX(${o.x}deg) rotateY(${o.y}deg) rotateZ(${o.z}deg)`,m.textContent=i?``:`${n.resultPrefix??`点数:`} ${a}`,m.hidden=i},g=()=>{if(i)return;i=!0,h();let e=n.sides??6,t=Math.floor(Math.random()*e)+1,r=we[t]??we[1],l=360*(3+Math.floor(Math.random()*3)),u=360*(3+Math.floor(Math.random()*3));o={x:r.x+l,y:r.y+u,z:Math.random()*360},h(),window.clearTimeout(s),s=window.setTimeout(()=>{a=t,i=!1,h(),c.current?.(t)},1200)};return p.addEventListener(`click`,g),h(),{update(e){n={...n,...e},c.current=n.onRoll,h()},destroy(){r||(r=!0,window.clearTimeout(s),p.removeEventListener(`click`,g),l.remove())}}}var De=`cos-double-pendulum`;function Oe(e,t={}){let n={width:400,height:400,trailLength:120,color:`#38bdf8`,color2:`#a78bfa`,...t},r=!1,i=0,a=null,o={theta1:Math.PI/2+.1,theta2:Math.PI/2-.2,omega1:0,omega2:0},s=[],l=document.createElement(`div`),u=document.createElement(`canvas`);u.className=`${De}__canvas`,l.appendChild(u),e.appendChild(l);let d=()=>{i&&cancelAnimationFrame(i),i=0,a?.(),a=null},f=()=>{if(d(),r)return;let e=n.width??400,t=n.height??400,f=n.trailLength??120,p=n.color??`#38bdf8`,m=n.color2??`#a78bfa`;l.className=De,l.style.width=`${e}px`,l.style.height=`${t}px`,u.style.width=`${e}px`,u.style.height=`${t}px`;let h=window.devicePixelRatio||1;u.width=e*h,u.height=t*h;let g=u.getContext(`2d`);if(!g)return;g.setTransform(h,0,0,h,0,0);let _=e/2,v=t*.28,y=t*.28,b=t*.26,x=9.8,S=.016,C=typeof document<`u`?document.hidden:!1;a=(0,c.bindVisibilityPause)(e=>{C=e});let w=()=>{if(i=requestAnimationFrame(w),C||r)return;let{theta1:n,theta2:a,omega1:c,omega2:l}=o,u=Math.sin(n),d=Math.sin(n-a),h=Math.cos(n-a),T=Math.cos(n),E=y*(3-1*Math.cos(2*n-2*a)),D=(-9.8*3*u-1*x*Math.sin(n-2*a)-2*d*1*(l*l*b+c*c*y*h))/E,O=2*d*(c*c*y*2+x*2*T+l*l*b*1*h)/(b*(3-1*Math.cos(2*n-2*a)));o.omega1+=D*S,o.omega2+=O*S,o.theta1+=o.omega1*S,o.theta2+=o.omega2*S;let k=_+y*Math.sin(o.theta1),A=v+y*Math.cos(o.theta1),j=k+b*Math.sin(o.theta2),M=A+b*Math.cos(o.theta2);s.push({x:j,y:M}),s.length>f&&s.shift(),g.fillStyle=`rgba(15, 23, 42, 0.22)`,g.fillRect(0,0,e,t),s.length>1&&(g.beginPath(),s.forEach((e,t)=>t===0?g.moveTo(e.x,e.y):g.lineTo(e.x,e.y)),g.strokeStyle=m,g.lineWidth=1.5,g.globalAlpha=.7,g.stroke(),g.globalAlpha=1),g.beginPath(),g.moveTo(_,v),g.lineTo(k,A),g.lineTo(j,M),g.strokeStyle=`#64748b`,g.lineWidth=2,g.stroke(),g.beginPath(),g.arc(_,v,5,0,Math.PI*2),g.fillStyle=`#94a3b8`,g.fill(),g.beginPath(),g.arc(k,A,10,0,Math.PI*2),g.fillStyle=p,g.shadowColor=p,g.shadowBlur=10,g.fill(),g.shadowBlur=0,g.beginPath(),g.arc(j,M,10,0,Math.PI*2),g.fillStyle=m,g.shadowColor=m,g.shadowBlur=10,g.fill(),g.shadowBlur=0};g.fillStyle=`#0f172a`,g.fillRect(0,0,e,t),w()};return f(),{update(e){n={...n,...e},f()},destroy(){r||(r=!0,d(),l.remove())}}}var ke=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#a66cff`,`#ff85c0`],Ae=.12,je=240,Me=800,Ne=500,Pe=()=>ke[Math.floor(Math.random()*ke.length)],Fe=(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:Pe(),decay:Math.random()*.015+.01}})};function Ie(e,t={}){let n={auto:!0,...t},r=!1,i=document.createElement(`div`);i.className=`cos-fireworks`;let a=document.createElement(`canvas`);a.className=`cos-fireworks__canvas`;let o=document.createElement(`p`);o.className=`cos-fireworks__hint`,i.appendChild(a),i.appendChild(o),e.appendChild(i);let s=[],l=0,u=0,d=!1,f=typeof document<`u`?document.hidden:!1,p=(0,c.prefersReducedMotion)(),m=n.width??Me,h=n.height??Ne,g=null,_=null,v=null,y={current:n.onComplete},b=e=>{let t=e??Math.random()*m*.6+m*.2;s.push({x:t,y:h,vy:-(Math.random()*4+6),targetY:Math.random()*h*.35+h*.15,color:Pe(),exploded:!1,particles:[],age:0}),d=!0},x=()=>{let t=n.fill??!1;(0,c.applyCanvasHostBox)(e,i,{fill:!!t,width:m,height:h}),a.style.width=`${m}px`,a.style.height=`${h}px`},S=()=>{let e=window.devicePixelRatio||1;a.width=m*e,a.height=h*e;let t=a.getContext(`2d`);t&&t.setTransform(e,0,0,e,0,0)},C=()=>{let e=n.auto??!0,t=n.interactive??e;a.classList.toggle(`cos-fireworks__canvas--interactive`,t),a.classList.toggle(`cos-fireworks__canvas--passthrough`,!t),a.style.touchAction=t?`none`:`auto`;let r=n.hint??`点击画布燃放烟花`;t&&r?(o.textContent=r,o.hidden=!1):o.hidden=!0},w=()=>{u&&=(clearInterval(u),0)},T=()=>{if(w(),!(!(n.auto??!0)||r)){if(p){b();return}u=window.setInterval(()=>b(),1200)}},E=()=>{if(r||(l=requestAnimationFrame(E),f))return;let e=a.getContext(`2d`);if(e){if(e.fillStyle=`rgb(15 23 42 / 25%)`,e.fillRect(0,0,m,h),p){d&&s.length===0&&(d=!1,y.current?.());return}for(let t=s.length-1;t>=0;--t){let n=s[t];if(!n.exploded){n.age+=1,n.y+=n.vy,n.vy+=Ae,e.beginPath(),e.arc(n.x,n.y,2.5,0,Math.PI*2),e.fillStyle=n.color,e.fill();let t=n.vy>=0,r=n.y<=n.targetY,i=n.y<0,a=n.age>=je;(t||r||i||a)&&(n.exploded=!0,n.particles=Fe(n.x,n.y,n.color));continue}n.particles=n.particles.filter(t=>(t.x+=t.vx,t.y+=t.vy,t.vy+=.06,t.alpha-=t.decay,t.alpha<=0?!1:(e.beginPath(),e.arc(t.x,t.y,2,0,Math.PI*2),e.fillStyle=t.color,e.globalAlpha=t.alpha,e.fill(),e.globalAlpha=1,!0))),n.particles.length===0&&s.splice(t,1)}d&&s.length===0&&(d=!1,y.current?.())}},D=()=>{if(g?.(),g=null,!(n.fill??!1)){m=n.width??Me,h=n.height??Ne,x(),S();return}g=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:Me,defaultHeight:Ne,measured:e});m=t.width,h=t.height,x(),S()})},O=e=>{let t=n.auto??!0;if(!(n.interactive??t))return;let r=(0,c.getRelativePointerPosition)(a,e);r&&b(r.x)};return a.addEventListener(`pointerdown`,O),_=(0,c.bindVisibilityPause)(e=>{f=e}),v=(0,c.bindPrefersReducedMotion)(e=>{p=e,T()}),D(),C(),T(),E(),{update:e=>{let t=n;n={...n,...e},e.onComplete!==void 0&&(y.current=e.onComplete);let r=t.fill!==n.fill||t.width!==n.width||t.height!==n.height,i=t.auto!==n.auto||t.interactive!==n.interactive||t.hint!==n.hint;r&&D(),i&&(C(),T())},launch:b,destroy:()=>{r||(r=!0,cancelAnimationFrame(l),w(),a.removeEventListener(`pointerdown`,O),_?.(),v?.(),g?.(),i.remove())}}}var Le=`cos-flip-card`;function Re(e,t={}){let n={frontTitle:`签到翻牌`,frontSubtitle:`点击翻开今日奖励`,backTitle:`恭喜获得`,backSubtitle:`积分 +20`,defaultFlipped:!1,disabled:!1,...t},r=!1,i=n.defaultFlipped??!1,a={current:n.onReveal},o={current:n.onFlipChange},s=document.createElement(`button`);s.type=`button`,s.className=Le;let c=document.createElement(`span`);c.className=`${Le}__inner`;let l=document.createElement(`span`);l.className=`${Le}__face ${Le}__front`;let u=document.createElement(`span`);u.className=`${Le}__face ${Le}__back`;let d=document.createElement(`span`);d.className=`${Le}__kicker`,d.textContent=`CHECK-IN`;let f=document.createElement(`span`);f.className=`${Le}__title`;let p=document.createElement(`span`);p.className=`${Le}__subtitle`;let m=document.createElement(`span`);m.className=`${Le}__kicker`,m.textContent=`REWARD`;let h=document.createElement(`span`);h.className=`${Le}__title`;let g=document.createElement(`span`);g.className=`${Le}__subtitle`,l.append(d,f,p),u.append(m,h,g),c.append(l,u),s.appendChild(c),e.appendChild(s);let _=()=>typeof n.flipped==`boolean`,v=()=>_()?!!n.flipped:i,y=()=>{let e=v();s.classList.toggle(`${Le}--flipped`,e),s.disabled=n.disabled??!1,s.setAttribute(`aria-pressed`,String(e)),f.textContent=n.frontTitle??`签到翻牌`,p.textContent=n.frontSubtitle??`点击翻开今日奖励`,h.textContent=n.backTitle??`恭喜获得`,g.textContent=n.backSubtitle??`积分 +20`},b=(e,t)=>{_()||(i=e),o.current?.(e),e&&t&&a.current?.(),y()};return s.addEventListener(`click`,()=>{n.disabled||v()||b(!0,!0)}),y(),{update(e){n={...n,...e},a.current=n.onReveal,o.current=n.onFlipChange,y()},flip(){n.disabled||v()||b(!0,!0)},reset(){b(!1,!1)},destroy(){r||(r=!0,s.remove())}}}var ze=`cos-flip-counter`,Be=2e3,Ve=(e,t)=>Math.max(0,Math.floor(e)).toString().padStart(t,`0`).slice(-t);function He(e,t={}){let n={value:0,digits:4,color:`#38bdf8`,duration:600,auto:!1,autoInterval:Be,...t},r=!1,i=Math.max(0,Math.floor(n.value??0)),a=null,o=[],s=document.createElement(`div`);s.className=ze,e.appendChild(s);let c=e=>{let t=document.createElement(`div`);t.className=`${ze}__digit`,t.style.setProperty(`--flip-color`,n.color??`#38bdf8`),t.style.setProperty(`--flip-duration`,`${n.duration??600}ms`);let r=document.createElement(`div`);r.className=`${ze}__digit-card`;let i=document.createElement(`div`);i.className=`${ze}__static-top`;let a=document.createElement(`div`);a.className=`${ze}__static-bottom`;let o=document.createElement(`span`),s=document.createElement(`span`);i.appendChild(o),a.appendChild(s),r.append(i,a);let c=()=>{let t=e.flipping?e.prev:e.current;o.textContent=t,s.textContent=t,r.classList.toggle(`${ze}__digit-card--flipping`,e.flipping)};return c(),t.appendChild(r),{digit:t,renderStatic:c,startFlip:(t,i)=>{window.clearTimeout(e.timer),e.prev=t,e.current=i,e.flipping=!0,c(),r.querySelectorAll(`.${ze}__flap`).forEach(e=>e.remove());let a=document.createElement(`div`);a.className=`${ze}__flap ${ze}__flap-top`;let o=document.createElement(`span`);o.textContent=t,a.appendChild(o);let s=document.createElement(`div`);s.className=`${ze}__flap ${ze}__flap-bottom`;let l=document.createElement(`span`);l.textContent=i,s.appendChild(l),r.append(a,s),e.timer=window.setTimeout(()=>{e.flipping=!1,a.remove(),s.remove(),c()},n.duration??600)}}},l=[],u=e=>{s.innerHTML=``,l=[];let t=n.digits??4,r=Ve(i,t).split(``);for(;o.length<r.length;)o.push({prev:`0`,current:`0`,flipping:!1,timer:0});o.length=r.length,r.forEach((t,n)=>{let r=o[n].current;t!==r&&(e&&(o[n].prev=r),o[n].current=t);let i=c(o[n]);e&&t!==r&&i.startFlip(r,t),s.appendChild(i.digit),l.push(i)})},d=()=>{a!=null&&(window.clearInterval(a),a=null)},f=()=>{if(!(n.auto??!1)||r){d();return}if(a!=null)return;let e=n.autoInterval??Be;a=window.setInterval(()=>{r||(i+=Math.floor(Math.random()*9)+1,n.value=i,u(!0))},e)};return u(!1),f(),{update(e){let t=n.value,r=n.digits,a=!!n.auto,o=n.autoInterval;n={...n,...e},e.value!==void 0&&!n.auto||e.value!==void 0&&n.auto&&!a?i=Math.max(0,Math.floor(e.value)):n.auto&&!a&&(i=Math.max(0,Math.floor(n.value??i)));let s=e.value!==void 0&&e.value!==t&&!n.auto,c=e.digits!==void 0&&e.digits!==r;s||c?u(s):(e.color!==void 0||e.duration!==void 0)&&l.forEach(e=>{e.digit.style.setProperty(`--flip-color`,n.color??`#38bdf8`),e.digit.style.setProperty(`--flip-duration`,`${n.duration??600}ms`)}),(!!n.auto!==a||n.autoInterval!==o)&&(d(),f())},destroy(){r||(r=!0,d(),o.forEach(e=>window.clearTimeout(e.timer)),s.remove())}}}var Ue=`cos-fuzzy-text`;function We(e,t={}){let n={text:`FUZZY`,fontSize:72,fontWeight:900,color:`#f8fafc`,baseIntensity:.18,hoverIntensity:.5,enableHover:!0,fuzzRange:30,...t},r=0,i=!1,a=null,o=document.createElement(`div`);o.className=Ue;let s=document.createElement(`canvas`);s.className=`${Ue}__canvas`,o.appendChild(s),e.appendChild(o);let c=async()=>{i=!1,a?.(),a=null,r&&cancelAnimationFrame(r);let e=s.getContext(`2d`);if(!e)return;let t=window.getComputedStyle(s).fontFamily||`sans-serif`,o=`${n.fontWeight??900} ${n.fontSize??72}px ${t}`;try{await document.fonts.load(o)}catch{await document.fonts.ready}if(i)return;let c=document.createElement(`canvas`),l=c.getContext(`2d`);if(!l)return;l.font=o,l.textBaseline=`alphabetic`;let u=n.text??`FUZZY`,d=l.measureText(u),f=d.actualBoundingBoxLeft??0,p=d.actualBoundingBoxRight??d.width,m=d.actualBoundingBoxAscent??n.fontSize??72,h=d.actualBoundingBoxDescent??(n.fontSize??72)*.2,g=Math.ceil(f+p),_=Math.ceil(m+h),v=g+10;c.width=v,c.height=_,l.font=o,l.fillStyle=n.color??`#f8fafc`,l.fillText(u,10/2-f,m);let y=n.fuzzRange??30,b=y+20;s.width=v+b*2,s.height=_,e.setTransform(1,0,0,1,0,0),e.translate(b,0);let x=b+10/2,S=x+g,C=!1,w=()=>{if(i)return;let t=C?n.hoverIntensity??.5:n.baseIntensity??.18;e.clearRect(-y-20,-10,v+2*(y+20),_+20);for(let n=0;n<_;n++){let r=Math.floor(t*(Math.random()-.5)*y);e.drawImage(c,0,n,v,1,r,n,v,1)}r=requestAnimationFrame(w)};r=requestAnimationFrame(w);let T=e=>{if(!(n.enableHover??!0))return;let t=s.getBoundingClientRect(),r=e.clientX-t.left,i=e.clientY-t.top;C=r>=x&&r<=S&&i>=0&&i<=_},E=()=>{C=!1};(n.enableHover??!0)&&(s.addEventListener(`mousemove`,T),s.addEventListener(`mouseleave`,E)),a=()=>{cancelAnimationFrame(r),s.removeEventListener(`mousemove`,T),s.removeEventListener(`mouseleave`,E)}};return c(),{update(e){n={...n,...e},c()},destroy(){i=!0,a?.(),o.remove()}}}var Ge=`cos-gradient-flow`,Ke=[`#ff00de`,`#7c3aed`,`#00f0ff`,`#38bdf8`,`#ff00de`];function qe(e,t={}){let n={text:`GRADIENT`,colors:Ke,fontSize:64,...t},r=document.createElement(`div`);r.className=Ge;let i=document.createElement(`h1`);i.className=`${Ge}__text`,r.appendChild(i),e.appendChild(r);let a=()=>{let e=(n.colors?.length??0)>=2?n.colors:Ke;i.textContent=n.text??`GRADIENT`,i.style.fontSize=`${n.fontSize??64}px`,i.style.backgroundImage=`linear-gradient(90deg, ${e.join(`, `)})`};return a(),{update(e){n={...n,...e},a()},destroy(){r.remove()}}}var Je=`cos-game-of-life`,Ye=560,Xe=420,Ze=(e,t,n)=>Array.from({length:e},()=>Array.from({length:t},()=>+(Math.random()<n))),Qe=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};function $e(e,t={}){let n={cellSize:14,speed:120,density:.28,aliveColor:`#a3e635`,gridColor:`rgb(148 163 184 / 14%)`,...t},r=!1,i=n.width??Ye,a=n.height??Xe,o=0,s=0,l=typeof document<`u`?document.hidden:!1,u=!0,d=0,f=null,p=0,m=0,h=[],g=document.createElement(`div`);g.className=Je;let _=document.createElement(`canvas`);_.className=`${Je}__canvas`;let v=document.createElement(`div`);v.className=`${Je}__toolbar`;let y=document.createElement(`div`);y.className=`${Je}__meta`;let b=document.createElement(`span`),x=document.createElement(`span`);y.append(b,x);let S=document.createElement(`div`);S.className=`${Je}__actions`;let C=document.createElement(`button`);C.type=`button`,C.className=`${Je}__button`;let w=document.createElement(`button`);w.type=`button`,w.className=`${Je}__button`,S.append(C,w),v.append(y,S),g.append(_,v),e.appendChild(g);let T=()=>({generation:n.labels?.generation??`Generation`,alive:n.labels?.alive??`alive`,pause:n.labels?.pause??`Pause`,play:n.labels?.play??`Play`,randomize:n.labels?.randomize??`Randomize`}),E=()=>{let e=n.cellSize??14;p=Math.max(6,Math.floor(a/e)),m=Math.max(6,Math.floor(i/e));let t=(0,c.clamp)(n.density??.28,.05,.7);h=Ze(p,m,t),d=0},D=()=>h.reduce((e,t)=>e+t.reduce((e,t)=>e+t,0),0),O=()=>{let e=T();b.textContent=`${e.generation} ${d}`,x.textContent=`${D()} ${e.alive}`,C.textContent=u?e.pause:e.play,w.textContent=e.randomize},k=()=>{i=n.width??Ye,g.style.width=`${i}px`,_.style.width=`${i}px`,_.style.height=`${a}px`},A=()=>{a=n.height??Xe;let e=window.devicePixelRatio||1;_.width=i*e,_.height=a*e;let t=_.getContext(`2d`);return t&&t.setTransform(e,0,0,e,0,0),t},j=()=>{let e=_.getContext(`2d`);if(!e)return;let t=n.cellSize??14,r=n.aliveColor??`#a3e635`,o=n.gridColor??`rgb(148 163 184 / 14%)`;e.fillStyle=`#020617`,e.fillRect(0,0,i,a);for(let n=0;n<p;n++)for(let i=0;i<m;i++){if(!h[n][i])continue;let a=i*t,o=n*t;e.fillStyle=r,e.fillRect(a+1,o+1,t-2,t-2);let s=e.createRadialGradient(a+t/2,o+t/2,0,a+t/2,o+t/2,t*.8);s.addColorStop(0,`rgb(255 255 255 / 28%)`),s.addColorStop(1,`transparent`),e.fillStyle=s,e.fillRect(a,o,t,t)}e.strokeStyle=o,e.lineWidth=1;for(let n=0;n<=m;n++)e.beginPath(),e.moveTo(n*t+.5,0),e.lineTo(n*t+.5,a),e.stroke();for(let n=0;n<=p;n++)e.beginPath(),e.moveTo(0,n*t+.5),e.lineTo(i,n*t+.5),e.stroke();O()},M=()=>{E(),j()},N=(e,t)=>{let r=_.getBoundingClientRect(),i=n.cellSize??14,a=Math.floor((e-r.left)/i),o=Math.floor((t-r.top)/i);o<0||o>=p||a<0||a>=m||(h=h.map((e,t)=>t===o?e.map((e,t)=>t===a?+!e:e):e),d++,j())},P=()=>{window.clearInterval(s),u&&(s=window.setInterval(()=>{l||(h=Qe(h),d++,j())},n.speed??120))};C.addEventListener(`click`,()=>{u=!u,O(),P()}),w.addEventListener(`click`,M),_.addEventListener(`click`,e=>N(e.clientX,e.clientY));let F=()=>{r||(o=requestAnimationFrame(F),j())};return k(),A(),E(),f=(0,c.bindVisibilityPause)(e=>{l=e}),j(),P(),F(),{update(e){n={...n,...e},k(),A(),E(),P(),j()},destroy(){r||(r=!0,cancelAnimationFrame(o),window.clearInterval(s),f?.(),g.remove())}}}var et=`cos-glitch-text`;function tt(e,t={}){let n={text:`GLITCH`,color:`#f8fafc`,glitchColor1:`#ff00de`,glitchColor2:`#00f0ff`,fontSize:64,...t},r=document.createElement(`div`);r.className=et;let i=document.createElement(`h1`);i.className=`${et}__text`,r.appendChild(i),e.appendChild(r);let a=()=>{let e=n.text??`GLITCH`;i.textContent=e,i.setAttribute(`data-text`,e),i.style.fontSize=`${n.fontSize??64}px`,i.style.setProperty(`--glitch-color`,n.color??`#f8fafc`),i.style.setProperty(`--glitch-c1`,n.glitchColor1??`#ff00de`),i.style.setProperty(`--glitch-c2`,n.glitchColor2??`#00f0ff`)};return a(),{update(e){n={...n,...e},a()},destroy(){r.remove()}}}var nt=`cos-gravity-balls`,rt=[`#38bdf8`,`#a78bfa`,`#f472b6`,`#4ade80`,`#fbbf24`],it=400,at=300;function ot(e,t={}){let n={ballCount:12,...t},r=!1,i=n.width??it,a=n.height??at,o=0,s=typeof document<`u`?document.hidden:!1,l=null,u=[],d=document.createElement(`div`);d.className=nt;let f=document.createElement(`canvas`);f.className=`${nt}__canvas`,d.appendChild(f),e.appendChild(d);let p=()=>{u.length=0;let e=n.ballCount??12;for(let t=0;t<e;t++)u.push({x:Math.random()*(i-40)+20,y:a*.5*Math.random()+10,vx:(Math.random()-.5)*4,vy:Math.random()*2,r:Math.random()*10+8,color:rt[Math.floor(Math.random()*rt.length)]})},m=()=>{i=n.width??it,a=n.height??at,d.style.width=`${i}px`,d.style.height=`${a}px`,f.style.width=`${i}px`,f.style.height=`${a}px`},h=()=>{let e=window.devicePixelRatio||1;f.width=i*e,f.height=a*e;let t=f.getContext(`2d`);return t&&t.setTransform(e,0,0,e,0,0),t},g=()=>{if(r||(o=requestAnimationFrame(g),s))return;let e=f.getContext(`2d`);if(e){e.fillStyle=`#0f172a`,e.fillRect(0,0,i,a);for(let e of u)e.vy+=.25,e.x+=e.vx,e.y+=e.vy,e.x-e.r<0?(e.x=e.r,e.vx*=-.99):e.x+e.r>i&&(e.x=i-e.r,e.vx*=-.99),e.y+e.r>a&&(e.y=a-e.r,e.vy*=-.99,e.vx*=.99),e.y-e.r<0&&(e.y=e.r,e.vy*=-.99);for(let e=0;e<u.length;e++)for(let t=e+1;t<u.length;t++){let n=u[e],r=u[t],i=r.x-n.x,a=r.y-n.y,o=Math.hypot(i,a)||.001,s=n.r+r.r;if(o<s){let e=i/o,t=a/o,c=s-o;n.x-=e*c*.5,n.y-=t*c*.5,r.x+=e*c*.5,r.y+=t*c*.5;let l=(n.vx-r.vx)*e+(n.vy-r.vy)*t;l>0&&(n.vx-=l*e,n.vy-=l*t,r.vx+=l*e,r.vy+=l*t)}}for(let t of u){e.beginPath(),e.arc(t.x,t.y,t.r,0,Math.PI*2);let n=e.createRadialGradient(t.x-t.r*.3,t.y-t.r*.3,0,t.x,t.y,t.r);n.addColorStop(0,`#fff`),n.addColorStop(.3,t.color),n.addColorStop(1,t.color),e.fillStyle=n,e.fill()}}};return m(),h(),p(),l=(0,c.bindVisibilityPause)(e=>{s=e}),g(),{update(e){n={...n,...e},m(),h(),p()},destroy(){r||(r=!0,cancelAnimationFrame(o),l?.(),d.remove())}}}var st=`cos-holographic-card`;function ct(e,t={}){let n={title:`全息卡片`,subtitle:`移动鼠标体验 3D 效果`,...t},r=document.createElement(`div`);r.className=`${st}__wrap`;let i=document.createElement(`div`);i.className=`${st}__card`;let a=document.createElement(`div`);a.className=`${st}__shine`;let o=document.createElement(`div`);o.className=`${st}__info`;let s=document.createElement(`h3`),c=document.createElement(`p`);o.append(s,c),i.append(a,o),r.appendChild(i),e.appendChild(r);let l=null,u=e=>{let t=i.getBoundingClientRect(),n=(e.clientX-t.left)/t.width-.5,r=(e.clientY-t.top)/t.height-.5;i.style.setProperty(`--rx`,`${-r*20}deg`),i.style.setProperty(`--ry`,`${n*20}deg`),i.style.setProperty(`--gx`,`${(n+.5)*100}%`),i.style.setProperty(`--gy`,`${(r+.5)*100}%`)},d=()=>{i.style.setProperty(`--rx`,`0deg`),i.style.setProperty(`--ry`,`0deg`),i.style.setProperty(`--gx`,`50%`),i.style.setProperty(`--gy`,`50%`)};i.addEventListener(`mousemove`,u),i.addEventListener(`mouseleave`,d);let f=()=>{if(l&&=(l.remove(),null),n.image){let e=document.createElement(`img`);e.className=`${st}__image`,e.src=n.image,e.alt=n.title??``,l=e}else{let e=document.createElement(`div`);e.className=st;let t=document.createElement(`span`);t.textContent=`✦`,e.appendChild(t),l=e}i.insertBefore(l,a),s.textContent=n.title??``,c.textContent=n.subtitle??``};return f(),{update(e){n={...n,...e},f()},destroy(){i.removeEventListener(`mousemove`,u),i.removeEventListener(`mouseleave`,d),r.remove()}}}var lt=`cos-liquid-progress`;function ut(e,t={}){let n={value:0,max:100,size:160,color:`#38bdf8`,...t},r=!1,i=0,a=0,o=typeof document<`u`?document.hidden:!1,s=null,l=`lp-${Math.random().toString(36).slice(2,9)}`,u=document.createElement(`div`);u.className=lt;let d=`http://www.w3.org/2000/svg`,f=document.createElementNS(d,`svg`);f.setAttribute(`viewBox`,`0 0 100 100`),f.setAttribute(`class`,`${lt}__svg`);let p=document.createElementNS(d,`defs`),m=document.createElementNS(d,`clipPath`);m.setAttribute(`id`,l);let h=document.createElementNS(d,`circle`);h.setAttribute(`cx`,`50`),h.setAttribute(`cy`,`50`),m.appendChild(h),p.appendChild(m);let g=document.createElementNS(d,`circle`);g.setAttribute(`cx`,`50`),g.setAttribute(`cy`,`50`),g.setAttribute(`class`,`${lt}__track`),g.setAttribute(`fill`,`none`);let _=document.createElementNS(d,`g`),v=document.createElementNS(d,`rect`);v.setAttribute(`x`,`0`),v.setAttribute(`y`,`0`),v.setAttribute(`width`,`100`),v.setAttribute(`height`,`100`),v.setAttribute(`class`,`${lt}__fill-bg`);let y=document.createElementNS(d,`path`);y.setAttribute(`class`,`${lt}__wave`),_.append(v,y);let b=document.createElementNS(d,`circle`);b.setAttribute(`cx`,`50`),b.setAttribute(`cy`,`50`),b.setAttribute(`class`,`${lt}__ring`),b.setAttribute(`fill`,`none`),f.append(p,g,_,b);let x=document.createElement(`span`);x.className=`${lt}__label`,u.append(f,x),e.appendChild(u);let S=()=>{let e=n.max??100,t=n.value??0;return(0,c.clamp)(e>0?t/e*100:0,0,100)},C=()=>{let e=n.size??160,t=n.color??`#38bdf8`,r=S(),i=100-r;u.style.width=`${e}px`,u.style.height=`${e}px`,u.style.setProperty(`--liquid-color`,t),h.setAttribute(`r`,`45`),g.setAttribute(`r`,`45`),g.setAttribute(`stroke-width`,`10`),b.setAttribute(`r`,`45`),b.setAttribute(`stroke-width`,`10`),_.setAttribute(`clip-path`,`url(#${l})`),y.setAttribute(`d`,`M0,${i} Q25,${i-4} 50,${i} T100,${i} V100 H0 Z`),x.textContent=`${Math.round(r)}%`},w=()=>{if(!r){if(!o){a+=.04;let e=100-S()+Math.sin(a)*2;y.setAttribute(`d`,`M0,${e} Q25,${e-4+Math.sin(a*1.3)*3} 50,${e} T100,${e} V100 H0 Z`)}i=requestAnimationFrame(w)}};return C(),s=(0,c.bindVisibilityPause)(e=>{o=e}),i=requestAnimationFrame(w),{update(e){n={...n,...e},C()},destroy(){r||(r=!0,cancelAnimationFrame(i),s?.(),u.remove())}}}var dt=`cos-lorenz-attractor`;function ft(e,t={}){let n={width:400,height:360,speed:1,color:`#f472b6`,pointCount:2e3,...t},r=!1,i=0,a=null,o=0,s=document.createElement(`div`),l=document.createElement(`canvas`);l.className=`${dt}__canvas`,s.appendChild(l),e.appendChild(s);let u=()=>{i&&cancelAnimationFrame(i),i=0,a?.(),a=null},d=()=>{if(u(),r)return;let e=n.width??400,t=n.height??360,d=n.speed??1,f=n.color??`#f472b6`,p=n.pointCount??2e3;s.className=dt,s.style.width=`${e}px`,s.style.height=`${t}px`,l.style.width=`${e}px`,l.style.height=`${t}px`;let m=window.devicePixelRatio||1;l.width=e*m,l.height=t*m;let h=l.getContext(`2d`);if(!h)return;h.setTransform(m,0,0,m,0,0);let g=.005,_=[],v=.1,y=0,b=0;for(let e=0;e<p;e++){let e=10*(y-v),t=v*(28-b)-y,n=v*y-2.6666666666666665*b;v+=e*g,y+=t*g,b+=n*g,_.push({x:v,y,z:b})}let x=(n,r,i,a)=>{let o=Math.cos(a),s=Math.sin(a),c=n*o-i*s,l=n*s+i*o;return{x:e/2+c*6,y:t/2-r*6,depth:l}},S=typeof document<`u`?document.hidden:!1;a=(0,c.bindVisibilityPause)(e=>{S=e});let C=()=>{if(i=requestAnimationFrame(C),S||r)return;o+=.004*d,h.fillStyle=`rgba(15, 23, 42, 0.15)`,h.fillRect(0,0,e,t);let n=_.map(e=>x(e.x,e.y,e.z,o));h.beginPath(),n.forEach((e,t)=>t===0?h.moveTo(e.x,e.y):h.lineTo(e.x,e.y)),h.strokeStyle=f,h.globalAlpha=.75,h.lineWidth=.9,h.stroke(),h.globalAlpha=1,n.forEach((e,t)=>{if(t%50!=0)return;let n=.2+(e.depth+30)/60*.6;h.beginPath(),h.arc(e.x,e.y,1.5,0,Math.PI*2),h.fillStyle=`#fff`,h.globalAlpha=Math.max(.1,Math.min(n,.9)),h.fill()}),h.globalAlpha=1};h.fillStyle=`#0f172a`,h.fillRect(0,0,e,t),C()};return d(),{update(e){n={...n,...e},d()},destroy(){r||(r=!0,u(),s.remove())}}}var pt=`cos-liquid-glass`;function mt(e,t={}){let n={blur:16,borderRadius:20,defaultContent:`液态玻璃面板`,...t},r=document.createElement(`div`);r.className=pt;let i=document.createElement(`div`);i.className=`${pt}__panel`;let a=document.createElement(`div`);a.className=`${pt}__content`,i.appendChild(a),r.appendChild(i),e.appendChild(r);let o=()=>{if(n.slotElement){n.slotElement.parentElement!==a&&(a.replaceChildren(),a.appendChild(n.slotElement));return}if(a.childNodes.length>0||n.defaultContent==null)return;let e=document.createElement(`span`);e.className=`${r.className}__placeholder`,e.textContent=n.defaultContent,a.replaceChildren(e)},s=()=>{i.style.setProperty(`--glass-blur`,`${n.blur??16}px`),i.style.setProperty(`--glass-radius`,`${n.borderRadius??20}px`),o()};return s(),{update(e){n={...n,...e},s()},getSlot:()=>a,destroy(){r.remove()}}}var ht=`cos-magnetic-button`;function gt(e,t={}){let n={strength:.4,color:`#6366f1`,defaultContent:`磁吸按钮`,...t},r=document.createElement(`div`);r.className=ht;let i=document.createElement(`button`);i.type=`button`,i.className=`${ht}__btn`,r.appendChild(i),e.appendChild(r);let a=()=>{if(n.slotElement){n.slotElement.parentElement!==i&&(i.replaceChildren(),i.appendChild(n.slotElement));return}if(i.childNodes.length>0||n.defaultContent==null)return;let e=document.createElement(`span`);e.textContent=n.defaultContent,i.replaceChildren(e)},o=e=>{let t=r.getBoundingClientRect(),a=t.left+t.width/2,o=t.top+t.height/2,s=n.strength??.4;i.style.transform=`translate(${(e.clientX-a)*s}px, ${(e.clientY-o)*s}px)`},s=()=>{i.style.transform=`translate(0, 0)`};r.addEventListener(`mousemove`,o),r.addEventListener(`mouseleave`,s);let c=()=>{i.style.setProperty(`--btn-color`,n.color??`#6366f1`),a()};return c(),{update(e){n={...n,...e},c()},getSlot:()=>i,destroy(){r.removeEventListener(`mousemove`,o),r.removeEventListener(`mouseleave`,s),r.remove()}}}var _t=`cos-matrix-rain`,vt=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ`,yt=800,bt=500;function xt(e,t={}){let n={fill:!1,density:.6,color:`#00ff41`,showOverlay:!0,title:`MATRIX`,subtitle:`数字雨效果`,...t},r=!1,i=n.width??yt,a=n.height??bt,o=0,s=typeof document<`u`?document.hidden:!1,l=(0,c.prefersReducedMotion)(),u=null,d=null,f=null,p=0,m=[],h=document.createElement(`div`);h.className=_t;let g=document.createElement(`canvas`);g.className=`${_t}__canvas`;let _=document.createElement(`div`);_.className=`${_t}__overlay`;let v=document.createElement(`h2`);v.className=`${_t}__title`;let y=document.createElement(`p`);y.className=`${_t}__subtitle`,_.append(v,y),h.append(g,_),e.appendChild(h);let b=()=>{let e=n.density??.6;p=Math.floor(i/16*e),m=Array.from({length:p},()=>Math.random()*-50)},x=()=>{let e=n.showOverlay??!0;_.hidden=!e,e&&(v.textContent=n.title??`MATRIX`,y.textContent=n.subtitle??`数字雨效果`)},S=()=>{(0,c.applyCanvasHostBox)(e,h,{fill:!!n.fill,width:i,height:a}),g.style.width=`${i}px`,g.style.height=`${a}px`,x()},C=()=>{let e=window.devicePixelRatio||1;g.width=i*e,g.height=a*e;let t=g.getContext(`2d`);return t&&t.setTransform(e,0,0,e,0,0),t},w=()=>{if(u?.(),u=null,!(n.fill??!1)){i=n.width??yt,a=n.height??bt,S(),C(),b();return}u=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:yt,defaultHeight:bt,measured:e});i=t.width,a=t.height,S(),C(),b()})},T=e=>{let t=g.getContext(`2d`);if(!t)return;let r=n.color??`#00ff41`,o=n.density??.6;e?(t.fillStyle=`rgb(0 0 0 / 8%)`,t.fillRect(0,0,i,a)):(t.fillStyle=`#000`,t.fillRect(0,0,i,a)),t.font=`16px monospace`,m.forEach((n,i)=>{let s=vt[Math.floor(Math.random()*53)],c=i/o*16;t.fillStyle=r,t.fillText(s,c,n*16),e&&(n*16>a&&Math.random()>.975&&(m[i]=0),m[i]+=1)})},E=()=>{r||(o=requestAnimationFrame(E),!(s||l)&&T(!0))};if(d=(0,c.bindVisibilityPause)(e=>{s=e}),f=(0,c.bindPrefersReducedMotion)(e=>{if(l=e,l){for(let e=0;e<m.length;e++)m[e]=a/16*Math.random();T(!1)}}),w(),b(),l){for(let e=0;e<m.length;e++)m[e]=a/16*Math.random();T(!1)}else E();return{update(e){let t=n;n={...n,...e},(t.fill!==n.fill||t.width!==n.width||t.height!==n.height)&&w(),x(),l&&T(!1)},destroy(){r||(r=!0,cancelAnimationFrame(o),d?.(),f?.(),u?.(),h.remove())}}}var St=`cos-metaball-pool`;function Ct(e,t={}){let n={width:400,height:300,ballCount:5,color:`#38bdf8`,...t},r=!1,i=0,a=typeof document<`u`?document.hidden:!1,o=null,s=[],l={x:-999,y:-999,active:!1},u=document.createElement(`div`);u.className=St;let d=document.createElement(`canvas`);d.className=`${St}__canvas`,u.appendChild(d),e.appendChild(u);let f=()=>{let e=n.width??400,t=n.height??300,r=Math.max(2,Math.min(n.ballCount??5,10));s=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}))},p=()=>{let e=n.width??400,t=n.height??300,r=n.color??`#38bdf8`;u.style.width=`${e}px`,u.style.height=`${t}px`,u.style.setProperty(`--pool-color`,r),d.style.width=`${e}px`,d.style.height=`${t}px`;let i=window.devicePixelRatio||1;d.width=e*i,d.height=t*i;let a=d.getContext(`2d`);a&&a.setTransform(i,0,0,i,0,0)},m=(e,t)=>{let n=d.getBoundingClientRect();l.x=e-n.left,l.y=t-n.top,l.active=!0},h=()=>{l.active=!1},g=e=>m(e.clientX,e.clientY),_=e=>{e.touches[0]&&m(e.touches[0].clientX,e.touches[0].clientY)},v=()=>{if(r||(i=requestAnimationFrame(v),a))return;let e=d.getContext(`2d`);if(!e)return;let t=n.width??400,o=n.height??300,u=.5,f=Math.floor(t*u),p=Math.floor(o*u);for(let e of s){if(l.active){let t=e.x-l.x,n=e.y-l.y,r=Math.hypot(t,n)||1;if(r<120){let i=(120-r)*.04;e.vx+=t/r*i,e.vy+=n/r*i}}e.vx*=.98,e.vy*=.98,e.x+=e.vx,e.y+=e.vy,e.x-e.r<0?(e.x=e.r,e.vx*=-.8):e.x+e.r>t&&(e.x=t-e.r,e.vx*=-.8),e.y-e.r<0?(e.y=e.r,e.vy*=-.8):e.y+e.r>o&&(e.y=o-e.r,e.vy*=-.8)}for(let e=0;e<s.length;e++)for(let t=e+1;t<s.length;t++){let n=s[e],r=s[t],i=r.x-n.x,a=r.y-n.y,o=Math.hypot(i,a)||.001,c=(n.r+r.r)*.55;if(o<c){let e=i/o,t=a/o,s=c-o;n.x-=e*s*.5,n.y-=t*s*.5,r.x+=e*s*.5,r.y+=t*s*.5}}let m=document.createElement(`canvas`);m.width=f,m.height=p;let h=m.getContext(`2d`);if(!h)return;let g=h.createImageData(f,p),_=g.data;for(let e=0;e<p;e++)for(let t=0;t<f;t++){let n=t/u,r=e/u,i=0;for(let e of s){let t=n-e.x,a=r-e.y,o=t*t+a*a;i+=e.r*e.r/(o+1)}let a=(e*f+t)*4;i>1?(_[a]=56+(0,c.clamp)((i-1)*.8,0,1)*40,_[a+1]=189,_[a+2]=248,_[a+3]=255):_[a+3]=0}h.putImageData(g,0,0),e.fillStyle=`#0f172a`,e.fillRect(0,0,t,o),e.save(),e.filter=`blur(8px)`,e.drawImage(m,0,0,t,o),e.restore(),e.globalCompositeOperation=`lighter`,e.drawImage(m,0,0,t,o),e.globalCompositeOperation=`source-over`;for(let t of s){let n=e.createRadialGradient(t.x-t.r*.3,t.y-t.r*.3,0,t.x,t.y,t.r*.6);n.addColorStop(0,`rgba(255,255,255,0.5)`),n.addColorStop(1,`rgba(56,189,248,0)`),e.beginPath(),e.arc(t.x,t.y,t.r*.5,0,Math.PI*2),e.fillStyle=n,e.fill()}};return f(),p(),d.addEventListener(`mousemove`,g),d.addEventListener(`mouseleave`,h),d.addEventListener(`touchmove`,_,{passive:!0}),d.addEventListener(`touchend`,h),o=(0,c.bindVisibilityPause)(e=>{a=e}),v(),{update(e){let t=n.ballCount,r=n.width,i=n.height;n={...n,...e},p(),(n.ballCount!==t||n.width!==r||n.height!==i)&&f()},destroy(){r||(r=!0,cancelAnimationFrame(i),o?.(),d.removeEventListener(`mousemove`,g),d.removeEventListener(`mouseleave`,h),d.removeEventListener(`touchmove`,_),d.removeEventListener(`touchend`,h),u.remove())}}}var wt=`cos-maze-generator`,Tt=400,Et=300;function Dt(e,t={}){let n={cellSize:20,...t},r=!1,i=n.width??Tt,a=n.height??Et,o=0,s=typeof document<`u`?document.hidden:!1,l=null,u={current:n.onGenerated},d=[],f=0,p=0,m=0,h=0,g=document.createElement(`div`);g.className=wt;let _=document.createElement(`canvas`);_.className=`${wt}__canvas`,g.appendChild(_),e.appendChild(g);let v=()=>{let e=n.cellSize??20;f=Math.floor(i/e),p=Math.floor(a/e),d=Array.from({length:p},()=>Array.from({length:f},()=>({top:!0,right:!0,bottom:!0,left:!0,visited:!1})));let t=[[0,0]];d[0][0].visited=!0;let r=[[0,-1,`top`],[1,0,`right`],[0,1,`bottom`],[-1,0,`left`]],o={top:`bottom`,right:`left`,bottom:`top`,left:`right`};for(;t.length;){let[e,n]=t[t.length-1],i=r.map(([t,r,i])=>{let a=e+t,o=n+r;return a<0||o<0||a>=f||o>=p||d[o][a].visited?null:{nx:a,ny:o,wall:i}}).filter(Boolean);if(!i.length){t.pop();continue}let a=i[Math.floor(Math.random()*i.length)];d[n][e][a.wall]=!1,d[a.ny][a.nx][o[a.wall]]=!1,d[a.ny][a.nx].visited=!0,t.push([a.nx,a.ny])}h=f*p*2,m=0,u.current?.(f,p)},y=()=>{i=n.width??Tt,a=n.height??Et,g.style.width=`${i}px`,g.style.height=`${a}px`,_.style.width=`${i}px`,_.style.height=`${a}px`},b=()=>{let e=window.devicePixelRatio||1;_.width=i*e,_.height=a*e;let t=_.getContext(`2d`);return t&&t.setTransform(e,0,0,e,0,0),t},x=()=>{if(r)return;if(s){o=requestAnimationFrame(x);return}let e=_.getContext(`2d`);if(!e)return;let t=n.cellSize??20;m=Math.min(h,m+2),e.fillStyle=`#0f172a`,e.fillRect(0,0,i,a),e.strokeStyle=`#38bdf8`,e.lineWidth=1.5,e.shadowColor=`#38bdf8`,e.shadowBlur=4;let c=0;for(let n=0;n<p;n++)for(let r=0;r<f;r++){let i=d[n][r],a=r*t,o=n*t;i.top&&c++<m&&(e.beginPath(),e.moveTo(a,o),e.lineTo(a+t,o),e.stroke()),i.right&&c++<m&&(e.beginPath(),e.moveTo(a+t,o),e.lineTo(a+t,o+t),e.stroke()),n===p-1&&i.bottom&&c++<m&&(e.beginPath(),e.moveTo(a,o+t),e.lineTo(a+t,o+t),e.stroke()),r===0&&i.left&&c++<m&&(e.beginPath(),e.moveTo(a,o),e.lineTo(a,o+t),e.stroke())}e.shadowBlur=0,m<h&&(o=requestAnimationFrame(x))};return y(),b(),v(),l=(0,c.bindVisibilityPause)(e=>{s=e}),x(),{update(e){n={...n,...e},u.current=n.onGenerated,y(),b(),v(),cancelAnimationFrame(o),x()},destroy(){r||(r=!0,cancelAnimationFrame(o),l?.(),g.remove())}}}var Ot=`cos-meteor-rain`,kt=800,At=500;function jt(e,t={}){let n={fill:!1,meteorCount:8,...t},r=!1,i=n.width??kt,a=n.height??At,o=0,s=typeof document<`u`?document.hidden:!1,l=(0,c.prefersReducedMotion)(),u=null,d=null,f=null,p=[],m=document.createElement(`div`);m.className=Ot;let h=document.createElement(`canvas`);h.className=`${Ot}__canvas`,m.appendChild(h),e.appendChild(m);let g=()=>{p.length=0;let e=n.meteorCount??8;for(let t=0;t<e;t++)p.push({x:Math.random()*i,y:Math.random()*a*.5,length:Math.random()*60+40,speed:Math.random()*6+4,opacity:Math.random()*.5+.3})},_=()=>{(0,c.applyCanvasHostBox)(e,m,{fill:!!n.fill,width:i,height:a}),h.style.width=`${i}px`,h.style.height=`${a}px`},v=()=>{let e=window.devicePixelRatio||1;h.width=i*e,h.height=a*e;let t=h.getContext(`2d`);return t&&t.setTransform(e,0,0,e,0,0),t},y=()=>{if(u?.(),u=null,!(n.fill??!1)){i=n.width??kt,a=n.height??At,_(),v(),g();return}u=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:kt,defaultHeight:At,measured:e});i=t.width,a=t.height,_(),v(),g()})},b=e=>{let t=h.getContext(`2d`);if(t){e?(t.fillStyle=`rgb(15 23 42 / 15%)`,t.fillRect(0,0,i,a)):(t.fillStyle=`#0f172a`,t.fillRect(0,0,i,a));for(let n of p){e&&(n.x+=n.speed,n.y+=n.speed*.6,(n.x>i+n.length||n.y>a+n.length)&&(n.x=-n.length,n.y=Math.random()*a*.4,n.length=Math.random()*60+40,n.speed=Math.random()*6+4,n.opacity=Math.random()*.5+.3));let r=n.x-n.length,o=n.y-n.length*.6;t.beginPath(),t.strokeStyle=`rgb(255 255 255 / ${n.opacity})`,t.lineWidth=2,t.moveTo(n.x,n.y),t.lineTo(r,o),t.stroke(),t.beginPath(),t.fillStyle=`rgb(255 255 255 / ${Math.min(1,n.opacity+.2)})`,t.arc(n.x,n.y,1.5,0,Math.PI*2),t.fill()}}},x=()=>{r||(o=requestAnimationFrame(x),!(s||l)&&b(!0))};return d=(0,c.bindVisibilityPause)(e=>{s=e}),f=(0,c.bindPrefersReducedMotion)(e=>{l=e,l&&b(!1)}),y(),g(),l?b(!1):x(),{update(e){let t=n;n={...n,...e},(t.fill!==n.fill||t.width!==n.width||t.height!==n.height)&&y(),l&&b(!1)},destroy(){r||(r=!0,cancelAnimationFrame(o),d?.(),f?.(),u?.(),m.remove())}}}var Mt=`cos-network-graph`,Nt=600,Pt=420,Ft=6,It=`ui-sans-serif, system-ui, -apple-system, sans-serif`,Lt=[{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`}],Rt=[{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`}],zt=(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};function Vt(e,t={}){let n={nodes:Lt,edges:Rt,linkColor:`rgb(148 163 184 / 35%)`,nodeRadius:20,hint:`拖拽节点 · 悬停查看关联`,...t},r=!1,i=n.width??Nt,a=n.height??Pt,o=typeof document<`u`?document.hidden:!1,s=null,l=[],u=null,d=null,f=n.hint??``,p=document.createElement(`div`);p.className=Mt;let m=document.createElement(`canvas`);m.className=`${Mt}__canvas`;let h=document.createElement(`div`);h.className=`${Mt}__hint`,p.append(m,h),e.appendChild(p);let g=()=>{let e=new Map,t=n.nodes??Lt,r=n.edges??Rt;for(let n of t)e.set(n.id,new Set);for(let t of r)e.get(t.source)?.add(t.target),e.get(t.target)?.add(t.source);return e},_=g(),v=()=>{i=n.width??Nt,a=n.height??Pt,p.style.width=String(i)+`px`,p.style.height=String(a)+`px`,m.style.width=String(i)+`px`,m.style.height=String(a)+`px`,h.textContent=f},y=()=>{let e=n.nodes??Lt;if(!e.length){l=[];return}let t=new Map(l.map(e=>[e.id,e]));l=e.map((n,r)=>{let o=t.get(n.id);return o?{...o,label:n.label||n.id,color:n.color||`#38bdf8`}:{id:n.id,label:n.label||n.id,color:n.color||`#38bdf8`,x:i/2+Math.cos(r/e.length*Math.PI*2)*140,y:a/2+Math.sin(r/e.length*Math.PI*2)*120,vx:0,vy:0}})},b=()=>{cancelAnimationFrame(0),y(),_=g();let e=Math.min(window.devicePixelRatio||1,2);m.width=i*e,m.height=a*e;let t=m.getContext(`2d`);if(!t)return;t.setTransform(e,0,0,e,0,0);let r=n.edges??Rt,s=n.linkColor??`rgb(148 163 184 / 35%)`,c=n.nodeRadius??20,f=0,p=()=>{let e=new Map;return l.forEach(t=>e.set(t.id,t)),e},h=(e,t)=>!t||e===t?!0:_.get(t)?.has(e)??!1,v=()=>{let e=l,t=p(),n=.92,o=.003;for(let t=0;t<e.length;t++){let n=e[t];for(let r=t+1;r<e.length;r++){let t=e[r],i=n.x-t.x,a=n.y-t.y,o=i*i+a*a||1,s=2400/o,c=Math.sqrt(o);i/=c,a/=c,n.vx+=i*s,n.vy+=a*s,t.vx-=i*s,t.vy-=a*s}}for(let e of r){let n=t.get(e.source),r=t.get(e.target);if(!n||!r)continue;let i=r.x-n.x,a=r.y-n.y,o=Math.sqrt(i*i+a*a)||1,s=.012*(o-120),c=i/o*s,l=a/o*s;n.vx+=c,n.vy+=l,r.vx-=c,r.vy-=l}for(let t of e)t.vx+=(i/2-t.x)*o,t.vy+=(a/2-t.y)*o,t.vx*=n,t.vy*=n,d?.node!==t&&(t.x+=t.vx,t.y+=t.vy,t.x=Math.max(c,Math.min(i-c,t.x)),t.y=Math.max(c,Math.min(a-c,t.y)))},b=()=>{let e=t.createRadialGradient(i*.5,a*.42,20,i*.5,a*.5,Math.max(i,a)*.72);e.addColorStop(0,`#1a2744`),e.addColorStop(.55,`#0f172a`),e.addColorStop(1,`#020617`),t.fillStyle=e,t.fillRect(0,0,i,a),t.fillStyle=`rgb(148 163 184 / 7%)`;for(let e=28;e<i;e+=28)for(let n=28;n<a;n+=28)t.beginPath(),t.arc(e,n,.7,0,Math.PI*2),t.fill();let n=t.createRadialGradient(i/2,a/2,Math.min(i,a)*.25,i/2,a/2,Math.max(i,a)*.7);n.addColorStop(0,`rgb(0 0 0 / 0%)`),n.addColorStop(1,`rgb(2 6 23 / 55%)`),t.fillStyle=n,t.fillRect(0,0,i,a)},x=(e,n,r,i)=>{let a=n.x-e.x,o=n.y-e.y,l=Math.sqrt(a*a+o*o)||1,u=a/l,d=o/l,f=c*.55,p=e.x+u*f,m=e.y+d*f,h=n.x-u*f,g=n.y-d*f,_=(p+h)/2,v=(m+g)/2,y=t.createLinearGradient(p,m,h,g);r?(y.addColorStop(0,Bt(e.color,.85)),y.addColorStop(.5,Bt(zt(e.color,n.color,.5),.55)),y.addColorStop(1,Bt(n.color,.85)),t.lineWidth=2.4,t.shadowColor=Bt(zt(e.color,n.color,.5),.45),t.shadowBlur=10):i?(y.addColorStop(0,Bt(s,.12)),y.addColorStop(.5,Bt(s,.08)),y.addColorStop(1,Bt(s,.12)),t.lineWidth=1,t.shadowBlur=0):(y.addColorStop(0,Bt(s,.15)),y.addColorStop(.5,s),y.addColorStop(1,Bt(s,.15)),t.lineWidth=1.35,t.shadowBlur=0),t.strokeStyle=y,t.lineCap=`round`,t.beginPath(),t.moveTo(p,m),t.quadraticCurveTo(_+d*4,v-u*4,h,g),t.stroke(),t.shadowBlur=0},S=(e,n,r)=>{let i=h(e.id,n),o=n===e.id,s=r&&d?.node===e,l=c*(o||s?1.12:i||!n?1:.94),u=!n||i?1:.28;t.save(),t.globalAlpha=u,t.beginPath(),t.arc(e.x,e.y,l+(o||s?10:6),0,Math.PI*2),t.fillStyle=Bt(e.color,o||s?.22:.12),t.fill(),t.shadowColor=Bt(e.color,o||s?.75:.45),t.shadowBlur=o||s?22:14;let f=t.createRadialGradient(e.x-l*.28,e.y-l*.32,l*.1,e.x,e.y,l);f.addColorStop(0,zt(e.color,`#ffffff`,.55)),f.addColorStop(.55,e.color),f.addColorStop(1,zt(e.color,`#0f172a`,.35)),t.beginPath(),t.arc(e.x,e.y,l,0,Math.PI*2),t.fillStyle=f,t.fill(),t.shadowBlur=0,t.strokeStyle=o||s?`rgb(255 255 255 / 70%)`:`rgb(255 255 255 / 28%)`,t.lineWidth=o||s?1.6:1.1,t.stroke();let p=Math.max(10,Math.min(13,Math.round(c*.58)));t.font=`500 ${p}px ${It}`,t.textAlign=`center`,t.textBaseline=`middle`;let m=e.label,g=t.measureText(m).width+16,_=p+8,v=e.x-g/2,y=Math.min(a-_-4,e.y+l+8);t.beginPath();let b=_/2;t.moveTo(v+b,y),t.arcTo(v+g,y,v+g,y+_,b),t.arcTo(v+g,y+_,v,y+_,b),t.arcTo(v,y+_,v,y,b),t.arcTo(v,y,v+g,y,b),t.closePath(),t.fillStyle=o||s?`rgb(15 23 42 / 78%)`:`rgb(15 23 42 / 55%)`,t.fill(),t.strokeStyle=`rgb(255 255 255 / 10%)`,t.lineWidth=1,t.stroke(),t.fillStyle=`#f8fafc`,t.fillText(m,e.x,y+_/2),t.restore()},C=()=>{b();let e=p(),t=d?.node.id??u,n=!!d;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=[...l].sort((e,n)=>(e.id===t?2:+!!h(e.id,t))-(n.id===t?2:+!!h(n.id,t)));for(let e of i)S(e,t,n)},w=()=>{f=requestAnimationFrame(w),!o&&(v(),C())};return f=requestAnimationFrame(w),()=>{cancelAnimationFrame(f)}},x=()=>n.nodeRadius??20,S=(e,t,n)=>{let r=e-n.left,i=t-n.top,a=x()+Ft,o=null,s=a*a;for(let e of l){let t=(e.x-r)**2+(e.y-i)**2;t<=s&&(s=t,o=e)}return o};function C(e){u=e?.id??null,f=e?e.label:n.hint??``,h.textContent=f}let w=e=>{if(e.pointerType===`mouse`&&e.button!==0)return;let t=m.getBoundingClientRect(),n=S(e.clientX,e.clientY,t);if(!n)return;m.setPointerCapture(e.pointerId),e.pointerType===`touch`&&e.preventDefault();let r=e.clientX-t.left,i=e.clientY-t.top;d={node:n,offsetX:n.x-r,offsetY:n.y-i,lastX:r,lastY:i,vx:0,vy:0},n.vx=0,n.vy=0,C(n)},T=e=>{let t=m.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,o=x();if(d){e.pointerType===`touch`&&e.preventDefault();let{node:t,offsetX:s,offsetY:c}=d,l=Math.max(o,Math.min(i-o,n+s)),u=Math.max(o,Math.min(a-o,r+c));d.vx=l-d.lastX,d.vy=u-d.lastY,d.lastX=l,d.lastY=u,t.x=l,t.y=u,t.vx=0,t.vy=0;return}C(S(e.clientX,e.clientY,t))},E=e=>{let t=d;t&&(t.node.vx=t.vx*.85,t.node.vy=t.vy*.85,d=null,m.hasPointerCapture(e.pointerId)&&m.releasePointerCapture(e.pointerId));let n=m.getBoundingClientRect();C(S(e.clientX,e.clientY,n))},D=()=>{d||C(null)};return m.addEventListener(`pointerdown`,w),m.addEventListener(`pointermove`,T),m.addEventListener(`pointerup`,E),m.addEventListener(`pointercancel`,E),m.addEventListener(`pointerleave`,D),s=(0,c.bindVisibilityPause)(e=>{o=e}),v(),b(),{update(e){n={...n,...e},u||(f=n.hint??``,h.textContent=f),v(),b()},destroy(){r||(r=!0,cancelAnimationFrame(0),s?.(),m.removeEventListener(`pointerdown`,w),m.removeEventListener(`pointermove`,T),m.removeEventListener(`pointerup`,E),m.removeEventListener(`pointercancel`,E),m.removeEventListener(`pointerleave`,D),p.remove())}}}var Ht=`cos-neon-text`;function Ut(e,t={}){let n={text:`NEON`,color:`#ff00de`,fontSize:72,flicker:!0,...t},r=document.createElement(`div`);r.className=Ht;let i=document.createElement(`h1`);i.className=`${Ht}__text`;let a=document.createElement(`p`);a.className=`${Ht}__reflection`,r.append(i,a),e.appendChild(r);let o=()=>{i.textContent=n.text??`NEON`,i.style.fontSize=`${n.fontSize??72}px`,i.style.setProperty(`--neon-color`,n.color??`#ff00de`),i.classList.toggle(`${Ht}__flicker`,n.flicker??!0),a.textContent=n.text??`NEON`,a.style.fontSize=`${(n.fontSize??72)*.35}px`,a.style.color=n.color??`#ff00de`};return o(),{update(e){n={...n,...e},o()},destroy(){r.remove()}}}var Wt=`cos-newton-cradle`;function Gt(e,t={}){let n={ballCount:5,color:`#38bdf8`,width:280,height:200,...t},r=!1,i=0,a=null,o=document.createElement(`div`),s=document.createElement(`canvas`);s.className=`${Wt}__canvas`,o.appendChild(s),e.appendChild(o);let l=()=>{i&&cancelAnimationFrame(i),i=0,a?.(),a=null},u=()=>{if(l(),r)return;let e=n.width??280,t=n.height??200,u=n.color??`#38bdf8`,d=Math.max(2,Math.min(n.ballCount??5,7));o.className=Wt,o.style.width=`${e}px`,o.style.height=`${t}px`,o.style.setProperty(`--ball-color`,u),s.style.width=`${e}px`,s.style.height=`${t}px`;let f=window.devicePixelRatio||1;s.width=e*f,s.height=t*f;let p=s.getContext(`2d`);if(!p)return;p.setTransform(f,0,0,f,0,0);let m=t-28-28,h=(d-1)*28,g=(e-h)/2,_=1/60,v=Array.from({length:d},()=>({theta:0,omega:0}));v[0].theta=-.52;let y=`left`,b=e=>g+e*28,x=e=>{let t=v[e];return{x:b(e)+m*Math.sin(t.theta),y:16+m*Math.cos(t.theta)}},S=e=>{y===`left`&&(y=`right`,v[0].omega=0,v[0].theta=0,v[d-1].omega=Math.abs(e))},C=e=>{y===`right`&&(y=`left`,v[d-1].omega=0,v[d-1].theta=0,v[0].omega=-Math.abs(e))},w=()=>{let e=x(0),t=x(1);if(e.x+14>=t.x-14-.5&&v[0].omega>.02){S(v[0].omega);return}let n=x(d-1),r=x(d-2);n.x-14<=r.x+14+.5&&v[d-1].omega<-.02&&C(v[d-1].omega)},T=typeof document<`u`?document.hidden:!1;a=(0,c.bindVisibilityPause)(e=>{T=e});let E=()=>{if(i=requestAnimationFrame(E),!(T||r)){for(let e=0;e<d;e++){let t=v[e];if(Math.abs(t.omega)<1e-5&&Math.abs(t.theta)<1e-5)continue;let n=-(980/m)*Math.sin(t.theta);t.omega+=n*_,t.omega*=.9998,t.theta+=t.omega*_}w();for(let e=1;e<d-1;e++)v[e].theta=0,v[e].omega=0;p.fillStyle=`#0f172a`,p.fillRect(0,0,e,t),p.strokeStyle=`#475569`,p.lineWidth=3,p.beginPath(),p.moveTo(g-14,16),p.lineTo(g+h+14,16),p.stroke();for(let e=0;e<d;e++){let t=b(e),{x:n,y:r}=x(e);p.beginPath(),p.moveTo(t,16),p.lineTo(n,r),p.strokeStyle=`#64748b`,p.lineWidth=2,p.stroke(),p.beginPath(),p.arc(n,r,14,0,Math.PI*2);let i=p.createRadialGradient(n-14*.3,r-14*.3,0,n,r,14);i.addColorStop(0,`#fff`),i.addColorStop(.35,u),i.addColorStop(1,u),p.fillStyle=i,p.shadowColor=u,p.shadowBlur=6,p.fill(),p.shadowBlur=0}}};E()};return u(),{update(e){n={...n,...e},u()},destroy(){r||(r=!0,l(),o.remove())}}}var Kt=`cos-nine-grid`,qt=[{icon:`🎁`,label:`谢谢参与`},{icon:`🧧`,label:`红包 1 元`},{icon:`🎫`,label:`优惠券`},{icon:`☕`,label:`咖啡券`},{icon:`💎`,label:`钻石`},{icon:`🎧`,label:`耳机`},{icon:`📦`,label:`神秘礼`},{icon:`⭐`,label:`积分 x10`},{icon:`🏆`,label:`大奖`}],Jt=e=>{let t=[...e?.length?e:qt];for(;t.length<9;)t.push({label:`奖品 ${t.length+1}`});return t.slice(0,9)};function Yt(e,t={}){let n={items:qt,buttonText:`开始抽奖`,spinningText:`抽奖中…`,disabled:!1,...t},r=!1,i=null,a=null,o=!1,s=[],l=document.createElement(`div`),u=document.createElement(`div`);u.className=`${Kt}__board`,u.setAttribute(`role`,`grid`),u.setAttribute(`aria-label`,`九宫格抽奖`);let d=[];for(let e=0;e<9;e++){let e=document.createElement(`div`);e.setAttribute(`role`,`gridcell`),u.appendChild(e),d.push(e)}let f=document.createElement(`button`);f.type=`button`,f.className=`${Kt}__button`,f.dataset.testid=`nine-grid-draw`,l.append(u,f),e.appendChild(l);let p=()=>{s.forEach(e=>window.clearTimeout(e)),s.length=0},m=()=>{l.className=Kt,Jt(n.items).forEach((e,t)=>{let n=d[t];if(n.className=`${Kt}__cell${i===t?` ${Kt}__active`:``}${a===t?` ${Kt}__winner`:``}`,n.replaceChildren(),e.icon){let t=document.createElement(`span`);t.className=`${Kt}__icon`,t.textContent=e.icon,n.appendChild(t)}let r=document.createElement(`span`);r.className=`${Kt}__label`,r.textContent=e.label,n.appendChild(r)}),f.disabled=o||!!n.disabled,f.setAttribute(`aria-busy`,String(o)),f.textContent=o?n.spinningText??`抽奖中…`:n.buttonText??`开始抽奖`},h=()=>{p(),o=!1,i=null,a=null,m()},g=e=>{if(o||n.disabled||r)return;p(),a=null,o=!0;let t=Jt(n.items),l=((typeof e==`number`?e:typeof n.targetIndex==`number`?n.targetIndex:Math.floor(Math.random()*9))%9+9)%9;if((0,c.prefersReducedMotion)()){i=l,a=l,o=!1,m(),n.onDrawEnd?.(t[l],l);return}let u=18+l,d=0,f=()=>{if(!r){if(i=d%9,d+=1,d>u){i=l,a=l,o=!1,m(),n.onDrawEnd?.(t[l],l);return}m(),s.push(window.setTimeout(f,60+Math.floor(d*12)))}};m(),f()};return f.addEventListener(`click`,()=>g()),m(),{update(e){n={...n,...e},m()},draw:g,reset:h,destroy(){r||(r=!0,p(),l.remove())}}}var Xt=`cos-orbital-chart`,Zt=[{label:`A`,value:30,color:`#38bdf8`},{label:`B`,value:25,color:`#a78bfa`},{label:`C`,value:20,color:`#f472b6`},{label:`D`,value:25,color:`#4ade80`}];function Qt(e,t={}){let n={data:Zt,size:240,...t},r=!1,i=0,a=0,o=typeof document<`u`?document.hidden:!1,s=null,l=document.createElement(`div`);l.className=Xt;let u=document.createElement(`canvas`);u.className=`${Xt}__canvas`;let d=document.createElement(`ul`);d.className=`${Xt}__legend`,l.append(u,d),e.appendChild(l);let f=()=>n.data&&n.data.length?n.data:Zt,p=()=>{d.replaceChildren();for(let e of f()){let t=document.createElement(`li`),n=document.createElement(`span`);n.className=`${Xt}__swatch`,n.style.background=e.color,t.append(n,document.createTextNode(` ${e.label} (${e.value})`)),d.appendChild(t)}},m=()=>{let e=n.size??240;l.style.width=`${e}px`,u.style.width=`${e}px`,u.style.height=`${e}px`;let t=window.devicePixelRatio||1;u.width=e*t,u.height=e*t;let r=u.getContext(`2d`);r&&r.setTransform(t,0,0,t,0,0)},h=()=>{if(r||(i=requestAnimationFrame(h),o))return;let e=u.getContext(`2d`);if(!e)return;let t=f();if(t.length===0)return;let s=n.size??240;a+=.012,e.fillStyle=`#0f172a`,e.fillRect(0,0,s,s);let l=t.reduce((e,t)=>e+t.value,0)||1,d=s/2,p=s/2,m=(s/2-20)/(t.length+1);t.forEach((t,n)=>{let r=m*(n+1),i=t.value/l,o=(0,c.clamp)(Math.round(i*12)+1,1,16),s=.4+n*.15;e.beginPath(),e.arc(d,p,r,0,Math.PI*2),e.strokeStyle=`rgb(148 163 184 / 15%)`,e.lineWidth=1,e.stroke();for(let n=0;n<o;n++){let i=a*s+n/o*Math.PI*2,c=d+Math.cos(i)*r,l=p+Math.sin(i)*r;e.beginPath(),e.arc(c,l,4,0,Math.PI*2),e.fillStyle=t.color,e.shadowColor=t.color,e.shadowBlur=6,e.fill(),e.shadowBlur=0}});let g=t.reduce((e,t)=>t.value>e.value?t:e,t[0]),_=Math.round(g.value/l*100);e.fillStyle=`#e2e8f0`,e.font=`bold 14px system-ui`,e.textAlign=`center`,e.fillText(`${_}%`,d,p+2),e.font=`10px system-ui`,e.fillStyle=`#94a3b8`,e.fillText(g.label,d,p+16)};return m(),p(),s=(0,c.bindVisibilityPause)(e=>{o=e}),h(),{update(e){n={...n,...e},m(),p()},destroy(){r||(r=!0,cancelAnimationFrame(i),s?.(),l.remove())}}}var $t=`cos-particle-network`,en=800,tn=500;function nn(e,t={}){let n={fill:!1,particleCount:60,linkDistance:120,repelRadius:150,color:`#38bdf8`,hint:`移动鼠标或手指与粒子互动`,...t},r=!1,i=n.width??en,a=n.height??tn,o=0,s=typeof document<`u`?document.hidden:!1,l=(0,c.prefersReducedMotion)(),u=null,d=null,f=null,p=[],m={x:-1e3,y:-1e3},h=document.createElement(`div`);h.className=$t;let g=document.createElement(`canvas`);g.className=`${$t}__canvas`;let _=document.createElement(`p`);_.className=`${$t}__hint`,h.append(g,_),e.appendChild(h);let v=()=>{p.length=0;let e=n.particleCount??60;for(let t=0;t<e;t++)p.push({x:Math.random()*i,y:Math.random()*a,vx:(Math.random()-.5)*1.2,vy:(Math.random()-.5)*1.2,radius:Math.random()*2+1})},y=()=>{(0,c.applyCanvasHostBox)(e,h,{fill:!!n.fill,width:i,height:a}),g.style.width=`${i}px`,g.style.height=`${a}px`,_.textContent=n.hint??``},b=()=>{let e=window.devicePixelRatio||1;g.width=i*e,g.height=a*e;let t=g.getContext(`2d`);return t&&t.setTransform(e,0,0,e,0,0),t},x=()=>{if(u?.(),u=null,!(n.fill??!1)){i=n.width??en,a=n.height??tn,y(),b(),v();return}u=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:en,defaultHeight:tn,measured:e});i=t.width,a=t.height,y(),b(),v()})},S=(e,t)=>{let n=g.getBoundingClientRect();m.x=e-n.left,m.y=t-n.top},C=()=>{m.x=-1e3,m.y=-1e3},w=e=>S(e.clientX,e.clientY),T=e=>{let t=e.touches[0];t&&S(t.clientX,t.clientY)};g.addEventListener(`mousemove`,w),g.addEventListener(`mouseleave`,C),g.addEventListener(`touchmove`,T,{passive:!0}),g.addEventListener(`touchend`,C);let E=e=>{let t=g.getContext(`2d`);if(!t)return;let r=n.color??`#38bdf8`,o=n.linkDistance??120,s=n.repelRadius??150,c=s*s;if(t.fillStyle=`#0f172a`,t.fillRect(0,0,i,a),e)for(let e of p){e.x+=e.vx,e.y+=e.vy,(e.x<0||e.x>i)&&(e.vx*=-1),(e.y<0||e.y>a)&&(e.vy*=-1);let t=m.x-e.x,n=m.y-e.y,r=t*t+n*n;if(r<c&&r>0){let i=Math.sqrt(r);e.vx-=t/i*.15,e.vy-=n/i*.15}}for(let e=0;e<p.length;e++)for(let n=e+1;n<p.length;n++){let i=p[e].x-p[n].x,a=p[e].y-p[n].y,s=i*i+a*a;if(s<o*o){let i=Math.sqrt(s);t.beginPath(),t.moveTo(p[e].x,p[e].y),t.lineTo(p[n].x,p[n].y),t.strokeStyle=r,t.globalAlpha=1-i/o,t.lineWidth=.8,t.stroke(),t.globalAlpha=1}}for(let e of p)t.beginPath(),t.arc(e.x,e.y,e.radius,0,Math.PI*2),t.fillStyle=r,t.fill()},D=()=>{r||(o=requestAnimationFrame(D),!(s||l)&&E(!0))};return d=(0,c.bindVisibilityPause)(e=>{s=e}),f=(0,c.bindPrefersReducedMotion)(e=>{l=e,l&&E(!1)}),x(),v(),l?E(!1):D(),{update(e){let t=n;n={...n,...e},(t.fill!==n.fill||t.width!==n.width||t.height!==n.height)&&x(),l&&E(!1)},destroy(){r||(r=!0,cancelAnimationFrame(o),d?.(),f?.(),u?.(),g.removeEventListener(`mousemove`,w),g.removeEventListener(`mouseleave`,C),g.removeEventListener(`touchmove`,T),g.removeEventListener(`touchend`,C),h.remove())}}}var W=`cos-photo-album`,rn=new Set,an=e=>{if(!e||typeof Image>`u`||rn.has(e))return;rn.add(e);let t=new Image;t.src=e,t.decode?.().catch(()=>{})},on=e=>typeof e==`number`?`${e}px`:e,sn=(e,t)=>Math.max(0,Math.min(Math.floor(e),Math.max(0,t))),cn=(e,t)=>{if(t)for(let[n,r]of Object.entries(t))r!=null&&(n.startsWith(`--`)?e.style.setProperty(n,String(r)):e.style[n]=typeof r==`number`?`${r}px`:String(r))},ln=32,un=4,dn=28,fn=.916,pn={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`},mn=e=>!Number.isFinite(e)||e<=0?16:Math.max(un,Math.min(dn,Math.round(e*fn/ln))),hn=(e,t)=>`${(e+.55)/t*100}%`,gn=`<svg class="${W}__flyleaf-motif" viewBox="0 0 120 120" aria-hidden="true">
|
|
2
|
+
<g fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round">
|
|
3
|
+
<circle cx="60" cy="60" r="46" />
|
|
4
|
+
<path d="M60 14 L106 60 L60 106 L14 60 Z" />
|
|
5
|
+
<circle cx="60" cy="60" r="28" />
|
|
6
|
+
<path d="M60 32 L88 60 L60 88 L32 60 Z" />
|
|
7
|
+
<path d="M60 20 V40 M60 80 V100 M20 60 H40 M80 60 H100" />
|
|
8
|
+
<path d="M34 34 L46 46 M86 34 L74 46 M34 86 L46 74 M86 86 L74 74" />
|
|
9
|
+
<path d="M60 50 L70 60 L60 70 L50 60 Z" />
|
|
10
|
+
<path d="M60 8 L63 14 L60 20 L57 14 Z" />
|
|
11
|
+
<path d="M60 100 L63 106 L60 112 L57 106 Z" />
|
|
12
|
+
<path d="M8 60 L14 63 L20 60 L14 57 Z" />
|
|
13
|
+
<path d="M100 60 L106 63 L112 60 L106 57 Z" />
|
|
14
|
+
</g>
|
|
15
|
+
</svg>`;function _n(e,t={photos:[]}){let n={width:920,height:560,initialIndex:0,pageTurnDuration:760,objectFit:`cover`,showPageNumber:!0,pageColor:`#f2ead8`,coverColor:`#4a3025`,ariaLabel:`Photo album`,...t,photos:Array.isArray(t.photos)?t.photos:[]},r=!1,i=sn(n.initialIndex??0,n.photos.length),a=null,o=typeof n.height==`number`?mn(n.height):16,s=!1,l=0,u=[],d=0,f=0,p=0,m=0,h=document.createElement(`div`),g=document.createElement(`div`);g.className=`${W}__book-shadow`,g.setAttribute(`aria-hidden`,`true`);let _=document.createElement(`div`);_.className=`${W}__stage`,_.setAttribute(`aria-hidden`,`true`);let v=document.createElement(`div`);v.className=`${W}__cover`;let y=document.createElement(`span`);y.className=`${W}__cover-edge-top`;let b=document.createElement(`span`);b.className=`${W}__cover-edge-side`,v.append(y,b);let x=document.createElement(`div`);x.className=`${W}__page-stack-left`;let S=document.createElement(`div`);S.className=`${W}__page-stack-right`,_.append(v,x,S);let C=document.createElement(`div`),w=document.createElement(`div`);w.className=`${W}__book`;let T=document.createElement(`div`);T.className=`${W}__static-page ${W}__left-page`;let E=document.createElement(`div`);E.className=`${W}__static-page ${W}__right-page`,w.append(T,E);let D=document.createElement(`div`);D.className=`${W}__book-gutter`,D.setAttribute(`aria-hidden`,`true`);let O=document.createElement(`div`),k=document.createElement(`button`);k.type=`button`,k.className=`${W}__hit-area ${W}__previous-area`;let A=document.createElement(`button`);A.type=`button`,A.className=`${W}__hit-area ${W}__next-area`;let j=document.createElement(`div`);h.append(g,_,C,w,D,O,k,A),e.appendChild(h);let M=()=>Array.isArray(n.photos)?n.photos:[],N=()=>({previous:n.labels?.previous??pn.previous,next:n.labels?.next??pn.next,empty:n.labels?.empty??pn.empty,flyleafTitle:n.labels?.flyleafTitle??pn.flyleafTitle,flyleafSubtitle:n.labels?.flyleafSubtitle??pn.flyleafSubtitle,flyleafEndTitle:n.labels?.flyleafEndTitle??pn.flyleafEndTitle,flyleafEndSubtitle:n.labels?.flyleafEndSubtitle??pn.flyleafEndSubtitle}),P=()=>Math.max(180,n.pageTurnDuration??760),F=()=>sn(i,M().length),I=()=>{u.forEach(e=>window.cancelAnimationFrame(e)),u.length=0},L=(e,t)=>{let n=document.createElement(`div`);n.className=`${W}__punch-holes ${e===`left`?`${W}__punch-left`:`${W}__punch-right`}`,n.setAttribute(`aria-hidden`,`true`);for(let e=0;e<t;e++){let r=document.createElement(`span`);r.className=`${W}__punch-hole`,r.style.top=hn(e,t),n.appendChild(r)}return n},R=(e,t,n)=>{e.className=t===`back`?`${W}__wire-binding-back`:`${W}__wire-binding-front`,e.setAttribute(`aria-hidden`,`true`),e.replaceChildren();let r=t===`back`?`${W}__wire-ring-back`:`${W}__wire-ring-front`;for(let t=0;t<n;t++){let i=document.createElement(`span`);i.className=r,i.style.top=hn(t,n),e.appendChild(i)}},z=(e,t,r)=>{let i=N(),a=M().length;if(e.replaceChildren(),e.className=`${W}__page-content`,e.style.backgroundColor=n.pageColor??`#f2ead8`,t){let i=document.createElement(`div`);i.className=`${W}__photo-mount`;let o=document.createElement(`img`);if(o.src=t.src,o.alt=t.alt??t.title??``,o.draggable=!1,o.style.objectFit=n.objectFit??`cover`,i.appendChild(o),e.appendChild(i),t.title||t.description){let n=document.createElement(`div`);if(n.className=`${W}__caption`,t.title){let e=document.createElement(`strong`);e.textContent=t.title,n.appendChild(e)}if(t.description){let e=document.createElement(`span`);e.textContent=t.description,n.appendChild(e)}e.appendChild(n)}if(n.showPageNumber!==!1){let t=document.createElement(`span`);t.className=`${W}__page-number`,t.textContent=`${r+1} / ${a}`,e.appendChild(t)}return}let o=r<0,s=document.createElement(`div`);s.className=`${W}__flyleaf`;for(let e of[`${W}__flyleaf-corner ${W}__flyleaf-corner-tl`,`${W}__flyleaf-corner ${W}__flyleaf-corner-tr`,`${W}__flyleaf-corner ${W}__flyleaf-corner-bl`,`${W}__flyleaf-corner ${W}__flyleaf-corner-br`]){let t=document.createElement(`span`);t.className=e,t.setAttribute(`aria-hidden`,`true`),s.appendChild(t)}let c=document.createElement(`div`);c.className=`${W}__flyleaf-inner`;let l=document.createElement(`span`);l.className=`${W}__flyleaf-rule`,l.setAttribute(`aria-hidden`,`true`);let u=document.createElement(`div`);u.innerHTML=gn;let d=document.createElement(`p`);d.className=`${W}__flyleaf-title`,d.textContent=o?i.flyleafTitle:i.flyleafEndTitle;let f=document.createElement(`p`);f.className=`${W}__flyleaf-subtitle`,f.textContent=o?i.flyleafSubtitle:i.flyleafEndSubtitle;let p=document.createElement(`span`);p.className=`${W}__flyleaf-rule`,p.setAttribute(`aria-hidden`,`true`),c.append(l,u.firstElementChild,d,f,p),s.appendChild(c),e.appendChild(s)},B=(e,t,n)=>{e.replaceChildren(),e.appendChild(L(t,o));let r=document.createElement(`div`);r.className=`${W}__gutter-shade`,r.setAttribute(`aria-hidden`,`true`),e.appendChild(r);let i=document.createElement(`div`);z(i,M()[n],n),e.appendChild(i)},V=()=>{let e=F();if(!a)return{left:e-1,right:e};let{fromIndex:t,targetIndex:n,direction:r,phase:i}=a;return i===`cover`?{left:t-1,right:t}:i===`settle`?{left:n-1,right:n}:r===`next`?{left:a.underlaySynced?n-1:t-1,right:n}:{left:n-1,right:a.underlaySynced?n:t}},H=()=>{let e=F();return a?a.direction===`next`?{front:a.fromIndex,back:a.fromIndex+1}:{front:a.targetIndex,back:a.targetIndex+1}:{front:e,back:e+1}},ee=()=>a?a.phase===`settle`?`${W}__turning-page`:a.direction===`next`?`${W}__turning-page ${a.phase===`cover`?`${W}__turn-next-ready`:`${W}__turn-next`}`:`${W}__turning-page ${a.phase===`cover`?`${W}__turn-previous-ready`:`${W}__turn-previous`}`:null,U=null,te=()=>{let e=a;if(!e||s||e.phase===`settle`)return;s=!0;let t=sn(e.targetIndex,M().length),r=l,o=()=>{if(r!==l)return;s=!1;let e=M(),i=e[t]??e[t-1],a=e[t]?t:t-1;i&&a>=0&&(n.onPageChange?.(a,i),n.onIndexChange?.(a,i))},c=e.direction===`next`?`translateZ(0) rotateY(-180deg)`:`translateZ(0) rotateY(0deg)`;U&&(U.style.animation=`none`,U.style.transition=`none`,U.style.willChange=`auto`,U.style.transform=c,U.style.opacity=`1`),i=t,a={...e,phase:`settle`,underlaySynced:!0},I();let d=window.requestAnimationFrame(()=>{let e=window.requestAnimationFrame(()=>{if(r!==l)return;U&&(U.style.visibility=`hidden`);let e=window.requestAnimationFrame(()=>{r===l&&(a=null,U=null,ae(),o())});u.push(e)});u.push(e)});u.push(d),ae()},ne=e=>{if(e.target!==e.currentTarget)return;let t=e.animationName||``;t&&!/turnNext|turnPrevious/i.test(t)||te()},re=()=>{let e=w.querySelector(`.${W}__turning-page`),t=ee();if(!a||!t){e?.remove(),U=null;return}U||(U=document.createElement(`div`),U.setAttribute(`aria-hidden`,`true`),U.addEventListener(`animationend`,ne),w.appendChild(U)),U.className=t;let r=H();U.replaceChildren();let i=document.createElement(`div`);i.className=`${W}__face ${W}__front`;let s=document.createElement(`div`);s.className=`${W}__face-sheet`,s.style.backgroundColor=n.pageColor??`#f2ead8`,s.appendChild(L(`right`,o));let c=document.createElement(`div`);z(c,M()[r.front],r.front),s.appendChild(c),i.appendChild(s);let l=document.createElement(`div`);l.className=`${W}__face ${W}__back`;let u=document.createElement(`div`);u.className=`${W}__face-sheet`,u.style.backgroundColor=n.pageColor??`#f2ead8`,u.appendChild(L(`left`,o));let d=document.createElement(`div`);z(d,M()[r.back],r.back),u.appendChild(d),l.appendChild(u),U.append(i,l)},ie=e=>{if(a||s||M().length<2)return;let t=F(),n=e===`next`?t+2:t-2;if(e===`next`&&t+1>=M().length||e===`previous`&&t<=0)return;s=!1,l+=1,I(),a={direction:e,fromIndex:t,targetIndex:n,phase:`cover`},ae();let i=l;window.cancelAnimationFrame(d),window.cancelAnimationFrame(f),d=window.requestAnimationFrame(()=>{f=window.requestAnimationFrame(()=>{r||i!==l||!a||a.phase!==`cover`||(a={...a,phase:`run`},ae(),window.clearTimeout(p),p=window.setTimeout(()=>{i===l&&te()},P()+120),window.clearTimeout(m),m=window.setTimeout(()=>{i!==l||!a||a.phase!==`run`||a.underlaySynced||(a={...a,underlaySynced:!0},ae())},Math.round(P()*.52)))})})},ae=()=>{let t=M(),r=N(),i=n.width??920,s=n.height??560;if((0,c.applyBlockHostBox)(e,h,{width:typeof i==`number`||typeof i==`string`?i:`100%`,rootFillsHost:!1}),h.style.setProperty(`--album-width`,on(i)),h.style.setProperty(`--album-height`,on(s)),h.style.setProperty(`--album-ratio`,typeof i==`number`&&typeof s==`number`?String(i/s):`1.6429`),h.style.setProperty(`--turn-duration`,`${P()}ms`),h.style.setProperty(`--cover-color`,n.coverColor??`#4a3025`),cn(h,n.style),h.setAttribute(`aria-label`,n.ariaLabel??`Photo album`),t.length===0){h.className=[W,`${W}__empty`,n.className].filter(Boolean).join(` `),h.setAttribute(`role`,`region`),h.tabIndex=-1,w.hidden=!0,k.hidden=!0,A.hidden=!0,j.className=``,j.textContent=r.empty,j.isConnected||h.appendChild(j);return}j.remove(),w.hidden=!1,k.hidden=!1,A.hidden=!1,h.className=[W,n.className].filter(Boolean).join(` `),h.setAttribute(`role`,`region`),h.setAttribute(`aria-roledescription`,`photo album`),h.tabIndex=0,R(C,`back`,o),R(O,`front`,o);let l=V();B(T,`left`,l.left),B(E,`right`,l.right),re();let u=F();k.disabled=u<=0||!!a,k.setAttribute(`aria-label`,r.previous),A.disabled=u+1>=t.length||!!a,A.setAttribute(`aria-label`,r.next);for(let e=-2;e<=2;e+=1)an(t[u+e]?.src)},oe=e=>{e.target===h&&(e.key===`ArrowRight`||e.key===`Enter`||e.key===` `?(e.preventDefault(),ie(`next`)):e.key===`ArrowLeft`&&(e.preventDefault(),ie(`previous`)))};k.addEventListener(`click`,()=>ie(`previous`)),A.addEventListener(`click`,()=>ie(`next`)),h.addEventListener(`keydown`,oe),ae();let se=e=>{let t=mn(e);t!==o&&(o=t,ae())};se(h.getBoundingClientRect().height);let ce=typeof ResizeObserver>`u`?null:new ResizeObserver(e=>{let t=e[0];t&&se(t.contentRect.height)});return ce?.observe(h),{update(e){let t=Array.isArray(e.photos)?e.photos:n.photos;n={...n,...e,photos:t},i=sn(i,M().length),ae()},destroy(){r||(r=!0,I(),window.cancelAnimationFrame(d),window.cancelAnimationFrame(f),window.clearTimeout(p),window.clearTimeout(m),ce?.disconnect(),U?.removeEventListener(`animationend`,ne),k.removeEventListener(`click`,()=>ie(`previous`)),A.removeEventListener(`click`,()=>ie(`next`)),h.removeEventListener(`keydown`,oe),h.remove())}}}var vn=`cos-photo-carousel`,yn=(e,t)=>{if(t)for(let[n,r]of Object.entries(t))r!=null&&(n.startsWith(`--`)?e.style.setProperty(n,String(r)):e.style[n]=typeof r==`number`?`${r}px`:String(r))},bn=(e,t)=>t<=0?0:(e%t+t)%t,xn=(e,t,n)=>n<=0?0:bn(Math.round(e/t),n);function Sn(e,t={photos:[]}){let n={width:420,height:360,radius:180,cardWidth:120,cardHeight:160,autoRotate:!0,autoRotateSpeed:12,dragSensitivity:.35,friction:2.2,showCaption:!1,initialAngle:0,ariaLabel:`Photo carousel`,...t,photos:Array.isArray(t.photos)?t.photos:[]},r=!1,i=n.initialAngle??0,a=0,o=!1,s=null,l=0,u=0,d=!1,f=0,p=0,m=0,h=document.createElement(`div`),g=document.createElement(`div`);g.className=`${vn}__perspective`;let _=document.createElement(`div`);_.className=`${vn}__scene`;let v=document.createElement(`div`);v.className=`${vn}__ring`;let y=document.createElement(`div`);y.className=`${vn}__caption`;let b=document.createElement(`div`);b.className=`${vn}__empty`,b.textContent=`暂无照片`,_.appendChild(v),g.appendChild(_),h.append(g,y,b),e.appendChild(h);let x=()=>Array.isArray(n.photos)?n.photos:[],S=()=>x().length,C=()=>S()>0?360/S():360,w=e=>{i=e,v.style.transform=`rotateY(${-e}deg)`;let t=xn(e,C(),S());if(t!==p){p=t,T(),E();let e=x()[t];n.onFaceChange?.(t,e),e&&n.onIndexChange?.(t,e)}},T=()=>{let e=x(),t=e.length,r=C(),i=n.radius??180,a=n.cardWidth??120,o=n.cardHeight??160;v.style.width=`${a}px`,v.style.height=`${o}px`,v.querySelectorAll(`.${vn}__card`).length!==t&&(v.replaceChildren(),e.forEach(()=>{let e=document.createElement(`div`),t=document.createElement(`div`);t.className=`${vn}__frame`;let n=document.createElement(`div`);n.className=`${vn}__image-wrap`;let r=document.createElement(`img`);r.className=`${vn}__image`,r.draggable=!1,n.appendChild(r),t.appendChild(n),e.appendChild(t),v.appendChild(e)})),Array.from(v.children).forEach((t,n)=>{let s=e[n],c=n===p;t.className=`${vn}__card ${c?`${vn}__card-front`:`${vn}__card-back`}`,t.style.setProperty(`--card-width`,`${a}px`),t.style.setProperty(`--card-height`,`${o}px`),t.style.transform=`rotateY(${n*r}deg) translateZ(${i}px)`,t.setAttribute(`aria-hidden`,c?`false`:`true`);let l=t.querySelector(`img`);l&&s&&(l.src=s.src,l.alt=s.alt??s.title??`Photo ${n+1}`)})},E=()=>{let e=x()[p],t=!!(n.showCaption&&e&&(e.title||e.description));if(y.hidden=!t,!t||!e){y.replaceChildren();return}if(y.replaceChildren(),e.title){let t=document.createElement(`p`);t.className=`${vn}__caption-title`,t.textContent=e.title,y.appendChild(t)}if(e.description){let t=document.createElement(`p`);t.className=`${vn}__caption-desc`,t.textContent=e.description,y.appendChild(t)}},D=()=>{let t=S();h.className=[vn,n.className].filter(Boolean).join(` `),(0,c.applyBlockHostBox)(e,h,{width:n.width??420,height:n.height??360}),yn(h,n.style),h.setAttribute(`aria-label`,n.ariaLabel??`Photo carousel`),t===0?(h.setAttribute(`role`,`img`),h.removeAttribute(`aria-roledescription`),h.tabIndex=-1,(0,c.setHidden)(b,!1),(0,c.setHidden)(g,!0),(0,c.setHidden)(y,!0)):(h.setAttribute(`role`,`region`),h.setAttribute(`aria-roledescription`,`carousel`),h.tabIndex=0,(0,c.setHidden)(b,!0),(0,c.setHidden)(g,!1))},O=e=>{S()<=0||e.button!==0||(o=!0,d=!1,s=e.pointerId,f=e.clientX,l=e.clientX,u=performance.now(),a=0,g.setPointerCapture(e.pointerId))},k=e=>{if(!o||s!==e.pointerId)return;let t=performance.now(),r=e.clientX-l,c=Math.max(.008,(t-u)/1e3);l=e.clientX,u=t,Math.abs(e.clientX-f)>6&&(d=!0);let p=-r*(n.dragSensitivity??.35);a=p/c,w(i+p)},A=e=>{if(s===e.pointerId){o=!1,s=null,a=Math.max(-720,Math.min(720,a));try{g.releasePointerCapture(e.pointerId)}catch{}}},j=e=>{let t=!d;if(A(e),t){let e=x()[p];e&&n.onPhotoClick?.(p,e)}},M=e=>{a=0,A(e)},N=e=>{if(m=requestAnimationFrame(N),r||o){P=e;return}if(P==null){P=e;return}let t=Math.min(.05,(e-P)/1e3);P=e;let s=i,c=a,l=!1;Math.abs(c)>.01?(s+=c*t,c*=Math.exp(-(n.friction??2.2)*t),Math.abs(c)<.02&&(c=0),a=c,l=!0):n.autoRotate!==!1&&(s+=(n.autoRotateSpeed??12)*t,l=!0),l&&w(s)},P=null;return g.addEventListener(`pointerdown`,O),g.addEventListener(`pointermove`,k),g.addEventListener(`pointerup`,j),g.addEventListener(`pointercancel`,M),p=xn(i,C(),S()),D(),T(),E(),v.style.transform=`rotateY(${-i}deg)`,m=requestAnimationFrame(N),{update(e){let t=S(),r=n.initialAngle;n={...n,...e,photos:Array.isArray(e.photos)?e.photos:n.photos},D(),(S()!==t||e.initialAngle!==void 0&&e.initialAngle!==r)&&(i=n.initialAngle??0,a=0,p=xn(i,C(),S())),T(),E(),w(i)},destroy(){r||(r=!0,cancelAnimationFrame(m),g.removeEventListener(`pointerdown`,O),g.removeEventListener(`pointermove`,k),g.removeEventListener(`pointerup`,j),g.removeEventListener(`pointercancel`,M),h.remove())}}}var Cn=1e3/120,wn=Cn/1e3,Tn=.42,En=3800,Dn=2600,On=2900,kn=.05,G=(e,t,n)=>Math.min(n,Math.max(t,e)),An=e=>{let t=Math.sin(e*127.1+31.7)*43758.5453;return t-Math.floor(t)},jn=(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+An(t*5.13)*.2));let _=e=>{let t=p>0?G(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((An(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}},Nn=({bandLength:e,damping:t,maxPull:n,stiffness:r,tension:i})=>{let a=420*G(r,.1,3),o=G(t,.02,1),s=Math.max(8,e);return{bandLength:s,segLength:s/5,gravityAccel:On,chainKeep:Math.exp(-(.6+o*6)*wn),swingDamp:2*G(.28+o,.1,1)*Math.sqrt(165),spinDamp:2*G(.35+o,.1,1.2)*Math.sqrt(60),bandK:a*.9,bandRecover:11,springK:a,springC:2*G(.45+o,.1,1.2)*Math.sqrt(a),neighborK:a*G(i,0,1),maxPull:Math.max(16,n)}},Pn=(e,t,n,r)=>({x:e?.pinXs[n]??0,y:(e?.anchorYs[n]??0)+(t?.segLength??0)*r}),Fn=(e,t,n)=>Array.from({length:6},(r,i)=>{let a=Pn(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}}),In=(e,t,n)=>{let r=e.baseRots[n]??0;return{chain:Fn(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}},Ln=(e,t,n,r)=>{e.chain.forEach((e,i)=>{let a=Pn(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},Rn=(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},zn=(e,t)=>{for(;e.length<t;)e.push({x:0,y:0});return e},Bn=(e,t)=>({min:Math.min(0,e-t),max:0}),Vn=(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=zn(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=Rn(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=zn(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=Rn(d,u.length);if(f!==n.rope){n.rope=f;for(let e of t.ropePaths)e?.setAttribute(`d`,f)}},Hn=(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,jn(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=G(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=G(-t.swayVx*kn,-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=G(t.ropeY+t.ropeVy*n,-r.maxPull,r.maxPull*1.2)}if(o?.mode===`pan`)return;let{min:l,max:u}=Bn(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=G(e.offset,l,u))},Un=(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}=Bn(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=Pn(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})})},Wn=e=>{e.nodes.forEach((t,n)=>{Ln(t,e.layout,e.physics,n)}),e.offsetVelocity=0},Gn=`cos-photo-clothesline`,Kn=(e,t)=>{if(t)for(let[n,r]of Object.entries(t))r!=null&&(n.startsWith(`--`)?e.style.setProperty(n,String(r)):e.style[n]=typeof r==`number`?`${r}px`:String(r))};function qn(e,t={photos:[]}){let n={width:`100%`,height:480,photoWidth:150,photoHeight:200,photoGap:46,ropeTop:66,ropeSag:26,bandLength:34,bandWidth:5,maxPull:110,stiffness:1,damping:.16,tension:.35,tilt:5,ropeColor:`#8d7a5c`,pinColor:`#d8a761`,frameColor:`#fffdf7`,objectFit:`cover`,showCaption:!0,initialIndex:0,ariaLabel:`Photo clothesline`,...t,photos:Array.isArray(t.photos)?t.photos:[]},r=!1,i={width:0,height:0},a=!1,o=n.initialIndex??0,s=n.initialIndex??0,l=null,u=0,d=0,f={bands:[],cards:[],rope:``,rail:``},p={nodes:[],layout:null,physics:null,offset:0,offsetVelocity:0,snapTarget:null,drag:null,impulse:null,buffer:[]},m=`http://www.w3.org/2000/svg`,h=document.createElement(`div`);h.setAttribute(`role`,`region`);let g=document.createElement(`div`),_=document.createElement(`div`);_.className=`${Gn}__rail`;let v=document.createElementNS(m,`svg`);v.classList.add(`${Gn}__strings`),v.setAttribute(`aria-hidden`,`true`);let y=[];for(let e of[`${Gn}__rope-shadow`,`${Gn}__rope-shadow-core`,`${Gn}__rope-body`,`${Gn}__rope-twist`]){let t=document.createElementNS(m,`path`);t.setAttribute(`class`,e),v.appendChild(t),y.push(t)}let b=[],x=[],S=[],C=[];_.appendChild(v),g.appendChild(_),h.appendChild(g),e.appendChild(h);let w=()=>Array.isArray(n.photos)?n.photos:[],T=()=>Mn({count:w().length,viewportWidth:i.width,viewportHeight:i.height,photoWidth:n.photoWidth??150,photoHeight:n.photoHeight??200,photoGap:n.photoGap??46,ropeTop:n.ropeTop??66,ropeSag:n.ropeSag??26,bandLength:n.bandLength??34,maxPull:n.maxPull??110,tilt:n.tilt??5}),E=()=>Nn({bandLength:n.bandLength??34,damping:n.damping??.16,maxPull:n.maxPull??110,stiffness:n.stiffness??1,tension:n.tension??.35}),D=()=>g.clientWidth||i.width,O=()=>({rail:_,ropePaths:y,bandPaths:b,bandGloss:x,knots:S,cards:C}),k=(e,t)=>{Vn(p,O(),f,e,t)},A=()=>{l!==null||typeof window>`u`||(u=0,d=0,l=window.requestAnimationFrame(j))},j=e=>{l=null;let t=u||e;u=e;let r=Math.min(e-t,64);d+=r;let i=D(),a=0;for(;d>=8.333333333333334&&a<12;)Hn(p,i,wn),d-=Cn,a+=1;if(a>=12&&(d=0),Un(p,i)){Wn(p),k(1,0),u=0,d=0;let e=p.layout?.centers;if(e&&e.length>0){let t=i/2-p.offset,r=0,a=1/0;for(let n=0;n<e.length;n++){let i=Math.abs(e[n]-t);i<a&&(a=i,r=n)}if(r!==s){s=r;let e=w()[r];e&&n.onIndexChange?.(r,e)}}return}k(d/Cn,r/1e3),l=window.requestAnimationFrame(j)},M=e=>{let t=D(),n=p.layout?.centers[G(e,0,Math.max(0,w().length-1))];if(n===void 0)return 0;let{min:r,max:i}=Bn(t,p.layout?.railWidth??0);return G(t/2-n,r,i)},N=(e,t)=>{let r=p.layout;if(!r)return;let i=n.photoWidth??150,a=n.photoHeight??200;e.style.left=`${r.cardLefts[t]}px`,e.style.top=`${r.cardTops[t]}px`,e.style.width=`${i}px`,e.style.height=`${a}px`,e.style.transform=`translate3d(0, 0, 0) rotate(${r.baseRots[t]}deg)`,e.style.setProperty(`--pin-x`,`${r.pinOffsets[t]}px`),e.style.setProperty(`--pin-grip`,`-13px`)},P=()=>{let e=w(),t=T(),r=E();for(p.layout=t,p.physics=r,p.nodes=Array.from({length:e.length},(e,n)=>In(t,r,n)),f.rope=``,f.rail=``,f.bands=[],f.cards=[],v.setAttribute(`width`,String(t.railWidth)),v.setAttribute(`height`,String(t.stageHeight)),v.setAttribute(`viewBox`,`0 0 ${t.railWidth} ${t.stageHeight}`),_.style.width=`${t.railWidth}px`;v.childNodes.length>4;)v.removeChild(v.lastChild);b.length=0,x.length=0,S.length=0,e.forEach(()=>{let e=document.createElementNS(m,`g`),t=document.createElementNS(m,`path`);t.setAttribute(`class`,`${Gn}__band-body`);let n=document.createElementNS(m,`path`);n.setAttribute(`class`,`${Gn}__band-gloss`);let r=document.createElementNS(m,`circle`);r.setAttribute(`class`,`${Gn}__band-knot`),r.setAttribute(`r`,`4.2`),e.append(t,n,r),v.appendChild(e),b.push(t),x.push(n),S.push(r)}),C.forEach(e=>e.remove()),C.length=0;let a=!!(n.showCaption&&e.some(e=>e.title||e.description)),o=!!n.onPhotoClick;e.forEach((e,t)=>{let r=document.createElement(`div`);r.className=`${Gn}__hanger`,r.dataset.photoIndex=String(t),r.tabIndex=0,r.setAttribute(`role`,o?`button`:`group`),(e.title??e.alt)&&r.setAttribute(`aria-label`,e.title??e.alt??``),N(r,t);let i=document.createElement(`span`);i.className=`${Gn}__pin`,i.setAttribute(`aria-hidden`,`true`);let s=document.createElement(`span`);s.className=`${Gn}__pin-spring`,i.appendChild(s);let c=document.createElement(`figure`);c.className=`${Gn}__frame`;let l=document.createElement(`span`);l.className=`${Gn}__photo`;let u=document.createElement(`img`);if(u.src=e.src,u.alt=e.alt??e.title??``,u.draggable=!1,u.style.objectFit=n.objectFit||`cover`,l.appendChild(u),c.appendChild(l),a){let t=document.createElement(`figcaption`);if(t.className=`${Gn}__caption`,e.title){let n=document.createElement(`strong`);n.textContent=e.title,t.appendChild(n)}if(e.description){let n=document.createElement(`span`);n.textContent=e.description,t.appendChild(n)}c.appendChild(t)}r.append(i,c),_.appendChild(r),C[t]=r}),g.className=`${Gn}__viewport${Math.min(0,i.width-t.railWidth)<-.5?` ${Gn}__pannable`:``}`},F=()=>{h.className=`${Gn} ${n.className??``}`.trim(),(0,c.applyBlockHostBox)(e,h,{width:n.width??`100%`,height:n.height??480}),h.style.setProperty(`--rope-color`,n.ropeColor??`#8d7a5c`),h.style.setProperty(`--band-color`,n.bandColor??n.ropeColor??`#8d7a5c`),h.style.setProperty(`--band-width`,`${Math.max(1,n.bandWidth??5)}px`),h.style.setProperty(`--pin-color`,n.pinColor??`#d8a761`),h.style.setProperty(`--frame-color`,n.frameColor??`#fffdf7`),n.background&&h.style.setProperty(`--clothesline-bg`,n.background),Kn(h,n.style),h.setAttribute(`aria-label`,n.ariaLabel??`Photo clothesline`)},I=()=>{if(i.width<=0)return;if(!a){a=!0,o=n.initialIndex??0,p.offset=M(o),k(1,0);return}if(o!==(n.initialIndex??0)){o=n.initialIndex??0,p.snapTarget=M(o),A();return}let{min:e,max:t}=Bn(D(),p.layout?.railWidth??0);p.offset=G(p.offset,e,t),k(1,0)},L=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=g.getBoundingClientRect(),a=e.clientX-i.left-p.offset,o=e.clientY-i.top,s=r>=0?p.nodes[r]:void 0,c=s?.chain[s.chain.length-1];p.snapTarget=null,p.offsetVelocity=0,p.drag={pointerId:e.pointerId,mode:c?`photo`:`pan`,photoIndex:r,grabDx:c?a-c.x:0,grabDy:c?o-c.y:0,pointerX:a,pointerY:o,smoothX:a,smoothY:o,rectLeft:i.left,rectTop:i.top,startX:e.clientX,startY:e.clientY,startOffset:p.offset,lastX:e.clientX,lastY:e.clientY,lastTime:e.timeStamp,vx:0,vy:0,moved:0},g.setPointerCapture(e.pointerId),A()},R=e=>{let t=p.drag;if(!t||t.pointerId!==e.pointerId)return;let n=e.clientX-t.startX,r=e.clientY-t.startY;t.moved=Math.max(t.moved,Math.hypot(n,r));let i=Math.max(e.timeStamp-t.lastTime,1)/1e3;if(t.vx=.7*((e.clientX-t.lastX)/i)+.3*t.vx,t.vy=.7*((e.clientY-t.lastY)/i)+.3*t.vy,t.lastX=e.clientX,t.lastY=e.clientY,t.lastTime=e.timeStamp,t.mode===`pan`){let{min:e,max:r}=Bn(D(),p.layout?.railWidth??0),i=t.startOffset+n;p.offset=i-(i>r?i-r:i<e?i-e:0)*(1-Tn),A();return}t.pointerX=e.clientX-t.rectLeft-p.offset,t.pointerY=e.clientY-t.rectTop,A()},z=e=>{let t=p.drag;if(!(!t||t.pointerId!==e.pointerId)){if(p.drag=null,g.hasPointerCapture(e.pointerId)&&g.releasePointerCapture(e.pointerId),t.mode===`pan`)p.offsetVelocity=G(t.vx,-En,En);else if(t.moved<=4&&t.photoIndex>=0){let e=w()[t.photoIndex];e&&n.onPhotoClick?.(t.photoIndex,e)}else t.photoIndex>=0&&(p.impulse={index:t.photoIndex,vx:G(t.vx,-Dn,Dn),vy:G(t.vy,-Dn,Dn)});A()}},B=e=>{let t=p.drag;!t||t.pointerId!==e.pointerId||(p.drag=null,A())},V=e=>{let t=Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.shiftKey?e.deltaY:0;if(t===0)return;let{min:n,max:r}=Bn(D(),p.layout?.railWidth??0);n>=r||(e.preventDefault(),p.snapTarget=null,p.offsetVelocity=0,p.offset=G(p.offset-t,n,r),A())},H=e=>{let t=e.target?.closest?.(`[data-photo-index]`),r=t?Number(t.dataset.photoIndex):-1;if(e.key===`ArrowRight`||e.key===`ArrowLeft`){let{min:t,max:r}=Bn(D(),p.layout?.railWidth??0);if(t>=r)return;e.preventDefault();let i=(n.photoWidth??150)+(n.photoGap??46);p.snapTarget=G((p.snapTarget??p.offset)+(e.key===`ArrowLeft`?i:-i),t,r),A();return}if(!(r<0)){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),p.impulse={index:r,vx:0,vy:e.key===`ArrowDown`?1500:-1e3},A();return}if(e.key===`Enter`||e.key===` `){let t=w()[r];if(!t||!n.onPhotoClick)return;e.preventDefault(),n.onPhotoClick(r,t)}}},ee=(e,t)=>{i.width===e&&i.height===t||(i={width:e,height:t},P(),I())};F(),P(),ee(g.clientWidth,g.clientHeight),requestAnimationFrame(()=>{r||ee(g.clientWidth,g.clientHeight)});let U=typeof ResizeObserver>`u`?null:new ResizeObserver(e=>{let t=e[0];t&&ee(Math.round(t.contentRect.width),Math.round(t.contentRect.height))});return U?.observe(g),g.addEventListener(`pointerdown`,L),g.addEventListener(`pointermove`,R),g.addEventListener(`pointerup`,z),g.addEventListener(`pointercancel`,B),g.addEventListener(`wheel`,V,{passive:!1}),g.addEventListener(`keydown`,H),{update(e){let t=n.photos;n={...n,...e},F(),P(),n.photos!==t&&(a=!1),I()},destroy(){r||(r=!0,l!==null&&window.cancelAnimationFrame(l),l=null,U?.disconnect(),g.removeEventListener(`pointerdown`,L),g.removeEventListener(`pointermove`,R),g.removeEventListener(`pointerup`,z),g.removeEventListener(`pointercancel`,B),g.removeEventListener(`wheel`,V),g.removeEventListener(`keydown`,H),h.remove())}}}var Jn=`cos-photo-filmstrip`,Yn=6,Xn=8,Zn=2600,Qn=14,$n=(e,t,n)=>Math.min(n,Math.max(t,e)),er=e=>String(e+1).padStart(2,`0`),tr=(e,t)=>{if(t)for(let[n,r]of Object.entries(t))r!=null&&(n.startsWith(`--`)?e.style.setProperty(n,String(r)):e.style[n]=typeof r==`number`?`${r}px`:String(r))};function nr(e,t={photos:[]}){let n={width:`100%`,height:280,frameWidth:160,frameHeight:120,frameGap:14,showCaption:!0,friction:2.8,dragSensitivity:1,initialIndex:0,ariaLabel:`Photo filmstrip`,...t,photos:Array.isArray(t.photos)?t.photos:[]},r=!1,i=0,a=n.initialIndex??0,o=!1,s=n.initialIndex??0,l=null,u=0,d={offset:0,velocity:0,drag:null,snapTarget:null},f=document.createElement(`div`),p=document.createElement(`div`);p.className=`${Jn}__sprocket-band`,p.setAttribute(`aria-hidden`,`true`);let m=document.createElement(`div`);m.className=`${Jn}__viewport`;let h=document.createElement(`div`);h.className=`${Jn}__strip`;let g=document.createElement(`div`);g.className=`${Jn}__empty`,g.textContent=`No photos`;let _=document.createElement(`div`);_.className=`${Jn}__sprocket-band ${Jn}__sprocket-band-bottom`,_.setAttribute(`aria-hidden`,`true`),m.append(h,g),f.append(p,m,_),e.appendChild(f);let v=()=>Array.isArray(n.photos)?n.photos:[],y=()=>v().length,b=()=>(n.frameWidth??160)+(n.frameGap??14),x=()=>i>0?i/2-(n.frameWidth??160)/2:0,S=()=>{let e=y();if(e<=0)return 0;let t=n.frameWidth??160,r=n.frameGap??14;return x()*2+e*t+Math.max(0,e-1)*r},C=e=>{let t=y();if(i<=0||t<=0)return 0;let r=n.frameWidth??160,a=$n(Math.floor(e),0,t-1),o=x()+a*b()+r/2;return i/2-o},w=e=>{let t=y();if(t<=0||i<=0)return 0;let r=n.frameWidth??160,a=(i/2-e-x()-r/2)/b();return $n(Math.round(a),0,t-1)},T=()=>{let e=y();return e<=0?{min:0,max:0}:{min:C(e-1),max:C(0)}},E=e=>{h.style.transform=`translate3d(${e}px, 0, 0)`},D=e=>{if(e===a)return;a=e;let t=v()[e];O(),t&&n.onIndexChange?.(e,t)},O=()=>{let e=v()[a],t=n.showCaption&&e?.title?`,当前:${e.title}${e.description?`,${e.description}`:``}`:``;f.setAttribute(`aria-label`,(n.ariaLabel??`Photo filmstrip`)+t)},k=()=>{l!==null&&(window.cancelAnimationFrame(l),l=null),u=0},A=()=>{if(l!==null||r)return;let e=t=>{l=null;let i=u||t;u=t;let a=Math.min(.05,(t-i)/1e3),{min:o,max:s}=T(),c=!1;if(d.drag)E(d.offset),c=!0;else if(d.snapTarget!==null){let e=d.snapTarget-d.offset;Math.abs(e)<=.35?(d.offset=d.snapTarget,d.snapTarget=null,d.velocity=0,D(w(d.offset)),E(d.offset)):(d.offset+=e*Math.min(1,Qn*a),d.velocity=0,E(d.offset),c=!0)}else{let e=d.velocity;if(Math.abs(e)>Xn)e*=Math.exp(-(n.friction??2.8)*a),Math.abs(e)<=Xn&&(e=0),d.velocity=e,d.offset+=e*a,(d.offset<o||d.offset>s)&&(d.offset=$n(d.offset,o,s),d.velocity=0),E(d.offset),c=!0;else{d.velocity=0;let e=C(w(d.offset));Math.abs(d.offset-e)>.35?(d.snapTarget=e,c=!0):(d.offset=e,D(w(d.offset)),E(d.offset))}}c&&!r?l=window.requestAnimationFrame(e):u=0};l=window.requestAnimationFrame(e)},j=()=>{let e=v(),t=e.length,r=n.frameWidth??160,i=n.frameHeight??120,a=n.frameGap??14,o=!!(n.showCaption&&e.some(e=>e.title||e.description));h.replaceChildren(),e.forEach((e,n)=>{let s=document.createElement(`div`);s.className=`${Jn}__frame-cell`,s.style.width=`${r}px`,s.style.marginRight=n<t-1?`${a}px`:`0`,s.dataset.photoIndex=String(n);let c=document.createElement(`span`);c.className=`${Jn}__frame-number`,c.textContent=er(n);let l=document.createElement(`div`);l.className=`${Jn}__frame-window`,l.style.width=`${r}px`,l.style.height=`${i}px`;let u=document.createElement(`img`);if(u.src=e.src,u.alt=e.alt??e.title??``,u.draggable=!1,l.appendChild(u),s.append(c,l),o&&(e.title||e.description)){let t=document.createElement(`div`);if(t.className=`${Jn}__caption`,e.title){let n=document.createElement(`strong`);n.textContent=e.title,t.appendChild(n)}if(e.description){let n=document.createElement(`span`);n.textContent=e.description,t.appendChild(n)}s.appendChild(t)}h.appendChild(s)});let s=x();h.style.minWidth=`${S()}px`,h.style.paddingLeft=`${s}px`,h.style.paddingRight=`${s}px`,h.style.boxSizing=`border-box`,(0,c.setHidden)(g,t>0),h.hidden=t===0},M=()=>{f.className=[Jn,n.className].filter(Boolean).join(` `),(0,c.applyBlockHostBox)(e,f,{width:n.width??`100%`,height:n.height??280}),tr(f,n.style),f.setAttribute(`role`,`region`),f.tabIndex=y()>0?0:-1,O()},N=()=>{let e=y();if(i<=0||e<=0)return;if(!o){o=!0,s=n.initialIndex??0,d.offset=C(s),d.velocity=0,d.snapTarget=null,d.drag=null,a=$n(s,0,e-1),E(d.offset),O();return}if(s!==(n.initialIndex??0)){s=n.initialIndex??0,d.velocity=0,d.drag=null,d.snapTarget=C(s),A();return}let{min:t,max:r}=T();d.offset=$n(d.offset,t,r),E(d.offset)},P=e=>{let t=d.drag;if(!t||t.pointerId!==e.pointerId)return;d.drag=null,m.hasPointerCapture(e.pointerId)&&m.releasePointerCapture(e.pointerId);let r=Math.max(.008,(e.timeStamp-t.lastTime)/1e3);if(d.velocity=$n((e.clientX-t.lastX)/r*(n.dragSensitivity??1),-2600,Zn),d.snapTarget=null,t.moved<=Yn){d.velocity=0;let e=w(d.offset),t=v()[e];t&&n.onPhotoClick?.(e,t),d.snapTarget=C(e)}A()},F=e=>{e.button!==0&&e.pointerType===`mouse`||y()<=0||(d.drag={pointerId:e.pointerId,startX:e.clientX,startOffset:d.offset,lastX:e.clientX,lastTime:e.timeStamp,vx:0,moved:0},d.velocity=0,d.snapTarget=null,m.setPointerCapture(e.pointerId),A())},I=e=>{let t=d.drag;if(!t||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;t.moved=Math.max(t.moved,Math.abs(r));let i=Math.max(e.timeStamp-t.lastTime,1)/1e3;t.vx=.7*((e.clientX-t.lastX)/i)+.3*t.vx,t.lastX=e.clientX,t.lastTime=e.timeStamp;let{min:a,max:o}=T();d.offset=$n(t.startOffset+r*(n.dragSensitivity??1),a,o),E(d.offset),A()},L=e=>{if(y()<=0||e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=e.key===`ArrowLeft`?b():-b(),{min:n,max:r}=T(),i=d.snapTarget??d.offset;d.velocity=0,d.drag=null,d.snapTarget=$n(i+t,n,r),A()},R=e=>{i!==e&&(i=e,j(),N())};m.addEventListener(`pointerdown`,F),m.addEventListener(`pointermove`,I),m.addEventListener(`pointerup`,P),m.addEventListener(`pointercancel`,P),f.addEventListener(`keydown`,L),M(),j(),R(m.clientWidth),requestAnimationFrame(()=>{r||R(m.clientWidth)});let z=typeof ResizeObserver>`u`?null:new ResizeObserver(e=>{let t=e[0];t&&R(Math.round(t.contentRect.width))});return z?.observe(m),{update(e){let t=n.photos,r=n.initialIndex;n={...n,...e,photos:Array.isArray(e.photos)?e.photos:n.photos},M(),e.photos&&e.photos!==t?(o=!1,j()):(e.frameWidth!==void 0||e.frameHeight!==void 0||e.frameGap!==void 0||e.showCaption!==void 0)&&j(),e.initialIndex!==void 0&&e.initialIndex!==r&&(s=-1),N()},destroy(){r||(r=!0,k(),z?.disconnect(),m.removeEventListener(`pointerdown`,F),m.removeEventListener(`pointermove`,I),m.removeEventListener(`pointerup`,P),m.removeEventListener(`pointercancel`,P),f.removeEventListener(`keydown`,L),f.remove())}}}var rr=`cos-photo-fridge`,ir=6,ar=1200,or=.08,sr=1.05,K=10,cr=32,lr=.24,ur=[`magnet-red`,`magnet-blue`,`magnet-green`,`magnet-yellow`],dr=(e,t,n)=>Math.min(n,Math.max(t,e)),fr=e=>{let t=Math.sin(e*127.1+31.7)*43758.5453;return t-Math.floor(t)},pr=(e,t)=>{if(t)for(let[n,r]of Object.entries(t))r!=null&&(n.startsWith(`--`)?e.style.setProperty(n,String(r)):e.style[n]=typeof r==`number`?`${r}px`:String(r))},mr=(e,t,n,r,i,a)=>{if(e<=0||t<=0||n<=0)return[];let o=Math.max(K,t-r-K-cr),s=Math.max(K,n-i-K),c=Math.max(0,o-K)*.55*a,l=Math.max(0,s-K)*.5*a,u=K+(o-K)*.5-r*.5,d=K+(s-K)*.5-i*.5;return Array.from({length:e},(t,n)=>{let r=e<=1?.5:n/(e-1);return{x:dr(u+(r-.5)*c*1.4+(fr(n*7.13+2.1)*2-1)*c*.45,K,o),y:dr(d+Math.sin(r*Math.PI*1.2)*l*.35+(fr(n*11.37+5.9)*2-1)*l*.42,K,s),rot:(fr(n*3.71+1.4)*2-1)*12*a}})},hr=(e,t,n,r,i)=>{e.x=dr(e.x,K,Math.max(K,r-t-K-cr)),e.y=dr(e.y,K,Math.max(K,i-n-K))};function gr(e,t={photos:[]}){let n={width:`100%`,height:480,cardWidth:120,cardHeight:140,scatter:1,friction:2,showCaption:!0,initialIndex:0,ariaLabel:`冰箱磁贴照片墙`,...t,photos:Array.isArray(t.photos)?t.photos:[]},r=!1,i={width:0,height:0},a=null,o=-1,s=null,l=0,u=[],d=[],f=0,p=null,m=[],h=document.createElement(`div`),g=document.createElement(`div`);g.className=`${rr}__handle`,g.setAttribute(`aria-hidden`,`true`);let _=document.createElement(`div`);_.className=`${rr}__stage`;let v=document.createElement(`div`);v.className=`${rr}__empty`,v.textContent=`暂无照片`,_.appendChild(v),h.append(g,_),e.appendChild(h);let y=()=>Array.isArray(n.photos)?n.photos:[],b=()=>y().length,x=()=>dr(n.scatter??1,0,2.5),S=e=>{let t=m[e],n=u[e];if(!t||!n)return;let r=a===e?sr:1;t.style.zIndex=String(d[e]??e),t.style.transform=`translate3d(${n.x}px, ${n.y}px, 0) rotate(${n.rot}deg) scale(${r})`,t.className=`${rr}__card${a===e?` ${rr}__card-dragging`:``}`},C=()=>{let e=n.cardWidth??120,t=n.cardHeight??140,r=mr(b(),i.width,i.height,e,t,x());u.length=0,d.length=0,r.forEach((e,t)=>{u.push({x:e.x,y:e.y,rot:e.rot,vx:0,vy:0,vRot:0}),d[t]=t}),f=Math.max(b()-1,0);let a=dr(Math.floor(n.initialIndex??0),0,Math.max(0,b()-1));b()>0&&(f+=1,d[a]=f),u.forEach(n=>hr(n,e,t,i.width,i.height)),o=b(),u.forEach((e,t)=>S(t))},w=e=>{let t=l?Math.min((e-l)/1e3,.032):.016;l=e;let o=n.cardWidth??120,c=n.cardHeight??140,d=Math.exp(-(n.friction??2)*t*60),f=!1;for(let e=0;e<u.length;e++){if(a===e)continue;let n=u[e];n.x+=n.vx*t,n.y+=n.vy*t,n.rot+=n.vRot*t,n.vx*=d,n.vy*=d,n.vRot*=d,hr(n,o,c,i.width,i.height),Math.abs(n.vx)>or||Math.abs(n.vy)>or||Math.abs(n.vRot)>or*.3?f=!0:(n.vx=0,n.vy=0,n.vRot=0),S(e)}s=f&&!r?requestAnimationFrame(w):null},T=()=>{s===null&&(l=0,s=requestAnimationFrame(w))},E=e=>{f+=1,d[e]=f,S(e)},D=e=>t=>{if(t.button!==0)return;let n=u[e];if(!n)return;let r=_.getBoundingClientRect();t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),E(e),a=e,S(e),p={pointerId:t.pointerId,index:e,grabDx:t.clientX-r.left-n.x,grabDy:t.clientY-r.top-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},O=e=>{if(!p||p.pointerId!==e.pointerId)return;let t=_.getBoundingClientRect(),r=e.clientX-p.startX,a=e.clientY-p.startY;p.moved=Math.max(p.moved,Math.hypot(r,a));let o=Math.max(e.timeStamp-p.lastTime,1)/1e3;p.vx=dr(.65*((e.clientX-p.lastX)/o)+.35*p.vx,-1200,ar),p.vy=dr(.65*((e.clientY-p.lastY)/o)+.35*p.vy,-1200,ar),p.lastX=e.clientX,p.lastY=e.clientY,p.lastTime=e.timeStamp;let s=u[p.index];if(!s)return;let c=n.cardWidth??120,l=n.cardHeight??140;s.x=e.clientX-t.left-p.grabDx,s.y=e.clientY-t.top-p.grabDy,s.rot+=p.vx*.0035,hr(s,c,l,i.width,i.height),S(p.index)},k=e=>{if(!p||p.pointerId!==e.pointerId)return;let t=p;p=null,a=null;let r=e.currentTarget;r.hasPointerCapture(e.pointerId)&&r.releasePointerCapture(e.pointerId);let i=u[t.index];if(i){if(t.moved<=ir){let e=y()[t.index];e&&n.onPhotoClick?.(t.index,e),S(t.index);return}i.vx=t.vx*.5,i.vy=t.vy*.5,i.vRot=t.vx*.008,T(),S(t.index)}},A=()=>{let e=y(),t=e.length,r=n.cardWidth??120,i=n.cardHeight??140,a=Math.round(i*(n.showCaption?1-lr:1)),o=!!(n.showCaption&&e.some(e=>e.title||e.description));(0,c.setHidden)(v,t>0),m.splice(0),_.querySelectorAll(`.${rr}__card`).forEach(e=>e.remove()),e.forEach((e,t)=>{let n=document.createElement(`div`);n.style.width=`${r}px`,n.style.height=`${i}px`;let s=document.createElement(`div`);s.className=`${rr}__magnet-row`,s.setAttribute(`aria-hidden`,`true`);let c=document.createElement(`span`);c.className=`${rr}__magnet ${rr}__${ur[t%ur.length]}`;let l=document.createElement(`span`);l.className=`${rr}__magnet ${rr}__${ur[(t+1)%ur.length]}`,s.append(c,l);let u=document.createElement(`div`);u.className=`${rr}__photo-frame`,u.style.height=`${a}px`;let d=document.createElement(`img`);if(d.className=`${rr}__image`,d.src=e.src,d.alt=e.alt??e.title??``,d.draggable=!1,u.appendChild(d),n.append(s,u),o&&(e.title||e.description)){let t=document.createElement(`div`);if(t.className=`${rr}__caption`,e.title){let n=document.createElement(`p`);n.className=`${rr}__title`,n.textContent=e.title,t.appendChild(n)}if(e.description){let n=document.createElement(`p`);n.className=`${rr}__description`,n.textContent=e.description,t.appendChild(n)}n.appendChild(t)}n.addEventListener(`pointerdown`,D(t)),n.addEventListener(`pointermove`,O),n.addEventListener(`pointerup`,k),n.addEventListener(`pointercancel`,k),_.appendChild(n),m.push(n)})},j=()=>{h.className=[rr,n.className].filter(Boolean).join(` `),(0,c.applyBlockHostBox)(e,h,{width:n.width??`100%`,height:n.height??480}),pr(h,n.style),h.setAttribute(`role`,`region`),h.setAttribute(`aria-label`,n.ariaLabel??`冰箱磁贴照片墙`)},M=()=>{if(i={width:_.clientWidth,height:_.clientHeight},!(i.width<=0||i.height<=0))if(o!==b()||u.length!==b())C();else{let e=n.cardWidth??120,t=n.cardHeight??140;u.forEach((n,r)=>{hr(n,e,t,i.width,i.height),S(r)})}};j(),A();let N=typeof ResizeObserver>`u`?null:new ResizeObserver(()=>{M()});return N?.observe(_),M(),{update(e){let t=n.photos;n={...n,...e,photos:Array.isArray(e.photos)?e.photos:n.photos},j(),e.photos&&e.photos!==t?(o=-1,A(),C()):e.cardWidth!==void 0||e.cardHeight!==void 0||e.showCaption!==void 0?(A(),C()):(e.scatter!==void 0||e.initialIndex!==void 0)&&C()},destroy(){r||(r=!0,s!==null&&cancelAnimationFrame(s),N?.disconnect(),h.remove())}}}var _r=Math.PI*2/6,vr=1.12,yr=2.05,br=.84,xr=(e,t,n,r)=>{let{accentMat:i,trimMat:a,beadMat:o,silkMat:s}=t,c=yr,u=new l.Group;u.position.y=c/2+.16,e.add(u),u.add(new l.Mesh(new l.CylinderGeometry(.1,.14,.05,20),i));let d=new l.Mesh(new l.CylinderGeometry(.016,.02,.32,12),a);d.position.y=.2,u.add(d);let f=new l.Mesh(new l.SphereGeometry(.055,20,20),a);f.position.y=.38,u.add(f);let p=.012,m=new l.Mesh(new l.TorusGeometry(.06,p,12,36),a);m.position.y=.48,u.add(m);let h=new l.Mesh(new l.CylinderGeometry(.007,.007,.24,8),a);h.position.y=.672-p*.55,u.add(h);let g=new l.CylinderGeometry(.038,.048,.028,16),_=new l.SphereGeometry(.026,16,16);for(let t=0;t<6;t++){let r=t*_r+_r/2,o=n*.98*Math.sin(r),s=n*.98*Math.cos(r),u=new l.Group;u.position.set(o,c/2+.145,s);let d=new l.Mesh(g,i);d.castShadow=!0,u.add(d);let f=new l.Mesh(_,a);f.position.y=.03,f.castShadow=!0,u.add(f),e.add(u)}let v=new l.SphereGeometry(.032,14,14),y=new l.CylinderGeometry(.006,.006,.1,8),b=new l.SphereGeometry(.038,14,14),x=new l.CylinderGeometry(.01,.004,c*.4,6),S=c*.4;for(let t=0;t<6;t++){let r=t*_r+_r/2,i=new l.Group;i.position.set(Math.sin(r)*(n+.04),c/2-.02,Math.cos(r)*(n+.04)),i.add(new l.Mesh(v,o));let a=new l.Mesh(y,o);a.position.y=-.065,i.add(a);let u=new l.Mesh(b,s);u.position.y=-.13,i.add(u);for(let e=0;e<5;e++){let t=new l.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 l.Mesh(new l.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)}},Sr=e=>{let t=e;t.map?.dispose(),t.emissiveMap?.dispose(),t.alphaMap?.dispose()},Cr=e=>{(Array.isArray(e)?e:[e]).forEach(e=>{Sr(e),e.dispose()})},wr=(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),Cr(e))}))})},Tr=e=>{let t=new l.Shape;for(let n=0;n<6;n++){let r=-Math.PI/6+n*_r,i=Math.cos(r)*e,a=Math.sin(r)*e;n===0?t.moveTo(i,a):t.lineTo(i,a)}return t.closePath(),t},Er=(e,t,n)=>{let r=new l.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},Dr=(e,t,n,r,i,a)=>{let o=Er(e,t,n);return o.holes.push(Er(r,i,a)),o},Or=e=>new l.Color(e),kr=()=>{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 l.CanvasTexture(e);return r.colorSpace=l.SRGBColorSpace,r},Ar=(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 l.CanvasTexture(r);return a.colorSpace=l.SRGBColorSpace,a.wrapS=l.RepeatWrapping,a.wrapT=l.RepeatWrapping,a.needsUpdate=!0,a},jr=(e,t,n,r,i)=>{let a=Ar(e,t);return a.repeat.set(n,r),a.anisotropy=i,a},Mr=(e,t,n,r)=>{e.colorSpace=l.SRGBColorSpace,e.anisotropy=r,e.wrapS=l.ClampToEdgeWrapping,e.wrapT=l.ClampToEdgeWrapping,e.center.set(.5,.5),e.generateMipmaps=!0,e.minFilter=l.LinearMipmapLinearFilter,e.magFilter=l.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)},Nr=`"PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif`,Pr=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}},Fr=(e,t,n)=>{let{w:r,h:i}=Pr(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 ${Nr}`,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 ${Nr}`,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 u=new l.CanvasTexture(s);return u.colorSpace=l.SRGBColorSpace,u.needsUpdate=!0,u},Ir=(e,t,n,r,i)=>new l.MeshPhysicalMaterial({color:e,map:t,metalness:0,roughness:n,clearcoat:r,clearcoatRoughness:i}),Lr=(e,t,n)=>{let r=jr(`#c4a07a`,`#5a3a22`,1.4,2.2,n),i=jr(`#d4b896`,`#6a4a30`,1.2,1.8,n),a=jr(`#e0c6a0`,`#7a5638`,1,2.4,n),o=a.clone();return o.repeat.set(1.6,1.6),o.anisotropy=n,{frameMat:Ir(e,r,.62,.22,.55),accentMat:Ir(new l.Color(e).offsetHSL(.02,-.04,.1),i,.58,.28,.5),trimMat:Ir(new l.Color(e).offsetHSL(.03,-.08,.18),a,.48,.35,.4),beadMat:Ir(13211226,o,.42,.4,.35),silkMat:new l.MeshPhysicalMaterial({color:t,metalness:0,roughness:.62,sheen:1,sheenRoughness:.45,sheenColor:new l.Color(t).offsetHSL(0,-.1,.25)})}},Rr=e=>{e.add(new l.HemisphereLight(16774891,12888202,.72));let t=new l.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 l.DirectionalLight(15783344,.34);n.position.set(-4,2.5,-2.5),e.add(n);let r=new l.DirectionalLight(16771280,.24);r.position.set(0,3,-5),e.add(r)},zr=(e,t,n,r)=>{let i=new l.ExtrudeGeometry(Tr(e),{depth:t,bevelEnabled:!0,bevelThickness:.025,bevelSize:.02,bevelSegments:3});i.rotateX(-Math.PI/2);let a=new l.Mesh(i,r);return a.position.y=n,a.castShadow=!0,a.receiveShadow=!0,a},Br=(e,t)=>{let n=new l.Scene;if(t.background)try{n.background=Or(t.background)}catch{n.background=null}else n.background=null;let r=new l.PerspectiveCamera(34,t.width/t.height,.1,100);r.position.set(0,1.35,6.6),r.lookAt(0,.08,0);let i=new l.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=l.SRGBColorSpace,i.toneMapping=l.ACESFilmicToneMapping,i.toneMappingExposure=1.12,i.shadowMap.enabled=!0,i.shadowMap.type=l.PCFSoftShadowMap;let a=vr,o=yr,s=a*br,c=o*br,u=s/c,d=a/(2*Math.tan(Math.PI/6)),f=a/(2*Math.sin(Math.PI/6)),p=f*1.12,m=Or(t.frameColor),h=Or(t.paperColor),g=Or(t.lightColor),_=Or(t.tasselColor),v=new l.Group;v.rotation.x=l.MathUtils.degToRad(14),n.add(v);let y=new l.Group;v.add(y),Rr(n);let b=i.capabilities.getMaxAnisotropy(),x=Lr(m,_,b),{frameMat:S,accentMat:C}=x,w=[],T=new l.TextureLoader,E=new l.PlaneGeometry(s,c),D=new l.ExtrudeGeometry(Dr(a*.96,o*.96,.04,s+.02,c+.02,.025),{depth:.07,bevelEnabled:!0,bevelThickness:.012,bevelSize:.01,bevelSegments:2}),O=new l.ShapeGeometry(Dr(s+.05,c+.05,.028,s,c,.02));for(let e=0;e<6;e++){let t=e*_r,n=new l.Group;n.position.set(Math.sin(t)*d,0,Math.cos(t)*d),n.rotation.y=t;let r=new l.Mesh(D,S);r.position.z=-.01,r.castShadow=!0,r.receiveShadow=!0,n.add(r);let i=new l.Mesh(O,C);i.position.z=.02,n.add(i);let a=new l.MeshBasicMaterial({color:h,map:null,toneMapped:!1,side:l.FrontSide,transparent:!0,opacity:1}),o=new l.Mesh(E,a);o.position.z=.032,o.userData.fadeTo=1,n.add(o),w.push(o),y.add(n)}let k=new l.CylinderGeometry(.038,.042,o-.12,20),A=new l.CylinderGeometry(.052,.048,.06,20);for(let e=0;e<6;e++){let t=e*_r+_r/2,n=Math.sin(t)*f,r=Math.cos(t)*f,i=new l.Mesh(k,S);i.position.set(n,0,r),i.castShadow=!0,y.add(i);let a=new l.Mesh(A,C);a.position.set(n,o/2-.05,r),a.castShadow=!0,y.add(a);let s=new l.Mesh(A,C);s.position.set(n,-o/2+.05,r),s.castShadow=!0,y.add(s)}y.add(zr(p,.1,o/2+.02,S)),y.add(zr(p*.78,.06,o/2+.12,S)),y.add(zr(p,.1,-o/2-.1,S)),y.add(zr(p*.62,.12,-o/2-.24,S));let j=new l.PointLight(g,3.2,7.5,1.35);j.position.set(0,-.08,0),j.castShadow=!1,y.add(j),j.add(new l.Mesh(new l.SphereGeometry(.07,24,24),new l.MeshBasicMaterial({color:16775408})));let M=new l.Mesh(new l.SphereGeometry(.14,24,24),new l.MeshBasicMaterial({color:g,transparent:!0,opacity:.35}));j.add(M);let N=new l.Mesh(new l.SphereGeometry(.32,24,24),new l.MeshBasicMaterial({color:g,transparent:!0,opacity:.12}));j.add(N),t.showAccessories&&xr(y,x,f,d);let P=kr(),F=new l.Mesh(new l.PlaneGeometry(3.6,3.6),new l.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=-l.MathUtils.degToRad(I);let L=new Map,R=new Map,z=new Map,B=0,V=!1,H=0,ee=()=>{V||(V=!0,H&&=(window.clearTimeout(H),0),i.render(n,r),t.onReady?.())},U=()=>{B+=1},te=()=>{B=Math.max(0,B-1),B===0&&ee()},ne=(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]}),U(),T.load(e,t=>{L.set(e,t);let n=z.get(e);z.delete(e),n?.resolve.forEach(e=>e(t)),te()},void 0,()=>{let t=z.get(e);z.delete(e),t?.reject.forEach(e=>e()),te()})},re=(e,t)=>{e.map=null,e.color.copy(h),e.transparent=!0,e.opacity=1,e.needsUpdate=!0,t.userData.fadeTo=1},ie=(e,t,n,r)=>{w.forEach((i,a)=>{let o=i.material,s=e[a];if(!s?.src){re(o,i);return}let c=(e,a)=>{let c=r?s.title:void 0,l=r?s.description:void 0,d=`${s.src}::${c||``}::${l||``}::${+!!r}`,f=R.get(d);f||(r&&(c||l)&&e.image?(f=Fr(e.image,c,l),R.set(d,f)):f=e),Mr(f,n,u,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,ne(s.src,e=>c(e,V),()=>re(o,i))})};ie(t.photos,t.silhouette,t.objectFit,t.showCaption),B===0?ee():H=window.setTimeout(ee,1600);let ae=()=>{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=-l.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:ie,render:()=>{ae(),i.render(n,r)},dispose:()=>{H&&window.clearTimeout(H),w.forEach(e=>{let t=e.material;t.map=null}),wr(n),L.forEach(e=>e.dispose()),L.clear(),R.forEach(e=>e.dispose()),R.clear(),z.clear(),i.dispose()}}},Vr=e=>{let t=(e%360+360)%360;return Math.round(t/60)%6},Hr=`cos-photo-lantern`,Ur=6,Wr=720,Gr=2.5,Kr=90,qr=.045,Jr=360,Yr=480,Xr=(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},Qr=e=>typeof e==`string`&&e.startsWith(`#`)?e:void 0,$r=(e,t)=>{if(t)for(let[n,r]of Object.entries(t))r!=null&&(n.startsWith(`--`)?e.style.setProperty(n,String(r)):e.style[n]=String(r))};function ei(e,t={photos:[]}){let n={autoRotate:!0,autoRotateSpeed:14,dragSensitivity:.42,friction:1.4,frameColor:`#5c4033`,paperColor:`#faf4e8`,lightColor:`#f0b35a`,lightSway:1,showAccessories:!0,tasselColor:`#c94b3a`,objectFit:`cover`,silhouette:!1,showCaption:!1,initialAngle:0,ariaLabel:`走马灯图片预览`,...t,photos:Array.isArray(t.photos)?t.photos:[]},r=!1,i=n.initialAngle??0,a=0,o=!1,s=null,l=0,u=0,d=!1,f=0,p=!1,m=Vr(i),h=Jr,g=Yr,_=null,v=0,y=performance.now(),b=null,x=document.createElement(`div`);x.className=[Hr,n.className].filter(Boolean).join(` `),x.setAttribute(`role`,`img`);let S=document.createElement(`canvas`);S.className=`${Hr}__canvas`,x.appendChild(S),e.appendChild(x);let C=()=>Array.from({length:6},(e,t)=>(Array.isArray(n.photos)?n.photos:[])[t]),w=()=>{(0,c.applyBlockHostBox)(e,x,{width:n.width??Jr,height:n.height??Yr}),n.background!==void 0&&(x.style.background=n.background),$r(x,n.style),x.className=[Hr,n.className].filter(Boolean).join(` `)},T=()=>{let e=C()[m],t=n.showCaption&&e?.title?`,当前:${e.title}${e.description?`,${e.description}`:``}`:``;x.setAttribute(`aria-label`,(n.ariaLabel??`走马灯图片预览`)+t)},E=()=>{_?.dispose(),_=null,!(h<=0||g<=0)&&(_=Br(S,{width:h,height:g,photos:C(),frameColor:n.frameColor??`#5c4033`,paperColor:n.paperColor??`#faf4e8`,lightColor:n.lightColor??`#f0b35a`,tasselColor:n.tasselColor??`#c94b3a`,showAccessories:n.showAccessories??!0,showCaption:n.showCaption??!1,silhouette:n.silhouette??!1,objectFit:n.objectFit||`cover`,background:Qr(n.background),initialAngleDeg:i,onReady:()=>S.classList.add(`${Hr}__canvas-ready`)}))},D=()=>{let e=x.parentElement,t=e?.clientWidth||window.innerWidth,r=e?.clientHeight||window.innerHeight,i=Zr(n.width,Jr,t),a=Zr(n.height,Yr,r);i===h&&a===g||(h=i,g=a,E())},O=(e,t)=>{o&&(o=!1,s=null,a=!t||e-u>Kr?0:Xr(a,-720,Wr))},k=e=>{e.button===0&&(o=!0,d=!1,s=e.pointerId,f=e.clientX,l=e.clientX,u=e.timeStamp,a=0,x.setPointerCapture(e.pointerId))},A=e=>{if(!o||s!==e.pointerId)return;let t=e.clientX-l,r=Math.max(.008,(e.timeStamp-u)/1e3);Math.abs(e.clientX-f)>Ur&&(d=!0);let c=n.dragSensitivity??.42;i-=t*c,_?.setAngleDeg(i);let p=-t/r*c,m=1-Math.exp(-r/qr);a+=(p-a)*m,l=e.clientX,u=e.timeStamp},j=e=>{if(s!==e.pointerId)return;let t=!d;O(e.timeStamp,!0);try{x.releasePointerCapture(e.pointerId)}catch{}if(t){let e=C()[m];e&&n.onPhotoClick?.(m,e)}},M=e=>{s===e.pointerId&&O(e.timeStamp,!1)},N=e=>{if(r)return;v=requestAnimationFrame(N);let t=_;if(!t||p){y=e;return}let s=Math.min(.05,(e-y)/1e3);y=e,o||(Math.abs(a)>Gr?(a*=Math.exp(-(n.friction??1.4)*s),Math.abs(a)<=Gr&&(a=0),i+=a*s,t.setAngleDeg(i)):(n.autoRotate??!0)&&(i+=(n.autoRotateSpeed??14)*s,t.setAngleDeg(i)));let c=Vr(i);if(c!==m){m=c;let e=C()[c];n.onFaceChange?.(c,e),e&&n.onIndexChange?.(c,e),T()}t.setLightSway(e/1e3,n.lightSway??1),t.render()};w(),T(),D(),b=new ResizeObserver(D),b.observe(x),x.parentElement&&b.observe(x.parentElement);let P=(0,c.bindVisibilityPause)(e=>{p=e});return x.addEventListener(`pointerdown`,k),x.addEventListener(`pointermove`,A),x.addEventListener(`pointerup`,j),x.addEventListener(`pointercancel`,M),v=requestAnimationFrame(N),{update(e){let t=n;n={...n,...e},w(),t.frameColor!==n.frameColor||t.paperColor!==n.paperColor||t.lightColor!==n.lightColor||t.tasselColor!==n.tasselColor||t.showAccessories!==n.showAccessories||t.background!==n.background||t.width!==n.width||t.height!==n.height?(D(),E()):_?.updatePhotos(C(),n.silhouette??!1,n.objectFit||`cover`,n.showCaption??!1),T()},destroy(){r||(r=!0,cancelAnimationFrame(v),P(),b?.disconnect(),_?.dispose(),_=null,x.removeEventListener(`pointerdown`,k),x.removeEventListener(`pointermove`,A),x.removeEventListener(`pointerup`,j),x.removeEventListener(`pointercancel`,M),x.remove())}}}var ti=`cos-photo-lightbox`,ni=6,ri=260,ii=320,ai=(e,t)=>t<=0?0:Math.max(0,Math.min(t-1,Math.floor(e))),oi=(e,t)=>{if(t)for(let[n,r]of Object.entries(t))r!=null&&(n.startsWith(`--`)?e.style.setProperty(n,String(r)):e.style[n]=typeof r==`number`?`${r}px`:String(r))};function si(e,t={photos:[]}){let n={width:360,height:480,slideWidth:200,slideHeight:280,pullThreshold:100,showCaption:!0,initialIndex:0,ariaLabel:`Photo lightbox`,...t,photos:Array.isArray(t.photos)?t.photos:[]},r=!1,i=ai(n.initialIndex??0,n.photos.length),a=0,o=`idle`,s=null,l=null,u=null,d=document.createElement(`div`),f=document.createElement(`div`);f.className=`${ti}__stage`;let p=document.createElement(`div`);p.className=`${ti}__table`;let m=document.createElement(`div`);m.className=`${ti}__slot`;let h=document.createElement(`div`);h.className=`${ti}__empty`,h.textContent=`No photos`,p.appendChild(m),f.append(h,p),d.appendChild(f),e.appendChild(d);let g=()=>Array.isArray(n.photos)?n.photos:[],_=()=>g().length,v=e=>{if(!n.showCaption||!e.title&&!e.description)return null;let t=document.createElement(`div`);if(t.className=`${ti}__caption`,e.title){let n=document.createElement(`div`);n.className=`${ti}__caption-title`,n.textContent=e.title,t.appendChild(n)}if(e.description){let n=document.createElement(`div`);n.className=`${ti}__caption-desc`,n.textContent=e.description,t.appendChild(n)}return t},y=(e,t,r,i)=>{let a=n.slideWidth??200,s=n.slideHeight??280,c=s-(n.showCaption&&(e.title||e.description)?44:0),l=document.createElement(`div`);l.className=`${ti}__slide ${r===`active`?`${ti}__slide-active`:`${ti}__slide-behind`}${r===`active`&&o===`exiting`?` ${ti}__slide-exiting`:``}`,l.style.width=`${a}px`,l.style.height=`${s}px`,l.style.transform=i,l.style.transition=o===`snapping`||o===`exiting`?`transform ${o===`exiting`?ri:ii}ms cubic-bezier(0.22, 1, 0.36, 1), opacity ${ri}ms ease`:`none`,r===`active`&&o===`exiting`&&(l.style.opacity=`0.35`),r===`active`&&(l.setAttribute(`role`,`button`),l.setAttribute(`aria-label`,e.alt||e.title||`Slide ${t+1} of ${_()}`));let u=document.createElement(`div`);u.className=`${ti}__slide-image-wrap`,u.style.height=`${c}px`;let d=document.createElement(`img`);d.className=`${ti}__slide-image`,d.src=e.src,d.alt=e.alt||e.title||``,d.draggable=!1,u.appendChild(d),l.appendChild(u);let f=v(e);return f&&l.appendChild(f),r===`active`&&(l.addEventListener(`pointerdown`,T),l.addEventListener(`pointermove`,E),l.addEventListener(`pointerup`,D),l.addEventListener(`pointercancel`,O)),l},b=e=>{let t=g(),r=ai(e,t.length);i=r;let a=t[r];a&&n.onIndexChange?.(r,a)},x=e=>{b(e),a=0,o=`idle`,A()},S=e=>{let t=e*((n.slideWidth??200)+72);o=`exiting`,a=t,A(),l!=null&&window.clearTimeout(l),l=window.setTimeout(()=>{x(ai(i+e,g().length))},ri)},C=()=>{o=`snapping`,a=0,A(),u!=null&&window.clearTimeout(u),u=window.setTimeout(()=>{o=`idle`,A()},ii)},w=e=>{ai(i+e,g().length)!==i&&S(e>0?1:-1)},T=e=>{o===`exiting`||_()===0||(s={pointerId:e.pointerId,startX:e.clientX,moved:!1},o=`dragging`,e.currentTarget.setPointerCapture(e.pointerId))},E=e=>{if(!s||s.pointerId!==e.pointerId||o===`exiting`)return;let t=e.clientX-s.startX;Math.abs(t)>ni&&(s.moved=!0);let n=i>0,r=i<_()-1;a=t>0&&!r||t<0&&!n?t*.28:t,A()},D=e=>{if(!s||s.pointerId!==e.pointerId)return;let t=s.startX,r=s.moved,c=e.currentTarget;if(s=null,c.hasPointerCapture(e.pointerId)&&c.releasePointerCapture(e.pointerId),o===`exiting`)return;let l=e.clientX-t;if(!r){o=`idle`,a=0,A();let e=g()[i];e&&n.onPhotoClick?.(i,e);return}let u=i>0,d=i<_()-1;if(Math.abs(l)>=(n.pullThreshold??100)){let e=l>0?1:-1;if(e>0&&d||e<0&&u){S(e);return}}C()},O=e=>{if(!s||s.pointerId!==e.pointerId)return;let t=e.currentTarget;s=null,t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),o!==`exiting`&&C()},k=e=>{e.key===`ArrowRight`?(e.preventDefault(),w(1)):e.key===`ArrowLeft`&&(e.preventDefault(),w(-1))},A=()=>{let t=g(),r=t.length,o=n.slideWidth??200,s=n.slideHeight??280,l=n.width??360,u=n.height??480;if(d.className=[ti,n.className].filter(Boolean).join(` `),(0,c.applyBlockHostBox)(e,d,{width:l,height:u}),oi(d,n.style),d.setAttribute(`role`,`region`),d.setAttribute(`aria-label`,n.ariaLabel??`Photo lightbox`),d.tabIndex=0,(0,c.setHidden)(h,r>0),(0,c.setHidden)(p,r===0),r===0){m.replaceChildren();return}let f=Math.max(24,(typeof l==`number`?l:o+48)*.08),_=Math.max(28,(typeof u==`number`?u:s+56)*.1);p.style.width=`${o+f*2}px`,p.style.height=`${s+_*2}px`,m.style.width=`${o}px`,m.style.height=`${s}px`;let v=t[i],b=i<r-1?t[i+1]:void 0,x=`translate(-50%, -50%) translateX(${a}px)`;m.replaceChildren(),b&&m.appendChild(y(b,i+1,`behind`,`translate(-50%, calc(-50% + 14px)) scale(0.94)`)),v&&m.appendChild(y(v,i,`active`,x))};return d.addEventListener(`keydown`,k),A(),{update(e){n={...n,...e,photos:Array.isArray(e.photos)?e.photos:n.photos},i=ai(i,g().length),A()},destroy(){r||(r=!0,l!=null&&window.clearTimeout(l),u!=null&&window.clearTimeout(u),d.removeEventListener(`keydown`,k),d.remove())}}}var ci=`cos-photo-polaroid`,li=6,ui=1400,di=.12,fi=.86,pi=.88,mi=1.04,hi=.22,gi=(e,t,n)=>Math.min(n,Math.max(t,e)),_i=e=>{let t=Math.sin(e*127.1+31.7)*43758.5453;return t-Math.floor(t)},vi=(e,t)=>{if(t)for(let[n,r]of Object.entries(t))r!=null&&(n.startsWith(`--`)?e.style.setProperty(n,String(r)):e.style[n]=typeof r==`number`?`${r}px`:String(r))},yi=(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);return{restX:c+(r-.5)*o*1.65+(_i(n*7.13+2.1)*2-1)*o*.42,restY:l-Math.sin(r*Math.PI)*s*.28+(_i(n*11.37+5.9)*2-1)*s*.38,restRot:(_i(n*3.71+1.4)*2-1)*14*a}})};function bi(e,t={photos:[]}){let n={width:`100%`,height:420,cardWidth:150,cardHeight:180,scatter:1,showCaption:!0,initialIndex:0,ariaLabel:`拍立得照片堆叠`,...t,photos:Array.isArray(t.photos)?t.photos:[]},r=!1,i={width:0,height:0},a=null,o=null,s=0,l=[],u=[],d=0,f=null,p=[],m=document.createElement(`div`),h=document.createElement(`div`);h.className=`${ci}__stage`;let g=document.createElement(`div`);g.className=`${ci}__empty`,g.textContent=`暂无照片`,h.appendChild(g),m.appendChild(h),e.appendChild(m);let _=()=>Array.isArray(n.photos)?n.photos:[],v=()=>_().length,y=()=>gi(n.scatter??1,0,2.5),b=e=>{let t=p[e],n=l[e];if(!t||!n)return;let r=a===e?mi:1;t.style.zIndex=String(u[e]??e),t.style.transform=`translate3d(${n.x}px, ${n.y}px, 0) rotate(${n.rot}deg) scale(${r})`,t.className=`${ci}__card${a===e?` ${ci}__card-dragging`:``}`},x=()=>{let e=yi(v(),i.width,i.height,n.cardWidth??150,n.cardHeight??180,y());l.length=0,u.length=0,e.forEach((e,t)=>{l.push({x:e.restX,y:e.restY,rot:e.restRot,vx:0,vy:0,vRot:0}),u[t]=t}),d=Math.max(v()-1,0);let t=gi(Math.floor(n.initialIndex??0),0,Math.max(0,v()-1));v()>0&&(d+=1,u[t]=d),l.forEach((e,t)=>b(t))},S=e=>{let t=s?Math.min((e-s)/1e3,.032):.016;s=e;let n=!1;for(let e=0;e<l.length;e++){if(a===e)continue;let r=l[e];r.x+=r.vx*t,r.y+=r.vy*t,r.rot+=r.vRot*t;let i=fi**(t*60),o=pi**(t*60);r.vx*=i,r.vy*=i,r.vRot*=o,Math.abs(r.vx)>di||Math.abs(r.vy)>di||Math.abs(r.vRot)>di*.35?n=!0:(r.vx=0,r.vy=0,r.vRot=0),b(e)}o=n&&!r?requestAnimationFrame(S):null},C=()=>{o===null&&(s=0,o=requestAnimationFrame(S))},w=e=>{d+=1,u[e]=d,b(e)},T=e=>t=>{if(t.button!==0)return;let n=l[e];if(!n)return;let r=h.getBoundingClientRect();t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),w(e),a=e,b(e),f={pointerId:t.pointerId,index:e,grabDx:t.clientX-r.left-n.x,grabDy:t.clientY-r.top-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},E=e=>{if(!f||f.pointerId!==e.pointerId)return;let t=h.getBoundingClientRect();f.moved=Math.max(f.moved,Math.hypot(e.clientX-f.startX,e.clientY-f.startY));let n=Math.max(e.timeStamp-f.lastTime,1)/1e3;f.vx=gi(.65*((e.clientX-f.lastX)/n)+.35*f.vx,-1400,ui),f.vy=gi(.65*((e.clientY-f.lastY)/n)+.35*f.vy,-1400,ui),f.lastX=e.clientX,f.lastY=e.clientY,f.lastTime=e.timeStamp;let r=l[f.index];r&&(r.x=e.clientX-t.left-f.grabDx,r.y=e.clientY-t.top-f.grabDy,r.rot+=f.vx*.0045,b(f.index))},D=e=>{if(!f||f.pointerId!==e.pointerId)return;let t=f;f=null,a=null;let r=e.currentTarget;r.hasPointerCapture(e.pointerId)&&r.releasePointerCapture(e.pointerId);let i=l[t.index];if(i){if(t.moved<=li){let e=_()[t.index];e&&n.onPhotoClick?.(t.index,e),b(t.index);return}i.vx=t.vx*.55,i.vy=t.vy*.55,i.vRot=t.vx*.012,C(),b(t.index)}},O=()=>{let e=_(),t=e.length,r=n.cardWidth??150,i=n.cardHeight??180,a=Math.round(i*(1-hi)),o=!!(n.showCaption&&e.some(e=>e.title||e.description));(0,c.setHidden)(g,t>0),p.splice(0),h.querySelectorAll(`.${ci}__card`).forEach(e=>e.remove()),e.forEach((e,t)=>{let n=document.createElement(`div`);n.style.width=`${r}px`,n.style.height=`${i}px`;let s=document.createElement(`div`);s.className=`${ci}__image-wrap`,s.style.height=`${a}px`;let c=document.createElement(`img`);if(c.className=`${ci}__image`,c.src=e.src,c.alt=e.alt??e.title??``,c.draggable=!1,s.appendChild(c),n.appendChild(s),o&&(e.title||e.description)){let t=document.createElement(`div`);if(t.className=`${ci}__caption`,e.title){let n=document.createElement(`p`);n.className=`${ci}__title`,n.textContent=e.title,t.appendChild(n)}if(e.description){let n=document.createElement(`p`);n.className=`${ci}__description`,n.textContent=e.description,t.appendChild(n)}n.appendChild(t)}n.addEventListener(`pointerdown`,T(t)),n.addEventListener(`pointermove`,E),n.addEventListener(`pointerup`,D),n.addEventListener(`pointercancel`,D),h.appendChild(n),p.push(n)})},k=()=>{m.className=[ci,n.className].filter(Boolean).join(` `),(0,c.applyBlockHostBox)(e,m,{width:n.width??`100%`,height:n.height??420}),vi(m,n.style),m.setAttribute(`role`,`region`),m.setAttribute(`aria-label`,n.ariaLabel??`拍立得照片堆叠`)};k(),O();let A=typeof ResizeObserver>`u`?null:new ResizeObserver(([e])=>{i={width:e.contentRect.width,height:e.contentRect.height},x()});return A?.observe(h),i={width:h.clientWidth,height:h.clientHeight},x(),{update(e){let t=n.photos;n={...n,...e,photos:Array.isArray(e.photos)?e.photos:n.photos},k(),(e.photos&&e.photos!==t||e.cardWidth!==void 0||e.cardHeight!==void 0||e.showCaption!==void 0)&&O(),x()},destroy(){r||(r=!0,o!==null&&cancelAnimationFrame(o),A?.disconnect(),m.remove())}}}var xi=`cos-photo-prism`,Si=6,Ci=6,wi=640,Ti=2.2,Ei=90,Di=.045,Oi=7.5,ki=5,Ai=4.8,ji=380,Mi=380,Ni=200,Pi=[`front`,`back`,`right`,`left`,`top`,`bottom`],Fi=(e,t,n)=>Math.max(t,Math.min(n,e)),Ii=e=>{let t=(e%360+360)%360;return t>180&&(t-=360),t},Li=(e,t)=>{let n=Ii(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},Ri=(e,t)=>{if(t)for(let[n,r]of Object.entries(t))r!=null&&(n.startsWith(`--`)?e.style.setProperty(n,String(r)):e.style[n]=String(r))};function zi(e,t={photos:[]}){let n={autoRotate:!0,dragSensitivity:.4,friction:1.35,showCaption:!0,ariaLabel:`照片棱镜`,...t,photos:Array.isArray(t.photos)?t.photos:[]},r=!1,i=-12,a=-28,o=0,s=0,l=!1,u=null,d=0,f=0,p=0,m=!1,h=0,g=0,_=!1,v=Li(i,a),y=0,b=performance.now(),x=0,S=document.createElement(`div`);S.setAttribute(`role`,`img`);let C=document.createElement(`div`);C.className=`${xi}__glow`,C.setAttribute(`aria-hidden`,`true`);let w=document.createElement(`div`);w.className=`${xi}__stage`;let T=document.createElement(`div`);T.className=`${xi}__float-wrap`;let E=document.createElement(`div`);E.className=`${xi}__cube`,T.appendChild(E),w.appendChild(T),S.append(C,w),e.appendChild(S);let D=()=>Array.from({length:Si},(e,t)=>(Array.isArray(n.photos)?n.photos:[])[t]),O=()=>{E.replaceChildren();let e=D();Pi.forEach((t,r)=>{let i=e[r],a=document.createElement(`div`);if(a.className=`${xi}__face ${xi}__${t}`,a.dataset.faceIndex=String(r),i){let e=document.createElement(`img`);e.className=`${xi}__photo`,e.src=i.src,e.alt=i.alt??i.title??`Photo ${r+1}`,e.draggable=!1,a.appendChild(e)}else{let e=document.createElement(`div`);e.className=`${xi}__placeholder`,e.setAttribute(`aria-hidden`,`true`),a.appendChild(e)}if(n.showCaption&&i&&(i.title||i.description)&&i){let e=document.createElement(`div`);if(e.className=`${xi}__caption`,i.title){let t=document.createElement(`strong`);t.textContent=i.title,e.appendChild(t)}if(i.description){let t=document.createElement(`span`);t.textContent=i.description,e.appendChild(t)}a.appendChild(e)}E.appendChild(a)})},k=()=>{S.className=[xi,n.className].filter(Boolean).join(` `),(0,c.applyBlockHostBox)(e,S,{width:n.width??ji,height:n.height??Mi}),S.style.setProperty(`--prism-size`,`${n.size??Ni}px`),Ri(S,n.style);let t=D()[v],r=n.showCaption&&t?.title?`,当前:${t.title}${t.description?`,${t.description}`:``}`:``;S.setAttribute(`aria-label`,(n.ariaLabel??`照片棱镜`)+r)},A=e=>{E.style.transform=`rotateX(${i}deg) rotateY(${a}deg)`,T.style.transform=`translateY(${e}px)`;let t=Li(i,a);t!==v&&(v=t,k())},j=(e,t)=>{if(l){if(l=!1,u=null,!t||e-p>Ei){o=0,s=0;return}o=Fi(o,-640,wi),s=Fi(s,-640,wi)}},M=e=>{e.button===0&&(l=!0,m=!1,u=e.pointerId,h=e.clientX,g=e.clientY,d=e.clientX,f=e.clientY,p=e.timeStamp,o=0,s=0,S.setPointerCapture(e.pointerId))},N=e=>{if(!l||u!==e.pointerId)return;let t=e.clientX-d,r=e.clientY-f,c=Math.max(.008,(e.timeStamp-p)/1e3);Math.hypot(e.clientX-h,e.clientY-g)>Ci&&(m=!0);let _=n.dragSensitivity??.4;a-=t*_,i-=r*_;let y=-t/c*_,b=-r/c*_,x=1-Math.exp(-c/Di);o+=(y-o)*x,s+=(b-s)*x,d=e.clientX,f=e.clientY,p=e.timeStamp,E.style.transform=`rotateX(${i}deg) rotateY(${a}deg)`;let S=Li(i,a);S!==v&&(v=S,k())},P=e=>{if(u!==e.pointerId)return;let t=!m;j(e.timeStamp,!0);try{S.releasePointerCapture(e.pointerId)}catch{}if(t){let t=e.target?.closest?.(`[data-face-index]`),r=t?Number(t.dataset.faceIndex):v,i=Number.isFinite(r)?r:v,a=D()[i];a&&n.onPhotoClick?.(i,a)}},F=e=>{u===e.pointerId&&j(e.timeStamp,!1)},I=e=>{if(r)return;if(y=requestAnimationFrame(I),_){b=e;return}let t=Math.min(.05,(e-b)/1e3);if(b=e,x+=t,!l)if(Math.abs(o)>Ti||Math.abs(s)>Ti){let e=Math.exp(-(n.friction??1.35)*t);o*=e,s*=e,Math.abs(o)<=Ti&&(o=0),Math.abs(s)<=Ti&&(s=0),i+=s*t,a+=o*t}else (n.autoRotate??!0)&&(a+=Oi*t);A(l||Math.abs(o)>Ti||Math.abs(s)>Ti?0:Math.sin(x/Ai*Math.PI*2)*ki)};k(),O(),A(0);let L=(0,c.bindVisibilityPause)(e=>{_=e});return S.addEventListener(`pointerdown`,M),S.addEventListener(`pointermove`,N),S.addEventListener(`pointerup`,P),S.addEventListener(`pointercancel`,F),y=requestAnimationFrame(I),{update(e){n={...n,...e},k(),O()},destroy(){r||(r=!0,cancelAnimationFrame(y),L(),S.removeEventListener(`pointerdown`,M),S.removeEventListener(`pointermove`,N),S.removeEventListener(`pointerup`,P),S.removeEventListener(`pointercancel`,F),S.remove())}}}var Bi=`cos-photo-scroll`,Vi=6,Hi=.045,Ui=90,Wi=8,Gi=2600,Ki=14,qi=(e,t,n)=>Math.min(n,Math.max(t,e)),Ji=(e,t)=>{if(t)for(let[n,r]of Object.entries(t))r!=null&&(n.startsWith(`--`)?e.style.setProperty(n,String(r)):e.style[n]=typeof r==`number`?`${r}px`:String(r))};function Yi(e,t={photos:[]}){let n={width:520,height:280,frameWidth:160,frameHeight:200,frameGap:20,dragSensitivity:1,friction:1.5,showCaption:!0,initialIndex:0,ariaLabel:`卷轴照片`,...t,photos:Array.isArray(t.photos)?t.photos:[]},r=!1,i=0,a=n.initialIndex??0,o=!1,s=n.initialIndex??0,l=!1,u=null,d=0,f={offset:0,velocity:0,drag:null,snapTarget:null},p=document.createElement(`div`),m=document.createElement(`div`);m.className=`${Bi}__roller ${Bi}__roller-left`,m.setAttribute(`aria-hidden`,`true`);let h=document.createElement(`div`);h.className=`${Bi}__roller ${Bi}__roller-right`,h.setAttribute(`aria-hidden`,`true`);let g=document.createElement(`div`);g.className=`${Bi}__center`;let _=document.createElement(`div`);_.className=`${Bi}__paper-viewport`;let v=document.createElement(`div`);v.className=`${Bi}__paper`;let y=document.createElement(`div`);y.className=`${Bi}__paper-surface`;let b=document.createElement(`div`);b.className=`${Bi}__empty`,b.textContent=`暂无照片`,v.appendChild(y),_.appendChild(v),g.append(b,_),p.append(m,g,h),e.appendChild(p);let x=()=>Array.isArray(n.photos)?n.photos:[],S=()=>x().length,C=()=>(n.frameWidth??160)+(n.frameGap??20),w=()=>i>0?i/2-(n.frameWidth??160)/2:0,T=()=>{let e=S();if(e<=0)return 0;let t=n.frameWidth??160,r=n.frameGap??20;return w()*2+e*t+Math.max(0,e-1)*r},E=e=>{let t=S();if(i<=0||t<=0)return 0;let r=n.frameWidth??160,a=qi(Math.floor(e),0,t-1);return i/2-(w()+a*C()+r/2)},D=e=>{let t=S();if(t<=0||i<=0)return 0;let r=n.frameWidth??160;return qi(Math.round((i/2-e-w()-r/2)/C()),0,t-1)},O=()=>{let e=S();return e<=0?{min:0,max:0}:{min:E(e-1),max:E(0)}},k=e=>{v.style.transform=`translate3d(${e}px, 0, 0)`},A=e=>{if(e===a)return;a=e,j(),M();let t=x()[e];t&&n.onIndexChange?.(e,t)},j=()=>{y.querySelectorAll(`.${Bi}__frame-cell`).forEach((e,t)=>{e.dataset.active=t===a?`true`:`false`})},M=()=>{let e=x()[a],t=n.showCaption&&e?.title?`,当前:${e.title}${e.description?`,${e.description}`:``}`:``;p.setAttribute(`aria-label`,(n.ariaLabel??`卷轴照片`)+t)},N=()=>{u!==null&&(window.cancelAnimationFrame(u),u=null),d=0},P=()=>{if(u!==null||r)return;let e=t=>{if(u=null,l)return;let i=d||t;d=t;let a=Math.min(.05,(t-i)/1e3),{min:o,max:s}=O(),c=!1;if(f.drag)k(f.offset),c=!0;else if(f.snapTarget!==null){let e=f.snapTarget-f.offset;Math.abs(e)<=.35?(f.offset=f.snapTarget,f.snapTarget=null,f.velocity=0,A(D(f.offset)),k(f.offset)):(f.offset+=e*Math.min(1,Ki*a),f.velocity=0,k(f.offset),c=!0)}else if(Math.abs(f.velocity)>Wi)f.velocity*=Math.exp(-(n.friction??1.5)*a),Math.abs(f.velocity)<=Wi&&(f.velocity=0),f.offset+=f.velocity*a,(f.offset<o||f.offset>s)&&(f.offset=qi(f.offset,o,s),f.velocity=0),k(f.offset),c=!0;else{f.velocity=0;let e=E(D(f.offset));Math.abs(f.offset-e)>.35?(f.snapTarget=e,c=!0):(f.offset=e,A(D(f.offset)),k(f.offset))}c&&!r?u=window.requestAnimationFrame(e):d=0};u=window.requestAnimationFrame(e)},F=()=>{let e=x(),t=e.length,r=n.frameWidth??160,i=n.frameHeight??200,o=n.frameGap??20;y.replaceChildren(),e.forEach((e,s)=>{let c=document.createElement(`div`);c.className=`${Bi}__frame-cell`,c.style.width=`${r}px`,c.style.marginRight=s<t-1?`${o}px`:`0`,c.dataset.active=s===a?`true`:`false`,c.dataset.photoIndex=String(s);let l=document.createElement(`div`);l.className=`${Bi}__frame`,l.style.width=`${r}px`,l.style.height=`${i}px`;let u=document.createElement(`img`);if(u.src=e.src,u.alt=e.alt??e.title??`Photo ${s+1}`,u.draggable=!1,l.appendChild(u),n.showCaption&&(e.title||e.description)){let t=document.createElement(`div`);if(t.className=`${Bi}__caption`,e.title){let n=document.createElement(`strong`);n.textContent=e.title,t.appendChild(n)}if(e.description){let n=document.createElement(`span`);n.textContent=e.description,t.appendChild(n)}l.appendChild(t)}c.appendChild(l),y.appendChild(c)});let s=T(),c=w();v.style.minWidth=`${s}px`,v.style.boxSizing=`border-box`,y.style.paddingLeft=`${c}px`,y.style.paddingRight=`${c}px`,y.style.minWidth=`${s}px`},I=()=>{let t=S();p.className=[Bi,n.className].filter(Boolean).join(` `),(0,c.applyBlockHostBox)(e,p,{width:n.width??520,height:n.height??280}),Ji(p,n.style),(0,c.setHidden)(b,t>0),(0,c.setHidden)(_,t===0),t===0?(p.setAttribute(`role`,`img`),p.tabIndex=-1,p.setAttribute(`aria-label`,n.ariaLabel??`卷轴照片`)):(p.setAttribute(`role`,`region`),p.tabIndex=0,M())},L=()=>{let e=S();if(i<=0||e<=0)return;if(!o){o=!0,s=n.initialIndex??0,f.offset=E(s),f.velocity=0,f.snapTarget=null,f.drag=null,a=qi(s,0,e-1),k(f.offset),j(),M();return}if(s!==(n.initialIndex??0)){s=n.initialIndex??0,f.velocity=0,f.drag=null,f.snapTarget=E(s),P();return}let{min:t,max:r}=O();f.offset=qi(f.offset,t,r),k(f.offset)},R=e=>{let t=f.drag;if(!(!t||t.pointerId!==e.pointerId)){if(f.drag=null,_.hasPointerCapture(e.pointerId)&&_.releasePointerCapture(e.pointerId),f.velocity=e.timeStamp-t.lastMoveTime>Ui?0:qi(t.vx*(n.dragSensitivity??1),-2600,Gi),f.snapTarget=null,t.moved<=Vi){f.velocity=0;let e=D(f.offset),t=x()[e];t&&n.onPhotoClick?.(e,t),f.snapTarget=E(e)}P()}},z=e=>{if(e.button!==0&&e.pointerType===`mouse`||S()<=0)return;let t=e.timeStamp;f.drag={pointerId:e.pointerId,startX:e.clientX,startOffset:f.offset,lastX:e.clientX,lastTime:t,lastMoveTime:t,vx:0,moved:0},f.velocity=0,f.snapTarget=null,_.setPointerCapture(e.pointerId),P()},B=e=>{let t=f.drag;if(!t||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;t.moved=Math.max(t.moved,Math.abs(r)),t.lastMoveTime=e.timeStamp;let i=Math.max(e.timeStamp-t.lastTime,1)/1e3,a=(e.clientX-t.lastX)/i,o=1-Math.exp(-i/Hi);t.vx=o*a+(1-o)*t.vx,t.lastX=e.clientX,t.lastTime=e.timeStamp;let{min:s,max:c}=O();f.offset=qi(t.startOffset+r*(n.dragSensitivity??1),s,c),k(f.offset),A(D(f.offset)),P()},V=e=>{if(S()<=0||e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=e.key===`ArrowLeft`?C():-C(),{min:n,max:r}=O(),i=f.snapTarget??f.offset;f.velocity=0,f.drag=null,f.snapTarget=qi(i+t,n,r),P()};_.addEventListener(`pointerdown`,z),_.addEventListener(`pointermove`,B),_.addEventListener(`pointerup`,R),_.addEventListener(`pointercancel`,R),p.addEventListener(`keydown`,V);let H=(0,c.bindVisibilityPause)(e=>{l=e,e||P()});I(),F();let ee=e=>{i!==e&&(i=e,F(),L())};ee(_.clientWidth);let U=typeof ResizeObserver>`u`?null:new ResizeObserver(e=>{let t=e[0];t&&ee(Math.round(t.contentRect.width))});return U?.observe(_),{update(e){let t=n.photos,r=n.initialIndex;n={...n,...e,photos:Array.isArray(e.photos)?e.photos:n.photos},I(),(e.photos&&e.photos!==t||e.frameWidth!==void 0||e.frameHeight!==void 0||e.frameGap!==void 0||e.showCaption!==void 0)&&(e.photos&&e.photos!==t&&(o=!1),F()),e.initialIndex!==void 0&&e.initialIndex!==r&&(s=-1),L()},destroy(){r||(r=!0,N(),H(),U?.disconnect(),_.removeEventListener(`pointerdown`,z),_.removeEventListener(`pointermove`,B),_.removeEventListener(`pointerup`,R),_.removeEventListener(`pointercancel`,R),p.removeEventListener(`keydown`,V),p.remove())}}}var Xi=`cos-photo-tunnel`,Zi=6,Qi=.35,$i=8,ea=10,ta=90,na=.045,ra=(e,t,n)=>Math.min(n,Math.max(t,e)),ia=(e,t)=>t<=0?0:ra(Math.round(e),0,t-1),aa=(e,t)=>{if(t)for(let[n,r]of Object.entries(t))r!=null&&(n.startsWith(`--`)?e.style.setProperty(n,String(r)):e.style[n]=String(r))};function oa(e,t={photos:[]}){let n={depthStep:180,dragSensitivity:.008,friction:1.5,autoAdvance:!1,autoAdvanceSpeed:.15,showCaption:!0,initialIndex:0,ariaLabel:`纵深照片隧道`,...t,photos:Array.isArray(t.photos)?t.photos:[]},r=!1,i=n.initialIndex??0,a=0,o=null,s=!1,l=null,u=0,d=0,f=0,p=0,m=0,h=0,g=!1,_=!1,v=ia(n.initialIndex??0,(n.photos??[]).length),y=0,b=[],x=null,S=document.createElement(`div`),C=document.createElement(`div`);C.className=`${Xi}__depth-fog`,C.setAttribute(`aria-hidden`,`true`);let w=document.createElement(`div`);w.className=`${Xi}__vignette`,w.setAttribute(`aria-hidden`,`true`);let T=document.createElement(`div`);T.className=`${Xi}__stage`;let E=document.createElement(`div`);E.className=`${Xi}__track`,T.appendChild(E);let D=document.createElement(`div`);D.className=`${Xi}__empty`,D.textContent=`暂无照片`,S.append(C,w,T,D),e.appendChild(S);let O=()=>Array.isArray(n.photos)?n.photos:[],k=e=>{i=e;let t=n.depthStep??180,r=O().length;for(let e=0;e<r;e+=1){let n=b[e];if(!n)continue;let r=e-i,a=Math.abs(r),o=r*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(`${Xi}__frame-current`,u),n.setAttribute(`aria-hidden`,u?`false`:`true`)}},A=e=>{if(e===v)return;v=e;let t=O()[e];t&&n.onIndexChange?.(e,t),j()},j=()=>{x?.remove(),x=null;let e=O()[v],t=!!(n.showCaption&&e&&(e.title||e.description)),r=t&&e?.title?`,当前:${e.title}${e.description?`,${e.description}`:``}`:``;if(S.setAttribute(`aria-label`,(n.ariaLabel??`纵深照片隧道`)+r),!(!t||!e)){if(x=document.createElement(`div`),x.className=`${Xi}__caption`,e.title){let t=document.createElement(`p`);t.className=`${Xi}__caption-title`,t.textContent=e.title,x.appendChild(t)}if(e.description){let t=document.createElement(`p`);t.className=`${Xi}__caption-desc`,t.textContent=e.description,x.appendChild(t)}S.appendChild(x)}},M=()=>{let t=O();S.className=[Xi,n.className].filter(Boolean).join(` `),(0,c.applyBlockHostBox)(e,S,{width:n.width??380,height:n.height??480}),aa(S,n.style);let r=t.length===0;(0,c.setHidden)(D,!r),(0,c.setHidden)(C,r),(0,c.setHidden)(w,r),(0,c.setHidden)(T,r),S.setAttribute(`role`,r?`img`:`region`),r||(S.setAttribute(`aria-roledescription`,`carousel`),S.tabIndex=0),E.replaceChildren(),b.length=0,t.forEach((e,t)=>{let n=document.createElement(`div`);n.className=`${Xi}__frame`,n.dataset.photoIndex=String(t);let r=document.createElement(`div`);r.className=`${Xi}__frame-inner`;let i=document.createElement(`div`);i.className=`${Xi}__image-wrap`;let a=document.createElement(`img`);a.className=`${Xi}__image`,a.src=e.src,a.alt=e.alt??e.title??`Photo ${t+1}`,a.draggable=!1,i.appendChild(a),r.appendChild(i),n.appendChild(r),E.appendChild(n),b[t]=n});let s=t.length,l=ia(n.initialIndex??0,s);i=l,a=0,o=null,v=l,k(l),j()},N=(e,t)=>{s&&(s=!1,l=null,a=!t||e-h>ta?0:ra(a,-8,$i),o=null)},P=e=>{O().length<=0||e.button!==0||(s=!0,g=!1,l=e.pointerId,u=e.clientX,d=e.clientY,f=i,p=e.clientX,m=e.clientY,h=e.timeStamp,a=0,o=null,T.setPointerCapture(e.pointerId))},F=e=>{if(!s||l!==e.pointerId)return;let t=e.clientX-u,r=e.clientY-d;Math.hypot(t,r)>Zi&&(g=!0);let i=e.clientX-p,o=e.clientY-m,c=Math.max(.008,(e.timeStamp-h)/1e3),_=n.dragSensitivity??.008,v=(Math.abs(o)>=Math.abs(i)?-o*_:-i*_)/c,y=1-Math.exp(-c/na);a+=(v-a)*y;let b=Math.abs(r)>=Math.abs(t)?-r*_:-t*_,x=Math.max(0,O().length-1),S=ra(f+b,0,x);p=e.clientX,m=e.clientY,h=e.timeStamp,k(S),A(ia(S,O().length))},I=e=>{if(l!==e.pointerId)return;let t=!g;N(e.timeStamp,!0);try{T.releasePointerCapture(e.pointerId)}catch{}if(t){let e=O()[v];e&&n.onPhotoClick?.(v,e)}},L=e=>{if(l===e.pointerId){N(e.timeStamp,!1);try{T.releasePointerCapture(e.pointerId)}catch{}}},R=performance.now(),z=e=>{if(r)return;if(y=requestAnimationFrame(z),_){R=e;return}let t=Math.min(.05,(e-R)/1e3);if(R=e,s)return;let c=O().length,l=Math.max(0,c-1),u=i,d=a,f=!1;if(o!==null){let e=o-u;Math.abs(e)<=.004?(u=o,o=null,d=0,A(ia(u,c)),f=!0):(u+=e*Math.min(1,ea*t),d=0,f=!0)}else if(Math.abs(d)>Qi)d*=Math.exp(-(n.friction??1.5)*t),Math.abs(d)<=Qi&&(d=0),u=ra(u+d*t,0,l),f=!0,(d===0||u<=0||u>=l)&&(o=ia(u,c));else if((n.autoAdvance??!1)&&c>1){u+=(n.autoAdvanceSpeed??.15)*t,u>=l?u=l:f=!0;let e=ia(u,c);e!==v&&A(e)}else{let e=ia(u,c);Math.abs(u-e)>.004?(o=e,f=!0):u!==e&&(u=e,A(e),f=!0)}a=d,f&&k(u)};M();let B=(0,c.bindVisibilityPause)(e=>{_=e});return T.addEventListener(`pointerdown`,P),T.addEventListener(`pointermove`,F),T.addEventListener(`pointerup`,I),T.addEventListener(`pointercancel`,L),y=requestAnimationFrame(z),{update(t){let r=n.initialIndex,s=n.photos;if(n={...n,...t},n.photos!==s)M();else{if(S.className=[Xi,n.className].filter(Boolean).join(` `),(0,c.applyBlockHostBox)(e,S,{width:n.width??380,height:n.height??480}),aa(S,n.style),n.initialIndex!==r){let e=ia(n.initialIndex??0,O().length);i=e,a=0,o=null,v=e,k(e)}j()}},destroy(){r||(r=!0,cancelAnimationFrame(y),B(),T.removeEventListener(`pointerdown`,P),T.removeEventListener(`pointermove`,F),T.removeEventListener(`pointerup`,I),T.removeEventListener(`pointercancel`,L),S.remove())}}}var q=`cos-photo-view-master`,sa=380,ca=420,la=300,ua=160,da=6,fa=640,pa=2.2,ma=90,ha=.045,ga=.35,_a=14,va=(e,t,n)=>Math.max(t,Math.min(n,e)),ya=(e,t)=>t<=0?0:(e%t+t)%t,ba=(e,t,n)=>n<=0?0:ya(Math.round(-e/t),n),xa=(e,t,n)=>{let r=-t*n;return r+Math.round((e-r)/360)*360},Sa=(e,t)=>{if(t)for(let[n,r]of Object.entries(t))r!=null&&(n.startsWith(`--`)?e.style.setProperty(n,String(r)):e.style[n]=String(r))};function Ca(e,t={photos:[]}){let n={dragSensitivity:.45,friction:1.4,autoRotate:!0,autoRotateSpeed:8,showCaption:!0,initialIndex:0,ariaLabel:`观景器`,...t,photos:Array.isArray(t.photos)?t.photos:[]},r=!1,i=0,a=0,o=!1,s=null,l=0,u=0,d=!1,f=0,p=!1,m=0,h=0,g=performance.now(),_=document.createElement(`div`);_.setAttribute(`role`,`img`);let v=document.createElement(`div`);v.className=`${q}__empty`,v.textContent=`暂无照片`;let y=document.createElement(`div`);y.className=`${q}__body`;let b=document.createElement(`div`);b.className=`${q}__top-bulb`,b.setAttribute(`aria-hidden`,`true`);let x=document.createElement(`div`);x.className=`${q}__side-grip ${q}__left`,x.setAttribute(`aria-hidden`,`true`);let S=document.createElement(`div`);S.className=`${q}__side-grip ${q}__right`,S.setAttribute(`aria-hidden`,`true`);let C=document.createElement(`div`);C.className=`${q}__body-ridge`,C.setAttribute(`aria-hidden`,`true`);let w=document.createElement(`div`);w.className=`${q}__disc-stage`;let T=document.createElement(`div`);T.className=`${q}__disc`,T.setAttribute(`aria-hidden`,`true`),w.appendChild(T);let E=document.createElement(`div`);E.className=`${q}__peep-stack`;let D=document.createElement(`div`);D.className=`${q}__peep-ring`,D.setAttribute(`aria-hidden`,`true`);let O=document.createElement(`div`);O.className=`${q}__peep-window`;let k=document.createElement(`img`);k.className=`${q}__peep-image`,k.draggable=!1;let A=document.createElement(`div`);A.className=`${q}__peep-vignette`,A.setAttribute(`aria-hidden`,`true`);let j=document.createElement(`div`);j.className=`${q}__peep-glare`,j.setAttribute(`aria-hidden`,`true`),O.append(k,A,j),E.append(D,O),y.append(b,x,S,C,w,E);let M=document.createElement(`div`);M.className=`${q}__caption`,_.append(v,y,M),e.appendChild(_);let N=()=>Array.isArray(n.photos)?n.photos:[],P=()=>{let e=N().length;return e>0?360/e:360},F=()=>{let e=n.discSize??la,t=n.peepSize??ua;return(e-t)/4+t/2},I=e=>{i=e,T.style.transform=`rotate(${e}deg)`;let t=N().length,r=ba(e,P(),t);if(r!==m){m=r;let e=N()[r];e&&n.onIndexChange?.(r,e),L()}},L=()=>{let e=N()[m];e?(k.hidden=!1,k.src=e.src,k.alt=e.alt??e.title??`Photo ${m+1}`):(k.hidden=!0,k.removeAttribute(`src`));let t=!!(n.showCaption&&e&&(e.title||e.description));if(M.hidden=!t,M.replaceChildren(),t&&e){if(e.title){let t=document.createElement(`p`);t.className=`${q}__caption-title`,t.textContent=e.title,M.appendChild(t)}if(e.description){let t=document.createElement(`p`);t.className=`${q}__caption-desc`,t.textContent=e.description,M.appendChild(t)}}let r=t&&e?.title?`,当前:${e.title}${e.description?`,${e.description}`:``}`:``;_.setAttribute(`aria-label`,(n.ariaLabel??`观景器`)+r)},R=()=>{let e=N(),t=e.length,r=t===0;(0,c.setHidden)(v,!r),(0,c.setHidden)(y,r),r&&(0,c.setHidden)(M,!0),T.replaceChildren();let o=P(),s=F();e.forEach((e,t)=>{let n=document.createElement(`div`);n.className=`${q}__slot`,n.style.transform=`rotate(${t*o}deg) translateY(-${s}px)`;let r=document.createElement(`div`);r.className=`${q}__slot-frame`;let i=document.createElement(`img`);i.className=`${q}__slot-image`,i.src=e.src,i.alt=``,i.draggable=!1,r.appendChild(i),n.appendChild(r),T.appendChild(n)});let l=ya(n.initialIndex??0,t);m=l,i=-l*o,a=0,T.style.transform=`rotate(${i}deg)`,L()},z=()=>{_.className=[q,n.className].filter(Boolean).join(` `),(0,c.applyBlockHostBox)(e,_,{width:n.width??sa,height:n.height??ca}),_.style.setProperty(`--pvm-disc-size`,`${n.discSize??la}px`),_.style.setProperty(`--pvm-peep-size`,`${n.peepSize??ua}px`),Sa(_,n.style)},B=(e,t)=>{o&&(o=!1,s=null,a=!t||e-u>ma?0:va(a,-640,fa))},V=e=>{e.button!==0||N().length<=0||(o=!0,d=!1,s=e.pointerId,f=e.clientX,l=e.clientX,u=e.timeStamp,a=0,_.setPointerCapture(e.pointerId))},H=e=>{if(!o||s!==e.pointerId)return;let t=e.clientX-l,r=Math.max(.008,(e.timeStamp-u)/1e3);Math.abs(e.clientX-f)>da&&(d=!0);let c=n.dragSensitivity??.45;I(i-t*c);let p=-t/r*c,m=1-Math.exp(-r/ha);a+=(p-a)*m,l=e.clientX,u=e.timeStamp},ee=e=>{if(s!==e.pointerId)return;let t=!d;B(e.timeStamp,!0);try{_.releasePointerCapture(e.pointerId)}catch{}if(t){let e=N()[m];e&&n.onPhotoClick?.(m,e)}},U=e=>{s===e.pointerId&&B(e.timeStamp,!1)},te=e=>{if(r)return;if(h=requestAnimationFrame(te),p){g=e;return}let t=Math.min(.05,(e-g)/1e3);g=e;let s=N().length;if(o||s<=0)return;let c=i,l=a,u=P();if(Math.abs(l)>pa)c+=l*t,l*=Math.exp(-(n.friction??1.4)*t),Math.abs(l)<=pa&&(l=0);else{l=0;let e=ba(c,u,s),r=xa(c,e,u),i=r-c;Math.abs(i)>ga?c+=i*Math.min(1,_a*t):(c=r,(n.autoRotate??!0)&&(c-=(n.autoRotateSpeed??8)*t))}a=l,I(c)};z(),R();let ne=(0,c.bindVisibilityPause)(e=>{p=e});return _.addEventListener(`pointerdown`,V),_.addEventListener(`pointermove`,H),_.addEventListener(`pointerup`,ee),_.addEventListener(`pointercancel`,U),h=requestAnimationFrame(te),{update(e){let t=n.photos,r=n.discSize,i=n.peepSize,a=n.initialIndex;n={...n,...e},z(),n.photos!==t||n.discSize!==r||n.peepSize!==i||n.initialIndex!==a?R():L()},destroy(){r||(r=!0,cancelAnimationFrame(h),ne(),_.removeEventListener(`pointerdown`,V),_.removeEventListener(`pointermove`,H),_.removeEventListener(`pointerup`,ee),_.removeEventListener(`pointercancel`,U),_.remove())}}}var wa=`cos-plasma-ball`,Ta=(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=Ta(e,t,o+f,s+p,i*.55,a-1),h=Ta(o+f,s+p,n,r,i*.55,a-1);return[...m.slice(0,-1),...h]};function Ea(e,t={}){let n={width:320,height:320,color:`#a78bfa`,arcCount:8,...t},r=!1,i=0,a=typeof document<`u`?document.hidden:!1,o=null,s={x:160,y:160,active:!1},l=[],u=document.createElement(`div`);u.className=wa;let d=document.createElement(`canvas`);d.className=`${wa}__canvas`,u.appendChild(d),e.appendChild(u);let f=()=>{let e=n.arcCount??8;l=Array.from({length:e},(t,n)=>({angle:n/e*Math.PI*2,length:.6+Math.random()*.35,speed:.02+Math.random()*.03}))},p=()=>{let e=n.width??320,t=n.height??320;u.style.width=`${e}px`,u.style.height=`${t}px`,d.style.width=`${e}px`,d.style.height=`${t}px`;let r=window.devicePixelRatio||1;d.width=e*r,d.height=t*r;let i=d.getContext(`2d`);i&&i.setTransform(r,0,0,r,0,0)},m=(e,t)=>{let n=d.getBoundingClientRect();s.x=e-n.left,s.y=t-n.top,s.active=!0},h=()=>{s.active=!1},g=e=>m(e.clientX,e.clientY),_=e=>{e.touches[0]&&m(e.touches[0].clientX,e.touches[0].clientY)},v=()=>{if(r||(i=requestAnimationFrame(v),a))return;let e=d.getContext(`2d`);if(!e)return;let t=n.width??320,o=n.height??320,c=n.color??`#a78bfa`,u=t/2,f=o/2,p=Math.min(t,o)*.38;e.fillStyle=`#0f172a`,e.fillRect(0,0,t,o);let m=e.createRadialGradient(u,f,p*.1,u,f,p*1.1);m.addColorStop(0,`rgba(30, 41, 59, 0.9)`),m.addColorStop(.7,`rgba(15, 23, 42, 0.6)`),m.addColorStop(1,`rgba(15, 23, 42, 0)`),e.beginPath(),e.arc(u,f,p*1.05,0,Math.PI*2),e.fillStyle=m,e.fill(),e.beginPath(),e.arc(u,f,p,0,Math.PI*2),e.strokeStyle=`rgba(148, 163, 184, 0.35)`,e.lineWidth=2,e.stroke(),l.forEach(t=>{t.angle+=t.speed*(Math.random()>.5?1:-1);let n=s.active?Math.atan2(s.y-f,s.x-u)+(t.angle-Math.PI)*.15:t.angle,r=p*t.length,i=Ta(u,f,u+Math.cos(n)*r,f+Math.sin(n)*r,18,4);e.beginPath(),i.forEach(([t,n],r)=>r===0?e.moveTo(t,n):e.lineTo(t,n)),e.strokeStyle=c,e.lineWidth=1.5,e.shadowColor=c,e.shadowBlur=14,e.globalAlpha=.85,e.stroke(),e.shadowBlur=0,e.globalAlpha=1}),e.beginPath(),e.arc(u,f,10,0,Math.PI*2);let h=e.createRadialGradient(u,f,0,u,f,10);h.addColorStop(0,`#fff`),h.addColorStop(.5,c),h.addColorStop(1,c),e.fillStyle=h,e.shadowColor=c,e.shadowBlur=20,e.fill(),e.shadowBlur=0};return f(),p(),d.addEventListener(`mousemove`,g),d.addEventListener(`mouseleave`,h),d.addEventListener(`touchmove`,_,{passive:!0}),d.addEventListener(`touchend`,h),o=(0,c.bindVisibilityPause)(e=>{a=e}),v(),{update(e){let t=n.arcCount??8;n={...n,...e},p(),(n.arcCount??8)!==t&&f()},destroy(){r||(r=!0,cancelAnimationFrame(i),o?.(),d.removeEventListener(`mousemove`,g),d.removeEventListener(`mouseleave`,h),d.removeEventListener(`touchmove`,_),d.removeEventListener(`touchend`,h),u.remove())}}}var Da=`cos-smoke-fog`,Oa=800,ka=500,Aa=10,ja=128,Ma=`#d2d4d8`,Na=[`#14151c`,`#1a1b24`,`#0e0f14`],Pa=(e,t)=>{let n=Math.sin(e*127.1+t*311.7)*43758.5453;return n-Math.floor(n)},Fa=(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=Pa(n,r),l=Pa(n+1,r),u=Pa(n,r+1),d=Pa(n+1,r+1);return c+(l-c)*o+(u-c)*s+(c-l-u+d)*o*s},Ia=(e,t)=>{let n=0,r=.5,i=1;for(let a=0;a<4;a++)n+=r*Fa(e*i,t*i),i*=2.05,r*=.5;return n},La=(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]},Ra=(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)],za=(e,t=1)=>t>=1?`rgb(${e[0]} ${e[1]} ${e[2]})`:`rgb(${e[0]} ${e[1]} ${e[2]} / ${t})`,Ba=e=>{if(Array.isArray(e)&&e.length>=3)return[e[0],e[1],e[2]];let t=La(typeof e==`string`?e:Na[2],[14,15,20]),n=Ra(t,[255,255,255],.06);return[za(Ra(t,[255,255,255],.1)),za(n),za(t)]},Va=(e,t)=>{let n=document.createElement(`canvas`);n.width=ja,n.height=ja;let r=n.getContext(`2d`),i=r.createImageData(ja,ja),a=i.data,o=ja/2,s=ja/2,c=ja*.48;for(let n=0;n<ja;n++)for(let r=0;r<ja;r++){let i=(r-o)/c,l=(n-s)/c,u=Math.hypot(i,l);if(u>1.15)continue;let d=Ia(r*.045+e*17.1,n*.045+e*9.3)*.7+Ia(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*ja+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},Ha=e=>Array.from({length:Aa},(t,n)=>Va(n+1,e)),Ua=(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()*Aa),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()}},Wa=(e,t)=>{let n=Math.hypot(e.vx,e.vy);if(n<=t)return;let r=t/n;e.vx*=r,e.vy*=r},Ga=e=>e<.06?e/.06:e>.55?Math.max(0,1-(e-.55)/.45):1,Ka=(e,t)=>.22+Math.min(1,Math.max(0,e/t))**1.15*.78;function qa(e,t={}){let n={fill:!1,density:.5,color:Ma,backgroundColor:Na,speed:1,disperseStrength:1,disperseRadius:1,interactive:!0,...t},r=!1,i=n.width??Oa,a=n.height??ka,o=typeof document<`u`?document.hidden:!1,s=(0,c.prefersReducedMotion)(),l=null,u=null,d=null,f=null,p=[],m=[],h=null,g=``,_=document.createElement(`div`);_.className=Da;let v=document.createElement(`canvas`);v.className=`${Da}__canvas`,_.appendChild(v),e.appendChild(_);let y=()=>{(0,c.applyCanvasHostBox)(e,_,{fill:!!n.fill,width:i,height:a}),v.style.width=String(i)+`px`,v.style.height=String(a)+`px`,n.ariaLabel&&(v.setAttribute(`role`,`img`),v.setAttribute(`aria-label`,n.ariaLabel)),n.interactive!==void 0&&(v.style.cursor=n.interactive?`pointer`:`default`)},b=()=>{if(l?.(),l=null,!(n.fill??!1)){i=n.width??Oa,a=n.height??ka,y(),typeof x==`function`&&x(),S();return}l=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:Oa,defaultHeight:ka,measured:e});i=t.width,a=t.height,y(),typeof x==`function`&&x(),S()})},x=()=>{let e=Math.floor(56+(n.density??.5)*100);p.splice(0,p.length);for(let t=0;t<e;t++){let e=Math.random()**1.75;p.push(Ua(i,a,e))}},S=()=>{f?.(),f=null,cancelAnimationFrame(0);let e=Math.min(window.devicePixelRatio||1,2);v.width=Math.floor(i*e),v.height=Math.floor(a*e);let t=v.getContext(`2d`);if(!t)return;t.setTransform(e,0,0,e,0,0);let r=n.color??Ma,l=La(r,[210,212,216]);h||(h=Ha(l),g=r);let u=h,d=0,_=0,y=()=>{let[e,r,o]=Ba(n.backgroundColor??Na),s=t.createLinearGradient(0,0,0,a);s.addColorStop(0,e),s.addColorStop(.45,r),s.addColorStop(1,o),t.fillStyle=s,t.fillRect(0,0,i,a);let c=La(o,[14,15,20]),l=Ra(c,[255,255,255],.22),u=t.createRadialGradient(i*.5,a*.75,0,i*.5,a,i*.55);u.addColorStop(0,za(l,.35)),u.addColorStop(1,za(c,0)),t.fillStyle=u,t.fillRect(0,0,i,a)},b=e=>{let n=Ga(e.age)*Ka(e.y,a);if(n<=.01)return;let r=u[e.sprite],i=e.birthSize+(e.maxSize-e.birthSize)*Math.min(1,e.age*1.15),o=e.size+(i-e.size)*.35,s=o,c=o*e.stretch;t.save(),t.translate(e.x,e.y),t.rotate(e.rotation),t.globalAlpha=e.opacity*n*(.85+e.warmth*.2),t.globalCompositeOperation=`screen`,t.drawImage(r,-s/2,-c/2,s,c),t.restore()},x=()=>{if(_=requestAnimationFrame(x),o||s)return;let e=(0,c.clamp)(n.speed??1,0,3),r=(0,c.clamp)(n.disperseStrength??1,0,3);d+=.01*Math.max(e,.001),y();let l=n.color??Ma;g!==l&&(h=Ha(La(l,[210,212,216])),g=l);let f=h??u;for(let e=m.length-1;e>=0;e--){let t=m[e],n=1-t.life,i=Math.sin(Math.PI*Math.min(1,n*1.05))*t.strength;t.radius+=(t.maxRadius-t.radius)*.055;for(let e of p){let n=e.x-t.x,a=e.y-t.y,o=Math.hypot(n,a)||.001;if(o>t.radius)continue;let s=o/t.radius,c=Math.exp(-s*s*2.2)*(1-s*.35),l=Math.exp(-(((s-.72)/.32)**2)),u=c*.55+l*.45,f=.72+.28*Math.sin(e.phase*2.7+d*1.2+o*.03),p=u*e.receptivity*f*i;if(p<.02)continue;let m=n/o,h=a/o,g=-h*t.swirl,_=m*t.swirl,v=1/(.65+e.mass*.7),y=Math.sin(e.phase*4.2+d*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,Wa(e,2.4*Math.max(r,.35))}t.life*=.972,t.life<.04&&m.splice(e,1)}t.save();for(let n=0;n<p.length;n++){let r=p[n],o=Math.sin(d*.55+r.phase)*.16,s=Math.cos(d*.4+r.phase*1.3)*.05;r.vx+=o*.018*e,r.vy+=s*.01*e-.0035*e;let c=Math.hypot(r.vx,r.vy),l=c>.8?.975:.99;r.vx*=l,r.vy*=l,r.x+=r.vx*e,r.y+=r.vy*e,r.rotation+=(r.spin+r.vx*.002)*e,r.age+=r.ageSpeed*e;let u=r.birthSize+(r.maxSize-r.birthSize)*Math.min(1,r.age*1.15);r.size+=(u-r.size)*.04;let m=(.3+r.warmth*.1)*Ka(r.y,a),h=.006+.008*Math.max(0,1-c/2.2);if(r.opacity+=(m-r.opacity)*h,r.stretch+=(1.05+(1-r.y/a)*.55-r.stretch)*.01,r.age>=1||r.y<-r.size||r.opacity<.02){p[n]=Ua(i,a,0);continue}r.x<-r.size&&(r.x=i+r.size*.5),r.x>i+r.size&&(r.x=-r.size*.5);let g=Ga(r.age)*Ka(r.y,a);if(g<=.01)continue;let _=f[r.sprite],v=r.birthSize+(r.maxSize-r.birthSize)*Math.min(1,r.age*1.15),y=r.size+(v-r.size)*.35,b=y,x=y*r.stretch;t.save(),t.translate(r.x,r.y),t.rotate(r.rotation),t.globalAlpha=r.opacity*g*(.85+r.warmth*.2),t.globalCompositeOperation=`screen`,t.drawImage(_,-b/2,-x/2,b,x),t.restore()}t.restore(),t.globalCompositeOperation=`source-over`,t.globalAlpha=1};if(s){y();for(let e of p)b(e);t.globalCompositeOperation=`source-over`,t.globalAlpha=1;return}x(),f=()=>{cancelAnimationFrame(_)}},C=(e,t)=>{if(!(n.interactive??!0))return;let r=v.getBoundingClientRect();if(r.width<=0||r.height<=0)return;let o=(e-r.left)/r.width*i,s=(t-r.top)/r.height*a,l=(0,c.clamp)(n.disperseRadius??1,0,3),u=(0,c.clamp)(n.disperseStrength??1,0,3);m.length>3&&m.shift(),m.push({x:o,y:s,life:1,swirl:Math.random()<.5?-1:1,radius:Math.min(i,a)*.08*l,maxRadius:Math.min(i,a)*(.42+Math.random()*.12)*l,strength:(.7+Math.random()*.25)*u})},w=e=>{e.pointerType===`mouse`&&e.button!==0||C(e.clientX,e.clientY)};return v.addEventListener(`pointerdown`,w),u=(0,c.bindVisibilityPause)(e=>{o=e}),d=(0,c.bindPrefersReducedMotion)(e=>{s=e,S()}),y(),b(),{update(e){let t=n.fill,r=n.width,i=n.height,a=n.density;n={...n,...e},y(),(n.fill!==t||n.width!==r||n.height!==i||n.density!==a)&&b()},destroy(){r||(r=!0,f?.(),cancelAnimationFrame(0),v.removeEventListener(`pointerdown`,w),u?.(),d?.(),l?.(),_.remove())}}}var Ja=.82,Ya=.08,Xa=1e3/60,Za=46*2.6,Qa=()=>({x:-1e3,y:-1e3,prevX:-1e3,prevY:-1e3,vx:0,vy:0,speed:0,active:!1,lastTs:0}),$a=e=>e<.5?2*e*e:1-(-2*e+2)**2/2,eo=e=>1-(1-e)**3,to=(e,t,n)=>{let r=Math.min(1,Math.max(0,(n-e)/(t-e)));return r*r*(3-2*r)},no=(e,t)=>e**t,ro=e=>{let t=Math.sin(e*127.1+311.7)*43758.5453;return t-Math.floor(t)},io=(e,t,n=!0)=>{let r=.18+(e/18)**.5*.52,i=n?.8+Math.random()*.35:1;return r*t*i},ao=(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()},oo=(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()},so=(e,t,n,r,i)=>{let a=Math.min(70,Math.floor(t*n/22e3));for(let o=0;o<a;o++){let a=ro(o+1),s=ro(o+57),c=ro(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},co=(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),ao(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%)`]]),ao(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%)`]]),ao(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=ro(r+3),a=ro(r+11);ao(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),ao(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%)`]]),ao(e,t*.28,n*1.02,t*.4,[[0,`rgb(0 3 6 / 28%)`],[1,`rgb(0 3 6 / 0%)`]]),ao(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)},lo=(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;oo(e,s,-n*.02,c,n*(.7+i%2*.12),.12+i%3*.04,l)}oo(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(),so(e,t,n,r,i)},uo=()=>{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},fo=(e,t)=>e.find(e=>e.id===t),po=e=>{let t=e.progress,n=$a(to(0,.72,t)),r=eo(to(.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}},mo=(e,t)=>{let n=new Map;for(let t of e){let e=`${Math.floor(t.x/Za)},${Math.floor(t.y/Za)}`,r=n.get(e);r?r.push(t):n.set(e,[t])}for(let r of e){let e=Math.floor(r.x/Za),i=Math.floor(r.y/Za);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)}}},ho=e=>{mo(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})},go=(e,t,n)=>{mo(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)})},_o=(e,t,n,r)=>{let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=fo(e,o.primaryId),c=fo(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=po(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,io(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)},vo=(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=io(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}},yo=(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}),bo=(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=yo(e.x,e.y,t);e.vx+=(e.drift*.015+u.x*.05)*i,e.vy+=u.y*.025*i,e.vx*=no(.968,i),e.vy*=no(.994,i),e.x+=(e.vx+u.x*.22)*i,e.y+=e.vy*i},xo=(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)}},So=(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*=no(.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*=no(.997,t),e.mode3Phase+=(.04+Math.abs(e.mode3Vel)*.8)*t,e.streamStretch*=no(.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)},Co=(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},wo=(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)},To=(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=wo(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},Eo=(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},Do=(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;Eo(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}},Oo=(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=Do(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)}},ko=(e,t,n,r,i,a)=>{let o=To(t,n),s=Math.min(1,Math.max(0,t.y/a)),c=i*Ja,l=a*Ya,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},Ao=(e,t,n,r,i,a,o,s,c,l,u)=>{let d=Oo(t,n,r,i,a,o),f=Math.min(1,Math.max(0,d.cy/l)),p=c*Ja,m=l*Ya,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},jo=`cos-bubble-field`,Mo=800,No=500;function Po(e,t={}){let n={fill:!1,bubbleCount:36,speed:1,color:`#7dd3fc`,interactive:!0,...t},r=!1,i=n.width??Mo,a=n.height??No,o=0,s=0,l=typeof document<`u`?document.hidden:!1,u=(0,c.prefersReducedMotion)(),d=null,f=null,p=null,m=[],h=[],g=Qa(),_=0,v=0,y=1,b=0,x=null,S=null,C=document.createElement(`div`);C.className=jo;let w=document.createElement(`canvas`);w.className=`${jo}__canvas`,C.appendChild(w),e.appendChild(C);let T=()=>{m.length=0;let e=n.bubbleCount??36,t=n.speed??1;for(let n=0;n<e;n++){let e=vo(y++,i,a,t,!0);e.y=a*(.15+Math.random()*.85),e.vy=-e.terminalRise*(.35+Math.random()*.35),m.push(e)}h.length=0,g=Qa(),_=0,v=0,b=0},E=()=>{(0,c.applyCanvasHostBox)(e,C,{fill:!!n.fill,width:i,height:a}),w.style.width=`${i}px`,w.style.height=`${a}px`},D=()=>{let e=Math.min(window.devicePixelRatio||1,2);w.width=Math.floor(i*e),w.height=Math.floor(a*e);let t=w.getContext(`2d`);return t&&t.setTransform(e,0,0,e,0,0),{ctx:t,dpr:e}},O=()=>{if(d?.(),d=null,!(n.fill??!1)){i=n.width??Mo,a=n.height??No,E(),D(),T();return}d=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:Mo,defaultHeight:No,measured:e});i=t.width,a=t.height,E(),D(),T()})},k=(e,t)=>{let n=w.getBoundingClientRect(),r=i/Math.max(n.width,1),o=a/Math.max(n.height,1);return{x:(e-n.left)*r,y:(t-n.top)*o}},A=(e,t)=>{if(!(n.interactive??!0))return;let{x:r,y:i}=k(e,t),a=performance.now(),o=g.lastTs>0?Math.max(1,a-g.lastTs):16;if(g.active){let e=r-g.x,t=i-g.y,n=16/o,a=e*n,s=t*n,c=Math.hypot(a,s);g.vx=g.vx*.55+a*.45,g.vy=g.vy*.55+s*.45,g.speed=g.speed*.55+c*.45}else g.vx=0,g.vy=0,g.speed=0;g.prevX=g.x,g.prevY=g.y,g.x=r,g.y=i,g.active=!0,g.lastTs=a},j=()=>{g=Qa()},M=e=>A(e.clientX,e.clientY),N=e=>A(e.clientX,e.clientY),P=e=>A(e.clientX,e.clientY);w.addEventListener(`pointermove`,M),w.addEventListener(`pointerenter`,N),w.addEventListener(`pointerdown`,P),w.addEventListener(`pointerleave`,j);let F=(e,t,n)=>{let r=`${i}x${a}@${t}:${n}`;if(x?.key!==r){let e=document.createElement(`canvas`);e.width=w.width,e.height=w.height;let o=e.getContext(`2d`);o&&(o.setTransform(t,0,0,t,0,0),co(o,i,a,n),x={key:r,canvas:e})}x&&(e.setTransform(1,0,0,1,0,0),e.drawImage(x.canvas,0,0),e.setTransform(t,0,0,t,0,0))},I=()=>{let{ctx:e,dpr:t}=D();if(!e)return;S||=uo();let r=n.color??`#7dd3fc`;F(e,t,r),lo(e,i,a,_,S,!0);let o=[...m].sort((e,t)=>t.y-e.y);for(let t of o)ko(e,t,_,r,i,a)},L=()=>{cancelAnimationFrame(o),o=0,s=0},R=(e=0)=>{if(r||(o=requestAnimationFrame(R),l||u))return;let t=w.getContext(`2d`);if(!t)return;let c=Math.min(window.devicePixelRatio||1,2);t.setTransform(c,0,0,c,0,0),S||=uo(),s||=e;let d=Math.min(40,Math.max(8,e-s||16.666666666666668));s=e;let f=d/Xa,p=d/1e3;_+=p;let x=n.color??`#7dd3fc`,C=n.speed??1,T=n.bubbleCount??36,E=n.interactive??!0;w.style.cursor=E?`pointer`:`default`,F(t,c,x),lo(t,i,a,_,S,!1),v+=p,v>.2&&m.length<T&&(v=0,m.push(vo(y++,i,a,C))),g.active&&(g.speed*=no(.94,f),g.vx*=no(.94,f),g.vy*=no(.94,f));let D=new Set;for(let e of h)D.add(e.primaryId),D.add(e.secondaryId);for(let e of m){if(e.phase+=.008*f,e.tilt+=Math.sin(_*.2+e.deformPhase)*.0012*f,e.pulseBoost*=no(.92,f),e.settle*=no(.93,f),e.settle>0&&(e.aspect+=(.985-e.aspect)*.08*f),e.settle<.01&&(e.settle=0),D.has(e.id))So(e,f);else{bo(e,_,a,C,f),So(e,f);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*no(.9,f)+Math.min(.35,(t-.55)*.08)*f),e.streamAngle=e.streamAngle*no(.85,f)+n*(1-no(.85,f))}}if(E&&g.active&&g.speed>.2&&!D.has(e.id)){let t=xo(e.x,e.y,g.x,g.y,g.vx,g.vy,g.speed);if(t.excite>.01||Math.hypot(t.fx,t.fy)>.01){let n=1/(.75+e.radius*.035);e.vx+=t.fx*n*f,e.vy+=t.fy*n*.82*f,Co(e,t.strain,t.strainAngle,t.excite,t.fx,t.fy)}}if(e.y+e.radius<-12){let t=vo(y++,i,a,C);Object.assign(e,t,{y:a+t.radius+ b++*.01})}e.x<-e.radius*1.5&&(e.x=i+e.radius),e.x>i+e.radius*1.5&&(e.x=-e.radius)}let O=m.filter(e=>!D.has(e.id));ho(O),go(O,h,D),_o(m,h,C,f),D.clear();for(let e of h)D.add(e.primaryId),D.add(e.secondaryId);for(let e of h){let n=e.pose??po(e),r=Math.min(.9,.55+n.absorb*.2);Ao(t,n.ax,n.ay,n.ar,n.bx,n.by,n.br,x,i,a,r)}let k=[...m].sort((e,t)=>t.y-e.y);for(let e of k)D.has(e.id)||ko(t,e,_,x,i,a)},z=()=>{L(),w.removeEventListener(`pointermove`,M),w.removeEventListener(`pointerenter`,N),w.removeEventListener(`pointerdown`,P),w.removeEventListener(`pointerleave`,j),f?.(),p?.(),d?.()},B=()=>{if(L(),u){I();return}R()};return f=(0,c.bindVisibilityPause)(e=>{l=e}),p=(0,c.bindPrefersReducedMotion)(e=>{let t=u;u=e,u&&!t?(L(),I()):!u&&t&&B()}),O(),B(),{update(e){let t=n.fill,r=n.width,i=n.height,a=n.bubbleCount;n={...n,...e},w.style.cursor=n.interactive??!0?`pointer`:`default`;let o=n.fill!==t||n.width!==r||n.height!==i,s=n.bubbleCount!==a;o?(O(),B()):(s&&T(),u&&I())},destroy(){r||(r=!0,z(),C.remove())}}}var Fo=(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}},Io=(e,t,n,r,i=.36)=>({x:e+r.lx*n*i,y:t+r.ly*n*i}),Lo=(e,t,n,r,i=.4)=>({x:e+r.ax*n*i,y:t+r.ay*n*i}),Ro=(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()},zo=(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()},Bo=(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()},Vo=(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())},Ho=(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;Bo(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(),Ro(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&&Ro(e,c*t*.26,l*t*.26,t*.09,t*.05,n-.15,.12+o(s+28.4)*.14),e.restore(),Vo(e,t,0,0,i)},Uo=(e,t)=>.35+.65*Math.max(0,Math.cos(e-t)),Wo=(e,t,n,r,i,a,o)=>{let{shadeAmt:s,rimPeak:c,specBright:l,hash01:u,seed:d}=o,f=Io(n,r,i,a,.36),p=Lo(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);Ro(e,f.x,f.y,_,v,a.toLight-.3,l*.55),e.restore(),Vo(e,i,n,r,c,t)},Go=Math.PI*2,J=e=>{let t=Math.sin(e*127.1+311.7)*43758.5453;return t-Math.floor(t)},Y=(e=0,t=1)=>e+Math.random()*(t-e),Ko=(e,t=1)=>(.82+e*.18)*t,qo=(e,t)=>({shadeOpts:{seed:e,depth:t,shadeAmt:.06+J(e+2.3)*.08,rimPeak:.36+J(e+3.1)*.28,specBright:.68+J(e+9.2)*.28,hash01:J},filmBias:J(e+11.6),envAmt:.06+J(e+13.3)*.09,envRgb:J(e+23)>.5?[35,70,55]:[40,65,95]}),Jo=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)]},Yo=(e,t)=>{let[n,r,i]=Jo(e);return`rgba(${n},${r},${i},${t})`},Xo=(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,Go),e.fill(),e.restore()},Zo=(e,t,n,r,i,a,o=1)=>{let s=t.seed;e.globalCompositeOperation=`lighter`;let c=7+Math.floor(J(s+16.2)*5);for(let l=0;l<c;l++){let c=t.phase*.7+l*(.55+J(s+l*3.1)*.35)+i*(.14+l%3*.04)+s*.01,u=Jo(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+J(s+l*2.7)*.4),f=Math.cos(c)*d,p=Math.sin(c)*d*(.85+J(s+l)*.2),m=n*(.22+J(s+l*4.1)*.22),h=(.2+t.depth*.18)*(.55+J(s+l*5.3)*.45)*Uo(c,r)*o;Xo(e,f,p,m,m*(.55+J(s+l*6)*.4),c*.4,u,h)}let l=6+Math.floor(J(s+17.5)*4);for(let c=0;c<l;c++){let u=t.phase+c/l*Go+i*(.1+J(s+18)*.12)+a,d=Jo(a+.2+.6*(.5+.5*Math.sin(c*1.9+s+i*.45)));Xo(e,Math.cos(u)*n*.82,Math.sin(u)*n*.82,n*(.16+J(s+c*1.3)*.12),n*(.1+J(s+c*2.1)*.1),u+Math.PI/2,d,(.22+t.depth*.16+J(s+c)*.09)*Uo(u,r)*o)}e.globalCompositeOperation=`source-over`},Qo=Math.PI*2,$o=56,es=e=>e<.5?2*e*e:1-(-2*e+2)**2/2,ts=e=>1-(1-e)**3,ns=(e,t,n)=>{let r=Math.min(1,Math.max(0,(n-e)/(t-e)));return r*r*(3-2*r)},rs=.82,is=.08,as=(e,t)=>({x:e*rs,y:t*is}),os=e=>{let t=new Set;for(let n of e)t.add(n.primaryId),t.add(n.secondaryId);return t},ss=e=>{let t=e.progress,n=es(ns(0,.72,t)),r=ts(ns(.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)*ts(ns(.38,1,r)),v=ts(ns(.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}},cs=(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},ls=(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;cs(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}},us=(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,Qo),{path:e,cx:s,cy:c,radius:n}}let l=new Path2D;for(let o=0;o<=$o;o++){let u=ls(Qo*o/$o,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)}},ds=e=>1-ns(0,.18,e),fs=e=>ns(.76,.96,e),ps=(e,t,n,r,i,a,o,s,c=1)=>{let l=i+Math.PI+(J(a+19.2)-.5)*.3,u=.32+J(a+20.1)*.2;Xo(e,t+Math.cos(l)*r*u*c,n+Math.sin(l)*r*u*c,r*(.4+J(a+21)*.25)*c,r*(.28+J(a+22)*.18)*c,l,s,o)},ms=(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=Ko(t.depth,a?.alphaScale??1),u=Fo(t.x,t.y,r,i),{shadeOpts:d,filmBias:f,envAmt:p,envRgb:m}=qo(t.seed,t.depth);a?.skipShadow||zo(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;Ho(e,h,u.toLight,d),e.save(),e.beginPath(),e.arc(0,0,h*.995,0,Go),e.clip(),Zo(e,t,h,u.toLight,n,f),e.restore(),ps(e,0,0,h,u.toLight,t.seed,p,m),e.restore()},hs=(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=ds(a),b=fs(h),x=(1-y)*(1-b);if(y>.02&&i&&(ms(e,{...r,x:l,y:u,r:d},n,o,s,{skipShadow:!0,alphaScale:y}),ms(e,{...i,x:f,y:p,r:m},n,o,s,{skipShadow:!0,alphaScale:y})),b>.02&&ms(e,{...r,x:_,y:v,r:d},n,o,s,{skipShadow:!0,alphaScale:b}),x<.02)return;let S=us(l,u,d,f,p,m),{shadeOpts:C,filmBias:w,envAmt:T,envRgb:E}=qo(r.seed,r.depth),D=Fo(S.cx,S.cy,o,s),O=Ko(r.depth,x),k=S.radius;c?.skipShadow||zo(e,S.cx,S.cy,k*.85,D,r.depth,O),e.save(),e.globalAlpha=O,Wo(e,S.path,S.cx,S.cy,k,D,C),e.save(),e.clip(S.path),e.translate(S.cx,S.cy),Zo(e,r,k,D.toLight,n,w,x),e.translate(-S.cx,-S.cy);let A=D.toLight+Math.PI+(J(r.seed+19.2)-.5)*.3;Xo(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()},gs=(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=ds(t.progress),d=fs(n.absorb),f=Ko(r.depth),p=(1-u)*(1-d);if(u>.02&&i){let t=Fo(n.ax,n.ay,a,o),s=Fo(n.bx,n.by,a,o);zo(e,n.ax,n.ay,n.ar,t,r.depth,f*u),zo(e,n.bx,n.by,n.br,s,i.depth,f*u)}if(d>.02){let t=Fo(c,l,a,o);zo(e,c,l,n.ar,t,r.depth,f*d)}if(p>.02){let t=us(n.ax,n.ay,n.ar,n.bx,n.by,n.br),i=Fo(t.cx,t.cy,a,o);zo(e,t.cx,t.cy,t.radius*.85,i,r.depth,f*p)}},_s=(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=Yo(.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,Go),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,Go),e.fillStyle=`rgba(255,255,255,0.8)`,e.fill()}e.restore()},vs=(e,t)=>{let n=(0,c.clamp)(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,Go),e.fill(),e.restore()},ys=Math.PI*2,bs=(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)},xs=(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,ys),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,ys),e.fill()},Ss=(e,t,n)=>{bs(e,t,n);let r=t*rs,i=n*is;xs(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)},Cs=`cos-soap-bubbles`,ws=800,Ts=500,Es=(e,t,n,r=!0)=>{let i=Y(.25,1),a=(10+Y()*46)*(.5+i*.75),o=Y(12,55)*(.35+i*.8);return{id:n,x:Y(a,Math.max(a+1,e-a)),y:r?t+a+Y(0,t*.4):Y(a,t-a),r:a,vx:Y(-22,22),vy:-o*Y(.5,1.2),phase:Y(0,Go),wobble:Y(.55,1.35),seed:Y(0,1e3),depth:i,pop:0,popAng:0,rise:o,gust:Y(.55,1.35),gustT:Y(.3,1.8),drift:Y(-28,28),swayT:Y(.4,2.2),coolT:r?Y(.15,.55):Y(.4,1.1)}};function Ds(e,t={}){let n={fill:!1,count:28,speed:1,interactive:!0,ariaLabel:`肥皂泡背景`,...t},r=!1,i=n.width??ws,a=n.height??Ts,o=typeof document<`u`?document.hidden:!1,s=(0,c.prefersReducedMotion)(),l=null,u=null,d=null,f=null,p=null,m=null,h=document.createElement(`div`);h.className=Cs,h.setAttribute(`role`,`img`);let g=document.createElement(`canvas`);g.className=`${Cs}__canvas`,h.appendChild(g),e.appendChild(h);let _=()=>{(0,c.applyCanvasHostBox)(e,h,{fill:!!n.fill,width:i,height:a}),g.style.width=`${i}px`,g.style.height=`${a}px`,h.setAttribute(`aria-label`,n.ariaLabel??`肥皂泡背景`)},v=e=>{if(!(n.interactive??!0)||e.pointerType===`mouse`&&e.button!==0)return;let t=g.getBoundingClientRect();m={x:(e.clientX-t.left)/Math.max(t.width,1)*i,y:(e.clientY-t.top)/Math.max(t.height,1)*a}},y=()=>{f?.(),f=null;let e=g.getContext(`2d`);if(!e)return;let t=Math.min(window.devicePixelRatio||1,2);g.width=Math.floor(i*t),g.height=Math.floor(a*t),e.setTransform(t,0,0,t,0,0);let l=[],u=[],d=[],h=1,_=()=>h++,v=(0,c.clamp)(Math.round(n.count??28),8,80);for(let e=0;e<v;e++)l.push(Es(i,a,_(),e>v*.35));let y=e=>l.find(t=>t.id===e),b=0,x=0,S=0,C=(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=Y(30,90);u.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+Y(-20,20),vy:Math.sin(n)*i*.35+Y(-10,30),r:Y(1.4,3.2)*(.55+e.depth*.5),life:.45+Y()*.35,maxLife:.8,kind:1})}let i=28+Math.floor(e.r*.9);for(let t=0;t<i;t++){let t=Y(0,Go),n=Y(20,160);u.push({x:e.x+Math.cos(t)*e.r*Y(.2,.9),y:e.y+Math.sin(t)*e.r*Y(.2,.9),vx:Math.cos(t)*n,vy:Math.sin(t)*n-Y(10,80),r:Y(.6,1.8)*(.5+e.depth*.4),life:.25+Y()*.4,maxLife:.65,kind:0})}},w=()=>{Ss(e,i,a);let{x:t,y:n}=as(i,a);for(let r of l)r.pop<=0&&ms(e,r,S,t,n,{skipShadow:!0})},T=t=>{if(r)return;if(s){b=0,w();return}if(b=requestAnimationFrame(T),o)return;x||=t;let f=(0,c.clamp)((t-x)/1e3,.008,.033);x=t;let p=n.speed??1;Ss(e,i,a);let{x:h,y:g}=as(i,a);if(S+=f*p,m){let e=m;m=null;let t=null,n=1/0;for(let r of l){if(r.pop>0||d.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&&C(t,e.x,e.y)}let v=(0,c.clamp)(Math.round(n.count??28),8,80);for(;l.length<v;)l.push(Es(i,a,_(),!0));let E=os(d);for(let e of l){if(E.has(e.id))continue;if(e.coolT>0&&(e.coolT=Math.max(0,e.coolT-f*p)),e.pop>0){if(e.pop>=1){Object.assign(e,Es(i,a,_(),!0));continue}e.pop=Math.min(1,e.pop+f*p*2.6);continue}if(e.phase+=f*p*e.wobble,e.gustT-=f*p,e.gustT<=0){let t=Math.random();t<.18?e.gust=Y(.12,.4):t<.3?e.gust=Y(1.6,2.4):e.gust=Y(.55,1.35),e.gustT=Y(.35,2.4)}e.swayT-=f*p,e.swayT<=0&&(e.drift=Y(-36,36)*(.4+Math.random()),Math.random()<.2&&(e.drift*=Y(1.4,2.2)),e.swayT=Y(.45,2.6));let t=Math.sin(e.phase*1.7+e.seed)*4+Math.cos(e.phase*.9)*3,n=e.drift+t,r=-e.rise*e.gust+Math.sin(e.phase*2.1+e.seed*.2)*6,o=1-Math.exp(-f*p*1.6);e.vx+=(n-e.vx)*o,e.vy+=(r-e.vy)*o,Math.random()<f*.35&&(e.vx+=Y(-18,18)),e.x+=e.vx*f*p,e.y+=e.vy*f*p,e.x<-e.r&&(e.x=i+e.r),e.x>i+e.r&&(e.x=-e.r),e.y+e.r<0&&Object.assign(e,Es(i,a,_(),!0))}for(let e=0;e<l.length;e++){let t=l[e];if(!(t.pop>0||E.has(t.id)||t.coolT>0))for(let n=e+1;n<l.length;n++){let e=l[n];if(e.pop>0||E.has(e.id)||e.coolT>0)continue;let r=e.x-t.x,i=e.y-t.y,a=Math.hypot(r,i)||1,o=a-(t.r+e.r),s=Math.min(14,(t.r+e.r)*.18);if(o>s||o<-1)continue;let c=(1-Math.max(0,o)/s)*18*f*p,u=r/a,d=i/a;t.vx+=u*c,t.vy+=d*c*.55,e.vx-=u*c,e.vy-=d*c*.55}}for(let e=0;e<l.length;e++){let t=l[e];if(!(t.pop>0||t.coolT>0||E.has(t.id)))for(let n=e+1;n<l.length;n++){let e=l[n];if(e.pop>0||e.coolT>0||E.has(e.id))continue;let r=e.x-t.x,i=e.y-t.y,a=Math.hypot(r,i);if(a>=t.r+e.r-Math.min(t.r,e.r)*.1||a<.5)continue;let o=t.x+r*t.r/(t.r+e.r),s=t.y+i*t.r/(t.r+e.r);if(Math.random()<.3)C(t,o,s),C(e,o,s);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));d.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}),E.add(n.id),E.add(r.id)}}}for(let e=d.length-1;e>=0;e--){let t=d[e],n=y(t.primaryId),r=y(t.secondaryId);if(!n||!r){d.splice(e,1);continue}t.progress=Math.min(1,t.progress+f*p*.92);let i=(n.vx+r.vx)*.5,a=(n.vy+r.vy)*.5;t.sharedVx=i,t.sharedVy=a;let o=f*p;t.startPrimaryX+=i*o,t.startPrimaryY+=a*o,t.startSecondaryX+=i*o,t.startSecondaryY+=a*o;let s=ss(t);t.pose=s;let c=Math.max(1,s.ar+s.br),u=(s.ax*s.ar+s.bx*s.br)/c,m=(s.ay*s.ar+s.by*s.br)/c,h=Math.min(1,s.approach*.35+s.absorb*.65);if(n.x=s.ax+(u-s.ax)*h,n.y=s.ay+(m-s.ay)*h,n.r=s.ar,r.x=s.bx,r.y=s.by,r.r=s.br,n.vx=i,n.vy=a,r.vx=i,r.vy=a,t.progress>=1){let i=Math.max(1,s.ar+s.br);n.x=(s.ax*s.ar+s.bx*s.br)/i,n.y=(s.ay*s.ar+s.by*s.br)/i,n.r=t.targetRadius,n.depth=t.depth,n.rise=(n.rise+r.rise)*.5*.9,n.gust=(n.gust+r.gust)*.5,n.drift=(n.drift+r.drift)*.5,n.coolT=.35;let a=l.findIndex(e=>e.id===r.id);a>=0&&l.splice(a,1),d.splice(e,1)}}for(;l.length<v;)l.push(Es(i,a,_(),!0));if(l.length>v)for(let e=l.length-1;e>=0&&l.length>v;e--)!E.has(l[e].id)&&l[e].pop<=0&&l.splice(e,1);let D=os(d),O=l.map((e,t)=>t).filter(e=>!D.has(l[e].id)).sort((e,t)=>l[e].depth-l[t].depth);for(let t of O){let n=l[t];if(n.pop>0)continue;let r=Fo(n.x,n.y,h,g);zo(e,n.x,n.y,n.r,r,n.depth,.82+n.depth*.18)}for(let t of d){let n=t.pose??ss(t),r=y(t.primaryId),i=y(t.secondaryId);r&&gs(e,t,n,r,i,h,g)}for(let t of O){let n=l[t];if(n.pop>0){n.pop<.22&&(e.save(),e.globalAlpha=1-n.pop/.22,ms(e,n,S,h,g,{skipShadow:!0}),e.restore()),_s(e,n);continue}ms(e,n,S,h,g,{skipShadow:!0})}for(let t of d){let n=t.pose??ss(t),r=y(t.primaryId),i=y(t.secondaryId);r&&hs(e,n,S,r,i,t.progress,h,g,{skipShadow:!0})}for(let t=u.length-1;t>=0;t--){let n=u[t];if(n.vy+=(n.kind===0?180:260)*f,n.vx*=Math.exp(-f*(n.kind===0?1.8:1.1)),n.x+=n.vx*f,n.y+=n.vy*f,n.life-=f*(n.kind===0?1.5:1.15),n.life<=0){u.splice(t,1);continue}vs(e,n)}},E=()=>{r||s||b||T(0)};p=E,T(0),f=()=>{cancelAnimationFrame(b),b=0,p===E&&(p=null)}},b=()=>{if(l?.(),l=null,!(n.fill??!1)){i=n.width??ws,a=n.height??Ts,_(),y();return}l=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:ws,defaultHeight:Ts,measured:e});i=t.width,a=t.height,_(),y()})};return g.addEventListener(`pointerdown`,v),u=(0,c.bindVisibilityPause)(e=>{o=e}),d=(0,c.bindPrefersReducedMotion)(e=>{let t=s;s=e,t!==e&&(s||p?.())}),b(),{update(e){let t=n.fill,r=n.width,i=n.height;n={...n,...e},h.setAttribute(`aria-label`,n.ariaLabel??`肥皂泡背景`),(n.fill!==t||n.width!==r||n.height!==i)&&b()},destroy(){r||(r=!0,f?.(),u?.(),d?.(),l?.(),g.removeEventListener(`pointerdown`,v),h.remove())}}}var Os={WITHER:3.8,SPROUT:2.6,FLOWER:4.8,PUFFING:5.5},ks=1.05,As=.05,js=.46,Ms=.54,Ns=.82,Ps=.56,Fs=.9,Is=.2,Ls=.06,Rs=.14,zs=.32,Bs=.38,Vs=.034,Hs=2.4,Us=10.5,Ws=4.6,Gs=6.5,Ks=.38,qs=.46,Js=13.5,Ys=5.4,Xs=7.8,Zs=.038,Qs=.32,$s=Math.PI*(3-Math.sqrt(5)),ec=.4,tc=22*Math.PI/180,nc=.42,rc=.18,ic=.58,X=e=>{let t=Math.sin(e*127.1)*43758.5453;return t-Math.floor(t)},ac=e=>1-(1-(0,c.clamp)(e,0,1))**3,oc=e=>(0,c.clamp)(e,0,1)<.5?4*e*e*e:1-(-2*e+2)**3/2,Z=(e,t,n)=>{let r=(0,c.clamp)((n-e)/Math.max(t-e,1e-4),0,1);return r*r*(3-2*r)},sc=(e,t)=>Math.tanh(e*t),Q=(e,t,n)=>e+(t-e)*n,cc=e=>(0,c.clamp)(e/14,0,1),lc=e=>(0,c.clamp)(Math.hypot(e.x,e.y)/4.2,0,1),uc=(e,t)=>(0,c.clamp)((e-t*.66)/Math.max(t*.28,1),.08,.96),dc=(e,t,n)=>n*(.66+t*.24+(X(e*.031+t*7.1)-.5)*.035),fc=(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}),pc=()=>({phase:`mature`,phaseTime:0,grow:ks,puffReveal:1,stemLenRatio:1,leafScale:1,fade:1,wilt:0,stemBrown:0}),mc=()=>1+Math.random()*4,hc=e=>3+X(e*5.1)*2,gc=(e,t,n,r)=>Fc(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),_c=(e,t,n)=>{let r=1-e/Math.max(t-1,1)*2,i=Math.sqrt(Math.max(0,1-r*r)),a=$s*e;return{lx:Math.cos(a)*i*n,ly:r*n*.52,lz:Math.sin(a)*i*n*.38}},vc=e=>.58+e.depth*.42,yc=()=>1,bc=e=>{let t=(0,c.clamp)(e,0,1);return{budSize:0,budOpen:0,bloom:0,wilt:0,receptacle:1-Z(.5,.95,t)*.32,puff:t,glow:Z(.08,.42,t)*(1-Z(.82,1,t)*.45)}},xc=(e,t,n)=>{let r=(0,c.clamp)(t/.94,0,1),i=Math.max(e.radius*.52,1),a=(0,c.clamp)(Math.hypot(n.lx,n.ly)/i,0,1),o=X(n.hairPhase*2.7+n.lx*.03)*.022;if(a<.22)return{reveal:(0,c.clamp)(r/.045,0,1),expand:(0,c.clamp)((r-.008)/.065,0,1),fluffLen:(0,c.clamp)((r-.012)/.08,0,1)};let s=a*.28+o,l=.07+a*.3;return{reveal:Z(s,s+l,r),expand:Z(s+.006,s+l+.028,r),fluffLen:Z(s+.012,s+l+.04,r)}},Sc=e=>{let t=(0,c.clamp)(e.stemLen/Math.max(e.stem,.001),0,1);if(e.phase===`sprout`){let e=oc(t);return{budSize:Z(.04,.9,e),budOpen:0,bloom:Z(.78,.97,e)*.08,wilt:0,receptacle:0,puff:0,glow:0}}if(e.phase===`flower`){let t=e.phaseTime/Os.FLOWER,n=Z(As,js,t),r=Z(Ms,Ns,t),i=Z(Ps,Fs,t),a=Z(.02,.38,n)*(1-Z(.55,.88,n)),o=n*(1-r)*Z(.42,.72,n),s=r>=.7?(0,c.clamp)(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`?bc(e.puffReveal):e.phase===`mature`?bc(1):{budSize:0,budOpen:0,bloom:0,wilt:0,receptacle:0,puff:0,glow:0}},Cc=(e,t)=>Math.imul(e,7919)^Math.imul(Math.round(t*127.1),104729),wc=e=>{let t=.24+X(e+23.1)*.42,n=.09+X(e+51.2)*.24;return{stemBendX:(X(e+37.9)-.5)*t*2.5,stemBendY:(X(e+41.7)-.5)*t*1.55,stemBend2X:(X(e+63.4)-.5)*n*2.6,stemBend2Y:(X(e+67.2)-.5)*n*1.35}},Tc=()=>wc(Math.floor(Math.random()*2147483647)),Ec=e=>{let t=ac(e.stemLen/Math.max(e.stem,.001));if(e.phase===`sprout`)return t;if(e.phase===`flower`){let n=Sc(e).bloom;return t+(1-t)*Z(0,.55,n)*.85}return 1},Dc=(e,t,n)=>{let r=(e.stemBendX+e.stemBend2X*.42+e.lean*.1)*t*n,i=t*Math.tan(tc);return(0,c.clamp)(r*.32,-i,i)},Oc=(e,t,n,r)=>{let i=t.x*(1.28+X(e.id*5.1)*.88)+n*.2,a=t.y*(.58+X(e.id*7.3)*.32);e.swayVel+=((i-e.sway)*Us-e.swayVel*Ws)*r,e.sway+=e.swayVel*r,e.sway=(0,c.clamp)(e.sway,-4.2,4.2),e.liftVel+=((a-e.windLift)*Gs-e.liftVel*Ws)*r,e.windLift+=e.liftVel*r,e.windLift=(0,c.clamp)(e.windLift,-1.6,1.6)},kc=(e,t,n,r,i,a,o)=>{let s=Math.max(o*.52,1),l=(0,c.clamp)(Math.hypot(e.lx,e.ly)/s,0,1),u=lc(n),d=a?1:.32,f=3.8+l*7.5,p=4.6+l*8.2,m=Ks*(.55+l*.65)*d*(.35+u*.65),h=qs*(.55+l*.65)*d*(.35+u*.65),g=n.x*m+sc(t.sway,.18)*o*.055*d,_=n.y*h+sc(t.windLift,.22)*o*.042*d,v=1-Math.exp(-i*f),y=1-Math.exp(-i*p);e.fluffOx+=(g-e.fluffOx)*v,e.fluffOy+=(_-e.fluffOy)*y;let b=o*(.16+l*.14),x=Math.hypot(e.fluffOx,e.fluffOy);if(x>b){let t=b/x;e.fluffOx*=t,e.fluffOy*=t}let S=(.012+u*.028)*d,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}},Ac=e=>{switch(e.phase){case`sprout`:return .45;case`flower`:return .62;default:return 1}},jc=(e,t)=>{let n=Ac(e)*nc,r=Ac(e)*rc,i=t*Math.tan(tc)*.66,a=t*.03;return{dx:sc(e.sway,.19)*i*n,dy:sc(e.windLift,.22)*a*r}},Mc=e=>{let t=e.stemLen*(1-e.wilt*.12),n=yc(),r=e.x,i=e.ground,a={x:r,y:i},o=t*n,s=Dc(e,o,Ec(e)),{dx:c,dy:l}=jc(e,o),u={x:r+s+c,y:i-o+l},d={x:r+c*.04,y:i-o*ec+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*ec*(1-p*.15)+l*.06},cp2:{x:r+m*.62,y:i-o*.78+h*.28},head:{x:r+m,y:i-o+h}}},Nc=(e,t,n,r,i)=>{let a=uc(t,n),o=.82+X(i+11.7)*.38,s=(0,c.clamp)(.48+a*.62+(X(i+5.3)-.5)*.16,.42,1.38)*o,l=n*(.1+X(i+9.4)*.26+a*.1)*(.68+X(i+13.2)*.62),u=(8+X(i+2.8)*16)*s,d=(0,c.clamp)(Math.round(r*(.55+X(i+17.5)*.75)*(.75+s*.35)),20,96);return{x:e,ground:t,stem:l,radius:u,lean:(X(i+41.3)-.5)*.42,...wc(Cc(i,e)),depth:a,scale:s,seedQuota:d}},Pc=(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`?mc():-1,releaseDuration:n.phase===`mature`?hc(t):3,releaseElapsed:0,releaseSeedTotal:0,releasing:!1,releaseBoost:0}),Fc=(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=(0,c.clamp)(.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=(0,c.clamp)(.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),l=(8+Math.random()*16)*a,u=(0,c.clamp)(Math.round(r*(.55+Math.random()*.75)*(.75+a*.35)),20,96);return{x:e,ground:o,stem:s,radius:l,lean:(Math.random()-.5)*.42,...Tc(),depth:t,scale:a,seedQuota:u}})},Ic=(e,t)=>{if(t.fade<=.02||t.leafScale<=.02)return;let n=t.fade*vc(t);e.save(),e.globalAlpha=n*.92;let r=5+Math.floor(X(t.x*3.7)*3);for(let n=0;n<r;n++){let i=n/r*Math.PI*2+X(n+t.x)*.4,a=(14+X(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+(X(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()},Lc=(e,t)=>{if(t.fade<=.02||t.stemLen<=.5)return;let{base:n,cp1:r,cp2:i,head:a}=Mc(t),o=t.scale;e.save(),e.globalAlpha=t.fade*vc(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()},Rc=(e,t,n,r,i,a,o)=>{let s=ac((0,c.clamp)(i,0,1)),l=(0,c.clamp)(a,0,1);if(r<=.02||s<=.04)return;e.save();let u=n,d=(2.4+s*3.8)*u,f=(5.5+s*9.5)*u,p=r*(1-Z(.35,.92,l));for(let n=0;n<13;n++){let r=n/13*Math.PI*2-Math.PI/2+X(o+n*1.7)*.12,i=Z(.08,.82,l)*(.58+X(o+n*2.3)*.2),a=r+i*.55,s=a+i*1.05+.08,c=(.85+X(n+o)*.45)*u*(1-l*.3),m=t.x+Math.cos(a)*d*.42,h=t.y+Math.sin(a)*d*.18+u*.5,g=t.x+Math.cos(s)*f*.52,_=t.y-f*(.38-i*.12)+Math.sin(s)*f*.08,v=t.x+Math.cos(s)*f*.92,y=t.y-f*(.62-i*.22)+Math.sin(s)*f*.12,b=48+X(o+n)*22;e.globalAlpha=p*(.82+X(n)*.14),e.fillStyle=`rgba(${b-10}, ${b+32}, ${b-16}, 0.9)`,e.beginPath(),e.moveTo(m-Math.cos(a+Math.PI/2)*c,h-Math.sin(a+Math.PI/2)*c),e.quadraticCurveTo(g,_,v,y),e.quadraticCurveTo(g,_,m+Math.cos(a+Math.PI/2)*c,h+Math.sin(a+Math.PI/2)*c),e.closePath(),e.fill(),e.strokeStyle=`rgba(28, 48, 24, ${.32*(1-l*.55)})`,e.lineWidth=.32*u,e.beginPath(),e.moveTo(m,h),e.quadraticCurveTo(g,_,v,y),e.stroke()}if(l<.88){let n=r*(1-l*1.1)*.96;e.globalAlpha=n;let i=(2.2+s*3.4)*u*(1-l*.35),a=(4+s*6.5)*u*(1-l*.45),o=t.y-a*.4,d=e.createLinearGradient(t.x,o-a*.55,t.x,o+a*.35);d.addColorStop(0,`rgba(54, 86, 44, 0.95)`),d.addColorStop(.4,`rgba(44, 72, 36, 0.93)`),d.addColorStop(.75,`rgba(58, 90, 48, 0.9)`),d.addColorStop(1,`rgba(68, 102, 54, 0.86)`),e.fillStyle=d,e.beginPath(),e.ellipse(t.x,o,i*.46,a*.5,0,0,Math.PI*2),e.fill();let f=(0,c.clamp)((l-.04)*2.8+(s-.75)*1.8,0,1);if(f>.03){e.globalAlpha=n*f*.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()},zc=(e,t,n,r,i,a=0)=>{let o=(0,c.clamp)(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*Z(0,.2,o)*(.58+a*.24);let l=e.createRadialGradient(t.x-.25*n,t.y-.3*n,0,t.x,t.y,s);l.addColorStop(0,`rgba(148, 118, 76, 0.68)`),l.addColorStop(.42,`rgba(116, 92, 60, 0.48)`),l.addColorStop(.76,`rgba(92, 76, 54, 0.22)`),l.addColorStop(1,`rgba(80, 68, 50, 0)`),e.fillStyle=l,e.beginPath(),e.arc(t.x,t.y,s,0,Math.PI*2),e.fill(),e.restore()},Bc=(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()},Vc=(e,t,n,r,i=1,a=0)=>{let o=(0,c.clamp)(i,0,1),s=(0,c.clamp)(a,0,1);if(n<=.02||r<=.02||o<=.015)return;e.save(),e.globalAlpha=r*Z(.08,.55,o)*(1-Z(.45,1,s));let l=7.2*n*(.32+o*.68),u=oc(o);for(let r=0;r<48;r++){let i=r/48*Math.PI*2,a=X(r)*.24,o=Z(a,a+.62,u),d=(10+X(r)*5)*n*(.08+o*.92)*(1-s*.88),f=l*(.34+s*.32),p=t.x+Math.cos(i)*f,m=t.y+Math.sin(i)*f,h=f+d*(1-s*.8),g=t.x+Math.cos(i)*h,_=t.y+Math.sin(i)*h,v=1-s*.45,y=(0,c.clamp)(o*1.1-X(r)*.06,0,1),b=e.createLinearGradient(p,m,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(p,m),e.quadraticCurveTo(p+Math.cos(i+.12+s*.28)*d*.52,m+Math.sin(i+.12+s*.28)*d*.52,g,_),e.quadraticCurveTo(p+Math.cos(i-.12-s*.28)*d*.52,m+Math.sin(i-.12-s*.28)*d*.52,p,m),e.fill()}if(s<.98){let r=1-Z(.42,.86,s)*.68,i=(1-Z(.48,.8,s))*Z(.08,.55,o);if(i>.015&&r>.12){let a=l*r,o=e.createRadialGradient(t.x,t.y,0,t.x,t.y,a),c=s*.75,u=i*(1-s*.25);o.addColorStop(0,`rgba(${Q(210,128,c)|0}, ${Q(158,102,c)|0}, ${Q(38,58,c)|0}, ${.72*n*u})`),o.addColorStop(.65,`rgba(${Q(180,108,c)|0}, ${Q(128,92,c)|0}, ${Q(32,48,c)|0}, ${.48*n*u})`),o.addColorStop(1,`rgba(${Q(130,92,c)|0}, ${Q(96,76,c)|0}, ${Q(28,40,c)|0}, ${.18*n*u})`),e.fillStyle=o,e.beginPath(),e.arc(t.x,t.y,a,0,Math.PI*2),e.fill()}}e.restore()},Hc=(e,t,n)=>{let r=Sc(t),i=t.fade*vc(t),a=t.scale;r.budSize>.015&&Rc(e,n,a,i*(1-Z(.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&&Bc(e,n,a,o*r.glow),Vc(e,n,ks*a,o,r.bloom,r.wilt)),r.receptacle>.012&&(t.phase===`flower`||t.phase===`puffing`||t.phase===`mature`)&&zc(e,n,a,i,r.receptacle,r.puff)},Uc=(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()},Wc=(e,t,n)=>{let r=n.fade*vc(n)*(0,c.clamp)(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()},Gc=(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=(X(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()}},Kc=(e,t,n,r,i,a,o,s=!1,l=1)=>{if(a<=.008)return;let u=n.attached?.42+(0,c.clamp)((n.lz+8)/20,0,1)*.48:.42+n.depth*.48,d=Math.max(0,n.life)*u*a*o;if(e.save(),e.translate(n.x,n.y),n.attached)e.rotate(n.rot);else if(e.globalAlpha=d,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 f=n.size*(.88+n.life*.12)*(n.attached?1:.76+n.depth*.24);if(n.attached&&s){let i=d*Z(.1,.42,l);i>.008&&(e.globalAlpha=i,e.drawImage(t,-f,-f,f*2,f*2));let a=d*(1-Z(.38,.92,l));a>.008&&Gc(e,n,f,Math.max(l,.28),a,r)}else e.globalAlpha=d,e.drawImage(t,-f,-f,f*2,f*2);if(n.attached&&!i&&l>.42){let t=Math.sin(r*3.2+n.hairPhase)*.18;e.globalAlpha=d*Z(.42,.72,l),e.strokeStyle=`rgba(255, 250, 240, ${.12+X(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)*f*.9,Math.sin(i)*f*.9),e.stroke()}}e.restore()},qc=class{cache=new Map;get(e){let t=this.cache.get(e.id);if(!t){let n=Mc(e);t={curve:n,head:n.head,life:Sc(e)},this.cache.set(e.id,t)}return t}clear(){this.cache.clear()}},Jc=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()}},Yc=e=>Sc(e).puff,Xc=(e,t)=>{if(e.phase===`mature`)return xc(e,1,t);let n=Yc(e);return e.phase===`puffing`||e.phase===`flower`&&n>0?xc(e,n,t):e.phase===`wither`?{reveal:e.puffReveal,expand:1,fluffLen:1}:{reveal:0,expand:0,fluffLen:0}},Zc=(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),l=i*(0,c.clamp)(.58+a*.3+o*.17+s*.15,.1,1.42);return l+=n.y*.82+r*i*.2+n.x*.05,(0,c.clamp)(l,-i*.55,i*1.85)},Qc=(e,t,n)=>{for(let r=0;r<t.seedQuota;r++){let i=_c(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:X(t.id*80+r)*Math.PI*2,spin:0,life:1,size:(4.8+X(r+t.id)*4.2)*t.scale,hairPhase:X(r*2.3+t.id)*Math.PI*2,landed:!1,landedAt:-1,germinateDelay:0,germinateChecked:!1,settleT:0,restGroundY:-1,swayPhase:X(r*2.3+t.id)*Math.PI*2,terminalVy:0,driftBias:(X(r*5.3+t.id*1.1)-.5)*.22,depth:(0,c.clamp)(t.depth+i.lz*.0045,.05,.98),fallFreqA:0,fallFreqB:0,fluffOx:0,fluffOy:0})}},$c=()=>{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+(X(e*1.7)-.5)*.45,r=72*.34+X(e+11)*72*.14,i=2.2+X(e+13)*.8,a=(X(e+17)-.5)*.22;t.strokeStyle=`rgba(248, 246, 238, ${.28+X(e+19)*.42})`,t.lineWidth=.28+X(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},el=(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=X(i)*e,o=t*(.44+X(i*1.3)*.16),s=80+X(i+2)*220,c=18+X(i+4)*42,l=X(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,X(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,X(e+t)*.5,0,Math.PI*2),r.fill()};for(let n=0;n<44;n++){let r=n*4.17+90,i=X(r)*e,a=o+X(r*1.7)*(t-o),s=(a-o)/Math.max(t-o,1),c=(28+X(r+3)*90)*(.55+s*.45),l=(10+X(r+5)*32)*(.5+s*.5),u=X(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},tl=(e,t,n)=>Z(n-t*.04,n+t*.08,e),nl=(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(X(o)<d)continue;let s=(X(o+1)-.5)*m*.75,p=(X(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+X(o+3)*(l-c))*(.55+v*.55),b=u*(.45+v*.65)*(.75+X(o+4)*.5);r.push({x:g,y:_,size:y,alpha:b,depth:v,phase:X(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},rl=(e,t,n,r,i)=>{for(let a=0;a<t.length;a++){let o=t[a],s=e[a];if(!s)continue;let l=.32+o.depth*.68,u=.78+X(o.phase*2.1)*.44,d=Math.sin(r*(.72+X(o.phase)*.38)+o.phase)*Zs*(.45+o.depth*.55),f=(n.x*(.62+o.depth*.28)+sc(n.x,.12)*.45+n.speed*.22*Math.sin(r*1.65+o.phase*1.3)+d)*l*Qs,p=(n.y*(.26+o.depth*.16)+d*.35)*l*Qs;s.swayVel+=((f-s.sway)*Js*u-s.swayVel*Ys)*i,s.sway+=s.swayVel*i,s.sway=(0,c.clamp)(s.sway,-2.6*Qs,2.6*Qs),s.liftVel+=((p-s.lift)*Xs*u-s.liftVel*Ys)*i,s.lift+=s.liftVel*i,s.lift=(0,c.clamp)(s.lift,-.75*Qs,.75*Qs)}},il=(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=tl(s.y,r,a);if(l<=.01)continue;let u=s.alpha*l,d=4+Math.floor(X(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+X(t+2)*.55))}for(let t=0;t<d;t++){let n=s.x*.31+s.y*.19+t*11.7,r=(X(n+1)-.5)*.75,a=-Math.PI/2+r,o=s.size*(.65+X(n+2)*.55),l=o/Math.max(f,1),d=.58+l*.42,p=.82+X(n+12)*.28,m=c.sway*d*p,h=c.lift*d*p,g=Math.sin(i*(3.2+X(n+14)*2.4)+s.phase+t*.7)*o*.028*l*l*Qs,_=s.x+(X(n+6)-.5)*s.size*.08,v=s.y,y=_+Math.cos(a)*o*.42+(X(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=X(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+X(n+5)*.55+s.size*.015,e.lineCap=`round`,e.beginPath(),e.moveTo(_,v),e.quadraticCurveTo(T,E,D,O),e.stroke()}}},al=`cos-dandelion-field`,ol=800,sl=500;function cl(e,t={}){let n={fill:!1,plantCount:10,seedCount:32,speed:1,interactive:!0,ariaLabel:`蒲公英播种背景`,...t},r=!1,i=n.width??ol,a=n.height??sl,o=typeof document<`u`?document.hidden:!1,s=(0,c.prefersReducedMotion)(),l=null,u=null,d=null,f=null,p=[],m=[],h=1,g=[],_=0,v=!1,y=null,b={x:0,y:0,speed:0},x={x:0,y:0,active:!1},S=0,C=null,w=new Jc,T=[],E=[],D=document.createElement(`div`);D.className=al;let O=document.createElement(`canvas`);O.className=`${al}__canvas`,D.appendChild(O),e.appendChild(D);let k=()=>{(0,c.applyCanvasHostBox)(e,D,{fill:!!n.fill,width:i,height:a}),O.style.width=String(i)+`px`,O.style.height=String(a)+`px`,O.setAttribute(`role`,`img`),O.setAttribute(`aria-label`,n.ariaLabel??`蒲公英播种背景`)},A=()=>{if(l?.(),l=null,!(n.fill??!1)){i=n.width??ol,a=n.height??sl,k(),j(),M();return}l=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:ol,defaultHeight:sl,measured:e});i=t.width,a=t.height,k(),j(),M()})},j=()=>{let e=(0,c.clamp)(Math.round(n.plantCount??10),1,22),t=Math.max(24,Math.min(90,Math.round(n.seedCount??32)));h=1,g=gc(e,i,a,t),_=0,v=!1,p.length=0,m.length=0,w.clear(),b.x=0,b.y=0,b.speed=0,C=null,S=0},M=()=>{f?.(),f=null,cancelAnimationFrame(0);let e=Math.min(window.devicePixelRatio||1,2);O.width=Math.floor(i*e),O.height=Math.floor(a*e);let t=O.getContext(`2d`);if(!t)return;t.setTransform(e,0,0,e,0,0),y||=$c();let r=y,l=0,u=0,d=e=>{let t=O.getBoundingClientRect();return{x:(e.clientX-t.left)*(i/Math.max(t.width,1)),y:(e.clientY-t.top)*(a/Math.max(t.height,1))}},D=()=>new Map(p.map(e=>[e.id,e])),k=(e,t,n)=>{let r=i*Ls;return p.some(i=>i.id===n?!1:Math.hypot(i.x-e,i.ground-t)<r)},A=(e,t=fc())=>{let n=h++,r=Pc({...e},n,t);return p.push(r),r},j=(e=!1)=>{for(let t of g){if(t.spawned)continue;let n=A(t.layout,e?pc():fc());e&&(Qc(m,n,!0),w.increment(n.id,n.seedQuota)),t.spawned=!0}v=!0,_=3},M=e=>{if(!v){_+=e;for(let e of g)e.spawned||_<e.at||(A(e.layout),e.spawned=!0);g.every(e=>e.spawned)&&(v=!0)}},N=()=>{if(v)return;let e=g.find(e=>!e.spawned&&e.at<=0);e&&(A(e.layout),e.spawned=!0)},P=(e,t)=>{if(p.length>=22)return null;let r=i*.04,o=(0,c.clamp)(e,r,i-r),s=(0,c.clamp)(t,a*.68,a*.93);if(k(o,s))return null;let l=h++,u=Math.max(24,Math.min(90,Math.round(n.seedCount??32))),d=Pc(Nc(o,s,a,u,l),l,fc(X(l*7.3)*.12));return p.push(d),d},F=e=>{for(let t=p.length-1;t>=0;t--)p[t].id===e&&p.splice(t,1);for(let t=m.length-1;t>=0;t--)m[t].plantId===e&&m[t].attached&&m.splice(t,1);w.remove(e)},I=e=>{e.phase===`puffing`||e.phase===`mature`||(e.phase=`puffing`,e.phaseTime=(0,c.clamp)(e.puffReveal,0,1)*Os.PUFFING,e.grow=ks,w.has(e.id)||(Qc(m,e,!0),w.increment(e.id,e.seedQuota)))},L=e=>{let t=dc(e.x,e.depth,a);e.terminalVy=Math.max(14,t-e.y)/(4+X(e.hairPhase*3.1+e.plantId)*5),e.vy=e.terminalVy*(.22+X(e.hairPhase*1.9)*.22),e.fallFreqA=.62+X(e.hairPhase*4.3)*1.25,e.fallFreqB=1.55+X(e.hairPhase*6.7)*3.1},R=(e,t,n,r,i)=>{e.attached=!1,w.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+X(e.hairPhase*4.1)*1,e.germinateChecked=!1,e.settleT=0,e.restGroundY=-1,e.swayPhase=e.hairPhase,e.driftBias=(X(e.hairPhase*5.3+e.rot)-.5)*.22,L(e),e.vy=e.terminalVy*(.22+X(e.hairPhase*1.9)*.22)+n,i&&(e.originX=i.x,e.originGround=i.ground)},z=(e,t)=>{e.settleT>0||(e.restGroundY=t,e.settleT=.001)},B=(e,t,n,r,i)=>{let o=Math.sin(n*1.55+e.swayPhase),s=Math.cos(n*.95+e.swayPhase*1.4),c=Zc(e,n,i,o);e.vy+=(c-e.vy)*Vs;let l=t*60,u=lc(i);e.vx+=(i.x*(.022+u*.018)+e.driftBias*.014+o*.011+s*.006)*l,e.vy+=i.y*(.032+u*.028)*l,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+o*.08+e.spin;let d=dc(e.x,e.depth,a);e.y>=d-.8&&(e.y=Math.min(e.y,d),z(e,d))},V=(e,t,n,r)=>{e.settleT=Math.min(1,e.settleT+t*Hs);let i=ac(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=(0,c.lerp)(e.y,e.restGroundY,o)+a,e.y>e.restGroundY&&(e.y=e.restGroundY+a),e.vy=0,e.spin*=.8,e.rot=(0,c.lerp)(e.rot,.08+X(e.swayPhase*1.9)*.22,o*2.5),e.settleT>=1&&(e.y=e.restGroundY,e.vx=0,e.landed=!0,e.landedAt=n)},H=e=>{e.y=e.restGroundY,e.vx=0,e.vy=0,e.rot=.08+X(e.swayPhase*1.9)*.22},ee=e=>{if(!e.canGerminate||e.attached||!e.landed)return!1;let t=dc(e.x,e.depth,a),n=e.originX!==void 0&&e.originGround!==void 0&&Math.hypot(e.x-e.originX,e.y-e.originGround)<i*.2,r=n?zs:Rs;return X(e.x*.31+e.y*.17+e.hairPhase)>r?!1:P(n?(0,c.clamp)(e.originX+(X(e.hairPhase*2.1)-.5)*i*.14,i*.04,i*.96):e.x,n?(0,c.clamp)(e.originGround+(X(e.hairPhase*3.3)-.5)*a*.035,a*.68,a*.93):t)!==null},U=e=>{let t=m.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=X(i*2.71+e.id*1.3);t.scheduledRelease=(0,c.clamp)(.05+a*.8+o*.15,.05,1)*r})},te=(e,t)=>{e.releaseElapsed+=t;let n=e.releaseBoost>.01?1+e.releaseBoost*14:1,r=e.releaseElapsed*n,i=e.releaseDuration,a=m.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=X(n.hairPhase*2.3+t*1.7+e.id)*Math.PI*2,i=.12+X(n.hairPhase*1.7+t*.9)*.34,a=(X(n.lx*1.3+t*2.4)-.5)*.16,c=1+e.releaseBoost*.22;R(n,(Math.cos(r)*i+b.x*.05+a)*c,(Math.sin(r)*i*.35+b.y*.05+.03+X(n.hairPhase+t*.6)*.04)*c,(X(n.rot+e.id+t)-.5)*.022,o),n.scheduledRelease=void 0}},ne=e=>{e.releasing||(e.releasing=!0,e.releaseElapsed=0,e.releaseSeedTotal=w.get(e.id),U(e))},re=e=>(e.phase===`mature`||e.phase===`puffing`)&&e.puffReveal>=.85&&w.has(e.id),ie=e=>!e.releasing||w.has(e.id)?!1:(e.phase=`wither`,e.phaseTime=0,e.releasing=!1,e.releaseBoost=0,e.releaseElapsed=0,e.releaseSeedTotal=0,!0),ae=(e,t)=>{re(e)&&(e.phase===`mature`&&(e.matureHoldLeft=0),ne(e),e.releaseBoost=(0,c.clamp)(e.releaseBoost+t,0,4),t>=1.2&&(e.releaseElapsed+=.12))},oe=e=>{e.phase=`mature`,e.phaseTime=0,e.grow=ks,e.puffReveal=1,e.matureHoldLeft=mc(),e.releaseDuration=hc(e.id),e.releaseElapsed=0,e.releaseSeedTotal=0,e.releasing=!1,e.releaseBoost=0},se=(e,t)=>{e.releaseBoost=Math.max(0,e.releaseBoost-t*.65)},ce=(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&&ne(e)),e.releasing&&te(e,t),se(e,t),ie(e);break;case`wither`:{let t=oc(e.phaseTime/Os.WITHER);e.wilt=t,e.stemBrown=t,e.fade=1-ac(Math.max(0,(t-.35)/.65)),e.leafScale=1-t*.85,e.puffReveal=0,e.phaseTime>=Os.WITHER&&F(e.id);break}case`sprout`:{let t=oc(e.phaseTime/Os.SPROUT);e.stemLen=e.stem*t,e.leafScale=.08+t*.92,e.fade=Math.min(1,Z(.08,.72,t)*1.08),e.phaseTime>=Os.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=Sc(e);e.grow=t.bloom*ks,t.wilt>=.7&&(w.has(e.id)||(Qc(m,e,!0),w.increment(e.id,e.seedQuota)),e.puffReveal=Math.max(e.puffReveal,Is),I(e));break}case`puffing`:e.grow=ks,e.releasing||(e.puffReveal=(0,c.clamp)(e.phaseTime/Os.PUFFING,0,1),e.phaseTime>=Os.PUFFING&&oe(e)),e.releasing&&(te(e,t),se(e,t),ie(e));break}},le=e=>{if(!n.interactive)return;let{x:t,y:r}=d(e);if(!x.active){x.x=t,x.y=r,x.active=!0;return}let i=t-x.x,a=r-x.y;x.x=t,x.y=r;let o=Math.hypot(i,a),s=cc(o);b.speed=Math.max(s,b.speed*.72);let l=.06+s*.2;if(b.x=(0,c.clamp)(b.x*.82+i*l,-5.5,5.5),b.y=(0,c.clamp)(b.y*.82+a*l,-5.5,5.5),s>=.58&&o>=9){let e=o*.018*(0,c.clamp)((s-ic)/(1-ic),.35,1),n=new qc;for(let i of p){if(!re(i))continue;let a=n.get(i).head;Math.hypot(a.x-t,a.y-r)<105*i.scale&&ae(i,e)}}},ue=e=>{if(!n.interactive)return;let{x:t,y:r}=d(e);Object.assign(x,{x:t,y:r,active:!0});let i=null,a=1/0,o=new qc;for(let e of p){if(!re(e))continue;let n=o.get(e).head,s=Math.hypot(n.x-t,n.y-r);s<a&&(a=s,i=e)}if(i&&a<130*i.scale){ae(i,2.8);let e=o.get(i).head;C={x:e.x,y:e.y,t:.35}}},de=e=>{let{x:t,y:n}=d(e);Object.assign(x,{x:t,y:n,active:!0})},fe=()=>{x.active=!1};O.addEventListener(`pointermove`,le),O.addEventListener(`pointerdown`,ue),O.addEventListener(`pointerenter`,de),O.addEventListener(`pointerleave`,fe);let pe=el(i,a),me=nl(i,a),he=me.map(()=>({sway:0,swayVel:0,lift:0,liftVel:0})),ge=(e,n=0,o,s=new qc)=>{let c=o??D();t.drawImage(pe,0,0,i,a),il(t,me,he,a,n);let l=T;l.length=0,l.push(...p),l.sort((e,t)=>e.ground+(1-e.depth)*8-(t.ground+(1-t.depth)*8));for(let e of l)Ic(t,e);for(let e of l){let{head:n}=s.get(e);if(Lc(t,e),Hc(t,e,n),e.phase===`wither`)Wc(t,n,e);else if(e.phase===`mature`||e.phase===`puffing`){let r=s.get(e).life,i=e.fade*vc(e);w.get(e.id)>0&&r.puff>.02&&Uc(t,n,e.radius*(.08+r.puff*.92),r.glow*i*.65)}}let u=E;u.length=0,u.push(...m),u.sort((e,t)=>{let n=c.get(e.plantId),r=c.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 u){if(e&&!i.attached)continue;let a=c.get(i.plantId);if(i.attached){let e=a?s.get(a).life:null;if(!a||a.phase===`sprout`||a.phase===`flower`&&(!e||e.puff<=.008)||a.phase===`wither`&&a.puffReveal<=.02)continue}let o=i.attached&&a?vc(a):.58+i.depth*.42,l=i.attached?a?a.fade*o:.78:o,u=a?Xc(a,i):{reveal:1,fluffLen:1,expand:1};Kc(t,r,i,n,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)}if(C&&!e){let e=t.createRadialGradient(C.x,C.y,0,C.x,C.y,28);e.addColorStop(0,`rgba(255, 252, 240, ${.08*C.t})`),e.addColorStop(1,`rgba(255, 252, 240, 0)`),t.fillStyle=e,t.beginPath(),t.arc(C.x,C.y,28,0,Math.PI*2),t.fill()}},_e=()=>{cancelAnimationFrame(l),l=0,O.removeEventListener(`pointermove`,le),O.removeEventListener(`pointerdown`,ue),O.removeEventListener(`pointerenter`,de),O.removeEventListener(`pointerleave`,fe)};if(s){j(!0),ge(!0),f=_e;return}let ve=e=>{if(l=requestAnimationFrame(ve),o)return;u||=e;let t=(0,c.clamp)((e-u)/1e3,.008,.04);u=e;let r=n.speed??1;S+=t*r,b.x*=Math.exp(-t*1.05),b.y*=Math.exp(-t*1.05),b.speed*=Math.exp(-t*2.6),C&&(C.t-=t*2.8,C.t<=0&&(C=null)),M(t*r),rl(he,me,b,S,t);let i=new qc,a=D(),s=p.slice();for(let e of s)Oc(e,b,Math.sin(S*(.85+X(e.id*2.3)*.35)+e.swayPhase)*e.swayAmp,t),ce(e,t);for(let e of m){let n=a.get(e.plantId);if(e.attached&&n){let r=i.get(n).head,a=n.phase===`puffing`||n.phase===`mature`||n.phase===`flower`&&n.puffReveal>.008,{offX:o,offY:s,tiltX:c,tiltY:l}=kc(e,n,b,S,t,a,n.radius),u=+!!a,{expand:d}=Xc(n,e),f=a?d:0,p=e.lx*u*f,m=e.ly*u*f;e.x=r.x+p+o,e.y=r.y+m+s,e.rot=Math.atan2(m+l,p+c)*.11+e.hairPhase*.02}else e.attached||(e.settleT<=0?B(e,t,S,r,b):e.landed?H(e):V(e,t,S,r),e.landed&&e.landedAt>=0&&S-e.landedAt>=e.germinateDelay&&(e.germinateChecked?e.life>0&&(e.life-=t*Bs):(e.germinateChecked=!0,ee(e)?e.life=0:e.canGerminate=!1)))}m=m.filter(e=>e.attached&&a.has(e.plantId)||!e.attached&&e.life>0),ge(!1,S,a,i)};ge(!1,0),N(),ve(0),f=_e};return u=(0,c.bindVisibilityPause)(e=>{o=e}),d=(0,c.bindPrefersReducedMotion)(e=>{let t=s;s=e,s!==t&&M()}),k(),A(),{update(e){let t=n.fill,r=n.width,i=n.height,a=n.plantCount,o=n.seedCount;n={...n,...e};let s=n.fill!==t||n.width!==r||n.height!==i,c=n.plantCount!==a||n.seedCount!==o;(s||c)&&A()},destroy(){r||(r=!0,f?.(),f=null,cancelAnimationFrame(0),u?.(),d?.(),l?.(),D.remove())}}}var ll=(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},ul=(e,t,n)=>{let r=ll(e,e.VERTEX_SHADER,t),i=ll(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},dl=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(),fl=(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}},pl=(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})},ml=()=>{let e=$();return e<.5?1:e<.78?2:e<.93?3:4},hl=(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]},gl=()=>{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),l=[],u=[],d=.6+$()*1.4,f=(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)}},p=(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)}},m=(e,t,n,r,i,a)=>{let o=Math.hypot(n,r);if(o<1e-4){p(e,t,i,a,`max`);return}for(let s=0;s<=5;s++){let c=s/5,l=1-c*.65;p(e-n/o*i*2.2*c,t-r/o*i*2.2*c,i*(.7+c*.4),a*l,`max`)}},h=(e,t,r,i)=>{p(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)}},g=(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-_)))}},_=(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);f(s,c,e.r*.08,.22*t*i,l,r,e.seed+n),i>.85&&p(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);p(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,g(e,1),p(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);p(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);pl(u,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;pl(u,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;pl(u,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 l){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=(0,c.clamp)(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;f(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,f(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);g(e,.9+t*.1),_(e,.7+t*.3),p(e.u,e.v,e.r*.1,t*.1,`max`),e.t>.1&&(e.phase=`cavity`,e.t=0);return}let r=(0,c.clamp)(e.t/1.55,0,1),i=(1-r)**1.05;if(g(e,i),_(e,i*(1-r*.6)),r>.2&&r<.4){let t=Math.sin((r-.2)/.2*Math.PI);p(e.u,e.v,e.r*.1,t*.14,`max`),f(e.u,e.v,e.r*.1,t*.22,.75,e.tear,e.seed)}r>.7&&p(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&&m(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)p(e.u,e.v,e.size*1.4,.035,`max`);else{let t=Math.hypot(e.vu,e.vv)||1;h(e.u,e.v,e.size*(e.kind===0?1.2:1.8),e.heat*(e.kind===0?.14:.22)),m(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;m(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,f=Math.atan2(a,i),h=Math.cos(f),g=Math.sin(f),_=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=f+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);p(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&&(g(e,l*.22),p(e.u,e.v,e.r*.08,l*.12,`max`));return}(e.phase===`burst`||e.phase===`cavity`)&&(g(e,l*.18),_(e,l*.25),p(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]=hl(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=(0,c.clamp)(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 l)D(t,e.u,e.v,e.vu,e.vv,n)};return{step:(i,a,o)=>{if(o.click&&l.push(fl(o.click.u,o.click.v)),o.autoSpawn){let e=(0,c.clamp)(o.activity,0,2);if(d-=i*a*(.55+e*.7),d<=0&&l.length<8){let t=Math.min(ml(),8-l.length);for(let e=0;e<t;e++){let e=b();l.push(fl(e.u,e.v))}d=(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 l)x(e,i,a);for(let e=l.length-1;e>=0;e--)l[e].t>=90&&l.splice(e,1);for(let e of u)S(e,i);for(let e=u.length-1;e>=0;e--)u[e].life<=0&&u.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((0,c.clamp)(t[i],0,1)*255),s[e+1]=Math.floor((0,c.clamp)(n[i],0,1)*255),s[e+2]=Math.floor((0,c.clamp)(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)}}},_l=`
|
|
16
|
+
attribute vec2 a_pos;
|
|
17
|
+
varying vec2 v_uv;
|
|
18
|
+
void main() {
|
|
19
|
+
v_uv = a_pos * 0.5 + 0.5;
|
|
20
|
+
gl_Position = vec4(a_pos, 0.0, 1.0);
|
|
21
|
+
}
|
|
22
|
+
`,vl=`
|
|
23
|
+
precision highp float;
|
|
24
|
+
|
|
25
|
+
uniform float u_time;
|
|
26
|
+
uniform vec2 u_res;
|
|
27
|
+
uniform vec2 u_sim;
|
|
28
|
+
uniform float u_heat;
|
|
29
|
+
uniform sampler2D u_field;
|
|
30
|
+
|
|
31
|
+
varying vec2 v_uv;
|
|
32
|
+
|
|
33
|
+
float hash(vec2 p) {
|
|
34
|
+
return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
float noise(vec2 p) {
|
|
38
|
+
vec2 i = floor(p);
|
|
39
|
+
vec2 f = fract(p);
|
|
40
|
+
vec2 u = f * f * (3.0 - 2.0 * f);
|
|
41
|
+
float a = hash(i);
|
|
42
|
+
float b = hash(i + vec2(1.0, 0.0));
|
|
43
|
+
float c = hash(i + vec2(0.0, 1.0));
|
|
44
|
+
float d = hash(i + vec2(1.0, 1.0));
|
|
45
|
+
return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
float fbm(vec2 p) {
|
|
49
|
+
float v = 0.0;
|
|
50
|
+
float a = 0.5;
|
|
51
|
+
for (int i = 0; i < 5; i++) {
|
|
52
|
+
v += a * noise(p);
|
|
53
|
+
p *= 2.05;
|
|
54
|
+
a *= 0.5;
|
|
55
|
+
}
|
|
56
|
+
return v;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
vec3 heatColor(float t) {
|
|
60
|
+
// 最低也是暗红熔壳,绝不走到纯黑
|
|
61
|
+
t = clamp(t, 0.18, 1.0);
|
|
62
|
+
vec3 c0 = vec3(0.28, 0.07, 0.02);
|
|
63
|
+
vec3 c1 = vec3(0.48, 0.12, 0.03);
|
|
64
|
+
vec3 c2 = vec3(0.72, 0.2, 0.04);
|
|
65
|
+
vec3 c3 = vec3(0.95, 0.4, 0.08);
|
|
66
|
+
vec3 c4 = vec3(1.0, 0.7, 0.28);
|
|
67
|
+
vec3 c5 = vec3(1.0, 0.9, 0.58);
|
|
68
|
+
if (t < 0.35) return mix(c0, c1, (t - 0.18) / 0.17);
|
|
69
|
+
if (t < 0.52) return mix(c1, c2, (t - 0.35) / 0.17);
|
|
70
|
+
if (t < 0.7) return mix(c2, c3, (t - 0.52) / 0.18);
|
|
71
|
+
if (t < 0.88) return mix(c3, c4, (t - 0.7) / 0.18);
|
|
72
|
+
return mix(c4, c5, (t - 0.88) / 0.12);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
float sampleH(vec2 uv) {
|
|
76
|
+
return texture2D(u_field, uv).r;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
float sampleHeat(vec2 uv) {
|
|
80
|
+
return texture2D(u_field, uv).g;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
float sampleCav(vec2 uv) {
|
|
84
|
+
return texture2D(u_field, uv).b;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
vec3 calcNormal(vec2 uv) {
|
|
88
|
+
vec2 e = vec2(1.0 / u_sim.x, 1.0 / u_sim.y);
|
|
89
|
+
float hL = sampleH(uv - vec2(e.x, 0.0)) - sampleCav(uv - vec2(e.x, 0.0)) * 0.3;
|
|
90
|
+
float hR = sampleH(uv + vec2(e.x, 0.0)) - sampleCav(uv + vec2(e.x, 0.0)) * 0.3;
|
|
91
|
+
float hD = sampleH(uv - vec2(0.0, e.y)) - sampleCav(uv - vec2(0.0, e.y)) * 0.3;
|
|
92
|
+
float hU = sampleH(uv + vec2(0.0, e.y)) - sampleCav(uv + vec2(0.0, e.y)) * 0.3;
|
|
93
|
+
return normalize(vec3((hL - hR) * 8.2, (hD - hU) * 8.2, 1.6));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
void main() {
|
|
97
|
+
vec2 uv = v_uv;
|
|
98
|
+
float aspect = u_res.x / max(u_res.y, 1.0);
|
|
99
|
+
vec2 p = (uv - 0.5) * vec2(aspect, 1.0);
|
|
100
|
+
|
|
101
|
+
float h = sampleH(uv);
|
|
102
|
+
float extra = min(sampleHeat(uv), 0.38);
|
|
103
|
+
float cav = sampleCav(uv);
|
|
104
|
+
|
|
105
|
+
vec3 N = calcNormal(uv);
|
|
106
|
+
vec2 stretchUv = uv - N.xy * h * 0.028;
|
|
107
|
+
|
|
108
|
+
float plate = fbm(stretchUv * vec2(4.0, 3.5) + u_time * 0.022);
|
|
109
|
+
float plate2 = fbm(stretchUv * vec2(8.0, 7.2) - u_time * 0.015);
|
|
110
|
+
float seam = pow(1.0 - abs(plate2 - 0.5) * 2.0, 3.0);
|
|
111
|
+
float micro = fbm(stretchUv * 16.0 + h * 1.5);
|
|
112
|
+
|
|
113
|
+
float dome = smoothstep(0.02, 0.28, h);
|
|
114
|
+
float domeCore = smoothstep(0.18, 0.88, h);
|
|
115
|
+
// 宽柔接触影:有深度但不描黑边
|
|
116
|
+
float contact = smoothstep(0.012, 0.12, h) * (1.0 - smoothstep(0.12, 0.42, h));
|
|
117
|
+
float shoulder = smoothstep(0.07, 0.22, h) * (1.0 - smoothstep(0.22, 0.55, h));
|
|
118
|
+
float apex = pow(domeCore, 1.35);
|
|
119
|
+
float thinSpot = pow(micro, 2.4) * domeCore;
|
|
120
|
+
|
|
121
|
+
float cavFloor = cav * 0.08;
|
|
122
|
+
float cavDeep = pow(cav, 1.4);
|
|
123
|
+
float cavRim = smoothstep(0.03, 0.14, cav) * (1.0 - smoothstep(0.14, 0.4, cav));
|
|
124
|
+
|
|
125
|
+
float t = plate * 0.5 * u_heat + 0.26 + seam * 0.18 + micro * 0.045;
|
|
126
|
+
t += extra * 0.7;
|
|
127
|
+
t -= contact * 0.025;
|
|
128
|
+
t += apex * 0.05;
|
|
129
|
+
t += thinSpot * 0.055;
|
|
130
|
+
t += cavFloor;
|
|
131
|
+
t = clamp(t, 0.26, 0.87);
|
|
132
|
+
|
|
133
|
+
vec3 col = heatColor(t);
|
|
134
|
+
|
|
135
|
+
vec3 L = normalize(vec3(-0.3, 0.42, 0.86));
|
|
136
|
+
vec3 V = vec3(0.0, 0.0, 1.0);
|
|
137
|
+
float wrap = clamp((dot(N, L) + 0.5) / 1.5, 0.0, 1.0);
|
|
138
|
+
float facing = clamp(N.z, 0.0, 1.0);
|
|
139
|
+
float softSpec = pow(max(dot(reflect(-L, N), V), 0.0), 8.5);
|
|
140
|
+
float broadSpec = pow(max(dot(reflect(-L, N), V), 0.0), 3.8);
|
|
141
|
+
|
|
142
|
+
// 中等凸感:顶亮 + 根部浅影 + 柔边
|
|
143
|
+
float volume = 0.92 + wrap * 0.12 + facing * apex * 0.13;
|
|
144
|
+
col *= volume;
|
|
145
|
+
col *= 1.0 + h * 0.1 * facing;
|
|
146
|
+
col *= 1.0 - contact * 0.16;
|
|
147
|
+
col = mix(col, heatColor(0.44), contact * 0.12);
|
|
148
|
+
col += heatColor(0.6) * shoulder * wrap * 0.13;
|
|
149
|
+
col += heatColor(0.68) * apex * 0.09;
|
|
150
|
+
col += vec3(1.0, 0.52, 0.16) * softSpec * dome * 0.22 * (0.35 + 0.65 * facing);
|
|
151
|
+
col += vec3(1.0, 0.42, 0.1) * broadSpec * dome * 0.08;
|
|
152
|
+
col += heatColor(0.6) * thinSpot * 0.08;
|
|
153
|
+
|
|
154
|
+
col += heatColor(min(0.76, 0.52 + extra)) * pow(extra, 1.35) * 0.22;
|
|
155
|
+
|
|
156
|
+
// 爆裂口:深井压暗 + 撕裂唇余温(不是中心白光团)
|
|
157
|
+
col *= 1.0 - cavDeep * 0.38;
|
|
158
|
+
col = mix(col, heatColor(0.34), cavDeep * 0.22);
|
|
159
|
+
col *= 1.0 - cavRim * 0.22;
|
|
160
|
+
col += vec3(1.0, 0.28, 0.04) * cavRim * 0.35;
|
|
161
|
+
col += heatColor(0.58) * pow(cav, 2.8) * 0.05;
|
|
162
|
+
|
|
163
|
+
col += (hash(uv * u_res + u_time) - 0.5) * 0.006;
|
|
164
|
+
col = max(col, vec3(0.18, 0.045, 0.015));
|
|
165
|
+
|
|
166
|
+
float vig = smoothstep(1.25, 0.35, length(p));
|
|
167
|
+
col *= 0.95 + 0.05 * vig;
|
|
168
|
+
|
|
169
|
+
gl_FragColor = vec4(col, 1.0);
|
|
170
|
+
}
|
|
171
|
+
`,yl=`cos-lava-bubble`,bl=800,xl=500;function Sl(e,t={}){let n={fill:!1,heat:1,speed:1,autoSpawn:!0,activity:1,interactive:!0,ariaLabel:`熔岩泡背景`,...t},r=!1,i=n.width??bl,a=n.height??xl,o=typeof document<`u`?document.hidden:!1,s=(0,c.prefersReducedMotion)(),l=null,u=null,d=null,f=null,p=null,m=null,h=null,g=null,_=document.createElement(`div`);_.className=yl,_.setAttribute(`role`,`img`);let v=document.createElement(`canvas`);v.className=`${yl}__canvas`,_.appendChild(v),e.appendChild(_);let y=(e,t)=>{let n=v.getBoundingClientRect();return{u:(e-n.left)/Math.max(n.width,1),v:1-(t-n.top)/Math.max(n.height,1)}},b=e=>{(n.interactive??!0)&&(e.pointerType===`mouse`&&e.button!==0||(m=y(e.clientX,e.clientY)))},x=e=>{if(!(n.interactive??!0))return;let{u:t,v:r}=y(e.clientX,e.clientY);h=g?{u:t,v:r,vu:t-g.u,vv:r-g.v}:{u:t,v:r,vu:0,vv:0},g={u:t,v:r}},S=()=>{g=null,h=null},C=()=>{(0,c.applyCanvasHostBox)(e,_,{fill:!!n.fill,width:i,height:a}),v.style.width=`${i}px`,v.style.height=`${a}px`,_.setAttribute(`aria-label`,n.ariaLabel??`熔岩泡背景`)},w={w:0,h:0},T=()=>{if(w.w===i&&w.h===a&&f)return;w={w:i,h:a},f?.(),f=null;let e=Math.min(window.devicePixelRatio||1,2);v.width=Math.floor(i*e),v.height=Math.floor(a*e);let t=v.getContext(`webgl`,{alpha:!1,antialias:!1,depth:!1,stencil:!1,premultipliedAlpha:!1});if(!t)return;let l=ul(t,_l,vl);if(!l)return;let u=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),t.STATIC_DRAW);let d=t.getAttribLocation(l,`a_pos`),g=t.getUniformLocation(l,`u_time`),_=t.getUniformLocation(l,`u_res`),y=t.getUniformLocation(l,`u_sim`),b=t.getUniformLocation(l,`u_heat`),x=t.getUniformLocation(l,`u_field`),S=dl(t);if(!S)return;let C=gl(),T=0,E=0,D=0,O=e=>{C.upload(t,S),t.viewport(0,0,v.width,v.height),t.useProgram(l),t.bindBuffer(t.ARRAY_BUFFER,u),t.enableVertexAttribArray(d),t.vertexAttribPointer(d,2,t.FLOAT,!1,0,0),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,S),t.uniform1i(x,0),t.uniform1f(g,e),t.uniform2f(_,v.width,v.height),t.uniform2f(y,192,192),t.uniform1f(b,n.heat??1),t.drawArrays(t.TRIANGLE_STRIP,0,4)},k=e=>{if(r)return;if(s){T=0,O(0);return}if(T=requestAnimationFrame(k),o)return;E||=e;let t=(0,c.clamp)((e-E)/1e3,.008,.033);E=e;let i=n.speed??1;D+=t*i;let a=m;m=null;let l=h,u=l&&Math.hypot(l.vu,l.vv)>3e-4?{u:l.u,v:l.v,vu:l.vu,vv:l.vv}:null;l&&(h={u:l.u,v:l.v,vu:0,vv:0}),C.step(t,i,{autoSpawn:n.autoSpawn??!0,activity:n.activity??1,click:a,stir:u}),O(D)},A=()=>{r||s||T||k(0)};p=A,k(0),f=()=>{cancelAnimationFrame(T),T=0,p===A&&(p=null),t.deleteTexture(S),t.deleteBuffer(u),t.deleteProgram(l)}},E=()=>{if(l?.(),l=null,!(n.fill??!1)){i=n.width??bl,a=n.height??xl,C(),T();return}l=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:bl,defaultHeight:xl,measured:e});i=t.width,a=t.height,C(),T()})};return v.addEventListener(`pointerdown`,b),v.addEventListener(`pointermove`,x),v.addEventListener(`pointerleave`,S),u=(0,c.bindVisibilityPause)(e=>{o=e}),d=(0,c.bindPrefersReducedMotion)(e=>{let t=s;s=e,t!==e&&(s||p?.())}),E(),{update(e){let t=n.fill,r=n.width,i=n.height;n={...n,...e},_.setAttribute(`aria-label`,n.ariaLabel??`熔岩泡背景`),(n.fill!==t||n.width!==r||n.height!==i)&&E()},destroy(){r||(r=!0,f?.(),u?.(),d?.(),l?.(),v.removeEventListener(`pointerdown`,b),v.removeEventListener(`pointermove`,x),v.removeEventListener(`pointerleave`,S),_.remove())}}}var Cl=`cos-ink-bloom`,wl=800,Tl=500,El=2,Dl=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]},Ol=e=>{let t=Math.sin(e*127.1)*43758.5453;return t-Math.floor(t)},kl=(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=Ol(n*12.9898+r*78.233),l=Ol((n+1)*12.9898+r*78.233),u=Ol(n*12.9898+(r+1)*78.233),d=Ol((n+1)*12.9898+(r+1)*78.233);return c+(l-c)*o+(u-c)*s+(c-l-u+d)*o*s},Al=(e,t)=>{let n=0,r=.5,i=1;for(let a=0;a<3;a++)n+=r*kl(e*i,t*i),i*=2.05,r*=.5;return n};function jl(e,t={}){let n={fill:!1,inkColor:`#0c0e12`,speed:1,interactive:!0,ariaLabel:`墨染清水背景`,...t},r=!1,i=n.width??wl,a=n.height??Tl,o=typeof document<`u`?document.hidden:!1,s=(0,c.prefersReducedMotion)(),l=null,u=null,d=null,f=null,p=document.createElement(`div`);p.className=Cl;let m=document.createElement(`canvas`);m.className=`${Cl}__canvas`,p.appendChild(m),e.appendChild(p);let h=()=>{(0,c.applyCanvasHostBox)(e,p,{fill:!!n.fill,width:i,height:a}),m.style.width=String(i)+`px`,m.style.height=String(a)+`px`,n.ariaLabel&&(m.setAttribute(`role`,`img`),m.setAttribute(`aria-label`,n.ariaLabel)),n.interactive!==void 0&&(m.style.cursor=n.interactive?`pointer`:`default`)},g=()=>{if(l?.(),l=null,!(n.fill??!1)){i=n.width??wl,a=n.height??Tl,h(),_();return}l=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:wl,defaultHeight:Tl,measured:e});i=t.width,a=t.height,h(),_()})},_=()=>{f?.(),f=null,cancelAnimationFrame(0);let e=Math.min(window.devicePixelRatio||1,El);m.width=Math.floor(i*e),m.height=Math.floor(a*e);let t=m.getContext(`2d`);if(!t)return;t.setTransform(e,0,0,e,0,0);let r=Math.max(140,Math.floor(i/4)),l=Math.max(88,Math.floor(a/4)),u=r*l,d=new Float32Array(u),p=new Float32Array(u),h=new Float32Array(u),g=new Float32Array(u),_=new Float32Array(u),v=new Float32Array(u),y=new Float32Array(u),b=new Float32Array(u),x=new Float32Array(u),S=document.createElement(`canvas`);S.width=r,S.height=l;let C=S.getContext(`2d`);if(!C)return;let w=C.createImageData(r,l),T=0,E=0,D=0,O=(e,t)=>(0,c.clamp)(Math.floor(e),0,r-1)+(0,c.clamp)(Math.floor(t),0,l-1)*r,k=(e,t,n)=>{let i=(0,c.clamp)(t,0,r-1.001),a=(0,c.clamp)(n,0,l-1.001),o=Math.floor(i),s=Math.floor(a),u=i-o,d=a-s,f=Math.min(o+1,r-1),p=Math.min(s+1,l-1),m=e[o+s*r],h=e[f+s*r],g=e[o+p*r],_=e[f+p*r];return m*(1-u)*(1-d)+h*u*(1-d)+g*(1-u)*d+_*u*d},A=(e,t)=>{let n=m.getBoundingClientRect();return{x:(e-n.left)/Math.max(n.width,1)*r,y:(t-n.top)/Math.max(n.height,1)*l}},j=(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=O(e+s,t+o);_[u]+=-o/c*r*l,v[u]+=s/c*r*l}},M=(e,t)=>{let n=()=>Math.random(),r=4.2+n()*2.8,i=1.35+n()*.55,a=1.4+n()*2.4,o=.5+n()*1.2,s=Math.ceil(r*3.2);for(let c=-s;c<=s;c++)for(let l=-s;l<=s;l++){let s=(Al(e*.18+l*.32,t*.18+c*.32)-.5)*r*.85,u=Math.hypot(l,c)+s;if(u>r*1.85)continue;let f=Math.exp(-(u*u)/(r*r*1.15)),p=O(e+l,t+c);d[p]=Math.min(2.4,d[p]+f*i),v[p]+=f*a*.4,_[p]+=(n()-.5)*f*o,v[p]+=(n()-.5)*f*o*.45}let c=3+Math.floor(n()*4);for(let r=0;r<c;r++){let r=n()*Math.PI*2,i=2+n()*5.5;j(e+Math.cos(r)*i,t+Math.sin(r)*i,4+n()*8,(n()<.5?-1:1)*(2.2+n()*4.8))}let l=6+n()*5;for(let r=0;r<22;r++){let i=r/22*Math.PI*2+n()*.35,a=O(e+Math.cos(i)*l*(.65+n()*.55),t+Math.sin(i)*l*(.65+n()*.55));d[a]=Math.min(2.4,d[a]+.18+n()*.22),_[a]+=Math.cos(i)*(.35+n()*1),v[a]+=Math.sin(i)*(.35+n()*1)}},N=(e,t,n,r)=>{let i=Math.hypot(n,r);if(i<.04)return;let a=4.5;for(let o=-6;o<=6;o++)for(let s=-6;s<=6;s++){let c=Math.hypot(s,o);if(c>a)continue;let l=Math.exp(-(c*c)/(a*a)),u=O(e+s,t+o);_[u]+=n*l*11,v[u]+=r*l*11,d[u]=Math.min(1.5,d[u]+l*.015*i)}},P=null,F=e=>{if(!n.interactive)return;let t=A(e.clientX,e.clientY);P=t,M(t.x,t.y),m.setPointerCapture(e.pointerId)},I=e=>{if(!n.interactive||!e.buttons||!P)return;let t=A(e.clientX,e.clientY);N(t.x,t.y,t.x-P.x,t.y-P.y),P=t},L=e=>{P=null,m.hasPointerCapture(e.pointerId)&&m.releasePointerCapture(e.pointerId)};m.addEventListener(`pointerdown`,F),m.addEventListener(`pointermove`,I),m.addEventListener(`pointerup`,L),m.addEventListener(`pointercancel`,L);let R=(e,t,n,i,a)=>{for(let o=0;o<l;o++)for(let s=0;s<r;s++){let c=s+o*r;t[c]=k(e,s-n[c]*a,o-i[c]*a)}},z=(e,t,n)=>{for(let i=0;i<l;i++)for(let a=0;a<r;a++){let o=a+i*r,s=e[o],l=n*(.28+(1-(0,c.clamp)(s/1.6,0,1))*.85),u=e[O(a-1,i)],d=e[O(a+1,i)],f=e[O(a,i-1)],p=e[O(a,i+1)];t[o]=s*(1-l)+(u+d+f+p)*.25*l}},B=e=>{for(let e=1;e<l-1;e++)for(let t=1;t<r-1;t++){let n=t+e*r;x[n]=(v[n+1]-v[n-1])*.5-(_[n+r]-_[n-r])*.5}for(let t=1;t<l-1;t++)for(let n=1;n<r-1;n++){let i=n+t*r,a=d[i];if(a<.002&&Math.abs(x[i])<.001)continue;let o=4.5*a;v[i]+=o*e;let s=(x[i+1]-x[i-1])*.5,c=(x[i+r]-x[i-r])*.5,l=Math.hypot(s,c)+1e-5,u=12*e;_[i]+=c/l*x[i]*u,v[i]-=s/l*x[i]*u;let f=Al(n*.07+D*.15,t*.07-D*.11),p=Al(n*.11-D*.08,t*.11+40),m=a*3.2*e;_[i]+=(f-.5)*m*2,v[i]+=(p-.5)*m*2}},V=(e,t,n)=>{let[r,i,a]=Dl(e),[o,s,l]=Dl(t),u=(0,c.clamp)(n,0,1);return`rgb(${Math.round(r+(o-r)*u)} ${Math.round(i+(s-i)*u)} ${Math.round(a+(l-a)*u)})`},H=e=>{let n=(0,c.clamp)(1-Math.exp(-e*3.2),0,.92),r=V(`#c5dff0`,`#2a3038`,n*.85),o=V(`#9ec9e4`,`#232830`,n*.9),s=V(`#7eb0d4`,`#1a1e24`,n*.95),l=V(`#5f96bf`,`#12151a`,n),u=t.createRadialGradient(i*.5,a*.38,8,i*.5,a*.52,Math.max(i,a)*.78);u.addColorStop(0,r),u.addColorStop(.4,o),u.addColorStop(.75,s),u.addColorStop(1,l),t.fillStyle=u,t.fillRect(0,0,i,a);let d=Math.max(0,.28*(1-n*1.1));if(d>.02){let e=t.createLinearGradient(0,0,i*.35,a);e.addColorStop(0,`rgb(220 240 255 / ${d*100}%)`),e.addColorStop(.45,`rgb(180 215 240 / 0%)`),e.addColorStop(1,`rgb(90 140 180 / ${12*(1-n)}%)`),t.fillStyle=e,t.fillRect(0,0,i,a)}},ee=()=>{let[e,r,o]=Dl(n.inkColor??`#0c0e12`),s=w.data;for(let t=0;t<u;t++){let n=h[t];if(n<.004){s[t*4+3]=0;continue}let i=1-Math.exp(-n*1.55),a=Math.min(255,i*200),c=1-i;s[t*4]=Math.round(e*(1-c*.35)+36*c),s[t*4+1]=Math.round(r*(1-c*.3)+42*c),s[t*4+2]=Math.round(o*(1-c*.22)+58*c),s[t*4+3]=a}C.putImageData(w,0,0),t.save(),t.imageSmoothingEnabled=!0,t.globalAlpha=.92,t.filter=`blur(2.8px)`,t.drawImage(S,0,0,i,a),t.globalAlpha=.55,t.filter=`blur(7px)`,t.drawImage(S,0,0,i,a),t.restore()},U=()=>{let[e,r,o]=Dl(n.inkColor??`#0c0e12`),s=w.data;for(let t=0;t<u;t++){let n=d[t];if(n<.003){s[t*4+3]=0;continue}let i=1-Math.exp(-n*2.15),a=Math.min(255,i*255),c=1-i;s[t*4]=Math.round(e*(1-c*.18)+28*c),s[t*4+1]=Math.round(r*(1-c*.16)+32*c),s[t*4+2]=Math.round(o*(1-c*.12)+42*c),s[t*4+3]=a}C.putImageData(w,0,0),t.save(),t.imageSmoothingEnabled=!0,t.globalAlpha=1,t.globalCompositeOperation=`source-over`,t.filter=`none`,t.drawImage(S,0,0,i,a),t.globalAlpha=.38,t.filter=`blur(1.6px)`,t.drawImage(S,0,0,i,a),t.restore()};if(s){H(0),f=()=>{m.removeEventListener(`pointerdown`,F),m.removeEventListener(`pointermove`,I),m.removeEventListener(`pointerup`,L),m.removeEventListener(`pointercancel`,L)};return}let te=e=>{if(T=requestAnimationFrame(te),o)return;E||=e;let t=(0,c.clamp)((e-E)/1e3,.008,.033);E=e;let r=t*(n.speed??1);D+=r,B(r);let i=Math.exp(-r*.55);for(let e=0;e<u;e++)_[e]*=i,v[e]*=i;R(d,p,_,v,r*22),[d,p]=[p,d],z(d,p,.085),[d,p]=[p,d],R(_,y,_,v,r*16),R(v,b,_,v,r*16),[_,y]=[y,_],[v,b]=[b,v];let a=1-Math.exp(-r*.022),s=0;for(let e=0;e<u;e++){let t=d[e]*a;d[e]-=t,h[e]=Math.min(2.8,h[e]+t),s+=h[e]}z(h,g,.055),[h,g]=[g,h];for(let e=0;e<u;e++)h[e]*=Math.exp(-r*35e-5);H(s/u),ee(),U()};te(0),f=()=>{cancelAnimationFrame(T),m.removeEventListener(`pointerdown`,F),m.removeEventListener(`pointermove`,I),m.removeEventListener(`pointerup`,L),m.removeEventListener(`pointercancel`,L)}};return u=(0,c.bindVisibilityPause)(e=>{o=e}),d=(0,c.bindPrefersReducedMotion)(e=>{let t=s;s=e,s!==t&&_()}),h(),g(),{update(e){let t=n.fill,r=n.width,i=n.height;n={...n,...e},(n.fill!==t||n.width!==r||n.height!==i)&&g()},destroy(){r||(r=!0,f?.(),f=null,cancelAnimationFrame(0),u?.(),d?.(),l?.(),p.remove())}}}var Ml=`cos-aurora-veil`,Nl=800,Pl=500,Fl=[`#7ee8d8`,`#4cc9f0`,`#9d8df1`,`#e8a0f0`,`#5eead4`],Il=2,Ll=4,Rl=e=>{let t=Math.sin(e*127.1)*43758.5453;return t-Math.floor(t)},zl=(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]},Bl=(e,t,n)=>[(0,c.lerp)(e[0],t[0],n),(0,c.lerp)(e[1],t[1],n),(0,c.lerp)(e[2],t[2],n)],Vl=(e,t)=>Bl(e,[255,255,255],t/255),Hl=e=>(0,c.clamp)(e/.035,0,1)*(0,c.clamp)((1-e)/.07,0,1),Ul=e=>1-(1-e)**3;function Wl(e,t={}){let n={fill:!1,colors:Fl,bandCount:5,speed:1,interactive:!0,ariaLabel:`极光帷幕背景`,...t},r=!1,i=n.width??Nl,a=n.height??Pl,o=typeof document<`u`?document.hidden:!1,s=(0,c.prefersReducedMotion)(),l=null,u=null,d=null,f=null,p=[],m=[],h=[],g=0,_=0,v={x:0,y:0,sx:0,sy:0,vx:0,svx:0,active:!1},y=0,b=document.createElement(`div`);b.className=Ml;let x=document.createElement(`canvas`);x.className=`${Ml}__canvas`,b.appendChild(x),e.appendChild(b);let S=()=>{x.setAttribute(`role`,`img`),x.setAttribute(`aria-label`,n.ariaLabel??`极光帷幕背景`)},C=()=>{(0,c.applyCanvasHostBox)(e,b,{fill:!!n.fill,width:i,height:a}),x.style.width=`${i}px`,x.style.height=`${a}px`,S()},w=()=>{if(l?.(),l=null,!(n.fill??!1)){i=n.width??Nl,a=n.height??Pl,C(),T(),E();return}l=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:Nl,defaultHeight:Pl,measured:e});i=t.width,a=t.height,C(),T(),E()})},T=()=>{let e=n.colors?.length?n.colors:Fl,t=Math.max(3,Math.min(8,Math.round(n.bandCount??5)));p.length=0,m.length=0,h.length=0;for(let n=0;n<t;n++){let r=zl(e[n%e.length],[126,232,216]);p.push({x:i*(.11+n/Math.max(t-1,1)*.78),width:i*(.058+Rl(n+2)*.072),amp:i*(.02+Rl(n+5)*.028),freq:.0038+Rl(n+8)*.0026,phase:Rl(n+11)*Math.PI*2,drift:i*(.012+Rl(n+13)*.022),depth:Rl(n+19),color:r,glow:Vl(r,62),sheets:2+Math.floor(Rl(n+17)*2)})}p.sort((e,t)=>e.depth-t.depth);for(let e=0;e<260;e++){let t=Rl(e*.91);m.push({x:Rl(e*1.71)*i,y:Rl(e*3.13+2)*a*.97,r:.15+t*1.2,a:.08+t*.48,tw:Rl(e*6.1),depth:t,warm:Rl(e*2.7)>.82})}g=0,_=0,y=0;let r={x:i*.5,y:a*.5};Object.assign(v,{x:r.x,y:r.y,sx:r.x,sy:r.y,vx:0,svx:0,active:!1})},E=()=>{f?.(),f=null,cancelAnimationFrame(0);let e=Math.min(window.devicePixelRatio||1,Il);x.width=Math.floor(i*e),x.height=Math.floor(a*e);let t=x.getContext(`2d`);if(!t)return;t.setTransform(e,0,0,e,0,0);let r=document.createElement(`canvas`);r.width=Math.floor(i*e),r.height=Math.floor(a*e);let l=r.getContext(`2d`);if(!l)return;l.setTransform(e,0,0,e,0,0);let u=document.createElement(`canvas`);u.width=r.width,u.height=r.height;let d=u.getContext(`2d`);if(!d)return;d.setTransform(e,0,0,e,0,0);let b=Math.max(110,Math.floor(a/3.5)),S=new Float32Array(b+1),C=new Float32Array(b+1),w=new Float32Array(b+1),T=new Float32Array(b+1),E=0,D=0,O=e=>{let t=x.getBoundingClientRect();return{x:(e.clientX-t.left)*(i/Math.max(t.width,1)),y:(e.clientY-t.top)*(a/Math.max(t.height,1))}},k=(e,t)=>{v.vx=e-v.x,v.x=e,v.y=t,v.active=!0},A=e=>{if(!n.interactive)return;let{x:t,y:r}=O(e);k(t,r)},j=e=>{if(!n.interactive)return;let{x:t,y:r}=O(e);k(t,r)},M=e=>{if(!n.interactive)return;let{x:t,y:r}=O(e);Object.assign(v,{x:t,y:r,sx:t,sy:r,vx:0,svx:0,active:!0}),g=1,_=.55,h.push({x:t,y:r,t:0}),h.length>Ll&&h.shift()},N=()=>{v.active=!1};x.addEventListener(`pointermove`,A),x.addEventListener(`pointerenter`,j),x.addEventListener(`pointerdown`,M),x.addEventListener(`pointerleave`,N);let P=e=>{let t=1-Math.exp(-e*16);v.sx=(0,c.lerp)(v.sx,v.x,t),v.sy=(0,c.lerp)(v.sy,v.y,t),v.svx=(0,c.lerp)(v.svx,v.vx,t*.88),v.vx*=.84},F=e=>v.active?v.svx*.042:Math.sin(e*.1)*.26,I=e=>{if(!v.active)return 1;let t=Math.abs(v.sx-e.x)/Math.max(i*.28,1);return 1+Math.exp(-t*t*1.6)*.22},L=(e,t,n,r)=>{let i=F(n),o=t/Math.max(a,1),s=Math.sin(t*e.freq+n*.28+e.phase+i*o*3.8)*e.amp+Math.sin(t*e.freq*1.55+n*.17+e.phase*1.15+i*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(v.active){let e=(t-v.sy)/a,n=Math.exp(-e*e*2);l+=(v.sx-l)*(.24+r*.04)*n,l+=v.svx*.28*n*(.35+o*.65)}for(let e of h){let n=Ul(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 g>.02&&(l+=Math.sin(t*.05+n*38+e.phase)*g*12+Math.sin(t*.095-n*50+r)*g*6),l},R=(e,t,n,r)=>{let i=e.width*(.56+r*.12);if(i*=.93+.07*Math.sin(t*.0045+n*.15+e.phase+r),v.active){let e=(t-v.sy)/a;i*=1-.38*Math.exp(-e*e*2.6)}return g>.02&&(i*=1+g*.18*Math.abs(Math.sin(t*.085+n*44+r))),i},z=(e,t,n)=>{for(let r=0;r<=b;r++){let i=r/b*a,o=L(e,i,t,n),s=R(e,i,t,n),c=Math.sin(i*.003+t*.1+e.phase+n*.8)*s*.05;S[r]=o-s-c,C[r]=o+s+c*.55}return{left:S,right:C}},B=(e,t)=>{e.beginPath();for(let n=0;n<=b;n++){let r=n/b*a;n===0?e.moveTo(t.left[n],r):e.lineTo(t.left[n],r)}for(let n=b;n>=0;n--){let r=n/b*a;e.lineTo(t.right[n],r)}e.closePath()},V=(e,t,n,r,o,s,c)=>{B(e,n);let[l,u,d]=t.color,[f,p,m]=t.glow,h=I(t),_=.62+t.depth*.38,v=(.38+g*.18)*s*h*_,y=.1*s*_,b=.9+.1*Math.sin(c*.65+t.phase),x=e.createLinearGradient(t.x-t.width*2.4,0,t.x+t.width*2.4,0);x.addColorStop(0,`rgb(${l} ${u} ${d} / 0%)`),x.addColorStop(.34,`rgb(${l} ${u} ${d} / ${y})`),x.addColorStop(.5,`rgb(${f} ${p} ${m} / ${v*o*b})`),x.addColorStop(.66,`rgb(${l} ${u} ${d} / ${y})`),x.addColorStop(1,`rgb(${l} ${u} ${d} / 0%)`),e.fillStyle=x,e.fill();let S=e.createLinearGradient(0,0,0,a);S.addColorStop(0,`rgb(${l} ${u} ${d} / 0%)`),S.addColorStop(.04,`rgb(${f} ${p} ${m} / ${(.62+g*.24)*h})`),S.addColorStop(.28,`rgb(${f} ${p} ${m} / ${(.82+g*.28)*h})`),S.addColorStop(.58,`rgb(${l} ${u} ${d} / ${(.48+g*.14)*h})`),S.addColorStop(.88,`rgb(${l} ${u} ${d} / 0.05)`),S.addColorStop(1,`rgb(${l} ${u} ${d} / 0%)`),e.save(),e.globalCompositeOperation=`source-atop`,e.fillStyle=S,e.fillRect(0,0,i,a),e.restore()},H=(e,n)=>{let r=t.createLinearGradient(0,0,0,a);r.addColorStop(0,`#000104`),r.addColorStop(.28,`#020810`),r.addColorStop(.62,`#040c14`),r.addColorStop(1,`#020508`),t.fillStyle=r,t.fillRect(0,0,i,a);let o=t.createLinearGradient(i*.1,a*.05,i*.9,a*.35);o.addColorStop(0,`rgb(0 0 0 / 0%)`),o.addColorStop(.45,`rgb(50 65 95 / 6%)`),o.addColorStop(.55,`rgb(60 75 110 / 7%)`),o.addColorStop(1,`rgb(0 0 0 / 0%)`),t.fillStyle=o,t.fillRect(0,0,i,a);let s=t.createRadialGradient(i*.52,a*.1,0,i*.48,a*.22,a*.7);s.addColorStop(0,`rgb(35 55 90 / 8%)`),s.addColorStop(1,`rgb(0 0 0 / 0%)`),t.fillStyle=s,t.fillRect(0,0,i,a);for(let r of m){let i=r.y/a,o=n?1:.5+.5*Math.sin(e*(.65+r.depth)+r.tw*10),s=r.a*o*Hl(i);if(s<.02)continue;let c=r.warm?`255 230 210`:`220 232 255`;t.fillStyle=`rgb(${c} / ${s})`,t.beginPath(),t.arc(r.x,r.y,r.r,0,Math.PI*2),t.fill(),r.depth>.88&&(t.strokeStyle=`rgb(${c} / ${s*.35})`,t.lineWidth=.5,t.beginPath(),t.moveTo(r.x-r.r*3.5,r.y),t.lineTo(r.x+r.r*3.5,r.y),t.moveTo(r.x,r.y-r.r*3.5),t.lineTo(r.x,r.y+r.r*3.5),t.stroke(),t.fillStyle=`rgb(${c} / ${s*.1})`,t.beginPath(),t.arc(r.x,r.y,r.r*2.6,0,Math.PI*2),t.fill())}let c=t.createLinearGradient(0,a*.82,0,a);c.addColorStop(0,`rgb(0 0 0 / 0%)`),c.addColorStop(.55,`rgb(20 40 55 / 12%)`),c.addColorStop(1,`rgb(10 25 35 / 28%)`),t.fillStyle=c,t.fillRect(0,a*.78,i,a*.22);let l=t.createRadialGradient(i*.5,a*.4,a*.14,i*.5,a*.5,a*.98);l.addColorStop(0,`rgb(0 0 0 / 0%)`),l.addColorStop(1,`rgb(0 0 0 / 42%)`),t.fillStyle=l,t.fillRect(0,0,i,a)},ee=e=>{l.clearRect(0,0,i,a),d.clearRect(0,0,i,a),l.globalCompositeOperation=`lighter`,d.globalCompositeOperation=`lighter`;for(let t of p){for(let n=0;n<t.sheets;n++)V(l,t,z(t,e,n),g,1,.88/t.sheets,e);let n=z(t,e,0);for(let e=0;e<=b;e++){let t=(n.left[e]+n.right[e])*.5;w[e]=(0,c.lerp)(n.left[e],t,.58),T[e]=(0,c.lerp)(n.right[e],t,.58)}V(d,t,{left:w,right:T},g,1.35,.52,e)}t.save(),t.globalCompositeOperation=`screen`,t.globalAlpha=1,t.drawImage(r,0,0,i,a),t.globalAlpha=.42+g*.1,t.filter=`blur(1px)`,t.drawImage(r,0,0,i,a),t.filter=`none`,t.globalAlpha=.62+g*.12,t.filter=`blur(2.4px)`,t.drawImage(u,0,0,i,a),t.filter=`none`,t.globalAlpha=1,t.restore();for(let e of h){let n=Ul(1-e.t),r=20+e.t*Math.max(i,a)*.22,o=t.createRadialGradient(e.x,e.y,0,e.x,e.y,r);o.addColorStop(0,`rgb(140 220 190 / ${.12*n})`),o.addColorStop(.5,`rgb(80 180 150 / ${.05*n})`),o.addColorStop(1,`rgb(0 0 0 / 0%)`),t.fillStyle=o,t.fillRect(0,0,i,a)}_>.01&&(t.fillStyle=`rgb(180 230 210 / ${_*.06})`,t.fillRect(0,0,i,a))},U=e=>{H(y,e),ee(y)};if(s){U(!0),f=()=>{x.removeEventListener(`pointermove`,A),x.removeEventListener(`pointerenter`,j),x.removeEventListener(`pointerdown`,M),x.removeEventListener(`pointerleave`,N)};return}let te=e=>{if(E=requestAnimationFrame(te),o)return;D||=e;let t=(0,c.clamp)((e-D)/1e3,.008,.04);D=e,P(t),y+=t*(n.speed??1),g*=Math.exp(-t*3.2),_*=Math.exp(-t*7);for(let e=h.length-1;e>=0;e--)h[e].t>=1&&h.splice(e,1);U(!1)};te(0),f=()=>{cancelAnimationFrame(E),x.removeEventListener(`pointermove`,A),x.removeEventListener(`pointerenter`,j),x.removeEventListener(`pointerdown`,M),x.removeEventListener(`pointerleave`,N)}};return u=(0,c.bindVisibilityPause)(e=>{o=e}),d=(0,c.bindPrefersReducedMotion)(e=>{let t=s;s=e,s!==t&&E()}),C(),T(),E(),{update(e){let t=n.fill,r=n.width,i=n.height;n={...n,...e},(n.fill!==t||n.width!==r||n.height!==i)&&w()},destroy(){r||(r=!0,f?.(),f=null,cancelAnimationFrame(0),u?.(),d?.(),l?.(),b.remove())}}}var Gl=`cos-solar-system`,Kl=[{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}];function ql(e,t={}){let n={width:400,height:400,speed:1,showOrbits:!0,...t},r=!1,i=0,a=typeof document<`u`?document.hidden:!1,o=null,s=Kl.map(e=>({...e,angle:Math.random()*Math.PI*2})),l=Array.from({length:80},()=>({x:Math.random(),y:Math.random(),alpha:Math.random()*.6})),u=document.createElement(`div`);u.className=Gl;let d=document.createElement(`canvas`);d.className=`${Gl}__canvas`,u.appendChild(d),e.appendChild(u);let f=()=>{let e=n.width??400,t=n.height??400;u.style.width=`${e}px`,u.style.height=`${t}px`,d.style.width=`${e}px`,d.style.height=`${t}px`;let r=window.devicePixelRatio||1;d.width=e*r,d.height=t*r;let i=d.getContext(`2d`);i&&i.setTransform(r,0,0,r,0,0)},p=()=>{if(r||(i=requestAnimationFrame(p),a))return;let e=d.getContext(`2d`);if(!e)return;let t=n.width??400,o=n.height??400,c=n.speed??1,u=n.showOrbits??!0,f=t/2,m=o/2,h=Math.min(t,o)/380,g=[];e.fillStyle=`#0f172a`,e.fillRect(0,0,t,o),l.forEach(n=>{e.fillStyle=`rgba(255,255,255,${n.alpha})`,e.fillRect(n.x*t,n.y*o,1,1)}),e.beginPath(),e.arc(f,m,18*h,0,Math.PI*2);let _=e.createRadialGradient(f,m,0,f,m,18*h);_.addColorStop(0,`#fef08a`),_.addColorStop(.5,`#fbbf24`),_.addColorStop(1,`#f97316`),e.fillStyle=_,e.shadowColor=`#fbbf24`,e.shadowBlur=24,e.fill(),e.shadowBlur=0,s.forEach((t,n)=>{t.angle+=t.speed*.008*c/Math.sqrt(t.orbit);let r=f,i=m;t.parent!==void 0&&g[t.parent]&&(r=g[t.parent].x,i=g[t.parent].y);let a=t.orbit*h,o=r+Math.cos(t.angle)*a,s=i+Math.sin(t.angle)*a;if(g[n]={x:o,y:s},u&&t.parent===void 0&&(e.beginPath(),e.arc(r,i,a,0,Math.PI*2),e.strokeStyle=`rgba(148, 163, 184, 0.15)`,e.lineWidth=1,e.stroke()),t.name===`Saturn`&&(e.beginPath(),e.ellipse(o,s,t.size*h*1.8,t.size*h*.5,t.angle*.3,0,Math.PI*2),e.strokeStyle=`rgba(252, 211, 77, 0.5)`,e.lineWidth=1.5,e.stroke()),e.beginPath(),e.arc(o,s,t.size*h,0,Math.PI*2),e.fillStyle=t.color,t.name===`Earth`){let n=e.createRadialGradient(o-2,s-2,0,o,s,t.size*h);n.addColorStop(0,`#4ade80`),n.addColorStop(.6,t.color),n.addColorStop(1,`#1d4ed8`),e.fillStyle=n}e.fill()})};return f(),o=(0,c.bindVisibilityPause)(e=>{a=e}),p(),{update(e){n={...n,...e},f()},destroy(){r||(r=!0,cancelAnimationFrame(i),o?.(),u.remove())}}}var Jl=`cos-snowfall`,Yl=800,Xl=500;function Zl(e,t={}){let n={fill:!1,mode:`snow`,count:120,...t},r=!1,i=n.width??Yl,a=n.height??Xl,o=0,s=typeof document<`u`?document.hidden:!1,l=(0,c.prefersReducedMotion)(),u=null,d=null,f=null,p=[],m=document.createElement(`div`);m.className=Jl;let h=document.createElement(`canvas`);h.className=`${Jl}__canvas`,m.appendChild(h),e.appendChild(m);let g=e=>{let t=n.mode??`snow`;return{x:Math.random()*i,y:e??Math.random()*a,size:t===`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}},_=()=>{p.length=0;let e=n.count??120;for(let t=0;t<e;t++)p.push(g())},v=()=>{(0,c.applyCanvasHostBox)(e,m,{fill:!!n.fill,width:i,height:a}),h.style.width=`${i}px`,h.style.height=`${a}px`},y=()=>{let e=window.devicePixelRatio||1;h.width=i*e,h.height=a*e;let t=h.getContext(`2d`);return t&&t.setTransform(e,0,0,e,0,0),t},b=()=>{if(u?.(),u=null,!(n.fill??!1)){i=n.width??Yl,a=n.height??Xl,v(),y(),_();return}u=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:Yl,defaultHeight:Xl,measured:e});i=t.width,a=t.height,v(),y(),_()})},x=(e,t)=>{e.globalAlpha=t.opacity,e.fillStyle=`#fff`,e.beginPath(),e.arc(t.x,t.y,t.size,0,Math.PI*2),e.fill()},S=(e,t)=>{e.save(),e.translate(t.x,t.y),e.rotate(t.rotation),e.globalAlpha=t.opacity;let n=t.size;e.fillStyle=`#ffb7c5`,e.beginPath(),e.ellipse(0,0,n,n*.6,0,0,Math.PI*2),e.fill(),e.fillStyle=`#ff8fa3`,e.beginPath(),e.ellipse(n*.3,0,n*.5,n*.35,.5,0,Math.PI*2),e.fill(),e.restore()},C=e=>{let t=h.getContext(`2d`);if(!t)return;let r=n.mode??`snow`;t.fillStyle=r===`sakura`?`#1a1020`:`#0f172a`,t.fillRect(0,0,i,a);for(let n of p)e&&(n.y+=n.speed,n.x+=n.drift+Math.sin(n.y*.02)*.3,n.rotation+=n.rotationSpeed,n.y>a+10&&Object.assign(n,g(-10))),r===`sakura`?S(t,n):x(t,n);t.globalAlpha=1},w=()=>{r||(o=requestAnimationFrame(w),!(s||l)&&C(!0))};return d=(0,c.bindVisibilityPause)(e=>{s=e}),f=(0,c.bindPrefersReducedMotion)(e=>{l=e,l&&C(!1)}),b(),_(),l?C(!1):w(),{update(e){let t=n;n={...n,...e},(t.fill!==n.fill||t.width!==n.width||t.height!==n.height)&&b(),l&&C(!1)},destroy(){r||(r=!0,cancelAnimationFrame(o),d?.(),f?.(),u?.(),m.remove())}}}var Ql=`cos-starfield`,$l=800,eu=500;function tu(e,t={}){let n={starCount:400,speed:1,...t},r=!1,i=n.width??$l,a=n.height??eu,o=null,s=null,l=null,u=0,d=typeof document<`u`?document.hidden:!1,f=(0,c.prefersReducedMotion)(),p=[],m=document.createElement(`div`);m.className=Ql;let h=document.createElement(`canvas`);h.className=`${Ql}__canvas`,m.appendChild(h),e.appendChild(m);let g=()=>{p.length=0;let e=n.starCount??400;for(let t=0;t<e;t++)p.push({x:(Math.random()-.5)*i,y:(Math.random()-.5)*a,z:Math.random()*i})},_=()=>{let t=n.fill??!1;(0,c.applyCanvasHostBox)(e,m,{fill:!!t,width:i,height:a}),h.style.width=`${i}px`,h.style.height=`${a}px`},v=()=>{let e=window.devicePixelRatio||1;h.width=i*e,h.height=a*e;let t=h.getContext(`2d`);return t&&t.setTransform(e,0,0,e,0,0),t},y=()=>{if(o?.(),o=null,!(n.fill??!1)){i=n.width??$l,a=n.height??eu,_(),v(),g();return}o=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:$l,defaultHeight:eu,measured:e});i=t.width,a=t.height,_(),v(),g()})},b=(e,t)=>{let r=i/2,o=a/2,s=n.speed??1;e.fillStyle=`rgb(0 0 0 / 25%)`,e.fillRect(0,0,i,a);for(let n of p){t&&(n.z-=s*2,n.z<=0&&(n.x=(Math.random()-.5)*i,n.y=(Math.random()-.5)*a,n.z=i));let c=128/n.z,l=n.x*c+r,u=n.y*c+o;if(l<0||l>=i||u<0||u>=a)continue;let d=(1-n.z/i)*3,f=(1-n.z/i)*255;if(t&&d>.5){let t=128/(n.z+s*4),i=n.x*t+r,a=n.y*t+o;e.beginPath(),e.strokeStyle=`rgb(${f} ${f} ${f+30})`,e.lineWidth=d,e.moveTo(i,a),e.lineTo(l,u),e.stroke()}else e.fillStyle=`rgb(${f} ${f} ${f+30})`,e.fillRect(l,u,Math.max(d,.5),Math.max(d,.5))}},x=()=>{if(r||(u=requestAnimationFrame(x),d))return;let e=h.getContext(`2d`);e&&(f||b(e,!0))},S=()=>{let e=v();e&&(e.fillStyle=`#000`,e.fillRect(0,0,i,a),b(e,!1))};return s=(0,c.bindVisibilityPause)(e=>{d=e}),l=(0,c.bindPrefersReducedMotion)(e=>{f=e,f&&S()}),y(),g(),f?S():x(),{update(e){let t=n;n={...n,...e},(t.fill!==n.fill||t.width!==n.width||t.height!==n.height)&&y(),f&&S()},destroy(){r||(r=!0,cancelAnimationFrame(u),s?.(),l?.(),o?.(),m.remove())}}}var nu=`cos-progress-chest`,ru=2,iu=120;function au(e,t={}){let n={progress:0,auto:!1,label:`开启宝箱`,openedLabel:`宝箱已开启!`,...t},r=!1,i=!1,a=(0,c.clamp)(n.progress??0,0,100),o=null,s={current:n.onOpen},l=document.createElement(`div`);l.className=nu;let u=document.createElement(`div`);u.className=`${nu}__bar-wrap`;let d=document.createElement(`div`);d.className=`${nu}__bar-track`;let f=document.createElement(`div`);f.className=`${nu}__bar-fill`;let p=document.createElement(`span`);p.className=`${nu}__pct`,d.appendChild(f),u.append(d,p);let m=document.createElement(`div`);m.className=`${nu}__chest`;let h=document.createElement(`div`);h.className=`${nu}__lid`;let g=document.createElement(`div`);g.className=`${nu}__lid-top`;let _=document.createElement(`div`);_.className=`${nu}__lock`,h.append(g,_);let v=document.createElement(`div`);v.className=`${nu}__body`;let y=document.createElement(`div`);y.className=`${nu}__treasure`,y.hidden=!0;for(let e of[`💎`,`✨`,`🪙`]){let t=document.createElement(`span`);t.textContent=e,y.appendChild(t)}v.appendChild(y),m.append(h,v);let b=document.createElement(`p`);b.className=`${nu}__label`,l.append(u,m,b),e.appendChild(l);let x=()=>n.auto?a:(0,c.clamp)(n.progress??0,0,100),S=()=>{let e=x(),t=e>=100;f.style.width=`${e}%`,p.textContent=`${e.toFixed(0)}%`,m.classList.toggle(`${nu}__chest--open`,t),y.hidden=!t,b.textContent=t?n.openedLabel??`宝箱已开启!`:n.label??`开启宝箱`,t&&!i&&(i=!0,s.current?.()),t||(i=!1)},C=()=>{o!=null&&(window.clearInterval(o),o=null)},w=()=>{if(!(n.auto??!1)||r){C();return}o??=window.setInterval(()=>{r||(a=a>=100?0:a+ru,S())},iu)};return S(),w(),{update(e){let t=!!n.auto;n={...n,...e},s.current=n.onOpen,!n.auto&&e.progress!==void 0&&(a=(0,c.clamp)(e.progress,0,100)),!!n.auto!==t&&n.auto&&(a=(0,c.clamp)(n.progress??a,0,100)),w(),S()},destroy(){r||(r=!0,C(),l.remove())}}}var ou=`cos-radar-scan`;function su(e,t={}){let n={size:300,color:`#22d3ee`,blipCount:5,...t},r=!1,i=n.size??300,a=0,o=0,s=typeof document<`u`?document.hidden:!1,l=null,u=[],d=document.createElement(`div`);d.className=ou;let f=document.createElement(`canvas`);f.className=`${ou}__canvas`,d.appendChild(f),e.appendChild(d);let p=()=>{u.length=0;let e=n.blipCount??5;for(let t=0;t<e;t++)u.push({angle:Math.random()*Math.PI*2,dist:Math.random()*.7+.15,alpha:Math.random()*.5+.5})},m=()=>{i=n.size??300,d.style.width=`${i}px`,d.style.height=`${i}px`,f.style.width=`${i}px`,f.style.height=`${i}px`},h=()=>{let e=window.devicePixelRatio||1;f.width=i*e,f.height=i*e;let t=f.getContext(`2d`);return t&&t.setTransform(e,0,0,e,0,0),t},g=()=>{if(r||(a=requestAnimationFrame(g),s))return;let e=f.getContext(`2d`);if(!e)return;let t=n.color??`#22d3ee`,c=i/2,l=i/2,d=i/2-10;o+=.03,e.fillStyle=`rgb(15 23 42 / 25%)`,e.fillRect(0,0,i,i);for(let n=1;n<=4;n++)e.beginPath(),e.arc(c,l,d/4*n,0,Math.PI*2),e.strokeStyle=`${t}33`,e.lineWidth=1,e.stroke();e.beginPath(),e.moveTo(c,l-d),e.lineTo(c,l+d),e.moveTo(c-d,l),e.lineTo(c+d,l),e.strokeStyle=`${t}44`,e.stroke();let p=o,m=e.createConicGradient(p-.5,c,l);m.addColorStop(0,`transparent`),m.addColorStop(.15,`${t}66`),m.addColorStop(.3,`transparent`),e.beginPath(),e.moveTo(c,l),e.arc(c,l,d,p-.5,p),e.closePath(),e.fillStyle=m,e.fill(),e.beginPath(),e.moveTo(c,l),e.lineTo(c+Math.cos(p)*d,l+Math.sin(p)*d),e.strokeStyle=t,e.lineWidth=2,e.stroke();for(let n of u){let r=c+Math.cos(n.angle)*d*n.dist,i=l+Math.sin(n.angle)*d*n.dist;Math.abs((p-n.angle+Math.PI)%(Math.PI*2)-Math.PI)<.3?n.alpha=Math.min(1,n.alpha+.05):n.alpha=Math.max(.2,n.alpha-.01),e.beginPath(),e.arc(r,i,4,0,Math.PI*2),e.fillStyle=t,e.globalAlpha=n.alpha,e.fill(),e.globalAlpha=1}e.beginPath(),e.arc(c,l,d,0,Math.PI*2),e.strokeStyle=t,e.lineWidth=2,e.stroke()};return m(),h(),p(),l=(0,c.bindVisibilityPause)(e=>{s=e}),g(),{update(e){n={...n,...e},m(),h(),p()},destroy(){r||(r=!0,cancelAnimationFrame(a),l?.(),d.remove())}}}var cu=`cos-red-packet-rain`,lu=400,uu=500;function du(e,t={}){let n={fill:!1,duration:1e4,auto:!0,grabbedLabel:`已抢:`,endedText:`红包雨结束`,hint:`点击红包抢夺`,...t},r=!1,i=n.width??lu,a=n.height??uu,o=0,s=typeof document<`u`?document.hidden:!1,l=(0,c.prefersReducedMotion)(),u=null,d=null,f=null,p=[],m=0,h=0,g=0,_=0,v=0,y=n.auto??!0,b={current:n.onGrab},x={current:n.onEnd},S=document.createElement(`div`);S.className=cu;let C=document.createElement(`canvas`);C.className=`${cu}__canvas`,C.style.touchAction=`none`;let w=document.createElement(`div`);w.className=`${cu}__hud`;let T=document.createElement(`span`),E=document.createElement(`span`);E.className=`${cu}__end`,w.appendChild(T),w.appendChild(E);let D=document.createElement(`p`);D.className=`${cu}__hint`,S.append(C,w,D),e.appendChild(S);let O=()=>{T.textContent=`${n.grabbedLabel??`已抢:`} ¥${v}`,E.textContent=y?``:n.endedText??`红包雨结束`,E.hidden=y,D.textContent=n.hint??`点击红包抢夺`},k=()=>{(0,c.applyCanvasHostBox)(e,S,{fill:!!n.fill,width:i,height:a}),C.style.width=`${i}px`,C.style.height=`${a}px`,O()},A=()=>{let e=window.devicePixelRatio||1;C.width=i*e,C.height=a*e;let t=C.getContext(`2d`);return t&&t.setTransform(e,0,0,e,0,0),t},j=()=>{if(u?.(),u=null,!(n.fill??!1)){i=n.width??lu,a=n.height??uu,k(),A();return}u=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:lu,defaultHeight:uu,measured:e});i=t.width,a=t.height,k(),A()})},M=()=>{p.push({id:m++,x:Math.random()*(i-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})},N=()=>{y&&(y=!1,O(),x.current?.())},P=()=>{_+=1;let e=_;p.length=0,h=0,y=!0,O(),window.clearTimeout(g),g=window.setTimeout(()=>{e===_&&N()},n.duration??1e4)},F=()=>{window.clearTimeout(g),N()},I=()=>{window.clearTimeout(g),_+=1,p.length=0,h=0,y=!1,v=0,O()},L=(e,t)=>{if(!y)return;let n=!1;for(let r of p)r.grabbed||n||Math.abs(e-r.x)<30&&Math.abs(t-r.y)<35&&(n=!0,r.grabbed=!0,v+=r.amount,O(),b.current?.(r.amount))},R=e=>{let t=(0,c.getRelativePointerPosition)(C,e);t&&L(t.x,t.y)};C.addEventListener(`pointerdown`,R);let z=()=>{if(r||(o=requestAnimationFrame(z),s))return;let e=C.getContext(`2d`);if(e){!l&&y&&(h++,h%20==0&&M()),e.fillStyle=`rgb(15 23 42 / 20%)`,e.fillRect(0,0,i,a);for(let t=p.length-1;t>=0;t--){let n=p[t];if(n.grabbed){p.splice(t,1);continue}l||(n.y+=n.speed,n.x+=Math.sin(n.y*.02)*.5),e.save(),e.translate(n.x,n.y),e.rotate(n.rotation),e.fillStyle=`#dc2626`,e.beginPath(),e.roundRect(-22,-28,44,56,6),e.fill(),e.fillStyle=`#fbbf24`,e.beginPath(),e.arc(0,-10,8,0,Math.PI*2),e.fill(),e.fillStyle=`#fde68a`,e.font=`bold 12px system-ui`,e.textAlign=`center`,e.fillText(`¥${n.amount}`,0,12),e.restore(),!l&&n.y>=a+60&&p.splice(t,1)}}};return d=(0,c.bindVisibilityPause)(e=>{s=e}),f=(0,c.bindPrefersReducedMotion)(e=>{l=e}),j(),(n.auto??!0)&&P(),z(),{update(e){n={...n,...e},b.current=n.onGrab,x.current=n.onEnd,j(),O()},start:P,stop:F,reset:I,destroy(){r||(r=!0,window.clearTimeout(g),cancelAnimationFrame(o),d?.(),f?.(),u?.(),C.removeEventListener(`pointerdown`,R),S.remove())}}}var fu=`cos-return-city`;function pu(e,t={}){let n={glassCount:8,glassRadius:150,...t},r=!1,i=[],a=[],o=[],s=document.createElement(`div`);s.className=fu;let c=document.createElement(`div`);c.className=`${fu}__glass-wrap`,s.appendChild(c),e.style.width=`100%`,e.style.height=`100%`,e.style.minHeight=`360px`,s.style.width=`100%`,s.style.height=`100%`,s.style.minHeight=`360px`,e.appendChild(s);let l=()=>{i.forEach(e=>window.clearTimeout(e)),i.length=0,a.forEach(e=>e.remove()),a.length=0,o.forEach(e=>e.remove()),o.length=0},u=()=>{l();let{width:e,height:t}=s.getBoundingClientRect(),r=n.starCount??Math.max(20,Math.floor(e/20)),u=n.glassCount??8,d=n.glassRadius??150;for(let n=0;n<r;n++){let n=window.setTimeout(()=>{let n=document.createElement(`div`);n.className=`${fu}__star`,n.style.top=`${Math.random()*t}px`,n.style.left=`${Math.random()*e}px`,s.append(n),a.push(n)},Math.random()*2e3);i.push(n)}for(let e=0;e<u;e++){let t=document.createElement(`div`);t.className=`${fu}__glass-item`,t.style.transform=`rotateY(${360/u*e}deg) translateZ(${d}px)`,c.appendChild(t),o.push(t);let n=window.setTimeout(()=>{t.style.top=`0px`,t.style.opacity=`1`},e*300);i.push(n)}};return u(),{update(e){n={...n,...e},u()},destroy(){r||(r=!0,l(),s.remove())}}}var mu=`cos-rope-chain`,hu=400,gu=400;function _u(e,t={}){let n={segments:16,color:`#38bdf8`,gravity:.4,...t},r=!1,i=n.width??hu,a=n.height??gu,o=0,s=typeof document<`u`?document.hidden:!1,l=null,u=[],d={active:!1,index:-1},f=0,p=0,m=document.createElement(`div`);m.className=mu;let h=document.createElement(`canvas`);h.className=`${mu}__canvas`,m.appendChild(h),e.appendChild(m);let g=()=>{p=Math.max(4,Math.min(n.segments??16,30)),f=a*.7/p;let e=i/2,t=a*.08;u.length=0;for(let n=0;n<=p;n++)u.push({x:e,y:t+n*f,prevX:e,prevY:t+n*f,pinned:n===0})},_=()=>{i=n.width??hu,a=n.height??gu,m.style.width=`${i}px`,m.style.height=`${a}px`,h.style.width=`${i}px`,h.style.height=`${a}px`},v=()=>{let e=window.devicePixelRatio||1;h.width=i*e,h.height=a*e;let t=h.getContext(`2d`);return t&&t.setTransform(e,0,0,e,0,0),t},y=(e,t)=>{let n=-1,r=30;return u.forEach((i,a)=>{let o=Math.hypot(i.x-e,i.y-t);o<r&&(r=o,n=a)}),n},b=(e,t)=>{let n=h.getBoundingClientRect(),r=e-n.left,i=t-n.top,a=y(r,i);if(a>=0){d.active=!0,d.index=a;let e=u[a];e.x=r,e.y=i,e.prevX=r,e.prevY=i}},x=(e,t)=>{if(!d.active)return;let n=h.getBoundingClientRect(),r=u[d.index];r.x=e-n.left,r.y=t-n.top},S=()=>{d.active=!1,d.index=-1},C=e=>b(e.clientX,e.clientY),w=e=>x(e.clientX,e.clientY),T=e=>{e.touches[0]&&b(e.touches[0].clientX,e.touches[0].clientY)},E=e=>{e.touches[0]&&x(e.touches[0].clientX,e.touches[0].clientY)};h.addEventListener(`mousedown`,C),h.addEventListener(`mousemove`,w),window.addEventListener(`mouseup`,S),h.addEventListener(`touchstart`,T,{passive:!0}),h.addEventListener(`touchmove`,E,{passive:!0}),window.addEventListener(`touchend`,S);let D=()=>{if(r||(o=requestAnimationFrame(D),s))return;let e=h.getContext(`2d`);if(!e)return;let t=n.gravity??.4,c=n.color??`#38bdf8`;for(let e of u){if(e.pinned||d.active&&u.indexOf(e)===d.index)continue;let n=(e.x-e.prevX)*.99,r=(e.y-e.prevY)*.99;e.prevX=e.x,e.prevY=e.y,e.x+=n,e.y+=r,e.y+=t}for(let e=0;e<6;e++)for(let e=0;e<u.length-1;e++){let t=u[e],n=u[e+1],r=n.x-t.x,i=n.y-t.y,a=Math.hypot(r,i)||.001,o=(a-f)/a,s=r*o*.5,c=i*o*.5;!t.pinned&&!(d.active&&e===d.index)&&(t.x+=s,t.y+=c),!n.pinned&&!(d.active&&e+1===d.index)&&(n.x-=s,n.y-=c)}e.fillStyle=`#0f172a`,e.fillRect(0,0,i,a),e.beginPath(),u.forEach((t,n)=>n===0?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)),e.strokeStyle=c,e.lineWidth=3,e.lineCap=`round`,e.lineJoin=`round`,e.shadowColor=c,e.shadowBlur=8,e.stroke(),e.shadowBlur=0,u.forEach((t,n)=>{(n===0||n===u.length-1||n%4==0)&&(e.beginPath(),e.arc(t.x,t.y,n===0?6:4,0,Math.PI*2),e.fillStyle=n===0?`#94a3b8`:c,e.fill())})};return _(),v(),g(),l=(0,c.bindVisibilityPause)(e=>{s=e}),D(),{update(e){n={...n,...e},_(),v(),g()},destroy(){r||(r=!0,cancelAnimationFrame(o),l?.(),h.removeEventListener(`mousedown`,C),h.removeEventListener(`mousemove`,w),window.removeEventListener(`mouseup`,S),h.removeEventListener(`touchstart`,T),h.removeEventListener(`touchmove`,E),window.removeEventListener(`touchend`,S),m.remove())}}}var vu=`cos-rotating-text`,yu=[`React`,`Motion`,`Design`,`COS`],bu=e=>{let t=Intl;return t.Segmenter?Array.from(new t.Segmenter(`en`,{granularity:`grapheme`}).segment(e),e=>e.segment):Array.from(e)};function xu(e,t={}){let n={texts:yu,interval:2200,stagger:40,duration:420,fontSize:56,color:`#0f172a`,highlightColor:`#38bdf8`,...t},r=0,i=`enter`,a=0,o=0,s=!1,c=document.createElement(`div`);c.className=vu;let l=document.createElement(`div`);l.className=`${vu}__badge`,c.appendChild(l),e.appendChild(c);let u=()=>Array.isArray(n.texts)&&n.texts.length>0?n.texts:yu,d=()=>{let e=bu(u()[r]??``);l.style.fontSize=`${n.fontSize??56}px`,l.style.color=n.color??`#0f172a`,l.style.setProperty(`--rt-bg`,n.highlightColor??`#38bdf8`),l.style.setProperty(`--rt-duration`,`${n.duration??420}ms`),l.replaceChildren(),e.forEach((t,r)=>{let a=document.createElement(`span`);a.className=`${vu}__char ${i===`enter`?`${vu}__enter`:`${vu}__exit`}`;let o=i===`enter`?r*(n.stagger??40):(e.length-1-r)*(n.stagger??40);a.style.animationDelay=`${o}ms`,a.textContent=t===` `?`\xA0`:t,l.appendChild(a)})},f=()=>{a&&clearTimeout(a),o&&clearTimeout(o),a=o=0},p=()=>{if(f(),s)return;let e=u(),t=bu(e[r]??``);a=window.setTimeout(()=>{s||(i=`exit`,d(),o=window.setTimeout(()=>{s||(r=(r+1)%e.length,i=`enter`,d(),p())},t.length*(n.stagger??40)+(n.duration??420)))},n.interval??2200)};return d(),p(),{update(e){n={...n,...e},r=0,i=`enter`,d(),p()},destroy(){s=!0,f(),c.remove()}}}var Su=`cos-speedometer`,Cu=(e,t,n,r)=>{let i=(r-90)*Math.PI/180;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}};function wu(e,t={}){let n={value:0,max:100,label:`SPEED`,color:`#f97316`,...t},r=!1,i=document.createElement(`div`);i.className=Su;let a=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);a.setAttribute(`viewBox`,`0 0 200 130`),a.classList.add(`${Su}__svg`);let o=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);o.classList.add(`${Su}__track`),o.setAttribute(`fill`,`none`),o.setAttribute(`stroke-width`,`12`),o.setAttribute(`stroke-linecap`,`round`);let s=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);s.classList.add(`${Su}__value-arc`),s.setAttribute(`fill`,`none`),s.setAttribute(`stroke-width`,`12`),s.setAttribute(`stroke-linecap`,`round`);let l=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);l.classList.add(`${Su}__needle`);let u=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`);u.classList.add(`${Su}__hub`),u.setAttribute(`cx`,`100`),u.setAttribute(`cy`,`100`),u.setAttribute(`r`,`6`);let d=document.createElementNS(`http://www.w3.org/2000/svg`,`text`);d.classList.add(`${Su}__value-text`),d.setAttribute(`x`,`100`),d.setAttribute(`y`,`118`);let f=[];for(let e of[-120,-60,0,60,120]){let t=Cu(100,100,58,e),n=Cu(100,100,66,e),r=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);r.classList.add(`${Su}__tick`),r.setAttribute(`x1`,String(t.x)),r.setAttribute(`y1`,String(t.y)),r.setAttribute(`x2`,String(n.x)),r.setAttribute(`y2`,String(n.y)),f.push(r)}a.append(o,s,...f,l,u,d);let p=document.createElement(`span`);p.className=`${Su}__label`,i.append(a,p),e.appendChild(i);let m=()=>{let e=Cu(100,100,72,-120),t=Cu(100,100,72,120);return`M ${e.x} ${e.y} A 72 72 0 1 1 ${t.x} ${t.y}`},h=()=>{let e=n.value??0,t=n.max??100,r=-120+(0,c.clamp)(t>0?e/t:0,0,1)*240;i.style.setProperty(`--gauge-color`,n.color??`#f97316`),p.textContent=n.label??`SPEED`,o.setAttribute(`d`,m());let a=Cu(100,100,72,-120),u=Cu(100,100,72,r),f=+(r- -120>180);s.setAttribute(`d`,`M ${a.x} ${a.y} A 72 72 0 ${f} 1 ${u.x} ${u.y}`);let h=Cu(100,100,58,r);l.setAttribute(`x1`,`100`),l.setAttribute(`y1`,`100`),l.setAttribute(`x2`,String(h.x)),l.setAttribute(`y2`,String(h.y)),d.textContent=String(Math.round(e))};return h(),{update(e){n={...n,...e},h()},destroy(){r||(r=!0,i.remove())}}}var Tu=`cos-shiny-text`;function Eu(e,t={}){let n={text:`SHINY TEXT`,speed:2,color:`#94a3b8`,shineColor:`#ffffff`,fontSize:64,disabled:!1,...t},r=document.createElement(`div`);r.className=Tu;let i=document.createElement(`span`);i.className=`${Tu}__text`,r.appendChild(i),e.appendChild(r);let a=()=>{i.textContent=n.text??`SHINY TEXT`,i.style.fontSize=`${n.fontSize??64}px`,i.style.setProperty(`--shiny-color`,n.color??`#94a3b8`),i.style.setProperty(`--shiny-shine`,n.shineColor??`#ffffff`),i.style.setProperty(`--shiny-duration`,`${Math.max(n.speed??2,.4)}s`),i.classList.toggle(`${Tu}__paused`,n.disabled??!1)};return a(),{update(e){n={...n,...e},a()},destroy(){r.remove()}}}var Du=`cos-timeline-pulse`;function Ou(e,t={}){let n={steps:[`Start`,`Process`,`Review`,`Done`],current:0,color:`#22d3ee`,...t},r=document.createElement(`div`);r.className=Du;let i=document.createElement(`div`);i.className=`${Du}__axis`;let a=document.createElement(`div`);a.className=`${Du}__track`;let o=document.createElement(`div`);o.className=`${Du}__progress`;let s=document.createElement(`ul`);s.className=`${Du}__steps`,i.append(a,o,s),r.appendChild(i),e.appendChild(r);let l=()=>{let e=n.steps??[`Start`,`Process`,`Review`,`Done`],t=(0,c.clamp)(n.current??0,0,Math.max(0,e.length-1)),i=e.length>1?t/(e.length-1):0;r.style.setProperty(`--pulse-color`,n.color??`#22d3ee`),r.style.setProperty(`--step-count`,String(e.length)),r.style.setProperty(`--progress-ratio`,String(i)),s.replaceChildren(),e.forEach((e,n)=>{let r=document.createElement(`li`);r.className=`${Du}__step`,r.dataset.state=n<t?`done`:n===t?`current`:`pending`;let i=document.createElement(`span`);i.className=`${Du}__dot`;let a=document.createElement(`span`);a.className=`${Du}__name`,a.textContent=e,r.append(i,a),s.appendChild(r)})};return l(),{update(e){n={...n,...e},l()},destroy(){r.remove()}}}var ku=`cos-ripple-water`,Au=800,ju=500,Mu=192,Nu=`
|
|
172
|
+
attribute vec2 a_pos;
|
|
173
|
+
varying vec2 v_uv;
|
|
174
|
+
void main() {
|
|
175
|
+
v_uv = a_pos * 0.5 + 0.5;
|
|
176
|
+
gl_Position = vec4(a_pos, 0.0, 1.0);
|
|
177
|
+
}
|
|
178
|
+
`,Pu=`
|
|
179
|
+
precision highp float;
|
|
180
|
+
uniform float u_time;
|
|
181
|
+
uniform vec2 u_res;
|
|
182
|
+
uniform vec3 u_tint;
|
|
183
|
+
uniform vec3 u_from;
|
|
184
|
+
uniform vec3 u_to;
|
|
185
|
+
uniform sampler2D u_height;
|
|
186
|
+
uniform vec2 u_sim;
|
|
187
|
+
uniform float u_waveAmp;
|
|
188
|
+
uniform float u_waveSpeed;
|
|
189
|
+
uniform float u_shimmer;
|
|
190
|
+
uniform float u_reflection;
|
|
191
|
+
varying vec2 v_uv;
|
|
192
|
+
float hash(vec2 p) {
|
|
193
|
+
return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
|
|
194
|
+
}
|
|
195
|
+
float ambientH(vec2 p, float t) {
|
|
196
|
+
float h = 0.0;
|
|
197
|
+
h += sin(p.x * 3.2 + t * 1.3) * cos(p.y * 2.4 - t * 0.9) * 0.45;
|
|
198
|
+
h += sin(p.x * 6.8 - t * 1.7 + p.y * 1.1) * 0.22;
|
|
199
|
+
h += sin(p.x * 12.0 + p.y * 9.0 + t * 2.4) * 0.08;
|
|
200
|
+
h += sin(p.x * 1.4 + p.y * 1.8 + t * 0.55) * 0.35;
|
|
201
|
+
return h;
|
|
202
|
+
}
|
|
203
|
+
float sampleHeight(vec2 uv) {
|
|
204
|
+
float rip = texture2D(u_height, uv).r * 2.0 - 1.0;
|
|
205
|
+
vec2 p = uv * vec2(u_res.x / u_res.y, 1.0) * 2.8;
|
|
206
|
+
float amb = ambientH(p, u_time * u_waveSpeed) * 0.035 * u_waveAmp;
|
|
207
|
+
return rip * 0.55 + amb;
|
|
208
|
+
}
|
|
209
|
+
vec3 calcNormal(vec2 uv) {
|
|
210
|
+
vec2 e = vec2(1.5 / u_sim.x, 1.5 / u_sim.y);
|
|
211
|
+
float hL = sampleHeight(uv - vec2(e.x, 0.0));
|
|
212
|
+
float hR = sampleHeight(uv + vec2(e.x, 0.0));
|
|
213
|
+
float hD = sampleHeight(uv - vec2(0.0, e.y));
|
|
214
|
+
float hU = sampleHeight(uv + vec2(0.0, e.y));
|
|
215
|
+
return normalize(vec3((hL - hR) * 14.0, (hD - hU) * 14.0, 1.0));
|
|
216
|
+
}
|
|
217
|
+
void main() {
|
|
218
|
+
vec2 uv = v_uv;
|
|
219
|
+
vec3 n = calcNormal(uv);
|
|
220
|
+
float h = sampleHeight(uv);
|
|
221
|
+
vec3 V = normalize(vec3(0.0, 0.25, 1.0));
|
|
222
|
+
vec3 L = normalize(vec3(0.45, 0.75, 0.55));
|
|
223
|
+
float ndotl = max(dot(n, L), 0.0);
|
|
224
|
+
float fresnel = pow(1.0 - max(dot(n, V), 0.0), 3.2);
|
|
225
|
+
float g = clamp((uv.x + (1.0 - uv.y)) * 0.5, 0.0, 1.0);
|
|
226
|
+
vec3 water = mix(u_from, u_to, g);
|
|
227
|
+
water = mix(water, u_from, clamp(h * 1.8 + ndotl * 0.12, 0.0, 0.28));
|
|
228
|
+
water *= 0.92 + n.y * 0.1;
|
|
229
|
+
vec3 sky = mix(u_from * 1.15, vec3(0.85, 0.92, 1.0), 0.45);
|
|
230
|
+
vec3 reflectCol = mix(sky, vec3(0.9, 0.95, 1.0), pow(max(n.y, 0.0), 2.0));
|
|
231
|
+
water = mix(water, reflectCol, fresnel * u_reflection);
|
|
232
|
+
vec3 H = normalize(L + V);
|
|
233
|
+
float spec = pow(max(dot(n, H), 0.0), 180.0);
|
|
234
|
+
float glitter = pow(max(dot(n, H), 0.0), 48.0);
|
|
235
|
+
float sparkThresh = step(0.992, glitter) * glitter;
|
|
236
|
+
vec3 sparkle = u_tint * (spec * 1.8 + sparkThresh * 2.5) * u_shimmer + vec3(1.0) * sparkThresh * 0.8 * u_shimmer;
|
|
237
|
+
float softSpec = pow(max(dot(n, H), 0.0), 16.0) * 0.22 * u_shimmer;
|
|
238
|
+
water += u_tint * softSpec + sparkle;
|
|
239
|
+
float crest = smoothstep(0.02, 0.12, abs(h)) * fresnel;
|
|
240
|
+
water += mix(u_tint, vec3(1.0), 0.4) * crest * 0.35;
|
|
241
|
+
float vig = smoothstep(1.15, 0.35, length((uv - 0.5) * vec2(1.1, 1.0)));
|
|
242
|
+
water *= 0.88 + 0.12 * vig;
|
|
243
|
+
water += (hash(uv * u_res + u_time) - 0.5) * 0.015;
|
|
244
|
+
gl_FragColor = vec4(water, 1.0);
|
|
245
|
+
}
|
|
246
|
+
`,Fu=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]},Iu=(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},Lu=(e,t,n)=>{let r=Iu(e,e.VERTEX_SHADER,t),i=Iu(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};function Ru(e,t={}){let n={fill:!1,fromColor:`#52ade3`,toColor:`#013565`,color:`#a8d8f5`,waveAmplitude:1,waveSpeed:1,shimmer:1,reflection:.38,rippleStrength:1,rippleRadius:6,damping:.985,spread:.5,interactive:!0,showHint:!0,hint:`点击水面产生涟漪`,...t},r=!1,i=n.width??Au,a=n.height??ju,o=typeof document<`u`?document.hidden:!1,s=(0,c.prefersReducedMotion)(),l=null,u=null,d=null,f=null,p=null,m=document.createElement(`div`);m.className=ku;let h=document.createElement(`canvas`);h.className=`${ku}__canvas`,h.setAttribute(`role`,`img`);let g=document.createElement(`span`);g.className=`${ku}__hint`,g.setAttribute(`aria-hidden`,`true`),m.append(h,g),e.appendChild(m);let _=()=>{let e=n.showHint??!0,t=n.hint??`点击水面产生涟漪`;g.textContent=t,g.hidden=!e,h.style.cursor=n.interactive??!0?`pointer`:`default`,h.setAttribute(`aria-label`,t||`涟漪水面`)},v=()=>{(0,c.applyCanvasHostBox)(e,m,{fill:!!n.fill,width:i,height:a}),h.style.width=`${i}px`,h.style.height=`${a}px`,_()},y=e=>{if(!(n.interactive??!0)||e.pointerType===`mouse`&&e.button!==0)return;let t=h.getBoundingClientRect();p={x:(e.clientX-t.left)/t.width,y:1-(e.clientY-t.top)/t.height,strength:n.rippleStrength??1}},b={w:0,h:0},x=()=>{if(b.w===i&&b.h===a&&f)return;b={w:i,h:a},f?.(),f=null;let e=Math.min(window.devicePixelRatio||1,2);h.width=Math.floor(i*e),h.height=Math.floor(a*e);let t=h.getContext(`webgl`,{alpha:!1,antialias:!1,depth:!1,stencil:!1,premultipliedAlpha:!1});if(!t)return;let l=Lu(t,Nu,Pu);if(!l)return;let u=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),t.STATIC_DRAW);let d=t.getAttribLocation(l,`a_pos`),m=t.getUniformLocation(l,`u_time`),g=t.getUniformLocation(l,`u_res`),_=t.getUniformLocation(l,`u_tint`),v=t.getUniformLocation(l,`u_from`),y=t.getUniformLocation(l,`u_to`),x=t.getUniformLocation(l,`u_height`),S=t.getUniformLocation(l,`u_sim`),C=t.getUniformLocation(l,`u_waveAmp`),w=t.getUniformLocation(l,`u_waveSpeed`),T=t.getUniformLocation(l,`u_shimmer`),E=t.getUniformLocation(l,`u_reflection`),D=Mu*Mu,O=new Float32Array(D),k=new Float32Array(D),A=new Float32Array(D),j=t.createTexture();t.bindTexture(t.TEXTURE_2D,j),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE);let M=new Uint8Array(D*4),N=()=>{for(let e=0;e<D;e++){let t=Math.max(0,Math.min(255,Math.floor((k[e]*.5+.5)*255))),n=e*4;M[n]=t,M[n+1]=t,M[n+2]=t,M[n+3]=255}t.bindTexture(t.TEXTURE_2D,j),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,Mu,Mu,0,t.RGBA,t.UNSIGNED_BYTE,M)},P=(e,t,n,r)=>{let i=e*(Mu-1),a=t*(Mu-1),o=(0,c.clamp)(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>=Mu-1||s<=0||s>=Mu-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);k[s*Mu+r]+=n*(l+u*1.1)}},F=(e,t)=>{let n=(0,c.clamp)(e,.9,.999),r=(0,c.clamp)(t,.3,.7);for(let e=0;e<2;e++){for(let e=1;e<Mu-1;e++){let t=e*Mu;for(let e=1;e<Mu-1;e++){let i=t+e,a=k[i-1]+k[i+1]+k[i-Mu]+k[i+Mu];A[i]=(a*r-O[i])*n,A[i]>1.5?A[i]=1.5:A[i]<-1.5&&(A[i]=-1.5)}}let e=O;O=k,k=A,A=e,A.fill(0)}},I=e=>{let r=Fu(n.fromColor??`#52ade3`),i=Fu(n.toColor??`#013565`),a=Fu(n.color??`#a8d8f5`);t.viewport(0,0,h.width,h.height),t.useProgram(l),t.bindBuffer(t.ARRAY_BUFFER,u),t.enableVertexAttribArray(d),t.vertexAttribPointer(d,2,t.FLOAT,!1,0,0),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,j),t.uniform1i(x,0),t.uniform1f(m,e),t.uniform2f(g,h.width,h.height),t.uniform3f(_,a[0],a[1],a[2]),t.uniform3f(v,r[0],r[1],r[2]),t.uniform3f(y,i[0],i[1],i[2]),t.uniform2f(S,Mu,Mu),t.uniform1f(C,(0,c.clamp)(n.waveAmplitude??1,0,2)),t.uniform1f(w,(0,c.clamp)(n.waveSpeed??1,0,3)),t.uniform1f(T,(0,c.clamp)(n.shimmer??1,0,2)),t.uniform1f(E,(0,c.clamp)(n.reflection??.38,0,1)),t.drawArrays(t.TRIANGLE_STRIP,0,4)};if(N(),s){I(0),f=()=>{t.deleteTexture(j),t.deleteBuffer(u),t.deleteProgram(l)};return}let L=performance.now(),R=0,z=e=>{if(!r&&(R=requestAnimationFrame(z),!(o||s))){if(p){let e=p,t=(0,c.clamp)(e.strength,0,3),r=n.rippleRadius??6;P(e.x,e.y,t,r),P(e.x+.004,e.y-.003,t*.35,r),p=null}F(n.damping??.985,n.spread??.5),N(),I((e-L)/1e3)}};R=requestAnimationFrame(z),f=()=>{cancelAnimationFrame(R),t.deleteTexture(j),t.deleteBuffer(u),t.deleteProgram(l)}},S=()=>{if(l?.(),l=null,!(n.fill??!1)){i=n.width??Au,a=n.height??ju,v(),x();return}l=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:Au,defaultHeight:ju,measured:e});i=t.width,a=t.height,v(),x()})};return h.addEventListener(`pointerdown`,y),u=(0,c.bindVisibilityPause)(e=>{o=e}),d=(0,c.bindPrefersReducedMotion)(e=>{s=e}),S(),{update(e){let t=n.fill,r=n.width,i=n.height;n={...n,...e},_(),(n.fill!==t||n.width!==r||n.height!==i)&&S()},destroy(){r||(r=!0,f?.(),u?.(),d?.(),l?.(),h.removeEventListener(`pointerdown`,y),m.remove())}}}var zu=`cos-scramble-text`,Bu=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*`;function Vu(e,t={}){let n={text:`DECRYPTED`,duration:2e3,charset:Bu,...t},r=0,i=0,a=!1,o=document.createElement(`div`);o.className=zu;let s=document.createElement(`p`);s.className=`${zu}__text`;let c=document.createElement(`span`);c.className=`${zu}__cursor`,s.appendChild(c),o.appendChild(s),e.appendChild(o);let l=()=>{a=!1,r&&cancelAnimationFrame(r),i=performance.now();let e=(n.charset?.length??0)>0?n.charset:Bu,t=n.text??`DECRYPTED`,o=l=>{if(a)return;let u=l-i,d=Math.min(u/(n.duration??2e3),1),f=Math.floor(d*t.length),p=t.split(``).map((t,n)=>t===` `?` `:n<f?t:e[Math.floor(Math.random()*e.length)]).join(``);s.firstChild?.nodeType===Node.TEXT_NODE?s.firstChild.data=p:s.insertBefore(document.createTextNode(p),c),s.childNodes.length>2&&s.childNodes[0]?.remove(),d<1?r=requestAnimationFrame(o):s.replaceChildren(document.createTextNode(t),c)};r=requestAnimationFrame(o)};return l(),{update(e){n={...n,...e},l()},destroy(){a=!0,cancelAnimationFrame(r),o.remove()}}}var Hu=`cos-scratch-card`;function Uu(e,t={}){let n={coverColor:`#94a3b8`,prize:`🎉 恭喜中奖!`,coverText:`刮开涂层`,revealThreshold:.45,width:300,height:180,...t},r=!1,i=!1,a=!1,o=document.createElement(`div`),s=document.createElement(`div`);s.className=`${Hu}__prize`;let l=document.createElement(`canvas`);l.dataset.testid=`scratch-card-canvas`,o.append(s,l),e.appendChild(o);let u=()=>n.width??300,d=()=>n.height??180,f=e=>{let t=u(),r=d();e.globalCompositeOperation=`source-over`,e.fillStyle=n.coverColor??`#94a3b8`,e.fillRect(0,0,t,r),e.fillStyle=`rgb(255 255 255 / 30%)`,e.font=`bold 16px system-ui, sans-serif`,e.textAlign=`center`,e.fillText(n.coverText??`刮开涂层`,t/2,r/2)},p=()=>{let e=u(),t=d(),n=window.devicePixelRatio||1;l.width=e*n,l.height=t*n,l.style.width=`${e}px`,l.style.height=`${t}px`;let r=l.getContext(`2d`);r&&(r.setTransform(n,0,0,n,0,0),f(r))},m=()=>{(0,c.applyBlockHostBox)(e,o,{width:u(),height:d()}),o.className=Hu,s.textContent=n.prize??`🎉 恭喜中奖!`,l.className=`${Hu}__canvas${a?` ${Hu}__hidden`:``}`,l.setAttribute(`aria-label`,n.coverText??`刮开涂层`)},h=()=>{a||r||(a=!0,m(),n.onReveal?.())},g=()=>{if(a)return;let e=l.getContext(`2d`);if(!e)return;let t=e.getImageData(0,0,l.width,l.height),r=0;for(let e=3;e<t.data.length;e+=4)t.data[e]<128&&r++;r/(l.width*l.height)>(n.revealThreshold??.45)&&h()},_=(e,t)=>{if(a)return;let n=l.getContext(`2d`);n&&(n.globalCompositeOperation=`destination-out`,n.beginPath(),n.arc(e,t,20,0,Math.PI*2),n.fill(),g())},v=e=>{`touches`in e&&e.preventDefault(),i=!0;let t=(0,c.getRelativePointerPosition)(l,e);t&&_(t.x,t.y)},y=e=>{if(!i)return;`touches`in e&&e.preventDefault();let t=(0,c.getRelativePointerPosition)(l,e);t&&_(t.x,t.y)},b=()=>{i=!1};return l.addEventListener(`mousedown`,v),l.addEventListener(`mousemove`,y),l.addEventListener(`mouseup`,b),l.addEventListener(`mouseleave`,b),l.addEventListener(`touchstart`,v,{passive:!1}),l.addEventListener(`touchmove`,y,{passive:!1}),l.addEventListener(`touchend`,b),p(),m(),{update(e){let t=u(),r=d(),i=n.coverColor,o=n.coverText;n={...n,...e},(u()!==t||d()!==r||n.coverColor!==i||n.coverText!==o)&&(a=!1,p()),m()},reset:()=>{a=!1,p(),m()},reveal:h,destroy(){r||(r=!0,l.removeEventListener(`mousedown`,v),l.removeEventListener(`mousemove`,y),l.removeEventListener(`mouseup`,b),l.removeEventListener(`mouseleave`,b),l.removeEventListener(`touchstart`,v),l.removeEventListener(`touchmove`,y),l.removeEventListener(`touchend`,b),o.remove())}}}var Wu=`cos-slot-machine`,Gu=[`🍒`,`🍋`,`🍊`,`🍇`,`⭐`,`7️⃣`],Ku=30,qu=8,Ju=[0,350,700],Yu=80,Xu=3,Zu=e=>1-(1-e)**3,Qu=(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)};function $u(e,t={}){let n={symbols:Gu,spinDuration:3e3,spinningText:`旋转中...`,jackpotText:`🎰 大奖!`,resultPrefix:`结果:`,...t},r=!1,i=!1,a=[0,0,0],o=[],s=0,l=null,u=document.createElement(`div`),d=document.createElement(`div`);d.className=`${Wu}__machine`;let f=[],p=[];for(let e=0;e<3;e++){let e=document.createElement(`div`);e.className=`${Wu}__reel`;let t=document.createElement(`div`);t.className=`${Wu}__strip`;let n=document.createElement(`div`);n.className=`${Wu}__mask`,e.append(t,n),d.appendChild(e),f.push(e),p.push(t)}let m=document.createElement(`button`);m.type=`button`,m.className=`${Wu}__spin-btn`,m.dataset.testid=`slot-machine-spin`;let h=document.createElement(`p`);h.className=`${Wu}__result`,h.hidden=!0,u.append(d,m,h),e.appendChild(u);let g=()=>n.symbols?.length?n.symbols:Gu,_=()=>g().length*Yu,v=()=>Math.floor(Ku/2)*_(),y=(e,t)=>-(e-1+t*g().length)*Yu,b=()=>n.buttonText??n.startText??`开始`,x=()=>{let e=g(),t=[];for(let n=0;n<Ku;n++)t.push(...e);for(let e of p){e.replaceChildren();for(let n of t){let t=document.createElement(`div`);t.className=`${Wu}__item`,t.style.height=`${Yu}px`,t.textContent=n,e.appendChild(t)}}let n=Yu*Xu;for(let e of f)e.style.height=`${n}px`},S=()=>{p.forEach((e,t)=>{e.style.transform=`translateY(${a[t]}px)`})},C=()=>{u.className=Wu,m.disabled=i,m.setAttribute(`aria-busy`,String(i)),m.textContent=i?n.spinningText??`旋转中...`:b(),o.length>0&&!i?(h.hidden=!1,h.textContent=o[0]===o[1]&&o[1]===o[2]?n.jackpotText??`🎰 大奖!`:`${n.resultPrefix??`结果:`} ${o.join(` `)}`):(h.hidden=!0,h.textContent=``)},w=e=>{let t=g();if(i||t.length===0||r)return;i=!0,o=[],C();let u=e??n.targetResults,d=[0,1,2].map(e=>Qu(t,u?.[e])),f=[...a],p=t.length*Yu,m=d.map((e,t)=>{let n=f[t],r=qu*p,i=Math.ceil((-n+r)/p)+1,a=y(e,i);for(;n-a<r;)i+=1,a=y(e,i);return a}),h=Math.max(n.spinDuration??3e3,16),_=performance.now(),b={cancelled:!1};l=b;let x=()=>{if(b.cancelled||r)return;let e=d.map(e=>t[e]);a=d.map(e=>y(e,Math.round(v()/p))),o=e,i=!1,S(),C(),n.onSpinEnd?.(e)};if((0,c.prefersReducedMotion)()){x();return}let w=e=>{b.cancelled||r||(a=f.map((t,n)=>{let r=e-_-Ju[n];if(r<0)return t;let i=Math.min(r/h,1);return t+(m[n]-t)*Zu(i)}),S(),Ju.every(t=>e-_-t>=h)?x():s=requestAnimationFrame(w))};s=requestAnimationFrame(w)};return m.addEventListener(`click`,()=>w()),x(),S(),C(),{update(e){let t=g().join(`\0`);n={...n,...e},g().join(`\0`)!==t&&x(),C()},spin:w,reset:()=>{i||(o=[],C())},destroy(){r||(r=!0,l&&(l.cancelled=!0),cancelAnimationFrame(s),u.remove())}}}var ed=`cos-sand-fall`,td=[`#fbbf24`,`#f59e0b`,`#d97706`,`#b45309`,`#92400e`],nd=480,rd=400,id=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]};function ad(e,t={}){let n={cellSize:4,colors:td,spawnRate:3,hint:`按住鼠标绘制沙粒`,clearText:`Clear`,...t},r=!1,i=n.width??nd,a=n.height??rd,o=0,s=typeof document<`u`?document.hidden:!1,l=null,u=0,d=0,f=[],p=[],m={x:-1,y:-1,down:!1},h=document.createElement(`div`);h.className=ed;let g=document.createElement(`canvas`);g.className=`${ed}__canvas`;let _=document.createElement(`div`);_.className=`${ed}__toolbar`;let v=document.createElement(`span`);v.className=`${ed}__hint`;let y=document.createElement(`button`);y.type=`button`,y.className=`${ed}__button`,_.append(v,y),h.append(g,_),e.appendChild(h);let b=(e,t)=>t*u+e,x=()=>{let e=n.cellSize??4;u=Math.max(1,Math.floor(i/e)),d=Math.max(1,Math.floor(a/e)),f=Array(u*d).fill(null),p=(n.colors?.length?n.colors:td).map(id),v.textContent=n.hint??`按住鼠标绘制沙粒`,y.textContent=n.clearText??`Clear`},S=()=>{i=n.width??nd,a=n.height??rd,h.style.width=`${i}px`,g.style.width=`${i}px`,g.style.height=`${a}px`},C=()=>{let e=window.devicePixelRatio||1;g.width=i*e,g.height=a*e;let t=g.getContext(`2d`);return t&&t.setTransform(e,0,0,e,0,0),t},w=()=>{for(let e=d-2;e>=0;e--)for(let t=0;t<u;t++){let n=b(t,e);if(f[n]===null)continue;let r=b(t,e+1);if(f[r]===null){f[r]=f[n],f[n]=null;continue}let i=Math.random()<.5?-1:1,a=t+i,o=t-i;a>=0&&a<u&&f[b(a,e+1)]===null?(f[b(a,e+1)]=f[n],f[n]=null):o>=0&&o<u&&f[b(o,e+1)]===null&&(f[b(o,e+1)]=f[n],f[n]=null)}},T=()=>{if(!m.down||m.x<0||m.y<0)return;let e=n.cellSize??4,t=Math.floor(m.x/e),r=Math.floor(m.y/e),i=n.spawnRate??3;for(let e=0;e<i;e++){let e=t+Math.floor((Math.random()-.5)*6),n=r+Math.floor((Math.random()-.5)*3);if(e<0||e>=u||n<0||n>=d)continue;let i=b(e,n);f[i]===null&&(f[i]=Math.floor(Math.random()*p.length))}},E=()=>{let e=g.getContext(`2d`);if(!e)return;let t=n.cellSize??4;e.fillStyle=`#0f172a`,e.fillRect(0,0,i,a);for(let n=0;n<d;n++)for(let r=0;r<u;r++){let i=f[b(r,n)];if(i===null)continue;let[a,o,s]=p[i];e.fillStyle=`rgb(${a} ${o} ${s})`,e.fillRect(r*t,n*t,t,t)}},D=(e,t,n)=>{let r=g.getBoundingClientRect();m.x=e-r.left,m.y=t-r.top,m.down=n},O=e=>D(e.clientX,e.clientY,!0),k=e=>{m.down&&D(e.clientX,e.clientY,!0)},A=()=>{m.down=!1},j=e=>{let t=e.touches[0];t&&D(t.clientX,t.clientY,!0)},M=e=>{let t=e.touches[0];t&&D(t.clientX,t.clientY,!0)};g.addEventListener(`mousedown`,O),g.addEventListener(`mousemove`,k),g.addEventListener(`mouseup`,A),g.addEventListener(`mouseleave`,A),g.addEventListener(`touchstart`,j),g.addEventListener(`touchmove`,M),g.addEventListener(`touchend`,A),y.addEventListener(`click`,()=>{f=Array(u*d).fill(null)});let N=()=>{r||(o=requestAnimationFrame(N),!s&&(T(),w(),E()))};return S(),C(),x(),l=(0,c.bindVisibilityPause)(e=>{s=e}),N(),{update(e){n={...n,...e},S(),C(),x()},destroy(){r||(r=!0,cancelAnimationFrame(o),l?.(),g.removeEventListener(`mousedown`,O),g.removeEventListener(`mousemove`,k),g.removeEventListener(`mouseup`,A),g.removeEventListener(`mouseleave`,A),g.removeEventListener(`touchstart`,j),g.removeEventListener(`touchmove`,M),g.removeEventListener(`touchend`,A),h.remove())}}}var od=`cos-split-reveal`,sd=[`fromTop`,`fromBottom`,`fromLeft`,`fromRight`],cd=e=>`${od}__${e.replace(/([A-Z])/g,`-$1`).toLowerCase()}`;function ld(e,t={}){let n={text:`REVEAL`,delay:80,color:`#f8fafc`,...t},r=document.createElement(`div`);r.className=od;let i=document.createElement(`h1`);i.className=`${od}__text`,r.appendChild(i),e.appendChild(r);let a=()=>{i.style.setProperty(`--reveal-color`,n.color??`#f8fafc`),i.replaceChildren(),(n.text??`REVEAL`).split(``).forEach((e,t)=>{let r=document.createElement(`span`),a=sd[t%sd.length];r.className=`${od}__char ${cd(a)}`,r.style.animationDelay=`${t*(n.delay??80)}ms`,r.textContent=e===` `?`\xA0`:e,i.appendChild(r)})};return a(),{update(e){n={...n,...e},a()},destroy(){r.remove()}}}var ud=`cos-split-text`;function dd(e,t={}){let n={text:`SPLIT TEXT`,animation:`fadeUp`,stagger:50,duration:500,loop:!0,loopPause:2400,fontSize:56,color:`#f8fafc`,...t},r=!0,i=0,a=0,o=!1,s=document.createElement(`div`);s.className=ud;let c=document.createElement(`div`);c.className=`${ud}__text`,s.appendChild(c),e.appendChild(s);let l=()=>(n.text??``).split(``),u=()=>l().length*(n.stagger??50)+(n.duration??500),d=()=>{c.style.fontSize=`${n.fontSize??56}px`,c.style.setProperty(`--split-color`,n.color??`#f8fafc`),c.style.setProperty(`--split-duration`,`${n.duration??500}ms`),c.replaceChildren();let e=`${ud}__${(n.animation??`fadeUp`).replace(/([A-Z])/g,`-$1`).toLowerCase()}`;l().forEach((t,i)=>{let a=document.createElement(`span`);a.className=`${ud}__char ${e} ${r?`${ud}__enter`:`${ud}__exit`}`,a.style.animationDelay=`${i*(n.stagger??50)}ms`,a.textContent=t===` `?`\xA0`:t,c.appendChild(a)})},f=()=>{i&&window.clearTimeout(i),a&&window.clearTimeout(a),i=a=0},p=()=>{if(f(),o=!1,!(n.loop??!0))return;let e=()=>{o||(r=!0,d(),i=window.setTimeout(()=>{o||(r=!1,d(),a=window.setTimeout(e,Math.max(n.duration??500,600)))},u()+(n.loopPause??2400)))};e()};return d(),p(),{update(e){n={...n,...e},d(),p()},destroy(){o=!0,f(),s.remove()}}}var fd=`cos-spring-mass`,pd=(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}};function md(e,t={}){let n={width:560,height:400,cols:6,rows:5,stiffness:.22,damping:.9,color:`#a78bfa`,hint:`拖拽网格质点,观察弹簧回弹`,...t},r=!1,i=0,a=null,o=pd(n.width??560,n.height??400,n.cols??6,n.rows??5),s=null,l={x:0,y:0},u=document.createElement(`div`),d=document.createElement(`canvas`);d.className=`${fd}__canvas`;let f=document.createElement(`div`);f.className=`${fd}__hint`,u.append(d,f),e.appendChild(u);let p=()=>{o=pd(n.width??560,n.height??400,n.cols??6,n.rows??5),s=null},m=(e,t)=>{let n=-1,r=20;return o.nodes.forEach((i,a)=>{if(i.pinned)return;let o=Math.hypot(i.x-e,i.y-t);o<r&&(r=o,n=a)}),n},h=(e,t)=>{let n=d.getBoundingClientRect(),r=e-n.left,i=t-n.top;l.x=r,l.y=i;let a=m(r,i);if(a<0)return;let c=o.nodes[a];s={index:a,ox:c.x-r,oy:c.y-i}},g=(e,t)=>{let n=d.getBoundingClientRect();l.x=e-n.left,l.y=t-n.top},_=()=>{s=null},v=e=>h(e.clientX,e.clientY),y=e=>g(e.clientX,e.clientY),b=e=>{let t=e.touches[0];t&&h(t.clientX,t.clientY)},x=e=>{let t=e.touches[0];t&&g(t.clientX,t.clientY)};d.addEventListener(`mousedown`,v),d.addEventListener(`mousemove`,y),d.addEventListener(`mouseup`,_),d.addEventListener(`mouseleave`,_),d.addEventListener(`touchstart`,b,{passive:!0}),d.addEventListener(`touchmove`,x,{passive:!0}),d.addEventListener(`touchend`,_);let S=()=>{i&&cancelAnimationFrame(i),i=0,a?.(),a=null},C=()=>{if(S(),r)return;let e=n.width??560,t=n.height??400,p=n.color??`#a78bfa`,m=n.damping??.9,h=Math.max(.04,Math.min(n.stiffness??.22,.8));u.className=fd,u.style.width=`${e}px`,u.style.height=`${t}px`,d.style.width=`${e}px`,d.style.height=`${t}px`,f.textContent=n.hint??`拖拽网格质点,观察弹簧回弹`;let g=window.devicePixelRatio||1;d.width=e*g,d.height=t*g;let _=d.getContext(`2d`);if(!_)return;_.setTransform(g,0,0,g,0,0);let v=typeof document<`u`?document.hidden:!1;a=(0,c.bindVisibilityPause)(e=>{v=e});let y=()=>{let{nodes:n,springs:r}=o;if(s){let e=n[s.index];e.x=l.x+s.ox,e.y=l.y+s.oy,e.vx=0,e.vy=0}for(let e of r){let t=n[e.a],r=n[e.b],i=r.x-t.x,a=r.y-t.y,o=Math.hypot(i,a)||.001,c=(o-e.rest)*h,l=i/o*c,u=a/o*c,d=s?.index===e.a,f=s?.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 i=n[r];if(i.pinned||s?.index===r){i.vx=0,i.vy=0;continue}i.vx*=m,i.vy*=m,i.x+=i.vx,i.y+=i.vy,i.x<10?(i.x=10,i.vx*=-.4):i.x>e-10&&(i.x=e-10,i.vx*=-.4),i.y<10?(i.y=10,i.vy*=-.4):i.y>t-10&&(i.y=t-10,i.vy*=-.4)}},b=()=>{let{nodes:n,springs:r}=o;_.fillStyle=`#0f172a`,_.fillRect(0,0,e,t);for(let i of r){let r=n[i.a],a=n[i.b],o=Math.hypot(a.x-r.x,a.y-r.y)||1,s=Math.min(1,Math.abs(o-i.rest)/i.rest);_.beginPath(),_.moveTo(r.x,r.y),_.lineTo(a.x,a.y),_.strokeStyle=p,_.globalAlpha=.22+s*.55,_.lineWidth=i.rest>Math.max(e,t)*.2?1:1.6,_.stroke(),_.globalAlpha=1}n.forEach((e,t)=>{_.beginPath(),_.arc(e.x,e.y,e.pinned?6:8,0,Math.PI*2),_.fillStyle=e.pinned?`#64748b`:p,_.fill(),_.strokeStyle=`rgb(255 255 255 / 28%)`,_.lineWidth=1,_.stroke(),s?.index===t&&(_.beginPath(),_.arc(e.x,e.y,13,0,Math.PI*2),_.strokeStyle=p,_.globalAlpha=.45,_.lineWidth=2,_.stroke(),_.globalAlpha=1)})},x=()=>{i=requestAnimationFrame(x),!(v||r)&&(y(),b())};i=requestAnimationFrame(x)};return p(),C(),{update(e){let t=n.width,r=n.height,i=n.cols,a=n.rows;n={...n,...e},(n.width!==t||n.height!==r||n.cols!==i||n.rows!==a)&&p(),C()},destroy(){r||(r=!0,S(),d.removeEventListener(`mousedown`,v),d.removeEventListener(`mousemove`,y),d.removeEventListener(`mouseup`,_),d.removeEventListener(`mouseleave`,_),d.removeEventListener(`touchstart`,b),d.removeEventListener(`touchmove`,x),d.removeEventListener(`touchend`,_),u.remove())}}}var hd=`cos-spotlight`;function gd(e,t={}){let n={radius:120,dimColor:`rgba(0, 0, 0, 0.85)`,defaultContent:`隐藏内容`,...t},r=document.createElement(`div`);r.className=hd;let i=document.createElement(`div`);i.className=`${hd}__content`;let a=document.createElement(`div`);a.className=`${hd}__overlay`,r.append(i,a),e.appendChild(r);let o=e=>{let t=r.getBoundingClientRect();r.style.setProperty(`--spot-x`,`${e.clientX-t.left}px`),r.style.setProperty(`--spot-y`,`${e.clientY-t.top}px`)};r.addEventListener(`mousemove`,o);let s=()=>{if(n.slotElement){n.slotElement.parentElement!==i&&(i.replaceChildren(),i.appendChild(n.slotElement));return}if(i.childNodes.length>0||n.defaultContent==null)return;let e=document.createElement(`span`);e.className=`${r.className}__placeholder`,e.textContent=n.defaultContent,i.replaceChildren(e)},c=()=>{r.style.setProperty(`--spot-radius`,`${n.radius??120}px`),r.style.setProperty(`--dim-color`,n.dimColor??`rgba(0, 0, 0, 0.85)`),s()};return c(),{update(e){n={...n,...e},c()},getSlot:()=>i,destroy(){r.removeEventListener(`mousemove`,o),r.remove()}}}var _d=`cos-turntable`,vd=[`#FF6B6B`,`#4ECDC4`,`#FFE66D`,`#A78BFA`,`#60A5FA`,`#F472B6`,`#34D399`,`#FB923C`],yd=[{label:`一等奖`},{label:`二等奖`},{label:`三等奖`},{label:`谢谢参与`},{label:`优惠券`},{label:`再来一次`}],bd=e=>1-(1-e)**3,xd=(e,t)=>t.color??vd[e%vd.length];function Sd(e,t={}){let n={prizes:yd,size:360,spinDuration:4e3,spinRounds:5,buttonText:`开始抽奖`,spinningText:`抽奖中...`,resultPrefix:`恭喜获得:`,...t},r=!1,i=!1,a=0,o=0,s=null,l=null,u=document.createElement(`div`),d=document.createElement(`div`);d.className=`${_d}__wheel-wrap`;let f=document.createElement(`div`);f.className=`${_d}__pointer`;let p=document.createElement(`canvas`);p.className=`${_d}__canvas`;let m=document.createElement(`button`);m.type=`button`,m.className=`${_d}__spin-btn`,m.dataset.testid=`turntable-spin`;let h=document.createElement(`p`);h.className=`${_d}__result`,h.hidden=!0,d.append(f,p,m),u.append(d,h),e.appendChild(u);let g=()=>n.prizes?.length?n.prizes:yd,_=()=>n.size??360,v=()=>_()+48,y=e=>{let t=p.getContext(`2d`);if(!t)return;let n=g(),r=_(),i=v(),a=i/2,o=r/2,s=Math.PI*2/n.length;t.clearRect(0,0,i,i),t.save(),t.translate(a,a),t.rotate(e),n.forEach((e,n)=>{let i=n*s-Math.PI/2,a=i+s;t.beginPath(),t.moveTo(0,0),t.arc(0,0,o,i,a),t.closePath(),t.fillStyle=xd(n,e),t.fill(),t.strokeStyle=`rgb(255 255 255 / 35%)`,t.lineWidth=2,t.stroke(),t.save(),t.rotate(i+s/2),t.textAlign=`right`,t.fillStyle=`#fff`,t.font=`bold ${Math.max(12,Math.floor(r/22))}px system-ui, sans-serif`,t.shadowColor=`rgb(0 0 0 / 30%)`,t.shadowBlur=4,t.fillText(e.label,o-18,6),t.restore()}),t.beginPath(),t.arc(0,0,o,0,Math.PI*2),t.strokeStyle=`#fbbf24`,t.lineWidth=6,t.stroke(),t.beginPath(),t.arc(0,0,o-4,0,Math.PI*2),t.strokeStyle=`#f59e0b`,t.lineWidth=2,t.stroke(),t.restore(),t.save(),t.translate(a,a);for(let e=0;e<12;e++){let n=e/12*Math.PI*2;t.beginPath(),t.arc(Math.cos(n)*(o+14),Math.sin(n)*(o+14),3,0,Math.PI*2),t.fillStyle=e%2==0?`#fde68a`:`#f59e0b`,t.fill()}t.restore()},b=()=>{let e=v(),t=window.devicePixelRatio||1;p.width=e*t,p.height=e*t,p.style.width=`${e}px`,p.style.height=`${e}px`;let n=p.getContext(`2d`);n&&n.setTransform(t,0,0,t,0,0);let r=e;d.style.width=`${r}px`,d.style.height=`${r}px`,u.style.width=`${r}px`,u.style.height=`${r+80}px`,y(a)},x=()=>{if(u.className=_d,m.disabled=i,m.setAttribute(`aria-busy`,String(i)),m.textContent=i?n.spinningText??`抽奖中...`:n.buttonText??`开始抽奖`,l&&!i){h.hidden=!1,h.replaceChildren(document.createTextNode(n.resultPrefix??`恭喜获得:`));let e=document.createElement(`strong`);e.textContent=l.label,h.appendChild(e)}else h.hidden=!0,h.replaceChildren()},S=e=>{let t=g();if(i||t.length===0||r)return;i=!0,l=null,x();let u=Math.PI*2/t.length,d=e??n.targetIndex,f=d===void 0?Math.floor(Math.random()*t.length):(Math.floor(d)%t.length+t.length)%t.length,p=f*u+u/2,m=(n.spinRounds??5)*Math.PI*2,h=a+m+(Math.PI*2-p)-a%(Math.PI*2),_=a,v=performance.now(),b={cancelled:!1};s=b;let S=n.spinDuration??4e3,C=e=>{if(b.cancelled||r)return;let o=t[f];a=e,y(e),i=!1,l=o,x(),n.onSpinEnd?.(o,f)};if((0,c.prefersReducedMotion)()){C(h);return}let w=e=>{if(b.cancelled||r)return;let t=Math.min((e-v)/S,1),n=_+(h-_)*bd(t);a=n,y(n),t<1?o=requestAnimationFrame(w):C(n)};o=requestAnimationFrame(w)};return m.addEventListener(`click`,()=>S()),b(),x(),{update(e){n={...n,...e},b(),x()},spin:S,reset:()=>{i||(l=null,x())},destroy(){r||(r=!0,s&&(s.cancelled=!0),o&&cancelAnimationFrame(o),u.remove())}}}var Cd=`cos-text-morph`,wd=[`COS DESIGN`,`TEXT MORPH`,`SMOOTH TRANSITION`];function Td(e,t={}){let n={texts:wd,interval:2200,duration:680,fontSize:64,color:`#f8fafc`,...t},r=0,i=0,a=0,o=0,s=!1,l=document.createElement(`div`);l.className=Cd;let u=document.createElement(`div`);u.className=`${Cd}__stage`;let d=document.createElement(`span`);d.className=`${Cd}__layer ${Cd}__current`;let f=document.createElement(`span`);f.className=`${Cd}__layer ${Cd}__next`,u.append(d,f),l.appendChild(u),e.appendChild(l);let p=()=>Array.isArray(n.texts)&&n.texts.length>0?n.texts:wd,m=()=>{l.style.setProperty(`--morph-color`,n.color??`#f8fafc`),u.style.fontSize=`${n.fontSize??64}px`;let e=p(),t=e[r],a=e[(r+1)%e.length];d.textContent=t,f.textContent=a,d.style.opacity=String(1-i),f.style.opacity=String(i),d.style.filter=`blur(${i*14}px)`,f.style.filter=`blur(${(1-i)*14}px)`,d.style.transform=`scale(${1-i*.08}) translateY(${i*-8}px)`,f.style.transform=`scale(${.92+i*.08}) translateY(${(1-i)*8}px)`},h=()=>{s||(o=window.setTimeout(()=>{let e=performance.now(),t=o=>{s||(i=(0,c.clamp)((o-e)/Math.max(n.duration??680,16),0,1),m(),i<1?a=requestAnimationFrame(t):(r=(r+1)%p().length,i=0,m(),h()))};a=requestAnimationFrame(t)},n.interval??2200))};return m(),h(),{update(e){n={...n,...e},r=0,i=0,o&&clearTimeout(o),cancelAnimationFrame(a),m(),h()},destroy(){s=!0,clearTimeout(o),cancelAnimationFrame(a),l.remove()}}}var Ed=`cos-true-focus`;function Dd(e,t={}){let n={sentence:`True Focus`,separator:` `,manualMode:!1,blurAmount:5,borderColor:`#22c55e`,glowColor:`rgb(34 197 94 / 60%)`,animationDuration:.5,pauseBetweenAnimations:1,fontSize:48,color:`#f8fafc`,...t},r=0,i=0,a=0,o=document.createElement(`div`);o.className=Ed;let s=document.createElement(`div`);s.className=`${Ed}__stage`;let c=document.createElement(`div`);c.className=`${Ed}__focus-frame`;for(let e of[`tl`,`tr`,`bl`,`br`]){let t=document.createElement(`span`);t.className=`${Ed}__corner ${Ed}__${e}`,c.appendChild(t)}s.appendChild(c),o.appendChild(s),e.appendChild(o);let l=[],u=()=>{let e=l[r];if(!e)return;let t=s.getBoundingClientRect(),n=e.getBoundingClientRect();c.style.transform=`translate(${n.left-t.left}px, ${n.top-t.top}px)`,c.style.width=`${n.width}px`,c.style.height=`${n.height}px`,c.style.opacity=r>=0?`1`:`0`},d=()=>{s.style.fontSize=`${n.fontSize??48}px`,s.style.setProperty(`--focus-color`,n.color??`#f8fafc`),s.style.setProperty(`--border-color`,n.borderColor??`#22c55e`),s.style.setProperty(`--glow-color`,n.glowColor??`rgb(34 197 94 / 60%)`),s.style.setProperty(`--focus-duration`,`${n.animationDuration??.5}s`),l.length=0,s.querySelectorAll(`.${Ed}__word`).forEach(e=>e.remove()),(n.sentence??``).split(n.separator??` `).filter(Boolean).forEach((e,t)=>{let a=document.createElement(`span`);a.className=`${Ed}__word`,a.textContent=e;let o=t===r;a.style.filter=o?`blur(0px)`:`blur(${n.blurAmount??5}px)`,a.style.cursor=n.manualMode?`pointer`:`default`,a.addEventListener(`mouseenter`,()=>{n.manualMode&&(i=t,r=t,d())}),a.addEventListener(`mouseleave`,()=>{n.manualMode&&(r=i,d())}),s.insertBefore(a,c),l.push(a)}),u()},f=()=>{if(a&&clearInterval(a),n.manualMode)return;let e=(n.sentence??``).split(n.separator??` `).filter(Boolean);e.length&&(a=window.setInterval(()=>{r=(r+1)%e.length,d()},((n.animationDuration??.5)+(n.pauseBetweenAnimations??1))*1e3))};return d(),f(),{update(e){n={...n,...e},r=0,d(),f()},destroy(){a&&clearInterval(a),o.remove()}}}var Od=`cos-typewriter`,kd=[`Hello, cos-design!`,`欢迎来到组件库 ✨`,`Build something fun 🚀`];function Ad(e,t={}){let n={texts:kd,speed:100,deleteSpeed:50,pause:2e3,...t},r=``,i=0,a=!1,o=0,s=!1,c=document.createElement(`div`);c.className=Od;let l=document.createElement(`div`);l.className=`${Od}__terminal`;let u=document.createElement(`div`);u.className=`${Od}__dots`;for(let e=0;e<3;e++)u.appendChild(document.createElement(`span`));let d=document.createElement(`p`);d.className=`${Od}__text`;let f=document.createElement(`span`);f.className=`${Od}__prompt`,f.textContent=`>`;let p=document.createElement(`span`);p.className=`${Od}__cursor`,p.textContent=`|`;let m=document.createTextNode(``);d.append(f,m,p),l.append(u,d),c.appendChild(l),e.appendChild(c);let h=()=>Array.isArray(n.texts)&&n.texts.length>0?n.texts:kd,g=()=>{if(s)return;let e=h(),t=e[i%e.length];!a&&r===t?o=window.setTimeout(()=>{a=!0,g()},n.pause??2e3):a&&r===``?o=window.setTimeout(()=>{a=!1,i=(i+1)%e.length,g()},0):(r=a?t.slice(0,r.length-1):t.slice(0,r.length+1),m.data=r,o=window.setTimeout(g,a?n.deleteSpeed??50:n.speed??100))};return g(),{update(e){let t=n;n={...n,...e},(t.speed!==n.speed||t.deleteSpeed!==n.deleteSpeed||t.pause!==n.pause||JSON.stringify(t.texts)!==JSON.stringify(n.texts))&&(r=``,i=0,a=!1,o&&clearTimeout(o),m.data=``,g())},destroy(){s=!0,o&&clearTimeout(o),c.remove()}}}var jd=`cos-wave-button`;function Md(e,t={}){let n={text:`点我试试`,color:`#38bdf8`,...t},r=document.createElement(`div`);r.className=jd;let i=document.createElement(`button`);i.type=`button`,i.className=`${jd}__btn`;let a=document.createElement(`span`);a.className=`${jd}__label`,i.append(Object.assign(document.createElement(`span`),{className:`${jd}__wave`}),Object.assign(document.createElement(`span`),{className:`${jd}__wave`}),a),r.appendChild(i),e.appendChild(r);let o=()=>{let e=n.buttonProps??{};for(let[t,n]of Object.entries(e))if(!(t===`className`||t===`style`||t===`children`)){if(t.startsWith(`on`)&&typeof n==`function`){let e=t.slice(2).toLowerCase(),r=`cosWave${t}`,a=i[r];a&&i.removeEventListener(e,a),i.addEventListener(e,n),i[r]=n;continue}n==null||n===!1?i.removeAttribute(t===`disabled`?`disabled`:t):n===!0?i.setAttribute(t,``):i.setAttribute(t,String(n))}},s=()=>{a.textContent=n.text??`点我试试`,i.style.setProperty(`--wave-color`,n.color??`#38bdf8`),i.className=`${jd}__btn${n.className?` ${n.className}`:``}`.trim(),n.style&&Object.entries(n.style).forEach(([e,t])=>{t!=null&&i.style.setProperty(e.replace(/([A-Z])/g,`-$1`).toLowerCase(),String(t))}),o()};return s(),{update(e){n={...n,...e},s()},getButton:()=>i,destroy(){r.remove()}}}var Nd=e=>Math.min(1,Math.max(0,e)),Pd=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]},Fd=([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)}`},Id=(e,t,n)=>e+(t-e)*n,Ld=(e,t,n)=>[Id(e[0],t[0],n),Id(e[1],t[1],n),Id(e[2],t[2],n)],Rd=(e,t,n)=>Fd(Ld(Pd(e),Pd(t),Nd(n))),zd=e=>{let t=Nd(e);return t*t*(3-2*t)},Bd=(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()}},Vd=(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()},Hd=(e,t=new Date)=>Vd(e??`14:00`,t)??Vd(`14:00`,t),Ud=(e,t)=>{let{sunrise:n,sunset:r}=t;if(!(r>n)){let t=Bd(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}},Wd=(e,t,n)=>{let r=Nd(n),i=Math.sin(Math.PI*r);return{x:e*(.1+.8*r),y:t*(.58-.4*i)}},Gd=`#e8895c`,Kd=`#f3c98a`,qd=`#2a1f4a`,Jd=`#c4784a`,Yd=(e,t,n)=>{if(n.isDay){let t=zd(n.elevation),r=(1-t)*.72;return[Rd(Rd(e[0],Gd,r),`#1a2438`,(1-t)*.12),Rd(Rd(e[1],Kd,r*.85),`#3a4558`,(1-t)*.08)]}let r=n.twilight;return[Rd(t[0],Rd(qd,Gd,.35),r*.55),Rd(t[1],Rd(Jd,Kd,.4),r*.7)]},Xd=(e,t,n)=>{let r=e.createLinearGradient(0,0,0,t);return r.addColorStop(0,n[0]),r.addColorStop(1,n[1]),r},Zd=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}},Qd=2,$d=[``,`薄雾`,`中雾`,`浓雾`],ef=e=>Math.min(3,Math.max(1,Math.round(e))),tf=e=>{let t=ef(e);return`${t} · ${$d[t]}`},nf=e=>e===`fog`,rf=(e,t)=>{let n=ef(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`}},af=e=>{let t=ef(e);return t===1?.45:t===3?.95:.65},of=e=>e===45?2:e===48?3:null,sf=e=>e==null||!Number.isFinite(e)?null:e>=5e3?1:e>=1e3?2:3,cf=2,lf=[``,`细雹`,`密雹`,`巨雹`],uf=e=>Math.min(3,Math.max(1,Math.round(e))),df=e=>{let t=uf(e);return`${t} · ${lf[t]}`},ff=e=>e===`hail`,pf=e=>{let t=uf(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}},mf=e=>e===96?2:e===99?3:null,hf=1,gf=10,_f=5,vf=5,yf=e=>Math.min(10,Math.max(1,Math.round(e))),bf=(e,t,n)=>e+(t-e)*n,xf=e=>{let t=yf(e);return t<=2?1:t<=4?2:t<=6?3:t<=8?4:5},Sf=[`毛毛雨`,`小雨`,`中雨`,`暴雨`,`特大暴雨`],Cf=[`毛毛雪`,`小雪`,`中雪`,`暴雪`,`特大暴雪`],wf=(e,t)=>{let n=xf(e);return(t===`rain`?Sf:Cf)[n-1]},Tf=(e,t)=>`${yf(e)} · ${wf(e,t)}`,Ef=[``,...Sf],Df=[``,...Cf],Of=e=>e===`lightRain`||e===`moderateRain`||e===`heavyRain`?`rain`:e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`?`snow`:e,kf=e=>e===`rain`||e===`lightRain`||e===`moderateRain`||e===`heavyRain`,Af=e=>e===`snow`||e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`,jf=e=>kf(e)||e===`thunderstorm`||e===`sleet`,Mf=e=>Af(e)||e===`sleet`,Nf=(e,t=5)=>e===`lightRain`?3:e===`moderateRain`?5:e===`heavyRain`?8:yf(t),Pf=(e,t=5)=>e===`lightSnow`?3:e===`moderateSnow`?5:e===`heavySnow`?8:yf(t),Ff=(e,t)=>t===`rain`?e<=2?`lightRain`:e===3?`moderateRain`:`heavyRain`:e<=2?`lightSnow`:e===3?`moderateSnow`:`heavySnow`,If=(e,t=5,n=5)=>e===`rain`?Ff(xf(t),`rain`):e===`lightRain`||e===`moderateRain`||e===`heavyRain`?Ff(xf(Nf(e)),`rain`):e===`snow`?Ff(xf(n),`snow`):e===`lightSnow`||e===`moderateSnow`||e===`heavySnow`?Ff(xf(Pf(e)),`snow`):e,Lf=(e,t)=>{let n=(yf(t)-1)/9;return{count:Math.round(bf(35,340,n)),speed:bf(5.5,16,n),wind:bf(-.4,-3.2,n),alpha:bf(.28,.62,n),splash:yf(t)>=5}},Rf=e=>{let t=(yf(e)-1)/9;return Math.round(bf(30,360,t))},zf=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,Bf=e=>[77].includes(e)?2:[71,85].includes(e)?3:[73].includes(e)?5:[75].includes(e)?8:[86].includes(e)?10:null,Vf=2,Hf=[``,`轻霾`,`中霾`,`重霾`],Uf=e=>Math.min(3,Math.max(1,Math.round(e))),Wf=e=>{let t=Uf(e);return`${t} · ${Hf[t]}`},Gf=e=>e===`smog`,Kf=(e,t)=>{let n=Uf(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`}},qf=e=>{let t=Uf(e);return t===1?.55:t===3?1.05:.85},Jf=e=>e==null||!Number.isFinite(e)?null:e>=5e3?1:e>=1e3?2:3,Yf={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`},Xf=e=>Of(Yf[e]??`overcast`),Zf={weather:null,rainLevel:null,snowLevel:null,fogLevel:null,hailLevel:null,smogLevel:null,status:`idle`,error:null,current:null},Qf={...Zf,status:`locating`},$f={...Zf,status:`fetching`},ep=e=>e!=null&&Number.isFinite(e.latitude)&&Number.isFinite(e.longitude),tp=e=>{if(typeof e!=`string`||!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null},np=e=>{if(typeof e!=`string`||!e)return null;let t=e.match(/T(\d{2}):(\d{2})/);return t?`${t[1]}:${t[2]}`:null},rp=(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},ip=e=>!e?.sunrise||!e?.sunset?null:{sunrise:e.sunrise,sunset:e.sunset},ap=e=>({...Zf,status:`error`,error:e}),op=async(e,t,n)=>{let r=new URLSearchParams({latitude:String(e),longitude:String(t),current:`weather_code,wind_speed_10m,is_day,visibility`,daily:`sunrise,sunset`,timezone:`auto`,forecast_days:`1`}),i=await fetch(`https://api.open-meteo.com/v1/forecast?${r}`,{signal:n});if(!i.ok)throw Error(`Open-Meteo 请求失败(HTTP ${i.status})`);let a=await i.json(),o=Number(a?.current?.weather_code);if(Number.isNaN(o))throw Error(`Open-Meteo 返回数据缺少 weather_code`);let s=Number(a?.current?.wind_speed_10m??0),c=tp(a?.daily?.sunrise?.[0]),l=tp(a?.daily?.sunset?.[0]),u=typeof a?.timezone==`string`?a.timezone:null,d=np(a?.current?.time)??rp(u),f=Xf(o),p=zf(o),m=Bf(o),h=a?.current?.visibility,g=h!=null&&Number.isFinite(Number(h))?Number(h):null,_=f===`fog`?sf(g)??of(o)??2:null,v=f===`hail`?mf(o)??2:null,y=f===`smog`?Jf(g)??2:null;return{weather:f,rainLevel:p,snowLevel:m,fogLevel:_,hailLevel:v,smogLevel:y,status:`success`,error:null,current:{weatherCode:o,windSpeed:s,isDay:a?.current?.is_day===1,latitude:e,longitude:t,timezone:u,localTime:d,visibility:g,rainLevel:p,snowLevel:m,fogLevel:_,hailLevel:v,smogLevel:y,sunrise:c,sunset:l}}},sp=(e,t,n)=>{if(!e)return n(Zf),()=>{};let r=!1,i=new AbortController,a=ep(t);n(a?$f:Qf);let o=async(e,t)=>{try{let a=await op(e,t,i.signal);r||n(a)}catch(e){if(r||e instanceof DOMException&&e.name===`AbortError`)return;n(ap(e instanceof Error?e.message:`天气获取失败`))}};return a?(o(t.latitude,t.longitude),()=>{r=!0,i.abort()}):typeof navigator>`u`||!navigator.geolocation?(Promise.resolve().then(()=>{r||n(ap(`当前环境不支持定位`))}),()=>{r=!0}):(navigator.geolocation.getCurrentPosition(({coords:e})=>{r||(n($f),o(e.latitude,e.longitude))},e=>{r||n(ap(e.message||`定位失败`))},{timeout:1e4,maximumAge:600*1e3}),()=>{r=!0,i.abort()})},cp=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=tp(a?.daily?.sunrise?.[0]),s=tp(a?.daily?.sunset?.[0]);return o==null||s==null?null:{sunrise:o,sunset:s}},lp=(e,t)=>{if(!ep(e))return t(null),()=>{};let n=!1,r=new AbortController;return cp(e.latitude,e.longitude,r.signal).then(e=>{n||t(e)}).catch(()=>{n||t(null)}),()=>{n=!0,r.abort()}},up=3,dp=e=>Math.min(12,Math.max(0,Math.round(e))),fp=e=>Math.max(0,dp(e)-2),pp=.55,mp=[0,3,8,16,24,33,44,55,68,81,95,110,125],hp=[1,5,11,19,28,38,49,61,74,88,102,117,1/0],gp=(e,t,n=0,r=0)=>{let i=t.gustiness,a=t.wander,o=n*.0017+r*.0024,s=e*pp,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)}},_p=e=>{let t=dp(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}},vp=e=>mp[dp(e)]??16,yp=e=>{let t=Math.max(0,e);for(let e=0;e<hp.length;e++)if(t<=hp[e])return e;return 12},bp=e=>{let t=yp(e),n=fp(t),r=vp(n),i=Math.max(.04,Math.min(r/16,4.2)),{alphaMul:a}=_p(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}},xp=e=>e.live&&e.liveWindKmh!=null&&Number.isFinite(e.liveWindKmh)?Math.max(0,e.liveWindKmh):vp(e.windLevel);function Sp(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 Cp(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 wp(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 Tp(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=Tp(e,t,o,s,i*.55,a-1),l=Tp(o,s,n,r,i*.55,a-1);return[...c.slice(0,-1),...l]}function Ep(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=gp(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 Dp(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=Tp(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 Op=3.2,kp=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},Ap=(e=16)=>Array.from({length:e},()=>kp(Op)),jp=e=>e[Math.floor(Math.random()*e.length)],Mp=(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=jp(r),e.drawSize=e.r*2.8+4,e.rotation=Math.random()*Math.PI*2,e.rotationSpeed=(Math.random()-.5)*.06},Np=(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 Mp(a,e,t,n,Math.random()<.72,r,i),a};function Pp(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 Fp(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 Ip(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=gp(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{Mp(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 Lp(e){e.ctx.fillStyle=e.skyGradient,e.ctx.fillRect(0,0,e.width,e.height)}function Rp(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 zp(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?Zd(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 Bp(e){if(e.activeNight){Rp(e),zp(e);return}zp(e)}var Vp={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}},Hp={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}},Up=([e,t,n])=>[Math.round(e*.3+18),Math.round(t*.3+24),Math.round(n*.3+42)];function Wp(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 Gp(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}=Wp(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 Kp(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 qp(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 Jp(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 Yp=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},Xp=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},Zp=()=>({dots:[1.2,1.6,2,2.3].map(e=>Yp(e)),crystals:[2.6,3.2,3.8,4.4,5].map(e=>Xp(e*2.4))}),Qp=e=>e[Math.floor(Math.random()*e.length)],$p=(e,t,n,r)=>{let i=1+Math.random()**1.6*4.2,a=i>=2.4,o=Qp(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}},em=(e,t)=>t?e===`smog`?`96, 88, 66`:`138, 150, 168`:e===`smog`?`168, 155, 126`:`226, 232, 238`;function tm(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=Vp[i],h=(()=>{let e=m;return jf(i)&&e.rain&&(e={...e,rain:Lf(e.rain,l)}),Mf(i)&&(e={...e,snowCount:Rf(u),fogBanks:u>=7?Math.max(e.fogBanks,3):e.fogBanks,haze:u>=7?Math.max(e.haze,.12):e.haze}),nf(i)&&(e=rf(e,f)),Gf(i)&&(e=Kf(e,p)),e})(),g=Hp[i],_=a??null,v=_?Ud(s?Date.now():o,_):null,y=v?!v.isDay:!1,b=v?Yd(h.sky,g.sky,v):y?g.sky:h.sky,x=y?Up(h.cloudColor):h.cloudColor,S=Math.min(n,r)*.09,C=n*.72,w=r*.26;if(v){let e=Wd(n,r,v.arcProgress);C=e.x,w=e.y}let T=Xd(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=qp(h,S),O=Jp(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},()=>Gp(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)*(nf(i)?af(f):Gf(i)?qf(p):1)})),F=h.fogBanks>0?Kp(em(i,y)):null,I=h.snowCount>0?Zp():null,L=I==null?[]:Array.from({length:h.snowCount},()=>$p(n,r,I)),R=ff(i)?pf(d):null,z=R==null?null:Ap(),B=z!=null&&R!=null?Array.from({length:R.count},()=>Np(n,r,z,{min:R.sizeMin,max:R.sizeMax},R.speedMul)):[],V=(()=>{let{count:e}=_p(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=[],ee=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:ee}}}function nm(e,t){if(!e.dayCycleTimes)return;let n=Ud(e.liveClock?t??Date.now():e.sceneTimeMs,e.dayCycleTimes),r=Hp[e.activeWeather],i=Yd(e.cfg.sky,r.sky,n),a=Wd(e.width,e.height,n.arcProgress);e.dayCycle=n,e.activeNight=!n.isDay,e.sky=i,e.skyGradient=Xd(e.ctx,e.height,i),e.sunX=a.x,e.sunY=a.y,e.celestial=n.isDay?e.sunSprite:e.moonSprite}function rm(e,t){t&&(e.state.t+=1),e.windField=gp(e.state.t,e.windMotion),e.dayCycleTimes&&nm(e,e.liveClock?Date.now():e.sceneTimeMs),Lp(e),Bp(e),Sp(e),Cp(e),wp(e),Pp(e),Fp(e),Ip(e),Ep(e),Dp(e)}function im(e){let{ctx:t,width:n,height:r,activeWeather:i,activeNight:a,windMotion:o}=e,s=tm(e),l={ctx:t,width:n,height:r,activeWeather:i,activeNight:s.dayCycle?!s.dayCycle.isDay:a,windMotion:o,windField:gp(0,o),...s};l.dayCycleTimes&&nm(l,l.liveClock?Date.now():l.sceneTimeMs);let u=document.hidden,d=(0,c.prefersReducedMotion)(),f=(0,c.bindVisibilityPause)(e=>{u=e}),p=(0,c.bindPrefersReducedMotion)(e=>{d=e});if(d)return rm(l,!1),()=>{f(),p()};let m=0,h=()=>{m=requestAnimationFrame(h),!u&&(d||rm(l,!0))};return h(),()=>{cancelAnimationFrame(m),f(),p()}}var am=`cos-weather-background`,om=800,sm=450;function cm(e,t={}){let n={fill:!1,weather:`partlyCloudy`,time:`14:00`,live:!1,windLevel:3,rainLevel:5,snowLevel:5,hailLevel:2,fogLevel:2,smogLevel:2,loading:!1,loadingText:`天气加载中…`,...t},r=!1,i=n.width??om,a=n.height??sm,o=null,s=null,l=null,u=Zf,d={current:n.onLiveWeather},f=document.createElement(`div`);f.className=am;let p=document.createElement(`canvas`);p.className=`${am}__canvas`,p.setAttribute(`role`,`img`);let m=document.createElement(`div`);m.className=`${am}__loading-overlay`,m.setAttribute(`role`,`status`),m.setAttribute(`aria-live`,`polite`);let h=document.createElement(`div`);h.className=`${am}__loading-spinner`,h.setAttribute(`aria-hidden`,`true`);let g=document.createElement(`span`);m.append(h,g),f.append(p,m),e.appendChild(f),m.hidden=!0;let _=()=>{(0,c.applyCanvasHostBox)(e,f,{fill:!!n.fill,width:i,height:a}),p.style.width=`${i}px`,p.style.height=`${a}px`},v=(e,t,r)=>{m.hidden=!(n.loading||n.live&&(u.status===`locating`||u.status===`fetching`)),g.textContent=n.loadingText??`天气加载中…`,p.setAttribute(`aria-label`,n.ariaLabel??`天气背景:${e}${t?`(夜间)`:``},${r}级风`)},y=()=>{s?.(),s=null;let e=window.devicePixelRatio||1;p.width=i*e,p.height=a*e;let t=p.getContext(`2d`);if(!t)return;t.setTransform(e,0,0,e,0,0);let r=!!n.live,o=Of(r&&u.weather?u.weather:n.weather??`partlyCloudy`),c=r&&u.rainLevel!=null?u.rainLevel:n.rainLevel??5,l=r&&u.snowLevel!=null?u.snowLevel:n.snowLevel??5,d=r&&u.fogLevel!=null?u.fogLevel:n.fogLevel??2,f=r&&u.hailLevel!=null?u.hailLevel:n.hailLevel??2,m=r&&u.smogLevel!=null?u.smogLevel:n.smogLevel??2,h=If(o,c,l),g=Hd(n.time),_=u.current?.sunrise??null,y=u.current?.sunset??null,b=u.current?.windSpeed??null,x=r&&_!=null&&y!=null?{sunrise:_,sunset:y}:Bd(g),S=bp(xp({live:r,windLevel:n.windLevel??3,liveWindKmh:b})),C=r&&u.current?!u.current.isDay:!Ud(g,x).isDay;v(o,C,S.level),s=im({ctx:t,width:i,height:a,activeWeather:h,activeNight:C,dayCycleTimes:x,sceneTimeMs:g,liveClock:r,windMotion:S,rainLevel:c,snowLevel:l,fogLevel:d,hailLevel:f,smogLevel:m})},b=()=>{if(l?.(),l=null,!n.live){u=Zf,y();return}l=sp(!0,n.latitude!=null&&n.longitude!=null?{latitude:n.latitude,longitude:n.longitude}:void 0,e=>{u=e,e.weather&&d.current?.(Of(e.weather)),y()})},x=()=>{if(o?.(),o=null,!(n.fill??!1)){i=n.width??om,a=n.height??sm,_(),y();return}o=(0,c.observeElementSize)(e,e=>{let t=(0,c.resolveCanvasBoxSize)({fill:!0,width:n.width,height:n.height,defaultWidth:om,defaultHeight:sm,measured:e});i=t.width,a=t.height,_(),y()})};return x(),b(),{update(e){let t=n;n={...n,...e},d.current=n.onLiveWeather;let r=t.live!==n.live||t.latitude!==n.latitude||t.longitude!==n.longitude;if(t.fill!==n.fill||t.width!==n.width||t.height!==n.height)x();else if(r)b();else{let e=e=>JSON.stringify(e,(e,t)=>typeof t==`function`?void 0:t);e(t)!==e(n)&&y()}},destroy(){r||(r=!0,s?.(),l?.(),o?.(),f.remove())}}}var lm=`cos-wave-text`;function um(e,t={}){let n={text:`WAVE`,amplitude:12,color:`#38bdf8`,fontSize:56,...t},r=document.createElement(`div`);r.className=lm;let i=document.createElement(`h1`);i.className=`${lm}__text`,r.appendChild(i),e.appendChild(r);let a=()=>{i.style.fontSize=`${n.fontSize??56}px`,i.style.setProperty(`--wave-color`,n.color??`#38bdf8`),i.style.setProperty(`--wave-amp`,`${n.amplitude??12}px`),i.replaceChildren();for(let[e,t]of(n.text??`WAVE`).split(``).entries()){let n=document.createElement(`span`);n.className=`${lm}__char`,n.style.animationDelay=`${e*.1}s`,n.textContent=t===` `?`\xA0`:t,i.appendChild(n)}};return a(),{update(e){n={...n,...e},a()},destroy(){r.remove()}}}Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return mf}}),Object.defineProperty(exports,"$t",{enumerable:!0,get:function(){return nr}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return hf}}),Object.defineProperty(exports,"An",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"At",{enumerable:!0,get:function(){return pu}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return xf}}),Object.defineProperty(exports,"Bn",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"Bt",{enumerable:!0,get:function(){return cl}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return Kf}}),Object.defineProperty(exports,"Cn",{enumerable:!0,get:function(){return He}}),Object.defineProperty(exports,"Ct",{enumerable:!0,get:function(){return Vu}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return _f}}),Object.defineProperty(exports,"Dn",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,"Dt",{enumerable:!0,get:function(){return wu}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return Gf}}),Object.defineProperty(exports,"En",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"Et",{enumerable:!0,get:function(){return Eu}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return Lf}}),Object.defineProperty(exports,"Fn",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"Ft",{enumerable:!0,get:function(){return Zl}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return Pf}}),Object.defineProperty(exports,"Gn",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"Gt",{enumerable:!0,get:function(){return Ca}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return Nf}}),Object.defineProperty(exports,"Hn",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"Ht",{enumerable:!0,get:function(){return Po}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return Rf}}),Object.defineProperty(exports,"In",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"It",{enumerable:!0,get:function(){return ql}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return Mf}}),Object.defineProperty(exports,"Jt",{enumerable:!0,get:function(){return zi}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return Bf}}),Object.defineProperty(exports,"Kt",{enumerable:!0,get:function(){return oa}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return kf}}),Object.defineProperty(exports,"Ln",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"Lt",{enumerable:!0,get:function(){return Wl}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return Df}}),Object.defineProperty(exports,"Mn",{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,"Mt",{enumerable:!0,get:function(){return su}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return yf}}),Object.defineProperty(exports,"Nn",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"Nt",{enumerable:!0,get:function(){return au}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return vf}}),Object.defineProperty(exports,"On",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"Ot",{enumerable:!0,get:function(){return xu}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return Tf}}),Object.defineProperty(exports,"Pn",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,"Pt",{enumerable:!0,get:function(){return tu}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return df}}),Object.defineProperty(exports,"Qt",{enumerable:!0,get:function(){return gr}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return Af}}),Object.defineProperty(exports,"Rn",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"Rt",{enumerable:!0,get:function(){return jl}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return Wf}}),Object.defineProperty(exports,"Sn",{enumerable:!0,get:function(){return We}}),Object.defineProperty(exports,"St",{enumerable:!0,get:function(){return Uu}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return Jf}}),Object.defineProperty(exports,"Tn",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,"Tt",{enumerable:!0,get:function(){return Ou}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return zf}}),Object.defineProperty(exports,"Un",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"Ut",{enumerable:!0,get:function(){return qa}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return wf}}),Object.defineProperty(exports,"Vn",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"Vt",{enumerable:!0,get:function(){return Ds}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return If}}),Object.defineProperty(exports,"Wn",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"Wt",{enumerable:!0,get:function(){return Ea}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return lf}}),Object.defineProperty(exports,"Xt",{enumerable:!0,get:function(){return si}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return cf}}),Object.defineProperty(exports,"Yt",{enumerable:!0,get:function(){return bi}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return uf}}),Object.defineProperty(exports,"Zt",{enumerable:!0,get:function(){return ei}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return sp}}),Object.defineProperty(exports,"_n",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(exports,"_t",{enumerable:!0,get:function(){return md}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return yp}}),Object.defineProperty(exports,"an",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return af}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return Hf}}),Object.defineProperty(exports,"bn",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"bt",{enumerable:!0,get:function(){return ad}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return vp}}),Object.defineProperty(exports,"cn",{enumerable:!0,get:function(){return Vt}}),Object.defineProperty(exports,"ct",{enumerable:!0,get:function(){return tf}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return op}}),Object.defineProperty(exports,"dn",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(exports,"dt",{enumerable:!0,get:function(){return Md}}),Object.defineProperty(exports,"en",{enumerable:!0,get:function(){return qn}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return pf}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return cp}}),Object.defineProperty(exports,"fn",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(exports,"ft",{enumerable:!0,get:function(){return Ad}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return Xf}}),Object.defineProperty(exports,"gn",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(exports,"gt",{enumerable:!0,get:function(){return gd}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return ep}}),Object.defineProperty(exports,"hn",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(exports,"ht",{enumerable:!0,get:function(){return Sd}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return bp}}),Object.defineProperty(exports,"in",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return ef}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Ef}}),Object.defineProperty(exports,"jn",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(exports,"jt",{enumerable:!0,get:function(){return du}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return gf}}),Object.defineProperty(exports,"kn",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"kt",{enumerable:!0,get:function(){return _u}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return _p}}),Object.defineProperty(exports,"ln",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(exports,"lt",{enumerable:!0,get:function(){return rf}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return ip}}),Object.defineProperty(exports,"mn",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(exports,"mt",{enumerable:!0,get:function(){return Td}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return cm}}),Object.defineProperty(exports,"nn",{enumerable:!0,get:function(){return _n}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return Qd}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return gp}}),Object.defineProperty(exports,"on",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(exports,"ot",{enumerable:!0,get:function(){return sf}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return rp}}),Object.defineProperty(exports,"pn",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(exports,"pt",{enumerable:!0,get:function(){return Dd}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return jf}}),Object.defineProperty(exports,"qt",{enumerable:!0,get:function(){return Yi}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return up}}),Object.defineProperty(exports,"rn",{enumerable:!0,get:function(){return nn}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return $d}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return fp}}),Object.defineProperty(exports,"sn",{enumerable:!0,get:function(){return Ut}}),Object.defineProperty(exports,"st",{enumerable:!0,get:function(){return of}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return um}}),Object.defineProperty(exports,"tn",{enumerable:!0,get:function(){return Sn}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return ff}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Zf}}),Object.defineProperty(exports,"un",{enumerable:!0,get:function(){return Dt}}),Object.defineProperty(exports,"ut",{enumerable:!0,get:function(){return nf}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return lp}}),Object.defineProperty(exports,"vn",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(exports,"vt",{enumerable:!0,get:function(){return dd}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return qf}}),Object.defineProperty(exports,"wn",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"wt",{enumerable:!0,get:function(){return Ru}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return Uf}}),Object.defineProperty(exports,"xn",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(exports,"xt",{enumerable:!0,get:function(){return $u}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return Vf}}),Object.defineProperty(exports,"yn",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(exports,"yt",{enumerable:!0,get:function(){return ld}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return Of}}),Object.defineProperty(exports,"zn",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"zt",{enumerable:!0,get:function(){return Sl}});
|