{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "weather-widget",
  "type": "registry:block",
  "title": "Weather Widget",
  "description": "Display weather conditions and forecasts.",
  "dependencies": [
    "lucide-react"
  ],
  "files": [
    {
      "path": "components/tool-ui/weather-widget/generated/weather-runtime-core.generated.ts",
      "type": "registry:lib",
      "target": "components/tool-ui/weather-widget/generated/weather-runtime-core.generated.ts",
      "content": "// @ts-nocheck\n// AUTO-GENERATED by `pnpm weather:compile`.\n// Source: lib/weather-authoring/weather-widget/weather-runtime-core.ts\n// DO NOT EDIT MANUALLY.\n\nimport{useMemo as ye,useState as ft,useEffect as dt}from\"react\";var Ze=8,j=new Set;function he(e){return j.has(e)?!0:j.size>=Ze?!1:(j.add(e),!0)}function ae(e){j.delete(e)}function ge(e,t){return t&&(ae(e),null)}import{useCallback as N,useEffect as Ke,useRef as v}from\"react\";var O=`#version 300 es\nin vec4 a_position;out vec2 v_uv;void main(){gl_Position=a_position;v_uv=a_position.xy*0.5+0.5;}`,se=`#version 300 es\nprecision highp float;in vec2 v_uv;out vec4 fragColor;uniform float u_time;uniform vec2 u_resolution;uniform float u_timeOfDay;uniform float u_moonPhase;uniform float u_starDensity;uniform vec2 u_celestialPos;uniform float u_sunSize;uniform float u_moonSize;uniform float u_sunGlowIntensity;uniform float u_sunGlowSize;uniform float u_sunRayCount;uniform float u_sunRayLength;uniform float u_sunRayIntensity;uniform float u_sunRayShimmer;uniform float u_sunRayShimmerSpeed;uniform float u_moonGlowIntensity;uniform float u_moonGlowSize;uniform float u_skyBrightness;uniform float u_skySaturation;uniform float u_skyContrast;uniform sampler2D u_moonTexture;uniform bool u_hasMoonTexture;\n#define PI 3.14159265359\n#define GODRAY_MAX_SAMPLES 32\n#define TAU 6.28318530718\nfloat hash(vec2 p){return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453123);}vec2 hash2(vec2 p){p=vec2(dot(p,vec2(127.1,311.7)),dot(p,vec2(269.5,183.3)));return fract(sin(p)*43758.5453);}float noise(vec2 p){vec2 i=floor(p);vec2 f=fract(p);f=f*f*(3.0-2.0*f);float a=hash(i);float b=hash(i+vec2(1.0,0.0));float c=hash(i+vec2(0.0,1.0));float d=hash(i+vec2(1.0,1.0));return mix(mix(a,b,f.x),mix(c,d,f.x),f.y);}float fbm(vec2 p,int octaves){float value=0.0;float amplitude=0.5;float frequency=1.0;for(int i=0;i<6;i++){if(i>=octaves)break;value+=amplitude*noise(p*frequency);frequency*=2.0;amplitude*=0.5;}return value;}float getSunY(float timeOfDay,float baseY){float belowHorizon=-0.25;float riseProgress=smoothstep(0.18,0.32,timeOfDay);float setProgress=smoothstep(0.68,0.82,timeOfDay);float visible=riseProgress*(1.0-setProgress);return mix(belowHorizon,baseY,visible);}float getMoonY(float timeOfDay,float baseY){float belowHorizon=-0.25;float risingEvening=smoothstep(0.74,0.88,timeOfDay);float settingMorning=1.0-smoothstep(0.12,0.26,timeOfDay);float visible=max(risingEvening,settingMorning);return mix(belowHorizon,baseY,visible);}float getHorizonFade(float y){return smoothstep(-0.2,0.0,y);}vec3 getSkyColor(vec2 uv,float timeOfDay){vec3 dayTop=vec3(0.4,0.6,0.9);vec3 dayHorizon=vec3(0.7,0.8,0.95);vec3 sunsetTop=vec3(0.2,0.2,0.4);vec3 sunsetHorizon=vec3(0.9,0.5,0.2);vec3 nightTop=vec3(0.02,0.02,0.05);vec3 nightHorizon=vec3(0.05,0.05,0.1);float dayAmount=smoothstep(0.25,0.4,timeOfDay)*smoothstep(0.75,0.6,timeOfDay);float sunsetAmount=max(smoothstep(0.2,0.3,timeOfDay)*smoothstep(0.4,0.3,timeOfDay),smoothstep(0.6,0.7,timeOfDay)*smoothstep(0.8,0.7,timeOfDay));float nightAmount=max(0.0,1.0-dayAmount-sunsetAmount);float gradientFactor=pow(1.0-uv.y,1.0);vec3 topColor=dayTop*dayAmount+sunsetTop*sunsetAmount+nightTop*nightAmount;vec3 horizonColor=dayHorizon*dayAmount+sunsetHorizon*sunsetAmount+nightHorizon*nightAmount;vec3 avgColor=(topColor+horizonColor)*0.5;topColor=mix(avgColor,topColor,u_skyContrast);horizonColor=mix(avgColor,horizonColor,u_skyContrast);vec3 color=mix(topColor,horizonColor,gradientFactor);color*=u_skyBrightness;float gray=dot(color,vec3(0.299,0.587,0.114));if(u_skySaturation<=1.0){color=mix(vec3(gray),color,u_skySaturation);}else{float boost=u_skySaturation-1.0;color=color+(color-vec3(gray))*boost;}return clamp(color,0.0,1.0);}float drawStars(vec2 uv,float density,float time){float stars=0.0;for(int layer=0;layer<3;layer++){float layerScale=100.0+float(layer)*50.0;vec2 gridUV=uv*layerScale;vec2 gridID=floor(gridUV);vec2 gridFract=fract(gridUV);vec2 starPos=hash2(gridID+float(layer)*100.0);float dist=length(gridFract-starPos);float starPresent=step(1.0-density*0.3,hash(gridID*(float(layer)+1.0)));float starSize=0.02+hash(gridID.yx)*0.03;float twinkle=sin(time*(2.0+hash(gridID)*3.0)+hash(gridID.yx)*TAU)*0.3+0.7;float star=smoothstep(starSize,0.0,dist)*starPresent*twinkle;star*=1.0-float(layer)*0.3;stars+=star;}return stars;}vec3 drawSun(vec2 uv,vec2 sunPos,float size){vec2 aspect=vec2(u_resolution.x/u_resolution.y,1.0);vec2 diff=(uv-sunPos)*aspect;float dist=length(diff);float angle=atan(diff.y,diff.x);float disc=1.0-smoothstep(size*0.9,size,dist);vec3 sunCore=vec3(1.0,1.0,0.95);vec3 sunEdge=vec3(1.0,0.9,0.4);float edgeFactor=clamp(dist/size,0.0,1.0);vec3 sunColor=mix(sunCore,sunEdge,edgeFactor);float limbDarkening=1.0-pow(clamp(dist/size,0.0,1.0),2.0)*0.3;sunColor*=limbDarkening;float glowSize=max(0.1,u_sunGlowSize);float scaledDist=dist/glowSize;float glow1=exp(-scaledDist*8.0)*0.5;float glow2=exp(-scaledDist*3.0)*0.3;float glow3=exp(-scaledDist*1.5)*0.15;vec3 glowColor=vec3(1.0,0.8,0.4);float glowTotal=(glow1+glow2+glow3)*u_sunGlowIntensity;vec3 result=sunColor*disc*2.0;result+=glowColor*glowTotal;float ringCenter=size*1.15;float ringWidth=max(size*0.35,0.001);float ringMask=smoothstep(size*0.85,size*1.05,dist);ringMask*=1.0-smoothstep(size*5.0,size*9.0,dist);float chromaShift=size*(0.012+u_sunRayIntensity*0.06);chromaShift*=smoothstep(size*0.9,size*2.4,dist);float ringR=exp(-pow((dist-chromaShift-ringCenter)/ringWidth,2.0));float ringG=exp(-pow((dist-ringCenter)/ringWidth,2.0));float ringB=exp(-pow((dist+chromaShift-ringCenter)/ringWidth,2.0));float ringT=clamp((dist-size)/(size*2.2),0.0,1.0);vec3 ringSpectral=0.55+0.45*cos(TAU*(ringT+vec3(0.0,0.33,0.67)));ringSpectral=clamp(ringSpectral,0.0,1.0);vec3 ringColor=mix(vec3(1.0),ringSpectral,0.45);float ringIntensity=(ringR+ringG+ringB)/3.0;ringIntensity*=ringMask*u_sunGlowIntensity*0.025;result+=ringColor*ringIntensity;if(u_sunRayCount>0.0&&u_sunRayIntensity>0.0){if(dist<size*3.6){float motion=clamp(u_sunRayShimmer,0.0,5.0);float t=u_time*max(0.0,u_sunRayShimmerSpeed);float rayPhase=angle*u_sunRayCount;float rayIndex=floor(rayPhase/PI+0.5);float raySeed=hash(vec2(rayIndex,19.17));float major=pow(abs(cos(rayPhase)),10.0);float minor=pow(abs(cos(rayPhase*2.0+raySeed*2.3)),22.0)*0.18;float rayShape=max(major,minor);float breathe=1.0+(noise(vec2(t*0.05,raySeed*7.0))-0.5)*(0.08*motion);float shimmer=1.0+(noise(vec2(dist*12.0-t*0.25,raySeed*23.0))-0.5)*(0.12*motion);float micro=1.0+(noise(vec2(t*0.6,rayPhase*0.8))-0.5)*(0.06*motion);float rayNoise=0.72+0.28*noise(vec2(rayPhase*0.35,t*0.12+raySeed*10.0));float rayPattern=rayShape*rayNoise;float rayStart=smoothstep(size*0.75,size*1.25,dist);float rayEnd=smoothstep(size*(3.0*breathe),size*1.5,dist);float rayLengthVar=0.75+raySeed*0.55;float maxRayDist=max(0.001,u_sunRayLength*0.15);float rayFalloff=exp(-dist*dist/(maxRayDist*maxRayDist*rayLengthVar*breathe));float rays=rayPattern*rayFalloff*rayStart*rayEnd*u_sunRayIntensity;rays*=shimmer*micro;float prismMask=smoothstep(size*1.05,size*2.6,dist);float rayChroma=size*(0.01+u_sunRayIntensity*0.05)*prismMask;float distR=max(0.0,dist-rayChroma);float distB=dist+rayChroma;float falloffR=exp(-distR*distR/(maxRayDist*maxRayDist*rayLengthVar*breathe));float falloffG=rayFalloff;float falloffB=exp(-distB*distB/(maxRayDist*maxRayDist*rayLengthVar*breathe));vec3 rayRGB=vec3(falloffR,falloffG,falloffB)*rayPattern*rayStart*rayEnd;float rayAvg=(rayRGB.r+rayRGB.g+rayRGB.b)/3.0;vec3 rayChromaColor=rayRGB/max(rayAvg,1e-4);float rayT=clamp((dist-size)/(size*2.6),0.0,1.0);vec3 raySpectral=0.55+0.45*cos(TAU*(rayT+vec3(0.0,0.33,0.67)));raySpectral=clamp(raySpectral,0.0,1.0);raySpectral=mix(vec3(1.0),raySpectral,0.28);vec3 rayWarm=vec3(1.0,0.92,0.7);float prismMix=clamp(0.08+u_sunRayIntensity*0.6,0.0,0.45)*prismMask;vec3 rayColor=mix(rayWarm,rayChromaColor,prismMix);rayColor=mix(rayColor,raySpectral,prismMix*0.65);result+=rayColor*rays;}}return result;}vec3 getSphereNormal(vec2 discUV){float r2=dot(discUV,discUV);if(r2>1.0)return vec3(0.0);float z=sqrt(1.0-r2);return normalize(vec3(discUV.x,discUV.y,z));}vec2 sphereToEquirectangular(vec3 normal){float longitude=atan(normal.x,normal.z);float u=longitude/TAU+0.5;float latitude=asin(clamp(normal.y,-1.0,1.0));float v=latitude/PI+0.5;return vec2(u,v);}vec3 getMoonSurfaceColor(vec3 normal,vec2 discUV){if(u_hasMoonTexture){vec2 texUV=sphereToEquirectangular(normal);return texture(u_moonTexture,texUV).rgb;}float brightness=0.7+fbm(discUV*5.0,3)*0.3;return vec3(brightness*0.85,brightness*0.83,brightness*0.8);}vec4 drawMoon(vec2 uv,vec2 moonPos,float size,float phase){vec2 aspect=vec2(u_resolution.x/u_resolution.y,1.0);vec2 diff=(uv-moonPos)*aspect;float dist=length(diff);vec2 discUV=diff/size;float discDist=length(discUV);float disc=1.0-smoothstep(0.95,1.0,discDist);float glowSize=max(0.1,u_moonGlowSize);float glowIntensity=u_moonGlowIntensity;if(disc<0.001){float scaledDist=dist/glowSize;float glow1=exp(-scaledDist*6.0)*0.15;float glow2=exp(-scaledDist*2.0)*0.06;vec3 glowColor=vec3(0.8,0.85,0.95);float phaseAngle=phase*TAU;vec3 sunDir=vec3(sin(phaseAngle),0.0,-cos(phaseAngle));float glowPhase=max(0.2,dot(normalize(vec3(discUV,0.5)),sunDir)*0.5+0.5);return vec4(glowColor*(glow1+glow2)*glowPhase*glowIntensity,0.0);}vec3 normal=getSphereNormal(discUV);float phaseAngle=phase*TAU;vec3 sunDir=vec3(sin(phaseAngle),0.0,-cos(phaseAngle));float NdotL=dot(normal,sunDir);float terminator=smoothstep(-0.02,0.08,NdotL);vec3 baseColor=getMoonSurfaceColor(normal,discUV);vec3 ambient=baseColor*0.03;vec3 lit=baseColor*terminator;vec3 moonSurface=ambient+lit;float limbDarkening=1.0-pow(discDist,3.0)*0.15;moonSurface*=limbDarkening;float rimLight=pow(1.0-abs(NdotL),4.0)*terminator*0.1;moonSurface+=vec3(1.0,0.98,0.95)*rimLight;float scaledDist=dist/glowSize;float glow1=exp(-scaledDist*6.0)*0.12;float glow2=exp(-scaledDist*2.0)*0.06;vec3 glowColor=vec3(0.8,0.85,0.95);float litAmount=max(0.1,terminator);vec3 glow=glowColor*(glow1+glow2)*litAmount*glowIntensity;return vec4(moonSurface*disc+glow,disc);}void main(){vec2 uv=v_uv;vec3 color=getSkyColor(uv,u_timeOfDay);float sunY=getSunY(u_timeOfDay,u_celestialPos.y);float moonY=getMoonY(u_timeOfDay,u_celestialPos.y);vec2 sunPos=vec2(u_celestialPos.x,sunY);vec2 moonPos=vec2(u_celestialPos.x,moonY);float moonFade=getHorizonFade(moonY);if(moonFade>0.01){float stars=drawStars(uv,u_starDensity,u_time);color+=vec3(stars)*moonFade;}float sunFade=getHorizonFade(sunY);if(sunFade>0.01){vec3 sun=drawSun(uv,sunPos,u_sunSize);color+=sun*sunFade;}if(moonFade>0.01){vec4 moon=drawMoon(uv,moonPos,u_moonSize,u_moonPhase);float alpha=moon.a*moonFade;color=mix(color,moon.rgb,alpha)+moon.rgb*(1.0-moon.a)*moonFade;}fragColor=vec4(color,0.0);}`,oe=`#version 300 es\nprecision highp float;in vec2 v_uv;out vec4 fragColor;uniform float u_time;uniform vec2 u_resolution;uniform sampler2D u_sceneTexture;uniform float u_timeOfDay;uniform float u_coverage;uniform float u_density;uniform float u_softness;uniform float u_windSpeed;uniform float u_windAngle;uniform float u_turbulence;uniform float u_lightIntensity;uniform float u_ambientDarkness;uniform int u_numLayers;uniform float u_cloudScale;uniform vec2 u_celestialPos;uniform float u_celestialSize;uniform float u_celestialBrightness;uniform float u_backlightIntensity;\n#define PI 3.14159265359\nfloat hash(vec2 p){return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453123);}float noise(vec2 p){vec2 i=floor(p);vec2 f=fract(p);f=f*f*(3.0-2.0*f);float a=hash(i);float b=hash(i+vec2(1.0,0.0));float c=hash(i+vec2(0.0,1.0));float d=hash(i+vec2(1.0,1.0));return mix(mix(a,b,f.x),mix(c,d,f.x),f.y);}float fbm(vec2 p,int octaves){float value=0.0;float amplitude=0.5;for(int i=0;i<8;i++){if(i>=octaves)break;value+=amplitude*noise(p);p*=2.0;amplitude*=0.5;}return value;}float cloudLayer(vec2 uv,float time,float layerSeed,float speed,float turbAmount){vec2 wind=vec2(cos(u_windAngle),sin(u_windAngle))*speed*time;float layerScale=(1.8+hash(vec2(layerSeed,0.0))*1.2)*u_cloudScale;float layerRotation=hash(vec2(layerSeed,1.0))*0.5-0.25;vec2 layerOffset=vec2(hash(vec2(layerSeed,2.0))*100.0,hash(vec2(layerSeed,3.0))*100.0);float c=cos(layerRotation);float s=sin(layerRotation);vec2 rotatedUV=vec2(uv.x*c-uv.y*s,uv.x*s+uv.y*c);vec2 p=rotatedUV*layerScale+wind+layerOffset;float turbSeed=layerSeed*50.0;vec2 turbOffset=vec2(fbm(p*0.5+time*0.1+turbSeed,4),fbm(p*0.5+turbSeed+100.0+time*0.1,4))*turbAmount;float n=fbm(p+turbOffset,6);return n;}vec3 cloudLighting(float density,float heightInCloud,float sunAlt,float warmth,float nightFactor,vec2 uv){float daylight=smoothstep(-0.12,0.1,sunAlt);vec3 dayLitColor=vec3(1.0,0.98,0.96);vec3 sunsetLitColor=vec3(1.0,0.7,0.45);vec3 nightLitColor=vec3(0.12,0.14,0.2);vec3 litColor=mix(dayLitColor,sunsetLitColor,warmth);litColor=mix(litColor,nightLitColor,nightFactor);vec3 dayShadowColor=vec3(0.45,0.5,0.6);vec3 sunsetShadowColor=vec3(0.35,0.25,0.3);vec3 nightShadowColor=vec3(0.03,0.04,0.07);vec3 shadowColor=mix(dayShadowColor,sunsetShadowColor,warmth);shadowColor=mix(shadowColor,nightShadowColor,nightFactor);shadowColor*=(1.0-u_ambientDarkness*0.3);float topLight=heightInCloud*max(0.0,sunAlt);float sideLight=(1.0-abs(heightInCloud-0.5)*2.0)*(1.0-sunAlt*0.5);float bottomLight=(1.0-heightInCloud)*warmth*0.5;float ambientLight=mix(0.03,0.2,daylight);float lightAmount=(topLight*0.5+sideLight*0.3+bottomLight)*daylight+ambientLight;lightAmount=clamp(lightAmount*u_lightIntensity,0.0,1.0);vec3 cloudColor=mix(shadowColor,litColor,lightAmount);float rimLight=pow(density,0.5)*(1.0-density)*4.0;vec3 rimColor=mix(vec3(1.0,1.0,0.95),vec3(1.0,0.8,0.5),warmth);rimColor=mix(rimColor,vec3(0.15,0.18,0.25),nightFactor);float rimStrength=mix(0.1,0.3,daylight);cloudColor+=rimColor*rimLight*rimStrength*u_lightIntensity;float hotSpot=pow(max(0.0,lightAmount-0.6)*2.5,2.0)*warmth*daylight;cloudColor+=vec3(1.0,0.5,0.2)*hotSpot*0.4;float aspect=u_resolution.x/u_resolution.y;vec2 celestialUV=u_celestialPos;vec2 diff=(uv-celestialUV)*vec2(aspect,1.0);float distToCelestial=length(diff);float transmission=pow(1.0-density,2.0);float glowRadius=u_celestialSize*6.0;float proximityGlow=exp(-distToCelestial*distToCelestial/(glowRadius*glowRadius));float backlight=proximityGlow*transmission*u_celestialBrightness;float edgeDist=u_celestialSize*3.0;float nearCelestial=smoothstep(edgeDist*2.5,edgeDist*0.3,distToCelestial);float edgeFactor=density*(1.0-density)*4.0;float silverLining=nearCelestial*edgeFactor*u_celestialBrightness;vec3 backlightColor=mix(vec3(1.0,0.9,0.7),vec3(0.7,0.75,0.9),nightFactor);cloudColor+=backlightColor*(backlight*0.5+silverLining*0.8)*u_backlightIntensity;return cloudColor;}void main(){vec2 uv=v_uv;vec4 scene=texture(u_sceneTexture,uv);float sunAlt=u_timeOfDay<0.5?u_timeOfDay*2.0:2.0-u_timeOfDay*2.0;sunAlt=sunAlt*2.0-1.0;float warmth=1.0-smoothstep(0.0,0.4,sunAlt);warmth=warmth*warmth;float nightFactor=1.0-smoothstep(-0.12,0.02,sunAlt);float daylight=smoothstep(-0.12,0.1,sunAlt);vec3 color=scene.rgb;float accumulatedAlpha=0.0;for(int i=u_numLayers-1;i>=0;i--){float layerIdx=float(i);float layerDepth=layerIdx/max(1.0,float(u_numLayers)-1.0);float layerSeed=layerIdx*7.31+13.0;float layerSpeed=u_windSpeed*(0.6+hash(vec2(layerSeed,10.0))*0.8);float layerTurb=u_turbulence*(0.7+hash(vec2(layerSeed,11.0))*0.6);float cloud=cloudLayer(uv,u_time,layerSeed,layerSpeed,layerTurb);float threshold=1.0-u_coverage;cloud=smoothstep(threshold,threshold+u_softness,cloud);float heightInCloud=uv.y*0.6+cloud*0.4;vec3 cloudColor=cloudLighting(cloud,heightInCloud,sunAlt,warmth,nightFactor,uv);vec3 hazeColor=mix(vec3(0.05,0.06,0.1),vec3(0.6,0.7,0.85),daylight);float hazeAmount=layerDepth*layerDepth*0.5;cloudColor=mix(cloudColor,hazeColor,hazeAmount);float contrastReduction=1.0-layerDepth*0.3;cloudColor=mix(vec3(0.5),cloudColor,contrastReduction);float alpha=cloud*u_density*(0.6+(1.0-layerDepth)*0.4);color=mix(color,cloudColor,alpha*(1.0-accumulatedAlpha));accumulatedAlpha=accumulatedAlpha+alpha*(1.0-accumulatedAlpha);}fragColor=vec4(color,accumulatedAlpha);}`,ie=`#version 300 es\nprecision highp float;in vec2 v_uv;out vec4 fragColor;uniform float u_time;uniform vec2 u_resolution;uniform sampler2D u_sceneTexture;uniform float u_glassIntensity;uniform float u_glassZoom;uniform float u_fallingIntensity;uniform float u_fallingSpeed;uniform float u_fallingAngle;uniform float u_fallingStreakLength;uniform int u_fallingLayers;uniform float u_refractionStrength;\n#define S(a, b, t) smoothstep(a, b, t)\nvec3 N13(float p){vec3 p3=fract(vec3(p)*vec3(0.1031,0.11369,0.13787));p3+=dot(p3,p3.yzx+19.19);return fract(vec3((p3.x+p3.y)*p3.z,(p3.x+p3.z)*p3.y,(p3.y+p3.z)*p3.x));}float N(float t){return fract(sin(t*12345.564)*7658.76);}float Saw(float b,float t){return S(0.0,b,t)*S(1.0,b,t);}vec2 DropLayer(vec2 uv,float t){vec2 UV=uv;uv.y+=t*0.75;vec2 aspect=vec2(6.0,1.0);vec2 grid=aspect*2.0;vec2 id=floor(uv*grid);float colShift=N(id.x);uv.y+=colShift;id=floor(uv*grid);vec3 n=N13(id.x*35.2+id.y*2376.1);vec2 st=fract(uv*grid)-vec2(0.5,0.0);float x=n.x-0.5;float y=UV.y*20.0;float wiggle=sin(y+sin(y));x+=wiggle*(0.5-abs(x))*(n.z-0.5);x*=0.7;float ti=fract(t+n.z);y=(Saw(0.85,ti)-0.5)*0.9+0.5;vec2 p=vec2(x,y);float d=length((st-p)*aspect.yx);float mainDrop=S(0.4,0.0,d);float r=sqrt(S(1.0,y,st.y));float cd=abs(st.x-x);float trail=S(0.23*r,0.15*r*r,cd);float trailFront=S(-0.02,0.02,st.y-y);trail*=trailFront*r*r;float y2=fract(UV.y*10.0)+(st.y-0.5);float dd=length(st-vec2(x,y2));float droplets=S(0.3,0.0,dd);float m=mainDrop+droplets*r*trailFront;return vec2(m,trail);}float StaticDrops(vec2 uv,float t){uv*=40.0;vec2 id=floor(uv);uv=fract(uv)-0.5;vec3 n=N13(id.x*107.45+id.y*3543.654);vec2 p=(n.xy-0.5)*0.7;float d=length(uv-p);float fade=Saw(0.025,fract(t+n.z));float c=S(0.3,0.0,d)*fract(n.z*10.0)*fade;return c;}vec2 Drops(vec2 uv,float t,float l0,float l1,float l2){float s=StaticDrops(uv,t)*l0;vec2 m1=DropLayer(uv,t)*l1;vec2 m2=DropLayer(uv*1.85,t)*l2;float c=s+m1.x+m2.x;c=S(0.3,1.0,c);return vec2(c,max(m1.y*l0,m2.y*l1));}float hash12(vec2 p){vec3 p3=fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}vec2 FallingRainLayer(vec2 uv,float t,float speed,float angle,float streakLen,float scale,float density){vec2 offset=vec2(0.0);vec2 p=uv;p.x+=p.y*angle;p*=scale;p.y+=t*speed;vec2 id=floor(p);vec2 gv=fract(p)-0.5;for(int y=-1;y<=1;y++){for(int x=-1;x<=1;x++){vec2 offs=vec2(float(x),float(y));vec2 cellId=id+offs;float n1=hash12(cellId);if(n1>density)continue;vec2 n2=vec2(hash12(cellId*17.23),hash12(cellId*31.17));vec2 dropPos=offs+n2-0.5;vec2 localUV=gv-dropPos;float streakW=0.025+n1*0.02;float streakH=streakLen*(0.4+hash12(cellId*7.13)*0.6);float t_pos=(localUV.y+streakH)/(2.0*streakH);t_pos=clamp(t_pos,0.0,1.0);if(abs(localUV.y)>streakH*1.2)continue;float taper=mix(1.3,0.4,t_pos*t_pos);float width=streakW*taper;float core=S(width,width*0.2,abs(localUV.x));float vertFade=S(0.0,0.1,t_pos)*S(1.0,0.85,t_pos);float streak=core*vertFade;if(streak>0.001){offset.x+=localUV.x*streak*0.5;offset.y+=(n1-0.5)*streak*0.1;}}}return offset;}vec2 FallingRain(vec2 uv,float t){vec2 totalOffset=vec2(0.0);if(u_fallingIntensity<0.01)return totalOffset;float speed=u_fallingSpeed*5.0;float streakLen=u_fallingStreakLength*0.3;for(int i=0;i<6;i++){if(i>=u_fallingLayers)break;float layerIdx=float(i);float depth=layerIdx/float(max(u_fallingLayers-1,1));float layerScale=mix(6.0,30.0,depth);float layerSpeed=speed*mix(2.0,0.5,depth);float layerDensity=u_fallingIntensity*mix(0.8,0.3,depth);float layerStrength=mix(1.0,0.15,depth);float layerStreakLen=streakLen*mix(1.5,0.4,depth);float layerAngle=u_fallingAngle*mix(1.0,0.6,depth);vec2 layerOffset=vec2(sin(layerIdx*73.156)*3.0,cos(layerIdx*37.842)*3.0);vec2 layer=FallingRainLayer(uv+layerOffset,t+layerIdx*0.13,layerSpeed,layerAngle,layerStreakLen,layerScale,layerDensity);totalOffset+=layer*layerStrength;}return totalOffset*0.4;}void main(){vec2 uv=(gl_FragCoord.xy-0.5*u_resolution.xy)/u_resolution.y;vec2 UV=v_uv;uv*=u_glassZoom;float t=u_time*0.2;float rainAmount=u_glassIntensity;float staticDrops=S(-0.5,1.0,rainAmount)*2.0;float layer1=S(0.25,0.75,rainAmount);float layer2=S(0.0,0.5,rainAmount);vec2 c=Drops(uv,t,staticDrops,layer1,layer2);vec2 e=vec2(0.001,0.0);float cx=Drops(uv+e,t,staticDrops,layer1,layer2).x;float cy=Drops(uv+e.yx,t,staticDrops,layer1,layer2).x;vec2 glassNormal=vec2(cx-c.x,cy-c.x);vec2 fallingRainOffset=FallingRain(uv,u_time);vec2 totalRefraction=(glassNormal+fallingRainOffset)*u_refractionStrength;vec2 refractedUV=UV+totalRefraction;refractedUV=clamp(refractedUV,0.0,1.0);vec4 scene=texture(u_sceneTexture,refractedUV);vec3 color=scene.rgb;float rainMagnitude=length(fallingRainOffset);if(rainMagnitude>0.001){float brightness=dot(scene.rgb,vec3(0.299,0.587,0.114));float specular=rainMagnitude*15.0*(0.1+brightness*0.9);color+=vec3(0.8,0.85,0.95)*specular*0.3;}color+=vec3(0.1,0.12,0.15)*c.x*0.5;fragColor=vec4(color,scene.a);}`,re=`#version 300 es\nprecision highp float;in vec2 v_uv;out vec4 fragColor;uniform float u_time;uniform vec2 u_resolution;uniform sampler2D u_sceneTexture;uniform bool u_enabled;uniform float u_flashIntensity;uniform float u_branchDensity;uniform float u_sceneIllumination;uniform float u_lastFlashTime;uniform float u_strikeSeed;\n#define MAX_SEGMENTS 32\n#define MAX_BRANCHES 16\n#define PI 3.14159265359\nfloat easeOutSine(float t){return sin(t*PI*0.5);}float easeInSine(float t){return 1.0-cos(t*PI*0.5);}float easeInOutSine(float t){return-(cos(PI*t)-1.0)*0.5;}float easeOutQuad(float t){return 1.0-(1.0-t)*(1.0-t);}float easeOutCubic(float t){float inv=1.0-t;return 1.0-inv*inv*inv;}float hash11(float p){p=fract(p*0.1031);p*=p+33.33;p*=p+p;return fract(p);}float hash12(vec2 p){vec3 p3=fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}vec2 hash22(vec2 p){vec3 p3=fract(vec3(p.xyx)*vec3(0.1031,0.1030,0.0973));p3+=dot(p3,p3.yzx+33.33);return fract((p3.xx+p3.yz)*p3.zy);}float noise(vec2 p){vec2 i=floor(p);vec2 f=fract(p);f=f*f*(3.0-2.0*f);float a=hash12(i);float b=hash12(i+vec2(1.0,0.0));float c=hash12(i+vec2(0.0,1.0));float d=hash12(i+vec2(1.0,1.0));return mix(mix(a,b,f.x),mix(c,d,f.x),f.y);}float distToSegment(vec2 p,vec2 a,vec2 b){vec2 pa=p-a;vec2 ba=b-a;float h=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-ba*h);}vec2 displacedPoint(vec2 start,vec2 end,float t,float seed,float displacementAmt){vec2 basePoint=mix(start,end,t);vec2 dir=end-start;vec2 perp=normalize(vec2(-dir.y,dir.x));float envelope=sin(t*PI);float n1=noise(vec2(t*8.0,seed*100.0))*2.0-1.0;float n2=noise(vec2(t*16.0,seed*100.0+50.0))*2.0-1.0;float n3=noise(vec2(t*32.0,seed*100.0+100.0))*2.0-1.0;float displacement=(n1*0.6+n2*0.3+n3*0.1)*envelope*displacementAmt;float targetBias=1.0-t*0.3;displacement*=targetBias;return basePoint+perp*displacement*length(dir);}float mainBoltDistance(vec2 uv,vec2 start,vec2 end,float seed,float displacementAmt){float minDist=999.0;vec2 prevPoint=start;for(int i=1;i<=MAX_SEGMENTS;i++){float t=float(i)/float(MAX_SEGMENTS);vec2 currPoint=displacedPoint(start,end,t,seed,displacementAmt);float d=distToSegment(uv,prevPoint,currPoint);minDist=min(minDist,d);prevPoint=currPoint;}return minDist;}float branchDistance(vec2 uv,vec2 branchStart,vec2 branchDir,float branchLen,float seed,float displacementAmt){vec2 branchEnd=branchStart+branchDir*branchLen;float minDist=999.0;vec2 prevPoint=branchStart;for(int i=1;i<=12;i++){float t=float(i)/12.0;vec2 currPoint=displacedPoint(branchStart,branchEnd,t,seed,displacementAmt*0.7);float d=distToSegment(uv,prevPoint,currPoint);minDist=min(minDist,d);prevPoint=currPoint;}return minDist;}vec2 branchesDistance(vec2 uv,vec2 start,vec2 end,float seed,float displacementAmt,float density){float minDist=999.0;float brightness=0.0;vec2 mainDir=normalize(end-start);float mainLen=length(end-start);for(int i=0;i<MAX_BRANCHES;i++){float idx=float(i);float branchT=0.15+hash11(seed+idx*7.31)*0.7;float branchProb=(1.0-branchT)*density;if(hash11(seed+idx*3.17)>branchProb)continue;vec2 branchStart=displacedPoint(start,end,branchT,seed,displacementAmt);float angleOffset=(hash11(seed+idx*11.13)*2.0-1.0)*0.6;float side=hash11(seed+idx*5.71)>0.5?1.0:-1.0;float angle=atan(mainDir.y,mainDir.x)+side*(0.3+abs(angleOffset)*0.5);vec2 branchDir=vec2(cos(angle),sin(angle));float branchLen=mainLen*(0.15+hash11(seed+idx*13.37)*0.25);float d=branchDistance(uv,branchStart,branchDir,branchLen,seed+idx*100.0,displacementAmt);if(d<minDist){minDist=d;brightness=0.5-branchT*0.2;}if(density>0.3&&hash11(seed+idx*17.19)<density*0.5){float subT=0.3+hash11(seed+idx*19.23)*0.4;vec2 subStart=branchStart+branchDir*branchLen*subT;float subAngle=angle+(hash11(seed+idx*23.29)*2.0-1.0)*0.5;vec2 subDir=vec2(cos(subAngle),sin(subAngle));float subLen=branchLen*0.4;float subD=branchDistance(uv,subStart,subDir,subLen,seed+idx*200.0,displacementAmt*0.5);if(subD<minDist){minDist=subD;brightness=0.25;}}}return vec2(minDist,brightness);}vec3 lightningGlow(float dist,float brightness,float intensity,float thickness){float scaledDist=dist/max(thickness,0.1);float core=smoothstep(0.003,0.0,scaledDist)*brightness;float innerGlow=exp(-scaledDist*150.0)*brightness;float outerGlow=exp(-dist*dist*3000.0)*brightness*thickness;vec3 coreColor=vec3(1.0,1.0,1.0);vec3 innerColor=vec3(0.7,0.8,1.0);vec3 outerColor=vec3(0.5,0.5,0.9);vec3 color=coreColor*core*2.0;color+=innerColor*innerGlow*0.8;color+=outerColor*outerGlow*0.5;return color*intensity;}float flashEnvelope(float timeSinceStrike,float duration){if(timeSinceStrike<0.0||timeSinceStrike>duration)return 0.0;float t=timeSinceStrike/duration;float attackT=clamp(t/0.03,0.0,1.0);float attack=easeOutCubic(attackT);float sustainT=clamp((t-0.05)/0.65,0.0,1.0);float sustain=1.0-easeInOutSine(sustainT);float decay=exp(-t*2.0);decay=mix(decay,easeOutSine(1.0-t),0.3);float endT=clamp((t-0.75)/0.25,0.0,1.0);float endFade=1.0-easeInSine(endT);return attack*max(sustain,decay*0.4)*endFade;}float restrikeEnvelope(float timeSinceStrike,float duration,float seed){float env=flashEnvelope(timeSinceStrike,duration*0.7);if(hash11(seed*7.7)>0.7){float restrike1=flashEnvelope(timeSinceStrike-duration*0.5,duration*0.3);env=max(env,restrike1*0.6);}if(hash11(seed*11.3)>0.85){float restrike2=flashEnvelope(timeSinceStrike-duration*0.75,duration*0.2);env=max(env,restrike2*0.4);}return env;}void main(){vec4 scene=texture(u_sceneTexture,v_uv);if(!u_enabled){fragColor=scene;return;}vec2 uv=v_uv;float aspect=u_resolution.x/u_resolution.y;uv.x*=aspect;float timeSinceStrike=u_time-u_lastFlashTime;float durationSec=0.8;float flash=restrikeEnvelope(timeSinceStrike,durationSec,u_strikeSeed);float afterimageDuration=durationSec*1.5;float afterimageT=clamp(timeSinceStrike/afterimageDuration,0.0,1.0);float afterimage=timeSinceStrike<0.0?0.0:(1.0-easeInSine(afterimageT));vec3 color=scene.rgb;if(flash>0.01||afterimage>0.01){vec2 strikeHash=hash22(vec2(u_strikeSeed*123.456,u_strikeSeed*789.012));vec2 boltStart=vec2((0.3+strikeHash.x*0.4)*aspect,1.05);vec2 boltEnd=vec2(boltStart.x+(strikeHash.x-0.5)*0.4,-0.05);float straightDist=distToSegment(uv,boltStart,boltEnd);float sourceGlow=exp(-length(uv-boltStart)*3.0);color+=vec3(0.4,0.45,0.6)*sourceGlow*afterimage*0.3;float distLimit=0.18+u_branchDensity*0.25+u_flashIntensity*0.05;float feather=0.08;float region=1.0-smoothstep(distLimit-feather,distLimit,straightDist);if(region<=0.0005){fragColor=vec4(color,scene.a);return;}float displacementAmt=0.15;float mainDist=mainBoltDistance(uv,boltStart,boltEnd,u_strikeSeed,displacementAmt);vec2 branchResult=branchesDistance(uv,boltStart,boltEnd,u_strikeSeed,displacementAmt,u_branchDensity);float branchDist=branchResult.x;float branchBrightness=branchResult.y;float mainThickness=mix(0.2,1.0,easeOutSine(sqrt(max(flash,0.0))));vec3 afterglowColor=vec3(0.5,0.45,0.7);vec3 mainCore=lightningGlow(mainDist,easeOutQuad(max(flash,0.0)),u_flashIntensity,mainThickness);float mainAfterglowDist=mainDist*0.6;float mainAfterglowStrength=exp(-mainAfterglowDist*50.0)*afterimage*0.5;vec3 mainAfterglow=afterglowColor*mainAfterglowStrength;float branchThickness=mix(0.15,1.0,easeOutSine(max(flash,0.0)));vec3 branchCore=lightningGlow(branchDist,branchBrightness*easeOutQuad(max(flash,0.0)),u_flashIntensity,branchThickness);float branchAfterglowDist=branchDist*0.7;float branchAfterglowStrength=exp(-branchAfterglowDist*80.0)*branchBrightness*afterimage*0.4;vec3 branchAfterglow=afterglowColor*branchAfterglowStrength;color+=(mainCore+branchCore)*max(flash,0.0)*region;color+=(mainAfterglow+branchAfterglow)*afterimage*region;}fragColor=vec4(color,scene.a);}`,le=`#version 300 es\nprecision highp float;in vec2 v_uv;out vec4 fragColor;uniform float u_time;uniform vec2 u_resolution;uniform sampler2D u_sceneTexture;uniform float u_intensity;uniform int u_layers;uniform float u_fallSpeed;uniform float u_windSpeed;uniform float u_windAngle;uniform float u_turbulence;uniform float u_drift;uniform float u_flutter;uniform float u_windShear;uniform float u_flakeSize;uniform float u_sizeVariation;uniform float u_opacity;uniform float u_glowAmount;uniform float u_sparkle;\n#define PI 3.14159265359\n#define MAX_LAYERS 6\nfloat hash12(vec2 p){vec3 p3=fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}vec2 hash22(vec2 p){vec3 p3=fract(vec3(p.xyx)*vec3(0.1031,0.1030,0.0973));p3+=dot(p3,p3.yzx+33.33);return fract((p3.xx+p3.yz)*p3.zy);}float noise(vec2 p){vec2 i=floor(p);vec2 f=fract(p);f=f*f*(3.0-2.0*f);float a=hash12(i);float b=hash12(i+vec2(1.0,0.0));float c=hash12(i+vec2(0.0,1.0));float d=hash12(i+vec2(1.0,1.0));return mix(mix(a,b,f.x),mix(c,d,f.x),f.y);}vec2 rotate2D(vec2 p,float angle){float c=cos(angle);float s=sin(angle);return vec2(p.x*c-p.y*s,p.x*s+p.y*c);}float snowflakeShape(vec2 uv,float size,float seed,float rotation){vec2 rotatedUV=rotate2D(uv,rotation);float dist=length(rotatedUV);float circle=smoothstep(size,size*0.3,dist);float angle=atan(rotatedUV.y,rotatedUV.x);float hexPattern=0.5+0.5*cos(angle*6.0);hexPattern=pow(hexPattern,2.0);float crystalAmount=smoothstep(0.02,0.05,size)*0.3;float shape=mix(circle,circle*(0.7+hexPattern*0.3),crystalAmount);float glow=exp(-dist*dist/(size*size*3.0))*u_glowAmount;return shape+glow*0.4;}vec2 getWind(float layerDepth){vec2 baseWind=vec2(cos(u_windAngle),0.0)*u_windSpeed;float windResponse=mix(0.3,1.0,1.0-layerDepth);float shearResponse=1.0+u_windShear*(1.0-layerDepth)*0.35;return baseWind*windResponse*shearResponse;}float sparkle(vec2 cellId,float time,float seed){float sparklePhase=hash12(cellId+vec2(seed*100.0,0.0))*100.0;float sparkleFreq=2.0+hash12(cellId+vec2(0.0,seed*100.0))*3.0;float sparkleWave=sin(time*sparkleFreq+sparklePhase);float sparkleIntensity=pow(max(0.0,sparkleWave),16.0);float sparkleProbability=hash12(cellId+vec2(floor(time*0.5),0.0));sparkleIntensity*=step(0.85,sparkleProbability);return sparkleIntensity*u_sparkle;}vec3 snowLayer(vec2 uv,float time,float layerIndex,float totalLayers){float depth=layerIndex/max(1.0,totalLayers-1.0);float layerScale=mix(8.0,40.0,depth);float layerSpeed=u_fallSpeed*mix(1.2,0.4,depth);float layerDensity=u_intensity*mix(1.0,0.5,depth);float layerFlakeSize=u_flakeSize*mix(1.5,0.3,depth);float layerOpacity=u_opacity*mix(1.0,0.4,depth);vec2 layerOffset=vec2(sin(layerIndex*73.156)*10.0,cos(layerIndex*37.842)*10.0);vec2 p=(uv+layerOffset)*layerScale;p.y+=time*layerSpeed*2.0;vec2 baseWind=getWind(depth);p.x+=time*baseWind.x*0.3;vec2 id=floor(p);vec2 gv=fract(p)-0.5;float snow=0.0;float sparkleAccum=0.0;for(int y=-1;y<=1;y++){for(int x=-1;x<=1;x++){vec2 offs=vec2(float(x),float(y));vec2 cellId=id+offs;float h1=hash12(cellId);vec2 h2=hash22(cellId);float h3=hash12(cellId+vec2(127.0,311.0));float h4=hash12(cellId+vec2(271.0,183.0));if(h1>layerDensity)continue;float sizeVar=1.0+(h3-0.5)*u_sizeVariation;float size=layerFlakeSize*sizeVar*0.04;vec2 flakePos=h2*0.8-0.4;float flutterPhase=h3*PI*2.0;float flutterAmp=u_flutter*0.15*(1.0-depth);flakePos.x+=sin(time*3.0+flutterPhase)*flutterAmp;flakePos.y+=cos(time*2.5+flutterPhase*1.3)*flutterAmp*0.5;float driftPhase=h4*PI*2.0+layerIndex*1.7;flakePos.x+=sin(time*0.55+driftPhase)*u_drift*0.18;float turbFreq=0.6+u_turbulence*1.4;vec2 turb=vec2(noise(cellId*0.17+time*turbFreq),noise(cellId.yx*0.17+time*turbFreq+17.0))-0.5;flakePos+=turb*(u_turbulence*0.22)*(1.0-depth);vec2 localUV=gv-offs-flakePos;float rotationSpeed=(1.5-sizeVar*0.5)*(0.5+h4*1.0);float rotationPhase=h4*PI*2.0;float rotation=time*rotationSpeed+rotationPhase;float flake=snowflakeShape(localUV,size,h1,rotation);float flakeSparkle=sparkle(cellId,time,h1)*flake;sparkleAccum+=flakeSparkle;snow+=flake*layerOpacity;}}return vec3(snow,sparkleAccum,depth);}void main(){vec4 scene=texture(u_sceneTexture,v_uv);vec2 uv=v_uv;float aspect=u_resolution.x/u_resolution.y;uv.x*=aspect;float snow=0.0;float totalSparkle=0.0;for(int i=u_layers-1;i>=0;i--){vec3 layerResult=snowLayer(uv,u_time,float(i),float(u_layers));snow+=layerResult.x;totalSparkle+=layerResult.y;}snow=clamp(snow,0.0,1.0);totalSparkle=clamp(totalSparkle,0.0,1.0);vec3 snowColor=vec3(0.75,0.78,0.85);vec3 sparkleColor=vec3(0.9,0.92,1.0);vec3 color=scene.rgb+snowColor*snow+sparkleColor*totalSparkle;fragColor=vec4(color,scene.a);}`,ue=`#version 300 es\nprecision highp float;in vec2 v_uv;out vec4 fragColor;uniform sampler2D u_sceneTexture;uniform float u_time;uniform vec2 u_resolution;uniform float u_timeOfDay;uniform vec2 u_sunPos;uniform float u_sunVisible;uniform float u_lastFlashTime;uniform float u_strikeSeed;uniform float u_lightningSceneIllumination;uniform bool u_postEnabled;uniform float u_haze;uniform float u_hazeHorizon;uniform float u_hazeDesaturation;uniform float u_hazeContrast;uniform float u_bloomIntensity;uniform float u_bloomThreshold;uniform float u_bloomKnee;uniform float u_bloomRadius;uniform float u_bloomTapScale;uniform float u_exposureIntensity;uniform float u_exposureDesaturation;uniform float u_exposureRecovery;uniform float u_godRayIntensity;uniform float u_godRayDecay;uniform float u_godRayDensity;uniform float u_godRayWeight;uniform int u_godRaySamples;\n#define PI 3.14159265359\n#define GODRAY_MAX_SAMPLES 32\nfloat saturate(float x){return clamp(x,0.0,1.0);}float luminance(vec3 c){return dot(c,vec3(0.299,0.587,0.114));}float easeOutSine(float t){return sin(t*PI*0.5);}float easeInSine(float t){return 1.0-cos(t*PI*0.5);}float easeInOutSine(float t){return-(cos(PI*t)-1.0)*0.5;}float easeOutQuad(float t){return 1.0-(1.0-t)*(1.0-t);}float easeOutCubic(float t){float inv=1.0-t;return 1.0-inv*inv*inv;}float hash11(float p){p=fract(p*0.1031);p*=p+33.33;p*=p+p;return fract(p);}float flashEnvelope(float timeSinceStrike,float duration){if(timeSinceStrike<0.0||timeSinceStrike>duration)return 0.0;float t=timeSinceStrike/duration;float attackT=clamp(t/0.03,0.0,1.0);float attack=easeOutCubic(attackT);float sustainT=clamp((t-0.05)/0.65,0.0,1.0);float sustain=1.0-easeInOutSine(sustainT);float decay=exp(-t*2.0);decay=mix(decay,easeOutSine(1.0-t),0.3);float endT=clamp((t-0.75)/0.25,0.0,1.0);float endFade=1.0-easeInSine(endT);return attack*max(sustain,decay*0.4)*endFade;}float restrikeEnvelope(float timeSinceStrike,float duration,float seed){float env=flashEnvelope(timeSinceStrike,duration*0.7);if(hash11(seed*7.7)>0.7){float restrike1=flashEnvelope(timeSinceStrike-duration*0.5,duration*0.3);env=max(env,restrike1*0.6);}if(hash11(seed*11.3)>0.85){float restrike2=flashEnvelope(timeSinceStrike-duration*0.75,duration*0.2);env=max(env,restrike2*0.4);}return env;}float getSunAltitudeFromTimeOfDay(float timeOfDay){float sunAlt=timeOfDay<0.5?timeOfDay*2.0:2.0-timeOfDay*2.0;return sunAlt*2.0-1.0;}vec3 applyHaze(vec3 color,vec2 uv){float haze=saturate(u_haze);if(haze<=0.0001)return color;float horizon=pow(1.0-uv.y,1.8);float hazeWeight=haze*mix(1.0,horizon,saturate(u_hazeHorizon));float sunAlt=getSunAltitudeFromTimeOfDay(u_timeOfDay);float daylight=smoothstep(-0.12,0.1,sunAlt);vec3 hazeDay=vec3(0.60,0.70,0.85);vec3 hazeNight=vec3(0.06,0.07,0.10);vec3 hazeColor=mix(hazeNight,hazeDay,daylight);color=mix(color,hazeColor,hazeWeight*0.55);float contrast=saturate(1.0-hazeWeight*saturate(u_hazeContrast));color=mix(vec3(0.5),color,contrast);float gray=luminance(color);float sat=saturate(1.0-hazeWeight*saturate(u_hazeDesaturation));color=mix(vec3(gray),color,sat);return color;}vec3 bloomTap(vec2 uv){vec3 c=texture(u_sceneTexture,clamp(uv,0.0,1.0)).rgb;float l=luminance(c);float knee=max(0.0001,u_bloomKnee);float m=smoothstep(u_bloomThreshold,u_bloomThreshold+knee,l);return c*m;}vec3 computeBloom(vec2 uv){float intensity=u_bloomIntensity;if(intensity<=0.0001)return vec3(0.0);vec2 texel=1.0/max(u_resolution,vec2(1.0));float radiusPx=max(0.0,u_bloomRadius)*(u_resolution.y*0.02);radiusPx*=max(0.25,u_bloomTapScale);vec2 d=texel*radiusPx;vec3 sum=vec3(0.0);sum+=bloomTap(uv)*0.20;sum+=bloomTap(uv+vec2(d.x,0.0))*0.12;sum+=bloomTap(uv+vec2(-d.x,0.0))*0.12;sum+=bloomTap(uv+vec2(0.0,d.y))*0.12;sum+=bloomTap(uv+vec2(0.0,-d.y))*0.12;sum+=bloomTap(uv+vec2(d.x,d.y))*0.08;sum+=bloomTap(uv+vec2(-d.x,d.y))*0.08;sum+=bloomTap(uv+vec2(d.x,-d.y))*0.08;sum+=bloomTap(uv+vec2(-d.x,-d.y))*0.08;return sum*intensity;}vec3 applyExposureResponse(vec3 color,float flashStrength){if(flashStrength<=0.0001)return color;float t=saturate(flashStrength);float gain=1.0+flashStrength*2.2;vec3 lifted=color*gain;vec3 tonemapped=1.0-exp(-lifted);vec3 outColor=mix(color,tonemapped,t);float gray=luminance(outColor);float desat=saturate(u_exposureDesaturation)*t;outColor=mix(outColor,vec3(gray),desat);outColor=mix(outColor,vec3(1.0),t*0.06);return outColor;}vec3 computeGodRays(vec2 uv){if(u_godRayIntensity<=0.0001)return vec3(0.0);if(u_godRaySamples<=0)return vec3(0.0);if(u_sunVisible<=0.001)return vec3(0.0);float sunAlt=getSunAltitudeFromTimeOfDay(u_timeOfDay);float daylight=smoothstep(-0.12,0.1,sunAlt);float lowSun=1.0-smoothstep(0.25,0.75,max(0.0,sunAlt));vec2 sunUV=clamp(u_sunPos,vec2(-0.25),vec2(1.25));vec2 delta=(uv-sunUV)*(u_godRayDensity/float(u_godRaySamples));vec2 coord=uv;float illuminationDecay=1.0;float accum=0.0;for(int i=0;i<GODRAY_MAX_SAMPLES;i++){if(i>=u_godRaySamples)break;coord-=delta;vec4 s=texture(u_sceneTexture,clamp(coord,0.0,1.0));float transmittance=1.0-saturate(s.a);float sampleLum=luminance(s.rgb);float brightMask=saturate((sampleLum-0.85)/0.15);brightMask*=brightMask;float raySample=transmittance*brightMask;accum+=raySample*illuminationDecay*u_godRayWeight;illuminationDecay*=u_godRayDecay;}vec3 rayColor=mix(vec3(0.7,0.72,0.8),vec3(1.0,0.92,0.75),daylight);float intensity=u_godRayIntensity*saturate(u_sunVisible)*daylight*lowSun;return rayColor*accum*intensity;}void main(){vec4 scene=texture(u_sceneTexture,v_uv);vec3 color=scene.rgb;if(!u_postEnabled){fragColor=vec4(color,1.0);return;}color+=computeGodRays(v_uv);color+=computeBloom(v_uv);float flashStrength=0.0;if(u_exposureIntensity>0.0001){float timeSinceStrike=u_time-u_lastFlashTime;float durationSec=0.8;float f=restrikeEnvelope(timeSinceStrike,durationSec,u_strikeSeed);float afterimageDuration=durationSec*1.5;float afterT=clamp((timeSinceStrike*max(0.05,u_exposureRecovery))/afterimageDuration,0.0,1.0);float afterimage=timeSinceStrike<0.0?0.0:(1.0-easeInSine(afterT));float sceneFlash=f*max(0.0,u_lightningSceneIllumination);color+=vec3(0.3,0.32,0.4)*sceneFlash;flashStrength=f*u_exposureIntensity;flashStrength=max(flashStrength,afterimage*u_exposureIntensity*0.12);color=applyExposureResponse(color,flashStrength);}color=applyHaze(color,v_uv);fragColor=vec4(clamp(color,0.0,1.0),1.0);}`;function pe(e,t,a){if(e.isContextLost())return null;let n=e.createShader(t);if(!n)return null;if(e.shaderSource(n,a),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS)){let s=e.getShaderInfoLog(n);if(!e.isContextLost()){let c=t===e.VERTEX_SHADER?\"vertex\":t===e.FRAGMENT_SHADER?\"fragment\":String(t);console.error(`Shader compile error (${c}):`,s??\"(no info log)\")}return e.deleteShader(n),null}return n}function B(e,t,a){if(e.isContextLost())return null;let n=pe(e,e.VERTEX_SHADER,t),s=pe(e,e.FRAGMENT_SHADER,a);if(!n||!s)return n&&e.deleteShader(n),s&&e.deleteShader(s),null;let c=e.createProgram();if(!c)return e.deleteShader(n),e.deleteShader(s),null;if(e.attachShader(c,n),e.attachShader(c,s),e.linkProgram(c),!e.getProgramParameter(c,e.LINK_STATUS)){let l=e.getProgramInfoLog(c);return e.isContextLost()||console.error(\"Program link error:\",l??\"(no info log)\"),e.deleteProgram(c),e.deleteShader(n),e.deleteShader(s),null}return e.detachShader(c,n),e.detachShader(c,s),e.deleteShader(n),e.deleteShader(s),c}function ce(e,t,a){let n=e.createTexture();if(!n)return null;e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,a,0,e.RGBA,e.UNSIGNED_BYTE,null),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);let s=e.createFramebuffer();if(!s)return e.deleteTexture(n),null;e.bindFramebuffer(e.FRAMEBUFFER,s),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0);let c=e.checkFramebufferStatus(e.FRAMEBUFFER);return c!==e.FRAMEBUFFER_COMPLETE?(e.isContextLost()||console.error(\"Framebuffer incomplete:\",c),e.deleteFramebuffer(s),e.deleteTexture(n),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null),null):(e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null),{fbo:s,texture:n,width:t,height:a})}function fe(e,t,a,n){t.width===a&&t.height===n||(e.bindTexture(e.TEXTURE_2D,t.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,a,n,0,e.RGBA,e.UNSIGNED_BYTE,null),e.bindTexture(e.TEXTURE_2D,null),t.width=a,t.height=n)}function J(e,t,a){let n=Math.max(0,Math.min(1,(a-e)/(t-e)));return n*n*(3-2*n)}function Se(e){let t=e.timeOfDay,a=e.celestialY,n=-.25,s=J(.18,.32,t),c=J(.68,.82,t),l=s*(1-c),o=n+(a-n)*l,r=J(.74,.88,t),i=1-J(.12,.26,t),h=Math.max(r,i),f=n+(a-n)*h,p=l>h,b=p?o:f,R=p?e.sunSize:e.moonSize,C=p?Math.min(1,e.sunGlowIntensity*.3)*l:Math.min(.5,e.moonGlowIntensity*.15)*h;return{sunY:o,moonY:f,sunVisible:l,moonVisible:h,activeY:b,activeSize:R,activeBrightness:C}}function Z(e,t,a,n,s){e.bindFramebuffer(e.FRAMEBUFFER,a.fbo),e.viewport(0,0,n,s),e.useProgram(t)}function K(e,t,a,n){e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,a),e.uniform1i(n(t,\"u_sceneTexture\"),0)}function ve(e,t,a,n){e.bindFramebuffer(e.FRAMEBUFFER,t.fbo),e.viewport(0,0,a,n),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)}function be({gl:e,program:t,target:a,displayWidth:n,displayHeight:s,time:c,params:l,moonTexture:o,moonTextureLoaded:r,getUniformLocation:i}){Z(e,t,a,n,s),e.uniform1f(i(t,\"u_time\"),c),e.uniform2f(i(t,\"u_resolution\"),n,s),e.uniform1f(i(t,\"u_timeOfDay\"),l.timeOfDay),e.uniform1f(i(t,\"u_moonPhase\"),l.moonPhase),e.uniform1f(i(t,\"u_starDensity\"),l.starDensity),e.uniform2f(i(t,\"u_celestialPos\"),l.celestialX,l.celestialY),e.uniform1f(i(t,\"u_sunSize\"),l.sunSize),e.uniform1f(i(t,\"u_moonSize\"),l.moonSize),e.uniform1f(i(t,\"u_sunGlowIntensity\"),l.sunGlowIntensity),e.uniform1f(i(t,\"u_sunGlowSize\"),l.sunGlowSize),e.uniform1f(i(t,\"u_sunRayCount\"),l.sunRayCount),e.uniform1f(i(t,\"u_sunRayLength\"),l.sunRayLength),e.uniform1f(i(t,\"u_sunRayIntensity\"),l.sunRayIntensity),e.uniform1f(i(t,\"u_sunRayShimmer\"),l.sunRayShimmer),e.uniform1f(i(t,\"u_sunRayShimmerSpeed\"),l.sunRayShimmerSpeed),e.uniform1f(i(t,\"u_moonGlowIntensity\"),l.moonGlowIntensity),e.uniform1f(i(t,\"u_moonGlowSize\"),l.moonGlowSize),e.uniform1f(i(t,\"u_skyBrightness\"),l.skyBrightness),e.uniform1f(i(t,\"u_skySaturation\"),l.skySaturation),e.uniform1f(i(t,\"u_skyContrast\"),l.skyContrast),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,o),e.uniform1i(i(t,\"u_moonTexture\"),0),e.uniform1i(i(t,\"u_hasMoonTexture\"),r?1:0),e.drawArrays(e.TRIANGLES,0,6)}function we({gl:e,program:t,target:a,sceneTexture:n,displayWidth:s,displayHeight:c,time:l,params:o,celestial:r,getUniformLocation:i}){Z(e,t,a,s,c),K(e,t,n,i),e.uniform1f(i(t,\"u_time\"),l),e.uniform2f(i(t,\"u_resolution\"),s,c),e.uniform1f(i(t,\"u_timeOfDay\"),r.timeOfDay),e.uniform1f(i(t,\"u_coverage\"),o.coverage),e.uniform1f(i(t,\"u_density\"),o.density),e.uniform1f(i(t,\"u_softness\"),o.softness),e.uniform1f(i(t,\"u_windSpeed\"),o.windSpeed),e.uniform1f(i(t,\"u_windAngle\"),o.windAngle),e.uniform1f(i(t,\"u_turbulence\"),o.turbulence),e.uniform1f(i(t,\"u_lightIntensity\"),o.lightIntensity),e.uniform1f(i(t,\"u_ambientDarkness\"),o.ambientDarkness),e.uniform1i(i(t,\"u_numLayers\"),o.numLayers),e.uniform1f(i(t,\"u_cloudScale\"),o.cloudScale);let h=Se(r);e.uniform2f(i(t,\"u_celestialPos\"),r.celestialX,h.activeY),e.uniform1f(i(t,\"u_celestialSize\"),h.activeSize),e.uniform1f(i(t,\"u_celestialBrightness\"),h.activeBrightness),e.uniform1f(i(t,\"u_backlightIntensity\"),o.backlightIntensity),e.drawArrays(e.TRIANGLES,0,6)}function xe({gl:e,program:t,target:a,sceneTexture:n,displayWidth:s,displayHeight:c,time:l,params:o,interactions:r,getUniformLocation:i}){Z(e,t,a,s,c),K(e,t,n,i),e.uniform1f(i(t,\"u_time\"),l),e.uniform2f(i(t,\"u_resolution\"),s,c),e.uniform1f(i(t,\"u_glassIntensity\"),o.glassIntensity),e.uniform1f(i(t,\"u_glassZoom\"),o.glassZoom),e.uniform1f(i(t,\"u_fallingIntensity\"),o.fallingIntensity),e.uniform1f(i(t,\"u_fallingSpeed\"),o.fallingSpeed),e.uniform1f(i(t,\"u_fallingAngle\"),o.fallingAngle),e.uniform1f(i(t,\"u_fallingStreakLength\"),o.fallingStreakLength),e.uniform1i(i(t,\"u_fallingLayers\"),o.fallingLayers),e.uniform1f(i(t,\"u_refractionStrength\"),r.rainRefractionStrength),e.drawArrays(e.TRIANGLES,0,6)}function Ie(e,t,a,n,s){if(!e.lightning||!a||!t.enabled)return!1;let l=.8*1.5,o=n-s;return o>=0&&o<=l}function Re({gl:e,program:t,target:a,sceneTexture:n,displayWidth:s,displayHeight:c,time:l,params:o,interactions:r,lastFlashTime:i,strikeSeed:h,getUniformLocation:f}){Z(e,t,a,s,c),K(e,t,n,f),e.uniform1f(f(t,\"u_time\"),l),e.uniform2f(f(t,\"u_resolution\"),s,c),e.uniform1i(f(t,\"u_enabled\"),o.enabled?1:0),e.uniform1f(f(t,\"u_flashIntensity\"),o.flashIntensity),e.uniform1f(f(t,\"u_branchDensity\"),o.branchDensity),e.uniform1f(f(t,\"u_sceneIllumination\"),r.lightningSceneIllumination),e.uniform1f(f(t,\"u_lastFlashTime\"),i),e.uniform1f(f(t,\"u_strikeSeed\"),h),e.drawArrays(e.TRIANGLES,0,6)}function ke({gl:e,program:t,target:a,sceneTexture:n,displayWidth:s,displayHeight:c,time:l,params:o,getUniformLocation:r}){Z(e,t,a,s,c),K(e,t,n,r),e.uniform1f(r(t,\"u_time\"),l),e.uniform2f(r(t,\"u_resolution\"),s,c),e.uniform1f(r(t,\"u_intensity\"),o.intensity),e.uniform1i(r(t,\"u_layers\"),o.layers),e.uniform1f(r(t,\"u_fallSpeed\"),o.fallSpeed),e.uniform1f(r(t,\"u_windSpeed\"),o.windSpeed),e.uniform1f(r(t,\"u_windAngle\"),o.windAngle),e.uniform1f(r(t,\"u_turbulence\"),o.turbulence),e.uniform1f(r(t,\"u_drift\"),o.drift),e.uniform1f(r(t,\"u_flutter\"),o.flutter),e.uniform1f(r(t,\"u_windShear\"),o.windShear),e.uniform1f(r(t,\"u_flakeSize\"),o.flakeSize),e.uniform1f(r(t,\"u_sizeVariation\"),o.sizeVariation),e.uniform1f(r(t,\"u_opacity\"),o.opacity),e.uniform1f(r(t,\"u_glowAmount\"),o.glowAmount),e.uniform1f(r(t,\"u_sparkle\"),o.sparkle),e.drawArrays(e.TRIANGLES,0,6)}function _e({gl:e,program:t,sceneTexture:a,displayWidth:n,displayHeight:s,time:c,celestial:l,interactions:o,post:r,lastFlashTime:i,strikeSeed:h,getUniformLocation:f}){e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,n,s),e.useProgram(t),K(e,t,a,f),e.uniform1f(f(t,\"u_time\"),c),e.uniform2f(f(t,\"u_resolution\"),n,s),e.uniform1f(f(t,\"u_timeOfDay\"),l.timeOfDay);let p=Se(l);e.uniform2f(f(t,\"u_sunPos\"),l.celestialX,p.sunY),e.uniform1f(f(t,\"u_sunVisible\"),p.sunVisible),e.uniform1f(f(t,\"u_lastFlashTime\"),i),e.uniform1f(f(t,\"u_strikeSeed\"),h),e.uniform1f(f(t,\"u_lightningSceneIllumination\"),o.lightningSceneIllumination),e.uniform1i(f(t,\"u_postEnabled\"),r.enabled?1:0),e.uniform1f(f(t,\"u_haze\"),r.haze),e.uniform1f(f(t,\"u_hazeHorizon\"),r.hazeHorizon),e.uniform1f(f(t,\"u_hazeDesaturation\"),r.hazeDesaturation),e.uniform1f(f(t,\"u_hazeContrast\"),r.hazeContrast),e.uniform1f(f(t,\"u_bloomIntensity\"),r.bloomIntensity),e.uniform1f(f(t,\"u_bloomThreshold\"),r.bloomThreshold),e.uniform1f(f(t,\"u_bloomKnee\"),r.bloomKnee),e.uniform1f(f(t,\"u_bloomRadius\"),r.bloomRadius),e.uniform1f(f(t,\"u_bloomTapScale\"),r.bloomTapScale),e.uniform1f(f(t,\"u_exposureIntensity\"),r.exposureIntensity),e.uniform1f(f(t,\"u_exposureDesaturation\"),r.exposureDesaturation),e.uniform1f(f(t,\"u_exposureRecovery\"),r.exposureRecovery),e.uniform1f(f(t,\"u_godRayIntensity\"),r.godRayIntensity),e.uniform1f(f(t,\"u_godRayDecay\"),r.godRayDecay),e.uniform1f(f(t,\"u_godRayDensity\"),r.godRayDensity),e.uniform1f(f(t,\"u_godRayWeight\"),r.godRayWeight),e.uniform1i(f(t,\"u_godRaySamples\"),Math.max(0,Math.min(32,Math.floor(r.godRaySamples)))),e.drawArrays(e.TRIANGLES,0,6)}function Ce(e){let t=v(null),a=v(null),n=v(0),s=v(0),c=v(-100),l=v(0),o=v(0),r=v(null),i=v(!1),h=v(null),f=v(new WeakMap),p=v(!1),b=v(!1),R=v(!1),C=v(!1),A=v(null),k=v(e);k.current=e;let w=v({celestial:null,cloud:null,rain:null,lightning:null,snow:null,composite:null}),T=v({a:null,b:null}),Q=N((d,u,y)=>{let g=f.current.get(u);g||(g=new Map,f.current.set(u,g));let m=g.get(y);if(m!==void 0)return m;let E=d.getUniformLocation(u,y);return g.set(y,E),E},[]),U=N(()=>{n.current&&(cancelAnimationFrame(n.current),n.current=0),b.current=!1},[]),$=N(d=>{d&&A.current&&ae(d),A.current=null},[]),G=N(()=>{U();let d=a.current,u=R.current;if(d&&!u){for(let y of Object.values(w.current))y&&d.deleteProgram(y);for(let y of[T.current.a,T.current.b])y&&(d.deleteFramebuffer(y.fbo),d.deleteTexture(y.texture));r.current&&d.deleteTexture(r.current),h.current&&d.deleteBuffer(h.current)}w.current={celestial:null,cloud:null,rain:null,lightning:null,snow:null,composite:null},T.current={a:null,b:null},r.current=null,i.current=!1,h.current=null,a.current=null,f.current=new WeakMap},[U]),z=N(({canvas:d,contextLost:u=!1,markInitFailed:y=!0,warnMessage:g,errorMessage:m})=>(u&&(R.current=!0),y&&(C.current=!0),m&&console.error(m),G(),A.current=ge(d,A.current),!1),[G]),V=N(()=>{if(C.current)return!1;let d=t.current;if(!d||A.current===!1)return!1;if(A.current===null){if(!he(d))return A.current=!1,!1;A.current=!0}G(),R.current=!1;let u=d.getContext(\"webgl2\");if(!u)return z({canvas:d,warnMessage:\"[WeatherEffectsCanvas] WebGL2 not supported; rendering without effects.\"});if(a.current=u,u.isContextLost())return z({canvas:d,contextLost:!0,markInitFailed:!1});if(w.current.celestial=B(u,O,se),w.current.cloud=B(u,O,oe),w.current.rain=B(u,O,ie),w.current.lightning=B(u,O,re),w.current.snow=B(u,O,le),w.current.composite=B(u,O,ue),!w.current.celestial||!w.current.composite)return u.isContextLost()?z({canvas:d,contextLost:!0,markInitFailed:!1}):z({canvas:d,errorMessage:\"Failed to create required WebGL programs\"});let y=k.current.dpr??window.devicePixelRatio,g=Math.max(1,Math.floor(d.clientWidth*y)),m=Math.max(1,Math.floor(d.clientHeight*y)),E=ce(u,g,m),x=ce(u,g,m);if(!E||!x)return u.isContextLost()?z({canvas:d,contextLost:!0,markInitFailed:!1}):z({canvas:d,errorMessage:\"Failed to create WebGL framebuffers\"});T.current.a=E,T.current.b=x;let I=u.createTexture();if(I){u.bindTexture(u.TEXTURE_2D,I),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,new Uint8Array([128,128,128,255])),r.current=I;let _=new Image;_.crossOrigin=\"anonymous\",_.onload=()=>{let S=a.current;!S||r.current!==I||(S.bindTexture(u.TEXTURE_2D,I),S.texImage2D(u.TEXTURE_2D,0,u.RGBA,u.RGBA,u.UNSIGNED_BYTE,_),S.generateMipmap(u.TEXTURE_2D),S.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,u.LINEAR_MIPMAP_LINEAR),S.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,u.LINEAR),S.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.REPEAT),S.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),i.current=!0)},_.src=\"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAZABkAAD/4QB0RXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAA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npxUnljO09KvtbyHHy/pSGGYcBaAKWyJRwPyFMx6Zq+YG/uH8qPJJ42H8qAKwQuMck1KEkU8jH1FTCGRfuqfyNKY58520AMXOeTj6UpJXlSc0FJP7lO2SY+7QBNHdNHx14xzQ8xcj+QqHy5M5CU0pJ0xQA7gnBJNAWTPXApojkqQIR97NAFhfMUD5qP3hPbBquQxOQDT18wHjNAEwtmPJOakMLnHPSoC7Be9O+0MBhQ35UAPMORnPIqJkYnnOKDNIeMH8qZh2GDmgBCWH3CRVciVyScmrGxsYCZ/OmhJgfu4oArmEvxnn3pHtXPIq7sk/u0bZP4hmgDIktmAwCTTxEQowea0jHnquKhMGTwpIoAriNjyPzqU71Xb94elPMD54WgRygcjNAEId8bPuimBFJzzmrDRyN/CfwpFidf4TQA9RvXYfzqm9qoyODV8L/ALJpfKJOQMUAf//Z\"}let P=new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),L=u.createBuffer();if(!L)return u.isContextLost()?z({canvas:d,contextLost:!0,markInitFailed:!1}):z({canvas:d,errorMessage:\"Failed to create WebGL buffer\"});h.current=L,u.bindBuffer(u.ARRAY_BUFFER,L),u.bufferData(u.ARRAY_BUFFER,P,u.STATIC_DRAW);for(let _ of Object.values(w.current)){if(!_)continue;let S=u.getAttribLocation(_,\"a_position\");S>=0&&(u.enableVertexAttribArray(S),u.vertexAttribPointer(S,2,u.FLOAT,!1,0,0))}return s.current=performance.now(),!0},[G,z]),F=N(()=>{let d=a.current,u=t.current,y=w.current,g=T.current,m=k.current;if(R.current||!p.current){b.current=!1,n.current=0;return}if(!d||!u||!g.a||!g.b){b.current=!1;return}let E=m.dpr??window.devicePixelRatio,x=Math.max(1,Math.floor(u.clientWidth*E)),I=Math.max(1,Math.floor(u.clientHeight*E));(u.width!==x||u.height!==I)&&(u.width=x,u.height=I,fe(d,g.a,x,I),fe(d,g.b,x,I));let P=(performance.now()-s.current)/1e3,L=(ne,$e)=>Q(d,ne,$e);m.layers.lightning&&m.lightning.enabled&&m.lightning.autoMode&&P>=l.current&&(c.current=P,o.current=Math.random(),l.current=P+m.lightning.autoInterval*(.5+Math.random()));let _=g.a,S=g.b,X=()=>{let ne=_;_=S,S=ne};m.layers.celestial&&y.celestial?(be({gl:d,program:y.celestial,target:S,displayWidth:x,displayHeight:I,time:P,params:m.celestial,moonTexture:r.current,moonTextureLoaded:i.current,getUniformLocation:L}),X()):(ve(d,S,x,I),X()),m.layers.clouds&&y.cloud&&(we({gl:d,program:y.cloud,target:S,sceneTexture:_.texture,displayWidth:x,displayHeight:I,time:P,params:m.cloud,celestial:m.celestial,getUniformLocation:L}),X()),m.layers.rain&&y.rain&&(xe({gl:d,program:y.rain,target:S,sceneTexture:_.texture,displayWidth:x,displayHeight:I,time:P,params:m.rain,interactions:m.interactions,getUniformLocation:L}),X()),Ie(m.layers,m.lightning,y.lightning,P,c.current)&&y.lightning&&(Re({gl:d,program:y.lightning,target:S,sceneTexture:_.texture,displayWidth:x,displayHeight:I,time:P,params:m.lightning,interactions:m.interactions,lastFlashTime:c.current,strikeSeed:o.current,getUniformLocation:L}),X()),m.layers.snow&&y.snow&&(ke({gl:d,program:y.snow,target:S,sceneTexture:_.texture,displayWidth:x,displayHeight:I,time:P,params:m.snow,getUniformLocation:L}),X()),y.composite&&_e({gl:d,program:y.composite,sceneTexture:_.texture,displayWidth:x,displayHeight:I,time:P,celestial:m.celestial,interactions:m.interactions,post:m.post,lastFlashTime:c.current,strikeSeed:o.current,getUniformLocation:L}),p.current&&!R.current?(b.current=!0,n.current=requestAnimationFrame(F)):(b.current=!1,n.current=0)},[Q]);return Ke(()=>{let d=t.current;if(!d)return;let u=m=>{m.preventDefault(),R.current=!0,G()},y=()=>{R.current=!1,C.current=!1,V()&&p.current&&(b.current=!0,F())};d.addEventListener(\"webglcontextlost\",u,{passive:!1}),d.addEventListener(\"webglcontextrestored\",y);let g=typeof IntersectionObserver<\"u\"?new IntersectionObserver(m=>{let x=!!m[0]?.isIntersecting;if(p.current=x,!x){U(),G(),$(d);return}!b.current&&!R.current&&(a.current&&T.current.a&&T.current.b||V())&&(b.current=!0,F())},{threshold:0}):null;return g?g.observe(d):p.current=!0,!g&&V()&&p.current&&(b.current=!0,F()),()=>{g?.disconnect(),d.removeEventListener(\"webglcontextlost\",u),d.removeEventListener(\"webglcontextrestored\",y),G(),$(d)}},[G,V,$,F,U]),t}var De={celestial:!0,clouds:!0,rain:!1,lightning:!1,snow:!1},Te={timeOfDay:.5,moonPhase:.5,starDensity:.5,celestialX:.74,celestialY:.78,sunSize:.14,moonSize:.17,sunGlowIntensity:3.05,sunGlowSize:.3,sunRayCount:6,sunRayLength:3,sunRayIntensity:.1,sunRayShimmer:1,sunRayShimmerSpeed:1,moonGlowIntensity:3.45,moonGlowSize:.94,skyBrightness:1,skySaturation:1,skyContrast:1},Pe={coverage:.5,density:.7,softness:.5,cloudScale:1,windSpeed:.3,windAngle:0,turbulence:.3,lightIntensity:1,ambientDarkness:.2,backlightIntensity:.5,numLayers:3},ze={glassIntensity:.5,glassZoom:1,fallingIntensity:.6,fallingSpeed:2,fallingAngle:.1,fallingStreakLength:1,fallingLayers:4},Ee={enabled:!1,autoMode:!0,autoInterval:8,flashIntensity:1,branchDensity:.5},Ae={intensity:.5,layers:4,fallSpeed:.6,windSpeed:.3,windAngle:.2,turbulence:.3,drift:.5,flutter:.5,windShear:.5,flakeSize:1,sizeVariation:.5,opacity:.5,glowAmount:.25,sparkle:.25},Ge={rainRefractionStrength:1,lightningSceneIllumination:.6},Le={enabled:!0,haze:0,hazeHorizon:.8,hazeDesaturation:.35,hazeContrast:.6,bloomIntensity:0,bloomThreshold:.82,bloomKnee:.35,bloomRadius:1.2,bloomTapScale:1,exposureIntensity:0,exposureDesaturation:.25,exposureRecovery:1,godRayIntensity:0,godRayDecay:.965,godRayDensity:.9,godRayWeight:.35,godRaySamples:16};function M(e,t){if(!t)return{...e};let a={...e};for(let n of Object.keys(t)){let s=t[n];s!==void 0&&(a[n]=s)}return a}function We(e){return{layers:M(De,e.layers),celestial:M(Te,e.celestial),cloud:M(Pe,e.cloud),rain:M(ze,e.rain),lightning:M(Ee,e.lightning),snow:M(Ae,e.snow),interactions:M(Ge,e.interactions),post:M(Le,e.post),dpr:e.dpr}}import{jsx as qe}from\"react/jsx-runtime\";function Fe({className:e,dpr:t,layers:a,celestial:n,cloud:s,rain:c,lightning:l,snow:o,interactions:r,post:i}){let h=Ce(We({dpr:t,layers:a,celestial:n,cloud:s,rain:c,lightning:l,snow:o,interactions:r,post:i}));return qe(\"canvas\",{ref:h,className:e,style:{width:\"100%\",height:\"100%\"}})}var de={clear:{dawn:{celestial:{celestialX:.69,skyBrightness:1,starDensity:.36,sunGlowIntensity:3.47,sunGlowSize:.49,sunRayCount:4,sunRayShimmer:5,sunRayShimmerSpeed:5},glass:{blur:4.5,brightness:.95}},dusk:{celestial:{celestialX:.69,skyBrightness:1,starDensity:.36,sunGlowIntensity:3.84,sunGlowSize:.43,sunRayCount:4,sunRayIntensity:.24,sunRayLength:1.37},glass:{brightness:.9}},midnight:{celestial:{celestialY:.71,moonGlowIntensity:3.23,moonPhase:.51,skyBrightness:.44,skyContrast:1,skySaturation:2,starDensity:1.72,sunGlowIntensity:1.59}},noon:{celestial:{celestialY:.71,moonPhase:.2421,skyBrightness:.8,skySaturation:1.9,starDensity:.14,sunGlowIntensity:1.72,sunGlowSize:.69,sunRayCount:4,sunRayIntensity:.19,sunRayShimmer:5,sunRayShimmerSpeed:5},glass:{brightness:1}}},cloudy:{dawn:{celestial:{celestialX:.69,celestialY:.74,skyBrightness:1,skyContrast:1.1,skySaturation:.88,starDensity:.36,sunGlowIntensity:2.4,sunGlowSize:.38,sunRayShimmer:5,sunRayShimmerSpeed:5},cloud:{ambientDarkness:1,backlightIntensity:1.07,cloudScale:1.73,coverage:.81,density:1.1,lightIntensity:.67,numLayers:1,softness:.42,windSpeed:.04},glass:{blur:3,brightness:.95},post:{bloomIntensity:.99,bloomKnee:.58,bloomRadius:5.5,bloomTapScale:1.39,bloomThreshold:.78,exposureIntensity:1.14,exposureRecovery:1.95,godRayDecay:.857,godRayDensity:.79,godRayIntensity:1.08,godRaySamples:121,godRayWeight:.42}},dusk:{celestial:{celestialX:.69,celestialY:.74,skyContrast:.99,skySaturation:1.38,starDensity:.11,sunGlowIntensity:3.21,sunGlowSize:.47,sunRayShimmer:5,sunRayShimmerSpeed:5},cloud:{ambientDarkness:.54,backlightIntensity:.78,cloudScale:1.73,coverage:.81,density:.9,lightIntensity:.78,numLayers:1,softness:.42,windSpeed:.04},glass:{brightness:.9},post:{bloomIntensity:1.11,bloomKnee:.58,bloomRadius:5.5,bloomTapScale:1.39,bloomThreshold:.78,exposureIntensity:1.14,exposureRecovery:1.95,godRayDecay:.857,godRayDensity:.79,godRayIntensity:1.08,godRaySamples:121,godRayWeight:.42}},midnight:{celestial:{celestialX:.74,celestialY:.71,moonGlowIntensity:3.55,moonGlowSize:.97,starDensity:1.72,sunRayShimmer:5,sunRayShimmerSpeed:5},cloud:{cloudScale:1.73,coverage:.81,density:1.02,numLayers:1,softness:.42,windSpeed:.04},post:{bloomIntensity:1.11,bloomKnee:.58,bloomRadius:5.5,bloomTapScale:1.39,bloomThreshold:.78,exposureIntensity:1.14,exposureRecovery:1.95,godRayDecay:.857,godRayDensity:.79,godRayIntensity:1.08,godRaySamples:121,godRayWeight:.42}},noon:{celestial:{celestialX:.74,celestialY:.71,moonPhase:.2421,skyBrightness:.84,skyContrast:1.31,skySaturation:1.44,starDensity:.14,sunGlowIntensity:1.35,sunGlowSize:.61,sunRayCount:4,sunRayIntensity:.22,sunRayShimmer:5,sunRayShimmerSpeed:5},cloud:{ambientDarkness:0,backlightIntensity:.45,cloudScale:1.73,coverage:.81,density:1.06,lightIntensity:.44,numLayers:1,softness:.42,windSpeed:.04},glass:{brightness:1},post:{bloomIntensity:.42,bloomKnee:.58,bloomRadius:5.5,bloomTapScale:1.39,bloomThreshold:.76,exposureIntensity:1.14,exposureRecovery:1.95,godRayDecay:.884,godRayDensity:.79,godRayIntensity:1.33,godRaySamples:121,godRayWeight:.42}}},drizzle:{dawn:{celestial:{celestialX:.69,celestialY:.74,moonGlowIntensity:3.55,moonGlowSize:.97,skyBrightness:.96,skyContrast:.84,skySaturation:.94,starDensity:1.72},cloud:{ambientDarkness:.7,backlightIntensity:.82,cloudScale:1.21,coverage:.61,density:.98,lightIntensity:0,numLayers:1,softness:.17,turbulence:.16,windSpeed:.02},glass:{brightness:.95},rain:{fallingAngle:.02,fallingIntensity:.13,fallingSpeed:2.24,fallingStreakLength:.32,glassIntensity:.29,glassZoom:.65}},dusk:{celestial:{celestialX:.69,celestialY:.74,moonGlowIntensity:3.55,moonGlowSize:.97,skyBrightness:.77,skyContrast:.84,skySaturation:.85,starDensity:1.72,sunGlowIntensity:2.73,sunRayLength:1.45},cloud:{ambientDarkness:.7,backlightIntensity:.82,cloudScale:1.21,coverage:.61,density:.98,lightIntensity:0,numLayers:1,softness:.17,turbulence:.16,windSpeed:.02},glass:{brightness:.9},rain:{fallingAngle:.02,fallingIntensity:.13,fallingSpeed:2.24,fallingStreakLength:.32,glassIntensity:.29,glassZoom:.65}},midnight:{celestial:{celestialX:.74,celestialY:.71,moonGlowIntensity:3.55,moonGlowSize:.97,skyBrightness:.77,skyContrast:.84,skySaturation:.85,starDensity:1.72,sunGlowIntensity:2.73,sunRayLength:1.45},cloud:{ambientDarkness:.7,backlightIntensity:.82,cloudScale:1.21,coverage:.61,density:.98,lightIntensity:0,numLayers:1,softness:.17,turbulence:.16,windSpeed:.02},rain:{fallingAngle:.02,fallingIntensity:.13,fallingSpeed:2.24,fallingStreakLength:.32,glassIntensity:.2,glassZoom:.5}},noon:{celestial:{celestialX:.74,celestialY:.71,moonGlowIntensity:3.55,moonGlowSize:.97,skyBrightness:.77,skyContrast:.84,skySaturation:.85,starDensity:1.72,sunGlowIntensity:2.73,sunRayLength:1.45},cloud:{ambientDarkness:.7,backlightIntensity:.82,cloudScale:1.21,coverage:.61,density:.98,lightIntensity:0,numLayers:1,softness:.17,turbulence:.16,windSpeed:.02},glass:{brightness:1},rain:{fallingAngle:.02,fallingIntensity:.13,fallingSpeed:2.24,fallingStreakLength:.32,glassIntensity:.29,glassZoom:.65}}},fog:{dawn:{celestial:{celestialY:.71,skyBrightness:1.05,skyContrast:.41,skySaturation:1.25,starDensity:.11,sunGlowIntensity:2.42,sunGlowSize:.38,sunRayIntensity:.05,sunRayLength:1.59},cloud:{ambientDarkness:1,backlightIntensity:.54,cloudScale:.64,density:1.5,numLayers:6,softness:.77,turbulence:.67,windSpeed:.02},glass:{brightness:.95}},dusk:{celestial:{celestialY:.71,skyBrightness:1.02,skyContrast:.62,skySaturation:.88,starDensity:.11,sunGlowIntensity:2.42,sunGlowSize:.38,sunRayIntensity:.05,sunRayLength:1.59},cloud:{ambientDarkness:0,backlightIntensity:.54,cloudScale:.93,numLayers:6,softness:.5,turbulence:1,windSpeed:.03},glass:{brightness:.9}},midnight:{celestial:{celestialY:.71,moonGlowIntensity:2.74,moonGlowSize:1.43,moonPhase:.5,skyBrightness:1.02,skyContrast:.62,skySaturation:.88,starDensity:.11,sunGlowIntensity:2.42,sunGlowSize:.38,sunRayIntensity:.05,sunRayLength:1.59},cloud:{ambientDarkness:0,backlightIntensity:1.4,cloudScale:.91,density:1.27,lightIntensity:2,numLayers:6,softness:.63,turbulence:.86,windSpeed:.03}},noon:{celestial:{celestialY:.71,skyBrightness:.76,skyContrast:.47,skySaturation:.6,starDensity:.11,sunGlowIntensity:.92,sunGlowSize:.84,sunRayCount:0,sunRayIntensity:0,sunRayLength:0},cloud:{ambientDarkness:1,backlightIntensity:.72,cloudScale:.83,density:1.5,numLayers:6,softness:.84,turbulence:.86,windSpeed:.03},glass:{brightness:1}}},hail:{dawn:{celestial:{celestialX:.69,celestialY:.74,skyBrightness:.42,skySaturation:.74,starDensity:.36,sunGlowIntensity:5,sunGlowSize:.36,sunRayShimmer:5,sunRayShimmerSpeed:5},cloud:{ambientDarkness:.75,backlightIntensity:.64,density:.83,lightIntensity:.55,numLayers:1,turbulence:.55,windAngle:-3.14,windSpeed:.14},glass:{brightness:.95},interactions:{rainRefractionStrength:.96},post:{bloomIntensity:.13,bloomThreshold:.64,godRayIntensity:.56,haze:.11,hazeHorizon:1},rain:{fallingIntensity:.42,fallingLayers:1,fallingSpeed:3,fallingStreakLength:.56,glassIntensity:1,glassZoom:.69},snow:{drift:.63,fallSpeed:8,flakeSize:.77,flutter:.79,glowAmount:.29,intensity:.81,layers:8,opacity:1,sizeVariation:.48,sparkle:.44,turbulence:.91,windAngle:2.23,windShear:.78,windSpeed:.99}},dusk:{celestial:{celestialX:.69,celestialY:.74,skyBrightness:.47,skyContrast:1.39,skySaturation:1.42,starDensity:.11,sunGlowIntensity:3.21,sunGlowSize:.51,sunRayShimmer:5,sunRayShimmerSpeed:5},cloud:{ambientDarkness:.75,backlightIntensity:.64,density:.83,lightIntensity:.79,numLayers:1,turbulence:.55,windAngle:-3.14,windSpeed:.14},glass:{brightness:.9},interactions:{rainRefractionStrength:.96},post:{bloomIntensity:.13,bloomThreshold:.64,godRayIntensity:.56,haze:.15,hazeHorizon:1},rain:{fallingIntensity:.42,fallingLayers:1,fallingSpeed:3,fallingStreakLength:.56,glassIntensity:.72,glassZoom:.69},snow:{drift:.63,fallSpeed:8,flakeSize:.77,flutter:.79,glowAmount:.71,intensity:.47,layers:8,opacity:1,sizeVariation:.77,sparkle:.1,turbulence:.91,windAngle:2.23,windShear:.78,windSpeed:1}},midnight:{celestial:{celestialX:.74,celestialY:.71,moonGlowIntensity:3.55,moonGlowSize:.97,skyBrightness:.42,skySaturation:.74,starDensity:1.72,sunRayShimmer:5,sunRayShimmerSpeed:5},cloud:{ambientDarkness:.75,backlightIntensity:.64,density:.83,lightIntensity:1.21,numLayers:1,turbulence:.55,windAngle:-3.14,windSpeed:.14},interactions:{rainRefractionStrength:.96},post:{bloomIntensity:.13,bloomThreshold:.64,godRayIntensity:.56,haze:.14,hazeHorizon:1},rain:{fallingIntensity:.42,fallingLayers:1,fallingSpeed:3,fallingStreakLength:.56,glassIntensity:.72,glassZoom:.69},snow:{drift:.63,fallSpeed:8,flakeSize:.77,flutter:.79,glowAmount:.71,intensity:.47,layers:8,opacity:1,sizeVariation:.85,sparkle:.1,turbulence:.87,windAngle:2.23,windShear:.78,windSpeed:1.11}},noon:{celestial:{celestialX:.74,celestialY:.71,moonPhase:.2421,skyBrightness:.56,skyContrast:1.03,skySaturation:.62,starDensity:.14,sunGlowIntensity:2.5,sunGlowSize:.54,sunRayCount:3,sunRayShimmer:5,sunRayShimmerSpeed:5},cloud:{ambientDarkness:1,backlightIntensity:.21,coverage:.74,density:.95,lightIntensity:.6,numLayers:1,softness:.36,turbulence:.55,windAngle:-3.14,windSpeed:.14},glass:{brightness:1},interactions:{rainRefractionStrength:.96},post:{bloomIntensity:.13,bloomThreshold:.64,godRayIntensity:.56,haze:.23,hazeHorizon:1},rain:{fallingIntensity:.42,fallingLayers:1,fallingSpeed:3,fallingStreakLength:.56,glassIntensity:.72,glassZoom:.69},snow:{drift:.63,fallSpeed:8,flakeSize:.77,flutter:.79,glowAmount:.71,intensity:.8,layers:8,opacity:1,sizeVariation:.77,sparkle:.1,turbulence:.91,windAngle:2.23,windShear:.78,windSpeed:.89}}},\"heavy-rain\":{dawn:{celestial:{celestialX:.69,celestialY:.74,moonGlowIntensity:3.55,moonGlowSize:.97,moonPhase:.3776,skyBrightness:.87,skySaturation:.56,starDensity:1.72,sunGlowIntensity:3.75,sunGlowSize:.43},cloud:{ambientDarkness:1,backlightIntensity:1.35,cloudScale:1.52,coverage:.53,density:1.17,lightIntensity:.06,numLayers:1,softness:.25,turbulence:.45,windSpeed:.05},glass:{brightness:.95},interactions:{rainRefractionStrength:1},post:{bloomIntensity:.36,godRayDecay:.838,godRayDensity:.56,godRayIntensity:1.11,godRaySamples:35,godRayWeight:.66,haze:.14,hazeHorizon:1},rain:{fallingAngle:.3,fallingLayers:6,fallingSpeed:3,fallingStreakLength:2,glassIntensity:.98,glassZoom:.58}},dusk:{celestial:{celestialX:.69,celestialY:.74,moonGlowIntensity:3.55,moonGlowSize:.97,moonPhase:.4115,moonSize:.17,skyBrightness:.96,skyContrast:.99,skySaturation:.72,starDensity:1.72,sunGlowIntensity:4.15,sunGlowSize:.35,sunRayCount:6,sunRayIntensity:.1,sunRayLength:3,sunSize:.14},cloud:{ambientDarkness:1,backlightIntensity:1.8,cloudScale:2.02,coverage:.72,density:.94,lightIntensity:0,numLayers:1,softness:.17,turbulence:.51,windAngle:0,windSpeed:.05},glass:{brightness:.9},interactions:{rainRefractionStrength:1},post:{bloomIntensity:.28,godRayWeight:.55,haze:.21,hazeHorizon:1},rain:{fallingAngle:.3,fallingIntensity:1,fallingLayers:6,fallingSpeed:3,fallingStreakLength:2,glassIntensity:.98,glassZoom:.58}},midnight:{celestial:{celestialX:.74,celestialY:.71,moonGlowIntensity:3.55,moonGlowSize:.97,moonPhase:.3776,moonSize:.17,skyBrightness:1.11,skyContrast:1,skySaturation:.78,starDensity:1.72,sunGlowIntensity:3.05,sunGlowSize:.3,sunRayCount:6,sunRayIntensity:.1,sunRayLength:3,sunSize:.14},cloud:{ambientDarkness:1,backlightIntensity:.81,cloudScale:2.16,coverage:.72,density:1.5,lightIntensity:0,numLayers:1,softness:.37,turbulence:.55,windAngle:0,windSpeed:.05},glass:{blur:1,brightness:1.15},interactions:{rainRefractionStrength:1},rain:{fallingAngle:.3,fallingIntensity:1,fallingLayers:6,fallingSpeed:3,fallingStreakLength:2,glassIntensity:.98,glassZoom:.58}},noon:{celestial:{celestialY:.71,moonGlowIntensity:3.55,moonGlowSize:.97,moonPhase:.3776,skyBrightness:.81,skyContrast:.54,skySaturation:.36,starDensity:1.68,sunGlowIntensity:3.7,sunGlowSize:.22,sunRayCount:0,sunRayIntensity:0,sunRayLength:0},cloud:{ambientDarkness:1,backlightIntensity:.59,cloudScale:1.8,coverage:.58,density:.87,lightIntensity:0,numLayers:1,softness:.2,turbulence:.24,windSpeed:.05},glass:{brightness:1},interactions:{rainRefractionStrength:1},post:{godRayIntensity:1.24,godRaySamples:0,godRayWeight:.6},rain:{fallingAngle:.3,fallingSpeed:3,glassIntensity:.98,glassZoom:.58}}},overcast:{dawn:{celestial:{celestialY:.71,moonGlowIntensity:1.91,moonGlowSize:.32,moonPhase:.5,skyBrightness:1.36,skyContrast:.73,skySaturation:1.6,starDensity:.11,sunGlowIntensity:5.1,sunGlowSize:.27,sunRayCount:6,sunRayIntensity:.05,sunRayLength:.6},cloud:{ambientDarkness:0,backlightIntensity:1.41,cloudScale:1.9,density:.3,lightIntensity:.75,numLayers:8,softness:.77,turbulence:.66,windSpeed:.04},glass:{brightness:.95},post:{bloomThreshold:.81,godRayIntensity:.32,godRayWeight:.3,haze:.15,hazeContrast:0,hazeHorizon:1}},dusk:{celestial:{celestialY:.71,moonGlowIntensity:1.91,moonGlowSize:.32,moonPhase:.5,skyBrightness:1.12,skyContrast:.83,skySaturation:2,starDensity:.11,sunGlowIntensity:4.15,sunGlowSize:.28,sunRayCount:6,sunRayIntensity:.05,sunRayLength:.6},cloud:{ambientDarkness:0,backlightIntensity:1.41,cloudScale:1.9,density:.3,lightIntensity:.78,numLayers:8,softness:.77,turbulence:.66,windSpeed:.04},glass:{brightness:.9},post:{bloomThreshold:.81,godRayIntensity:.32,godRayWeight:.3,haze:.15,hazeContrast:0,hazeHorizon:1}},midnight:{celestial:{celestialY:.71,moonGlowIntensity:2.75,moonGlowSize:1.54,moonPhase:.5,skyBrightness:1.58,skyContrast:.84,skySaturation:1.15,starDensity:.11,sunGlowIntensity:2.42,sunGlowSize:.38,sunRayCount:6,sunRayIntensity:.05,sunRayLength:1.59},cloud:{ambientDarkness:0,backlightIntensity:1.41,cloudScale:1.9,coverage:.9,density:1.16,lightIntensity:0,numLayers:8,softness:.87,turbulence:.66,windSpeed:.04},post:{bloomThreshold:.81,godRayIntensity:.02,godRayWeight:.15,haze:.35,hazeContrast:0,hazeHorizon:.96}},noon:{celestial:{celestialY:.71,moonGlowIntensity:1.91,moonGlowSize:.32,moonPhase:.5,skyBrightness:1.16,skyContrast:.53,skySaturation:.88,starDensity:.11,sunGlowIntensity:5.2,sunGlowSize:.38,sunRayCount:6,sunRayIntensity:.05,sunRayLength:1.59},cloud:{ambientDarkness:0,backlightIntensity:.9,cloudScale:1.9,coverage:.95,density:.3,lightIntensity:.08,numLayers:8,softness:.77,turbulence:.66,windSpeed:.04},glass:{brightness:1},post:{bloomThreshold:.81,godRayIntensity:.12,godRayWeight:.2,haze:.15,hazeContrast:0,hazeHorizon:1}}},\"partly-cloudy\":{dawn:{celestial:{celestialY:.71,moonGlowIntensity:3.55,moonGlowSize:.97,moonPhase:.5,starDensity:1.72,sunGlowIntensity:3.89,sunGlowSize:.38,sunRayCount:4,sunRayIntensity:.17},cloud:{ambientDarkness:.42,coverage:.37,density:1.24,lightIntensity:1.42,softness:.28,windSpeed:.01},glass:{blur:3,brightness:.95}},dusk:{celestial:{celestialY:.71,moonGlowIntensity:3.55,moonGlowSize:.97,moonPhase:.5,starDensity:1.72,sunGlowIntensity:3.89,sunGlowSize:.38,sunRayCount:4,sunRayIntensity:.17},cloud:{ambientDarkness:.42,cloudScale:1.68,coverage:.37,density:1.24,lightIntensity:1.42,softness:.26,windSpeed:.01},glass:{brightness:.9}},midnight:{celestial:{celestialY:.71,moonGlowIntensity:3.55,moonGlowSize:.97,moonPhase:.5,starDensity:1.72},cloud:{ambientDarkness:.42,backlightIntensity:1.23,cloudScale:1.11,coverage:.37,density:1.24,lightIntensity:1.42,numLayers:5,softness:.21,turbulence:.18,windSpeed:.01}},noon:{celestial:{celestialY:.71,moonGlowIntensity:3.55,moonGlowSize:.97,moonPhase:.5,starDensity:1.72},cloud:{ambientDarkness:.42,backlightIntensity:0,cloudScale:1.86,coverage:.48,density:1.71,lightIntensity:.67,numLayers:2,softness:.41,windSpeed:.01},glass:{brightness:1}}},rain:{dawn:{celestial:{celestialX:.69,celestialY:.74,moonGlowIntensity:3.55,moonGlowSize:.97,skyBrightness:.96,skyContrast:.84,skySaturation:.94,starDensity:1.72},cloud:{ambientDarkness:.7,backlightIntensity:.82,cloudScale:1.13,coverage:.72,density:.94,lightIntensity:0,numLayers:1,softness:.17,turbulence:.34,windSpeed:.05},glass:{brightness:.95},interactions:{rainRefractionStrength:.76},rain:{fallingAngle:0,fallingIntensity:.84,fallingLayers:4,fallingSpeed:3,fallingStreakLength:.54,glassIntensity:.38,glassZoom:.5}},dusk:{celestial:{celestialX:.69,celestialY:.74,moonGlowIntensity:3.55,moonGlowSize:.97,moonPhase:.4115,moonSize:.17,skyBrightness:.96,skyContrast:.84,skySaturation:.94,starDensity:1.72,sunGlowIntensity:3.05,sunGlowSize:.3,sunRayCount:6,sunRayIntensity:.1,sunRayLength:3,sunSize:.14},cloud:{ambientDarkness:1,backlightIntensity:.82,cloudScale:1.13,coverage:.72,density:.94,lightIntensity:0,numLayers:1,softness:.17,turbulence:.34,windAngle:0,windSpeed:.05},glass:{brightness:.9},interactions:{rainRefractionStrength:.76},lightning:{enabled:!0},rain:{fallingAngle:0,fallingIntensity:.84,fallingLayers:5,fallingSpeed:3,fallingStreakLength:.54,glassIntensity:.38,glassZoom:.5}},midnight:{celestial:{celestialX:.74,celestialY:.71,moonGlowIntensity:3.55,moonGlowSize:.97,moonPhase:.3776,moonSize:.17,skyBrightness:1.11,skyContrast:1,skySaturation:.78,starDensity:1.72,sunGlowIntensity:3.05,sunGlowSize:.3,sunRayCount:6,sunRayIntensity:.1,sunRayLength:3,sunSize:.14},cloud:{ambientDarkness:1,backlightIntensity:.77,cloudScale:1.13,coverage:.72,density:1,lightIntensity:0,numLayers:1,softness:.23,turbulence:.34,windAngle:0,windSpeed:.05},interactions:{rainRefractionStrength:.76},rain:{fallingAngle:0,fallingIntensity:.84,fallingLayers:5,fallingSpeed:3,fallingStreakLength:.54,glassIntensity:.38,glassZoom:.5}},noon:{celestial:{celestialX:.74,celestialY:.71,moonGlowIntensity:3.55,moonGlowSize:.97,moonPhase:.3776,moonSize:.17,skyBrightness:1.12,skyContrast:.49,skySaturation:.59,starDensity:1.72,sunGlowIntensity:3.05,sunGlowSize:.22,sunRayCount:0,sunRayIntensity:0,sunRayLength:0,sunSize:.14},cloud:{ambientDarkness:1,backlightIntensity:.59,cloudScale:1.13,coverage:.79,density:1.08,lightIntensity:0,numLayers:1,softness:.23,turbulence:.34,windAngle:0,windSpeed:.05},glass:{brightness:1},interactions:{rainRefractionStrength:.76},lightning:{enabled:!0},rain:{fallingAngle:0,fallingIntensity:.84,fallingLayers:5,fallingSpeed:3,fallingStreakLength:.54,glassIntensity:.38,glassZoom:.5}}},sleet:{dawn:{celestial:{celestialX:.69,celestialY:.74,skyBrightness:.82,starDensity:.36,sunGlowIntensity:5},cloud:{ambientDarkness:1,backlightIntensity:1.27,turbulence:.56,windSpeed:.03},glass:{brightness:.95},rain:{fallingAngle:.31,fallingIntensity:.22,fallingSpeed:2.07,fallingStreakLength:2,glassIntensity:.41,glassZoom:.85},snow:{drift:1,fallSpeed:8,flakeSize:.85,flutter:.98,glowAmount:.09,intensity:.34,layers:8,opacity:.78,sizeVariation:1,sparkle:.48,turbulence:.92,windAngle:1.76,windShear:1,windSpeed:1.8}},dusk:{celestial:{celestialX:.69,celestialY:.74,starDensity:.36,sunGlowIntensity:5},cloud:{turbulence:.56,windSpeed:.03},glass:{brightness:.9},lightning:{enabled:!0},rain:{fallingAngle:.31,fallingIntensity:.22,fallingSpeed:2.07,fallingStreakLength:2,glassIntensity:.41,glassZoom:.85},snow:{drift:1,fallSpeed:8,flakeSize:.85,flutter:.98,glowAmount:.09,intensity:.34,layers:8,opacity:.78,sizeVariation:1,sparkle:.48,windAngle:1.76,windShear:1,windSpeed:1.8}},midnight:{celestial:{celestialX:.69,celestialY:.74,starDensity:.36,sunGlowIntensity:5},cloud:{turbulence:.56,windSpeed:.03},lightning:{enabled:!0},rain:{fallingAngle:.31,fallingIntensity:.22,fallingSpeed:2.07,fallingStreakLength:2,glassIntensity:.41,glassZoom:.85},snow:{drift:1,fallSpeed:8,flakeSize:.85,flutter:.98,glowAmount:.09,intensity:.34,layers:8,opacity:.78,sizeVariation:1,sparkle:.48,windAngle:1.76,windShear:1,windSpeed:1.8}},noon:{celestial:{celestialX:.69,celestialY:.74,starDensity:.36,sunGlowIntensity:5},cloud:{turbulence:.56,windSpeed:.03},glass:{brightness:1},lightning:{enabled:!0},rain:{fallingAngle:.31,fallingIntensity:.22,fallingSpeed:2.07,fallingStreakLength:2,glassIntensity:.41,glassZoom:.85},snow:{drift:1,fallSpeed:8,flakeSize:.85,flutter:.98,glowAmount:.09,intensity:.34,layers:8,opacity:.78,sizeVariation:1,sparkle:.48,turbulence:1,windAngle:1.76,windShear:1,windSpeed:1.8}}},snow:{dawn:{celestial:{celestialY:.71,moonGlowIntensity:3.55,moonGlowSize:.97,skyBrightness:.6,skyContrast:0,skySaturation:1.5,starDensity:1.72},cloud:{ambientDarkness:.94,backlightIntensity:1.14,density:1.19,lightIntensity:1.73,turbulence:.3,windSpeed:.04},glass:{brightness:.95,chromaticAberration:2,depth:8,strength:10},post:{godRayIntensity:.4,haze:.03,hazeContrast:.05,hazeDesaturation:0,hazeHorizon:1},snow:{drift:1,fallSpeed:1.5,flakeSize:1.05,flutter:1,glowAmount:.44,intensity:.53,layers:8,opacity:.4,sizeVariation:.63,sparkle:.97,turbulence:.59,windAngle:1.95,windShear:.8,windSpeed:2}},dusk:{celestial:{celestialY:.71,moonGlowIntensity:3.55,moonGlowSize:.97,skyBrightness:1.01,skyContrast:.86,skySaturation:2,starDensity:1.72,sunGlowIntensity:4.9},cloud:{ambientDarkness:.9,backlightIntensity:1.53,cloudScale:1.82,coverage:.62,density:1.19,lightIntensity:.55,softness:.31,turbulence:.3,windSpeed:.04},glass:{blur:2,chromaticAberration:2,depth:8,strength:10},post:{godRayIntensity:.4,haze:.03,hazeContrast:.05,hazeDesaturation:0,hazeHorizon:1},snow:{drift:1,fallSpeed:1.5,flakeSize:1.05,flutter:1,glowAmount:.88,intensity:.96,layers:8,opacity:.34,sizeVariation:.63,sparkle:.97,turbulence:.59,windAngle:1.95,windShear:.8,windSpeed:2}},midnight:{celestial:{celestialY:.71,moonGlowIntensity:3.55,moonGlowSize:.97,moonPhase:.5,skyBrightness:1.07,skyContrast:.59,skySaturation:1.57,starDensity:1.72},cloud:{ambientDarkness:.04,cloudScale:1.15,coverage:.5,density:1.19,lightIntensity:1.29,softness:.14,turbulence:.3,windAngle:-.08,windSpeed:.04},glass:{blur:1,chromaticAberration:2,depth:8,strength:10},post:{godRayIntensity:.4,haze:.03,hazeContrast:.05,hazeDesaturation:0,hazeHorizon:1},snow:{drift:1,fallSpeed:1.5,flakeSize:1.05,flutter:1,glowAmount:.88,intensity:.53,layers:8,opacity:.34,sizeVariation:.63,sparkle:.97,turbulence:.59,windAngle:1.95,windShear:.8,windSpeed:1.44}},noon:{celestial:{celestialY:.71,moonGlowIntensity:3.55,moonGlowSize:.97,skyBrightness:.35,skyContrast:.69,skySaturation:.73,starDensity:1.72,sunGlowIntensity:3.45,sunGlowSize:.29,sunRayCount:0},cloud:{ambientDarkness:1,backlightIntensity:1.01,density:1.19,lightIntensity:.57,turbulence:.3,windSpeed:.04},glass:{blur:1,brightness:1.15,chromaticAberration:2,depth:8,saturation:1.4,strength:10},post:{godRayIntensity:.4,haze:.03,hazeContrast:.05,hazeDesaturation:0,hazeHorizon:1},snow:{drift:1,fallSpeed:1.5,flakeSize:1.28,flutter:1,glowAmount:.47,intensity:.53,layers:8,opacity:.34,sizeVariation:.63,sparkle:1,turbulence:.59,windAngle:1.95,windShear:.8,windSpeed:2}}},thunderstorm:{dawn:{celestial:{celestialX:.69,celestialY:.74,moonGlowIntensity:0,moonGlowSize:0,skyBrightness:.78,skyContrast:1.03,skySaturation:.94,starDensity:1.72,sunGlowIntensity:5.1,sunRayCount:5,sunRayIntensity:.13,sunRayLength:1.7,sunRayShimmer:5,sunRayShimmerSpeed:5},cloud:{backlightIntensity:.55,cloudScale:1.56,coverage:.71,density:.97,lightIntensity:0,numLayers:1,softness:.28,turbulence:.36,windSpeed:.04},glass:{blur:1,brightness:.9,chromaticAberration:2,strength:45},interactions:{lightningSceneIllumination:.83,rainRefractionStrength:2},lightning:{autoInterval:8,branchDensity:.83,enabled:!0,flashIntensity:1.57},post:{bloomIntensity:.39,exposureIntensity:.95,exposureRecovery:4.5,godRayDecay:.894,godRayDensity:.91,godRayIntensity:.26,godRaySamples:39,godRayWeight:.36,haze:.07,hazeContrast:0,hazeHorizon:1},rain:{fallingAngle:.02,fallingLayers:12,fallingSpeed:3,fallingStreakLength:1.46,glassIntensity:1.71,glassZoom:.51}},dusk:{celestial:{celestialX:.69,celestialY:.74,moonGlowIntensity:0,moonGlowSize:0,skyBrightness:.91,skyContrast:1.03,skySaturation:1.19,starDensity:1.72,sunGlowIntensity:5.05,sunRayShimmer:5,sunRayShimmerSpeed:5},cloud:{ambientDarkness:1,backlightIntensity:.55,cloudScale:1.56,coverage:.71,density:.97,lightIntensity:0,numLayers:1,softness:.28,turbulence:.36,windSpeed:.04},glass:{blur:1,brightness:.9,chromaticAberration:2,strength:45},interactions:{lightningSceneIllumination:.83,rainRefractionStrength:2},lightning:{branchDensity:.83,enabled:!0,flashIntensity:1.57},post:{bloomIntensity:.44,exposureIntensity:1.1,exposureRecovery:4.5,haze:.07,hazeContrast:0,hazeHorizon:1},rain:{fallingAngle:.02,fallingLayers:12,fallingSpeed:3,fallingStreakLength:1.46,glassIntensity:1.32,glassZoom:.51}},midnight:{celestial:{celestialY:.71,moonGlowIntensity:4.55,moonGlowSize:1.25,moonPhase:.5,skyBrightness:.78,skyContrast:1.03,skySaturation:.74,starDensity:1.72,sunRayShimmer:5,sunRayShimmerSpeed:5},cloud:{ambientDarkness:.88,backlightIntensity:.55,cloudScale:1.56,coverage:.71,density:.97,lightIntensity:0,numLayers:1,softness:.28,turbulence:.36,windSpeed:.04},glass:{blur:1,brightness:.9,chromaticAberration:2,strength:45},interactions:{lightningSceneIllumination:.83,rainRefractionStrength:2},lightning:{autoInterval:8.5,branchDensity:.89,enabled:!0,flashIntensity:1.57},post:{bloomIntensity:.44,exposureIntensity:1.1,exposureRecovery:4.5,haze:.07,hazeContrast:0,hazeHorizon:1},rain:{fallingAngle:.02,fallingLayers:12,fallingSpeed:3,fallingStreakLength:1.46,glassIntensity:1.32,glassZoom:.51}},noon:{celestial:{celestialY:.71,moonGlowIntensity:0,moonGlowSize:0,skyBrightness:.74,skyContrast:1.07,skySaturation:.55,starDensity:1.72,sunGlowIntensity:2.7,sunGlowSize:.51,sunRayCount:0,sunRayIntensity:0,sunRayLength:0,sunRayShimmer:5,sunRayShimmerSpeed:5},cloud:{ambientDarkness:1,backlightIntensity:.55,cloudScale:1.56,coverage:.71,density:.97,lightIntensity:0,numLayers:1,softness:.28,turbulence:.36,windSpeed:.04},glass:{blur:1,brightness:.9,chromaticAberration:2,strength:45},interactions:{lightningSceneIllumination:.83,rainRefractionStrength:2},lightning:{enabled:!0,flashIntensity:1.57},post:{bloomIntensity:.44,exposureIntensity:1.1,exposureRecovery:4.5,haze:.07,hazeContrast:0,hazeHorizon:1},rain:{fallingAngle:.02,fallingLayers:12,fallingSpeed:3,fallingStreakLength:1.46,glassIntensity:1.32,glassZoom:.51}}},windy:{dawn:{celestial:{celestialX:.69,celestialY:.74,skyBrightness:1,starDensity:.36,sunGlowIntensity:5},cloud:{cloudScale:.85,coverage:.4,windSpeed:.17},glass:{brightness:.95}},dusk:{celestial:{celestialX:.69,celestialY:.74,starDensity:.11,sunGlowIntensity:3.21,sunGlowSize:.51},cloud:{cloudScale:.85,coverage:.4,windSpeed:.17},glass:{brightness:.9}},midnight:{celestial:{celestialX:.74,celestialY:.71,moonGlowIntensity:3.55,moonGlowSize:.97,starDensity:1.72},cloud:{cloudScale:.85,coverage:.4,windSpeed:.17}},noon:{celestial:{celestialX:.74,celestialY:.71,moonPhase:.2421,starDensity:.14,sunGlowIntensity:1.59,sunGlowSize:.55},cloud:{cloudScale:.85,coverage:.4,windSpeed:.17},glass:{brightness:1}}}};function H(e){if(!e)return .5;let t=new Date(e),a=t.getUTCHours(),n=t.getUTCMinutes();return(a+n/60)/24}function Qe(e){if(!e)return .5;let t=new Date(e);t.setUTCHours(0,0,0,0);let a=new Date(\"2000-01-06T00:00:00Z\"),n=(t.getTime()-a.getTime())/(1e3*60*60*24),s=29.530588853;return(n%s+s)%s/s}function je(e){return e<0}var Je={clear:1,\"partly-cloudy\":.9,cloudy:.8,overcast:.65,fog:.7,drizzle:.7,rain:.6,\"heavy-rain\":.45,thunderstorm:.3,snow:.8,sleet:.65,hail:.5,windy:.9};function et(e,t){return e<.35?\"dark\":e>.45?\"light\":t??\"dark\"}function Oe(e){let t=e*24;return t<6?-1+t/6:t<12?(t-6)/6:t<18?1-(t-12)/6:-(t-18)/6}function tt(e,t=\"clear\"){let a=Oe(e),n;a<0?n=.05+(1+a)*.1:n=.15+a*.85;let s=Je[t],c=n*s;return Math.max(0,Math.min(1,c))}function nt(e=0){return e<=10?e/10*.3:e<=25?.3+(e-10)/15*.4:.7+Math.min((e-25)/25,.3)}function at(e){switch(e){case\"light\":return .3;case\"moderate\":return .6;case\"heavy\":return 1;default:return 0}}function st(e=10){return e>=10?0:e>=5?(10-e)/5*.3:.3+(5-e)/5*.7}function te(e){return Math.max(0,Math.min(1,e))}function ee(e,t,a){let n=te((a-e)/(t-e));return n*n*(3-2*n)}var D={x:.74,y:.78,sunSize:.14,moonSize:.17,starDensity:2,sunGlowIntensity:3.05,sunGlowSize:.3,sunRayCount:6,sunRayLength:3,sunRayIntensity:.1,moonGlowIntensity:3.45,moonGlowSize:.94},ot={clear:D,\"partly-cloudy\":D,cloudy:D,overcast:D,fog:D,drizzle:D,rain:D,\"heavy-rain\":D,thunderstorm:D,snow:D,sleet:D,hail:D,windy:D},it={clear:{cloud:{coverage:.1,speed:.3,darkness:0,turbulence:.2}},\"partly-cloudy\":{cloud:{coverage:.4,speed:.4,darkness:.1,turbulence:.3}},cloudy:{cloud:{coverage:.7,speed:.4,darkness:.2,turbulence:.3}},overcast:{cloud:{coverage:.95,speed:.3,darkness:.35,turbulence:.25}},fog:{cloud:{coverage:.6,speed:.15,darkness:.15,turbulence:.1}},drizzle:{cloud:{coverage:.75,speed:.35,darkness:.3,turbulence:.3},rain:{intensity:.25,glassDrops:!0,fallingRain:!0,angle:3}},rain:{cloud:{coverage:.85,speed:.5,darkness:.4,turbulence:.4},rain:{intensity:.6,glassDrops:!0,fallingRain:!0,angle:5}},\"heavy-rain\":{cloud:{coverage:.95,speed:.6,darkness:.55,turbulence:.5},rain:{intensity:1,glassDrops:!0,fallingRain:!0,angle:8}},thunderstorm:{cloud:{coverage:1,speed:.7,darkness:.7,turbulence:.6},rain:{intensity:1,glassDrops:!0,fallingRain:!0,angle:15},lightning:{enabled:!0,autoTrigger:!0,intervalMin:4,intervalMax:12}},snow:{cloud:{coverage:.7,speed:.25,darkness:.2,turbulence:.2},snow:{intensity:.7,windDrift:.3}},sleet:{cloud:{coverage:.8,speed:.4,darkness:.35,turbulence:.35},rain:{intensity:.5,glassDrops:!0,fallingRain:!0,angle:10},snow:{intensity:.3,windDrift:.4}},hail:{cloud:{coverage:.9,speed:.6,darkness:.5,turbulence:.5},rain:{intensity:.7,glassDrops:!0,fallingRain:!0,angle:5},snow:{intensity:.3,windDrift:.4}},windy:{cloud:{coverage:.5,speed:1,darkness:.1,turbulence:.6}}};function Me(e){let{conditionCode:t,windSpeed:a,precipitationLevel:n,visibility:s,timestamp:c,timeOfDay:l}=e,o=it[t],r=l??H(c),i=Oe(r),h=nt(a),f=at(n),p=st(s),b=je(i),R={sunAltitude:i,haze:Math.max(p,(o.cloud?.darkness??0)*.3),starVisibility:b&&!o.cloud?1:b?1-(o.cloud?.coverage??0):0},C={atmosphere:R};if(o.cloud&&(C.cloud={...o.cloud,speed:o.cloud.speed*(1+h*.5),turbulence:o.cloud.turbulence*(1+h*.3)}),o.rain){let E=f>0?f:o.rain.intensity;C.rain={...o.rain,intensity:E,angle:o.rain.angle+h*10}}o.lightning&&(C.lightning={...o.lightning}),o.snow&&(C.snow={...o.snow,windDrift:o.snow.windDrift+h*.3});let A=Qe(c),k=ot[t];C.celestial={timeOfDay:r,moonPhase:A,starDensity:b?k.starDensity:0,celestialX:k.x,celestialY:k.y,sunSize:k.sunSize,moonSize:k.moonSize,sunGlowIntensity:k.sunGlowIntensity,sunGlowSize:k.sunGlowSize,sunRayCount:k.sunRayCount,sunRayLength:k.sunRayLength,sunRayIntensity:k.sunRayIntensity,moonGlowIntensity:k.moonGlowIntensity,moonGlowSize:k.moonGlowSize};let w=te(R.haze),T=C.cloud?.coverage??0,Q=T>.001,$=te(.04+(t===\"fog\"?.18:t===\"thunderstorm\"?.12:t===\"heavy-rain\"?.1:t===\"overcast\"?.08:t===\"cloudy\"||t===\"partly-cloudy\"?.06:.04)+w*.22),G=1.1+w*1.2,z=C.lightning?.enabled?.85:0,V=ee(-.05,.08,i),F=1-ee(.18,.7,Math.max(0,i)),d=ee(.25,.85,T),u=1-ee(.97,1,T),y=.35+w*.65,g=Q?te(V*F*d*u*y*.6):0,m={enabled:!0,haze:w,bloomIntensity:$,bloomRadius:G,exposureIntensity:z,godRayIntensity:g};return C.post=m,C}function rt(e){let t=Me(e),a=e.timeOfDay??t.celestial?.timeOfDay??H(e.timestamp),n=t.cloud!==void 0,s=t.rain!==void 0,c=t.lightning!==void 0,l=t.snow!==void 0,o=t.lightning?.intervalMin??4,r=t.lightning?.intervalMax??12;return{layers:{celestial:!0,clouds:n,rain:s,lightning:c,snow:l},celestial:{timeOfDay:a,moonPhase:t.celestial?.moonPhase??.5,starDensity:t.celestial?.starDensity??.5,celestialX:t.celestial?.celestialX??.5,celestialY:t.celestial?.celestialY??.72,sunSize:t.celestial?.sunSize??.06,moonSize:t.celestial?.moonSize??.05,sunGlowIntensity:t.celestial?.sunGlowIntensity??1,sunGlowSize:t.celestial?.sunGlowSize??.3,sunRayCount:t.celestial?.sunRayCount??12,sunRayLength:t.celestial?.sunRayLength??.5,sunRayIntensity:t.celestial?.sunRayIntensity??.4,sunRayShimmer:1,sunRayShimmerSpeed:1,moonGlowIntensity:t.celestial?.moonGlowIntensity??1,moonGlowSize:t.celestial?.moonGlowSize??.2,skyBrightness:1,skySaturation:1,skyContrast:1},cloud:{cloudScale:1.5,coverage:t.cloud?.coverage??.5,density:.7,softness:.3,windSpeed:t.cloud?.speed??.5,windAngle:0,turbulence:t.cloud?.turbulence??.5,lightIntensity:1,ambientDarkness:t.cloud?.darkness??.3,backlightIntensity:.5,numLayers:3},rain:{glassIntensity:s?(t.rain?.intensity??.5)*.7:0,zoom:1,fallingIntensity:s?t.rain?.intensity??.6:0,fallingSpeed:1,fallingAngle:s?(t.rain?.angle??5)*.02:.1,fallingStreakLength:.8,fallingLayers:3,fallingRefraction:.3},lightning:{autoMode:c?t.lightning?.autoTrigger??!0:!1,autoInterval:c?(o+r)/2:8,glowIntensity:.8,branchDensity:.6,sceneIllumination:.6},snow:{intensity:l?t.snow?.intensity??.7:0,layers:4,fallSpeed:.5,windSpeed:l?t.snow?.windDrift??.3:.3,windAngle:0,turbulence:.3,drift:l?t.snow?.windDrift??.3:.3,flutter:.5,windShear:.2,flakeSize:1,sizeVariation:.5,opacity:.8,glowAmount:.3,sparkle:.2},post:{enabled:!0,haze:0,hazeHorizon:.5,hazeDesaturation:.3,hazeContrast:.2,bloomIntensity:0,bloomThreshold:.8,bloomKnee:.5,bloomRadius:8,bloomTapScale:1,exposureIntensity:0,exposureDesaturation:.3,exposureRecovery:2,godRayIntensity:0,godRayDecay:.96,godRayDensity:.5,godRayWeight:.3,godRaySamples:60}}}function lt(e){return{layers:e.layers,celestial:{timeOfDay:e.celestial.timeOfDay,moonPhase:e.celestial.moonPhase,starDensity:e.celestial.starDensity,celestialX:e.celestial.celestialX,celestialY:e.celestial.celestialY,sunSize:e.celestial.sunSize,moonSize:e.celestial.moonSize,sunGlowIntensity:e.celestial.sunGlowIntensity,sunGlowSize:e.celestial.sunGlowSize,sunRayCount:e.celestial.sunRayCount,sunRayLength:e.celestial.sunRayLength,sunRayIntensity:e.celestial.sunRayIntensity,sunRayShimmer:e.celestial.sunRayShimmer,sunRayShimmerSpeed:e.celestial.sunRayShimmerSpeed,moonGlowIntensity:e.celestial.moonGlowIntensity,moonGlowSize:e.celestial.moonGlowSize,skyBrightness:e.celestial.skyBrightness,skySaturation:e.celestial.skySaturation,skyContrast:e.celestial.skyContrast},cloud:{coverage:e.cloud.coverage,density:e.cloud.density,softness:e.cloud.softness,cloudScale:e.cloud.cloudScale,windSpeed:e.cloud.windSpeed,windAngle:e.cloud.windAngle,turbulence:e.cloud.turbulence,lightIntensity:e.cloud.lightIntensity,ambientDarkness:e.cloud.ambientDarkness,backlightIntensity:e.cloud.backlightIntensity,numLayers:e.cloud.numLayers},rain:{glassIntensity:e.rain.glassIntensity,glassZoom:e.rain.zoom,fallingIntensity:e.rain.fallingIntensity,fallingSpeed:e.rain.fallingSpeed,fallingAngle:e.rain.fallingAngle,fallingStreakLength:e.rain.fallingStreakLength,fallingLayers:e.rain.fallingLayers},lightning:{enabled:e.layers.lightning,autoMode:e.lightning.autoMode,autoInterval:e.lightning.autoInterval,flashIntensity:e.lightning.glowIntensity,branchDensity:e.lightning.branchDensity},snow:{intensity:e.snow.intensity,layers:e.snow.layers,fallSpeed:e.snow.fallSpeed,windSpeed:e.snow.windSpeed,windAngle:e.snow.windAngle,turbulence:e.snow.turbulence,drift:e.snow.drift,flutter:e.snow.flutter,windShear:e.snow.windShear,flakeSize:e.snow.flakeSize,sizeVariation:e.snow.sizeVariation,opacity:e.snow.opacity,glowAmount:e.snow.glowAmount,sparkle:e.snow.sparkle},interactions:{rainRefractionStrength:e.rain.fallingRefraction,lightningSceneIllumination:e.lightning.sceneIllumination},post:e.post}}function Be(e){return lt(rt(e))}var me={dawn:.25,noon:.5,dusk:.75,midnight:0},ut=[\"dawn\",\"noon\",\"dusk\",\"midnight\"];function q(e){let t=(e%1+1)%1,a=\"noon\",n=1/0;for(let s of ut){let c=me[s],l=Math.abs(t-c);l>.5&&(l=1-l);let o=Math.abs(l-n)<=Number.EPSILON;(l<n||o&&s===\"midnight\")&&(n=l,a=s)}return a}function W(e,t){if(!(!e&&!t))return{...e,...t}}function Ne(e,t){return{...e,layers:W(e.layers,t.layers),celestial:W(e.celestial,t.celestial),cloud:W(e.cloud,t.cloud),rain:W(e.rain,t.rain),lightning:W(e.lightning,t.lightning),snow:W(e.snow,t.snow),glass:W(e.glass,t.glass),interactions:W(e.interactions,t.interactions),post:W(e.post,t.post)}}function Ye(e){let t=Be(e),a=e.timeOfDay;typeof a==\"number\"&&t.celestial&&(t.celestial.timeOfDay=a);let n=e.tunedPresets?.[e.conditionCode],s=a??t.celestial?.timeOfDay;if(!n||s===void 0)return t;let c=q(s);return Ne(t,n[c])}function ct(){if(typeof window>\"u\")return\"high\";let e=window.devicePixelRatio||1,t=window.innerWidth*window.innerHeight*e*e,a=typeof navigator<\"u\"?navigator.hardwareConcurrency:void 0,n=typeof navigator<\"u\"?navigator.deviceMemory:void 0,s=window.innerWidth<768;return typeof n==\"number\"&&n<=4||typeof a==\"number\"&&a<=4||t>25e5?s?\"low\":\"medium\":s?\"medium\":\"high\"}function Ve(e){return e===\"low\"||e===\"medium\"||e===\"high\"?e:ct()}function Xe(e){if(typeof window>\"u\")return;let t=window.devicePixelRatio||1;return Math.max(1,Math.min(t,e===\"low\"?1:e===\"medium\"?1.5:2))}import{jsx as He}from\"react/jsx-runtime\";var mt=de;function yt({conditionCode:e,windSpeed:t,precipitationLevel:a,visibility:n,timestamp:s,timeOfDay:c,settings:l,className:o}){let[r,i]=ft(!1),h=l?.enabled!==!1,f=l?.reducedMotion??!1,p=ye(()=>Ve(l?.quality??\"auto\"),[l?.quality]);dt(()=>{i(!0)},[]);let b=ye(()=>Xe(p),[p]),R=ye(()=>!h||f?null:Ye({conditionCode:e,windSpeed:t,precipitationLevel:a,visibility:n,timestamp:s,timeOfDay:c,tunedPresets:mt}),[h,f,e,t,a,n,s,c]);return!r||!h||f||!R?null:He(\"div\",{className:o,style:{position:\"absolute\",inset:0,overflow:\"hidden\",pointerEvents:\"none\",borderRadius:\"inherit\"},\"aria-hidden\":\"true\",children:He(Fe,{className:\"absolute inset-0\",dpr:b,...R})})}function ht({glassStyles:e,blurAmount:t}){if(!!e.backdropFilter)return e;let n=`blur(${t}px)`;return{backdropFilter:n,WebkitBackdropFilter:n}}import{useEffect as gt,useMemo as pt,useState as St}from\"react\";var Y={depth:12,radius:12,strength:40,chromaticAberration:8,blur:2,brightness:1.05,saturation:1.2};function vt({width:e,height:t,radius:a,depth:n}){let s=Math.ceil(a/t*15),c=Math.ceil(a/e*15),l=Math.max(0,e-2*n),o=Math.max(0,t-2*n),r=`<svg height=\"${t}\" width=\"${e}\" viewBox=\"0 0 ${e} ${t}\" xmlns=\"http://www.w3.org/2000/svg\">\n    <style>.mix { mix-blend-mode: screen; }</style>\n    <defs>\n      <linearGradient id=\"Y\" x1=\"0\" x2=\"0\" y1=\"${s}%\" y2=\"${100-s}%\">\n        <stop offset=\"0%\" stop-color=\"#0F0\" />\n        <stop offset=\"100%\" stop-color=\"#000\" />\n      </linearGradient>\n      <linearGradient id=\"X\" x1=\"${c}%\" x2=\"${100-c}%\" y1=\"0\" y2=\"0\">\n        <stop offset=\"0%\" stop-color=\"#F00\" />\n        <stop offset=\"100%\" stop-color=\"#000\" />\n      </linearGradient>\n    </defs>\n    <rect x=\"0\" y=\"0\" height=\"${t}\" width=\"${e}\" fill=\"#808080\" />\n    <g filter=\"blur(2px)\">\n      <rect x=\"0\" y=\"0\" height=\"${t}\" width=\"${e}\" fill=\"#000080\" />\n      <rect x=\"0\" y=\"0\" height=\"${t}\" width=\"${e}\" fill=\"url(#Y)\" class=\"mix\" />\n      <rect x=\"0\" y=\"0\" height=\"${t}\" width=\"${e}\" fill=\"url(#X)\" class=\"mix\" />\n      <rect x=\"${n}\" y=\"${n}\" height=\"${o}\" width=\"${l}\" fill=\"#808080\" rx=\"${a}\" ry=\"${a}\" filter=\"blur(${n}px)\" />\n    </g>\n  </svg>`;return\"data:image/svg+xml;utf8,\"+encodeURIComponent(r)}function bt({width:e,height:t,radius:a,depth:n,strength:s,chromaticAberration:c}){let l=vt({width:e,height:t,radius:a,depth:n}),o=`<feImage x=\"0\" y=\"0\" height=\"${t}\" width=\"${e}\" href=\"${l}\" result=\"displacementMap\" />`,r;if(c===0)r=`\n      ${o}\n      <feDisplacementMap in=\"SourceGraphic\" in2=\"displacementMap\" scale=\"${s}\" xChannelSelector=\"R\" yChannelSelector=\"G\" />\n    `;else{let h=s+c*2,f=s+c;r=`\n      ${o}\n      <feDisplacementMap in=\"SourceGraphic\" in2=\"displacementMap\" scale=\"${h}\" xChannelSelector=\"R\" yChannelSelector=\"G\" />\n      <feColorMatrix type=\"matrix\" values=\"1 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1 0\" result=\"displacedR\" />\n      <feDisplacementMap in=\"SourceGraphic\" in2=\"displacementMap\" scale=\"${f}\" xChannelSelector=\"R\" yChannelSelector=\"G\" />\n      <feColorMatrix type=\"matrix\" values=\"0 0 0 0 0  0 1 0 0 0  0 0 0 0 0  0 0 0 1 0\" result=\"displacedG\" />\n      <feDisplacementMap in=\"SourceGraphic\" in2=\"displacementMap\" scale=\"${s}\" xChannelSelector=\"R\" yChannelSelector=\"G\" />\n      <feColorMatrix type=\"matrix\" values=\"0 0 0 0 0  0 0 0 0 0  0 0 1 0 0  0 0 0 1 0\" result=\"displacedB\" />\n      <feBlend in=\"displacedR\" in2=\"displacedG\" mode=\"screen\"/>\n      <feBlend in2=\"displacedB\" mode=\"screen\"/>\n    `}let i=`<svg height=\"${t}\" width=\"${e}\" viewBox=\"0 0 ${e} ${t}\" xmlns=\"http://www.w3.org/2000/svg\">\n    <defs>\n      <filter id=\"displace\" color-interpolation-filters=\"sRGB\">${r}</filter>\n    </defs>\n  </svg>`;return\"data:image/svg+xml;utf8,\"+encodeURIComponent(i)+\"#displace\"}function wt({filterUrl:e,blur:t,brightness:a,saturation:n}){return`blur(${t/2}px) url('${e}') blur(${t}px) brightness(${a}) saturate(${n})`}function xt(){let[e,t]=St(!0);return gt(()=>{let a=CSS.supports(\"backdrop-filter\",\"blur(1px)\")||CSS.supports(\"-webkit-backdrop-filter\",\"blur(1px)\");t(a)},[]),e}function It({width:e,height:t,depth:a=Y.depth,radius:n=Y.radius,strength:s=Y.strength,chromaticAberration:c=Y.chromaticAberration,blur:l=Y.blur,brightness:o=Y.brightness,saturation:r=Y.saturation,enabled:i=!0}){let h=xt();return pt(()=>{if(!i||!h||e<=0||t<=0)return{};let f=bt({width:e,height:t,radius:n,depth:a,strength:s,chromaticAberration:c}),p=wt({filterUrl:f,blur:l,brightness:o,saturation:r});return{backdropFilter:p,WebkitBackdropFilter:p}},[e,t,a,n,s,c,l,o,r,i,h])}function Ue(e){return(e%1+1)%1}function Rt(e){let t=Ue(e),a=q(t);return me[a]}function kt(e){return((Math.floor(e)%12+12)%12+.5)/12}function _t(e){let{time:t,updatedAt:a}=e;return typeof t?.timeBucket==\"number\"?{timeOfDay:kt(t.timeBucket),source:\"timeBucket\"}:typeof t?.localTimeOfDay==\"number\"?{timeOfDay:Ue(t.localTimeOfDay),source:\"localTimeOfDay\"}:typeof a==\"string\"?{timeOfDay:H(a),source:\"updatedAt\"}:{timeOfDay:.5,source:\"defaultNoon\"}}export{yt as EffectCompositorRuntime,de as TUNED_WEATHER_EFFECTS_CHECKPOINT_OVERRIDES,q as getNearestCheckpoint,tt as getSceneBrightnessFromTimeOfDay,H as getTimeOfDay,et as getWeatherTheme,ht as resolveGlassBackdropFilterStyles,_t as resolveWeatherTime,Rt as snapTimeOfDayToNearestCheckpoint,It as useGlassStyles};\n"
    },
    {
      "path": "components/tool-ui/weather-widget/runtime.ts",
      "type": "registry:lib",
      "target": "components/tool-ui/weather-widget/runtime.ts",
      "content": "/**\n * Start here when wiring the Weather Widget in your app.\n *\n * Import `WeatherWidget` and the runtime types from this file for production use.\n * Reach for `index.tsx` only if you're actively working on authoring/debug internals.\n */\nexport { WeatherWidget } from \"./weather-widget-container\";\nexport type {\n  WeatherWidgetPayload,\n  WeatherWidgetRuntimeProps as WeatherWidgetProps,\n  WeatherWidgetCurrent,\n  WeatherWidgetTime,\n  WeatherWidgetLocation,\n  WeatherConditionCode,\n  ForecastDay,\n  TemperatureUnit,\n  PrecipitationLevel,\n} from \"./schema-runtime\";\n"
    },
    {
      "path": "components/tool-ui/weather-widget/schema-runtime.ts",
      "type": "registry:lib",
      "target": "components/tool-ui/weather-widget/schema-runtime.ts",
      "content": "export type WeatherConditionCode =\n  | \"clear\"\n  | \"partly-cloudy\"\n  | \"cloudy\"\n  | \"overcast\"\n  | \"fog\"\n  | \"drizzle\"\n  | \"rain\"\n  | \"heavy-rain\"\n  | \"thunderstorm\"\n  | \"snow\"\n  | \"sleet\"\n  | \"hail\"\n  | \"windy\";\n\nexport type TemperatureUnit = \"celsius\" | \"fahrenheit\";\n\nexport type PrecipitationLevel = \"none\" | \"light\" | \"moderate\" | \"heavy\";\n\nexport type TimeBucket = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;\n\nexport interface ForecastDay {\n  label: string;\n  conditionCode: WeatherConditionCode;\n  tempMin: number;\n  tempMax: number;\n}\n\nexport interface WeatherWidgetCurrent {\n  conditionCode: WeatherConditionCode;\n  temperature: number;\n  tempMin: number;\n  tempMax: number;\n  windSpeed?: number;\n  precipitationLevel?: PrecipitationLevel;\n  visibility?: number;\n}\n\nexport interface WeatherWidgetTime {\n  timeBucket?: TimeBucket;\n  localTimeOfDay?: number;\n}\n\nexport interface WeatherWidgetLocation {\n  name: string;\n}\n\nexport interface WeatherWidgetPayload {\n  version: \"3.1\";\n  id: string;\n  location: WeatherWidgetLocation;\n  units: {\n    temperature: TemperatureUnit;\n  };\n  current: WeatherWidgetCurrent;\n  forecast: ForecastDay[];\n  time: WeatherWidgetTime;\n  updatedAt?: string;\n}\n\nexport type EffectQuality = \"low\" | \"medium\" | \"high\" | \"auto\";\n\nexport interface EffectSettings {\n  enabled?: boolean;\n  quality?: EffectQuality;\n  reducedMotion?: boolean;\n}\n\nexport interface WeatherWidgetRuntimeProps extends WeatherWidgetPayload {\n  className?: string;\n  effects?: EffectSettings;\n}\n"
    },
    {
      "path": "components/tool-ui/weather-widget/weather-data-overlay.tsx",
      "type": "registry:component",
      "target": "components/tool-ui/weather-widget/weather-data-overlay.tsx",
      "content": "\"use client\";\n\nimport { useEffect, useRef, useState, useCallback } from \"react\";\nimport {\n  Sun,\n  Cloud,\n  CloudSun,\n  CloudFog,\n  CloudDrizzle,\n  CloudRain,\n  CloudLightning,\n  Snowflake,\n  CloudHail,\n  Wind,\n  type LucideIcon,\n} from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\nimport type {\n  ForecastDay,\n  TemperatureUnit,\n  WeatherConditionCode,\n} from \"./schema-runtime\";\nimport {\n  getSceneBrightnessFromTimeOfDay,\n  getTimeOfDay,\n  getWeatherTheme,\n} from \"./generated/weather-runtime-core.generated\";\nimport {\n  resolveGlassBackdropFilterStyles,\n  useGlassStyles,\n} from \"./generated/weather-runtime-core.generated\";\n\ntype WeatherTheme = \"light\" | \"dark\";\n\nfunction getPeakIntensity(timeOfDay: number): number {\n  const noonDistance = Math.abs(timeOfDay - 0.5);\n  const midnightDistance = Math.min(timeOfDay, 1 - timeOfDay);\n  const minDistance = Math.min(noonDistance, midnightDistance);\n  return Math.max(0, 1 - minDistance * 4);\n}\n\nfunction sineEasedGradient(\n  x: number,\n  y: number,\n  radius: number,\n  peakOpacity: number,\n  steps = 8,\n): string {\n  const stops: string[] = [];\n  for (let i = 0; i <= steps; i++) {\n    const t = i / steps;\n    const eased = Math.sin((t * Math.PI) / 2);\n    const opacity = peakOpacity * (1 - eased);\n    const position = t * 100;\n    stops.push(\n      `rgba(255,255,255,${opacity.toFixed(4)}) ${position.toFixed(1)}%`,\n    );\n  }\n  return `radial-gradient(circle ${radius}px at ${x}px ${y}px, ${stops.join(\", \")})`;\n}\n\nconst conditionIcons: Record<WeatherConditionCode, LucideIcon> = {\n  clear: Sun,\n  \"partly-cloudy\": CloudSun,\n  cloudy: Cloud,\n  overcast: Cloud,\n  fog: CloudFog,\n  drizzle: CloudDrizzle,\n  rain: CloudRain,\n  \"heavy-rain\": CloudRain,\n  thunderstorm: CloudLightning,\n  snow: Snowflake,\n  sleet: CloudHail,\n  hail: CloudHail,\n  windy: Wind,\n};\n\nexport interface GlassEffectParams {\n  enabled?: boolean;\n  depth?: number;\n  strength?: number;\n  chromaticAberration?: number;\n  blur?: number;\n  brightness?: number;\n  saturation?: number;\n}\n\nexport interface WeatherDataOverlayProps {\n  location: string;\n  conditionCode: WeatherConditionCode;\n  temperature: number;\n  tempHigh: number;\n  tempLow: number;\n  forecast?: ForecastDay[];\n  unit?: TemperatureUnit;\n  theme?: WeatherTheme;\n  /**\n   * Provide either `timeOfDay` (0-1) or a `timestamp` ISO string.\n   * If neither is provided, defaults to noon (0.5).\n   */\n  timeOfDay?: number;\n  timestamp?: string | undefined;\n  className?: string;\n  reducedMotion?: boolean;\n  /**\n   * Glass refraction effect parameters for the forecast card.\n   * When enabled, applies SVG displacement filter for realistic glass distortion.\n   */\n  glassParams?: GlassEffectParams | undefined;\n}\n\ninterface GlowState {\n  x: number;\n  y: number;\n  intensity: number;\n}\n\nexport function observeCardDimensions(\n  element: HTMLDivElement | null,\n  onResize: () => void,\n): () => void {\n  if (!element || typeof ResizeObserver !== \"function\") {\n    return () => {};\n  }\n\n  const observer = new ResizeObserver(onResize);\n  observer.observe(element);\n  return () => observer.disconnect();\n}\n\nexport function WeatherDataOverlay({\n  location,\n  conditionCode,\n  temperature,\n  tempHigh,\n  tempLow,\n  forecast = [],\n  unit = \"fahrenheit\",\n  theme: themeProp,\n  timeOfDay: timeOfDayProp,\n  timestamp,\n  className,\n  reducedMotion = false,\n  glassParams,\n}: WeatherDataOverlayProps) {\n  const timeOfDay =\n    typeof timeOfDayProp === \"number\"\n      ? timeOfDayProp\n      : typeof timestamp === \"string\"\n        ? getTimeOfDay(timestamp)\n        : 0.5;\n\n  const [glowState, setGlowState] = useState<GlowState>({\n    x: 0,\n    y: 0,\n    intensity: 0,\n  });\n  const [cardDimensions, setCardDimensions] = useState({ width: 0, height: 0 });\n  const cardRef = useRef<HTMLDivElement>(null);\n  const containerRef = useRef<HTMLDivElement>(null);\n  const pendingGlowStateRef = useRef<GlowState | null>(null);\n  const pendingGlowFrameRef = useRef<number | null>(null);\n\n  // Glass effect styles applied directly to forecast container.\n  // Enabled by default - falls back to simple blur if SVG filter unsupported.\n  const glassEnabled = glassParams?.enabled !== false;\n  const glassStyles = useGlassStyles({\n    width: cardDimensions.width,\n    height: cardDimensions.height,\n    depth: glassParams?.depth ?? 3,\n    radius: 12,\n    strength: glassParams?.strength ?? 75,\n    chromaticAberration: glassParams?.chromaticAberration ?? 6,\n    blur: glassParams?.blur ?? 1.5,\n    brightness: glassParams?.brightness ?? 0.8,\n    saturation: glassParams?.saturation ?? 1.3,\n    enabled: glassEnabled,\n  });\n\n  // Track forecast card dimensions for glass effect\n  const updateCardDimensions = useCallback(() => {\n    if (cardRef.current) {\n      const rect = cardRef.current.getBoundingClientRect();\n      setCardDimensions({\n        width: Math.round(rect.width),\n        height: Math.round(rect.height),\n      });\n    }\n  }, []);\n  const hasForecastStrip = forecast.length > 0;\n\n  useEffect(() => {\n    updateCardDimensions();\n    return observeCardDimensions(cardRef.current, updateCardDimensions);\n  }, [hasForecastStrip, updateCardDimensions]);\n\n  const theme =\n    themeProp ??\n    getWeatherTheme(\n      getSceneBrightnessFromTimeOfDay(timeOfDay, conditionCode),\n      undefined,\n    );\n\n  const commitGlowState = useCallback((nextState: GlowState) => {\n    setGlowState((prevState) => {\n      if (\n        prevState.x === nextState.x &&\n        prevState.y === nextState.y &&\n        prevState.intensity === nextState.intensity\n      ) {\n        return prevState;\n      }\n\n      return nextState;\n    });\n  }, []);\n\n  const cancelPendingGlowFrame = useCallback(() => {\n    pendingGlowStateRef.current = null;\n\n    if (\n      pendingGlowFrameRef.current !== null &&\n      typeof window !== \"undefined\" &&\n      typeof window.cancelAnimationFrame === \"function\"\n    ) {\n      window.cancelAnimationFrame(pendingGlowFrameRef.current);\n    }\n\n    pendingGlowFrameRef.current = null;\n  }, []);\n\n  const scheduleGlowState = useCallback(\n    (nextState: GlowState) => {\n      pendingGlowStateRef.current = nextState;\n\n      if (pendingGlowFrameRef.current !== null) {\n        return;\n      }\n\n      if (\n        typeof window === \"undefined\" ||\n        typeof window.requestAnimationFrame !== \"function\"\n      ) {\n        pendingGlowStateRef.current = null;\n        commitGlowState(nextState);\n        return;\n      }\n\n      pendingGlowFrameRef.current = window.requestAnimationFrame(() => {\n        pendingGlowFrameRef.current = null;\n        const pendingState = pendingGlowStateRef.current;\n        pendingGlowStateRef.current = null;\n\n        if (pendingState) {\n          commitGlowState(pendingState);\n        }\n      });\n    },\n    [commitGlowState],\n  );\n\n  const clearGlowIntensity = useCallback(() => {\n    cancelPendingGlowFrame();\n    setGlowState((prevState) => {\n      if (prevState.intensity === 0) {\n        return prevState;\n      }\n\n      return { ...prevState, intensity: 0 };\n    });\n  }, [cancelPendingGlowFrame]);\n\n  useEffect(() => {\n    if (reducedMotion) {\n      clearGlowIntensity();\n      return;\n    }\n\n    const container = containerRef.current;\n    if (!container) return;\n\n    const handleMouseMove = (e: MouseEvent) => {\n      if (!cardRef.current) return;\n      const cardRect = cardRef.current.getBoundingClientRect();\n\n      const clampedX = Math.max(\n        cardRect.left,\n        Math.min(e.clientX, cardRect.right),\n      );\n      const clampedY = Math.max(\n        cardRect.top,\n        Math.min(e.clientY, cardRect.bottom),\n      );\n\n      const distanceX =\n        e.clientX < cardRect.left\n          ? cardRect.left - e.clientX\n          : e.clientX > cardRect.right\n            ? e.clientX - cardRect.right\n            : 0;\n      const distanceY =\n        e.clientY < cardRect.top\n          ? cardRect.top - e.clientY\n          : e.clientY > cardRect.bottom\n            ? e.clientY - cardRect.bottom\n            : 0;\n      const distance = Math.sqrt(distanceX * distanceX + distanceY * distanceY);\n\n      const maxDistance = 150;\n      const intensity = Math.max(0, 1 - distance / maxDistance);\n\n      scheduleGlowState({\n        x: clampedX - cardRect.left,\n        y: clampedY - cardRect.top,\n        intensity,\n      });\n    };\n\n    const handleMouseLeave = () => {\n      clearGlowIntensity();\n    };\n\n    container.addEventListener(\"mousemove\", handleMouseMove);\n    container.addEventListener(\"mouseleave\", handleMouseLeave);\n\n    return () => {\n      container.removeEventListener(\"mousemove\", handleMouseMove);\n      container.removeEventListener(\"mouseleave\", handleMouseLeave);\n      cancelPendingGlowFrame();\n    };\n  }, [\n    reducedMotion,\n    clearGlowIntensity,\n    scheduleGlowState,\n    cancelPendingGlowFrame,\n  ]);\n\n  const roundedTemperature = Math.round(temperature);\n  const unitSymbol = unit === \"celsius\" ? \"C\" : \"F\";\n  const spokenUnit = unit === \"celsius\" ? \"Celsius\" : \"Fahrenheit\";\n  const peakIntensity = getPeakIntensity(timeOfDay);\n\n  const isDark = theme === \"dark\";\n  const textPrimary = isDark ? \"text-white\" : \"text-black\";\n  const textPrimarySoft = isDark ? \"text-white/90\" : \"text-black/85\";\n  const textSecondary = isDark ? \"text-white/80\" : \"text-black/80\";\n  const textSubtle = isDark ? \"text-white/40\" : \"text-black/40\";\n\n  const baseBgOpacity = isDark ? 0.04 : 0.04;\n  const bgOpacity = baseBgOpacity * (1 - peakIntensity * 0.7);\n  const midnightDistance = Math.min(timeOfDay, 1 - timeOfDay);\n  const baseBlur = isDark ? 2 + midnightDistance * 38 : 24;\n  const blurAmount = isDark\n    ? baseBlur\n    : baseBlur - peakIntensity * (baseBlur - 8);\n\n  // Dawn intensity peaks around timeOfDay 0.2-0.3 (morning transition)\n  const isDawn = timeOfDay > 0.1 && timeOfDay < 0.4;\n  const dawnIntensity = isDawn ? 1 - Math.abs(timeOfDay - 0.25) * 4 : 0;\n  const forecastTextShadow =\n    dawnIntensity > 0\n      ? `0 0.5px 1px rgba(0,0,0,${(dawnIntensity * 0.4).toFixed(2)})`\n      : undefined;\n\n  const shadowStyle = isDark\n    ? \"0 1px 8px rgba(0,0,0,0.3)\"\n    : \"0 1px 8px rgba(255,255,255,0.3)\";\n\n  // Fluid type scales with the widget container size. (Requires container-type:size.)\n  const locationFontSize = \"clamp(13px, 7.5cqmin, 17px)\";\n  const temperatureFontSize = \"clamp(48px, 32cqmin, 72px)\";\n  const degreeFontSize = \"clamp(18px, 12cqmin, 28px)\";\n  const hiLoFontSize = \"clamp(11px, 6.5cqmin, 15px)\";\n  const forecastFontFamily =\n    '\"SF Pro Text\", Inter, \"Noto Sans\", system-ui, sans-serif';\n\n  return (\n    <div\n      ref={containerRef}\n      className={cn(\n        \"pointer-events-auto absolute inset-0 z-10 flex select-none flex-col\",\n        className,\n      )}\n    >\n      {/* Current weather (more inset than forecast strip) */}\n      <div className=\"px-6 pt-6\">\n        <div className=\"flex flex-col items-start\">\n          <h2\n            className={cn(\n              \"font-medium leading-[1.08] tracking-tight\",\n              textSecondary,\n            )}\n            style={{\n              fontSize: locationFontSize,\n              fontFamily: forecastFontFamily,\n              textShadow: shadowStyle,\n            }}\n          >\n            {location}\n          </h2>\n\n          <div className=\"-mt-0.5 flex items-start gap-1\">\n            <span\n              className={cn(\n                \"font-[250] tabular-nums leading-[1.02] tracking-[-0.015em]\",\n                textPrimarySoft,\n              )}\n              style={{\n                fontSize: temperatureFontSize,\n                fontFamily: forecastFontFamily,\n                fontFeatureSettings: '\"tnum\" 1, \"case\" 1',\n                textShadow: isDark\n                  ? \"0 2px 20px rgba(0,0,0,0.25)\"\n                  : \"0 2px 20px rgba(255,255,255,0.3)\",\n              }}\n              aria-hidden=\"true\"\n            >\n              {roundedTemperature}\n            </span>\n            <span\n              className={cn(\"mt-2 font-[250] tabular-nums\", textSecondary)}\n              style={{\n                fontSize: degreeFontSize,\n                fontFamily: forecastFontFamily,\n                fontFeatureSettings: '\"tnum\" 1, \"case\" 1',\n              }}\n              aria-hidden=\"true\"\n            >\n              °{unitSymbol}\n            </span>\n            <span className=\"sr-only\">\n              {roundedTemperature} degrees {spokenUnit}\n            </span>\n          </div>\n\n          <div\n            className=\"mt-0.5 flex items-center gap-3\"\n            style={{\n              fontFamily: forecastFontFamily,\n              fontFeatureSettings: '\"tnum\" 1, \"case\" 1',\n            }}\n          >\n            <span\n              className=\"font-medium tabular-nums\"\n              style={{ fontSize: hiLoFontSize }}\n            >\n              <span className={textSubtle}>H </span>\n              <span className={textPrimary}>{Math.round(tempHigh)}°</span>\n            </span>\n            <span\n              className=\"font-medium tabular-nums\"\n              style={{ fontSize: hiLoFontSize }}\n            >\n              <span className={textSubtle}>L </span>\n              <span className={textPrimary}>{Math.round(tempLow)}°</span>\n            </span>\n          </div>\n        </div>\n      </div>\n\n      {/* Spacer */}\n      <div className=\"flex-1\" />\n\n      {/* Forecast strip - hidden at small container sizes (less inset than header) */}\n      {forecast.length > 0 && (\n        <div className=\"px-3 pb-3\">\n          {/* Show the strip earlier, but progressively reduce content as height shrinks. */}\n          <div ref={cardRef} className=\"weather-forecast-strip relative hidden\">\n            {/* Edge shine - outside overflow-hidden so it aligns with border */}\n            <div\n              className=\"pointer-events-none absolute inset-0 z-10 rounded-xl transition-opacity duration-300 ease-out\"\n              style={{\n                opacity: glowState.intensity,\n                background: sineEasedGradient(\n                  glowState.x,\n                  glowState.y,\n                  100,\n                  isDark ? 0.6 : 1,\n                ),\n                mask: \"linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)\",\n                maskComposite: \"exclude\",\n                WebkitMaskComposite: \"xor\",\n                padding: \"0.5px\",\n              }}\n            />\n            <div\n              className=\"relative overflow-hidden rounded-xl px-3 py-2.5\"\n              style={{\n                backgroundColor: `rgba(255, 255, 255, ${bgOpacity})`,\n                ...resolveGlassBackdropFilterStyles({\n                  glassStyles,\n                  blurAmount,\n                }),\n              }}\n            >\n              {/* Inner glow */}\n              <div\n                className=\"pointer-events-none absolute inset-0 mix-blend-color-dodge transition-opacity duration-300 ease-out\"\n                style={{\n                  opacity: glowState.intensity,\n                  background: sineEasedGradient(\n                    glowState.x,\n                    glowState.y,\n                    120,\n                    isDark ? 0.06 : 0.15,\n                  ),\n                }}\n              />\n              <div className=\"relative flex items-center justify-between\">\n                {forecast.slice(0, 5).map((day, index) => {\n                  const DayIcon = conditionIcons[day.conditionCode];\n                  return (\n                    <div\n                      key={`${day.label}-${index}`}\n                      className=\"flex flex-1 flex-col items-center gap-0.5\"\n                      style={{\n                        fontFamily: forecastFontFamily,\n                        fontFeatureSettings: '\"tnum\" 1, \"case\" 1',\n                        textShadow: forecastTextShadow,\n                      }}\n                    >\n                      <span\n                        className={cn(\n                          \"text-[10px] uppercase tracking-[0.08em]\",\n                          index === 0 ? \"font-semibold\" : \"font-medium\",\n                          textPrimary,\n                        )}\n                      >\n                        {day.label}\n                      </span>\n                      <DayIcon\n                        className={cn(\n                          \"my-0.5 size-5\",\n                          textPrimary,\n                          index === 0 ? \"opacity-100\" : \"opacity-70\",\n                          // At shorter containers (but still showing the strip),\n                          // omit the icon to preserve legibility.\n                          \"weather-forecast-icon hidden\",\n                        )}\n                        strokeWidth={1.5}\n                        aria-hidden=\"true\"\n                      />\n                      <div className=\"flex flex-col items-center gap-0.5\">\n                        <span\n                          className={cn(\n                            \"text-[15px] tabular-nums leading-[1.2] tracking-[-0.01em]\",\n                            index === 0 ? \"font-semibold\" : \"font-medium\",\n                            textPrimary,\n                          )}\n                        >\n                          {Math.round(day.tempMax)}°\n                        </span>\n                        <span\n                          className={cn(\n                            \"font-normal text-[12px] tabular-nums leading-[1.3]\",\n                            textPrimary,\n                          )}\n                        >\n                          {Math.round(day.tempMin)}°\n                        </span>\n                      </div>\n                    </div>\n                  );\n                })}\n              </div>\n            </div>\n          </div>\n        </div>\n      )}\n\n      {/* Height-based container queries (requires container-type:size on the weather container). */}\n      <style>{`\n        @container weather (min-height: 245px) {\n          .weather-forecast-strip {\n            display: block !important;\n          }\n        }\n        @container weather (min-height: 280px) {\n          .weather-forecast-icon {\n            display: block !important;\n          }\n        }\n      `}</style>\n    </div>\n  );\n}\n"
    },
    {
      "path": "components/tool-ui/weather-widget/weather-widget-container.tsx",
      "type": "registry:component",
      "target": "components/tool-ui/weather-widget/weather-widget-container.tsx",
      "content": "\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\nimport {\n  EffectCompositorRuntime,\n  getNearestCheckpoint,\n  getSceneBrightnessFromTimeOfDay,\n  getWeatherTheme,\n  resolveWeatherTime,\n  snapTimeOfDayToNearestCheckpoint,\n  TUNED_WEATHER_EFFECTS_CHECKPOINT_OVERRIDES,\n} from \"./generated/weather-runtime-core.generated\";\nimport type { WeatherWidgetRuntimeProps } from \"./schema-runtime\";\nimport { WeatherDataOverlay } from \"./weather-data-overlay\";\n\ntype TimeCheckpoint = \"dawn\" | \"noon\" | \"dusk\" | \"midnight\";\n\nexport function WeatherWidget({\n  version: _version,\n  id,\n  location,\n  units,\n  current,\n  forecast,\n  time,\n  updatedAt,\n  className,\n  effects,\n}: WeatherWidgetRuntimeProps) {\n  const [prefersReducedMotion, setPrefersReducedMotion] = useState(() => {\n    if (typeof window === \"undefined\") {\n      return false;\n    }\n\n    return (\n      window.matchMedia?.(\"(prefers-reduced-motion: reduce)\")?.matches ?? false\n    );\n  });\n\n  useEffect(() => {\n    if (\n      typeof window === \"undefined\" ||\n      typeof window.matchMedia !== \"function\"\n    ) {\n      return;\n    }\n\n    const mediaQueryList = window.matchMedia(\n      \"(prefers-reduced-motion: reduce)\",\n    );\n    setPrefersReducedMotion(mediaQueryList.matches);\n\n    const handleMotionPreferenceChange = (event: MediaQueryListEvent) => {\n      setPrefersReducedMotion(event.matches);\n    };\n\n    if (typeof mediaQueryList.addEventListener === \"function\") {\n      mediaQueryList.addEventListener(\"change\", handleMotionPreferenceChange);\n      return () => {\n        mediaQueryList.removeEventListener(\n          \"change\",\n          handleMotionPreferenceChange,\n        );\n      };\n    }\n\n    mediaQueryList.addListener(handleMotionPreferenceChange);\n    return () => {\n      mediaQueryList.removeListener(handleMotionPreferenceChange);\n    };\n  }, []);\n\n  const reducedMotion = effects?.reducedMotion ?? prefersReducedMotion;\n  const effectsEnabled = effects?.enabled !== false && !reducedMotion;\n\n  const resolvedTime = resolveWeatherTime({\n    time,\n    updatedAt,\n  });\n  const timeOfDay = snapTimeOfDayToNearestCheckpoint(resolvedTime.timeOfDay);\n  const tunedOverrides =\n    TUNED_WEATHER_EFFECTS_CHECKPOINT_OVERRIDES[current.conditionCode];\n  const checkpoint = getNearestCheckpoint(timeOfDay) as TimeCheckpoint;\n  const checkpointOverrides = tunedOverrides?.[checkpoint];\n  const glassParams =\n    checkpointOverrides && \"glass\" in checkpointOverrides\n      ? checkpointOverrides.glass\n      : undefined;\n  const brightness = getSceneBrightnessFromTimeOfDay(\n    timeOfDay,\n    current.conditionCode,\n  );\n  const weatherTheme = getWeatherTheme(brightness, undefined);\n  const isWeatherDark = weatherTheme === \"dark\";\n  const backgroundClass = isWeatherDark\n    ? \"bg-gradient-to-b from-zinc-950 via-zinc-900/70 to-zinc-950\"\n    : \"bg-gradient-to-b from-sky-50 via-sky-100/70 to-white\";\n\n  return (\n    <article\n      data-slot=\"weather-widget\"\n      data-tool-ui-id={id}\n      className={cn(\"isolate w-full max-w-md\", className)}\n    >\n      <div\n        data-slot=\"card\"\n        className={cn(\n          \"@container/weather relative aspect-[4/3] overflow-clip rounded-2xl border-0 p-0 shadow-none [container-type:size]\",\n          backgroundClass,\n        )}\n      >\n        {effectsEnabled && (\n          <EffectCompositorRuntime\n            className=\"absolute inset-0\"\n            conditionCode={current.conditionCode}\n            windSpeed={current.windSpeed}\n            precipitationLevel={current.precipitationLevel}\n            visibility={current.visibility}\n            timestamp={updatedAt}\n            timeOfDay={timeOfDay}\n            settings={effects}\n          />\n        )}\n\n        <WeatherDataOverlay\n          location={location.name}\n          conditionCode={current.conditionCode}\n          temperature={current.temperature}\n          tempHigh={current.tempMax}\n          tempLow={current.tempMin}\n          forecast={forecast}\n          unit={units.temperature}\n          theme={weatherTheme}\n          timeOfDay={timeOfDay}\n          timestamp={updatedAt}\n          glassParams={glassParams}\n          reducedMotion={reducedMotion}\n        />\n      </div>\n    </article>\n  );\n}\n"
    }
  ]
}
