shaders 2.0.0-alpha.0 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react/engine/{Ombre.d.ts → Shader.d.ts} +4 -4
- package/dist/react/engine/Shader.d.ts.map +1 -0
- package/dist/react/engine/component.template.d.ts +1 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.ts +1 -12
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +15 -15
- package/dist/react/index.js.map +1 -1
- package/dist/svelte/components/Circle.svelte +2 -2
- package/dist/svelte/components/GlassTiles.svelte +2 -2
- package/dist/svelte/components/Grayscale.svelte +2 -2
- package/dist/svelte/components/HueShift.svelte +2 -2
- package/dist/svelte/components/Invert.svelte +2 -2
- package/dist/svelte/components/LinearGradient.svelte +2 -2
- package/dist/svelte/components/Posterize.svelte +2 -2
- package/dist/svelte/components/Saturation.svelte +2 -2
- package/dist/svelte/components/SolidColor.svelte +2 -2
- package/dist/svelte/components/Twirl.svelte +2 -2
- package/dist/svelte/components/Vibrance.svelte +2 -2
- package/dist/svelte/engine/{Ombre.svelte → Shader.svelte} +2 -2
- package/dist/svelte/engine/{Ombre.svelte.d.ts → Shader.svelte.d.ts} +3 -3
- package/dist/svelte/engine/component.template.svelte +2 -2
- package/dist/svelte/index.d.ts +1 -1
- package/dist/svelte/index.js +1 -1
- package/dist/vue/engine/{Ombre.vue.d.ts → Shader.vue.d.ts} +1 -1
- package/dist/vue/engine/Shader.vue.d.ts.map +1 -0
- package/dist/vue/index.d.ts +1 -1
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +3 -3
- package/package.json +1 -1
- package/dist/react/components/Circle.d.ts +0 -22
- package/dist/react/components/Circle.d.ts.map +0 -1
- package/dist/react/components/GlassTiles.d.ts +0 -22
- package/dist/react/components/GlassTiles.d.ts.map +0 -1
- package/dist/react/components/Grayscale.d.ts +0 -22
- package/dist/react/components/Grayscale.d.ts.map +0 -1
- package/dist/react/components/HueShift.d.ts +0 -22
- package/dist/react/components/HueShift.d.ts.map +0 -1
- package/dist/react/components/Invert.d.ts +0 -22
- package/dist/react/components/Invert.d.ts.map +0 -1
- package/dist/react/components/LinearGradient.d.ts +0 -22
- package/dist/react/components/LinearGradient.d.ts.map +0 -1
- package/dist/react/components/Posterize.d.ts +0 -22
- package/dist/react/components/Posterize.d.ts.map +0 -1
- package/dist/react/components/Saturation.d.ts +0 -22
- package/dist/react/components/Saturation.d.ts.map +0 -1
- package/dist/react/components/SolidColor.d.ts +0 -22
- package/dist/react/components/SolidColor.d.ts.map +0 -1
- package/dist/react/components/Twirl.d.ts +0 -22
- package/dist/react/components/Twirl.d.ts.map +0 -1
- package/dist/react/components/Vibrance.d.ts +0 -22
- package/dist/react/components/Vibrance.d.ts.map +0 -1
- package/dist/react/engine/Ombre.d.ts.map +0 -1
- package/dist/vue/engine/Ombre.vue.d.ts.map +0 -1
package/dist/react/index.cjs
CHANGED
|
@@ -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 ytt=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 xe=J.createContext(null),xtt=({children:r,hideNotice:t=!1,style:e={},className:s="",...i})=>{const n=J.useRef(null),a=J.useMemo(()=>"ombre-root-"+Math.random().toString(36).substring(7),[]),o=J.useRef(null);o.current===null&&(o.current=Ms.shaderRenderer());const l=J.useMemo(()=>(f,x,b,w,S=null)=>{if(x===null){try{o.current.removeNode(f)}catch(_){console.warn("Error removing node:",_)}return}try{o.current.registerNode(f,x,b,w,S)}catch(_){console.error("Error registering node:",_,{id:f,parentId:b,metadata:w})}},[]),h=J.useMemo(()=>(f,x,b)=>{try{o.current.updateUniformValue(f,x,b)}catch(w){console.warn("Error updating uniform:",w)}},[]),u=J.useMemo(()=>(f,x)=>{try{o.current.updateNodeMetadata(f,x)}catch(b){console.warn("Error updating metadata:",b)}},[]),c=J.useMemo(()=>({ombreParentId:a,ombreNodeRegister:l,ombreUniformUpdate:h,ombreMetadataUpdate:u}),[a,l,h,u]),d=J.useRef(!1),p=J.useRef(!1);J.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||ytt(0,0,0,0),null,null,{}),d.current=!0,p.current=!1,t||x.showLicenseWarning()}).catch(b=>{console.error("[Ombre] Initialization failed:",b),p.current=!1}),()=>{try{x.cleanup(),d.current=!1,p.current=!1,console.log("[Ombre] Renderer cleaned up successfully")}catch(b){console.warn("[Ombre] Error during cleanup:",b)}}},[a,t]);const m={...s===""?{width:"1200px",height:"800px"}:{},...typeof e=="object"?e:{}};return Vr.jsx(xe.Provider,{value:c,children:Vr.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",...typeof e=="object"?e:{}},className:s,...i,children:[Vr.jsx("canvas",{"data-renderer":"ombre",ref:n,style:m}),r]})})};function btt(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const rA={blendMode:"normal",opacity:1};try{ul&&ul.props&&Object.entries(ul.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(rA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const vtt=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Ombre> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${ul.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>btt(r,rA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(ul,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,ul.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})},ad=new WeakMap,gl={name:"glassTiles",props:{intensity:{type:Number,default:1,description:"The intensity of the glass tiles effect"},tileCount:{type:Number,default:100,description:"Number of tiles across the shortest dimension"}},fragmentNode:({uniforms:r,childNode:t,onCleanup:e,canvas:s})=>{let{vec2:i,vec4:n,floor:a,mul:o,div:l,sub:h,add:u,convertToTexture:c,uv:d,uniform:p}=rs;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=ad.get(s);b||(b=new ResizeObserver(Vt=>{let Yt=Vt[0];if(!Yt)return;let{width:se,height:te}=Yt.contentRect,ft=window.devicePixelRatio||1;m.setSize(se*ft,te*ft),x()}),b.observe(s),ad.set(s,b)),e(()=>{let Vt=ad.get(s);Vt&&(Vt.disconnect(),ad.delete(s))});let w=d(),S=r.intensity.uniform,_=r.tileCount.uniform,V=i(f.greaterThanEqual(1).select(o(_,f),_),f.lessThan(1).select(l(_,f),_)),z=l(a(o(w,V)),V),A=h(w,z),I=i(.5,.5),et=o(S,.025),nt=l(A,l(i(1),V)),it=h(nt,I),vt=o(it,et),mt=u(A,vt),Rt=u(mt,z);return n(m.sample(Rt))}};function wtt(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const sA={blendMode:"normal",opacity:1};try{gl&&gl.props&&Object.entries(gl.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(sA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const Mtt=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Ombre> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${gl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>wtt(r,sA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(gl,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,gl.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})},od={VERTEX:"vertex"},Rn={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},$h=["x","y","z","w"],gr="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 Fv=1234567;const iA=Math.PI/180,nA=180/Math.PI;function Td(){let r=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(gr[r&255]+gr[r>>8&255]+gr[r>>16&255]+gr[r>>24&255]+"-"+gr[t&255]+gr[t>>8&255]+"-"+gr[t>>16&15|64]+gr[t>>24&255]+"-"+gr[e&63|128]+gr[e>>8&255]+"-"+gr[e>>16&255]+gr[e>>24&255]+gr[s&255]+gr[s>>8&255]+gr[s>>16&255]+gr[s>>24&255]).toLowerCase()}function kt(r,t,e){return Math.max(t,Math.min(e,r))}function Q0(r,t){return(r%t+t)%t}function Ttt(r,t,e,s,i){return s+(r-t)*(i-s)/(e-t)}function Ntt(r,t,e){return r===t?0:(e-r)/(t-r)}function Bu(r,t,e){return(1-e)*r+e*t}function Stt(r,t,e,s){return Bu(r,t,1-Math.exp(-e*s))}function _tt(r,t=1){return t-Math.abs(Q0(r,t*2)-t)}function Att(r,t,e){return r<=t?0:r>=e?1:(r=(r-t)/(e-t),r*r*(3-2*r))}function ztt(r,t,e){return r<=t?0:r>=e?1:(r=(r-t)/(e-t),r*r*r*(r*(r*6-15)+10))}function Ctt(r,t){return r+Math.floor(Math.random()*(t-r+1))}function Ett(r,t){return r+Math.random()*(t-r)}function Vtt(r){return r*(.5-Math.random())}function Rtt(r){r!==void 0&&(Fv=r);let t=Fv+=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 Ltt(r){return r*iA}function Itt(r){return r*nA}function Ptt(r){return(r&r-1)==0&&r!==0}function Ftt(r){return 2**Math.ceil(Math.log(r)/Math.LN2)}function Ott(r){return 2**Math.floor(Math.log(r)/Math.LN2)}function Btt(r,t,e,s,i){let n=Math.cos,a=Math.sin,o=n(e/2),l=a(e/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":r.set(o*u,l*c,l*d,o*h);break;case"YZY":r.set(l*d,o*u,l*c,o*h);break;case"ZXZ":r.set(l*c,l*d,o*u,o*h);break;case"XZX":r.set(o*u,l*m,l*p,o*h);break;case"YXY":r.set(l*p,o*u,l*m,o*h);break;case"ZYZ":r.set(l*m,l*p,o*u,o*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Gs(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw Error("Invalid component type.")}}function Ht(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw Error("Invalid component type.")}}const ktt={DEG2RAD:iA,RAD2DEG:nA,generateUUID:Td,clamp:kt,euclideanModulo:Q0,mapLinear:Ttt,inverseLerp:Ntt,lerp:Bu,damp:Stt,pingpong:_tt,smoothstep:Att,smootherstep:ztt,randInt:Ctt,randFloat:Ett,randFloatSpread:Vtt,seededRandom:Rtt,degToRad:Ltt,radToDeg:Itt,isPowerOfTwo:Ptt,ceilPowerOfTwo:Ftt,floorPowerOfTwo:Ott,setQuaternionFromProperEuler:Btt,normalize:Ht,denormalize:Gs},Vg=0,Dtt=1015,Rg="",Us="srgb",Ov="srgb-linear",Bv="linear",ku="srgb",ap=35044,Ca=2e3,Lg=2001;var jh=class aA{constructor(t,e,s,i,n,a,o,l,h){aA.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,s,i,n,a,o,l,h)}set(t,e,s,i,n,a,o,l,h){let u=this.elements;return u[0]=t,u[1]=i,u[2]=o,u[3]=e,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 e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],this}extractBasis(t,e,s){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let s=t.elements,i=e.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],w=i[1],S=i[4],_=i[7],V=i[2],z=i[5],A=i[8];return n[0]=a*f+o*w+l*V,n[3]=a*x+o*S+l*z,n[6]=a*b+o*_+l*A,n[1]=h*f+u*w+c*V,n[4]=h*x+u*S+c*z,n[7]=h*b+u*_+c*A,n[2]=d*f+p*w+m*V,n[5]=d*x+p*S+m*z,n[8]=d*b+p*_+m*A,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=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 e*a*u-e*o*h-s*n*u+s*o*l+i*n*h-i*a*l}invert(){let t=this.elements,e=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=e*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*e-i*l)*f,t[5]=(i*n-o*e)*f,t[6]=p*f,t[7]=(s*l-h*e)*f,t[8]=(a*e-s*n)*f,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,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+e,0,0,1),this}scale(t,e){return this.premultiply(Ff.makeScale(t,e)),this}rotate(t){return this.premultiply(Ff.makeRotation(-t)),this}translate(t,e){return this.premultiply(Ff.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,s,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,s=t.elements;for(let i=0;i<9;i++)if(e[i]!==s[i])return!1;return!0}fromArray(t,e=0){for(let s=0;s<9;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){let s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t}clone(){return new this.constructor().fromArray(this.elements)}};const Ff=new jh,kv={};function Dv(r){r in kv||(kv[r]=!0,console.warn(r))}const Uv=new jh().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),$v=new jh().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Utt(){let r={enabled:!0,workingColorSpace:Ov,spaces:{},convert:function(i,n,a){return this.enabled===!1||n===a||!n||!a||(this.spaces[n].transfer===ku&&(i.r=yl(i.r),i.g=yl(i.g),i.b=yl(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===ku&&(i.r=xl(i.r),i.g=xl(i.g),i.b=xl(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===Rg?Bv: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 Dv("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,n)},toWorkingColorSpace:function(i,n){return Dv("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,n)}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],s=[.3127,.329];return r.define({[Ov]:{primaries:t,whitePoint:s,transfer:Bv,toXYZ:Uv,fromXYZ:$v,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:Us},outputColorSpaceConfig:{drawingBufferColorSpace:Us}},[Us]:{primaries:t,whitePoint:s,transfer:ku,toXYZ:Uv,fromXYZ:$v,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:Us}}}),r}const Oe=Utt();function yl(r){return r<.04045?r*.0773993808:(r*.9478672986+.0521327014)**2.4}function xl(r){return r<.0031308?r*12.92:1.055*r**.41666-.055}const oA={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},zn={h:0,s:0,l:0},ld={h:0,s:0,l:0};function Of(r,t,e){return e<0&&(e+=1),e>1&&--e,e<1/6?r+(t-r)*6*e:e<1/2?t:e<2/3?r+(t-r)*6*(2/3-e):r}var K0=class{constructor(r,t,e){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(r,t,e)}set(r,t,e){if(t===void 0&&e===void 0){let s=r;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(r,t,e);return this}setScalar(r){return this.r=r,this.g=r,this.b=r,this}setHex(r,t=Us){return r=Math.floor(r),this.r=(r>>16&255)/255,this.g=(r>>8&255)/255,this.b=(r&255)/255,Oe.colorSpaceToWorking(this,t),this}setRGB(r,t,e,s=Oe.workingColorSpace){return this.r=r,this.g=t,this.b=e,Oe.colorSpaceToWorking(this,s),this}setHSL(r,t,e,s=Oe.workingColorSpace){if(r=Q0(r,1),t=kt(t,0,1),e=kt(e,0,1),t===0)this.r=this.g=this.b=e;else{let i=e<=.5?e*(1+t):e+t-e*t,n=2*e-i;this.r=Of(n,i,r+1/3),this.g=Of(n,i,r),this.b=Of(n,i,r-1/3)}return Oe.colorSpaceToWorking(this,s),this}setStyle(r,t=Us){function e(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+r+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(r)){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 e(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 e(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 e(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 "+r)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(r)){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 "+r)}else if(r&&r.length>0)return this.setColorName(r,t);return this}setColorName(r,t=Us){let e=oA[r.toLowerCase()];return e===void 0?console.warn("THREE.Color: Unknown color "+r):this.setHex(e,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(r){return this.r=r.r,this.g=r.g,this.b=r.b,this}copySRGBToLinear(r){return this.r=yl(r.r),this.g=yl(r.g),this.b=yl(r.b),this}copyLinearToSRGB(r){return this.r=xl(r.r),this.g=xl(r.g),this.b=xl(r.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(r=Us){return Oe.workingToColorSpace(yr.copy(this),r),Math.round(kt(yr.r*255,0,255))*65536+Math.round(kt(yr.g*255,0,255))*256+Math.round(kt(yr.b*255,0,255))}getHexString(r=Us){return("000000"+this.getHex(r).toString(16)).slice(-6)}getHSL(r,t=Oe.workingColorSpace){Oe.workingToColorSpace(yr.copy(this),t);let e=yr.r,s=yr.g,i=yr.b,n=Math.max(e,s,i),a=Math.min(e,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 e:o=(s-i)/u+(s<i?6:0);break;case s:o=(i-e)/u+2;break;case i:o=(e-s)/u+4;break}o/=6}return r.h=o,r.s=l,r.l=h,r}getRGB(r,t=Oe.workingColorSpace){return Oe.workingToColorSpace(yr.copy(this),t),r.r=yr.r,r.g=yr.g,r.b=yr.b,r}getStyle(r=Us){Oe.workingToColorSpace(yr.copy(this),r);let t=yr.r,e=yr.g,s=yr.b;return r===Us?`rgb(${Math.round(t*255)},${Math.round(e*255)},${Math.round(s*255)})`:`color(${r} ${t.toFixed(3)} ${e.toFixed(3)} ${s.toFixed(3)})`}offsetHSL(r,t,e){return this.getHSL(zn),this.setHSL(zn.h+r,zn.s+t,zn.l+e)}add(r){return this.r+=r.r,this.g+=r.g,this.b+=r.b,this}addColors(r,t){return this.r=r.r+t.r,this.g=r.g+t.g,this.b=r.b+t.b,this}addScalar(r){return this.r+=r,this.g+=r,this.b+=r,this}sub(r){return this.r=Math.max(0,this.r-r.r),this.g=Math.max(0,this.g-r.g),this.b=Math.max(0,this.b-r.b),this}multiply(r){return this.r*=r.r,this.g*=r.g,this.b*=r.b,this}multiplyScalar(r){return this.r*=r,this.g*=r,this.b*=r,this}lerp(r,t){return this.r+=(r.r-this.r)*t,this.g+=(r.g-this.g)*t,this.b+=(r.b-this.b)*t,this}lerpColors(r,t,e){return this.r=r.r+(t.r-r.r)*e,this.g=r.g+(t.g-r.g)*e,this.b=r.b+(t.b-r.b)*e,this}lerpHSL(r,t){this.getHSL(zn),r.getHSL(ld);let e=Bu(zn.h,ld.h,t),s=Bu(zn.s,ld.s,t),i=Bu(zn.l,ld.l,t);return this.setHSL(e,s,i),this}setFromVector3(r){return this.r=r.x,this.g=r.y,this.b=r.z,this}applyMatrix3(r){let t=this.r,e=this.g,s=this.b,i=r.elements;return this.r=i[0]*t+i[3]*e+i[6]*s,this.g=i[1]*t+i[4]*e+i[7]*s,this.b=i[2]*t+i[5]*e+i[8]*s,this}equals(r){return r.r===this.r&&r.g===this.g&&r.b===this.b}fromArray(r,t=0){return this.r=r[t],this.g=r[t+1],this.b=r[t+2],this}toArray(r=[],t=0){return r[t]=this.r,r[t+1]=this.g,r[t+2]=this.b,r}fromBufferAttribute(r,t){return this.r=r.getX(t),this.g=r.getY(t),this.b=r.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const yr=new K0;K0.NAMES=oA;var $tt=class lA{constructor(t,e,s,i){lA.prototype.isMatrix2=!0,this.elements=[1,0,0,1],t!==void 0&&this.set(t,e,s,i)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let s=0;s<4;s++)this.elements[s]=t[s+e];return this}set(t,e,s,i){let n=this.elements;return n[0]=t,n[2]=e,n[1]=s,n[3]=i,this}},jtt=class{constructor(r=0,t=0,e=0,s=1){this.isQuaternion=!0,this._x=r,this._y=t,this._z=e,this._w=s}static slerpFlat(r,t,e,s,i,n,a){let o=e[s+0],l=e[s+1],h=e[s+2],u=e[s+3],c=i[n+0],d=i[n+1],p=i[n+2],m=i[n+3];if(a===0){r[t+0]=o,r[t+1]=l,r[t+2]=h,r[t+3]=u;return}if(a===1){r[t+0]=c,r[t+1]=d,r[t+2]=p,r[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,w=1-x*x;if(w>2**-52){let _=Math.sqrt(w),V=Math.atan2(_,x*b);f=Math.sin(f*V)/_,a=Math.sin(a*V)/_}let S=a*b;if(o=o*f+c*S,l=l*f+d*S,h=h*f+p*S,u=u*f+m*S,f===1-a){let _=1/Math.sqrt(o*o+l*l+h*h+u*u);o*=_,l*=_,h*=_,u*=_}}r[t]=o,r[t+1]=l,r[t+2]=h,r[t+3]=u}static multiplyQuaternionsFlat(r,t,e,s,i,n){let a=e[s],o=e[s+1],l=e[s+2],h=e[s+3],u=i[n],c=i[n+1],d=i[n+2],p=i[n+3];return r[t]=a*p+h*u+o*d-l*c,r[t+1]=o*p+h*c+l*u-a*d,r[t+2]=l*p+h*d+a*c-o*u,r[t+3]=h*p-a*u-o*c-l*d,r}get x(){return this._x}set x(r){this._x=r,this._onChangeCallback()}get y(){return this._y}set y(r){this._y=r,this._onChangeCallback()}get z(){return this._z}set z(r){this._z=r,this._onChangeCallback()}get w(){return this._w}set w(r){this._w=r,this._onChangeCallback()}set(r,t,e,s){return this._x=r,this._y=t,this._z=e,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(r){return this._x=r.x,this._y=r.y,this._z=r.z,this._w=r.w,this._onChangeCallback(),this}setFromEuler(r,t=!0){let e=r._x,s=r._y,i=r._z,n=r._order,a=Math.cos,o=Math.sin,l=a(e/2),h=a(s/2),u=a(i/2),c=o(e/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(r,t){let e=t/2,s=Math.sin(e);return this._x=r.x*s,this._y=r.y*s,this._z=r.z*s,this._w=Math.cos(e),this._onChangeCallback(),this}setFromRotationMatrix(r){let t=r.elements,e=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=e+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(e>a&&e>u){let d=2*Math.sqrt(1+e-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-e-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-e-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(r,t){let e=r.dot(t)+1;return e<2**-52?(e=0,Math.abs(r.x)>Math.abs(r.z)?(this._x=-r.y,this._y=r.x,this._z=0,this._w=e):(this._x=0,this._y=-r.z,this._z=r.y,this._w=e)):(this._x=r.y*t.z-r.z*t.y,this._y=r.z*t.x-r.x*t.z,this._z=r.x*t.y-r.y*t.x,this._w=e),this.normalize()}angleTo(r){return 2*Math.acos(Math.abs(kt(this.dot(r),-1,1)))}rotateTowards(r,t){let e=this.angleTo(r);if(e===0)return this;let s=Math.min(1,t/e);return this.slerp(r,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(r){return this._x*r._x+this._y*r._y+this._z*r._z+this._w*r._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 r=this.length();return r===0?(this._x=0,this._y=0,this._z=0,this._w=1):(r=1/r,this._x*=r,this._y*=r,this._z*=r,this._w*=r),this._onChangeCallback(),this}multiply(r){return this.multiplyQuaternions(this,r)}premultiply(r){return this.multiplyQuaternions(r,this)}multiplyQuaternions(r,t){let e=r._x,s=r._y,i=r._z,n=r._w,a=t._x,o=t._y,l=t._z,h=t._w;return this._x=e*h+n*a+s*l-i*o,this._y=s*h+n*o+i*a-e*l,this._z=i*h+n*l+e*o-s*a,this._w=n*h-e*a-s*o-i*l,this._onChangeCallback(),this}slerp(r,t){if(t===0)return this;if(t===1)return this.copy(r);let e=this._x,s=this._y,i=this._z,n=this._w,a=n*r._w+e*r._x+s*r._y+i*r._z;if(a<0?(this._w=-r._w,this._x=-r._x,this._y=-r._y,this._z=-r._z,a=-a):this.copy(r),a>=1)return this._w=n,this._x=e,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*e+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=e*u+this._x*c,this._y=s*u+this._y*c,this._z=i*u+this._z*c,this._onChangeCallback(),this}slerpQuaternions(r,t,e){return this.copy(r).slerp(t,e)}random(){let r=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),e=Math.random(),s=Math.sqrt(1-e),i=Math.sqrt(e);return this.set(s*Math.sin(r),s*Math.cos(r),i*Math.sin(t),i*Math.cos(t))}equals(r){return r._x===this._x&&r._y===this._y&&r._z===this._z&&r._w===this._w}fromArray(r,t=0){return this._x=r[t],this._y=r[t+1],this._z=r[t+2],this._w=r[t+3],this._onChangeCallback(),this}toArray(r=[],t=0){return r[t]=this._x,r[t+1]=this._y,r[t+2]=this._z,r[t+3]=this._w,r}fromBufferAttribute(r,t){return this._x=r.getX(t),this._y=r.getY(t),this._z=r.getZ(t),this._w=r.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(r){return this._onChangeCallback=r,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},ti=class uA{constructor(t=0,e=0,s=0){uA.prototype.isVector3=!0,this.x=t,this.y=e,this.z=s}set(t,e,s){return s===void 0&&(s=this.z),this.x=t,this.y=e,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,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;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,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,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,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.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,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(jv.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(jv.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,s=this.y,i=this.z,n=t.elements;return this.x=n[0]*e+n[3]*s+n[6]*i,this.y=n[1]*e+n[4]*s+n[7]*i,this.z=n[2]*e+n[5]*s+n[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,s=this.y,i=this.z,n=t.elements,a=1/(n[3]*e+n[7]*s+n[11]*i+n[15]);return this.x=(n[0]*e+n[4]*s+n[8]*i+n[12])*a,this.y=(n[1]*e+n[5]*s+n[9]*i+n[13])*a,this.z=(n[2]*e+n[6]*s+n[10]*i+n[14])*a,this}applyQuaternion(t){let e=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*e-n*i),c=2*(n*s-a*e);return this.x=e+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 e=this.x,s=this.y,i=this.z,n=t.elements;return this.x=n[0]*e+n[4]*s+n[8]*i,this.y=n[1]*e+n[5]*s+n[9]*i,this.z=n[2]*e+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,e){return this.x=kt(this.x,t.x,e.x),this.y=kt(this.y,t.y,e.y),this.z=kt(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=kt(this.x,t,e),this.y=kt(this.y,t,e),this.z=kt(this.z,t,e),this}clampLength(t,e){let s=this.length();return this.divideScalar(s||1).multiplyScalar(kt(s,t,e))}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,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let s=t.x,i=t.y,n=t.z,a=e.x,o=e.y,l=e.z;return this.x=i*l-n*o,this.y=n*a-s*l,this.z=s*o-i*a,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let s=t.dot(this)/e;return this.copy(t).multiplyScalar(s)}projectOnPlane(t){return Bf.copy(this).projectOnVector(t),this.sub(Bf)}reflect(t){return this.sub(Bf.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let s=this.dot(t)/e;return Math.acos(kt(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,s=this.y-t.y,i=this.z-t.z;return e*e+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,e,s){let i=Math.sin(e)*t;return this.x=i*Math.sin(s),this.y=Math.cos(e)*t,this.z=i*Math.cos(s),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,s){return this.x=t*Math.sin(e),this.y=s,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),s=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=s,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*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,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,s=Math.sqrt(1-e*e);return this.x=s*Math.cos(t),this.y=e,this.z=s*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};const Bf=new ti,jv=new jtt;var hA=class Ig{constructor(t,e,s,i,n,a,o,l,h,u,c,d,p,m,f,x){Ig.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,e,s,i,n,a,o,l,h,u,c,d,p,m,f,x)}set(t,e,s,i,n,a,o,l,h,u,c,d,p,m,f,x){let b=this.elements;return b[0]=t,b[4]=e,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 Ig().fromArray(this.elements)}copy(t){let e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],e[9]=s[9],e[10]=s[10],e[11]=s[11],e[12]=s[12],e[13]=s[13],e[14]=s[14],e[15]=s[15],this}copyPosition(t){let e=this.elements,s=t.elements;return e[12]=s[12],e[13]=s[13],e[14]=s[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,s){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this}makeBasis(t,e,s){return this.set(t.x,e.x,s.x,0,t.y,e.y,s.y,0,t.z,e.z,s.z,0,0,0,0,1),this}extractRotation(t){let e=this.elements,s=t.elements,i=1/Wo.setFromMatrixColumn(t,0).length(),n=1/Wo.setFromMatrixColumn(t,1).length(),a=1/Wo.setFromMatrixColumn(t,2).length();return e[0]=s[0]*i,e[1]=s[1]*i,e[2]=s[2]*i,e[3]=0,e[4]=s[4]*n,e[5]=s[5]*n,e[6]=s[6]*n,e[7]=0,e[8]=s[8]*a,e[9]=s[9]*a,e[10]=s[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=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;e[0]=l*u,e[4]=-l*c,e[8]=h,e[1]=p+m*h,e[5]=d-f*h,e[9]=-o*l,e[2]=f-d*h,e[6]=m+p*h,e[10]=a*l}else if(t.order==="YXZ"){let d=l*u,p=l*c,m=h*u,f=h*c;e[0]=d+f*o,e[4]=m*o-p,e[8]=a*h,e[1]=a*c,e[5]=a*u,e[9]=-o,e[2]=p*o-m,e[6]=f+d*o,e[10]=a*l}else if(t.order==="ZXY"){let d=l*u,p=l*c,m=h*u,f=h*c;e[0]=d-f*o,e[4]=-a*c,e[8]=m+p*o,e[1]=p+m*o,e[5]=a*u,e[9]=f-d*o,e[2]=-a*h,e[6]=o,e[10]=a*l}else if(t.order==="ZYX"){let d=a*u,p=a*c,m=o*u,f=o*c;e[0]=l*u,e[4]=m*h-p,e[8]=d*h+f,e[1]=l*c,e[5]=f*h+d,e[9]=p*h-m,e[2]=-h,e[6]=o*l,e[10]=a*l}else if(t.order==="YZX"){let d=a*l,p=a*h,m=o*l,f=o*h;e[0]=l*u,e[4]=f-d*c,e[8]=m*c+p,e[1]=c,e[5]=a*u,e[9]=-o*u,e[2]=-h*u,e[6]=p*c+m,e[10]=d-f*c}else if(t.order==="XZY"){let d=a*l,p=a*h,m=o*l,f=o*h;e[0]=l*u,e[4]=-c,e[8]=h*u,e[1]=d*c+f,e[5]=a*u,e[9]=p*c-m,e[2]=m*c-p,e[6]=o*u,e[10]=f*c+d}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Wtt,t,qtt)}lookAt(t,e,s){let i=this.elements;return Wr.subVectors(t,e),Wr.lengthSq()===0&&(Wr.z=1),Wr.normalize(),Cn.crossVectors(s,Wr),Cn.lengthSq()===0&&(Math.abs(s.z)===1?Wr.x+=1e-4:Wr.z+=1e-4,Wr.normalize(),Cn.crossVectors(s,Wr)),Cn.normalize(),ud.crossVectors(Wr,Cn),i[0]=Cn.x,i[4]=ud.x,i[8]=Wr.x,i[1]=Cn.y,i[5]=ud.y,i[9]=Wr.y,i[2]=Cn.z,i[6]=ud.z,i[10]=Wr.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let s=t.elements,i=e.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],w=s[3],S=s[7],_=s[11],V=s[15],z=i[0],A=i[4],I=i[8],et=i[12],nt=i[1],it=i[5],vt=i[9],mt=i[13],Rt=i[2],Vt=i[6],Yt=i[10],se=i[14],te=i[3],ft=i[7],bt=i[11],Et=i[15];return n[0]=a*z+o*nt+l*Rt+h*te,n[4]=a*A+o*it+l*Vt+h*ft,n[8]=a*I+o*vt+l*Yt+h*bt,n[12]=a*et+o*mt+l*se+h*Et,n[1]=u*z+c*nt+d*Rt+p*te,n[5]=u*A+c*it+d*Vt+p*ft,n[9]=u*I+c*vt+d*Yt+p*bt,n[13]=u*et+c*mt+d*se+p*Et,n[2]=m*z+f*nt+x*Rt+b*te,n[6]=m*A+f*it+x*Vt+b*ft,n[10]=m*I+f*vt+x*Yt+b*bt,n[14]=m*et+f*mt+x*se+b*Et,n[3]=w*z+S*nt+_*Rt+V*te,n[7]=w*A+S*it+_*Vt+V*ft,n[11]=w*I+S*vt+_*Yt+V*bt,n[15]=w*et+S*mt+_*se+V*Et,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=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*(+e*l*p-e*h*d+n*a*d-i*a*p+i*h*u-n*l*u)+x*(+e*h*c-e*o*p-n*a*c+s*a*p+n*o*u-s*h*u)+b*(-i*o*u-e*l*c+e*o*d+i*a*c-s*a*d+s*l*u)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,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]=e,i[14]=s),this}invert(){let t=this.elements,e=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],w=c*x*h-f*d*h+f*l*p-o*x*p-c*l*b+o*d*b,S=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,V=m*c*l-u*f*l-m*o*d+a*f*d+u*o*x-a*c*x,z=e*w+s*S+i*_+n*V;if(z===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let A=1/z;return t[0]=w*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]=S*A,t[5]=(u*x*n-m*d*n+m*i*p-e*x*p-u*i*b+e*d*b)*A,t[6]=(m*l*n-a*x*n-m*i*h+e*x*h+a*i*b-e*l*b)*A,t[7]=(a*d*n-u*l*n+u*i*h-e*d*h-a*i*p+e*l*p)*A,t[8]=_*A,t[9]=(m*c*n-u*f*n-m*s*p+e*f*p+u*s*b-e*c*b)*A,t[10]=(a*f*n-m*o*n+m*s*h-e*f*h-a*s*b+e*o*b)*A,t[11]=(u*o*n-a*c*n-u*s*h+e*c*h+a*s*p-e*o*p)*A,t[12]=V*A,t[13]=(u*f*i-m*c*i+m*s*d-e*f*d-u*s*x+e*c*x)*A,t[14]=(m*o*i-a*f*i-m*s*l+e*f*l+a*s*x-e*o*x)*A,t[15]=(a*c*i-u*o*i+u*s*l-e*c*l-a*s*d+e*o*d)*A,this}scale(t){let e=this.elements,s=t.x,i=t.y,n=t.z;return e[0]*=s,e[4]*=i,e[8]*=n,e[1]*=s,e[5]*=i,e[9]*=n,e[2]*=s,e[6]*=i,e[10]*=n,e[3]*=s,e[7]*=i,e[11]*=n,this}getMaxScaleOnAxis(){let t=this.elements,e=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(e,s,i))}makeTranslation(t,e,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,e,0,0,1,s,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),s=Math.sin(t);return this.set(1,0,0,0,0,e,-s,0,0,s,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),s=Math.sin(t);return this.set(e,0,s,0,0,1,0,0,-s,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,0,s,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let s=Math.cos(e),i=Math.sin(e),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,e,s){return this.set(t,0,0,0,0,e,0,0,0,0,s,0,0,0,0,1),this}makeShear(t,e,s,i,n,a){return this.set(1,s,n,0,t,1,a,0,e,i,1,0,0,0,0,1),this}compose(t,e,s){let i=this.elements,n=e._x,a=e._y,o=e._z,l=e._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,w=l*h,S=l*u,_=l*c,V=s.x,z=s.y,A=s.z;return i[0]=(1-(f+b))*V,i[1]=(p+_)*V,i[2]=(m-S)*V,i[3]=0,i[4]=(p-_)*z,i[5]=(1-(d+b))*z,i[6]=(x+w)*z,i[7]=0,i[8]=(m+S)*A,i[9]=(x-w)*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,e,s){let i=this.elements,n=Wo.set(i[0],i[1],i[2]).length(),a=Wo.set(i[4],i[5],i[6]).length(),o=Wo.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],Ps.copy(this);let h=1/n,u=1/a,c=1/o;return Ps.elements[0]*=h,Ps.elements[1]*=h,Ps.elements[2]*=h,Ps.elements[4]*=u,Ps.elements[5]*=u,Ps.elements[6]*=u,Ps.elements[8]*=c,Ps.elements[9]*=c,Ps.elements[10]*=c,e.setFromRotationMatrix(Ps),s.x=n,s.y=a,s.z=o,this}makePerspective(t,e,s,i,n,a,o=Ca){let l=this.elements,h=2*n/(e-t),u=2*n/(s-i),c=(e+t)/(e-t),d=(s+i)/(s-i),p,m;if(o===Ca)p=-(a+n)/(a-n),m=-2*a*n/(a-n);else if(o===Lg)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,e,s,i,n,a,o=Ca){let l=this.elements,h=1/(e-t),u=1/(s-i),c=1/(a-n),d=(e+t)*h,p=(s+i)*u,m,f;if(o===Ca)m=(a+n)*c,f=-2*c;else if(o===Lg)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 e=this.elements,s=t.elements;for(let i=0;i<16;i++)if(e[i]!==s[i])return!1;return!0}fromArray(t,e=0){for(let s=0;s<16;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){let s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t[e+9]=s[9],t[e+10]=s[10],t[e+11]=s[11],t[e+12]=s[12],t[e+13]=s[13],t[e+14]=s[14],t[e+15]=s[15],t}};const Wo=new ti,Ps=new hA,Wtt=new ti(0,0,0),qtt=new ti(1,1,1),Cn=new ti,ud=new ti,Wr=new ti;var cA=class dA{constructor(t=0,e=0){dA.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,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,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;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,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,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,e){return this.x=t.x-e.x,this.y=t.y-e.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 e=this.x,s=this.y,i=t.elements;return this.x=i[0]*e+i[3]*s+i[6],this.y=i[1]*e+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,e){return this.x=kt(this.x,t.x,e.x),this.y=kt(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=kt(this.x,t,e),this.y=kt(this.y,t,e),this}clampLength(t,e){let s=this.length();return this.divideScalar(s||1).multiplyScalar(kt(s,t,e))}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 e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let s=this.dot(t)/e;return Math.acos(kt(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,s=this.y-t.y;return e*e+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,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let s=Math.cos(e),i=Math.sin(e),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}},Htt=class pA{constructor(t=0,e=0,s=0,i=1){pA.prototype.isVector4=!0,this.x=t,this.y=e,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,e,s,i){return this.x=t,this.y=e,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,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;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,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,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,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.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 e=this.x,s=this.y,i=this.z,n=this.w,a=t.elements;return this.x=a[0]*e+a[4]*s+a[8]*i+a[12]*n,this.y=a[1]*e+a[5]*s+a[9]*i+a[13]*n,this.z=a[2]*e+a[6]*s+a[10]*i+a[14]*n,this.w=a[3]*e+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 e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,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;e=Math.PI;let S=(h+1)/2,_=(p+1)/2,V=(b+1)/2,z=(u+d)/4,A=(c+f)/4,I=(m+x)/4;return S>_&&S>V?S<a?(s=0,i=.707106781,n=.707106781):(s=Math.sqrt(S),i=z/s,n=A/s):_>V?_<a?(s=.707106781,i=0,n=.707106781):(i=Math.sqrt(_),s=z/i,n=I/i):V<a?(s=.707106781,i=.707106781,n=0):(n=Math.sqrt(V),s=A/n,i=I/n),this.set(s,i,n,e),this}let w=Math.sqrt((x-m)*(x-m)+(c-f)*(c-f)+(d-u)*(d-u));return Math.abs(w)<.001&&(w=1),this.x=(x-m)/w,this.y=(c-f)/w,this.z=(d-u)/w,this.w=Math.acos((h+p+b-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[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,e){return this.x=kt(this.x,t.x,e.x),this.y=kt(this.y,t.y,e.y),this.z=kt(this.z,t.z,e.z),this.w=kt(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=kt(this.x,t,e),this.y=kt(this.y,t,e),this.z=kt(this.z,t,e),this.w=kt(this.w,t,e),this}clampLength(t,e){let s=this.length();return this.divideScalar(s||1).multiplyScalar(kt(s,t,e))}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,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this.w=t.w+(e.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,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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 Pg(r,t=0){let e=3735928559^t,s=1103547991^t;if(r instanceof Array)for(let i=0,n;i<r.length;i++)n=r[i],e=Math.imul(e^n,2654435761),s=Math.imul(s^n,1597334677);else for(let i=0,n;i<r.length;i++)n=r.charCodeAt(i),e=Math.imul(e^n,2654435761),s=Math.imul(s^n,1597334677);return e=Math.imul(e^e>>>16,2246822507),e^=Math.imul(s^s>>>13,3266489909),s=Math.imul(s^s>>>16,2246822507),s^=Math.imul(e^e>>>13,3266489909),4294967296*(2097151&s)+(e>>>0)}const mA=(...r)=>Pg(r);function Gtt(r,t=!1){let e=[];r.isNode===!0&&(e.push(r.id),r=r.getSelf());for(let{property:s,childNode:i}of Fg(r))e.push(Pg(s.slice(0,-4)),i.getCacheKey(t));return Pg(e)}function*Fg(r,t=!1){for(let e in r){if(e.startsWith("_")===!0)continue;let s=r[e];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:e,index:i,childNode:n})}else if(s&&s.isNode===!0)yield{property:e,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:e,index:i,childNode:n})}}}function Og(r){if(r==null)return null;let t=typeof r;return r.isNode===!0?"node":t==="number"?"float":t==="boolean"?"bool":t==="string"?"string":t==="function"?"shader":r.isVector2===!0?"vec2":r.isVector3===!0?"vec3":r.isVector4===!0?"vec4":r.isMatrix2===!0?"mat2":r.isMatrix3===!0?"mat3":r.isMatrix4===!0?"mat4":r.isColor===!0?"color":r instanceof ArrayBuffer?"ArrayBuffer":null}function fA(r,...t){let e=r?r.slice(-4):void 0;return t.length===1&&(e==="vec2"?t=[t[0],t[0]]:e==="vec3"?t=[t[0],t[0],t[0]]:e==="vec4"&&(t=[t[0],t[0],t[0],t[0]])),r==="color"?new K0(...t):e==="vec2"?new cA(...t):e==="vec3"?new ti(...t):e==="vec4"?new Htt(...t):e==="mat2"?new $tt(...t):e==="mat3"?new jh(...t):e==="mat4"?new hA(...t):r==="bool"?t[0]||!1:r==="float"||r==="int"||r==="uint"?t[0]||0:r==="string"?t[0]||"":r==="ArrayBuffer"?Ytt(t[0]):null}function Xtt(r){let t="",e=new Uint8Array(r);for(let s=0;s<e.length;s++)t+=String.fromCharCode(e[s]);return btoa(t)}function Ytt(r){return Uint8Array.from(atob(r),t=>t.charCodeAt(0)).buffer}var Ztt=class{addEventListener(r,t){this._listeners===void 0&&(this._listeners={});let e=this._listeners;e[r]===void 0&&(e[r]=[]),e[r].indexOf(t)===-1&&e[r].push(t)}hasEventListener(r,t){let e=this._listeners;return e===void 0?!1:e[r]!==void 0&&e[r].indexOf(t)!==-1}removeEventListener(r,t){let e=this._listeners;if(e===void 0)return;let s=e[r];if(s!==void 0){let i=s.indexOf(t);i!==-1&&s.splice(i,1)}}dispatchEvent(r){let t=this._listeners;if(t===void 0)return;let e=t[r.type];if(e!==void 0){r.target=this;let s=e.slice(0);for(let i=0,n=s.length;i<n;i++)s[i].call(this,r);r.target=null}}};const Jtt={analyze:"setup",generate:"analyze"};let Qtt=0;var Ktt=class extends Ztt{static get type(){return"Node"}constructor(r=null){super(),this.nodeType=r,this.updateType=Rn.NONE,this.updateBeforeType=Rn.NONE,this.updateAfterType=Rn.NONE,this.uuid=ktt.generateUUID(),this.version=0,this.global=!1,this.parents=!1,this.isNode=!0,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,"id",{value:Qtt++})}set needsUpdate(r){r===!0&&this.version++}get type(){return this.constructor.type}onUpdate(r,t){return this.updateType=t,this.update=r.bind(this.getSelf()),this}onFrameUpdate(r){return this.onUpdate(r,Rn.FRAME)}onRenderUpdate(r){return this.onUpdate(r,Rn.RENDER)}onObjectUpdate(r){return this.onUpdate(r,Rn.OBJECT)}onReference(r){return this.updateReference=r.bind(this.getSelf()),this}getSelf(){return this.self||this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:r}of Fg(this))yield r}dispose(){this.dispatchEvent({type:"dispose"})}traverse(r){r(this);for(let t of this.getChildren())t.traverse(r)}getCacheKey(r=!1){return r||(r=this.version!==this._cacheKeyVersion),(r===!0||this._cacheKey===null)&&(this._cacheKey=mA(Gtt(this,r),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(r){let t=this.getNodeType(r);return r.getElementType(t)}getMemberType(){return"void"}getNodeType(r){let t=r.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(r):this.nodeType}getShared(r){let t=this.getHash(r);return r.getNodeFromHash(t)||this}setup(r){let t=r.getNodeProperties(this),e=0;for(let s of this.getChildren())t["node"+e++]=s;return t.outputNode||null}analyze(r,t=null){let e=r.increaseUsage(this);if(this.parents===!0){let s=r.getDataFromNode(this,"any");s.stages=s.stages||{},s.stages[r.shaderStage]=s.stages[r.shaderStage]||[],s.stages[r.shaderStage].push(t)}if(e===1){let s=r.getNodeProperties(this);for(let i of Object.values(s))i&&i.isNode===!0&&i.build(r,this)}}generate(r,t){let{outputNode:e}=r.getNodeProperties(this);if(e&&e.isNode===!0)return e.build(r,t)}updateBefore(){console.warn("Abstract function.")}updateAfter(){console.warn("Abstract function.")}update(){console.warn("Abstract function.")}build(r,t=null){let e=this.getShared(r);if(this!==e)return e.build(r,t);let s=r.getDataFromNode(this);s.buildStages=s.buildStages||{},s.buildStages[r.buildStage]=!0;let i=Jtt[r.buildStage];if(i&&s.buildStages[i]!==!0){let o=r.getBuildStage();r.setBuildStage(i),this.build(r),r.setBuildStage(o)}r.addNode(this),r.addChain(this);let n=null,a=r.getBuildStage();if(a==="setup"){this.updateReference(r);let o=r.getNodeProperties(this);if(o.initialized!==!0){o.initialized=!0,o.outputNode=this.setup(r)||o.outputNode||null;for(let l of Object.values(o))if(l&&l.isNode===!0){if(l.parents===!0){let h=r.getNodeProperties(l);h.parents=h.parents||[],h.parents.push(this)}l.build(r)}}n=o.outputNode}else if(a==="analyze")this.analyze(r,t);else if(a==="generate")if(this.generate.length===1){let l=this.getNodeType(r),h=r.getDataFromNode(this);n=h.snippet,n===void 0?h.generated===void 0?(h.generated=!0,n=this.generate(r)||"",h.snippet=n):(console.warn("THREE.Node: Recursion detected.",this),n=""):h.flowCodes!==void 0&&r.context.nodeBlock!==void 0&&r.addFlowCodeHierarchy(this,r.context.nodeBlock),n=r.format(n,l,t)}else n=this.generate(r,t)||"";return r.removeChain(this),r.addSequentialNode(this),n}getSerializeChildren(){return Fg(this)}serialize(r){let t=this.getSerializeChildren(),e={};for(let{property:s,index:i,childNode:n}of t)i===void 0?e[s]=n.toJSON(r.meta).uuid:(e[s]===void 0&&(e[s]=Number.isInteger(i)?[]:{}),e[s][i]=n.toJSON(r.meta).uuid);Object.keys(e).length>0&&(r.inputNodes=e)}deserialize(r){if(r.inputNodes!==void 0){let t=r.meta.nodes;for(let e in r.inputNodes)if(Array.isArray(r.inputNodes[e])){let s=[];for(let i of r.inputNodes[e])s.push(t[i]);this[e]=s}else if(typeof r.inputNodes[e]=="object"){let s={};for(let i in r.inputNodes[e]){let n=r.inputNodes[e][i];s[i]=t[n]}this[e]=s}else{let s=r.inputNodes[e];this[e]=t[s]}}}toJSON(r){let{uuid:t,type:e}=this,s=r===void 0||typeof r=="string";s&&(r={textures:{},images:{},nodes:{}});let i=r.nodes[t];i===void 0&&(i={uuid:t,type:e,meta:r,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},s!==!0&&(r.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(r.textures),o=n(r.images),l=n(r.nodes);a.length>0&&(i.textures=a),o.length>0&&(i.images=o),l.length>0&&(i.nodes=l)}return i}},$e=Ktt,tet=class extends $e{static get type(){return"TempNode"}constructor(r=null){super(r),this.isTempNode=!0}hasDependencies(r){return r.getDataFromNode(this).usageCount>1}build(r,t){if(r.getBuildStage()==="generate"){let s=r.getVectorType(this.getNodeType(r,t)),i=r.getDataFromNode(this);if(i.propertyName!==void 0)return r.format(i.propertyName,s,t);if(s!=="void"&&t!=="void"&&this.hasDependencies(r)){let n=super.build(r,s),a=r.getVarFromNode(this,null,s),o=r.getPropertyName(a);return r.addLineFlowCode(`${o} = ${n}`,this),i.snippet=n,i.propertyName=o,r.format(i.propertyName,s,t)}}return super.build(r,t)}},ss=tet,eet=class extends $e{static get type(){return"ArrayElementNode"}constructor(r,t){super(),this.node=r,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(r){return this.node.getElementType(r)}generate(r){let t=this.indexNode.getNodeType(r),e=this.node.build(r),s=this.indexNode.build(r,!r.isVector(t)&&r.isInteger(t)?t:"uint");return`${e}[ ${s} ]`}},tx=eet,ret=class extends $e{static get type(){return"ConvertNode"}constructor(r,t){super(),this.node=r,this.convertTo=t}getNodeType(r){let t=this.node.getNodeType(r),e=null;for(let s of this.convertTo.split("|"))(e===null||r.getTypeLength(t)===r.getTypeLength(s))&&(e=s);return e}serialize(r){super.serialize(r),r.convertTo=this.convertTo}deserialize(r){super.deserialize(r),this.convertTo=r.convertTo}generate(r,t){let e=this.node,s=this.getNodeType(r),i=e.build(r,s);return r.format(i,s,t)}},gA=ret,set=class extends ss{static get type(){return"JoinNode"}constructor(r=[],t=null){super(t),this.nodes=r}getNodeType(r){return this.nodeType===null?r.getTypeFromLength(this.nodes.reduce((t,e)=>t+r.getTypeLength(e.getNodeType(r)),0)):r.getVectorType(this.nodeType)}generate(r,t){let e=this.getNodeType(r),s=r.getTypeLength(e),i=this.nodes,n=r.getComponentType(e),a=[],o=0;for(let h of i){if(o>=s){console.error(`THREE.TSL: Length of parameters exceeds maximum length of function '${e}()' type.`);break}let u=h.getNodeType(r),c=r.getTypeLength(u),d;o+c>s&&(console.error(`THREE.TSL: Length of '${e}()' data exceeds maximum length of output type.`),c=s-o,u=r.getTypeFromLength(c)),o+=c,d=h.build(r,u);let p=r.getComponentType(u);p!==n&&(d=r.format(d,p,n)),a.push(d)}let l=`${r.getType(e)}( ${a.join(", ")} )`;return r.format(l,e,t)}},iet=set;const net=$h.join("");var aet=class extends $e{static get type(){return"SplitNode"}constructor(r,t="x"){super(),this.node=r,this.components=t,this.isSplitNode=!0}getVectorLength(){let r=this.components.length;for(let t of this.components)r=Math.max($h.indexOf(t)+1,r);return r}getComponentType(r){return r.getComponentType(this.node.getNodeType(r))}getNodeType(r){return r.getTypeFromLength(this.components.length,this.getComponentType(r))}generate(r,t){let e=this.node,s=r.getTypeLength(e.getNodeType(r)),i=null;if(s>1){let n=null;this.getVectorLength()>=s&&(n=r.getTypeFromLength(this.getVectorLength(),this.getComponentType(r)));let o=e.build(r,n);i=this.components.length===s&&this.components===net.slice(0,this.components.length)?r.format(o,n,t):r.format(`${o}.${this.components}`,this.getNodeType(r),t)}else i=e.build(r,t);return i}serialize(r){super.serialize(r),r.components=this.components}deserialize(r){super.deserialize(r),this.components=r.components}},Wv=aet,oet=class extends ss{static get type(){return"SetNode"}constructor(r,t,e){super(),this.sourceNode=r,this.components=t,this.targetNode=e}getNodeType(r){return this.sourceNode.getNodeType(r)}generate(r){let{sourceNode:t,components:e,targetNode:s}=this,i=this.getNodeType(r),n=r.getComponentType(s.getNodeType(r)),a=r.getTypeFromLength(e.length,n),o=s.build(r,a),l=t.build(r,i),h=r.getTypeLength(i),u=[];for(let c=0;c<h;c++){let d=$h[c];d===e[0]?(u.push(o),c+=e.length-1):u.push(l+"."+d)}return`${r.getType(i)}( ${u.join(", ")} )`}},uet=oet,het=class extends ss{static get type(){return"FlipNode"}constructor(r,t){super(),this.sourceNode=r,this.components=t}getNodeType(r){return this.sourceNode.getNodeType(r)}generate(r){let{components:t,sourceNode:e}=this,s=this.getNodeType(r),i=e.build(r),n=r.getVarFromNode(this),a=r.getPropertyName(n);r.addLineFlowCode(a+" = "+i,this);let o=r.getTypeLength(s),l=[],h=0;for(let u=0;u<o;u++){let c=$h[u];c===t[h]?(l.push("1.0 - "+(a+"."+c)),h++):l.push(a+"."+c)}return`${r.getType(s)}( ${l.join(", ")} )`}},cet=het,det=class extends $e{static get type(){return"InputNode"}constructor(r,t=null){super(t),this.isInputNode=!0,this.value=r,this.precision=null}getNodeType(){return this.nodeType===null?Og(this.value):this.nodeType}getInputType(r){return this.getNodeType(r)}setPrecision(r){return this.precision=r,this}serialize(r){super.serialize(r),r.value=this.value,this.value&&this.value.toArray&&(r.value=this.value.toArray()),r.valueType=Og(this.value),r.nodeType=this.nodeType,r.valueType==="ArrayBuffer"&&(r.value=Xtt(r.value)),r.precision=this.precision}deserialize(r){super.deserialize(r),this.nodeType=r.nodeType,this.value=Array.isArray(r.value)?fA(r.valueType,...r.value):r.value,this.precision=r.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(r.value))}generate(){console.warn("Abstract function.")}},ex=det;const qv=/float|u?int/;var pet=class extends ex{static get type(){return"ConstNode"}constructor(r,t=null){super(r,t),this.isConstNode=!0}generateConst(r){return r.generateConst(this.getNodeType(r),this.value)}generate(r,t){let e=this.getNodeType(r);return qv.test(e)&&qv.test(t)?r.generateConst(t,this.value):r.format(this.generateConst(r),e,t)}},mn=pet,met=class extends $e{static get type(){return"MemberNode"}constructor(r,t){super(),this.node=r,this.property=t,this.isMemberNode=!0}getNodeType(r){return this.node.getMemberType(r,this.property)}generate(r){return this.node.build(r)+"."+this.property}},fet=met;let get=null;const rl=new Map;function j(r,t){if(rl.has(r)){console.warn(`THREE.TSL: Redefinition of method chaining '${r}'.`);return}if(typeof t!="function")throw Error(`THREE.TSL: Node element ${r} is not a function`);rl.set(r,t)}const yA=r=>r.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),Hv=r=>yA(r).split("").sort().join(""),xA={setup(r,t){let e=t.shift();return r(Zp(e),...t)},get(r,t,e){if(typeof t=="string"&&r[t]===void 0){if(r.isStackNode!==!0&&t==="assign")return(...s)=>(get.assign(e,...s),e);if(rl.has(t)){let s=rl.get(t);return r.isStackNode?(...i)=>e.add(s(...i)):(...i)=>s(e,...i)}else{if(t==="self")return r;if(t.endsWith("Assign")&&rl.has(t.slice(0,t.length-6))){let s=rl.get(t.slice(0,t.length-6));return r.isStackNode?(...i)=>e.assign(i[0],s(...i)):(...i)=>e.assign(s(e,...i))}else{if(/^[xyzwrgbastpq]{1,4}$/.test(t)===!0)return t=yA(t),ht(new Wv(e,t));if(/^set[XYZWRGBASTPQ]{1,4}$/.test(t)===!0)return t=Hv(t.slice(3).toLowerCase()),s=>ht(new uet(r,t,ht(s)));if(/^flip[XYZWRGBASTPQ]{1,4}$/.test(t)===!0)return t=Hv(t.slice(4).toLowerCase()),()=>ht(new cet(ht(r),t));if(t==="width"||t==="height"||t==="depth")return t==="width"?t="x":t==="height"?t="y":t==="depth"&&(t="z"),ht(new Wv(r,t));if(/^\d+$/.test(t)===!0)return ht(new tx(e,new mn(Number(t),"uint")));if(/^get$/.test(t)===!0)return s=>ht(new fet(e,s))}}}return Reflect.get(r,t,e)},set(r,t,e,s){return typeof t=="string"&&r[t]===void 0&&(/^[xyzwrgbastpq]{1,4}$/.test(t)===!0||t==="width"||t==="height"||t==="depth"||/^\d+$/.test(t)===!0)?(s[t].assign(e),!0):Reflect.set(r,t,e,s)}},kf=new WeakMap,Gv=new WeakMap,yet=function(r,t=null){let e=Og(r);if(e==="node"){let s=kf.get(r);return s===void 0&&(s=new Proxy(r,xA),kf.set(r,s),kf.set(s,s)),s}else{if(t===null&&(e==="float"||e==="boolean")||e&&e!=="shader"&&e!=="string")return ht(Bg(r,t));if(e==="shader")return As(r)}return r},xet=function(r,t=null){for(let e in r)r[e]=ht(r[e],t);return r},bet=function(r,t=null){let e=r.length;for(let s=0;s<e;s++)r[s]=ht(r[s],t);return r},vet=function(r,t=null,e=null,s=null){let i=u=>ht(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:r.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 r(...Nd(h(u)))):e===null?n=(...u)=>i(new r(t,...Nd(h(u)))):(e=ht(e),n=(...u)=>i(new r(t,...Nd(h(u)),e))),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 wet=class extends $e{constructor(r,t){super(),this.shaderNode=r,this.inputNodes=t,this.isShaderCallNodeInternal=!0}getNodeType(r){return this.shaderNode.nodeType||this.getOutputNode(r).getNodeType(r)}getMemberType(r,t){return this.getOutputNode(r).getMemberType(r,t)}call(r){let{shaderNode:t,inputNodes:e}=this,s=r.getNodeProperties(t),i=t.namespace&&t.namespace===r.namespace?r.getNamespace("once"):"once";if(s[i])return s[i];let n=null;if(t.layout){let a=Gv.get(r.constructor);a===void 0&&(a=new WeakMap,Gv.set(r.constructor,a));let o=a.get(t);o===void 0&&(o=ht(r.buildFunctionNode(t)),a.set(t,o)),r.addInclude(o),n=ht(o.call(e))}else{let a=t.jsFunc,o=e!==null||a.length>1?a(e||[],r):a(r);n=ht(o)}return t.once&&(s[i]=n),n}setupOutput(r){return r.addStack(),r.stack.outputNode=this.call(r),r.removeStack()}getOutputNode(r){let t=r.getNodeProperties(this),e=r.getOutputNamespace();return t[e]=t[e]||this.setupOutput(r),t[e]}build(r,t=null){let e=null,s=r.getBuildStage(),i=r.getNodeProperties(this),n=r.getOutputNamespace(),a=this.getOutputNode(r);if(s==="setup"){let o=r.getNamespace("initialized");i[o]!==!0&&(i[o]=!0,i[n]=this.getOutputNode(r),i[n].build(r)),e=i[n]}else s==="analyze"?a.build(r,t):s==="generate"&&(e=a.build(r,t)||"");return e}},Met=class extends $e{constructor(r,t){super(t),this.jsFunc=r,this.layout=null,this.global=!0,this.once=!1,this.namespace=null}setLayout(r){return this.layout=r,this}call(r=null){return Zp(r),ht(new wet(this,r))}setup(){return this.call()}};const Tet=[!1,!0],Net=[0,1,2,3],_et=[-1,-2],bA=[.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],rx=new Map;for(let r of Tet)rx.set(r,new mn(r));const sx=new Map;for(let r of Net)sx.set(r,new mn(r,"uint"));const ix=new Map([...sx].map(r=>new mn(r.value,"int")));for(let r of _et)ix.set(r,new mn(r,"int"));const Xp=new Map([...ix].map(r=>new mn(r.value)));for(let r of bA)Xp.set(r,new mn(r));for(let r of bA)Xp.set(-r,new mn(-r));const Yp={bool:rx,uint:sx,ints:ix,float:Xp},Xv=new Map([...rx,...Xp]),Bg=(r,t)=>Xv.has(r)?Xv.get(r):r.isNode===!0?r:new mn(r,t),Aet=r=>{try{return r.getNodeType()}catch{return}},je=function(r,t=null){return(...e)=>{if((e.length===0||!["bool","float","int","uint"].includes(r)&&e.every(i=>typeof i!="object"))&&(e=[fA(r,...e)]),e.length===1&&t!==null&&t.has(e[0]))return ht(t.get(e[0]));if(e.length===1){let i=Bg(e[0],r);return Aet(i)===r?ht(i):ht(new gA(i,r))}let s=e.map(i=>Bg(i));return ht(new iet(s,r))}},zet=r=>r==null?null:r.nodeType||r.convertTo||(typeof r=="string"?r:null);function Cet(r,t){return new Proxy(new Met(r,t),xA)}const ht=(r,t=null)=>yet(r,t),Zp=(r,t=null)=>new xet(r,t),Nd=(r,t=null)=>new bet(r,t),tt=(...r)=>new vet(...r);let Eet=0;const As=(r,t=null)=>{let e=null;t!==null&&(typeof t=="object"?e=t.return:(typeof t=="string"?e=t:console.error("THREE.TSL: Invalid layout type."),t=null));let s=new Cet(r,e),i=(...n)=>{let a;Zp(n),a=n[0]&&(n[0].isNode||Object.getPrototypeOf(n[0])!==Object.prototype)?[...n]:n[0];let l=s.call(a);return e==="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"+Eet++,type:e,inputs:[]};for(let a in t)a!=="return"&&n.inputs.push({name:a,type:t[a]});t=n}i.setLayout(t)}return i};function Vet(r){return r}j("toStack",Vet);const Ret=new je("color"),Mi=new je("float",Yp.float),sh=new je("int",Yp.ints),Let=new je("uint",Yp.uint),Iet=new je("bool",Yp.bool),vA=new je("vec2"),Pet=new je("ivec2"),Fet=new je("uvec2"),Oet=new je("bvec2"),Fl=new je("vec3"),Bet=new je("ivec3"),ket=new je("uvec3"),Det=new je("bvec3"),ka=new je("vec4"),Uet=new je("ivec4"),$et=new je("uvec4"),jet=new je("bvec4"),Wet=new je("mat2"),wA=new je("mat3"),qet=new je("mat4");j("toColor",Ret),j("toFloat",Mi),j("toInt",sh),j("toUint",Let),j("toBool",Iet),j("toVec2",vA),j("toIVec2",Pet),j("toUVec2",Fet),j("toBVec2",Oet),j("toVec3",Fl),j("toIVec3",Bet),j("toUVec3",ket),j("toBVec3",Det),j("toVec4",ka),j("toIVec4",Uet),j("toUVec4",$et),j("toBVec4",jet),j("toMat2",Wet),j("toMat3",wA),j("toMat4",qet);const Het=tt(tx).setParameterLength(2),Get=(r,t)=>ht(new gA(ht(r),t));j("element",Het),j("convert",Get),j("append",r=>(console.warn("THREE.TSL: .append() has been renamed to .toStack()."),r));const Xet={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"};var Le=class kg extends ss{static get type(){return"OperatorNode"}constructor(t,e,s,...i){if(super(),i.length>0){let n=new kg(t,e,s);for(let a=0;a<i.length-1;a++)n=new kg(t,n,i[a]);e=n,s=i[i.length-1]}this.op=t,this.aNode=e,this.bNode=s,this.isOperatorNode=!0}getOperatorMethod(t,e){return t.getMethod(Xet[this.op],e)}getNodeType(t){let e=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(e==="%")return n;if(e==="~"||e==="&"||e==="|"||e==="^"||e===">>"||e==="<<")return t.getIntegerType(n);if(e==="!"||e==="&&"||e==="||"||e==="^^")return"bool";if(e==="=="||e==="!="||e==="<"||e===">"||e==="<="||e===">="){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,e){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(e!=="void"){let d=t.renderer.coordinateSystem===Ca;if(s==="=="||s==="!="||s==="<"||s===">"||s==="<="||s===">=")return d&&t.isVector(o)?t.format(`${this.getOperatorMethod(t,e)}( ${h}, ${u} )`,a,e):t.format(`( ${h} ${s} ${u} )`,a,e);if(s==="%")return t.isInteger(l)?t.format(`( ${h} % ${u} )`,a,e):t.format(`${this.getOperatorMethod(t,a)}( ${h}, ${u} )`,a,e);if(s==="!"||s==="~")return t.format(`(${s}${h})`,o,e);if(c)return t.format(`${c}( ${h}, ${u} )`,a,e);if(t.isMatrix(o)&&l==="float")return t.format(`( ${u} ${s} ${h} )`,a,e);if(o==="float"&&t.isMatrix(l))return t.format(`${h} ${s} ${u}`,a,e);{let p=`( ${h} ${s} ${u} )`;return!d&&a==="bool"&&t.isVector(o)&&t.isVector(l)&&(p=`all${p}`),t.format(p,a,e)}}else if(o!=="void")return c?t.format(`${c}( ${h}, ${u} )`,a,e):t.isMatrix(o)&&l==="float"?t.format(`${u} ${s} ${h}`,a,e):t.format(`${h} ${s} ${u}`,a,e)}serialize(t){super.serialize(t),t.op=this.op}deserialize(t){super.deserialize(t),this.op=t.op}};const MA=tt(Le,"+").setParameterLength(2,1/0).setName("add"),Dg=tt(Le,"-").setParameterLength(2,1/0).setName("sub"),nx=tt(Le,"*").setParameterLength(2,1/0).setName("mul"),TA=tt(Le,"/").setParameterLength(2,1/0).setName("div"),Jp=tt(Le,"%").setParameterLength(2).setName("mod"),NA=tt(Le,"==").setParameterLength(2).setName("equal"),Yet=tt(Le,"!=").setParameterLength(2).setName("notEqual"),Zet=tt(Le,"<").setParameterLength(2).setName("lessThan"),Jet=tt(Le,">").setParameterLength(2).setName("greaterThan"),Qet=tt(Le,"<=").setParameterLength(2).setName("lessThanEqual"),Ket=tt(Le,">=").setParameterLength(2).setName("greaterThanEqual"),trt=tt(Le,"&&").setParameterLength(2,1/0).setName("and"),ert=tt(Le,"||").setParameterLength(2,1/0).setName("or"),rrt=tt(Le,"!").setParameterLength(1).setName("not"),srt=tt(Le,"^^").setParameterLength(2).setName("xor"),irt=tt(Le,"&").setParameterLength(2).setName("bitAnd"),nrt=tt(Le,"~").setParameterLength(2).setName("bitNot"),art=tt(Le,"|").setParameterLength(2).setName("bitOr"),ort=tt(Le,"^").setParameterLength(2).setName("bitXor"),lrt=tt(Le,"<<").setParameterLength(2).setName("shiftLeft"),urt=tt(Le,">>").setParameterLength(2).setName("shiftRight"),hrt=As(([r])=>(r.addAssign(1),r)),crt=As(([r])=>(r.subAssign(1),r)),drt=As(([r])=>{let t=sh(r).toConst();return r.addAssign(1),t}),prt=As(([r])=>{let t=sh(r).toConst();return r.subAssign(1),t});j("add",MA),j("sub",Dg),j("mul",nx),j("div",TA),j("mod",Jp),j("equal",NA),j("notEqual",Yet),j("lessThan",Zet),j("greaterThan",Jet),j("lessThanEqual",Qet),j("greaterThanEqual",Ket),j("and",trt),j("or",ert),j("not",rrt),j("xor",srt),j("bitAnd",irt),j("bitNot",nrt),j("bitOr",art),j("bitXor",ort),j("shiftLeft",lrt),j("shiftRight",urt),j("incrementBefore",hrt),j("decrementBefore",crt),j("increment",drt),j("decrement",prt);const mrt=(r,t)=>(console.warn('THREE.TSL: "remainder()" is deprecated. Use "mod( int( ... ) )" instead.'),Jp(r,t)),frt=(r,t)=>(console.warn('THREE.TSL: "modInt()" is deprecated. Use "mod( int( ... ) )" instead.'),Jp(sh(r),sh(t)));j("remainder",mrt),j("modInt",frt);var O=class re extends ss{static get type(){return"MathNode"}constructor(t,e,s=null,i=null){if(super(),(t===re.MAX||t===re.MIN)&&arguments.length>3){let n=new re(t,e,s);for(let a=2;a<arguments.length-1;a++)n=new re(t,n,arguments[a]);e=n,s=arguments[arguments.length-1],i=null}this.method=t,this.aNode=e,this.bNode=s,this.cNode=i,this.isMathNode=!0}getInputType(t){let e=this.aNode.getNodeType(t),s=this.bNode?this.bNode.getNodeType(t):null,i=this.cNode?this.cNode.getNodeType(t):null,n=t.isMatrix(e)?0:t.getTypeLength(e),a=t.isMatrix(s)?0:t.getTypeLength(s),o=t.isMatrix(i)?0:t.getTypeLength(i);return n>a&&n>o?e:a>o?s:o>n?i:e}getNodeType(t){let e=this.method;return e===re.LENGTH||e===re.DISTANCE||e===re.DOT?"float":e===re.CROSS?"vec3":e===re.ALL||e===re.ANY?"bool":e===re.EQUALS?t.changeComponentType(this.aNode.getNodeType(t),"bool"):this.getInputType(t)}setup(t){let{aNode:e,bNode:s,method:i}=this,n=null;if(i===re.ONE_MINUS)n=Dg(1,e);else if(i===re.RECIPROCAL)n=TA(1,e);else if(i===re.DIFFERENCE)n=ax(Dg(e,s));else if(i===re.TRANSFORM_DIRECTION){let a=e,o=s;t.isMatrix(a.getNodeType(t))?o=ka(Fl(o),0):a=ka(Fl(a),0);let l=nx(a,o).xyz;n=SA(l)}return n===null?super.setup(t):n}generate(t,e){if(t.getNodeProperties(this).outputNode)return super.generate(t,e);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===re.NEGATE)return t.format("( - "+o.build(t,a)+" )",n,e);{let c=[];return i===re.CROSS?c.push(o.build(t,n),l.build(t,n)):u===Ca&&i===re.STEP?c.push(o.build(t,t.getTypeLength(o.getNodeType(t))===1?"float":a),l.build(t,a)):u===Ca&&(i===re.MIN||i===re.MAX)?c.push(o.build(t,a),l.build(t,t.getTypeLength(l.getNodeType(t))===1?"float":a)):i===re.REFRACT?c.push(o.build(t,a),l.build(t,a),h.build(t,"float")):i===re.MIX?c.push(o.build(t,a),l.build(t,a),h.build(t,t.getTypeLength(h.getNodeType(t))===1?"float":a)):(u===Lg&&i===re.ATAN&&l!==null&&(i="atan2"),t.shaderStage!=="fragment"&&(i===re.DFDX||i===re.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,e)}}serialize(t){super.serialize(t),t.method=this.method}deserialize(t){super.deserialize(t),this.method=t.method}};O.ALL="all",O.ANY="any",O.RADIANS="radians",O.DEGREES="degrees",O.EXP="exp",O.EXP2="exp2",O.LOG="log",O.LOG2="log2",O.SQRT="sqrt",O.INVERSE_SQRT="inversesqrt",O.FLOOR="floor",O.CEIL="ceil",O.NORMALIZE="normalize",O.FRACT="fract",O.SIN="sin",O.COS="cos",O.TAN="tan",O.ASIN="asin",O.ACOS="acos",O.ATAN="atan",O.ABS="abs",O.SIGN="sign",O.LENGTH="length",O.NEGATE="negate",O.ONE_MINUS="oneMinus",O.DFDX="dFdx",O.DFDY="dFdy",O.ROUND="round",O.RECIPROCAL="reciprocal",O.TRUNC="trunc",O.FWIDTH="fwidth",O.TRANSPOSE="transpose",O.BITCAST="bitcast",O.EQUALS="equals",O.MIN="min",O.MAX="max",O.STEP="step",O.REFLECT="reflect",O.DISTANCE="distance",O.DIFFERENCE="difference",O.DOT="dot",O.CROSS="cross",O.POW="pow",O.TRANSFORM_DIRECTION="transformDirection",O.MIX="mix",O.CLAMP="clamp",O.REFRACT="refract",O.SMOOTHSTEP="smoothstep",O.FACEFORWARD="faceforward";const grt=Mi(Math.PI);Mi(Math.PI*2);const yrt=tt(O,O.ALL).setParameterLength(1),xrt=tt(O,O.ANY).setParameterLength(1),brt=tt(O,O.RADIANS).setParameterLength(1),vrt=tt(O,O.DEGREES).setParameterLength(1),wrt=tt(O,O.EXP).setParameterLength(1),Mrt=tt(O,O.EXP2).setParameterLength(1),Trt=tt(O,O.LOG).setParameterLength(1),Nrt=tt(O,O.LOG2).setParameterLength(1),Srt=tt(O,O.SQRT).setParameterLength(1),_rt=tt(O,O.INVERSE_SQRT).setParameterLength(1),Art=tt(O,O.FLOOR).setParameterLength(1),zrt=tt(O,O.CEIL).setParameterLength(1),SA=tt(O,O.NORMALIZE).setParameterLength(1),_A=tt(O,O.FRACT).setParameterLength(1),AA=tt(O,O.SIN).setParameterLength(1),Crt=tt(O,O.COS).setParameterLength(1),Ert=tt(O,O.TAN).setParameterLength(1),Vrt=tt(O,O.ASIN).setParameterLength(1),Rrt=tt(O,O.ACOS).setParameterLength(1),zA=tt(O,O.ATAN).setParameterLength(1,2),ax=tt(O,O.ABS).setParameterLength(1),CA=tt(O,O.SIGN).setParameterLength(1),Lrt=tt(O,O.LENGTH).setParameterLength(1),Irt=tt(O,O.NEGATE).setParameterLength(1),Prt=tt(O,O.ONE_MINUS).setParameterLength(1),Frt=tt(O,O.DFDX).setParameterLength(1),Ort=tt(O,O.DFDY).setParameterLength(1),Brt=tt(O,O.ROUND).setParameterLength(1),krt=tt(O,O.RECIPROCAL).setParameterLength(1),Drt=tt(O,O.TRUNC).setParameterLength(1),Urt=tt(O,O.FWIDTH).setParameterLength(1),$rt=tt(O,O.TRANSPOSE).setParameterLength(1),jrt=(r,t)=>(console.warn('THREE.TSL: "equals" is deprecated. Use "equal" inside a vector instead, like: "bvec*( equal( ... ) )"'),NA(r,t)),Wrt=tt(O,O.MIN).setParameterLength(2,1/0),qrt=tt(O,O.MAX).setParameterLength(2,1/0),Hrt=tt(O,O.STEP).setParameterLength(2),Grt=tt(O,O.REFLECT).setParameterLength(2),Xrt=tt(O,O.DISTANCE).setParameterLength(2),Yrt=tt(O,O.DIFFERENCE).setParameterLength(2),Wh=tt(O,O.DOT).setParameterLength(2),Zrt=tt(O,O.CROSS).setParameterLength(2),EA=tt(O,O.POW).setParameterLength(2),Jrt=tt(O,O.POW,2).setParameterLength(1),Qrt=tt(O,O.POW,3).setParameterLength(1),Krt=tt(O,O.POW,4).setParameterLength(1),tst=tt(O,O.TRANSFORM_DIRECTION).setParameterLength(2),est=r=>nx(CA(r),EA(ax(r),1/3)),rst=r=>Wh(r,r),Qp=tt(O,O.MIX).setParameterLength(3),VA=(r,t=0,e=1)=>ht(new O(O.CLAMP,ht(r),ht(t),ht(e))),sst=r=>VA(r),ist=tt(O,O.REFRACT).setParameterLength(3),nst=tt(O,O.SMOOTHSTEP).setParameterLength(3),ast=tt(O,O.FACEFORWARD).setParameterLength(3),ost=As(([r])=>{let t=12.9898,e=78.233,s=43758.5453,i=Wh(r.xy,vA(t,e)),n=Jp(i,grt);return _A(AA(n).mul(s))}),lst=(r,t,e)=>Qp(t,e,r),ust=(r,t,e)=>nst(t,e,r),hst=(r,t)=>(console.warn('THREE.TSL: "atan2" is overloaded. Use "atan" instead.'),zA(r,t));j("all",yrt),j("any",xrt),j("equals",jrt),j("radians",brt),j("degrees",vrt),j("exp",wrt),j("exp2",Mrt),j("log",Trt),j("log2",Nrt),j("sqrt",Srt),j("inverseSqrt",_rt),j("floor",Art),j("ceil",zrt),j("normalize",SA),j("fract",_A),j("sin",AA),j("cos",Crt),j("tan",Ert),j("asin",Vrt),j("acos",Rrt),j("atan",zA),j("abs",ax),j("sign",CA),j("length",Lrt),j("lengthSq",rst),j("negate",Irt),j("oneMinus",Prt),j("dFdx",Frt),j("dFdy",Ort),j("round",Brt),j("reciprocal",krt),j("trunc",Drt),j("fwidth",Urt),j("atan2",hst),j("min",Wrt),j("max",qrt),j("step",Hrt),j("reflect",Grt),j("distance",Xrt),j("dot",Wh),j("cross",Zrt),j("pow",EA),j("pow2",Jrt),j("pow3",Qrt),j("pow4",Krt),j("transformDirection",tst),j("mix",lst),j("clamp",VA),j("refract",ist),j("smoothstep",ust),j("faceForward",ast),j("difference",Yrt),j("saturate",sst),j("cbrt",est),j("transpose",$rt),j("rand",ost);var Yv=class extends ss{static get type(){return"ArrayNode"}constructor(r,t,e=null){super(r),this.count=t,this.values=e,this.isArrayNode=!0}getNodeType(r){return this.nodeType===null&&(this.nodeType=this.values[0].getNodeType(r)),this.nodeType}getElementType(r){return this.getNodeType(r)}generate(r){let t=this.getNodeType(r);return r.generateArray(t,this.count,this.values)}};const cst=(...r)=>{let t;if(r.length===1){let e=r[0];t=new Yv(null,e.length,e)}else{let e=r[0],s=r[1];t=new Yv(e,s)}return ht(t)};j("toArray",(r,t)=>cst(Array(t).fill(r)));var RA=class extends $e{static get type(){return"UniformGroupNode"}constructor(r,t=!1,e=1){super("string"),this.name=r,this.shared=t,this.order=e,this.isUniformGroup=!0}serialize(r){super.serialize(r),r.name=this.name,r.version=this.version,r.shared=this.shared}deserialize(r){super.deserialize(r),this.name=r.name,this.version=r.version,this.shared=r.shared}};const dst=r=>new RA(r),pst=(r,t=0)=>new RA(r,!0,t),mst=pst("render"),fst=dst("object");var gst=class extends ex{static get type(){return"UniformNode"}constructor(r,t=null){super(r,t),this.isUniformNode=!0,this.name="",this.groupNode=fst}label(r){return this.name=r,this}setGroup(r){return this.groupNode=r,this}getGroup(){return this.groupNode}getUniformHash(r){return this.getHash(r)}onUpdate(r,t){let e=this.getSelf();return r=r.bind(e),super.onUpdate(s=>{let i=r(s,e);i!==void 0&&(this.value=i)},t)}generate(r,t){let e=this.getNodeType(r),s=this.getUniformHash(r),i=r.getNodeFromHash(s);i===void 0&&(r.setHashNode(this,s),i=this);let n=i.getInputType(r),a=r.getUniformFromNode(i,n,r.shaderStage,this.name||r.context.label),o=r.getPropertyName(a);return r.context.label!==void 0&&delete r.context.label,r.format(o,e,t)}};const yst=(r,t)=>{let e=zet(t||r),s=r;return ht(new gst(s,e))};var xst=class extends $e{static get type(){return"PropertyNode"}constructor(r,t=null,e=!1){super(r),this.name=t,this.varying=e,this.isPropertyNode=!0,this.global=!0}getHash(r){return this.name||super.getHash(r)}generate(r){let t;return this.varying===!0?(t=r.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=r.getVarFromNode(this,this.name),r.getPropertyName(t)}};const bst=(r,t)=>ht(new xst(r,t));var vst=class extends ss{static get type(){return"AssignNode"}constructor(r,t){super(),this.targetNode=r,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}getNodeType(r,t){return t==="void"?"void":this.targetNode.getNodeType(r)}needsSplitAssign(r){let{targetNode:t}=this;if(r.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){let e=r.getTypeLength(t.node.getNodeType(r));return $h.join("").slice(0,e)!==t.components}return!1}setup(r){let{targetNode:t,sourceNode:e}=this,s=r.getNodeProperties(this);s.sourceNode=e,s.targetNode=t.context({assign:!0})}generate(r,t){let{targetNode:e,sourceNode:s}=r.getNodeProperties(this),i=this.needsSplitAssign(r),n=e.getNodeType(r),a=e.build(r),o=s.build(r,n),l=s.getNodeType(r),h=r.getDataFromNode(this),u;if(h.initialized===!0)t!=="void"&&(u=a);else if(i){let c=r.getVarFromNode(this,null,n),d=r.getPropertyName(c);r.addLineFlowCode(`${d} = ${o}`,this);let p=e.node,m=p.node.context({assign:!0}),f=m.build(r);for(let x=0;x<p.components.length;x++){let b=p.components[x];r.addLineFlowCode(`${f}.${b} = ${d}[ ${x} ]`,this)}t!=="void"&&(u=a)}else u=`${a} = ${o}`,(t==="void"||l==="void")&&(r.addLineFlowCode(u,this),t!=="void"&&(u=a));return h.initialized=!0,r.format(u,n,t)}};const wst=tt(vst).setParameterLength(2);j("assign",wst);var Mst=class extends ss{static get type(){return"FunctionCallNode"}constructor(r=null,t={}){super(),this.functionNode=r,this.parameters=t}setParameters(r){return this.parameters=r,this}getParameters(){return this.parameters}getNodeType(r){return this.functionNode.getNodeType(r)}generate(r){let t=[],e=this.functionNode,s=e.getInputs(r),i=this.parameters,n=(o,l)=>{let h=l.type,u=h==="pointer",c;return c=u?"&"+o.build(r):o.build(r,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(Mi(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(Mi(0),o))):t.push(n(l,o))}return`${e.build(r,"property")}( ${t.join(", ")} )`}};const Tst=(r,...t)=>(t=t.length>1||t[0]&&t[0].isNode===!0?Nd(t):Zp(t[0]),ht(new Mst(ht(r),t)));j("call",Tst);var Nst=class extends $e{static get type(){return"ConditionalNode"}constructor(r,t,e=null){super(),this.condNode=r,this.ifNode=t,this.elseNode=e}getNodeType(r){let{ifNode:t,elseNode:e}=r.getNodeProperties(this);if(t===void 0)return this.setup(r),this.getNodeType(r);let s=t.getNodeType(r);if(e!==null){let i=e.getNodeType(r);if(r.getTypeLength(i)>r.getTypeLength(s))return i}return s}setup(r){let t=this.condNode.cache(),e=this.ifNode.cache(),s=this.elseNode?this.elseNode.cache():null,i=r.context.nodeBlock;r.getDataFromNode(e).parentNodeBlock=i,s!==null&&(r.getDataFromNode(s).parentNodeBlock=i);let n=r.getNodeProperties(this);n.condNode=t,n.ifNode=e.context({nodeBlock:e}),n.elseNode=s?s.context({nodeBlock:s}):null}generate(r,t){let e=this.getNodeType(r),s=r.getDataFromNode(this);if(s.nodeProperty!==void 0)return s.nodeProperty;let{condNode:i,ifNode:n,elseNode:a}=r.getNodeProperties(this),o=r.currentFunctionNode,l=t!=="void",h=l?bst(e).build(r):"";s.nodeProperty=h;let u=i.build(r,"bool");r.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 ytt=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 xe=J.createContext(null),xtt=({children:r,hideNotice:t=!1,style:e={},className:s="",...i})=>{const n=J.useRef(null),a=J.useMemo(()=>"ombre-root-"+Math.random().toString(36).substring(7),[]),o=J.useRef(null);o.current===null&&(o.current=Ms.shaderRenderer());const l=J.useMemo(()=>(f,x,b,w,S=null)=>{if(x===null){try{o.current.removeNode(f)}catch(_){console.warn("Error removing node:",_)}return}try{o.current.registerNode(f,x,b,w,S)}catch(_){console.error("Error registering node:",_,{id:f,parentId:b,metadata:w})}},[]),h=J.useMemo(()=>(f,x,b)=>{try{o.current.updateUniformValue(f,x,b)}catch(w){console.warn("Error updating uniform:",w)}},[]),u=J.useMemo(()=>(f,x)=>{try{o.current.updateNodeMetadata(f,x)}catch(b){console.warn("Error updating metadata:",b)}},[]),c=J.useMemo(()=>({ombreParentId:a,ombreNodeRegister:l,ombreUniformUpdate:h,ombreMetadataUpdate:u}),[a,l,h,u]),d=J.useRef(!1),p=J.useRef(!1);J.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||ytt(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 e=="object"?e:{}};return Vr.jsx(xe.Provider,{value:c,children:Vr.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",...typeof e=="object"?e:{}},className:s,...i,children:[Vr.jsx("canvas",{"data-renderer":"ombre",ref:n,style:m}),r]})})};function btt(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const rA={blendMode:"normal",opacity:1};try{ul&&ul.props&&Object.entries(ul.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(rA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const vtt=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${ul.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>btt(r,rA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(ul,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,ul.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})},ad=new WeakMap,gl={name:"glassTiles",props:{intensity:{type:Number,default:1,description:"The intensity of the glass tiles effect"},tileCount:{type:Number,default:100,description:"Number of tiles across the shortest dimension"}},fragmentNode:({uniforms:r,childNode:t,onCleanup:e,canvas:s})=>{let{vec2:i,vec4:n,floor:a,mul:o,div:l,sub:h,add:u,convertToTexture:c,uv:d,uniform:p}=rs;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=ad.get(s);b||(b=new ResizeObserver(Vt=>{let Yt=Vt[0];if(!Yt)return;let{width:se,height:te}=Yt.contentRect,ft=window.devicePixelRatio||1;m.setSize(se*ft,te*ft),x()}),b.observe(s),ad.set(s,b)),e(()=>{let Vt=ad.get(s);Vt&&(Vt.disconnect(),ad.delete(s))});let w=d(),S=r.intensity.uniform,_=r.tileCount.uniform,V=i(f.greaterThanEqual(1).select(o(_,f),_),f.lessThan(1).select(l(_,f),_)),z=l(a(o(w,V)),V),A=h(w,z),I=i(.5,.5),et=o(S,.025),nt=l(A,l(i(1),V)),it=h(nt,I),vt=o(it,et),mt=u(A,vt),Rt=u(mt,z);return n(m.sample(Rt))}};function wtt(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const sA={blendMode:"normal",opacity:1};try{gl&&gl.props&&Object.entries(gl.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(sA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const Mtt=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${gl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>wtt(r,sA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(gl,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,gl.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})},od={VERTEX:"vertex"},Rn={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},$h=["x","y","z","w"],gr="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 Fv=1234567;const iA=Math.PI/180,nA=180/Math.PI;function Td(){let r=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(gr[r&255]+gr[r>>8&255]+gr[r>>16&255]+gr[r>>24&255]+"-"+gr[t&255]+gr[t>>8&255]+"-"+gr[t>>16&15|64]+gr[t>>24&255]+"-"+gr[e&63|128]+gr[e>>8&255]+"-"+gr[e>>16&255]+gr[e>>24&255]+gr[s&255]+gr[s>>8&255]+gr[s>>16&255]+gr[s>>24&255]).toLowerCase()}function kt(r,t,e){return Math.max(t,Math.min(e,r))}function Q0(r,t){return(r%t+t)%t}function Ttt(r,t,e,s,i){return s+(r-t)*(i-s)/(e-t)}function Ntt(r,t,e){return r===t?0:(e-r)/(t-r)}function Bu(r,t,e){return(1-e)*r+e*t}function Stt(r,t,e,s){return Bu(r,t,1-Math.exp(-e*s))}function _tt(r,t=1){return t-Math.abs(Q0(r,t*2)-t)}function Att(r,t,e){return r<=t?0:r>=e?1:(r=(r-t)/(e-t),r*r*(3-2*r))}function ztt(r,t,e){return r<=t?0:r>=e?1:(r=(r-t)/(e-t),r*r*r*(r*(r*6-15)+10))}function Ctt(r,t){return r+Math.floor(Math.random()*(t-r+1))}function Ett(r,t){return r+Math.random()*(t-r)}function Vtt(r){return r*(.5-Math.random())}function Rtt(r){r!==void 0&&(Fv=r);let t=Fv+=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 Ltt(r){return r*iA}function Itt(r){return r*nA}function Ptt(r){return(r&r-1)==0&&r!==0}function Ftt(r){return 2**Math.ceil(Math.log(r)/Math.LN2)}function Ott(r){return 2**Math.floor(Math.log(r)/Math.LN2)}function Btt(r,t,e,s,i){let n=Math.cos,a=Math.sin,o=n(e/2),l=a(e/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":r.set(o*u,l*c,l*d,o*h);break;case"YZY":r.set(l*d,o*u,l*c,o*h);break;case"ZXZ":r.set(l*c,l*d,o*u,o*h);break;case"XZX":r.set(o*u,l*m,l*p,o*h);break;case"YXY":r.set(l*p,o*u,l*m,o*h);break;case"ZYZ":r.set(l*m,l*p,o*u,o*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Gs(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw Error("Invalid component type.")}}function Ht(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw Error("Invalid component type.")}}const ktt={DEG2RAD:iA,RAD2DEG:nA,generateUUID:Td,clamp:kt,euclideanModulo:Q0,mapLinear:Ttt,inverseLerp:Ntt,lerp:Bu,damp:Stt,pingpong:_tt,smoothstep:Att,smootherstep:ztt,randInt:Ctt,randFloat:Ett,randFloatSpread:Vtt,seededRandom:Rtt,degToRad:Ltt,radToDeg:Itt,isPowerOfTwo:Ptt,ceilPowerOfTwo:Ftt,floorPowerOfTwo:Ott,setQuaternionFromProperEuler:Btt,normalize:Ht,denormalize:Gs},Vg=0,Dtt=1015,Rg="",Us="srgb",Ov="srgb-linear",Bv="linear",ku="srgb",ap=35044,Ca=2e3,Lg=2001;var jh=class aA{constructor(t,e,s,i,n,a,o,l,h){aA.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,s,i,n,a,o,l,h)}set(t,e,s,i,n,a,o,l,h){let u=this.elements;return u[0]=t,u[1]=i,u[2]=o,u[3]=e,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 e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],this}extractBasis(t,e,s){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let s=t.elements,i=e.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],w=i[1],S=i[4],_=i[7],V=i[2],z=i[5],A=i[8];return n[0]=a*f+o*w+l*V,n[3]=a*x+o*S+l*z,n[6]=a*b+o*_+l*A,n[1]=h*f+u*w+c*V,n[4]=h*x+u*S+c*z,n[7]=h*b+u*_+c*A,n[2]=d*f+p*w+m*V,n[5]=d*x+p*S+m*z,n[8]=d*b+p*_+m*A,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=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 e*a*u-e*o*h-s*n*u+s*o*l+i*n*h-i*a*l}invert(){let t=this.elements,e=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=e*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*e-i*l)*f,t[5]=(i*n-o*e)*f,t[6]=p*f,t[7]=(s*l-h*e)*f,t[8]=(a*e-s*n)*f,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,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+e,0,0,1),this}scale(t,e){return this.premultiply(Ff.makeScale(t,e)),this}rotate(t){return this.premultiply(Ff.makeRotation(-t)),this}translate(t,e){return this.premultiply(Ff.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,s,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,s=t.elements;for(let i=0;i<9;i++)if(e[i]!==s[i])return!1;return!0}fromArray(t,e=0){for(let s=0;s<9;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){let s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t}clone(){return new this.constructor().fromArray(this.elements)}};const Ff=new jh,kv={};function Dv(r){r in kv||(kv[r]=!0,console.warn(r))}const Uv=new jh().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),$v=new jh().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Utt(){let r={enabled:!0,workingColorSpace:Ov,spaces:{},convert:function(i,n,a){return this.enabled===!1||n===a||!n||!a||(this.spaces[n].transfer===ku&&(i.r=yl(i.r),i.g=yl(i.g),i.b=yl(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===ku&&(i.r=xl(i.r),i.g=xl(i.g),i.b=xl(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===Rg?Bv: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 Dv("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,n)},toWorkingColorSpace:function(i,n){return Dv("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,n)}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],s=[.3127,.329];return r.define({[Ov]:{primaries:t,whitePoint:s,transfer:Bv,toXYZ:Uv,fromXYZ:$v,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:Us},outputColorSpaceConfig:{drawingBufferColorSpace:Us}},[Us]:{primaries:t,whitePoint:s,transfer:ku,toXYZ:Uv,fromXYZ:$v,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:Us}}}),r}const Oe=Utt();function yl(r){return r<.04045?r*.0773993808:(r*.9478672986+.0521327014)**2.4}function xl(r){return r<.0031308?r*12.92:1.055*r**.41666-.055}const oA={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},zn={h:0,s:0,l:0},ld={h:0,s:0,l:0};function Of(r,t,e){return e<0&&(e+=1),e>1&&--e,e<1/6?r+(t-r)*6*e:e<1/2?t:e<2/3?r+(t-r)*6*(2/3-e):r}var K0=class{constructor(r,t,e){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(r,t,e)}set(r,t,e){if(t===void 0&&e===void 0){let s=r;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(r,t,e);return this}setScalar(r){return this.r=r,this.g=r,this.b=r,this}setHex(r,t=Us){return r=Math.floor(r),this.r=(r>>16&255)/255,this.g=(r>>8&255)/255,this.b=(r&255)/255,Oe.colorSpaceToWorking(this,t),this}setRGB(r,t,e,s=Oe.workingColorSpace){return this.r=r,this.g=t,this.b=e,Oe.colorSpaceToWorking(this,s),this}setHSL(r,t,e,s=Oe.workingColorSpace){if(r=Q0(r,1),t=kt(t,0,1),e=kt(e,0,1),t===0)this.r=this.g=this.b=e;else{let i=e<=.5?e*(1+t):e+t-e*t,n=2*e-i;this.r=Of(n,i,r+1/3),this.g=Of(n,i,r),this.b=Of(n,i,r-1/3)}return Oe.colorSpaceToWorking(this,s),this}setStyle(r,t=Us){function e(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+r+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(r)){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 e(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 e(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 e(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 "+r)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(r)){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 "+r)}else if(r&&r.length>0)return this.setColorName(r,t);return this}setColorName(r,t=Us){let e=oA[r.toLowerCase()];return e===void 0?console.warn("THREE.Color: Unknown color "+r):this.setHex(e,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(r){return this.r=r.r,this.g=r.g,this.b=r.b,this}copySRGBToLinear(r){return this.r=yl(r.r),this.g=yl(r.g),this.b=yl(r.b),this}copyLinearToSRGB(r){return this.r=xl(r.r),this.g=xl(r.g),this.b=xl(r.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(r=Us){return Oe.workingToColorSpace(yr.copy(this),r),Math.round(kt(yr.r*255,0,255))*65536+Math.round(kt(yr.g*255,0,255))*256+Math.round(kt(yr.b*255,0,255))}getHexString(r=Us){return("000000"+this.getHex(r).toString(16)).slice(-6)}getHSL(r,t=Oe.workingColorSpace){Oe.workingToColorSpace(yr.copy(this),t);let e=yr.r,s=yr.g,i=yr.b,n=Math.max(e,s,i),a=Math.min(e,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 e:o=(s-i)/u+(s<i?6:0);break;case s:o=(i-e)/u+2;break;case i:o=(e-s)/u+4;break}o/=6}return r.h=o,r.s=l,r.l=h,r}getRGB(r,t=Oe.workingColorSpace){return Oe.workingToColorSpace(yr.copy(this),t),r.r=yr.r,r.g=yr.g,r.b=yr.b,r}getStyle(r=Us){Oe.workingToColorSpace(yr.copy(this),r);let t=yr.r,e=yr.g,s=yr.b;return r===Us?`rgb(${Math.round(t*255)},${Math.round(e*255)},${Math.round(s*255)})`:`color(${r} ${t.toFixed(3)} ${e.toFixed(3)} ${s.toFixed(3)})`}offsetHSL(r,t,e){return this.getHSL(zn),this.setHSL(zn.h+r,zn.s+t,zn.l+e)}add(r){return this.r+=r.r,this.g+=r.g,this.b+=r.b,this}addColors(r,t){return this.r=r.r+t.r,this.g=r.g+t.g,this.b=r.b+t.b,this}addScalar(r){return this.r+=r,this.g+=r,this.b+=r,this}sub(r){return this.r=Math.max(0,this.r-r.r),this.g=Math.max(0,this.g-r.g),this.b=Math.max(0,this.b-r.b),this}multiply(r){return this.r*=r.r,this.g*=r.g,this.b*=r.b,this}multiplyScalar(r){return this.r*=r,this.g*=r,this.b*=r,this}lerp(r,t){return this.r+=(r.r-this.r)*t,this.g+=(r.g-this.g)*t,this.b+=(r.b-this.b)*t,this}lerpColors(r,t,e){return this.r=r.r+(t.r-r.r)*e,this.g=r.g+(t.g-r.g)*e,this.b=r.b+(t.b-r.b)*e,this}lerpHSL(r,t){this.getHSL(zn),r.getHSL(ld);let e=Bu(zn.h,ld.h,t),s=Bu(zn.s,ld.s,t),i=Bu(zn.l,ld.l,t);return this.setHSL(e,s,i),this}setFromVector3(r){return this.r=r.x,this.g=r.y,this.b=r.z,this}applyMatrix3(r){let t=this.r,e=this.g,s=this.b,i=r.elements;return this.r=i[0]*t+i[3]*e+i[6]*s,this.g=i[1]*t+i[4]*e+i[7]*s,this.b=i[2]*t+i[5]*e+i[8]*s,this}equals(r){return r.r===this.r&&r.g===this.g&&r.b===this.b}fromArray(r,t=0){return this.r=r[t],this.g=r[t+1],this.b=r[t+2],this}toArray(r=[],t=0){return r[t]=this.r,r[t+1]=this.g,r[t+2]=this.b,r}fromBufferAttribute(r,t){return this.r=r.getX(t),this.g=r.getY(t),this.b=r.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const yr=new K0;K0.NAMES=oA;var $tt=class lA{constructor(t,e,s,i){lA.prototype.isMatrix2=!0,this.elements=[1,0,0,1],t!==void 0&&this.set(t,e,s,i)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let s=0;s<4;s++)this.elements[s]=t[s+e];return this}set(t,e,s,i){let n=this.elements;return n[0]=t,n[2]=e,n[1]=s,n[3]=i,this}},jtt=class{constructor(r=0,t=0,e=0,s=1){this.isQuaternion=!0,this._x=r,this._y=t,this._z=e,this._w=s}static slerpFlat(r,t,e,s,i,n,a){let o=e[s+0],l=e[s+1],h=e[s+2],u=e[s+3],c=i[n+0],d=i[n+1],p=i[n+2],m=i[n+3];if(a===0){r[t+0]=o,r[t+1]=l,r[t+2]=h,r[t+3]=u;return}if(a===1){r[t+0]=c,r[t+1]=d,r[t+2]=p,r[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,w=1-x*x;if(w>2**-52){let _=Math.sqrt(w),V=Math.atan2(_,x*b);f=Math.sin(f*V)/_,a=Math.sin(a*V)/_}let S=a*b;if(o=o*f+c*S,l=l*f+d*S,h=h*f+p*S,u=u*f+m*S,f===1-a){let _=1/Math.sqrt(o*o+l*l+h*h+u*u);o*=_,l*=_,h*=_,u*=_}}r[t]=o,r[t+1]=l,r[t+2]=h,r[t+3]=u}static multiplyQuaternionsFlat(r,t,e,s,i,n){let a=e[s],o=e[s+1],l=e[s+2],h=e[s+3],u=i[n],c=i[n+1],d=i[n+2],p=i[n+3];return r[t]=a*p+h*u+o*d-l*c,r[t+1]=o*p+h*c+l*u-a*d,r[t+2]=l*p+h*d+a*c-o*u,r[t+3]=h*p-a*u-o*c-l*d,r}get x(){return this._x}set x(r){this._x=r,this._onChangeCallback()}get y(){return this._y}set y(r){this._y=r,this._onChangeCallback()}get z(){return this._z}set z(r){this._z=r,this._onChangeCallback()}get w(){return this._w}set w(r){this._w=r,this._onChangeCallback()}set(r,t,e,s){return this._x=r,this._y=t,this._z=e,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(r){return this._x=r.x,this._y=r.y,this._z=r.z,this._w=r.w,this._onChangeCallback(),this}setFromEuler(r,t=!0){let e=r._x,s=r._y,i=r._z,n=r._order,a=Math.cos,o=Math.sin,l=a(e/2),h=a(s/2),u=a(i/2),c=o(e/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(r,t){let e=t/2,s=Math.sin(e);return this._x=r.x*s,this._y=r.y*s,this._z=r.z*s,this._w=Math.cos(e),this._onChangeCallback(),this}setFromRotationMatrix(r){let t=r.elements,e=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=e+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(e>a&&e>u){let d=2*Math.sqrt(1+e-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-e-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-e-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(r,t){let e=r.dot(t)+1;return e<2**-52?(e=0,Math.abs(r.x)>Math.abs(r.z)?(this._x=-r.y,this._y=r.x,this._z=0,this._w=e):(this._x=0,this._y=-r.z,this._z=r.y,this._w=e)):(this._x=r.y*t.z-r.z*t.y,this._y=r.z*t.x-r.x*t.z,this._z=r.x*t.y-r.y*t.x,this._w=e),this.normalize()}angleTo(r){return 2*Math.acos(Math.abs(kt(this.dot(r),-1,1)))}rotateTowards(r,t){let e=this.angleTo(r);if(e===0)return this;let s=Math.min(1,t/e);return this.slerp(r,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(r){return this._x*r._x+this._y*r._y+this._z*r._z+this._w*r._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 r=this.length();return r===0?(this._x=0,this._y=0,this._z=0,this._w=1):(r=1/r,this._x*=r,this._y*=r,this._z*=r,this._w*=r),this._onChangeCallback(),this}multiply(r){return this.multiplyQuaternions(this,r)}premultiply(r){return this.multiplyQuaternions(r,this)}multiplyQuaternions(r,t){let e=r._x,s=r._y,i=r._z,n=r._w,a=t._x,o=t._y,l=t._z,h=t._w;return this._x=e*h+n*a+s*l-i*o,this._y=s*h+n*o+i*a-e*l,this._z=i*h+n*l+e*o-s*a,this._w=n*h-e*a-s*o-i*l,this._onChangeCallback(),this}slerp(r,t){if(t===0)return this;if(t===1)return this.copy(r);let e=this._x,s=this._y,i=this._z,n=this._w,a=n*r._w+e*r._x+s*r._y+i*r._z;if(a<0?(this._w=-r._w,this._x=-r._x,this._y=-r._y,this._z=-r._z,a=-a):this.copy(r),a>=1)return this._w=n,this._x=e,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*e+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=e*u+this._x*c,this._y=s*u+this._y*c,this._z=i*u+this._z*c,this._onChangeCallback(),this}slerpQuaternions(r,t,e){return this.copy(r).slerp(t,e)}random(){let r=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),e=Math.random(),s=Math.sqrt(1-e),i=Math.sqrt(e);return this.set(s*Math.sin(r),s*Math.cos(r),i*Math.sin(t),i*Math.cos(t))}equals(r){return r._x===this._x&&r._y===this._y&&r._z===this._z&&r._w===this._w}fromArray(r,t=0){return this._x=r[t],this._y=r[t+1],this._z=r[t+2],this._w=r[t+3],this._onChangeCallback(),this}toArray(r=[],t=0){return r[t]=this._x,r[t+1]=this._y,r[t+2]=this._z,r[t+3]=this._w,r}fromBufferAttribute(r,t){return this._x=r.getX(t),this._y=r.getY(t),this._z=r.getZ(t),this._w=r.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(r){return this._onChangeCallback=r,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},ti=class uA{constructor(t=0,e=0,s=0){uA.prototype.isVector3=!0,this.x=t,this.y=e,this.z=s}set(t,e,s){return s===void 0&&(s=this.z),this.x=t,this.y=e,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,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;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,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,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,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.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,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(jv.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(jv.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,s=this.y,i=this.z,n=t.elements;return this.x=n[0]*e+n[3]*s+n[6]*i,this.y=n[1]*e+n[4]*s+n[7]*i,this.z=n[2]*e+n[5]*s+n[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,s=this.y,i=this.z,n=t.elements,a=1/(n[3]*e+n[7]*s+n[11]*i+n[15]);return this.x=(n[0]*e+n[4]*s+n[8]*i+n[12])*a,this.y=(n[1]*e+n[5]*s+n[9]*i+n[13])*a,this.z=(n[2]*e+n[6]*s+n[10]*i+n[14])*a,this}applyQuaternion(t){let e=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*e-n*i),c=2*(n*s-a*e);return this.x=e+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 e=this.x,s=this.y,i=this.z,n=t.elements;return this.x=n[0]*e+n[4]*s+n[8]*i,this.y=n[1]*e+n[5]*s+n[9]*i,this.z=n[2]*e+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,e){return this.x=kt(this.x,t.x,e.x),this.y=kt(this.y,t.y,e.y),this.z=kt(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=kt(this.x,t,e),this.y=kt(this.y,t,e),this.z=kt(this.z,t,e),this}clampLength(t,e){let s=this.length();return this.divideScalar(s||1).multiplyScalar(kt(s,t,e))}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,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let s=t.x,i=t.y,n=t.z,a=e.x,o=e.y,l=e.z;return this.x=i*l-n*o,this.y=n*a-s*l,this.z=s*o-i*a,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let s=t.dot(this)/e;return this.copy(t).multiplyScalar(s)}projectOnPlane(t){return Bf.copy(this).projectOnVector(t),this.sub(Bf)}reflect(t){return this.sub(Bf.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let s=this.dot(t)/e;return Math.acos(kt(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,s=this.y-t.y,i=this.z-t.z;return e*e+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,e,s){let i=Math.sin(e)*t;return this.x=i*Math.sin(s),this.y=Math.cos(e)*t,this.z=i*Math.cos(s),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,s){return this.x=t*Math.sin(e),this.y=s,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),s=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=s,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*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,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,s=Math.sqrt(1-e*e);return this.x=s*Math.cos(t),this.y=e,this.z=s*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};const Bf=new ti,jv=new jtt;var hA=class Ig{constructor(t,e,s,i,n,a,o,l,h,u,c,d,p,m,f,x){Ig.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,e,s,i,n,a,o,l,h,u,c,d,p,m,f,x)}set(t,e,s,i,n,a,o,l,h,u,c,d,p,m,f,x){let b=this.elements;return b[0]=t,b[4]=e,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 Ig().fromArray(this.elements)}copy(t){let e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],e[9]=s[9],e[10]=s[10],e[11]=s[11],e[12]=s[12],e[13]=s[13],e[14]=s[14],e[15]=s[15],this}copyPosition(t){let e=this.elements,s=t.elements;return e[12]=s[12],e[13]=s[13],e[14]=s[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,s){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this}makeBasis(t,e,s){return this.set(t.x,e.x,s.x,0,t.y,e.y,s.y,0,t.z,e.z,s.z,0,0,0,0,1),this}extractRotation(t){let e=this.elements,s=t.elements,i=1/Wo.setFromMatrixColumn(t,0).length(),n=1/Wo.setFromMatrixColumn(t,1).length(),a=1/Wo.setFromMatrixColumn(t,2).length();return e[0]=s[0]*i,e[1]=s[1]*i,e[2]=s[2]*i,e[3]=0,e[4]=s[4]*n,e[5]=s[5]*n,e[6]=s[6]*n,e[7]=0,e[8]=s[8]*a,e[9]=s[9]*a,e[10]=s[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=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;e[0]=l*u,e[4]=-l*c,e[8]=h,e[1]=p+m*h,e[5]=d-f*h,e[9]=-o*l,e[2]=f-d*h,e[6]=m+p*h,e[10]=a*l}else if(t.order==="YXZ"){let d=l*u,p=l*c,m=h*u,f=h*c;e[0]=d+f*o,e[4]=m*o-p,e[8]=a*h,e[1]=a*c,e[5]=a*u,e[9]=-o,e[2]=p*o-m,e[6]=f+d*o,e[10]=a*l}else if(t.order==="ZXY"){let d=l*u,p=l*c,m=h*u,f=h*c;e[0]=d-f*o,e[4]=-a*c,e[8]=m+p*o,e[1]=p+m*o,e[5]=a*u,e[9]=f-d*o,e[2]=-a*h,e[6]=o,e[10]=a*l}else if(t.order==="ZYX"){let d=a*u,p=a*c,m=o*u,f=o*c;e[0]=l*u,e[4]=m*h-p,e[8]=d*h+f,e[1]=l*c,e[5]=f*h+d,e[9]=p*h-m,e[2]=-h,e[6]=o*l,e[10]=a*l}else if(t.order==="YZX"){let d=a*l,p=a*h,m=o*l,f=o*h;e[0]=l*u,e[4]=f-d*c,e[8]=m*c+p,e[1]=c,e[5]=a*u,e[9]=-o*u,e[2]=-h*u,e[6]=p*c+m,e[10]=d-f*c}else if(t.order==="XZY"){let d=a*l,p=a*h,m=o*l,f=o*h;e[0]=l*u,e[4]=-c,e[8]=h*u,e[1]=d*c+f,e[5]=a*u,e[9]=p*c-m,e[2]=m*c-p,e[6]=o*u,e[10]=f*c+d}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Wtt,t,qtt)}lookAt(t,e,s){let i=this.elements;return Wr.subVectors(t,e),Wr.lengthSq()===0&&(Wr.z=1),Wr.normalize(),Cn.crossVectors(s,Wr),Cn.lengthSq()===0&&(Math.abs(s.z)===1?Wr.x+=1e-4:Wr.z+=1e-4,Wr.normalize(),Cn.crossVectors(s,Wr)),Cn.normalize(),ud.crossVectors(Wr,Cn),i[0]=Cn.x,i[4]=ud.x,i[8]=Wr.x,i[1]=Cn.y,i[5]=ud.y,i[9]=Wr.y,i[2]=Cn.z,i[6]=ud.z,i[10]=Wr.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let s=t.elements,i=e.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],w=s[3],S=s[7],_=s[11],V=s[15],z=i[0],A=i[4],I=i[8],et=i[12],nt=i[1],it=i[5],vt=i[9],mt=i[13],Rt=i[2],Vt=i[6],Yt=i[10],se=i[14],te=i[3],ft=i[7],bt=i[11],Et=i[15];return n[0]=a*z+o*nt+l*Rt+h*te,n[4]=a*A+o*it+l*Vt+h*ft,n[8]=a*I+o*vt+l*Yt+h*bt,n[12]=a*et+o*mt+l*se+h*Et,n[1]=u*z+c*nt+d*Rt+p*te,n[5]=u*A+c*it+d*Vt+p*ft,n[9]=u*I+c*vt+d*Yt+p*bt,n[13]=u*et+c*mt+d*se+p*Et,n[2]=m*z+f*nt+x*Rt+b*te,n[6]=m*A+f*it+x*Vt+b*ft,n[10]=m*I+f*vt+x*Yt+b*bt,n[14]=m*et+f*mt+x*se+b*Et,n[3]=w*z+S*nt+_*Rt+V*te,n[7]=w*A+S*it+_*Vt+V*ft,n[11]=w*I+S*vt+_*Yt+V*bt,n[15]=w*et+S*mt+_*se+V*Et,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=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*(+e*l*p-e*h*d+n*a*d-i*a*p+i*h*u-n*l*u)+x*(+e*h*c-e*o*p-n*a*c+s*a*p+n*o*u-s*h*u)+b*(-i*o*u-e*l*c+e*o*d+i*a*c-s*a*d+s*l*u)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,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]=e,i[14]=s),this}invert(){let t=this.elements,e=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],w=c*x*h-f*d*h+f*l*p-o*x*p-c*l*b+o*d*b,S=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,V=m*c*l-u*f*l-m*o*d+a*f*d+u*o*x-a*c*x,z=e*w+s*S+i*_+n*V;if(z===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let A=1/z;return t[0]=w*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]=S*A,t[5]=(u*x*n-m*d*n+m*i*p-e*x*p-u*i*b+e*d*b)*A,t[6]=(m*l*n-a*x*n-m*i*h+e*x*h+a*i*b-e*l*b)*A,t[7]=(a*d*n-u*l*n+u*i*h-e*d*h-a*i*p+e*l*p)*A,t[8]=_*A,t[9]=(m*c*n-u*f*n-m*s*p+e*f*p+u*s*b-e*c*b)*A,t[10]=(a*f*n-m*o*n+m*s*h-e*f*h-a*s*b+e*o*b)*A,t[11]=(u*o*n-a*c*n-u*s*h+e*c*h+a*s*p-e*o*p)*A,t[12]=V*A,t[13]=(u*f*i-m*c*i+m*s*d-e*f*d-u*s*x+e*c*x)*A,t[14]=(m*o*i-a*f*i-m*s*l+e*f*l+a*s*x-e*o*x)*A,t[15]=(a*c*i-u*o*i+u*s*l-e*c*l-a*s*d+e*o*d)*A,this}scale(t){let e=this.elements,s=t.x,i=t.y,n=t.z;return e[0]*=s,e[4]*=i,e[8]*=n,e[1]*=s,e[5]*=i,e[9]*=n,e[2]*=s,e[6]*=i,e[10]*=n,e[3]*=s,e[7]*=i,e[11]*=n,this}getMaxScaleOnAxis(){let t=this.elements,e=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(e,s,i))}makeTranslation(t,e,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,e,0,0,1,s,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),s=Math.sin(t);return this.set(1,0,0,0,0,e,-s,0,0,s,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),s=Math.sin(t);return this.set(e,0,s,0,0,1,0,0,-s,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,0,s,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let s=Math.cos(e),i=Math.sin(e),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,e,s){return this.set(t,0,0,0,0,e,0,0,0,0,s,0,0,0,0,1),this}makeShear(t,e,s,i,n,a){return this.set(1,s,n,0,t,1,a,0,e,i,1,0,0,0,0,1),this}compose(t,e,s){let i=this.elements,n=e._x,a=e._y,o=e._z,l=e._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,w=l*h,S=l*u,_=l*c,V=s.x,z=s.y,A=s.z;return i[0]=(1-(f+b))*V,i[1]=(p+_)*V,i[2]=(m-S)*V,i[3]=0,i[4]=(p-_)*z,i[5]=(1-(d+b))*z,i[6]=(x+w)*z,i[7]=0,i[8]=(m+S)*A,i[9]=(x-w)*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,e,s){let i=this.elements,n=Wo.set(i[0],i[1],i[2]).length(),a=Wo.set(i[4],i[5],i[6]).length(),o=Wo.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],Ps.copy(this);let h=1/n,u=1/a,c=1/o;return Ps.elements[0]*=h,Ps.elements[1]*=h,Ps.elements[2]*=h,Ps.elements[4]*=u,Ps.elements[5]*=u,Ps.elements[6]*=u,Ps.elements[8]*=c,Ps.elements[9]*=c,Ps.elements[10]*=c,e.setFromRotationMatrix(Ps),s.x=n,s.y=a,s.z=o,this}makePerspective(t,e,s,i,n,a,o=Ca){let l=this.elements,h=2*n/(e-t),u=2*n/(s-i),c=(e+t)/(e-t),d=(s+i)/(s-i),p,m;if(o===Ca)p=-(a+n)/(a-n),m=-2*a*n/(a-n);else if(o===Lg)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,e,s,i,n,a,o=Ca){let l=this.elements,h=1/(e-t),u=1/(s-i),c=1/(a-n),d=(e+t)*h,p=(s+i)*u,m,f;if(o===Ca)m=(a+n)*c,f=-2*c;else if(o===Lg)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 e=this.elements,s=t.elements;for(let i=0;i<16;i++)if(e[i]!==s[i])return!1;return!0}fromArray(t,e=0){for(let s=0;s<16;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){let s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t[e+9]=s[9],t[e+10]=s[10],t[e+11]=s[11],t[e+12]=s[12],t[e+13]=s[13],t[e+14]=s[14],t[e+15]=s[15],t}};const Wo=new ti,Ps=new hA,Wtt=new ti(0,0,0),qtt=new ti(1,1,1),Cn=new ti,ud=new ti,Wr=new ti;var cA=class dA{constructor(t=0,e=0){dA.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,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,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;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,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,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,e){return this.x=t.x-e.x,this.y=t.y-e.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 e=this.x,s=this.y,i=t.elements;return this.x=i[0]*e+i[3]*s+i[6],this.y=i[1]*e+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,e){return this.x=kt(this.x,t.x,e.x),this.y=kt(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=kt(this.x,t,e),this.y=kt(this.y,t,e),this}clampLength(t,e){let s=this.length();return this.divideScalar(s||1).multiplyScalar(kt(s,t,e))}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 e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let s=this.dot(t)/e;return Math.acos(kt(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,s=this.y-t.y;return e*e+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,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let s=Math.cos(e),i=Math.sin(e),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}},Htt=class pA{constructor(t=0,e=0,s=0,i=1){pA.prototype.isVector4=!0,this.x=t,this.y=e,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,e,s,i){return this.x=t,this.y=e,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,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;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,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,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,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.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 e=this.x,s=this.y,i=this.z,n=this.w,a=t.elements;return this.x=a[0]*e+a[4]*s+a[8]*i+a[12]*n,this.y=a[1]*e+a[5]*s+a[9]*i+a[13]*n,this.z=a[2]*e+a[6]*s+a[10]*i+a[14]*n,this.w=a[3]*e+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 e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,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;e=Math.PI;let S=(h+1)/2,_=(p+1)/2,V=(b+1)/2,z=(u+d)/4,A=(c+f)/4,I=(m+x)/4;return S>_&&S>V?S<a?(s=0,i=.707106781,n=.707106781):(s=Math.sqrt(S),i=z/s,n=A/s):_>V?_<a?(s=.707106781,i=0,n=.707106781):(i=Math.sqrt(_),s=z/i,n=I/i):V<a?(s=.707106781,i=.707106781,n=0):(n=Math.sqrt(V),s=A/n,i=I/n),this.set(s,i,n,e),this}let w=Math.sqrt((x-m)*(x-m)+(c-f)*(c-f)+(d-u)*(d-u));return Math.abs(w)<.001&&(w=1),this.x=(x-m)/w,this.y=(c-f)/w,this.z=(d-u)/w,this.w=Math.acos((h+p+b-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[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,e){return this.x=kt(this.x,t.x,e.x),this.y=kt(this.y,t.y,e.y),this.z=kt(this.z,t.z,e.z),this.w=kt(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=kt(this.x,t,e),this.y=kt(this.y,t,e),this.z=kt(this.z,t,e),this.w=kt(this.w,t,e),this}clampLength(t,e){let s=this.length();return this.divideScalar(s||1).multiplyScalar(kt(s,t,e))}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,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this.w=t.w+(e.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,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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 Pg(r,t=0){let e=3735928559^t,s=1103547991^t;if(r instanceof Array)for(let i=0,n;i<r.length;i++)n=r[i],e=Math.imul(e^n,2654435761),s=Math.imul(s^n,1597334677);else for(let i=0,n;i<r.length;i++)n=r.charCodeAt(i),e=Math.imul(e^n,2654435761),s=Math.imul(s^n,1597334677);return e=Math.imul(e^e>>>16,2246822507),e^=Math.imul(s^s>>>13,3266489909),s=Math.imul(s^s>>>16,2246822507),s^=Math.imul(e^e>>>13,3266489909),4294967296*(2097151&s)+(e>>>0)}const mA=(...r)=>Pg(r);function Gtt(r,t=!1){let e=[];r.isNode===!0&&(e.push(r.id),r=r.getSelf());for(let{property:s,childNode:i}of Fg(r))e.push(Pg(s.slice(0,-4)),i.getCacheKey(t));return Pg(e)}function*Fg(r,t=!1){for(let e in r){if(e.startsWith("_")===!0)continue;let s=r[e];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:e,index:i,childNode:n})}else if(s&&s.isNode===!0)yield{property:e,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:e,index:i,childNode:n})}}}function Og(r){if(r==null)return null;let t=typeof r;return r.isNode===!0?"node":t==="number"?"float":t==="boolean"?"bool":t==="string"?"string":t==="function"?"shader":r.isVector2===!0?"vec2":r.isVector3===!0?"vec3":r.isVector4===!0?"vec4":r.isMatrix2===!0?"mat2":r.isMatrix3===!0?"mat3":r.isMatrix4===!0?"mat4":r.isColor===!0?"color":r instanceof ArrayBuffer?"ArrayBuffer":null}function fA(r,...t){let e=r?r.slice(-4):void 0;return t.length===1&&(e==="vec2"?t=[t[0],t[0]]:e==="vec3"?t=[t[0],t[0],t[0]]:e==="vec4"&&(t=[t[0],t[0],t[0],t[0]])),r==="color"?new K0(...t):e==="vec2"?new cA(...t):e==="vec3"?new ti(...t):e==="vec4"?new Htt(...t):e==="mat2"?new $tt(...t):e==="mat3"?new jh(...t):e==="mat4"?new hA(...t):r==="bool"?t[0]||!1:r==="float"||r==="int"||r==="uint"?t[0]||0:r==="string"?t[0]||"":r==="ArrayBuffer"?Ytt(t[0]):null}function Xtt(r){let t="",e=new Uint8Array(r);for(let s=0;s<e.length;s++)t+=String.fromCharCode(e[s]);return btoa(t)}function Ytt(r){return Uint8Array.from(atob(r),t=>t.charCodeAt(0)).buffer}var Ztt=class{addEventListener(r,t){this._listeners===void 0&&(this._listeners={});let e=this._listeners;e[r]===void 0&&(e[r]=[]),e[r].indexOf(t)===-1&&e[r].push(t)}hasEventListener(r,t){let e=this._listeners;return e===void 0?!1:e[r]!==void 0&&e[r].indexOf(t)!==-1}removeEventListener(r,t){let e=this._listeners;if(e===void 0)return;let s=e[r];if(s!==void 0){let i=s.indexOf(t);i!==-1&&s.splice(i,1)}}dispatchEvent(r){let t=this._listeners;if(t===void 0)return;let e=t[r.type];if(e!==void 0){r.target=this;let s=e.slice(0);for(let i=0,n=s.length;i<n;i++)s[i].call(this,r);r.target=null}}};const Jtt={analyze:"setup",generate:"analyze"};let Qtt=0;var Ktt=class extends Ztt{static get type(){return"Node"}constructor(r=null){super(),this.nodeType=r,this.updateType=Rn.NONE,this.updateBeforeType=Rn.NONE,this.updateAfterType=Rn.NONE,this.uuid=ktt.generateUUID(),this.version=0,this.global=!1,this.parents=!1,this.isNode=!0,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,"id",{value:Qtt++})}set needsUpdate(r){r===!0&&this.version++}get type(){return this.constructor.type}onUpdate(r,t){return this.updateType=t,this.update=r.bind(this.getSelf()),this}onFrameUpdate(r){return this.onUpdate(r,Rn.FRAME)}onRenderUpdate(r){return this.onUpdate(r,Rn.RENDER)}onObjectUpdate(r){return this.onUpdate(r,Rn.OBJECT)}onReference(r){return this.updateReference=r.bind(this.getSelf()),this}getSelf(){return this.self||this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:r}of Fg(this))yield r}dispose(){this.dispatchEvent({type:"dispose"})}traverse(r){r(this);for(let t of this.getChildren())t.traverse(r)}getCacheKey(r=!1){return r||(r=this.version!==this._cacheKeyVersion),(r===!0||this._cacheKey===null)&&(this._cacheKey=mA(Gtt(this,r),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(r){let t=this.getNodeType(r);return r.getElementType(t)}getMemberType(){return"void"}getNodeType(r){let t=r.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(r):this.nodeType}getShared(r){let t=this.getHash(r);return r.getNodeFromHash(t)||this}setup(r){let t=r.getNodeProperties(this),e=0;for(let s of this.getChildren())t["node"+e++]=s;return t.outputNode||null}analyze(r,t=null){let e=r.increaseUsage(this);if(this.parents===!0){let s=r.getDataFromNode(this,"any");s.stages=s.stages||{},s.stages[r.shaderStage]=s.stages[r.shaderStage]||[],s.stages[r.shaderStage].push(t)}if(e===1){let s=r.getNodeProperties(this);for(let i of Object.values(s))i&&i.isNode===!0&&i.build(r,this)}}generate(r,t){let{outputNode:e}=r.getNodeProperties(this);if(e&&e.isNode===!0)return e.build(r,t)}updateBefore(){console.warn("Abstract function.")}updateAfter(){console.warn("Abstract function.")}update(){console.warn("Abstract function.")}build(r,t=null){let e=this.getShared(r);if(this!==e)return e.build(r,t);let s=r.getDataFromNode(this);s.buildStages=s.buildStages||{},s.buildStages[r.buildStage]=!0;let i=Jtt[r.buildStage];if(i&&s.buildStages[i]!==!0){let o=r.getBuildStage();r.setBuildStage(i),this.build(r),r.setBuildStage(o)}r.addNode(this),r.addChain(this);let n=null,a=r.getBuildStage();if(a==="setup"){this.updateReference(r);let o=r.getNodeProperties(this);if(o.initialized!==!0){o.initialized=!0,o.outputNode=this.setup(r)||o.outputNode||null;for(let l of Object.values(o))if(l&&l.isNode===!0){if(l.parents===!0){let h=r.getNodeProperties(l);h.parents=h.parents||[],h.parents.push(this)}l.build(r)}}n=o.outputNode}else if(a==="analyze")this.analyze(r,t);else if(a==="generate")if(this.generate.length===1){let l=this.getNodeType(r),h=r.getDataFromNode(this);n=h.snippet,n===void 0?h.generated===void 0?(h.generated=!0,n=this.generate(r)||"",h.snippet=n):(console.warn("THREE.Node: Recursion detected.",this),n=""):h.flowCodes!==void 0&&r.context.nodeBlock!==void 0&&r.addFlowCodeHierarchy(this,r.context.nodeBlock),n=r.format(n,l,t)}else n=this.generate(r,t)||"";return r.removeChain(this),r.addSequentialNode(this),n}getSerializeChildren(){return Fg(this)}serialize(r){let t=this.getSerializeChildren(),e={};for(let{property:s,index:i,childNode:n}of t)i===void 0?e[s]=n.toJSON(r.meta).uuid:(e[s]===void 0&&(e[s]=Number.isInteger(i)?[]:{}),e[s][i]=n.toJSON(r.meta).uuid);Object.keys(e).length>0&&(r.inputNodes=e)}deserialize(r){if(r.inputNodes!==void 0){let t=r.meta.nodes;for(let e in r.inputNodes)if(Array.isArray(r.inputNodes[e])){let s=[];for(let i of r.inputNodes[e])s.push(t[i]);this[e]=s}else if(typeof r.inputNodes[e]=="object"){let s={};for(let i in r.inputNodes[e]){let n=r.inputNodes[e][i];s[i]=t[n]}this[e]=s}else{let s=r.inputNodes[e];this[e]=t[s]}}}toJSON(r){let{uuid:t,type:e}=this,s=r===void 0||typeof r=="string";s&&(r={textures:{},images:{},nodes:{}});let i=r.nodes[t];i===void 0&&(i={uuid:t,type:e,meta:r,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},s!==!0&&(r.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(r.textures),o=n(r.images),l=n(r.nodes);a.length>0&&(i.textures=a),o.length>0&&(i.images=o),l.length>0&&(i.nodes=l)}return i}},$e=Ktt,tet=class extends $e{static get type(){return"TempNode"}constructor(r=null){super(r),this.isTempNode=!0}hasDependencies(r){return r.getDataFromNode(this).usageCount>1}build(r,t){if(r.getBuildStage()==="generate"){let s=r.getVectorType(this.getNodeType(r,t)),i=r.getDataFromNode(this);if(i.propertyName!==void 0)return r.format(i.propertyName,s,t);if(s!=="void"&&t!=="void"&&this.hasDependencies(r)){let n=super.build(r,s),a=r.getVarFromNode(this,null,s),o=r.getPropertyName(a);return r.addLineFlowCode(`${o} = ${n}`,this),i.snippet=n,i.propertyName=o,r.format(i.propertyName,s,t)}}return super.build(r,t)}},ss=tet,eet=class extends $e{static get type(){return"ArrayElementNode"}constructor(r,t){super(),this.node=r,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(r){return this.node.getElementType(r)}generate(r){let t=this.indexNode.getNodeType(r),e=this.node.build(r),s=this.indexNode.build(r,!r.isVector(t)&&r.isInteger(t)?t:"uint");return`${e}[ ${s} ]`}},tx=eet,ret=class extends $e{static get type(){return"ConvertNode"}constructor(r,t){super(),this.node=r,this.convertTo=t}getNodeType(r){let t=this.node.getNodeType(r),e=null;for(let s of this.convertTo.split("|"))(e===null||r.getTypeLength(t)===r.getTypeLength(s))&&(e=s);return e}serialize(r){super.serialize(r),r.convertTo=this.convertTo}deserialize(r){super.deserialize(r),this.convertTo=r.convertTo}generate(r,t){let e=this.node,s=this.getNodeType(r),i=e.build(r,s);return r.format(i,s,t)}},gA=ret,set=class extends ss{static get type(){return"JoinNode"}constructor(r=[],t=null){super(t),this.nodes=r}getNodeType(r){return this.nodeType===null?r.getTypeFromLength(this.nodes.reduce((t,e)=>t+r.getTypeLength(e.getNodeType(r)),0)):r.getVectorType(this.nodeType)}generate(r,t){let e=this.getNodeType(r),s=r.getTypeLength(e),i=this.nodes,n=r.getComponentType(e),a=[],o=0;for(let h of i){if(o>=s){console.error(`THREE.TSL: Length of parameters exceeds maximum length of function '${e}()' type.`);break}let u=h.getNodeType(r),c=r.getTypeLength(u),d;o+c>s&&(console.error(`THREE.TSL: Length of '${e}()' data exceeds maximum length of output type.`),c=s-o,u=r.getTypeFromLength(c)),o+=c,d=h.build(r,u);let p=r.getComponentType(u);p!==n&&(d=r.format(d,p,n)),a.push(d)}let l=`${r.getType(e)}( ${a.join(", ")} )`;return r.format(l,e,t)}},iet=set;const net=$h.join("");var aet=class extends $e{static get type(){return"SplitNode"}constructor(r,t="x"){super(),this.node=r,this.components=t,this.isSplitNode=!0}getVectorLength(){let r=this.components.length;for(let t of this.components)r=Math.max($h.indexOf(t)+1,r);return r}getComponentType(r){return r.getComponentType(this.node.getNodeType(r))}getNodeType(r){return r.getTypeFromLength(this.components.length,this.getComponentType(r))}generate(r,t){let e=this.node,s=r.getTypeLength(e.getNodeType(r)),i=null;if(s>1){let n=null;this.getVectorLength()>=s&&(n=r.getTypeFromLength(this.getVectorLength(),this.getComponentType(r)));let o=e.build(r,n);i=this.components.length===s&&this.components===net.slice(0,this.components.length)?r.format(o,n,t):r.format(`${o}.${this.components}`,this.getNodeType(r),t)}else i=e.build(r,t);return i}serialize(r){super.serialize(r),r.components=this.components}deserialize(r){super.deserialize(r),this.components=r.components}},Wv=aet,oet=class extends ss{static get type(){return"SetNode"}constructor(r,t,e){super(),this.sourceNode=r,this.components=t,this.targetNode=e}getNodeType(r){return this.sourceNode.getNodeType(r)}generate(r){let{sourceNode:t,components:e,targetNode:s}=this,i=this.getNodeType(r),n=r.getComponentType(s.getNodeType(r)),a=r.getTypeFromLength(e.length,n),o=s.build(r,a),l=t.build(r,i),h=r.getTypeLength(i),u=[];for(let c=0;c<h;c++){let d=$h[c];d===e[0]?(u.push(o),c+=e.length-1):u.push(l+"."+d)}return`${r.getType(i)}( ${u.join(", ")} )`}},uet=oet,het=class extends ss{static get type(){return"FlipNode"}constructor(r,t){super(),this.sourceNode=r,this.components=t}getNodeType(r){return this.sourceNode.getNodeType(r)}generate(r){let{components:t,sourceNode:e}=this,s=this.getNodeType(r),i=e.build(r),n=r.getVarFromNode(this),a=r.getPropertyName(n);r.addLineFlowCode(a+" = "+i,this);let o=r.getTypeLength(s),l=[],h=0;for(let u=0;u<o;u++){let c=$h[u];c===t[h]?(l.push("1.0 - "+(a+"."+c)),h++):l.push(a+"."+c)}return`${r.getType(s)}( ${l.join(", ")} )`}},cet=het,det=class extends $e{static get type(){return"InputNode"}constructor(r,t=null){super(t),this.isInputNode=!0,this.value=r,this.precision=null}getNodeType(){return this.nodeType===null?Og(this.value):this.nodeType}getInputType(r){return this.getNodeType(r)}setPrecision(r){return this.precision=r,this}serialize(r){super.serialize(r),r.value=this.value,this.value&&this.value.toArray&&(r.value=this.value.toArray()),r.valueType=Og(this.value),r.nodeType=this.nodeType,r.valueType==="ArrayBuffer"&&(r.value=Xtt(r.value)),r.precision=this.precision}deserialize(r){super.deserialize(r),this.nodeType=r.nodeType,this.value=Array.isArray(r.value)?fA(r.valueType,...r.value):r.value,this.precision=r.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(r.value))}generate(){console.warn("Abstract function.")}},ex=det;const qv=/float|u?int/;var pet=class extends ex{static get type(){return"ConstNode"}constructor(r,t=null){super(r,t),this.isConstNode=!0}generateConst(r){return r.generateConst(this.getNodeType(r),this.value)}generate(r,t){let e=this.getNodeType(r);return qv.test(e)&&qv.test(t)?r.generateConst(t,this.value):r.format(this.generateConst(r),e,t)}},mn=pet,met=class extends $e{static get type(){return"MemberNode"}constructor(r,t){super(),this.node=r,this.property=t,this.isMemberNode=!0}getNodeType(r){return this.node.getMemberType(r,this.property)}generate(r){return this.node.build(r)+"."+this.property}},fet=met;let get=null;const rl=new Map;function j(r,t){if(rl.has(r)){console.warn(`THREE.TSL: Redefinition of method chaining '${r}'.`);return}if(typeof t!="function")throw Error(`THREE.TSL: Node element ${r} is not a function`);rl.set(r,t)}const yA=r=>r.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),Hv=r=>yA(r).split("").sort().join(""),xA={setup(r,t){let e=t.shift();return r(Zp(e),...t)},get(r,t,e){if(typeof t=="string"&&r[t]===void 0){if(r.isStackNode!==!0&&t==="assign")return(...s)=>(get.assign(e,...s),e);if(rl.has(t)){let s=rl.get(t);return r.isStackNode?(...i)=>e.add(s(...i)):(...i)=>s(e,...i)}else{if(t==="self")return r;if(t.endsWith("Assign")&&rl.has(t.slice(0,t.length-6))){let s=rl.get(t.slice(0,t.length-6));return r.isStackNode?(...i)=>e.assign(i[0],s(...i)):(...i)=>e.assign(s(e,...i))}else{if(/^[xyzwrgbastpq]{1,4}$/.test(t)===!0)return t=yA(t),ht(new Wv(e,t));if(/^set[XYZWRGBASTPQ]{1,4}$/.test(t)===!0)return t=Hv(t.slice(3).toLowerCase()),s=>ht(new uet(r,t,ht(s)));if(/^flip[XYZWRGBASTPQ]{1,4}$/.test(t)===!0)return t=Hv(t.slice(4).toLowerCase()),()=>ht(new cet(ht(r),t));if(t==="width"||t==="height"||t==="depth")return t==="width"?t="x":t==="height"?t="y":t==="depth"&&(t="z"),ht(new Wv(r,t));if(/^\d+$/.test(t)===!0)return ht(new tx(e,new mn(Number(t),"uint")));if(/^get$/.test(t)===!0)return s=>ht(new fet(e,s))}}}return Reflect.get(r,t,e)},set(r,t,e,s){return typeof t=="string"&&r[t]===void 0&&(/^[xyzwrgbastpq]{1,4}$/.test(t)===!0||t==="width"||t==="height"||t==="depth"||/^\d+$/.test(t)===!0)?(s[t].assign(e),!0):Reflect.set(r,t,e,s)}},kf=new WeakMap,Gv=new WeakMap,yet=function(r,t=null){let e=Og(r);if(e==="node"){let s=kf.get(r);return s===void 0&&(s=new Proxy(r,xA),kf.set(r,s),kf.set(s,s)),s}else{if(t===null&&(e==="float"||e==="boolean")||e&&e!=="shader"&&e!=="string")return ht(Bg(r,t));if(e==="shader")return As(r)}return r},xet=function(r,t=null){for(let e in r)r[e]=ht(r[e],t);return r},bet=function(r,t=null){let e=r.length;for(let s=0;s<e;s++)r[s]=ht(r[s],t);return r},vet=function(r,t=null,e=null,s=null){let i=u=>ht(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:r.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 r(...Nd(h(u)))):e===null?n=(...u)=>i(new r(t,...Nd(h(u)))):(e=ht(e),n=(...u)=>i(new r(t,...Nd(h(u)),e))),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 wet=class extends $e{constructor(r,t){super(),this.shaderNode=r,this.inputNodes=t,this.isShaderCallNodeInternal=!0}getNodeType(r){return this.shaderNode.nodeType||this.getOutputNode(r).getNodeType(r)}getMemberType(r,t){return this.getOutputNode(r).getMemberType(r,t)}call(r){let{shaderNode:t,inputNodes:e}=this,s=r.getNodeProperties(t),i=t.namespace&&t.namespace===r.namespace?r.getNamespace("once"):"once";if(s[i])return s[i];let n=null;if(t.layout){let a=Gv.get(r.constructor);a===void 0&&(a=new WeakMap,Gv.set(r.constructor,a));let o=a.get(t);o===void 0&&(o=ht(r.buildFunctionNode(t)),a.set(t,o)),r.addInclude(o),n=ht(o.call(e))}else{let a=t.jsFunc,o=e!==null||a.length>1?a(e||[],r):a(r);n=ht(o)}return t.once&&(s[i]=n),n}setupOutput(r){return r.addStack(),r.stack.outputNode=this.call(r),r.removeStack()}getOutputNode(r){let t=r.getNodeProperties(this),e=r.getOutputNamespace();return t[e]=t[e]||this.setupOutput(r),t[e]}build(r,t=null){let e=null,s=r.getBuildStage(),i=r.getNodeProperties(this),n=r.getOutputNamespace(),a=this.getOutputNode(r);if(s==="setup"){let o=r.getNamespace("initialized");i[o]!==!0&&(i[o]=!0,i[n]=this.getOutputNode(r),i[n].build(r)),e=i[n]}else s==="analyze"?a.build(r,t):s==="generate"&&(e=a.build(r,t)||"");return e}},Met=class extends $e{constructor(r,t){super(t),this.jsFunc=r,this.layout=null,this.global=!0,this.once=!1,this.namespace=null}setLayout(r){return this.layout=r,this}call(r=null){return Zp(r),ht(new wet(this,r))}setup(){return this.call()}};const Tet=[!1,!0],Net=[0,1,2,3],_et=[-1,-2],bA=[.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],rx=new Map;for(let r of Tet)rx.set(r,new mn(r));const sx=new Map;for(let r of Net)sx.set(r,new mn(r,"uint"));const ix=new Map([...sx].map(r=>new mn(r.value,"int")));for(let r of _et)ix.set(r,new mn(r,"int"));const Xp=new Map([...ix].map(r=>new mn(r.value)));for(let r of bA)Xp.set(r,new mn(r));for(let r of bA)Xp.set(-r,new mn(-r));const Yp={bool:rx,uint:sx,ints:ix,float:Xp},Xv=new Map([...rx,...Xp]),Bg=(r,t)=>Xv.has(r)?Xv.get(r):r.isNode===!0?r:new mn(r,t),Aet=r=>{try{return r.getNodeType()}catch{return}},je=function(r,t=null){return(...e)=>{if((e.length===0||!["bool","float","int","uint"].includes(r)&&e.every(i=>typeof i!="object"))&&(e=[fA(r,...e)]),e.length===1&&t!==null&&t.has(e[0]))return ht(t.get(e[0]));if(e.length===1){let i=Bg(e[0],r);return Aet(i)===r?ht(i):ht(new gA(i,r))}let s=e.map(i=>Bg(i));return ht(new iet(s,r))}},zet=r=>r==null?null:r.nodeType||r.convertTo||(typeof r=="string"?r:null);function Cet(r,t){return new Proxy(new Met(r,t),xA)}const ht=(r,t=null)=>yet(r,t),Zp=(r,t=null)=>new xet(r,t),Nd=(r,t=null)=>new bet(r,t),tt=(...r)=>new vet(...r);let Eet=0;const As=(r,t=null)=>{let e=null;t!==null&&(typeof t=="object"?e=t.return:(typeof t=="string"?e=t:console.error("THREE.TSL: Invalid layout type."),t=null));let s=new Cet(r,e),i=(...n)=>{let a;Zp(n),a=n[0]&&(n[0].isNode||Object.getPrototypeOf(n[0])!==Object.prototype)?[...n]:n[0];let l=s.call(a);return e==="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"+Eet++,type:e,inputs:[]};for(let a in t)a!=="return"&&n.inputs.push({name:a,type:t[a]});t=n}i.setLayout(t)}return i};function Vet(r){return r}j("toStack",Vet);const Ret=new je("color"),Mi=new je("float",Yp.float),sh=new je("int",Yp.ints),Let=new je("uint",Yp.uint),Iet=new je("bool",Yp.bool),vA=new je("vec2"),Pet=new je("ivec2"),Fet=new je("uvec2"),Oet=new je("bvec2"),Fl=new je("vec3"),Bet=new je("ivec3"),ket=new je("uvec3"),Det=new je("bvec3"),ka=new je("vec4"),Uet=new je("ivec4"),$et=new je("uvec4"),jet=new je("bvec4"),Wet=new je("mat2"),wA=new je("mat3"),qet=new je("mat4");j("toColor",Ret),j("toFloat",Mi),j("toInt",sh),j("toUint",Let),j("toBool",Iet),j("toVec2",vA),j("toIVec2",Pet),j("toUVec2",Fet),j("toBVec2",Oet),j("toVec3",Fl),j("toIVec3",Bet),j("toUVec3",ket),j("toBVec3",Det),j("toVec4",ka),j("toIVec4",Uet),j("toUVec4",$et),j("toBVec4",jet),j("toMat2",Wet),j("toMat3",wA),j("toMat4",qet);const Het=tt(tx).setParameterLength(2),Get=(r,t)=>ht(new gA(ht(r),t));j("element",Het),j("convert",Get),j("append",r=>(console.warn("THREE.TSL: .append() has been renamed to .toStack()."),r));const Xet={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"};var Le=class kg extends ss{static get type(){return"OperatorNode"}constructor(t,e,s,...i){if(super(),i.length>0){let n=new kg(t,e,s);for(let a=0;a<i.length-1;a++)n=new kg(t,n,i[a]);e=n,s=i[i.length-1]}this.op=t,this.aNode=e,this.bNode=s,this.isOperatorNode=!0}getOperatorMethod(t,e){return t.getMethod(Xet[this.op],e)}getNodeType(t){let e=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(e==="%")return n;if(e==="~"||e==="&"||e==="|"||e==="^"||e===">>"||e==="<<")return t.getIntegerType(n);if(e==="!"||e==="&&"||e==="||"||e==="^^")return"bool";if(e==="=="||e==="!="||e==="<"||e===">"||e==="<="||e===">="){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,e){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(e!=="void"){let d=t.renderer.coordinateSystem===Ca;if(s==="=="||s==="!="||s==="<"||s===">"||s==="<="||s===">=")return d&&t.isVector(o)?t.format(`${this.getOperatorMethod(t,e)}( ${h}, ${u} )`,a,e):t.format(`( ${h} ${s} ${u} )`,a,e);if(s==="%")return t.isInteger(l)?t.format(`( ${h} % ${u} )`,a,e):t.format(`${this.getOperatorMethod(t,a)}( ${h}, ${u} )`,a,e);if(s==="!"||s==="~")return t.format(`(${s}${h})`,o,e);if(c)return t.format(`${c}( ${h}, ${u} )`,a,e);if(t.isMatrix(o)&&l==="float")return t.format(`( ${u} ${s} ${h} )`,a,e);if(o==="float"&&t.isMatrix(l))return t.format(`${h} ${s} ${u}`,a,e);{let p=`( ${h} ${s} ${u} )`;return!d&&a==="bool"&&t.isVector(o)&&t.isVector(l)&&(p=`all${p}`),t.format(p,a,e)}}else if(o!=="void")return c?t.format(`${c}( ${h}, ${u} )`,a,e):t.isMatrix(o)&&l==="float"?t.format(`${u} ${s} ${h}`,a,e):t.format(`${h} ${s} ${u}`,a,e)}serialize(t){super.serialize(t),t.op=this.op}deserialize(t){super.deserialize(t),this.op=t.op}};const MA=tt(Le,"+").setParameterLength(2,1/0).setName("add"),Dg=tt(Le,"-").setParameterLength(2,1/0).setName("sub"),nx=tt(Le,"*").setParameterLength(2,1/0).setName("mul"),TA=tt(Le,"/").setParameterLength(2,1/0).setName("div"),Jp=tt(Le,"%").setParameterLength(2).setName("mod"),NA=tt(Le,"==").setParameterLength(2).setName("equal"),Yet=tt(Le,"!=").setParameterLength(2).setName("notEqual"),Zet=tt(Le,"<").setParameterLength(2).setName("lessThan"),Jet=tt(Le,">").setParameterLength(2).setName("greaterThan"),Qet=tt(Le,"<=").setParameterLength(2).setName("lessThanEqual"),Ket=tt(Le,">=").setParameterLength(2).setName("greaterThanEqual"),trt=tt(Le,"&&").setParameterLength(2,1/0).setName("and"),ert=tt(Le,"||").setParameterLength(2,1/0).setName("or"),rrt=tt(Le,"!").setParameterLength(1).setName("not"),srt=tt(Le,"^^").setParameterLength(2).setName("xor"),irt=tt(Le,"&").setParameterLength(2).setName("bitAnd"),nrt=tt(Le,"~").setParameterLength(2).setName("bitNot"),art=tt(Le,"|").setParameterLength(2).setName("bitOr"),ort=tt(Le,"^").setParameterLength(2).setName("bitXor"),lrt=tt(Le,"<<").setParameterLength(2).setName("shiftLeft"),urt=tt(Le,">>").setParameterLength(2).setName("shiftRight"),hrt=As(([r])=>(r.addAssign(1),r)),crt=As(([r])=>(r.subAssign(1),r)),drt=As(([r])=>{let t=sh(r).toConst();return r.addAssign(1),t}),prt=As(([r])=>{let t=sh(r).toConst();return r.subAssign(1),t});j("add",MA),j("sub",Dg),j("mul",nx),j("div",TA),j("mod",Jp),j("equal",NA),j("notEqual",Yet),j("lessThan",Zet),j("greaterThan",Jet),j("lessThanEqual",Qet),j("greaterThanEqual",Ket),j("and",trt),j("or",ert),j("not",rrt),j("xor",srt),j("bitAnd",irt),j("bitNot",nrt),j("bitOr",art),j("bitXor",ort),j("shiftLeft",lrt),j("shiftRight",urt),j("incrementBefore",hrt),j("decrementBefore",crt),j("increment",drt),j("decrement",prt);const mrt=(r,t)=>(console.warn('THREE.TSL: "remainder()" is deprecated. Use "mod( int( ... ) )" instead.'),Jp(r,t)),frt=(r,t)=>(console.warn('THREE.TSL: "modInt()" is deprecated. Use "mod( int( ... ) )" instead.'),Jp(sh(r),sh(t)));j("remainder",mrt),j("modInt",frt);var O=class re extends ss{static get type(){return"MathNode"}constructor(t,e,s=null,i=null){if(super(),(t===re.MAX||t===re.MIN)&&arguments.length>3){let n=new re(t,e,s);for(let a=2;a<arguments.length-1;a++)n=new re(t,n,arguments[a]);e=n,s=arguments[arguments.length-1],i=null}this.method=t,this.aNode=e,this.bNode=s,this.cNode=i,this.isMathNode=!0}getInputType(t){let e=this.aNode.getNodeType(t),s=this.bNode?this.bNode.getNodeType(t):null,i=this.cNode?this.cNode.getNodeType(t):null,n=t.isMatrix(e)?0:t.getTypeLength(e),a=t.isMatrix(s)?0:t.getTypeLength(s),o=t.isMatrix(i)?0:t.getTypeLength(i);return n>a&&n>o?e:a>o?s:o>n?i:e}getNodeType(t){let e=this.method;return e===re.LENGTH||e===re.DISTANCE||e===re.DOT?"float":e===re.CROSS?"vec3":e===re.ALL||e===re.ANY?"bool":e===re.EQUALS?t.changeComponentType(this.aNode.getNodeType(t),"bool"):this.getInputType(t)}setup(t){let{aNode:e,bNode:s,method:i}=this,n=null;if(i===re.ONE_MINUS)n=Dg(1,e);else if(i===re.RECIPROCAL)n=TA(1,e);else if(i===re.DIFFERENCE)n=ax(Dg(e,s));else if(i===re.TRANSFORM_DIRECTION){let a=e,o=s;t.isMatrix(a.getNodeType(t))?o=ka(Fl(o),0):a=ka(Fl(a),0);let l=nx(a,o).xyz;n=SA(l)}return n===null?super.setup(t):n}generate(t,e){if(t.getNodeProperties(this).outputNode)return super.generate(t,e);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===re.NEGATE)return t.format("( - "+o.build(t,a)+" )",n,e);{let c=[];return i===re.CROSS?c.push(o.build(t,n),l.build(t,n)):u===Ca&&i===re.STEP?c.push(o.build(t,t.getTypeLength(o.getNodeType(t))===1?"float":a),l.build(t,a)):u===Ca&&(i===re.MIN||i===re.MAX)?c.push(o.build(t,a),l.build(t,t.getTypeLength(l.getNodeType(t))===1?"float":a)):i===re.REFRACT?c.push(o.build(t,a),l.build(t,a),h.build(t,"float")):i===re.MIX?c.push(o.build(t,a),l.build(t,a),h.build(t,t.getTypeLength(h.getNodeType(t))===1?"float":a)):(u===Lg&&i===re.ATAN&&l!==null&&(i="atan2"),t.shaderStage!=="fragment"&&(i===re.DFDX||i===re.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,e)}}serialize(t){super.serialize(t),t.method=this.method}deserialize(t){super.deserialize(t),this.method=t.method}};O.ALL="all",O.ANY="any",O.RADIANS="radians",O.DEGREES="degrees",O.EXP="exp",O.EXP2="exp2",O.LOG="log",O.LOG2="log2",O.SQRT="sqrt",O.INVERSE_SQRT="inversesqrt",O.FLOOR="floor",O.CEIL="ceil",O.NORMALIZE="normalize",O.FRACT="fract",O.SIN="sin",O.COS="cos",O.TAN="tan",O.ASIN="asin",O.ACOS="acos",O.ATAN="atan",O.ABS="abs",O.SIGN="sign",O.LENGTH="length",O.NEGATE="negate",O.ONE_MINUS="oneMinus",O.DFDX="dFdx",O.DFDY="dFdy",O.ROUND="round",O.RECIPROCAL="reciprocal",O.TRUNC="trunc",O.FWIDTH="fwidth",O.TRANSPOSE="transpose",O.BITCAST="bitcast",O.EQUALS="equals",O.MIN="min",O.MAX="max",O.STEP="step",O.REFLECT="reflect",O.DISTANCE="distance",O.DIFFERENCE="difference",O.DOT="dot",O.CROSS="cross",O.POW="pow",O.TRANSFORM_DIRECTION="transformDirection",O.MIX="mix",O.CLAMP="clamp",O.REFRACT="refract",O.SMOOTHSTEP="smoothstep",O.FACEFORWARD="faceforward";const grt=Mi(Math.PI);Mi(Math.PI*2);const yrt=tt(O,O.ALL).setParameterLength(1),xrt=tt(O,O.ANY).setParameterLength(1),brt=tt(O,O.RADIANS).setParameterLength(1),vrt=tt(O,O.DEGREES).setParameterLength(1),wrt=tt(O,O.EXP).setParameterLength(1),Mrt=tt(O,O.EXP2).setParameterLength(1),Trt=tt(O,O.LOG).setParameterLength(1),Nrt=tt(O,O.LOG2).setParameterLength(1),Srt=tt(O,O.SQRT).setParameterLength(1),_rt=tt(O,O.INVERSE_SQRT).setParameterLength(1),Art=tt(O,O.FLOOR).setParameterLength(1),zrt=tt(O,O.CEIL).setParameterLength(1),SA=tt(O,O.NORMALIZE).setParameterLength(1),_A=tt(O,O.FRACT).setParameterLength(1),AA=tt(O,O.SIN).setParameterLength(1),Crt=tt(O,O.COS).setParameterLength(1),Ert=tt(O,O.TAN).setParameterLength(1),Vrt=tt(O,O.ASIN).setParameterLength(1),Rrt=tt(O,O.ACOS).setParameterLength(1),zA=tt(O,O.ATAN).setParameterLength(1,2),ax=tt(O,O.ABS).setParameterLength(1),CA=tt(O,O.SIGN).setParameterLength(1),Lrt=tt(O,O.LENGTH).setParameterLength(1),Irt=tt(O,O.NEGATE).setParameterLength(1),Prt=tt(O,O.ONE_MINUS).setParameterLength(1),Frt=tt(O,O.DFDX).setParameterLength(1),Ort=tt(O,O.DFDY).setParameterLength(1),Brt=tt(O,O.ROUND).setParameterLength(1),krt=tt(O,O.RECIPROCAL).setParameterLength(1),Drt=tt(O,O.TRUNC).setParameterLength(1),Urt=tt(O,O.FWIDTH).setParameterLength(1),$rt=tt(O,O.TRANSPOSE).setParameterLength(1),jrt=(r,t)=>(console.warn('THREE.TSL: "equals" is deprecated. Use "equal" inside a vector instead, like: "bvec*( equal( ... ) )"'),NA(r,t)),Wrt=tt(O,O.MIN).setParameterLength(2,1/0),qrt=tt(O,O.MAX).setParameterLength(2,1/0),Hrt=tt(O,O.STEP).setParameterLength(2),Grt=tt(O,O.REFLECT).setParameterLength(2),Xrt=tt(O,O.DISTANCE).setParameterLength(2),Yrt=tt(O,O.DIFFERENCE).setParameterLength(2),Wh=tt(O,O.DOT).setParameterLength(2),Zrt=tt(O,O.CROSS).setParameterLength(2),EA=tt(O,O.POW).setParameterLength(2),Jrt=tt(O,O.POW,2).setParameterLength(1),Qrt=tt(O,O.POW,3).setParameterLength(1),Krt=tt(O,O.POW,4).setParameterLength(1),tst=tt(O,O.TRANSFORM_DIRECTION).setParameterLength(2),est=r=>nx(CA(r),EA(ax(r),1/3)),rst=r=>Wh(r,r),Qp=tt(O,O.MIX).setParameterLength(3),VA=(r,t=0,e=1)=>ht(new O(O.CLAMP,ht(r),ht(t),ht(e))),sst=r=>VA(r),ist=tt(O,O.REFRACT).setParameterLength(3),nst=tt(O,O.SMOOTHSTEP).setParameterLength(3),ast=tt(O,O.FACEFORWARD).setParameterLength(3),ost=As(([r])=>{let t=12.9898,e=78.233,s=43758.5453,i=Wh(r.xy,vA(t,e)),n=Jp(i,grt);return _A(AA(n).mul(s))}),lst=(r,t,e)=>Qp(t,e,r),ust=(r,t,e)=>nst(t,e,r),hst=(r,t)=>(console.warn('THREE.TSL: "atan2" is overloaded. Use "atan" instead.'),zA(r,t));j("all",yrt),j("any",xrt),j("equals",jrt),j("radians",brt),j("degrees",vrt),j("exp",wrt),j("exp2",Mrt),j("log",Trt),j("log2",Nrt),j("sqrt",Srt),j("inverseSqrt",_rt),j("floor",Art),j("ceil",zrt),j("normalize",SA),j("fract",_A),j("sin",AA),j("cos",Crt),j("tan",Ert),j("asin",Vrt),j("acos",Rrt),j("atan",zA),j("abs",ax),j("sign",CA),j("length",Lrt),j("lengthSq",rst),j("negate",Irt),j("oneMinus",Prt),j("dFdx",Frt),j("dFdy",Ort),j("round",Brt),j("reciprocal",krt),j("trunc",Drt),j("fwidth",Urt),j("atan2",hst),j("min",Wrt),j("max",qrt),j("step",Hrt),j("reflect",Grt),j("distance",Xrt),j("dot",Wh),j("cross",Zrt),j("pow",EA),j("pow2",Jrt),j("pow3",Qrt),j("pow4",Krt),j("transformDirection",tst),j("mix",lst),j("clamp",VA),j("refract",ist),j("smoothstep",ust),j("faceForward",ast),j("difference",Yrt),j("saturate",sst),j("cbrt",est),j("transpose",$rt),j("rand",ost);var Yv=class extends ss{static get type(){return"ArrayNode"}constructor(r,t,e=null){super(r),this.count=t,this.values=e,this.isArrayNode=!0}getNodeType(r){return this.nodeType===null&&(this.nodeType=this.values[0].getNodeType(r)),this.nodeType}getElementType(r){return this.getNodeType(r)}generate(r){let t=this.getNodeType(r);return r.generateArray(t,this.count,this.values)}};const cst=(...r)=>{let t;if(r.length===1){let e=r[0];t=new Yv(null,e.length,e)}else{let e=r[0],s=r[1];t=new Yv(e,s)}return ht(t)};j("toArray",(r,t)=>cst(Array(t).fill(r)));var RA=class extends $e{static get type(){return"UniformGroupNode"}constructor(r,t=!1,e=1){super("string"),this.name=r,this.shared=t,this.order=e,this.isUniformGroup=!0}serialize(r){super.serialize(r),r.name=this.name,r.version=this.version,r.shared=this.shared}deserialize(r){super.deserialize(r),this.name=r.name,this.version=r.version,this.shared=r.shared}};const dst=r=>new RA(r),pst=(r,t=0)=>new RA(r,!0,t),mst=pst("render"),fst=dst("object");var gst=class extends ex{static get type(){return"UniformNode"}constructor(r,t=null){super(r,t),this.isUniformNode=!0,this.name="",this.groupNode=fst}label(r){return this.name=r,this}setGroup(r){return this.groupNode=r,this}getGroup(){return this.groupNode}getUniformHash(r){return this.getHash(r)}onUpdate(r,t){let e=this.getSelf();return r=r.bind(e),super.onUpdate(s=>{let i=r(s,e);i!==void 0&&(this.value=i)},t)}generate(r,t){let e=this.getNodeType(r),s=this.getUniformHash(r),i=r.getNodeFromHash(s);i===void 0&&(r.setHashNode(this,s),i=this);let n=i.getInputType(r),a=r.getUniformFromNode(i,n,r.shaderStage,this.name||r.context.label),o=r.getPropertyName(a);return r.context.label!==void 0&&delete r.context.label,r.format(o,e,t)}};const yst=(r,t)=>{let e=zet(t||r),s=r;return ht(new gst(s,e))};var xst=class extends $e{static get type(){return"PropertyNode"}constructor(r,t=null,e=!1){super(r),this.name=t,this.varying=e,this.isPropertyNode=!0,this.global=!0}getHash(r){return this.name||super.getHash(r)}generate(r){let t;return this.varying===!0?(t=r.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=r.getVarFromNode(this,this.name),r.getPropertyName(t)}};const bst=(r,t)=>ht(new xst(r,t));var vst=class extends ss{static get type(){return"AssignNode"}constructor(r,t){super(),this.targetNode=r,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}getNodeType(r,t){return t==="void"?"void":this.targetNode.getNodeType(r)}needsSplitAssign(r){let{targetNode:t}=this;if(r.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){let e=r.getTypeLength(t.node.getNodeType(r));return $h.join("").slice(0,e)!==t.components}return!1}setup(r){let{targetNode:t,sourceNode:e}=this,s=r.getNodeProperties(this);s.sourceNode=e,s.targetNode=t.context({assign:!0})}generate(r,t){let{targetNode:e,sourceNode:s}=r.getNodeProperties(this),i=this.needsSplitAssign(r),n=e.getNodeType(r),a=e.build(r),o=s.build(r,n),l=s.getNodeType(r),h=r.getDataFromNode(this),u;if(h.initialized===!0)t!=="void"&&(u=a);else if(i){let c=r.getVarFromNode(this,null,n),d=r.getPropertyName(c);r.addLineFlowCode(`${d} = ${o}`,this);let p=e.node,m=p.node.context({assign:!0}),f=m.build(r);for(let x=0;x<p.components.length;x++){let b=p.components[x];r.addLineFlowCode(`${f}.${b} = ${d}[ ${x} ]`,this)}t!=="void"&&(u=a)}else u=`${a} = ${o}`,(t==="void"||l==="void")&&(r.addLineFlowCode(u,this),t!=="void"&&(u=a));return h.initialized=!0,r.format(u,n,t)}};const wst=tt(vst).setParameterLength(2);j("assign",wst);var Mst=class extends ss{static get type(){return"FunctionCallNode"}constructor(r=null,t={}){super(),this.functionNode=r,this.parameters=t}setParameters(r){return this.parameters=r,this}getParameters(){return this.parameters}getNodeType(r){return this.functionNode.getNodeType(r)}generate(r){let t=[],e=this.functionNode,s=e.getInputs(r),i=this.parameters,n=(o,l)=>{let h=l.type,u=h==="pointer",c;return c=u?"&"+o.build(r):o.build(r,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(Mi(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(Mi(0),o))):t.push(n(l,o))}return`${e.build(r,"property")}( ${t.join(", ")} )`}};const Tst=(r,...t)=>(t=t.length>1||t[0]&&t[0].isNode===!0?Nd(t):Zp(t[0]),ht(new Mst(ht(r),t)));j("call",Tst);var Nst=class extends $e{static get type(){return"ConditionalNode"}constructor(r,t,e=null){super(),this.condNode=r,this.ifNode=t,this.elseNode=e}getNodeType(r){let{ifNode:t,elseNode:e}=r.getNodeProperties(this);if(t===void 0)return this.setup(r),this.getNodeType(r);let s=t.getNodeType(r);if(e!==null){let i=e.getNodeType(r);if(r.getTypeLength(i)>r.getTypeLength(s))return i}return s}setup(r){let t=this.condNode.cache(),e=this.ifNode.cache(),s=this.elseNode?this.elseNode.cache():null,i=r.context.nodeBlock;r.getDataFromNode(e).parentNodeBlock=i,s!==null&&(r.getDataFromNode(s).parentNodeBlock=i);let n=r.getNodeProperties(this);n.condNode=t,n.ifNode=e.context({nodeBlock:e}),n.elseNode=s?s.context({nodeBlock:s}):null}generate(r,t){let e=this.getNodeType(r),s=r.getDataFromNode(this);if(s.nodeProperty!==void 0)return s.nodeProperty;let{condNode:i,ifNode:n,elseNode:a}=r.getNodeProperties(this),o=r.currentFunctionNode,l=t!=="void",h=l?bst(e).build(r):"";s.nodeProperty=h;let u=i.build(r,"bool");r.addFlowCode(`
|
|
151
151
|
${r.tab}if ( ${u} ) {
|
|
152
152
|
|
|
153
153
|
`).addFlowTab();let c=n.build(r,e);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))),r.removeFlowTab().addFlowCode(r.tab+" "+c+`
|
|
@@ -164,5 +164,5 @@ ${r.tab}if ( ${u} ) {
|
|
|
164
164
|
`,n+=r.flow.code.replace(/^\t/gm,"")+`
|
|
165
165
|
`,n+="/* ... */ "+e+` /* ... */
|
|
166
166
|
`,n+="// #"+i+`#
|
|
167
|
-
`,t===null?console.log(n):t(r,n),e}};const dit=(r,t=null)=>ht(new cit(ht(r),t));j("debug",dit);const pit=As(([r])=>OA(r.rgb)),mit=As(([r,t=Mi(1)])=>t.mix(OA(r.rgb),r.rgb)),fit=As(([r,t=Mi(1)])=>{let e=MA(r.r,r.g,r.b).div(3),s=r.r.max(r.g.max(r.b)),i=s.sub(e).mul(t).mul(-3);return Qp(r.rgb,s,i)}),git=As(([r,t=Mi(1)])=>{let e=Fl(.57735,.57735,.57735),s=t.cos();return Fl(r.rgb.mul(s).add(e.cross(r.rgb).mul(t.sin()).add(e.mul(Wh(e,r.rgb).mul(s.oneMinus())))))}),OA=(r,t=Fl(Oe.getLuminanceCoefficients(new ti)))=>Wh(r,t),bl={name:"Grayscale",props:{},fragmentNode:({childNode:r})=>{let{vec4:t}=rs;if(!r)return console.error("You must pass a child component into the Grayscale shader."),t(0);let e=r||t(0,0,0,0);return t(pit(e.rgb).rgb,e.a)}};function yit(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const BA={blendMode:"normal",opacity:1};try{bl&&bl.props&&Object.entries(bl.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(BA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const xit=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Ombre> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${bl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>yit(r,BA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(bl,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,bl.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})},vl={name:"HueShift",props:{shift:{type:Number,default:0,description:"The amount to shift the hue by"}},fragmentNode:({uniforms:r,childNode:t})=>{let{vec4:e}=rs;if(!t)return console.error("You must pass a child component into the Hue Shift shader."),e(0);let s=t||e(0,0,0,0);return e(git(s.rgb,r.shift.uniform).rgb,s.a)}};function bit(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const kA={blendMode:"normal",opacity:1};try{vl&&vl.props&&Object.entries(vl.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(kA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const vit=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Ombre> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${vl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>bit(r,kA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(vl,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,vl.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})},wl={name:"Invert",props:{},fragmentNode:({childNode:r})=>{let{vec4:t,vec3:e}=rs;if(!r)return console.error("You must pass a child component into the Invert shader."),t(0);let s=r||t(0,0,0,0);return t(e(1,1,1).sub(s.rgb),s.a)}};function wit(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const DA={blendMode:"normal",opacity:1};try{wl&&wl.props&&Object.entries(wl.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(DA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const Mit=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Ombre> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${wl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>wit(r,DA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(wl,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,wl.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})},Ml={name:"LinearGradient",props:{startColor:{type:String,default:"#1aff00",transform:Ju,description:"The starting color of the gradient"},endColor:{type:String,default:"#0000ff",transform:Ju,description:"The ending color of the gradient"},angle:{type:Number,default:0,description:"rotation angle in degrees (0-360, where 0 = left-to-right)"},center:{type:Object,default:{x:.5,y:.5},transform:Ky},autoRotate:{type:Boolean,default:!1,description:"Enable automatic rotation of the gradient"},autoRotateSpeed:{type:Number,default:1,description:"Speed of the automatic rotation in degrees per second"}},fragmentNode:({uniforms:r,onBeforeRender:t})=>{let{vec2:e,mix:s,float:i,cos:n,sin:a,dot:o,radians:l,viewportUV:h,abs:u,div:c,uniform:d}=rs,p=d(0);t(({deltaTime:et})=>{if(r.autoRotate.uniform.value){let nt=r.autoRotateSpeed.uniform.value*et*100;p.value=(p.value+nt)%360}});let m=r.angle.uniform.add(p),f=l(m),x=n(f),b=a(f),w=e(x,b),S=e(r.center.uniform[0],r.center.uniform[1]),_=h.sub(S),V=o(_,w),z=i(.5).mul(u(x).add(u(b))),A=c(V,z.max(1e-6)),I=A.mul(.5).add(.5).clamp(i(0),i(1));return s(r.startColor.uniform,r.endColor.uniform,I)}};function Tit(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const UA={blendMode:"normal",opacity:1};try{Ml&&Ml.props&&Object.entries(Ml.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(UA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const Nit=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Ombre> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${Ml.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>Tit(r,UA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(Ml,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Ml.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})};var Sit=class extends ss{static get type(){return"PosterizeNode"}constructor(r,t){super(),this.sourceNode=r,this.stepsNode=t}setup(){let{sourceNode:r,stepsNode:t}=this;return r.mul(t).floor().div(t)}};const _it=tt(Sit).setParameterLength(2),Tl={name:"Posterize",props:{intensity:{type:Number,default:5,description:"The intensity of the posterization effect (lower is more posterized)"}},fragmentNode:({uniforms:r,childNode:t})=>{let{vec4:e,int:s}=rs;if(!t)return console.error("You must pass a child component into the Posterize shader."),e(0);let i=t||e(0,0,0,0);return _it(i,s(r.intensity.uniform))}};function Ait(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const $A={blendMode:"normal",opacity:1};try{Tl&&Tl.props&&Object.entries(Tl.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&($A[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const zit=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Ombre> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${Tl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>Ait(r,$A),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(Tl,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Tl.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})},Nl={name:"Saturation",props:{intensity:{type:Number,default:1,description:"The intensity of the saturation effect (1 being no change)"}},fragmentNode:({uniforms:r,childNode:t})=>{let{vec4:e}=rs;if(!t)return console.error("You must pass a child component into the Saturation shader."),e(0);let s=t||e(0,0,0,0);return e(mit(s.rgb,r.intensity.uniform).rgb,s.a)}};function Cit(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const jA={blendMode:"normal",opacity:1};try{Nl&&Nl.props&&Object.entries(Nl.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(jA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const Eit=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Ombre> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${Nl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>Cit(r,jA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(Nl,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Nl.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})},Sl={name:"SolidColor",props:{color:{type:String,default:"#5b18ca",transform:Ju,description:"The solid color to display"}},fragmentNode:({uniforms:r})=>r.color.uniform};function Vit(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const WA={blendMode:"normal",opacity:1};try{Sl&&Sl.props&&Object.entries(Sl.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(WA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const Rit=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Ombre> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${Sl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>Vit(r,WA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(Sl,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Sl.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})},_l={name:"Twirl",props:{center:{type:Object,default:{x:.5,y:.5},transform:Ky,description:"The center point of the twirl effect"},intensity:{type:Number,default:1,description:"The strength of the twirl effect"}},fragmentNode:({uniforms:r,childNode:t})=>{let{vec2:e,vec4:s,cos:i,sin:n,length:a,uv:o,convertToTexture:l}=rs;if(!t)return console.error("You must pass a child component into the Twirl shader."),s(0);let h=l(t),u=o(),c=e(r.center.uniform.x,r.center.uniform.y),d=u.sub(c),p=r.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)),w=e(x.add(c.x),b.add(c.y));return s(h.sample(w))}};function Lit(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const qA={blendMode:"normal",opacity:1};try{_l&&_l.props&&Object.entries(_l.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(qA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const Iit=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Ombre> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${_l.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>Lit(r,qA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(_l,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,_l.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})},Al={name:"Vibrance",props:{intensity:{type:Number,default:0,description:"The intensity of the vibrance effect"}},fragmentNode:({uniforms:r,childNode:t})=>{let{vec4:e}=rs;if(!t)return console.error("You must pass a child component into the Vibrance shader."),e(0);let s=t||e(0,0,0,0);return e(fit(s.rgb,r.intensity.uniform).rgb,s.a)}};function Pit(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const HA={blendMode:"normal",opacity:1};try{Al&&Al.props&&Object.entries(Al.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(HA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const Fit=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Ombre> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${Al.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>Pit(r,HA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(Al,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Al.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})};exports.Circle=vtt;exports.GlassTiles=Mtt;exports.Grayscale=xit;exports.HueShift=vit;exports.Invert=Mit;exports.LinearGradient=Nit;exports.Ombre=xtt;exports.Posterize=zit;exports.Saturation=Eit;exports.SolidColor=Rit;exports.Twirl=Iit;exports.Vibrance=Fit;
|
|
167
|
+
`,t===null?console.log(n):t(r,n),e}};const dit=(r,t=null)=>ht(new cit(ht(r),t));j("debug",dit);const pit=As(([r])=>OA(r.rgb)),mit=As(([r,t=Mi(1)])=>t.mix(OA(r.rgb),r.rgb)),fit=As(([r,t=Mi(1)])=>{let e=MA(r.r,r.g,r.b).div(3),s=r.r.max(r.g.max(r.b)),i=s.sub(e).mul(t).mul(-3);return Qp(r.rgb,s,i)}),git=As(([r,t=Mi(1)])=>{let e=Fl(.57735,.57735,.57735),s=t.cos();return Fl(r.rgb.mul(s).add(e.cross(r.rgb).mul(t.sin()).add(e.mul(Wh(e,r.rgb).mul(s.oneMinus())))))}),OA=(r,t=Fl(Oe.getLuminanceCoefficients(new ti)))=>Wh(r,t),bl={name:"Grayscale",props:{},fragmentNode:({childNode:r})=>{let{vec4:t}=rs;if(!r)return console.error("You must pass a child component into the Grayscale shader."),t(0);let e=r||t(0,0,0,0);return t(pit(e.rgb).rgb,e.a)}};function yit(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const BA={blendMode:"normal",opacity:1};try{bl&&bl.props&&Object.entries(bl.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(BA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const xit=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${bl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>yit(r,BA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(bl,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,bl.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})},vl={name:"HueShift",props:{shift:{type:Number,default:0,description:"The amount to shift the hue by"}},fragmentNode:({uniforms:r,childNode:t})=>{let{vec4:e}=rs;if(!t)return console.error("You must pass a child component into the Hue Shift shader."),e(0);let s=t||e(0,0,0,0);return e(git(s.rgb,r.shift.uniform).rgb,s.a)}};function bit(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const kA={blendMode:"normal",opacity:1};try{vl&&vl.props&&Object.entries(vl.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(kA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const vit=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${vl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>bit(r,kA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(vl,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,vl.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})},wl={name:"Invert",props:{},fragmentNode:({childNode:r})=>{let{vec4:t,vec3:e}=rs;if(!r)return console.error("You must pass a child component into the Invert shader."),t(0);let s=r||t(0,0,0,0);return t(e(1,1,1).sub(s.rgb),s.a)}};function wit(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const DA={blendMode:"normal",opacity:1};try{wl&&wl.props&&Object.entries(wl.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(DA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const Mit=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${wl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>wit(r,DA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(wl,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,wl.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})},Ml={name:"LinearGradient",props:{startColor:{type:String,default:"#1aff00",transform:Ju,description:"The starting color of the gradient"},endColor:{type:String,default:"#0000ff",transform:Ju,description:"The ending color of the gradient"},angle:{type:Number,default:0,description:"rotation angle in degrees (0-360, where 0 = left-to-right)"},center:{type:Object,default:{x:.5,y:.5},transform:Ky},autoRotate:{type:Boolean,default:!1,description:"Enable automatic rotation of the gradient"},autoRotateSpeed:{type:Number,default:1,description:"Speed of the automatic rotation in degrees per second"}},fragmentNode:({uniforms:r,onBeforeRender:t})=>{let{vec2:e,mix:s,float:i,cos:n,sin:a,dot:o,radians:l,viewportUV:h,abs:u,div:c,uniform:d}=rs,p=d(0);t(({deltaTime:et})=>{if(r.autoRotate.uniform.value){let nt=r.autoRotateSpeed.uniform.value*et*100;p.value=(p.value+nt)%360}});let m=r.angle.uniform.add(p),f=l(m),x=n(f),b=a(f),w=e(x,b),S=e(r.center.uniform[0],r.center.uniform[1]),_=h.sub(S),V=o(_,w),z=i(.5).mul(u(x).add(u(b))),A=c(V,z.max(1e-6)),I=A.mul(.5).add(.5).clamp(i(0),i(1));return s(r.startColor.uniform,r.endColor.uniform,I)}};function Tit(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const UA={blendMode:"normal",opacity:1};try{Ml&&Ml.props&&Object.entries(Ml.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(UA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const Nit=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${Ml.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>Tit(r,UA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(Ml,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Ml.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})};var Sit=class extends ss{static get type(){return"PosterizeNode"}constructor(r,t){super(),this.sourceNode=r,this.stepsNode=t}setup(){let{sourceNode:r,stepsNode:t}=this;return r.mul(t).floor().div(t)}};const _it=tt(Sit).setParameterLength(2),Tl={name:"Posterize",props:{intensity:{type:Number,default:5,description:"The intensity of the posterization effect (lower is more posterized)"}},fragmentNode:({uniforms:r,childNode:t})=>{let{vec4:e,int:s}=rs;if(!t)return console.error("You must pass a child component into the Posterize shader."),e(0);let i=t||e(0,0,0,0);return _it(i,s(r.intensity.uniform))}};function Ait(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const $A={blendMode:"normal",opacity:1};try{Tl&&Tl.props&&Object.entries(Tl.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&($A[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const zit=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${Tl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>Ait(r,$A),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(Tl,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Tl.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})},Nl={name:"Saturation",props:{intensity:{type:Number,default:1,description:"The intensity of the saturation effect (1 being no change)"}},fragmentNode:({uniforms:r,childNode:t})=>{let{vec4:e}=rs;if(!t)return console.error("You must pass a child component into the Saturation shader."),e(0);let s=t||e(0,0,0,0);return e(mit(s.rgb,r.intensity.uniform).rgb,s.a)}};function Cit(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const jA={blendMode:"normal",opacity:1};try{Nl&&Nl.props&&Object.entries(Nl.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(jA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const Eit=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${Nl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>Cit(r,jA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(Nl,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Nl.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})},Sl={name:"SolidColor",props:{color:{type:String,default:"#5b18ca",transform:Ju,description:"The solid color to display"}},fragmentNode:({uniforms:r})=>r.color.uniform};function Vit(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const WA={blendMode:"normal",opacity:1};try{Sl&&Sl.props&&Object.entries(Sl.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(WA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const Rit=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${Sl.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>Vit(r,WA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(Sl,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Sl.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})},_l={name:"Twirl",props:{center:{type:Object,default:{x:.5,y:.5},transform:Ky,description:"The center point of the twirl effect"},intensity:{type:Number,default:1,description:"The strength of the twirl effect"}},fragmentNode:({uniforms:r,childNode:t})=>{let{vec2:e,vec4:s,cos:i,sin:n,length:a,uv:o,convertToTexture:l}=rs;if(!t)return console.error("You must pass a child component into the Twirl shader."),s(0);let h=l(t),u=o(),c=e(r.center.uniform.x,r.center.uniform.y),d=u.sub(c),p=r.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)),w=e(x.add(c.x),b.add(c.y));return s(h.sample(w))}};function Lit(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const qA={blendMode:"normal",opacity:1};try{_l&&_l.props&&Object.entries(_l.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(qA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const Iit=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${_l.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>Lit(r,qA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(_l,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,_l.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})},Al={name:"Vibrance",props:{intensity:{type:Number,default:0,description:"The intensity of the vibrance effect"}},fragmentNode:({uniforms:r,childNode:t})=>{let{vec4:e}=rs;if(!t)return console.error("You must pass a child component into the Vibrance shader."),e(0);let s=t||e(0,0,0,0);return e(fit(s.rgb,r.intensity.uniform).rgb,s.a)}};function Pit(r,t){let e={...t};for(const[s,i]of Object.entries(r))s!=="children"&&s!=="ref"&&i!==void 0&&(e[s]=i);return e}const HA={blendMode:"normal",opacity:1};try{Al&&Al.props&&Object.entries(Al.props).forEach(([r,t])=>{const e=t;e&&typeof e=="object"&&"default"in e&&(HA[r]=e.default)})}catch(r){console.warn("Error extracting default props:",r)}const Fit=r=>{const t=J.useContext(xe);if(!t)throw new Error("Shader components must be used inside an <Shader> component or another shader component");const{ombreParentId:e,ombreNodeRegister:s,ombreUniformUpdate:i,ombreMetadataUpdate:n}=t,a=J.useMemo(()=>r.id||`${Al.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`,[r.id]),o=J.useMemo(()=>Pit(r,HA),[r]),l=J.useRef(null);l.current===null&&(l.current=Ms.createUniformsMap(Al,o,a));const h=J.useMemo(()=>({...t,ombreParentId:a}),[t,a]);if(J.useEffect(()=>{if(l.current)try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};return s(a,Al.fragmentNode,e,u,l.current),()=>{s(a,null,null,null,null)}}catch(u){return console.error("Error registering shader node:",u),()=>{}}},[a,e,s,r.blendMode,r.opacity,r.id,r.maskSource,r.maskType]),J.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]),J.useEffect(()=>{try{const u={blendMode:r.blendMode||"normal",opacity:r.opacity??1,id:r.id,mask:r.maskSource?{source:r.maskSource,type:r.maskType||"alpha"}:void 0,renderOrder:0};n(a,u)}catch(u){console.error("Error updating metadata:",u)}},[r.blendMode,r.opacity,r.maskSource,r.maskType,r.id,a,n]),r.ref&&typeof r.ref=="function")try{r.ref(null)}catch{}return Vr.jsx(xe.Provider,{value:h,children:r.children})};exports.Circle=vtt;exports.GlassTiles=Mtt;exports.Grayscale=xit;exports.HueShift=vit;exports.Invert=Mit;exports.LinearGradient=Nit;exports.Posterize=zit;exports.Saturation=Eit;exports.Shader=xtt;exports.SolidColor=Rit;exports.Twirl=Iit;exports.Vibrance=Fit;
|
|
168
168
|
//# sourceMappingURL=index.cjs.map
|