miijs
Version:
The most complete and easy to use Mii library available.
1 lines • 603 kB
JavaScript
import{$ as Hm,$a as Vr,$b as Tc,$c as G,$d as Fg,A as ju,Aa as ct,Ac,Ae as kg,Af as Zg,B as Ku,Ba as qn,Bc as Cc,Bd as wg,C as Yu,Ca as Hn,Cb as wo,Cc as wc,D as Qu,Da as cn,Db as Eo,Dc as Ec,Dd as Vt,Df as Jg,E as Zu,Ea as Ze,Eb as Gr,Ec as Do,Ed as Fc,Ee as Io,Ef as Oc,F as Ju,Fa as Me,Fb as Mo,Fc as qs,Fd as Hs,G as ec,Ga as mt,H as tc,Ha as $e,Hd as qr,I as sc,Ia as Jm,J as nc,Ja as eg,Je as Ct,Jg as dx,Ka as Ts,Ke as zg,La as pc,Ma as fc,Md as Eg,Na as tg,O as rc,Oa as to,Od as Mg,Oe as $g,P as ic,Pa as At,Pc as zr,Pd as Dc,Pg as kc,Q as oc,Qa as _s,Qc as Ss,Qd as Lc,R as ac,Ra as bs,Rc as It,Rd as Lo,S as uc,Sa as so,Sd as vs,T as cc,Ta as no,Td as Pc,U as lc,Ua as Yt,Uc as bg,V as dc,Va as ro,Vc as $r,W as zm,Wa as sg,Wf as ex,X as $m,Xa as io,Xc as Sg,Xf as tx,Y as Wm,Ya as Pr,Yb as Bo,Z as ys,Za as Ur,Zb as ng,Zd as Bg,_ as qm,_a as Ir,_b as ln,_c as Ng,_d as Hr,a as Yi,aa as Xm,ab as mc,ac as _c,ad as V,ae as Po,ba as jm,bb as gc,bc,bd as ge,be as Dg,cb as xc,cc as Z,ce as Uc,d as Pm,da as Km,db as yc,dc as Fo,dd as Wr,de as Lg,dg as sx,e as Um,ea as Ym,eb as oo,ec as Sc,ed as vg,eg as Vo,f as Im,fb as ao,fc as rg,fd as Mc,fg as nx,fh as hx,gb as uo,gc as ig,gd as Je,ge as Uo,gg as Gc,h as Vm,ha as Qm,hb as co,hc as og,hd as Rg,he as Pg,hg as rx,i as Om,ia as Br,ib as lo,ic as ag,id as X,ie as Ug,ig as ix,ja as Fr,jb as Or,jc as ug,jd as Xn,je as Ig,jg as ox,k as Cr,ka as Qi,kb as ho,kc as cg,kd as _e,kf as Wg,l as zn,la as Zi,lb as po,lc as lg,lg as ax,m as Qe,ma as Ji,mb as fo,mc as dg,mg as ux,n as zs,na as Dr,nb as mo,nc as hg,nd as dn,nf as qg,o as an,oa as un,ob as go,oc as pg,od as xe,oe as Ic,p as $s,pa as Lr,pb as xo,pc as fg,pd as Ns,q as wr,qa as Rt,qb as yo,qc as mg,qe as hn,qg as cx,r as Er,ra as hc,rb as To,rc as gg,rd as Ag,s as Mr,sb as _o,sc as xg,se as Vc,t as $n,ta as Wn,tb as bo,tc as yg,te as Vg,tf as Hg,u as Kt,ub as So,uc as Tg,ue as Og,v as Hu,va as ke,vb as No,vc as _g,vf as Xg,vg as lx,w as Xu,wa as eo,wb as vo,wc as Nc,wd as Cg,we as Gg,wf as jg,x as Gm,xb as Ro,xc as kr,xf as Kg,y as km,ya as Ws,yb as Ao,yc as vc,yd as Pe,yf as Yg,z as xs,za as Zm,zb as Co,zc as Rc,zd as Bc,zf as Qg}from"./chunk-R7OXYAFO.js";import{g as Lm}from"./chunk-VMLSR5BU.js";Lm();var q0=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","aoMapIntensity","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveIntensity","emissiveMap","envMap","envMapIntensity","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","lightMapIntensity","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"],zc=new WeakMap,yl=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=q0,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}needsVelocity(e){let t=e.getMRT();return t!==null&&t.has("velocity")}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){let{geometry:s,material:n,object:r}=e;if(t={material:this.getMaterialData(n),geometry:{id:s.id,attributes:this.getAttributesData(s.attributes),indexVersion:s.index?s.index.version:null,drawRange:{start:s.drawRange.start,count:s.drawRange.count}},worldMatrix:r.matrixWorld.clone()},r.center&&(t.center=r.center.clone()),r.morphTargetInfluences&&(t.morphTargetInfluences=r.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),t.material.transmission>0){let{width:o,height:a}=e.context;t.bufferWidth=o,t.bufferHeight=a}t.lights=this.getLightsData(e.lightsNode.getLights()),this.renderObjects.set(e,t)}return t}getAttributesData(e){let t={};for(let s in e){let n=e[s];t[s]={version:n.version}}return t}containsNode(e){let t=e.material;for(let s in t)if(t[s]&&t[s].isNode)return!0;return!!(e.context.modelViewMatrix||e.context.modelNormalViewMatrix||e.context.getAO||e.context.getShadow)}getMaterialData(e){let t={};for(let s of this.refreshUniforms){let n=e[s];n!=null&&(typeof n=="object"&&n.clone!==void 0?n.isTexture===!0?t[s]={id:n.id,version:n.version}:t[s]=n.clone():t[s]=n)}return t}equals(e,t){let{object:s,material:n,geometry:r}=e,o=this.getRenderObjectData(e);if(o.worldMatrix.equals(s.matrixWorld)!==!0)return o.worldMatrix.copy(s.matrixWorld),!1;let a=o.material;for(let x in a){let _=a[x],N=n[x];if(_.equals!==void 0){if(_.equals(N)===!1)return _.copy(N),!1}else if(N.isTexture===!0){if(_.id!==N.id||_.version!==N.version)return _.id=N.id,_.version=N.version,!1}else if(_!==N)return a[x]=N,!1}if(a.transmission>0){let{width:x,height:_}=e.context;if(o.bufferWidth!==x||o.bufferHeight!==_)return o.bufferWidth=x,o.bufferHeight=_,!1}let u=o.geometry,c=r.attributes,l=u.attributes,d=Object.keys(l),h=Object.keys(c);if(u.id!==r.id)return u.id=r.id,!1;if(d.length!==h.length)return o.geometry.attributes=this.getAttributesData(c),!1;for(let x of d){let _=l[x],N=c[x];if(N===void 0)return delete l[x],!1;if(_.version!==N.version)return _.version=N.version,!1}let p=r.index,f=u.indexVersion,g=p?p.version:null;if(f!==g)return u.indexVersion=g,!1;if(u.drawRange.start!==r.drawRange.start||u.drawRange.count!==r.drawRange.count)return u.drawRange.start=r.drawRange.start,u.drawRange.count=r.drawRange.count,!1;if(o.morphTargetInfluences){let x=!1;for(let _=0;_<o.morphTargetInfluences.length;_++)o.morphTargetInfluences[_]!==s.morphTargetInfluences[_]&&(o.morphTargetInfluences[_]=s.morphTargetInfluences[_],x=!0);if(x)return!1}if(o.lights){for(let x=0;x<t.length;x++)if(o.lights[x].map!==t[x].map)return!1}return o.center&&o.center.equals(s.center)===!1?(o.center.copy(s.center),!0):(e.bundle!==null&&(o.version=e.bundle.version),!0)}getLightsData(e){let t=[];for(let s of e)s.isSpotLight===!0&&s.map!==null&&t.push({map:s.map.version});return t}getLights(e,t){if(zc.has(e)){let n=zc.get(e);if(n.renderId===t)return n.lightsData}let s=this.getLightsData(e.getLights());return zc.set(e,{renderId:t,lightsData:s}),s}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e)||this.needsVelocity(t.renderer))return!0;let{renderId:s}=t;if(this.renderId!==s)return this.renderId=s,!0;let n=e.object.static===!0,r=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;if(n||r)return!1;let o=this.getLights(e.lightsNode,s);return this.equals(e,o)!==!0}};function nf(i,e=0){let t=3735928559^e,s=1103547991^e;if(i instanceof Array)for(let n=0,r;n<i.length;n++)r=i[n],t=Math.imul(t^r,2654435761),s=Math.imul(s^r,1597334677);else for(let n=0,r;n<i.length;n++)r=i.charCodeAt(n),t=Math.imul(t^r,2654435761),s=Math.imul(s^r,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(s^s>>>13,3266489909),s=Math.imul(s^s>>>16,2246822507),s^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&s)+(t>>>0)}var Nr=i=>nf(i),Un=i=>nf(i),or=(...i)=>nf(i),H0=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),px=new WeakMap;function rf(i){return H0.get(i)}function bi(i){if(/[iu]?vec\d/.test(i))return i.startsWith("ivec")?Int32Array:i.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(i)||/float/.test(i))return Float32Array;if(/uint/.test(i))return Uint32Array;if(/int/.test(i))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${i}`)}function of(i){if(/float|int|uint/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 9;if(/mat4/.test(i))return 16;V("TSL: Unsupported type:",i)}function $y(i){if(/float|int|uint/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 12;if(/mat4/.test(i))return 16;V("TSL: Unsupported type:",i)}function Wy(i){if(/float|int|uint/.test(i))return 4;if(/vec2/.test(i))return 8;if(/vec3/.test(i)||/vec4/.test(i))return 16;if(/mat2/.test(i))return 8;if(/mat3/.test(i)||/mat4/.test(i))return 16;V("TSL: Unsupported type:",i)}function Ms(i){if(i==null)return null;let e=typeof i;return i.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":i.isVector2===!0?"vec2":i.isVector3===!0?"vec3":i.isVector4===!0?"vec4":i.isMatrix2===!0?"mat2":i.isMatrix3===!0?"mat3":i.isMatrix4===!0?"mat4":i.isColor===!0?"color":i instanceof ArrayBuffer?"ArrayBuffer":null}function gu(i,...e){let t=i?i.slice(-4):void 0;return e.length===1&&(t==="vec2"?e=[e[0],e[0]]:t==="vec3"?e=[e[0],e[0],e[0]]:t==="vec4"&&(e=[e[0],e[0],e[0],e[0]])),i==="color"?new Vt(...e):t==="vec2"?new Je(...e):t==="vec3"?new X(...e):t==="vec4"?new xe(...e):t==="mat2"?new kc(...e):t==="mat3"?new Xn(...e):t==="mat4"?new Pe(...e):i==="bool"?e[0]||!1:i==="float"||i==="int"||i==="uint"?e[0]||0:i==="string"?e[0]||"":i==="ArrayBuffer"?cf(e[0]):null}function af(i){let e=px.get(i);return e===void 0&&(e={},px.set(i,e)),e}function uf(i){let e="",t=new Uint8Array(i);for(let s=0;s<t.length;s++)e+=String.fromCharCode(t[s]);return btoa(e)}function cf(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}var _F=Object.freeze({__proto__:null,arrayBufferToBase64:uf,base64ToArrayBuffer:cf,getAlignmentFromType:Wy,getDataFromObject:af,getLengthFromType:of,getMemoryLengthFromType:$y,getTypeFromLength:rf,getTypedArrayFromType:bi,getValueFromType:gu,getValueType:Ms,hash:or,hashArray:Un,hashString:Nr}),li={VERTEX:"vertex",FRAGMENT:"fragment"},Q={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},X0={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},He={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},qy=["fragment","vertex"],Tl=["setup","analyze","generate"],_l=[...qy,"compute"],In=["x","y","z","w"],j0={analyze:"setup",generate:"analyze"},K0=0,$=class extends Wr{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=Q.NONE,this.updateBeforeType=Q.NONE,this.updateAfterType=Q.NONE,this.uuid=Mc.generateUUID(),this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,"id",{value:K0++})}set needsUpdate(e){e===!0&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,Q.FRAME)}onRenderUpdate(e){return this.onUpdate(e,Q.RENDER)}onObjectUpdate(e){return this.onUpdate(e,Q.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(let t of this.getChildren())t.traverse(e)}_getChildren(e=new Set){let t=[];e.add(this);for(let s of Object.getOwnPropertyNames(this)){let n=this[s];if(!(s.startsWith("_")===!0||e.has(n))){if(Array.isArray(n)===!0)for(let r=0;r<n.length;r++){let o=n[r];o&&o.isNode===!0&&t.push({property:s,index:r,childNode:o})}else if(n&&n.isNode===!0)t.push({property:s,childNode:n});else if(n&&Object.getPrototypeOf(n)===Object.prototype)for(let r in n){if(r.startsWith("_")===!0)continue;let o=n[r];o&&o.isNode===!0&&t.push({property:s,index:r,childNode:o})}}}return t}getCacheKey(e=!1,t=null){if(e=e||this.version!==this._cacheKeyVersion,e===!0||this._cacheKey===null){t===null&&(t=new Set);let s=[];for(let{property:n,childNode:r}of this._getChildren(t))s.push(Nr(n.slice(0,-4)),r.getCacheKey(e,t));this._cacheKey=or(Un(s),this.customCacheKey()),this._cacheKeyVersion=this.version}return this._cacheKey}customCacheKey(){return this.id}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){let t=this.getNodeType(e);return e.getElementType(t)}getMemberType(){return"void"}getNodeType(e){let t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){let t=this.getHash(e);return e.getNodeFromHash(t)||this}getArrayCount(){return null}setup(e){let t=e.getNodeProperties(this),s=0;for(let n of this.getChildren())t["node"+s++]=n;return t.outputNode||null}analyze(e,t=null){let s=e.increaseUsage(this);if(this.parents===!0){let n=e.getDataFromNode(this,"any");n.stages=n.stages||{},n.stages[e.shaderStage]=n.stages[e.shaderStage]||[],n.stages[e.shaderStage].push(t)}if(s===1){let n=e.getNodeProperties(this);for(let r of Object.values(n))r&&r.isNode===!0&&r.build(e,this)}}generate(e,t){let{outputNode:s}=e.getNodeProperties(this);if(s&&s.isNode===!0)return s.build(e,t)}updateBefore(){G("Abstract function.")}updateAfter(){G("Abstract function.")}update(){G("Abstract function.")}before(e){return this._beforeNodes===null&&(this._beforeNodes=[]),this._beforeNodes.push(e),this}build(e,t=null){let s=this.getShared(e);if(this!==s)return s.build(e,t);if(this._beforeNodes!==null){let u=this._beforeNodes;this._beforeNodes=null;for(let c of u)c.build(e,t);this._beforeNodes=u}let n=e.getDataFromNode(this);n.buildStages=n.buildStages||{},n.buildStages[e.buildStage]=!0;let r=j0[e.buildStage];if(r&&n.buildStages[r]!==!0){let u=e.getBuildStage();e.setBuildStage(r),this.build(e),e.setBuildStage(u)}e.addNode(this),e.addChain(this);let o=null,a=e.getBuildStage();if(a==="setup"){this.updateReference(e);let u=e.getNodeProperties(this);if(u.initialized!==!0){u.initialized=!0,u.outputNode=this.setup(e)||u.outputNode||null;for(let c of Object.values(u))if(c&&c.isNode===!0){if(c.parents===!0){let l=e.getNodeProperties(c);l.parents=l.parents||[],l.parents.push(this)}c.build(e)}}o=u.outputNode}else if(a==="analyze")this.analyze(e,t);else if(a==="generate"){if(this.generate.length<2){let c=this.getNodeType(e),l=e.getDataFromNode(this);o=l.snippet,o===void 0?l.generated===void 0?(l.generated=!0,o=this.generate(e)||"",l.snippet=o):(G("Node: Recursion detected.",this),o="/* Recursion detected. */"):l.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),o=e.format(o,c,t)}else o=this.generate(e,t)||"";o===""&&t!==null&&t!=="void"&&t!=="OutputType"&&(V(`TSL: Invalid generated code, expected a "${t}".`),o=e.generateConst(t))}return e.removeChain(this),e.addSequentialNode(this),o}getSerializeChildren(){return this._getChildren()}serialize(e){let t=this.getSerializeChildren(),s={};for(let{property:n,index:r,childNode:o}of t)r!==void 0?(s[n]===void 0&&(s[n]=Number.isInteger(r)?[]:{}),s[n][r]=o.toJSON(e.meta).uuid):s[n]=o.toJSON(e.meta).uuid;Object.keys(s).length>0&&(e.inputNodes=s)}deserialize(e){if(e.inputNodes!==void 0){let t=e.meta.nodes;for(let s in e.inputNodes)if(Array.isArray(e.inputNodes[s])){let n=[];for(let r of e.inputNodes[s])n.push(t[r]);this[s]=n}else if(typeof e.inputNodes[s]=="object"){let n={};for(let r in e.inputNodes[s]){let o=e.inputNodes[s][r];n[r]=t[o]}this[s]=n}else{let n=e.inputNodes[s];this[s]=t[n]}}}toJSON(e){let{uuid:t,type:s}=this,n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{},nodes:{}});let r=e.nodes[t];r===void 0&&(r={uuid:t,type:s,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},n!==!0&&(e.nodes[r.uuid]=r),this.serialize(r),delete r.meta);function o(a){let u=[];for(let c in a){let l=a[c];delete l.metadata,u.push(l)}return u}if(n){let a=o(e.textures),u=o(e.images),c=o(e.nodes);a.length>0&&(r.textures=a),u.length>0&&(r.images=u),c.length>0&&(r.nodes=c)}return r}},Ps=class extends ${static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){let t=this.indexNode.getNodeType(e),s=this.node.build(e),n=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint");return`${s}[ ${n} ]`}},ha=class extends ${static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){let t=this.node.getNodeType(e),s=null;for(let n of this.convertTo.split("|"))(s===null||e.getTypeLength(t)===e.getTypeLength(n))&&(s=n);return s}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){let s=this.node,n=this.getNodeType(e),r=s.build(e,n);return e.format(r,n,t)}},ye=class extends ${static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){let n=e.getVectorType(this.getNodeType(e,t)),r=e.getDataFromNode(this);if(r.propertyName!==void 0)return e.format(r.propertyName,n,t);if(n!=="void"&&t!=="void"&&this.hasDependencies(e)){let o=super.build(e,n),a=e.getVarFromNode(this,null,n),u=e.getPropertyName(a);return e.addLineFlowCode(`${u} = ${o}`,this),r.snippet=o,r.propertyName=u,e.format(r.propertyName,n,t)}}return super.build(e,t)}},bl=class extends ye{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}getNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,s)=>t+e.getTypeLength(s.getNodeType(e)),0))}generate(e,t){let s=this.getNodeType(e),n=e.getTypeLength(s),r=this.nodes,o=e.getComponentType(s),a=[],u=0;for(let l of r){if(u>=n){V(`TSL: Length of parameters exceeds maximum length of function '${s}()' type.`);break}let d=l.getNodeType(e),h=e.getTypeLength(d),p;if(u+h>n&&(V(`TSL: Length of '${s}()' data exceeds maximum length of output type.`),h=n-u,d=e.getTypeFromLength(h)),u+=h,p=l.build(e,d),e.getComponentType(d)!==o){let g=e.getTypeFromLength(h,o);p=e.format(p,d,g)}a.push(p)}let c=`${e.getType(s)}( ${a.join(", ")} )`;return e.format(c,s,t)}},Y0=In.join(""),pa=class extends ${static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(let t of this.components)e=Math.max(In.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){let s=this.node,n=e.getTypeLength(s.getNodeType(e)),r=null;if(n>1){let o=null;this.getVectorLength()>=n&&(o=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));let u=s.build(e,o);this.components.length===n&&this.components===Y0.slice(0,this.components.length)?r=e.format(u,o,t):r=e.format(`${u}.${this.components}`,this.getNodeType(e),t)}else r=s.build(e,t);return r}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}},Sl=class extends ye{static get type(){return"SetNode"}constructor(e,t,s){super(),this.sourceNode=e,this.components=t,this.targetNode=s}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{sourceNode:t,components:s,targetNode:n}=this,r=this.getNodeType(e),o=e.getComponentType(n.getNodeType(e)),a=e.getTypeFromLength(s.length,o),u=n.build(e,a),c=t.build(e,r),l=e.getTypeLength(r),d=[];for(let h=0;h<l;h++){let p=In[h];p===s[0]?(d.push(u),h+=s.length-1):d.push(c+"."+p)}return`${e.getType(r)}( ${d.join(", ")} )`}},Nl=class extends ye{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{components:t,sourceNode:s}=this,n=this.getNodeType(e),r=s.build(e),o=e.getVarFromNode(this),a=e.getPropertyName(o);e.addLineFlowCode(a+" = "+r,this);let u=e.getTypeLength(n),c=[],l=0;for(let d=0;d<u;d++){let h=In[d];h===t[l]?(c.push("1.0 - "+(a+"."+h)),l++):c.push(a+"."+h)}return`${e.getType(n)}( ${c.join(", ")} )`}},Si=class extends ${static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}getNodeType(){return this.nodeType===null?Ms(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=Ms(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=uf(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?gu(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){G("Abstract function.")}},fx=/float|u?int/,lt=class extends Si{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){let s=this.getNodeType(e);return fx.test(s)&&fx.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),s,t)}},vl=class extends ${static get type(){return"MemberNode"}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return this.structNode.isMemberNode&&this.structNode.hasMember(e)===!1?!1:this.structNode.getMemberType(e,this.property)!=="void"}getNodeType(e){return this.hasMember(e)===!1?"float":this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(this.hasMember(e)===!1)return"float";let s=this.getNodeType(e);return e.getStructTypeNode(s).getMemberType(e,t)}generate(e){if(this.hasMember(e)===!1){G(`TSL: Member "${this.property}" does not exist in struct.`);let s=this.getNodeType(e);return e.generateConst(s)}return this.structNode.build(e)+"."+this.property}},tn=null,Rl=new Map;function C(i,e){if(Rl.has(i)){G(`TSL: Redefinition of method chaining '${i}'.`);return}if(typeof e!="function")throw new Error(`THREE.TSL: Node element ${i} is not a function`);Rl.set(i,e),i!=="assign"&&($.prototype[i]=function(...t){return this.isStackNode?this.addToStack(e(...t)):e(this,...t)},$.prototype[i+"Assign"]=function(...t){return this.isStackNode?this.assign(t[0],e(...t)):this.assign(e(this,...t))})}var Q0=i=>i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),mx=i=>Q0(i).split("").sort().join("");$.prototype.assign=function(...i){if(this.isStackNode!==!0)return tn!==null?tn.assign(this,...i):V("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn()."),this;{let e=Rl.get("assign");return this.addToStack(e(...i))}};$.prototype.toVarIntent=function(){return this};$.prototype.get=function(i){return new vl(this,i)};var hi={};function Oo(i,e,t){hi[i]=hi[e]=hi[t]={get(){this._cache=this._cache||{};let o=this._cache[i];return o===void 0&&(o=new pa(this,i),this._cache[i]=o),o},set(o){this[i].assign(O(o))}};let s=i.toUpperCase(),n=e.toUpperCase(),r=t.toUpperCase();$.prototype["set"+s]=$.prototype["set"+n]=$.prototype["set"+r]=function(o){let a=mx(i);return new Sl(this,a,O(o))},$.prototype["flip"+s]=$.prototype["flip"+n]=$.prototype["flip"+r]=function(){let o=mx(i);return new Nl(this,o)}}var Qt=["x","y","z","w"],Zt=["r","g","b","a"],Jt=["s","t","p","q"];for(let i=0;i<4;i++){let e=Qt[i],t=Zt[i],s=Jt[i];Oo(e,t,s);for(let n=0;n<4;n++){e=Qt[i]+Qt[n],t=Zt[i]+Zt[n],s=Jt[i]+Jt[n],Oo(e,t,s);for(let r=0;r<4;r++){e=Qt[i]+Qt[n]+Qt[r],t=Zt[i]+Zt[n]+Zt[r],s=Jt[i]+Jt[n]+Jt[r],Oo(e,t,s);for(let o=0;o<4;o++)e=Qt[i]+Qt[n]+Qt[r]+Qt[o],t=Zt[i]+Zt[n]+Zt[r]+Zt[o],s=Jt[i]+Jt[n]+Jt[r]+Jt[o],Oo(e,t,s)}}}for(let i=0;i<32;i++)hi[i]={get(){this._cache=this._cache||{};let e=this._cache[i];return e===void 0&&(e=new Ps(this,new lt(i,"uint")),this._cache[i]=e),e},set(e){this[i].assign(O(e))}};Object.defineProperties($.prototype,hi);var gx=new WeakMap,Z0=function(i,e=null){let t=Ms(i);return t==="node"?i:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?O(wl(i,e)):t==="shader"?i.isFn?i:S(i):i},J0=function(i,e=null){for(let t in i)i[t]=O(i[t],e);return i},eS=function(i,e=null){let t=i.length;for(let s=0;s<t;s++)i[s]=O(i[s],e);return i},Hy=function(i,e=null,t=null,s=null){function n(l){return s!==null?(l=O(Object.assign(l,s)),s.intent===!0&&(l=l.toVarIntent())):l=O(l),l}let r,o=e,a,u;function c(l){let d;return o?d=/[a-z]/i.test(o)?o+"()":o:d=i.type,a!==void 0&&l.length<a?(V(`TSL: "${d}" parameter length is less than minimum required.`),l.concat(new Array(a-l.length).fill(0))):u!==void 0&&l.length>u?(V(`TSL: "${d}" parameter length exceeds limit.`),l.slice(0,u)):l}return e===null?r=(...l)=>n(new i(...Cn(c(l)))):t!==null?(t=O(t),r=(...l)=>n(new i(e,...Cn(c(l)),t))):r=(...l)=>n(new i(e,...Cn(c(l)))),r.setParameterLength=(...l)=>(l.length===1?a=u=l[0]:l.length===2&&([a,u]=l),r),r.setName=l=>(o=l,r),r},tS=function(i,...e){return new i(...Cn(e))},Al=class extends ${constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){let{shaderNode:t,rawInputs:s}=this,n=e.getNodeProperties(t),r=e.getClosestSubBuild(t.subBuilds)||"",o=r||"default";if(n[o])return n[o];let a=e.subBuildFn,u=e.fnCall;e.subBuildFn=r,e.fnCall=this;let c=null;if(t.layout){let l=gx.get(e.constructor);l===void 0&&(l=new WeakMap,gx.set(e.constructor,l));let d=l.get(t);d===void 0&&(d=O(e.buildFunctionNode(t)),l.set(t,d)),e.addInclude(d);let h=s?sS(s):null;c=O(d.call(h))}else{let l=new Proxy(e,{get:(g,x,_)=>{let N;return Symbol.iterator===x?N=function*(){yield void 0}:N=Reflect.get(g,x,_),N}}),d=s?nS(s):null,h=Array.isArray(s)?s.length>0:s!==null,p=t.jsFunc,f=h||p.length>1?p(d,l):p(l);c=O(f)}return e.subBuildFn=a,e.fnCall=u,t.once&&(n[o]=c),c}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){let t=e.getNodeProperties(this),s=e.getSubBuildOutput(this);return t[s]=t[s]||this.setupOutput(e),t[s].subBuild=e.getClosestSubBuild(this),t[s]}build(e,t=null){let s=null,n=e.getBuildStage(),r=e.getNodeProperties(this),o=e.getSubBuildOutput(this),a=this.getOutputNode(e),u=e.fnCall;if(e.fnCall=this,n==="setup"){let c=e.getSubBuildProperty("initialized",this);if(r[c]!==!0&&(r[c]=!0,r[o]=this.getOutputNode(e),r[o].build(e),this.shaderNode.subBuilds))for(let l of e.chaining){let d=e.getDataFromNode(l,"any");d.subBuilds=d.subBuilds||new Set;for(let h of this.shaderNode.subBuilds)d.subBuilds.add(h)}s=r[o]}else n==="analyze"?a.build(e,t):n==="generate"&&(s=a.build(e,t)||"");return e.fnCall=u,s}};function sS(i){let e;return Tu(i),i[0]&&(i[0].isNode||Object.getPrototypeOf(i[0])!==Object.prototype)?e=[...i]:e=i[0],e}function nS(i){let e=0;return Tu(i),new Proxy(i,{get:(t,s,n)=>{let r;if(s==="length")return r=i.length,r;if(Symbol.iterator===s)r=function*(){for(let o of i)yield O(o)};else{if(i.length>0)if(Object.getPrototypeOf(i[0])===Object.prototype){let o=i[0];o[s]===void 0?r=o[e++]:r=Reflect.get(o,s,n)}else i[0]instanceof $&&(i[s]===void 0?r=i[e++]:r=Reflect.get(i,s,n));else r=Reflect.get(t,s,n);r=O(r)}return r}})}var Cl=class extends ${constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new Al(this,e)}setup(){return this.call()}},rS=[!1,!0],iS=[0,1,2,3],oS=[-1,-2],Xy=[.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],lf=new Map;for(let i of rS)lf.set(i,new lt(i));var df=new Map;for(let i of iS)df.set(i,new lt(i,"uint"));var hf=new Map([...df].map(i=>new lt(i.value,"int")));for(let i of oS)hf.set(i,new lt(i,"int"));var xu=new Map([...hf].map(i=>new lt(i.value)));for(let i of Xy)xu.set(i,new lt(i));for(let i of Xy)xu.set(-i,new lt(-i));var yu={bool:lf,uint:df,ints:hf,float:xu},xx=new Map([...lf,...xu]),wl=(i,e)=>xx.has(i)?xx.get(i):i.isNode===!0?i:new lt(i,e),Ge=function(i,e=null){return(...t)=>{for(let n of t)if(n===void 0)return V(`TSL: Invalid parameter for the type "${i}".`),new lt(0,i);if((t.length===0||!["bool","float","int","uint"].includes(i)&&t.every(n=>{let r=typeof n;return r!=="object"&&r!=="function"}))&&(t=[gu(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return di(e.get(t[0]));if(t.length===1){let n=wl(t[0],i);return n.nodeType===i?di(n):di(new ha(n,i))}let s=t.map(n=>wl(n));return di(new bl(s,i))}},Ni=i=>typeof i=="object"&&i!==null?i.value:i,jy=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function rr(i,e){return new Cl(i,e)}var O=(i,e=null)=>Z0(i,e),di=(i,e=null)=>O(i,e).toVarIntent(),Tu=(i,e=null)=>new J0(i,e),Cn=(i,e=null)=>new eS(i,e),Y=(i,e=null,t=null,s=null)=>new Hy(i,e,t,s),I=(i,...e)=>new tS(i,...e),P=(i,e=null,t=null,s={})=>new Hy(i,e,t,{...s,intent:!0}),aS=0,El=class extends ${constructor(e,t=null){super();let s=null;t!==null&&(typeof t=="object"?s=t.return:(typeof t=="string"?s=t:V("TSL: Invalid layout type."),t=null)),this.shaderNode=new rr(e,s),t!==null&&this.setLayout(t),this.isFn=!0}setLayout(e){let t=this.shaderNode.nodeType;if(typeof e.inputs!="object"){let s={name:"fn"+aS++,type:t,inputs:[]};for(let n in e)n!=="return"&&s.inputs.push({name:n,type:e[n]});e=s}return this.shaderNode.setLayout(e),this}getNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){let t=this.shaderNode.call(e);return this.shaderNode.nodeType==="void"&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){let t=this.getNodeType(e);return V('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".'),e.generateConst(t)}};function S(i,e=null){let t=new El(i,e);return new Proxy(()=>{},{apply(s,n,r){return t.call(...r)},get(s,n,r){return Reflect.get(t,n,r)},set(s,n,r,o){return Reflect.set(t,n,r,o)}})}var vi=i=>{tn=i},pf=()=>tn,W=(...i)=>tn.If(...i),uS=(...i)=>tn.Switch(...i);function _u(i){return tn&&tn.addToStack(i),i}C("toStack",_u);var Ky=new Ge("color"),m=new Ge("float",yu.float),y=new Ge("int",yu.ints),B=new Ge("uint",yu.uint),Dt=new Ge("bool",yu.bool),L=new Ge("vec2"),Ie=new Ge("ivec2"),ff=new Ge("uvec2"),Yy=new Ge("bvec2"),T=new Ge("vec3"),mf=new Ge("ivec3"),Vn=new Ge("uvec3"),gf=new Ge("bvec3"),k=new Ge("vec4"),xf=new Ge("ivec4"),yf=new Ge("uvec4"),Qy=new Ge("bvec4"),bu=new Ge("mat2"),je=new Ge("mat3"),en=new Ge("mat4"),cS=(i="")=>new lt(i,"string"),lS=i=>new lt(i,"ArrayBuffer");C("toColor",Ky);C("toFloat",m);C("toInt",y);C("toUint",B);C("toBool",Dt);C("toVec2",L);C("toIVec2",Ie);C("toUVec2",ff);C("toBVec2",Yy);C("toVec3",T);C("toIVec3",mf);C("toUVec3",Vn);C("toBVec3",gf);C("toVec4",k);C("toIVec4",xf);C("toUVec4",yf);C("toBVec4",Qy);C("toMat2",bu);C("toMat3",je);C("toMat4",en);var Zy=Y(Ps).setParameterLength(2),Jy=(i,e)=>O(new ha(O(i),e)),dS=(i,e)=>O(new pa(O(i),e));C("element",Zy);C("convert",Jy);var hS=i=>(G("TSL: append() has been renamed to Stack()."),_u(i));C("append",i=>(G("TSL: .append() has been renamed to .toStack()."),_u(i)));var re=class extends ${static get type(){return"PropertyNode"}constructor(e,t=null,s=!1){super(e),this.name=t,this.varying=s,this.isPropertyNode=!0,this.global=!0}customCacheKey(){return Nr(this.type+":"+(this.name||"")+":"+(this.varying?"1":"0"))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;return this.varying===!0?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}},zt=(i,e)=>new re(i,e),yt=(i,e)=>new re(i,e,!0),ue=I(re,"vec4","DiffuseColor"),Tn=I(re,"vec3","DiffuseContribution"),Ml=I(re,"vec3","EmissiveColor"),rs=I(re,"float","Roughness"),Bs=I(re,"float","Metalness"),fa=I(re,"float","Clearcoat"),Ri=I(re,"float","ClearcoatRoughness"),xt=I(re,"vec3","Sheen"),Ys=I(re,"float","SheenRoughness"),Su=I(re,"float","Iridescence"),ma=I(re,"float","IridescenceIOR"),ga=I(re,"float","IridescenceThickness"),xa=I(re,"float","AlphaT"),Ks=I(re,"float","Anisotropy"),pi=I(re,"vec3","AnisotropyT"),wn=I(re,"vec3","AnisotropyB"),sn=I(re,"color","SpecularColor"),Sn=I(re,"color","SpecularColorBlended"),ar=I(re,"float","SpecularF90"),ya=I(re,"float","Shininess"),ur=I(re,"vec4","Output"),En=I(re,"float","dashSize"),Ai=I(re,"float","gapSize"),pS=I(re,"float","pointWidth"),fi=I(re,"float","IOR"),Ta=I(re,"float","Transmission"),Tf=I(re,"float","Thickness"),_f=I(re,"float","AttenuationDistance"),bf=I(re,"color","AttenuationColor"),Sf=I(re,"float","Dispersion"),_a=class extends ${static get type(){return"UniformGroupNode"}constructor(e,t=!1,s=1){super("string"),this.name=e,this.shared=t,this.order=s,this.isUniformGroup=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}},eT=i=>new _a(i),Nu=(i,e=0)=>new _a(i,!0,e),tT=Nu("frame"),H=Nu("render"),Nf=eT("object"),Mn=class extends Si{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=Nf}setName(e){return this.name=e,this}label(e){return G('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(s=>{let n=e(s,this);n!==void 0&&(this.value=n)},t)}getInputType(e){let t=super.getInputType(e);return t==="bool"&&(t="uint"),t}generate(e,t){let s=this.getNodeType(e),n=this.getUniformHash(e),r=e.getNodeFromHash(n);r===void 0&&(e.setHashNode(this,n),r=this);let o=r.getInputType(e),a=e.getUniformFromNode(r,o,e.shaderStage,this.name||e.context.nodeName),u=e.getPropertyName(a);e.context.nodeName!==void 0&&delete e.context.nodeName;let c=u;if(s==="bool"){let l=e.getDataFromNode(this),d=l.propertyName;if(d===void 0){let h=e.getVarFromNode(this,null,"bool");d=e.getPropertyName(h),l.propertyName=d,c=e.format(u,o,s),e.addLineFlowCode(`${d} = ${c}`,this)}c=d}return e.format(c,s,t)}},q=(i,e)=>{let t=jy(e||i);if(t===i&&(i=gu(t)),i&&i.isNode===!0){let s=i.value;i.traverse(n=>{n.isConstNode===!0&&(s=n.value)}),i=s}return new Mn(i,t)},ba=class extends ye{static get type(){return"ArrayNode"}constructor(e,t,s=null){super(e),this.count=t,this.values=s,this.isArrayNode=!0}getArrayCount(){return this.count}getNodeType(e){return this.nodeType===null?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return this.nodeType===null?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){let t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}},sT=(...i)=>{let e;if(i.length===1){let t=i[0];e=new ba(null,t.length,t)}else{let t=i[0],s=i[1];e=new ba(t,s)}return O(e)};C("toArray",(i,e)=>sT(Array(e).fill(i)));var Bl=class extends ye{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}getNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){let{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){let s=e.getTypeLength(t.node.getNodeType(e));return In.join("").slice(0,s)!==t.components}return!1}setup(e){let{targetNode:t,sourceNode:s}=this,n=t.getScope(),r=e.getDataFromNode(n);r.assign=!0;let o=e.getNodeProperties(this);o.sourceNode=s,o.targetNode=t.context({assign:!0})}generate(e,t){let{targetNode:s,sourceNode:n}=e.getNodeProperties(this),r=this.needsSplitAssign(e),o=s.build(e),a=s.getNodeType(e),u=n.build(e,a),c=n.getNodeType(e),l=e.getDataFromNode(this),d;if(l.initialized===!0)t!=="void"&&(d=o);else if(r){let h=e.getVarFromNode(this,null,a),p=e.getPropertyName(h);e.addLineFlowCode(`${p} = ${u}`,this);let f=s.node,x=f.node.context({assign:!0}).build(e);for(let _=0;_<f.components.length;_++){let N=f.components[_];e.addLineFlowCode(`${x}.${N} = ${p}[ ${_} ]`,this)}t!=="void"&&(d=o)}else d=`${o} = ${u}`,(t==="void"||c==="void")&&(e.addLineFlowCode(d,this),t!=="void"&&(d=o));return l.initialized=!0,e.format(d,a,t)}},nT=Y(Bl).setParameterLength(2);C("assign",nT);var Fl=class extends ye{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}getNodeType(e){return this.functionNode.getNodeType(e)}getMemberType(e,t){return this.functionNode.getMemberType(e,t)}generate(e){let t=[],s=this.functionNode,n=s.getInputs(e),r=this.parameters,o=(u,c)=>{let l=c.type,d=l==="pointer",h;return d?h="&"+u.build(e):h=u.build(e,l),h};if(Array.isArray(r)){if(r.length>n.length)V("TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),r.length=n.length;else if(r.length<n.length)for(V("TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.");r.length<n.length;)r.push(m(0));for(let u=0;u<r.length;u++)t.push(o(r[u],n[u]))}else for(let u of n){let c=r[u.name];c!==void 0?t.push(o(c,u)):(V(`TSL: Input '${u.name}' not found in 'Fn()'.`),t.push(o(m(0),u)))}return`${s.build(e,"property")}( ${t.join(", ")} )`}},rT=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?Cn(e):Tu(e[0]),new Fl(O(i),e));C("call",rT);var fS={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"},Ce=class i extends ye{static get type(){return"OperatorNode"}constructor(e,t,s,...n){if(super(),n.length>0){let r=new i(e,t,s);for(let o=0;o<n.length-1;o++)r=new i(e,r,n[o]);t=r,s=n[n.length-1]}this.op=e,this.aNode=t,this.bNode=s,this.isOperatorNode=!0}getOperatorMethod(e,t){return e.getMethod(fS[this.op],t)}getNodeType(e,t=null){let s=this.op,n=this.aNode,r=this.bNode,o=n.getNodeType(e),a=r?r.getNodeType(e):null;if(o==="void"||a==="void")return t||"void";if(s==="%")return o;if(s==="~"||s==="&"||s==="|"||s==="^"||s===">>"||s==="<<")return e.getIntegerType(o);if(s==="!"||s==="&&"||s==="||"||s==="^^")return"bool";if(s==="=="||s==="!="||s==="<"||s===">"||s==="<="||s===">="){let u=Math.max(e.getTypeLength(o),e.getTypeLength(a));return u>1?`bvec${u}`:"bool"}else{if(e.isMatrix(o)){if(a==="float")return o;if(e.isVector(a))return e.getVectorFromMatrix(o);if(e.isMatrix(a))return o}else if(e.isMatrix(a)){if(o==="float")return a;if(e.isVector(o))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(o)?a:o}}generate(e,t){let s=this.op,{aNode:n,bNode:r}=this,o=this.getNodeType(e,t),a=null,u=null;o!=="void"?(a=n.getNodeType(e),u=r?r.getNodeType(e):null,s==="<"||s===">"||s==="<="||s===">="||s==="=="||s==="!="?e.isVector(a)?u=a:e.isVector(u)?a=u:a!==u&&(a=u="float"):s===">>"||s==="<<"?(a=o,u=e.changeComponentType(u,"uint")):s==="%"?(a=o,u=e.isInteger(a)&&e.isInteger(u)?u:a):e.isMatrix(a)?u==="float"?u="float":e.isVector(u)?u=e.getVectorFromMatrix(a):e.isMatrix(u)||(a=u=o):e.isMatrix(u)?a==="float"?a="float":e.isVector(a)?a=e.getVectorFromMatrix(u):a=u=o:a=u=o):a=u=o;let c=n.build(e,a),l=r?r.build(e,u):null,d=e.getFunctionOperator(s);if(t!=="void"){let h=e.renderer.coordinateSystem===zr;if(s==="=="||s==="!="||s==="<"||s===">"||s==="<="||s===">=")return h?e.isVector(a)?e.format(`${this.getOperatorMethod(e,t)}( ${c}, ${l} )`,o,t):e.format(`( ${c} ${s} ${l} )`,o,t):e.format(`( ${c} ${s} ${l} )`,o,t);if(s==="%")return e.isInteger(u)?e.format(`( ${c} % ${l} )`,o,t):e.format(`${this.getOperatorMethod(e,o)}( ${c}, ${l} )`,o,t);if(s==="!"||s==="~")return e.format(`(${s}${c})`,a,t);if(d)return e.format(`${d}( ${c}, ${l} )`,o,t);if(e.isMatrix(a)&&u==="float")return e.format(`( ${l} ${s} ${c} )`,o,t);if(a==="float"&&e.isMatrix(u))return e.format(`${c} ${s} ${l}`,o,t);{let p=`( ${c} ${s} ${l} )`;return!h&&o==="bool"&&e.isVector(a)&&e.isVector(u)&&(p=`all${p}`),e.format(p,o,t)}}else if(a!=="void")return d?e.format(`${d}( ${c}, ${l} )`,o,t):e.isMatrix(a)&&u==="float"?e.format(`${l} ${s} ${c}`,o,t):e.format(`${c} ${s} ${l}`,o,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}},Fe=P(Ce,"+").setParameterLength(2,1/0).setName("add"),ee=P(Ce,"-").setParameterLength(2,1/0).setName("sub"),K=P(Ce,"*").setParameterLength(2,1/0).setName("mul"),bt=P(Ce,"/").setParameterLength(2,1/0).setName("div"),$i=P(Ce,"%").setParameterLength(2).setName("mod"),vf=P(Ce,"==").setParameterLength(2).setName("equal"),iT=P(Ce,"!=").setParameterLength(2).setName("notEqual"),oT=P(Ce,"<").setParameterLength(2).setName("lessThan"),Rf=P(Ce,">").setParameterLength(2).setName("greaterThan"),aT=P(Ce,"<=").setParameterLength(2).setName("lessThanEqual"),uT=P(Ce,">=").setParameterLength(2).setName("greaterThanEqual"),cT=P(Ce,"&&").setParameterLength(2,1/0).setName("and"),lT=P(Ce,"||").setParameterLength(2,1/0).setName("or"),dT=P(Ce,"!").setParameterLength(1).setName("not"),hT=P(Ce,"^^").setParameterLength(2).setName("xor"),pT=P(Ce,"&").setParameterLength(2).setName("bitAnd"),fT=P(Ce,"~").setParameterLength(1).setName("bitNot"),mT=P(Ce,"|").setParameterLength(2).setName("bitOr"),gT=P(Ce,"^").setParameterLength(2).setName("bitXor"),xT=P(Ce,"<<").setParameterLength(2).setName("shiftLeft"),yT=P(Ce,">>").setParameterLength(2).setName("shiftRight"),TT=S(([i])=>(i.addAssign(1),i)),_T=S(([i])=>(i.subAssign(1),i)),bT=S(([i])=>{let e=y(i).toConst();return i.addAssign(1),e}),ST=S(([i])=>{let e=y(i).toConst();return i.subAssign(1),e});C("add",Fe);C("sub",ee);C("mul",K);C("div",bt);C("mod",$i);C("equal",vf);C("notEqual",iT);C("lessThan",oT);C("greaterThan",Rf);C("lessThanEqual",aT);C("greaterThanEqual",uT);C("and",cT);C("or",lT);C("not",dT);C("xor",hT);C("bitAnd",pT);C("bitNot",fT);C("bitOr",mT);C("bitXor",gT);C("shiftLeft",xT);C("shiftRight",yT);C("incrementBefore",TT);C("decrementBefore",_T);C("increment",bT);C("decrement",ST);var NT=(i,e)=>(G('TSL: "modInt()" is deprecated. Use "mod( int( ... ) )" instead.'),$i(y(i),y(e)));C("modInt",NT);var v=class i extends ye{static get type(){return"MathNode"}constructor(e,t,s=null,n=null){if(super(),(e===i.MAX||e===i.MIN)&&arguments.length>3){let r=new i(e,t,s);for(let o=2;o<arguments.length-1;o++)r=new i(e,r,arguments[o]);t=r,s=arguments[arguments.length-1],n=null}this.method=e,this.aNode=t,this.bNode=s,this.cNode=n,this.isMathNode=!0}getInputType(e){let t=this.aNode.getNodeType(e),s=this.bNode?this.bNode.getNodeType(e):null,n=this.cNode?this.cNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),o=e.isMatrix(s)?0:e.getTypeLength(s),a=e.isMatrix(n)?0:e.getTypeLength(n);return r>o&&r>a?t:o>a?s:a>r?n:t}getNodeType(e){let t=this.method;return t===i.LENGTH||t===i.DISTANCE||t===i.DOT?"float":t===i.CROSS?"vec3":t===i.ALL||t===i.ANY?"bool":t===i.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){let{aNode:t,bNode:s,method:n}=this,r=null;if(n===i.ONE_MINUS)r=ee(1,t);else if(n===i.RECIPROCAL)r=bt(1,t);else if(n===i.DIFFERENCE)r=pe(ee(t,s));else if(n===i.TRANSFORM_DIRECTION){let o=t,a=s;e.isMatrix(o.getNodeType(e))?a=k(T(a),0):o=k(T(o),0);let u=K(o,a).xyz;r=ut(u)}return r!==null?r:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let n=this.method,r=this.getNodeType(e),o=this.getInputType(e),a=this.aNode,u=this.bNode,c=this.cNode,l=e.renderer.coordinateSystem;if(n===i.NEGATE)return e.format("( - "+a.build(e,o)+" )",r,t);{let d=[];return n===i.CROSS?d.push(a.build(e,r),u.build(e,r)):l===zr&&n===i.STEP?d.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":o),u.build(e,o)):l===zr&&(n===i.MIN||n===i.MAX)?d.push(a.build(e,o),u.build(e,e.getTypeLength(u.getNodeType(e))===1?"float":o)):n===i.REFRACT?d.push(a.build(e,o),u.build(e,o),c.build(e,"float")):n===i.MIX?d.push(a.build(e,o),u.build(e,o),c.build(e,e.getTypeLength(c.getNodeType(e))===1?"float":o)):(l===Ss&&n===i.ATAN&&u!==null&&(n="atan2"),e.shaderStage!=="fragment"&&(n===i.DFDX||n===i.DFDY)&&(G(`TSL: '${n}' is not supported in the ${e.shaderStage} stage.`),n="/*"+n+"*/"),d.push(a.build(e,o)),u!==null&&d.push(u.build(e,o)),c!==null&&d.push(c.build(e,o))),e.format(`${e.getMethod(n,r)}( ${d.join(", ")} )`,r,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};v.ALL="all";v.ANY="any";v.RADIANS="radians";v.DEGREES="degrees";v.EXP="exp";v.EXP2="exp2";v.LOG="log";v.LOG2="log2";v.SQRT="sqrt";v.INVERSE_SQRT="inversesqrt";v.FLOOR="floor";v.CEIL="ceil";v.NORMALIZE="normalize";v.FRACT="fract";v.SIN="sin";v.COS="cos";v.TAN="tan";v.ASIN="asin";v.ACOS="acos";v.ATAN="atan";v.ABS="abs";v.SIGN="sign";v.LENGTH="length";v.NEGATE="negate";v.ONE_MINUS="oneMinus";v.DFDX="dFdx";v.DFDY="dFdy";v.ROUND="round";v.RECIPROCAL="reciprocal";v.TRUNC="trunc";v.FWIDTH="fwidth";v.TRANSPOSE="transpose";v.DETERMINANT="determinant";v.INVERSE="inverse";v.EQUALS="equals";v.MIN="min";v.MAX="max";v.STEP="step";v.REFLECT="reflect";v.DISTANCE="distance";v.DIFFERENCE="difference";v.DOT="dot";v.CROSS="cross";v.POW="pow";v.TRANSFORM_DIRECTION="transformDirection";v.MIX="mix";v.CLAMP="clamp";v.REFRACT="refract";v.SMOOTHSTEP="smoothstep";v.FACEFORWARD="faceforward";var Af=m(1e-6),mS=m(1e6),Sa=m(Math.PI),gS=m(Math.PI*2),xS=m(Math.PI*2),yS=m(Math.PI*.5),vT=P(v,v.ALL).setParameterLength(1),RT=P(v,v.ANY).setParameterLength(1),AT=P(v,v.RADIANS).setParameterLength(1),CT=P(v,v.DEGREES).setParameterLength(1),Cf=P(v,v.EXP).setParameterLength(1),mr=P(v,v.EXP2).setParameterLength(1),vu=P(v,v.LOG).setParameterLength(1),is=P(v,v.LOG2).setParameterLength(1),tt=P(v,v.SQRT).setParameterLength(1),wf=P(v,v.INVERSE_SQRT).setParameterLength(1),os=P(v,v.FLOOR).setParameterLength(1),Ru=P(v,v.CEIL).setParameterLength(1),ut=P(v,v.NORMALIZE).setParameterLength(1),$t=P(v,v.FRACT).setParameterLength(1),rt=P(v,v.SIN).setParameterLength(1),Gt=P(v,v.COS).setParameterLength(1),wT=P(v,v.TAN).setParameterLength(1),ET=P(v,v.ASIN).setParameterLength(1),Ef=P(v,v.ACOS).setParameterLength(1),Au=P(v,v.ATAN).setParameterLength(1,2),pe=P(v,v.ABS).setParameterLength(1),Mf=P(v,v.SIGN).setParameterLength(1),as=P(v,v.LENGTH).setParameterLength(1),Bf=P(v,v.NEGATE).setParameterLength(1),MT=P(v,v.ONE_MINUS).setParameterLength(1),Ff=P(v,v.DFDX).setParameterLength(1),Df=P(v,v.DFDY).setParameterLength(1),BT=P(v,v.ROUND).setParameterLength(1),FT=P(v,v.RECIPROCAL).setParameterLength(1),Lf=P(v,v.TRUNC).setParameterLength(1),Pf=P(v,v.FWIDTH).setParameterLength(1),DT=P(v,v.TRANSPOSE).setParameterLength(1),LT=P(v,v.DETERMINANT).setParameterLength(1),PT=P(v,v.INVERSE).setParameterLength(1),UT=(i,e)=>(G('TSL: "equals" is deprecated. Use "equal" inside a vector instead, like: "bvec*( equal( ... ) )"'),vf(i,e)),dt=P(v,v.MIN).setParameterLength(2,1/0),ve=P(v,v.MAX).setParameterLength(2,1/0),Cu=P(v,v.STEP).setParameterLength(2),IT=P(v,v.REFLECT).setParameterLength(2),VT=P(v,v.DISTANCE).setParameterLength(2),OT=P(v,v.DIFFERENCE).setParameterLength(2),Lt=P(v,v.DOT).setParameterLength(2),Us=P(v,v.CROSS).setParameterLength(2),Mt=P(v,v.POW).setParameterLength(2),Uf=i=>K(i,i),GT=i=>K(i,i,i),If=i=>K(i,i,i,i),kT=P(v,v.TRANSFORM_DIRECTION).setParameterLength(2),zT=i=>K(Mf(i),Mt(pe(i),1/3)),Vf=i=>Lt(i,i),J=P(v,v.MIX).setParameterLength(3),Wt=(i,e=0,t=1)=>O(new v(v.CLAMP,O(i),O(e),O(t))),wu=i=>Wt(i),Of=P(v,v.REFRACT).setParameterLength(3),St=P(v,v.SMOOTHSTEP).setParameterLength(3),Gf=P(v,v.FACEFORWARD).setParameterLength(3),$T=S(([i])=>{let s=43758.5453,n=Lt(i.xy,L(12.9898,78.233)),r=$i(n,Sa);return $t(rt(r).mul(s))}),WT=(i,e,t)=>J(e,t,i),qT=(i,e,t)=>St(e,t,i),HT=(i,e)=>Cu(e,i),XT=(i,e)=>(G('TSL: "atan2" is overloaded. Use "atan" instead.'),Au(i,e)),TS=Gf,_S=wf;C("all",vT);C("any",RT);C("equals",UT);C("radians",AT);C("degrees",CT);C("exp",Cf);C("exp2",mr);C("log",vu);C("log2",is);C("sqrt",tt);C("inverseSqrt",wf);C("floor",os);C("ceil",Ru);C("normalize",ut);C("fract",$t);C("sin",rt);C("cos",Gt);C("tan",wT);C("asin",ET);C("acos",Ef);C("atan",Au);C("abs",pe);C("sign",Mf);C("length",as);C("lengthSq",Vf);C("negate",Bf);C("oneMinus",MT);C("dFdx",Ff);C("dFdy",Df);C("round",BT);C("reciprocal",FT);C("trunc",Lf);C("fwidth",Pf);C("atan2",XT);C("min",dt);C("max",ve);C("step",HT);C("reflect",IT);C("distance",VT);C("dot",Lt);C("cross",Us);C("pow",Mt);C("pow2",Uf);C("pow3",GT);C("pow4",If);C("transformDirection",kT);C("mix",WT);C("clamp",Wt);C("refract",Of);C("smoothstep",qT);C("faceForward",Gf);C("difference",OT);C("saturate",wu);C("cbrt",zT);C("transpose",DT);C("determinant",LT);C("inverse",PT);C("rand",$T);var Dl=class extends ${static get type(){return"ConditionalNode"}constructor(e,t,s=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=s}getNodeType(e){let{ifNode:t,elseNode:s}=e.getNodeProperties(this);if(t===void 0)return e.flowBuildStage(this,"setup"),this.getNodeType(e);let n=t.getNodeType(e);if(s!==null){let r=s.getNodeType(e);if(e.getTypeLength(r)>e.getTypeLength(n))return r}return n}setup(e){let t=this.condNode,s=this.ifNode.isolate(),n=this.elseNode?this.elseNode.isolate():null,r=e.context.nodeBlock;e.getDataFromNode(s).parentNodeBlock=r,n!==null&&(e.getDataFromNode(n).parentNodeBlock=r);let o=e.context.uniformFlow,a=e.getNodeProperties(this);a.condNode=t,a.ifNode=o?s:s.context({nodeBlock:s}),a.elseNode=n?o?n:n.context({nodeBlock:n}):null}generate(e,t){let s=this.getNodeType(e),n=e.getDataFromNode(this);if(n.nodeProperty!==void 0)return n.nodeProperty;let{condNode:r,ifNode:o,elseNode:a}=e.getNodeProperties(this),u=e.currentFunctionNode,c=t!=="void",l=c?zt(s).build(e):"";n.nodeProperty=l;let d=r.build(e,"bool");if(e.context.