shaders 2.0.647 → 2.0.648

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -86,7 +86,7 @@ fn tsl_biquadraticTexture( map : texture_2d<f32>, coord : vec2f, iRes : vec2u, l
86
86
  return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );
87
87
 
88
88
  }
89
- `)};typeof navigator<"u"&&/Windows/g.test(navigator.userAgent)&&(Ca.pow_float=new er("fn tsl_pow_float( a : f32, b : f32 ) -> f32 { return select( -pow( -a, b ), pow( a, b ), a > 0.0 ); }"),Ca.pow_vec2=new er("fn tsl_pow_vec2( a : vec2f, b : vec2f ) -> vec2f { return vec2f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ) ); }",[Ca.pow_float]),Ca.pow_vec3=new er("fn tsl_pow_vec3( a : vec3f, b : vec3f ) -> vec3f { return vec3f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ), tsl_pow_float( a.z, b.z ) ); }",[Ca.pow_float]),Ca.pow_vec4=new er("fn tsl_pow_vec4( a : vec4f, b : vec4f ) -> vec4f { return vec4f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ), tsl_pow_float( a.z, b.z ), tsl_pow_float( a.w, b.w ) ); }",[Ca.pow_float]));var _e={};YC(_e,{BRDF_GGX:()=>BF,BRDF_Lambert:()=>DF,BasicShadowFilter:()=>UF,Break:()=>$F,Const:()=>Yk,Continue:()=>jF,DFGApprox:()=>WF,D_GGX:()=>qF,Discard:()=>HF,EPSILON:()=>GF,F_Schlick:()=>XF,Fn:()=>YF,INFINITY:()=>ZF,If:()=>JF,Loop:()=>KF,NodeAccess:()=>sO,NodeShaderStage:()=>tO,NodeType:()=>eO,NodeUpdateType:()=>rO,PCFShadowFilter:()=>iO,PCFSoftShadowFilter:()=>nO,PI:()=>aO,PI2:()=>oO,Return:()=>lO,Schlick_to_F0:()=>uO,ScriptableNodeResources:()=>hO,ShaderNode:()=>cO,Switch:()=>QF,TBNViewMatrix:()=>dO,VSMShadowFilter:()=>pO,V_GGX_SmithCorrelated:()=>mO,Var:()=>ij,abs:()=>fO,acesFilmicToneMapping:()=>gO,acos:()=>yO,add:()=>xO,addNodeElement:()=>bO,agxToneMapping:()=>vO,all:()=>MO,alphaT:()=>wO,and:()=>TO,anisotropy:()=>NO,anisotropyB:()=>SO,anisotropyT:()=>_O,any:()=>AO,append:()=>CO,array:()=>zO,arrayBuffer:()=>EO,asin:()=>VO,assign:()=>RO,atan:()=>IO,atan2:()=>LO,atomicAdd:()=>PO,atomicAnd:()=>FO,atomicFunc:()=>OO,atomicLoad:()=>WO,atomicMax:()=>kO,atomicMin:()=>BO,atomicOr:()=>DO,atomicStore:()=>UO,atomicSub:()=>$O,atomicXor:()=>jO,attenuationColor:()=>qO,attenuationDistance:()=>HO,attribute:()=>GO,attributeArray:()=>XO,backgroundBlurriness:()=>YO,backgroundIntensity:()=>ZO,backgroundRotation:()=>JO,batch:()=>QO,billboarding:()=>KO,bitAnd:()=>tk,bitNot:()=>ek,bitOr:()=>rk,bitXor:()=>sk,bitangentGeometry:()=>ik,bitangentLocal:()=>nk,bitangentView:()=>ak,bitangentWorld:()=>ok,bitcast:()=>lk,blendBurn:()=>uk,blendColor:()=>hk,blendDodge:()=>ck,blendOverlay:()=>dk,blendScreen:()=>pk,blur:()=>mk,bool:()=>fk,buffer:()=>gk,bufferAttribute:()=>yk,bumpMap:()=>xk,burn:()=>bk,bvec2:()=>vk,bvec3:()=>Mk,bvec4:()=>wk,bypass:()=>Tk,cache:()=>Nk,call:()=>Sk,cameraFar:()=>_k,cameraIndex:()=>Ak,cameraNear:()=>Ck,cameraNormalMatrix:()=>zk,cameraPosition:()=>Ek,cameraProjectionMatrix:()=>Vk,cameraProjectionMatrixInverse:()=>Rk,cameraViewMatrix:()=>Ik,cameraWorldMatrix:()=>Lk,cbrt:()=>Pk,cdl:()=>Fk,ceil:()=>Ok,checker:()=>kk,cineonToneMapping:()=>Bk,clamp:()=>JN,clearcoat:()=>Dk,clearcoatRoughness:()=>Uk,code:()=>$k,color:()=>jk,colorSpaceToWorking:()=>Wk,colorToDirection:()=>qk,compute:()=>Hk,computeSkinning:()=>Gk,cond:()=>Xk,context:()=>Zk,convert:()=>Jk,convertColorSpace:()=>Qk,convertToTexture:()=>Kk,cos:()=>Gd,cross:()=>t9,cubeTexture:()=>e9,dFdx:()=>r9,dFdy:()=>s9,dashSize:()=>i9,debug:()=>n9,decrement:()=>a9,decrementBefore:()=>o9,defaultBuildStages:()=>l9,defaultShaderStages:()=>u9,defined:()=>h9,degrees:()=>c9,deltaTime:()=>d9,densityFog:()=>p9,densityFogFactor:()=>m9,depth:()=>f9,depthPass:()=>g9,difference:()=>y9,diffuseColor:()=>x9,directPointLight:()=>b9,directionToColor:()=>v9,dispersion:()=>M9,distance:()=>w9,div:()=>T9,dodge:()=>N9,dot:()=>Pg,drawIndex:()=>S9,dynamicBufferAttribute:()=>_9,element:()=>A9,emissive:()=>C9,equal:()=>z9,equals:()=>E9,equirectUV:()=>V9,exp:()=>R9,exp2:()=>I9,expression:()=>L9,faceDirection:()=>P9,faceForward:()=>F9,faceforward:()=>O9,float:()=>Fg,floor:()=>k9,fog:()=>B9,fract:()=>Og,frameGroup:()=>D9,frameId:()=>U9,frontFacing:()=>$9,fwidth:()=>QN,gain:()=>j9,gapSize:()=>W9,getConstNodeType:()=>q9,getCurrentStack:()=>H9,getDirection:()=>G9,getDistanceAttenuation:()=>X9,getGeometryRoughness:()=>Y9,getNormalFromDepth:()=>Z9,getParallaxCorrectNormal:()=>J9,getRoughness:()=>Q9,getScreenPosition:()=>K9,getShIrradianceAt:()=>tB,getShadowMaterial:()=>sB,getShadowRenderObjectFunction:()=>iB,getTextureIndex:()=>eB,getViewPosition:()=>rB,globalId:()=>ZB,glsl:()=>nB,glslFn:()=>aB,grayscale:()=>oB,greaterThan:()=>lB,greaterThanEqual:()=>uB,hash:()=>hB,highpModelNormalViewMatrix:()=>cB,highpModelViewMatrix:()=>dB,hue:()=>pB,increment:()=>mB,incrementBefore:()=>fB,instance:()=>gB,instanceIndex:()=>yB,instancedArray:()=>xB,instancedBufferAttribute:()=>bB,instancedDynamicBufferAttribute:()=>vB,instancedMesh:()=>MB,int:()=>wB,inverseSqrt:()=>TB,inversesqrt:()=>NB,invocationLocalIndex:()=>SB,invocationSubgroupIndex:()=>_B,ior:()=>AB,iridescence:()=>CB,iridescenceIOR:()=>zB,iridescenceThickness:()=>EB,ivec2:()=>VB,ivec3:()=>RB,ivec4:()=>IB,js:()=>LB,label:()=>PB,length:()=>FB,lengthSq:()=>OB,lessThan:()=>kB,lessThanEqual:()=>BB,lightPosition:()=>DB,lightProjectionUV:()=>GD,lightShadowMatrix:()=>UB,lightTargetDirection:()=>$B,lightTargetPosition:()=>jB,lightViewPosition:()=>WB,lightingContext:()=>qB,lights:()=>HB,linearDepth:()=>GB,linearToneMapping:()=>XB,localId:()=>YB,log:()=>JB,log2:()=>QB,logarithmicDepthToViewZ:()=>KB,loop:()=>t7,luminance:()=>e7,mat2:()=>s7,mat3:()=>i7,mat4:()=>n7,matcapUV:()=>a7,materialAO:()=>o7,materialAlphaTest:()=>l7,materialAnisotropy:()=>u7,materialAnisotropyVector:()=>h7,materialAttenuationColor:()=>c7,materialAttenuationDistance:()=>d7,materialClearcoat:()=>p7,materialClearcoatNormal:()=>m7,materialClearcoatRoughness:()=>f7,materialColor:()=>g7,materialDispersion:()=>y7,materialEmissive:()=>x7,materialIOR:()=>b7,materialIridescence:()=>v7,materialIridescenceIOR:()=>M7,materialIridescenceThickness:()=>w7,materialLightMap:()=>T7,materialLineDashOffset:()=>N7,materialLineDashSize:()=>S7,materialLineGapSize:()=>_7,materialLineScale:()=>A7,materialLineWidth:()=>C7,materialMetalness:()=>z7,materialNormal:()=>E7,materialOpacity:()=>V7,materialPointSize:()=>R7,materialReference:()=>I7,materialReflectivity:()=>L7,materialRefractionRatio:()=>P7,materialRotation:()=>F7,materialRoughness:()=>O7,materialSheen:()=>k7,materialSheenRoughness:()=>B7,materialShininess:()=>D7,materialSpecular:()=>U7,materialSpecularColor:()=>$7,materialSpecularIntensity:()=>j7,materialSpecularStrength:()=>W7,materialThickness:()=>q7,materialTransmission:()=>H7,max:()=>G7,maxMipLevel:()=>X7,mediumpModelViewMatrix:()=>r7,metalness:()=>Y7,min:()=>Z7,mix:()=>Nl,mixElement:()=>J7,mod:()=>Q7,modInt:()=>K7,modelDirection:()=>t8,modelNormalMatrix:()=>e8,modelPosition:()=>r8,modelRadius:()=>s8,modelScale:()=>i8,modelViewMatrix:()=>n8,modelViewPosition:()=>a8,modelViewProjection:()=>o8,modelWorldMatrix:()=>l8,modelWorldMatrixInverse:()=>u8,morphReference:()=>h8,mrt:()=>c8,mul:()=>d8,mx_aastep:()=>p8,mx_cell_noise_float:()=>m8,mx_contrast:()=>f8,mx_fractal_noise_float:()=>g8,mx_fractal_noise_vec2:()=>y8,mx_fractal_noise_vec3:()=>x8,mx_fractal_noise_vec4:()=>b8,mx_hsvtorgb:()=>v8,mx_noise_float:()=>M8,mx_noise_vec3:()=>w8,mx_noise_vec4:()=>T8,mx_ramplr:()=>N8,mx_ramptb:()=>S8,mx_rgbtohsv:()=>_8,mx_safepower:()=>A8,mx_splitlr:()=>C8,mx_splittb:()=>z8,mx_srgb_texture_to_lin_rec709:()=>E8,mx_transform_uv:()=>V8,mx_worley_noise_float:()=>R8,mx_worley_noise_vec2:()=>I8,mx_worley_noise_vec3:()=>L8,namespace:()=>P8,negate:()=>F8,neutralToneMapping:()=>O8,nodeArray:()=>k8,nodeImmutable:()=>B8,nodeObject:()=>D8,nodeObjects:()=>U8,nodeProxy:()=>$8,normalFlat:()=>j8,normalGeometry:()=>W8,normalLocal:()=>q8,normalMap:()=>H8,normalView:()=>G8,normalWorld:()=>X8,normalize:()=>Y8,not:()=>Z8,notEqual:()=>J8,numWorkgroups:()=>Q8,objectDirection:()=>K8,objectGroup:()=>tD,objectPosition:()=>eD,objectRadius:()=>rD,objectScale:()=>sD,objectViewPosition:()=>iD,objectWorldMatrix:()=>nD,oneMinus:()=>aD,or:()=>oD,orthographicDepthToViewZ:()=>lD,oscSawtooth:()=>uD,oscSine:()=>hD,oscSquare:()=>cD,oscTriangle:()=>dD,output:()=>pD,outputStruct:()=>mD,overlay:()=>fD,overloadingFn:()=>gD,parabola:()=>yD,parallaxDirection:()=>xD,parallaxUV:()=>bD,parameter:()=>vD,pass:()=>MD,passTexture:()=>wD,pcurve:()=>TD,perspectiveDepthToViewZ:()=>ND,pmremTexture:()=>SD,pointShadow:()=>VU,pointUV:()=>_D,pointWidth:()=>AD,positionGeometry:()=>CD,positionLocal:()=>zD,positionPrevious:()=>ED,positionView:()=>VD,positionViewDirection:()=>RD,positionWorld:()=>ID,positionWorldDirection:()=>LD,posterize:()=>PD,pow:()=>KN,pow2:()=>FD,pow3:()=>OD,pow4:()=>kD,premult:()=>BD,property:()=>DD,radians:()=>UD,rand:()=>$D,range:()=>jD,rangeFog:()=>WD,rangeFogFactor:()=>qD,reciprocal:()=>HD,reference:()=>XD,referenceBuffer:()=>YD,reflect:()=>ZD,reflectVector:()=>JD,reflectView:()=>QD,reflector:()=>KD,refract:()=>tU,refractVector:()=>eU,refractView:()=>rU,reinhardToneMapping:()=>sU,remainder:()=>iU,remap:()=>nU,remapClamp:()=>aU,renderGroup:()=>oU,renderOutput:()=>lU,rendererReference:()=>uU,rotate:()=>hU,rotateUV:()=>cU,roughness:()=>dU,round:()=>pU,rtt:()=>mU,sRGBTransferEOTF:()=>fU,sRGBTransferOETF:()=>gU,sampler:()=>yU,samplerComparison:()=>xU,saturate:()=>bU,saturation:()=>vU,screen:()=>MU,screenCoordinate:()=>wU,screenSize:()=>TU,screenUV:()=>NU,scriptable:()=>SU,scriptableValue:()=>_U,select:()=>AU,setCurrentStack:()=>CU,shaderStages:()=>zU,shadow:()=>EU,shadowPositionWorld:()=>RU,shapeCircle:()=>LU,sharedUniformGroup:()=>IU,sheen:()=>PU,sheenRoughness:()=>FU,shiftLeft:()=>OU,shiftRight:()=>kU,shininess:()=>BU,sign:()=>DU,sin:()=>Zn,sinc:()=>UU,skinning:()=>$U,smoothstep:()=>kg,smoothstepElement:()=>jU,specularColor:()=>WU,specularF90:()=>qU,spherizeUV:()=>HU,split:()=>GU,spritesheetUV:()=>XU,sqrt:()=>YU,stack:()=>ZU,step:()=>JU,storage:()=>QU,storageBarrier:()=>KU,storageObject:()=>t$,storageTexture:()=>e$,string:()=>r$,struct:()=>s$,sub:()=>i$,subgroupIndex:()=>n$,subgroupSize:()=>a$,tan:()=>o$,tangentGeometry:()=>l$,tangentLocal:()=>u$,tangentView:()=>h$,tangentWorld:()=>c$,temp:()=>d$,texture:()=>p$,texture3D:()=>m$,textureBarrier:()=>f$,textureBicubic:()=>g$,textureCubeUV:()=>y$,textureLoad:()=>x$,textureSize:()=>b$,textureStore:()=>v$,thickness:()=>M$,time:()=>S0,timerDelta:()=>w$,timerGlobal:()=>T$,timerLocal:()=>N$,toneMapping:()=>S$,toneMappingExposure:()=>_$,toonOutlinePass:()=>A$,transformDirection:()=>C$,transformNormal:()=>z$,transformNormalToView:()=>E$,transformedBentNormalView:()=>V$,transformedBitangentView:()=>R$,transformedBitangentWorld:()=>I$,transformedClearcoatNormalView:()=>L$,transformedNormalView:()=>P$,transformedNormalWorld:()=>F$,transformedTangentView:()=>O$,transformedTangentWorld:()=>k$,transmission:()=>B$,transpose:()=>D$,triNoise3D:()=>U$,triplanarTexture:()=>$$,triplanarTextures:()=>j$,trunc:()=>W$,tslFn:()=>q$,uint:()=>H$,uniform:()=>G$,uniformArray:()=>Y$,uniformCubeTexture:()=>X$,uniformGroup:()=>Z$,uniformTexture:()=>J$,uniforms:()=>Q$,unpremult:()=>K$,userData:()=>tj,uv:()=>_0,uvec2:()=>ej,uvec3:()=>rj,uvec4:()=>sj,varying:()=>nj,varyingProperty:()=>aj,vec2:()=>A0,vec3:()=>oj,vec4:()=>oh,vectorComponents:()=>lj,velocity:()=>uj,vertexColor:()=>hj,vertexIndex:()=>cj,vibrance:()=>dj,viewZToLogarithmicDepth:()=>pj,viewZToOrthographicDepth:()=>mj,viewZToPerspectiveDepth:()=>fj,viewport:()=>gj,viewportBottomLeft:()=>yj,viewportCoordinate:()=>xj,viewportDepthTexture:()=>bj,viewportLinearDepth:()=>vj,viewportMipTexture:()=>Mj,viewportResolution:()=>wj,viewportSafeUV:()=>Tj,viewportSharedTexture:()=>Nj,viewportSize:()=>Sj,viewportTexture:()=>_j,viewportTopLeft:()=>Aj,viewportUV:()=>Cj,wgsl:()=>zj,wgslFn:()=>Ej,workgroupArray:()=>Vj,workgroupBarrier:()=>Rj,workgroupId:()=>Ij,workingToColorSpace:()=>Lj,xor:()=>Pj});const BF=g.BRDF_GGX,DF=g.BRDF_Lambert,UF=g.BasicShadowFilter,$F=g.Break,jF=g.Continue,WF=g.DFGApprox,qF=g.D_GGX,HF=g.Discard,GF=g.EPSILON,XF=g.F_Schlick,YF=g.Fn,ZF=g.INFINITY,JF=g.If,QF=g.Switch,KF=g.Loop,tO=g.NodeShaderStage,eO=g.NodeType,rO=g.NodeUpdateType,sO=g.NodeAccess,iO=g.PCFShadowFilter,nO=g.PCFSoftShadowFilter,aO=g.PI,oO=g.PI2,lO=g.Return,uO=g.Schlick_to_F0,hO=g.ScriptableNodeResources,cO=g.ShaderNode,dO=g.TBNViewMatrix,pO=g.VSMShadowFilter,mO=g.V_GGX_SmithCorrelated,fO=g.abs,gO=g.acesFilmicToneMapping,yO=g.acos,xO=g.add,bO=g.addNodeElement,vO=g.agxToneMapping,MO=g.all,wO=g.alphaT,TO=g.and,NO=g.anisotropy,SO=g.anisotropyB,_O=g.anisotropyT,AO=g.any,CO=g.append,zO=g.array,EO=g.arrayBuffer,VO=g.asin,RO=g.assign,IO=g.atan,LO=g.atan2,PO=g.atomicAdd,FO=g.atomicAnd,OO=g.atomicFunc,kO=g.atomicMax,BO=g.atomicMin,DO=g.atomicOr,UO=g.atomicStore,$O=g.atomicSub,jO=g.atomicXor,WO=g.atomicLoad,qO=g.attenuationColor,HO=g.attenuationDistance,GO=g.attribute,XO=g.attributeArray,YO=g.backgroundBlurriness,ZO=g.backgroundIntensity,JO=g.backgroundRotation,QO=g.batch,KO=g.billboarding,tk=g.bitAnd,ek=g.bitNot,rk=g.bitOr,sk=g.bitXor,ik=g.bitangentGeometry,nk=g.bitangentLocal,ak=g.bitangentView,ok=g.bitangentWorld,lk=g.bitcast,uk=g.blendBurn,hk=g.blendColor,ck=g.blendDodge,dk=g.blendOverlay,pk=g.blendScreen,mk=g.blur,fk=g.bool,gk=g.buffer,yk=g.bufferAttribute,xk=g.bumpMap,bk=g.burn,vk=g.bvec2,Mk=g.bvec3,wk=g.bvec4,Tk=g.bypass,Nk=g.cache,Sk=g.call,_k=g.cameraFar,Ak=g.cameraIndex,Ck=g.cameraNear,zk=g.cameraNormalMatrix,Ek=g.cameraPosition,Vk=g.cameraProjectionMatrix,Rk=g.cameraProjectionMatrixInverse,Ik=g.cameraViewMatrix,Lk=g.cameraWorldMatrix,Pk=g.cbrt,Fk=g.cdl,Ok=g.ceil,kk=g.checker,Bk=g.cineonToneMapping,JN=g.clamp,Dk=g.clearcoat,Uk=g.clearcoatRoughness,$k=g.code,jk=g.color,Wk=g.colorSpaceToWorking,qk=g.colorToDirection,Hk=g.compute,Gk=g.computeSkinning,Xk=g.cond,Yk=g.Const,Zk=g.context,Jk=g.convert,Qk=g.convertColorSpace,Kk=g.convertToTexture,Gd=g.cos,t9=g.cross,e9=g.cubeTexture,r9=g.dFdx,s9=g.dFdy,i9=g.dashSize,n9=g.debug,a9=g.decrement,o9=g.decrementBefore,l9=g.defaultBuildStages,u9=g.defaultShaderStages,h9=g.defined,c9=g.degrees,d9=g.deltaTime,p9=g.densityFog,m9=g.densityFogFactor,f9=g.depth,g9=g.depthPass,y9=g.difference,x9=g.diffuseColor,b9=g.directPointLight,v9=g.directionToColor,M9=g.dispersion,w9=g.distance,T9=g.div,N9=g.dodge,Pg=g.dot,S9=g.drawIndex,_9=g.dynamicBufferAttribute,A9=g.element,C9=g.emissive,z9=g.equal,E9=g.equals,V9=g.equirectUV,R9=g.exp,I9=g.exp2,L9=g.expression,P9=g.faceDirection,F9=g.faceForward,O9=g.faceforward,Fg=g.float,k9=g.floor,B9=g.fog,Og=g.fract,D9=g.frameGroup,U9=g.frameId,$9=g.frontFacing,QN=g.fwidth,j9=g.gain,W9=g.gapSize,q9=g.getConstNodeType,H9=g.getCurrentStack,G9=g.getDirection,X9=g.getDistanceAttenuation,Y9=g.getGeometryRoughness,Z9=g.getNormalFromDepth,J9=g.getParallaxCorrectNormal,Q9=g.getRoughness,K9=g.getScreenPosition,tB=g.getShIrradianceAt,eB=g.getTextureIndex,rB=g.getViewPosition,sB=g.getShadowMaterial,iB=g.getShadowRenderObjectFunction,nB=g.glsl,aB=g.glslFn,oB=g.grayscale,lB=g.greaterThan,uB=g.greaterThanEqual,hB=g.hash,cB=g.highpModelNormalViewMatrix,dB=g.highpModelViewMatrix,pB=g.hue,mB=g.increment,fB=g.incrementBefore,gB=g.instance,yB=g.instanceIndex,xB=g.instancedArray,bB=g.instancedBufferAttribute,vB=g.instancedDynamicBufferAttribute,MB=g.instancedMesh,wB=g.int,TB=g.inverseSqrt,NB=g.inversesqrt,SB=g.invocationLocalIndex,_B=g.invocationSubgroupIndex,AB=g.ior,CB=g.iridescence,zB=g.iridescenceIOR,EB=g.iridescenceThickness,VB=g.ivec2,RB=g.ivec3,IB=g.ivec4,LB=g.js,PB=g.label,FB=g.length,OB=g.lengthSq,kB=g.lessThan,BB=g.lessThanEqual,DB=g.lightPosition,UB=g.lightShadowMatrix,$B=g.lightTargetDirection,jB=g.lightTargetPosition,WB=g.lightViewPosition,qB=g.lightingContext,HB=g.lights,GB=g.linearDepth,XB=g.linearToneMapping,YB=g.localId,ZB=g.globalId,JB=g.log,QB=g.log2,KB=g.logarithmicDepthToViewZ,t7=g.loop,e7=g.luminance,r7=g.mediumpModelViewMatrix,s7=g.mat2,i7=g.mat3,n7=g.mat4,a7=g.matcapUV,o7=g.materialAO,l7=g.materialAlphaTest,u7=g.materialAnisotropy,h7=g.materialAnisotropyVector,c7=g.materialAttenuationColor,d7=g.materialAttenuationDistance,p7=g.materialClearcoat,m7=g.materialClearcoatNormal,f7=g.materialClearcoatRoughness,g7=g.materialColor,y7=g.materialDispersion,x7=g.materialEmissive,b7=g.materialIOR,v7=g.materialIridescence,M7=g.materialIridescenceIOR,w7=g.materialIridescenceThickness,T7=g.materialLightMap,N7=g.materialLineDashOffset,S7=g.materialLineDashSize,_7=g.materialLineGapSize,A7=g.materialLineScale,C7=g.materialLineWidth,z7=g.materialMetalness,E7=g.materialNormal,V7=g.materialOpacity,R7=g.materialPointSize,I7=g.materialReference,L7=g.materialReflectivity,P7=g.materialRefractionRatio,F7=g.materialRotation,O7=g.materialRoughness,k7=g.materialSheen,B7=g.materialSheenRoughness,D7=g.materialShininess,U7=g.materialSpecular,$7=g.materialSpecularColor,j7=g.materialSpecularIntensity,W7=g.materialSpecularStrength,q7=g.materialThickness,H7=g.materialTransmission,G7=g.max,X7=g.maxMipLevel,Y7=g.metalness,Z7=g.min,Nl=g.mix,J7=g.mixElement,Q7=g.mod,K7=g.modInt,t8=g.modelDirection,e8=g.modelNormalMatrix,r8=g.modelPosition,s8=g.modelRadius,i8=g.modelScale,n8=g.modelViewMatrix,a8=g.modelViewPosition,o8=g.modelViewProjection,l8=g.modelWorldMatrix,u8=g.modelWorldMatrixInverse,h8=g.morphReference,c8=g.mrt,d8=g.mul,p8=g.mx_aastep,m8=g.mx_cell_noise_float,f8=g.mx_contrast,g8=g.mx_fractal_noise_float,y8=g.mx_fractal_noise_vec2,x8=g.mx_fractal_noise_vec3,b8=g.mx_fractal_noise_vec4,v8=g.mx_hsvtorgb,M8=g.mx_noise_float,w8=g.mx_noise_vec3,T8=g.mx_noise_vec4,N8=g.mx_ramplr,S8=g.mx_ramptb,_8=g.mx_rgbtohsv,A8=g.mx_safepower,C8=g.mx_splitlr,z8=g.mx_splittb,E8=g.mx_srgb_texture_to_lin_rec709,V8=g.mx_transform_uv,R8=g.mx_worley_noise_float,I8=g.mx_worley_noise_vec2,L8=g.mx_worley_noise_vec3,P8=g.namespace,F8=g.negate,O8=g.neutralToneMapping,k8=g.nodeArray,B8=g.nodeImmutable,D8=g.nodeObject,U8=g.nodeObjects,$8=g.nodeProxy,j8=g.normalFlat,W8=g.normalGeometry,q8=g.normalLocal,H8=g.normalMap,G8=g.normalView,X8=g.normalWorld,Y8=g.normalize,Z8=g.not,J8=g.notEqual,Q8=g.numWorkgroups,K8=g.objectDirection,tD=g.objectGroup,eD=g.objectPosition,rD=g.objectRadius,sD=g.objectScale,iD=g.objectViewPosition,nD=g.objectWorldMatrix,aD=g.oneMinus,oD=g.or,lD=g.orthographicDepthToViewZ,uD=g.oscSawtooth,hD=g.oscSine,cD=g.oscSquare,dD=g.oscTriangle,pD=g.output,mD=g.outputStruct,fD=g.overlay,gD=g.overloadingFn,yD=g.parabola,xD=g.parallaxDirection,bD=g.parallaxUV,vD=g.parameter,MD=g.pass,wD=g.passTexture,TD=g.pcurve,ND=g.perspectiveDepthToViewZ,SD=g.pmremTexture,_D=g.pointUV,AD=g.pointWidth,CD=g.positionGeometry,zD=g.positionLocal,ED=g.positionPrevious,VD=g.positionView,RD=g.positionViewDirection,ID=g.positionWorld,LD=g.positionWorldDirection,PD=g.posterize,KN=g.pow,FD=g.pow2,OD=g.pow3,kD=g.pow4,BD=g.premult,DD=g.property,UD=g.radians,$D=g.rand,jD=g.range,WD=g.rangeFog,qD=g.rangeFogFactor,HD=g.reciprocal,GD=g.lightProjectionUV,XD=g.reference,YD=g.referenceBuffer,ZD=g.reflect,JD=g.reflectVector,QD=g.reflectView,KD=g.reflector,tU=g.refract,eU=g.refractVector,rU=g.refractView,sU=g.reinhardToneMapping,iU=g.remainder,nU=g.remap,aU=g.remapClamp,oU=g.renderGroup,lU=g.renderOutput,uU=g.rendererReference,hU=g.rotate,cU=g.rotateUV,dU=g.roughness,pU=g.round,mU=g.rtt,fU=g.sRGBTransferEOTF,gU=g.sRGBTransferOETF,yU=g.sampler,xU=g.samplerComparison,bU=g.saturate,vU=g.saturation,MU=g.screen,wU=g.screenCoordinate,TU=g.screenSize,NU=g.screenUV,SU=g.scriptable,_U=g.scriptableValue,AU=g.select,CU=g.setCurrentStack,zU=g.shaderStages,EU=g.shadow,VU=g.pointShadow,RU=g.shadowPositionWorld,IU=g.sharedUniformGroup,LU=g.shapeCircle,PU=g.sheen,FU=g.sheenRoughness,OU=g.shiftLeft,kU=g.shiftRight,BU=g.shininess,DU=g.sign,Zn=g.sin,UU=g.sinc,$U=g.skinning,kg=g.smoothstep,jU=g.smoothstepElement,WU=g.specularColor,qU=g.specularF90,HU=g.spherizeUV,GU=g.split,XU=g.spritesheetUV,YU=g.sqrt,ZU=g.stack,JU=g.step,QU=g.storage,KU=g.storageBarrier,t$=g.storageObject,e$=g.storageTexture,r$=g.string,s$=g.struct,i$=g.sub,n$=g.subgroupIndex,a$=g.subgroupSize,o$=g.tan,l$=g.tangentGeometry,u$=g.tangentLocal,h$=g.tangentView,c$=g.tangentWorld,d$=g.temp,p$=g.texture,m$=g.texture3D,f$=g.textureBarrier,g$=g.textureBicubic,y$=g.textureCubeUV,x$=g.textureLoad,b$=g.textureSize,v$=g.textureStore,M$=g.thickness,S0=g.time,w$=g.timerDelta,T$=g.timerGlobal,N$=g.timerLocal,S$=g.toneMapping,_$=g.toneMappingExposure,A$=g.toonOutlinePass,C$=g.transformDirection,z$=g.transformNormal,E$=g.transformNormalToView,V$=g.transformedBentNormalView,R$=g.transformedBitangentView,I$=g.transformedBitangentWorld,L$=g.transformedClearcoatNormalView,P$=g.transformedNormalView,F$=g.transformedNormalWorld,O$=g.transformedTangentView,k$=g.transformedTangentWorld,B$=g.transmission,D$=g.transpose,U$=g.triNoise3D,$$=g.triplanarTexture,j$=g.triplanarTextures,W$=g.trunc,q$=g.tslFn,H$=g.uint,G$=g.uniform,X$=g.uniformCubeTexture,Y$=g.uniformArray,Z$=g.uniformGroup,J$=g.uniformTexture,Q$=g.uniforms,K$=g.unpremult,tj=g.userData,_0=g.uv,ej=g.uvec2,rj=g.uvec3,sj=g.uvec4,ij=g.Var,nj=g.varying,aj=g.varyingProperty,A0=g.vec2,oj=g.vec3,oh=g.vec4,lj=g.vectorComponents,uj=g.velocity,hj=g.vertexColor,cj=g.vertexIndex,dj=g.vibrance,pj=g.viewZToLogarithmicDepth,mj=g.viewZToOrthographicDepth,fj=g.viewZToPerspectiveDepth,gj=g.viewport,yj=g.viewportBottomLeft,xj=g.viewportCoordinate,bj=g.viewportDepthTexture,vj=g.viewportLinearDepth,Mj=g.viewportMipTexture,wj=g.viewportResolution,Tj=g.viewportSafeUV,Nj=g.viewportSharedTexture,Sj=g.viewportSize,_j=g.viewportTexture,Aj=g.viewportTopLeft,Cj=g.viewportUV,zj=g.wgsl,Ej=g.wgslFn,Vj=g.workgroupArray,Rj=g.workgroupBarrier,Ij=g.workgroupId,Lj=g.workingToColorSpace,Pj=g.xor,Sl={name:"ASCII",props:{characters:{default:"@%#*+=-:.",description:"Characters to use for ASCII effect (light to dark)"},cellSize:{default:30,description:"Size of each ASCII character cell in pixels"},fontFamily:{default:"jetbrains mono",description:"Font family for characters"}},fragmentNode:({uniforms:e,childNode:t,onCleanup:r,onBeforeRender:s,canvas:i})=>{let{vec2:n,vec3:a,vec4:o,floor:l,fract:h,dot:u,screenUV:c,convertToTexture:d,texture:p}=_e;if(!t)return o(0,0,0,0);let m=Math.round(i.clientWidth),f=Math.round(i.clientHeight),x=d(t,m,f),b=(xr,Zt,Yr)=>{let pi=xr.length,Tr=Math.max(2,Math.ceil(Math.sqrt(pi))),An=Math.max(8,Zt-4),fs=document.createElement("canvas");fs.width=Tr*Zt,fs.height=Tr*Zt;let gs=fs.getContext("2d");gs.fillStyle="#000000",gs.fillRect(0,0,fs.width,fs.height),gs.fillStyle="#ffffff",gs.font=`${An}px ${Yr}`,gs.textAlign="center",gs.textBaseline="middle";for(let Cn=0;Cn<pi;Cn++){let jC=xr[Cn],WC=Math.floor(Cn/Tr),qC=Cn%Tr,HC=qC*Zt+Zt/2,GC=WC*Zt+Zt/2;gs.fillText(jC,HC,GC)}return console.log(`Atlas created: ${pi} chars, ${Tr}x${Tr} grid, ${fs.width}x${fs.height}px`),console.log(`Characters: "${xr}"`),{canvas:fs,atlasSize:Tr,cellSize:Zt,charCount:pi}},v=b(e.characters.uniform.value,e.cellSize.uniform.value,e.fontFamily.uniform.value),T=new Ye.CanvasTexture(v.canvas);T.minFilter=Ye.NearestFilter,T.magFilter=Ye.NearestFilter,T.generateMipmaps=!1;let _=p(T),E=e.characters.uniform.value,C=e.cellSize.uniform.value,A=e.fontFamily.uniform.value,I=()=>{let xr=e.characters.uniform.value,Zt=e.cellSize.uniform.value,Yr=e.fontFamily.uniform.value;(xr!==E||Zt!==C||Yr!==A)&&(v=b(xr,Zt,Yr),T.image=v.canvas,T.needsUpdate=!0,E=xr,C=Zt,A=Yr)};s(()=>{I()}),r(()=>{T.dispose()});let Q=e.cellSize.uniform,ot=n(m,f).div(Q),K=c.mul(ot),mt=l(K),nt=h(K),yt=mt.add(n(.5)).div(ot),lt=x.sample(yt),Nt=u(lt.rgb,a(.299,.587,.114)),ht=v.charCount,Mt=Nt.mul(.8).add(.1),ut=Mt.mul(ht),at=l(ut.min(ht-1e-4)),gt=v.atlasSize,Ot=at.mod(gt),jt=l(at.div(gt)),be=1/gt,se=n(nt.x,nt.y.sub(1).mul(-1)),Ae=n(Ot,jt).mul(be).add(se.mul(be)),di=_.sample(Ae);return o(di.rgb.mul(lt.rgb),lt.a)}};/**
89
+ `)};typeof navigator<"u"&&/Windows/g.test(navigator.userAgent)&&(Ca.pow_float=new er("fn tsl_pow_float( a : f32, b : f32 ) -> f32 { return select( -pow( -a, b ), pow( a, b ), a > 0.0 ); }"),Ca.pow_vec2=new er("fn tsl_pow_vec2( a : vec2f, b : vec2f ) -> vec2f { return vec2f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ) ); }",[Ca.pow_float]),Ca.pow_vec3=new er("fn tsl_pow_vec3( a : vec3f, b : vec3f ) -> vec3f { return vec3f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ), tsl_pow_float( a.z, b.z ) ); }",[Ca.pow_float]),Ca.pow_vec4=new er("fn tsl_pow_vec4( a : vec4f, b : vec4f ) -> vec4f { return vec4f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ), tsl_pow_float( a.z, b.z ), tsl_pow_float( a.w, b.w ) ); }",[Ca.pow_float]));var _e={};YC(_e,{BRDF_GGX:()=>BF,BRDF_Lambert:()=>DF,BasicShadowFilter:()=>UF,Break:()=>$F,Const:()=>Yk,Continue:()=>jF,DFGApprox:()=>WF,D_GGX:()=>qF,Discard:()=>HF,EPSILON:()=>GF,F_Schlick:()=>XF,Fn:()=>YF,INFINITY:()=>ZF,If:()=>JF,Loop:()=>KF,NodeAccess:()=>sO,NodeShaderStage:()=>tO,NodeType:()=>eO,NodeUpdateType:()=>rO,PCFShadowFilter:()=>iO,PCFSoftShadowFilter:()=>nO,PI:()=>aO,PI2:()=>oO,Return:()=>lO,Schlick_to_F0:()=>uO,ScriptableNodeResources:()=>hO,ShaderNode:()=>cO,Switch:()=>QF,TBNViewMatrix:()=>dO,VSMShadowFilter:()=>pO,V_GGX_SmithCorrelated:()=>mO,Var:()=>ij,abs:()=>fO,acesFilmicToneMapping:()=>gO,acos:()=>yO,add:()=>xO,addNodeElement:()=>bO,agxToneMapping:()=>vO,all:()=>MO,alphaT:()=>wO,and:()=>TO,anisotropy:()=>NO,anisotropyB:()=>SO,anisotropyT:()=>_O,any:()=>AO,append:()=>CO,array:()=>zO,arrayBuffer:()=>EO,asin:()=>VO,assign:()=>RO,atan:()=>IO,atan2:()=>LO,atomicAdd:()=>PO,atomicAnd:()=>FO,atomicFunc:()=>OO,atomicLoad:()=>WO,atomicMax:()=>kO,atomicMin:()=>BO,atomicOr:()=>DO,atomicStore:()=>UO,atomicSub:()=>$O,atomicXor:()=>jO,attenuationColor:()=>qO,attenuationDistance:()=>HO,attribute:()=>GO,attributeArray:()=>XO,backgroundBlurriness:()=>YO,backgroundIntensity:()=>ZO,backgroundRotation:()=>JO,batch:()=>QO,billboarding:()=>KO,bitAnd:()=>tk,bitNot:()=>ek,bitOr:()=>rk,bitXor:()=>sk,bitangentGeometry:()=>ik,bitangentLocal:()=>nk,bitangentView:()=>ak,bitangentWorld:()=>ok,bitcast:()=>lk,blendBurn:()=>uk,blendColor:()=>hk,blendDodge:()=>ck,blendOverlay:()=>dk,blendScreen:()=>pk,blur:()=>mk,bool:()=>fk,buffer:()=>gk,bufferAttribute:()=>yk,bumpMap:()=>xk,burn:()=>bk,bvec2:()=>vk,bvec3:()=>Mk,bvec4:()=>wk,bypass:()=>Tk,cache:()=>Nk,call:()=>Sk,cameraFar:()=>_k,cameraIndex:()=>Ak,cameraNear:()=>Ck,cameraNormalMatrix:()=>zk,cameraPosition:()=>Ek,cameraProjectionMatrix:()=>Vk,cameraProjectionMatrixInverse:()=>Rk,cameraViewMatrix:()=>Ik,cameraWorldMatrix:()=>Lk,cbrt:()=>Pk,cdl:()=>Fk,ceil:()=>Ok,checker:()=>kk,cineonToneMapping:()=>Bk,clamp:()=>JN,clearcoat:()=>Dk,clearcoatRoughness:()=>Uk,code:()=>$k,color:()=>jk,colorSpaceToWorking:()=>Wk,colorToDirection:()=>qk,compute:()=>Hk,computeSkinning:()=>Gk,cond:()=>Xk,context:()=>Zk,convert:()=>Jk,convertColorSpace:()=>Qk,convertToTexture:()=>Kk,cos:()=>Gd,cross:()=>t9,cubeTexture:()=>e9,dFdx:()=>r9,dFdy:()=>s9,dashSize:()=>i9,debug:()=>n9,decrement:()=>a9,decrementBefore:()=>o9,defaultBuildStages:()=>l9,defaultShaderStages:()=>u9,defined:()=>h9,degrees:()=>c9,deltaTime:()=>d9,densityFog:()=>p9,densityFogFactor:()=>m9,depth:()=>f9,depthPass:()=>g9,difference:()=>y9,diffuseColor:()=>x9,directPointLight:()=>b9,directionToColor:()=>v9,dispersion:()=>M9,distance:()=>w9,div:()=>T9,dodge:()=>N9,dot:()=>Pg,drawIndex:()=>S9,dynamicBufferAttribute:()=>_9,element:()=>A9,emissive:()=>C9,equal:()=>z9,equals:()=>E9,equirectUV:()=>V9,exp:()=>R9,exp2:()=>I9,expression:()=>L9,faceDirection:()=>P9,faceForward:()=>F9,faceforward:()=>O9,float:()=>Fg,floor:()=>k9,fog:()=>B9,fract:()=>Og,frameGroup:()=>D9,frameId:()=>U9,frontFacing:()=>$9,fwidth:()=>QN,gain:()=>j9,gapSize:()=>W9,getConstNodeType:()=>q9,getCurrentStack:()=>H9,getDirection:()=>G9,getDistanceAttenuation:()=>X9,getGeometryRoughness:()=>Y9,getNormalFromDepth:()=>Z9,getParallaxCorrectNormal:()=>J9,getRoughness:()=>Q9,getScreenPosition:()=>K9,getShIrradianceAt:()=>tB,getShadowMaterial:()=>sB,getShadowRenderObjectFunction:()=>iB,getTextureIndex:()=>eB,getViewPosition:()=>rB,globalId:()=>ZB,glsl:()=>nB,glslFn:()=>aB,grayscale:()=>oB,greaterThan:()=>lB,greaterThanEqual:()=>uB,hash:()=>hB,highpModelNormalViewMatrix:()=>cB,highpModelViewMatrix:()=>dB,hue:()=>pB,increment:()=>mB,incrementBefore:()=>fB,instance:()=>gB,instanceIndex:()=>yB,instancedArray:()=>xB,instancedBufferAttribute:()=>bB,instancedDynamicBufferAttribute:()=>vB,instancedMesh:()=>MB,int:()=>wB,inverseSqrt:()=>TB,inversesqrt:()=>NB,invocationLocalIndex:()=>SB,invocationSubgroupIndex:()=>_B,ior:()=>AB,iridescence:()=>CB,iridescenceIOR:()=>zB,iridescenceThickness:()=>EB,ivec2:()=>VB,ivec3:()=>RB,ivec4:()=>IB,js:()=>LB,label:()=>PB,length:()=>FB,lengthSq:()=>OB,lessThan:()=>kB,lessThanEqual:()=>BB,lightPosition:()=>DB,lightProjectionUV:()=>GD,lightShadowMatrix:()=>UB,lightTargetDirection:()=>$B,lightTargetPosition:()=>jB,lightViewPosition:()=>WB,lightingContext:()=>qB,lights:()=>HB,linearDepth:()=>GB,linearToneMapping:()=>XB,localId:()=>YB,log:()=>JB,log2:()=>QB,logarithmicDepthToViewZ:()=>KB,loop:()=>t7,luminance:()=>e7,mat2:()=>s7,mat3:()=>i7,mat4:()=>n7,matcapUV:()=>a7,materialAO:()=>o7,materialAlphaTest:()=>l7,materialAnisotropy:()=>u7,materialAnisotropyVector:()=>h7,materialAttenuationColor:()=>c7,materialAttenuationDistance:()=>d7,materialClearcoat:()=>p7,materialClearcoatNormal:()=>m7,materialClearcoatRoughness:()=>f7,materialColor:()=>g7,materialDispersion:()=>y7,materialEmissive:()=>x7,materialIOR:()=>b7,materialIridescence:()=>v7,materialIridescenceIOR:()=>M7,materialIridescenceThickness:()=>w7,materialLightMap:()=>T7,materialLineDashOffset:()=>N7,materialLineDashSize:()=>S7,materialLineGapSize:()=>_7,materialLineScale:()=>A7,materialLineWidth:()=>C7,materialMetalness:()=>z7,materialNormal:()=>E7,materialOpacity:()=>V7,materialPointSize:()=>R7,materialReference:()=>I7,materialReflectivity:()=>L7,materialRefractionRatio:()=>P7,materialRotation:()=>F7,materialRoughness:()=>O7,materialSheen:()=>k7,materialSheenRoughness:()=>B7,materialShininess:()=>D7,materialSpecular:()=>U7,materialSpecularColor:()=>$7,materialSpecularIntensity:()=>j7,materialSpecularStrength:()=>W7,materialThickness:()=>q7,materialTransmission:()=>H7,max:()=>G7,maxMipLevel:()=>X7,mediumpModelViewMatrix:()=>r7,metalness:()=>Y7,min:()=>Z7,mix:()=>Nl,mixElement:()=>J7,mod:()=>Q7,modInt:()=>K7,modelDirection:()=>t8,modelNormalMatrix:()=>e8,modelPosition:()=>r8,modelRadius:()=>s8,modelScale:()=>i8,modelViewMatrix:()=>n8,modelViewPosition:()=>a8,modelViewProjection:()=>o8,modelWorldMatrix:()=>l8,modelWorldMatrixInverse:()=>u8,morphReference:()=>h8,mrt:()=>c8,mul:()=>d8,mx_aastep:()=>p8,mx_cell_noise_float:()=>m8,mx_contrast:()=>f8,mx_fractal_noise_float:()=>g8,mx_fractal_noise_vec2:()=>y8,mx_fractal_noise_vec3:()=>x8,mx_fractal_noise_vec4:()=>b8,mx_hsvtorgb:()=>v8,mx_noise_float:()=>M8,mx_noise_vec3:()=>w8,mx_noise_vec4:()=>T8,mx_ramplr:()=>N8,mx_ramptb:()=>S8,mx_rgbtohsv:()=>_8,mx_safepower:()=>A8,mx_splitlr:()=>C8,mx_splittb:()=>z8,mx_srgb_texture_to_lin_rec709:()=>E8,mx_transform_uv:()=>V8,mx_worley_noise_float:()=>R8,mx_worley_noise_vec2:()=>I8,mx_worley_noise_vec3:()=>L8,namespace:()=>P8,negate:()=>F8,neutralToneMapping:()=>O8,nodeArray:()=>k8,nodeImmutable:()=>B8,nodeObject:()=>D8,nodeObjects:()=>U8,nodeProxy:()=>$8,normalFlat:()=>j8,normalGeometry:()=>W8,normalLocal:()=>q8,normalMap:()=>H8,normalView:()=>G8,normalWorld:()=>X8,normalize:()=>Y8,not:()=>Z8,notEqual:()=>J8,numWorkgroups:()=>Q8,objectDirection:()=>K8,objectGroup:()=>tD,objectPosition:()=>eD,objectRadius:()=>rD,objectScale:()=>sD,objectViewPosition:()=>iD,objectWorldMatrix:()=>nD,oneMinus:()=>aD,or:()=>oD,orthographicDepthToViewZ:()=>lD,oscSawtooth:()=>uD,oscSine:()=>hD,oscSquare:()=>cD,oscTriangle:()=>dD,output:()=>pD,outputStruct:()=>mD,overlay:()=>fD,overloadingFn:()=>gD,parabola:()=>yD,parallaxDirection:()=>xD,parallaxUV:()=>bD,parameter:()=>vD,pass:()=>MD,passTexture:()=>wD,pcurve:()=>TD,perspectiveDepthToViewZ:()=>ND,pmremTexture:()=>SD,pointShadow:()=>VU,pointUV:()=>_D,pointWidth:()=>AD,positionGeometry:()=>CD,positionLocal:()=>zD,positionPrevious:()=>ED,positionView:()=>VD,positionViewDirection:()=>RD,positionWorld:()=>ID,positionWorldDirection:()=>LD,posterize:()=>PD,pow:()=>KN,pow2:()=>FD,pow3:()=>OD,pow4:()=>kD,premult:()=>BD,property:()=>DD,radians:()=>UD,rand:()=>$D,range:()=>jD,rangeFog:()=>WD,rangeFogFactor:()=>qD,reciprocal:()=>HD,reference:()=>XD,referenceBuffer:()=>YD,reflect:()=>ZD,reflectVector:()=>JD,reflectView:()=>QD,reflector:()=>KD,refract:()=>tU,refractVector:()=>eU,refractView:()=>rU,reinhardToneMapping:()=>sU,remainder:()=>iU,remap:()=>nU,remapClamp:()=>aU,renderGroup:()=>oU,renderOutput:()=>lU,rendererReference:()=>uU,rotate:()=>hU,rotateUV:()=>cU,roughness:()=>dU,round:()=>pU,rtt:()=>mU,sRGBTransferEOTF:()=>fU,sRGBTransferOETF:()=>gU,sampler:()=>yU,samplerComparison:()=>xU,saturate:()=>bU,saturation:()=>vU,screen:()=>MU,screenCoordinate:()=>wU,screenSize:()=>TU,screenUV:()=>NU,scriptable:()=>SU,scriptableValue:()=>_U,select:()=>AU,setCurrentStack:()=>CU,shaderStages:()=>zU,shadow:()=>EU,shadowPositionWorld:()=>RU,shapeCircle:()=>LU,sharedUniformGroup:()=>IU,sheen:()=>PU,sheenRoughness:()=>FU,shiftLeft:()=>OU,shiftRight:()=>kU,shininess:()=>BU,sign:()=>DU,sin:()=>Zn,sinc:()=>UU,skinning:()=>$U,smoothstep:()=>kg,smoothstepElement:()=>jU,specularColor:()=>WU,specularF90:()=>qU,spherizeUV:()=>HU,split:()=>GU,spritesheetUV:()=>XU,sqrt:()=>YU,stack:()=>ZU,step:()=>JU,storage:()=>QU,storageBarrier:()=>KU,storageObject:()=>t$,storageTexture:()=>e$,string:()=>r$,struct:()=>s$,sub:()=>i$,subgroupIndex:()=>n$,subgroupSize:()=>a$,tan:()=>o$,tangentGeometry:()=>l$,tangentLocal:()=>u$,tangentView:()=>h$,tangentWorld:()=>c$,temp:()=>d$,texture:()=>p$,texture3D:()=>m$,textureBarrier:()=>f$,textureBicubic:()=>g$,textureCubeUV:()=>y$,textureLoad:()=>x$,textureSize:()=>b$,textureStore:()=>v$,thickness:()=>M$,time:()=>S0,timerDelta:()=>w$,timerGlobal:()=>T$,timerLocal:()=>N$,toneMapping:()=>S$,toneMappingExposure:()=>_$,toonOutlinePass:()=>A$,transformDirection:()=>C$,transformNormal:()=>z$,transformNormalToView:()=>E$,transformedBentNormalView:()=>V$,transformedBitangentView:()=>R$,transformedBitangentWorld:()=>I$,transformedClearcoatNormalView:()=>L$,transformedNormalView:()=>P$,transformedNormalWorld:()=>F$,transformedTangentView:()=>O$,transformedTangentWorld:()=>k$,transmission:()=>B$,transpose:()=>D$,triNoise3D:()=>U$,triplanarTexture:()=>$$,triplanarTextures:()=>j$,trunc:()=>W$,tslFn:()=>q$,uint:()=>H$,uniform:()=>G$,uniformArray:()=>Y$,uniformCubeTexture:()=>X$,uniformGroup:()=>Z$,uniformTexture:()=>J$,uniforms:()=>Q$,unpremult:()=>K$,userData:()=>tj,uv:()=>_0,uvec2:()=>ej,uvec3:()=>rj,uvec4:()=>sj,varying:()=>nj,varyingProperty:()=>aj,vec2:()=>A0,vec3:()=>oj,vec4:()=>oh,vectorComponents:()=>lj,velocity:()=>uj,vertexColor:()=>hj,vertexIndex:()=>cj,vibrance:()=>dj,viewZToLogarithmicDepth:()=>pj,viewZToOrthographicDepth:()=>mj,viewZToPerspectiveDepth:()=>fj,viewport:()=>gj,viewportBottomLeft:()=>yj,viewportCoordinate:()=>xj,viewportDepthTexture:()=>bj,viewportLinearDepth:()=>vj,viewportMipTexture:()=>Mj,viewportResolution:()=>wj,viewportSafeUV:()=>Tj,viewportSharedTexture:()=>Nj,viewportSize:()=>Sj,viewportTexture:()=>_j,viewportTopLeft:()=>Aj,viewportUV:()=>Cj,wgsl:()=>zj,wgslFn:()=>Ej,workgroupArray:()=>Vj,workgroupBarrier:()=>Rj,workgroupId:()=>Ij,workingToColorSpace:()=>Lj,xor:()=>Pj});const BF=g.BRDF_GGX,DF=g.BRDF_Lambert,UF=g.BasicShadowFilter,$F=g.Break,jF=g.Continue,WF=g.DFGApprox,qF=g.D_GGX,HF=g.Discard,GF=g.EPSILON,XF=g.F_Schlick,YF=g.Fn,ZF=g.INFINITY,JF=g.If,QF=g.Switch,KF=g.Loop,tO=g.NodeShaderStage,eO=g.NodeType,rO=g.NodeUpdateType,sO=g.NodeAccess,iO=g.PCFShadowFilter,nO=g.PCFSoftShadowFilter,aO=g.PI,oO=g.PI2,lO=g.Return,uO=g.Schlick_to_F0,hO=g.ScriptableNodeResources,cO=g.ShaderNode,dO=g.TBNViewMatrix,pO=g.VSMShadowFilter,mO=g.V_GGX_SmithCorrelated,fO=g.abs,gO=g.acesFilmicToneMapping,yO=g.acos,xO=g.add,bO=g.addNodeElement,vO=g.agxToneMapping,MO=g.all,wO=g.alphaT,TO=g.and,NO=g.anisotropy,SO=g.anisotropyB,_O=g.anisotropyT,AO=g.any,CO=g.append,zO=g.array,EO=g.arrayBuffer,VO=g.asin,RO=g.assign,IO=g.atan,LO=g.atan2,PO=g.atomicAdd,FO=g.atomicAnd,OO=g.atomicFunc,kO=g.atomicMax,BO=g.atomicMin,DO=g.atomicOr,UO=g.atomicStore,$O=g.atomicSub,jO=g.atomicXor,WO=g.atomicLoad,qO=g.attenuationColor,HO=g.attenuationDistance,GO=g.attribute,XO=g.attributeArray,YO=g.backgroundBlurriness,ZO=g.backgroundIntensity,JO=g.backgroundRotation,QO=g.batch,KO=g.billboarding,tk=g.bitAnd,ek=g.bitNot,rk=g.bitOr,sk=g.bitXor,ik=g.bitangentGeometry,nk=g.bitangentLocal,ak=g.bitangentView,ok=g.bitangentWorld,lk=g.bitcast,uk=g.blendBurn,hk=g.blendColor,ck=g.blendDodge,dk=g.blendOverlay,pk=g.blendScreen,mk=g.blur,fk=g.bool,gk=g.buffer,yk=g.bufferAttribute,xk=g.bumpMap,bk=g.burn,vk=g.bvec2,Mk=g.bvec3,wk=g.bvec4,Tk=g.bypass,Nk=g.cache,Sk=g.call,_k=g.cameraFar,Ak=g.cameraIndex,Ck=g.cameraNear,zk=g.cameraNormalMatrix,Ek=g.cameraPosition,Vk=g.cameraProjectionMatrix,Rk=g.cameraProjectionMatrixInverse,Ik=g.cameraViewMatrix,Lk=g.cameraWorldMatrix,Pk=g.cbrt,Fk=g.cdl,Ok=g.ceil,kk=g.checker,Bk=g.cineonToneMapping,JN=g.clamp,Dk=g.clearcoat,Uk=g.clearcoatRoughness,$k=g.code,jk=g.color,Wk=g.colorSpaceToWorking,qk=g.colorToDirection,Hk=g.compute,Gk=g.computeSkinning,Xk=g.cond,Yk=g.Const,Zk=g.context,Jk=g.convert,Qk=g.convertColorSpace,Kk=g.convertToTexture,Gd=g.cos,t9=g.cross,e9=g.cubeTexture,r9=g.dFdx,s9=g.dFdy,i9=g.dashSize,n9=g.debug,a9=g.decrement,o9=g.decrementBefore,l9=g.defaultBuildStages,u9=g.defaultShaderStages,h9=g.defined,c9=g.degrees,d9=g.deltaTime,p9=g.densityFog,m9=g.densityFogFactor,f9=g.depth,g9=g.depthPass,y9=g.difference,x9=g.diffuseColor,b9=g.directPointLight,v9=g.directionToColor,M9=g.dispersion,w9=g.distance,T9=g.div,N9=g.dodge,Pg=g.dot,S9=g.drawIndex,_9=g.dynamicBufferAttribute,A9=g.element,C9=g.emissive,z9=g.equal,E9=g.equals,V9=g.equirectUV,R9=g.exp,I9=g.exp2,L9=g.expression,P9=g.faceDirection,F9=g.faceForward,O9=g.faceforward,Fg=g.float,k9=g.floor,B9=g.fog,Og=g.fract,D9=g.frameGroup,U9=g.frameId,$9=g.frontFacing,QN=g.fwidth,j9=g.gain,W9=g.gapSize,q9=g.getConstNodeType,H9=g.getCurrentStack,G9=g.getDirection,X9=g.getDistanceAttenuation,Y9=g.getGeometryRoughness,Z9=g.getNormalFromDepth,J9=g.getParallaxCorrectNormal,Q9=g.getRoughness,K9=g.getScreenPosition,tB=g.getShIrradianceAt,eB=g.getTextureIndex,rB=g.getViewPosition,sB=g.getShadowMaterial,iB=g.getShadowRenderObjectFunction,nB=g.glsl,aB=g.glslFn,oB=g.grayscale,lB=g.greaterThan,uB=g.greaterThanEqual,hB=g.hash,cB=g.highpModelNormalViewMatrix,dB=g.highpModelViewMatrix,pB=g.hue,mB=g.increment,fB=g.incrementBefore,gB=g.instance,yB=g.instanceIndex,xB=g.instancedArray,bB=g.instancedBufferAttribute,vB=g.instancedDynamicBufferAttribute,MB=g.instancedMesh,wB=g.int,TB=g.inverseSqrt,NB=g.inversesqrt,SB=g.invocationLocalIndex,_B=g.invocationSubgroupIndex,AB=g.ior,CB=g.iridescence,zB=g.iridescenceIOR,EB=g.iridescenceThickness,VB=g.ivec2,RB=g.ivec3,IB=g.ivec4,LB=g.js,PB=g.label,FB=g.length,OB=g.lengthSq,kB=g.lessThan,BB=g.lessThanEqual,DB=g.lightPosition,UB=g.lightShadowMatrix,$B=g.lightTargetDirection,jB=g.lightTargetPosition,WB=g.lightViewPosition,qB=g.lightingContext,HB=g.lights,GB=g.linearDepth,XB=g.linearToneMapping,YB=g.localId,ZB=g.globalId,JB=g.log,QB=g.log2,KB=g.logarithmicDepthToViewZ,t7=g.loop,e7=g.luminance,r7=g.mediumpModelViewMatrix,s7=g.mat2,i7=g.mat3,n7=g.mat4,a7=g.matcapUV,o7=g.materialAO,l7=g.materialAlphaTest,u7=g.materialAnisotropy,h7=g.materialAnisotropyVector,c7=g.materialAttenuationColor,d7=g.materialAttenuationDistance,p7=g.materialClearcoat,m7=g.materialClearcoatNormal,f7=g.materialClearcoatRoughness,g7=g.materialColor,y7=g.materialDispersion,x7=g.materialEmissive,b7=g.materialIOR,v7=g.materialIridescence,M7=g.materialIridescenceIOR,w7=g.materialIridescenceThickness,T7=g.materialLightMap,N7=g.materialLineDashOffset,S7=g.materialLineDashSize,_7=g.materialLineGapSize,A7=g.materialLineScale,C7=g.materialLineWidth,z7=g.materialMetalness,E7=g.materialNormal,V7=g.materialOpacity,R7=g.materialPointSize,I7=g.materialReference,L7=g.materialReflectivity,P7=g.materialRefractionRatio,F7=g.materialRotation,O7=g.materialRoughness,k7=g.materialSheen,B7=g.materialSheenRoughness,D7=g.materialShininess,U7=g.materialSpecular,$7=g.materialSpecularColor,j7=g.materialSpecularIntensity,W7=g.materialSpecularStrength,q7=g.materialThickness,H7=g.materialTransmission,G7=g.max,X7=g.maxMipLevel,Y7=g.metalness,Z7=g.min,Nl=g.mix,J7=g.mixElement,Q7=g.mod,K7=g.modInt,t8=g.modelDirection,e8=g.modelNormalMatrix,r8=g.modelPosition,s8=g.modelRadius,i8=g.modelScale,n8=g.modelViewMatrix,a8=g.modelViewPosition,o8=g.modelViewProjection,l8=g.modelWorldMatrix,u8=g.modelWorldMatrixInverse,h8=g.morphReference,c8=g.mrt,d8=g.mul,p8=g.mx_aastep,m8=g.mx_cell_noise_float,f8=g.mx_contrast,g8=g.mx_fractal_noise_float,y8=g.mx_fractal_noise_vec2,x8=g.mx_fractal_noise_vec3,b8=g.mx_fractal_noise_vec4,v8=g.mx_hsvtorgb,M8=g.mx_noise_float,w8=g.mx_noise_vec3,T8=g.mx_noise_vec4,N8=g.mx_ramplr,S8=g.mx_ramptb,_8=g.mx_rgbtohsv,A8=g.mx_safepower,C8=g.mx_splitlr,z8=g.mx_splittb,E8=g.mx_srgb_texture_to_lin_rec709,V8=g.mx_transform_uv,R8=g.mx_worley_noise_float,I8=g.mx_worley_noise_vec2,L8=g.mx_worley_noise_vec3,P8=g.namespace,F8=g.negate,O8=g.neutralToneMapping,k8=g.nodeArray,B8=g.nodeImmutable,D8=g.nodeObject,U8=g.nodeObjects,$8=g.nodeProxy,j8=g.normalFlat,W8=g.normalGeometry,q8=g.normalLocal,H8=g.normalMap,G8=g.normalView,X8=g.normalWorld,Y8=g.normalize,Z8=g.not,J8=g.notEqual,Q8=g.numWorkgroups,K8=g.objectDirection,tD=g.objectGroup,eD=g.objectPosition,rD=g.objectRadius,sD=g.objectScale,iD=g.objectViewPosition,nD=g.objectWorldMatrix,aD=g.oneMinus,oD=g.or,lD=g.orthographicDepthToViewZ,uD=g.oscSawtooth,hD=g.oscSine,cD=g.oscSquare,dD=g.oscTriangle,pD=g.output,mD=g.outputStruct,fD=g.overlay,gD=g.overloadingFn,yD=g.parabola,xD=g.parallaxDirection,bD=g.parallaxUV,vD=g.parameter,MD=g.pass,wD=g.passTexture,TD=g.pcurve,ND=g.perspectiveDepthToViewZ,SD=g.pmremTexture,_D=g.pointUV,AD=g.pointWidth,CD=g.positionGeometry,zD=g.positionLocal,ED=g.positionPrevious,VD=g.positionView,RD=g.positionViewDirection,ID=g.positionWorld,LD=g.positionWorldDirection,PD=g.posterize,KN=g.pow,FD=g.pow2,OD=g.pow3,kD=g.pow4,BD=g.premult,DD=g.property,UD=g.radians,$D=g.rand,jD=g.range,WD=g.rangeFog,qD=g.rangeFogFactor,HD=g.reciprocal,GD=g.lightProjectionUV,XD=g.reference,YD=g.referenceBuffer,ZD=g.reflect,JD=g.reflectVector,QD=g.reflectView,KD=g.reflector,tU=g.refract,eU=g.refractVector,rU=g.refractView,sU=g.reinhardToneMapping,iU=g.remainder,nU=g.remap,aU=g.remapClamp,oU=g.renderGroup,lU=g.renderOutput,uU=g.rendererReference,hU=g.rotate,cU=g.rotateUV,dU=g.roughness,pU=g.round,mU=g.rtt,fU=g.sRGBTransferEOTF,gU=g.sRGBTransferOETF,yU=g.sampler,xU=g.samplerComparison,bU=g.saturate,vU=g.saturation,MU=g.screen,wU=g.screenCoordinate,TU=g.screenSize,NU=g.screenUV,SU=g.scriptable,_U=g.scriptableValue,AU=g.select,CU=g.setCurrentStack,zU=g.shaderStages,EU=g.shadow,VU=g.pointShadow,RU=g.shadowPositionWorld,IU=g.sharedUniformGroup,LU=g.shapeCircle,PU=g.sheen,FU=g.sheenRoughness,OU=g.shiftLeft,kU=g.shiftRight,BU=g.shininess,DU=g.sign,Zn=g.sin,UU=g.sinc,$U=g.skinning,kg=g.smoothstep,jU=g.smoothstepElement,WU=g.specularColor,qU=g.specularF90,HU=g.spherizeUV,GU=g.split,XU=g.spritesheetUV,YU=g.sqrt,ZU=g.stack,JU=g.step,QU=g.storage,KU=g.storageBarrier,t$=g.storageObject,e$=g.storageTexture,r$=g.string,s$=g.struct,i$=g.sub,n$=g.subgroupIndex,a$=g.subgroupSize,o$=g.tan,l$=g.tangentGeometry,u$=g.tangentLocal,h$=g.tangentView,c$=g.tangentWorld,d$=g.temp,p$=g.texture,m$=g.texture3D,f$=g.textureBarrier,g$=g.textureBicubic,y$=g.textureCubeUV,x$=g.textureLoad,b$=g.textureSize,v$=g.textureStore,M$=g.thickness,S0=g.time,w$=g.timerDelta,T$=g.timerGlobal,N$=g.timerLocal,S$=g.toneMapping,_$=g.toneMappingExposure,A$=g.toonOutlinePass,C$=g.transformDirection,z$=g.transformNormal,E$=g.transformNormalToView,V$=g.transformedBentNormalView,R$=g.transformedBitangentView,I$=g.transformedBitangentWorld,L$=g.transformedClearcoatNormalView,P$=g.transformedNormalView,F$=g.transformedNormalWorld,O$=g.transformedTangentView,k$=g.transformedTangentWorld,B$=g.transmission,D$=g.transpose,U$=g.triNoise3D,$$=g.triplanarTexture,j$=g.triplanarTextures,W$=g.trunc,q$=g.tslFn,H$=g.uint,G$=g.uniform,X$=g.uniformCubeTexture,Y$=g.uniformArray,Z$=g.uniformGroup,J$=g.uniformTexture,Q$=g.uniforms,K$=g.unpremult,tj=g.userData,_0=g.uv,ej=g.uvec2,rj=g.uvec3,sj=g.uvec4,ij=g.Var,nj=g.varying,aj=g.varyingProperty,A0=g.vec2,oj=g.vec3,oh=g.vec4,lj=g.vectorComponents,uj=g.velocity,hj=g.vertexColor,cj=g.vertexIndex,dj=g.vibrance,pj=g.viewZToLogarithmicDepth,mj=g.viewZToOrthographicDepth,fj=g.viewZToPerspectiveDepth,gj=g.viewport,yj=g.viewportBottomLeft,xj=g.viewportCoordinate,bj=g.viewportDepthTexture,vj=g.viewportLinearDepth,Mj=g.viewportMipTexture,wj=g.viewportResolution,Tj=g.viewportSafeUV,Nj=g.viewportSharedTexture,Sj=g.viewportSize,_j=g.viewportTexture,Aj=g.viewportTopLeft,Cj=g.viewportUV,zj=g.wgsl,Ej=g.wgslFn,Vj=g.workgroupArray,Rj=g.workgroupBarrier,Ij=g.workgroupId,Lj=g.workingToColorSpace,Pj=g.xor,Sl={name:"ASCII",props:{characters:{default:"@%#*+=-:.",description:"Characters to use for ASCII effect (light to dark)",ui:{type:"text",label:"Characters"}},cellSize:{default:30,description:"Size of each ASCII character cell in pixels",ui:{type:"range",min:8,max:100,step:1,label:"Cell Size"}},fontFamily:{default:"jetbrains mono",description:"Font family for characters",ui:{type:"select",options:[{label:"JetBrains Mono",value:"jetbrains mono"},{label:"Courier New",value:"courier new"},{label:"Monaco",value:"monaco"},{label:"Consolas",value:"consolas"}],label:"Font Family"}}},fragmentNode:({uniforms:e,childNode:t,onCleanup:r,onBeforeRender:s,canvas:i})=>{let{vec2:n,vec3:a,vec4:o,floor:l,fract:h,dot:u,screenUV:c,convertToTexture:d,texture:p}=_e;if(!t)return o(0,0,0,0);let m=Math.round(i.clientWidth),f=Math.round(i.clientHeight),x=d(t,m,f),b=(xr,Zt,Yr)=>{let pi=xr.length,Tr=Math.max(2,Math.ceil(Math.sqrt(pi))),An=Math.max(8,Zt-4),fs=document.createElement("canvas");fs.width=Tr*Zt,fs.height=Tr*Zt;let gs=fs.getContext("2d");gs.fillStyle="#000000",gs.fillRect(0,0,fs.width,fs.height),gs.fillStyle="#ffffff",gs.font=`${An}px ${Yr}`,gs.textAlign="center",gs.textBaseline="middle";for(let Cn=0;Cn<pi;Cn++){let jC=xr[Cn],WC=Math.floor(Cn/Tr),qC=Cn%Tr,HC=qC*Zt+Zt/2,GC=WC*Zt+Zt/2;gs.fillText(jC,HC,GC)}return console.log(`Atlas created: ${pi} chars, ${Tr}x${Tr} grid, ${fs.width}x${fs.height}px`),console.log(`Characters: "${xr}"`),{canvas:fs,atlasSize:Tr,cellSize:Zt,charCount:pi}},v=b(e.characters.uniform.value,e.cellSize.uniform.value,e.fontFamily.uniform.value),T=new Ye.CanvasTexture(v.canvas);T.minFilter=Ye.NearestFilter,T.magFilter=Ye.NearestFilter,T.generateMipmaps=!1;let _=p(T),E=e.characters.uniform.value,C=e.cellSize.uniform.value,A=e.fontFamily.uniform.value,I=()=>{let xr=e.characters.uniform.value,Zt=e.cellSize.uniform.value,Yr=e.fontFamily.uniform.value;(xr!==E||Zt!==C||Yr!==A)&&(v=b(xr,Zt,Yr),T.image=v.canvas,T.needsUpdate=!0,E=xr,C=Zt,A=Yr)};s(()=>{I()}),r(()=>{T.dispose()});let Q=e.cellSize.uniform,ot=n(m,f).div(Q),K=c.mul(ot),mt=l(K),nt=h(K),yt=mt.add(n(.5)).div(ot),lt=x.sample(yt),Nt=u(lt.rgb,a(.299,.587,.114)),ht=v.charCount,Mt=Nt.mul(.8).add(.1),ut=Mt.mul(ht),at=l(ut.min(ht-1e-4)),gt=v.atlasSize,Ot=at.mod(gt),jt=l(at.div(gt)),be=1/gt,se=n(nt.x,nt.y.sub(1).mul(-1)),Ae=n(Ot,jt).mul(be).add(se.mul(be)),di=_.sample(Ae);return o(di.rgb.mul(lt.rgb),lt.a)}};/**
90
90
  * @license
91
91
  * Copyright 2010-2025 Three.js Authors
92
92
  * SPDX-License-Identifier: MIT
@@ -147,7 +147,7 @@ fn tsl_biquadraticTexture( map : texture_2d<f32>, coord : vec2f, iRes : vec2u, l
147
147
  * @license
148
148
  * Copyright 2010-2025 Three.js Authors
149
149
  * SPDX-License-Identifier: MIT
150
- */y.BRDF_GGX;y.BRDF_Lambert;y.BasicShadowFilter;y.Break;y.Continue;y.DFGApprox;y.D_GGX;y.Discard;y.EPSILON;y.F_Schlick;y.Fn;y.INFINITY;y.If;y.Switch;y.Loop;y.NodeShaderStage;y.NodeType;y.NodeUpdateType;y.NodeAccess;y.PCFShadowFilter;y.PCFSoftShadowFilter;y.PI;y.PI2;y.Return;y.Schlick_to_F0;y.ScriptableNodeResources;y.ShaderNode;y.TBNViewMatrix;y.VSMShadowFilter;y.V_GGX_SmithCorrelated;y.abs;y.acesFilmicToneMapping;y.acos;y.add;y.addNodeElement;y.agxToneMapping;y.all;y.alphaT;y.and;y.anisotropy;y.anisotropyB;y.anisotropyT;y.any;y.append;y.array;y.arrayBuffer;y.asin;y.assign;y.atan;y.atan2;y.atomicAdd;y.atomicAnd;y.atomicFunc;y.atomicMax;y.atomicMin;y.atomicOr;y.atomicStore;y.atomicSub;y.atomicXor;y.atomicLoad;y.attenuationColor;y.attenuationDistance;y.attribute;y.attributeArray;y.backgroundBlurriness;y.backgroundIntensity;y.backgroundRotation;y.batch;y.billboarding;y.bitAnd;y.bitNot;y.bitOr;y.bitXor;y.bitangentGeometry;y.bitangentLocal;y.bitangentView;y.bitangentWorld;y.bitcast;y.blendBurn;y.blendColor;y.blendDodge;y.blendOverlay;y.blendScreen;y.blur;y.bool;y.buffer;y.bufferAttribute;y.bumpMap;y.burn;y.bvec2;y.bvec3;y.bvec4;y.bypass;y.cache;y.call;y.cameraFar;y.cameraIndex;y.cameraNear;y.cameraNormalMatrix;y.cameraPosition;y.cameraProjectionMatrix;y.cameraProjectionMatrixInverse;y.cameraViewMatrix;y.cameraWorldMatrix;y.cbrt;y.cdl;y.ceil;y.checker;y.cineonToneMapping;y.clamp;y.clearcoat;y.clearcoatRoughness;y.code;y.color;y.colorSpaceToWorking;y.colorToDirection;y.compute;y.computeSkinning;y.cond;y.Const;y.context;y.convert;y.convertColorSpace;y.convertToTexture;y.cos;y.cross;y.cubeTexture;y.dFdx;y.dFdy;y.dashSize;y.debug;y.decrement;y.decrementBefore;y.defaultBuildStages;y.defaultShaderStages;y.defined;y.degrees;y.deltaTime;y.densityFog;y.densityFogFactor;y.depth;y.depthPass;y.difference;y.diffuseColor;y.directPointLight;y.directionToColor;y.dispersion;y.distance;y.div;y.dodge;y.dot;y.drawIndex;y.dynamicBufferAttribute;y.element;y.emissive;y.equal;y.equals;y.equirectUV;y.exp;y.exp2;y.expression;y.faceDirection;y.faceForward;y.faceforward;y.float;y.floor;y.fog;y.fract;y.frameGroup;y.frameId;y.frontFacing;y.fwidth;y.gain;y.gapSize;y.getConstNodeType;y.getCurrentStack;y.getDirection;y.getDistanceAttenuation;y.getGeometryRoughness;y.getNormalFromDepth;y.getParallaxCorrectNormal;y.getRoughness;y.getScreenPosition;y.getShIrradianceAt;y.getTextureIndex;y.getViewPosition;y.getShadowMaterial;y.getShadowRenderObjectFunction;y.glsl;y.glslFn;y.grayscale;y.greaterThan;y.greaterThanEqual;y.hash;y.highpModelNormalViewMatrix;y.highpModelViewMatrix;y.hue;y.increment;y.incrementBefore;y.instance;y.instanceIndex;y.instancedArray;y.instancedBufferAttribute;y.instancedDynamicBufferAttribute;y.instancedMesh;y.int;y.inverseSqrt;y.inversesqrt;y.invocationLocalIndex;y.invocationSubgroupIndex;y.ior;y.iridescence;y.iridescenceIOR;y.iridescenceThickness;y.ivec2;y.ivec3;y.ivec4;y.js;y.label;y.length;y.lengthSq;y.lessThan;y.lessThanEqual;y.lightPosition;y.lightShadowMatrix;y.lightTargetDirection;y.lightTargetPosition;y.lightViewPosition;y.lightingContext;y.lights;y.linearDepth;y.linearToneMapping;y.localId;y.globalId;y.log;y.log2;y.logarithmicDepthToViewZ;y.loop;y.luminance;y.mediumpModelViewMatrix;y.mat2;y.mat3;y.mat4;y.matcapUV;y.materialAO;y.materialAlphaTest;y.materialAnisotropy;y.materialAnisotropyVector;y.materialAttenuationColor;y.materialAttenuationDistance;y.materialClearcoat;y.materialClearcoatNormal;y.materialClearcoatRoughness;y.materialColor;y.materialDispersion;y.materialEmissive;y.materialIOR;y.materialIridescence;y.materialIridescenceIOR;y.materialIridescenceThickness;y.materialLightMap;y.materialLineDashOffset;y.materialLineDashSize;y.materialLineGapSize;y.materialLineScale;y.materialLineWidth;y.materialMetalness;y.materialNormal;y.materialOpacity;y.materialPointSize;y.materialReference;y.materialReflectivity;y.materialRefractionRatio;y.materialRotation;y.materialRoughness;y.materialSheen;y.materialSheenRoughness;y.materialShininess;y.materialSpecular;y.materialSpecularColor;y.materialSpecularIntensity;y.materialSpecularStrength;y.materialThickness;y.materialTransmission;y.max;y.maxMipLevel;y.metalness;y.min;y.mix;y.mixElement;y.mod;y.modInt;y.modelDirection;y.modelNormalMatrix;y.modelPosition;y.modelRadius;y.modelScale;y.modelViewMatrix;y.modelViewPosition;y.modelViewProjection;y.modelWorldMatrix;y.modelWorldMatrixInverse;y.morphReference;y.mrt;y.mul;y.mx_aastep;y.mx_cell_noise_float;y.mx_contrast;y.mx_fractal_noise_float;y.mx_fractal_noise_vec2;y.mx_fractal_noise_vec3;y.mx_fractal_noise_vec4;y.mx_hsvtorgb;y.mx_noise_float;y.mx_noise_vec3;y.mx_noise_vec4;y.mx_ramplr;y.mx_ramptb;y.mx_rgbtohsv;y.mx_safepower;y.mx_splitlr;y.mx_splittb;y.mx_srgb_texture_to_lin_rec709;y.mx_transform_uv;y.mx_worley_noise_float;y.mx_worley_noise_vec2;y.mx_worley_noise_vec3;y.namespace;y.negate;y.neutralToneMapping;y.nodeArray;y.nodeImmutable;y.nodeObject;y.nodeObjects;y.nodeProxy;y.normalFlat;y.normalGeometry;y.normalLocal;y.normalMap;y.normalView;y.normalWorld;y.normalize;y.not;y.notEqual;y.numWorkgroups;y.objectDirection;y.objectGroup;y.objectPosition;y.objectRadius;y.objectScale;y.objectViewPosition;y.objectWorldMatrix;y.oneMinus;y.or;y.orthographicDepthToViewZ;y.oscSawtooth;y.oscSine;y.oscSquare;y.oscTriangle;y.output;y.outputStruct;y.overlay;y.overloadingFn;y.parabola;y.parallaxDirection;y.parallaxUV;y.parameter;y.pass;y.passTexture;y.pcurve;y.perspectiveDepthToViewZ;y.pmremTexture;y.pointUV;y.pointWidth;y.positionGeometry;y.positionLocal;y.positionPrevious;y.positionView;y.positionViewDirection;y.positionWorld;y.positionWorldDirection;y.posterize;y.pow;y.pow2;y.pow3;y.pow4;y.premult;y.property;y.radians;y.rand;y.range;y.rangeFog;y.rangeFogFactor;y.reciprocal;y.lightProjectionUV;y.reference;y.referenceBuffer;y.reflect;y.reflectVector;y.reflectView;y.reflector;y.refract;y.refractVector;y.refractView;y.reinhardToneMapping;y.remainder;y.remap;y.remapClamp;y.renderGroup;y.renderOutput;y.rendererReference;y.rotate;y.rotateUV;y.roughness;y.round;y.rtt;y.sRGBTransferEOTF;y.sRGBTransferOETF;y.sampler;y.samplerComparison;y.saturate;y.saturation;y.screen;y.screenCoordinate;y.screenSize;y.screenUV;y.scriptable;y.scriptableValue;y.select;y.setCurrentStack;y.shaderStages;y.shadow;y.pointShadow;y.shadowPositionWorld;y.sharedUniformGroup;y.shapeCircle;y.sheen;y.sheenRoughness;y.shiftLeft;y.shiftRight;y.shininess;y.sign;y.sin;y.sinc;y.skinning;y.smoothstep;y.smoothstepElement;y.specularColor;y.specularF90;y.spherizeUV;y.split;y.spritesheetUV;y.sqrt;y.stack;y.step;y.storage;y.storageBarrier;y.storageObject;y.storageTexture;y.string;y.struct;y.sub;y.subgroupIndex;y.subgroupSize;y.tan;y.tangentGeometry;y.tangentLocal;y.tangentView;y.tangentWorld;y.temp;y.texture;y.texture3D;y.textureBarrier;y.textureBicubic;y.textureCubeUV;y.textureLoad;y.textureSize;y.textureStore;y.thickness;y.time;y.timerDelta;y.timerGlobal;y.timerLocal;y.toneMapping;y.toneMappingExposure;y.toonOutlinePass;y.transformDirection;y.transformNormal;y.transformNormalToView;y.transformedBentNormalView;y.transformedBitangentView;y.transformedBitangentWorld;y.transformedClearcoatNormalView;y.transformedNormalView;y.transformedNormalWorld;y.transformedTangentView;y.transformedTangentWorld;y.transmission;y.transpose;y.triNoise3D;y.triplanarTexture;y.triplanarTextures;y.trunc;y.tslFn;y.uint;y.uniform;y.uniformCubeTexture;y.uniformArray;y.uniformGroup;y.uniformTexture;y.uniforms;y.unpremult;y.userData;y.uv;y.uvec2;y.uvec3;y.uvec4;y.Var;y.varying;y.varyingProperty;y.vec2;y.vec3;const eK=y.vec4;y.vectorComponents;y.velocity;y.vertexColor;y.vertexIndex;y.vibrance;y.viewZToLogarithmicDepth;y.viewZToOrthographicDepth;y.viewZToPerspectiveDepth;y.viewport;y.viewportBottomLeft;y.viewportCoordinate;y.viewportDepthTexture;y.viewportLinearDepth;y.viewportMipTexture;y.viewportResolution;y.viewportSafeUV;y.viewportSharedTexture;y.viewportSize;y.viewportTexture;y.viewportTopLeft;y.viewportUV;y.wgsl;y.wgslFn;y.workgroupArray;y.workgroupBarrier;y.workgroupId;y.workingToColorSpace;y.xor;const Tt=z.createContext(null),rK=({children:e,hideNotice:t=!1,style:r={},className:s="",...i})=>{const n=z.useRef(null),a=z.useMemo(()=>"ombre-root-"+Math.random().toString(36).substring(7),[]),o=z.useRef(null);o.current===null&&(o.current=pe.shaderRenderer());const l=z.useMemo(()=>(f,x,b,v,T=null)=>{if(x===null){try{o.current.removeNode(f)}catch(_){console.warn("Error removing node:",_)}return}try{o.current.registerNode(f,x,b,v,T)}catch(_){console.error("Error registering node:",_,{id:f,parentId:b,metadata:v})}},[]),h=z.useMemo(()=>(f,x,b)=>{try{o.current.updateUniformValue(f,x,b)}catch(v){console.warn("Error updating uniform:",v)}},[]),u=z.useMemo(()=>(f,x)=>{try{o.current.updateNodeMetadata(f,x)}catch(b){console.warn("Error updating metadata:",b)}},[]),c=z.useMemo(()=>({ombreParentId:a,ombreNodeRegister:l,ombreUniformUpdate:h,ombreMetadataUpdate:u}),[a,l,h,u]),d=z.useRef(!1),p=z.useRef(!1);z.useEffect(()=>{if(d.current||p.current)return;const f=n.current;if(!f)return;p.current=!0;const x=o.current;return x.initialize({canvas:f}).then(()=>{x.registerNode(a,({childNode:b})=>b||eK(0,0,0,0),null,null,{}),d.current=!0,p.current=!1,t||x.showLicenseWarning()}).catch(b=>{console.error("[Shader] Initialization failed:",b),p.current=!1}),()=>{try{x.cleanup(),d.current=!1,p.current=!1,console.log("[Shader] Renderer cleaned up successfully")}catch(b){console.warn("[Shader] Error during cleanup:",b)}}},[a,t]);const m={...s===""?{width:"1200px",height:"800px"}:{},...typeof r=="object"?r:{}};return ae.jsx(Tt.Provider,{value:c,children:ae.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",...typeof r=="object"?r:{}},className:s,...i,children:[ae.jsx("canvas",{"data-renderer":"ombre",ref:n,style:m}),e]})})};function sK(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const sA={blendMode:"normal"};try{Sl&&Sl.props&&Object.entries(Sl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(sA[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const iK=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Sl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>sK(e,sA),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Sl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Sl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})};var yv=function(e){function t(n){"@babel/helpers - typeof";return t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},t(n)}function r(n,a){if(t(n)!="object"||!n)return n;var o=n[Symbol.toPrimitive];if(o!==void 0){var l=o.call(n,a);if(t(l)!="object")return l;throw TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(n)}function s(n){var a=r(n,"string");return t(a)=="symbol"?a:a+""}function i(n,a,o){return(a=s(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o,n}return e.defineProperty=i,e}({}),Un,Sd;function ye(e,t){let r=e.length;Array.isArray(e[0])||(e=[e]),Array.isArray(t[0])||(t=t.map(a=>[a]));let s=t[0].length,i=t[0].map((a,o)=>t.map(l=>l[o])),n=e.map(a=>i.map(o=>{let l=0;if(!Array.isArray(a)){for(let h of o)l+=a*h;return l}for(let h=0;h<a.length;h++)l+=a[h]*(o[h]||0);return l}));return r===1&&(n=n[0]),s===1?n.map(a=>a[0]):n}function pc(e){return la(e)==="string"}function la(e){return(Object.prototype.toString.call(e).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function Rp(e,{precision:t,unit:r}){return fa(e)?"none":iA(e,t)+(r??"")}function fa(e){return Number.isNaN(e)||e instanceof Number&&e?.none}function Xe(e){return fa(e)?0:e}function iA(e,t){if(e===0)return 0;let r=~~e,s=0;r&&t&&(s=~~Math.log10(Math.abs(r))+1);let i=10**(t-s);return Math.floor(e*i+.5)/i}const nK={deg:1,grad:.9,rad:180/Math.PI,turn:360};function nA(e){if(!e)return;e=e.trim();let t=/^([a-z]+)\((.+?)\)$/i,r=/^-?[\d.]+$/,s=/%|deg|g?rad|turn$/,i=/\/?\s*(none|[-\w.]+(?:%|deg|g?rad|turn)?)/g,n=e.match(t);if(n){let a=[];return n[2].replace(i,(o,l)=>{let h=l.match(s),u=l;if(h){let c=h[0],d=u.slice(0,-c.length);c==="%"?(u=new Number(d/100),u.type="<percentage>"):(u=new Number(d*nK[c]),u.type="<angle>",u.unit=c)}else r.test(u)?(u=new Number(u),u.type="<number>"):u==="none"&&(u=new Number(NaN),u.none=!0);o.startsWith("/")&&(u=u instanceof Number?u:new Number(u),u.alpha=!0),typeof u=="object"&&u instanceof Number&&(u.raw=l),a.push(u)}),{name:n[1].toLowerCase(),rawName:n[1],rawArgs:n[2],args:a}}}function aA(e){return e[e.length-1]}function Ch(e,t,r){return isNaN(e)?t:isNaN(t)?e:e+(t-e)*r}function oA(e,t,r){return(r-e)/(t-e)}function _x(e,t,r){return Ch(t[0],t[1],oA(e[0],e[1],r))}function lA(e){return e.map(t=>t.split("|").map(r=>{r=r.trim();let s=r.match(/^(<[a-z]+>)\[(-?[.\d]+),\s*(-?[.\d]+)\]?$/);if(s){let i=new String(s[1]);return i.range=[+s[2],+s[3]],i}return r}))}function uA(e,t,r){return Math.max(Math.min(r,t),e)}function Mm(e,t){return Math.sign(e)===Math.sign(t)?e:-e}function xi(e,t){return Mm(Math.abs(e)**t,e)}function Ax(e,t){return t===0?0:e/t}function hA(e,t,r=0,s=e.length){for(;r<s;){let i=r+s>>1;e[i]<t?r=i+1:s=i}return r}var aK=Object.freeze({__proto__:null,bisectLeft:hA,clamp:uA,copySign:Mm,interpolate:Ch,interpolateInv:oA,isNone:fa,isString:pc,last:aA,mapRange:_x,multiplyMatrices:ye,parseCoordGrammar:lA,parseFunction:nA,serializeNumber:Rp,skipNone:Xe,spow:xi,toPrecision:iA,type:la,zdiv:Ax}),oK=class{add(t,r,s){if(typeof arguments[0]!="string"){for(var t in arguments[0])this.add(t,arguments[0][t],arguments[1]);return}(Array.isArray(t)?t:[t]).forEach(function(i){this[i]=this[i]||[],r&&this[i][s?"unshift":"push"](r)},this)}run(t,r){this[t]=this[t]||[],this[t].forEach(function(s){s.call(r&&r.context?r.context:r,r)})}};const ga=new oK;var ps={gamut_mapping:"css",precision:5,deltaE:"76",verbose:((Un=globalThis)==null||(Un=Un.process)==null||(Un=Un.env)==null||(Un=Un.NODE_ENV)==null?void 0:Un.toLowerCase())!=="test",warn:function(e){var t,r;this.verbose&&((t=globalThis)==null||(t=t.console)==null||(r=t.warn)==null||r.call(t,e))}};const kr={D50:[.3457/.3585,1,.2958/.3585],D65:[.3127/.329,1,.3583/.329]};function sy(e){return Array.isArray(e)?e:kr[e]}function Ip(e,t,r,s={}){if(e=sy(e),t=sy(t),!e||!t)throw TypeError(`Missing white point to convert ${e?"":"from"}${!e&&!t?"/":""}${t?"":"to"}`);if(e===t)return r;let i={W1:e,W2:t,XYZ:r,options:s};if(ga.run("chromatic-adaptation-start",i),i.M||(i.W1===kr.D65&&i.W2===kr.D50?i.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:i.W1===kr.D50&&i.W2===kr.D65&&(i.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),ga.run("chromatic-adaptation-end",i),i.M)return ye(i.M,i.XYZ);throw TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}const lK=new Set(["<number>","<percentage>","<angle>"]);function xv(e,t,r,s){return Object.entries(e.coords).map(([n,a],o)=>{let l=t.coordGrammar[o],h=s[o],u=h?.type,c;if(c=h.none?l.find(m=>lK.has(m)):l.find(m=>m==u),!c){let m=a.name||n;throw TypeError(`${u??h.raw} not allowed for ${m} in ${r}()`)}let d=c.range;u==="<percentage>"&&(d||(d=[0,1]));let p=a.range||a.refRange;return d&&p&&(s[o]=_x(d,p,s[o])),c})}function cA(e,{meta:t}={}){let r={str:String(e)?.trim()};if(ga.run("parse-start",r),r.color)return r.color;if(r.parsed=nA(r.str),r.parsed){let i=r.parsed.name;if(i==="color"){let n=r.parsed.args.shift(),a=n.startsWith("--")?n.substring(2):`--${n}`,o=[n,a],l=r.parsed.rawArgs.indexOf("/")>0?r.parsed.args.pop():1;for(let c of pt.all){let d=c.getFormat("color");if(d&&(o.includes(d.id)||d.ids?.filter(p=>o.includes(p)).length)){let p=Object.keys(c.coords).map((f,x)=>r.parsed.args[x]||0),m;return d.coordGrammar&&(m=xv(c,d,"color",p)),t&&Object.assign(t,{formatId:"color",types:m}),d.id.startsWith("--")&&!n.startsWith("--")&&ps.warn(`${c.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${d.id}) instead of color(${n}).`),n.startsWith("--")&&!d.id.startsWith("--")&&ps.warn(`${c.name} is a standard space and supported in the CSS spec. Use color(${d.id}) instead of prefixed color(${n}).`),{spaceId:c.id,coords:p,alpha:l}}}let h="",u=n in pt.registry?n:a;if(u in pt.registry){var s;let c=(s=pt.registry[u].formats)==null||(s=s.color)==null?void 0:s.id;c&&(h=`Did you mean color(${c})?`)}throw TypeError(`Cannot parse color(${n}). `+(h||"Missing a plugin?"))}else for(let n of pt.all){let a=n.getFormat(i);if(a&&a.type==="function"){let o=1;(a.lastAlpha||aA(r.parsed.args).alpha)&&(o=r.parsed.args.pop());let l=r.parsed.args,h;return a.coordGrammar&&(h=xv(n,a,i,l)),t&&Object.assign(t,{formatId:a.name,types:h}),{spaceId:n.id,coords:l,alpha:o}}}}else for(let i of pt.all)for(let n in i.formats){let a=i.formats[n];if(a.type!=="custom"||a.test&&!a.test(r.str))continue;let o=a.parse(r.str);if(o)return o.alpha??(o.alpha=1),t&&(t.formatId=n),o}throw TypeError(`Could not parse ${e} as a color. Missing a plugin?`)}function zt(e){if(Array.isArray(e))return e.map(zt);if(!e)throw TypeError("Empty color reference");pc(e)&&(e=cA(e));let t=e.space||e.spaceId;return t instanceof pt||(e.space=pt.get(t)),e.alpha===void 0&&(e.alpha=1),e}const uK=75e-6;var pt=(Sd=class Gs{constructor(t){this.id=t.id,this.name=t.name,this.base=t.base?Gs.get(t.base):null,this.aliases=t.aliases,this.base&&(this.fromBase=t.fromBase,this.toBase=t.toBase);let r=t.coords??this.base.coords;for(let i in r)"name"in r[i]||(r[i].name=i);this.coords=r;let s=t.white??this.base.white??"D65";for(let i in this.white=sy(s),this.formats=t.formats??{},this.formats){let n=this.formats[i];n.type||(n.type="function"),n.name||(n.name=i)}this.formats.color?.id||(this.formats.color={...this.formats.color??{},id:t.cssId||this.id}),t.gamutSpace?this.gamutSpace=t.gamutSpace==="self"?this:Gs.get(t.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(i,n)=>!0),this.referred=t.referred,Object.defineProperty(this,"path",{value:hK(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),ga.run("colorspace-init-end",this)}inGamut(t,{epsilon:r=uK}={}){if(!this.equals(this.gamutSpace))return t=this.to(this.gamutSpace,t),this.gamutSpace.inGamut(t,{epsilon:r});let s=Object.values(this.coords);return t.every((i,n)=>{let a=s[n];if(a.type!=="angle"&&a.range){if(Number.isNaN(i))return!0;let[o,l]=a.range;return(o===void 0||i>=o-r)&&(l===void 0||i<=l+r)}return!0})}get isUnbounded(){return Object.values(this.coords).every(t=>!("range"in t))}get cssId(){var t;return((t=this.formats)==null||(t=t.color)==null?void 0:t.id)||this.id}get isPolar(){for(let t in this.coords)if(this.coords[t].type==="angle")return!0;return!1}getFormat(t){if(typeof t=="object")return t=bv(t,this),t;let r;return r=t==="default"?Object.values(this.formats)[0]:this.formats[t],r?(r=bv(r,this),r):null}equals(t){return t?this===t||this.id===t||this.id===t.id:!1}to(t,r){if(arguments.length===1){let o=zt(t);[t,r]=[o.space,o.coords]}if(t=Gs.get(t),this.equals(t))return r;r=r.map(o=>Number.isNaN(o)?0:o);let s=this.path,i=t.path,n,a;for(let o=0;o<s.length&&s[o].equals(i[o]);o++)n=s[o],a=o;if(!n)throw Error(`Cannot convert between color spaces ${this} and ${t}: no connection space was found`);for(let o=s.length-1;o>a;o--)r=s[o].toBase(r);for(let o=a+1;o<i.length;o++)r=i[o].fromBase(r);return r}from(t,r){if(arguments.length===1){let s=zt(t);[t,r]=[s.space,s.coords]}return t=Gs.get(t),t.to(this,r)}toString(){return`${this.name} (${this.id})`}getMinCoords(){let t=[];for(let r in this.coords){let s=this.coords[r],i=s.range||s.refRange;t.push(i?.min??0)}return t}static get all(){return[...new Set(Object.values(Gs.registry))]}static register(t,r){if(arguments.length===1&&(r=arguments[0],t=r.id),r=this.get(r),this.registry[t]&&this.registry[t]!==r)throw Error(`Duplicate color space registration: '${t}'`);if(this.registry[t]=r,arguments.length===1&&r.aliases)for(let s of r.aliases)this.register(s,r);return r}static get(t,...r){if(!t||t instanceof Gs)return t;if(la(t)==="string"){let i=Gs.registry[t.toLowerCase()];if(!i)throw TypeError(`No color space found with id = "${t}"`);return i}if(r.length)return Gs.get(...r);throw TypeError(`${t} is not a valid color space`)}static resolveCoord(t,r){let s=la(t),i,n;if(s==="string"?t.includes(".")?[i,n]=t.split("."):[i,n]=[,t]:Array.isArray(t)?[i,n]=t:(i=t.space,n=t.coordId),i=Gs.get(i),i||(i=r),!i)throw TypeError(`Cannot resolve coordinate reference ${t}: No color space specified and relative references are not allowed here`);if(s=la(n),s==="number"||s==="string"&&n>=0){let l=Object.entries(i.coords)[n];if(l)return{space:i,id:l[0],index:n,...l[1]}}i=Gs.get(i);let a=n.toLowerCase(),o=0;for(let l in i.coords){let h=i.coords[l];if(l.toLowerCase()===a||h.name?.toLowerCase()===a)return{space:i,id:l,index:o,...h};o++}throw TypeError(`No "${n}" coordinate found in ${i.name}. Its coordinates are: ${Object.keys(i.coords).join(", ")}`)}},yv.defineProperty(Sd,"registry",{}),yv.defineProperty(Sd,"DEFAULT_FORMAT",{type:"functions",name:"color"}),Sd);function hK(e){let t=[e];for(let r=e;r=r.base;)t.push(r);return t}function bv(e,{coords:t}={}){if(e.coords&&!e.coordGrammar){e.type||(e.type="function"),e.name||(e.name="color"),e.coordGrammar=lA(e.coords);let r=Object.entries(t).map(([s,i],n)=>{let a=e.coordGrammar[n][0],o=i.range||i.refRange,l=a.range,h="";return a=="<percentage>"?(l=[0,100],h="%"):a=="<angle>"&&(h="deg"),{fromRange:o,toRange:l,suffix:h}});e.serializeCoords=(s,i)=>s.map((n,a)=>{let{fromRange:o,toRange:l,suffix:h}=r[a];return o&&l&&(n=_x(o,l,n)),n=Rp(n,{precision:i,unit:h}),n})}return e}var vr=new pt({id:"xyz-d65",name:"XYZ D65",coords:{x:{name:"X"},y:{name:"Y"},z:{name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]}),Xr=class extends pt{constructor(t){t.coords||(t.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),t.base||(t.base=vr),t.toXYZ_M&&t.fromXYZ_M&&(t.toBase??(t.toBase=r=>{let s=ye(t.toXYZ_M,r);return this.white!==this.base.white&&(s=Ip(this.white,this.base.white,s)),s}),t.fromBase??(t.fromBase=r=>(r=Ip(this.base.white,this.white,r),ye(t.fromXYZ_M,r)))),t.referred??(t.referred="display"),super(t)}};function mc(e,t){return e=zt(e),!t||e.space.equals(t)?e.coords.slice():(t=pt.get(t),t.from(e))}function us(e,t){e=zt(e);let{space:r,index:s}=pt.resolveCoord(t,e.space);return mc(e,r)[s]}function Cx(e,t,r){return e=zt(e),t=pt.get(t),e.coords=t.to(e.space,r),e}Cx.returns="color";function wn(e,t,r){if(e=zt(e),arguments.length===2&&la(arguments[1])==="object"){let s=arguments[1];for(let i in s)wn(e,i,s[i])}else{typeof r=="function"&&(r=r(us(e,t)));let{space:s,index:i}=pt.resolveCoord(t,e.space),n=mc(e,s);n[i]=r,Cx(e,s,n)}return e}wn.returns="color";var zx=new pt({id:"xyz-d50",name:"XYZ D50",white:"D50",base:vr,fromBase:e=>Ip(vr.white,"D50",e),toBase:e=>Ip("D50",vr.white,e)});const cK=216/24389,vv=24/116,_d=24389/27;let sg=kr.D50;var hs=new pt({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:sg,base:zx,fromBase(e){let t=e.map((s,i)=>s/sg[i]),r=t.map(s=>s>cK?Math.cbrt(s):(_d*s+16)/116);return[116*r[1]-16,500*(r[0]-r[1]),200*(r[1]-r[2])]},toBase(e){let t=[];return t[1]=(e[0]+16)/116,t[0]=e[1]/500+t[1],t[2]=t[1]-e[2]/200,[t[0]>vv?t[0]**3:(116*t[0]-16)/_d,e[0]>8?((e[0]+16)/116)**3:e[0]/_d,t[2]>vv?t[2]**3:(116*t[2]-16)/_d].map((s,i)=>s*sg[i])},formats:{lab:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function Di(e){return(e%360+360)%360}function dK(e,t){if(e==="raw")return t;let[r,s]=t.map(Di),i=s-r;return e==="increasing"?i<0&&(s+=360):e==="decreasing"?i>0&&(r+=360):e==="longer"?-180<i&&i<180&&(i>0?r+=360:s+=360):e==="shorter"&&(i>180?r+=360:i<-180&&(s+=360)),[r,s]}var zh=new pt({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:hs,fromBase(e){let[t,r,s]=e,i,n=.02;return i=Math.abs(r)<n&&Math.abs(s)<n?NaN:Math.atan2(s,r)*180/Math.PI,[t,Math.sqrt(r**2+s**2),Di(i)]},toBase(e){let[t,r,s]=e;return r<0&&(r=0),isNaN(s)&&(s=0),[t,r*Math.cos(s*Math.PI/180),r*Math.sin(s*Math.PI/180)]},formats:{lch:{coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}});const Mv=25**7,Lp=Math.PI,wv=180/Lp,el=Lp/180;function Tv(e){let t=e*e;return t*t*t*e}function dA(e,t,{kL:r=1,kC:s=1,kH:i=1}={}){[e,t]=zt([e,t]);let[n,a,o]=hs.from(e),l=zh.from(hs,[n,a,o])[1],[h,u,c]=hs.from(t),d=zh.from(hs,[h,u,c])[1];l<0&&(l=0),d<0&&(d=0);let p=(l+d)/2,m=Tv(p),f=.5*(1-Math.sqrt(m/(m+Mv))),x=(1+f)*a,b=(1+f)*u,v=Math.sqrt(x**2+o**2),T=Math.sqrt(b**2+c**2),_=x===0&&o===0?0:Math.atan2(o,x),E=b===0&&c===0?0:Math.atan2(c,b);_<0&&(_+=2*Lp),E<0&&(E+=2*Lp),_*=wv,E*=wv;let C=h-n,A=T-v,I=E-_,Q=_+E,ot=Math.abs(I),K;v*T===0?K=0:ot<=180?K=I:I>180?K=I-360:I<-180?K=I+360:ps.warn("the unthinkable has happened");let mt=2*Math.sqrt(T*v)*Math.sin(K*el/2),nt=(n+h)/2,yt=(v+T)/2,lt=Tv(yt),Nt;Nt=v*T===0?Q:ot<=180?Q/2:Q<360?(Q+360)/2:(Q-360)/2;let ht=(nt-50)**2,Mt=1+.015*ht/Math.sqrt(20+ht),ut=1+.045*yt,at=1;at-=.17*Math.cos((Nt-30)*el),at+=.24*Math.cos(2*Nt*el),at+=.32*Math.cos((3*Nt+6)*el),at-=.2*Math.cos((4*Nt-63)*el);let gt=1+.015*yt*at,Ot=30*Math.exp(-1*((Nt-275)/25)**2),jt=2*Math.sqrt(lt/(lt+Mv)),be=-1*Math.sin(2*Ot*el)*jt,se=(C/(r*Mt))**2;return se+=(A/(s*ut))**2,se+=(mt/(i*gt))**2,se+=be*(A/(s*ut))*(mt/(i*gt)),Math.sqrt(se)}const pK=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],mK=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],fK=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],gK=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]];var ou=new pt({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:vr,fromBase(e){let t=ye(pK,e),r=t.map(s=>Math.cbrt(s));return ye(fK,r)},toBase(e){let t=ye(gK,e),r=t.map(s=>s**3);return ye(mK,r)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function iy(e,t){[e,t]=zt([e,t]);let[r,s,i]=ou.from(e),[n,a,o]=ou.from(t),l=r-n,h=s-a,u=i-o;return Math.sqrt(l**2+h**2+u**2)}const yK=75e-6;function Ka(e,t,{epsilon:r=yK}={}){e=zt(e),t||(t=e.space),t=pt.get(t);let s=e.coords;return t!==e.space&&(s=t.from(e)),t.inGamut(s,{epsilon:r})}function lu(e){return{space:e.space,coords:e.coords.slice(),alpha:e.alpha}}function pA(e,t,r="lab"){r=pt.get(r);let s=r.from(e),i=r.from(t);return Math.sqrt(s.reduce((n,a,o)=>{let l=i[o];return isNaN(a)||isNaN(l)?n:n+(l-a)**2},0))}function xK(e,t){return pA(e,t,"lab")}const bK=Math.PI,Nv=bK/180;function vK(e,t,{l:r=2,c:s=1}={}){[e,t]=zt([e,t]);let[i,n,a]=hs.from(e),[,o,l]=zh.from(hs,[i,n,a]),[h,u,c]=hs.from(t),d=zh.from(hs,[h,u,c])[1];o<0&&(o=0),d<0&&(d=0);let p=i-h,m=o-d,f=n-u,x=a-c,b=f**2+x**2-m**2,v=.511;i>=16&&(v=.040975*i/(1+.01765*i));let T=.0638*o/(1+.0131*o)+.638,_;Number.isNaN(l)&&(l=0),_=l>=164&&l<=345?.56+Math.abs(.2*Math.cos((l+168)*Nv)):.36+Math.abs(.4*Math.cos((l+35)*Nv));let E=o**4,C=Math.sqrt(E/(E+1900)),A=T*(C*_+1-C),I=(p/(r*v))**2;return I+=(m/(s*T))**2,I+=b/A**2,Math.sqrt(I)}const Sv=203;var Ex=new pt({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:vr,fromBase(e){return e.map(t=>Math.max(t*Sv,0))},toBase(e){return e.map(t=>Math.max(t/Sv,0))}});const Ad=1.15,Cd=.66,_v=2610/2**14,MK=2**14/2610,Av=3424/2**12,Cv=2413/2**7,zv=2392/2**7,wK=1.7*2523/2**5,Ev=2**5/(1.7*2523),zd=-.56,ig=16295499532821565e-27,TK=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],NK=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],SK=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],_K=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]];var mA=new pt({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:Ex,fromBase(e){let[t,r,s]=e,i=Ad*t-(Ad-1)*s,n=Cd*r-(Cd-1)*t,a=ye(TK,[i,n,s]),o=a.map(function(d){let p=Av+Cv*(d/1e4)**_v,m=1+zv*(d/1e4)**_v;return(p/m)**wK}),[l,h,u]=ye(SK,o);return[(1+zd)*l/(1+zd*l)-ig,h,u]},toBase(e){let[t,r,s]=e,i=(t+ig)/(1+zd-zd*(t+ig)),n=ye(_K,[i,r,s]),a=n.map(function(d){let p=Av-d**Ev,m=zv*d**Ev-Cv;return 1e4*(p/m)**MK}),[o,l,h]=ye(NK,a),u=(o+(Ad-1)*h)/Ad,c=(l+(Cd-1)*u)/Cd;return[u,c,h]},formats:{color:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),ny=new pt({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,1],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:mA,fromBase(e){let[t,r,s]=e,i,n=2e-4;return i=Math.abs(r)<n&&Math.abs(s)<n?NaN:Math.atan2(s,r)*180/Math.PI,[t,Math.sqrt(r**2+s**2),Di(i)]},toBase(e){return[e[0],e[1]*Math.cos(e[2]*Math.PI/180),e[1]*Math.sin(e[2]*Math.PI/180)]}});function AK(e,t){[e,t]=zt([e,t]);let[r,s,i]=ny.from(e),[n,a,o]=ny.from(t),l=r-n,h=s-a;Number.isNaN(i)&&Number.isNaN(o)?(i=0,o=0):Number.isNaN(i)?i=o:Number.isNaN(o)&&(o=i);let u=i-o,c=2*Math.sqrt(s*a)*Math.sin(u/2*(Math.PI/180));return Math.sqrt(l**2+h**2+c**2)}const fA=3424/4096,gA=2413/128,yA=2392/128,Vv=2610/16384,CK=2523/32,zK=16384/2610,Rv=32/2523,EK=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],VK=[[2048/4096,2048/4096,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],RK=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],IK=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]];var ay=new pt({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:Ex,fromBase(e){let t=ye(EK,e);return LK(t)},toBase(e){let t=PK(e);return ye(IK,t)}});function LK(e){let t=e.map(function(r){let s=fA+gA*(r/1e4)**Vv,i=1+yA*(r/1e4)**Vv;return(s/i)**CK});return ye(VK,t)}function PK(e){return ye(RK,e).map(function(s){let i=Math.max(s**Rv-fA,0),n=gA-yA*s**Rv;return 1e4*(i/n)**zK})}function FK(e,t){[e,t]=zt([e,t]);let[r,s,i]=ay.from(e),[n,a,o]=ay.from(t);return 720*Math.sqrt((r-n)**2+.25*(s-a)**2+(i-o)**2)}const OK=kr.D65,xA=.42,Iv=1/xA,ng=2*Math.PI,bA=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],kK=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],BK=[[460,451,288],[460,-891,-261],[460,-220,-6300]],DK={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},ja={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},UK=180/Math.PI,Lv=Math.PI/180;function vA(e,t){return e.map(s=>{let i=xi(t*Math.abs(s)*.01,xA);return 400*Mm(i,s)/(i+27.13)})}function $K(e,t){let r=100/t*27.13**Iv;return e.map(s=>{let i=Math.abs(s);return Mm(r*xi(i/(400-i),Iv),s)})}function jK(e){let t=Di(e);t<=ja.h[0]&&(t+=360);let r=hA(ja.h,t)-1,[s,i]=ja.h.slice(r,r+2),[n,a]=ja.e.slice(r,r+2),o=ja.H[r],l=(t-s)/n;return o+100*l/(l+(i-t)/a)}function WK(e){let t=(e%400+400)%400,r=Math.floor(.01*t);t%=100;let[s,i]=ja.h.slice(r,r+2),[n,a]=ja.e.slice(r,r+2);return Di((t*(a*s-n*i)-100*s*a)/(t*(a-n)-100*a))}function MA(e,t,r,s,i){let n={};n.discounting=i,n.refWhite=e,n.surround=s;let a=e.map(f=>f*100);n.la=t,n.yb=r;let o=a[1],l=ye(bA,a);s=DK[n.surround];let h=s[0];n.c=s[1],n.nc=s[2];let u=1/(5*n.la+1),c=u**4;n.fl=c*n.la+.1*(1-c)*(1-c)*Math.cbrt(5*n.la),n.flRoot=n.fl**.25,n.n=n.yb/o,n.z=1.48+Math.sqrt(n.n),n.nbb=.725*n.n**-.2,n.ncb=n.nbb;let d=Math.max(Math.min(h*(1-1/3.6*Math.exp((-n.la-42)/92)),1),0);n.dRgb=l.map(f=>Ch(1,o/f,d)),n.dRgbInv=n.dRgb.map(f=>1/f);let p=l.map((f,x)=>f*n.dRgb[x]),m=vA(p,n.fl);return n.aW=n.nbb*(2*m[0]+m[1]+.05*m[2]),n}const Pv=MA(OK,64/Math.PI*.2,20,"average",!1);function oy(e,t){if(!(e.J!==void 0^e.Q!==void 0))throw Error("Conversion requires one and only one: 'J' or 'Q'");if(!(e.C!==void 0^e.M!==void 0^e.s!==void 0))throw Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(e.h!==void 0^e.H!==void 0))throw Error("Conversion requires one and only one: 'h' or 'H'");if(e.J===0||e.Q===0)return[0,0,0];let r=0;r=e.h===void 0?WK(e.H)*Lv:Di(e.h)*Lv;let s=Math.cos(r),i=Math.sin(r),n=0;e.J===void 0?e.Q!==void 0&&(n=.25*t.c*e.Q/((t.aW+4)*t.flRoot)):n=xi(e.J,1/2)*.1;let a=0;e.C===void 0?e.M===void 0?e.s!==void 0&&(a=4e-4*e.s**2*(t.aW+4)/t.c):a=e.M/t.flRoot/n:a=e.C/n;let o=xi(a*(1.64-.29**t.n)**-.73,10/9),l=.25*(Math.cos(r+2)+3.8),h=t.aW*xi(n,2/t.c/t.z),u=5e4/13*t.nc*t.ncb*l,c=h/t.nbb,d=23*(c+.305)*Ax(o,23*u+o*(11*s+108*i)),p=d*s,m=d*i,f=$K(ye(BK,[c,p,m]).map(x=>x*1/1403),t.fl);return ye(kK,f.map((x,b)=>x*t.dRgbInv[b])).map(x=>x/100)}function wA(e,t){let r=e.map(T=>T*100),s=vA(ye(bA,r).map((T,_)=>T*t.dRgb[_]),t.fl),i=s[0]+(-12*s[1]+s[2])/11,n=(s[0]+s[1]-2*s[2])/9,a=(Math.atan2(n,i)%ng+ng)%ng,o=.25*(Math.cos(a+2)+3.8),l=5e4/13*t.nc*t.ncb*Ax(o*Math.sqrt(i**2+n**2),s[0]+s[1]+1.05*s[2]+.305),h=xi(l,.9)*(1.64-.29**t.n)**.73,u=t.nbb*(2*s[0]+s[1]+.05*s[2]),c=xi(u/t.aW,.5*t.c*t.z),d=100*xi(c,2),p=4/t.c*c*(t.aW+4)*t.flRoot,m=h*c,f=m*t.flRoot,x=Di(a*UK),b=jK(x),v=50*xi(t.c*h/(t.aW+4),1/2);return{J:d,C:m,h:x,s:v,Q:p,M:f,H:b}}var qK=new pt({id:"cam16-jmh",cssId:"--cam16-jmh",name:"CAM16-JMh",coords:{j:{refRange:[0,100],name:"J"},m:{refRange:[0,105],name:"Colorfulness"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:vr,fromBase(e){let t=wA(e,Pv);return[t.J,t.M,t.h]},toBase(e){return oy({J:e[0],M:e[1],h:e[2]},Pv)}});const HK=kr.D65,GK=216/24389,TA=24389/27;function XK(e){return 116*(e>GK?Math.cbrt(e):(TA*e+16)/116)-16}function ly(e){return e>8?((e+16)/116)**3:e/TA}function YK(e,t){let[r,s,i]=e,n=[],a=0;if(i===0)return[0,0,0];let o=ly(i);a=i>0?.00379058511492914*i**2+.608983189401032*i+.9155088574762233:9514440756550361e-21*i**2+.08693057439788597*i-21.928975842194614;let l=2e-12,h=15,u=0,c=1/0;for(;u<=h;){n=oy({J:a,C:s,h:r},t);let d=Math.abs(n[1]-o);if(d<c){if(d<=l)return n;c=d}a-=(n[1]-o)*a/(2*n[1]),u+=1}return oy({J:a,C:s,h:r},t)}function ZK(e,t){let r=XK(e[1]);if(r===0)return[0,0,0];let s=wA(e,Vx);return[Di(s.h),s.C,r]}const Vx=MA(HK,200/Math.PI*ly(50),ly(50)*100,"average",!1);var Eh=new pt({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:vr,fromBase(e){return ZK(e)},toBase(e){return YK(e,Vx)},formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const JK=Math.PI/180,Fv=[1,.007,.0228];function Ov(e){e[1]<0&&(e=Eh.fromBase(Eh.toBase(e)));let t=Math.log(Math.max(1+Fv[2]*e[1]*Vx.flRoot,1))/Fv[2],r=e[0]*JK,s=t*Math.cos(r),i=t*Math.sin(r);return[e[2],s,i]}function QK(e,t){[e,t]=zt([e,t]);let[r,s,i]=Ov(Eh.from(e)),[n,a,o]=Ov(Eh.from(t));return Math.sqrt((r-n)**2+(s-a)**2+(i-o)**2)}var uu={deltaE76:xK,deltaECMC:vK,deltaE2000:dA,deltaEJz:AK,deltaEITP:FK,deltaEOK:iy,deltaEHCT:QK};function KK(e){let t=e?Math.floor(Math.log10(Math.abs(e))):0;return Math.max(parseFloat(`1e${t-2}`),1e-6)}const kv={hct:{method:"hct.c",jnd:2,deltaEMethod:"hct",blackWhiteClamp:{}},"hct-tonal":{method:"hct.c",jnd:0,deltaEMethod:"hct",blackWhiteClamp:{channel:"hct.t",min:0,max:100}}};function ya(e,{method:t=ps.gamut_mapping,space:r=void 0,deltaEMethod:s="",jnd:i=2,blackWhiteClamp:n={}}={}){if(e=zt(e),pc(arguments[1])?r=arguments[1]:r||(r=e.space),r=pt.get(r),Ka(e,r,{epsilon:0}))return e;let a;if(t==="css")a=ttt(e,{space:r});else{if(t!=="clip"&&!Ka(e,r)){Object.prototype.hasOwnProperty.call(kv,t)&&({method:t,jnd:i,deltaEMethod:s,blackWhiteClamp:n}=kv[t]);let o=dA;if(s!==""){for(let h in uu)if("deltae"+s.toLowerCase()===h.toLowerCase()){o=uu[h];break}}let l=ya(ge(e,r),{method:"clip",space:r});if(o(e,l)>i){if(Object.keys(n).length===3){let v=pt.resolveCoord(n.channel),T=us(ge(e,v.space),v.id);if(fa(T)&&(T=0),T>=n.max)return ge({space:"xyz-d65",coords:kr.D65},e.space);if(T<=n.min)return ge({space:"xyz-d65",coords:[0,0,0]},e.space)}let h=pt.resolveCoord(t),u=h.space,c=h.id,d=ge(e,u);d.coords.forEach((v,T)=>{fa(v)&&(d.coords[T]=0)});let p=h.range||h.refRange,m=p[0],f=KK(i),x=m,b=us(d,c);for(;b-x>f;){let v=lu(d);v=ya(v,{space:r,method:"clip"}),o(d,v)-i<f?x=us(d,c):b=us(d,c),wn(d,c,(x+b)/2)}a=ge(d,r)}else a=l}else a=ge(e,r);if(t==="clip"||!Ka(a,r,{epsilon:0})){let o=Object.values(r.coords).map(l=>l.range||[]);a.coords=a.coords.map((l,h)=>{let[u,c]=o[h];return u!==void 0&&(l=Math.max(u,l)),c!==void 0&&(l=Math.min(l,c)),l})}}return r!==e.space&&(a=ge(a,e.space)),e.coords=a.coords,e}ya.returns="color";const Bv={WHITE:{space:ou,coords:[1,0,0]},BLACK:{space:ou,coords:[0,0,0]}};function ttt(e,{space:t}={}){let r=.02,s=1e-4;e=zt(e),t||(t=e.space),t=pt.get(t);let i=pt.get("oklch");if(t.isUnbounded)return ge(e,t);let n=ge(e,i),a=n.coords[0];if(a>=1){let m=ge(Bv.WHITE,t);return m.alpha=e.alpha,ge(m,t)}if(a<=0){let m=ge(Bv.BLACK,t);return m.alpha=e.alpha,ge(m,t)}if(Ka(n,t,{epsilon:0}))return ge(n,t);function o(m){let f=ge(m,t),x=Object.values(t.coords);return f.coords=f.coords.map((b,v)=>{if("range"in x[v]){let[T,_]=x[v].range;return uA(T,b,_)}return b}),f}let l=0,h=n.coords[1],u=!0,c=lu(n),d=o(c),p=iy(d,c);if(p<r)return d;for(;h-l>s;){let m=(l+h)/2;if(c.coords[1]=m,u&&Ka(c,t,{epsilon:0}))l=m;else if(d=o(c),p=iy(d,c),p<r){if(r-p<s)break;u=!1,l=m}else h=m}return d}function ge(e,t,{inGamut:r}={}){e=zt(e),t=pt.get(t);let s=t.from(e),i={space:t,coords:s,alpha:e.alpha};return r&&(i=ya(i,r===!0?void 0:r)),i}ge.returns="color";function dh(e,{precision:t=ps.precision,format:r="default",inGamut:s=!0,...i}={}){let n;e=zt(e);let a=r;r=e.space.getFormat(r)??e.space.getFormat("default")??pt.DEFAULT_FORMAT;let o=e.coords.slice();if(s||(s=r.toGamut),s&&!Ka(e)&&(o=ya(lu(e),s===!0?void 0:s).coords),r.type==="custom")if(i.precision=t,r.serialize)n=r.serialize(o,e.alpha,i);else throw TypeError(`format ${a} can only be used to parse colors, not for serialization`);else{let l=r.name||"color";r.serializeCoords?o=r.serializeCoords(o,t):t!==null&&(o=o.map(d=>Rp(d,{precision:t})));let h=[...o];if(l==="color"){let d=r.id||r.ids?.[0]||e.space.id;h.unshift(d)}let u=e.alpha;t!==null&&(u=Rp(u,{precision:t}));let c=e.alpha>=1||r.noAlpha?"":`${r.commas?",":" /"} ${u}`;n=`${l}(${h.join(r.commas?", ":" ")}${c})`}return n}const ett=[[.6369580483012914,.14461690358620832,.1688809751641721],[.2627002120112671,.6779980715188708,.05930171646986196],[0,.028072693049087428,1.060985057710791]],rtt=[[1.716651187971268,-.355670783776392,-.25336628137366],[-.666684351832489,1.616481236634939,.0157685458139111],[.017639857445311,-.042770613257809,.942103121235474]];var wm=new Xr({id:"rec2020-linear",cssId:"--rec2020-linear",name:"Linear REC.2020",white:"D65",toXYZ_M:ett,fromXYZ_M:rtt});const Ed=1.09929682680944,Dv=.018053968510807;var NA=new Xr({id:"rec2020",name:"REC.2020",base:wm,toBase(e){return e.map(function(t){return t<Dv*4.5?t/4.5:((t+Ed-1)/Ed)**(1/.45)})},fromBase(e){return e.map(function(t){return t>=Dv?Ed*t**.45-(Ed-1):4.5*t})}});const stt=[[.4865709486482162,.26566769316909306,.1982172852343625],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],itt=[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]];var SA=new Xr({id:"p3-linear",cssId:"--display-p3-linear",name:"Linear P3",white:"D65",toXYZ_M:stt,fromXYZ_M:itt});const ntt=[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],ar=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]];var _A=new Xr({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:ntt,fromXYZ_M:ar}),Uv={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[153/255,50/255,204/255],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,153/255],lightslategrey:[119/255,136/255,153/255],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[102/255,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,204/255],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[102/255,51/255,153/255],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let $v=[,,,].fill("<percentage> | <number>[0, 255]"),jv=[,,,].fill("<number>[0, 255]");var hu=new Xr({id:"srgb",name:"sRGB",base:_A,fromBase:e=>e.map(t=>{let r=t<0?-1:1,s=t*r;return s>.0031308?r*(1.055*s**(1/2.4)-.055):12.92*t}),toBase:e=>e.map(t=>{let r=t<0?-1:1,s=t*r;return s<=.04045?t/12.92:r*((s+.055)/1.055)**2.4}),formats:{rgb:{coords:$v},rgb_number:{name:"rgb",commas:!0,coords:jv,noAlpha:!0},color:{},rgba:{coords:$v,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:jv},hex:{type:"custom",toGamut:!0,test:e=>/^#([a-f0-9]{3,4}){1,2}$/i.test(e),parse(e){e.length<=5&&(e=e.replace(/[a-f0-9]/gi,"$&$&"));let t=[];return e.replace(/[a-f0-9]{2}/gi,r=>{t.push(parseInt(r,16)/255)}),{spaceId:"srgb",coords:t.slice(0,3),alpha:t.slice(3)[0]}},serialize:(e,t,{collapse:r=!0}={})=>{t<1&&e.push(t),e=e.map(n=>Math.round(n*255));let s=r&&e.every(n=>n%17==0);return"#"+e.map(n=>s?(n/17).toString(16):n.toString(16).padStart(2,"0")).join("")}},keyword:{type:"custom",test:e=>/^[a-z]+$/i.test(e),parse(e){e=e.toLowerCase();let t={spaceId:"srgb",coords:null,alpha:1};if(e==="transparent"?(t.coords=Uv.black,t.alpha=0):t.coords=Uv[e],t.coords)return t}}}}),AA=new Xr({id:"p3",cssId:"display-p3",name:"P3",base:SA,fromBase:hu.fromBase,toBase:hu.toBase});ps.display_space=hu;let att;if(typeof CSS<"u"&&CSS.supports)for(let e of[hs,NA,AA]){let t=e.getMinCoords(),r={space:e,coords:t,alpha:1},s=dh(r);if(CSS.supports("color",s)){ps.display_space=e;break}}function ott(e,{space:t=ps.display_space,...r}={}){let s=dh(e,r);if(typeof CSS>"u"||CSS.supports("color",s)||!ps.display_space)s=new String(s),s.color=e;else{let i=e;if((e.coords.some(fa)||fa(e.alpha))&&!(att??(att=CSS.supports("color","hsl(none 50% 50%)")))&&(i=lu(e),i.coords=i.coords.map(Xe),i.alpha=Xe(i.alpha),s=dh(i,r),CSS.supports("color",s)))return s=new String(s),s.color=i,s;i=ge(i,t),s=new String(dh(i,r)),s.color=i}return s}function ltt(e,t){return e=zt(e),t=zt(t),e.space===t.space&&e.alpha===t.alpha&&e.coords.every((r,s)=>r===t.coords[s])}function xa(e){return us(e,[vr,"y"])}function CA(e,t){wn(e,[vr,"y"],t)}function utt(e){Object.defineProperty(e.prototype,"luminance",{get(){return xa(this)},set(t){CA(this,t)}})}var htt=Object.freeze({__proto__:null,getLuminance:xa,register:utt,setLuminance:CA});function ctt(e,t){e=zt(e),t=zt(t);let r=Math.max(xa(e),0),s=Math.max(xa(t),0);return s>r&&([r,s]=[s,r]),(r+.05)/(s+.05)}const dtt=.56,ptt=.57,mtt=.62,ftt=.65,Wv=.022,gtt=1.414,ytt=.1,xtt=5e-4,btt=1.14,qv=.027,vtt=1.14;function Hv(e){return e>=Wv?e:e+(Wv-e)**gtt}function rl(e){let t=e<0?-1:1,r=Math.abs(e);return t*r**2.4}function Mtt(e,t){t=zt(t),e=zt(e);let r,s,i,n,a,o;t=ge(t,"srgb"),[n,a,o]=t.coords;let l=rl(n)*.2126729+rl(a)*.7151522+rl(o)*.072175;e=ge(e,"srgb"),[n,a,o]=e.coords;let h=rl(n)*.2126729+rl(a)*.7151522+rl(o)*.072175,u=Hv(l),c=Hv(h),d=c>u;return Math.abs(c-u)<xtt?s=0:d?(r=c**dtt-u**ptt,s=r*btt):(r=c**ftt-u**mtt,s=r*vtt),i=Math.abs(s)<ytt?0:s>0?s-qv:s+qv,i*100}function wtt(e,t){e=zt(e),t=zt(t);let r=Math.max(xa(e),0),s=Math.max(xa(t),0);s>r&&([r,s]=[s,r]);let i=r+s;return i===0?0:(r-s)/i}const Ttt=5e4;function Ntt(e,t){e=zt(e),t=zt(t);let r=Math.max(xa(e),0),s=Math.max(xa(t),0);return s>r&&([r,s]=[s,r]),s===0?Ttt:(r-s)/s}function Stt(e,t){e=zt(e),t=zt(t);let r=us(e,[hs,"l"]),s=us(t,[hs,"l"]);return Math.abs(r-s)}const _tt=216/24389,Gv=24/116,Vd=24389/27;let ag=kr.D65;var uy=new pt({id:"lab-d65",name:"Lab D65",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:ag,base:vr,fromBase(e){let t=e.map((s,i)=>s/ag[i]),r=t.map(s=>s>_tt?Math.cbrt(s):(Vd*s+16)/116);return[116*r[1]-16,500*(r[0]-r[1]),200*(r[1]-r[2])]},toBase(e){let t=[];return t[1]=(e[0]+16)/116,t[0]=e[1]/500+t[1],t[2]=t[1]-e[2]/200,[t[0]>Gv?t[0]**3:(116*t[0]-16)/Vd,e[0]>8?((e[0]+16)/116)**3:e[0]/Vd,t[2]>Gv?t[2]**3:(116*t[2]-16)/Vd].map((s,i)=>s*ag[i])},formats:{"lab-d65":{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});const Att=5**.5*.5+.5;function Ctt(e,t){e=zt(e),t=zt(t);let r=us(e,[uy,"l"]),s=us(t,[uy,"l"]),i=Math.abs(r**1.618033988749895-s**1.618033988749895),n=i**(1/Att)*Math.SQRT2-40;return n<7.5?0:n}var Qd=Object.freeze({__proto__:null,contrastAPCA:Mtt,contrastDeltaPhi:Ctt,contrastLstar:Stt,contrastMichelson:wtt,contrastWCAG21:ctt,contrastWeber:Ntt});function ztt(e,t,r={}){pc(r)&&(r={algorithm:r});let{algorithm:s,...i}=r;if(!s){let n=Object.keys(Qd).map(a=>a.replace(/^contrast/,"")).join(", ");throw TypeError(`contrast() function needs a contrast algorithm. Please specify one of: ${n}`)}for(let n in e=zt(e),t=zt(t),Qd)if("contrast"+s.toLowerCase()===n.toLowerCase())return Qd[n](e,t,i);throw TypeError(`Unknown contrast algorithm: ${s}`)}function Tm(e){let[t,r,s]=mc(e,vr),i=t+15*r+3*s;return[4*t/i,9*r/i]}function zA(e){let[t,r,s]=mc(e,vr),i=t+r+s;return[t/i,r/i]}function Ett(e){Object.defineProperty(e.prototype,"uv",{get(){return Tm(this)}}),Object.defineProperty(e.prototype,"xy",{get(){return zA(this)}})}var Vtt=Object.freeze({__proto__:null,register:Ett,uv:Tm,xy:zA});function eh(e,t,r={}){pc(r)&&(r={method:r});let{method:s=ps.deltaE,...i}=r;for(let n in uu)if("deltae"+s.toLowerCase()===n.toLowerCase())return uu[n](e,t,i);throw TypeError(`Unknown deltaE method: ${s}`)}function Rtt(e,t=.25){let r=pt.get("oklch","lch");return wn(e,[r,"l"],i=>i*(1+t))}function Itt(e,t=.25){let r=pt.get("oklch","lch");return wn(e,[r,"l"],i=>i*(1-t))}var Ltt=Object.freeze({__proto__:null,darken:Itt,lighten:Rtt});function EA(e,t,r=.5,s={}){return[e,t]=[zt(e),zt(t)],la(r)==="object"&&([r,s]=[.5,r]),fc(e,t,s)(r)}function VA(e,t,r={}){let s;Rx(e)&&([s,r]=[e,t],[e,t]=s.rangeArgs.colors);let{maxDeltaE:i,deltaEMethod:n,steps:a=2,maxSteps:o=1e3,...l}=r;s||([e,t]=[zt(e),zt(t)],s=fc(e,t,l));let h=eh(e,t),u=i>0?Math.max(a,Math.ceil(h/i)+1):a,c=[];if(o!==void 0&&(u=Math.min(u,o)),u===1)c=[{p:.5,color:s(.5)}];else{let d=1/(u-1);c=Array.from({length:u},(p,m)=>{let f=m*d;return{p:f,color:s(f)}})}if(i>0){let d=c.reduce((p,m,f)=>{if(f===0)return 0;let x=eh(m.color,c[f-1].color,n);return Math.max(p,x)},0);for(;d>i;){d=0;for(let p=1;p<c.length&&c.length<o;p++){let m=c[p-1],f=c[p],x=(f.p+m.p)/2,b=s(x);d=Math.max(d,eh(b,m.color),eh(b,f.color)),c.splice(p,0,{p:x,color:s(x)}),p++}}}return c=c.map(d=>d.color),c}function fc(e,t,r={}){if(Rx(e)){let[l,h]=[e,t];return fc(...l.rangeArgs.colors,{...l.rangeArgs.options,...h})}let{space:s,outputSpace:i,progression:n,premultiplied:a}=r;e=zt(e),t=zt(t),e=lu(e),t=lu(t);let o={colors:[e,t],options:r};if(s=s?pt.get(s):pt.registry[ps.interpolationSpace]||e.space,i=i?pt.get(i):s,e=ge(e,s),t=ge(t,s),e=ya(e),t=ya(t),s.coords.h&&s.coords.h.type==="angle"){let l=r.hue=r.hue||"shorter",h=[s,"h"],[u,c]=[us(e,h),us(t,h)];isNaN(u)&&!isNaN(c)?u=c:isNaN(c)&&!isNaN(u)&&(c=u),[u,c]=dK(l,[u,c]),wn(e,h,u),wn(t,h,c)}return a&&(e.coords=e.coords.map(l=>l*e.alpha),t.coords=t.coords.map(l=>l*t.alpha)),Object.assign(l=>{l=n?n(l):l;let h=e.coords.map((d,p)=>{let m=t.coords[p];return Ch(d,m,l)}),u=Ch(e.alpha,t.alpha,l),c={space:s,coords:h,alpha:u};return a&&(c.coords=c.coords.map(d=>d/u)),i!==s&&(c=ge(c,i)),c},{rangeArgs:o})}function Rx(e){return la(e)==="function"&&!!e.rangeArgs}ps.interpolationSpace="lab";function Ptt(e){e.defineFunction("mix",EA,{returns:"color"}),e.defineFunction("range",fc,{returns:"function<color>"}),e.defineFunction("steps",VA,{returns:"array<color>"})}var Ftt=Object.freeze({__proto__:null,isRange:Rx,mix:EA,range:fc,register:Ptt,steps:VA}),RA=new pt({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:hu,fromBase:e=>{let t=Math.max(...e),r=Math.min(...e),[s,i,n]=e,[a,o,l]=[NaN,0,(r+t)/2],h=t-r;if(h!==0){switch(o=l===0||l===1?0:(t-l)/Math.min(l,1-l),t){case s:a=(i-n)/h+(i<n?6:0);break;case i:a=(n-s)/h+2;break;case n:a=(s-i)/h+4}a*=60}return o<0&&(a+=180,o=Math.abs(o)),a>=360&&(a-=360),[a,o*100,l*100]},toBase:e=>{let[t,r,s]=e;t%=360,t<0&&(t+=360),r/=100,s/=100;function i(n){let a=(n+t/30)%12,o=r*Math.min(s,1-s);return s-o*Math.max(-1,Math.min(a-3,9-a,1))}return[i(0),i(8),i(4)]},formats:{hsl:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsla:{coords:["<number> | <angle>","<percentage>","<percentage>"],commas:!0,lastAlpha:!0}}}),IA=new pt({id:"hsv",name:"HSV",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},v:{range:[0,100],name:"Value"}},base:RA,fromBase(e){let[t,r,s]=e;r/=100,s/=100;let i=s+r*Math.min(s,1-s);return[t,i===0?0:200*(1-s/i),100*i]},toBase(e){let[t,r,s]=e;r/=100,s/=100;let i=s*(1-r/2);return[t,i===0||i===1?0:(s-i)/Math.min(i,1-i)*100,i*100]},formats:{color:{id:"--hsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),Ott=new pt({id:"hwb",name:"HWB",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},w:{range:[0,100],name:"Whiteness"},b:{range:[0,100],name:"Blackness"}},base:IA,fromBase(e){let[t,r,s]=e;return[t,s*(100-r)/100,100-s]},toBase(e){let[t,r,s]=e;r/=100,s/=100;let i=r+s;if(i>=1){let o=r/i;return[t,0,o*100]}let n=1-s,a=n===0?0:1-r/n;return[t,a*100,n*100]},formats:{hwb:{coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const ktt=[[.5766690429101305,.1855582379065463,.1882286462349947],[.29734497525053605,.6273635662554661,.07529145849399788],[.02703136138641234,.07068885253582723,.9913375368376388]],Btt=[[2.0415879038107465,-.5650069742788596,-.34473135077832956],[-.9692436362808795,1.8759675015077202,.04155505740717557],[.013444280632031142,-.11836239223101838,1.0151749943912054]];var LA=new Xr({id:"a98rgb-linear",cssId:"--a98-rgb-linear",name:"Linear Adobe® 98 RGB compatible",white:"D65",toXYZ_M:ktt,fromXYZ_M:Btt}),Dtt=new Xr({id:"a98rgb",cssId:"a98-rgb",name:"Adobe® 98 RGB compatible",base:LA,toBase:e=>e.map(t=>Math.abs(t)**(563/256)*Math.sign(t)),fromBase:e=>e.map(t=>Math.abs(t)**(256/563)*Math.sign(t))});const Utt=[[.7977666449006423,.13518129740053308,.0313477341283922],[.2880748288194013,.711835234241873,8993693872564e-17],[0,0,.8251046025104602]],$tt=[[1.3457868816471583,-.25557208737979464,-.05110186497554526],[-.5446307051249019,1.5082477428451468,.02052744743642139],[0,0,1.2119675456389452]];var PA=new Xr({id:"prophoto-linear",cssId:"--prophoto-rgb-linear",name:"Linear ProPhoto",white:"D50",base:zx,toXYZ_M:Utt,fromXYZ_M:$tt});const jtt=1/512,Wtt=16/512;var qtt=new Xr({id:"prophoto",cssId:"prophoto-rgb",name:"ProPhoto",base:PA,toBase(e){return e.map(t=>t<Wtt?t/16:t**1.8)},fromBase(e){return e.map(t=>t>=jtt?t**(1/1.8):16*t)}}),Htt=new pt({id:"oklch",name:"Oklch",coords:{l:{refRange:[0,1],name:"Lightness"},c:{refRange:[0,.4],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},white:"D65",base:ou,fromBase(e){let[t,r,s]=e,i,n=2e-4;return i=Math.abs(r)<n&&Math.abs(s)<n?NaN:Math.atan2(s,r)*180/Math.PI,[t,Math.sqrt(r**2+s**2),Di(i)]},toBase(e){let[t,r,s]=e,i,n;return isNaN(s)?(i=0,n=0):(i=r*Math.cos(s*Math.PI/180),n=r*Math.sin(s*Math.PI/180)),[t,i,n]},formats:{oklch:{coords:["<percentage> | <number>","<number> | <percentage>[0,1]","<number> | <angle>"]}}});let FA=kr.D65;const Gtt=216/24389,Xv=24389/27,[Yv,Zv]=Tm({space:vr,coords:FA});var OA=new pt({id:"luv",name:"Luv",coords:{l:{refRange:[0,100],name:"Lightness"},u:{refRange:[-215,215]},v:{refRange:[-215,215]}},white:FA,base:vr,fromBase(e){let t=[Xe(e[0]),Xe(e[1]),Xe(e[2])],r=t[1],[s,i]=Tm({space:vr,coords:t});if(!Number.isFinite(s)||!Number.isFinite(i))return[0,0,0];let n=r<=Gtt?Xv*r:116*Math.cbrt(r)-16;return[n,13*n*(s-Yv),13*n*(i-Zv)]},toBase(e){let[t,r,s]=e;if(t===0||fa(t))return[0,0,0];r=Xe(r),s=Xe(s);let i=r/(13*t)+Yv,n=s/(13*t)+Zv,a=t<=8?t/Xv:((t+16)/116)**3;return[a*(9*i/(4*n)),a,a*((12-3*i-20*n)/(4*n))]},formats:{color:{id:"--luv",coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),Ix=new pt({id:"lchuv",name:"LChuv",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,220],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:OA,fromBase(e){let[t,r,s]=e,i,n=.02;return i=Math.abs(r)<n&&Math.abs(s)<n?NaN:Math.atan2(s,r)*180/Math.PI,[t,Math.sqrt(r**2+s**2),Di(i)]},toBase(e){let[t,r,s]=e;return r<0&&(r=0),isNaN(s)&&(s=0),[t,r*Math.cos(s*Math.PI/180),r*Math.sin(s*Math.PI/180)]},formats:{color:{id:"--lchuv",coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}});const Xtt=216/24389,Ytt=24389/27,Jv=ar[0][0],Qv=ar[0][1],og=ar[0][2],Kv=ar[1][0],tM=ar[1][1],lg=ar[1][2],eM=ar[2][0],rM=ar[2][1],ug=ar[2][2];function sl(e,t,r){let s=t/(Math.sin(r)-e*Math.cos(r));return s<0?1/0:s}function Pp(e){let t=(e+16)**3/1560896,r=t>Xtt?t:e/Ytt,s=r*(284517*Jv-94839*og),i=r*(838422*og+769860*Qv+731718*Jv),n=r*(632260*og-126452*Qv),a=r*(284517*Kv-94839*lg),o=r*(838422*lg+769860*tM+731718*Kv),l=r*(632260*lg-126452*tM),h=r*(284517*eM-94839*ug),u=r*(838422*ug+769860*rM+731718*eM),c=r*(632260*ug-126452*rM);return{r0s:s/n,r0i:i*e/n,r1s:s/(n+126452),r1i:(i-769860)*e/(n+126452),g0s:a/l,g0i:o*e/l,g1s:a/(l+126452),g1i:(o-769860)*e/(l+126452),b0s:h/c,b0i:u*e/c,b1s:h/(c+126452),b1i:(u-769860)*e/(c+126452)}}function sM(e,t){let r=t/360*Math.PI*2,s=sl(e.r0s,e.r0i,r),i=sl(e.r1s,e.r1i,r),n=sl(e.g0s,e.g0i,r),a=sl(e.g1s,e.g1i,r),o=sl(e.b0s,e.b0i,r),l=sl(e.b1s,e.b1i,r);return Math.min(s,i,n,a,o,l)}var Ztt=new pt({id:"hsluv",name:"HSLuv",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:Ix,gamutSpace:hu,fromBase(e){let[t,r,s]=[Xe(e[0]),Xe(e[1]),Xe(e[2])],i;if(t>99.9999999)i=0,t=100;else if(t<1e-8)i=0,t=0;else{let n=Pp(t),a=sM(n,s);i=r/a*100}return[s,i,t]},toBase(e){let[t,r,s]=[Xe(e[0]),Xe(e[1]),Xe(e[2])],i;if(s>99.9999999)s=100,i=0;else if(s<1e-8)s=0,i=0;else{let n=Pp(s);i=sM(n,t)/100*r}return[s,i,t]},formats:{color:{id:"--hsluv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});ar[0][0],ar[0][1],ar[0][2],ar[1][0],ar[1][1],ar[1][2],ar[2][0],ar[2][1],ar[2][2];function il(e,t){return Math.abs(t)/Math.sqrt(e**2+1)}function iM(e){let t=il(e.r0s,e.r0i),r=il(e.r1s,e.r1i),s=il(e.g0s,e.g0i),i=il(e.g1s,e.g1i),n=il(e.b0s,e.b0i),a=il(e.b1s,e.b1i);return Math.min(t,r,s,i,n,a)}var Jtt=new pt({id:"hpluv",name:"HPLuv",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:Ix,gamutSpace:"self",fromBase(e){let[t,r,s]=[Xe(e[0]),Xe(e[1]),Xe(e[2])],i;if(t>99.9999999)i=0,t=100;else if(t<1e-8)i=0,t=0;else{let n=Pp(t),a=iM(n);i=r/a*100}return[s,i,t]},toBase(e){let[t,r,s]=[Xe(e[0]),Xe(e[1]),Xe(e[2])],i;if(s>99.9999999)s=100,i=0;else if(s<1e-8)s=0,i=0;else{let n=Pp(s);i=iM(n)/100*r}return[s,i,t]},formats:{color:{id:"--hpluv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const nM=203,aM=2610/2**14,Qtt=2**14/2610,Ktt=2523/2**5,oM=2**5/2523,lM=3424/2**12,uM=2413/2**7,hM=2392/2**7;var tet=new Xr({id:"rec2100pq",cssId:"rec2100-pq",name:"REC.2100-PQ",base:wm,toBase(e){return e.map(function(t){return(Math.max(t**oM-lM,0)/(uM-hM*t**oM))**Qtt*1e4/nM})},fromBase(e){return e.map(function(t){let r=Math.max(t*nM/1e4,0),s=lM+uM*r**aM,i=1+hM*r**aM;return(s/i)**Ktt})}});const cM=.17883277,dM=.28466892,pM=.55991073,hg=3.7743;var eet=new Xr({id:"rec2100hlg",cssId:"rec2100-hlg",name:"REC.2100-HLG",referred:"scene",base:wm,toBase(e){return e.map(function(t){return t<=.5?t**2/3*hg:(Math.exp((t-pM)/cM)+dM)/12*hg})},fromBase(e){return e.map(function(t){return t/=hg,t<=1/12?Math.sqrt(3*t):cM*Math.log(12*t-dM)+pM})}});const kA={};ga.add("chromatic-adaptation-start",e=>{e.options.method&&(e.M=mM(e.W1,e.W2,e.options.method))}),ga.add("chromatic-adaptation-end",e=>{e.M||(e.M=mM(e.W1,e.W2,e.options.method))});function Rd({id:e,toCone_M:t,fromCone_M:r}){kA[e]=arguments[0]}function mM(e,t,r="Bradford"){let s=kA[r],[i,n,a]=ye(s.toCone_M,e),[o,l,h]=ye(s.toCone_M,t),u=[[o/i,0,0],[0,l/n,0],[0,0,h/a]],c=ye(u,s.toCone_M);return ye(s.fromCone_M,c)}Rd({id:"von Kries",toCone_M:[[.40024,.7076,-.08081],[-.2263,1.16532,.0457],[0,0,.91822]],fromCone_M:[[1.8599363874558397,-1.1293816185800916,.21989740959619328],[.3611914362417676,.6388124632850422,-6370596838649899e-21],[0,0,1.0890636230968613]]}),Rd({id:"Bradford",toCone_M:[[.8951,.2664,-.1614],[-.7502,1.7135,.0367],[.0389,-.0685,1.0296]],fromCone_M:[[.9869929054667121,-.14705425642099013,.15996265166373122],[.4323052697233945,.5183602715367774,.049291228212855594],[-.00852866457517732,.04004282165408486,.96848669578755]]}),Rd({id:"CAT02",toCone_M:[[.7328,.4296,-.1624],[-.7036,1.6975,.0061],[.003,.0136,.9834]],fromCone_M:[[1.0961238208355142,-.27886900021828726,.18274517938277307],[.4543690419753592,.4735331543074117,.07209780371722911],[-.009627608738429355,-.00569803121611342,1.0153256399545427]]}),Rd({id:"CAT16",toCone_M:[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],fromCone_M:[[1.862067855087233,-1.0112546305316845,.14918677544445172],[.3875265432361372,.6214474419314753,-.008973985167612521],[-.01584149884933386,-.03412293802851557,1.0499644368778496]]}),Object.assign(kr,{A:[1.0985,1,.35585],C:[.98074,1,1.18232],D55:[.95682,1,.92149],D75:[.94972,1,1.22638],E:[1,1,1],F2:[.99186,1,.67393],F7:[.95041,1,1.08747],F11:[1.00962,1,.6435]}),kr.ACES=[.32168/.33767,1,.34065/.33767];const ret=[[.6624541811085053,.13400420645643313,.1561876870049078],[.27222871678091454,.6740817658111484,.05368951740793705],[-.005574649490394108,.004060733528982826,1.0103391003129971]],set=[[1.6410233796943257,-.32480329418479,-.23642469523761225],[-.6636628587229829,1.6153315916573379,.016756347685530137],[.011721894328375376,-.008284441996237409,.9883948585390215]];var BA=new Xr({id:"acescg",cssId:"--acescg",name:"ACEScg",coords:{r:{range:[0,65504],name:"Red"},g:{range:[0,65504],name:"Green"},b:{range:[0,65504],name:"Blue"}},referred:"scene",white:kr.ACES,toXYZ_M:ret,fromXYZ_M:set});const Id=2**-16,cg=-.35828683,Ld=(Math.log2(65504)+9.72)/17.52;var iet=new Xr({id:"acescc",cssId:"--acescc",name:"ACEScc",coords:{r:{range:[cg,Ld],name:"Red"},g:{range:[cg,Ld],name:"Green"},b:{range:[cg,Ld],name:"Blue"}},referred:"scene",base:BA,toBase(e){let t=-.3013698630136986;return e.map(function(r){return r<=t?(2**(r*17.52-9.72)-Id)*2:r<Ld?2**(r*17.52-9.72):65504})},fromBase(e){return e.map(function(t){return t<=0?(Math.log2(Id)+9.72)/17.52:t<Id?(Math.log2(Id+t*.5)+9.72)/17.52:(Math.log2(t)+9.72)/17.52})}}),fM=Object.freeze({__proto__:null,A98RGB:Dtt,A98RGB_Linear:LA,ACEScc:iet,ACEScg:BA,CAM16_JMh:qK,HCT:Eh,HPLuv:Jtt,HSL:RA,HSLuv:Ztt,HSV:IA,HWB:Ott,ICTCP:ay,JzCzHz:ny,Jzazbz:mA,LCH:zh,LCHuv:Ix,Lab:hs,Lab_D65:uy,Luv:OA,OKLCH:Htt,OKLab:ou,P3:AA,P3_Linear:SA,ProPhoto:qtt,ProPhoto_Linear:PA,REC_2020:NA,REC_2020_Linear:wm,REC_2100_HLG:eet,REC_2100_PQ:tet,XYZ_ABS_D65:Ex,XYZ_D50:zx,XYZ_D65:vr,sRGB:hu,sRGB_Linear:_A}),ss=class Dr{constructor(...t){let r;t.length===1&&(r=zt(t[0]));let s,i,n;r?(s=r.space||r.spaceId,i=r.coords,n=r.alpha):[s,i,n]=t,Object.defineProperty(this,"space",{value:pt.get(s),writable:!1,enumerable:!0,configurable:!0}),this.coords=i?i.slice():[0,0,0],this.alpha=n>1||n===void 0?1:n<0?0:n;for(let a=0;a<this.coords.length;a++)this.coords[a]==="NaN"&&(this.coords[a]=NaN);for(let a in this.space.coords)Object.defineProperty(this,a,{get:()=>this.get(a),set:o=>this.set(a,o)})}get spaceId(){return this.space.id}clone(){return new Dr(this.space,this.coords,this.alpha)}toJSON(){return{spaceId:this.spaceId,coords:this.coords,alpha:this.alpha}}display(...t){let r=ott(this,...t);return r.color=new Dr(r.color),r}static get(t,...r){return t instanceof Dr?t:new Dr(t,...r)}static defineFunction(t,r,s=r){let{instance:i=!0,returns:n}=s,a=function(...o){let l=r(...o);if(n==="color")l=Dr.get(l);else if(n==="function<color>"){let h=l;l=function(...u){let c=h(...u);return Dr.get(c)},Object.assign(l,h)}else n==="array<color>"&&(l=l.map(h=>Dr.get(h)));return l};t in Dr||(Dr[t]=a),i&&(Dr.prototype[t]=function(...o){return a(this,...o)})}static defineFunctions(t){for(let r in t)Dr.defineFunction(r,t[r],t[r])}static extend(t){if(t.register)t.register(Dr);else for(let r in t)Dr.defineFunction(r,t[r])}};ss.defineFunctions({get:us,getAll:mc,set:wn,setAll:Cx,to:ge,equals:ltt,inGamut:Ka,toGamut:ya,distance:pA,toString:dh}),Object.assign(ss,{util:aK,hooks:ga,WHITES:kr,Space:pt,spaces:pt.registry,parse:cA,defaults:ps});for(let e of Object.keys(fM))pt.register(fM[e]);for(let e in pt.registry)hy(e,pt.registry[e]);ga.add("colorspace-init-end",e=>{hy(e.id,e),e.aliases?.forEach(t=>{hy(t,e)})});function hy(e,t){let r=e.replace(/-/g,"_");Object.defineProperty(ss.prototype,r,{get(){let s=this.getAll(e);return typeof Proxy>"u"?s:new Proxy(s,{has:(i,n)=>{try{return pt.resolveCoord([t,n]),!0}catch{}return Reflect.has(i,n)},get:(i,n,a)=>{if(n&&typeof n!="symbol"&&!(n in i)){let{index:o}=pt.resolveCoord([t,n]);if(o>=0)return i[o]}return Reflect.get(i,n,a)},set:(i,n,a,o)=>{if(n&&typeof n!="symbol"&&!(n in i)||n>=0){let{index:l}=pt.resolveCoord([t,n]);if(l>=0)return i[l]=a,this.setAll(e,i),!0}return Reflect.set(i,n,a,o)}})},set(s){this.setAll(e,s)},configurable:!0,enumerable:!0})}ss.extend(uu),ss.extend({deltaE:eh}),Object.assign(ss,{deltaEMethods:uu}),ss.extend(Ltt),ss.extend({contrast:ztt}),ss.extend(Vtt),ss.extend(htt),ss.extend(Ftt),ss.extend(Qd);const{vec2:net,vec4:aet}=_e,Br=e=>{let t=new ss(e);return aet(...t.to("p3-linear").coords,t.alpha).value},gc=e=>{let t=.5,r=.5,s=(i,n=!1)=>{if(typeof i=="number")return i;let a=i.toLowerCase().trim();if(n){if(a==="top")return 0;if(a==="bottom")return 1;if(a==="center")return .5}else{if(a==="left")return 0;if(a==="right")return 1;if(a==="center")return .5}return console.warn(`Invalid position value: ${i}. Defaulting to center.`),.5};if(typeof e=="string"){let i=e.toLowerCase().trim().split(/\s+/);i.includes("left")?t=0:i.includes("right")?t=1:(i.includes("center")||i.length===1&&(i[0]==="top"||i[0]==="bottom"))&&(t=.5),i.includes("top")?r=0:i.includes("bottom")?r=1:(i.includes("center")||i.length===1&&(i[0]==="left"||i[0]==="right"))&&(r=.5),i.length===1&&i[0]==="center"&&(t=.5,r=.5)}else typeof e=="object"&&e?(t=s(e.x,!1),r=s(e.y,!0)):console.warn(`Invalid position value provided: ${e}. Defaulting to center.`);return net(t,1-r).value},oet=e=>{if(typeof e=="number")return(e%360+360)%360;let t=e.toLowerCase().trim();switch(t){case"to right":return 0;case"to bottom":return 90;case"to left":return 180;case"to top":return 270;case"to bottom right":case"to right bottom":return 45;case"to bottom left":case"to left bottom":return 135;case"to top left":case"to left top":return 225;case"to top right":case"to right top":return 315;case"from left":return 0;case"from top":return 90;case"from right":return 180;case"from bottom":return 270;case"from top left":return 45;case"from top right":return 135;case"from bottom right":return 225;case"from bottom left":return 315;default:let r=t.match(/^(-?\d*\.?\d+)(deg|rad|turn)?$/);if(r){let[,s,i="deg"]=r,n=parseFloat(s);switch(i){case"deg":return(n%360+360)%360;case"rad":return(n*180/Math.PI%360+360)%360;case"turn":return(n*360%360+360)%360;default:return(n%360+360)%360}}return console.warn(`Invalid angle value: ${e}. Defaulting to 0 degrees.`),0}},Rl={name:"Checkerboard",props:{colorA:{default:"#cccccc",transform:Br,description:"First color of the checkerboard pattern"},colorB:{default:"#999999",transform:Br,description:"Second color of the checkerboard pattern"},cells:{default:8,description:"Number of cells along the shortest canvas edge (creates square cells)"}},fragmentNode:({uniforms:e})=>{let{vec2:t,mix:r,floor:s,mod:i,screenUV:n,viewportSize:a}=_e,o=a.x.div(a.y),l=t(n.x.mul(o),n.y.oneMinus()),h=e.cells.uniform,u=l.mul(h),c=s(u),d=i(c.x.add(c.y),2);return r(e.colorA.uniform,e.colorB.uniform,d)}};function uet(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const DA={blendMode:"normal"};try{Rl&&Rl.props&&Object.entries(Rl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(DA[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const het=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Rl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>uet(e,DA),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Rl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Rl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Il={name:"Circle",props:{color:{default:"#ffffff",transform:Br,description:"The color of the circle"},radius:{default:1,description:"The radius of the circle. A value of one (1) is sets the circle to fit the canvas."},softness:{default:0,description:"Edge softness. Lower values like zero (0) are sharp, higher values like one (1) are softer."},center:{default:{x:.5,y:.5},transform:gc,description:"The center point of the circle"}},fragmentNode:({uniforms:e})=>{let{vec2:t,vec4:r,length:s,mix:i,smoothstep:n,screenUV:a,viewportSize:o}=_e,l=o.x.div(o.y),h=t(a.x.mul(l),a.y),u=t(e.center.uniform.x.mul(l),e.center.uniform.y.oneMinus()),c=s(h.sub(u)),d=e.softness.uniform,p=e.radius.uniform.mul(.5),m=n(p,p.sub(d),c);return i(r(e.color.uniform.rgb,0),e.color.uniform,m)}};function cet(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const UA={blendMode:"normal"};try{Il&&Il.props&&Object.entries(Il.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(UA[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const det=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Il.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>cet(e,UA),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Il,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Il.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Ll={name:"DotGrid",props:{color:{default:"#ffffff",description:"The color of the dot",transform:Br},density:{default:100,description:"The number of dots on the longest canvas edge"},dotSize:{default:.3,description:"The size of each dot, zero (0) being invisible, one (1) filled the grid with no gaps"},twinkle:{default:0,description:"Intensity of the twinkle effect (0 = off, 1 = full twinkle)"}},fragmentNode:({uniforms:e})=>{let{screenUV:t,vec4:r,vec3:s,vec2:i,smoothstep:n,length:a,floor:o,float:l,viewportSize:h,time:u,sin:c,mix:d}=_e,p=t,m=e.density.uniform,f=e.dotSize.uniform,x=e.color.uniform,b=e.twinkle.uniform,v=h,T=v.x.div(v.y),_=i(p.x.mul(T),p.y.oneMinus()),E=_.mul(m),C=E.sub(o(E)),A=a(C.sub(.5)),I=a(QN(_.mul(m))),Q=l(1).sub(n(f.mul(.5),f.mul(.5).add(I.mul(.5)),A)),ot=o(E),K=ot.x.mul(12.9898).add(ot.y.mul(78.233)).sin().mul(43758.5453).fract(),mt=u.mul(2).add(K.mul(6.28318)),nt=c(mt).mul(.5).add(.5),yt=d(l(1),nt,b),lt=Q.mul(yt),Nt=s(x).mul(lt);return r(Nt,lt)}};function pet(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const $A={blendMode:"normal"};try{Ll&&Ll.props&&Object.entries(Ll.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&($A[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const met=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Ll.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>pet(e,$A),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Ll,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Ll.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Pl={name:"FilmGrain",props:{intensity:{default:.25,description:"Grain intensity (0-1)"},power:{default:.645,description:"Controls blending based on brightness"},speed:{default:.5,description:"Animation speed of grain noise"}},fragmentNode:({uniforms:e,childNode:t})=>{let r=t||oh(0,0,0,0),s=_0(),i=p=>Og(Zn(Pg(p,A0(12.9898,78.233))).mul(43758.5453)),n=p=>Pg(p,oh(.299,.587,.114,0)),a=i(s).add(S0.mul(e.speed.uniform)),o=Og(Zn(a.mul(43758.5453))),l=Nl(Fg(.5),Fg(.75),o).mul(e.intensity.uniform),h=KN(n(r),e.power.uniform),u=r.mul(l),c=JN(h,0,1),d=Nl(u,r,c);return oh(d.x,d.y,d.z,r.w)}};function fet(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const jA={blendMode:"normal"};try{Pl&&Pl.props&&Object.entries(Pl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(jA[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const get=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Pl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>fet(e,jA),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Pl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Pl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Pd=new WeakMap,Fl={name:"glassTiles",props:{intensity:{default:1,description:"The intensity of the glass tiles effect"},tileCount:{default:100,description:"Number of tiles across the shortest dimension"}},fragmentNode:({uniforms:e,childNode:t,onCleanup:r,canvas:s})=>{let{vec2:i,vec4:n,floor:a,mul:o,div:l,sub:h,add:u,convertToTexture:c,screenUV:d,uniform:p}=_e;if(!t)return console.error("You must pass a child component into the Glass Tiles shader."),n(0);let m=c(t),f=p(1),x=()=>{s&&(f.value=s.clientWidth/s.clientHeight)};x();let b=Pd.get(s);b||(b=new ResizeObserver(lt=>{let Nt=lt[0];if(!Nt)return;let{width:ht,height:Mt}=Nt.contentRect,ut=window.devicePixelRatio||1;m.setSize(ht*ut,Mt*ut),x()}),b.observe(s),Pd.set(s,b)),r(()=>{let lt=Pd.get(s);lt&&(lt.disconnect(),Pd.delete(s))});let v=d,T=e.intensity.uniform,_=e.tileCount.uniform,E=i(f.greaterThanEqual(1).select(o(_,f),_),f.lessThan(1).select(l(_,f),_)),C=l(a(o(v,E)),E),A=h(v,C),I=i(.5,.5),Q=o(T,.025),ot=l(A,l(i(1),E)),K=h(ot,I),mt=o(K,Q),nt=u(A,mt),yt=u(nt,C);return n(m.sample(yt))}};function yet(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const WA={blendMode:"normal"};try{Fl&&Fl.props&&Object.entries(Fl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(WA[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const xet=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Fl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>yet(e,WA),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Fl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Fl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Fd={VERTEX:"vertex"},Hn={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},yc=["x","y","z","w"],Cr="00.01.02.03.04.05.06.07.08.09.0a.0b.0c.0d.0e.0f.10.11.12.13.14.15.16.17.18.19.1a.1b.1c.1d.1e.1f.20.21.22.23.24.25.26.27.28.29.2a.2b.2c.2d.2e.2f.30.31.32.33.34.35.36.37.38.39.3a.3b.3c.3d.3e.3f.40.41.42.43.44.45.46.47.48.49.4a.4b.4c.4d.4e.4f.50.51.52.53.54.55.56.57.58.59.5a.5b.5c.5d.5e.5f.60.61.62.63.64.65.66.67.68.69.6a.6b.6c.6d.6e.6f.70.71.72.73.74.75.76.77.78.79.7a.7b.7c.7d.7e.7f.80.81.82.83.84.85.86.87.88.89.8a.8b.8c.8d.8e.8f.90.91.92.93.94.95.96.97.98.99.9a.9b.9c.9d.9e.9f.a0.a1.a2.a3.a4.a5.a6.a7.a8.a9.aa.ab.ac.ad.ae.af.b0.b1.b2.b3.b4.b5.b6.b7.b8.b9.ba.bb.bc.bd.be.bf.c0.c1.c2.c3.c4.c5.c6.c7.c8.c9.ca.cb.cc.cd.ce.cf.d0.d1.d2.d3.d4.d5.d6.d7.d8.d9.da.db.dc.dd.de.df.e0.e1.e2.e3.e4.e5.e6.e7.e8.e9.ea.eb.ec.ed.ee.ef.f0.f1.f2.f3.f4.f5.f6.f7.f8.f9.fa.fb.fc.fd.fe.ff".split(".");let gM=1234567;const qA=Math.PI/180,HA=180/Math.PI;function Kd(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(Cr[e&255]+Cr[e>>8&255]+Cr[e>>16&255]+Cr[e>>24&255]+"-"+Cr[t&255]+Cr[t>>8&255]+"-"+Cr[t>>16&15|64]+Cr[t>>24&255]+"-"+Cr[r&63|128]+Cr[r>>8&255]+"-"+Cr[r>>16&255]+Cr[r>>24&255]+Cr[s&255]+Cr[s>>8&255]+Cr[s>>16&255]+Cr[s>>24&255]).toLowerCase()}function qt(e,t,r){return Math.max(t,Math.min(r,e))}function Lx(e,t){return(e%t+t)%t}function bet(e,t,r,s,i){return s+(e-t)*(i-s)/(r-t)}function vet(e,t,r){return e===t?0:(r-e)/(t-e)}function ph(e,t,r){return(1-r)*e+r*t}function Met(e,t,r,s){return ph(e,t,1-Math.exp(-r*s))}function wet(e,t=1){return t-Math.abs(Lx(e,t*2)-t)}function Tet(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t),e*e*(3-2*e))}function Net(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t),e*e*e*(e*(e*6-15)+10))}function _et(e,t){return e+Math.floor(Math.random()*(t-e+1))}function Aet(e,t){return e+Math.random()*(t-e)}function Cet(e){return e*(.5-Math.random())}function zet(e){e!==void 0&&(gM=e);let t=gM+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Eet(e){return e*qA}function Vet(e){return e*HA}function Ret(e){return(e&e-1)==0&&e!==0}function Iet(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function Let(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function Pet(e,t,r,s,i){let n=Math.cos,a=Math.sin,o=n(r/2),l=a(r/2),h=n((t+s)/2),u=a((t+s)/2),c=n((t-s)/2),d=a((t-s)/2),p=n((s-t)/2),m=a((s-t)/2);switch(i){case"XYX":e.set(o*u,l*c,l*d,o*h);break;case"YZY":e.set(l*d,o*u,l*c,o*h);break;case"ZXZ":e.set(l*c,l*d,o*u,o*h);break;case"XZX":e.set(o*u,l*m,l*p,o*h);break;case"YXY":e.set(l*p,o*u,l*m,o*h);break;case"ZYZ":e.set(l*m,l*p,o*u,o*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ii(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function Kt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error("Invalid component type.")}}const Fet={DEG2RAD:qA,RAD2DEG:HA,generateUUID:Kd,clamp:qt,euclideanModulo:Lx,mapLinear:bet,inverseLerp:vet,lerp:ph,damp:Met,pingpong:wet,smoothstep:Tet,smootherstep:Net,randInt:_et,randFloat:Aet,randFloatSpread:Cet,seededRandom:zet,degToRad:Eet,radToDeg:Vet,isPowerOfTwo:Ret,ceilPowerOfTwo:Iet,floorPowerOfTwo:Let,setQuaternionFromProperEuler:Pet,normalize:Kt,denormalize:ii},cy=0,Oet=1015,dy="",Qs="srgb",yM="srgb-linear",xM="linear",mh="srgb",Fp=35044,Wa=2e3,py=2001;var xc=class GA{constructor(t,r,s,i,n,a,o,l,h){GA.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,r,s,i,n,a,o,l,h)}set(t,r,s,i,n,a,o,l,h){let u=this.elements;return u[0]=t,u[1]=i,u[2]=o,u[3]=r,u[4]=n,u[5]=l,u[6]=s,u[7]=a,u[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let r=this.elements,s=t.elements;return r[0]=s[0],r[1]=s[1],r[2]=s[2],r[3]=s[3],r[4]=s[4],r[5]=s[5],r[6]=s[6],r[7]=s[7],r[8]=s[8],this}extractBasis(t,r,s){return t.setFromMatrix3Column(this,0),r.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let r=t.elements;return this.set(r[0],r[4],r[8],r[1],r[5],r[9],r[2],r[6],r[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,r){let s=t.elements,i=r.elements,n=this.elements,a=s[0],o=s[3],l=s[6],h=s[1],u=s[4],c=s[7],d=s[2],p=s[5],m=s[8],f=i[0],x=i[3],b=i[6],v=i[1],T=i[4],_=i[7],E=i[2],C=i[5],A=i[8];return n[0]=a*f+o*v+l*E,n[3]=a*x+o*T+l*C,n[6]=a*b+o*_+l*A,n[1]=h*f+u*v+c*E,n[4]=h*x+u*T+c*C,n[7]=h*b+u*_+c*A,n[2]=d*f+p*v+m*E,n[5]=d*x+p*T+m*C,n[8]=d*b+p*_+m*A,this}multiplyScalar(t){let r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=t,r[4]*=t,r[7]*=t,r[2]*=t,r[5]*=t,r[8]*=t,this}determinant(){let t=this.elements,r=t[0],s=t[1],i=t[2],n=t[3],a=t[4],o=t[5],l=t[6],h=t[7],u=t[8];return r*a*u-r*o*h-s*n*u+s*o*l+i*n*h-i*a*l}invert(){let t=this.elements,r=t[0],s=t[1],i=t[2],n=t[3],a=t[4],o=t[5],l=t[6],h=t[7],u=t[8],c=u*a-o*h,d=o*l-u*n,p=h*n-a*l,m=r*c+s*d+i*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);let f=1/m;return t[0]=c*f,t[1]=(i*h-u*s)*f,t[2]=(o*s-i*a)*f,t[3]=d*f,t[4]=(u*r-i*l)*f,t[5]=(i*n-o*r)*f,t[6]=p*f,t[7]=(s*l-h*r)*f,t[8]=(a*r-s*n)*f,this}transpose(){let t,r=this.elements;return t=r[1],r[1]=r[3],r[3]=t,t=r[2],r[2]=r[6],r[6]=t,t=r[5],r[5]=r[7],r[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let r=this.elements;return t[0]=r[0],t[1]=r[3],t[2]=r[6],t[3]=r[1],t[4]=r[4],t[5]=r[7],t[6]=r[2],t[7]=r[5],t[8]=r[8],this}setUvTransform(t,r,s,i,n,a,o){let l=Math.cos(n),h=Math.sin(n);return this.set(s*l,s*h,-s*(l*a+h*o)+a+t,-i*h,i*l,-i*(-h*a+l*o)+o+r,0,0,1),this}scale(t,r){return this.premultiply(dg.makeScale(t,r)),this}rotate(t){return this.premultiply(dg.makeRotation(-t)),this}translate(t,r){return this.premultiply(dg.makeTranslation(t,r)),this}makeTranslation(t,r){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,r,0,0,1),this}makeRotation(t){let r=Math.cos(t),s=Math.sin(t);return this.set(r,-s,0,s,r,0,0,0,1),this}makeScale(t,r){return this.set(t,0,0,0,r,0,0,0,1),this}equals(t){let r=this.elements,s=t.elements;for(let i=0;i<9;i++)if(r[i]!==s[i])return!1;return!0}fromArray(t,r=0){for(let s=0;s<9;s++)this.elements[s]=t[s+r];return this}toArray(t=[],r=0){let s=this.elements;return t[r]=s[0],t[r+1]=s[1],t[r+2]=s[2],t[r+3]=s[3],t[r+4]=s[4],t[r+5]=s[5],t[r+6]=s[6],t[r+7]=s[7],t[r+8]=s[8],t}clone(){return new this.constructor().fromArray(this.elements)}};const dg=new xc,bM={};function vM(e){e in bM||(bM[e]=!0,console.warn(e))}const MM=new xc().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),wM=new xc().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function ket(){let e={enabled:!0,workingColorSpace:yM,spaces:{},convert:function(i,n,a){return this.enabled===!1||n===a||!n||!a||(this.spaces[n].transfer===mh&&(i.r=Ol(i.r),i.g=Ol(i.g),i.b=Ol(i.b)),this.spaces[n].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[n].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===mh&&(i.r=kl(i.r),i.g=kl(i.g),i.b=kl(i.b))),i},workingToColorSpace:function(i,n){return this.convert(i,this.workingColorSpace,n)},colorSpaceToWorking:function(i,n){return this.convert(i,n,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===dy?xM:this.spaces[i].transfer},getLuminanceCoefficients:function(i,n=this.workingColorSpace){return i.fromArray(this.spaces[n].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,n,a){return i.copy(this.spaces[n].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,n){return vM("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),e.workingToColorSpace(i,n)},toWorkingColorSpace:function(i,n){return vM("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),e.colorSpaceToWorking(i,n)}},t=[.64,.33,.3,.6,.15,.06],r=[.2126,.7152,.0722],s=[.3127,.329];return e.define({[yM]:{primaries:t,whitePoint:s,transfer:xM,toXYZ:MM,fromXYZ:wM,luminanceCoefficients:r,workingColorSpaceConfig:{unpackColorSpace:Qs},outputColorSpaceConfig:{drawingBufferColorSpace:Qs}},[Qs]:{primaries:t,whitePoint:s,transfer:mh,toXYZ:MM,fromXYZ:wM,luminanceCoefficients:r,outputColorSpaceConfig:{drawingBufferColorSpace:Qs}}}),e}const He=ket();function Ol(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function kl(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}const XA={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},$n={h:0,s:0,l:0},Od={h:0,s:0,l:0};function pg(e,t,r){return r<0&&(r+=1),r>1&&--r,r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*6*(2/3-r):e}var Px=class{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(t===void 0&&r===void 0){let s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Qs){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,He.colorSpaceToWorking(this,t),this}setRGB(e,t,r,s=He.workingColorSpace){return this.r=e,this.g=t,this.b=r,He.colorSpaceToWorking(this,s),this}setHSL(e,t,r,s=He.workingColorSpace){if(e=Lx(e,1),t=qt(t,0,1),r=qt(r,0,1),t===0)this.r=this.g=this.b=r;else{let i=r<=.5?r*(1+t):r+t-r*t,n=2*r-i;this.r=pg(n,i,e+1/3),this.g=pg(n,i,e),this.b=pg(n,i,e-1/3)}return He.colorSpaceToWorking(this,s),this}setStyle(e,t=Qs){function r(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,n=s[1],a=s[2];switch(n){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){let i=s[1],n=i.length;if(n===3)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,t);if(n===6)return this.setHex(parseInt(i,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Qs){let r=XA[e.toLowerCase()];return r===void 0?console.warn("THREE.Color: Unknown color "+e):this.setHex(r,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Ol(e.r),this.g=Ol(e.g),this.b=Ol(e.b),this}copyLinearToSRGB(e){return this.r=kl(e.r),this.g=kl(e.g),this.b=kl(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Qs){return He.workingToColorSpace(zr.copy(this),e),Math.round(qt(zr.r*255,0,255))*65536+Math.round(qt(zr.g*255,0,255))*256+Math.round(qt(zr.b*255,0,255))}getHexString(e=Qs){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=He.workingColorSpace){He.workingToColorSpace(zr.copy(this),t);let r=zr.r,s=zr.g,i=zr.b,n=Math.max(r,s,i),a=Math.min(r,s,i),o,l,h=(a+n)/2;if(a===n)o=0,l=0;else{let u=n-a;switch(l=h<=.5?u/(n+a):u/(2-n-a),n){case r:o=(s-i)/u+(s<i?6:0);break;case s:o=(i-r)/u+2;break;case i:o=(r-s)/u+4;break}o/=6}return e.h=o,e.s=l,e.l=h,e}getRGB(e,t=He.workingColorSpace){return He.workingToColorSpace(zr.copy(this),t),e.r=zr.r,e.g=zr.g,e.b=zr.b,e}getStyle(e=Qs){He.workingToColorSpace(zr.copy(this),e);let t=zr.r,r=zr.g,s=zr.b;return e===Qs?`rgb(${Math.round(t*255)},${Math.round(r*255)},${Math.round(s*255)})`:`color(${e} ${t.toFixed(3)} ${r.toFixed(3)} ${s.toFixed(3)})`}offsetHSL(e,t,r){return this.getHSL($n),this.setHSL($n.h+e,$n.s+t,$n.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL($n),e.getHSL(Od);let r=ph($n.h,Od.h,t),s=ph($n.s,Od.s,t),i=ph($n.l,Od.l,t);return this.setHSL(r,s,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,r=this.g,s=this.b,i=e.elements;return this.r=i[0]*t+i[3]*r+i[6]*s,this.g=i[1]*t+i[4]*r+i[7]*s,this.b=i[2]*t+i[5]*r+i[8]*s,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const zr=new Px;Px.NAMES=XA;var Bet=class YA{constructor(t,r,s,i){YA.prototype.isMatrix2=!0,this.elements=[1,0,0,1],t!==void 0&&this.set(t,r,s,i)}identity(){return this.set(1,0,0,1),this}fromArray(t,r=0){for(let s=0;s<4;s++)this.elements[s]=t[s+r];return this}set(t,r,s,i){let n=this.elements;return n[0]=t,n[2]=r,n[1]=s,n[3]=i,this}},Det=class{constructor(e=0,t=0,r=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=s}static slerpFlat(e,t,r,s,i,n,a){let o=r[s+0],l=r[s+1],h=r[s+2],u=r[s+3],c=i[n+0],d=i[n+1],p=i[n+2],m=i[n+3];if(a===0){e[t+0]=o,e[t+1]=l,e[t+2]=h,e[t+3]=u;return}if(a===1){e[t+0]=c,e[t+1]=d,e[t+2]=p,e[t+3]=m;return}if(u!==m||o!==c||l!==d||h!==p){let f=1-a,x=o*c+l*d+h*p+u*m,b=x>=0?1:-1,v=1-x*x;if(v>2**-52){let _=Math.sqrt(v),E=Math.atan2(_,x*b);f=Math.sin(f*E)/_,a=Math.sin(a*E)/_}let T=a*b;if(o=o*f+c*T,l=l*f+d*T,h=h*f+p*T,u=u*f+m*T,f===1-a){let _=1/Math.sqrt(o*o+l*l+h*h+u*u);o*=_,l*=_,h*=_,u*=_}}e[t]=o,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,r,s,i,n){let a=r[s],o=r[s+1],l=r[s+2],h=r[s+3],u=i[n],c=i[n+1],d=i[n+2],p=i[n+3];return e[t]=a*p+h*u+o*d-l*c,e[t+1]=o*p+h*c+l*u-a*d,e[t+2]=l*p+h*d+a*c-o*u,e[t+3]=h*p-a*u-o*c-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,s){return this._x=e,this._y=t,this._z=r,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let r=e._x,s=e._y,i=e._z,n=e._order,a=Math.cos,o=Math.sin,l=a(r/2),h=a(s/2),u=a(i/2),c=o(r/2),d=o(s/2),p=o(i/2);switch(n){case"XYZ":this._x=c*h*u+l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u-c*d*p;break;case"YXZ":this._x=c*h*u+l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u+c*d*p;break;case"ZXY":this._x=c*h*u-l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u-c*d*p;break;case"ZYX":this._x=c*h*u-l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u+c*d*p;break;case"YZX":this._x=c*h*u+l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u-c*d*p;break;case"XZY":this._x=c*h*u-l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u+c*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+n)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let r=t/2,s=Math.sin(r);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,r=t[0],s=t[4],i=t[8],n=t[1],a=t[5],o=t[9],l=t[2],h=t[6],u=t[10],c=r+a+u;if(c>0){let d=.5/Math.sqrt(c+1);this._w=.25/d,this._x=(h-o)*d,this._y=(i-l)*d,this._z=(n-s)*d}else if(r>a&&r>u){let d=2*Math.sqrt(1+r-a-u);this._w=(h-o)/d,this._x=.25*d,this._y=(s+n)/d,this._z=(i+l)/d}else if(a>u){let d=2*Math.sqrt(1+a-r-u);this._w=(i-l)/d,this._x=(s+n)/d,this._y=.25*d,this._z=(o+h)/d}else{let d=2*Math.sqrt(1+u-r-a);this._w=(n-s)/d,this._x=(i+l)/d,this._y=(o+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r<2**-52?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(qt(this.dot(e),-1,1)))}rotateTowards(e,t){let r=this.angleTo(e);if(r===0)return this;let s=Math.min(1,t/r);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let r=e._x,s=e._y,i=e._z,n=e._w,a=t._x,o=t._y,l=t._z,h=t._w;return this._x=r*h+n*a+s*l-i*o,this._y=s*h+n*o+i*a-r*l,this._z=i*h+n*l+r*o-s*a,this._w=n*h-r*a-s*o-i*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let r=this._x,s=this._y,i=this._z,n=this._w,a=n*e._w+r*e._x+s*e._y+i*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=n,this._x=r,this._y=s,this._z=i,this;let o=1-a*a;if(o<=2**-52){let d=1-t;return this._w=d*n+t*this._w,this._x=d*r+t*this._x,this._y=d*s+t*this._y,this._z=d*i+t*this._z,this.normalize(),this}let l=Math.sqrt(o),h=Math.atan2(l,a),u=Math.sin((1-t)*h)/l,c=Math.sin(t*h)/l;return this._w=n*u+this._w*c,this._x=r*u+this._x*c,this._y=s*u+this._y*c,this._z=i*u+this._z*c,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),s=Math.sqrt(1-r),i=Math.sqrt(r);return this.set(s*Math.sin(e),s*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},ci=class ZA{constructor(t=0,r=0,s=0){ZA.prototype.isVector3=!0,this.x=t,this.y=r,this.z=s}set(t,r,s){return s===void 0&&(s=this.z),this.x=t,this.y=r,this.z=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;case 2:this.z=r;break;default:throw Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,r){return this.x=t.x+r.x,this.y=t.y+r.y,this.z=t.z+r.z,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this.z+=t.z*r,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,r){return this.x=t.x-r.x,this.y=t.y-r.y,this.z=t.z-r.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,r){return this.x=t.x*r.x,this.y=t.y*r.y,this.z=t.z*r.z,this}applyEuler(t){return this.applyQuaternion(TM.setFromEuler(t))}applyAxisAngle(t,r){return this.applyQuaternion(TM.setFromAxisAngle(t,r))}applyMatrix3(t){let r=this.x,s=this.y,i=this.z,n=t.elements;return this.x=n[0]*r+n[3]*s+n[6]*i,this.y=n[1]*r+n[4]*s+n[7]*i,this.z=n[2]*r+n[5]*s+n[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let r=this.x,s=this.y,i=this.z,n=t.elements,a=1/(n[3]*r+n[7]*s+n[11]*i+n[15]);return this.x=(n[0]*r+n[4]*s+n[8]*i+n[12])*a,this.y=(n[1]*r+n[5]*s+n[9]*i+n[13])*a,this.z=(n[2]*r+n[6]*s+n[10]*i+n[14])*a,this}applyQuaternion(t){let r=this.x,s=this.y,i=this.z,n=t.x,a=t.y,o=t.z,l=t.w,h=2*(a*i-o*s),u=2*(o*r-n*i),c=2*(n*s-a*r);return this.x=r+l*h+a*c-o*u,this.y=s+l*u+o*h-n*c,this.z=i+l*c+n*u-a*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let r=this.x,s=this.y,i=this.z,n=t.elements;return this.x=n[0]*r+n[4]*s+n[8]*i,this.y=n[1]*r+n[5]*s+n[9]*i,this.z=n[2]*r+n[6]*s+n[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,r){return this.x=qt(this.x,t.x,r.x),this.y=qt(this.y,t.y,r.y),this.z=qt(this.z,t.z,r.z),this}clampScalar(t,r){return this.x=qt(this.x,t,r),this.y=qt(this.y,t,r),this.z=qt(this.z,t,r),this}clampLength(t,r){let s=this.length();return this.divideScalar(s||1).multiplyScalar(qt(s,t,r))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this.z+=(t.z-this.z)*r,this}lerpVectors(t,r,s){return this.x=t.x+(r.x-t.x)*s,this.y=t.y+(r.y-t.y)*s,this.z=t.z+(r.z-t.z)*s,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,r){let s=t.x,i=t.y,n=t.z,a=r.x,o=r.y,l=r.z;return this.x=i*l-n*o,this.y=n*a-s*l,this.z=s*o-i*a,this}projectOnVector(t){let r=t.lengthSq();if(r===0)return this.set(0,0,0);let s=t.dot(this)/r;return this.copy(t).multiplyScalar(s)}projectOnPlane(t){return mg.copy(this).projectOnVector(t),this.sub(mg)}reflect(t){return this.sub(mg.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let r=Math.sqrt(this.lengthSq()*t.lengthSq());if(r===0)return Math.PI/2;let s=this.dot(t)/r;return Math.acos(qt(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let r=this.x-t.x,s=this.y-t.y,i=this.z-t.z;return r*r+s*s+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,r,s){let i=Math.sin(r)*t;return this.x=i*Math.sin(s),this.y=Math.cos(r)*t,this.z=i*Math.cos(s),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,r,s){return this.x=t*Math.sin(r),this.y=s,this.z=t*Math.cos(r),this}setFromMatrixPosition(t){let r=t.elements;return this.x=r[12],this.y=r[13],this.z=r[14],this}setFromMatrixScale(t){let r=this.setFromMatrixColumn(t,0).length(),s=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=r,this.y=s,this.z=i,this}setFromMatrixColumn(t,r){return this.fromArray(t.elements,r*4)}setFromMatrix3Column(t,r){return this.fromArray(t.elements,r*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this.z=t[r+2],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t[r+2]=this.z,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this.z=t.getZ(r),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,r=Math.random()*2-1,s=Math.sqrt(1-r*r);return this.x=s*Math.cos(t),this.y=r,this.z=s*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};const mg=new ci,TM=new Det;var JA=class my{constructor(t,r,s,i,n,a,o,l,h,u,c,d,p,m,f,x){my.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,r,s,i,n,a,o,l,h,u,c,d,p,m,f,x)}set(t,r,s,i,n,a,o,l,h,u,c,d,p,m,f,x){let b=this.elements;return b[0]=t,b[4]=r,b[8]=s,b[12]=i,b[1]=n,b[5]=a,b[9]=o,b[13]=l,b[2]=h,b[6]=u,b[10]=c,b[14]=d,b[3]=p,b[7]=m,b[11]=f,b[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new my().fromArray(this.elements)}copy(t){let r=this.elements,s=t.elements;return r[0]=s[0],r[1]=s[1],r[2]=s[2],r[3]=s[3],r[4]=s[4],r[5]=s[5],r[6]=s[6],r[7]=s[7],r[8]=s[8],r[9]=s[9],r[10]=s[10],r[11]=s[11],r[12]=s[12],r[13]=s[13],r[14]=s[14],r[15]=s[15],this}copyPosition(t){let r=this.elements,s=t.elements;return r[12]=s[12],r[13]=s[13],r[14]=s[14],this}setFromMatrix3(t){let r=t.elements;return this.set(r[0],r[3],r[6],0,r[1],r[4],r[7],0,r[2],r[5],r[8],0,0,0,0,1),this}extractBasis(t,r,s){return t.setFromMatrixColumn(this,0),r.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this}makeBasis(t,r,s){return this.set(t.x,r.x,s.x,0,t.y,r.y,s.y,0,t.z,r.z,s.z,0,0,0,0,1),this}extractRotation(t){let r=this.elements,s=t.elements,i=1/nl.setFromMatrixColumn(t,0).length(),n=1/nl.setFromMatrixColumn(t,1).length(),a=1/nl.setFromMatrixColumn(t,2).length();return r[0]=s[0]*i,r[1]=s[1]*i,r[2]=s[2]*i,r[3]=0,r[4]=s[4]*n,r[5]=s[5]*n,r[6]=s[6]*n,r[7]=0,r[8]=s[8]*a,r[9]=s[9]*a,r[10]=s[10]*a,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromEuler(t){let r=this.elements,s=t.x,i=t.y,n=t.z,a=Math.cos(s),o=Math.sin(s),l=Math.cos(i),h=Math.sin(i),u=Math.cos(n),c=Math.sin(n);if(t.order==="XYZ"){let d=a*u,p=a*c,m=o*u,f=o*c;r[0]=l*u,r[4]=-l*c,r[8]=h,r[1]=p+m*h,r[5]=d-f*h,r[9]=-o*l,r[2]=f-d*h,r[6]=m+p*h,r[10]=a*l}else if(t.order==="YXZ"){let d=l*u,p=l*c,m=h*u,f=h*c;r[0]=d+f*o,r[4]=m*o-p,r[8]=a*h,r[1]=a*c,r[5]=a*u,r[9]=-o,r[2]=p*o-m,r[6]=f+d*o,r[10]=a*l}else if(t.order==="ZXY"){let d=l*u,p=l*c,m=h*u,f=h*c;r[0]=d-f*o,r[4]=-a*c,r[8]=m+p*o,r[1]=p+m*o,r[5]=a*u,r[9]=f-d*o,r[2]=-a*h,r[6]=o,r[10]=a*l}else if(t.order==="ZYX"){let d=a*u,p=a*c,m=o*u,f=o*c;r[0]=l*u,r[4]=m*h-p,r[8]=d*h+f,r[1]=l*c,r[5]=f*h+d,r[9]=p*h-m,r[2]=-h,r[6]=o*l,r[10]=a*l}else if(t.order==="YZX"){let d=a*l,p=a*h,m=o*l,f=o*h;r[0]=l*u,r[4]=f-d*c,r[8]=m*c+p,r[1]=c,r[5]=a*u,r[9]=-o*u,r[2]=-h*u,r[6]=p*c+m,r[10]=d-f*c}else if(t.order==="XZY"){let d=a*l,p=a*h,m=o*l,f=o*h;r[0]=l*u,r[4]=-c,r[8]=h*u,r[1]=d*c+f,r[5]=a*u,r[9]=p*c-m,r[2]=m*c-p,r[6]=o*u,r[10]=f*c+d}return r[3]=0,r[7]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Uet,t,$et)}lookAt(t,r,s){let i=this.elements;return rs.subVectors(t,r),rs.lengthSq()===0&&(rs.z=1),rs.normalize(),jn.crossVectors(s,rs),jn.lengthSq()===0&&(Math.abs(s.z)===1?rs.x+=1e-4:rs.z+=1e-4,rs.normalize(),jn.crossVectors(s,rs)),jn.normalize(),kd.crossVectors(rs,jn),i[0]=jn.x,i[4]=kd.x,i[8]=rs.x,i[1]=jn.y,i[5]=kd.y,i[9]=rs.y,i[2]=jn.z,i[6]=kd.z,i[10]=rs.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,r){let s=t.elements,i=r.elements,n=this.elements,a=s[0],o=s[4],l=s[8],h=s[12],u=s[1],c=s[5],d=s[9],p=s[13],m=s[2],f=s[6],x=s[10],b=s[14],v=s[3],T=s[7],_=s[11],E=s[15],C=i[0],A=i[4],I=i[8],Q=i[12],ot=i[1],K=i[5],mt=i[9],nt=i[13],yt=i[2],lt=i[6],Nt=i[10],ht=i[14],Mt=i[3],ut=i[7],at=i[11],gt=i[15];return n[0]=a*C+o*ot+l*yt+h*Mt,n[4]=a*A+o*K+l*lt+h*ut,n[8]=a*I+o*mt+l*Nt+h*at,n[12]=a*Q+o*nt+l*ht+h*gt,n[1]=u*C+c*ot+d*yt+p*Mt,n[5]=u*A+c*K+d*lt+p*ut,n[9]=u*I+c*mt+d*Nt+p*at,n[13]=u*Q+c*nt+d*ht+p*gt,n[2]=m*C+f*ot+x*yt+b*Mt,n[6]=m*A+f*K+x*lt+b*ut,n[10]=m*I+f*mt+x*Nt+b*at,n[14]=m*Q+f*nt+x*ht+b*gt,n[3]=v*C+T*ot+_*yt+E*Mt,n[7]=v*A+T*K+_*lt+E*ut,n[11]=v*I+T*mt+_*Nt+E*at,n[15]=v*Q+T*nt+_*ht+E*gt,this}multiplyScalar(t){let r=this.elements;return r[0]*=t,r[4]*=t,r[8]*=t,r[12]*=t,r[1]*=t,r[5]*=t,r[9]*=t,r[13]*=t,r[2]*=t,r[6]*=t,r[10]*=t,r[14]*=t,r[3]*=t,r[7]*=t,r[11]*=t,r[15]*=t,this}determinant(){let t=this.elements,r=t[0],s=t[4],i=t[8],n=t[12],a=t[1],o=t[5],l=t[9],h=t[13],u=t[2],c=t[6],d=t[10],p=t[14],m=t[3],f=t[7],x=t[11],b=t[15];return m*(+n*l*c-i*h*c-n*o*d+s*h*d+i*o*p-s*l*p)+f*(+r*l*p-r*h*d+n*a*d-i*a*p+i*h*u-n*l*u)+x*(+r*h*c-r*o*p-n*a*c+s*a*p+n*o*u-s*h*u)+b*(-i*o*u-r*l*c+r*o*d+i*a*c-s*a*d+s*l*u)}transpose(){let t=this.elements,r;return r=t[1],t[1]=t[4],t[4]=r,r=t[2],t[2]=t[8],t[8]=r,r=t[6],t[6]=t[9],t[9]=r,r=t[3],t[3]=t[12],t[12]=r,r=t[7],t[7]=t[13],t[13]=r,r=t[11],t[11]=t[14],t[14]=r,this}setPosition(t,r,s){let i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=r,i[14]=s),this}invert(){let t=this.elements,r=t[0],s=t[1],i=t[2],n=t[3],a=t[4],o=t[5],l=t[6],h=t[7],u=t[8],c=t[9],d=t[10],p=t[11],m=t[12],f=t[13],x=t[14],b=t[15],v=c*x*h-f*d*h+f*l*p-o*x*p-c*l*b+o*d*b,T=m*d*h-u*x*h-m*l*p+a*x*p+u*l*b-a*d*b,_=u*f*h-m*c*h+m*o*p-a*f*p-u*o*b+a*c*b,E=m*c*l-u*f*l-m*o*d+a*f*d+u*o*x-a*c*x,C=r*v+s*T+i*_+n*E;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let A=1/C;return t[0]=v*A,t[1]=(f*d*n-c*x*n-f*i*p+s*x*p+c*i*b-s*d*b)*A,t[2]=(o*x*n-f*l*n+f*i*h-s*x*h-o*i*b+s*l*b)*A,t[3]=(c*l*n-o*d*n-c*i*h+s*d*h+o*i*p-s*l*p)*A,t[4]=T*A,t[5]=(u*x*n-m*d*n+m*i*p-r*x*p-u*i*b+r*d*b)*A,t[6]=(m*l*n-a*x*n-m*i*h+r*x*h+a*i*b-r*l*b)*A,t[7]=(a*d*n-u*l*n+u*i*h-r*d*h-a*i*p+r*l*p)*A,t[8]=_*A,t[9]=(m*c*n-u*f*n-m*s*p+r*f*p+u*s*b-r*c*b)*A,t[10]=(a*f*n-m*o*n+m*s*h-r*f*h-a*s*b+r*o*b)*A,t[11]=(u*o*n-a*c*n-u*s*h+r*c*h+a*s*p-r*o*p)*A,t[12]=E*A,t[13]=(u*f*i-m*c*i+m*s*d-r*f*d-u*s*x+r*c*x)*A,t[14]=(m*o*i-a*f*i-m*s*l+r*f*l+a*s*x-r*o*x)*A,t[15]=(a*c*i-u*o*i+u*s*l-r*c*l-a*s*d+r*o*d)*A,this}scale(t){let r=this.elements,s=t.x,i=t.y,n=t.z;return r[0]*=s,r[4]*=i,r[8]*=n,r[1]*=s,r[5]*=i,r[9]*=n,r[2]*=s,r[6]*=i,r[10]*=n,r[3]*=s,r[7]*=i,r[11]*=n,this}getMaxScaleOnAxis(){let t=this.elements,r=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],s=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(r,s,i))}makeTranslation(t,r,s){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,r,0,0,1,s,0,0,0,1),this}makeRotationX(t){let r=Math.cos(t),s=Math.sin(t);return this.set(1,0,0,0,0,r,-s,0,0,s,r,0,0,0,0,1),this}makeRotationY(t){let r=Math.cos(t),s=Math.sin(t);return this.set(r,0,s,0,0,1,0,0,-s,0,r,0,0,0,0,1),this}makeRotationZ(t){let r=Math.cos(t),s=Math.sin(t);return this.set(r,-s,0,0,s,r,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,r){let s=Math.cos(r),i=Math.sin(r),n=1-s,a=t.x,o=t.y,l=t.z,h=n*a,u=n*o;return this.set(h*a+s,h*o-i*l,h*l+i*o,0,h*o+i*l,u*o+s,u*l-i*a,0,h*l-i*o,u*l+i*a,n*l*l+s,0,0,0,0,1),this}makeScale(t,r,s){return this.set(t,0,0,0,0,r,0,0,0,0,s,0,0,0,0,1),this}makeShear(t,r,s,i,n,a){return this.set(1,s,n,0,t,1,a,0,r,i,1,0,0,0,0,1),this}compose(t,r,s){let i=this.elements,n=r._x,a=r._y,o=r._z,l=r._w,h=n+n,u=a+a,c=o+o,d=n*h,p=n*u,m=n*c,f=a*u,x=a*c,b=o*c,v=l*h,T=l*u,_=l*c,E=s.x,C=s.y,A=s.z;return i[0]=(1-(f+b))*E,i[1]=(p+_)*E,i[2]=(m-T)*E,i[3]=0,i[4]=(p-_)*C,i[5]=(1-(d+b))*C,i[6]=(x+v)*C,i[7]=0,i[8]=(m+T)*A,i[9]=(x-v)*A,i[10]=(1-(d+f))*A,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,r,s){let i=this.elements,n=nl.set(i[0],i[1],i[2]).length(),a=nl.set(i[4],i[5],i[6]).length(),o=nl.set(i[8],i[9],i[10]).length();this.determinant()<0&&(n=-n),t.x=i[12],t.y=i[13],t.z=i[14],Hs.copy(this);let h=1/n,u=1/a,c=1/o;return Hs.elements[0]*=h,Hs.elements[1]*=h,Hs.elements[2]*=h,Hs.elements[4]*=u,Hs.elements[5]*=u,Hs.elements[6]*=u,Hs.elements[8]*=c,Hs.elements[9]*=c,Hs.elements[10]*=c,r.setFromRotationMatrix(Hs),s.x=n,s.y=a,s.z=o,this}makePerspective(t,r,s,i,n,a,o=Wa){let l=this.elements,h=2*n/(r-t),u=2*n/(s-i),c=(r+t)/(r-t),d=(s+i)/(s-i),p,m;if(o===Wa)p=-(a+n)/(a-n),m=-2*a*n/(a-n);else if(o===py)p=-a/(a-n),m=-a*n/(a-n);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=h,l[4]=0,l[8]=c,l[12]=0,l[1]=0,l[5]=u,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,r,s,i,n,a,o=Wa){let l=this.elements,h=1/(r-t),u=1/(s-i),c=1/(a-n),d=(r+t)*h,p=(s+i)*u,m,f;if(o===Wa)m=(a+n)*c,f=-2*c;else if(o===py)m=n*c,f=-1*c;else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*h,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=f,l[14]=-m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){let r=this.elements,s=t.elements;for(let i=0;i<16;i++)if(r[i]!==s[i])return!1;return!0}fromArray(t,r=0){for(let s=0;s<16;s++)this.elements[s]=t[s+r];return this}toArray(t=[],r=0){let s=this.elements;return t[r]=s[0],t[r+1]=s[1],t[r+2]=s[2],t[r+3]=s[3],t[r+4]=s[4],t[r+5]=s[5],t[r+6]=s[6],t[r+7]=s[7],t[r+8]=s[8],t[r+9]=s[9],t[r+10]=s[10],t[r+11]=s[11],t[r+12]=s[12],t[r+13]=s[13],t[r+14]=s[14],t[r+15]=s[15],t}};const nl=new ci,Hs=new JA,Uet=new ci(0,0,0),$et=new ci(1,1,1),jn=new ci,kd=new ci,rs=new ci;var QA=class KA{constructor(t=0,r=0){KA.prototype.isVector2=!0,this.x=t,this.y=r}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,r){return this.x=t,this.y=r,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;default:throw Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,r){return this.x=t.x+r.x,this.y=t.y+r.y,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,r){return this.x=t.x-r.x,this.y=t.y-r.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let r=this.x,s=this.y,i=t.elements;return this.x=i[0]*r+i[3]*s+i[6],this.y=i[1]*r+i[4]*s+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,r){return this.x=qt(this.x,t.x,r.x),this.y=qt(this.y,t.y,r.y),this}clampScalar(t,r){return this.x=qt(this.x,t,r),this.y=qt(this.y,t,r),this}clampLength(t,r){let s=this.length();return this.divideScalar(s||1).multiplyScalar(qt(s,t,r))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let r=Math.sqrt(this.lengthSq()*t.lengthSq());if(r===0)return Math.PI/2;let s=this.dot(t)/r;return Math.acos(qt(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let r=this.x-t.x,s=this.y-t.y;return r*r+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this}lerpVectors(t,r,s){return this.x=t.x+(r.x-t.x)*s,this.y=t.y+(r.y-t.y)*s,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this}rotateAround(t,r){let s=Math.cos(r),i=Math.sin(r),n=this.x-t.x,a=this.y-t.y;return this.x=n*s-a*i+t.x,this.y=n*i+a*s+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},jet=class tC{constructor(t=0,r=0,s=0,i=1){tC.prototype.isVector4=!0,this.x=t,this.y=r,this.z=s,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,r,s,i){return this.x=t,this.y=r,this.z=s,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;case 2:this.z=r;break;case 3:this.w=r;break;default:throw Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w===void 0?1:t.w,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,r){return this.x=t.x+r.x,this.y=t.y+r.y,this.z=t.z+r.z,this.w=t.w+r.w,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this.z+=t.z*r,this.w+=t.w*r,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,r){return this.x=t.x-r.x,this.y=t.y-r.y,this.z=t.z-r.z,this.w=t.w-r.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let r=this.x,s=this.y,i=this.z,n=this.w,a=t.elements;return this.x=a[0]*r+a[4]*s+a[8]*i+a[12]*n,this.y=a[1]*r+a[5]*s+a[9]*i+a[13]*n,this.z=a[2]*r+a[6]*s+a[10]*i+a[14]*n,this.w=a[3]*r+a[7]*s+a[11]*i+a[15]*n,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let r=Math.sqrt(1-t.w*t.w);return r<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/r,this.y=t.y/r,this.z=t.z/r),this}setAxisAngleFromRotationMatrix(t){let r,s,i,n,a=.01,o=.1,l=t.elements,h=l[0],u=l[4],c=l[8],d=l[1],p=l[5],m=l[9],f=l[2],x=l[6],b=l[10];if(Math.abs(u-d)<a&&Math.abs(c-f)<a&&Math.abs(m-x)<a){if(Math.abs(u+d)<o&&Math.abs(c+f)<o&&Math.abs(m+x)<o&&Math.abs(h+p+b-3)<o)return this.set(1,0,0,0),this;r=Math.PI;let T=(h+1)/2,_=(p+1)/2,E=(b+1)/2,C=(u+d)/4,A=(c+f)/4,I=(m+x)/4;return T>_&&T>E?T<a?(s=0,i=.707106781,n=.707106781):(s=Math.sqrt(T),i=C/s,n=A/s):_>E?_<a?(s=.707106781,i=0,n=.707106781):(i=Math.sqrt(_),s=C/i,n=I/i):E<a?(s=.707106781,i=.707106781,n=0):(n=Math.sqrt(E),s=A/n,i=I/n),this.set(s,i,n,r),this}let v=Math.sqrt((x-m)*(x-m)+(c-f)*(c-f)+(d-u)*(d-u));return Math.abs(v)<.001&&(v=1),this.x=(x-m)/v,this.y=(c-f)/v,this.z=(d-u)/v,this.w=Math.acos((h+p+b-1)/2),this}setFromMatrixPosition(t){let r=t.elements;return this.x=r[12],this.y=r[13],this.z=r[14],this.w=r[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,r){return this.x=qt(this.x,t.x,r.x),this.y=qt(this.y,t.y,r.y),this.z=qt(this.z,t.z,r.z),this.w=qt(this.w,t.w,r.w),this}clampScalar(t,r){return this.x=qt(this.x,t,r),this.y=qt(this.y,t,r),this.z=qt(this.z,t,r),this.w=qt(this.w,t,r),this}clampLength(t,r){let s=this.length();return this.divideScalar(s||1).multiplyScalar(qt(s,t,r))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this.z+=(t.z-this.z)*r,this.w+=(t.w-this.w)*r,this}lerpVectors(t,r,s){return this.x=t.x+(r.x-t.x)*s,this.y=t.y+(r.y-t.y)*s,this.z=t.z+(r.z-t.z)*s,this.w=t.w+(r.w-t.w)*s,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this.z=t[r+2],this.w=t[r+3],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t[r+2]=this.z,t[r+3]=this.w,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this.z=t.getZ(r),this.w=t.getW(r),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};function fy(e,t=0){let r=3735928559^t,s=1103547991^t;if(e instanceof Array)for(let i=0,n;i<e.length;i++)n=e[i],r=Math.imul(r^n,2654435761),s=Math.imul(s^n,1597334677);else for(let i=0,n;i<e.length;i++)n=e.charCodeAt(i),r=Math.imul(r^n,2654435761),s=Math.imul(s^n,1597334677);return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(s^s>>>13,3266489909),s=Math.imul(s^s>>>16,2246822507),s^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&s)+(r>>>0)}const eC=(...e)=>fy(e);function Wet(e,t=!1){let r=[];e.isNode===!0&&(r.push(e.id),e=e.getSelf());for(let{property:s,childNode:i}of gy(e))r.push(fy(s.slice(0,-4)),i.getCacheKey(t));return fy(r)}function*gy(e,t=!1){for(let r in e){if(r.startsWith("_")===!0)continue;let s=e[r];if(Array.isArray(s)===!0)for(let i=0;i<s.length;i++){let n=s[i];n&&(n.isNode===!0||t&&typeof n.toJSON=="function")&&(yield{property:r,index:i,childNode:n})}else if(s&&s.isNode===!0)yield{property:r,childNode:s};else if(typeof s=="object")for(let i in s){let n=s[i];n&&(n.isNode===!0||t&&typeof n.toJSON=="function")&&(yield{property:r,index:i,childNode:n})}}}function yy(e){if(e==null)return null;let t=typeof e;return e.isNode===!0?"node":t==="number"?"float":t==="boolean"?"bool":t==="string"?"string":t==="function"?"shader":e.isVector2===!0?"vec2":e.isVector3===!0?"vec3":e.isVector4===!0?"vec4":e.isMatrix2===!0?"mat2":e.isMatrix3===!0?"mat3":e.isMatrix4===!0?"mat4":e.isColor===!0?"color":e instanceof ArrayBuffer?"ArrayBuffer":null}function rC(e,...t){let r=e?e.slice(-4):void 0;return t.length===1&&(r==="vec2"?t=[t[0],t[0]]:r==="vec3"?t=[t[0],t[0],t[0]]:r==="vec4"&&(t=[t[0],t[0],t[0],t[0]])),e==="color"?new Px(...t):r==="vec2"?new QA(...t):r==="vec3"?new ci(...t):r==="vec4"?new jet(...t):r==="mat2"?new Bet(...t):r==="mat3"?new xc(...t):r==="mat4"?new JA(...t):e==="bool"?t[0]||!1:e==="float"||e==="int"||e==="uint"?t[0]||0:e==="string"?t[0]||"":e==="ArrayBuffer"?Het(t[0]):null}function qet(e){let t="",r=new Uint8Array(e);for(let s=0;s<r.length;s++)t+=String.fromCharCode(r[s]);return btoa(t)}function Het(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0)).buffer}var Get=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){let r=this._listeners;return r===void 0?!1:r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){let r=this._listeners;if(r===void 0)return;let s=r[e];if(s!==void 0){let i=s.indexOf(t);i!==-1&&s.splice(i,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let r=t[e.type];if(r!==void 0){e.target=this;let s=r.slice(0);for(let i=0,n=s.length;i<n;i++)s[i].call(this,e);e.target=null}}};const Xet={analyze:"setup",generate:"analyze"};let Yet=0;var Zet=class extends Get{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=Hn.NONE,this.updateBeforeType=Hn.NONE,this.updateAfterType=Hn.NONE,this.uuid=Fet.generateUUID(),this.version=0,this.global=!1,this.parents=!1,this.isNode=!0,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,"id",{value:Yet++})}set needsUpdate(e){e===!0&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this.getSelf()),this}onFrameUpdate(e){return this.onUpdate(e,Hn.FRAME)}onRenderUpdate(e){return this.onUpdate(e,Hn.RENDER)}onObjectUpdate(e){return this.onUpdate(e,Hn.OBJECT)}onReference(e){return this.updateReference=e.bind(this.getSelf()),this}getSelf(){return this.self||this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:e}of gy(this))yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(let t of this.getChildren())t.traverse(e)}getCacheKey(e=!1){return e||(e=this.version!==this._cacheKeyVersion),(e===!0||this._cacheKey===null)&&(this._cacheKey=eC(Wet(this,e),this.customCacheKey()),this._cacheKeyVersion=this.version),this._cacheKey}customCacheKey(){return 0}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){let t=this.getNodeType(e);return e.getElementType(t)}getMemberType(){return"void"}getNodeType(e){let t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){let t=this.getHash(e);return e.getNodeFromHash(t)||this}setup(e){let t=e.getNodeProperties(this),r=0;for(let s of this.getChildren())t["node"+r++]=s;return t.outputNode||null}analyze(e,t=null){let r=e.increaseUsage(this);if(this.parents===!0){let s=e.getDataFromNode(this,"any");s.stages=s.stages||{},s.stages[e.shaderStage]=s.stages[e.shaderStage]||[],s.stages[e.shaderStage].push(t)}if(r===1){let s=e.getNodeProperties(this);for(let i of Object.values(s))i&&i.isNode===!0&&i.build(e,this)}}generate(e,t){let{outputNode:r}=e.getNodeProperties(this);if(r&&r.isNode===!0)return r.build(e,t)}updateBefore(){console.warn("Abstract function.")}updateAfter(){console.warn("Abstract function.")}update(){console.warn("Abstract function.")}build(e,t=null){let r=this.getShared(e);if(this!==r)return r.build(e,t);let s=e.getDataFromNode(this);s.buildStages=s.buildStages||{},s.buildStages[e.buildStage]=!0;let i=Xet[e.buildStage];if(i&&s.buildStages[i]!==!0){let o=e.getBuildStage();e.setBuildStage(i),this.build(e),e.setBuildStage(o)}e.addNode(this),e.addChain(this);let n=null,a=e.getBuildStage();if(a==="setup"){this.updateReference(e);let o=e.getNodeProperties(this);if(o.initialized!==!0){o.initialized=!0,o.outputNode=this.setup(e)||o.outputNode||null;for(let l of Object.values(o))if(l&&l.isNode===!0){if(l.parents===!0){let h=e.getNodeProperties(l);h.parents=h.parents||[],h.parents.push(this)}l.build(e)}}n=o.outputNode}else if(a==="analyze")this.analyze(e,t);else if(a==="generate")if(this.generate.length===1){let l=this.getNodeType(e),h=e.getDataFromNode(this);n=h.snippet,n===void 0?h.generated===void 0?(h.generated=!0,n=this.generate(e)||"",h.snippet=n):(console.warn("THREE.Node: Recursion detected.",this),n=""):h.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),n=e.format(n,l,t)}else n=this.generate(e,t)||"";return e.removeChain(this),e.addSequentialNode(this),n}getSerializeChildren(){return gy(this)}serialize(e){let t=this.getSerializeChildren(),r={};for(let{property:s,index:i,childNode:n}of t)i===void 0?r[s]=n.toJSON(e.meta).uuid:(r[s]===void 0&&(r[s]=Number.isInteger(i)?[]:{}),r[s][i]=n.toJSON(e.meta).uuid);Object.keys(r).length>0&&(e.inputNodes=r)}deserialize(e){if(e.inputNodes!==void 0){let t=e.meta.nodes;for(let r in e.inputNodes)if(Array.isArray(e.inputNodes[r])){let s=[];for(let i of e.inputNodes[r])s.push(t[i]);this[r]=s}else if(typeof e.inputNodes[r]=="object"){let s={};for(let i in e.inputNodes[r]){let n=e.inputNodes[r][i];s[i]=t[n]}this[r]=s}else{let s=e.inputNodes[r];this[r]=t[s]}}}toJSON(e){let{uuid:t,type:r}=this,s=e===void 0||typeof e=="string";s&&(e={textures:{},images:{},nodes:{}});let i=e.nodes[t];i===void 0&&(i={uuid:t,type:r,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},s!==!0&&(e.nodes[i.uuid]=i),this.serialize(i),delete i.meta);function n(a){let o=[];for(let l in a){let h=a[l];delete h.metadata,o.push(h)}return o}if(s){let a=n(e.textures),o=n(e.images),l=n(e.nodes);a.length>0&&(i.textures=a),o.length>0&&(i.images=o),l.length>0&&(i.nodes=l)}return i}},Qe=Zet,Jet=class extends Qe{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){let s=e.getVectorType(this.getNodeType(e,t)),i=e.getDataFromNode(this);if(i.propertyName!==void 0)return e.format(i.propertyName,s,t);if(s!=="void"&&t!=="void"&&this.hasDependencies(e)){let n=super.build(e,s),a=e.getVarFromNode(this,null,s),o=e.getPropertyName(a);return e.addLineFlowCode(`${o} = ${n}`,this),i.snippet=n,i.propertyName=o,e.format(i.propertyName,s,t)}}return super.build(e,t)}},ms=Jet,Qet=class extends Qe{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}generate(e){let t=this.indexNode.getNodeType(e),r=this.node.build(e),s=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint");return`${r}[ ${s} ]`}},Fx=Qet,Ket=class extends Qe{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){let t=this.node.getNodeType(e),r=null;for(let s of this.convertTo.split("|"))(r===null||e.getTypeLength(t)===e.getTypeLength(s))&&(r=s);return r}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){let r=this.node,s=this.getNodeType(e),i=r.build(e,s);return e.format(i,s,t)}},sC=Ket,trt=class extends ms{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}getNodeType(e){return this.nodeType===null?e.getTypeFromLength(this.nodes.reduce((t,r)=>t+e.getTypeLength(r.getNodeType(e)),0)):e.getVectorType(this.nodeType)}generate(e,t){let r=this.getNodeType(e),s=e.getTypeLength(r),i=this.nodes,n=e.getComponentType(r),a=[],o=0;for(let h of i){if(o>=s){console.error(`THREE.TSL: Length of parameters exceeds maximum length of function '${r}()' type.`);break}let u=h.getNodeType(e),c=e.getTypeLength(u),d;o+c>s&&(console.error(`THREE.TSL: Length of '${r}()' data exceeds maximum length of output type.`),c=s-o,u=e.getTypeFromLength(c)),o+=c,d=h.build(e,u);let p=e.getComponentType(u);p!==n&&(d=e.format(d,p,n)),a.push(d)}let l=`${e.getType(r)}( ${a.join(", ")} )`;return e.format(l,r,t)}},ert=trt;const rrt=yc.join("");var srt=class extends Qe{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(let t of this.components)e=Math.max(yc.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}generate(e,t){let r=this.node,s=e.getTypeLength(r.getNodeType(e)),i=null;if(s>1){let n=null;this.getVectorLength()>=s&&(n=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));let o=r.build(e,n);i=this.components.length===s&&this.components===rrt.slice(0,this.components.length)?e.format(o,n,t):e.format(`${o}.${this.components}`,this.getNodeType(e),t)}else i=r.build(e,t);return i}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}},NM=srt,irt=class extends ms{static get type(){return"SetNode"}constructor(e,t,r){super(),this.sourceNode=e,this.components=t,this.targetNode=r}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{sourceNode:t,components:r,targetNode:s}=this,i=this.getNodeType(e),n=e.getComponentType(s.getNodeType(e)),a=e.getTypeFromLength(r.length,n),o=s.build(e,a),l=t.build(e,i),h=e.getTypeLength(i),u=[];for(let c=0;c<h;c++){let d=yc[c];d===r[0]?(u.push(o),c+=r.length-1):u.push(l+"."+d)}return`${e.getType(i)}( ${u.join(", ")} )`}},nrt=irt,art=class extends ms{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{components:t,sourceNode:r}=this,s=this.getNodeType(e),i=r.build(e),n=e.getVarFromNode(this),a=e.getPropertyName(n);e.addLineFlowCode(a+" = "+i,this);let o=e.getTypeLength(s),l=[],h=0;for(let u=0;u<o;u++){let c=yc[u];c===t[h]?(l.push("1.0 - "+(a+"."+c)),h++):l.push(a+"."+c)}return`${e.getType(s)}( ${l.join(", ")} )`}},ort=art,lrt=class extends Qe{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}getNodeType(){return this.nodeType===null?yy(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=yy(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=qet(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?rC(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){console.warn("Abstract function.")}},Ox=lrt;const SM=/float|u?int/;var urt=class extends Ox{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){let r=this.getNodeType(e);return SM.test(r)&&SM.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),r,t)}},_n=urt,hrt=class extends Qe{static get type(){return"MemberNode"}constructor(e,t){super(),this.node=e,this.property=t,this.isMemberNode=!0}getNodeType(e){return this.node.getMemberType(e,this.property)}generate(e){return this.node.build(e)+"."+this.property}},crt=hrt;let drt=null;const yl=new Map;function W(e,t){if(yl.has(e)){console.warn(`THREE.TSL: Redefinition of method chaining '${e}'.`);return}if(typeof t!="function")throw Error(`THREE.TSL: Node element ${e} is not a function`);yl.set(e,t)}const iC=e=>e.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),_M=e=>iC(e).split("").sort().join(""),nC={setup(e,t){let r=t.shift();return e(_m(r),...t)},get(e,t,r){if(typeof t=="string"&&e[t]===void 0){if(e.isStackNode!==!0&&t==="assign")return(...s)=>(drt.assign(r,...s),r);if(yl.has(t)){let s=yl.get(t);return e.isStackNode?(...i)=>r.add(s(...i)):(...i)=>s(r,...i)}else{if(t==="self")return e;if(t.endsWith("Assign")&&yl.has(t.slice(0,t.length-6))){let s=yl.get(t.slice(0,t.length-6));return e.isStackNode?(...i)=>r.assign(i[0],s(...i)):(...i)=>r.assign(s(r,...i))}else{if(/^[xyzwrgbastpq]{1,4}$/.test(t)===!0)return t=iC(t),xt(new NM(r,t));if(/^set[XYZWRGBASTPQ]{1,4}$/.test(t)===!0)return t=_M(t.slice(3).toLowerCase()),s=>xt(new nrt(e,t,xt(s)));if(/^flip[XYZWRGBASTPQ]{1,4}$/.test(t)===!0)return t=_M(t.slice(4).toLowerCase()),()=>xt(new ort(xt(e),t));if(t==="width"||t==="height"||t==="depth")return t==="width"?t="x":t==="height"?t="y":t==="depth"&&(t="z"),xt(new NM(e,t));if(/^\d+$/.test(t)===!0)return xt(new Fx(r,new _n(Number(t),"uint")));if(/^get$/.test(t)===!0)return s=>xt(new crt(r,s))}}}return Reflect.get(e,t,r)},set(e,t,r,s){return typeof t=="string"&&e[t]===void 0&&(/^[xyzwrgbastpq]{1,4}$/.test(t)===!0||t==="width"||t==="height"||t==="depth"||/^\d+$/.test(t)===!0)?(s[t].assign(r),!0):Reflect.set(e,t,r,s)}},fg=new WeakMap,AM=new WeakMap,prt=function(e,t=null){let r=yy(e);if(r==="node"){let s=fg.get(e);return s===void 0&&(s=new Proxy(e,nC),fg.set(e,s),fg.set(s,s)),s}else{if(t===null&&(r==="float"||r==="boolean")||r&&r!=="shader"&&r!=="string")return xt(xy(e,t));if(r==="shader")return Bs(e)}return e},mrt=function(e,t=null){for(let r in e)e[r]=xt(e[r],t);return e},frt=function(e,t=null){let r=e.length;for(let s=0;s<r;s++)e[s]=xt(e[s],t);return e},grt=function(e,t=null,r=null,s=null){let i=u=>xt(s===null?u:Object.assign(u,s)),n,a=t,o,l;function h(u){let c;return c=a?/[a-z]/i.test(a)?a+"()":a:e.type,o!==void 0&&u.length<o?(console.error(`THREE.TSL: "${c}" parameter length is less than minimum required.`),u.concat(Array(o-u.length).fill(0))):l!==void 0&&u.length>l?(console.error(`THREE.TSL: "${c}" parameter length exceeds limit.`),u.slice(0,l)):u}return t===null?n=(...u)=>i(new e(...tp(h(u)))):r===null?n=(...u)=>i(new e(t,...tp(h(u)))):(r=xt(r),n=(...u)=>i(new e(t,...tp(h(u)),r))),n.setParameterLength=(...u)=>(u.length===1?o=l=u[0]:u.length===2&&([o,l]=u),n),n.setName=u=>(a=u,n),n};var yrt=class extends Qe{constructor(e,t){super(),this.shaderNode=e,this.inputNodes=t,this.isShaderCallNodeInternal=!0}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){let{shaderNode:t,inputNodes:r}=this,s=e.getNodeProperties(t),i=t.namespace&&t.namespace===e.namespace?e.getNamespace("once"):"once";if(s[i])return s[i];let n=null;if(t.layout){let a=AM.get(e.constructor);a===void 0&&(a=new WeakMap,AM.set(e.constructor,a));let o=a.get(t);o===void 0&&(o=xt(e.buildFunctionNode(t)),a.set(t,o)),e.addInclude(o),n=xt(o.call(r))}else{let a=t.jsFunc,o=r!==null||a.length>1?a(r||[],e):a(e);n=xt(o)}return t.once&&(s[i]=n),n}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){let t=e.getNodeProperties(this),r=e.getOutputNamespace();return t[r]=t[r]||this.setupOutput(e),t[r]}build(e,t=null){let r=null,s=e.getBuildStage(),i=e.getNodeProperties(this),n=e.getOutputNamespace(),a=this.getOutputNode(e);if(s==="setup"){let o=e.getNamespace("initialized");i[o]!==!0&&(i[o]=!0,i[n]=this.getOutputNode(e),i[n].build(e)),r=i[n]}else s==="analyze"?a.build(e,t):s==="generate"&&(r=a.build(e,t)||"");return r}},xrt=class extends Qe{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1,this.namespace=null}setLayout(e){return this.layout=e,this}call(e=null){return _m(e),xt(new yrt(this,e))}setup(){return this.call()}};const brt=[!1,!0],vrt=[0,1,2,3],Mrt=[-1,-2],aC=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],kx=new Map;for(let e of brt)kx.set(e,new _n(e));const Bx=new Map;for(let e of vrt)Bx.set(e,new _n(e,"uint"));const Dx=new Map([...Bx].map(e=>new _n(e.value,"int")));for(let e of Mrt)Dx.set(e,new _n(e,"int"));const Nm=new Map([...Dx].map(e=>new _n(e.value)));for(let e of aC)Nm.set(e,new _n(e));for(let e of aC)Nm.set(-e,new _n(-e));const Sm={bool:kx,uint:Bx,ints:Dx,float:Nm},CM=new Map([...kx,...Nm]),xy=(e,t)=>CM.has(e)?CM.get(e):e.isNode===!0?e:new _n(e,t),wrt=e=>{try{return e.getNodeType()}catch{return}},Ke=function(e,t=null){return(...r)=>{if((r.length===0||!["bool","float","int","uint"].includes(e)&&r.every(i=>typeof i!="object"))&&(r=[rC(e,...r)]),r.length===1&&t!==null&&t.has(r[0]))return xt(t.get(r[0]));if(r.length===1){let i=xy(r[0],e);return wrt(i)===e?xt(i):xt(new sC(i,e))}let s=r.map(i=>xy(i));return xt(new ert(s,e))}},Trt=e=>e==null?null:e.nodeType||e.convertTo||(typeof e=="string"?e:null);function Nrt(e,t){return new Proxy(new xrt(e,t),nC)}const xt=(e,t=null)=>prt(e,t),_m=(e,t=null)=>new mrt(e,t),tp=(e,t=null)=>new frt(e,t),rt=(...e)=>new grt(...e);let Srt=0;const Bs=(e,t=null)=>{let r=null;t!==null&&(typeof t=="object"?r=t.return:(typeof t=="string"?r=t:console.error("THREE.TSL: Invalid layout type."),t=null));let s=new Nrt(e,r),i=(...n)=>{let a;_m(n),a=n[0]&&(n[0].isNode||Object.getPrototypeOf(n[0])!==Object.prototype)?[...n]:n[0];let l=s.call(a);return r==="void"&&l.toStack(),l};if(i.shaderNode=s,i.id=s.id,i.getNodeType=(...n)=>s.getNodeType(...n),i.getCacheKey=(...n)=>s.getCacheKey(...n),i.setLayout=n=>(s.setLayout(n),i),i.once=(n=null)=>(s.once=!0,s.namespace=n,i),t!==null){if(typeof t.inputs!="object"){let n={name:"fn"+Srt++,type:r,inputs:[]};for(let a in t)a!=="return"&&n.inputs.push({name:a,type:t[a]});t=n}i.setLayout(t)}return i};function _rt(e){return e}W("toStack",_rt);const Art=new Ke("color"),Li=new Ke("float",Sm.float),Vh=new Ke("int",Sm.ints),Crt=new Ke("uint",Sm.uint),zrt=new Ke("bool",Sm.bool),oC=new Ke("vec2"),Ert=new Ke("ivec2"),Vrt=new Ke("uvec2"),Rrt=new Ke("bvec2"),cu=new Ke("vec3"),Irt=new Ke("ivec3"),Lrt=new Ke("uvec3"),Prt=new Ke("bvec3"),to=new Ke("vec4"),Frt=new Ke("ivec4"),Ort=new Ke("uvec4"),krt=new Ke("bvec4"),Brt=new Ke("mat2"),lC=new Ke("mat3"),Drt=new Ke("mat4");W("toColor",Art),W("toFloat",Li),W("toInt",Vh),W("toUint",Crt),W("toBool",zrt),W("toVec2",oC),W("toIVec2",Ert),W("toUVec2",Vrt),W("toBVec2",Rrt),W("toVec3",cu),W("toIVec3",Irt),W("toUVec3",Lrt),W("toBVec3",Prt),W("toVec4",to),W("toIVec4",Frt),W("toUVec4",Ort),W("toBVec4",krt),W("toMat2",Brt),W("toMat3",lC),W("toMat4",Drt);const Urt=rt(Fx).setParameterLength(2),$rt=(e,t)=>xt(new sC(xt(e),t));W("element",Urt),W("convert",$rt),W("append",e=>(console.warn("THREE.TSL: .append() has been renamed to .toStack()."),e));const jrt={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"};var $e=class by extends ms{static get type(){return"OperatorNode"}constructor(t,r,s,...i){if(super(),i.length>0){let n=new by(t,r,s);for(let a=0;a<i.length-1;a++)n=new by(t,n,i[a]);r=n,s=i[i.length-1]}this.op=t,this.aNode=r,this.bNode=s,this.isOperatorNode=!0}getOperatorMethod(t,r){return t.getMethod(jrt[this.op],r)}getNodeType(t){let r=this.op,s=this.aNode,i=this.bNode,n=s.getNodeType(t),a=i?i.getNodeType(t):null;if(n==="void"||a==="void")return"void";if(r==="%")return n;if(r==="~"||r==="&"||r==="|"||r==="^"||r===">>"||r==="<<")return t.getIntegerType(n);if(r==="!"||r==="&&"||r==="||"||r==="^^")return"bool";if(r==="=="||r==="!="||r==="<"||r===">"||r==="<="||r===">="){let o=Math.max(t.getTypeLength(n),t.getTypeLength(a));return o>1?`bvec${o}`:"bool"}else{if(t.isMatrix(n)){if(a==="float")return n;if(t.isVector(a))return t.getVectorFromMatrix(n);if(t.isMatrix(a))return n}else if(t.isMatrix(a)){if(n==="float")return a;if(t.isVector(n))return t.getVectorFromMatrix(a)}return t.getTypeLength(a)>t.getTypeLength(n)?a:n}}generate(t,r){let s=this.op,{aNode:i,bNode:n}=this,a=this.getNodeType(t),o=null,l=null;a==="void"?o=l=a:(o=i.getNodeType(t),l=n?n.getNodeType(t):null,s==="<"||s===">"||s==="<="||s===">="||s==="=="||s==="!="?t.isVector(o)?l=o:t.isVector(l)?o=l:o!==l&&(o=l="float"):s===">>"||s==="<<"?(o=a,l=t.changeComponentType(l,"uint")):s==="%"?(o=a,l=t.isInteger(o)&&t.isInteger(l)?l:o):t.isMatrix(o)?l==="float"?l="float":t.isVector(l)?l=t.getVectorFromMatrix(o):t.isMatrix(l)||(o=l=a):o=t.isMatrix(l)?o==="float"?"float":t.isVector(o)?t.getVectorFromMatrix(l):l=a:l=a);let h=i.build(t,o),u=n?n.build(t,l):null,c=t.getFunctionOperator(s);if(r!=="void"){let d=t.renderer.coordinateSystem===Wa;if(s==="=="||s==="!="||s==="<"||s===">"||s==="<="||s===">=")return d&&t.isVector(o)?t.format(`${this.getOperatorMethod(t,r)}( ${h}, ${u} )`,a,r):t.format(`( ${h} ${s} ${u} )`,a,r);if(s==="%")return t.isInteger(l)?t.format(`( ${h} % ${u} )`,a,r):t.format(`${this.getOperatorMethod(t,a)}( ${h}, ${u} )`,a,r);if(s==="!"||s==="~")return t.format(`(${s}${h})`,o,r);if(c)return t.format(`${c}( ${h}, ${u} )`,a,r);if(t.isMatrix(o)&&l==="float")return t.format(`( ${u} ${s} ${h} )`,a,r);if(o==="float"&&t.isMatrix(l))return t.format(`${h} ${s} ${u}`,a,r);{let p=`( ${h} ${s} ${u} )`;return!d&&a==="bool"&&t.isVector(o)&&t.isVector(l)&&(p=`all${p}`),t.format(p,a,r)}}else if(o!=="void")return c?t.format(`${c}( ${h}, ${u} )`,a,r):t.isMatrix(o)&&l==="float"?t.format(`${u} ${s} ${h}`,a,r):t.format(`${h} ${s} ${u}`,a,r)}serialize(t){super.serialize(t),t.op=this.op}deserialize(t){super.deserialize(t),this.op=t.op}};const uC=rt($e,"+").setParameterLength(2,1/0).setName("add"),vy=rt($e,"-").setParameterLength(2,1/0).setName("sub"),Ux=rt($e,"*").setParameterLength(2,1/0).setName("mul"),hC=rt($e,"/").setParameterLength(2,1/0).setName("div"),Am=rt($e,"%").setParameterLength(2).setName("mod"),cC=rt($e,"==").setParameterLength(2).setName("equal"),Wrt=rt($e,"!=").setParameterLength(2).setName("notEqual"),qrt=rt($e,"<").setParameterLength(2).setName("lessThan"),Hrt=rt($e,">").setParameterLength(2).setName("greaterThan"),Grt=rt($e,"<=").setParameterLength(2).setName("lessThanEqual"),Xrt=rt($e,">=").setParameterLength(2).setName("greaterThanEqual"),Yrt=rt($e,"&&").setParameterLength(2,1/0).setName("and"),Zrt=rt($e,"||").setParameterLength(2,1/0).setName("or"),Jrt=rt($e,"!").setParameterLength(1).setName("not"),Qrt=rt($e,"^^").setParameterLength(2).setName("xor"),Krt=rt($e,"&").setParameterLength(2).setName("bitAnd"),tst=rt($e,"~").setParameterLength(2).setName("bitNot"),est=rt($e,"|").setParameterLength(2).setName("bitOr"),rst=rt($e,"^").setParameterLength(2).setName("bitXor"),sst=rt($e,"<<").setParameterLength(2).setName("shiftLeft"),ist=rt($e,">>").setParameterLength(2).setName("shiftRight"),nst=Bs(([e])=>(e.addAssign(1),e)),ast=Bs(([e])=>(e.subAssign(1),e)),ost=Bs(([e])=>{let t=Vh(e).toConst();return e.addAssign(1),t}),lst=Bs(([e])=>{let t=Vh(e).toConst();return e.subAssign(1),t});W("add",uC),W("sub",vy),W("mul",Ux),W("div",hC),W("mod",Am),W("equal",cC),W("notEqual",Wrt),W("lessThan",qrt),W("greaterThan",Hrt),W("lessThanEqual",Grt),W("greaterThanEqual",Xrt),W("and",Yrt),W("or",Zrt),W("not",Jrt),W("xor",Qrt),W("bitAnd",Krt),W("bitNot",tst),W("bitOr",est),W("bitXor",rst),W("shiftLeft",sst),W("shiftRight",ist),W("incrementBefore",nst),W("decrementBefore",ast),W("increment",ost),W("decrement",lst);const ust=(e,t)=>(console.warn('THREE.TSL: "remainder()" is deprecated. Use "mod( int( ... ) )" instead.'),Am(e,t)),hst=(e,t)=>(console.warn('THREE.TSL: "modInt()" is deprecated. Use "mod( int( ... ) )" instead.'),Am(Vh(e),Vh(t)));W("remainder",ust),W("modInt",hst);var k=class ue extends ms{static get type(){return"MathNode"}constructor(t,r,s=null,i=null){if(super(),(t===ue.MAX||t===ue.MIN)&&arguments.length>3){let n=new ue(t,r,s);for(let a=2;a<arguments.length-1;a++)n=new ue(t,n,arguments[a]);r=n,s=arguments[arguments.length-1],i=null}this.method=t,this.aNode=r,this.bNode=s,this.cNode=i,this.isMathNode=!0}getInputType(t){let r=this.aNode.getNodeType(t),s=this.bNode?this.bNode.getNodeType(t):null,i=this.cNode?this.cNode.getNodeType(t):null,n=t.isMatrix(r)?0:t.getTypeLength(r),a=t.isMatrix(s)?0:t.getTypeLength(s),o=t.isMatrix(i)?0:t.getTypeLength(i);return n>a&&n>o?r:a>o?s:o>n?i:r}getNodeType(t){let r=this.method;return r===ue.LENGTH||r===ue.DISTANCE||r===ue.DOT?"float":r===ue.CROSS?"vec3":r===ue.ALL||r===ue.ANY?"bool":r===ue.EQUALS?t.changeComponentType(this.aNode.getNodeType(t),"bool"):this.getInputType(t)}setup(t){let{aNode:r,bNode:s,method:i}=this,n=null;if(i===ue.ONE_MINUS)n=vy(1,r);else if(i===ue.RECIPROCAL)n=hC(1,r);else if(i===ue.DIFFERENCE)n=$x(vy(r,s));else if(i===ue.TRANSFORM_DIRECTION){let a=r,o=s;t.isMatrix(a.getNodeType(t))?o=to(cu(o),0):a=to(cu(a),0);let l=Ux(a,o).xyz;n=dC(l)}return n===null?super.setup(t):n}generate(t,r){if(t.getNodeProperties(this).outputNode)return super.generate(t,r);let i=this.method,n=this.getNodeType(t),a=this.getInputType(t),o=this.aNode,l=this.bNode,h=this.cNode,u=t.renderer.coordinateSystem;if(i===ue.NEGATE)return t.format("( - "+o.build(t,a)+" )",n,r);{let c=[];return i===ue.CROSS?c.push(o.build(t,n),l.build(t,n)):u===Wa&&i===ue.STEP?c.push(o.build(t,t.getTypeLength(o.getNodeType(t))===1?"float":a),l.build(t,a)):u===Wa&&(i===ue.MIN||i===ue.MAX)?c.push(o.build(t,a),l.build(t,t.getTypeLength(l.getNodeType(t))===1?"float":a)):i===ue.REFRACT?c.push(o.build(t,a),l.build(t,a),h.build(t,"float")):i===ue.MIX?c.push(o.build(t,a),l.build(t,a),h.build(t,t.getTypeLength(h.getNodeType(t))===1?"float":a)):(u===py&&i===ue.ATAN&&l!==null&&(i="atan2"),t.shaderStage!=="fragment"&&(i===ue.DFDX||i===ue.DFDY)&&(console.warn(`THREE.TSL: '${i}' is not supported in the ${t.shaderStage} stage.`),i="/*"+i+"*/"),c.push(o.build(t,a)),l!==null&&c.push(l.build(t,a)),h!==null&&c.push(h.build(t,a))),t.format(`${t.getMethod(i,n)}( ${c.join(", ")} )`,n,r)}}serialize(t){super.serialize(t),t.method=this.method}deserialize(t){super.deserialize(t),this.method=t.method}};k.ALL="all",k.ANY="any",k.RADIANS="radians",k.DEGREES="degrees",k.EXP="exp",k.EXP2="exp2",k.LOG="log",k.LOG2="log2",k.SQRT="sqrt",k.INVERSE_SQRT="inversesqrt",k.FLOOR="floor",k.CEIL="ceil",k.NORMALIZE="normalize",k.FRACT="fract",k.SIN="sin",k.COS="cos",k.TAN="tan",k.ASIN="asin",k.ACOS="acos",k.ATAN="atan",k.ABS="abs",k.SIGN="sign",k.LENGTH="length",k.NEGATE="negate",k.ONE_MINUS="oneMinus",k.DFDX="dFdx",k.DFDY="dFdy",k.ROUND="round",k.RECIPROCAL="reciprocal",k.TRUNC="trunc",k.FWIDTH="fwidth",k.TRANSPOSE="transpose",k.BITCAST="bitcast",k.EQUALS="equals",k.MIN="min",k.MAX="max",k.STEP="step",k.REFLECT="reflect",k.DISTANCE="distance",k.DIFFERENCE="difference",k.DOT="dot",k.CROSS="cross",k.POW="pow",k.TRANSFORM_DIRECTION="transformDirection",k.MIX="mix",k.CLAMP="clamp",k.REFRACT="refract",k.SMOOTHSTEP="smoothstep",k.FACEFORWARD="faceforward";const cst=Li(Math.PI);Li(Math.PI*2);const dst=rt(k,k.ALL).setParameterLength(1),pst=rt(k,k.ANY).setParameterLength(1),mst=rt(k,k.RADIANS).setParameterLength(1),fst=rt(k,k.DEGREES).setParameterLength(1),gst=rt(k,k.EXP).setParameterLength(1),yst=rt(k,k.EXP2).setParameterLength(1),xst=rt(k,k.LOG).setParameterLength(1),bst=rt(k,k.LOG2).setParameterLength(1),vst=rt(k,k.SQRT).setParameterLength(1),Mst=rt(k,k.INVERSE_SQRT).setParameterLength(1),wst=rt(k,k.FLOOR).setParameterLength(1),Tst=rt(k,k.CEIL).setParameterLength(1),dC=rt(k,k.NORMALIZE).setParameterLength(1),pC=rt(k,k.FRACT).setParameterLength(1),mC=rt(k,k.SIN).setParameterLength(1),Nst=rt(k,k.COS).setParameterLength(1),Sst=rt(k,k.TAN).setParameterLength(1),_st=rt(k,k.ASIN).setParameterLength(1),Ast=rt(k,k.ACOS).setParameterLength(1),fC=rt(k,k.ATAN).setParameterLength(1,2),$x=rt(k,k.ABS).setParameterLength(1),gC=rt(k,k.SIGN).setParameterLength(1),Cst=rt(k,k.LENGTH).setParameterLength(1),zst=rt(k,k.NEGATE).setParameterLength(1),Est=rt(k,k.ONE_MINUS).setParameterLength(1),Vst=rt(k,k.DFDX).setParameterLength(1),Rst=rt(k,k.DFDY).setParameterLength(1),Ist=rt(k,k.ROUND).setParameterLength(1),Lst=rt(k,k.RECIPROCAL).setParameterLength(1),Pst=rt(k,k.TRUNC).setParameterLength(1),Fst=rt(k,k.FWIDTH).setParameterLength(1),Ost=rt(k,k.TRANSPOSE).setParameterLength(1),kst=(e,t)=>(console.warn('THREE.TSL: "equals" is deprecated. Use "equal" inside a vector instead, like: "bvec*( equal( ... ) )"'),cC(e,t)),Bst=rt(k,k.MIN).setParameterLength(2,1/0),Dst=rt(k,k.MAX).setParameterLength(2,1/0),Ust=rt(k,k.STEP).setParameterLength(2),$st=rt(k,k.REFLECT).setParameterLength(2),jst=rt(k,k.DISTANCE).setParameterLength(2),Wst=rt(k,k.DIFFERENCE).setParameterLength(2),bc=rt(k,k.DOT).setParameterLength(2),qst=rt(k,k.CROSS).setParameterLength(2),yC=rt(k,k.POW).setParameterLength(2),Hst=rt(k,k.POW,2).setParameterLength(1),Gst=rt(k,k.POW,3).setParameterLength(1),Xst=rt(k,k.POW,4).setParameterLength(1),Yst=rt(k,k.TRANSFORM_DIRECTION).setParameterLength(2),Zst=e=>Ux(gC(e),yC($x(e),1/3)),Jst=e=>bc(e,e),Cm=rt(k,k.MIX).setParameterLength(3),xC=(e,t=0,r=1)=>xt(new k(k.CLAMP,xt(e),xt(t),xt(r))),Qst=e=>xC(e),Kst=rt(k,k.REFRACT).setParameterLength(3),tit=rt(k,k.SMOOTHSTEP).setParameterLength(3),eit=rt(k,k.FACEFORWARD).setParameterLength(3),rit=Bs(([e])=>{let t=12.9898,r=78.233,s=43758.5453,i=bc(e.xy,oC(t,r)),n=Am(i,cst);return pC(mC(n).mul(s))}),sit=(e,t,r)=>Cm(t,r,e),iit=(e,t,r)=>tit(t,r,e),nit=(e,t)=>(console.warn('THREE.TSL: "atan2" is overloaded. Use "atan" instead.'),fC(e,t));W("all",dst),W("any",pst),W("equals",kst),W("radians",mst),W("degrees",fst),W("exp",gst),W("exp2",yst),W("log",xst),W("log2",bst),W("sqrt",vst),W("inverseSqrt",Mst),W("floor",wst),W("ceil",Tst),W("normalize",dC),W("fract",pC),W("sin",mC),W("cos",Nst),W("tan",Sst),W("asin",_st),W("acos",Ast),W("atan",fC),W("abs",$x),W("sign",gC),W("length",Cst),W("lengthSq",Jst),W("negate",zst),W("oneMinus",Est),W("dFdx",Vst),W("dFdy",Rst),W("round",Ist),W("reciprocal",Lst),W("trunc",Pst),W("fwidth",Fst),W("atan2",nit),W("min",Bst),W("max",Dst),W("step",Ust),W("reflect",$st),W("distance",jst),W("dot",bc),W("cross",qst),W("pow",yC),W("pow2",Hst),W("pow3",Gst),W("pow4",Xst),W("transformDirection",Yst),W("mix",sit),W("clamp",xC),W("refract",Kst),W("smoothstep",iit),W("faceForward",eit),W("difference",Wst),W("saturate",Qst),W("cbrt",Zst),W("transpose",Ost),W("rand",rit);var zM=class extends ms{static get type(){return"ArrayNode"}constructor(e,t,r=null){super(e),this.count=t,this.values=r,this.isArrayNode=!0}getNodeType(e){return this.nodeType===null&&(this.nodeType=this.values[0].getNodeType(e)),this.nodeType}getElementType(e){return this.getNodeType(e)}generate(e){let t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}};const ait=(...e)=>{let t;if(e.length===1){let r=e[0];t=new zM(null,r.length,r)}else{let r=e[0],s=e[1];t=new zM(r,s)}return xt(t)};W("toArray",(e,t)=>ait(Array(t).fill(e)));var bC=class extends Qe{static get type(){return"UniformGroupNode"}constructor(e,t=!1,r=1){super("string"),this.name=e,this.shared=t,this.order=r,this.isUniformGroup=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}};const oit=e=>new bC(e),lit=(e,t=0)=>new bC(e,!0,t),uit=lit("render"),hit=oit("object");var cit=class extends Ox{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=hit}label(e){return this.name=e,this}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){let r=this.getSelf();return e=e.bind(r),super.onUpdate(s=>{let i=e(s,r);i!==void 0&&(this.value=i)},t)}generate(e,t){let r=this.getNodeType(e),s=this.getUniformHash(e),i=e.getNodeFromHash(s);i===void 0&&(e.setHashNode(this,s),i=this);let n=i.getInputType(e),a=e.getUniformFromNode(i,n,e.shaderStage,this.name||e.context.label),o=e.getPropertyName(a);return e.context.label!==void 0&&delete e.context.label,e.format(o,r,t)}};const dit=(e,t)=>{let r=Trt(t||e),s=e;return xt(new cit(s,r))};var pit=class extends Qe{static get type(){return"PropertyNode"}constructor(e,t=null,r=!1){super(e),this.name=t,this.varying=r,this.isPropertyNode=!0,this.global=!0}getHash(e){return this.name||super.getHash(e)}generate(e){let t;return this.varying===!0?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}};const mit=(e,t)=>xt(new pit(e,t));var fit=class extends ms{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}getNodeType(e,t){return t==="void"?"void":this.targetNode.getNodeType(e)}needsSplitAssign(e){let{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){let r=e.getTypeLength(t.node.getNodeType(e));return yc.join("").slice(0,r)!==t.components}return!1}setup(e){let{targetNode:t,sourceNode:r}=this,s=e.getNodeProperties(this);s.sourceNode=r,s.targetNode=t.context({assign:!0})}generate(e,t){let{targetNode:r,sourceNode:s}=e.getNodeProperties(this),i=this.needsSplitAssign(e),n=r.getNodeType(e),a=r.build(e),o=s.build(e,n),l=s.getNodeType(e),h=e.getDataFromNode(this),u;if(h.initialized===!0)t!=="void"&&(u=a);else if(i){let c=e.getVarFromNode(this,null,n),d=e.getPropertyName(c);e.addLineFlowCode(`${d} = ${o}`,this);let p=r.node,m=p.node.context({assign:!0}),f=m.build(e);for(let x=0;x<p.components.length;x++){let b=p.components[x];e.addLineFlowCode(`${f}.${b} = ${d}[ ${x} ]`,this)}t!=="void"&&(u=a)}else u=`${a} = ${o}`,(t==="void"||l==="void")&&(e.addLineFlowCode(u,this),t!=="void"&&(u=a));return h.initialized=!0,e.format(u,n,t)}};const git=rt(fit).setParameterLength(2);W("assign",git);var yit=class extends ms{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}getNodeType(e){return this.functionNode.getNodeType(e)}generate(e){let t=[],r=this.functionNode,s=r.getInputs(e),i=this.parameters,n=(o,l)=>{let h=l.type,u=h==="pointer",c;return c=u?"&"+o.build(e):o.build(e,h),c};if(Array.isArray(i)){if(i.length>s.length)console.error("THREE.TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),i.length=s.length;else if(i.length<s.length)for(console.error("THREE.TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.");i.length<s.length;)i.push(Li(0));for(let o=0;o<i.length;o++)t.push(n(i[o],s[o]))}else for(let o of s){let l=i[o.name];l===void 0?(console.error(`THREE.TSL: Input '${o.name}' not found in 'Fn()'.`),t.push(n(Li(0),o))):t.push(n(l,o))}return`${r.build(e,"property")}( ${t.join(", ")} )`}};const xit=(e,...t)=>(t=t.length>1||t[0]&&t[0].isNode===!0?tp(t):_m(t[0]),xt(new yit(xt(e),t)));W("call",xit);var bit=class extends Qe{static get type(){return"ConditionalNode"}constructor(e,t,r=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=r}getNodeType(e){let{ifNode:t,elseNode:r}=e.getNodeProperties(this);if(t===void 0)return this.setup(e),this.getNodeType(e);let s=t.getNodeType(e);if(r!==null){let i=r.getNodeType(e);if(e.getTypeLength(i)>e.getTypeLength(s))return i}return s}setup(e){let t=this.condNode.cache(),r=this.ifNode.cache(),s=this.elseNode?this.elseNode.cache():null,i=e.context.nodeBlock;e.getDataFromNode(r).parentNodeBlock=i,s!==null&&(e.getDataFromNode(s).parentNodeBlock=i);let n=e.getNodeProperties(this);n.condNode=t,n.ifNode=r.context({nodeBlock:r}),n.elseNode=s?s.context({nodeBlock:s}):null}generate(e,t){let r=this.getNodeType(e),s=e.getDataFromNode(this);if(s.nodeProperty!==void 0)return s.nodeProperty;let{condNode:i,ifNode:n,elseNode:a}=e.getNodeProperties(this),o=e.currentFunctionNode,l=t!=="void",h=l?mit(r).build(e):"";s.nodeProperty=h;let u=i.build(e,"bool");e.addFlowCode(`
150
+ */y.BRDF_GGX;y.BRDF_Lambert;y.BasicShadowFilter;y.Break;y.Continue;y.DFGApprox;y.D_GGX;y.Discard;y.EPSILON;y.F_Schlick;y.Fn;y.INFINITY;y.If;y.Switch;y.Loop;y.NodeShaderStage;y.NodeType;y.NodeUpdateType;y.NodeAccess;y.PCFShadowFilter;y.PCFSoftShadowFilter;y.PI;y.PI2;y.Return;y.Schlick_to_F0;y.ScriptableNodeResources;y.ShaderNode;y.TBNViewMatrix;y.VSMShadowFilter;y.V_GGX_SmithCorrelated;y.abs;y.acesFilmicToneMapping;y.acos;y.add;y.addNodeElement;y.agxToneMapping;y.all;y.alphaT;y.and;y.anisotropy;y.anisotropyB;y.anisotropyT;y.any;y.append;y.array;y.arrayBuffer;y.asin;y.assign;y.atan;y.atan2;y.atomicAdd;y.atomicAnd;y.atomicFunc;y.atomicMax;y.atomicMin;y.atomicOr;y.atomicStore;y.atomicSub;y.atomicXor;y.atomicLoad;y.attenuationColor;y.attenuationDistance;y.attribute;y.attributeArray;y.backgroundBlurriness;y.backgroundIntensity;y.backgroundRotation;y.batch;y.billboarding;y.bitAnd;y.bitNot;y.bitOr;y.bitXor;y.bitangentGeometry;y.bitangentLocal;y.bitangentView;y.bitangentWorld;y.bitcast;y.blendBurn;y.blendColor;y.blendDodge;y.blendOverlay;y.blendScreen;y.blur;y.bool;y.buffer;y.bufferAttribute;y.bumpMap;y.burn;y.bvec2;y.bvec3;y.bvec4;y.bypass;y.cache;y.call;y.cameraFar;y.cameraIndex;y.cameraNear;y.cameraNormalMatrix;y.cameraPosition;y.cameraProjectionMatrix;y.cameraProjectionMatrixInverse;y.cameraViewMatrix;y.cameraWorldMatrix;y.cbrt;y.cdl;y.ceil;y.checker;y.cineonToneMapping;y.clamp;y.clearcoat;y.clearcoatRoughness;y.code;y.color;y.colorSpaceToWorking;y.colorToDirection;y.compute;y.computeSkinning;y.cond;y.Const;y.context;y.convert;y.convertColorSpace;y.convertToTexture;y.cos;y.cross;y.cubeTexture;y.dFdx;y.dFdy;y.dashSize;y.debug;y.decrement;y.decrementBefore;y.defaultBuildStages;y.defaultShaderStages;y.defined;y.degrees;y.deltaTime;y.densityFog;y.densityFogFactor;y.depth;y.depthPass;y.difference;y.diffuseColor;y.directPointLight;y.directionToColor;y.dispersion;y.distance;y.div;y.dodge;y.dot;y.drawIndex;y.dynamicBufferAttribute;y.element;y.emissive;y.equal;y.equals;y.equirectUV;y.exp;y.exp2;y.expression;y.faceDirection;y.faceForward;y.faceforward;y.float;y.floor;y.fog;y.fract;y.frameGroup;y.frameId;y.frontFacing;y.fwidth;y.gain;y.gapSize;y.getConstNodeType;y.getCurrentStack;y.getDirection;y.getDistanceAttenuation;y.getGeometryRoughness;y.getNormalFromDepth;y.getParallaxCorrectNormal;y.getRoughness;y.getScreenPosition;y.getShIrradianceAt;y.getTextureIndex;y.getViewPosition;y.getShadowMaterial;y.getShadowRenderObjectFunction;y.glsl;y.glslFn;y.grayscale;y.greaterThan;y.greaterThanEqual;y.hash;y.highpModelNormalViewMatrix;y.highpModelViewMatrix;y.hue;y.increment;y.incrementBefore;y.instance;y.instanceIndex;y.instancedArray;y.instancedBufferAttribute;y.instancedDynamicBufferAttribute;y.instancedMesh;y.int;y.inverseSqrt;y.inversesqrt;y.invocationLocalIndex;y.invocationSubgroupIndex;y.ior;y.iridescence;y.iridescenceIOR;y.iridescenceThickness;y.ivec2;y.ivec3;y.ivec4;y.js;y.label;y.length;y.lengthSq;y.lessThan;y.lessThanEqual;y.lightPosition;y.lightShadowMatrix;y.lightTargetDirection;y.lightTargetPosition;y.lightViewPosition;y.lightingContext;y.lights;y.linearDepth;y.linearToneMapping;y.localId;y.globalId;y.log;y.log2;y.logarithmicDepthToViewZ;y.loop;y.luminance;y.mediumpModelViewMatrix;y.mat2;y.mat3;y.mat4;y.matcapUV;y.materialAO;y.materialAlphaTest;y.materialAnisotropy;y.materialAnisotropyVector;y.materialAttenuationColor;y.materialAttenuationDistance;y.materialClearcoat;y.materialClearcoatNormal;y.materialClearcoatRoughness;y.materialColor;y.materialDispersion;y.materialEmissive;y.materialIOR;y.materialIridescence;y.materialIridescenceIOR;y.materialIridescenceThickness;y.materialLightMap;y.materialLineDashOffset;y.materialLineDashSize;y.materialLineGapSize;y.materialLineScale;y.materialLineWidth;y.materialMetalness;y.materialNormal;y.materialOpacity;y.materialPointSize;y.materialReference;y.materialReflectivity;y.materialRefractionRatio;y.materialRotation;y.materialRoughness;y.materialSheen;y.materialSheenRoughness;y.materialShininess;y.materialSpecular;y.materialSpecularColor;y.materialSpecularIntensity;y.materialSpecularStrength;y.materialThickness;y.materialTransmission;y.max;y.maxMipLevel;y.metalness;y.min;y.mix;y.mixElement;y.mod;y.modInt;y.modelDirection;y.modelNormalMatrix;y.modelPosition;y.modelRadius;y.modelScale;y.modelViewMatrix;y.modelViewPosition;y.modelViewProjection;y.modelWorldMatrix;y.modelWorldMatrixInverse;y.morphReference;y.mrt;y.mul;y.mx_aastep;y.mx_cell_noise_float;y.mx_contrast;y.mx_fractal_noise_float;y.mx_fractal_noise_vec2;y.mx_fractal_noise_vec3;y.mx_fractal_noise_vec4;y.mx_hsvtorgb;y.mx_noise_float;y.mx_noise_vec3;y.mx_noise_vec4;y.mx_ramplr;y.mx_ramptb;y.mx_rgbtohsv;y.mx_safepower;y.mx_splitlr;y.mx_splittb;y.mx_srgb_texture_to_lin_rec709;y.mx_transform_uv;y.mx_worley_noise_float;y.mx_worley_noise_vec2;y.mx_worley_noise_vec3;y.namespace;y.negate;y.neutralToneMapping;y.nodeArray;y.nodeImmutable;y.nodeObject;y.nodeObjects;y.nodeProxy;y.normalFlat;y.normalGeometry;y.normalLocal;y.normalMap;y.normalView;y.normalWorld;y.normalize;y.not;y.notEqual;y.numWorkgroups;y.objectDirection;y.objectGroup;y.objectPosition;y.objectRadius;y.objectScale;y.objectViewPosition;y.objectWorldMatrix;y.oneMinus;y.or;y.orthographicDepthToViewZ;y.oscSawtooth;y.oscSine;y.oscSquare;y.oscTriangle;y.output;y.outputStruct;y.overlay;y.overloadingFn;y.parabola;y.parallaxDirection;y.parallaxUV;y.parameter;y.pass;y.passTexture;y.pcurve;y.perspectiveDepthToViewZ;y.pmremTexture;y.pointUV;y.pointWidth;y.positionGeometry;y.positionLocal;y.positionPrevious;y.positionView;y.positionViewDirection;y.positionWorld;y.positionWorldDirection;y.posterize;y.pow;y.pow2;y.pow3;y.pow4;y.premult;y.property;y.radians;y.rand;y.range;y.rangeFog;y.rangeFogFactor;y.reciprocal;y.lightProjectionUV;y.reference;y.referenceBuffer;y.reflect;y.reflectVector;y.reflectView;y.reflector;y.refract;y.refractVector;y.refractView;y.reinhardToneMapping;y.remainder;y.remap;y.remapClamp;y.renderGroup;y.renderOutput;y.rendererReference;y.rotate;y.rotateUV;y.roughness;y.round;y.rtt;y.sRGBTransferEOTF;y.sRGBTransferOETF;y.sampler;y.samplerComparison;y.saturate;y.saturation;y.screen;y.screenCoordinate;y.screenSize;y.screenUV;y.scriptable;y.scriptableValue;y.select;y.setCurrentStack;y.shaderStages;y.shadow;y.pointShadow;y.shadowPositionWorld;y.sharedUniformGroup;y.shapeCircle;y.sheen;y.sheenRoughness;y.shiftLeft;y.shiftRight;y.shininess;y.sign;y.sin;y.sinc;y.skinning;y.smoothstep;y.smoothstepElement;y.specularColor;y.specularF90;y.spherizeUV;y.split;y.spritesheetUV;y.sqrt;y.stack;y.step;y.storage;y.storageBarrier;y.storageObject;y.storageTexture;y.string;y.struct;y.sub;y.subgroupIndex;y.subgroupSize;y.tan;y.tangentGeometry;y.tangentLocal;y.tangentView;y.tangentWorld;y.temp;y.texture;y.texture3D;y.textureBarrier;y.textureBicubic;y.textureCubeUV;y.textureLoad;y.textureSize;y.textureStore;y.thickness;y.time;y.timerDelta;y.timerGlobal;y.timerLocal;y.toneMapping;y.toneMappingExposure;y.toonOutlinePass;y.transformDirection;y.transformNormal;y.transformNormalToView;y.transformedBentNormalView;y.transformedBitangentView;y.transformedBitangentWorld;y.transformedClearcoatNormalView;y.transformedNormalView;y.transformedNormalWorld;y.transformedTangentView;y.transformedTangentWorld;y.transmission;y.transpose;y.triNoise3D;y.triplanarTexture;y.triplanarTextures;y.trunc;y.tslFn;y.uint;y.uniform;y.uniformCubeTexture;y.uniformArray;y.uniformGroup;y.uniformTexture;y.uniforms;y.unpremult;y.userData;y.uv;y.uvec2;y.uvec3;y.uvec4;y.Var;y.varying;y.varyingProperty;y.vec2;y.vec3;const eK=y.vec4;y.vectorComponents;y.velocity;y.vertexColor;y.vertexIndex;y.vibrance;y.viewZToLogarithmicDepth;y.viewZToOrthographicDepth;y.viewZToPerspectiveDepth;y.viewport;y.viewportBottomLeft;y.viewportCoordinate;y.viewportDepthTexture;y.viewportLinearDepth;y.viewportMipTexture;y.viewportResolution;y.viewportSafeUV;y.viewportSharedTexture;y.viewportSize;y.viewportTexture;y.viewportTopLeft;y.viewportUV;y.wgsl;y.wgslFn;y.workgroupArray;y.workgroupBarrier;y.workgroupId;y.workingToColorSpace;y.xor;const Tt=z.createContext(null),rK=({children:e,hideNotice:t=!1,style:r={},className:s="",...i})=>{const n=z.useRef(null),a=z.useMemo(()=>"ombre-root-"+Math.random().toString(36).substring(7),[]),o=z.useRef(null);o.current===null&&(o.current=pe.shaderRenderer());const l=z.useMemo(()=>(f,x,b,v,T=null)=>{if(x===null){try{o.current.removeNode(f)}catch(_){console.warn("Error removing node:",_)}return}try{o.current.registerNode(f,x,b,v,T)}catch(_){console.error("Error registering node:",_,{id:f,parentId:b,metadata:v})}},[]),h=z.useMemo(()=>(f,x,b)=>{try{o.current.updateUniformValue(f,x,b)}catch(v){console.warn("Error updating uniform:",v)}},[]),u=z.useMemo(()=>(f,x)=>{try{o.current.updateNodeMetadata(f,x)}catch(b){console.warn("Error updating metadata:",b)}},[]),c=z.useMemo(()=>({ombreParentId:a,ombreNodeRegister:l,ombreUniformUpdate:h,ombreMetadataUpdate:u}),[a,l,h,u]),d=z.useRef(!1),p=z.useRef(!1);z.useEffect(()=>{if(d.current||p.current)return;const f=n.current;if(!f)return;p.current=!0;const x=o.current;return x.initialize({canvas:f}).then(()=>{x.registerNode(a,({childNode:b})=>b||eK(0,0,0,0),null,null,{}),d.current=!0,p.current=!1,t||x.showLicenseWarning()}).catch(b=>{console.error("[Shader] Initialization failed:",b),p.current=!1}),()=>{try{x.cleanup(),d.current=!1,p.current=!1,console.log("[Shader] Renderer cleaned up successfully")}catch(b){console.warn("[Shader] Error during cleanup:",b)}}},[a,t]);const m={...s===""?{width:"1200px",height:"800px"}:{},...typeof r=="object"?r:{}};return ae.jsx(Tt.Provider,{value:c,children:ae.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",...typeof r=="object"?r:{}},className:s,...i,children:[ae.jsx("canvas",{"data-renderer":"ombre",ref:n,style:m}),e]})})};function sK(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const sA={blendMode:"normal"};try{Sl&&Sl.props&&Object.entries(Sl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(sA[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const iK=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Sl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>sK(e,sA),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Sl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Sl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})};var yv=function(e){function t(n){"@babel/helpers - typeof";return t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},t(n)}function r(n,a){if(t(n)!="object"||!n)return n;var o=n[Symbol.toPrimitive];if(o!==void 0){var l=o.call(n,a);if(t(l)!="object")return l;throw TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(n)}function s(n){var a=r(n,"string");return t(a)=="symbol"?a:a+""}function i(n,a,o){return(a=s(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o,n}return e.defineProperty=i,e}({}),Un,Sd;function ye(e,t){let r=e.length;Array.isArray(e[0])||(e=[e]),Array.isArray(t[0])||(t=t.map(a=>[a]));let s=t[0].length,i=t[0].map((a,o)=>t.map(l=>l[o])),n=e.map(a=>i.map(o=>{let l=0;if(!Array.isArray(a)){for(let h of o)l+=a*h;return l}for(let h=0;h<a.length;h++)l+=a[h]*(o[h]||0);return l}));return r===1&&(n=n[0]),s===1?n.map(a=>a[0]):n}function pc(e){return la(e)==="string"}function la(e){return(Object.prototype.toString.call(e).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function Rp(e,{precision:t,unit:r}){return fa(e)?"none":iA(e,t)+(r??"")}function fa(e){return Number.isNaN(e)||e instanceof Number&&e?.none}function Xe(e){return fa(e)?0:e}function iA(e,t){if(e===0)return 0;let r=~~e,s=0;r&&t&&(s=~~Math.log10(Math.abs(r))+1);let i=10**(t-s);return Math.floor(e*i+.5)/i}const nK={deg:1,grad:.9,rad:180/Math.PI,turn:360};function nA(e){if(!e)return;e=e.trim();let t=/^([a-z]+)\((.+?)\)$/i,r=/^-?[\d.]+$/,s=/%|deg|g?rad|turn$/,i=/\/?\s*(none|[-\w.]+(?:%|deg|g?rad|turn)?)/g,n=e.match(t);if(n){let a=[];return n[2].replace(i,(o,l)=>{let h=l.match(s),u=l;if(h){let c=h[0],d=u.slice(0,-c.length);c==="%"?(u=new Number(d/100),u.type="<percentage>"):(u=new Number(d*nK[c]),u.type="<angle>",u.unit=c)}else r.test(u)?(u=new Number(u),u.type="<number>"):u==="none"&&(u=new Number(NaN),u.none=!0);o.startsWith("/")&&(u=u instanceof Number?u:new Number(u),u.alpha=!0),typeof u=="object"&&u instanceof Number&&(u.raw=l),a.push(u)}),{name:n[1].toLowerCase(),rawName:n[1],rawArgs:n[2],args:a}}}function aA(e){return e[e.length-1]}function Ch(e,t,r){return isNaN(e)?t:isNaN(t)?e:e+(t-e)*r}function oA(e,t,r){return(r-e)/(t-e)}function _x(e,t,r){return Ch(t[0],t[1],oA(e[0],e[1],r))}function lA(e){return e.map(t=>t.split("|").map(r=>{r=r.trim();let s=r.match(/^(<[a-z]+>)\[(-?[.\d]+),\s*(-?[.\d]+)\]?$/);if(s){let i=new String(s[1]);return i.range=[+s[2],+s[3]],i}return r}))}function uA(e,t,r){return Math.max(Math.min(r,t),e)}function Mm(e,t){return Math.sign(e)===Math.sign(t)?e:-e}function xi(e,t){return Mm(Math.abs(e)**t,e)}function Ax(e,t){return t===0?0:e/t}function hA(e,t,r=0,s=e.length){for(;r<s;){let i=r+s>>1;e[i]<t?r=i+1:s=i}return r}var aK=Object.freeze({__proto__:null,bisectLeft:hA,clamp:uA,copySign:Mm,interpolate:Ch,interpolateInv:oA,isNone:fa,isString:pc,last:aA,mapRange:_x,multiplyMatrices:ye,parseCoordGrammar:lA,parseFunction:nA,serializeNumber:Rp,skipNone:Xe,spow:xi,toPrecision:iA,type:la,zdiv:Ax}),oK=class{add(t,r,s){if(typeof arguments[0]!="string"){for(var t in arguments[0])this.add(t,arguments[0][t],arguments[1]);return}(Array.isArray(t)?t:[t]).forEach(function(i){this[i]=this[i]||[],r&&this[i][s?"unshift":"push"](r)},this)}run(t,r){this[t]=this[t]||[],this[t].forEach(function(s){s.call(r&&r.context?r.context:r,r)})}};const ga=new oK;var ps={gamut_mapping:"css",precision:5,deltaE:"76",verbose:((Un=globalThis)==null||(Un=Un.process)==null||(Un=Un.env)==null||(Un=Un.NODE_ENV)==null?void 0:Un.toLowerCase())!=="test",warn:function(e){var t,r;this.verbose&&((t=globalThis)==null||(t=t.console)==null||(r=t.warn)==null||r.call(t,e))}};const kr={D50:[.3457/.3585,1,.2958/.3585],D65:[.3127/.329,1,.3583/.329]};function sy(e){return Array.isArray(e)?e:kr[e]}function Ip(e,t,r,s={}){if(e=sy(e),t=sy(t),!e||!t)throw TypeError(`Missing white point to convert ${e?"":"from"}${!e&&!t?"/":""}${t?"":"to"}`);if(e===t)return r;let i={W1:e,W2:t,XYZ:r,options:s};if(ga.run("chromatic-adaptation-start",i),i.M||(i.W1===kr.D65&&i.W2===kr.D50?i.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:i.W1===kr.D50&&i.W2===kr.D65&&(i.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),ga.run("chromatic-adaptation-end",i),i.M)return ye(i.M,i.XYZ);throw TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}const lK=new Set(["<number>","<percentage>","<angle>"]);function xv(e,t,r,s){return Object.entries(e.coords).map(([n,a],o)=>{let l=t.coordGrammar[o],h=s[o],u=h?.type,c;if(c=h.none?l.find(m=>lK.has(m)):l.find(m=>m==u),!c){let m=a.name||n;throw TypeError(`${u??h.raw} not allowed for ${m} in ${r}()`)}let d=c.range;u==="<percentage>"&&(d||(d=[0,1]));let p=a.range||a.refRange;return d&&p&&(s[o]=_x(d,p,s[o])),c})}function cA(e,{meta:t}={}){let r={str:String(e)?.trim()};if(ga.run("parse-start",r),r.color)return r.color;if(r.parsed=nA(r.str),r.parsed){let i=r.parsed.name;if(i==="color"){let n=r.parsed.args.shift(),a=n.startsWith("--")?n.substring(2):`--${n}`,o=[n,a],l=r.parsed.rawArgs.indexOf("/")>0?r.parsed.args.pop():1;for(let c of pt.all){let d=c.getFormat("color");if(d&&(o.includes(d.id)||d.ids?.filter(p=>o.includes(p)).length)){let p=Object.keys(c.coords).map((f,x)=>r.parsed.args[x]||0),m;return d.coordGrammar&&(m=xv(c,d,"color",p)),t&&Object.assign(t,{formatId:"color",types:m}),d.id.startsWith("--")&&!n.startsWith("--")&&ps.warn(`${c.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${d.id}) instead of color(${n}).`),n.startsWith("--")&&!d.id.startsWith("--")&&ps.warn(`${c.name} is a standard space and supported in the CSS spec. Use color(${d.id}) instead of prefixed color(${n}).`),{spaceId:c.id,coords:p,alpha:l}}}let h="",u=n in pt.registry?n:a;if(u in pt.registry){var s;let c=(s=pt.registry[u].formats)==null||(s=s.color)==null?void 0:s.id;c&&(h=`Did you mean color(${c})?`)}throw TypeError(`Cannot parse color(${n}). `+(h||"Missing a plugin?"))}else for(let n of pt.all){let a=n.getFormat(i);if(a&&a.type==="function"){let o=1;(a.lastAlpha||aA(r.parsed.args).alpha)&&(o=r.parsed.args.pop());let l=r.parsed.args,h;return a.coordGrammar&&(h=xv(n,a,i,l)),t&&Object.assign(t,{formatId:a.name,types:h}),{spaceId:n.id,coords:l,alpha:o}}}}else for(let i of pt.all)for(let n in i.formats){let a=i.formats[n];if(a.type!=="custom"||a.test&&!a.test(r.str))continue;let o=a.parse(r.str);if(o)return o.alpha??(o.alpha=1),t&&(t.formatId=n),o}throw TypeError(`Could not parse ${e} as a color. Missing a plugin?`)}function zt(e){if(Array.isArray(e))return e.map(zt);if(!e)throw TypeError("Empty color reference");pc(e)&&(e=cA(e));let t=e.space||e.spaceId;return t instanceof pt||(e.space=pt.get(t)),e.alpha===void 0&&(e.alpha=1),e}const uK=75e-6;var pt=(Sd=class Gs{constructor(t){this.id=t.id,this.name=t.name,this.base=t.base?Gs.get(t.base):null,this.aliases=t.aliases,this.base&&(this.fromBase=t.fromBase,this.toBase=t.toBase);let r=t.coords??this.base.coords;for(let i in r)"name"in r[i]||(r[i].name=i);this.coords=r;let s=t.white??this.base.white??"D65";for(let i in this.white=sy(s),this.formats=t.formats??{},this.formats){let n=this.formats[i];n.type||(n.type="function"),n.name||(n.name=i)}this.formats.color?.id||(this.formats.color={...this.formats.color??{},id:t.cssId||this.id}),t.gamutSpace?this.gamutSpace=t.gamutSpace==="self"?this:Gs.get(t.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(i,n)=>!0),this.referred=t.referred,Object.defineProperty(this,"path",{value:hK(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),ga.run("colorspace-init-end",this)}inGamut(t,{epsilon:r=uK}={}){if(!this.equals(this.gamutSpace))return t=this.to(this.gamutSpace,t),this.gamutSpace.inGamut(t,{epsilon:r});let s=Object.values(this.coords);return t.every((i,n)=>{let a=s[n];if(a.type!=="angle"&&a.range){if(Number.isNaN(i))return!0;let[o,l]=a.range;return(o===void 0||i>=o-r)&&(l===void 0||i<=l+r)}return!0})}get isUnbounded(){return Object.values(this.coords).every(t=>!("range"in t))}get cssId(){var t;return((t=this.formats)==null||(t=t.color)==null?void 0:t.id)||this.id}get isPolar(){for(let t in this.coords)if(this.coords[t].type==="angle")return!0;return!1}getFormat(t){if(typeof t=="object")return t=bv(t,this),t;let r;return r=t==="default"?Object.values(this.formats)[0]:this.formats[t],r?(r=bv(r,this),r):null}equals(t){return t?this===t||this.id===t||this.id===t.id:!1}to(t,r){if(arguments.length===1){let o=zt(t);[t,r]=[o.space,o.coords]}if(t=Gs.get(t),this.equals(t))return r;r=r.map(o=>Number.isNaN(o)?0:o);let s=this.path,i=t.path,n,a;for(let o=0;o<s.length&&s[o].equals(i[o]);o++)n=s[o],a=o;if(!n)throw Error(`Cannot convert between color spaces ${this} and ${t}: no connection space was found`);for(let o=s.length-1;o>a;o--)r=s[o].toBase(r);for(let o=a+1;o<i.length;o++)r=i[o].fromBase(r);return r}from(t,r){if(arguments.length===1){let s=zt(t);[t,r]=[s.space,s.coords]}return t=Gs.get(t),t.to(this,r)}toString(){return`${this.name} (${this.id})`}getMinCoords(){let t=[];for(let r in this.coords){let s=this.coords[r],i=s.range||s.refRange;t.push(i?.min??0)}return t}static get all(){return[...new Set(Object.values(Gs.registry))]}static register(t,r){if(arguments.length===1&&(r=arguments[0],t=r.id),r=this.get(r),this.registry[t]&&this.registry[t]!==r)throw Error(`Duplicate color space registration: '${t}'`);if(this.registry[t]=r,arguments.length===1&&r.aliases)for(let s of r.aliases)this.register(s,r);return r}static get(t,...r){if(!t||t instanceof Gs)return t;if(la(t)==="string"){let i=Gs.registry[t.toLowerCase()];if(!i)throw TypeError(`No color space found with id = "${t}"`);return i}if(r.length)return Gs.get(...r);throw TypeError(`${t} is not a valid color space`)}static resolveCoord(t,r){let s=la(t),i,n;if(s==="string"?t.includes(".")?[i,n]=t.split("."):[i,n]=[,t]:Array.isArray(t)?[i,n]=t:(i=t.space,n=t.coordId),i=Gs.get(i),i||(i=r),!i)throw TypeError(`Cannot resolve coordinate reference ${t}: No color space specified and relative references are not allowed here`);if(s=la(n),s==="number"||s==="string"&&n>=0){let l=Object.entries(i.coords)[n];if(l)return{space:i,id:l[0],index:n,...l[1]}}i=Gs.get(i);let a=n.toLowerCase(),o=0;for(let l in i.coords){let h=i.coords[l];if(l.toLowerCase()===a||h.name?.toLowerCase()===a)return{space:i,id:l,index:o,...h};o++}throw TypeError(`No "${n}" coordinate found in ${i.name}. Its coordinates are: ${Object.keys(i.coords).join(", ")}`)}},yv.defineProperty(Sd,"registry",{}),yv.defineProperty(Sd,"DEFAULT_FORMAT",{type:"functions",name:"color"}),Sd);function hK(e){let t=[e];for(let r=e;r=r.base;)t.push(r);return t}function bv(e,{coords:t}={}){if(e.coords&&!e.coordGrammar){e.type||(e.type="function"),e.name||(e.name="color"),e.coordGrammar=lA(e.coords);let r=Object.entries(t).map(([s,i],n)=>{let a=e.coordGrammar[n][0],o=i.range||i.refRange,l=a.range,h="";return a=="<percentage>"?(l=[0,100],h="%"):a=="<angle>"&&(h="deg"),{fromRange:o,toRange:l,suffix:h}});e.serializeCoords=(s,i)=>s.map((n,a)=>{let{fromRange:o,toRange:l,suffix:h}=r[a];return o&&l&&(n=_x(o,l,n)),n=Rp(n,{precision:i,unit:h}),n})}return e}var vr=new pt({id:"xyz-d65",name:"XYZ D65",coords:{x:{name:"X"},y:{name:"Y"},z:{name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]}),Xr=class extends pt{constructor(t){t.coords||(t.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),t.base||(t.base=vr),t.toXYZ_M&&t.fromXYZ_M&&(t.toBase??(t.toBase=r=>{let s=ye(t.toXYZ_M,r);return this.white!==this.base.white&&(s=Ip(this.white,this.base.white,s)),s}),t.fromBase??(t.fromBase=r=>(r=Ip(this.base.white,this.white,r),ye(t.fromXYZ_M,r)))),t.referred??(t.referred="display"),super(t)}};function mc(e,t){return e=zt(e),!t||e.space.equals(t)?e.coords.slice():(t=pt.get(t),t.from(e))}function us(e,t){e=zt(e);let{space:r,index:s}=pt.resolveCoord(t,e.space);return mc(e,r)[s]}function Cx(e,t,r){return e=zt(e),t=pt.get(t),e.coords=t.to(e.space,r),e}Cx.returns="color";function wn(e,t,r){if(e=zt(e),arguments.length===2&&la(arguments[1])==="object"){let s=arguments[1];for(let i in s)wn(e,i,s[i])}else{typeof r=="function"&&(r=r(us(e,t)));let{space:s,index:i}=pt.resolveCoord(t,e.space),n=mc(e,s);n[i]=r,Cx(e,s,n)}return e}wn.returns="color";var zx=new pt({id:"xyz-d50",name:"XYZ D50",white:"D50",base:vr,fromBase:e=>Ip(vr.white,"D50",e),toBase:e=>Ip("D50",vr.white,e)});const cK=216/24389,vv=24/116,_d=24389/27;let sg=kr.D50;var hs=new pt({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:sg,base:zx,fromBase(e){let t=e.map((s,i)=>s/sg[i]),r=t.map(s=>s>cK?Math.cbrt(s):(_d*s+16)/116);return[116*r[1]-16,500*(r[0]-r[1]),200*(r[1]-r[2])]},toBase(e){let t=[];return t[1]=(e[0]+16)/116,t[0]=e[1]/500+t[1],t[2]=t[1]-e[2]/200,[t[0]>vv?t[0]**3:(116*t[0]-16)/_d,e[0]>8?((e[0]+16)/116)**3:e[0]/_d,t[2]>vv?t[2]**3:(116*t[2]-16)/_d].map((s,i)=>s*sg[i])},formats:{lab:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function Di(e){return(e%360+360)%360}function dK(e,t){if(e==="raw")return t;let[r,s]=t.map(Di),i=s-r;return e==="increasing"?i<0&&(s+=360):e==="decreasing"?i>0&&(r+=360):e==="longer"?-180<i&&i<180&&(i>0?r+=360:s+=360):e==="shorter"&&(i>180?r+=360:i<-180&&(s+=360)),[r,s]}var zh=new pt({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:hs,fromBase(e){let[t,r,s]=e,i,n=.02;return i=Math.abs(r)<n&&Math.abs(s)<n?NaN:Math.atan2(s,r)*180/Math.PI,[t,Math.sqrt(r**2+s**2),Di(i)]},toBase(e){let[t,r,s]=e;return r<0&&(r=0),isNaN(s)&&(s=0),[t,r*Math.cos(s*Math.PI/180),r*Math.sin(s*Math.PI/180)]},formats:{lch:{coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}});const Mv=25**7,Lp=Math.PI,wv=180/Lp,el=Lp/180;function Tv(e){let t=e*e;return t*t*t*e}function dA(e,t,{kL:r=1,kC:s=1,kH:i=1}={}){[e,t]=zt([e,t]);let[n,a,o]=hs.from(e),l=zh.from(hs,[n,a,o])[1],[h,u,c]=hs.from(t),d=zh.from(hs,[h,u,c])[1];l<0&&(l=0),d<0&&(d=0);let p=(l+d)/2,m=Tv(p),f=.5*(1-Math.sqrt(m/(m+Mv))),x=(1+f)*a,b=(1+f)*u,v=Math.sqrt(x**2+o**2),T=Math.sqrt(b**2+c**2),_=x===0&&o===0?0:Math.atan2(o,x),E=b===0&&c===0?0:Math.atan2(c,b);_<0&&(_+=2*Lp),E<0&&(E+=2*Lp),_*=wv,E*=wv;let C=h-n,A=T-v,I=E-_,Q=_+E,ot=Math.abs(I),K;v*T===0?K=0:ot<=180?K=I:I>180?K=I-360:I<-180?K=I+360:ps.warn("the unthinkable has happened");let mt=2*Math.sqrt(T*v)*Math.sin(K*el/2),nt=(n+h)/2,yt=(v+T)/2,lt=Tv(yt),Nt;Nt=v*T===0?Q:ot<=180?Q/2:Q<360?(Q+360)/2:(Q-360)/2;let ht=(nt-50)**2,Mt=1+.015*ht/Math.sqrt(20+ht),ut=1+.045*yt,at=1;at-=.17*Math.cos((Nt-30)*el),at+=.24*Math.cos(2*Nt*el),at+=.32*Math.cos((3*Nt+6)*el),at-=.2*Math.cos((4*Nt-63)*el);let gt=1+.015*yt*at,Ot=30*Math.exp(-1*((Nt-275)/25)**2),jt=2*Math.sqrt(lt/(lt+Mv)),be=-1*Math.sin(2*Ot*el)*jt,se=(C/(r*Mt))**2;return se+=(A/(s*ut))**2,se+=(mt/(i*gt))**2,se+=be*(A/(s*ut))*(mt/(i*gt)),Math.sqrt(se)}const pK=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],mK=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],fK=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],gK=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]];var ou=new pt({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:vr,fromBase(e){let t=ye(pK,e),r=t.map(s=>Math.cbrt(s));return ye(fK,r)},toBase(e){let t=ye(gK,e),r=t.map(s=>s**3);return ye(mK,r)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function iy(e,t){[e,t]=zt([e,t]);let[r,s,i]=ou.from(e),[n,a,o]=ou.from(t),l=r-n,h=s-a,u=i-o;return Math.sqrt(l**2+h**2+u**2)}const yK=75e-6;function Ka(e,t,{epsilon:r=yK}={}){e=zt(e),t||(t=e.space),t=pt.get(t);let s=e.coords;return t!==e.space&&(s=t.from(e)),t.inGamut(s,{epsilon:r})}function lu(e){return{space:e.space,coords:e.coords.slice(),alpha:e.alpha}}function pA(e,t,r="lab"){r=pt.get(r);let s=r.from(e),i=r.from(t);return Math.sqrt(s.reduce((n,a,o)=>{let l=i[o];return isNaN(a)||isNaN(l)?n:n+(l-a)**2},0))}function xK(e,t){return pA(e,t,"lab")}const bK=Math.PI,Nv=bK/180;function vK(e,t,{l:r=2,c:s=1}={}){[e,t]=zt([e,t]);let[i,n,a]=hs.from(e),[,o,l]=zh.from(hs,[i,n,a]),[h,u,c]=hs.from(t),d=zh.from(hs,[h,u,c])[1];o<0&&(o=0),d<0&&(d=0);let p=i-h,m=o-d,f=n-u,x=a-c,b=f**2+x**2-m**2,v=.511;i>=16&&(v=.040975*i/(1+.01765*i));let T=.0638*o/(1+.0131*o)+.638,_;Number.isNaN(l)&&(l=0),_=l>=164&&l<=345?.56+Math.abs(.2*Math.cos((l+168)*Nv)):.36+Math.abs(.4*Math.cos((l+35)*Nv));let E=o**4,C=Math.sqrt(E/(E+1900)),A=T*(C*_+1-C),I=(p/(r*v))**2;return I+=(m/(s*T))**2,I+=b/A**2,Math.sqrt(I)}const Sv=203;var Ex=new pt({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:vr,fromBase(e){return e.map(t=>Math.max(t*Sv,0))},toBase(e){return e.map(t=>Math.max(t/Sv,0))}});const Ad=1.15,Cd=.66,_v=2610/2**14,MK=2**14/2610,Av=3424/2**12,Cv=2413/2**7,zv=2392/2**7,wK=1.7*2523/2**5,Ev=2**5/(1.7*2523),zd=-.56,ig=16295499532821565e-27,TK=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],NK=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],SK=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],_K=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]];var mA=new pt({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:Ex,fromBase(e){let[t,r,s]=e,i=Ad*t-(Ad-1)*s,n=Cd*r-(Cd-1)*t,a=ye(TK,[i,n,s]),o=a.map(function(d){let p=Av+Cv*(d/1e4)**_v,m=1+zv*(d/1e4)**_v;return(p/m)**wK}),[l,h,u]=ye(SK,o);return[(1+zd)*l/(1+zd*l)-ig,h,u]},toBase(e){let[t,r,s]=e,i=(t+ig)/(1+zd-zd*(t+ig)),n=ye(_K,[i,r,s]),a=n.map(function(d){let p=Av-d**Ev,m=zv*d**Ev-Cv;return 1e4*(p/m)**MK}),[o,l,h]=ye(NK,a),u=(o+(Ad-1)*h)/Ad,c=(l+(Cd-1)*u)/Cd;return[u,c,h]},formats:{color:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),ny=new pt({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,1],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:mA,fromBase(e){let[t,r,s]=e,i,n=2e-4;return i=Math.abs(r)<n&&Math.abs(s)<n?NaN:Math.atan2(s,r)*180/Math.PI,[t,Math.sqrt(r**2+s**2),Di(i)]},toBase(e){return[e[0],e[1]*Math.cos(e[2]*Math.PI/180),e[1]*Math.sin(e[2]*Math.PI/180)]}});function AK(e,t){[e,t]=zt([e,t]);let[r,s,i]=ny.from(e),[n,a,o]=ny.from(t),l=r-n,h=s-a;Number.isNaN(i)&&Number.isNaN(o)?(i=0,o=0):Number.isNaN(i)?i=o:Number.isNaN(o)&&(o=i);let u=i-o,c=2*Math.sqrt(s*a)*Math.sin(u/2*(Math.PI/180));return Math.sqrt(l**2+h**2+c**2)}const fA=3424/4096,gA=2413/128,yA=2392/128,Vv=2610/16384,CK=2523/32,zK=16384/2610,Rv=32/2523,EK=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],VK=[[2048/4096,2048/4096,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],RK=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],IK=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]];var ay=new pt({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:Ex,fromBase(e){let t=ye(EK,e);return LK(t)},toBase(e){let t=PK(e);return ye(IK,t)}});function LK(e){let t=e.map(function(r){let s=fA+gA*(r/1e4)**Vv,i=1+yA*(r/1e4)**Vv;return(s/i)**CK});return ye(VK,t)}function PK(e){return ye(RK,e).map(function(s){let i=Math.max(s**Rv-fA,0),n=gA-yA*s**Rv;return 1e4*(i/n)**zK})}function FK(e,t){[e,t]=zt([e,t]);let[r,s,i]=ay.from(e),[n,a,o]=ay.from(t);return 720*Math.sqrt((r-n)**2+.25*(s-a)**2+(i-o)**2)}const OK=kr.D65,xA=.42,Iv=1/xA,ng=2*Math.PI,bA=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],kK=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],BK=[[460,451,288],[460,-891,-261],[460,-220,-6300]],DK={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},ja={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},UK=180/Math.PI,Lv=Math.PI/180;function vA(e,t){return e.map(s=>{let i=xi(t*Math.abs(s)*.01,xA);return 400*Mm(i,s)/(i+27.13)})}function $K(e,t){let r=100/t*27.13**Iv;return e.map(s=>{let i=Math.abs(s);return Mm(r*xi(i/(400-i),Iv),s)})}function jK(e){let t=Di(e);t<=ja.h[0]&&(t+=360);let r=hA(ja.h,t)-1,[s,i]=ja.h.slice(r,r+2),[n,a]=ja.e.slice(r,r+2),o=ja.H[r],l=(t-s)/n;return o+100*l/(l+(i-t)/a)}function WK(e){let t=(e%400+400)%400,r=Math.floor(.01*t);t%=100;let[s,i]=ja.h.slice(r,r+2),[n,a]=ja.e.slice(r,r+2);return Di((t*(a*s-n*i)-100*s*a)/(t*(a-n)-100*a))}function MA(e,t,r,s,i){let n={};n.discounting=i,n.refWhite=e,n.surround=s;let a=e.map(f=>f*100);n.la=t,n.yb=r;let o=a[1],l=ye(bA,a);s=DK[n.surround];let h=s[0];n.c=s[1],n.nc=s[2];let u=1/(5*n.la+1),c=u**4;n.fl=c*n.la+.1*(1-c)*(1-c)*Math.cbrt(5*n.la),n.flRoot=n.fl**.25,n.n=n.yb/o,n.z=1.48+Math.sqrt(n.n),n.nbb=.725*n.n**-.2,n.ncb=n.nbb;let d=Math.max(Math.min(h*(1-1/3.6*Math.exp((-n.la-42)/92)),1),0);n.dRgb=l.map(f=>Ch(1,o/f,d)),n.dRgbInv=n.dRgb.map(f=>1/f);let p=l.map((f,x)=>f*n.dRgb[x]),m=vA(p,n.fl);return n.aW=n.nbb*(2*m[0]+m[1]+.05*m[2]),n}const Pv=MA(OK,64/Math.PI*.2,20,"average",!1);function oy(e,t){if(!(e.J!==void 0^e.Q!==void 0))throw Error("Conversion requires one and only one: 'J' or 'Q'");if(!(e.C!==void 0^e.M!==void 0^e.s!==void 0))throw Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(e.h!==void 0^e.H!==void 0))throw Error("Conversion requires one and only one: 'h' or 'H'");if(e.J===0||e.Q===0)return[0,0,0];let r=0;r=e.h===void 0?WK(e.H)*Lv:Di(e.h)*Lv;let s=Math.cos(r),i=Math.sin(r),n=0;e.J===void 0?e.Q!==void 0&&(n=.25*t.c*e.Q/((t.aW+4)*t.flRoot)):n=xi(e.J,1/2)*.1;let a=0;e.C===void 0?e.M===void 0?e.s!==void 0&&(a=4e-4*e.s**2*(t.aW+4)/t.c):a=e.M/t.flRoot/n:a=e.C/n;let o=xi(a*(1.64-.29**t.n)**-.73,10/9),l=.25*(Math.cos(r+2)+3.8),h=t.aW*xi(n,2/t.c/t.z),u=5e4/13*t.nc*t.ncb*l,c=h/t.nbb,d=23*(c+.305)*Ax(o,23*u+o*(11*s+108*i)),p=d*s,m=d*i,f=$K(ye(BK,[c,p,m]).map(x=>x*1/1403),t.fl);return ye(kK,f.map((x,b)=>x*t.dRgbInv[b])).map(x=>x/100)}function wA(e,t){let r=e.map(T=>T*100),s=vA(ye(bA,r).map((T,_)=>T*t.dRgb[_]),t.fl),i=s[0]+(-12*s[1]+s[2])/11,n=(s[0]+s[1]-2*s[2])/9,a=(Math.atan2(n,i)%ng+ng)%ng,o=.25*(Math.cos(a+2)+3.8),l=5e4/13*t.nc*t.ncb*Ax(o*Math.sqrt(i**2+n**2),s[0]+s[1]+1.05*s[2]+.305),h=xi(l,.9)*(1.64-.29**t.n)**.73,u=t.nbb*(2*s[0]+s[1]+.05*s[2]),c=xi(u/t.aW,.5*t.c*t.z),d=100*xi(c,2),p=4/t.c*c*(t.aW+4)*t.flRoot,m=h*c,f=m*t.flRoot,x=Di(a*UK),b=jK(x),v=50*xi(t.c*h/(t.aW+4),1/2);return{J:d,C:m,h:x,s:v,Q:p,M:f,H:b}}var qK=new pt({id:"cam16-jmh",cssId:"--cam16-jmh",name:"CAM16-JMh",coords:{j:{refRange:[0,100],name:"J"},m:{refRange:[0,105],name:"Colorfulness"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:vr,fromBase(e){let t=wA(e,Pv);return[t.J,t.M,t.h]},toBase(e){return oy({J:e[0],M:e[1],h:e[2]},Pv)}});const HK=kr.D65,GK=216/24389,TA=24389/27;function XK(e){return 116*(e>GK?Math.cbrt(e):(TA*e+16)/116)-16}function ly(e){return e>8?((e+16)/116)**3:e/TA}function YK(e,t){let[r,s,i]=e,n=[],a=0;if(i===0)return[0,0,0];let o=ly(i);a=i>0?.00379058511492914*i**2+.608983189401032*i+.9155088574762233:9514440756550361e-21*i**2+.08693057439788597*i-21.928975842194614;let l=2e-12,h=15,u=0,c=1/0;for(;u<=h;){n=oy({J:a,C:s,h:r},t);let d=Math.abs(n[1]-o);if(d<c){if(d<=l)return n;c=d}a-=(n[1]-o)*a/(2*n[1]),u+=1}return oy({J:a,C:s,h:r},t)}function ZK(e,t){let r=XK(e[1]);if(r===0)return[0,0,0];let s=wA(e,Vx);return[Di(s.h),s.C,r]}const Vx=MA(HK,200/Math.PI*ly(50),ly(50)*100,"average",!1);var Eh=new pt({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:vr,fromBase(e){return ZK(e)},toBase(e){return YK(e,Vx)},formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const JK=Math.PI/180,Fv=[1,.007,.0228];function Ov(e){e[1]<0&&(e=Eh.fromBase(Eh.toBase(e)));let t=Math.log(Math.max(1+Fv[2]*e[1]*Vx.flRoot,1))/Fv[2],r=e[0]*JK,s=t*Math.cos(r),i=t*Math.sin(r);return[e[2],s,i]}function QK(e,t){[e,t]=zt([e,t]);let[r,s,i]=Ov(Eh.from(e)),[n,a,o]=Ov(Eh.from(t));return Math.sqrt((r-n)**2+(s-a)**2+(i-o)**2)}var uu={deltaE76:xK,deltaECMC:vK,deltaE2000:dA,deltaEJz:AK,deltaEITP:FK,deltaEOK:iy,deltaEHCT:QK};function KK(e){let t=e?Math.floor(Math.log10(Math.abs(e))):0;return Math.max(parseFloat(`1e${t-2}`),1e-6)}const kv={hct:{method:"hct.c",jnd:2,deltaEMethod:"hct",blackWhiteClamp:{}},"hct-tonal":{method:"hct.c",jnd:0,deltaEMethod:"hct",blackWhiteClamp:{channel:"hct.t",min:0,max:100}}};function ya(e,{method:t=ps.gamut_mapping,space:r=void 0,deltaEMethod:s="",jnd:i=2,blackWhiteClamp:n={}}={}){if(e=zt(e),pc(arguments[1])?r=arguments[1]:r||(r=e.space),r=pt.get(r),Ka(e,r,{epsilon:0}))return e;let a;if(t==="css")a=ttt(e,{space:r});else{if(t!=="clip"&&!Ka(e,r)){Object.prototype.hasOwnProperty.call(kv,t)&&({method:t,jnd:i,deltaEMethod:s,blackWhiteClamp:n}=kv[t]);let o=dA;if(s!==""){for(let h in uu)if("deltae"+s.toLowerCase()===h.toLowerCase()){o=uu[h];break}}let l=ya(ge(e,r),{method:"clip",space:r});if(o(e,l)>i){if(Object.keys(n).length===3){let v=pt.resolveCoord(n.channel),T=us(ge(e,v.space),v.id);if(fa(T)&&(T=0),T>=n.max)return ge({space:"xyz-d65",coords:kr.D65},e.space);if(T<=n.min)return ge({space:"xyz-d65",coords:[0,0,0]},e.space)}let h=pt.resolveCoord(t),u=h.space,c=h.id,d=ge(e,u);d.coords.forEach((v,T)=>{fa(v)&&(d.coords[T]=0)});let p=h.range||h.refRange,m=p[0],f=KK(i),x=m,b=us(d,c);for(;b-x>f;){let v=lu(d);v=ya(v,{space:r,method:"clip"}),o(d,v)-i<f?x=us(d,c):b=us(d,c),wn(d,c,(x+b)/2)}a=ge(d,r)}else a=l}else a=ge(e,r);if(t==="clip"||!Ka(a,r,{epsilon:0})){let o=Object.values(r.coords).map(l=>l.range||[]);a.coords=a.coords.map((l,h)=>{let[u,c]=o[h];return u!==void 0&&(l=Math.max(u,l)),c!==void 0&&(l=Math.min(l,c)),l})}}return r!==e.space&&(a=ge(a,e.space)),e.coords=a.coords,e}ya.returns="color";const Bv={WHITE:{space:ou,coords:[1,0,0]},BLACK:{space:ou,coords:[0,0,0]}};function ttt(e,{space:t}={}){let r=.02,s=1e-4;e=zt(e),t||(t=e.space),t=pt.get(t);let i=pt.get("oklch");if(t.isUnbounded)return ge(e,t);let n=ge(e,i),a=n.coords[0];if(a>=1){let m=ge(Bv.WHITE,t);return m.alpha=e.alpha,ge(m,t)}if(a<=0){let m=ge(Bv.BLACK,t);return m.alpha=e.alpha,ge(m,t)}if(Ka(n,t,{epsilon:0}))return ge(n,t);function o(m){let f=ge(m,t),x=Object.values(t.coords);return f.coords=f.coords.map((b,v)=>{if("range"in x[v]){let[T,_]=x[v].range;return uA(T,b,_)}return b}),f}let l=0,h=n.coords[1],u=!0,c=lu(n),d=o(c),p=iy(d,c);if(p<r)return d;for(;h-l>s;){let m=(l+h)/2;if(c.coords[1]=m,u&&Ka(c,t,{epsilon:0}))l=m;else if(d=o(c),p=iy(d,c),p<r){if(r-p<s)break;u=!1,l=m}else h=m}return d}function ge(e,t,{inGamut:r}={}){e=zt(e),t=pt.get(t);let s=t.from(e),i={space:t,coords:s,alpha:e.alpha};return r&&(i=ya(i,r===!0?void 0:r)),i}ge.returns="color";function dh(e,{precision:t=ps.precision,format:r="default",inGamut:s=!0,...i}={}){let n;e=zt(e);let a=r;r=e.space.getFormat(r)??e.space.getFormat("default")??pt.DEFAULT_FORMAT;let o=e.coords.slice();if(s||(s=r.toGamut),s&&!Ka(e)&&(o=ya(lu(e),s===!0?void 0:s).coords),r.type==="custom")if(i.precision=t,r.serialize)n=r.serialize(o,e.alpha,i);else throw TypeError(`format ${a} can only be used to parse colors, not for serialization`);else{let l=r.name||"color";r.serializeCoords?o=r.serializeCoords(o,t):t!==null&&(o=o.map(d=>Rp(d,{precision:t})));let h=[...o];if(l==="color"){let d=r.id||r.ids?.[0]||e.space.id;h.unshift(d)}let u=e.alpha;t!==null&&(u=Rp(u,{precision:t}));let c=e.alpha>=1||r.noAlpha?"":`${r.commas?",":" /"} ${u}`;n=`${l}(${h.join(r.commas?", ":" ")}${c})`}return n}const ett=[[.6369580483012914,.14461690358620832,.1688809751641721],[.2627002120112671,.6779980715188708,.05930171646986196],[0,.028072693049087428,1.060985057710791]],rtt=[[1.716651187971268,-.355670783776392,-.25336628137366],[-.666684351832489,1.616481236634939,.0157685458139111],[.017639857445311,-.042770613257809,.942103121235474]];var wm=new Xr({id:"rec2020-linear",cssId:"--rec2020-linear",name:"Linear REC.2020",white:"D65",toXYZ_M:ett,fromXYZ_M:rtt});const Ed=1.09929682680944,Dv=.018053968510807;var NA=new Xr({id:"rec2020",name:"REC.2020",base:wm,toBase(e){return e.map(function(t){return t<Dv*4.5?t/4.5:((t+Ed-1)/Ed)**(1/.45)})},fromBase(e){return e.map(function(t){return t>=Dv?Ed*t**.45-(Ed-1):4.5*t})}});const stt=[[.4865709486482162,.26566769316909306,.1982172852343625],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],itt=[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]];var SA=new Xr({id:"p3-linear",cssId:"--display-p3-linear",name:"Linear P3",white:"D65",toXYZ_M:stt,fromXYZ_M:itt});const ntt=[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],ar=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]];var _A=new Xr({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:ntt,fromXYZ_M:ar}),Uv={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[153/255,50/255,204/255],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,153/255],lightslategrey:[119/255,136/255,153/255],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[102/255,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,204/255],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[102/255,51/255,153/255],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let $v=[,,,].fill("<percentage> | <number>[0, 255]"),jv=[,,,].fill("<number>[0, 255]");var hu=new Xr({id:"srgb",name:"sRGB",base:_A,fromBase:e=>e.map(t=>{let r=t<0?-1:1,s=t*r;return s>.0031308?r*(1.055*s**(1/2.4)-.055):12.92*t}),toBase:e=>e.map(t=>{let r=t<0?-1:1,s=t*r;return s<=.04045?t/12.92:r*((s+.055)/1.055)**2.4}),formats:{rgb:{coords:$v},rgb_number:{name:"rgb",commas:!0,coords:jv,noAlpha:!0},color:{},rgba:{coords:$v,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:jv},hex:{type:"custom",toGamut:!0,test:e=>/^#([a-f0-9]{3,4}){1,2}$/i.test(e),parse(e){e.length<=5&&(e=e.replace(/[a-f0-9]/gi,"$&$&"));let t=[];return e.replace(/[a-f0-9]{2}/gi,r=>{t.push(parseInt(r,16)/255)}),{spaceId:"srgb",coords:t.slice(0,3),alpha:t.slice(3)[0]}},serialize:(e,t,{collapse:r=!0}={})=>{t<1&&e.push(t),e=e.map(n=>Math.round(n*255));let s=r&&e.every(n=>n%17==0);return"#"+e.map(n=>s?(n/17).toString(16):n.toString(16).padStart(2,"0")).join("")}},keyword:{type:"custom",test:e=>/^[a-z]+$/i.test(e),parse(e){e=e.toLowerCase();let t={spaceId:"srgb",coords:null,alpha:1};if(e==="transparent"?(t.coords=Uv.black,t.alpha=0):t.coords=Uv[e],t.coords)return t}}}}),AA=new Xr({id:"p3",cssId:"display-p3",name:"P3",base:SA,fromBase:hu.fromBase,toBase:hu.toBase});ps.display_space=hu;let att;if(typeof CSS<"u"&&CSS.supports)for(let e of[hs,NA,AA]){let t=e.getMinCoords(),r={space:e,coords:t,alpha:1},s=dh(r);if(CSS.supports("color",s)){ps.display_space=e;break}}function ott(e,{space:t=ps.display_space,...r}={}){let s=dh(e,r);if(typeof CSS>"u"||CSS.supports("color",s)||!ps.display_space)s=new String(s),s.color=e;else{let i=e;if((e.coords.some(fa)||fa(e.alpha))&&!(att??(att=CSS.supports("color","hsl(none 50% 50%)")))&&(i=lu(e),i.coords=i.coords.map(Xe),i.alpha=Xe(i.alpha),s=dh(i,r),CSS.supports("color",s)))return s=new String(s),s.color=i,s;i=ge(i,t),s=new String(dh(i,r)),s.color=i}return s}function ltt(e,t){return e=zt(e),t=zt(t),e.space===t.space&&e.alpha===t.alpha&&e.coords.every((r,s)=>r===t.coords[s])}function xa(e){return us(e,[vr,"y"])}function CA(e,t){wn(e,[vr,"y"],t)}function utt(e){Object.defineProperty(e.prototype,"luminance",{get(){return xa(this)},set(t){CA(this,t)}})}var htt=Object.freeze({__proto__:null,getLuminance:xa,register:utt,setLuminance:CA});function ctt(e,t){e=zt(e),t=zt(t);let r=Math.max(xa(e),0),s=Math.max(xa(t),0);return s>r&&([r,s]=[s,r]),(r+.05)/(s+.05)}const dtt=.56,ptt=.57,mtt=.62,ftt=.65,Wv=.022,gtt=1.414,ytt=.1,xtt=5e-4,btt=1.14,qv=.027,vtt=1.14;function Hv(e){return e>=Wv?e:e+(Wv-e)**gtt}function rl(e){let t=e<0?-1:1,r=Math.abs(e);return t*r**2.4}function Mtt(e,t){t=zt(t),e=zt(e);let r,s,i,n,a,o;t=ge(t,"srgb"),[n,a,o]=t.coords;let l=rl(n)*.2126729+rl(a)*.7151522+rl(o)*.072175;e=ge(e,"srgb"),[n,a,o]=e.coords;let h=rl(n)*.2126729+rl(a)*.7151522+rl(o)*.072175,u=Hv(l),c=Hv(h),d=c>u;return Math.abs(c-u)<xtt?s=0:d?(r=c**dtt-u**ptt,s=r*btt):(r=c**ftt-u**mtt,s=r*vtt),i=Math.abs(s)<ytt?0:s>0?s-qv:s+qv,i*100}function wtt(e,t){e=zt(e),t=zt(t);let r=Math.max(xa(e),0),s=Math.max(xa(t),0);s>r&&([r,s]=[s,r]);let i=r+s;return i===0?0:(r-s)/i}const Ttt=5e4;function Ntt(e,t){e=zt(e),t=zt(t);let r=Math.max(xa(e),0),s=Math.max(xa(t),0);return s>r&&([r,s]=[s,r]),s===0?Ttt:(r-s)/s}function Stt(e,t){e=zt(e),t=zt(t);let r=us(e,[hs,"l"]),s=us(t,[hs,"l"]);return Math.abs(r-s)}const _tt=216/24389,Gv=24/116,Vd=24389/27;let ag=kr.D65;var uy=new pt({id:"lab-d65",name:"Lab D65",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:ag,base:vr,fromBase(e){let t=e.map((s,i)=>s/ag[i]),r=t.map(s=>s>_tt?Math.cbrt(s):(Vd*s+16)/116);return[116*r[1]-16,500*(r[0]-r[1]),200*(r[1]-r[2])]},toBase(e){let t=[];return t[1]=(e[0]+16)/116,t[0]=e[1]/500+t[1],t[2]=t[1]-e[2]/200,[t[0]>Gv?t[0]**3:(116*t[0]-16)/Vd,e[0]>8?((e[0]+16)/116)**3:e[0]/Vd,t[2]>Gv?t[2]**3:(116*t[2]-16)/Vd].map((s,i)=>s*ag[i])},formats:{"lab-d65":{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});const Att=5**.5*.5+.5;function Ctt(e,t){e=zt(e),t=zt(t);let r=us(e,[uy,"l"]),s=us(t,[uy,"l"]),i=Math.abs(r**1.618033988749895-s**1.618033988749895),n=i**(1/Att)*Math.SQRT2-40;return n<7.5?0:n}var Qd=Object.freeze({__proto__:null,contrastAPCA:Mtt,contrastDeltaPhi:Ctt,contrastLstar:Stt,contrastMichelson:wtt,contrastWCAG21:ctt,contrastWeber:Ntt});function ztt(e,t,r={}){pc(r)&&(r={algorithm:r});let{algorithm:s,...i}=r;if(!s){let n=Object.keys(Qd).map(a=>a.replace(/^contrast/,"")).join(", ");throw TypeError(`contrast() function needs a contrast algorithm. Please specify one of: ${n}`)}for(let n in e=zt(e),t=zt(t),Qd)if("contrast"+s.toLowerCase()===n.toLowerCase())return Qd[n](e,t,i);throw TypeError(`Unknown contrast algorithm: ${s}`)}function Tm(e){let[t,r,s]=mc(e,vr),i=t+15*r+3*s;return[4*t/i,9*r/i]}function zA(e){let[t,r,s]=mc(e,vr),i=t+r+s;return[t/i,r/i]}function Ett(e){Object.defineProperty(e.prototype,"uv",{get(){return Tm(this)}}),Object.defineProperty(e.prototype,"xy",{get(){return zA(this)}})}var Vtt=Object.freeze({__proto__:null,register:Ett,uv:Tm,xy:zA});function eh(e,t,r={}){pc(r)&&(r={method:r});let{method:s=ps.deltaE,...i}=r;for(let n in uu)if("deltae"+s.toLowerCase()===n.toLowerCase())return uu[n](e,t,i);throw TypeError(`Unknown deltaE method: ${s}`)}function Rtt(e,t=.25){let r=pt.get("oklch","lch");return wn(e,[r,"l"],i=>i*(1+t))}function Itt(e,t=.25){let r=pt.get("oklch","lch");return wn(e,[r,"l"],i=>i*(1-t))}var Ltt=Object.freeze({__proto__:null,darken:Itt,lighten:Rtt});function EA(e,t,r=.5,s={}){return[e,t]=[zt(e),zt(t)],la(r)==="object"&&([r,s]=[.5,r]),fc(e,t,s)(r)}function VA(e,t,r={}){let s;Rx(e)&&([s,r]=[e,t],[e,t]=s.rangeArgs.colors);let{maxDeltaE:i,deltaEMethod:n,steps:a=2,maxSteps:o=1e3,...l}=r;s||([e,t]=[zt(e),zt(t)],s=fc(e,t,l));let h=eh(e,t),u=i>0?Math.max(a,Math.ceil(h/i)+1):a,c=[];if(o!==void 0&&(u=Math.min(u,o)),u===1)c=[{p:.5,color:s(.5)}];else{let d=1/(u-1);c=Array.from({length:u},(p,m)=>{let f=m*d;return{p:f,color:s(f)}})}if(i>0){let d=c.reduce((p,m,f)=>{if(f===0)return 0;let x=eh(m.color,c[f-1].color,n);return Math.max(p,x)},0);for(;d>i;){d=0;for(let p=1;p<c.length&&c.length<o;p++){let m=c[p-1],f=c[p],x=(f.p+m.p)/2,b=s(x);d=Math.max(d,eh(b,m.color),eh(b,f.color)),c.splice(p,0,{p:x,color:s(x)}),p++}}}return c=c.map(d=>d.color),c}function fc(e,t,r={}){if(Rx(e)){let[l,h]=[e,t];return fc(...l.rangeArgs.colors,{...l.rangeArgs.options,...h})}let{space:s,outputSpace:i,progression:n,premultiplied:a}=r;e=zt(e),t=zt(t),e=lu(e),t=lu(t);let o={colors:[e,t],options:r};if(s=s?pt.get(s):pt.registry[ps.interpolationSpace]||e.space,i=i?pt.get(i):s,e=ge(e,s),t=ge(t,s),e=ya(e),t=ya(t),s.coords.h&&s.coords.h.type==="angle"){let l=r.hue=r.hue||"shorter",h=[s,"h"],[u,c]=[us(e,h),us(t,h)];isNaN(u)&&!isNaN(c)?u=c:isNaN(c)&&!isNaN(u)&&(c=u),[u,c]=dK(l,[u,c]),wn(e,h,u),wn(t,h,c)}return a&&(e.coords=e.coords.map(l=>l*e.alpha),t.coords=t.coords.map(l=>l*t.alpha)),Object.assign(l=>{l=n?n(l):l;let h=e.coords.map((d,p)=>{let m=t.coords[p];return Ch(d,m,l)}),u=Ch(e.alpha,t.alpha,l),c={space:s,coords:h,alpha:u};return a&&(c.coords=c.coords.map(d=>d/u)),i!==s&&(c=ge(c,i)),c},{rangeArgs:o})}function Rx(e){return la(e)==="function"&&!!e.rangeArgs}ps.interpolationSpace="lab";function Ptt(e){e.defineFunction("mix",EA,{returns:"color"}),e.defineFunction("range",fc,{returns:"function<color>"}),e.defineFunction("steps",VA,{returns:"array<color>"})}var Ftt=Object.freeze({__proto__:null,isRange:Rx,mix:EA,range:fc,register:Ptt,steps:VA}),RA=new pt({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:hu,fromBase:e=>{let t=Math.max(...e),r=Math.min(...e),[s,i,n]=e,[a,o,l]=[NaN,0,(r+t)/2],h=t-r;if(h!==0){switch(o=l===0||l===1?0:(t-l)/Math.min(l,1-l),t){case s:a=(i-n)/h+(i<n?6:0);break;case i:a=(n-s)/h+2;break;case n:a=(s-i)/h+4}a*=60}return o<0&&(a+=180,o=Math.abs(o)),a>=360&&(a-=360),[a,o*100,l*100]},toBase:e=>{let[t,r,s]=e;t%=360,t<0&&(t+=360),r/=100,s/=100;function i(n){let a=(n+t/30)%12,o=r*Math.min(s,1-s);return s-o*Math.max(-1,Math.min(a-3,9-a,1))}return[i(0),i(8),i(4)]},formats:{hsl:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsla:{coords:["<number> | <angle>","<percentage>","<percentage>"],commas:!0,lastAlpha:!0}}}),IA=new pt({id:"hsv",name:"HSV",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},v:{range:[0,100],name:"Value"}},base:RA,fromBase(e){let[t,r,s]=e;r/=100,s/=100;let i=s+r*Math.min(s,1-s);return[t,i===0?0:200*(1-s/i),100*i]},toBase(e){let[t,r,s]=e;r/=100,s/=100;let i=s*(1-r/2);return[t,i===0||i===1?0:(s-i)/Math.min(i,1-i)*100,i*100]},formats:{color:{id:"--hsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),Ott=new pt({id:"hwb",name:"HWB",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},w:{range:[0,100],name:"Whiteness"},b:{range:[0,100],name:"Blackness"}},base:IA,fromBase(e){let[t,r,s]=e;return[t,s*(100-r)/100,100-s]},toBase(e){let[t,r,s]=e;r/=100,s/=100;let i=r+s;if(i>=1){let o=r/i;return[t,0,o*100]}let n=1-s,a=n===0?0:1-r/n;return[t,a*100,n*100]},formats:{hwb:{coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const ktt=[[.5766690429101305,.1855582379065463,.1882286462349947],[.29734497525053605,.6273635662554661,.07529145849399788],[.02703136138641234,.07068885253582723,.9913375368376388]],Btt=[[2.0415879038107465,-.5650069742788596,-.34473135077832956],[-.9692436362808795,1.8759675015077202,.04155505740717557],[.013444280632031142,-.11836239223101838,1.0151749943912054]];var LA=new Xr({id:"a98rgb-linear",cssId:"--a98-rgb-linear",name:"Linear Adobe® 98 RGB compatible",white:"D65",toXYZ_M:ktt,fromXYZ_M:Btt}),Dtt=new Xr({id:"a98rgb",cssId:"a98-rgb",name:"Adobe® 98 RGB compatible",base:LA,toBase:e=>e.map(t=>Math.abs(t)**(563/256)*Math.sign(t)),fromBase:e=>e.map(t=>Math.abs(t)**(256/563)*Math.sign(t))});const Utt=[[.7977666449006423,.13518129740053308,.0313477341283922],[.2880748288194013,.711835234241873,8993693872564e-17],[0,0,.8251046025104602]],$tt=[[1.3457868816471583,-.25557208737979464,-.05110186497554526],[-.5446307051249019,1.5082477428451468,.02052744743642139],[0,0,1.2119675456389452]];var PA=new Xr({id:"prophoto-linear",cssId:"--prophoto-rgb-linear",name:"Linear ProPhoto",white:"D50",base:zx,toXYZ_M:Utt,fromXYZ_M:$tt});const jtt=1/512,Wtt=16/512;var qtt=new Xr({id:"prophoto",cssId:"prophoto-rgb",name:"ProPhoto",base:PA,toBase(e){return e.map(t=>t<Wtt?t/16:t**1.8)},fromBase(e){return e.map(t=>t>=jtt?t**(1/1.8):16*t)}}),Htt=new pt({id:"oklch",name:"Oklch",coords:{l:{refRange:[0,1],name:"Lightness"},c:{refRange:[0,.4],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},white:"D65",base:ou,fromBase(e){let[t,r,s]=e,i,n=2e-4;return i=Math.abs(r)<n&&Math.abs(s)<n?NaN:Math.atan2(s,r)*180/Math.PI,[t,Math.sqrt(r**2+s**2),Di(i)]},toBase(e){let[t,r,s]=e,i,n;return isNaN(s)?(i=0,n=0):(i=r*Math.cos(s*Math.PI/180),n=r*Math.sin(s*Math.PI/180)),[t,i,n]},formats:{oklch:{coords:["<percentage> | <number>","<number> | <percentage>[0,1]","<number> | <angle>"]}}});let FA=kr.D65;const Gtt=216/24389,Xv=24389/27,[Yv,Zv]=Tm({space:vr,coords:FA});var OA=new pt({id:"luv",name:"Luv",coords:{l:{refRange:[0,100],name:"Lightness"},u:{refRange:[-215,215]},v:{refRange:[-215,215]}},white:FA,base:vr,fromBase(e){let t=[Xe(e[0]),Xe(e[1]),Xe(e[2])],r=t[1],[s,i]=Tm({space:vr,coords:t});if(!Number.isFinite(s)||!Number.isFinite(i))return[0,0,0];let n=r<=Gtt?Xv*r:116*Math.cbrt(r)-16;return[n,13*n*(s-Yv),13*n*(i-Zv)]},toBase(e){let[t,r,s]=e;if(t===0||fa(t))return[0,0,0];r=Xe(r),s=Xe(s);let i=r/(13*t)+Yv,n=s/(13*t)+Zv,a=t<=8?t/Xv:((t+16)/116)**3;return[a*(9*i/(4*n)),a,a*((12-3*i-20*n)/(4*n))]},formats:{color:{id:"--luv",coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),Ix=new pt({id:"lchuv",name:"LChuv",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,220],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:OA,fromBase(e){let[t,r,s]=e,i,n=.02;return i=Math.abs(r)<n&&Math.abs(s)<n?NaN:Math.atan2(s,r)*180/Math.PI,[t,Math.sqrt(r**2+s**2),Di(i)]},toBase(e){let[t,r,s]=e;return r<0&&(r=0),isNaN(s)&&(s=0),[t,r*Math.cos(s*Math.PI/180),r*Math.sin(s*Math.PI/180)]},formats:{color:{id:"--lchuv",coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}});const Xtt=216/24389,Ytt=24389/27,Jv=ar[0][0],Qv=ar[0][1],og=ar[0][2],Kv=ar[1][0],tM=ar[1][1],lg=ar[1][2],eM=ar[2][0],rM=ar[2][1],ug=ar[2][2];function sl(e,t,r){let s=t/(Math.sin(r)-e*Math.cos(r));return s<0?1/0:s}function Pp(e){let t=(e+16)**3/1560896,r=t>Xtt?t:e/Ytt,s=r*(284517*Jv-94839*og),i=r*(838422*og+769860*Qv+731718*Jv),n=r*(632260*og-126452*Qv),a=r*(284517*Kv-94839*lg),o=r*(838422*lg+769860*tM+731718*Kv),l=r*(632260*lg-126452*tM),h=r*(284517*eM-94839*ug),u=r*(838422*ug+769860*rM+731718*eM),c=r*(632260*ug-126452*rM);return{r0s:s/n,r0i:i*e/n,r1s:s/(n+126452),r1i:(i-769860)*e/(n+126452),g0s:a/l,g0i:o*e/l,g1s:a/(l+126452),g1i:(o-769860)*e/(l+126452),b0s:h/c,b0i:u*e/c,b1s:h/(c+126452),b1i:(u-769860)*e/(c+126452)}}function sM(e,t){let r=t/360*Math.PI*2,s=sl(e.r0s,e.r0i,r),i=sl(e.r1s,e.r1i,r),n=sl(e.g0s,e.g0i,r),a=sl(e.g1s,e.g1i,r),o=sl(e.b0s,e.b0i,r),l=sl(e.b1s,e.b1i,r);return Math.min(s,i,n,a,o,l)}var Ztt=new pt({id:"hsluv",name:"HSLuv",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:Ix,gamutSpace:hu,fromBase(e){let[t,r,s]=[Xe(e[0]),Xe(e[1]),Xe(e[2])],i;if(t>99.9999999)i=0,t=100;else if(t<1e-8)i=0,t=0;else{let n=Pp(t),a=sM(n,s);i=r/a*100}return[s,i,t]},toBase(e){let[t,r,s]=[Xe(e[0]),Xe(e[1]),Xe(e[2])],i;if(s>99.9999999)s=100,i=0;else if(s<1e-8)s=0,i=0;else{let n=Pp(s);i=sM(n,t)/100*r}return[s,i,t]},formats:{color:{id:"--hsluv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});ar[0][0],ar[0][1],ar[0][2],ar[1][0],ar[1][1],ar[1][2],ar[2][0],ar[2][1],ar[2][2];function il(e,t){return Math.abs(t)/Math.sqrt(e**2+1)}function iM(e){let t=il(e.r0s,e.r0i),r=il(e.r1s,e.r1i),s=il(e.g0s,e.g0i),i=il(e.g1s,e.g1i),n=il(e.b0s,e.b0i),a=il(e.b1s,e.b1i);return Math.min(t,r,s,i,n,a)}var Jtt=new pt({id:"hpluv",name:"HPLuv",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:Ix,gamutSpace:"self",fromBase(e){let[t,r,s]=[Xe(e[0]),Xe(e[1]),Xe(e[2])],i;if(t>99.9999999)i=0,t=100;else if(t<1e-8)i=0,t=0;else{let n=Pp(t),a=iM(n);i=r/a*100}return[s,i,t]},toBase(e){let[t,r,s]=[Xe(e[0]),Xe(e[1]),Xe(e[2])],i;if(s>99.9999999)s=100,i=0;else if(s<1e-8)s=0,i=0;else{let n=Pp(s);i=iM(n)/100*r}return[s,i,t]},formats:{color:{id:"--hpluv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const nM=203,aM=2610/2**14,Qtt=2**14/2610,Ktt=2523/2**5,oM=2**5/2523,lM=3424/2**12,uM=2413/2**7,hM=2392/2**7;var tet=new Xr({id:"rec2100pq",cssId:"rec2100-pq",name:"REC.2100-PQ",base:wm,toBase(e){return e.map(function(t){return(Math.max(t**oM-lM,0)/(uM-hM*t**oM))**Qtt*1e4/nM})},fromBase(e){return e.map(function(t){let r=Math.max(t*nM/1e4,0),s=lM+uM*r**aM,i=1+hM*r**aM;return(s/i)**Ktt})}});const cM=.17883277,dM=.28466892,pM=.55991073,hg=3.7743;var eet=new Xr({id:"rec2100hlg",cssId:"rec2100-hlg",name:"REC.2100-HLG",referred:"scene",base:wm,toBase(e){return e.map(function(t){return t<=.5?t**2/3*hg:(Math.exp((t-pM)/cM)+dM)/12*hg})},fromBase(e){return e.map(function(t){return t/=hg,t<=1/12?Math.sqrt(3*t):cM*Math.log(12*t-dM)+pM})}});const kA={};ga.add("chromatic-adaptation-start",e=>{e.options.method&&(e.M=mM(e.W1,e.W2,e.options.method))}),ga.add("chromatic-adaptation-end",e=>{e.M||(e.M=mM(e.W1,e.W2,e.options.method))});function Rd({id:e,toCone_M:t,fromCone_M:r}){kA[e]=arguments[0]}function mM(e,t,r="Bradford"){let s=kA[r],[i,n,a]=ye(s.toCone_M,e),[o,l,h]=ye(s.toCone_M,t),u=[[o/i,0,0],[0,l/n,0],[0,0,h/a]],c=ye(u,s.toCone_M);return ye(s.fromCone_M,c)}Rd({id:"von Kries",toCone_M:[[.40024,.7076,-.08081],[-.2263,1.16532,.0457],[0,0,.91822]],fromCone_M:[[1.8599363874558397,-1.1293816185800916,.21989740959619328],[.3611914362417676,.6388124632850422,-6370596838649899e-21],[0,0,1.0890636230968613]]}),Rd({id:"Bradford",toCone_M:[[.8951,.2664,-.1614],[-.7502,1.7135,.0367],[.0389,-.0685,1.0296]],fromCone_M:[[.9869929054667121,-.14705425642099013,.15996265166373122],[.4323052697233945,.5183602715367774,.049291228212855594],[-.00852866457517732,.04004282165408486,.96848669578755]]}),Rd({id:"CAT02",toCone_M:[[.7328,.4296,-.1624],[-.7036,1.6975,.0061],[.003,.0136,.9834]],fromCone_M:[[1.0961238208355142,-.27886900021828726,.18274517938277307],[.4543690419753592,.4735331543074117,.07209780371722911],[-.009627608738429355,-.00569803121611342,1.0153256399545427]]}),Rd({id:"CAT16",toCone_M:[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],fromCone_M:[[1.862067855087233,-1.0112546305316845,.14918677544445172],[.3875265432361372,.6214474419314753,-.008973985167612521],[-.01584149884933386,-.03412293802851557,1.0499644368778496]]}),Object.assign(kr,{A:[1.0985,1,.35585],C:[.98074,1,1.18232],D55:[.95682,1,.92149],D75:[.94972,1,1.22638],E:[1,1,1],F2:[.99186,1,.67393],F7:[.95041,1,1.08747],F11:[1.00962,1,.6435]}),kr.ACES=[.32168/.33767,1,.34065/.33767];const ret=[[.6624541811085053,.13400420645643313,.1561876870049078],[.27222871678091454,.6740817658111484,.05368951740793705],[-.005574649490394108,.004060733528982826,1.0103391003129971]],set=[[1.6410233796943257,-.32480329418479,-.23642469523761225],[-.6636628587229829,1.6153315916573379,.016756347685530137],[.011721894328375376,-.008284441996237409,.9883948585390215]];var BA=new Xr({id:"acescg",cssId:"--acescg",name:"ACEScg",coords:{r:{range:[0,65504],name:"Red"},g:{range:[0,65504],name:"Green"},b:{range:[0,65504],name:"Blue"}},referred:"scene",white:kr.ACES,toXYZ_M:ret,fromXYZ_M:set});const Id=2**-16,cg=-.35828683,Ld=(Math.log2(65504)+9.72)/17.52;var iet=new Xr({id:"acescc",cssId:"--acescc",name:"ACEScc",coords:{r:{range:[cg,Ld],name:"Red"},g:{range:[cg,Ld],name:"Green"},b:{range:[cg,Ld],name:"Blue"}},referred:"scene",base:BA,toBase(e){let t=-.3013698630136986;return e.map(function(r){return r<=t?(2**(r*17.52-9.72)-Id)*2:r<Ld?2**(r*17.52-9.72):65504})},fromBase(e){return e.map(function(t){return t<=0?(Math.log2(Id)+9.72)/17.52:t<Id?(Math.log2(Id+t*.5)+9.72)/17.52:(Math.log2(t)+9.72)/17.52})}}),fM=Object.freeze({__proto__:null,A98RGB:Dtt,A98RGB_Linear:LA,ACEScc:iet,ACEScg:BA,CAM16_JMh:qK,HCT:Eh,HPLuv:Jtt,HSL:RA,HSLuv:Ztt,HSV:IA,HWB:Ott,ICTCP:ay,JzCzHz:ny,Jzazbz:mA,LCH:zh,LCHuv:Ix,Lab:hs,Lab_D65:uy,Luv:OA,OKLCH:Htt,OKLab:ou,P3:AA,P3_Linear:SA,ProPhoto:qtt,ProPhoto_Linear:PA,REC_2020:NA,REC_2020_Linear:wm,REC_2100_HLG:eet,REC_2100_PQ:tet,XYZ_ABS_D65:Ex,XYZ_D50:zx,XYZ_D65:vr,sRGB:hu,sRGB_Linear:_A}),ss=class Dr{constructor(...t){let r;t.length===1&&(r=zt(t[0]));let s,i,n;r?(s=r.space||r.spaceId,i=r.coords,n=r.alpha):[s,i,n]=t,Object.defineProperty(this,"space",{value:pt.get(s),writable:!1,enumerable:!0,configurable:!0}),this.coords=i?i.slice():[0,0,0],this.alpha=n>1||n===void 0?1:n<0?0:n;for(let a=0;a<this.coords.length;a++)this.coords[a]==="NaN"&&(this.coords[a]=NaN);for(let a in this.space.coords)Object.defineProperty(this,a,{get:()=>this.get(a),set:o=>this.set(a,o)})}get spaceId(){return this.space.id}clone(){return new Dr(this.space,this.coords,this.alpha)}toJSON(){return{spaceId:this.spaceId,coords:this.coords,alpha:this.alpha}}display(...t){let r=ott(this,...t);return r.color=new Dr(r.color),r}static get(t,...r){return t instanceof Dr?t:new Dr(t,...r)}static defineFunction(t,r,s=r){let{instance:i=!0,returns:n}=s,a=function(...o){let l=r(...o);if(n==="color")l=Dr.get(l);else if(n==="function<color>"){let h=l;l=function(...u){let c=h(...u);return Dr.get(c)},Object.assign(l,h)}else n==="array<color>"&&(l=l.map(h=>Dr.get(h)));return l};t in Dr||(Dr[t]=a),i&&(Dr.prototype[t]=function(...o){return a(this,...o)})}static defineFunctions(t){for(let r in t)Dr.defineFunction(r,t[r],t[r])}static extend(t){if(t.register)t.register(Dr);else for(let r in t)Dr.defineFunction(r,t[r])}};ss.defineFunctions({get:us,getAll:mc,set:wn,setAll:Cx,to:ge,equals:ltt,inGamut:Ka,toGamut:ya,distance:pA,toString:dh}),Object.assign(ss,{util:aK,hooks:ga,WHITES:kr,Space:pt,spaces:pt.registry,parse:cA,defaults:ps});for(let e of Object.keys(fM))pt.register(fM[e]);for(let e in pt.registry)hy(e,pt.registry[e]);ga.add("colorspace-init-end",e=>{hy(e.id,e),e.aliases?.forEach(t=>{hy(t,e)})});function hy(e,t){let r=e.replace(/-/g,"_");Object.defineProperty(ss.prototype,r,{get(){let s=this.getAll(e);return typeof Proxy>"u"?s:new Proxy(s,{has:(i,n)=>{try{return pt.resolveCoord([t,n]),!0}catch{}return Reflect.has(i,n)},get:(i,n,a)=>{if(n&&typeof n!="symbol"&&!(n in i)){let{index:o}=pt.resolveCoord([t,n]);if(o>=0)return i[o]}return Reflect.get(i,n,a)},set:(i,n,a,o)=>{if(n&&typeof n!="symbol"&&!(n in i)||n>=0){let{index:l}=pt.resolveCoord([t,n]);if(l>=0)return i[l]=a,this.setAll(e,i),!0}return Reflect.set(i,n,a,o)}})},set(s){this.setAll(e,s)},configurable:!0,enumerable:!0})}ss.extend(uu),ss.extend({deltaE:eh}),Object.assign(ss,{deltaEMethods:uu}),ss.extend(Ltt),ss.extend({contrast:ztt}),ss.extend(Vtt),ss.extend(htt),ss.extend(Ftt),ss.extend(Qd);const{vec2:net,vec4:aet}=_e,Br=e=>{let t=new ss(e);return aet(...t.to("p3-linear").coords,t.alpha).value},gc=e=>{let t=.5,r=.5,s=(i,n=!1)=>{if(typeof i=="number")return i;let a=i.toLowerCase().trim();if(n){if(a==="top")return 0;if(a==="bottom")return 1;if(a==="center")return .5}else{if(a==="left")return 0;if(a==="right")return 1;if(a==="center")return .5}return console.warn(`Invalid position value: ${i}. Defaulting to center.`),.5};if(typeof e=="string"){let i=e.toLowerCase().trim().split(/\s+/);i.includes("left")?t=0:i.includes("right")?t=1:(i.includes("center")||i.length===1&&(i[0]==="top"||i[0]==="bottom"))&&(t=.5),i.includes("top")?r=0:i.includes("bottom")?r=1:(i.includes("center")||i.length===1&&(i[0]==="left"||i[0]==="right"))&&(r=.5),i.length===1&&i[0]==="center"&&(t=.5,r=.5)}else typeof e=="object"&&e?(t=s(e.x,!1),r=s(e.y,!0)):console.warn(`Invalid position value provided: ${e}. Defaulting to center.`);return net(t,1-r).value},oet=e=>{if(typeof e=="number")return(e%360+360)%360;let t=e.toLowerCase().trim();switch(t){case"to right":return 0;case"to bottom":return 90;case"to left":return 180;case"to top":return 270;case"to bottom right":case"to right bottom":return 45;case"to bottom left":case"to left bottom":return 135;case"to top left":case"to left top":return 225;case"to top right":case"to right top":return 315;case"from left":return 0;case"from top":return 90;case"from right":return 180;case"from bottom":return 270;case"from top left":return 45;case"from top right":return 135;case"from bottom right":return 225;case"from bottom left":return 315;default:let r=t.match(/^(-?\d*\.?\d+)(deg|rad|turn)?$/);if(r){let[,s,i="deg"]=r,n=parseFloat(s);switch(i){case"deg":return(n%360+360)%360;case"rad":return(n*180/Math.PI%360+360)%360;case"turn":return(n*360%360+360)%360;default:return(n%360+360)%360}}return console.warn(`Invalid angle value: ${e}. Defaulting to 0 degrees.`),0}},Rl={name:"Checkerboard",props:{colorA:{default:"#cccccc",transform:Br,description:"First color of the checkerboard pattern",ui:{type:"color",label:"Color A"}},colorB:{default:"#999999",transform:Br,description:"Second color of the checkerboard pattern",ui:{type:"color",label:"Color B"}},cells:{default:8,description:"Number of cells along the shortest canvas edge (creates square cells)",ui:{type:"range",min:1,max:50,step:1,label:"Cells"}}},fragmentNode:({uniforms:e})=>{let{vec2:t,mix:r,floor:s,mod:i,screenUV:n,viewportSize:a}=_e,o=a.x.div(a.y),l=t(n.x.mul(o),n.y.oneMinus()),h=e.cells.uniform,u=l.mul(h),c=s(u),d=i(c.x.add(c.y),2);return r(e.colorA.uniform,e.colorB.uniform,d)}};function uet(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const DA={blendMode:"normal"};try{Rl&&Rl.props&&Object.entries(Rl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(DA[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const het=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Rl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>uet(e,DA),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Rl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Rl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Il={name:"Circle",props:{color:{default:"#ffffff",transform:Br,description:"The color of the circle",ui:{type:"color",label:"Color"}},radius:{default:1,description:"The radius of the circle. A value of one (1) is sets the circle to fit the canvas.",ui:{type:"range",min:0,max:2,step:.01,label:"Radius"}},softness:{default:0,description:"Edge softness. Lower values like zero (0) are sharp, higher values like one (1) are softer.",ui:{type:"range",min:0,max:1,step:.01,label:"Softness"}},center:{default:{x:.5,y:.5},transform:gc,description:"The center point of the circle",ui:{type:"text",label:"Center Position"}}},fragmentNode:({uniforms:e})=>{let{vec2:t,vec4:r,length:s,mix:i,smoothstep:n,screenUV:a,viewportSize:o}=_e,l=o.x.div(o.y),h=t(a.x.mul(l),a.y),u=t(e.center.uniform.x.mul(l),e.center.uniform.y.oneMinus()),c=s(h.sub(u)),d=e.softness.uniform,p=e.radius.uniform.mul(.5),m=n(p,p.sub(d),c);return i(r(e.color.uniform.rgb,0),e.color.uniform,m)}};function cet(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const UA={blendMode:"normal"};try{Il&&Il.props&&Object.entries(Il.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(UA[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const det=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Il.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>cet(e,UA),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Il,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Il.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Ll={name:"DotGrid",props:{color:{default:"#ffffff",description:"The color of the dot",transform:Br,ui:{type:"color",label:"Color"}},density:{default:100,description:"The number of dots on the longest canvas edge",ui:{type:"range",min:10,max:500,step:10,label:"Density"}},dotSize:{default:.3,description:"The size of each dot, zero (0) being invisible, one (1) filled the grid with no gaps",ui:{type:"range",min:0,max:1,step:.01,label:"Dot Size"}},twinkle:{default:0,description:"Intensity of the twinkle effect (0 = off, 1 = full twinkle)",ui:{type:"range",min:0,max:1,step:.01,label:"Twinkle"}}},fragmentNode:({uniforms:e})=>{let{screenUV:t,vec4:r,vec3:s,vec2:i,smoothstep:n,length:a,floor:o,float:l,viewportSize:h,time:u,sin:c,mix:d}=_e,p=t,m=e.density.uniform,f=e.dotSize.uniform,x=e.color.uniform,b=e.twinkle.uniform,v=h,T=v.x.div(v.y),_=i(p.x.mul(T),p.y.oneMinus()),E=_.mul(m),C=E.sub(o(E)),A=a(C.sub(.5)),I=a(QN(_.mul(m))),Q=l(1).sub(n(f.mul(.5),f.mul(.5).add(I.mul(.5)),A)),ot=o(E),K=ot.x.mul(12.9898).add(ot.y.mul(78.233)).sin().mul(43758.5453).fract(),mt=u.mul(2).add(K.mul(6.28318)),nt=c(mt).mul(.5).add(.5),yt=d(l(1),nt,b),lt=Q.mul(yt),Nt=s(x).mul(lt);return r(Nt,lt)}};function pet(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const $A={blendMode:"normal"};try{Ll&&Ll.props&&Object.entries(Ll.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&($A[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const met=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Ll.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>pet(e,$A),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Ll,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Ll.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Pl={name:"FilmGrain",props:{intensity:{default:.25,description:"Grain intensity (0-1)",ui:{type:"range",min:0,max:1,step:.01,label:"Intensity"}},power:{default:.645,description:"Controls blending based on brightness",ui:{type:"range",min:0,max:2,step:.01,label:"Power"}},speed:{default:.5,description:"Animation speed of grain noise",ui:{type:"range",min:0,max:3,step:.1,label:"Speed"}}},fragmentNode:({uniforms:e,childNode:t})=>{let r=t||oh(0,0,0,0),s=_0(),i=p=>Og(Zn(Pg(p,A0(12.9898,78.233))).mul(43758.5453)),n=p=>Pg(p,oh(.299,.587,.114,0)),a=i(s).add(S0.mul(e.speed.uniform)),o=Og(Zn(a.mul(43758.5453))),l=Nl(Fg(.5),Fg(.75),o).mul(e.intensity.uniform),h=KN(n(r),e.power.uniform),u=r.mul(l),c=JN(h,0,1),d=Nl(u,r,c);return oh(d.x,d.y,d.z,r.w)}};function fet(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const jA={blendMode:"normal"};try{Pl&&Pl.props&&Object.entries(Pl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(jA[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const get=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Pl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>fet(e,jA),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Pl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Pl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Pd=new WeakMap,Fl={name:"glassTiles",props:{intensity:{default:1,description:"The intensity of the glass tiles effect",ui:{type:"range",min:0,max:5,step:.1,label:"Intensity"}},tileCount:{default:100,description:"Number of tiles across the shortest dimension",ui:{type:"range",min:1,max:200,step:1,label:"Tile Count"}}},fragmentNode:({uniforms:e,childNode:t,onCleanup:r,canvas:s})=>{let{vec2:i,vec4:n,floor:a,mul:o,div:l,sub:h,add:u,convertToTexture:c,screenUV:d,uniform:p}=_e;if(!t)return console.error("You must pass a child component into the Glass Tiles shader."),n(0);let m=c(t),f=p(1),x=()=>{s&&(f.value=s.clientWidth/s.clientHeight)};x();let b=Pd.get(s);b||(b=new ResizeObserver(lt=>{let Nt=lt[0];if(!Nt)return;let{width:ht,height:Mt}=Nt.contentRect,ut=window.devicePixelRatio||1;m.setSize(ht*ut,Mt*ut),x()}),b.observe(s),Pd.set(s,b)),r(()=>{let lt=Pd.get(s);lt&&(lt.disconnect(),Pd.delete(s))});let v=d,T=e.intensity.uniform,_=e.tileCount.uniform,E=i(f.greaterThanEqual(1).select(o(_,f),_),f.lessThan(1).select(l(_,f),_)),C=l(a(o(v,E)),E),A=h(v,C),I=i(.5,.5),Q=o(T,.025),ot=l(A,l(i(1),E)),K=h(ot,I),mt=o(K,Q),nt=u(A,mt),yt=u(nt,C);return n(m.sample(yt))}};function yet(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const WA={blendMode:"normal"};try{Fl&&Fl.props&&Object.entries(Fl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(WA[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const xet=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Fl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>yet(e,WA),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Fl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Fl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Fd={VERTEX:"vertex"},Hn={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},yc=["x","y","z","w"],Cr="00.01.02.03.04.05.06.07.08.09.0a.0b.0c.0d.0e.0f.10.11.12.13.14.15.16.17.18.19.1a.1b.1c.1d.1e.1f.20.21.22.23.24.25.26.27.28.29.2a.2b.2c.2d.2e.2f.30.31.32.33.34.35.36.37.38.39.3a.3b.3c.3d.3e.3f.40.41.42.43.44.45.46.47.48.49.4a.4b.4c.4d.4e.4f.50.51.52.53.54.55.56.57.58.59.5a.5b.5c.5d.5e.5f.60.61.62.63.64.65.66.67.68.69.6a.6b.6c.6d.6e.6f.70.71.72.73.74.75.76.77.78.79.7a.7b.7c.7d.7e.7f.80.81.82.83.84.85.86.87.88.89.8a.8b.8c.8d.8e.8f.90.91.92.93.94.95.96.97.98.99.9a.9b.9c.9d.9e.9f.a0.a1.a2.a3.a4.a5.a6.a7.a8.a9.aa.ab.ac.ad.ae.af.b0.b1.b2.b3.b4.b5.b6.b7.b8.b9.ba.bb.bc.bd.be.bf.c0.c1.c2.c3.c4.c5.c6.c7.c8.c9.ca.cb.cc.cd.ce.cf.d0.d1.d2.d3.d4.d5.d6.d7.d8.d9.da.db.dc.dd.de.df.e0.e1.e2.e3.e4.e5.e6.e7.e8.e9.ea.eb.ec.ed.ee.ef.f0.f1.f2.f3.f4.f5.f6.f7.f8.f9.fa.fb.fc.fd.fe.ff".split(".");let gM=1234567;const qA=Math.PI/180,HA=180/Math.PI;function Kd(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(Cr[e&255]+Cr[e>>8&255]+Cr[e>>16&255]+Cr[e>>24&255]+"-"+Cr[t&255]+Cr[t>>8&255]+"-"+Cr[t>>16&15|64]+Cr[t>>24&255]+"-"+Cr[r&63|128]+Cr[r>>8&255]+"-"+Cr[r>>16&255]+Cr[r>>24&255]+Cr[s&255]+Cr[s>>8&255]+Cr[s>>16&255]+Cr[s>>24&255]).toLowerCase()}function qt(e,t,r){return Math.max(t,Math.min(r,e))}function Lx(e,t){return(e%t+t)%t}function bet(e,t,r,s,i){return s+(e-t)*(i-s)/(r-t)}function vet(e,t,r){return e===t?0:(r-e)/(t-e)}function ph(e,t,r){return(1-r)*e+r*t}function Met(e,t,r,s){return ph(e,t,1-Math.exp(-r*s))}function wet(e,t=1){return t-Math.abs(Lx(e,t*2)-t)}function Tet(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t),e*e*(3-2*e))}function Net(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t),e*e*e*(e*(e*6-15)+10))}function _et(e,t){return e+Math.floor(Math.random()*(t-e+1))}function Aet(e,t){return e+Math.random()*(t-e)}function Cet(e){return e*(.5-Math.random())}function zet(e){e!==void 0&&(gM=e);let t=gM+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Eet(e){return e*qA}function Vet(e){return e*HA}function Ret(e){return(e&e-1)==0&&e!==0}function Iet(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function Let(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function Pet(e,t,r,s,i){let n=Math.cos,a=Math.sin,o=n(r/2),l=a(r/2),h=n((t+s)/2),u=a((t+s)/2),c=n((t-s)/2),d=a((t-s)/2),p=n((s-t)/2),m=a((s-t)/2);switch(i){case"XYX":e.set(o*u,l*c,l*d,o*h);break;case"YZY":e.set(l*d,o*u,l*c,o*h);break;case"ZXZ":e.set(l*c,l*d,o*u,o*h);break;case"XZX":e.set(o*u,l*m,l*p,o*h);break;case"YXY":e.set(l*p,o*u,l*m,o*h);break;case"ZYZ":e.set(l*m,l*p,o*u,o*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ii(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function Kt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error("Invalid component type.")}}const Fet={DEG2RAD:qA,RAD2DEG:HA,generateUUID:Kd,clamp:qt,euclideanModulo:Lx,mapLinear:bet,inverseLerp:vet,lerp:ph,damp:Met,pingpong:wet,smoothstep:Tet,smootherstep:Net,randInt:_et,randFloat:Aet,randFloatSpread:Cet,seededRandom:zet,degToRad:Eet,radToDeg:Vet,isPowerOfTwo:Ret,ceilPowerOfTwo:Iet,floorPowerOfTwo:Let,setQuaternionFromProperEuler:Pet,normalize:Kt,denormalize:ii},cy=0,Oet=1015,dy="",Qs="srgb",yM="srgb-linear",xM="linear",mh="srgb",Fp=35044,Wa=2e3,py=2001;var xc=class GA{constructor(t,r,s,i,n,a,o,l,h){GA.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,r,s,i,n,a,o,l,h)}set(t,r,s,i,n,a,o,l,h){let u=this.elements;return u[0]=t,u[1]=i,u[2]=o,u[3]=r,u[4]=n,u[5]=l,u[6]=s,u[7]=a,u[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let r=this.elements,s=t.elements;return r[0]=s[0],r[1]=s[1],r[2]=s[2],r[3]=s[3],r[4]=s[4],r[5]=s[5],r[6]=s[6],r[7]=s[7],r[8]=s[8],this}extractBasis(t,r,s){return t.setFromMatrix3Column(this,0),r.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let r=t.elements;return this.set(r[0],r[4],r[8],r[1],r[5],r[9],r[2],r[6],r[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,r){let s=t.elements,i=r.elements,n=this.elements,a=s[0],o=s[3],l=s[6],h=s[1],u=s[4],c=s[7],d=s[2],p=s[5],m=s[8],f=i[0],x=i[3],b=i[6],v=i[1],T=i[4],_=i[7],E=i[2],C=i[5],A=i[8];return n[0]=a*f+o*v+l*E,n[3]=a*x+o*T+l*C,n[6]=a*b+o*_+l*A,n[1]=h*f+u*v+c*E,n[4]=h*x+u*T+c*C,n[7]=h*b+u*_+c*A,n[2]=d*f+p*v+m*E,n[5]=d*x+p*T+m*C,n[8]=d*b+p*_+m*A,this}multiplyScalar(t){let r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=t,r[4]*=t,r[7]*=t,r[2]*=t,r[5]*=t,r[8]*=t,this}determinant(){let t=this.elements,r=t[0],s=t[1],i=t[2],n=t[3],a=t[4],o=t[5],l=t[6],h=t[7],u=t[8];return r*a*u-r*o*h-s*n*u+s*o*l+i*n*h-i*a*l}invert(){let t=this.elements,r=t[0],s=t[1],i=t[2],n=t[3],a=t[4],o=t[5],l=t[6],h=t[7],u=t[8],c=u*a-o*h,d=o*l-u*n,p=h*n-a*l,m=r*c+s*d+i*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);let f=1/m;return t[0]=c*f,t[1]=(i*h-u*s)*f,t[2]=(o*s-i*a)*f,t[3]=d*f,t[4]=(u*r-i*l)*f,t[5]=(i*n-o*r)*f,t[6]=p*f,t[7]=(s*l-h*r)*f,t[8]=(a*r-s*n)*f,this}transpose(){let t,r=this.elements;return t=r[1],r[1]=r[3],r[3]=t,t=r[2],r[2]=r[6],r[6]=t,t=r[5],r[5]=r[7],r[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let r=this.elements;return t[0]=r[0],t[1]=r[3],t[2]=r[6],t[3]=r[1],t[4]=r[4],t[5]=r[7],t[6]=r[2],t[7]=r[5],t[8]=r[8],this}setUvTransform(t,r,s,i,n,a,o){let l=Math.cos(n),h=Math.sin(n);return this.set(s*l,s*h,-s*(l*a+h*o)+a+t,-i*h,i*l,-i*(-h*a+l*o)+o+r,0,0,1),this}scale(t,r){return this.premultiply(dg.makeScale(t,r)),this}rotate(t){return this.premultiply(dg.makeRotation(-t)),this}translate(t,r){return this.premultiply(dg.makeTranslation(t,r)),this}makeTranslation(t,r){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,r,0,0,1),this}makeRotation(t){let r=Math.cos(t),s=Math.sin(t);return this.set(r,-s,0,s,r,0,0,0,1),this}makeScale(t,r){return this.set(t,0,0,0,r,0,0,0,1),this}equals(t){let r=this.elements,s=t.elements;for(let i=0;i<9;i++)if(r[i]!==s[i])return!1;return!0}fromArray(t,r=0){for(let s=0;s<9;s++)this.elements[s]=t[s+r];return this}toArray(t=[],r=0){let s=this.elements;return t[r]=s[0],t[r+1]=s[1],t[r+2]=s[2],t[r+3]=s[3],t[r+4]=s[4],t[r+5]=s[5],t[r+6]=s[6],t[r+7]=s[7],t[r+8]=s[8],t}clone(){return new this.constructor().fromArray(this.elements)}};const dg=new xc,bM={};function vM(e){e in bM||(bM[e]=!0,console.warn(e))}const MM=new xc().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),wM=new xc().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function ket(){let e={enabled:!0,workingColorSpace:yM,spaces:{},convert:function(i,n,a){return this.enabled===!1||n===a||!n||!a||(this.spaces[n].transfer===mh&&(i.r=Ol(i.r),i.g=Ol(i.g),i.b=Ol(i.b)),this.spaces[n].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[n].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===mh&&(i.r=kl(i.r),i.g=kl(i.g),i.b=kl(i.b))),i},workingToColorSpace:function(i,n){return this.convert(i,this.workingColorSpace,n)},colorSpaceToWorking:function(i,n){return this.convert(i,n,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===dy?xM:this.spaces[i].transfer},getLuminanceCoefficients:function(i,n=this.workingColorSpace){return i.fromArray(this.spaces[n].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,n,a){return i.copy(this.spaces[n].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,n){return vM("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),e.workingToColorSpace(i,n)},toWorkingColorSpace:function(i,n){return vM("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),e.colorSpaceToWorking(i,n)}},t=[.64,.33,.3,.6,.15,.06],r=[.2126,.7152,.0722],s=[.3127,.329];return e.define({[yM]:{primaries:t,whitePoint:s,transfer:xM,toXYZ:MM,fromXYZ:wM,luminanceCoefficients:r,workingColorSpaceConfig:{unpackColorSpace:Qs},outputColorSpaceConfig:{drawingBufferColorSpace:Qs}},[Qs]:{primaries:t,whitePoint:s,transfer:mh,toXYZ:MM,fromXYZ:wM,luminanceCoefficients:r,outputColorSpaceConfig:{drawingBufferColorSpace:Qs}}}),e}const He=ket();function Ol(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function kl(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}const XA={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},$n={h:0,s:0,l:0},Od={h:0,s:0,l:0};function pg(e,t,r){return r<0&&(r+=1),r>1&&--r,r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*6*(2/3-r):e}var Px=class{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(t===void 0&&r===void 0){let s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Qs){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,He.colorSpaceToWorking(this,t),this}setRGB(e,t,r,s=He.workingColorSpace){return this.r=e,this.g=t,this.b=r,He.colorSpaceToWorking(this,s),this}setHSL(e,t,r,s=He.workingColorSpace){if(e=Lx(e,1),t=qt(t,0,1),r=qt(r,0,1),t===0)this.r=this.g=this.b=r;else{let i=r<=.5?r*(1+t):r+t-r*t,n=2*r-i;this.r=pg(n,i,e+1/3),this.g=pg(n,i,e),this.b=pg(n,i,e-1/3)}return He.colorSpaceToWorking(this,s),this}setStyle(e,t=Qs){function r(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,n=s[1],a=s[2];switch(n){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){let i=s[1],n=i.length;if(n===3)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,t);if(n===6)return this.setHex(parseInt(i,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Qs){let r=XA[e.toLowerCase()];return r===void 0?console.warn("THREE.Color: Unknown color "+e):this.setHex(r,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Ol(e.r),this.g=Ol(e.g),this.b=Ol(e.b),this}copyLinearToSRGB(e){return this.r=kl(e.r),this.g=kl(e.g),this.b=kl(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Qs){return He.workingToColorSpace(zr.copy(this),e),Math.round(qt(zr.r*255,0,255))*65536+Math.round(qt(zr.g*255,0,255))*256+Math.round(qt(zr.b*255,0,255))}getHexString(e=Qs){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=He.workingColorSpace){He.workingToColorSpace(zr.copy(this),t);let r=zr.r,s=zr.g,i=zr.b,n=Math.max(r,s,i),a=Math.min(r,s,i),o,l,h=(a+n)/2;if(a===n)o=0,l=0;else{let u=n-a;switch(l=h<=.5?u/(n+a):u/(2-n-a),n){case r:o=(s-i)/u+(s<i?6:0);break;case s:o=(i-r)/u+2;break;case i:o=(r-s)/u+4;break}o/=6}return e.h=o,e.s=l,e.l=h,e}getRGB(e,t=He.workingColorSpace){return He.workingToColorSpace(zr.copy(this),t),e.r=zr.r,e.g=zr.g,e.b=zr.b,e}getStyle(e=Qs){He.workingToColorSpace(zr.copy(this),e);let t=zr.r,r=zr.g,s=zr.b;return e===Qs?`rgb(${Math.round(t*255)},${Math.round(r*255)},${Math.round(s*255)})`:`color(${e} ${t.toFixed(3)} ${r.toFixed(3)} ${s.toFixed(3)})`}offsetHSL(e,t,r){return this.getHSL($n),this.setHSL($n.h+e,$n.s+t,$n.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL($n),e.getHSL(Od);let r=ph($n.h,Od.h,t),s=ph($n.s,Od.s,t),i=ph($n.l,Od.l,t);return this.setHSL(r,s,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,r=this.g,s=this.b,i=e.elements;return this.r=i[0]*t+i[3]*r+i[6]*s,this.g=i[1]*t+i[4]*r+i[7]*s,this.b=i[2]*t+i[5]*r+i[8]*s,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const zr=new Px;Px.NAMES=XA;var Bet=class YA{constructor(t,r,s,i){YA.prototype.isMatrix2=!0,this.elements=[1,0,0,1],t!==void 0&&this.set(t,r,s,i)}identity(){return this.set(1,0,0,1),this}fromArray(t,r=0){for(let s=0;s<4;s++)this.elements[s]=t[s+r];return this}set(t,r,s,i){let n=this.elements;return n[0]=t,n[2]=r,n[1]=s,n[3]=i,this}},Det=class{constructor(e=0,t=0,r=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=s}static slerpFlat(e,t,r,s,i,n,a){let o=r[s+0],l=r[s+1],h=r[s+2],u=r[s+3],c=i[n+0],d=i[n+1],p=i[n+2],m=i[n+3];if(a===0){e[t+0]=o,e[t+1]=l,e[t+2]=h,e[t+3]=u;return}if(a===1){e[t+0]=c,e[t+1]=d,e[t+2]=p,e[t+3]=m;return}if(u!==m||o!==c||l!==d||h!==p){let f=1-a,x=o*c+l*d+h*p+u*m,b=x>=0?1:-1,v=1-x*x;if(v>2**-52){let _=Math.sqrt(v),E=Math.atan2(_,x*b);f=Math.sin(f*E)/_,a=Math.sin(a*E)/_}let T=a*b;if(o=o*f+c*T,l=l*f+d*T,h=h*f+p*T,u=u*f+m*T,f===1-a){let _=1/Math.sqrt(o*o+l*l+h*h+u*u);o*=_,l*=_,h*=_,u*=_}}e[t]=o,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,r,s,i,n){let a=r[s],o=r[s+1],l=r[s+2],h=r[s+3],u=i[n],c=i[n+1],d=i[n+2],p=i[n+3];return e[t]=a*p+h*u+o*d-l*c,e[t+1]=o*p+h*c+l*u-a*d,e[t+2]=l*p+h*d+a*c-o*u,e[t+3]=h*p-a*u-o*c-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,s){return this._x=e,this._y=t,this._z=r,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let r=e._x,s=e._y,i=e._z,n=e._order,a=Math.cos,o=Math.sin,l=a(r/2),h=a(s/2),u=a(i/2),c=o(r/2),d=o(s/2),p=o(i/2);switch(n){case"XYZ":this._x=c*h*u+l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u-c*d*p;break;case"YXZ":this._x=c*h*u+l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u+c*d*p;break;case"ZXY":this._x=c*h*u-l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u-c*d*p;break;case"ZYX":this._x=c*h*u-l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u+c*d*p;break;case"YZX":this._x=c*h*u+l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u-c*d*p;break;case"XZY":this._x=c*h*u-l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u+c*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+n)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let r=t/2,s=Math.sin(r);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,r=t[0],s=t[4],i=t[8],n=t[1],a=t[5],o=t[9],l=t[2],h=t[6],u=t[10],c=r+a+u;if(c>0){let d=.5/Math.sqrt(c+1);this._w=.25/d,this._x=(h-o)*d,this._y=(i-l)*d,this._z=(n-s)*d}else if(r>a&&r>u){let d=2*Math.sqrt(1+r-a-u);this._w=(h-o)/d,this._x=.25*d,this._y=(s+n)/d,this._z=(i+l)/d}else if(a>u){let d=2*Math.sqrt(1+a-r-u);this._w=(i-l)/d,this._x=(s+n)/d,this._y=.25*d,this._z=(o+h)/d}else{let d=2*Math.sqrt(1+u-r-a);this._w=(n-s)/d,this._x=(i+l)/d,this._y=(o+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r<2**-52?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(qt(this.dot(e),-1,1)))}rotateTowards(e,t){let r=this.angleTo(e);if(r===0)return this;let s=Math.min(1,t/r);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let r=e._x,s=e._y,i=e._z,n=e._w,a=t._x,o=t._y,l=t._z,h=t._w;return this._x=r*h+n*a+s*l-i*o,this._y=s*h+n*o+i*a-r*l,this._z=i*h+n*l+r*o-s*a,this._w=n*h-r*a-s*o-i*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let r=this._x,s=this._y,i=this._z,n=this._w,a=n*e._w+r*e._x+s*e._y+i*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=n,this._x=r,this._y=s,this._z=i,this;let o=1-a*a;if(o<=2**-52){let d=1-t;return this._w=d*n+t*this._w,this._x=d*r+t*this._x,this._y=d*s+t*this._y,this._z=d*i+t*this._z,this.normalize(),this}let l=Math.sqrt(o),h=Math.atan2(l,a),u=Math.sin((1-t)*h)/l,c=Math.sin(t*h)/l;return this._w=n*u+this._w*c,this._x=r*u+this._x*c,this._y=s*u+this._y*c,this._z=i*u+this._z*c,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),s=Math.sqrt(1-r),i=Math.sqrt(r);return this.set(s*Math.sin(e),s*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},ci=class ZA{constructor(t=0,r=0,s=0){ZA.prototype.isVector3=!0,this.x=t,this.y=r,this.z=s}set(t,r,s){return s===void 0&&(s=this.z),this.x=t,this.y=r,this.z=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;case 2:this.z=r;break;default:throw Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,r){return this.x=t.x+r.x,this.y=t.y+r.y,this.z=t.z+r.z,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this.z+=t.z*r,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,r){return this.x=t.x-r.x,this.y=t.y-r.y,this.z=t.z-r.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,r){return this.x=t.x*r.x,this.y=t.y*r.y,this.z=t.z*r.z,this}applyEuler(t){return this.applyQuaternion(TM.setFromEuler(t))}applyAxisAngle(t,r){return this.applyQuaternion(TM.setFromAxisAngle(t,r))}applyMatrix3(t){let r=this.x,s=this.y,i=this.z,n=t.elements;return this.x=n[0]*r+n[3]*s+n[6]*i,this.y=n[1]*r+n[4]*s+n[7]*i,this.z=n[2]*r+n[5]*s+n[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let r=this.x,s=this.y,i=this.z,n=t.elements,a=1/(n[3]*r+n[7]*s+n[11]*i+n[15]);return this.x=(n[0]*r+n[4]*s+n[8]*i+n[12])*a,this.y=(n[1]*r+n[5]*s+n[9]*i+n[13])*a,this.z=(n[2]*r+n[6]*s+n[10]*i+n[14])*a,this}applyQuaternion(t){let r=this.x,s=this.y,i=this.z,n=t.x,a=t.y,o=t.z,l=t.w,h=2*(a*i-o*s),u=2*(o*r-n*i),c=2*(n*s-a*r);return this.x=r+l*h+a*c-o*u,this.y=s+l*u+o*h-n*c,this.z=i+l*c+n*u-a*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let r=this.x,s=this.y,i=this.z,n=t.elements;return this.x=n[0]*r+n[4]*s+n[8]*i,this.y=n[1]*r+n[5]*s+n[9]*i,this.z=n[2]*r+n[6]*s+n[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,r){return this.x=qt(this.x,t.x,r.x),this.y=qt(this.y,t.y,r.y),this.z=qt(this.z,t.z,r.z),this}clampScalar(t,r){return this.x=qt(this.x,t,r),this.y=qt(this.y,t,r),this.z=qt(this.z,t,r),this}clampLength(t,r){let s=this.length();return this.divideScalar(s||1).multiplyScalar(qt(s,t,r))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this.z+=(t.z-this.z)*r,this}lerpVectors(t,r,s){return this.x=t.x+(r.x-t.x)*s,this.y=t.y+(r.y-t.y)*s,this.z=t.z+(r.z-t.z)*s,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,r){let s=t.x,i=t.y,n=t.z,a=r.x,o=r.y,l=r.z;return this.x=i*l-n*o,this.y=n*a-s*l,this.z=s*o-i*a,this}projectOnVector(t){let r=t.lengthSq();if(r===0)return this.set(0,0,0);let s=t.dot(this)/r;return this.copy(t).multiplyScalar(s)}projectOnPlane(t){return mg.copy(this).projectOnVector(t),this.sub(mg)}reflect(t){return this.sub(mg.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let r=Math.sqrt(this.lengthSq()*t.lengthSq());if(r===0)return Math.PI/2;let s=this.dot(t)/r;return Math.acos(qt(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let r=this.x-t.x,s=this.y-t.y,i=this.z-t.z;return r*r+s*s+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,r,s){let i=Math.sin(r)*t;return this.x=i*Math.sin(s),this.y=Math.cos(r)*t,this.z=i*Math.cos(s),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,r,s){return this.x=t*Math.sin(r),this.y=s,this.z=t*Math.cos(r),this}setFromMatrixPosition(t){let r=t.elements;return this.x=r[12],this.y=r[13],this.z=r[14],this}setFromMatrixScale(t){let r=this.setFromMatrixColumn(t,0).length(),s=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=r,this.y=s,this.z=i,this}setFromMatrixColumn(t,r){return this.fromArray(t.elements,r*4)}setFromMatrix3Column(t,r){return this.fromArray(t.elements,r*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this.z=t[r+2],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t[r+2]=this.z,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this.z=t.getZ(r),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,r=Math.random()*2-1,s=Math.sqrt(1-r*r);return this.x=s*Math.cos(t),this.y=r,this.z=s*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};const mg=new ci,TM=new Det;var JA=class my{constructor(t,r,s,i,n,a,o,l,h,u,c,d,p,m,f,x){my.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,r,s,i,n,a,o,l,h,u,c,d,p,m,f,x)}set(t,r,s,i,n,a,o,l,h,u,c,d,p,m,f,x){let b=this.elements;return b[0]=t,b[4]=r,b[8]=s,b[12]=i,b[1]=n,b[5]=a,b[9]=o,b[13]=l,b[2]=h,b[6]=u,b[10]=c,b[14]=d,b[3]=p,b[7]=m,b[11]=f,b[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new my().fromArray(this.elements)}copy(t){let r=this.elements,s=t.elements;return r[0]=s[0],r[1]=s[1],r[2]=s[2],r[3]=s[3],r[4]=s[4],r[5]=s[5],r[6]=s[6],r[7]=s[7],r[8]=s[8],r[9]=s[9],r[10]=s[10],r[11]=s[11],r[12]=s[12],r[13]=s[13],r[14]=s[14],r[15]=s[15],this}copyPosition(t){let r=this.elements,s=t.elements;return r[12]=s[12],r[13]=s[13],r[14]=s[14],this}setFromMatrix3(t){let r=t.elements;return this.set(r[0],r[3],r[6],0,r[1],r[4],r[7],0,r[2],r[5],r[8],0,0,0,0,1),this}extractBasis(t,r,s){return t.setFromMatrixColumn(this,0),r.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this}makeBasis(t,r,s){return this.set(t.x,r.x,s.x,0,t.y,r.y,s.y,0,t.z,r.z,s.z,0,0,0,0,1),this}extractRotation(t){let r=this.elements,s=t.elements,i=1/nl.setFromMatrixColumn(t,0).length(),n=1/nl.setFromMatrixColumn(t,1).length(),a=1/nl.setFromMatrixColumn(t,2).length();return r[0]=s[0]*i,r[1]=s[1]*i,r[2]=s[2]*i,r[3]=0,r[4]=s[4]*n,r[5]=s[5]*n,r[6]=s[6]*n,r[7]=0,r[8]=s[8]*a,r[9]=s[9]*a,r[10]=s[10]*a,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromEuler(t){let r=this.elements,s=t.x,i=t.y,n=t.z,a=Math.cos(s),o=Math.sin(s),l=Math.cos(i),h=Math.sin(i),u=Math.cos(n),c=Math.sin(n);if(t.order==="XYZ"){let d=a*u,p=a*c,m=o*u,f=o*c;r[0]=l*u,r[4]=-l*c,r[8]=h,r[1]=p+m*h,r[5]=d-f*h,r[9]=-o*l,r[2]=f-d*h,r[6]=m+p*h,r[10]=a*l}else if(t.order==="YXZ"){let d=l*u,p=l*c,m=h*u,f=h*c;r[0]=d+f*o,r[4]=m*o-p,r[8]=a*h,r[1]=a*c,r[5]=a*u,r[9]=-o,r[2]=p*o-m,r[6]=f+d*o,r[10]=a*l}else if(t.order==="ZXY"){let d=l*u,p=l*c,m=h*u,f=h*c;r[0]=d-f*o,r[4]=-a*c,r[8]=m+p*o,r[1]=p+m*o,r[5]=a*u,r[9]=f-d*o,r[2]=-a*h,r[6]=o,r[10]=a*l}else if(t.order==="ZYX"){let d=a*u,p=a*c,m=o*u,f=o*c;r[0]=l*u,r[4]=m*h-p,r[8]=d*h+f,r[1]=l*c,r[5]=f*h+d,r[9]=p*h-m,r[2]=-h,r[6]=o*l,r[10]=a*l}else if(t.order==="YZX"){let d=a*l,p=a*h,m=o*l,f=o*h;r[0]=l*u,r[4]=f-d*c,r[8]=m*c+p,r[1]=c,r[5]=a*u,r[9]=-o*u,r[2]=-h*u,r[6]=p*c+m,r[10]=d-f*c}else if(t.order==="XZY"){let d=a*l,p=a*h,m=o*l,f=o*h;r[0]=l*u,r[4]=-c,r[8]=h*u,r[1]=d*c+f,r[5]=a*u,r[9]=p*c-m,r[2]=m*c-p,r[6]=o*u,r[10]=f*c+d}return r[3]=0,r[7]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Uet,t,$et)}lookAt(t,r,s){let i=this.elements;return rs.subVectors(t,r),rs.lengthSq()===0&&(rs.z=1),rs.normalize(),jn.crossVectors(s,rs),jn.lengthSq()===0&&(Math.abs(s.z)===1?rs.x+=1e-4:rs.z+=1e-4,rs.normalize(),jn.crossVectors(s,rs)),jn.normalize(),kd.crossVectors(rs,jn),i[0]=jn.x,i[4]=kd.x,i[8]=rs.x,i[1]=jn.y,i[5]=kd.y,i[9]=rs.y,i[2]=jn.z,i[6]=kd.z,i[10]=rs.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,r){let s=t.elements,i=r.elements,n=this.elements,a=s[0],o=s[4],l=s[8],h=s[12],u=s[1],c=s[5],d=s[9],p=s[13],m=s[2],f=s[6],x=s[10],b=s[14],v=s[3],T=s[7],_=s[11],E=s[15],C=i[0],A=i[4],I=i[8],Q=i[12],ot=i[1],K=i[5],mt=i[9],nt=i[13],yt=i[2],lt=i[6],Nt=i[10],ht=i[14],Mt=i[3],ut=i[7],at=i[11],gt=i[15];return n[0]=a*C+o*ot+l*yt+h*Mt,n[4]=a*A+o*K+l*lt+h*ut,n[8]=a*I+o*mt+l*Nt+h*at,n[12]=a*Q+o*nt+l*ht+h*gt,n[1]=u*C+c*ot+d*yt+p*Mt,n[5]=u*A+c*K+d*lt+p*ut,n[9]=u*I+c*mt+d*Nt+p*at,n[13]=u*Q+c*nt+d*ht+p*gt,n[2]=m*C+f*ot+x*yt+b*Mt,n[6]=m*A+f*K+x*lt+b*ut,n[10]=m*I+f*mt+x*Nt+b*at,n[14]=m*Q+f*nt+x*ht+b*gt,n[3]=v*C+T*ot+_*yt+E*Mt,n[7]=v*A+T*K+_*lt+E*ut,n[11]=v*I+T*mt+_*Nt+E*at,n[15]=v*Q+T*nt+_*ht+E*gt,this}multiplyScalar(t){let r=this.elements;return r[0]*=t,r[4]*=t,r[8]*=t,r[12]*=t,r[1]*=t,r[5]*=t,r[9]*=t,r[13]*=t,r[2]*=t,r[6]*=t,r[10]*=t,r[14]*=t,r[3]*=t,r[7]*=t,r[11]*=t,r[15]*=t,this}determinant(){let t=this.elements,r=t[0],s=t[4],i=t[8],n=t[12],a=t[1],o=t[5],l=t[9],h=t[13],u=t[2],c=t[6],d=t[10],p=t[14],m=t[3],f=t[7],x=t[11],b=t[15];return m*(+n*l*c-i*h*c-n*o*d+s*h*d+i*o*p-s*l*p)+f*(+r*l*p-r*h*d+n*a*d-i*a*p+i*h*u-n*l*u)+x*(+r*h*c-r*o*p-n*a*c+s*a*p+n*o*u-s*h*u)+b*(-i*o*u-r*l*c+r*o*d+i*a*c-s*a*d+s*l*u)}transpose(){let t=this.elements,r;return r=t[1],t[1]=t[4],t[4]=r,r=t[2],t[2]=t[8],t[8]=r,r=t[6],t[6]=t[9],t[9]=r,r=t[3],t[3]=t[12],t[12]=r,r=t[7],t[7]=t[13],t[13]=r,r=t[11],t[11]=t[14],t[14]=r,this}setPosition(t,r,s){let i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=r,i[14]=s),this}invert(){let t=this.elements,r=t[0],s=t[1],i=t[2],n=t[3],a=t[4],o=t[5],l=t[6],h=t[7],u=t[8],c=t[9],d=t[10],p=t[11],m=t[12],f=t[13],x=t[14],b=t[15],v=c*x*h-f*d*h+f*l*p-o*x*p-c*l*b+o*d*b,T=m*d*h-u*x*h-m*l*p+a*x*p+u*l*b-a*d*b,_=u*f*h-m*c*h+m*o*p-a*f*p-u*o*b+a*c*b,E=m*c*l-u*f*l-m*o*d+a*f*d+u*o*x-a*c*x,C=r*v+s*T+i*_+n*E;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let A=1/C;return t[0]=v*A,t[1]=(f*d*n-c*x*n-f*i*p+s*x*p+c*i*b-s*d*b)*A,t[2]=(o*x*n-f*l*n+f*i*h-s*x*h-o*i*b+s*l*b)*A,t[3]=(c*l*n-o*d*n-c*i*h+s*d*h+o*i*p-s*l*p)*A,t[4]=T*A,t[5]=(u*x*n-m*d*n+m*i*p-r*x*p-u*i*b+r*d*b)*A,t[6]=(m*l*n-a*x*n-m*i*h+r*x*h+a*i*b-r*l*b)*A,t[7]=(a*d*n-u*l*n+u*i*h-r*d*h-a*i*p+r*l*p)*A,t[8]=_*A,t[9]=(m*c*n-u*f*n-m*s*p+r*f*p+u*s*b-r*c*b)*A,t[10]=(a*f*n-m*o*n+m*s*h-r*f*h-a*s*b+r*o*b)*A,t[11]=(u*o*n-a*c*n-u*s*h+r*c*h+a*s*p-r*o*p)*A,t[12]=E*A,t[13]=(u*f*i-m*c*i+m*s*d-r*f*d-u*s*x+r*c*x)*A,t[14]=(m*o*i-a*f*i-m*s*l+r*f*l+a*s*x-r*o*x)*A,t[15]=(a*c*i-u*o*i+u*s*l-r*c*l-a*s*d+r*o*d)*A,this}scale(t){let r=this.elements,s=t.x,i=t.y,n=t.z;return r[0]*=s,r[4]*=i,r[8]*=n,r[1]*=s,r[5]*=i,r[9]*=n,r[2]*=s,r[6]*=i,r[10]*=n,r[3]*=s,r[7]*=i,r[11]*=n,this}getMaxScaleOnAxis(){let t=this.elements,r=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],s=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(r,s,i))}makeTranslation(t,r,s){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,r,0,0,1,s,0,0,0,1),this}makeRotationX(t){let r=Math.cos(t),s=Math.sin(t);return this.set(1,0,0,0,0,r,-s,0,0,s,r,0,0,0,0,1),this}makeRotationY(t){let r=Math.cos(t),s=Math.sin(t);return this.set(r,0,s,0,0,1,0,0,-s,0,r,0,0,0,0,1),this}makeRotationZ(t){let r=Math.cos(t),s=Math.sin(t);return this.set(r,-s,0,0,s,r,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,r){let s=Math.cos(r),i=Math.sin(r),n=1-s,a=t.x,o=t.y,l=t.z,h=n*a,u=n*o;return this.set(h*a+s,h*o-i*l,h*l+i*o,0,h*o+i*l,u*o+s,u*l-i*a,0,h*l-i*o,u*l+i*a,n*l*l+s,0,0,0,0,1),this}makeScale(t,r,s){return this.set(t,0,0,0,0,r,0,0,0,0,s,0,0,0,0,1),this}makeShear(t,r,s,i,n,a){return this.set(1,s,n,0,t,1,a,0,r,i,1,0,0,0,0,1),this}compose(t,r,s){let i=this.elements,n=r._x,a=r._y,o=r._z,l=r._w,h=n+n,u=a+a,c=o+o,d=n*h,p=n*u,m=n*c,f=a*u,x=a*c,b=o*c,v=l*h,T=l*u,_=l*c,E=s.x,C=s.y,A=s.z;return i[0]=(1-(f+b))*E,i[1]=(p+_)*E,i[2]=(m-T)*E,i[3]=0,i[4]=(p-_)*C,i[5]=(1-(d+b))*C,i[6]=(x+v)*C,i[7]=0,i[8]=(m+T)*A,i[9]=(x-v)*A,i[10]=(1-(d+f))*A,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,r,s){let i=this.elements,n=nl.set(i[0],i[1],i[2]).length(),a=nl.set(i[4],i[5],i[6]).length(),o=nl.set(i[8],i[9],i[10]).length();this.determinant()<0&&(n=-n),t.x=i[12],t.y=i[13],t.z=i[14],Hs.copy(this);let h=1/n,u=1/a,c=1/o;return Hs.elements[0]*=h,Hs.elements[1]*=h,Hs.elements[2]*=h,Hs.elements[4]*=u,Hs.elements[5]*=u,Hs.elements[6]*=u,Hs.elements[8]*=c,Hs.elements[9]*=c,Hs.elements[10]*=c,r.setFromRotationMatrix(Hs),s.x=n,s.y=a,s.z=o,this}makePerspective(t,r,s,i,n,a,o=Wa){let l=this.elements,h=2*n/(r-t),u=2*n/(s-i),c=(r+t)/(r-t),d=(s+i)/(s-i),p,m;if(o===Wa)p=-(a+n)/(a-n),m=-2*a*n/(a-n);else if(o===py)p=-a/(a-n),m=-a*n/(a-n);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=h,l[4]=0,l[8]=c,l[12]=0,l[1]=0,l[5]=u,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,r,s,i,n,a,o=Wa){let l=this.elements,h=1/(r-t),u=1/(s-i),c=1/(a-n),d=(r+t)*h,p=(s+i)*u,m,f;if(o===Wa)m=(a+n)*c,f=-2*c;else if(o===py)m=n*c,f=-1*c;else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*h,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=f,l[14]=-m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){let r=this.elements,s=t.elements;for(let i=0;i<16;i++)if(r[i]!==s[i])return!1;return!0}fromArray(t,r=0){for(let s=0;s<16;s++)this.elements[s]=t[s+r];return this}toArray(t=[],r=0){let s=this.elements;return t[r]=s[0],t[r+1]=s[1],t[r+2]=s[2],t[r+3]=s[3],t[r+4]=s[4],t[r+5]=s[5],t[r+6]=s[6],t[r+7]=s[7],t[r+8]=s[8],t[r+9]=s[9],t[r+10]=s[10],t[r+11]=s[11],t[r+12]=s[12],t[r+13]=s[13],t[r+14]=s[14],t[r+15]=s[15],t}};const nl=new ci,Hs=new JA,Uet=new ci(0,0,0),$et=new ci(1,1,1),jn=new ci,kd=new ci,rs=new ci;var QA=class KA{constructor(t=0,r=0){KA.prototype.isVector2=!0,this.x=t,this.y=r}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,r){return this.x=t,this.y=r,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;default:throw Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,r){return this.x=t.x+r.x,this.y=t.y+r.y,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,r){return this.x=t.x-r.x,this.y=t.y-r.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let r=this.x,s=this.y,i=t.elements;return this.x=i[0]*r+i[3]*s+i[6],this.y=i[1]*r+i[4]*s+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,r){return this.x=qt(this.x,t.x,r.x),this.y=qt(this.y,t.y,r.y),this}clampScalar(t,r){return this.x=qt(this.x,t,r),this.y=qt(this.y,t,r),this}clampLength(t,r){let s=this.length();return this.divideScalar(s||1).multiplyScalar(qt(s,t,r))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let r=Math.sqrt(this.lengthSq()*t.lengthSq());if(r===0)return Math.PI/2;let s=this.dot(t)/r;return Math.acos(qt(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let r=this.x-t.x,s=this.y-t.y;return r*r+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this}lerpVectors(t,r,s){return this.x=t.x+(r.x-t.x)*s,this.y=t.y+(r.y-t.y)*s,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this}rotateAround(t,r){let s=Math.cos(r),i=Math.sin(r),n=this.x-t.x,a=this.y-t.y;return this.x=n*s-a*i+t.x,this.y=n*i+a*s+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},jet=class tC{constructor(t=0,r=0,s=0,i=1){tC.prototype.isVector4=!0,this.x=t,this.y=r,this.z=s,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,r,s,i){return this.x=t,this.y=r,this.z=s,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;case 2:this.z=r;break;case 3:this.w=r;break;default:throw Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w===void 0?1:t.w,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,r){return this.x=t.x+r.x,this.y=t.y+r.y,this.z=t.z+r.z,this.w=t.w+r.w,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this.z+=t.z*r,this.w+=t.w*r,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,r){return this.x=t.x-r.x,this.y=t.y-r.y,this.z=t.z-r.z,this.w=t.w-r.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let r=this.x,s=this.y,i=this.z,n=this.w,a=t.elements;return this.x=a[0]*r+a[4]*s+a[8]*i+a[12]*n,this.y=a[1]*r+a[5]*s+a[9]*i+a[13]*n,this.z=a[2]*r+a[6]*s+a[10]*i+a[14]*n,this.w=a[3]*r+a[7]*s+a[11]*i+a[15]*n,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let r=Math.sqrt(1-t.w*t.w);return r<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/r,this.y=t.y/r,this.z=t.z/r),this}setAxisAngleFromRotationMatrix(t){let r,s,i,n,a=.01,o=.1,l=t.elements,h=l[0],u=l[4],c=l[8],d=l[1],p=l[5],m=l[9],f=l[2],x=l[6],b=l[10];if(Math.abs(u-d)<a&&Math.abs(c-f)<a&&Math.abs(m-x)<a){if(Math.abs(u+d)<o&&Math.abs(c+f)<o&&Math.abs(m+x)<o&&Math.abs(h+p+b-3)<o)return this.set(1,0,0,0),this;r=Math.PI;let T=(h+1)/2,_=(p+1)/2,E=(b+1)/2,C=(u+d)/4,A=(c+f)/4,I=(m+x)/4;return T>_&&T>E?T<a?(s=0,i=.707106781,n=.707106781):(s=Math.sqrt(T),i=C/s,n=A/s):_>E?_<a?(s=.707106781,i=0,n=.707106781):(i=Math.sqrt(_),s=C/i,n=I/i):E<a?(s=.707106781,i=.707106781,n=0):(n=Math.sqrt(E),s=A/n,i=I/n),this.set(s,i,n,r),this}let v=Math.sqrt((x-m)*(x-m)+(c-f)*(c-f)+(d-u)*(d-u));return Math.abs(v)<.001&&(v=1),this.x=(x-m)/v,this.y=(c-f)/v,this.z=(d-u)/v,this.w=Math.acos((h+p+b-1)/2),this}setFromMatrixPosition(t){let r=t.elements;return this.x=r[12],this.y=r[13],this.z=r[14],this.w=r[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,r){return this.x=qt(this.x,t.x,r.x),this.y=qt(this.y,t.y,r.y),this.z=qt(this.z,t.z,r.z),this.w=qt(this.w,t.w,r.w),this}clampScalar(t,r){return this.x=qt(this.x,t,r),this.y=qt(this.y,t,r),this.z=qt(this.z,t,r),this.w=qt(this.w,t,r),this}clampLength(t,r){let s=this.length();return this.divideScalar(s||1).multiplyScalar(qt(s,t,r))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this.z+=(t.z-this.z)*r,this.w+=(t.w-this.w)*r,this}lerpVectors(t,r,s){return this.x=t.x+(r.x-t.x)*s,this.y=t.y+(r.y-t.y)*s,this.z=t.z+(r.z-t.z)*s,this.w=t.w+(r.w-t.w)*s,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this.z=t[r+2],this.w=t[r+3],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t[r+2]=this.z,t[r+3]=this.w,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this.z=t.getZ(r),this.w=t.getW(r),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};function fy(e,t=0){let r=3735928559^t,s=1103547991^t;if(e instanceof Array)for(let i=0,n;i<e.length;i++)n=e[i],r=Math.imul(r^n,2654435761),s=Math.imul(s^n,1597334677);else for(let i=0,n;i<e.length;i++)n=e.charCodeAt(i),r=Math.imul(r^n,2654435761),s=Math.imul(s^n,1597334677);return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(s^s>>>13,3266489909),s=Math.imul(s^s>>>16,2246822507),s^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&s)+(r>>>0)}const eC=(...e)=>fy(e);function Wet(e,t=!1){let r=[];e.isNode===!0&&(r.push(e.id),e=e.getSelf());for(let{property:s,childNode:i}of gy(e))r.push(fy(s.slice(0,-4)),i.getCacheKey(t));return fy(r)}function*gy(e,t=!1){for(let r in e){if(r.startsWith("_")===!0)continue;let s=e[r];if(Array.isArray(s)===!0)for(let i=0;i<s.length;i++){let n=s[i];n&&(n.isNode===!0||t&&typeof n.toJSON=="function")&&(yield{property:r,index:i,childNode:n})}else if(s&&s.isNode===!0)yield{property:r,childNode:s};else if(typeof s=="object")for(let i in s){let n=s[i];n&&(n.isNode===!0||t&&typeof n.toJSON=="function")&&(yield{property:r,index:i,childNode:n})}}}function yy(e){if(e==null)return null;let t=typeof e;return e.isNode===!0?"node":t==="number"?"float":t==="boolean"?"bool":t==="string"?"string":t==="function"?"shader":e.isVector2===!0?"vec2":e.isVector3===!0?"vec3":e.isVector4===!0?"vec4":e.isMatrix2===!0?"mat2":e.isMatrix3===!0?"mat3":e.isMatrix4===!0?"mat4":e.isColor===!0?"color":e instanceof ArrayBuffer?"ArrayBuffer":null}function rC(e,...t){let r=e?e.slice(-4):void 0;return t.length===1&&(r==="vec2"?t=[t[0],t[0]]:r==="vec3"?t=[t[0],t[0],t[0]]:r==="vec4"&&(t=[t[0],t[0],t[0],t[0]])),e==="color"?new Px(...t):r==="vec2"?new QA(...t):r==="vec3"?new ci(...t):r==="vec4"?new jet(...t):r==="mat2"?new Bet(...t):r==="mat3"?new xc(...t):r==="mat4"?new JA(...t):e==="bool"?t[0]||!1:e==="float"||e==="int"||e==="uint"?t[0]||0:e==="string"?t[0]||"":e==="ArrayBuffer"?Het(t[0]):null}function qet(e){let t="",r=new Uint8Array(e);for(let s=0;s<r.length;s++)t+=String.fromCharCode(r[s]);return btoa(t)}function Het(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0)).buffer}var Get=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){let r=this._listeners;return r===void 0?!1:r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){let r=this._listeners;if(r===void 0)return;let s=r[e];if(s!==void 0){let i=s.indexOf(t);i!==-1&&s.splice(i,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let r=t[e.type];if(r!==void 0){e.target=this;let s=r.slice(0);for(let i=0,n=s.length;i<n;i++)s[i].call(this,e);e.target=null}}};const Xet={analyze:"setup",generate:"analyze"};let Yet=0;var Zet=class extends Get{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=Hn.NONE,this.updateBeforeType=Hn.NONE,this.updateAfterType=Hn.NONE,this.uuid=Fet.generateUUID(),this.version=0,this.global=!1,this.parents=!1,this.isNode=!0,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,"id",{value:Yet++})}set needsUpdate(e){e===!0&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this.getSelf()),this}onFrameUpdate(e){return this.onUpdate(e,Hn.FRAME)}onRenderUpdate(e){return this.onUpdate(e,Hn.RENDER)}onObjectUpdate(e){return this.onUpdate(e,Hn.OBJECT)}onReference(e){return this.updateReference=e.bind(this.getSelf()),this}getSelf(){return this.self||this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:e}of gy(this))yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(let t of this.getChildren())t.traverse(e)}getCacheKey(e=!1){return e||(e=this.version!==this._cacheKeyVersion),(e===!0||this._cacheKey===null)&&(this._cacheKey=eC(Wet(this,e),this.customCacheKey()),this._cacheKeyVersion=this.version),this._cacheKey}customCacheKey(){return 0}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){let t=this.getNodeType(e);return e.getElementType(t)}getMemberType(){return"void"}getNodeType(e){let t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){let t=this.getHash(e);return e.getNodeFromHash(t)||this}setup(e){let t=e.getNodeProperties(this),r=0;for(let s of this.getChildren())t["node"+r++]=s;return t.outputNode||null}analyze(e,t=null){let r=e.increaseUsage(this);if(this.parents===!0){let s=e.getDataFromNode(this,"any");s.stages=s.stages||{},s.stages[e.shaderStage]=s.stages[e.shaderStage]||[],s.stages[e.shaderStage].push(t)}if(r===1){let s=e.getNodeProperties(this);for(let i of Object.values(s))i&&i.isNode===!0&&i.build(e,this)}}generate(e,t){let{outputNode:r}=e.getNodeProperties(this);if(r&&r.isNode===!0)return r.build(e,t)}updateBefore(){console.warn("Abstract function.")}updateAfter(){console.warn("Abstract function.")}update(){console.warn("Abstract function.")}build(e,t=null){let r=this.getShared(e);if(this!==r)return r.build(e,t);let s=e.getDataFromNode(this);s.buildStages=s.buildStages||{},s.buildStages[e.buildStage]=!0;let i=Xet[e.buildStage];if(i&&s.buildStages[i]!==!0){let o=e.getBuildStage();e.setBuildStage(i),this.build(e),e.setBuildStage(o)}e.addNode(this),e.addChain(this);let n=null,a=e.getBuildStage();if(a==="setup"){this.updateReference(e);let o=e.getNodeProperties(this);if(o.initialized!==!0){o.initialized=!0,o.outputNode=this.setup(e)||o.outputNode||null;for(let l of Object.values(o))if(l&&l.isNode===!0){if(l.parents===!0){let h=e.getNodeProperties(l);h.parents=h.parents||[],h.parents.push(this)}l.build(e)}}n=o.outputNode}else if(a==="analyze")this.analyze(e,t);else if(a==="generate")if(this.generate.length===1){let l=this.getNodeType(e),h=e.getDataFromNode(this);n=h.snippet,n===void 0?h.generated===void 0?(h.generated=!0,n=this.generate(e)||"",h.snippet=n):(console.warn("THREE.Node: Recursion detected.",this),n=""):h.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),n=e.format(n,l,t)}else n=this.generate(e,t)||"";return e.removeChain(this),e.addSequentialNode(this),n}getSerializeChildren(){return gy(this)}serialize(e){let t=this.getSerializeChildren(),r={};for(let{property:s,index:i,childNode:n}of t)i===void 0?r[s]=n.toJSON(e.meta).uuid:(r[s]===void 0&&(r[s]=Number.isInteger(i)?[]:{}),r[s][i]=n.toJSON(e.meta).uuid);Object.keys(r).length>0&&(e.inputNodes=r)}deserialize(e){if(e.inputNodes!==void 0){let t=e.meta.nodes;for(let r in e.inputNodes)if(Array.isArray(e.inputNodes[r])){let s=[];for(let i of e.inputNodes[r])s.push(t[i]);this[r]=s}else if(typeof e.inputNodes[r]=="object"){let s={};for(let i in e.inputNodes[r]){let n=e.inputNodes[r][i];s[i]=t[n]}this[r]=s}else{let s=e.inputNodes[r];this[r]=t[s]}}}toJSON(e){let{uuid:t,type:r}=this,s=e===void 0||typeof e=="string";s&&(e={textures:{},images:{},nodes:{}});let i=e.nodes[t];i===void 0&&(i={uuid:t,type:r,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},s!==!0&&(e.nodes[i.uuid]=i),this.serialize(i),delete i.meta);function n(a){let o=[];for(let l in a){let h=a[l];delete h.metadata,o.push(h)}return o}if(s){let a=n(e.textures),o=n(e.images),l=n(e.nodes);a.length>0&&(i.textures=a),o.length>0&&(i.images=o),l.length>0&&(i.nodes=l)}return i}},Qe=Zet,Jet=class extends Qe{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){let s=e.getVectorType(this.getNodeType(e,t)),i=e.getDataFromNode(this);if(i.propertyName!==void 0)return e.format(i.propertyName,s,t);if(s!=="void"&&t!=="void"&&this.hasDependencies(e)){let n=super.build(e,s),a=e.getVarFromNode(this,null,s),o=e.getPropertyName(a);return e.addLineFlowCode(`${o} = ${n}`,this),i.snippet=n,i.propertyName=o,e.format(i.propertyName,s,t)}}return super.build(e,t)}},ms=Jet,Qet=class extends Qe{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}generate(e){let t=this.indexNode.getNodeType(e),r=this.node.build(e),s=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint");return`${r}[ ${s} ]`}},Fx=Qet,Ket=class extends Qe{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){let t=this.node.getNodeType(e),r=null;for(let s of this.convertTo.split("|"))(r===null||e.getTypeLength(t)===e.getTypeLength(s))&&(r=s);return r}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){let r=this.node,s=this.getNodeType(e),i=r.build(e,s);return e.format(i,s,t)}},sC=Ket,trt=class extends ms{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}getNodeType(e){return this.nodeType===null?e.getTypeFromLength(this.nodes.reduce((t,r)=>t+e.getTypeLength(r.getNodeType(e)),0)):e.getVectorType(this.nodeType)}generate(e,t){let r=this.getNodeType(e),s=e.getTypeLength(r),i=this.nodes,n=e.getComponentType(r),a=[],o=0;for(let h of i){if(o>=s){console.error(`THREE.TSL: Length of parameters exceeds maximum length of function '${r}()' type.`);break}let u=h.getNodeType(e),c=e.getTypeLength(u),d;o+c>s&&(console.error(`THREE.TSL: Length of '${r}()' data exceeds maximum length of output type.`),c=s-o,u=e.getTypeFromLength(c)),o+=c,d=h.build(e,u);let p=e.getComponentType(u);p!==n&&(d=e.format(d,p,n)),a.push(d)}let l=`${e.getType(r)}( ${a.join(", ")} )`;return e.format(l,r,t)}},ert=trt;const rrt=yc.join("");var srt=class extends Qe{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(let t of this.components)e=Math.max(yc.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}generate(e,t){let r=this.node,s=e.getTypeLength(r.getNodeType(e)),i=null;if(s>1){let n=null;this.getVectorLength()>=s&&(n=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));let o=r.build(e,n);i=this.components.length===s&&this.components===rrt.slice(0,this.components.length)?e.format(o,n,t):e.format(`${o}.${this.components}`,this.getNodeType(e),t)}else i=r.build(e,t);return i}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}},NM=srt,irt=class extends ms{static get type(){return"SetNode"}constructor(e,t,r){super(),this.sourceNode=e,this.components=t,this.targetNode=r}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{sourceNode:t,components:r,targetNode:s}=this,i=this.getNodeType(e),n=e.getComponentType(s.getNodeType(e)),a=e.getTypeFromLength(r.length,n),o=s.build(e,a),l=t.build(e,i),h=e.getTypeLength(i),u=[];for(let c=0;c<h;c++){let d=yc[c];d===r[0]?(u.push(o),c+=r.length-1):u.push(l+"."+d)}return`${e.getType(i)}( ${u.join(", ")} )`}},nrt=irt,art=class extends ms{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{components:t,sourceNode:r}=this,s=this.getNodeType(e),i=r.build(e),n=e.getVarFromNode(this),a=e.getPropertyName(n);e.addLineFlowCode(a+" = "+i,this);let o=e.getTypeLength(s),l=[],h=0;for(let u=0;u<o;u++){let c=yc[u];c===t[h]?(l.push("1.0 - "+(a+"."+c)),h++):l.push(a+"."+c)}return`${e.getType(s)}( ${l.join(", ")} )`}},ort=art,lrt=class extends Qe{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}getNodeType(){return this.nodeType===null?yy(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=yy(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=qet(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?rC(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){console.warn("Abstract function.")}},Ox=lrt;const SM=/float|u?int/;var urt=class extends Ox{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){let r=this.getNodeType(e);return SM.test(r)&&SM.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),r,t)}},_n=urt,hrt=class extends Qe{static get type(){return"MemberNode"}constructor(e,t){super(),this.node=e,this.property=t,this.isMemberNode=!0}getNodeType(e){return this.node.getMemberType(e,this.property)}generate(e){return this.node.build(e)+"."+this.property}},crt=hrt;let drt=null;const yl=new Map;function W(e,t){if(yl.has(e)){console.warn(`THREE.TSL: Redefinition of method chaining '${e}'.`);return}if(typeof t!="function")throw Error(`THREE.TSL: Node element ${e} is not a function`);yl.set(e,t)}const iC=e=>e.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),_M=e=>iC(e).split("").sort().join(""),nC={setup(e,t){let r=t.shift();return e(_m(r),...t)},get(e,t,r){if(typeof t=="string"&&e[t]===void 0){if(e.isStackNode!==!0&&t==="assign")return(...s)=>(drt.assign(r,...s),r);if(yl.has(t)){let s=yl.get(t);return e.isStackNode?(...i)=>r.add(s(...i)):(...i)=>s(r,...i)}else{if(t==="self")return e;if(t.endsWith("Assign")&&yl.has(t.slice(0,t.length-6))){let s=yl.get(t.slice(0,t.length-6));return e.isStackNode?(...i)=>r.assign(i[0],s(...i)):(...i)=>r.assign(s(r,...i))}else{if(/^[xyzwrgbastpq]{1,4}$/.test(t)===!0)return t=iC(t),xt(new NM(r,t));if(/^set[XYZWRGBASTPQ]{1,4}$/.test(t)===!0)return t=_M(t.slice(3).toLowerCase()),s=>xt(new nrt(e,t,xt(s)));if(/^flip[XYZWRGBASTPQ]{1,4}$/.test(t)===!0)return t=_M(t.slice(4).toLowerCase()),()=>xt(new ort(xt(e),t));if(t==="width"||t==="height"||t==="depth")return t==="width"?t="x":t==="height"?t="y":t==="depth"&&(t="z"),xt(new NM(e,t));if(/^\d+$/.test(t)===!0)return xt(new Fx(r,new _n(Number(t),"uint")));if(/^get$/.test(t)===!0)return s=>xt(new crt(r,s))}}}return Reflect.get(e,t,r)},set(e,t,r,s){return typeof t=="string"&&e[t]===void 0&&(/^[xyzwrgbastpq]{1,4}$/.test(t)===!0||t==="width"||t==="height"||t==="depth"||/^\d+$/.test(t)===!0)?(s[t].assign(r),!0):Reflect.set(e,t,r,s)}},fg=new WeakMap,AM=new WeakMap,prt=function(e,t=null){let r=yy(e);if(r==="node"){let s=fg.get(e);return s===void 0&&(s=new Proxy(e,nC),fg.set(e,s),fg.set(s,s)),s}else{if(t===null&&(r==="float"||r==="boolean")||r&&r!=="shader"&&r!=="string")return xt(xy(e,t));if(r==="shader")return Bs(e)}return e},mrt=function(e,t=null){for(let r in e)e[r]=xt(e[r],t);return e},frt=function(e,t=null){let r=e.length;for(let s=0;s<r;s++)e[s]=xt(e[s],t);return e},grt=function(e,t=null,r=null,s=null){let i=u=>xt(s===null?u:Object.assign(u,s)),n,a=t,o,l;function h(u){let c;return c=a?/[a-z]/i.test(a)?a+"()":a:e.type,o!==void 0&&u.length<o?(console.error(`THREE.TSL: "${c}" parameter length is less than minimum required.`),u.concat(Array(o-u.length).fill(0))):l!==void 0&&u.length>l?(console.error(`THREE.TSL: "${c}" parameter length exceeds limit.`),u.slice(0,l)):u}return t===null?n=(...u)=>i(new e(...tp(h(u)))):r===null?n=(...u)=>i(new e(t,...tp(h(u)))):(r=xt(r),n=(...u)=>i(new e(t,...tp(h(u)),r))),n.setParameterLength=(...u)=>(u.length===1?o=l=u[0]:u.length===2&&([o,l]=u),n),n.setName=u=>(a=u,n),n};var yrt=class extends Qe{constructor(e,t){super(),this.shaderNode=e,this.inputNodes=t,this.isShaderCallNodeInternal=!0}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){let{shaderNode:t,inputNodes:r}=this,s=e.getNodeProperties(t),i=t.namespace&&t.namespace===e.namespace?e.getNamespace("once"):"once";if(s[i])return s[i];let n=null;if(t.layout){let a=AM.get(e.constructor);a===void 0&&(a=new WeakMap,AM.set(e.constructor,a));let o=a.get(t);o===void 0&&(o=xt(e.buildFunctionNode(t)),a.set(t,o)),e.addInclude(o),n=xt(o.call(r))}else{let a=t.jsFunc,o=r!==null||a.length>1?a(r||[],e):a(e);n=xt(o)}return t.once&&(s[i]=n),n}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){let t=e.getNodeProperties(this),r=e.getOutputNamespace();return t[r]=t[r]||this.setupOutput(e),t[r]}build(e,t=null){let r=null,s=e.getBuildStage(),i=e.getNodeProperties(this),n=e.getOutputNamespace(),a=this.getOutputNode(e);if(s==="setup"){let o=e.getNamespace("initialized");i[o]!==!0&&(i[o]=!0,i[n]=this.getOutputNode(e),i[n].build(e)),r=i[n]}else s==="analyze"?a.build(e,t):s==="generate"&&(r=a.build(e,t)||"");return r}},xrt=class extends Qe{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1,this.namespace=null}setLayout(e){return this.layout=e,this}call(e=null){return _m(e),xt(new yrt(this,e))}setup(){return this.call()}};const brt=[!1,!0],vrt=[0,1,2,3],Mrt=[-1,-2],aC=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],kx=new Map;for(let e of brt)kx.set(e,new _n(e));const Bx=new Map;for(let e of vrt)Bx.set(e,new _n(e,"uint"));const Dx=new Map([...Bx].map(e=>new _n(e.value,"int")));for(let e of Mrt)Dx.set(e,new _n(e,"int"));const Nm=new Map([...Dx].map(e=>new _n(e.value)));for(let e of aC)Nm.set(e,new _n(e));for(let e of aC)Nm.set(-e,new _n(-e));const Sm={bool:kx,uint:Bx,ints:Dx,float:Nm},CM=new Map([...kx,...Nm]),xy=(e,t)=>CM.has(e)?CM.get(e):e.isNode===!0?e:new _n(e,t),wrt=e=>{try{return e.getNodeType()}catch{return}},Ke=function(e,t=null){return(...r)=>{if((r.length===0||!["bool","float","int","uint"].includes(e)&&r.every(i=>typeof i!="object"))&&(r=[rC(e,...r)]),r.length===1&&t!==null&&t.has(r[0]))return xt(t.get(r[0]));if(r.length===1){let i=xy(r[0],e);return wrt(i)===e?xt(i):xt(new sC(i,e))}let s=r.map(i=>xy(i));return xt(new ert(s,e))}},Trt=e=>e==null?null:e.nodeType||e.convertTo||(typeof e=="string"?e:null);function Nrt(e,t){return new Proxy(new xrt(e,t),nC)}const xt=(e,t=null)=>prt(e,t),_m=(e,t=null)=>new mrt(e,t),tp=(e,t=null)=>new frt(e,t),rt=(...e)=>new grt(...e);let Srt=0;const Bs=(e,t=null)=>{let r=null;t!==null&&(typeof t=="object"?r=t.return:(typeof t=="string"?r=t:console.error("THREE.TSL: Invalid layout type."),t=null));let s=new Nrt(e,r),i=(...n)=>{let a;_m(n),a=n[0]&&(n[0].isNode||Object.getPrototypeOf(n[0])!==Object.prototype)?[...n]:n[0];let l=s.call(a);return r==="void"&&l.toStack(),l};if(i.shaderNode=s,i.id=s.id,i.getNodeType=(...n)=>s.getNodeType(...n),i.getCacheKey=(...n)=>s.getCacheKey(...n),i.setLayout=n=>(s.setLayout(n),i),i.once=(n=null)=>(s.once=!0,s.namespace=n,i),t!==null){if(typeof t.inputs!="object"){let n={name:"fn"+Srt++,type:r,inputs:[]};for(let a in t)a!=="return"&&n.inputs.push({name:a,type:t[a]});t=n}i.setLayout(t)}return i};function _rt(e){return e}W("toStack",_rt);const Art=new Ke("color"),Li=new Ke("float",Sm.float),Vh=new Ke("int",Sm.ints),Crt=new Ke("uint",Sm.uint),zrt=new Ke("bool",Sm.bool),oC=new Ke("vec2"),Ert=new Ke("ivec2"),Vrt=new Ke("uvec2"),Rrt=new Ke("bvec2"),cu=new Ke("vec3"),Irt=new Ke("ivec3"),Lrt=new Ke("uvec3"),Prt=new Ke("bvec3"),to=new Ke("vec4"),Frt=new Ke("ivec4"),Ort=new Ke("uvec4"),krt=new Ke("bvec4"),Brt=new Ke("mat2"),lC=new Ke("mat3"),Drt=new Ke("mat4");W("toColor",Art),W("toFloat",Li),W("toInt",Vh),W("toUint",Crt),W("toBool",zrt),W("toVec2",oC),W("toIVec2",Ert),W("toUVec2",Vrt),W("toBVec2",Rrt),W("toVec3",cu),W("toIVec3",Irt),W("toUVec3",Lrt),W("toBVec3",Prt),W("toVec4",to),W("toIVec4",Frt),W("toUVec4",Ort),W("toBVec4",krt),W("toMat2",Brt),W("toMat3",lC),W("toMat4",Drt);const Urt=rt(Fx).setParameterLength(2),$rt=(e,t)=>xt(new sC(xt(e),t));W("element",Urt),W("convert",$rt),W("append",e=>(console.warn("THREE.TSL: .append() has been renamed to .toStack()."),e));const jrt={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"};var $e=class by extends ms{static get type(){return"OperatorNode"}constructor(t,r,s,...i){if(super(),i.length>0){let n=new by(t,r,s);for(let a=0;a<i.length-1;a++)n=new by(t,n,i[a]);r=n,s=i[i.length-1]}this.op=t,this.aNode=r,this.bNode=s,this.isOperatorNode=!0}getOperatorMethod(t,r){return t.getMethod(jrt[this.op],r)}getNodeType(t){let r=this.op,s=this.aNode,i=this.bNode,n=s.getNodeType(t),a=i?i.getNodeType(t):null;if(n==="void"||a==="void")return"void";if(r==="%")return n;if(r==="~"||r==="&"||r==="|"||r==="^"||r===">>"||r==="<<")return t.getIntegerType(n);if(r==="!"||r==="&&"||r==="||"||r==="^^")return"bool";if(r==="=="||r==="!="||r==="<"||r===">"||r==="<="||r===">="){let o=Math.max(t.getTypeLength(n),t.getTypeLength(a));return o>1?`bvec${o}`:"bool"}else{if(t.isMatrix(n)){if(a==="float")return n;if(t.isVector(a))return t.getVectorFromMatrix(n);if(t.isMatrix(a))return n}else if(t.isMatrix(a)){if(n==="float")return a;if(t.isVector(n))return t.getVectorFromMatrix(a)}return t.getTypeLength(a)>t.getTypeLength(n)?a:n}}generate(t,r){let s=this.op,{aNode:i,bNode:n}=this,a=this.getNodeType(t),o=null,l=null;a==="void"?o=l=a:(o=i.getNodeType(t),l=n?n.getNodeType(t):null,s==="<"||s===">"||s==="<="||s===">="||s==="=="||s==="!="?t.isVector(o)?l=o:t.isVector(l)?o=l:o!==l&&(o=l="float"):s===">>"||s==="<<"?(o=a,l=t.changeComponentType(l,"uint")):s==="%"?(o=a,l=t.isInteger(o)&&t.isInteger(l)?l:o):t.isMatrix(o)?l==="float"?l="float":t.isVector(l)?l=t.getVectorFromMatrix(o):t.isMatrix(l)||(o=l=a):o=t.isMatrix(l)?o==="float"?"float":t.isVector(o)?t.getVectorFromMatrix(l):l=a:l=a);let h=i.build(t,o),u=n?n.build(t,l):null,c=t.getFunctionOperator(s);if(r!=="void"){let d=t.renderer.coordinateSystem===Wa;if(s==="=="||s==="!="||s==="<"||s===">"||s==="<="||s===">=")return d&&t.isVector(o)?t.format(`${this.getOperatorMethod(t,r)}( ${h}, ${u} )`,a,r):t.format(`( ${h} ${s} ${u} )`,a,r);if(s==="%")return t.isInteger(l)?t.format(`( ${h} % ${u} )`,a,r):t.format(`${this.getOperatorMethod(t,a)}( ${h}, ${u} )`,a,r);if(s==="!"||s==="~")return t.format(`(${s}${h})`,o,r);if(c)return t.format(`${c}( ${h}, ${u} )`,a,r);if(t.isMatrix(o)&&l==="float")return t.format(`( ${u} ${s} ${h} )`,a,r);if(o==="float"&&t.isMatrix(l))return t.format(`${h} ${s} ${u}`,a,r);{let p=`( ${h} ${s} ${u} )`;return!d&&a==="bool"&&t.isVector(o)&&t.isVector(l)&&(p=`all${p}`),t.format(p,a,r)}}else if(o!=="void")return c?t.format(`${c}( ${h}, ${u} )`,a,r):t.isMatrix(o)&&l==="float"?t.format(`${u} ${s} ${h}`,a,r):t.format(`${h} ${s} ${u}`,a,r)}serialize(t){super.serialize(t),t.op=this.op}deserialize(t){super.deserialize(t),this.op=t.op}};const uC=rt($e,"+").setParameterLength(2,1/0).setName("add"),vy=rt($e,"-").setParameterLength(2,1/0).setName("sub"),Ux=rt($e,"*").setParameterLength(2,1/0).setName("mul"),hC=rt($e,"/").setParameterLength(2,1/0).setName("div"),Am=rt($e,"%").setParameterLength(2).setName("mod"),cC=rt($e,"==").setParameterLength(2).setName("equal"),Wrt=rt($e,"!=").setParameterLength(2).setName("notEqual"),qrt=rt($e,"<").setParameterLength(2).setName("lessThan"),Hrt=rt($e,">").setParameterLength(2).setName("greaterThan"),Grt=rt($e,"<=").setParameterLength(2).setName("lessThanEqual"),Xrt=rt($e,">=").setParameterLength(2).setName("greaterThanEqual"),Yrt=rt($e,"&&").setParameterLength(2,1/0).setName("and"),Zrt=rt($e,"||").setParameterLength(2,1/0).setName("or"),Jrt=rt($e,"!").setParameterLength(1).setName("not"),Qrt=rt($e,"^^").setParameterLength(2).setName("xor"),Krt=rt($e,"&").setParameterLength(2).setName("bitAnd"),tst=rt($e,"~").setParameterLength(2).setName("bitNot"),est=rt($e,"|").setParameterLength(2).setName("bitOr"),rst=rt($e,"^").setParameterLength(2).setName("bitXor"),sst=rt($e,"<<").setParameterLength(2).setName("shiftLeft"),ist=rt($e,">>").setParameterLength(2).setName("shiftRight"),nst=Bs(([e])=>(e.addAssign(1),e)),ast=Bs(([e])=>(e.subAssign(1),e)),ost=Bs(([e])=>{let t=Vh(e).toConst();return e.addAssign(1),t}),lst=Bs(([e])=>{let t=Vh(e).toConst();return e.subAssign(1),t});W("add",uC),W("sub",vy),W("mul",Ux),W("div",hC),W("mod",Am),W("equal",cC),W("notEqual",Wrt),W("lessThan",qrt),W("greaterThan",Hrt),W("lessThanEqual",Grt),W("greaterThanEqual",Xrt),W("and",Yrt),W("or",Zrt),W("not",Jrt),W("xor",Qrt),W("bitAnd",Krt),W("bitNot",tst),W("bitOr",est),W("bitXor",rst),W("shiftLeft",sst),W("shiftRight",ist),W("incrementBefore",nst),W("decrementBefore",ast),W("increment",ost),W("decrement",lst);const ust=(e,t)=>(console.warn('THREE.TSL: "remainder()" is deprecated. Use "mod( int( ... ) )" instead.'),Am(e,t)),hst=(e,t)=>(console.warn('THREE.TSL: "modInt()" is deprecated. Use "mod( int( ... ) )" instead.'),Am(Vh(e),Vh(t)));W("remainder",ust),W("modInt",hst);var k=class ue extends ms{static get type(){return"MathNode"}constructor(t,r,s=null,i=null){if(super(),(t===ue.MAX||t===ue.MIN)&&arguments.length>3){let n=new ue(t,r,s);for(let a=2;a<arguments.length-1;a++)n=new ue(t,n,arguments[a]);r=n,s=arguments[arguments.length-1],i=null}this.method=t,this.aNode=r,this.bNode=s,this.cNode=i,this.isMathNode=!0}getInputType(t){let r=this.aNode.getNodeType(t),s=this.bNode?this.bNode.getNodeType(t):null,i=this.cNode?this.cNode.getNodeType(t):null,n=t.isMatrix(r)?0:t.getTypeLength(r),a=t.isMatrix(s)?0:t.getTypeLength(s),o=t.isMatrix(i)?0:t.getTypeLength(i);return n>a&&n>o?r:a>o?s:o>n?i:r}getNodeType(t){let r=this.method;return r===ue.LENGTH||r===ue.DISTANCE||r===ue.DOT?"float":r===ue.CROSS?"vec3":r===ue.ALL||r===ue.ANY?"bool":r===ue.EQUALS?t.changeComponentType(this.aNode.getNodeType(t),"bool"):this.getInputType(t)}setup(t){let{aNode:r,bNode:s,method:i}=this,n=null;if(i===ue.ONE_MINUS)n=vy(1,r);else if(i===ue.RECIPROCAL)n=hC(1,r);else if(i===ue.DIFFERENCE)n=$x(vy(r,s));else if(i===ue.TRANSFORM_DIRECTION){let a=r,o=s;t.isMatrix(a.getNodeType(t))?o=to(cu(o),0):a=to(cu(a),0);let l=Ux(a,o).xyz;n=dC(l)}return n===null?super.setup(t):n}generate(t,r){if(t.getNodeProperties(this).outputNode)return super.generate(t,r);let i=this.method,n=this.getNodeType(t),a=this.getInputType(t),o=this.aNode,l=this.bNode,h=this.cNode,u=t.renderer.coordinateSystem;if(i===ue.NEGATE)return t.format("( - "+o.build(t,a)+" )",n,r);{let c=[];return i===ue.CROSS?c.push(o.build(t,n),l.build(t,n)):u===Wa&&i===ue.STEP?c.push(o.build(t,t.getTypeLength(o.getNodeType(t))===1?"float":a),l.build(t,a)):u===Wa&&(i===ue.MIN||i===ue.MAX)?c.push(o.build(t,a),l.build(t,t.getTypeLength(l.getNodeType(t))===1?"float":a)):i===ue.REFRACT?c.push(o.build(t,a),l.build(t,a),h.build(t,"float")):i===ue.MIX?c.push(o.build(t,a),l.build(t,a),h.build(t,t.getTypeLength(h.getNodeType(t))===1?"float":a)):(u===py&&i===ue.ATAN&&l!==null&&(i="atan2"),t.shaderStage!=="fragment"&&(i===ue.DFDX||i===ue.DFDY)&&(console.warn(`THREE.TSL: '${i}' is not supported in the ${t.shaderStage} stage.`),i="/*"+i+"*/"),c.push(o.build(t,a)),l!==null&&c.push(l.build(t,a)),h!==null&&c.push(h.build(t,a))),t.format(`${t.getMethod(i,n)}( ${c.join(", ")} )`,n,r)}}serialize(t){super.serialize(t),t.method=this.method}deserialize(t){super.deserialize(t),this.method=t.method}};k.ALL="all",k.ANY="any",k.RADIANS="radians",k.DEGREES="degrees",k.EXP="exp",k.EXP2="exp2",k.LOG="log",k.LOG2="log2",k.SQRT="sqrt",k.INVERSE_SQRT="inversesqrt",k.FLOOR="floor",k.CEIL="ceil",k.NORMALIZE="normalize",k.FRACT="fract",k.SIN="sin",k.COS="cos",k.TAN="tan",k.ASIN="asin",k.ACOS="acos",k.ATAN="atan",k.ABS="abs",k.SIGN="sign",k.LENGTH="length",k.NEGATE="negate",k.ONE_MINUS="oneMinus",k.DFDX="dFdx",k.DFDY="dFdy",k.ROUND="round",k.RECIPROCAL="reciprocal",k.TRUNC="trunc",k.FWIDTH="fwidth",k.TRANSPOSE="transpose",k.BITCAST="bitcast",k.EQUALS="equals",k.MIN="min",k.MAX="max",k.STEP="step",k.REFLECT="reflect",k.DISTANCE="distance",k.DIFFERENCE="difference",k.DOT="dot",k.CROSS="cross",k.POW="pow",k.TRANSFORM_DIRECTION="transformDirection",k.MIX="mix",k.CLAMP="clamp",k.REFRACT="refract",k.SMOOTHSTEP="smoothstep",k.FACEFORWARD="faceforward";const cst=Li(Math.PI);Li(Math.PI*2);const dst=rt(k,k.ALL).setParameterLength(1),pst=rt(k,k.ANY).setParameterLength(1),mst=rt(k,k.RADIANS).setParameterLength(1),fst=rt(k,k.DEGREES).setParameterLength(1),gst=rt(k,k.EXP).setParameterLength(1),yst=rt(k,k.EXP2).setParameterLength(1),xst=rt(k,k.LOG).setParameterLength(1),bst=rt(k,k.LOG2).setParameterLength(1),vst=rt(k,k.SQRT).setParameterLength(1),Mst=rt(k,k.INVERSE_SQRT).setParameterLength(1),wst=rt(k,k.FLOOR).setParameterLength(1),Tst=rt(k,k.CEIL).setParameterLength(1),dC=rt(k,k.NORMALIZE).setParameterLength(1),pC=rt(k,k.FRACT).setParameterLength(1),mC=rt(k,k.SIN).setParameterLength(1),Nst=rt(k,k.COS).setParameterLength(1),Sst=rt(k,k.TAN).setParameterLength(1),_st=rt(k,k.ASIN).setParameterLength(1),Ast=rt(k,k.ACOS).setParameterLength(1),fC=rt(k,k.ATAN).setParameterLength(1,2),$x=rt(k,k.ABS).setParameterLength(1),gC=rt(k,k.SIGN).setParameterLength(1),Cst=rt(k,k.LENGTH).setParameterLength(1),zst=rt(k,k.NEGATE).setParameterLength(1),Est=rt(k,k.ONE_MINUS).setParameterLength(1),Vst=rt(k,k.DFDX).setParameterLength(1),Rst=rt(k,k.DFDY).setParameterLength(1),Ist=rt(k,k.ROUND).setParameterLength(1),Lst=rt(k,k.RECIPROCAL).setParameterLength(1),Pst=rt(k,k.TRUNC).setParameterLength(1),Fst=rt(k,k.FWIDTH).setParameterLength(1),Ost=rt(k,k.TRANSPOSE).setParameterLength(1),kst=(e,t)=>(console.warn('THREE.TSL: "equals" is deprecated. Use "equal" inside a vector instead, like: "bvec*( equal( ... ) )"'),cC(e,t)),Bst=rt(k,k.MIN).setParameterLength(2,1/0),Dst=rt(k,k.MAX).setParameterLength(2,1/0),Ust=rt(k,k.STEP).setParameterLength(2),$st=rt(k,k.REFLECT).setParameterLength(2),jst=rt(k,k.DISTANCE).setParameterLength(2),Wst=rt(k,k.DIFFERENCE).setParameterLength(2),bc=rt(k,k.DOT).setParameterLength(2),qst=rt(k,k.CROSS).setParameterLength(2),yC=rt(k,k.POW).setParameterLength(2),Hst=rt(k,k.POW,2).setParameterLength(1),Gst=rt(k,k.POW,3).setParameterLength(1),Xst=rt(k,k.POW,4).setParameterLength(1),Yst=rt(k,k.TRANSFORM_DIRECTION).setParameterLength(2),Zst=e=>Ux(gC(e),yC($x(e),1/3)),Jst=e=>bc(e,e),Cm=rt(k,k.MIX).setParameterLength(3),xC=(e,t=0,r=1)=>xt(new k(k.CLAMP,xt(e),xt(t),xt(r))),Qst=e=>xC(e),Kst=rt(k,k.REFRACT).setParameterLength(3),tit=rt(k,k.SMOOTHSTEP).setParameterLength(3),eit=rt(k,k.FACEFORWARD).setParameterLength(3),rit=Bs(([e])=>{let t=12.9898,r=78.233,s=43758.5453,i=bc(e.xy,oC(t,r)),n=Am(i,cst);return pC(mC(n).mul(s))}),sit=(e,t,r)=>Cm(t,r,e),iit=(e,t,r)=>tit(t,r,e),nit=(e,t)=>(console.warn('THREE.TSL: "atan2" is overloaded. Use "atan" instead.'),fC(e,t));W("all",dst),W("any",pst),W("equals",kst),W("radians",mst),W("degrees",fst),W("exp",gst),W("exp2",yst),W("log",xst),W("log2",bst),W("sqrt",vst),W("inverseSqrt",Mst),W("floor",wst),W("ceil",Tst),W("normalize",dC),W("fract",pC),W("sin",mC),W("cos",Nst),W("tan",Sst),W("asin",_st),W("acos",Ast),W("atan",fC),W("abs",$x),W("sign",gC),W("length",Cst),W("lengthSq",Jst),W("negate",zst),W("oneMinus",Est),W("dFdx",Vst),W("dFdy",Rst),W("round",Ist),W("reciprocal",Lst),W("trunc",Pst),W("fwidth",Fst),W("atan2",nit),W("min",Bst),W("max",Dst),W("step",Ust),W("reflect",$st),W("distance",jst),W("dot",bc),W("cross",qst),W("pow",yC),W("pow2",Hst),W("pow3",Gst),W("pow4",Xst),W("transformDirection",Yst),W("mix",sit),W("clamp",xC),W("refract",Kst),W("smoothstep",iit),W("faceForward",eit),W("difference",Wst),W("saturate",Qst),W("cbrt",Zst),W("transpose",Ost),W("rand",rit);var zM=class extends ms{static get type(){return"ArrayNode"}constructor(e,t,r=null){super(e),this.count=t,this.values=r,this.isArrayNode=!0}getNodeType(e){return this.nodeType===null&&(this.nodeType=this.values[0].getNodeType(e)),this.nodeType}getElementType(e){return this.getNodeType(e)}generate(e){let t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}};const ait=(...e)=>{let t;if(e.length===1){let r=e[0];t=new zM(null,r.length,r)}else{let r=e[0],s=e[1];t=new zM(r,s)}return xt(t)};W("toArray",(e,t)=>ait(Array(t).fill(e)));var bC=class extends Qe{static get type(){return"UniformGroupNode"}constructor(e,t=!1,r=1){super("string"),this.name=e,this.shared=t,this.order=r,this.isUniformGroup=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}};const oit=e=>new bC(e),lit=(e,t=0)=>new bC(e,!0,t),uit=lit("render"),hit=oit("object");var cit=class extends Ox{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=hit}label(e){return this.name=e,this}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){let r=this.getSelf();return e=e.bind(r),super.onUpdate(s=>{let i=e(s,r);i!==void 0&&(this.value=i)},t)}generate(e,t){let r=this.getNodeType(e),s=this.getUniformHash(e),i=e.getNodeFromHash(s);i===void 0&&(e.setHashNode(this,s),i=this);let n=i.getInputType(e),a=e.getUniformFromNode(i,n,e.shaderStage,this.name||e.context.label),o=e.getPropertyName(a);return e.context.label!==void 0&&delete e.context.label,e.format(o,r,t)}};const dit=(e,t)=>{let r=Trt(t||e),s=e;return xt(new cit(s,r))};var pit=class extends Qe{static get type(){return"PropertyNode"}constructor(e,t=null,r=!1){super(e),this.name=t,this.varying=r,this.isPropertyNode=!0,this.global=!0}getHash(e){return this.name||super.getHash(e)}generate(e){let t;return this.varying===!0?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}};const mit=(e,t)=>xt(new pit(e,t));var fit=class extends ms{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}getNodeType(e,t){return t==="void"?"void":this.targetNode.getNodeType(e)}needsSplitAssign(e){let{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){let r=e.getTypeLength(t.node.getNodeType(e));return yc.join("").slice(0,r)!==t.components}return!1}setup(e){let{targetNode:t,sourceNode:r}=this,s=e.getNodeProperties(this);s.sourceNode=r,s.targetNode=t.context({assign:!0})}generate(e,t){let{targetNode:r,sourceNode:s}=e.getNodeProperties(this),i=this.needsSplitAssign(e),n=r.getNodeType(e),a=r.build(e),o=s.build(e,n),l=s.getNodeType(e),h=e.getDataFromNode(this),u;if(h.initialized===!0)t!=="void"&&(u=a);else if(i){let c=e.getVarFromNode(this,null,n),d=e.getPropertyName(c);e.addLineFlowCode(`${d} = ${o}`,this);let p=r.node,m=p.node.context({assign:!0}),f=m.build(e);for(let x=0;x<p.components.length;x++){let b=p.components[x];e.addLineFlowCode(`${f}.${b} = ${d}[ ${x} ]`,this)}t!=="void"&&(u=a)}else u=`${a} = ${o}`,(t==="void"||l==="void")&&(e.addLineFlowCode(u,this),t!=="void"&&(u=a));return h.initialized=!0,e.format(u,n,t)}};const git=rt(fit).setParameterLength(2);W("assign",git);var yit=class extends ms{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}getNodeType(e){return this.functionNode.getNodeType(e)}generate(e){let t=[],r=this.functionNode,s=r.getInputs(e),i=this.parameters,n=(o,l)=>{let h=l.type,u=h==="pointer",c;return c=u?"&"+o.build(e):o.build(e,h),c};if(Array.isArray(i)){if(i.length>s.length)console.error("THREE.TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),i.length=s.length;else if(i.length<s.length)for(console.error("THREE.TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.");i.length<s.length;)i.push(Li(0));for(let o=0;o<i.length;o++)t.push(n(i[o],s[o]))}else for(let o of s){let l=i[o.name];l===void 0?(console.error(`THREE.TSL: Input '${o.name}' not found in 'Fn()'.`),t.push(n(Li(0),o))):t.push(n(l,o))}return`${r.build(e,"property")}( ${t.join(", ")} )`}};const xit=(e,...t)=>(t=t.length>1||t[0]&&t[0].isNode===!0?tp(t):_m(t[0]),xt(new yit(xt(e),t)));W("call",xit);var bit=class extends Qe{static get type(){return"ConditionalNode"}constructor(e,t,r=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=r}getNodeType(e){let{ifNode:t,elseNode:r}=e.getNodeProperties(this);if(t===void 0)return this.setup(e),this.getNodeType(e);let s=t.getNodeType(e);if(r!==null){let i=r.getNodeType(e);if(e.getTypeLength(i)>e.getTypeLength(s))return i}return s}setup(e){let t=this.condNode.cache(),r=this.ifNode.cache(),s=this.elseNode?this.elseNode.cache():null,i=e.context.nodeBlock;e.getDataFromNode(r).parentNodeBlock=i,s!==null&&(e.getDataFromNode(s).parentNodeBlock=i);let n=e.getNodeProperties(this);n.condNode=t,n.ifNode=r.context({nodeBlock:r}),n.elseNode=s?s.context({nodeBlock:s}):null}generate(e,t){let r=this.getNodeType(e),s=e.getDataFromNode(this);if(s.nodeProperty!==void 0)return s.nodeProperty;let{condNode:i,ifNode:n,elseNode:a}=e.getNodeProperties(this),o=e.currentFunctionNode,l=t!=="void",h=l?mit(r).build(e):"";s.nodeProperty=h;let u=i.build(e,"bool");e.addFlowCode(`
151
151
  ${e.tab}if ( ${u} ) {
152
152
 
153
153
  `).addFlowTab();let c=n.build(e,r);if(c&&(l?c=h+" = "+c+";":(c="return "+c+";",o===null&&(console.warn("THREE.TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values."),c="// "+c))),e.removeFlowTab().addFlowCode(e.tab+" "+c+`
@@ -164,5 +164,5 @@ ${e.tab}if ( ${u} ) {
164
164
  `,n+=e.flow.code.replace(/^\t/gm,"")+`
165
165
  `,n+="/* ... */ "+r+` /* ... */
166
166
  `,n+="// #"+i+`#
167
- `,t===null?console.log(n):t(e,n),r}};const ont=(e,t=null)=>xt(new ant(xt(e),t));W("debug",ont);const lnt=Bs(([e])=>NC(e.rgb)),unt=Bs(([e,t=Li(1)])=>t.mix(NC(e.rgb),e.rgb)),hnt=Bs(([e,t=Li(1)])=>{let r=uC(e.r,e.g,e.b).div(3),s=e.r.max(e.g.max(e.b)),i=s.sub(r).mul(t).mul(-3);return Cm(e.rgb,s,i)}),cnt=Bs(([e,t=Li(1)])=>{let r=cu(.57735,.57735,.57735),s=t.cos();return cu(e.rgb.mul(s).add(r.cross(e.rgb).mul(t.sin()).add(r.mul(bc(r,e.rgb).mul(s.oneMinus())))))}),NC=(e,t=cu(He.getLuminanceCoefficients(new ci)))=>bc(e,t),Bl={name:"Grayscale",props:{},fragmentNode:({childNode:e})=>{let{vec4:t}=_e;if(!e)return console.error("You must pass a child component into the Grayscale shader."),t(0);let r=e||t(0,0,0,0);return t(lnt(r.rgb).rgb,r.a)}};function dnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const SC={blendMode:"normal"};try{Bl&&Bl.props&&Object.entries(Bl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(SC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const pnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Bl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>dnt(e,SC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Bl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Bl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Dl={name:"Grid",props:{color:{default:"#ffffff",transform:Br,description:"The color of the grid lines"},cells:{default:10,description:"Number of cells along the shortest canvas edge (creates square cells)"},thickness:{default:1,description:"Thickness of grid lines (normalized, 0.0-1.0)"}},fragmentNode:({uniforms:e})=>{let{vec2:t,vec4:r,fract:s,max:i,screenUV:n,viewportSize:a,fwidth:o,smoothstep:l}=_e,h=a.x.div(a.y),u=t(n.x.mul(h),n.y.oneMinus()),c=e.cells.uniform,d=u.mul(c),p=s(d),m=e.thickness.uniform.mul(.01),f=p.x.min(p.x.oneMinus()),x=p.y.min(p.y.oneMinus()),b=o(d),v=l(m.add(b.x),m,f),T=l(m.add(b.y),m,x),_=i(v,T);return r(e.color.uniform.rgb,e.color.uniform.a.mul(_))}};function mnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const _C={blendMode:"normal"};try{Dl&&Dl.props&&Object.entries(Dl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(_C[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const fnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Dl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>mnt(e,_C),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Dl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Dl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Ul={name:"GridDistortion",props:{smoothness:{default:0,description:"How smooth and flowing the motion is"},intensity:{default:1,description:"Strength of the distortion effect"},swirl:{default:0,description:"Amount of swirl motion"},duration:{default:3,description:"How long the effect persists (higher = longer)"},radius:{default:1,description:"Radius of the distortion effect"},gridSize:{default:20,description:"Resolution of the distortion grid (higher = more detailed)"}},fragmentNode:({uniforms:e,onBeforeRender:t,childNode:r,onCleanup:s,canvas:i})=>{let{vec2:n,vec4:a,float:o,uniform:l,screenUV:h,convertToTexture:u,texture:c}=_e;if(!r)return a(0,0,0,0);let d=Math.round(i.clientWidth),p=Math.round(i.clientHeight),m=u(r,d,p),f=Math.max(8,Math.min(128,Math.floor(e.gridSize.uniform.value))),x=new Float32Array(f*f*2),b=new Ye.DataTexture(x,f,f,Ye.RGFormat,Ye.FloatType);b.magFilter=Ye.LinearFilter,b.minFilter=Ye.LinearFilter,b.needsUpdate=!0;let v=c(b),T=l(.5),_=l(.5),E=l(0),C=l(0),A=.5,I=.5,Q=Date.now();t(({pointer:Mt})=>{let ut=Date.now(),at=Math.min((ut-Q)/1e3,.016);Q=ut;let gt=at>0?(Mt.x-A)/at:0,Ot=at>0?(Mt.y-I)/at:0;E.value=E.value*.85+gt*.15,C.value=C.value*.85+Ot*.15,T.value=Mt.x,_.value=Mt.y;let jt=e.duration.uniform.value,be=e.intensity.uniform.value,se=e.radius.uniform.value*.05,Ae=e.swirl.uniform.value;for(let di=0;di<f;di++)for(let xr=0;xr<f;xr++){let Zt=(di*f+xr)*2;x[Zt]*=1-jt*at,x[Zt+1]*=1-jt*at;let Yr=(xr+.5)/f,pi=(di+.5)/f,Tr=Yr-Mt.x,An=pi-Mt.y,fs=Math.sqrt(Tr*Tr+An*An);if(fs<se*2&&Math.abs(gt)+Math.abs(Ot)>.01){let gs=Math.exp(-fs*fs/(se*se));if(x[Zt]+=E.value*gs*be*at*.5,x[Zt+1]+=C.value*gs*be*at*.5,Ae>0){let Cn=Math.atan2(An,Tr)+Math.PI*.5;x[Zt]+=Math.cos(Cn)*Ae*gs*at*2,x[Zt+1]+=Math.sin(Cn)*Ae*gs*at*2}}x[Zt]=Math.max(-1,Math.min(1,x[Zt])),x[Zt+1]=Math.max(-1,Math.min(1,x[Zt+1]))}b.needsUpdate=!0,A=Mt.x,I=Mt.y}),s(()=>{b.dispose()});let ot=e.gridSize.uniform,K=o(1).div(ot),mt=h.div(K).floor().mul(K).add(K.mul(.5)),nt=v.sample(mt).xy,yt=o(.1),lt=o(-.1),Nt=nt.clamp(n(lt,lt),n(yt,yt)),ht=h.sub(Nt);return m.sample(ht)}};function gnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const AC={blendMode:"normal"};try{Ul&&Ul.props&&Object.entries(Ul.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(AC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const ynt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Ul.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>gnt(e,AC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Ul,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Ul.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},$l={name:"HueShift",props:{shift:{default:0,description:"The amount to shift the hue by"}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec4:r}=_e;if(!t)return console.error("You must pass a child component into the Hue Shift shader."),r(0);let s=t||r(0,0,0,0);return r(cnt(s.rgb,e.shift.uniform).rgb,s.a)}};function xnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const CC={blendMode:"normal"};try{$l&&$l.props&&Object.entries($l.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(CC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const bnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${$l.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>xnt(e,CC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap($l,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,$l.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},jl={name:"ImageTexture",props:{src:{default:"https://picsum.photos/1920/1080",description:"Image URL to display"},fit:{default:"cover",description:"How the image should fit within the canvas"}},fragmentNode:({uniforms:e,onCleanup:t})=>{let{texture:r,screenUV:s}=_e,i=new Ye.TextureLoader,n=i.load(e.src.uniform.value);n.colorSpace=Ye.SRGBColorSpace,n.flipY=!0;let a=r(n);t(()=>{n.dispose()});let o=s.xy.setY(s.y.oneMinus());return a.sample(o)}};function vnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const zC={blendMode:"normal"};try{jl&&jl.props&&Object.entries(jl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(zC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Mnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${jl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>vnt(e,zC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(jl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,jl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Wl={name:"Invert",props:{},fragmentNode:({childNode:e})=>{let{vec4:t,vec3:r}=_e;if(!e)return console.error("You must pass a child component into the Invert shader."),t(0);let s=e||t(0,0,0,0);return t(r(1,1,1).sub(s.rgb),s.a)}};function wnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const EC={blendMode:"normal"};try{Wl&&Wl.props&&Object.entries(Wl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(EC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Tnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Wl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>wnt(e,EC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Wl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Wl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},ql={name:"LinearGradient",props:{startColor:{default:"#1aff00",transform:Br,description:"The starting color of the gradient"},endColor:{default:"#0000ff",transform:Br,description:"The ending color of the gradient"},angle:{default:0,transform:oet,description:"The rotation angle of the gradient (in degrees)"},center:{default:{x:.5,y:.5},transform:gc}},fragmentNode:({uniforms:e})=>{let{vec2:t,mix:r,float:s,cos:i,sin:n,dot:a,radians:o,screenUV:l,abs:h,div:u}=_e,c=o(e.angle.uniform),d=i(c),p=n(c),m=t(d,p),f=t(e.center.uniform[0],e.center.uniform[1].oneMinus()),x=l.sub(f),b=a(x,m),v=s(.5).mul(h(d).add(h(p))),T=u(b,v.max(1e-6)),_=T.mul(.5).add(.5).clamp(s(0),s(1));return r(e.startColor.uniform,e.endColor.uniform,_)}};function Nnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const VC={blendMode:"normal"};try{ql&&ql.props&&Object.entries(ql.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(VC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Snt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${ql.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>Nnt(e,VC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(ql,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,ql.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Hl={name:"Liquify",props:{smoothness:{default:0,description:"How smooth and flowing the motion is (0-1)"},intensity:{default:1,description:"Strength of the distortion effect"},swirl:{default:0,description:"Amount of swirl motion (0-1)"},duration:{default:3,description:"How long the effect persists (higher = longer)"},radius:{default:1,description:"Radius of the distortion effect"}},fragmentNode:({uniforms:e,onBeforeRender:t,childNode:r,onCleanup:s,canvas:i})=>{let{vec2:n,vec4:a,float:o,uniform:l,screenUV:h,convertToTexture:u,texture:c}=_e;if(!r)return a(0,0,0,0);let d=Math.round(i.clientWidth),p=Math.round(i.clientHeight),m=u(r,d,p),f=32,x=new Float32Array(f*f*2),b=new Ye.DataTexture(x,f,f,Ye.RGFormat,Ye.FloatType);b.magFilter=Ye.LinearFilter,b.minFilter=Ye.LinearFilter,b.needsUpdate=!0;let v=c(b),T=l(.5),_=l(.5),E=l(0),C=l(0),A=.5,I=.5,Q=Date.now();t(({pointer:lt})=>{let Nt=Date.now(),ht=Math.min((Nt-Q)/1e3,.016);Q=Nt;let Mt=ht>0?(lt.x-A)/ht:0,ut=ht>0?(lt.y-I)/ht:0;E.value=E.value*.85+Mt*.15,C.value=C.value*.85+ut*.15,T.value=lt.x,_.value=lt.y;let at=e.duration.uniform.value,gt=e.intensity.uniform.value,Ot=e.radius.uniform.value*.05,jt=e.swirl.uniform.value;for(let be=0;be<f;be++)for(let se=0;se<f;se++){let Ae=(be*f+se)*2;x[Ae]*=1-at*ht,x[Ae+1]*=1-at*ht;let di=(se+.5)/f,xr=(be+.5)/f,Zt=di-lt.x,Yr=xr-lt.y,pi=Math.sqrt(Zt*Zt+Yr*Yr);if(pi<Ot*2&&Math.abs(Mt)+Math.abs(ut)>.01){let Tr=Math.exp(-pi*pi/(Ot*Ot));if(x[Ae]+=E.value*Tr*gt*ht*.5,x[Ae+1]+=C.value*Tr*gt*ht*.5,jt>0){let An=Math.atan2(Yr,Zt)+Math.PI*.5;x[Ae]+=Math.cos(An)*jt*Tr*ht*2,x[Ae+1]+=Math.sin(An)*jt*Tr*ht*2}}x[Ae]=Math.max(-1,Math.min(1,x[Ae])),x[Ae+1]=Math.max(-1,Math.min(1,x[Ae+1]))}b.needsUpdate=!0,A=lt.x,I=lt.y}),s(()=>{b.dispose()});let ot=v.sample(h).xy,K=o(.2),mt=o(-.2),nt=ot.clamp(n(mt,mt),n(K,K)),yt=h.sub(nt);return m.sample(yt)}};function _nt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const RC={blendMode:"normal"};try{Hl&&Hl.props&&Object.entries(Hl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(RC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Ant=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Hl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>_nt(e,RC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Hl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Hl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Gl={name:"Pixelate",props:{scale:{default:50,description:"Pixel size - higher values create larger, more visible pixels"}},fragmentNode:({uniforms:e,childNode:t,canvas:r})=>{let{vec4:s,floor:i,screenUV:n,convertToTexture:a}=_e;if(!t)return s(0,0,0,0);let o=Math.round(r.clientWidth),l=Math.round(r.clientHeight),h=a(t,o,l),u=e.scale.uniform,c=i(n.mul(u)).div(u);return h.sample(c)}};function Cnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const IC={blendMode:"normal"};try{Gl&&Gl.props&&Object.entries(Gl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(IC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const znt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Gl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>Cnt(e,IC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Gl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Gl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})};var Ent=class extends ms{static get type(){return"PosterizeNode"}constructor(t,r){super(),this.sourceNode=t,this.stepsNode=r}setup(){let{sourceNode:t,stepsNode:r}=this;return t.mul(r).floor().div(r)}};const Vnt=rt(Ent).setParameterLength(2),Xl={name:"Posterize",props:{intensity:{default:5,description:"The intensity of the posterization effect (lower is more posterized)"}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec4:r,int:s}=_e;if(!t)return console.error("You must pass a child component into the Posterize shader."),r(0);let i=t||r(0,0,0,0);return Vnt(i,s(e.intensity.uniform))}};function Rnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const LC={blendMode:"normal"};try{Xl&&Xl.props&&Object.entries(Xl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(LC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Int=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Xl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>Rnt(e,LC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Xl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Xl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Yl={name:"RadialGradient",props:{startColor:{default:"#ff0000",transform:Br,description:"The starting color at the center of the gradient"},endColor:{default:"#0000ff",transform:Br,description:"The ending color at the edge of the gradient"},center:{default:{x:.5,y:.5},transform:gc,description:"The center point of the radial gradient"},radius:{default:1,description:"The radius of the gradient (normalized, 0.0-1.0)"}},fragmentNode:({uniforms:e})=>{let{vec2:t,mix:r,float:s,distance:i,screenUV:n,viewportSize:a}=_e,o=a.x.div(a.y),l=t(n.x.mul(o),n.y),h=t(e.center.uniform.x.mul(o),e.center.uniform.y.oneMinus()),u=i(l,h),c=u.div(e.radius.uniform).clamp(s(0),s(1));return r(e.startColor.uniform,e.endColor.uniform,c)}};function Lnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const PC={blendMode:"normal"};try{Yl&&Yl.props&&Object.entries(Yl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(PC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Pnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Yl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>Lnt(e,PC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Yl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Yl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Zl={name:"Ripple",props:{intensity:{default:1,description:"Overall ripple intensity"},rippleSpeed:{default:150,description:"Speed of ripple expansion"},damping:{default:.95,description:"Water damping (higher = less decay)"},mouseIntensity:{default:1,description:"Mouse movement ripple strength"}},fragmentNode:({uniforms:e,onBeforeRender:t,childNode:r,onCleanup:s,canvas:i})=>{let{vec2:n,vec4:a,screenUV:o,convertToTexture:l,texture:h}=_e;if(!r)return a(0,0,0,0);let u=Math.round(i.clientWidth),c=Math.round(i.clientHeight),d=l(r,u,c),p=128,m={current:new Float32Array(p*p),previous:new Float32Array(p*p)};for(let nt=0;nt<p*p;nt++)m.current[nt]=0,m.previous[nt]=0;let f=new Ye.DataTexture(m.current,p,p,Ye.RedFormat,Ye.FloatType);f.minFilter=Ye.LinearFilter,f.magFilter=Ye.LinearFilter,f.needsUpdate=!0;let x=h(f),b=.5,v=.5,T=0,_=(nt,yt,lt)=>{let Nt=nt/i.clientWidth,ht=yt/i.clientHeight,Mt=Math.floor(Nt*p),ut=Math.floor(ht*p),at=8,gt=lt*.5;for(let Ot=-8;Ot<=at;Ot++)for(let jt=-8;jt<=at;jt++){let be=Ot*Ot+jt*jt;if(be<=at*at){let se=Mt+Ot,Ae=ut+jt;if(se>=0&&se<p&&Ae>=0&&Ae<p){let di=Ae*p+se,xr=Math.sqrt(be),Zt=1-xr/at,Yr=Math.cos(xr/at*Math.PI*.5)*gt*Zt;m.previous[di]+=Yr}}}},E=()=>{let nt=e.damping.uniform.value;for(let lt=1;lt<p-1;lt++)for(let Nt=1;Nt<p-1;Nt++){let ht=lt*p+Nt,Mt=m.previous[ht-p],ut=m.previous[ht+p],at=m.previous[ht-1],gt=m.previous[ht+1];m.current[ht]=(Mt+ut+at+gt)/2-m.current[ht],m.current[ht]*=nt,m.current[ht]=Math.max(-2,Math.min(2,m.current[ht]))}for(let lt=0;lt<p;lt++)m.current[lt]=0,m.current[(p-1)*p+lt]=0,m.current[lt*p]=0,m.current[lt*p+(p-1)]=0;let yt=m.current;m.current=m.previous,m.previous=yt,f.image.data=m.current,f.needsUpdate=!0};t(({pointer:nt})=>{let yt=performance.now();if(yt-T>=16){T=yt;let lt=nt.x*i.clientWidth,Nt=nt.y*i.clientHeight,ht=lt-b*i.clientWidth,Mt=Nt-v*i.clientHeight,ut=Math.sqrt(ht*ht+Mt*Mt);if(ut>2){let at=ut/16,gt=Math.min(at/10,2),Ot=Math.min(ut/20,1),jt=Ot*gt*e.mouseIntensity.uniform.value;_(lt,Nt,jt)}b=nt.x,v=nt.y}E()}),s(()=>{f.dispose()});let C=o,A=e.intensity.uniform,I=1/p,Q=x.sample(C.add(n(I,0))).r.sub(x.sample(C.sub(n(I,0))).r),ot=x.sample(C.add(n(0,I))).r.sub(x.sample(C.sub(n(0,I))).r),K=n(Q,ot).mul(A).mul(.05),mt=o.add(K);return d.sample(mt)}};function Fnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const FC={blendMode:"normal"};try{Zl&&Zl.props&&Object.entries(Zl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(FC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Ont=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Zl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>Fnt(e,FC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Zl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Zl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Jl={name:"Saturation",props:{intensity:{default:1,description:"The intensity of the saturation effect (1 being no change)"}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec4:r}=_e;if(!t)return console.error("You must pass a child component into the Saturation shader."),r(0);let s=t||r(0,0,0,0);return r(unt(s.rgb,e.intensity.uniform).rgb,s.a)}};function knt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const OC={blendMode:"normal"};try{Jl&&Jl.props&&Object.entries(Jl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(OC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Bnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Jl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>knt(e,OC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Jl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Jl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Ql={name:"SolidColor",props:{color:{default:"#5b18ca",transform:Br,description:"The solid color to display"}},fragmentNode:({uniforms:e})=>e.color.uniform};function Dnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const kC={blendMode:"normal"};try{Ql&&Ql.props&&Object.entries(Ql.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(kC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Unt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Ql.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>Dnt(e,kC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Ql,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Ql.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Kl={name:"Spiral",props:{colorBack:{default:"#000000",transform:Br,description:"Background color"},colorFront:{default:"#ffffff",transform:Br,description:"Spiral stroke color"},strokeWidth:{default:.5,description:"Thickness of spiral stroke"},strokeFalloff:{default:0,description:"Stroke losing width further from center"},softness:{default:0,description:"Color transition sharpness (0 = hard edge, 1 = smooth fade)"},speed:{default:1,description:"Animation speed (negative values reverse direction)"},center:{default:{x:.5,y:.5},transform:gc,description:"The center point of the spiral"},scale:{default:1,description:"Scale factor for spiral bands (higher = more bands, lower = fewer bands)"}},fragmentNode:({uniforms:e})=>{let{vec2:t,vec4:r,float:s,atan2:i,length:n,clamp:a,fract:o,abs:l,mix:h,smoothstep:u,screenUV:c,time:d,fwidth:p,viewportSize:m}=_e,f=m.x.div(m.y),x=t(c.x.mul(f),c.y),b=t(e.center.uniform.x.mul(f),e.center.uniform.y.oneMinus()),v=x.sub(b),T=d.mul(e.speed.uniform),_=n(v),E=_,C=i(v.y,v.x).sub(T),A=s(6.283185307),I=C.div(A),Q=E.mul(e.scale.uniform).add(I),ot=o(Q),K=l(ot.sub(.5)).mul(2),mt=a(e.strokeWidth.uniform,e.strokeFalloff.uniform.mul(.005),1),nt=a(e.strokeFalloff.uniform,0,1).mul(_).oneMinus(),yt=mt.mul(nt),lt=p(Q),Nt=s(4).sub(u(.05,.4,e.strokeWidth.uniform.mul(2)).mul(u(.05,.4,e.strokeWidth.uniform.oneMinus().mul(2))).mul(3)),ht=h(Nt.mul(lt),p(K),a(lt,0,1)),Mt=u(yt.sub(ht).sub(e.softness.uniform),yt.add(ht).add(e.softness.uniform),K),ut=e.colorFront.uniform.rgb.mul(e.colorFront.uniform.a),at=e.colorFront.uniform.a,gt=e.colorBack.uniform.rgb.mul(e.colorBack.uniform.a),Ot=e.colorBack.uniform.a,jt=ut.mul(Mt),be=at.mul(Mt),se=jt.add(gt.mul(be.oneMinus())),Ae=be.add(Ot.mul(be.oneMinus()));return r(se,Ae)}};function $nt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const BC={blendMode:"normal"};try{Kl&&Kl.props&&Object.entries(Kl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(BC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const jnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Kl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>$nt(e,BC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Kl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Kl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},tu={name:"Swirl",props:{colorA:{default:"#1275d8",description:"Primary gradient color",transform:Br},colorB:{default:"#e19136",description:"Secondary gradient color",transform:Br},colorC:{default:"#320485",description:"Accent gradient color",transform:Br},speed:{default:1,description:"Flow animation speed"},scale:{default:5,description:"Gradient scale"},complexity:{default:5,description:"Flow complexity"}},fragmentNode:({uniforms:e})=>{let t=_0(),r=S0.mul(e.speed.uniform),s=e.scale.uniform,i=e.complexity.uniform,n=Zn(t.x.mul(s.mul(1.2)).add(r.mul(.8))).mul(.3),a=Gd(t.y.mul(s.mul(.9)).sub(r.mul(.6))).mul(.3),o=A0(t.x.add(Zn(t.y.mul(i.mul(2)).add(r)).mul(.08)),t.y.add(Gd(t.x.mul(i.mul(1.5)).sub(r.mul(.7))).mul(.08))),l=Zn(o.x.mul(s.mul(3)).add(o.y.mul(s.mul(2))).add(r.mul(.5))),h=Gd(o.x.sub(o.y).mul(s.mul(2.5)).add(r.mul(.3))),u=Zn(o.x.mul(i).add(n).add(o.y.mul(i.mul(.8)).add(a)).add(r.mul(.4))),c=Nl(l,h,u.mul(.5).add(.5)),d=o.x.mul(.7).add(o.y.mul(.3)).add(c.mul(.2)),p=Nl(e.colorA.uniform,e.colorB.uniform,kg(.1,.6,d)),m=Nl(p,e.colorC.uniform,kg(.4,.9,d.add(u.mul(.3)))),f=Zn(r.mul(3).add(d.mul(10))).mul(.02).add(1),x=m.mul(f);return oh(x,1)}};function Wnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const DC={blendMode:"normal"};try{tu&&tu.props&&Object.entries(tu.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(DC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const qnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${tu.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>Wnt(e,DC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(tu,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,tu.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},eu={name:"Twirl",props:{center:{default:{x:.5,y:.5},transform:gc,description:"The center point of the twirl effect"},intensity:{default:1,description:"The strength of the twirl effect"}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec2:r,vec4:s,cos:i,sin:n,length:a,screenUV:o,convertToTexture:l}=_e;if(!t)return console.error("You must pass a child component into the Twirl shader."),s(0);let h=l(t),u=o,c=r(e.center.uniform.x,e.center.uniform.y.oneMinus()),d=u.sub(c),p=e.intensity.uniform.mul(a(d)),m=i(p),f=n(p),x=m.mul(d.x).sub(f.mul(d.y)),b=f.mul(d.x).add(m.mul(d.y)),v=r(x.add(c.x),b.add(c.y));return s(h.sample(v))}};function Hnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const UC={blendMode:"normal"};try{eu&&eu.props&&Object.entries(eu.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(UC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Gnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${eu.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>Hnt(e,UC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(eu,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,eu.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},ru={name:"Vibrance",props:{intensity:{default:0,description:"The intensity of the vibrance effect"}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec4:r}=_e;if(!t)return console.error("You must pass a child component into the Vibrance shader."),r(0);let s=t||r(0,0,0,0);return r(hnt(s.rgb,e.intensity.uniform).rgb,s.a)}};function Xnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const $C={blendMode:"normal"};try{ru&&ru.props&&Object.entries(ru.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&($C[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Ynt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${ru.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>Xnt(e,$C),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(ru,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,ru.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})};exports.Ascii=iK;exports.Checkerboard=het;exports.Circle=det;exports.DotGrid=met;exports.FilmGrain=get;exports.GlassTiles=xet;exports.Grayscale=pnt;exports.Grid=fnt;exports.GridDistortion=ynt;exports.HueShift=bnt;exports.ImageTexture=Mnt;exports.Invert=Tnt;exports.LinearGradient=Snt;exports.Liquify=Ant;exports.Pixelate=znt;exports.Posterize=Int;exports.RadialGradient=Pnt;exports.Ripple=Ont;exports.Saturation=Bnt;exports.Shader=rK;exports.SolidColor=Unt;exports.Spiral=jnt;exports.Swirl=qnt;exports.Twirl=Gnt;exports.Vibrance=Ynt;
167
+ `,t===null?console.log(n):t(e,n),r}};const ont=(e,t=null)=>xt(new ant(xt(e),t));W("debug",ont);const lnt=Bs(([e])=>NC(e.rgb)),unt=Bs(([e,t=Li(1)])=>t.mix(NC(e.rgb),e.rgb)),hnt=Bs(([e,t=Li(1)])=>{let r=uC(e.r,e.g,e.b).div(3),s=e.r.max(e.g.max(e.b)),i=s.sub(r).mul(t).mul(-3);return Cm(e.rgb,s,i)}),cnt=Bs(([e,t=Li(1)])=>{let r=cu(.57735,.57735,.57735),s=t.cos();return cu(e.rgb.mul(s).add(r.cross(e.rgb).mul(t.sin()).add(r.mul(bc(r,e.rgb).mul(s.oneMinus())))))}),NC=(e,t=cu(He.getLuminanceCoefficients(new ci)))=>bc(e,t),Bl={name:"Grayscale",props:{},fragmentNode:({childNode:e})=>{let{vec4:t}=_e;if(!e)return console.error("You must pass a child component into the Grayscale shader."),t(0);let r=e||t(0,0,0,0);return t(lnt(r.rgb).rgb,r.a)}};function dnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const SC={blendMode:"normal"};try{Bl&&Bl.props&&Object.entries(Bl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(SC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const pnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Bl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>dnt(e,SC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Bl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Bl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Dl={name:"Grid",props:{color:{default:"#ffffff",transform:Br,description:"The color of the grid lines",ui:{type:"color",label:"Color"}},cells:{default:10,description:"Number of cells along the shortest canvas edge (creates square cells)",ui:{type:"range",min:1,max:50,step:1,label:"Cells"}},thickness:{default:1,description:"Thickness of grid lines (normalized, 0.0-1.0)",ui:{type:"range",min:0,max:5,step:.1,label:"Thickness"}}},fragmentNode:({uniforms:e})=>{let{vec2:t,vec4:r,fract:s,max:i,screenUV:n,viewportSize:a,fwidth:o,smoothstep:l}=_e,h=a.x.div(a.y),u=t(n.x.mul(h),n.y.oneMinus()),c=e.cells.uniform,d=u.mul(c),p=s(d),m=e.thickness.uniform.mul(.01),f=p.x.min(p.x.oneMinus()),x=p.y.min(p.y.oneMinus()),b=o(d),v=l(m.add(b.x),m,f),T=l(m.add(b.y),m,x),_=i(v,T);return r(e.color.uniform.rgb,e.color.uniform.a.mul(_))}};function mnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const _C={blendMode:"normal"};try{Dl&&Dl.props&&Object.entries(Dl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(_C[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const fnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Dl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>mnt(e,_C),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Dl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Dl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Ul={name:"GridDistortion",props:{smoothness:{default:0,description:"How smooth and flowing the motion is",ui:{type:"range",min:0,max:1,step:.01,label:"Smoothness"}},intensity:{default:1,description:"Strength of the distortion effect",ui:{type:"range",min:0,max:5,step:.1,label:"Intensity"}},swirl:{default:0,description:"Amount of swirl motion",ui:{type:"range",min:0,max:2,step:.1,label:"Swirl"}},duration:{default:3,description:"How long the effect persists (higher = longer)",ui:{type:"range",min:0,max:10,step:.1,label:"Duration"}},radius:{default:1,description:"Radius of the distortion effect",ui:{type:"range",min:0,max:3,step:.01,label:"Radius"}},gridSize:{default:20,description:"Resolution of the distortion grid (higher = more detailed)",ui:{type:"range",min:8,max:128,step:1,label:"Grid Size"}}},fragmentNode:({uniforms:e,onBeforeRender:t,childNode:r,onCleanup:s,canvas:i})=>{let{vec2:n,vec4:a,float:o,uniform:l,screenUV:h,convertToTexture:u,texture:c}=_e;if(!r)return a(0,0,0,0);let d=Math.round(i.clientWidth),p=Math.round(i.clientHeight),m=u(r,d,p),f=Math.max(8,Math.min(128,Math.floor(e.gridSize.uniform.value))),x=new Float32Array(f*f*2),b=new Ye.DataTexture(x,f,f,Ye.RGFormat,Ye.FloatType);b.magFilter=Ye.LinearFilter,b.minFilter=Ye.LinearFilter,b.needsUpdate=!0;let v=c(b),T=l(.5),_=l(.5),E=l(0),C=l(0),A=.5,I=.5,Q=Date.now();t(({pointer:Mt})=>{let ut=Date.now(),at=Math.min((ut-Q)/1e3,.016);Q=ut;let gt=at>0?(Mt.x-A)/at:0,Ot=at>0?(Mt.y-I)/at:0;E.value=E.value*.85+gt*.15,C.value=C.value*.85+Ot*.15,T.value=Mt.x,_.value=Mt.y;let jt=e.duration.uniform.value,be=e.intensity.uniform.value,se=e.radius.uniform.value*.05,Ae=e.swirl.uniform.value;for(let di=0;di<f;di++)for(let xr=0;xr<f;xr++){let Zt=(di*f+xr)*2;x[Zt]*=1-jt*at,x[Zt+1]*=1-jt*at;let Yr=(xr+.5)/f,pi=(di+.5)/f,Tr=Yr-Mt.x,An=pi-Mt.y,fs=Math.sqrt(Tr*Tr+An*An);if(fs<se*2&&Math.abs(gt)+Math.abs(Ot)>.01){let gs=Math.exp(-fs*fs/(se*se));if(x[Zt]+=E.value*gs*be*at*.5,x[Zt+1]+=C.value*gs*be*at*.5,Ae>0){let Cn=Math.atan2(An,Tr)+Math.PI*.5;x[Zt]+=Math.cos(Cn)*Ae*gs*at*2,x[Zt+1]+=Math.sin(Cn)*Ae*gs*at*2}}x[Zt]=Math.max(-1,Math.min(1,x[Zt])),x[Zt+1]=Math.max(-1,Math.min(1,x[Zt+1]))}b.needsUpdate=!0,A=Mt.x,I=Mt.y}),s(()=>{b.dispose()});let ot=e.gridSize.uniform,K=o(1).div(ot),mt=h.div(K).floor().mul(K).add(K.mul(.5)),nt=v.sample(mt).xy,yt=o(.1),lt=o(-.1),Nt=nt.clamp(n(lt,lt),n(yt,yt)),ht=h.sub(Nt);return m.sample(ht)}};function gnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const AC={blendMode:"normal"};try{Ul&&Ul.props&&Object.entries(Ul.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(AC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const ynt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Ul.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>gnt(e,AC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Ul,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Ul.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},$l={name:"HueShift",props:{shift:{default:0,description:"The amount to shift the hue by",ui:{type:"range",min:-180,max:180,step:1,label:"Shift"}}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec4:r}=_e;if(!t)return console.error("You must pass a child component into the Hue Shift shader."),r(0);let s=t||r(0,0,0,0);return r(cnt(s.rgb,e.shift.uniform).rgb,s.a)}};function xnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const CC={blendMode:"normal"};try{$l&&$l.props&&Object.entries($l.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(CC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const bnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${$l.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>xnt(e,CC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap($l,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,$l.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},jl={name:"ImageTexture",props:{src:{default:"https://picsum.photos/1920/1080",description:"Image URL to display",ui:{type:"text",label:"Source URL"}},fit:{default:"cover",description:"How the image should fit within the canvas"}},fragmentNode:({uniforms:e,onCleanup:t})=>{let{texture:r,screenUV:s}=_e,i=new Ye.TextureLoader,n=i.load(e.src.uniform.value);n.colorSpace=Ye.SRGBColorSpace,n.flipY=!0;let a=r(n);t(()=>{n.dispose()});let o=s.xy.setY(s.y.oneMinus());return a.sample(o)}};function vnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const zC={blendMode:"normal"};try{jl&&jl.props&&Object.entries(jl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(zC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Mnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${jl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>vnt(e,zC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(jl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,jl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Wl={name:"Invert",props:{},fragmentNode:({childNode:e})=>{let{vec4:t,vec3:r}=_e;if(!e)return console.error("You must pass a child component into the Invert shader."),t(0);let s=e||t(0,0,0,0);return t(r(1,1,1).sub(s.rgb),s.a)}};function wnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const EC={blendMode:"normal"};try{Wl&&Wl.props&&Object.entries(Wl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(EC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Tnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Wl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>wnt(e,EC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Wl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Wl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},ql={name:"LinearGradient",props:{startColor:{default:"#1aff00",transform:Br,description:"The starting color of the gradient",ui:{type:"color",label:"Start Color"}},endColor:{default:"#0000ff",transform:Br,description:"The ending color of the gradient",ui:{type:"color",label:"End Color"}},angle:{default:0,transform:oet,description:"The rotation angle of the gradient (in degrees)",ui:{type:"range",min:0,max:360,step:1,label:"Angle"}},center:{default:{x:.5,y:.5},transform:gc}},fragmentNode:({uniforms:e})=>{let{vec2:t,mix:r,float:s,cos:i,sin:n,dot:a,radians:o,screenUV:l,abs:h,div:u}=_e,c=o(e.angle.uniform),d=i(c),p=n(c),m=t(d,p),f=t(e.center.uniform[0],e.center.uniform[1].oneMinus()),x=l.sub(f),b=a(x,m),v=s(.5).mul(h(d).add(h(p))),T=u(b,v.max(1e-6)),_=T.mul(.5).add(.5).clamp(s(0),s(1));return r(e.startColor.uniform,e.endColor.uniform,_)}};function Nnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const VC={blendMode:"normal"};try{ql&&ql.props&&Object.entries(ql.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(VC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Snt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${ql.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>Nnt(e,VC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(ql,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,ql.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Hl={name:"Liquify",props:{smoothness:{default:0,description:"How smooth and flowing the motion is (0-1)",ui:{type:"range",min:0,max:1,step:.01,label:"Smoothness"}},intensity:{default:1,description:"Strength of the distortion effect",ui:{type:"range",min:0,max:5,step:.1,label:"Intensity"}},swirl:{default:0,description:"Amount of swirl motion (0-1)",ui:{type:"range",min:0,max:1,step:.01,label:"Swirl"}},duration:{default:3,description:"How long the effect persists (higher = longer)",ui:{type:"range",min:0,max:10,step:.1,label:"Duration"}},radius:{default:1,description:"Radius of the distortion effect",ui:{type:"range",min:0,max:3,step:.01,label:"Radius"}}},fragmentNode:({uniforms:e,onBeforeRender:t,childNode:r,onCleanup:s,canvas:i})=>{let{vec2:n,vec4:a,float:o,uniform:l,screenUV:h,convertToTexture:u,texture:c}=_e;if(!r)return a(0,0,0,0);let d=Math.round(i.clientWidth),p=Math.round(i.clientHeight),m=u(r,d,p),f=32,x=new Float32Array(f*f*2),b=new Ye.DataTexture(x,f,f,Ye.RGFormat,Ye.FloatType);b.magFilter=Ye.LinearFilter,b.minFilter=Ye.LinearFilter,b.needsUpdate=!0;let v=c(b),T=l(.5),_=l(.5),E=l(0),C=l(0),A=.5,I=.5,Q=Date.now();t(({pointer:lt})=>{let Nt=Date.now(),ht=Math.min((Nt-Q)/1e3,.016);Q=Nt;let Mt=ht>0?(lt.x-A)/ht:0,ut=ht>0?(lt.y-I)/ht:0;E.value=E.value*.85+Mt*.15,C.value=C.value*.85+ut*.15,T.value=lt.x,_.value=lt.y;let at=e.duration.uniform.value,gt=e.intensity.uniform.value,Ot=e.radius.uniform.value*.05,jt=e.swirl.uniform.value;for(let be=0;be<f;be++)for(let se=0;se<f;se++){let Ae=(be*f+se)*2;x[Ae]*=1-at*ht,x[Ae+1]*=1-at*ht;let di=(se+.5)/f,xr=(be+.5)/f,Zt=di-lt.x,Yr=xr-lt.y,pi=Math.sqrt(Zt*Zt+Yr*Yr);if(pi<Ot*2&&Math.abs(Mt)+Math.abs(ut)>.01){let Tr=Math.exp(-pi*pi/(Ot*Ot));if(x[Ae]+=E.value*Tr*gt*ht*.5,x[Ae+1]+=C.value*Tr*gt*ht*.5,jt>0){let An=Math.atan2(Yr,Zt)+Math.PI*.5;x[Ae]+=Math.cos(An)*jt*Tr*ht*2,x[Ae+1]+=Math.sin(An)*jt*Tr*ht*2}}x[Ae]=Math.max(-1,Math.min(1,x[Ae])),x[Ae+1]=Math.max(-1,Math.min(1,x[Ae+1]))}b.needsUpdate=!0,A=lt.x,I=lt.y}),s(()=>{b.dispose()});let ot=v.sample(h).xy,K=o(.2),mt=o(-.2),nt=ot.clamp(n(mt,mt),n(K,K)),yt=h.sub(nt);return m.sample(yt)}};function _nt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const RC={blendMode:"normal"};try{Hl&&Hl.props&&Object.entries(Hl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(RC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Ant=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Hl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>_nt(e,RC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Hl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Hl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Gl={name:"Pixelate",props:{scale:{default:50,description:"Pixel size - higher values create larger, more visible pixels",ui:{type:"range",min:1,max:200,step:1,label:"Scale"}}},fragmentNode:({uniforms:e,childNode:t,canvas:r})=>{let{vec4:s,floor:i,screenUV:n,convertToTexture:a}=_e;if(!t)return s(0,0,0,0);let o=Math.round(r.clientWidth),l=Math.round(r.clientHeight),h=a(t,o,l),u=e.scale.uniform,c=i(n.mul(u)).div(u);return h.sample(c)}};function Cnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const IC={blendMode:"normal"};try{Gl&&Gl.props&&Object.entries(Gl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(IC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const znt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Gl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>Cnt(e,IC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Gl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Gl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})};var Ent=class extends ms{static get type(){return"PosterizeNode"}constructor(t,r){super(),this.sourceNode=t,this.stepsNode=r}setup(){let{sourceNode:t,stepsNode:r}=this;return t.mul(r).floor().div(r)}};const Vnt=rt(Ent).setParameterLength(2),Xl={name:"Posterize",props:{intensity:{default:5,description:"The intensity of the posterization effect (lower is more posterized)",ui:{type:"range",min:2,max:20,step:1,label:"Intensity"}}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec4:r,int:s}=_e;if(!t)return console.error("You must pass a child component into the Posterize shader."),r(0);let i=t||r(0,0,0,0);return Vnt(i,s(e.intensity.uniform))}};function Rnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const LC={blendMode:"normal"};try{Xl&&Xl.props&&Object.entries(Xl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(LC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Int=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Xl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>Rnt(e,LC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Xl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Xl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Yl={name:"RadialGradient",props:{startColor:{default:"#ff0000",transform:Br,description:"The starting color at the center of the gradient",ui:{type:"color",label:"Start Color"}},endColor:{default:"#0000ff",transform:Br,description:"The ending color at the edge of the gradient",ui:{type:"color",label:"End Color"}},center:{default:{x:.5,y:.5},transform:gc,description:"The center point of the radial gradient"},radius:{default:1,description:"The radius of the gradient (normalized, 0.0-1.0)",ui:{type:"range",min:0,max:2,step:.01,label:"Radius"}}},fragmentNode:({uniforms:e})=>{let{vec2:t,mix:r,float:s,distance:i,screenUV:n,viewportSize:a}=_e,o=a.x.div(a.y),l=t(n.x.mul(o),n.y),h=t(e.center.uniform.x.mul(o),e.center.uniform.y.oneMinus()),u=i(l,h),c=u.div(e.radius.uniform).clamp(s(0),s(1));return r(e.startColor.uniform,e.endColor.uniform,c)}};function Lnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const PC={blendMode:"normal"};try{Yl&&Yl.props&&Object.entries(Yl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(PC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Pnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Yl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>Lnt(e,PC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Yl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Yl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Zl={name:"Ripple",props:{intensity:{default:1,description:"Overall ripple intensity",ui:{type:"range",min:0,max:5,step:.1,label:"Intensity"}},rippleSpeed:{default:150,description:"Speed of ripple expansion",ui:{type:"range",min:50,max:500,step:10,label:"Ripple Speed"}},damping:{default:.95,description:"Water damping (higher = less decay)",ui:{type:"range",min:.8,max:.99,step:.01,label:"Damping"}},mouseIntensity:{default:1,description:"Mouse movement ripple strength",ui:{type:"range",min:0,max:3,step:.1,label:"Mouse Intensity"}}},fragmentNode:({uniforms:e,onBeforeRender:t,childNode:r,onCleanup:s,canvas:i})=>{let{vec2:n,vec4:a,screenUV:o,convertToTexture:l,texture:h}=_e;if(!r)return a(0,0,0,0);let u=Math.round(i.clientWidth),c=Math.round(i.clientHeight),d=l(r,u,c),p=128,m={current:new Float32Array(p*p),previous:new Float32Array(p*p)};for(let nt=0;nt<p*p;nt++)m.current[nt]=0,m.previous[nt]=0;let f=new Ye.DataTexture(m.current,p,p,Ye.RedFormat,Ye.FloatType);f.minFilter=Ye.LinearFilter,f.magFilter=Ye.LinearFilter,f.needsUpdate=!0;let x=h(f),b=.5,v=.5,T=0,_=(nt,yt,lt)=>{let Nt=nt/i.clientWidth,ht=yt/i.clientHeight,Mt=Math.floor(Nt*p),ut=Math.floor(ht*p),at=8,gt=lt*.5;for(let Ot=-8;Ot<=at;Ot++)for(let jt=-8;jt<=at;jt++){let be=Ot*Ot+jt*jt;if(be<=at*at){let se=Mt+Ot,Ae=ut+jt;if(se>=0&&se<p&&Ae>=0&&Ae<p){let di=Ae*p+se,xr=Math.sqrt(be),Zt=1-xr/at,Yr=Math.cos(xr/at*Math.PI*.5)*gt*Zt;m.previous[di]+=Yr}}}},E=()=>{let nt=e.damping.uniform.value;for(let lt=1;lt<p-1;lt++)for(let Nt=1;Nt<p-1;Nt++){let ht=lt*p+Nt,Mt=m.previous[ht-p],ut=m.previous[ht+p],at=m.previous[ht-1],gt=m.previous[ht+1];m.current[ht]=(Mt+ut+at+gt)/2-m.current[ht],m.current[ht]*=nt,m.current[ht]=Math.max(-2,Math.min(2,m.current[ht]))}for(let lt=0;lt<p;lt++)m.current[lt]=0,m.current[(p-1)*p+lt]=0,m.current[lt*p]=0,m.current[lt*p+(p-1)]=0;let yt=m.current;m.current=m.previous,m.previous=yt,f.image.data=m.current,f.needsUpdate=!0};t(({pointer:nt})=>{let yt=performance.now();if(yt-T>=16){T=yt;let lt=nt.x*i.clientWidth,Nt=nt.y*i.clientHeight,ht=lt-b*i.clientWidth,Mt=Nt-v*i.clientHeight,ut=Math.sqrt(ht*ht+Mt*Mt);if(ut>2){let at=ut/16,gt=Math.min(at/10,2),Ot=Math.min(ut/20,1),jt=Ot*gt*e.mouseIntensity.uniform.value;_(lt,Nt,jt)}b=nt.x,v=nt.y}E()}),s(()=>{f.dispose()});let C=o,A=e.intensity.uniform,I=1/p,Q=x.sample(C.add(n(I,0))).r.sub(x.sample(C.sub(n(I,0))).r),ot=x.sample(C.add(n(0,I))).r.sub(x.sample(C.sub(n(0,I))).r),K=n(Q,ot).mul(A).mul(.05),mt=o.add(K);return d.sample(mt)}};function Fnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const FC={blendMode:"normal"};try{Zl&&Zl.props&&Object.entries(Zl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(FC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Ont=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Zl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>Fnt(e,FC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Zl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Zl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Jl={name:"Saturation",props:{intensity:{default:1,description:"The intensity of the saturation effect (1 being no change)",ui:{type:"range",min:0,max:3,step:.01,label:"Intensity"}}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec4:r}=_e;if(!t)return console.error("You must pass a child component into the Saturation shader."),r(0);let s=t||r(0,0,0,0);return r(unt(s.rgb,e.intensity.uniform).rgb,s.a)}};function knt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const OC={blendMode:"normal"};try{Jl&&Jl.props&&Object.entries(Jl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(OC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Bnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Jl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>knt(e,OC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Jl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Jl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Ql={name:"SolidColor",props:{color:{default:"#5b18ca",transform:Br,description:"The solid color to display",ui:{type:"color",label:"Color"}}},fragmentNode:({uniforms:e})=>e.color.uniform};function Dnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const kC={blendMode:"normal"};try{Ql&&Ql.props&&Object.entries(Ql.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(kC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Unt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Ql.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>Dnt(e,kC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Ql,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Ql.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},Kl={name:"Spiral",props:{colorBack:{default:"#000000",transform:Br,description:"Background color",ui:{type:"color",label:"Background Color"}},colorFront:{default:"#ffffff",transform:Br,description:"Spiral stroke color",ui:{type:"color",label:"Spiral Color"}},strokeWidth:{default:.5,description:"Thickness of spiral stroke",ui:{type:"range",min:0,max:2,step:.01,label:"Stroke Width"}},strokeFalloff:{default:0,description:"Stroke losing width further from center",ui:{type:"range",min:0,max:1,step:.01,label:"Stroke Falloff"}},softness:{default:0,description:"Color transition sharpness (0 = hard edge, 1 = smooth fade)",ui:{type:"range",min:0,max:1,step:.01,label:"Softness"}},speed:{default:1,description:"Animation speed (negative values reverse direction)",ui:{type:"range",min:-3,max:3,step:.1,label:"Speed"}},center:{default:{x:.5,y:.5},transform:gc,description:"The center point of the spiral"},scale:{default:1,description:"Scale factor for spiral bands (higher = more bands, lower = fewer bands)",ui:{type:"range",min:.1,max:5,step:.1,label:"Scale"}}},fragmentNode:({uniforms:e})=>{let{vec2:t,vec4:r,float:s,atan2:i,length:n,clamp:a,fract:o,abs:l,mix:h,smoothstep:u,screenUV:c,time:d,fwidth:p,viewportSize:m}=_e,f=m.x.div(m.y),x=t(c.x.mul(f),c.y),b=t(e.center.uniform.x.mul(f),e.center.uniform.y.oneMinus()),v=x.sub(b),T=d.mul(e.speed.uniform),_=n(v),E=_,C=i(v.y,v.x).sub(T),A=s(6.283185307),I=C.div(A),Q=E.mul(e.scale.uniform).add(I),ot=o(Q),K=l(ot.sub(.5)).mul(2),mt=a(e.strokeWidth.uniform,e.strokeFalloff.uniform.mul(.005),1),nt=a(e.strokeFalloff.uniform,0,1).mul(_).oneMinus(),yt=mt.mul(nt),lt=p(Q),Nt=s(4).sub(u(.05,.4,e.strokeWidth.uniform.mul(2)).mul(u(.05,.4,e.strokeWidth.uniform.oneMinus().mul(2))).mul(3)),ht=h(Nt.mul(lt),p(K),a(lt,0,1)),Mt=u(yt.sub(ht).sub(e.softness.uniform),yt.add(ht).add(e.softness.uniform),K),ut=e.colorFront.uniform.rgb.mul(e.colorFront.uniform.a),at=e.colorFront.uniform.a,gt=e.colorBack.uniform.rgb.mul(e.colorBack.uniform.a),Ot=e.colorBack.uniform.a,jt=ut.mul(Mt),be=at.mul(Mt),se=jt.add(gt.mul(be.oneMinus())),Ae=be.add(Ot.mul(be.oneMinus()));return r(se,Ae)}};function $nt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const BC={blendMode:"normal"};try{Kl&&Kl.props&&Object.entries(Kl.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(BC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const jnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${Kl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>$nt(e,BC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(Kl,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Kl.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},tu={name:"Swirl",props:{colorA:{default:"#1275d8",description:"Primary gradient color",transform:Br,ui:{type:"color",label:"Primary Color"}},colorB:{default:"#e19136",description:"Secondary gradient color",transform:Br,ui:{type:"color",label:"Secondary Color"}},colorC:{default:"#320485",description:"Accent gradient color",transform:Br,ui:{type:"color",label:"Accent Color"}},speed:{default:1,description:"Flow animation speed",ui:{type:"range",min:0,max:5,step:.1,label:"Speed"}},scale:{default:5,description:"Gradient scale",ui:{type:"range",min:.1,max:20,step:.1,label:"Scale"}},complexity:{default:5,description:"Flow complexity",ui:{type:"range",min:1,max:10,step:.1,label:"Complexity"}}},fragmentNode:({uniforms:e})=>{let t=_0(),r=S0.mul(e.speed.uniform),s=e.scale.uniform,i=e.complexity.uniform,n=Zn(t.x.mul(s.mul(1.2)).add(r.mul(.8))).mul(.3),a=Gd(t.y.mul(s.mul(.9)).sub(r.mul(.6))).mul(.3),o=A0(t.x.add(Zn(t.y.mul(i.mul(2)).add(r)).mul(.08)),t.y.add(Gd(t.x.mul(i.mul(1.5)).sub(r.mul(.7))).mul(.08))),l=Zn(o.x.mul(s.mul(3)).add(o.y.mul(s.mul(2))).add(r.mul(.5))),h=Gd(o.x.sub(o.y).mul(s.mul(2.5)).add(r.mul(.3))),u=Zn(o.x.mul(i).add(n).add(o.y.mul(i.mul(.8)).add(a)).add(r.mul(.4))),c=Nl(l,h,u.mul(.5).add(.5)),d=o.x.mul(.7).add(o.y.mul(.3)).add(c.mul(.2)),p=Nl(e.colorA.uniform,e.colorB.uniform,kg(.1,.6,d)),m=Nl(p,e.colorC.uniform,kg(.4,.9,d.add(u.mul(.3)))),f=Zn(r.mul(3).add(d.mul(10))).mul(.02).add(1),x=m.mul(f);return oh(x,1)}};function Wnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const DC={blendMode:"normal"};try{tu&&tu.props&&Object.entries(tu.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(DC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const qnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${tu.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>Wnt(e,DC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(tu,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,tu.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},eu={name:"Twirl",props:{center:{default:{x:.5,y:.5},transform:gc,description:"The center point of the twirl effect"},intensity:{default:1,description:"The strength of the twirl effect",ui:{type:"range",min:-5,max:5,step:.1,label:"Intensity"}}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec2:r,vec4:s,cos:i,sin:n,length:a,screenUV:o,convertToTexture:l}=_e;if(!t)return console.error("You must pass a child component into the Twirl shader."),s(0);let h=l(t),u=o,c=r(e.center.uniform.x,e.center.uniform.y.oneMinus()),d=u.sub(c),p=e.intensity.uniform.mul(a(d)),m=i(p),f=n(p),x=m.mul(d.x).sub(f.mul(d.y)),b=f.mul(d.x).add(m.mul(d.y)),v=r(x.add(c.x),b.add(c.y));return s(h.sample(v))}};function Hnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const UC={blendMode:"normal"};try{eu&&eu.props&&Object.entries(eu.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&(UC[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Gnt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${eu.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>Hnt(e,UC),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(eu,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,eu.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})},ru={name:"Vibrance",props:{intensity:{default:0,description:"The intensity of the vibrance effect",ui:{type:"range",min:-2,max:2,step:.01,label:"Intensity"}}},fragmentNode:({uniforms:e,childNode:t})=>{let{vec4:r}=_e;if(!t)return console.error("You must pass a child component into the Vibrance shader."),r(0);let s=t||r(0,0,0,0);return r(hnt(s.rgb,e.intensity.uniform).rgb,s.a)}};function Xnt(e,t){let r={...t};for(const[s,i]of Object.entries(e))s!=="children"&&s!=="ref"&&i!==void 0&&(r[s]=i);return r}const $C={blendMode:"normal"};try{ru&&ru.props&&Object.entries(ru.props).forEach(([e,t])=>{const r=t;r&&typeof r=="object"&&"default"in r&&($C[e]=r.default)})}catch(e){console.warn("Error extracting default props:",e)}const Ynt=e=>{const t=z.useContext(Tt);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:r,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=z.useMemo(()=>e.id||`${ru.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[e.id]),o=z.useMemo(()=>Xnt(e,$C),[e]),l=z.useRef(null);l.current===null&&(l.current=pe.createUniformsMap(ru,o,a));const h=z.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(z.useEffect(()=>{if(l.current)try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};return s(a,ru.fragmentNode,r,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,r,s,e.blendMode,e.opacity,e.id,e.maskSource,e.maskType]),z.useEffect(()=>{if(l.current)try{Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u];d.value=p?p(m):m}}),Object.entries(l.current).forEach(([u,c])=>{if(!c||typeof c!="object")return;const{uniform:d,transform:p}=c;if(d?.value!==void 0&&u in o){const m=o[u],f=p?p(m):m;i(a,u,f)}})}catch(u){console.error("Error updating uniforms:",u)}},[o,a,i]),z.useEffect(()=>{try{const u={blendMode:e.blendMode||"normal",opacity:e.opacity,id:e.id,mask:e.maskSource?{source:e.maskSource,type:e.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[e.blendMode,e.opacity,e.maskSource,e.maskType,e.id,a,n]),e.ref&&typeof e.ref=="function")try{e.ref(null)}catch{}return ae.jsx(Tt.Provider,{value:h,children:e.children})};exports.Ascii=iK;exports.Checkerboard=het;exports.Circle=det;exports.DotGrid=met;exports.FilmGrain=get;exports.GlassTiles=xet;exports.Grayscale=pnt;exports.Grid=fnt;exports.GridDistortion=ynt;exports.HueShift=bnt;exports.ImageTexture=Mnt;exports.Invert=Tnt;exports.LinearGradient=Snt;exports.Liquify=Ant;exports.Pixelate=znt;exports.Posterize=Int;exports.RadialGradient=Pnt;exports.Ripple=Ont;exports.Saturation=Bnt;exports.Shader=rK;exports.SolidColor=Unt;exports.Spiral=jnt;exports.Swirl=qnt;exports.Twirl=Gnt;exports.Vibrance=Ynt;
168
168
  //# sourceMappingURL=index.cjs.map