playermap_graph 0.2.11 → 0.2.12

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/index.umd.js CHANGED
@@ -77,7 +77,7 @@ spurious results.`)}}return!1};let _b=class{constructor(e,n="GraphQL request",i=
77
77
  `))}function xb(r){var e;return(e=r==null?void 0:r.some(n=>n.includes(`
78
78
  `)))!==null&&e!==void 0?e:!1}const bb="Accept",Rm="Content-Type",Nm="application/json",Sb="application/graphql-response+json",Tb=r=>r.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),gP=r=>{const e=r.toLowerCase();return e.includes(Sb)||e.includes(Nm)},wb=r=>{try{if(Array.isArray(r))return{_tag:"Batch",executionResults:r.map(Mb)};if(Bh(r))return{_tag:"Single",executionResult:Mb(r)};throw new Error(`Invalid execution result: result is not object or array.
79
79
  Got:
80
- ${String(r)}`)}catch(e){return e}},Mb=r=>{if(typeof r!="object"||r===null)throw new Error("Invalid execution result: result is not object");let e,n,i;if("errors"in r){if(!Bh(r.errors)&&!Array.isArray(r.errors))throw new Error("Invalid execution result: errors is not plain object OR array");e=r.errors}if("data"in r){if(!Bh(r.data)&&r.data!==null)throw new Error("Invalid execution result: data is not plain object");n=r.data}if("extensions"in r){if(!Bh(r.extensions))throw new Error("Invalid execution result: extensions is not plain object");i=r.extensions}return{data:n,errors:e,extensions:i}},yP=r=>r._tag==="Batch"?r.executionResults.some(Eb):Eb(r.executionResult),Eb=r=>Array.isArray(r.errors)?r.errors.length>0:!!r.errors,Ab=r=>typeof r=="object"&&r!==null&&"kind"in r&&r.kind===it.OPERATION_DEFINITION,_P=r=>{var i;let e;const n=r.definitions.filter(Ab);return n.length===1&&(e=(i=n[0].name)==null?void 0:i.value),e},vP=r=>{let e=!1;const n=r.definitions.filter(Ab);return n.length===1&&(e=n[0].operation===jo.MUTATION),e},Pm=(r,e)=>{const n=typeof r=="string"?r:fP(r);let i=!1,s;if(e)return{expression:n,isMutation:i,operationName:s};const o=wN(()=>typeof r=="string"?rP(r):r);return o instanceof Error?{expression:n,isMutation:i,operationName:s}:(s=_P(o),i=vP(o),{expression:n,operationName:s,isMutation:i})},Dm=JSON,Im=async r=>{const e={...r,method:r.request._tag==="Single"?r.request.document.isMutation?"POST":ib(r.method??"post"):r.request.hasMutations?"POST":ib(r.method??"post"),fetchOptions:{...r.fetchOptions,errorPolicy:r.fetchOptions.errorPolicy??"none"}},i=await bP(e.method)(e);if(!i.ok)return new $a({status:i.status,headers:i.headers},{query:r.request._tag==="Single"?r.request.document.expression:r.request.query,variables:r.request.variables});const s=await xP(i,r.fetchOptions.jsonSerializer??Dm);if(s instanceof Error)throw s;const o={status:i.status,headers:i.headers};if(yP(s)&&e.fetchOptions.errorPolicy==="none"){const a=s._tag==="Batch"?{...s.executionResults,...o}:{...s.executionResult,...o};return new $a(a,{query:r.request._tag==="Single"?r.request.document.expression:r.request.query,variables:r.request.variables})}switch(s._tag){case"Single":return{...o,...Cb(e)(s.executionResult)};case"Batch":return{...o,data:s.executionResults.map(Cb(e))};default:Sm(s)}},Cb=r=>e=>({extensions:e.extensions,data:e.data,errors:r.fetchOptions.errorPolicy==="all"?e.errors:void 0}),xP=async(r,e)=>{const n=r.headers.get(Rm),i=await r.text();return n&&gP(n)?wb(e.parse(i)):wb(i)},bP=r=>async e=>{const n=new Headers(e.headers);let i=null,s;n.has(bb)||n.set(bb,[Sb,Nm].join(", ")),r==="POST"?(s=(e.fetchOptions.jsonSerializer??Dm).stringify(SP(e)),typeof s=="string"&&!n.has(Rm)&&n.set(Rm,Nm)):i=TP(e);const o={method:r,headers:n,body:s,...e.fetchOptions};let a=new URL(e.url),l=o;if(e.middleware){const u=await Promise.resolve(e.middleware({...o,url:e.url,operationName:e.request._tag==="Single"?e.request.document.operationName:void 0,variables:e.request.variables})),{url:h,...d}=u;a=new URL(h),l=d}return i&&i.forEach((u,h)=>{a.searchParams.append(h,u)}),await(e.fetch??fetch)(a,l)},SP=r=>{switch(r.request._tag){case"Single":return{query:r.request.document.expression,variables:r.request.variables,operationName:r.request.document.operationName};case"Batch":return rb(r.request.query,r.request.variables??[]).map(([e,n])=>({query:e,variables:n}));default:throw Sm(r.request)}},TP=r=>{var i;const e=r.fetchOptions.jsonSerializer??Dm,n=new URLSearchParams;switch(r.request._tag){case"Single":return n.append("query",Tb(r.request.document.expression)),r.request.variables&&n.append("variables",e.stringify(r.request.variables)),r.request.document.operationName&&n.append("operationName",r.request.document.operationName),n;case"Batch":{const s=((i=r.request.variables)==null?void 0:i.map(l=>e.stringify(l)))??[],o=r.request.query.map(Tb),a=rb(o,s).map(([l,c])=>({query:l,variables:c}));return n.append("query",e.stringify(a)),n}default:throw Sm(r.request)}};class Lm{constructor(e,n={}){Lc(this,"url");Lc(this,"requestConfig");Lc(this,"rawRequest",async(...e)=>{const[n,i,s]=e,o=AN(n,i,s),{headers:a,fetch:l=globalThis.fetch,method:c="POST",requestMiddleware:u,responseMiddleware:h,excludeOperationName:d,...f}=this.requestConfig,{url:p}=this;o.signal!==void 0&&(f.signal=o.signal);const m=Pm(o.query,d),_=await Im({url:p,request:{_tag:"Single",document:m,variables:o.variables},headers:{...ja(bm(a)),...ja(o.requestHeaders)},fetch:l,method:c,fetchOptions:f,middleware:u});if(h&&await h(_,{operationName:m.operationName,variables:i,url:this.url}),_ instanceof Error)throw _;return _});this.url=e,this.requestConfig=n}async request(e,...n){const[i,s]=n,o=wP(e,i,s),{headers:a,fetch:l=globalThis.fetch,method:c="POST",requestMiddleware:u,responseMiddleware:h,excludeOperationName:d,...f}=this.requestConfig,{url:p}=this;o.signal!==void 0&&(f.signal=o.signal);const m=Pm(o.document,d),_=await Im({url:p,request:{_tag:"Single",document:m,variables:o.variables},headers:{...ja(bm(a)),...ja(o.requestHeaders)},fetch:l,method:c,fetchOptions:f,middleware:u});if(h&&await h(_,{operationName:m.operationName,variables:o.variables,url:this.url}),_ instanceof Error)throw _;return _.data}async batchRequests(e,n){const i=EN(e,n),{headers:s,excludeOperationName:o,...a}=this.requestConfig;i.signal!==void 0&&(a.signal=i.signal);const l=i.documents.map(({document:f})=>Pm(f,o)),c=l.map(({expression:f})=>f),u=l.some(({isMutation:f})=>f),h=i.documents.map(({variables:f})=>f),d=await Im({url:this.url,request:{_tag:"Batch",operationName:void 0,query:c,hasMutations:u,variables:h},headers:{...ja(bm(s)),...ja(i.requestHeaders)},fetch:this.requestConfig.fetch??globalThis.fetch,method:this.requestConfig.method||"POST",fetchOptions:a,middleware:this.requestConfig.requestMiddleware});if(this.requestConfig.responseMiddleware&&await this.requestConfig.responseMiddleware(d,{operationName:void 0,variables:h,url:this.url}),d instanceof Error)throw d;return d.data}setHeaders(e){return this.requestConfig.headers=e,this}setHeader(e,n){const{headers:i}=this.requestConfig;return i?i[e]=n:this.requestConfig.headers={[e]:n},this}setEndpoint(e){return this.url=e,this}}const wP=(r,e,n)=>r.document?r:{document:r,variables:e,requestHeaders:n,signal:void 0},en=(r,...e)=>r.reduce((n,i,s)=>`${n}${i}${s in e?String(e[s]):""}`,""),MP={"0x15fd51c3248baf65414b97a52ff4302e653bd4f765e6784fd5eb4906ea322390":"Boss Fighters"},EP={"0x8df2369b088fbd3e1a6e238fe9337348b4adeb0defd4a63362ed8726ab03be65":"Spellcaster Studio"},Kr="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Crect width='100' height='100' fill='%2322c55e'/%3E%3C/svg%3E",Nr=r=>{if(!r)return{status:"normal"};const e=r.toLowerCase().trim();for(const[n,i]of Object.entries(MP))if(e===n.toLowerCase())return{status:"verified",studio:i};for(const[n]of Object.entries(EP))if(e===n.toLowerCase())return{status:"not-verified"};return{status:"normal"}},Rb={base:{url:" https://prod.base.intuition-api.com/v1/graphql",displayName:"Base Mainnet"}},zc=r=>new Lm(Rb[r].url),Wo=r=>!r||!r.id?r:Nr(r.id).status==="not-verified"?{...r,image:Kr}:r,AP=Object.freeze(Object.defineProperty({__proto__:null,ENDPOINTS:Rb,createClient:zc,fetchAtomDetails:async(r,e="baseSepolia")=>{const n=zc(e);let i;i=en`
80
+ ${String(r)}`)}catch(e){return e}},Mb=r=>{if(typeof r!="object"||r===null)throw new Error("Invalid execution result: result is not object");let e,n,i;if("errors"in r){if(!Bh(r.errors)&&!Array.isArray(r.errors))throw new Error("Invalid execution result: errors is not plain object OR array");e=r.errors}if("data"in r){if(!Bh(r.data)&&r.data!==null)throw new Error("Invalid execution result: data is not plain object");n=r.data}if("extensions"in r){if(!Bh(r.extensions))throw new Error("Invalid execution result: extensions is not plain object");i=r.extensions}return{data:n,errors:e,extensions:i}},yP=r=>r._tag==="Batch"?r.executionResults.some(Eb):Eb(r.executionResult),Eb=r=>Array.isArray(r.errors)?r.errors.length>0:!!r.errors,Ab=r=>typeof r=="object"&&r!==null&&"kind"in r&&r.kind===it.OPERATION_DEFINITION,_P=r=>{var i;let e;const n=r.definitions.filter(Ab);return n.length===1&&(e=(i=n[0].name)==null?void 0:i.value),e},vP=r=>{let e=!1;const n=r.definitions.filter(Ab);return n.length===1&&(e=n[0].operation===jo.MUTATION),e},Pm=(r,e)=>{const n=typeof r=="string"?r:fP(r);let i=!1,s;if(e)return{expression:n,isMutation:i,operationName:s};const o=wN(()=>typeof r=="string"?rP(r):r);return o instanceof Error?{expression:n,isMutation:i,operationName:s}:(s=_P(o),i=vP(o),{expression:n,operationName:s,isMutation:i})},Dm=JSON,Im=async r=>{const e={...r,method:r.request._tag==="Single"?r.request.document.isMutation?"POST":ib(r.method??"post"):r.request.hasMutations?"POST":ib(r.method??"post"),fetchOptions:{...r.fetchOptions,errorPolicy:r.fetchOptions.errorPolicy??"none"}},i=await bP(e.method)(e);if(!i.ok)return new $a({status:i.status,headers:i.headers},{query:r.request._tag==="Single"?r.request.document.expression:r.request.query,variables:r.request.variables});const s=await xP(i,r.fetchOptions.jsonSerializer??Dm);if(s instanceof Error)throw s;const o={status:i.status,headers:i.headers};if(yP(s)&&e.fetchOptions.errorPolicy==="none"){const a=s._tag==="Batch"?{...s.executionResults,...o}:{...s.executionResult,...o};return new $a(a,{query:r.request._tag==="Single"?r.request.document.expression:r.request.query,variables:r.request.variables})}switch(s._tag){case"Single":return{...o,...Cb(e)(s.executionResult)};case"Batch":return{...o,data:s.executionResults.map(Cb(e))};default:Sm(s)}},Cb=r=>e=>({extensions:e.extensions,data:e.data,errors:r.fetchOptions.errorPolicy==="all"?e.errors:void 0}),xP=async(r,e)=>{const n=r.headers.get(Rm),i=await r.text();return n&&gP(n)?wb(e.parse(i)):wb(i)},bP=r=>async e=>{const n=new Headers(e.headers);let i=null,s;n.has(bb)||n.set(bb,[Sb,Nm].join(", ")),r==="POST"?(s=(e.fetchOptions.jsonSerializer??Dm).stringify(SP(e)),typeof s=="string"&&!n.has(Rm)&&n.set(Rm,Nm)):i=TP(e);const o={method:r,headers:n,body:s,...e.fetchOptions};let a=new URL(e.url),l=o;if(e.middleware){const u=await Promise.resolve(e.middleware({...o,url:e.url,operationName:e.request._tag==="Single"?e.request.document.operationName:void 0,variables:e.request.variables})),{url:h,...d}=u;a=new URL(h),l=d}return i&&i.forEach((u,h)=>{a.searchParams.append(h,u)}),await(e.fetch??fetch)(a,l)},SP=r=>{switch(r.request._tag){case"Single":return{query:r.request.document.expression,variables:r.request.variables,operationName:r.request.document.operationName};case"Batch":return rb(r.request.query,r.request.variables??[]).map(([e,n])=>({query:e,variables:n}));default:throw Sm(r.request)}},TP=r=>{var i;const e=r.fetchOptions.jsonSerializer??Dm,n=new URLSearchParams;switch(r.request._tag){case"Single":return n.append("query",Tb(r.request.document.expression)),r.request.variables&&n.append("variables",e.stringify(r.request.variables)),r.request.document.operationName&&n.append("operationName",r.request.document.operationName),n;case"Batch":{const s=((i=r.request.variables)==null?void 0:i.map(l=>e.stringify(l)))??[],o=r.request.query.map(Tb),a=rb(o,s).map(([l,c])=>({query:l,variables:c}));return n.append("query",e.stringify(a)),n}default:throw Sm(r.request)}};class Lm{constructor(e,n={}){Lc(this,"url");Lc(this,"requestConfig");Lc(this,"rawRequest",async(...e)=>{const[n,i,s]=e,o=AN(n,i,s),{headers:a,fetch:l=globalThis.fetch,method:c="POST",requestMiddleware:u,responseMiddleware:h,excludeOperationName:d,...f}=this.requestConfig,{url:p}=this;o.signal!==void 0&&(f.signal=o.signal);const m=Pm(o.query,d),_=await Im({url:p,request:{_tag:"Single",document:m,variables:o.variables},headers:{...ja(bm(a)),...ja(o.requestHeaders)},fetch:l,method:c,fetchOptions:f,middleware:u});if(h&&await h(_,{operationName:m.operationName,variables:i,url:this.url}),_ instanceof Error)throw _;return _});this.url=e,this.requestConfig=n}async request(e,...n){const[i,s]=n,o=wP(e,i,s),{headers:a,fetch:l=globalThis.fetch,method:c="POST",requestMiddleware:u,responseMiddleware:h,excludeOperationName:d,...f}=this.requestConfig,{url:p}=this;o.signal!==void 0&&(f.signal=o.signal);const m=Pm(o.document,d),_=await Im({url:p,request:{_tag:"Single",document:m,variables:o.variables},headers:{...ja(bm(a)),...ja(o.requestHeaders)},fetch:l,method:c,fetchOptions:f,middleware:u});if(h&&await h(_,{operationName:m.operationName,variables:o.variables,url:this.url}),_ instanceof Error)throw _;return _.data}async batchRequests(e,n){const i=EN(e,n),{headers:s,excludeOperationName:o,...a}=this.requestConfig;i.signal!==void 0&&(a.signal=i.signal);const l=i.documents.map(({document:f})=>Pm(f,o)),c=l.map(({expression:f})=>f),u=l.some(({isMutation:f})=>f),h=i.documents.map(({variables:f})=>f),d=await Im({url:this.url,request:{_tag:"Batch",operationName:void 0,query:c,hasMutations:u,variables:h},headers:{...ja(bm(s)),...ja(i.requestHeaders)},fetch:this.requestConfig.fetch??globalThis.fetch,method:this.requestConfig.method||"POST",fetchOptions:a,middleware:this.requestConfig.requestMiddleware});if(this.requestConfig.responseMiddleware&&await this.requestConfig.responseMiddleware(d,{operationName:void 0,variables:h,url:this.url}),d instanceof Error)throw d;return d.data}setHeaders(e){return this.requestConfig.headers=e,this}setHeader(e,n){const{headers:i}=this.requestConfig;return i?i[e]=n:this.requestConfig.headers={[e]:n},this}setEndpoint(e){return this.url=e,this}}const wP=(r,e,n)=>r.document?r:{document:r,variables:e,requestHeaders:n,signal:void 0},en=(r,...e)=>r.reduce((n,i,s)=>`${n}${i}${s in e?String(e[s]):""}`,""),MP={"0x15fd51c3248baf65414b97a52ff4302e653bd4f765e6784fd5eb4906ea322390":"Boss Fighters"},EP={"0x8df2369b088fbd3e1a6e238fe9337348b4adeb0defd4a63362ed8726ab03be65":"Spellcaster Studio","0x744c083e5713cd66d7c1ec3ff64e50088285709fac3d2903f20d4f37c6a351e2":"Quantic Dream"},Kr="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Crect width='100' height='100' fill='%2322c55e'/%3E%3C/svg%3E",Nr=r=>{if(!r)return{status:"normal"};const e=r.toLowerCase().trim();for(const[n,i]of Object.entries(MP))if(e===n.toLowerCase())return{status:"verified",studio:i};for(const[n]of Object.entries(EP))if(e===n.toLowerCase())return{status:"not-verified"};return{status:"normal"}},Rb={base:{url:" https://prod.base.intuition-api.com/v1/graphql",displayName:"Base Mainnet"}},zc=r=>new Lm(Rb[r].url),Wo=r=>!r||!r.id?r:Nr(r.id).status==="not-verified"?{...r,image:Kr}:r,AP=Object.freeze(Object.defineProperty({__proto__:null,ENDPOINTS:Rb,createClient:zc,fetchAtomDetails:async(r,e="baseSepolia")=>{const n=zc(e);let i;i=en`
81
81
  query GetAtom($atomId: numeric!) {
82
82
  atom(id: $atomId) {
83
83
  id
@@ -1960,7 +1960,7 @@ IncidentLight directLight;
1960
1960
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1961
1961
  if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1962
1962
  }
1963
- #endif`,eO=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1963
+ #endif`,e3=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1964
1964
  #ifdef FLAT_SHADED
1965
1965
  vec3 fdx = dFdx( vViewPosition );
1966
1966
  vec3 fdy = dFdy( vViewPosition );
@@ -2001,7 +2001,7 @@ IncidentLight directLight;
2001
2001
  tbn2[1] *= faceDirection;
2002
2002
  #endif
2003
2003
  #endif
2004
- vec3 nonPerturbedNormal = normal;`,tO=`#ifdef USE_NORMALMAP_OBJECTSPACE
2004
+ vec3 nonPerturbedNormal = normal;`,t3=`#ifdef USE_NORMALMAP_OBJECTSPACE
2005
2005
  normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
2006
2006
  #ifdef FLIP_SIDED
2007
2007
  normal = - normal;
@@ -2016,25 +2016,25 @@ vec3 nonPerturbedNormal = normal;`,tO=`#ifdef USE_NORMALMAP_OBJECTSPACE
2016
2016
  normal = normalize( tbn * mapN );
2017
2017
  #elif defined( USE_BUMPMAP )
2018
2018
  normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
2019
- #endif`,nO=`#ifndef FLAT_SHADED
2019
+ #endif`,n3=`#ifndef FLAT_SHADED
2020
2020
  varying vec3 vNormal;
2021
2021
  #ifdef USE_TANGENT
2022
2022
  varying vec3 vTangent;
2023
2023
  varying vec3 vBitangent;
2024
2024
  #endif
2025
- #endif`,iO=`#ifndef FLAT_SHADED
2025
+ #endif`,i3=`#ifndef FLAT_SHADED
2026
2026
  varying vec3 vNormal;
2027
2027
  #ifdef USE_TANGENT
2028
2028
  varying vec3 vTangent;
2029
2029
  varying vec3 vBitangent;
2030
2030
  #endif
2031
- #endif`,rO=`#ifndef FLAT_SHADED
2031
+ #endif`,r3=`#ifndef FLAT_SHADED
2032
2032
  vNormal = normalize( transformedNormal );
2033
2033
  #ifdef USE_TANGENT
2034
2034
  vTangent = normalize( transformedTangent );
2035
2035
  vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
2036
2036
  #endif
2037
- #endif`,sO=`#ifdef USE_NORMALMAP
2037
+ #endif`,s3=`#ifdef USE_NORMALMAP
2038
2038
  uniform sampler2D normalMap;
2039
2039
  uniform vec2 normalScale;
2040
2040
  #endif
@@ -2056,13 +2056,13 @@ vec3 nonPerturbedNormal = normal;`,tO=`#ifdef USE_NORMALMAP_OBJECTSPACE
2056
2056
  float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
2057
2057
  return mat3( T * scale, B * scale, N );
2058
2058
  }
2059
- #endif`,oO=`#ifdef USE_CLEARCOAT
2059
+ #endif`,o3=`#ifdef USE_CLEARCOAT
2060
2060
  vec3 clearcoatNormal = nonPerturbedNormal;
2061
- #endif`,aO=`#ifdef USE_CLEARCOAT_NORMALMAP
2061
+ #endif`,a3=`#ifdef USE_CLEARCOAT_NORMALMAP
2062
2062
  vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
2063
2063
  clearcoatMapN.xy *= clearcoatNormalScale;
2064
2064
  clearcoatNormal = normalize( tbn2 * clearcoatMapN );
2065
- #endif`,lO=`#ifdef USE_CLEARCOATMAP
2065
+ #endif`,l3=`#ifdef USE_CLEARCOATMAP
2066
2066
  uniform sampler2D clearcoatMap;
2067
2067
  #endif
2068
2068
  #ifdef USE_CLEARCOAT_NORMALMAP
@@ -2071,18 +2071,18 @@ vec3 nonPerturbedNormal = normal;`,tO=`#ifdef USE_NORMALMAP_OBJECTSPACE
2071
2071
  #endif
2072
2072
  #ifdef USE_CLEARCOAT_ROUGHNESSMAP
2073
2073
  uniform sampler2D clearcoatRoughnessMap;
2074
- #endif`,cO=`#ifdef USE_IRIDESCENCEMAP
2074
+ #endif`,c3=`#ifdef USE_IRIDESCENCEMAP
2075
2075
  uniform sampler2D iridescenceMap;
2076
2076
  #endif
2077
2077
  #ifdef USE_IRIDESCENCE_THICKNESSMAP
2078
2078
  uniform sampler2D iridescenceThicknessMap;
2079
- #endif`,uO=`#ifdef OPAQUE
2079
+ #endif`,u3=`#ifdef OPAQUE
2080
2080
  diffuseColor.a = 1.0;
2081
2081
  #endif
2082
2082
  #ifdef USE_TRANSMISSION
2083
2083
  diffuseColor.a *= material.transmissionAlpha;
2084
2084
  #endif
2085
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,hO=`vec3 packNormalToRGB( const in vec3 normal ) {
2085
+ gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,h3=`vec3 packNormalToRGB( const in vec3 normal ) {
2086
2086
  return normalize( normal ) * 0.5 + 0.5;
2087
2087
  }
2088
2088
  vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -2151,9 +2151,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const
2151
2151
  }
2152
2152
  float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
2153
2153
  return ( near * far ) / ( ( far - near ) * depth - far );
2154
- }`,dO=`#ifdef PREMULTIPLIED_ALPHA
2154
+ }`,d3=`#ifdef PREMULTIPLIED_ALPHA
2155
2155
  gl_FragColor.rgb *= gl_FragColor.a;
2156
- #endif`,fO=`vec4 mvPosition = vec4( transformed, 1.0 );
2156
+ #endif`,f3=`vec4 mvPosition = vec4( transformed, 1.0 );
2157
2157
  #ifdef USE_BATCHING
2158
2158
  mvPosition = batchingMatrix * mvPosition;
2159
2159
  #endif
@@ -2161,22 +2161,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
2161
2161
  mvPosition = instanceMatrix * mvPosition;
2162
2162
  #endif
2163
2163
  mvPosition = modelViewMatrix * mvPosition;
2164
- gl_Position = projectionMatrix * mvPosition;`,pO=`#ifdef DITHERING
2164
+ gl_Position = projectionMatrix * mvPosition;`,p3=`#ifdef DITHERING
2165
2165
  gl_FragColor.rgb = dithering( gl_FragColor.rgb );
2166
- #endif`,mO=`#ifdef DITHERING
2166
+ #endif`,m3=`#ifdef DITHERING
2167
2167
  vec3 dithering( vec3 color ) {
2168
2168
  float grid_position = rand( gl_FragCoord.xy );
2169
2169
  vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
2170
2170
  dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
2171
2171
  return color + dither_shift_RGB;
2172
2172
  }
2173
- #endif`,gO=`float roughnessFactor = roughness;
2173
+ #endif`,g3=`float roughnessFactor = roughness;
2174
2174
  #ifdef USE_ROUGHNESSMAP
2175
2175
  vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
2176
2176
  roughnessFactor *= texelRoughness.g;
2177
- #endif`,yO=`#ifdef USE_ROUGHNESSMAP
2177
+ #endif`,y3=`#ifdef USE_ROUGHNESSMAP
2178
2178
  uniform sampler2D roughnessMap;
2179
- #endif`,_O=`#if NUM_SPOT_LIGHT_COORDS > 0
2179
+ #endif`,_3=`#if NUM_SPOT_LIGHT_COORDS > 0
2180
2180
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
2181
2181
  #endif
2182
2182
  #if NUM_SPOT_LIGHT_MAPS > 0
@@ -2362,7 +2362,7 @@ gl_Position = projectionMatrix * mvPosition;`,pO=`#ifdef DITHERING
2362
2362
  }
2363
2363
  return mix( 1.0, shadow, shadowIntensity );
2364
2364
  }
2365
- #endif`,vO=`#if NUM_SPOT_LIGHT_COORDS > 0
2365
+ #endif`,v3=`#if NUM_SPOT_LIGHT_COORDS > 0
2366
2366
  uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
2367
2367
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
2368
2368
  #endif
@@ -2403,7 +2403,7 @@ gl_Position = projectionMatrix * mvPosition;`,pO=`#ifdef DITHERING
2403
2403
  };
2404
2404
  uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2405
2405
  #endif
2406
- #endif`,xO=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2406
+ #endif`,x3=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2407
2407
  vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
2408
2408
  vec4 shadowWorldPosition;
2409
2409
  #endif
@@ -2435,7 +2435,7 @@ gl_Position = projectionMatrix * mvPosition;`,pO=`#ifdef DITHERING
2435
2435
  vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2436
2436
  }
2437
2437
  #pragma unroll_loop_end
2438
- #endif`,bO=`float getShadowMask() {
2438
+ #endif`,b3=`float getShadowMask() {
2439
2439
  float shadow = 1.0;
2440
2440
  #ifdef USE_SHADOWMAP
2441
2441
  #if NUM_DIR_LIGHT_SHADOWS > 0
@@ -2467,12 +2467,12 @@ gl_Position = projectionMatrix * mvPosition;`,pO=`#ifdef DITHERING
2467
2467
  #endif
2468
2468
  #endif
2469
2469
  return shadow;
2470
- }`,SO=`#ifdef USE_SKINNING
2470
+ }`,S3=`#ifdef USE_SKINNING
2471
2471
  mat4 boneMatX = getBoneMatrix( skinIndex.x );
2472
2472
  mat4 boneMatY = getBoneMatrix( skinIndex.y );
2473
2473
  mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2474
2474
  mat4 boneMatW = getBoneMatrix( skinIndex.w );
2475
- #endif`,TO=`#ifdef USE_SKINNING
2475
+ #endif`,T3=`#ifdef USE_SKINNING
2476
2476
  uniform mat4 bindMatrix;
2477
2477
  uniform mat4 bindMatrixInverse;
2478
2478
  uniform highp sampler2D boneTexture;
@@ -2487,7 +2487,7 @@ gl_Position = projectionMatrix * mvPosition;`,pO=`#ifdef DITHERING
2487
2487
  vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2488
2488
  return mat4( v1, v2, v3, v4 );
2489
2489
  }
2490
- #endif`,wO=`#ifdef USE_SKINNING
2490
+ #endif`,w3=`#ifdef USE_SKINNING
2491
2491
  vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2492
2492
  vec4 skinned = vec4( 0.0 );
2493
2493
  skinned += boneMatX * skinVertex * skinWeight.x;
@@ -2495,7 +2495,7 @@ gl_Position = projectionMatrix * mvPosition;`,pO=`#ifdef DITHERING
2495
2495
  skinned += boneMatZ * skinVertex * skinWeight.z;
2496
2496
  skinned += boneMatW * skinVertex * skinWeight.w;
2497
2497
  transformed = ( bindMatrixInverse * skinned ).xyz;
2498
- #endif`,MO=`#ifdef USE_SKINNING
2498
+ #endif`,M3=`#ifdef USE_SKINNING
2499
2499
  mat4 skinMatrix = mat4( 0.0 );
2500
2500
  skinMatrix += skinWeight.x * boneMatX;
2501
2501
  skinMatrix += skinWeight.y * boneMatY;
@@ -2506,17 +2506,17 @@ gl_Position = projectionMatrix * mvPosition;`,pO=`#ifdef DITHERING
2506
2506
  #ifdef USE_TANGENT
2507
2507
  objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2508
2508
  #endif
2509
- #endif`,EO=`float specularStrength;
2509
+ #endif`,E3=`float specularStrength;
2510
2510
  #ifdef USE_SPECULARMAP
2511
2511
  vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2512
2512
  specularStrength = texelSpecular.r;
2513
2513
  #else
2514
2514
  specularStrength = 1.0;
2515
- #endif`,AO=`#ifdef USE_SPECULARMAP
2515
+ #endif`,A3=`#ifdef USE_SPECULARMAP
2516
2516
  uniform sampler2D specularMap;
2517
- #endif`,CO=`#if defined( TONE_MAPPING )
2517
+ #endif`,C3=`#if defined( TONE_MAPPING )
2518
2518
  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2519
- #endif`,RO=`#ifndef saturate
2519
+ #endif`,R3=`#ifndef saturate
2520
2520
  #define saturate( a ) clamp( a, 0.0, 1.0 )
2521
2521
  #endif
2522
2522
  uniform float toneMappingExposure;
@@ -2613,7 +2613,7 @@ vec3 NeutralToneMapping( vec3 color ) {
2613
2613
  float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2614
2614
  return mix( color, vec3( newPeak ), g );
2615
2615
  }
2616
- vec3 CustomToneMapping( vec3 color ) { return color; }`,NO=`#ifdef USE_TRANSMISSION
2616
+ vec3 CustomToneMapping( vec3 color ) { return color; }`,N3=`#ifdef USE_TRANSMISSION
2617
2617
  material.transmission = transmission;
2618
2618
  material.transmissionAlpha = 1.0;
2619
2619
  material.thickness = thickness;
@@ -2634,7 +2634,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,NO=`#ifdef USE_TRANSMISS
2634
2634
  material.attenuationColor, material.attenuationDistance );
2635
2635
  material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2636
2636
  totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2637
- #endif`,PO=`#ifdef USE_TRANSMISSION
2637
+ #endif`,P3=`#ifdef USE_TRANSMISSION
2638
2638
  uniform float transmission;
2639
2639
  uniform float thickness;
2640
2640
  uniform float attenuationDistance;
@@ -2765,7 +2765,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,NO=`#ifdef USE_TRANSMISS
2765
2765
  float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2766
2766
  return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2767
2767
  }
2768
- #endif`,DO=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2768
+ #endif`,D3=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2769
2769
  varying vec2 vUv;
2770
2770
  #endif
2771
2771
  #ifdef USE_MAP
@@ -2835,7 +2835,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,NO=`#ifdef USE_TRANSMISS
2835
2835
  #ifdef USE_THICKNESSMAP
2836
2836
  uniform mat3 thicknessMapTransform;
2837
2837
  varying vec2 vThicknessMapUv;
2838
- #endif`,IO=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2838
+ #endif`,I3=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2839
2839
  varying vec2 vUv;
2840
2840
  #endif
2841
2841
  #ifdef USE_MAP
@@ -2929,7 +2929,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,NO=`#ifdef USE_TRANSMISS
2929
2929
  #ifdef USE_THICKNESSMAP
2930
2930
  uniform mat3 thicknessMapTransform;
2931
2931
  varying vec2 vThicknessMapUv;
2932
- #endif`,LO=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2932
+ #endif`,L3=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2933
2933
  vUv = vec3( uv, 1 ).xy;
2934
2934
  #endif
2935
2935
  #ifdef USE_MAP
@@ -3000,7 +3000,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,NO=`#ifdef USE_TRANSMISS
3000
3000
  #endif
3001
3001
  #ifdef USE_THICKNESSMAP
3002
3002
  vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
3003
- #endif`,OO=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
3003
+ #endif`,O3=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
3004
3004
  vec4 worldPosition = vec4( transformed, 1.0 );
3005
3005
  #ifdef USE_BATCHING
3006
3006
  worldPosition = batchingMatrix * worldPosition;
@@ -3009,7 +3009,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,NO=`#ifdef USE_TRANSMISS
3009
3009
  worldPosition = instanceMatrix * worldPosition;
3010
3010
  #endif
3011
3011
  worldPosition = modelMatrix * worldPosition;
3012
- #endif`;const vt={alphahash_fragment:UI,alphahash_pars_fragment:BI,alphamap_fragment:kI,alphamap_pars_fragment:zI,alphatest_fragment:GI,alphatest_pars_fragment:VI,aomap_fragment:$I,aomap_pars_fragment:jI,batching_pars_vertex:HI,batching_vertex:WI,begin_vertex:qI,beginnormal_vertex:XI,bsdfs:YI,iridescence_fragment:KI,bumpmap_pars_fragment:ZI,clipping_planes_fragment:QI,clipping_planes_pars_fragment:JI,clipping_planes_pars_vertex:eL,clipping_planes_vertex:tL,color_fragment:nL,color_pars_fragment:iL,color_pars_vertex:rL,color_vertex:sL,common:oL,cube_uv_reflection_fragment:aL,defaultnormal_vertex:lL,displacementmap_pars_vertex:cL,displacementmap_vertex:uL,emissivemap_fragment:hL,emissivemap_pars_fragment:dL,colorspace_fragment:fL,colorspace_pars_fragment:pL,envmap_fragment:mL,envmap_common_pars_fragment:gL,envmap_pars_fragment:yL,envmap_pars_vertex:_L,envmap_physical_pars_fragment:RL,envmap_vertex:vL,fog_vertex:xL,fog_pars_vertex:bL,fog_fragment:SL,fog_pars_fragment:TL,gradientmap_pars_fragment:wL,lightmap_pars_fragment:ML,lights_lambert_fragment:EL,lights_lambert_pars_fragment:AL,lights_pars_begin:CL,lights_toon_fragment:NL,lights_toon_pars_fragment:PL,lights_phong_fragment:DL,lights_phong_pars_fragment:IL,lights_physical_fragment:LL,lights_physical_pars_fragment:OL,lights_fragment_begin:FL,lights_fragment_maps:UL,lights_fragment_end:BL,logdepthbuf_fragment:kL,logdepthbuf_pars_fragment:zL,logdepthbuf_pars_vertex:GL,logdepthbuf_vertex:VL,map_fragment:$L,map_pars_fragment:jL,map_particle_fragment:HL,map_particle_pars_fragment:WL,metalnessmap_fragment:qL,metalnessmap_pars_fragment:XL,morphinstance_vertex:YL,morphcolor_vertex:KL,morphnormal_vertex:ZL,morphtarget_pars_vertex:QL,morphtarget_vertex:JL,normal_fragment_begin:eO,normal_fragment_maps:tO,normal_pars_fragment:nO,normal_pars_vertex:iO,normal_vertex:rO,normalmap_pars_fragment:sO,clearcoat_normal_fragment_begin:oO,clearcoat_normal_fragment_maps:aO,clearcoat_pars_fragment:lO,iridescence_pars_fragment:cO,opaque_fragment:uO,packing:hO,premultiplied_alpha_fragment:dO,project_vertex:fO,dithering_fragment:pO,dithering_pars_fragment:mO,roughnessmap_fragment:gO,roughnessmap_pars_fragment:yO,shadowmap_pars_fragment:_O,shadowmap_pars_vertex:vO,shadowmap_vertex:xO,shadowmask_pars_fragment:bO,skinbase_vertex:SO,skinning_pars_vertex:TO,skinning_vertex:wO,skinnormal_vertex:MO,specularmap_fragment:EO,specularmap_pars_fragment:AO,tonemapping_fragment:CO,tonemapping_pars_fragment:RO,transmission_fragment:NO,transmission_pars_fragment:PO,uv_pars_fragment:DO,uv_pars_vertex:IO,uv_vertex:LO,worldpos_vertex:OO,background_vert:`varying vec2 vUv;
3012
+ #endif`;const vt={alphahash_fragment:UI,alphahash_pars_fragment:BI,alphamap_fragment:kI,alphamap_pars_fragment:zI,alphatest_fragment:GI,alphatest_pars_fragment:VI,aomap_fragment:$I,aomap_pars_fragment:jI,batching_pars_vertex:HI,batching_vertex:WI,begin_vertex:qI,beginnormal_vertex:XI,bsdfs:YI,iridescence_fragment:KI,bumpmap_pars_fragment:ZI,clipping_planes_fragment:QI,clipping_planes_pars_fragment:JI,clipping_planes_pars_vertex:eL,clipping_planes_vertex:tL,color_fragment:nL,color_pars_fragment:iL,color_pars_vertex:rL,color_vertex:sL,common:oL,cube_uv_reflection_fragment:aL,defaultnormal_vertex:lL,displacementmap_pars_vertex:cL,displacementmap_vertex:uL,emissivemap_fragment:hL,emissivemap_pars_fragment:dL,colorspace_fragment:fL,colorspace_pars_fragment:pL,envmap_fragment:mL,envmap_common_pars_fragment:gL,envmap_pars_fragment:yL,envmap_pars_vertex:_L,envmap_physical_pars_fragment:RL,envmap_vertex:vL,fog_vertex:xL,fog_pars_vertex:bL,fog_fragment:SL,fog_pars_fragment:TL,gradientmap_pars_fragment:wL,lightmap_pars_fragment:ML,lights_lambert_fragment:EL,lights_lambert_pars_fragment:AL,lights_pars_begin:CL,lights_toon_fragment:NL,lights_toon_pars_fragment:PL,lights_phong_fragment:DL,lights_phong_pars_fragment:IL,lights_physical_fragment:LL,lights_physical_pars_fragment:OL,lights_fragment_begin:FL,lights_fragment_maps:UL,lights_fragment_end:BL,logdepthbuf_fragment:kL,logdepthbuf_pars_fragment:zL,logdepthbuf_pars_vertex:GL,logdepthbuf_vertex:VL,map_fragment:$L,map_pars_fragment:jL,map_particle_fragment:HL,map_particle_pars_fragment:WL,metalnessmap_fragment:qL,metalnessmap_pars_fragment:XL,morphinstance_vertex:YL,morphcolor_vertex:KL,morphnormal_vertex:ZL,morphtarget_pars_vertex:QL,morphtarget_vertex:JL,normal_fragment_begin:e3,normal_fragment_maps:t3,normal_pars_fragment:n3,normal_pars_vertex:i3,normal_vertex:r3,normalmap_pars_fragment:s3,clearcoat_normal_fragment_begin:o3,clearcoat_normal_fragment_maps:a3,clearcoat_pars_fragment:l3,iridescence_pars_fragment:c3,opaque_fragment:u3,packing:h3,premultiplied_alpha_fragment:d3,project_vertex:f3,dithering_fragment:p3,dithering_pars_fragment:m3,roughnessmap_fragment:g3,roughnessmap_pars_fragment:y3,shadowmap_pars_fragment:_3,shadowmap_pars_vertex:v3,shadowmap_vertex:x3,shadowmask_pars_fragment:b3,skinbase_vertex:S3,skinning_pars_vertex:T3,skinning_vertex:w3,skinnormal_vertex:M3,specularmap_fragment:E3,specularmap_pars_fragment:A3,tonemapping_fragment:C3,tonemapping_pars_fragment:R3,transmission_fragment:N3,transmission_pars_fragment:P3,uv_pars_fragment:D3,uv_pars_vertex:I3,uv_vertex:L3,worldpos_vertex:O3,background_vert:`varying vec2 vUv;
3013
3013
  uniform mat3 uvTransform;
3014
3014
  void main() {
3015
3015
  vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
@@ -4061,7 +4061,7 @@ void main() {
4061
4061
  #include <tonemapping_fragment>
4062
4062
  #include <colorspace_fragment>
4063
4063
  #include <fog_fragment>
4064
- }`},Le={common:{diffuse:{value:new Et(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new bt},alphaMap:{value:null},alphaMapTransform:{value:new bt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new bt}},envmap:{envMap:{value:null},envMapRotation:{value:new bt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new bt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new bt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new bt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new bt},normalScale:{value:new Pe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new bt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new bt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new bt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new bt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Et(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Et(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new bt},alphaTest:{value:0},uvTransform:{value:new bt}},sprite:{diffuse:{value:new Et(16777215)},opacity:{value:1},center:{value:new Pe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new bt},alphaMap:{value:null},alphaMapTransform:{value:new bt},alphaTest:{value:0}}},Lr={basic:{uniforms:si([Le.common,Le.specularmap,Le.envmap,Le.aomap,Le.lightmap,Le.fog]),vertexShader:vt.meshbasic_vert,fragmentShader:vt.meshbasic_frag},lambert:{uniforms:si([Le.common,Le.specularmap,Le.envmap,Le.aomap,Le.lightmap,Le.emissivemap,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.fog,Le.lights,{emissive:{value:new Et(0)}}]),vertexShader:vt.meshlambert_vert,fragmentShader:vt.meshlambert_frag},phong:{uniforms:si([Le.common,Le.specularmap,Le.envmap,Le.aomap,Le.lightmap,Le.emissivemap,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.fog,Le.lights,{emissive:{value:new Et(0)},specular:{value:new Et(1118481)},shininess:{value:30}}]),vertexShader:vt.meshphong_vert,fragmentShader:vt.meshphong_frag},standard:{uniforms:si([Le.common,Le.envmap,Le.aomap,Le.lightmap,Le.emissivemap,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.roughnessmap,Le.metalnessmap,Le.fog,Le.lights,{emissive:{value:new Et(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:vt.meshphysical_vert,fragmentShader:vt.meshphysical_frag},toon:{uniforms:si([Le.common,Le.aomap,Le.lightmap,Le.emissivemap,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.gradientmap,Le.fog,Le.lights,{emissive:{value:new Et(0)}}]),vertexShader:vt.meshtoon_vert,fragmentShader:vt.meshtoon_frag},matcap:{uniforms:si([Le.common,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.fog,{matcap:{value:null}}]),vertexShader:vt.meshmatcap_vert,fragmentShader:vt.meshmatcap_frag},points:{uniforms:si([Le.points,Le.fog]),vertexShader:vt.points_vert,fragmentShader:vt.points_frag},dashed:{uniforms:si([Le.common,Le.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:vt.linedashed_vert,fragmentShader:vt.linedashed_frag},depth:{uniforms:si([Le.common,Le.displacementmap]),vertexShader:vt.depth_vert,fragmentShader:vt.depth_frag},normal:{uniforms:si([Le.common,Le.bumpmap,Le.normalmap,Le.displacementmap,{opacity:{value:1}}]),vertexShader:vt.meshnormal_vert,fragmentShader:vt.meshnormal_frag},sprite:{uniforms:si([Le.sprite,Le.fog]),vertexShader:vt.sprite_vert,fragmentShader:vt.sprite_frag},background:{uniforms:{uvTransform:{value:new bt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:vt.background_vert,fragmentShader:vt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new bt}},vertexShader:vt.backgroundCube_vert,fragmentShader:vt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:vt.cube_vert,fragmentShader:vt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:vt.equirect_vert,fragmentShader:vt.equirect_frag},distanceRGBA:{uniforms:si([Le.common,Le.displacementmap,{referencePosition:{value:new V},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:vt.distanceRGBA_vert,fragmentShader:vt.distanceRGBA_frag},shadow:{uniforms:si([Le.lights,Le.fog,{color:{value:new Et(0)},opacity:{value:1}}]),vertexShader:vt.shadow_vert,fragmentShader:vt.shadow_frag}};Lr.physical={uniforms:si([Lr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new bt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new bt},clearcoatNormalScale:{value:new Pe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new bt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new bt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new bt},sheen:{value:0},sheenColor:{value:new Et(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new bt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new bt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new bt},transmissionSamplerSize:{value:new Pe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new bt},attenuationDistance:{value:0},attenuationColor:{value:new Et(0)},specularColor:{value:new Et(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new bt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new bt},anisotropyVector:{value:new Pe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new bt}}]),vertexShader:vt.meshphysical_vert,fragmentShader:vt.meshphysical_frag};const Ed={r:0,b:0,g:0},oa=new so,FO=new tn;function UO(r,e,n,i,s,o,a){const l=new Et(0);let c=o===!0?0:1,u,h,d=null,f=0,p=null;function m(x){let b=x.isScene===!0?x.background:null;return b&&b.isTexture&&(b=(x.backgroundBlurriness>0?n:e).get(b)),b}function _(x){let b=!1;const v=m(x);v===null?g(l,c):v&&v.isColor&&(g(v,1),b=!0);const T=r.xr.getEnvironmentBlendMode();T==="additive"?i.buffers.color.setClear(0,0,0,1,a):T==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,a),(r.autoClear||b)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function y(x,b){const v=m(b);v&&(v.isCubeTexture||v.mapping===Zh)?(h===void 0&&(h=new yi(new c0(1,1,1),new Ir({name:"BackgroundCubeMaterial",uniforms:ml(Lr.backgroundCube.uniforms),vertexShader:Lr.backgroundCube.vertexShader,fragmentShader:Lr.backgroundCube.fragmentShader,side:ri,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(T,w,E){this.matrixWorld.copyPosition(E.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(h)),oa.copy(b.backgroundRotation),oa.x*=-1,oa.y*=-1,oa.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(oa.y*=-1,oa.z*=-1),h.material.uniforms.envMap.value=v,h.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=b.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(FO.makeRotationFromEuler(oa)),h.material.toneMapped=Dt.getTransfer(v.colorSpace)!==Kt,(d!==v||f!==v.version||p!==r.toneMapping)&&(h.material.needsUpdate=!0,d=v,f=v.version,p=r.toneMapping),h.layers.enableAll(),x.unshift(h,h.geometry,h.material,0,0,null)):v&&v.isTexture&&(u===void 0&&(u=new yi(new Zc(2,2),new Ir({name:"BackgroundMaterial",uniforms:ml(Lr.background.uniforms),vertexShader:Lr.background.vertexShader,fragmentShader:Lr.background.fragmentShader,side:Zs,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(u)),u.material.uniforms.t2D.value=v,u.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,u.material.toneMapped=Dt.getTransfer(v.colorSpace)!==Kt,v.matrixAutoUpdate===!0&&v.updateMatrix(),u.material.uniforms.uvTransform.value.copy(v.matrix),(d!==v||f!==v.version||p!==r.toneMapping)&&(u.material.needsUpdate=!0,d=v,f=v.version,p=r.toneMapping),u.layers.enableAll(),x.unshift(u,u.geometry,u.material,0,0,null))}function g(x,b){x.getRGB(Ed,KS(r)),i.buffers.color.setClear(Ed.r,Ed.g,Ed.b,b,a)}return{getClearColor:function(){return l},setClearColor:function(x,b=1){l.set(x),c=b,g(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(x){c=x,g(l,c)},render:_,addToRenderList:y}}function BO(r,e){const n=r.getParameter(r.MAX_VERTEX_ATTRIBS),i={},s=f(null);let o=s,a=!1;function l(S,R,O,P,C){let I=!1;const L=d(P,O,R);o!==L&&(o=L,u(o.object)),I=p(S,P,O,C),I&&m(S,P,O,C),C!==null&&e.update(C,r.ELEMENT_ARRAY_BUFFER),(I||a)&&(a=!1,v(S,R,O,P),C!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(C).buffer))}function c(){return r.createVertexArray()}function u(S){return r.bindVertexArray(S)}function h(S){return r.deleteVertexArray(S)}function d(S,R,O){const P=O.wireframe===!0;let C=i[S.id];C===void 0&&(C={},i[S.id]=C);let I=C[R.id];I===void 0&&(I={},C[R.id]=I);let L=I[P];return L===void 0&&(L=f(c()),I[P]=L),L}function f(S){const R=[],O=[],P=[];for(let C=0;C<n;C++)R[C]=0,O[C]=0,P[C]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:R,enabledAttributes:O,attributeDivisors:P,object:S,attributes:{},index:null}}function p(S,R,O,P){const C=o.attributes,I=R.attributes;let L=0;const W=O.getAttributes();for(const $ in W)if(W[$].location>=0){const U=C[$];let k=I[$];if(k===void 0&&($==="instanceMatrix"&&S.instanceMatrix&&(k=S.instanceMatrix),$==="instanceColor"&&S.instanceColor&&(k=S.instanceColor)),U===void 0||U.attribute!==k||k&&U.data!==k.data)return!0;L++}return o.attributesNum!==L||o.index!==P}function m(S,R,O,P){const C={},I=R.attributes;let L=0;const W=O.getAttributes();for(const $ in W)if(W[$].location>=0){let U=I[$];U===void 0&&($==="instanceMatrix"&&S.instanceMatrix&&(U=S.instanceMatrix),$==="instanceColor"&&S.instanceColor&&(U=S.instanceColor));const k={};k.attribute=U,U&&U.data&&(k.data=U.data),C[$]=k,L++}o.attributes=C,o.attributesNum=L,o.index=P}function _(){const S=o.newAttributes;for(let R=0,O=S.length;R<O;R++)S[R]=0}function y(S){g(S,0)}function g(S,R){const O=o.newAttributes,P=o.enabledAttributes,C=o.attributeDivisors;O[S]=1,P[S]===0&&(r.enableVertexAttribArray(S),P[S]=1),C[S]!==R&&(r.vertexAttribDivisor(S,R),C[S]=R)}function x(){const S=o.newAttributes,R=o.enabledAttributes;for(let O=0,P=R.length;O<P;O++)R[O]!==S[O]&&(r.disableVertexAttribArray(O),R[O]=0)}function b(S,R,O,P,C,I,L){L===!0?r.vertexAttribIPointer(S,R,O,C,I):r.vertexAttribPointer(S,R,O,P,C,I)}function v(S,R,O,P){_();const C=P.attributes,I=O.getAttributes(),L=R.defaultAttributeValues;for(const W in I){const $=I[W];if($.location>=0){let ie=C[W];if(ie===void 0&&(W==="instanceMatrix"&&S.instanceMatrix&&(ie=S.instanceMatrix),W==="instanceColor"&&S.instanceColor&&(ie=S.instanceColor)),ie!==void 0){const U=ie.normalized,k=ie.itemSize,re=e.get(ie);if(re===void 0)continue;const he=re.buffer,F=re.type,G=re.bytesPerElement,ee=F===r.INT||F===r.UNSIGNED_INT||ie.gpuType===lg;if(ie.isInterleavedBufferAttribute){const J=ie.data,ue=J.stride,be=ie.offset;if(J.isInstancedInterleavedBuffer){for(let Te=0;Te<$.locationSize;Te++)g($.location+Te,J.meshPerAttribute);S.isInstancedMesh!==!0&&P._maxInstanceCount===void 0&&(P._maxInstanceCount=J.meshPerAttribute*J.count)}else for(let Te=0;Te<$.locationSize;Te++)y($.location+Te);r.bindBuffer(r.ARRAY_BUFFER,he);for(let Te=0;Te<$.locationSize;Te++)b($.location+Te,k/$.locationSize,F,U,ue*G,(be+k/$.locationSize*Te)*G,ee)}else{if(ie.isInstancedBufferAttribute){for(let J=0;J<$.locationSize;J++)g($.location+J,ie.meshPerAttribute);S.isInstancedMesh!==!0&&P._maxInstanceCount===void 0&&(P._maxInstanceCount=ie.meshPerAttribute*ie.count)}else for(let J=0;J<$.locationSize;J++)y($.location+J);r.bindBuffer(r.ARRAY_BUFFER,he);for(let J=0;J<$.locationSize;J++)b($.location+J,k/$.locationSize,F,U,k*G,k/$.locationSize*J*G,ee)}}else if(L!==void 0){const U=L[W];if(U!==void 0)switch(U.length){case 2:r.vertexAttrib2fv($.location,U);break;case 3:r.vertexAttrib3fv($.location,U);break;case 4:r.vertexAttrib4fv($.location,U);break;default:r.vertexAttrib1fv($.location,U)}}}}x()}function T(){A();for(const S in i){const R=i[S];for(const O in R){const P=R[O];for(const C in P)h(P[C].object),delete P[C];delete R[O]}delete i[S]}}function w(S){if(i[S.id]===void 0)return;const R=i[S.id];for(const O in R){const P=R[O];for(const C in P)h(P[C].object),delete P[C];delete R[O]}delete i[S.id]}function E(S){for(const R in i){const O=i[R];if(O[S.id]===void 0)continue;const P=O[S.id];for(const C in P)h(P[C].object),delete P[C];delete O[S.id]}}function A(){M(),a=!0,o!==s&&(o=s,u(o.object))}function M(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:l,reset:A,resetDefaultState:M,dispose:T,releaseStatesOfGeometry:w,releaseStatesOfProgram:E,initAttributes:_,enableAttribute:y,disableUnusedAttributes:x}}function kO(r,e,n){let i;function s(u){i=u}function o(u,h){r.drawArrays(i,u,h),n.update(h,i,1)}function a(u,h,d){d!==0&&(r.drawArraysInstanced(i,u,h,d),n.update(h,i,d))}function l(u,h,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,u,0,h,0,d);let p=0;for(let m=0;m<d;m++)p+=h[m];n.update(p,i,1)}function c(u,h,d,f){if(d===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let m=0;m<u.length;m++)a(u[m],h[m],f[m]);else{p.multiDrawArraysInstancedWEBGL(i,u,0,h,0,f,0,d);let m=0;for(let _=0;_<d;_++)m+=h[_]*f[_];n.update(m,i,1)}}this.setMode=s,this.render=o,this.renderInstances=a,this.renderMultiDraw=l,this.renderMultiDrawInstances=c}function zO(r,e,n,i){let s;function o(){if(s!==void 0)return s;if(e.has("EXT_texture_filter_anisotropic")===!0){const E=e.get("EXT_texture_filter_anisotropic");s=r.getParameter(E.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function a(E){return!(E!==or&&i.convert(E)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function l(E){const A=E===Za&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(E!==ts&&i.convert(E)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&E!==ns&&!A)}function c(E){if(E==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";E="mediump"}return E==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let u=n.precision!==void 0?n.precision:"highp";const h=c(u);h!==u&&(console.warn("THREE.WebGLRenderer:",u,"not supported, using",h,"instead."),u=h);const d=n.logarithmicDepthBuffer===!0,f=n.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),p=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),m=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_TEXTURE_SIZE),y=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),g=r.getParameter(r.MAX_VERTEX_ATTRIBS),x=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),b=r.getParameter(r.MAX_VARYING_VECTORS),v=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),T=m>0,w=r.getParameter(r.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:l,precision:u,logarithmicDepthBuffer:d,reverseDepthBuffer:f,maxTextures:p,maxVertexTextures:m,maxTextureSize:_,maxCubemapSize:y,maxAttributes:g,maxVertexUniforms:x,maxVaryings:b,maxFragmentUniforms:v,vertexTextures:T,maxSamples:w}}function GO(r){const e=this;let n=null,i=0,s=!1,o=!1;const a=new hs,l=new bt,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(d,f){const p=d.length!==0||f||i!==0||s;return s=f,i=d.length,p},this.beginShadows=function(){o=!0,h(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(d,f){n=h(d,f,0)},this.setState=function(d,f,p){const m=d.clippingPlanes,_=d.clipIntersection,y=d.clipShadows,g=r.get(d);if(!s||m===null||m.length===0||o&&!y)o?h(null):u();else{const x=o?0:i,b=x*4;let v=g.clippingState||null;c.value=v,v=h(m,f,b,p);for(let T=0;T!==b;++T)v[T]=n[T];g.clippingState=v,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=x}};function u(){c.value!==n&&(c.value=n,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(d,f,p,m){const _=d!==null?d.length:0;let y=null;if(_!==0){if(y=c.value,m!==!0||y===null){const g=p+_*4,x=f.matrixWorldInverse;l.getNormalMatrix(x),(y===null||y.length<g)&&(y=new Float32Array(g));for(let b=0,v=p;b!==_;++b,v+=4)a.copy(d[b]).applyMatrix4(x,l),a.normal.toArray(y,v),y[v+3]=a.constant}c.value=y,c.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,y}}function VO(r){let e=new WeakMap;function n(a,l){return l===ig?a.mapping=Ya:l===rg&&(a.mapping=Ka),a}function i(a){if(a&&a.isTexture){const l=a.mapping;if(l===ig||l===rg)if(e.has(a)){const c=e.get(a).texture;return n(c,a.mapping)}else{const c=a.image;if(c&&c.height>0){const u=new II(c.height);return u.fromEquirectangularTexture(r,a),e.set(a,u),a.addEventListener("dispose",s),n(u.texture,a.mapping)}else return null}}return a}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap}return{get:i,dispose:o}}let d0=class extends QS{constructor(e=-1,n=1,i=1,s=-1,o=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=i,this.bottom=s,this.near=o,this.far=a,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,i,s,o,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=s,this.view.width=o,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let o=i-e,a=i+e,l=s+n,c=s-n;if(this.view!==null&&this.view.enabled){const u=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o+=u*this.view.offsetX,a=o+u*this.view.width,l-=h*this.view.offsetY,c=l-h*this.view.height}this.projectionMatrix.makeOrthographic(o,a,l,c,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}};const _l=4,i1=[.125,.215,.35,.446,.526,.582],aa=20,f0=new d0,r1=new Et;let p0=null,m0=0,g0=0,y0=!1;const la=(1+Math.sqrt(5))/2,vl=1/la,s1=[new V(-la,vl,0),new V(la,vl,0),new V(-vl,0,la),new V(vl,0,la),new V(0,la,-vl),new V(0,la,vl),new V(-1,1,-1),new V(1,1,-1),new V(-1,1,1),new V(1,1,1)];let o1=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,i=.1,s=100){p0=this._renderer.getRenderTarget(),m0=this._renderer.getActiveCubeFace(),g0=this._renderer.getActiveMipmapLevel(),y0=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(e,i,s,o),n>0&&this._blur(o,0,0,n),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=c1(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=l1(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(p0,m0,g0),this._renderer.xr.enabled=y0,e.scissorTest=!1,Ad(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===Ya||e.mapping===Ka?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),p0=this._renderer.getRenderTarget(),m0=this._renderer.getActiveCubeFace(),g0=this._renderer.getActiveMipmapLevel(),y0=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=n||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,i={magFilter:Pr,minFilter:Pr,generateMipmaps:!1,type:Za,format:or,colorSpace:tl,depthBuffer:!1},s=a1(e,n,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=a1(e,n,i);const{_lodMax:o}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=$O(o)),this._blurMaterial=jO(o,e,n)}return s}_compileMaterial(e){const n=new yi(this._lodPlanes[0],e);this._renderer.compile(n,f0)}_sceneToCubeUV(e,n,i,s){const l=new Xi(90,1,n,i),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],h=this._renderer,d=h.autoClear,f=h.toneMapping;h.getClearColor(r1),h.toneMapping=Qs,h.autoClear=!1;const p=new gd({name:"PMREM.Background",side:ri,depthWrite:!1,depthTest:!1}),m=new yi(new c0,p);let _=!1;const y=e.background;y?y.isColor&&(p.color.copy(y),e.background=null,_=!0):(p.color.copy(r1),_=!0);for(let g=0;g<6;g++){const x=g%3;x===0?(l.up.set(0,c[g],0),l.lookAt(u[g],0,0)):x===1?(l.up.set(0,0,c[g]),l.lookAt(0,u[g],0)):(l.up.set(0,c[g],0),l.lookAt(0,0,u[g]));const b=this._cubeSize;Ad(s,x*b,g>2?b:0,b,b),h.setRenderTarget(s),_&&h.render(m,l),h.render(e,l)}m.geometry.dispose(),m.material.dispose(),h.toneMapping=f,h.autoClear=d,e.background=y}_textureToCubeUV(e,n){const i=this._renderer,s=e.mapping===Ya||e.mapping===Ka;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=c1()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=l1());const o=s?this._cubemapMaterial:this._equirectMaterial,a=new yi(this._lodPlanes[0],o),l=o.uniforms;l.envMap.value=e;const c=this._cubeSize;Ad(n,0,0,3*c,2*c),i.setRenderTarget(n),i.render(a,f0)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;const s=this._lodPlanes.length;for(let o=1;o<s;o++){const a=Math.sqrt(this._sigmas[o]*this._sigmas[o]-this._sigmas[o-1]*this._sigmas[o-1]),l=s1[(s-o-1)%s1.length];this._blur(e,o-1,o,a,l)}n.autoClear=i}_blur(e,n,i,s,o){const a=this._pingPongRenderTarget;this._halfBlur(e,a,n,i,s,"latitudinal",o),this._halfBlur(a,e,i,i,s,"longitudinal",o)}_halfBlur(e,n,i,s,o,a,l){const c=this._renderer,u=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,d=new yi(this._lodPlanes[s],u),f=u.uniforms,p=this._sizeLods[i]-1,m=isFinite(o)?Math.PI/(2*p):2*Math.PI/(2*aa-1),_=o/m,y=isFinite(o)?1+Math.floor(h*_):aa;y>aa&&console.warn(`sigmaRadians, ${o}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${aa}`);const g=[];let x=0;for(let E=0;E<aa;++E){const A=E/_,M=Math.exp(-A*A/2);g.push(M),E===0?x+=M:E<y&&(x+=2*M)}for(let E=0;E<g.length;E++)g[E]=g[E]/x;f.envMap.value=e.texture,f.samples.value=y,f.weights.value=g,f.latitudinal.value=a==="latitudinal",l&&(f.poleAxis.value=l);const{_lodMax:b}=this;f.dTheta.value=m,f.mipInt.value=b-i;const v=this._sizeLods[s],T=3*v*(s>b-_l?s-b+_l:0),w=4*(this._cubeSize-v);Ad(n,T,w,3*v,2*v),c.setRenderTarget(n),c.render(d,f0)}};function $O(r){const e=[],n=[],i=[];let s=r;const o=r-_l+1+i1.length;for(let a=0;a<o;a++){const l=Math.pow(2,s);n.push(l);let c=1/l;a>r-_l?c=i1[a-r+_l-1]:a===0&&(c=0),i.push(c);const u=1/(l-2),h=-u,d=1+u,f=[h,h,d,h,d,d,h,h,d,d,h,d],p=6,m=6,_=3,y=2,g=1,x=new Float32Array(_*m*p),b=new Float32Array(y*m*p),v=new Float32Array(g*m*p);for(let w=0;w<p;w++){const E=w%3*2/3-1,A=w>2?0:-1,M=[E,A,0,E+2/3,A,0,E+2/3,A+1,0,E,A,0,E+2/3,A+1,0,E,A+1,0];x.set(M,_*m*w),b.set(f,y*m*w);const S=[w,w,w,w,w,w];v.set(S,g*m*w)}const T=new Di;T.setAttribute("position",new Wi(x,_)),T.setAttribute("uv",new Wi(b,y)),T.setAttribute("faceIndex",new Wi(v,g)),e.push(T),s>_l&&s--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function a1(r,e,n){const i=new eo(r,e,n);return i.texture.mapping=Zh,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Ad(r,e,n,i,s){r.viewport.set(e,n,i,s),r.scissor.set(e,n,i,s)}function jO(r,e,n){const i=new Float32Array(aa),s=new V(0,1,0);return new Ir({name:"SphericalGaussianBlur",defines:{n:aa,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:_0(),fragmentShader:`
4064
+ }`},Le={common:{diffuse:{value:new Et(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new bt},alphaMap:{value:null},alphaMapTransform:{value:new bt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new bt}},envmap:{envMap:{value:null},envMapRotation:{value:new bt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new bt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new bt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new bt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new bt},normalScale:{value:new Pe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new bt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new bt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new bt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new bt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Et(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Et(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new bt},alphaTest:{value:0},uvTransform:{value:new bt}},sprite:{diffuse:{value:new Et(16777215)},opacity:{value:1},center:{value:new Pe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new bt},alphaMap:{value:null},alphaMapTransform:{value:new bt},alphaTest:{value:0}}},Lr={basic:{uniforms:si([Le.common,Le.specularmap,Le.envmap,Le.aomap,Le.lightmap,Le.fog]),vertexShader:vt.meshbasic_vert,fragmentShader:vt.meshbasic_frag},lambert:{uniforms:si([Le.common,Le.specularmap,Le.envmap,Le.aomap,Le.lightmap,Le.emissivemap,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.fog,Le.lights,{emissive:{value:new Et(0)}}]),vertexShader:vt.meshlambert_vert,fragmentShader:vt.meshlambert_frag},phong:{uniforms:si([Le.common,Le.specularmap,Le.envmap,Le.aomap,Le.lightmap,Le.emissivemap,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.fog,Le.lights,{emissive:{value:new Et(0)},specular:{value:new Et(1118481)},shininess:{value:30}}]),vertexShader:vt.meshphong_vert,fragmentShader:vt.meshphong_frag},standard:{uniforms:si([Le.common,Le.envmap,Le.aomap,Le.lightmap,Le.emissivemap,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.roughnessmap,Le.metalnessmap,Le.fog,Le.lights,{emissive:{value:new Et(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:vt.meshphysical_vert,fragmentShader:vt.meshphysical_frag},toon:{uniforms:si([Le.common,Le.aomap,Le.lightmap,Le.emissivemap,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.gradientmap,Le.fog,Le.lights,{emissive:{value:new Et(0)}}]),vertexShader:vt.meshtoon_vert,fragmentShader:vt.meshtoon_frag},matcap:{uniforms:si([Le.common,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.fog,{matcap:{value:null}}]),vertexShader:vt.meshmatcap_vert,fragmentShader:vt.meshmatcap_frag},points:{uniforms:si([Le.points,Le.fog]),vertexShader:vt.points_vert,fragmentShader:vt.points_frag},dashed:{uniforms:si([Le.common,Le.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:vt.linedashed_vert,fragmentShader:vt.linedashed_frag},depth:{uniforms:si([Le.common,Le.displacementmap]),vertexShader:vt.depth_vert,fragmentShader:vt.depth_frag},normal:{uniforms:si([Le.common,Le.bumpmap,Le.normalmap,Le.displacementmap,{opacity:{value:1}}]),vertexShader:vt.meshnormal_vert,fragmentShader:vt.meshnormal_frag},sprite:{uniforms:si([Le.sprite,Le.fog]),vertexShader:vt.sprite_vert,fragmentShader:vt.sprite_frag},background:{uniforms:{uvTransform:{value:new bt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:vt.background_vert,fragmentShader:vt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new bt}},vertexShader:vt.backgroundCube_vert,fragmentShader:vt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:vt.cube_vert,fragmentShader:vt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:vt.equirect_vert,fragmentShader:vt.equirect_frag},distanceRGBA:{uniforms:si([Le.common,Le.displacementmap,{referencePosition:{value:new V},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:vt.distanceRGBA_vert,fragmentShader:vt.distanceRGBA_frag},shadow:{uniforms:si([Le.lights,Le.fog,{color:{value:new Et(0)},opacity:{value:1}}]),vertexShader:vt.shadow_vert,fragmentShader:vt.shadow_frag}};Lr.physical={uniforms:si([Lr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new bt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new bt},clearcoatNormalScale:{value:new Pe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new bt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new bt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new bt},sheen:{value:0},sheenColor:{value:new Et(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new bt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new bt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new bt},transmissionSamplerSize:{value:new Pe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new bt},attenuationDistance:{value:0},attenuationColor:{value:new Et(0)},specularColor:{value:new Et(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new bt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new bt},anisotropyVector:{value:new Pe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new bt}}]),vertexShader:vt.meshphysical_vert,fragmentShader:vt.meshphysical_frag};const Ed={r:0,b:0,g:0},oa=new so,F3=new tn;function U3(r,e,n,i,s,o,a){const l=new Et(0);let c=o===!0?0:1,u,h,d=null,f=0,p=null;function m(x){let b=x.isScene===!0?x.background:null;return b&&b.isTexture&&(b=(x.backgroundBlurriness>0?n:e).get(b)),b}function _(x){let b=!1;const v=m(x);v===null?g(l,c):v&&v.isColor&&(g(v,1),b=!0);const T=r.xr.getEnvironmentBlendMode();T==="additive"?i.buffers.color.setClear(0,0,0,1,a):T==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,a),(r.autoClear||b)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function y(x,b){const v=m(b);v&&(v.isCubeTexture||v.mapping===Zh)?(h===void 0&&(h=new yi(new c0(1,1,1),new Ir({name:"BackgroundCubeMaterial",uniforms:ml(Lr.backgroundCube.uniforms),vertexShader:Lr.backgroundCube.vertexShader,fragmentShader:Lr.backgroundCube.fragmentShader,side:ri,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(T,w,E){this.matrixWorld.copyPosition(E.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(h)),oa.copy(b.backgroundRotation),oa.x*=-1,oa.y*=-1,oa.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(oa.y*=-1,oa.z*=-1),h.material.uniforms.envMap.value=v,h.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=b.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(F3.makeRotationFromEuler(oa)),h.material.toneMapped=Dt.getTransfer(v.colorSpace)!==Kt,(d!==v||f!==v.version||p!==r.toneMapping)&&(h.material.needsUpdate=!0,d=v,f=v.version,p=r.toneMapping),h.layers.enableAll(),x.unshift(h,h.geometry,h.material,0,0,null)):v&&v.isTexture&&(u===void 0&&(u=new yi(new Zc(2,2),new Ir({name:"BackgroundMaterial",uniforms:ml(Lr.background.uniforms),vertexShader:Lr.background.vertexShader,fragmentShader:Lr.background.fragmentShader,side:Zs,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(u)),u.material.uniforms.t2D.value=v,u.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,u.material.toneMapped=Dt.getTransfer(v.colorSpace)!==Kt,v.matrixAutoUpdate===!0&&v.updateMatrix(),u.material.uniforms.uvTransform.value.copy(v.matrix),(d!==v||f!==v.version||p!==r.toneMapping)&&(u.material.needsUpdate=!0,d=v,f=v.version,p=r.toneMapping),u.layers.enableAll(),x.unshift(u,u.geometry,u.material,0,0,null))}function g(x,b){x.getRGB(Ed,KS(r)),i.buffers.color.setClear(Ed.r,Ed.g,Ed.b,b,a)}return{getClearColor:function(){return l},setClearColor:function(x,b=1){l.set(x),c=b,g(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(x){c=x,g(l,c)},render:_,addToRenderList:y}}function B3(r,e){const n=r.getParameter(r.MAX_VERTEX_ATTRIBS),i={},s=f(null);let o=s,a=!1;function l(S,R,O,P,C){let I=!1;const L=d(P,O,R);o!==L&&(o=L,u(o.object)),I=p(S,P,O,C),I&&m(S,P,O,C),C!==null&&e.update(C,r.ELEMENT_ARRAY_BUFFER),(I||a)&&(a=!1,v(S,R,O,P),C!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(C).buffer))}function c(){return r.createVertexArray()}function u(S){return r.bindVertexArray(S)}function h(S){return r.deleteVertexArray(S)}function d(S,R,O){const P=O.wireframe===!0;let C=i[S.id];C===void 0&&(C={},i[S.id]=C);let I=C[R.id];I===void 0&&(I={},C[R.id]=I);let L=I[P];return L===void 0&&(L=f(c()),I[P]=L),L}function f(S){const R=[],O=[],P=[];for(let C=0;C<n;C++)R[C]=0,O[C]=0,P[C]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:R,enabledAttributes:O,attributeDivisors:P,object:S,attributes:{},index:null}}function p(S,R,O,P){const C=o.attributes,I=R.attributes;let L=0;const W=O.getAttributes();for(const $ in W)if(W[$].location>=0){const U=C[$];let k=I[$];if(k===void 0&&($==="instanceMatrix"&&S.instanceMatrix&&(k=S.instanceMatrix),$==="instanceColor"&&S.instanceColor&&(k=S.instanceColor)),U===void 0||U.attribute!==k||k&&U.data!==k.data)return!0;L++}return o.attributesNum!==L||o.index!==P}function m(S,R,O,P){const C={},I=R.attributes;let L=0;const W=O.getAttributes();for(const $ in W)if(W[$].location>=0){let U=I[$];U===void 0&&($==="instanceMatrix"&&S.instanceMatrix&&(U=S.instanceMatrix),$==="instanceColor"&&S.instanceColor&&(U=S.instanceColor));const k={};k.attribute=U,U&&U.data&&(k.data=U.data),C[$]=k,L++}o.attributes=C,o.attributesNum=L,o.index=P}function _(){const S=o.newAttributes;for(let R=0,O=S.length;R<O;R++)S[R]=0}function y(S){g(S,0)}function g(S,R){const O=o.newAttributes,P=o.enabledAttributes,C=o.attributeDivisors;O[S]=1,P[S]===0&&(r.enableVertexAttribArray(S),P[S]=1),C[S]!==R&&(r.vertexAttribDivisor(S,R),C[S]=R)}function x(){const S=o.newAttributes,R=o.enabledAttributes;for(let O=0,P=R.length;O<P;O++)R[O]!==S[O]&&(r.disableVertexAttribArray(O),R[O]=0)}function b(S,R,O,P,C,I,L){L===!0?r.vertexAttribIPointer(S,R,O,C,I):r.vertexAttribPointer(S,R,O,P,C,I)}function v(S,R,O,P){_();const C=P.attributes,I=O.getAttributes(),L=R.defaultAttributeValues;for(const W in I){const $=I[W];if($.location>=0){let ie=C[W];if(ie===void 0&&(W==="instanceMatrix"&&S.instanceMatrix&&(ie=S.instanceMatrix),W==="instanceColor"&&S.instanceColor&&(ie=S.instanceColor)),ie!==void 0){const U=ie.normalized,k=ie.itemSize,re=e.get(ie);if(re===void 0)continue;const he=re.buffer,F=re.type,G=re.bytesPerElement,ee=F===r.INT||F===r.UNSIGNED_INT||ie.gpuType===lg;if(ie.isInterleavedBufferAttribute){const J=ie.data,ue=J.stride,be=ie.offset;if(J.isInstancedInterleavedBuffer){for(let Te=0;Te<$.locationSize;Te++)g($.location+Te,J.meshPerAttribute);S.isInstancedMesh!==!0&&P._maxInstanceCount===void 0&&(P._maxInstanceCount=J.meshPerAttribute*J.count)}else for(let Te=0;Te<$.locationSize;Te++)y($.location+Te);r.bindBuffer(r.ARRAY_BUFFER,he);for(let Te=0;Te<$.locationSize;Te++)b($.location+Te,k/$.locationSize,F,U,ue*G,(be+k/$.locationSize*Te)*G,ee)}else{if(ie.isInstancedBufferAttribute){for(let J=0;J<$.locationSize;J++)g($.location+J,ie.meshPerAttribute);S.isInstancedMesh!==!0&&P._maxInstanceCount===void 0&&(P._maxInstanceCount=ie.meshPerAttribute*ie.count)}else for(let J=0;J<$.locationSize;J++)y($.location+J);r.bindBuffer(r.ARRAY_BUFFER,he);for(let J=0;J<$.locationSize;J++)b($.location+J,k/$.locationSize,F,U,k*G,k/$.locationSize*J*G,ee)}}else if(L!==void 0){const U=L[W];if(U!==void 0)switch(U.length){case 2:r.vertexAttrib2fv($.location,U);break;case 3:r.vertexAttrib3fv($.location,U);break;case 4:r.vertexAttrib4fv($.location,U);break;default:r.vertexAttrib1fv($.location,U)}}}}x()}function T(){A();for(const S in i){const R=i[S];for(const O in R){const P=R[O];for(const C in P)h(P[C].object),delete P[C];delete R[O]}delete i[S]}}function w(S){if(i[S.id]===void 0)return;const R=i[S.id];for(const O in R){const P=R[O];for(const C in P)h(P[C].object),delete P[C];delete R[O]}delete i[S.id]}function E(S){for(const R in i){const O=i[R];if(O[S.id]===void 0)continue;const P=O[S.id];for(const C in P)h(P[C].object),delete P[C];delete O[S.id]}}function A(){M(),a=!0,o!==s&&(o=s,u(o.object))}function M(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:l,reset:A,resetDefaultState:M,dispose:T,releaseStatesOfGeometry:w,releaseStatesOfProgram:E,initAttributes:_,enableAttribute:y,disableUnusedAttributes:x}}function k3(r,e,n){let i;function s(u){i=u}function o(u,h){r.drawArrays(i,u,h),n.update(h,i,1)}function a(u,h,d){d!==0&&(r.drawArraysInstanced(i,u,h,d),n.update(h,i,d))}function l(u,h,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,u,0,h,0,d);let p=0;for(let m=0;m<d;m++)p+=h[m];n.update(p,i,1)}function c(u,h,d,f){if(d===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let m=0;m<u.length;m++)a(u[m],h[m],f[m]);else{p.multiDrawArraysInstancedWEBGL(i,u,0,h,0,f,0,d);let m=0;for(let _=0;_<d;_++)m+=h[_]*f[_];n.update(m,i,1)}}this.setMode=s,this.render=o,this.renderInstances=a,this.renderMultiDraw=l,this.renderMultiDrawInstances=c}function z3(r,e,n,i){let s;function o(){if(s!==void 0)return s;if(e.has("EXT_texture_filter_anisotropic")===!0){const E=e.get("EXT_texture_filter_anisotropic");s=r.getParameter(E.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function a(E){return!(E!==or&&i.convert(E)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function l(E){const A=E===Za&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(E!==ts&&i.convert(E)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&E!==ns&&!A)}function c(E){if(E==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";E="mediump"}return E==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let u=n.precision!==void 0?n.precision:"highp";const h=c(u);h!==u&&(console.warn("THREE.WebGLRenderer:",u,"not supported, using",h,"instead."),u=h);const d=n.logarithmicDepthBuffer===!0,f=n.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),p=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),m=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_TEXTURE_SIZE),y=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),g=r.getParameter(r.MAX_VERTEX_ATTRIBS),x=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),b=r.getParameter(r.MAX_VARYING_VECTORS),v=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),T=m>0,w=r.getParameter(r.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:l,precision:u,logarithmicDepthBuffer:d,reverseDepthBuffer:f,maxTextures:p,maxVertexTextures:m,maxTextureSize:_,maxCubemapSize:y,maxAttributes:g,maxVertexUniforms:x,maxVaryings:b,maxFragmentUniforms:v,vertexTextures:T,maxSamples:w}}function G3(r){const e=this;let n=null,i=0,s=!1,o=!1;const a=new hs,l=new bt,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(d,f){const p=d.length!==0||f||i!==0||s;return s=f,i=d.length,p},this.beginShadows=function(){o=!0,h(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(d,f){n=h(d,f,0)},this.setState=function(d,f,p){const m=d.clippingPlanes,_=d.clipIntersection,y=d.clipShadows,g=r.get(d);if(!s||m===null||m.length===0||o&&!y)o?h(null):u();else{const x=o?0:i,b=x*4;let v=g.clippingState||null;c.value=v,v=h(m,f,b,p);for(let T=0;T!==b;++T)v[T]=n[T];g.clippingState=v,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=x}};function u(){c.value!==n&&(c.value=n,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(d,f,p,m){const _=d!==null?d.length:0;let y=null;if(_!==0){if(y=c.value,m!==!0||y===null){const g=p+_*4,x=f.matrixWorldInverse;l.getNormalMatrix(x),(y===null||y.length<g)&&(y=new Float32Array(g));for(let b=0,v=p;b!==_;++b,v+=4)a.copy(d[b]).applyMatrix4(x,l),a.normal.toArray(y,v),y[v+3]=a.constant}c.value=y,c.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,y}}function V3(r){let e=new WeakMap;function n(a,l){return l===ig?a.mapping=Ya:l===rg&&(a.mapping=Ka),a}function i(a){if(a&&a.isTexture){const l=a.mapping;if(l===ig||l===rg)if(e.has(a)){const c=e.get(a).texture;return n(c,a.mapping)}else{const c=a.image;if(c&&c.height>0){const u=new II(c.height);return u.fromEquirectangularTexture(r,a),e.set(a,u),a.addEventListener("dispose",s),n(u.texture,a.mapping)}else return null}}return a}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap}return{get:i,dispose:o}}let d0=class extends QS{constructor(e=-1,n=1,i=1,s=-1,o=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=i,this.bottom=s,this.near=o,this.far=a,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,i,s,o,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=s,this.view.width=o,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let o=i-e,a=i+e,l=s+n,c=s-n;if(this.view!==null&&this.view.enabled){const u=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o+=u*this.view.offsetX,a=o+u*this.view.width,l-=h*this.view.offsetY,c=l-h*this.view.height}this.projectionMatrix.makeOrthographic(o,a,l,c,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}};const _l=4,i1=[.125,.215,.35,.446,.526,.582],aa=20,f0=new d0,r1=new Et;let p0=null,m0=0,g0=0,y0=!1;const la=(1+Math.sqrt(5))/2,vl=1/la,s1=[new V(-la,vl,0),new V(la,vl,0),new V(-vl,0,la),new V(vl,0,la),new V(0,la,-vl),new V(0,la,vl),new V(-1,1,-1),new V(1,1,-1),new V(-1,1,1),new V(1,1,1)];let o1=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,i=.1,s=100){p0=this._renderer.getRenderTarget(),m0=this._renderer.getActiveCubeFace(),g0=this._renderer.getActiveMipmapLevel(),y0=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(e,i,s,o),n>0&&this._blur(o,0,0,n),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=c1(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=l1(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(p0,m0,g0),this._renderer.xr.enabled=y0,e.scissorTest=!1,Ad(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===Ya||e.mapping===Ka?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),p0=this._renderer.getRenderTarget(),m0=this._renderer.getActiveCubeFace(),g0=this._renderer.getActiveMipmapLevel(),y0=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=n||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,i={magFilter:Pr,minFilter:Pr,generateMipmaps:!1,type:Za,format:or,colorSpace:tl,depthBuffer:!1},s=a1(e,n,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=a1(e,n,i);const{_lodMax:o}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=$3(o)),this._blurMaterial=j3(o,e,n)}return s}_compileMaterial(e){const n=new yi(this._lodPlanes[0],e);this._renderer.compile(n,f0)}_sceneToCubeUV(e,n,i,s){const l=new Xi(90,1,n,i),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],h=this._renderer,d=h.autoClear,f=h.toneMapping;h.getClearColor(r1),h.toneMapping=Qs,h.autoClear=!1;const p=new gd({name:"PMREM.Background",side:ri,depthWrite:!1,depthTest:!1}),m=new yi(new c0,p);let _=!1;const y=e.background;y?y.isColor&&(p.color.copy(y),e.background=null,_=!0):(p.color.copy(r1),_=!0);for(let g=0;g<6;g++){const x=g%3;x===0?(l.up.set(0,c[g],0),l.lookAt(u[g],0,0)):x===1?(l.up.set(0,0,c[g]),l.lookAt(0,u[g],0)):(l.up.set(0,c[g],0),l.lookAt(0,0,u[g]));const b=this._cubeSize;Ad(s,x*b,g>2?b:0,b,b),h.setRenderTarget(s),_&&h.render(m,l),h.render(e,l)}m.geometry.dispose(),m.material.dispose(),h.toneMapping=f,h.autoClear=d,e.background=y}_textureToCubeUV(e,n){const i=this._renderer,s=e.mapping===Ya||e.mapping===Ka;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=c1()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=l1());const o=s?this._cubemapMaterial:this._equirectMaterial,a=new yi(this._lodPlanes[0],o),l=o.uniforms;l.envMap.value=e;const c=this._cubeSize;Ad(n,0,0,3*c,2*c),i.setRenderTarget(n),i.render(a,f0)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;const s=this._lodPlanes.length;for(let o=1;o<s;o++){const a=Math.sqrt(this._sigmas[o]*this._sigmas[o]-this._sigmas[o-1]*this._sigmas[o-1]),l=s1[(s-o-1)%s1.length];this._blur(e,o-1,o,a,l)}n.autoClear=i}_blur(e,n,i,s,o){const a=this._pingPongRenderTarget;this._halfBlur(e,a,n,i,s,"latitudinal",o),this._halfBlur(a,e,i,i,s,"longitudinal",o)}_halfBlur(e,n,i,s,o,a,l){const c=this._renderer,u=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,d=new yi(this._lodPlanes[s],u),f=u.uniforms,p=this._sizeLods[i]-1,m=isFinite(o)?Math.PI/(2*p):2*Math.PI/(2*aa-1),_=o/m,y=isFinite(o)?1+Math.floor(h*_):aa;y>aa&&console.warn(`sigmaRadians, ${o}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${aa}`);const g=[];let x=0;for(let E=0;E<aa;++E){const A=E/_,M=Math.exp(-A*A/2);g.push(M),E===0?x+=M:E<y&&(x+=2*M)}for(let E=0;E<g.length;E++)g[E]=g[E]/x;f.envMap.value=e.texture,f.samples.value=y,f.weights.value=g,f.latitudinal.value=a==="latitudinal",l&&(f.poleAxis.value=l);const{_lodMax:b}=this;f.dTheta.value=m,f.mipInt.value=b-i;const v=this._sizeLods[s],T=3*v*(s>b-_l?s-b+_l:0),w=4*(this._cubeSize-v);Ad(n,T,w,3*v,2*v),c.setRenderTarget(n),c.render(d,f0)}};function $3(r){const e=[],n=[],i=[];let s=r;const o=r-_l+1+i1.length;for(let a=0;a<o;a++){const l=Math.pow(2,s);n.push(l);let c=1/l;a>r-_l?c=i1[a-r+_l-1]:a===0&&(c=0),i.push(c);const u=1/(l-2),h=-u,d=1+u,f=[h,h,d,h,d,d,h,h,d,d,h,d],p=6,m=6,_=3,y=2,g=1,x=new Float32Array(_*m*p),b=new Float32Array(y*m*p),v=new Float32Array(g*m*p);for(let w=0;w<p;w++){const E=w%3*2/3-1,A=w>2?0:-1,M=[E,A,0,E+2/3,A,0,E+2/3,A+1,0,E,A,0,E+2/3,A+1,0,E,A+1,0];x.set(M,_*m*w),b.set(f,y*m*w);const S=[w,w,w,w,w,w];v.set(S,g*m*w)}const T=new Di;T.setAttribute("position",new Wi(x,_)),T.setAttribute("uv",new Wi(b,y)),T.setAttribute("faceIndex",new Wi(v,g)),e.push(T),s>_l&&s--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function a1(r,e,n){const i=new eo(r,e,n);return i.texture.mapping=Zh,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Ad(r,e,n,i,s){r.viewport.set(e,n,i,s),r.scissor.set(e,n,i,s)}function j3(r,e,n){const i=new Float32Array(aa),s=new V(0,1,0);return new Ir({name:"SphericalGaussianBlur",defines:{n:aa,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:_0(),fragmentShader:`
4065
4065
 
4066
4066
  precision mediump float;
4067
4067
  precision mediump int;
@@ -4211,17 +4211,17 @@ void main() {
4211
4211
  gl_Position = vec4( position, 1.0 );
4212
4212
 
4213
4213
  }
4214
- `}function HO(r){let e=new WeakMap,n=null;function i(l){if(l&&l.isTexture){const c=l.mapping,u=c===ig||c===rg,h=c===Ya||c===Ka;if(u||h){let d=e.get(l);const f=d!==void 0?d.texture.pmremVersion:0;if(l.isRenderTargetTexture&&l.pmremVersion!==f)return n===null&&(n=new o1(r)),d=u?n.fromEquirectangular(l,d):n.fromCubemap(l,d),d.texture.pmremVersion=l.pmremVersion,e.set(l,d),d.texture;if(d!==void 0)return d.texture;{const p=l.image;return u&&p&&p.height>0||h&&p&&s(p)?(n===null&&(n=new o1(r)),d=u?n.fromEquirectangular(l):n.fromCubemap(l),d.texture.pmremVersion=l.pmremVersion,e.set(l,d),l.addEventListener("dispose",o),d.texture):null}}}return l}function s(l){let c=0;const u=6;for(let h=0;h<u;h++)l[h]!==void 0&&c++;return c===u}function o(l){const c=l.target;c.removeEventListener("dispose",o);const u=e.get(c);u!==void 0&&(e.delete(c),u.dispose())}function a(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:a}}function WO(r){const e={};function n(i){if(e[i]!==void 0)return e[i];let s;switch(i){case"WEBGL_depth_texture":s=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":s=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":s=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":s=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:s=r.getExtension(i)}return e[i]=s,s}return{has:function(i){return n(i)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(i){const s=n(i);return s===null&&Wc("THREE.WebGLRenderer: "+i+" extension not supported."),s}}}function qO(r,e,n,i){const s={},o=new WeakMap;function a(d){const f=d.target;f.index!==null&&e.remove(f.index);for(const m in f.attributes)e.remove(f.attributes[m]);for(const m in f.morphAttributes){const _=f.morphAttributes[m];for(let y=0,g=_.length;y<g;y++)e.remove(_[y])}f.removeEventListener("dispose",a),delete s[f.id];const p=o.get(f);p&&(e.remove(p),o.delete(f)),i.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,n.memory.geometries--}function l(d,f){return s[f.id]===!0||(f.addEventListener("dispose",a),s[f.id]=!0,n.memory.geometries++),f}function c(d){const f=d.attributes;for(const m in f)e.update(f[m],r.ARRAY_BUFFER);const p=d.morphAttributes;for(const m in p){const _=p[m];for(let y=0,g=_.length;y<g;y++)e.update(_[y],r.ARRAY_BUFFER)}}function u(d){const f=[],p=d.index,m=d.attributes.position;let _=0;if(p!==null){const x=p.array;_=p.version;for(let b=0,v=x.length;b<v;b+=3){const T=x[b+0],w=x[b+1],E=x[b+2];f.push(T,w,w,E,E,T)}}else if(m!==void 0){const x=m.array;_=m.version;for(let b=0,v=x.length/3-1;b<v;b+=3){const T=b+0,w=b+1,E=b+2;f.push(T,w,w,E,E,T)}}else return;const y=new(ES(f)?WS:HS)(f,1);y.version=_;const g=o.get(d);g&&e.remove(g),o.set(d,y)}function h(d){const f=o.get(d);if(f){const p=d.index;p!==null&&f.version<p.version&&u(d)}else u(d);return o.get(d)}return{get:l,update:c,getWireframeAttribute:h}}function XO(r,e,n){let i;function s(f){i=f}let o,a;function l(f){o=f.type,a=f.bytesPerElement}function c(f,p){r.drawElements(i,p,o,f*a),n.update(p,i,1)}function u(f,p,m){m!==0&&(r.drawElementsInstanced(i,p,o,f*a,m),n.update(p,i,m))}function h(f,p,m){if(m===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,p,0,o,f,0,m);let y=0;for(let g=0;g<m;g++)y+=p[g];n.update(y,i,1)}function d(f,p,m,_){if(m===0)return;const y=e.get("WEBGL_multi_draw");if(y===null)for(let g=0;g<f.length;g++)u(f[g]/a,p[g],_[g]);else{y.multiDrawElementsInstancedWEBGL(i,p,0,o,f,0,_,0,m);let g=0;for(let x=0;x<m;x++)g+=p[x]*_[x];n.update(g,i,1)}}this.setMode=s,this.setIndex=l,this.render=c,this.renderInstances=u,this.renderMultiDraw=h,this.renderMultiDrawInstances=d}function YO(r){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(o,a,l){switch(n.calls++,a){case r.TRIANGLES:n.triangles+=l*(o/3);break;case r.LINES:n.lines+=l*(o/2);break;case r.LINE_STRIP:n.lines+=l*(o-1);break;case r.LINE_LOOP:n.lines+=l*o;break;case r.POINTS:n.points+=l*o;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function s(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:s,update:i}}function KO(r,e,n){const i=new WeakMap,s=new Sn;function o(a,l,c){const u=a.morphTargetInfluences,h=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,d=h!==void 0?h.length:0;let f=i.get(l);if(f===void 0||f.count!==d){let M=function(){E.dispose(),i.delete(l),l.removeEventListener("dispose",M)};f!==void 0&&f.texture.dispose();const p=l.morphAttributes.position!==void 0,m=l.morphAttributes.normal!==void 0,_=l.morphAttributes.color!==void 0,y=l.morphAttributes.position||[],g=l.morphAttributes.normal||[],x=l.morphAttributes.color||[];let b=0;p===!0&&(b=1),m===!0&&(b=2),_===!0&&(b=3);let v=l.attributes.position.count*b,T=1;v>e.maxTextureSize&&(T=Math.ceil(v/e.maxTextureSize),v=e.maxTextureSize);const w=new Float32Array(v*T*4*d),E=new LS(w,v,T,d);E.type=ns,E.needsUpdate=!0;const A=b*4;for(let S=0;S<d;S++){const R=y[S],O=g[S],P=x[S],C=v*T*4*S;for(let I=0;I<R.count;I++){const L=I*A;p===!0&&(s.fromBufferAttribute(R,I),w[C+L+0]=s.x,w[C+L+1]=s.y,w[C+L+2]=s.z,w[C+L+3]=0),m===!0&&(s.fromBufferAttribute(O,I),w[C+L+4]=s.x,w[C+L+5]=s.y,w[C+L+6]=s.z,w[C+L+7]=0),_===!0&&(s.fromBufferAttribute(P,I),w[C+L+8]=s.x,w[C+L+9]=s.y,w[C+L+10]=s.z,w[C+L+11]=P.itemSize===4?s.w:1)}}f={count:d,texture:E,size:new Pe(v,T)},i.set(l,f),l.addEventListener("dispose",M)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(r,"morphTexture",a.morphTexture,n);else{let p=0;for(let _=0;_<u.length;_++)p+=u[_];const m=l.morphTargetsRelative?1:1-p;c.getUniforms().setValue(r,"morphTargetBaseInfluence",m),c.getUniforms().setValue(r,"morphTargetInfluences",u)}c.getUniforms().setValue(r,"morphTargetsTexture",f.texture,n),c.getUniforms().setValue(r,"morphTargetsTextureSize",f.size)}return{update:o}}function ZO(r,e,n,i){let s=new WeakMap;function o(c){const u=i.render.frame,h=c.geometry,d=e.get(c,h);if(s.get(d)!==u&&(e.update(d),s.set(d,u)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==u&&(n.update(c.instanceMatrix,r.ARRAY_BUFFER),c.instanceColor!==null&&n.update(c.instanceColor,r.ARRAY_BUFFER),s.set(c,u))),c.isSkinnedMesh){const f=c.skeleton;s.get(f)!==u&&(f.update(),s.set(f,u))}return d}function a(){s=new WeakMap}function l(c){const u=c.target;u.removeEventListener("dispose",l),n.remove(u.instanceMatrix),u.instanceColor!==null&&n.remove(u.instanceColor)}return{update:o,dispose:a}}let u1=class extends Ri{constructor(e,n,i,s,o,a,l,c,u,h=Ja){if(h!==Ja&&h!==el)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&h===Ja&&(i=Qo),i===void 0&&h===el&&(i=Qa),super(null,s,o,a,l,c,h,i,u),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=l!==void 0?l:sr,this.minFilter=c!==void 0?c:sr,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}};const h1=new Ri,d1=new u1(1,1),f1=new LS,p1=new _I,m1=new t1,g1=[],y1=[],_1=new Float32Array(16),v1=new Float32Array(9),x1=new Float32Array(4);function xl(r,e,n){const i=r[0];if(i<=0||i>0)return r;const s=e*n;let o=g1[s];if(o===void 0&&(o=new Float32Array(s),g1[s]=o),e!==0){i.toArray(o,0);for(let a=1,l=0;a!==e;++a)l+=n,r[a].toArray(o,l)}return o}function Dn(r,e){if(r.length!==e.length)return!1;for(let n=0,i=r.length;n<i;n++)if(r[n]!==e[n])return!1;return!0}function In(r,e){for(let n=0,i=e.length;n<i;n++)r[n]=e[n]}function Cd(r,e){let n=y1[e];n===void 0&&(n=new Int32Array(e),y1[e]=n);for(let i=0;i!==e;++i)n[i]=r.allocateTextureUnit();return n}function QO(r,e){const n=this.cache;n[0]!==e&&(r.uniform1f(this.addr,e),n[0]=e)}function JO(r,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Dn(n,e))return;r.uniform2fv(this.addr,e),In(n,e)}}function e3(r,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(e.r!==void 0)(n[0]!==e.r||n[1]!==e.g||n[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(Dn(n,e))return;r.uniform3fv(this.addr,e),In(n,e)}}function t3(r,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Dn(n,e))return;r.uniform4fv(this.addr,e),In(n,e)}}function n3(r,e){const n=this.cache,i=e.elements;if(i===void 0){if(Dn(n,e))return;r.uniformMatrix2fv(this.addr,!1,e),In(n,e)}else{if(Dn(n,i))return;x1.set(i),r.uniformMatrix2fv(this.addr,!1,x1),In(n,i)}}function i3(r,e){const n=this.cache,i=e.elements;if(i===void 0){if(Dn(n,e))return;r.uniformMatrix3fv(this.addr,!1,e),In(n,e)}else{if(Dn(n,i))return;v1.set(i),r.uniformMatrix3fv(this.addr,!1,v1),In(n,i)}}function r3(r,e){const n=this.cache,i=e.elements;if(i===void 0){if(Dn(n,e))return;r.uniformMatrix4fv(this.addr,!1,e),In(n,e)}else{if(Dn(n,i))return;_1.set(i),r.uniformMatrix4fv(this.addr,!1,_1),In(n,i)}}function s3(r,e){const n=this.cache;n[0]!==e&&(r.uniform1i(this.addr,e),n[0]=e)}function o3(r,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Dn(n,e))return;r.uniform2iv(this.addr,e),In(n,e)}}function a3(r,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(Dn(n,e))return;r.uniform3iv(this.addr,e),In(n,e)}}function l3(r,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Dn(n,e))return;r.uniform4iv(this.addr,e),In(n,e)}}function c3(r,e){const n=this.cache;n[0]!==e&&(r.uniform1ui(this.addr,e),n[0]=e)}function u3(r,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Dn(n,e))return;r.uniform2uiv(this.addr,e),In(n,e)}}function h3(r,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(Dn(n,e))return;r.uniform3uiv(this.addr,e),In(n,e)}}function d3(r,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Dn(n,e))return;r.uniform4uiv(this.addr,e),In(n,e)}}function f3(r,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(r.uniform1i(this.addr,s),i[0]=s);let o;this.type===r.SAMPLER_2D_SHADOW?(d1.compareFunction=TS,o=d1):o=h1,n.setTexture2D(e||o,s)}function p3(r,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(r.uniform1i(this.addr,s),i[0]=s),n.setTexture3D(e||p1,s)}function m3(r,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(r.uniform1i(this.addr,s),i[0]=s),n.setTextureCube(e||m1,s)}function g3(r,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(r.uniform1i(this.addr,s),i[0]=s),n.setTexture2DArray(e||f1,s)}function y3(r){switch(r){case 5126:return QO;case 35664:return JO;case 35665:return e3;case 35666:return t3;case 35674:return n3;case 35675:return i3;case 35676:return r3;case 5124:case 35670:return s3;case 35667:case 35671:return o3;case 35668:case 35672:return a3;case 35669:case 35673:return l3;case 5125:return c3;case 36294:return u3;case 36295:return h3;case 36296:return d3;case 35678:case 36198:case 36298:case 36306:case 35682:return f3;case 35679:case 36299:case 36307:return p3;case 35680:case 36300:case 36308:case 36293:return m3;case 36289:case 36303:case 36311:case 36292:return g3}}function _3(r,e){r.uniform1fv(this.addr,e)}function v3(r,e){const n=xl(e,this.size,2);r.uniform2fv(this.addr,n)}function x3(r,e){const n=xl(e,this.size,3);r.uniform3fv(this.addr,n)}function b3(r,e){const n=xl(e,this.size,4);r.uniform4fv(this.addr,n)}function S3(r,e){const n=xl(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,n)}function T3(r,e){const n=xl(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,n)}function w3(r,e){const n=xl(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,n)}function M3(r,e){r.uniform1iv(this.addr,e)}function E3(r,e){r.uniform2iv(this.addr,e)}function A3(r,e){r.uniform3iv(this.addr,e)}function C3(r,e){r.uniform4iv(this.addr,e)}function R3(r,e){r.uniform1uiv(this.addr,e)}function N3(r,e){r.uniform2uiv(this.addr,e)}function P3(r,e){r.uniform3uiv(this.addr,e)}function D3(r,e){r.uniform4uiv(this.addr,e)}function I3(r,e,n){const i=this.cache,s=e.length,o=Cd(n,s);Dn(i,o)||(r.uniform1iv(this.addr,o),In(i,o));for(let a=0;a!==s;++a)n.setTexture2D(e[a]||h1,o[a])}function L3(r,e,n){const i=this.cache,s=e.length,o=Cd(n,s);Dn(i,o)||(r.uniform1iv(this.addr,o),In(i,o));for(let a=0;a!==s;++a)n.setTexture3D(e[a]||p1,o[a])}function O3(r,e,n){const i=this.cache,s=e.length,o=Cd(n,s);Dn(i,o)||(r.uniform1iv(this.addr,o),In(i,o));for(let a=0;a!==s;++a)n.setTextureCube(e[a]||m1,o[a])}function F3(r,e,n){const i=this.cache,s=e.length,o=Cd(n,s);Dn(i,o)||(r.uniform1iv(this.addr,o),In(i,o));for(let a=0;a!==s;++a)n.setTexture2DArray(e[a]||f1,o[a])}function U3(r){switch(r){case 5126:return _3;case 35664:return v3;case 35665:return x3;case 35666:return b3;case 35674:return S3;case 35675:return T3;case 35676:return w3;case 5124:case 35670:return M3;case 35667:case 35671:return E3;case 35668:case 35672:return A3;case 35669:case 35673:return C3;case 5125:return R3;case 36294:return N3;case 36295:return P3;case 36296:return D3;case 35678:case 36198:case 36298:case 36306:case 35682:return I3;case 35679:case 36299:case 36307:return L3;case 35680:case 36300:case 36308:case 36293:return O3;case 36289:case 36303:case 36311:case 36292:return F3}}class B3{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.setValue=y3(n.type)}}class k3{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=U3(n.type)}}class z3{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,i){const s=this.seq;for(let o=0,a=s.length;o!==a;++o){const l=s[o];l.setValue(e,n[l.id],i)}}}const v0=/(\w+)(\])?(\[|\.)?/g;function b1(r,e){r.seq.push(e),r.map[e.id]=e}function G3(r,e,n){const i=r.name,s=i.length;for(v0.lastIndex=0;;){const o=v0.exec(i),a=v0.lastIndex;let l=o[1];const c=o[2]==="]",u=o[3];if(c&&(l=l|0),u===void 0||u==="["&&a+2===s){b1(n,u===void 0?new B3(l,r,e):new k3(l,r,e));break}else{let d=n.map[l];d===void 0&&(d=new z3(l),b1(n,d)),n=d}}}class Rd{constructor(e,n){this.seq=[],this.map={};const i=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let s=0;s<i;++s){const o=e.getActiveUniform(n,s),a=e.getUniformLocation(n,o.name);G3(o,a,this)}}setValue(e,n,i,s){const o=this.map[n];o!==void 0&&o.setValue(e,i,s)}setOptional(e,n,i){const s=n[i];s!==void 0&&this.setValue(e,i,s)}static upload(e,n,i,s){for(let o=0,a=n.length;o!==a;++o){const l=n[o],c=i[l.id];c.needsUpdate!==!1&&l.setValue(e,c.value,s)}}static seqWithValue(e,n){const i=[];for(let s=0,o=e.length;s!==o;++s){const a=e[s];a.id in n&&i.push(a)}return i}}function S1(r,e,n){const i=r.createShader(e);return r.shaderSource(i,n),r.compileShader(i),i}const V3=37297;let $3=0;function j3(r,e){const n=r.split(`
4214
+ `}function H3(r){let e=new WeakMap,n=null;function i(l){if(l&&l.isTexture){const c=l.mapping,u=c===ig||c===rg,h=c===Ya||c===Ka;if(u||h){let d=e.get(l);const f=d!==void 0?d.texture.pmremVersion:0;if(l.isRenderTargetTexture&&l.pmremVersion!==f)return n===null&&(n=new o1(r)),d=u?n.fromEquirectangular(l,d):n.fromCubemap(l,d),d.texture.pmremVersion=l.pmremVersion,e.set(l,d),d.texture;if(d!==void 0)return d.texture;{const p=l.image;return u&&p&&p.height>0||h&&p&&s(p)?(n===null&&(n=new o1(r)),d=u?n.fromEquirectangular(l):n.fromCubemap(l),d.texture.pmremVersion=l.pmremVersion,e.set(l,d),l.addEventListener("dispose",o),d.texture):null}}}return l}function s(l){let c=0;const u=6;for(let h=0;h<u;h++)l[h]!==void 0&&c++;return c===u}function o(l){const c=l.target;c.removeEventListener("dispose",o);const u=e.get(c);u!==void 0&&(e.delete(c),u.dispose())}function a(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:a}}function W3(r){const e={};function n(i){if(e[i]!==void 0)return e[i];let s;switch(i){case"WEBGL_depth_texture":s=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":s=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":s=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":s=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:s=r.getExtension(i)}return e[i]=s,s}return{has:function(i){return n(i)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(i){const s=n(i);return s===null&&Wc("THREE.WebGLRenderer: "+i+" extension not supported."),s}}}function q3(r,e,n,i){const s={},o=new WeakMap;function a(d){const f=d.target;f.index!==null&&e.remove(f.index);for(const m in f.attributes)e.remove(f.attributes[m]);for(const m in f.morphAttributes){const _=f.morphAttributes[m];for(let y=0,g=_.length;y<g;y++)e.remove(_[y])}f.removeEventListener("dispose",a),delete s[f.id];const p=o.get(f);p&&(e.remove(p),o.delete(f)),i.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,n.memory.geometries--}function l(d,f){return s[f.id]===!0||(f.addEventListener("dispose",a),s[f.id]=!0,n.memory.geometries++),f}function c(d){const f=d.attributes;for(const m in f)e.update(f[m],r.ARRAY_BUFFER);const p=d.morphAttributes;for(const m in p){const _=p[m];for(let y=0,g=_.length;y<g;y++)e.update(_[y],r.ARRAY_BUFFER)}}function u(d){const f=[],p=d.index,m=d.attributes.position;let _=0;if(p!==null){const x=p.array;_=p.version;for(let b=0,v=x.length;b<v;b+=3){const T=x[b+0],w=x[b+1],E=x[b+2];f.push(T,w,w,E,E,T)}}else if(m!==void 0){const x=m.array;_=m.version;for(let b=0,v=x.length/3-1;b<v;b+=3){const T=b+0,w=b+1,E=b+2;f.push(T,w,w,E,E,T)}}else return;const y=new(ES(f)?WS:HS)(f,1);y.version=_;const g=o.get(d);g&&e.remove(g),o.set(d,y)}function h(d){const f=o.get(d);if(f){const p=d.index;p!==null&&f.version<p.version&&u(d)}else u(d);return o.get(d)}return{get:l,update:c,getWireframeAttribute:h}}function X3(r,e,n){let i;function s(f){i=f}let o,a;function l(f){o=f.type,a=f.bytesPerElement}function c(f,p){r.drawElements(i,p,o,f*a),n.update(p,i,1)}function u(f,p,m){m!==0&&(r.drawElementsInstanced(i,p,o,f*a,m),n.update(p,i,m))}function h(f,p,m){if(m===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,p,0,o,f,0,m);let y=0;for(let g=0;g<m;g++)y+=p[g];n.update(y,i,1)}function d(f,p,m,_){if(m===0)return;const y=e.get("WEBGL_multi_draw");if(y===null)for(let g=0;g<f.length;g++)u(f[g]/a,p[g],_[g]);else{y.multiDrawElementsInstancedWEBGL(i,p,0,o,f,0,_,0,m);let g=0;for(let x=0;x<m;x++)g+=p[x]*_[x];n.update(g,i,1)}}this.setMode=s,this.setIndex=l,this.render=c,this.renderInstances=u,this.renderMultiDraw=h,this.renderMultiDrawInstances=d}function Y3(r){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(o,a,l){switch(n.calls++,a){case r.TRIANGLES:n.triangles+=l*(o/3);break;case r.LINES:n.lines+=l*(o/2);break;case r.LINE_STRIP:n.lines+=l*(o-1);break;case r.LINE_LOOP:n.lines+=l*o;break;case r.POINTS:n.points+=l*o;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function s(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:s,update:i}}function K3(r,e,n){const i=new WeakMap,s=new Sn;function o(a,l,c){const u=a.morphTargetInfluences,h=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,d=h!==void 0?h.length:0;let f=i.get(l);if(f===void 0||f.count!==d){let M=function(){E.dispose(),i.delete(l),l.removeEventListener("dispose",M)};f!==void 0&&f.texture.dispose();const p=l.morphAttributes.position!==void 0,m=l.morphAttributes.normal!==void 0,_=l.morphAttributes.color!==void 0,y=l.morphAttributes.position||[],g=l.morphAttributes.normal||[],x=l.morphAttributes.color||[];let b=0;p===!0&&(b=1),m===!0&&(b=2),_===!0&&(b=3);let v=l.attributes.position.count*b,T=1;v>e.maxTextureSize&&(T=Math.ceil(v/e.maxTextureSize),v=e.maxTextureSize);const w=new Float32Array(v*T*4*d),E=new LS(w,v,T,d);E.type=ns,E.needsUpdate=!0;const A=b*4;for(let S=0;S<d;S++){const R=y[S],O=g[S],P=x[S],C=v*T*4*S;for(let I=0;I<R.count;I++){const L=I*A;p===!0&&(s.fromBufferAttribute(R,I),w[C+L+0]=s.x,w[C+L+1]=s.y,w[C+L+2]=s.z,w[C+L+3]=0),m===!0&&(s.fromBufferAttribute(O,I),w[C+L+4]=s.x,w[C+L+5]=s.y,w[C+L+6]=s.z,w[C+L+7]=0),_===!0&&(s.fromBufferAttribute(P,I),w[C+L+8]=s.x,w[C+L+9]=s.y,w[C+L+10]=s.z,w[C+L+11]=P.itemSize===4?s.w:1)}}f={count:d,texture:E,size:new Pe(v,T)},i.set(l,f),l.addEventListener("dispose",M)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(r,"morphTexture",a.morphTexture,n);else{let p=0;for(let _=0;_<u.length;_++)p+=u[_];const m=l.morphTargetsRelative?1:1-p;c.getUniforms().setValue(r,"morphTargetBaseInfluence",m),c.getUniforms().setValue(r,"morphTargetInfluences",u)}c.getUniforms().setValue(r,"morphTargetsTexture",f.texture,n),c.getUniforms().setValue(r,"morphTargetsTextureSize",f.size)}return{update:o}}function Z3(r,e,n,i){let s=new WeakMap;function o(c){const u=i.render.frame,h=c.geometry,d=e.get(c,h);if(s.get(d)!==u&&(e.update(d),s.set(d,u)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==u&&(n.update(c.instanceMatrix,r.ARRAY_BUFFER),c.instanceColor!==null&&n.update(c.instanceColor,r.ARRAY_BUFFER),s.set(c,u))),c.isSkinnedMesh){const f=c.skeleton;s.get(f)!==u&&(f.update(),s.set(f,u))}return d}function a(){s=new WeakMap}function l(c){const u=c.target;u.removeEventListener("dispose",l),n.remove(u.instanceMatrix),u.instanceColor!==null&&n.remove(u.instanceColor)}return{update:o,dispose:a}}let u1=class extends Ri{constructor(e,n,i,s,o,a,l,c,u,h=Ja){if(h!==Ja&&h!==el)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&h===Ja&&(i=Qo),i===void 0&&h===el&&(i=Qa),super(null,s,o,a,l,c,h,i,u),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=l!==void 0?l:sr,this.minFilter=c!==void 0?c:sr,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}};const h1=new Ri,d1=new u1(1,1),f1=new LS,p1=new _I,m1=new t1,g1=[],y1=[],_1=new Float32Array(16),v1=new Float32Array(9),x1=new Float32Array(4);function xl(r,e,n){const i=r[0];if(i<=0||i>0)return r;const s=e*n;let o=g1[s];if(o===void 0&&(o=new Float32Array(s),g1[s]=o),e!==0){i.toArray(o,0);for(let a=1,l=0;a!==e;++a)l+=n,r[a].toArray(o,l)}return o}function Dn(r,e){if(r.length!==e.length)return!1;for(let n=0,i=r.length;n<i;n++)if(r[n]!==e[n])return!1;return!0}function In(r,e){for(let n=0,i=e.length;n<i;n++)r[n]=e[n]}function Cd(r,e){let n=y1[e];n===void 0&&(n=new Int32Array(e),y1[e]=n);for(let i=0;i!==e;++i)n[i]=r.allocateTextureUnit();return n}function Q3(r,e){const n=this.cache;n[0]!==e&&(r.uniform1f(this.addr,e),n[0]=e)}function J3(r,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Dn(n,e))return;r.uniform2fv(this.addr,e),In(n,e)}}function eO(r,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(e.r!==void 0)(n[0]!==e.r||n[1]!==e.g||n[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(Dn(n,e))return;r.uniform3fv(this.addr,e),In(n,e)}}function tO(r,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Dn(n,e))return;r.uniform4fv(this.addr,e),In(n,e)}}function nO(r,e){const n=this.cache,i=e.elements;if(i===void 0){if(Dn(n,e))return;r.uniformMatrix2fv(this.addr,!1,e),In(n,e)}else{if(Dn(n,i))return;x1.set(i),r.uniformMatrix2fv(this.addr,!1,x1),In(n,i)}}function iO(r,e){const n=this.cache,i=e.elements;if(i===void 0){if(Dn(n,e))return;r.uniformMatrix3fv(this.addr,!1,e),In(n,e)}else{if(Dn(n,i))return;v1.set(i),r.uniformMatrix3fv(this.addr,!1,v1),In(n,i)}}function rO(r,e){const n=this.cache,i=e.elements;if(i===void 0){if(Dn(n,e))return;r.uniformMatrix4fv(this.addr,!1,e),In(n,e)}else{if(Dn(n,i))return;_1.set(i),r.uniformMatrix4fv(this.addr,!1,_1),In(n,i)}}function sO(r,e){const n=this.cache;n[0]!==e&&(r.uniform1i(this.addr,e),n[0]=e)}function oO(r,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Dn(n,e))return;r.uniform2iv(this.addr,e),In(n,e)}}function aO(r,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(Dn(n,e))return;r.uniform3iv(this.addr,e),In(n,e)}}function lO(r,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Dn(n,e))return;r.uniform4iv(this.addr,e),In(n,e)}}function cO(r,e){const n=this.cache;n[0]!==e&&(r.uniform1ui(this.addr,e),n[0]=e)}function uO(r,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Dn(n,e))return;r.uniform2uiv(this.addr,e),In(n,e)}}function hO(r,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(Dn(n,e))return;r.uniform3uiv(this.addr,e),In(n,e)}}function dO(r,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Dn(n,e))return;r.uniform4uiv(this.addr,e),In(n,e)}}function fO(r,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(r.uniform1i(this.addr,s),i[0]=s);let o;this.type===r.SAMPLER_2D_SHADOW?(d1.compareFunction=TS,o=d1):o=h1,n.setTexture2D(e||o,s)}function pO(r,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(r.uniform1i(this.addr,s),i[0]=s),n.setTexture3D(e||p1,s)}function mO(r,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(r.uniform1i(this.addr,s),i[0]=s),n.setTextureCube(e||m1,s)}function gO(r,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(r.uniform1i(this.addr,s),i[0]=s),n.setTexture2DArray(e||f1,s)}function yO(r){switch(r){case 5126:return Q3;case 35664:return J3;case 35665:return eO;case 35666:return tO;case 35674:return nO;case 35675:return iO;case 35676:return rO;case 5124:case 35670:return sO;case 35667:case 35671:return oO;case 35668:case 35672:return aO;case 35669:case 35673:return lO;case 5125:return cO;case 36294:return uO;case 36295:return hO;case 36296:return dO;case 35678:case 36198:case 36298:case 36306:case 35682:return fO;case 35679:case 36299:case 36307:return pO;case 35680:case 36300:case 36308:case 36293:return mO;case 36289:case 36303:case 36311:case 36292:return gO}}function _O(r,e){r.uniform1fv(this.addr,e)}function vO(r,e){const n=xl(e,this.size,2);r.uniform2fv(this.addr,n)}function xO(r,e){const n=xl(e,this.size,3);r.uniform3fv(this.addr,n)}function bO(r,e){const n=xl(e,this.size,4);r.uniform4fv(this.addr,n)}function SO(r,e){const n=xl(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,n)}function TO(r,e){const n=xl(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,n)}function wO(r,e){const n=xl(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,n)}function MO(r,e){r.uniform1iv(this.addr,e)}function EO(r,e){r.uniform2iv(this.addr,e)}function AO(r,e){r.uniform3iv(this.addr,e)}function CO(r,e){r.uniform4iv(this.addr,e)}function RO(r,e){r.uniform1uiv(this.addr,e)}function NO(r,e){r.uniform2uiv(this.addr,e)}function PO(r,e){r.uniform3uiv(this.addr,e)}function DO(r,e){r.uniform4uiv(this.addr,e)}function IO(r,e,n){const i=this.cache,s=e.length,o=Cd(n,s);Dn(i,o)||(r.uniform1iv(this.addr,o),In(i,o));for(let a=0;a!==s;++a)n.setTexture2D(e[a]||h1,o[a])}function LO(r,e,n){const i=this.cache,s=e.length,o=Cd(n,s);Dn(i,o)||(r.uniform1iv(this.addr,o),In(i,o));for(let a=0;a!==s;++a)n.setTexture3D(e[a]||p1,o[a])}function OO(r,e,n){const i=this.cache,s=e.length,o=Cd(n,s);Dn(i,o)||(r.uniform1iv(this.addr,o),In(i,o));for(let a=0;a!==s;++a)n.setTextureCube(e[a]||m1,o[a])}function FO(r,e,n){const i=this.cache,s=e.length,o=Cd(n,s);Dn(i,o)||(r.uniform1iv(this.addr,o),In(i,o));for(let a=0;a!==s;++a)n.setTexture2DArray(e[a]||f1,o[a])}function UO(r){switch(r){case 5126:return _O;case 35664:return vO;case 35665:return xO;case 35666:return bO;case 35674:return SO;case 35675:return TO;case 35676:return wO;case 5124:case 35670:return MO;case 35667:case 35671:return EO;case 35668:case 35672:return AO;case 35669:case 35673:return CO;case 5125:return RO;case 36294:return NO;case 36295:return PO;case 36296:return DO;case 35678:case 36198:case 36298:case 36306:case 35682:return IO;case 35679:case 36299:case 36307:return LO;case 35680:case 36300:case 36308:case 36293:return OO;case 36289:case 36303:case 36311:case 36292:return FO}}class BO{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.setValue=yO(n.type)}}class kO{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=UO(n.type)}}class zO{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,i){const s=this.seq;for(let o=0,a=s.length;o!==a;++o){const l=s[o];l.setValue(e,n[l.id],i)}}}const v0=/(\w+)(\])?(\[|\.)?/g;function b1(r,e){r.seq.push(e),r.map[e.id]=e}function GO(r,e,n){const i=r.name,s=i.length;for(v0.lastIndex=0;;){const o=v0.exec(i),a=v0.lastIndex;let l=o[1];const c=o[2]==="]",u=o[3];if(c&&(l=l|0),u===void 0||u==="["&&a+2===s){b1(n,u===void 0?new BO(l,r,e):new kO(l,r,e));break}else{let d=n.map[l];d===void 0&&(d=new zO(l),b1(n,d)),n=d}}}class Rd{constructor(e,n){this.seq=[],this.map={};const i=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let s=0;s<i;++s){const o=e.getActiveUniform(n,s),a=e.getUniformLocation(n,o.name);GO(o,a,this)}}setValue(e,n,i,s){const o=this.map[n];o!==void 0&&o.setValue(e,i,s)}setOptional(e,n,i){const s=n[i];s!==void 0&&this.setValue(e,i,s)}static upload(e,n,i,s){for(let o=0,a=n.length;o!==a;++o){const l=n[o],c=i[l.id];c.needsUpdate!==!1&&l.setValue(e,c.value,s)}}static seqWithValue(e,n){const i=[];for(let s=0,o=e.length;s!==o;++s){const a=e[s];a.id in n&&i.push(a)}return i}}function S1(r,e,n){const i=r.createShader(e);return r.shaderSource(i,n),r.compileShader(i),i}const VO=37297;let $O=0;function jO(r,e){const n=r.split(`
4215
4215
  `),i=[],s=Math.max(e-6,0),o=Math.min(e+6,n.length);for(let a=s;a<o;a++){const l=a+1;i.push(`${l===e?">":" "} ${l}: ${n[a]}`)}return i.join(`
4216
- `)}const T1=new bt;function H3(r){Dt._getMatrix(T1,Dt.workingColorSpace,r);const e=`mat3( ${T1.elements.map(n=>n.toFixed(4))} )`;switch(Dt.getTransfer(r)){case rd:return[e,"LinearTransferOETF"];case Kt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function w1(r,e,n){const i=r.getShaderParameter(e,r.COMPILE_STATUS),s=r.getShaderInfoLog(e).trim();if(i&&s==="")return"";const o=/ERROR: 0:(\d+)/.exec(s);if(o){const a=parseInt(o[1]);return n.toUpperCase()+`
4216
+ `)}const T1=new bt;function HO(r){Dt._getMatrix(T1,Dt.workingColorSpace,r);const e=`mat3( ${T1.elements.map(n=>n.toFixed(4))} )`;switch(Dt.getTransfer(r)){case rd:return[e,"LinearTransferOETF"];case Kt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function w1(r,e,n){const i=r.getShaderParameter(e,r.COMPILE_STATUS),s=r.getShaderInfoLog(e).trim();if(i&&s==="")return"";const o=/ERROR: 0:(\d+)/.exec(s);if(o){const a=parseInt(o[1]);return n.toUpperCase()+`
4217
4217
 
4218
4218
  `+s+`
4219
4219
 
4220
- `+j3(r.getShaderSource(e),a)}else return s}function W3(r,e){const n=H3(e);return[`vec4 ${r}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
4221
- `)}function q3(r,e){let n;switch(e){case ND:n="Linear";break;case PD:n="Reinhard";break;case DD:n="Cineon";break;case ID:n="ACESFilmic";break;case OD:n="AgX";break;case FD:n="Neutral";break;case LD:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+r+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const Nd=new V;function X3(){Dt.getLuminanceCoefficients(Nd);const r=Nd.x.toFixed(4),e=Nd.y.toFixed(4),n=Nd.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(`
4222
- `)}function Y3(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Qc).join(`
4223
- `)}function K3(r){const e=[];for(const n in r){const i=r[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join(`
4224
- `)}function Z3(r,e){const n={},i=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const o=r.getActiveAttrib(e,s),a=o.name;let l=1;o.type===r.FLOAT_MAT2&&(l=2),o.type===r.FLOAT_MAT3&&(l=3),o.type===r.FLOAT_MAT4&&(l=4),n[a]={type:o.type,location:r.getAttribLocation(e,a),locationSize:l}}return n}function Qc(r){return r!==""}function M1(r,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function E1(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Q3=/^[ \t]*#include +<([\w\d./]+)>/gm;function x0(r){return r.replace(Q3,eF)}const J3=new Map;function eF(r,e){let n=vt[e];if(n===void 0){const i=J3.get(e);if(i!==void 0)n=vt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return x0(n)}const tF=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function A1(r){return r.replace(tF,nF)}function nF(r,e,n,i){let s="";for(let o=parseInt(e);o<parseInt(n);o++)s+=i.replace(/\[\s*i\s*\]/g,"[ "+o+" ]").replace(/UNROLLED_LOOP_INDEX/g,o);return s}function C1(r){let e=`precision ${r.precision} float;
4220
+ `+jO(r.getShaderSource(e),a)}else return s}function WO(r,e){const n=HO(e);return[`vec4 ${r}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
4221
+ `)}function qO(r,e){let n;switch(e){case ND:n="Linear";break;case PD:n="Reinhard";break;case DD:n="Cineon";break;case ID:n="ACESFilmic";break;case OD:n="AgX";break;case FD:n="Neutral";break;case LD:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+r+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const Nd=new V;function XO(){Dt.getLuminanceCoefficients(Nd);const r=Nd.x.toFixed(4),e=Nd.y.toFixed(4),n=Nd.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(`
4222
+ `)}function YO(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Qc).join(`
4223
+ `)}function KO(r){const e=[];for(const n in r){const i=r[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join(`
4224
+ `)}function ZO(r,e){const n={},i=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const o=r.getActiveAttrib(e,s),a=o.name;let l=1;o.type===r.FLOAT_MAT2&&(l=2),o.type===r.FLOAT_MAT3&&(l=3),o.type===r.FLOAT_MAT4&&(l=4),n[a]={type:o.type,location:r.getAttribLocation(e,a),locationSize:l}}return n}function Qc(r){return r!==""}function M1(r,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function E1(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const QO=/^[ \t]*#include +<([\w\d./]+)>/gm;function x0(r){return r.replace(QO,eF)}const JO=new Map;function eF(r,e){let n=vt[e];if(n===void 0){const i=JO.get(e);if(i!==void 0)n=vt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return x0(n)}const tF=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function A1(r){return r.replace(tF,nF)}function nF(r,e,n,i){let s="";for(let o=parseInt(e);o<parseInt(n);o++)s+=i.replace(/\[\s*i\s*\]/g,"[ "+o+" ]").replace(/UNROLLED_LOOP_INDEX/g,o);return s}function C1(r){let e=`precision ${r.precision} float;
4225
4225
  precision ${r.precision} int;
4226
4226
  precision ${r.precision} sampler2D;
4227
4227
  precision ${r.precision} samplerCube;
@@ -4241,14 +4241,14 @@ void main() {
4241
4241
  `;return r.precision==="highp"?e+=`
4242
4242
  #define HIGH_PRECISION`:r.precision==="mediump"?e+=`
4243
4243
  #define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
4244
- #define LOW_PRECISION`),e}function iF(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===oS?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===cD?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===Qr&&(e="SHADOWMAP_TYPE_VSM"),e}function rF(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case Ya:case Ka:e="ENVMAP_TYPE_CUBE";break;case Zh:e="ENVMAP_TYPE_CUBE_UV";break}return e}function sF(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case Ka:e="ENVMAP_MODE_REFRACTION";break}return e}function oF(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case ng:e="ENVMAP_BLENDING_MULTIPLY";break;case CD:e="ENVMAP_BLENDING_MIX";break;case RD:e="ENVMAP_BLENDING_ADD";break}return e}function aF(r){const e=r.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),7*16)),texelHeight:i,maxMip:n}}function lF(r,e,n,i){const s=r.getContext(),o=n.defines;let a=n.vertexShader,l=n.fragmentShader;const c=iF(n),u=rF(n),h=sF(n),d=oF(n),f=aF(n),p=Y3(n),m=K3(o),_=s.createProgram();let y,g,x=n.glslVersion?"#version "+n.glslVersion+`
4244
+ #define LOW_PRECISION`),e}function iF(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===oS?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===cD?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===Qr&&(e="SHADOWMAP_TYPE_VSM"),e}function rF(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case Ya:case Ka:e="ENVMAP_TYPE_CUBE";break;case Zh:e="ENVMAP_TYPE_CUBE_UV";break}return e}function sF(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case Ka:e="ENVMAP_MODE_REFRACTION";break}return e}function oF(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case ng:e="ENVMAP_BLENDING_MULTIPLY";break;case CD:e="ENVMAP_BLENDING_MIX";break;case RD:e="ENVMAP_BLENDING_ADD";break}return e}function aF(r){const e=r.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),7*16)),texelHeight:i,maxMip:n}}function lF(r,e,n,i){const s=r.getContext(),o=n.defines;let a=n.vertexShader,l=n.fragmentShader;const c=iF(n),u=rF(n),h=sF(n),d=oF(n),f=aF(n),p=YO(n),m=KO(o),_=s.createProgram();let y,g,x=n.glslVersion?"#version "+n.glslVersion+`
4245
4245
  `:"";n.isRawShaderMaterial?(y=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(Qc).join(`
4246
4246
  `),y.length>0&&(y+=`
4247
4247
  `),g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(Qc).join(`
4248
4248
  `),g.length>0&&(g+=`
4249
4249
  `)):(y=[C1(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
4250
4250
  `].filter(Qc).join(`
4251
- `),g=[C1(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.envMap?"#define "+h:"",n.envMap?"#define "+d:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Qs?"#define TONE_MAPPING":"",n.toneMapping!==Qs?vt.tonemapping_pars_fragment:"",n.toneMapping!==Qs?q3("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",vt.colorspace_pars_fragment,W3("linearToOutputTexel",n.outputColorSpace),X3(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
4251
+ `),g=[C1(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.envMap?"#define "+h:"",n.envMap?"#define "+d:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Qs?"#define TONE_MAPPING":"",n.toneMapping!==Qs?vt.tonemapping_pars_fragment:"",n.toneMapping!==Qs?qO("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",vt.colorspace_pars_fragment,WO("linearToOutputTexel",n.outputColorSpace),XO(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
4252
4252
  `].filter(Qc).join(`
4253
4253
  `)),a=x0(a),a=M1(a,n),a=E1(a,n),l=x0(l),l=M1(l,n),l=E1(l,n),a=A1(a),l=A1(l),n.isRawShaderMaterial!==!0&&(x=`#version 300 es
4254
4254
  `,y=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(`
@@ -4262,7 +4262,7 @@ Material Type: `+R.type+`
4262
4262
 
4263
4263
  Program Info Log: `+O+`
4264
4264
  `+W+`
4265
- `+$)}else O!==""?console.warn("THREE.WebGLProgram: Program Info Log:",O):(P===""||C==="")&&(L=!1);L&&(R.diagnostics={runnable:I,programLog:O,vertexShader:{log:P,prefix:y},fragmentShader:{log:C,prefix:g}})}s.deleteShader(T),s.deleteShader(w),A=new Rd(s,_),M=Z3(s,_)}let A;this.getUniforms=function(){return A===void 0&&E(this),A};let M;this.getAttributes=function(){return M===void 0&&E(this),M};let S=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return S===!1&&(S=s.getProgramParameter(_,V3)),S},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(_),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=$3++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=T,this.fragmentShader=w,this}let cF=0;class uF{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,i=e.fragmentShader,s=this._getShaderStage(n),o=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(s)===!1&&(a.add(s),s.usedTimes++),a.has(o)===!1&&(a.add(o),o.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const i of n)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let i=n.get(e);return i===void 0&&(i=new Set,n.set(e,i)),i}_getShaderStage(e){const n=this.shaderCache;let i=n.get(e);return i===void 0&&(i=new hF(e),n.set(e,i)),i}}class hF{constructor(e){this.id=cF++,this.code=e,this.usedTimes=0}}function dF(r,e,n,i,s,o,a){const l=new Zg,c=new uF,u=new Set,h=[],d=s.logarithmicDepthBuffer,f=s.vertexTextures;let p=s.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(M){return u.add(M),M===0?"uv":`uv${M}`}function y(M,S,R,O,P){const C=O.fog,I=P.geometry,L=M.isMeshStandardMaterial?O.environment:null,W=(M.isMeshStandardMaterial?n:e).get(M.envMap||L),$=W&&W.mapping===Zh?W.image.height:null,ie=m[M.type];M.precision!==null&&(p=s.getMaxPrecision(M.precision),p!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",p,"instead."));const U=I.morphAttributes.position||I.morphAttributes.normal||I.morphAttributes.color,k=U!==void 0?U.length:0;let re=0;I.morphAttributes.position!==void 0&&(re=1),I.morphAttributes.normal!==void 0&&(re=2),I.morphAttributes.color!==void 0&&(re=3);let he,F,G,ee;if(ie){const Ft=Lr[ie];he=Ft.vertexShader,F=Ft.fragmentShader}else he=M.vertexShader,F=M.fragmentShader,c.update(M),G=c.getVertexShaderID(M),ee=c.getFragmentShaderID(M);const J=r.getRenderTarget(),ue=r.state.buffers.depth.getReversed(),be=P.isInstancedMesh===!0,Te=P.isBatchedMesh===!0,je=!!M.map,pe=!!M.matcap,ot=!!W,q=!!M.aoMap,Ct=!!M.lightMap,at=!!M.bumpMap,pt=!!M.normalMap,Je=!!M.displacementMap,Ot=!!M.emissiveMap,Ze=!!M.metalnessMap,B=!!M.roughnessMap,N=M.anisotropy>0,se=M.clearcoat>0,ve=M.dispersion>0,Se=M.iridescence>0,me=M.sheen>0,Ge=M.transmission>0,Oe=N&&!!M.anisotropyMap,ze=se&&!!M.clearcoatMap,tt=se&&!!M.clearcoatNormalMap,Me=se&&!!M.clearcoatRoughnessMap,Ve=Se&&!!M.iridescenceMap,et=Se&&!!M.iridescenceThicknessMap,st=me&&!!M.sheenColorMap,$e=me&&!!M.sheenRoughnessMap,St=!!M.specularMap,yt=!!M.specularColorMap,Ht=!!M.specularIntensityMap,Y=Ge&&!!M.transmissionMap,De=Ge&&!!M.thicknessMap,le=!!M.gradientMap,xe=!!M.alphaMap,Be=M.alphaTest>0,ke=!!M.alphaHash,ht=!!M.extensions;let fn=Qs;M.toneMapped&&(J===null||J.isXRRenderTarget===!0)&&(fn=r.toneMapping);const On={shaderID:ie,shaderType:M.type,shaderName:M.name,vertexShader:he,fragmentShader:F,defines:M.defines,customVertexShaderID:G,customFragmentShaderID:ee,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:p,batching:Te,batchingColor:Te&&P._colorsTexture!==null,instancing:be,instancingColor:be&&P.instanceColor!==null,instancingMorph:be&&P.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:J===null?r.outputColorSpace:J.isXRRenderTarget===!0?J.texture.colorSpace:tl,alphaToCoverage:!!M.alphaToCoverage,map:je,matcap:pe,envMap:ot,envMapMode:ot&&W.mapping,envMapCubeUVHeight:$,aoMap:q,lightMap:Ct,bumpMap:at,normalMap:pt,displacementMap:f&&Je,emissiveMap:Ot,normalMapObjectSpace:pt&&M.normalMapType===zD,normalMapTangentSpace:pt&&M.normalMapType===bS,metalnessMap:Ze,roughnessMap:B,anisotropy:N,anisotropyMap:Oe,clearcoat:se,clearcoatMap:ze,clearcoatNormalMap:tt,clearcoatRoughnessMap:Me,dispersion:ve,iridescence:Se,iridescenceMap:Ve,iridescenceThicknessMap:et,sheen:me,sheenColorMap:st,sheenRoughnessMap:$e,specularMap:St,specularColorMap:yt,specularIntensityMap:Ht,transmission:Ge,transmissionMap:Y,thicknessMap:De,gradientMap:le,opaque:M.transparent===!1&&M.blending===qa&&M.alphaToCoverage===!1,alphaMap:xe,alphaTest:Be,alphaHash:ke,combine:M.combine,mapUv:je&&_(M.map.channel),aoMapUv:q&&_(M.aoMap.channel),lightMapUv:Ct&&_(M.lightMap.channel),bumpMapUv:at&&_(M.bumpMap.channel),normalMapUv:pt&&_(M.normalMap.channel),displacementMapUv:Je&&_(M.displacementMap.channel),emissiveMapUv:Ot&&_(M.emissiveMap.channel),metalnessMapUv:Ze&&_(M.metalnessMap.channel),roughnessMapUv:B&&_(M.roughnessMap.channel),anisotropyMapUv:Oe&&_(M.anisotropyMap.channel),clearcoatMapUv:ze&&_(M.clearcoatMap.channel),clearcoatNormalMapUv:tt&&_(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Me&&_(M.clearcoatRoughnessMap.channel),iridescenceMapUv:Ve&&_(M.iridescenceMap.channel),iridescenceThicknessMapUv:et&&_(M.iridescenceThicknessMap.channel),sheenColorMapUv:st&&_(M.sheenColorMap.channel),sheenRoughnessMapUv:$e&&_(M.sheenRoughnessMap.channel),specularMapUv:St&&_(M.specularMap.channel),specularColorMapUv:yt&&_(M.specularColorMap.channel),specularIntensityMapUv:Ht&&_(M.specularIntensityMap.channel),transmissionMapUv:Y&&_(M.transmissionMap.channel),thicknessMapUv:De&&_(M.thicknessMap.channel),alphaMapUv:xe&&_(M.alphaMap.channel),vertexTangents:!!I.attributes.tangent&&(pt||N),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!I.attributes.color&&I.attributes.color.itemSize===4,pointsUvs:P.isPoints===!0&&!!I.attributes.uv&&(je||xe),fog:!!C,useFog:M.fog===!0,fogExp2:!!C&&C.isFogExp2,flatShading:M.flatShading===!0,sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:d,reverseDepthBuffer:ue,skinning:P.isSkinnedMesh===!0,morphTargets:I.morphAttributes.position!==void 0,morphNormals:I.morphAttributes.normal!==void 0,morphColors:I.morphAttributes.color!==void 0,morphTargetsCount:k,morphTextureStride:re,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numLightProbes:S.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:M.dithering,shadowMapEnabled:r.shadowMap.enabled&&R.length>0,shadowMapType:r.shadowMap.type,toneMapping:fn,decodeVideoTexture:je&&M.map.isVideoTexture===!0&&Dt.getTransfer(M.map.colorSpace)===Kt,decodeVideoTextureEmissive:Ot&&M.emissiveMap.isVideoTexture===!0&&Dt.getTransfer(M.emissiveMap.colorSpace)===Kt,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===Jr,flipSided:M.side===ri,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionClipCullDistance:ht&&M.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ht&&M.extensions.multiDraw===!0||Te)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()};return On.vertexUv1s=u.has(1),On.vertexUv2s=u.has(2),On.vertexUv3s=u.has(3),u.clear(),On}function g(M){const S=[];if(M.shaderID?S.push(M.shaderID):(S.push(M.customVertexShaderID),S.push(M.customFragmentShaderID)),M.defines!==void 0)for(const R in M.defines)S.push(R),S.push(M.defines[R]);return M.isRawShaderMaterial===!1&&(x(S,M),b(S,M),S.push(r.outputColorSpace)),S.push(M.customProgramCacheKey),S.join()}function x(M,S){M.push(S.precision),M.push(S.outputColorSpace),M.push(S.envMapMode),M.push(S.envMapCubeUVHeight),M.push(S.mapUv),M.push(S.alphaMapUv),M.push(S.lightMapUv),M.push(S.aoMapUv),M.push(S.bumpMapUv),M.push(S.normalMapUv),M.push(S.displacementMapUv),M.push(S.emissiveMapUv),M.push(S.metalnessMapUv),M.push(S.roughnessMapUv),M.push(S.anisotropyMapUv),M.push(S.clearcoatMapUv),M.push(S.clearcoatNormalMapUv),M.push(S.clearcoatRoughnessMapUv),M.push(S.iridescenceMapUv),M.push(S.iridescenceThicknessMapUv),M.push(S.sheenColorMapUv),M.push(S.sheenRoughnessMapUv),M.push(S.specularMapUv),M.push(S.specularColorMapUv),M.push(S.specularIntensityMapUv),M.push(S.transmissionMapUv),M.push(S.thicknessMapUv),M.push(S.combine),M.push(S.fogExp2),M.push(S.sizeAttenuation),M.push(S.morphTargetsCount),M.push(S.morphAttributeCount),M.push(S.numDirLights),M.push(S.numPointLights),M.push(S.numSpotLights),M.push(S.numSpotLightMaps),M.push(S.numHemiLights),M.push(S.numRectAreaLights),M.push(S.numDirLightShadows),M.push(S.numPointLightShadows),M.push(S.numSpotLightShadows),M.push(S.numSpotLightShadowsWithMaps),M.push(S.numLightProbes),M.push(S.shadowMapType),M.push(S.toneMapping),M.push(S.numClippingPlanes),M.push(S.numClipIntersection),M.push(S.depthPacking)}function b(M,S){l.disableAll(),S.supportsVertexTextures&&l.enable(0),S.instancing&&l.enable(1),S.instancingColor&&l.enable(2),S.instancingMorph&&l.enable(3),S.matcap&&l.enable(4),S.envMap&&l.enable(5),S.normalMapObjectSpace&&l.enable(6),S.normalMapTangentSpace&&l.enable(7),S.clearcoat&&l.enable(8),S.iridescence&&l.enable(9),S.alphaTest&&l.enable(10),S.vertexColors&&l.enable(11),S.vertexAlphas&&l.enable(12),S.vertexUv1s&&l.enable(13),S.vertexUv2s&&l.enable(14),S.vertexUv3s&&l.enable(15),S.vertexTangents&&l.enable(16),S.anisotropy&&l.enable(17),S.alphaHash&&l.enable(18),S.batching&&l.enable(19),S.dispersion&&l.enable(20),S.batchingColor&&l.enable(21),M.push(l.mask),l.disableAll(),S.fog&&l.enable(0),S.useFog&&l.enable(1),S.flatShading&&l.enable(2),S.logarithmicDepthBuffer&&l.enable(3),S.reverseDepthBuffer&&l.enable(4),S.skinning&&l.enable(5),S.morphTargets&&l.enable(6),S.morphNormals&&l.enable(7),S.morphColors&&l.enable(8),S.premultipliedAlpha&&l.enable(9),S.shadowMapEnabled&&l.enable(10),S.doubleSided&&l.enable(11),S.flipSided&&l.enable(12),S.useDepthPacking&&l.enable(13),S.dithering&&l.enable(14),S.transmission&&l.enable(15),S.sheen&&l.enable(16),S.opaque&&l.enable(17),S.pointsUvs&&l.enable(18),S.decodeVideoTexture&&l.enable(19),S.decodeVideoTextureEmissive&&l.enable(20),S.alphaToCoverage&&l.enable(21),M.push(l.mask)}function v(M){const S=m[M.type];let R;if(S){const O=Lr[S];R=ZS.clone(O.uniforms)}else R=M.uniforms;return R}function T(M,S){let R;for(let O=0,P=h.length;O<P;O++){const C=h[O];if(C.cacheKey===S){R=C,++R.usedTimes;break}}return R===void 0&&(R=new lF(r,S,M,o),h.push(R)),R}function w(M){if(--M.usedTimes===0){const S=h.indexOf(M);h[S]=h[h.length-1],h.pop(),M.destroy()}}function E(M){c.remove(M)}function A(){c.dispose()}return{getParameters:y,getProgramCacheKey:g,getUniforms:v,acquireProgram:T,releaseProgram:w,releaseShaderCache:E,programs:h,dispose:A}}function fF(){let r=new WeakMap;function e(a){return r.has(a)}function n(a){let l=r.get(a);return l===void 0&&(l={},r.set(a,l)),l}function i(a){r.delete(a)}function s(a,l,c){r.get(a)[l]=c}function o(){r=new WeakMap}return{has:e,get:n,remove:i,update:s,dispose:o}}function pF(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function R1(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function N1(){const r=[];let e=0;const n=[],i=[],s=[];function o(){e=0,n.length=0,i.length=0,s.length=0}function a(d,f,p,m,_,y){let g=r[e];return g===void 0?(g={id:d.id,object:d,geometry:f,material:p,groupOrder:m,renderOrder:d.renderOrder,z:_,group:y},r[e]=g):(g.id=d.id,g.object=d,g.geometry=f,g.material=p,g.groupOrder=m,g.renderOrder=d.renderOrder,g.z=_,g.group=y),e++,g}function l(d,f,p,m,_,y){const g=a(d,f,p,m,_,y);p.transmission>0?i.push(g):p.transparent===!0?s.push(g):n.push(g)}function c(d,f,p,m,_,y){const g=a(d,f,p,m,_,y);p.transmission>0?i.unshift(g):p.transparent===!0?s.unshift(g):n.unshift(g)}function u(d,f){n.length>1&&n.sort(d||pF),i.length>1&&i.sort(f||R1),s.length>1&&s.sort(f||R1)}function h(){for(let d=e,f=r.length;d<f;d++){const p=r[d];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:n,transmissive:i,transparent:s,init:o,push:l,unshift:c,finish:h,sort:u}}function mF(){let r=new WeakMap;function e(i,s){const o=r.get(i);let a;return o===void 0?(a=new N1,r.set(i,[a])):s>=o.length?(a=new N1,o.push(a)):a=o[s],a}function n(){r=new WeakMap}return{get:e,dispose:n}}function gF(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new V,color:new Et};break;case"SpotLight":n={position:new V,direction:new V,color:new Et,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new V,color:new Et,distance:0,decay:0};break;case"HemisphereLight":n={direction:new V,skyColor:new Et,groundColor:new Et};break;case"RectAreaLight":n={color:new Et,position:new V,halfWidth:new V,halfHeight:new V};break}return r[e.id]=n,n}}}function yF(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=n,n}}}let _F=0;function vF(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function xF(r){const e=new gF,n=yF(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let u=0;u<9;u++)i.probe.push(new V);const s=new V,o=new tn,a=new tn;function l(u){let h=0,d=0,f=0;for(let M=0;M<9;M++)i.probe[M].set(0,0,0);let p=0,m=0,_=0,y=0,g=0,x=0,b=0,v=0,T=0,w=0,E=0;u.sort(vF);for(let M=0,S=u.length;M<S;M++){const R=u[M],O=R.color,P=R.intensity,C=R.distance,I=R.shadow&&R.shadow.map?R.shadow.map.texture:null;if(R.isAmbientLight)h+=O.r*P,d+=O.g*P,f+=O.b*P;else if(R.isLightProbe){for(let L=0;L<9;L++)i.probe[L].addScaledVector(R.sh.coefficients[L],P);E++}else if(R.isDirectionalLight){const L=e.get(R);if(L.color.copy(R.color).multiplyScalar(R.intensity),R.castShadow){const W=R.shadow,$=n.get(R);$.shadowIntensity=W.intensity,$.shadowBias=W.bias,$.shadowNormalBias=W.normalBias,$.shadowRadius=W.radius,$.shadowMapSize=W.mapSize,i.directionalShadow[p]=$,i.directionalShadowMap[p]=I,i.directionalShadowMatrix[p]=R.shadow.matrix,x++}i.directional[p]=L,p++}else if(R.isSpotLight){const L=e.get(R);L.position.setFromMatrixPosition(R.matrixWorld),L.color.copy(O).multiplyScalar(P),L.distance=C,L.coneCos=Math.cos(R.angle),L.penumbraCos=Math.cos(R.angle*(1-R.penumbra)),L.decay=R.decay,i.spot[_]=L;const W=R.shadow;if(R.map&&(i.spotLightMap[T]=R.map,T++,W.updateMatrices(R),R.castShadow&&w++),i.spotLightMatrix[_]=W.matrix,R.castShadow){const $=n.get(R);$.shadowIntensity=W.intensity,$.shadowBias=W.bias,$.shadowNormalBias=W.normalBias,$.shadowRadius=W.radius,$.shadowMapSize=W.mapSize,i.spotShadow[_]=$,i.spotShadowMap[_]=I,v++}_++}else if(R.isRectAreaLight){const L=e.get(R);L.color.copy(O).multiplyScalar(P),L.halfWidth.set(R.width*.5,0,0),L.halfHeight.set(0,R.height*.5,0),i.rectArea[y]=L,y++}else if(R.isPointLight){const L=e.get(R);if(L.color.copy(R.color).multiplyScalar(R.intensity),L.distance=R.distance,L.decay=R.decay,R.castShadow){const W=R.shadow,$=n.get(R);$.shadowIntensity=W.intensity,$.shadowBias=W.bias,$.shadowNormalBias=W.normalBias,$.shadowRadius=W.radius,$.shadowMapSize=W.mapSize,$.shadowCameraNear=W.camera.near,$.shadowCameraFar=W.camera.far,i.pointShadow[m]=$,i.pointShadowMap[m]=I,i.pointShadowMatrix[m]=R.shadow.matrix,b++}i.point[m]=L,m++}else if(R.isHemisphereLight){const L=e.get(R);L.skyColor.copy(R.color).multiplyScalar(P),L.groundColor.copy(R.groundColor).multiplyScalar(P),i.hemi[g]=L,g++}}y>0&&(r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Le.LTC_FLOAT_1,i.rectAreaLTC2=Le.LTC_FLOAT_2):(i.rectAreaLTC1=Le.LTC_HALF_1,i.rectAreaLTC2=Le.LTC_HALF_2)),i.ambient[0]=h,i.ambient[1]=d,i.ambient[2]=f;const A=i.hash;(A.directionalLength!==p||A.pointLength!==m||A.spotLength!==_||A.rectAreaLength!==y||A.hemiLength!==g||A.numDirectionalShadows!==x||A.numPointShadows!==b||A.numSpotShadows!==v||A.numSpotMaps!==T||A.numLightProbes!==E)&&(i.directional.length=p,i.spot.length=_,i.rectArea.length=y,i.point.length=m,i.hemi.length=g,i.directionalShadow.length=x,i.directionalShadowMap.length=x,i.pointShadow.length=b,i.pointShadowMap.length=b,i.spotShadow.length=v,i.spotShadowMap.length=v,i.directionalShadowMatrix.length=x,i.pointShadowMatrix.length=b,i.spotLightMatrix.length=v+T-w,i.spotLightMap.length=T,i.numSpotLightShadowsWithMaps=w,i.numLightProbes=E,A.directionalLength=p,A.pointLength=m,A.spotLength=_,A.rectAreaLength=y,A.hemiLength=g,A.numDirectionalShadows=x,A.numPointShadows=b,A.numSpotShadows=v,A.numSpotMaps=T,A.numLightProbes=E,i.version=_F++)}function c(u,h){let d=0,f=0,p=0,m=0,_=0;const y=h.matrixWorldInverse;for(let g=0,x=u.length;g<x;g++){const b=u[g];if(b.isDirectionalLight){const v=i.directional[d];v.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),v.direction.sub(s),v.direction.transformDirection(y),d++}else if(b.isSpotLight){const v=i.spot[p];v.position.setFromMatrixPosition(b.matrixWorld),v.position.applyMatrix4(y),v.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),v.direction.sub(s),v.direction.transformDirection(y),p++}else if(b.isRectAreaLight){const v=i.rectArea[m];v.position.setFromMatrixPosition(b.matrixWorld),v.position.applyMatrix4(y),a.identity(),o.copy(b.matrixWorld),o.premultiply(y),a.extractRotation(o),v.halfWidth.set(b.width*.5,0,0),v.halfHeight.set(0,b.height*.5,0),v.halfWidth.applyMatrix4(a),v.halfHeight.applyMatrix4(a),m++}else if(b.isPointLight){const v=i.point[f];v.position.setFromMatrixPosition(b.matrixWorld),v.position.applyMatrix4(y),f++}else if(b.isHemisphereLight){const v=i.hemi[_];v.direction.setFromMatrixPosition(b.matrixWorld),v.direction.transformDirection(y),_++}}}return{setup:l,setupView:c,state:i}}function P1(r){const e=new xF(r),n=[],i=[];function s(h){u.camera=h,n.length=0,i.length=0}function o(h){n.push(h)}function a(h){i.push(h)}function l(){e.setup(n)}function c(h){e.setupView(n,h)}const u={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:s,state:u,setupLights:l,setupLightsView:c,pushLight:o,pushShadow:a}}function bF(r){let e=new WeakMap;function n(s,o=0){const a=e.get(s);let l;return a===void 0?(l=new P1(r),e.set(s,[l])):o>=a.length?(l=new P1(r),a.push(l)):l=a[o],l}function i(){e=new WeakMap}return{get:n,dispose:i}}class SF extends ia{static get type(){return"MeshDepthMaterial"}constructor(e){super(),this.isMeshDepthMaterial=!0,this.depthPacking=BD,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class TF extends ia{static get type(){return"MeshDistanceMaterial"}constructor(e){super(),this.isMeshDistanceMaterial=!0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const wF=`void main() {
4265
+ `+$)}else O!==""?console.warn("THREE.WebGLProgram: Program Info Log:",O):(P===""||C==="")&&(L=!1);L&&(R.diagnostics={runnable:I,programLog:O,vertexShader:{log:P,prefix:y},fragmentShader:{log:C,prefix:g}})}s.deleteShader(T),s.deleteShader(w),A=new Rd(s,_),M=ZO(s,_)}let A;this.getUniforms=function(){return A===void 0&&E(this),A};let M;this.getAttributes=function(){return M===void 0&&E(this),M};let S=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return S===!1&&(S=s.getProgramParameter(_,VO)),S},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(_),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=$O++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=T,this.fragmentShader=w,this}let cF=0;class uF{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,i=e.fragmentShader,s=this._getShaderStage(n),o=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(s)===!1&&(a.add(s),s.usedTimes++),a.has(o)===!1&&(a.add(o),o.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const i of n)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let i=n.get(e);return i===void 0&&(i=new Set,n.set(e,i)),i}_getShaderStage(e){const n=this.shaderCache;let i=n.get(e);return i===void 0&&(i=new hF(e),n.set(e,i)),i}}class hF{constructor(e){this.id=cF++,this.code=e,this.usedTimes=0}}function dF(r,e,n,i,s,o,a){const l=new Zg,c=new uF,u=new Set,h=[],d=s.logarithmicDepthBuffer,f=s.vertexTextures;let p=s.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(M){return u.add(M),M===0?"uv":`uv${M}`}function y(M,S,R,O,P){const C=O.fog,I=P.geometry,L=M.isMeshStandardMaterial?O.environment:null,W=(M.isMeshStandardMaterial?n:e).get(M.envMap||L),$=W&&W.mapping===Zh?W.image.height:null,ie=m[M.type];M.precision!==null&&(p=s.getMaxPrecision(M.precision),p!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",p,"instead."));const U=I.morphAttributes.position||I.morphAttributes.normal||I.morphAttributes.color,k=U!==void 0?U.length:0;let re=0;I.morphAttributes.position!==void 0&&(re=1),I.morphAttributes.normal!==void 0&&(re=2),I.morphAttributes.color!==void 0&&(re=3);let he,F,G,ee;if(ie){const Ft=Lr[ie];he=Ft.vertexShader,F=Ft.fragmentShader}else he=M.vertexShader,F=M.fragmentShader,c.update(M),G=c.getVertexShaderID(M),ee=c.getFragmentShaderID(M);const J=r.getRenderTarget(),ue=r.state.buffers.depth.getReversed(),be=P.isInstancedMesh===!0,Te=P.isBatchedMesh===!0,je=!!M.map,pe=!!M.matcap,ot=!!W,q=!!M.aoMap,Ct=!!M.lightMap,at=!!M.bumpMap,pt=!!M.normalMap,Je=!!M.displacementMap,Ot=!!M.emissiveMap,Ze=!!M.metalnessMap,B=!!M.roughnessMap,N=M.anisotropy>0,se=M.clearcoat>0,ve=M.dispersion>0,Se=M.iridescence>0,me=M.sheen>0,Ge=M.transmission>0,Oe=N&&!!M.anisotropyMap,ze=se&&!!M.clearcoatMap,tt=se&&!!M.clearcoatNormalMap,Me=se&&!!M.clearcoatRoughnessMap,Ve=Se&&!!M.iridescenceMap,et=Se&&!!M.iridescenceThicknessMap,st=me&&!!M.sheenColorMap,$e=me&&!!M.sheenRoughnessMap,St=!!M.specularMap,yt=!!M.specularColorMap,Ht=!!M.specularIntensityMap,Y=Ge&&!!M.transmissionMap,De=Ge&&!!M.thicknessMap,le=!!M.gradientMap,xe=!!M.alphaMap,Be=M.alphaTest>0,ke=!!M.alphaHash,ht=!!M.extensions;let fn=Qs;M.toneMapped&&(J===null||J.isXRRenderTarget===!0)&&(fn=r.toneMapping);const On={shaderID:ie,shaderType:M.type,shaderName:M.name,vertexShader:he,fragmentShader:F,defines:M.defines,customVertexShaderID:G,customFragmentShaderID:ee,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:p,batching:Te,batchingColor:Te&&P._colorsTexture!==null,instancing:be,instancingColor:be&&P.instanceColor!==null,instancingMorph:be&&P.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:J===null?r.outputColorSpace:J.isXRRenderTarget===!0?J.texture.colorSpace:tl,alphaToCoverage:!!M.alphaToCoverage,map:je,matcap:pe,envMap:ot,envMapMode:ot&&W.mapping,envMapCubeUVHeight:$,aoMap:q,lightMap:Ct,bumpMap:at,normalMap:pt,displacementMap:f&&Je,emissiveMap:Ot,normalMapObjectSpace:pt&&M.normalMapType===zD,normalMapTangentSpace:pt&&M.normalMapType===bS,metalnessMap:Ze,roughnessMap:B,anisotropy:N,anisotropyMap:Oe,clearcoat:se,clearcoatMap:ze,clearcoatNormalMap:tt,clearcoatRoughnessMap:Me,dispersion:ve,iridescence:Se,iridescenceMap:Ve,iridescenceThicknessMap:et,sheen:me,sheenColorMap:st,sheenRoughnessMap:$e,specularMap:St,specularColorMap:yt,specularIntensityMap:Ht,transmission:Ge,transmissionMap:Y,thicknessMap:De,gradientMap:le,opaque:M.transparent===!1&&M.blending===qa&&M.alphaToCoverage===!1,alphaMap:xe,alphaTest:Be,alphaHash:ke,combine:M.combine,mapUv:je&&_(M.map.channel),aoMapUv:q&&_(M.aoMap.channel),lightMapUv:Ct&&_(M.lightMap.channel),bumpMapUv:at&&_(M.bumpMap.channel),normalMapUv:pt&&_(M.normalMap.channel),displacementMapUv:Je&&_(M.displacementMap.channel),emissiveMapUv:Ot&&_(M.emissiveMap.channel),metalnessMapUv:Ze&&_(M.metalnessMap.channel),roughnessMapUv:B&&_(M.roughnessMap.channel),anisotropyMapUv:Oe&&_(M.anisotropyMap.channel),clearcoatMapUv:ze&&_(M.clearcoatMap.channel),clearcoatNormalMapUv:tt&&_(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Me&&_(M.clearcoatRoughnessMap.channel),iridescenceMapUv:Ve&&_(M.iridescenceMap.channel),iridescenceThicknessMapUv:et&&_(M.iridescenceThicknessMap.channel),sheenColorMapUv:st&&_(M.sheenColorMap.channel),sheenRoughnessMapUv:$e&&_(M.sheenRoughnessMap.channel),specularMapUv:St&&_(M.specularMap.channel),specularColorMapUv:yt&&_(M.specularColorMap.channel),specularIntensityMapUv:Ht&&_(M.specularIntensityMap.channel),transmissionMapUv:Y&&_(M.transmissionMap.channel),thicknessMapUv:De&&_(M.thicknessMap.channel),alphaMapUv:xe&&_(M.alphaMap.channel),vertexTangents:!!I.attributes.tangent&&(pt||N),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!I.attributes.color&&I.attributes.color.itemSize===4,pointsUvs:P.isPoints===!0&&!!I.attributes.uv&&(je||xe),fog:!!C,useFog:M.fog===!0,fogExp2:!!C&&C.isFogExp2,flatShading:M.flatShading===!0,sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:d,reverseDepthBuffer:ue,skinning:P.isSkinnedMesh===!0,morphTargets:I.morphAttributes.position!==void 0,morphNormals:I.morphAttributes.normal!==void 0,morphColors:I.morphAttributes.color!==void 0,morphTargetsCount:k,morphTextureStride:re,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numLightProbes:S.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:M.dithering,shadowMapEnabled:r.shadowMap.enabled&&R.length>0,shadowMapType:r.shadowMap.type,toneMapping:fn,decodeVideoTexture:je&&M.map.isVideoTexture===!0&&Dt.getTransfer(M.map.colorSpace)===Kt,decodeVideoTextureEmissive:Ot&&M.emissiveMap.isVideoTexture===!0&&Dt.getTransfer(M.emissiveMap.colorSpace)===Kt,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===Jr,flipSided:M.side===ri,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionClipCullDistance:ht&&M.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ht&&M.extensions.multiDraw===!0||Te)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()};return On.vertexUv1s=u.has(1),On.vertexUv2s=u.has(2),On.vertexUv3s=u.has(3),u.clear(),On}function g(M){const S=[];if(M.shaderID?S.push(M.shaderID):(S.push(M.customVertexShaderID),S.push(M.customFragmentShaderID)),M.defines!==void 0)for(const R in M.defines)S.push(R),S.push(M.defines[R]);return M.isRawShaderMaterial===!1&&(x(S,M),b(S,M),S.push(r.outputColorSpace)),S.push(M.customProgramCacheKey),S.join()}function x(M,S){M.push(S.precision),M.push(S.outputColorSpace),M.push(S.envMapMode),M.push(S.envMapCubeUVHeight),M.push(S.mapUv),M.push(S.alphaMapUv),M.push(S.lightMapUv),M.push(S.aoMapUv),M.push(S.bumpMapUv),M.push(S.normalMapUv),M.push(S.displacementMapUv),M.push(S.emissiveMapUv),M.push(S.metalnessMapUv),M.push(S.roughnessMapUv),M.push(S.anisotropyMapUv),M.push(S.clearcoatMapUv),M.push(S.clearcoatNormalMapUv),M.push(S.clearcoatRoughnessMapUv),M.push(S.iridescenceMapUv),M.push(S.iridescenceThicknessMapUv),M.push(S.sheenColorMapUv),M.push(S.sheenRoughnessMapUv),M.push(S.specularMapUv),M.push(S.specularColorMapUv),M.push(S.specularIntensityMapUv),M.push(S.transmissionMapUv),M.push(S.thicknessMapUv),M.push(S.combine),M.push(S.fogExp2),M.push(S.sizeAttenuation),M.push(S.morphTargetsCount),M.push(S.morphAttributeCount),M.push(S.numDirLights),M.push(S.numPointLights),M.push(S.numSpotLights),M.push(S.numSpotLightMaps),M.push(S.numHemiLights),M.push(S.numRectAreaLights),M.push(S.numDirLightShadows),M.push(S.numPointLightShadows),M.push(S.numSpotLightShadows),M.push(S.numSpotLightShadowsWithMaps),M.push(S.numLightProbes),M.push(S.shadowMapType),M.push(S.toneMapping),M.push(S.numClippingPlanes),M.push(S.numClipIntersection),M.push(S.depthPacking)}function b(M,S){l.disableAll(),S.supportsVertexTextures&&l.enable(0),S.instancing&&l.enable(1),S.instancingColor&&l.enable(2),S.instancingMorph&&l.enable(3),S.matcap&&l.enable(4),S.envMap&&l.enable(5),S.normalMapObjectSpace&&l.enable(6),S.normalMapTangentSpace&&l.enable(7),S.clearcoat&&l.enable(8),S.iridescence&&l.enable(9),S.alphaTest&&l.enable(10),S.vertexColors&&l.enable(11),S.vertexAlphas&&l.enable(12),S.vertexUv1s&&l.enable(13),S.vertexUv2s&&l.enable(14),S.vertexUv3s&&l.enable(15),S.vertexTangents&&l.enable(16),S.anisotropy&&l.enable(17),S.alphaHash&&l.enable(18),S.batching&&l.enable(19),S.dispersion&&l.enable(20),S.batchingColor&&l.enable(21),M.push(l.mask),l.disableAll(),S.fog&&l.enable(0),S.useFog&&l.enable(1),S.flatShading&&l.enable(2),S.logarithmicDepthBuffer&&l.enable(3),S.reverseDepthBuffer&&l.enable(4),S.skinning&&l.enable(5),S.morphTargets&&l.enable(6),S.morphNormals&&l.enable(7),S.morphColors&&l.enable(8),S.premultipliedAlpha&&l.enable(9),S.shadowMapEnabled&&l.enable(10),S.doubleSided&&l.enable(11),S.flipSided&&l.enable(12),S.useDepthPacking&&l.enable(13),S.dithering&&l.enable(14),S.transmission&&l.enable(15),S.sheen&&l.enable(16),S.opaque&&l.enable(17),S.pointsUvs&&l.enable(18),S.decodeVideoTexture&&l.enable(19),S.decodeVideoTextureEmissive&&l.enable(20),S.alphaToCoverage&&l.enable(21),M.push(l.mask)}function v(M){const S=m[M.type];let R;if(S){const O=Lr[S];R=ZS.clone(O.uniforms)}else R=M.uniforms;return R}function T(M,S){let R;for(let O=0,P=h.length;O<P;O++){const C=h[O];if(C.cacheKey===S){R=C,++R.usedTimes;break}}return R===void 0&&(R=new lF(r,S,M,o),h.push(R)),R}function w(M){if(--M.usedTimes===0){const S=h.indexOf(M);h[S]=h[h.length-1],h.pop(),M.destroy()}}function E(M){c.remove(M)}function A(){c.dispose()}return{getParameters:y,getProgramCacheKey:g,getUniforms:v,acquireProgram:T,releaseProgram:w,releaseShaderCache:E,programs:h,dispose:A}}function fF(){let r=new WeakMap;function e(a){return r.has(a)}function n(a){let l=r.get(a);return l===void 0&&(l={},r.set(a,l)),l}function i(a){r.delete(a)}function s(a,l,c){r.get(a)[l]=c}function o(){r=new WeakMap}return{has:e,get:n,remove:i,update:s,dispose:o}}function pF(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function R1(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function N1(){const r=[];let e=0;const n=[],i=[],s=[];function o(){e=0,n.length=0,i.length=0,s.length=0}function a(d,f,p,m,_,y){let g=r[e];return g===void 0?(g={id:d.id,object:d,geometry:f,material:p,groupOrder:m,renderOrder:d.renderOrder,z:_,group:y},r[e]=g):(g.id=d.id,g.object=d,g.geometry=f,g.material=p,g.groupOrder=m,g.renderOrder=d.renderOrder,g.z=_,g.group=y),e++,g}function l(d,f,p,m,_,y){const g=a(d,f,p,m,_,y);p.transmission>0?i.push(g):p.transparent===!0?s.push(g):n.push(g)}function c(d,f,p,m,_,y){const g=a(d,f,p,m,_,y);p.transmission>0?i.unshift(g):p.transparent===!0?s.unshift(g):n.unshift(g)}function u(d,f){n.length>1&&n.sort(d||pF),i.length>1&&i.sort(f||R1),s.length>1&&s.sort(f||R1)}function h(){for(let d=e,f=r.length;d<f;d++){const p=r[d];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:n,transmissive:i,transparent:s,init:o,push:l,unshift:c,finish:h,sort:u}}function mF(){let r=new WeakMap;function e(i,s){const o=r.get(i);let a;return o===void 0?(a=new N1,r.set(i,[a])):s>=o.length?(a=new N1,o.push(a)):a=o[s],a}function n(){r=new WeakMap}return{get:e,dispose:n}}function gF(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new V,color:new Et};break;case"SpotLight":n={position:new V,direction:new V,color:new Et,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new V,color:new Et,distance:0,decay:0};break;case"HemisphereLight":n={direction:new V,skyColor:new Et,groundColor:new Et};break;case"RectAreaLight":n={color:new Et,position:new V,halfWidth:new V,halfHeight:new V};break}return r[e.id]=n,n}}}function yF(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=n,n}}}let _F=0;function vF(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function xF(r){const e=new gF,n=yF(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let u=0;u<9;u++)i.probe.push(new V);const s=new V,o=new tn,a=new tn;function l(u){let h=0,d=0,f=0;for(let M=0;M<9;M++)i.probe[M].set(0,0,0);let p=0,m=0,_=0,y=0,g=0,x=0,b=0,v=0,T=0,w=0,E=0;u.sort(vF);for(let M=0,S=u.length;M<S;M++){const R=u[M],O=R.color,P=R.intensity,C=R.distance,I=R.shadow&&R.shadow.map?R.shadow.map.texture:null;if(R.isAmbientLight)h+=O.r*P,d+=O.g*P,f+=O.b*P;else if(R.isLightProbe){for(let L=0;L<9;L++)i.probe[L].addScaledVector(R.sh.coefficients[L],P);E++}else if(R.isDirectionalLight){const L=e.get(R);if(L.color.copy(R.color).multiplyScalar(R.intensity),R.castShadow){const W=R.shadow,$=n.get(R);$.shadowIntensity=W.intensity,$.shadowBias=W.bias,$.shadowNormalBias=W.normalBias,$.shadowRadius=W.radius,$.shadowMapSize=W.mapSize,i.directionalShadow[p]=$,i.directionalShadowMap[p]=I,i.directionalShadowMatrix[p]=R.shadow.matrix,x++}i.directional[p]=L,p++}else if(R.isSpotLight){const L=e.get(R);L.position.setFromMatrixPosition(R.matrixWorld),L.color.copy(O).multiplyScalar(P),L.distance=C,L.coneCos=Math.cos(R.angle),L.penumbraCos=Math.cos(R.angle*(1-R.penumbra)),L.decay=R.decay,i.spot[_]=L;const W=R.shadow;if(R.map&&(i.spotLightMap[T]=R.map,T++,W.updateMatrices(R),R.castShadow&&w++),i.spotLightMatrix[_]=W.matrix,R.castShadow){const $=n.get(R);$.shadowIntensity=W.intensity,$.shadowBias=W.bias,$.shadowNormalBias=W.normalBias,$.shadowRadius=W.radius,$.shadowMapSize=W.mapSize,i.spotShadow[_]=$,i.spotShadowMap[_]=I,v++}_++}else if(R.isRectAreaLight){const L=e.get(R);L.color.copy(O).multiplyScalar(P),L.halfWidth.set(R.width*.5,0,0),L.halfHeight.set(0,R.height*.5,0),i.rectArea[y]=L,y++}else if(R.isPointLight){const L=e.get(R);if(L.color.copy(R.color).multiplyScalar(R.intensity),L.distance=R.distance,L.decay=R.decay,R.castShadow){const W=R.shadow,$=n.get(R);$.shadowIntensity=W.intensity,$.shadowBias=W.bias,$.shadowNormalBias=W.normalBias,$.shadowRadius=W.radius,$.shadowMapSize=W.mapSize,$.shadowCameraNear=W.camera.near,$.shadowCameraFar=W.camera.far,i.pointShadow[m]=$,i.pointShadowMap[m]=I,i.pointShadowMatrix[m]=R.shadow.matrix,b++}i.point[m]=L,m++}else if(R.isHemisphereLight){const L=e.get(R);L.skyColor.copy(R.color).multiplyScalar(P),L.groundColor.copy(R.groundColor).multiplyScalar(P),i.hemi[g]=L,g++}}y>0&&(r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Le.LTC_FLOAT_1,i.rectAreaLTC2=Le.LTC_FLOAT_2):(i.rectAreaLTC1=Le.LTC_HALF_1,i.rectAreaLTC2=Le.LTC_HALF_2)),i.ambient[0]=h,i.ambient[1]=d,i.ambient[2]=f;const A=i.hash;(A.directionalLength!==p||A.pointLength!==m||A.spotLength!==_||A.rectAreaLength!==y||A.hemiLength!==g||A.numDirectionalShadows!==x||A.numPointShadows!==b||A.numSpotShadows!==v||A.numSpotMaps!==T||A.numLightProbes!==E)&&(i.directional.length=p,i.spot.length=_,i.rectArea.length=y,i.point.length=m,i.hemi.length=g,i.directionalShadow.length=x,i.directionalShadowMap.length=x,i.pointShadow.length=b,i.pointShadowMap.length=b,i.spotShadow.length=v,i.spotShadowMap.length=v,i.directionalShadowMatrix.length=x,i.pointShadowMatrix.length=b,i.spotLightMatrix.length=v+T-w,i.spotLightMap.length=T,i.numSpotLightShadowsWithMaps=w,i.numLightProbes=E,A.directionalLength=p,A.pointLength=m,A.spotLength=_,A.rectAreaLength=y,A.hemiLength=g,A.numDirectionalShadows=x,A.numPointShadows=b,A.numSpotShadows=v,A.numSpotMaps=T,A.numLightProbes=E,i.version=_F++)}function c(u,h){let d=0,f=0,p=0,m=0,_=0;const y=h.matrixWorldInverse;for(let g=0,x=u.length;g<x;g++){const b=u[g];if(b.isDirectionalLight){const v=i.directional[d];v.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),v.direction.sub(s),v.direction.transformDirection(y),d++}else if(b.isSpotLight){const v=i.spot[p];v.position.setFromMatrixPosition(b.matrixWorld),v.position.applyMatrix4(y),v.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),v.direction.sub(s),v.direction.transformDirection(y),p++}else if(b.isRectAreaLight){const v=i.rectArea[m];v.position.setFromMatrixPosition(b.matrixWorld),v.position.applyMatrix4(y),a.identity(),o.copy(b.matrixWorld),o.premultiply(y),a.extractRotation(o),v.halfWidth.set(b.width*.5,0,0),v.halfHeight.set(0,b.height*.5,0),v.halfWidth.applyMatrix4(a),v.halfHeight.applyMatrix4(a),m++}else if(b.isPointLight){const v=i.point[f];v.position.setFromMatrixPosition(b.matrixWorld),v.position.applyMatrix4(y),f++}else if(b.isHemisphereLight){const v=i.hemi[_];v.direction.setFromMatrixPosition(b.matrixWorld),v.direction.transformDirection(y),_++}}}return{setup:l,setupView:c,state:i}}function P1(r){const e=new xF(r),n=[],i=[];function s(h){u.camera=h,n.length=0,i.length=0}function o(h){n.push(h)}function a(h){i.push(h)}function l(){e.setup(n)}function c(h){e.setupView(n,h)}const u={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:s,state:u,setupLights:l,setupLightsView:c,pushLight:o,pushShadow:a}}function bF(r){let e=new WeakMap;function n(s,o=0){const a=e.get(s);let l;return a===void 0?(l=new P1(r),e.set(s,[l])):o>=a.length?(l=new P1(r),a.push(l)):l=a[o],l}function i(){e=new WeakMap}return{get:n,dispose:i}}class SF extends ia{static get type(){return"MeshDepthMaterial"}constructor(e){super(),this.isMeshDepthMaterial=!0,this.depthPacking=BD,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class TF extends ia{static get type(){return"MeshDistanceMaterial"}constructor(e){super(),this.isMeshDistanceMaterial=!0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const wF=`void main() {
4266
4266
  gl_Position = vec4( position, 1.0 );
4267
4267
  }`,MF=`uniform sampler2D shadow_pass;
4268
4268
  uniform vec2 resolution;
@@ -4314,7 +4314,7 @@ void main() {
4314
4314
 
4315
4315
  }
4316
4316
 
4317
- }`;class FF{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n,i){if(this.texture===null){const s=new Ri,o=e.properties.get(s);o.__webglTexture=n.texture,(n.depthNear!=i.depthNear||n.depthFar!=i.depthFar)&&(this.depthNear=n.depthNear,this.depthFar=n.depthFar),this.texture=s}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,i=new Ir({vertexShader:LF,fragmentShader:OF,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new yi(new Zc(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class UF extends Jo{constructor(e,n){super();const i=this;let s=null,o=1,a=null,l="local-floor",c=1,u=null,h=null,d=null,f=null,p=null,m=null;const _=new FF,y=n.getContextAttributes();let g=null,x=null;const b=[],v=[],T=new Pe;let w=null;const E=new Xi;E.viewport=new Sn;const A=new Xi;A.viewport=new Sn;const M=[E,A],S=new DF;let R=null,O=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(F){let G=b[F];return G===void 0&&(G=new b0,b[F]=G),G.getTargetRaySpace()},this.getControllerGrip=function(F){let G=b[F];return G===void 0&&(G=new b0,b[F]=G),G.getGripSpace()},this.getHand=function(F){let G=b[F];return G===void 0&&(G=new b0,b[F]=G),G.getHandSpace()};function P(F){const G=v.indexOf(F.inputSource);if(G===-1)return;const ee=b[G];ee!==void 0&&(ee.update(F.inputSource,F.frame,u||a),ee.dispatchEvent({type:F.type,data:F.inputSource}))}function C(){s.removeEventListener("select",P),s.removeEventListener("selectstart",P),s.removeEventListener("selectend",P),s.removeEventListener("squeeze",P),s.removeEventListener("squeezestart",P),s.removeEventListener("squeezeend",P),s.removeEventListener("end",C),s.removeEventListener("inputsourceschange",I);for(let F=0;F<b.length;F++){const G=v[F];G!==null&&(v[F]=null,b[F].disconnect(G))}R=null,O=null,_.reset(),e.setRenderTarget(g),p=null,f=null,d=null,s=null,x=null,he.stop(),i.isPresenting=!1,e.setPixelRatio(w),e.setSize(T.width,T.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(F){o=F,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(F){l=F,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return u||a},this.setReferenceSpace=function(F){u=F},this.getBaseLayer=function(){return f!==null?f:p},this.getBinding=function(){return d},this.getFrame=function(){return m},this.getSession=function(){return s},this.setSession=async function(F){if(s=F,s!==null){if(g=e.getRenderTarget(),s.addEventListener("select",P),s.addEventListener("selectstart",P),s.addEventListener("selectend",P),s.addEventListener("squeeze",P),s.addEventListener("squeezestart",P),s.addEventListener("squeezeend",P),s.addEventListener("end",C),s.addEventListener("inputsourceschange",I),y.xrCompatible!==!0&&await n.makeXRCompatible(),w=e.getPixelRatio(),e.getSize(T),s.renderState.layers===void 0){const G={antialias:y.antialias,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:o};p=new XRWebGLLayer(s,n,G),s.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),x=new eo(p.framebufferWidth,p.framebufferHeight,{format:or,type:ts,colorSpace:e.outputColorSpace,stencilBuffer:y.stencil})}else{let G=null,ee=null,J=null;y.depth&&(J=y.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,G=y.stencil?el:Ja,ee=y.stencil?Qa:Qo);const ue={colorFormat:n.RGBA8,depthFormat:J,scaleFactor:o};d=new XRWebGLBinding(s,n),f=d.createProjectionLayer(ue),s.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),x=new eo(f.textureWidth,f.textureHeight,{format:or,type:ts,depthTexture:new u1(f.textureWidth,f.textureHeight,ee,void 0,void 0,void 0,void 0,void 0,void 0,G),stencilBuffer:y.stencil,colorSpace:e.outputColorSpace,samples:y.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1})}x.isXRRenderTarget=!0,this.setFoveation(c),u=null,a=await s.requestReferenceSpace(l),he.setContext(s),he.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function I(F){for(let G=0;G<F.removed.length;G++){const ee=F.removed[G],J=v.indexOf(ee);J>=0&&(v[J]=null,b[J].disconnect(ee))}for(let G=0;G<F.added.length;G++){const ee=F.added[G];let J=v.indexOf(ee);if(J===-1){for(let be=0;be<b.length;be++)if(be>=v.length){v.push(ee),J=be;break}else if(v[be]===null){v[be]=ee,J=be;break}if(J===-1)break}const ue=b[J];ue&&ue.connect(ee)}}const L=new V,W=new V;function $(F,G,ee){L.setFromMatrixPosition(G.matrixWorld),W.setFromMatrixPosition(ee.matrixWorld);const J=L.distanceTo(W),ue=G.projectionMatrix.elements,be=ee.projectionMatrix.elements,Te=ue[14]/(ue[10]-1),je=ue[14]/(ue[10]+1),pe=(ue[9]+1)/ue[5],ot=(ue[9]-1)/ue[5],q=(ue[8]-1)/ue[0],Ct=(be[8]+1)/be[0],at=Te*q,pt=Te*Ct,Je=J/(-q+Ct),Ot=Je*-q;if(G.matrixWorld.decompose(F.position,F.quaternion,F.scale),F.translateX(Ot),F.translateZ(Je),F.matrixWorld.compose(F.position,F.quaternion,F.scale),F.matrixWorldInverse.copy(F.matrixWorld).invert(),ue[10]===-1)F.projectionMatrix.copy(G.projectionMatrix),F.projectionMatrixInverse.copy(G.projectionMatrixInverse);else{const Ze=Te+Je,B=je+Je,N=at-Ot,se=pt+(J-Ot),ve=pe*je/B*Ze,Se=ot*je/B*Ze;F.projectionMatrix.makePerspective(N,se,ve,Se,Ze,B),F.projectionMatrixInverse.copy(F.projectionMatrix).invert()}}function ie(F,G){G===null?F.matrixWorld.copy(F.matrix):F.matrixWorld.multiplyMatrices(G.matrixWorld,F.matrix),F.matrixWorldInverse.copy(F.matrixWorld).invert()}this.updateCamera=function(F){if(s===null)return;let G=F.near,ee=F.far;_.texture!==null&&(_.depthNear>0&&(G=_.depthNear),_.depthFar>0&&(ee=_.depthFar)),S.near=A.near=E.near=G,S.far=A.far=E.far=ee,(R!==S.near||O!==S.far)&&(s.updateRenderState({depthNear:S.near,depthFar:S.far}),R=S.near,O=S.far),E.layers.mask=F.layers.mask|2,A.layers.mask=F.layers.mask|4,S.layers.mask=E.layers.mask|A.layers.mask;const J=F.parent,ue=S.cameras;ie(S,J);for(let be=0;be<ue.length;be++)ie(ue[be],J);ue.length===2?$(S,E,A):S.projectionMatrix.copy(E.projectionMatrix),U(F,S,J)};function U(F,G,ee){ee===null?F.matrix.copy(G.matrixWorld):(F.matrix.copy(ee.matrixWorld),F.matrix.invert(),F.matrix.multiply(G.matrixWorld)),F.matrix.decompose(F.position,F.quaternion,F.scale),F.updateMatrixWorld(!0),F.projectionMatrix.copy(G.projectionMatrix),F.projectionMatrixInverse.copy(G.projectionMatrixInverse),F.isPerspectiveCamera&&(F.fov=$c*2*Math.atan(1/F.projectionMatrix.elements[5]),F.zoom=1)}this.getCamera=function(){return S},this.getFoveation=function(){if(!(f===null&&p===null))return c},this.setFoveation=function(F){c=F,f!==null&&(f.fixedFoveation=F),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=F)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(S)};let k=null;function re(F,G){if(h=G.getViewerPose(u||a),m=G,h!==null){const ee=h.views;p!==null&&(e.setRenderTargetFramebuffer(x,p.framebuffer),e.setRenderTarget(x));let J=!1;ee.length!==S.cameras.length&&(S.cameras.length=0,J=!0);for(let be=0;be<ee.length;be++){const Te=ee[be];let je=null;if(p!==null)je=p.getViewport(Te);else{const ot=d.getViewSubImage(f,Te);je=ot.viewport,be===0&&(e.setRenderTargetTextures(x,ot.colorTexture,f.ignoreDepthValues?void 0:ot.depthStencilTexture),e.setRenderTarget(x))}let pe=M[be];pe===void 0&&(pe=new Xi,pe.layers.enable(be),pe.viewport=new Sn,M[be]=pe),pe.matrix.fromArray(Te.transform.matrix),pe.matrix.decompose(pe.position,pe.quaternion,pe.scale),pe.projectionMatrix.fromArray(Te.projectionMatrix),pe.projectionMatrixInverse.copy(pe.projectionMatrix).invert(),pe.viewport.set(je.x,je.y,je.width,je.height),be===0&&(S.matrix.copy(pe.matrix),S.matrix.decompose(S.position,S.quaternion,S.scale)),J===!0&&S.cameras.push(pe)}const ue=s.enabledFeatures;if(ue&&ue.includes("depth-sensing")){const be=d.getDepthInformation(ee[0]);be&&be.isValid&&be.texture&&_.init(e,be,s.renderState)}}for(let ee=0;ee<b.length;ee++){const J=v[ee],ue=b[ee];J!==null&&ue!==void 0&&ue.update(J,G,u||a)}k&&k(F,G),G.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:G}),m=null}const he=new n1;he.setAnimationLoop(re),this.setAnimationLoop=function(F){k=F},this.dispose=function(){}}}const ua=new so,BF=new tn;function kF(r,e){function n(y,g){y.matrixAutoUpdate===!0&&y.updateMatrix(),g.value.copy(y.matrix)}function i(y,g){g.color.getRGB(y.fogColor.value,KS(r)),g.isFog?(y.fogNear.value=g.near,y.fogFar.value=g.far):g.isFogExp2&&(y.fogDensity.value=g.density)}function s(y,g,x,b,v){g.isMeshBasicMaterial||g.isMeshLambertMaterial?o(y,g):g.isMeshToonMaterial?(o(y,g),d(y,g)):g.isMeshPhongMaterial?(o(y,g),h(y,g)):g.isMeshStandardMaterial?(o(y,g),f(y,g),g.isMeshPhysicalMaterial&&p(y,g,v)):g.isMeshMatcapMaterial?(o(y,g),m(y,g)):g.isMeshDepthMaterial?o(y,g):g.isMeshDistanceMaterial?(o(y,g),_(y,g)):g.isMeshNormalMaterial?o(y,g):g.isLineBasicMaterial?(a(y,g),g.isLineDashedMaterial&&l(y,g)):g.isPointsMaterial?c(y,g,x,b):g.isSpriteMaterial?u(y,g):g.isShadowMaterial?(y.color.value.copy(g.color),y.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function o(y,g){y.opacity.value=g.opacity,g.color&&y.diffuse.value.copy(g.color),g.emissive&&y.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(y.map.value=g.map,n(g.map,y.mapTransform)),g.alphaMap&&(y.alphaMap.value=g.alphaMap,n(g.alphaMap,y.alphaMapTransform)),g.bumpMap&&(y.bumpMap.value=g.bumpMap,n(g.bumpMap,y.bumpMapTransform),y.bumpScale.value=g.bumpScale,g.side===ri&&(y.bumpScale.value*=-1)),g.normalMap&&(y.normalMap.value=g.normalMap,n(g.normalMap,y.normalMapTransform),y.normalScale.value.copy(g.normalScale),g.side===ri&&y.normalScale.value.negate()),g.displacementMap&&(y.displacementMap.value=g.displacementMap,n(g.displacementMap,y.displacementMapTransform),y.displacementScale.value=g.displacementScale,y.displacementBias.value=g.displacementBias),g.emissiveMap&&(y.emissiveMap.value=g.emissiveMap,n(g.emissiveMap,y.emissiveMapTransform)),g.specularMap&&(y.specularMap.value=g.specularMap,n(g.specularMap,y.specularMapTransform)),g.alphaTest>0&&(y.alphaTest.value=g.alphaTest);const x=e.get(g),b=x.envMap,v=x.envMapRotation;b&&(y.envMap.value=b,ua.copy(v),ua.x*=-1,ua.y*=-1,ua.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(ua.y*=-1,ua.z*=-1),y.envMapRotation.value.setFromMatrix4(BF.makeRotationFromEuler(ua)),y.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=g.reflectivity,y.ior.value=g.ior,y.refractionRatio.value=g.refractionRatio),g.lightMap&&(y.lightMap.value=g.lightMap,y.lightMapIntensity.value=g.lightMapIntensity,n(g.lightMap,y.lightMapTransform)),g.aoMap&&(y.aoMap.value=g.aoMap,y.aoMapIntensity.value=g.aoMapIntensity,n(g.aoMap,y.aoMapTransform))}function a(y,g){y.diffuse.value.copy(g.color),y.opacity.value=g.opacity,g.map&&(y.map.value=g.map,n(g.map,y.mapTransform))}function l(y,g){y.dashSize.value=g.dashSize,y.totalSize.value=g.dashSize+g.gapSize,y.scale.value=g.scale}function c(y,g,x,b){y.diffuse.value.copy(g.color),y.opacity.value=g.opacity,y.size.value=g.size*x,y.scale.value=b*.5,g.map&&(y.map.value=g.map,n(g.map,y.uvTransform)),g.alphaMap&&(y.alphaMap.value=g.alphaMap,n(g.alphaMap,y.alphaMapTransform)),g.alphaTest>0&&(y.alphaTest.value=g.alphaTest)}function u(y,g){y.diffuse.value.copy(g.color),y.opacity.value=g.opacity,y.rotation.value=g.rotation,g.map&&(y.map.value=g.map,n(g.map,y.mapTransform)),g.alphaMap&&(y.alphaMap.value=g.alphaMap,n(g.alphaMap,y.alphaMapTransform)),g.alphaTest>0&&(y.alphaTest.value=g.alphaTest)}function h(y,g){y.specular.value.copy(g.specular),y.shininess.value=Math.max(g.shininess,1e-4)}function d(y,g){g.gradientMap&&(y.gradientMap.value=g.gradientMap)}function f(y,g){y.metalness.value=g.metalness,g.metalnessMap&&(y.metalnessMap.value=g.metalnessMap,n(g.metalnessMap,y.metalnessMapTransform)),y.roughness.value=g.roughness,g.roughnessMap&&(y.roughnessMap.value=g.roughnessMap,n(g.roughnessMap,y.roughnessMapTransform)),g.envMap&&(y.envMapIntensity.value=g.envMapIntensity)}function p(y,g,x){y.ior.value=g.ior,g.sheen>0&&(y.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),y.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(y.sheenColorMap.value=g.sheenColorMap,n(g.sheenColorMap,y.sheenColorMapTransform)),g.sheenRoughnessMap&&(y.sheenRoughnessMap.value=g.sheenRoughnessMap,n(g.sheenRoughnessMap,y.sheenRoughnessMapTransform))),g.clearcoat>0&&(y.clearcoat.value=g.clearcoat,y.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(y.clearcoatMap.value=g.clearcoatMap,n(g.clearcoatMap,y.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,n(g.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(y.clearcoatNormalMap.value=g.clearcoatNormalMap,n(g.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===ri&&y.clearcoatNormalScale.value.negate())),g.dispersion>0&&(y.dispersion.value=g.dispersion),g.iridescence>0&&(y.iridescence.value=g.iridescence,y.iridescenceIOR.value=g.iridescenceIOR,y.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(y.iridescenceMap.value=g.iridescenceMap,n(g.iridescenceMap,y.iridescenceMapTransform)),g.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=g.iridescenceThicknessMap,n(g.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),g.transmission>0&&(y.transmission.value=g.transmission,y.transmissionSamplerMap.value=x.texture,y.transmissionSamplerSize.value.set(x.width,x.height),g.transmissionMap&&(y.transmissionMap.value=g.transmissionMap,n(g.transmissionMap,y.transmissionMapTransform)),y.thickness.value=g.thickness,g.thicknessMap&&(y.thicknessMap.value=g.thicknessMap,n(g.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=g.attenuationDistance,y.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(y.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(y.anisotropyMap.value=g.anisotropyMap,n(g.anisotropyMap,y.anisotropyMapTransform))),y.specularIntensity.value=g.specularIntensity,y.specularColor.value.copy(g.specularColor),g.specularColorMap&&(y.specularColorMap.value=g.specularColorMap,n(g.specularColorMap,y.specularColorMapTransform)),g.specularIntensityMap&&(y.specularIntensityMap.value=g.specularIntensityMap,n(g.specularIntensityMap,y.specularIntensityMapTransform))}function m(y,g){g.matcap&&(y.matcap.value=g.matcap)}function _(y,g){const x=e.get(g).light;y.referencePosition.value.setFromMatrixPosition(x.matrixWorld),y.nearDistance.value=x.shadow.camera.near,y.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function zF(r,e,n,i){let s={},o={},a=[];const l=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function c(x,b){const v=b.program;i.uniformBlockBinding(x,v)}function u(x,b){let v=s[x.id];v===void 0&&(m(x),v=h(x),s[x.id]=v,x.addEventListener("dispose",y));const T=b.program;i.updateUBOMapping(x,T);const w=e.render.frame;o[x.id]!==w&&(f(x),o[x.id]=w)}function h(x){const b=d();x.__bindingPointIndex=b;const v=r.createBuffer(),T=x.__size,w=x.usage;return r.bindBuffer(r.UNIFORM_BUFFER,v),r.bufferData(r.UNIFORM_BUFFER,T,w),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,b,v),v}function d(){for(let x=0;x<l;x++)if(a.indexOf(x)===-1)return a.push(x),x;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(x){const b=s[x.id],v=x.uniforms,T=x.__cache;r.bindBuffer(r.UNIFORM_BUFFER,b);for(let w=0,E=v.length;w<E;w++){const A=Array.isArray(v[w])?v[w]:[v[w]];for(let M=0,S=A.length;M<S;M++){const R=A[M];if(p(R,w,M,T)===!0){const O=R.__offset,P=Array.isArray(R.value)?R.value:[R.value];let C=0;for(let I=0;I<P.length;I++){const L=P[I],W=_(L);typeof L=="number"||typeof L=="boolean"?(R.__data[0]=L,r.bufferSubData(r.UNIFORM_BUFFER,O+C,R.__data)):L.isMatrix3?(R.__data[0]=L.elements[0],R.__data[1]=L.elements[1],R.__data[2]=L.elements[2],R.__data[3]=0,R.__data[4]=L.elements[3],R.__data[5]=L.elements[4],R.__data[6]=L.elements[5],R.__data[7]=0,R.__data[8]=L.elements[6],R.__data[9]=L.elements[7],R.__data[10]=L.elements[8],R.__data[11]=0):(L.toArray(R.__data,C),C+=W.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,O,R.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function p(x,b,v,T){const w=x.value,E=b+"_"+v;if(T[E]===void 0)return typeof w=="number"||typeof w=="boolean"?T[E]=w:T[E]=w.clone(),!0;{const A=T[E];if(typeof w=="number"||typeof w=="boolean"){if(A!==w)return T[E]=w,!0}else if(A.equals(w)===!1)return A.copy(w),!0}return!1}function m(x){const b=x.uniforms;let v=0;const T=16;for(let E=0,A=b.length;E<A;E++){const M=Array.isArray(b[E])?b[E]:[b[E]];for(let S=0,R=M.length;S<R;S++){const O=M[S],P=Array.isArray(O.value)?O.value:[O.value];for(let C=0,I=P.length;C<I;C++){const L=P[C],W=_(L),$=v%T,ie=$%W.boundary,U=$+ie;v+=ie,U!==0&&T-U<W.storage&&(v+=T-U),O.__data=new Float32Array(W.storage/Float32Array.BYTES_PER_ELEMENT),O.__offset=v,v+=W.storage}}}const w=v%T;return w>0&&(v+=T-w),x.__size=v,x.__cache={},this}function _(x){const b={boundary:0,storage:0};return typeof x=="number"||typeof x=="boolean"?(b.boundary=4,b.storage=4):x.isVector2?(b.boundary=8,b.storage=8):x.isVector3||x.isColor?(b.boundary=16,b.storage=12):x.isVector4?(b.boundary=16,b.storage=16):x.isMatrix3?(b.boundary=48,b.storage=48):x.isMatrix4?(b.boundary=64,b.storage=64):x.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",x),b}function y(x){const b=x.target;b.removeEventListener("dispose",y);const v=a.indexOf(b.__bindingPointIndex);a.splice(v,1),r.deleteBuffer(s[b.id]),delete s[b.id],delete o[b.id]}function g(){for(const x in s)r.deleteBuffer(s[x]);a=[],s={},o={}}return{bind:c,update:u,dispose:g}}class GF{constructor(e={}){const{canvas:n=uI(),context:i=null,depth:s=!0,stencil:o=!1,alpha:a=!1,antialias:l=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:u=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1,reverseDepthBuffer:f=!1}=e;this.isWebGLRenderer=!0;let p;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=i.getContextAttributes().alpha}else p=a;const m=new Uint32Array(4),_=new Int32Array(4);let y=null,g=null;const x=[],b=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=mi,this.toneMapping=Qs,this.toneMappingExposure=1;const v=this;let T=!1,w=0,E=0,A=null,M=-1,S=null;const R=new Sn,O=new Sn;let P=null;const C=new Et(0);let I=0,L=n.width,W=n.height,$=1,ie=null,U=null;const k=new Sn(0,0,L,W),re=new Sn(0,0,L,W);let he=!1;const F=new h0;let G=!1,ee=!1;const J=new tn,ue=new tn,be=new V,Te=new Sn,je={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let pe=!1;function ot(){return A===null?$:1}let q=i;function Ct(D,H){return n.getContext(D,H)}try{const D={alpha:!0,depth:s,stencil:o,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:u,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Kh}`),n.addEventListener("webglcontextlost",xe,!1),n.addEventListener("webglcontextrestored",Be,!1),n.addEventListener("webglcontextcreationerror",ke,!1),q===null){const H="webgl2";if(q=Ct(H,D),q===null)throw Ct(H)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw console.error("THREE.WebGLRenderer: "+D.message),D}let at,pt,Je,Ot,Ze,B,N,se,ve,Se,me,Ge,Oe,ze,tt,Me,Ve,et,st,$e,St,yt,Ht,Y;function De(){at=new WO(q),at.init(),yt=new PF(q,at),pt=new zO(q,at,e,yt),Je=new CF(q,at),pt.reverseDepthBuffer&&f&&Je.buffers.depth.setReversed(!0),Ot=new YO(q),Ze=new fF,B=new NF(q,at,Je,Ze,pt,yt,Ot),N=new VO(v),se=new HO(v),ve=new FI(q),Ht=new BO(q,ve),Se=new qO(q,ve,Ot,Ht),me=new ZO(q,Se,ve,Ot),st=new KO(q,pt,B),Me=new GO(Ze),Ge=new dF(v,N,se,at,pt,Ht,Me),Oe=new kF(v,Ze),ze=new mF,tt=new bF(at),et=new UO(v,N,se,Je,me,p,c),Ve=new EF(v,me,pt),Y=new zF(q,Ot,pt,Je),$e=new kO(q,at,Ot),St=new XO(q,at,Ot),Ot.programs=Ge.programs,v.capabilities=pt,v.extensions=at,v.properties=Ze,v.renderLists=ze,v.shadowMap=Ve,v.state=Je,v.info=Ot}De();const le=new UF(v,q);this.xr=le,this.getContext=function(){return q},this.getContextAttributes=function(){return q.getContextAttributes()},this.forceContextLoss=function(){const D=at.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=at.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return $},this.setPixelRatio=function(D){D!==void 0&&($=D,this.setSize(L,W,!1))},this.getSize=function(D){return D.set(L,W)},this.setSize=function(D,H,te=!0){if(le.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}L=D,W=H,n.width=Math.floor(D*$),n.height=Math.floor(H*$),te===!0&&(n.style.width=D+"px",n.style.height=H+"px"),this.setViewport(0,0,D,H)},this.getDrawingBufferSize=function(D){return D.set(L*$,W*$).floor()},this.setDrawingBufferSize=function(D,H,te){L=D,W=H,$=te,n.width=Math.floor(D*te),n.height=Math.floor(H*te),this.setViewport(0,0,D,H)},this.getCurrentViewport=function(D){return D.copy(R)},this.getViewport=function(D){return D.copy(k)},this.setViewport=function(D,H,te,oe){D.isVector4?k.set(D.x,D.y,D.z,D.w):k.set(D,H,te,oe),Je.viewport(R.copy(k).multiplyScalar($).round())},this.getScissor=function(D){return D.copy(re)},this.setScissor=function(D,H,te,oe){D.isVector4?re.set(D.x,D.y,D.z,D.w):re.set(D,H,te,oe),Je.scissor(O.copy(re).multiplyScalar($).round())},this.getScissorTest=function(){return he},this.setScissorTest=function(D){Je.setScissorTest(he=D)},this.setOpaqueSort=function(D){ie=D},this.setTransparentSort=function(D){U=D},this.getClearColor=function(D){return D.copy(et.getClearColor())},this.setClearColor=function(){et.setClearColor.apply(et,arguments)},this.getClearAlpha=function(){return et.getClearAlpha()},this.setClearAlpha=function(){et.setClearAlpha.apply(et,arguments)},this.clear=function(D=!0,H=!0,te=!0){let oe=0;if(D){let K=!1;if(A!==null){const Ee=A.texture.format;K=Ee===fg||Ee===dg||Ee===hg}if(K){const Ee=A.texture.type,Ne=Ee===ts||Ee===Qo||Ee===Gc||Ee===Qa||Ee===cg||Ee===ug,We=et.getClearColor(),Xe=et.getClearAlpha(),ct=We.r,_t=We.g,Ke=We.b;Ne?(m[0]=ct,m[1]=_t,m[2]=Ke,m[3]=Xe,q.clearBufferuiv(q.COLOR,0,m)):(_[0]=ct,_[1]=_t,_[2]=Ke,_[3]=Xe,q.clearBufferiv(q.COLOR,0,_))}else oe|=q.COLOR_BUFFER_BIT}H&&(oe|=q.DEPTH_BUFFER_BIT),te&&(oe|=q.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),q.clear(oe)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",xe,!1),n.removeEventListener("webglcontextrestored",Be,!1),n.removeEventListener("webglcontextcreationerror",ke,!1),ze.dispose(),tt.dispose(),Ze.dispose(),N.dispose(),se.dispose(),me.dispose(),Ht.dispose(),Y.dispose(),Ge.dispose(),le.dispose(),le.removeEventListener("sessionstart",Ih),le.removeEventListener("sessionend",Lh),Xs.stop()};function xe(D){D.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function Be(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;const D=Ot.autoReset,H=Ve.enabled,te=Ve.autoUpdate,oe=Ve.needsUpdate,K=Ve.type;De(),Ot.autoReset=D,Ve.enabled=H,Ve.autoUpdate=te,Ve.needsUpdate=oe,Ve.type=K}function ke(D){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",D.statusMessage)}function ht(D){const H=D.target;H.removeEventListener("dispose",ht),fn(H)}function fn(D){On(D),Ze.remove(D)}function On(D){const H=Ze.get(D).programs;H!==void 0&&(H.forEach(function(te){Ge.releaseProgram(te)}),D.isShaderMaterial&&Ge.releaseShaderCache(D))}this.renderBufferDirect=function(D,H,te,oe,K,Ee){H===null&&(H=je);const Ne=K.isMesh&&K.matrixWorld.determinant()<0,We=Yt(D,H,te,oe,K);Je.setMaterial(oe,Ne);let Xe=te.index,ct=1;if(oe.wireframe===!0){if(Xe=Se.getWireframeAttribute(te),Xe===void 0)return;ct=2}const _t=te.drawRange,Ke=te.attributes.position;let Ut=_t.start*ct,Jt=(_t.start+_t.count)*ct;Ee!==null&&(Ut=Math.max(Ut,Ee.start*ct),Jt=Math.min(Jt,(Ee.start+Ee.count)*ct)),Xe!==null?(Ut=Math.max(Ut,0),Jt=Math.min(Jt,Xe.count)):Ke!=null&&(Ut=Math.max(Ut,0),Jt=Math.min(Jt,Ke.count));const on=Jt-Ut;if(on<0||on===1/0)return;Ht.setup(K,oe,We,te,Xe);let Ci,Wt=$e;if(Xe!==null&&(Ci=ve.get(Xe),Wt=St,Wt.setIndex(Ci)),K.isMesh)oe.wireframe===!0?(Je.setLineWidth(oe.wireframeLinewidth*ot()),Wt.setMode(q.LINES)):Wt.setMode(q.TRIANGLES);else if(K.isLine){let Qe=oe.linewidth;Qe===void 0&&(Qe=1),Je.setLineWidth(Qe*ot()),K.isLineSegments?Wt.setMode(q.LINES):K.isLineLoop?Wt.setMode(q.LINE_LOOP):Wt.setMode(q.LINE_STRIP)}else K.isPoints?Wt.setMode(q.POINTS):K.isSprite&&Wt.setMode(q.TRIANGLES);if(K.isBatchedMesh)if(K._multiDrawInstances!==null)Wt.renderMultiDrawInstances(K._multiDrawStarts,K._multiDrawCounts,K._multiDrawCount,K._multiDrawInstances);else if(at.get("WEBGL_multi_draw"))Wt.renderMultiDraw(K._multiDrawStarts,K._multiDrawCounts,K._multiDrawCount);else{const Qe=K._multiDrawStarts,Ys=K._multiDrawCounts,qt=K._multiDrawCount,Rr=Xe?ve.get(Xe).bytesPerElement:1,Ic=Ze.get(oe).currentProgram.getUniforms();for(let Hi=0;Hi<qt;Hi++)Ic.setValue(q,"_gl_DrawID",Hi),Wt.render(Qe[Hi]/Rr,Ys[Hi])}else if(K.isInstancedMesh)Wt.renderInstances(Ut,on,K.count);else if(te.isInstancedBufferGeometry){const Qe=te._maxInstanceCount!==void 0?te._maxInstanceCount:1/0,Ys=Math.min(te.instanceCount,Qe);Wt.renderInstances(Ut,on,Ys)}else Wt.render(Ut,on)};function Ft(D,H,te){D.transparent===!0&&D.side===Jr&&D.forceSinglePass===!1?(D.side=ri,D.needsUpdate=!0,Ue(D,H,te),D.side=Zs,D.needsUpdate=!0,Ue(D,H,te),D.side=Jr):Ue(D,H,te)}this.compile=function(D,H,te=null){te===null&&(te=D),g=tt.get(te),g.init(H),b.push(g),te.traverseVisible(function(K){K.isLight&&K.layers.test(H.layers)&&(g.pushLight(K),K.castShadow&&g.pushShadow(K))}),D!==te&&D.traverseVisible(function(K){K.isLight&&K.layers.test(H.layers)&&(g.pushLight(K),K.castShadow&&g.pushShadow(K))}),g.setupLights();const oe=new Set;return D.traverse(function(K){if(!(K.isMesh||K.isPoints||K.isLine||K.isSprite))return;const Ee=K.material;if(Ee)if(Array.isArray(Ee))for(let Ne=0;Ne<Ee.length;Ne++){const We=Ee[Ne];Ft(We,te,K),oe.add(We)}else Ft(Ee,te,K),oe.add(Ee)}),b.pop(),g=null,oe},this.compileAsync=function(D,H,te=null){const oe=this.compile(D,H,te);return new Promise(K=>{function Ee(){if(oe.forEach(function(Ne){Ze.get(Ne).currentProgram.isReady()&&oe.delete(Ne)}),oe.size===0){K(D);return}setTimeout(Ee,10)}at.get("KHR_parallel_shader_compile")!==null?Ee():setTimeout(Ee,10)})};let ji=null;function Cr(D){ji&&ji(D)}function Ih(){Xs.stop()}function Lh(){Xs.start()}const Xs=new n1;Xs.setAnimationLoop(Cr),typeof self<"u"&&Xs.setContext(self),this.setAnimationLoop=function(D){ji=D,le.setAnimationLoop(D),D===null?Xs.stop():Xs.start()},le.addEventListener("sessionstart",Ih),le.addEventListener("sessionend",Lh),this.render=function(D,H){if(H!==void 0&&H.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;if(D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),H.parent===null&&H.matrixWorldAutoUpdate===!0&&H.updateMatrixWorld(),le.enabled===!0&&le.isPresenting===!0&&(le.cameraAutoUpdate===!0&&le.updateCamera(H),H=le.getCamera()),D.isScene===!0&&D.onBeforeRender(v,D,H,A),g=tt.get(D,b.length),g.init(H),b.push(g),ue.multiplyMatrices(H.projectionMatrix,H.matrixWorldInverse),F.setFromProjectionMatrix(ue),ee=this.localClippingEnabled,G=Me.init(this.clippingPlanes,ee),y=ze.get(D,x.length),y.init(),x.push(y),le.enabled===!0&&le.isPresenting===!0){const Ee=v.xr.getDepthSensingMesh();Ee!==null&&Oh(Ee,H,-1/0,v.sortObjects)}Oh(D,H,0,v.sortObjects),y.finish(),v.sortObjects===!0&&y.sort(ie,U),pe=le.enabled===!1||le.isPresenting===!1||le.hasDepthSensing()===!1,pe&&et.addToRenderList(y,D),this.info.render.frame++,G===!0&&Me.beginShadows();const te=g.state.shadowsArray;Ve.render(te,D,H),G===!0&&Me.endShadows(),this.info.autoReset===!0&&this.info.reset();const oe=y.opaque,K=y.transmissive;if(g.setupLights(),H.isArrayCamera){const Ee=H.cameras;if(K.length>0)for(let Ne=0,We=Ee.length;Ne<We;Ne++){const Xe=Ee[Ne];mm(oe,K,D,Xe)}pe&&et.render(D);for(let Ne=0,We=Ee.length;Ne<We;Ne++){const Xe=Ee[Ne];pm(y,D,Xe,Xe.viewport)}}else K.length>0&&mm(oe,K,D,H),pe&&et.render(D),pm(y,D,H);A!==null&&(B.updateMultisampleRenderTarget(A),B.updateRenderTargetMipmap(A)),D.isScene===!0&&D.onAfterRender(v,D,H),Ht.resetDefaultState(),M=-1,S=null,b.pop(),b.length>0?(g=b[b.length-1],G===!0&&Me.setGlobalState(v.clippingPlanes,g.state.camera)):g=null,x.pop(),x.length>0?y=x[x.length-1]:y=null};function Oh(D,H,te,oe){if(D.visible===!1)return;if(D.layers.test(H.layers)){if(D.isGroup)te=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(H);else if(D.isLight)g.pushLight(D),D.castShadow&&g.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||F.intersectsSprite(D)){oe&&Te.setFromMatrixPosition(D.matrixWorld).applyMatrix4(ue);const Ne=me.update(D),We=D.material;We.visible&&y.push(D,Ne,We,te,Te.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||F.intersectsObject(D))){const Ne=me.update(D),We=D.material;if(oe&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),Te.copy(D.boundingSphere.center)):(Ne.boundingSphere===null&&Ne.computeBoundingSphere(),Te.copy(Ne.boundingSphere.center)),Te.applyMatrix4(D.matrixWorld).applyMatrix4(ue)),Array.isArray(We)){const Xe=Ne.groups;for(let ct=0,_t=Xe.length;ct<_t;ct++){const Ke=Xe[ct],Ut=We[Ke.materialIndex];Ut&&Ut.visible&&y.push(D,Ne,Ut,te,Te.z,Ke)}}else We.visible&&y.push(D,Ne,We,te,Te.z,null)}}const Ee=D.children;for(let Ne=0,We=Ee.length;Ne<We;Ne++)Oh(Ee[Ne],H,te,oe)}function pm(D,H,te,oe){const K=D.opaque,Ee=D.transmissive,Ne=D.transparent;g.setupLightsView(te),G===!0&&Me.setGlobalState(v.clippingPlanes,te),oe&&Je.viewport(R.copy(oe)),K.length>0&&z(K,H,te),Ee.length>0&&z(Ee,H,te),Ne.length>0&&z(Ne,H,te),Je.buffers.depth.setTest(!0),Je.buffers.depth.setMask(!0),Je.buffers.color.setMask(!0),Je.setPolygonOffset(!1)}function mm(D,H,te,oe){if((te.isScene===!0?te.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[oe.id]===void 0&&(g.state.transmissionRenderTarget[oe.id]=new eo(1,1,{generateMipmaps:!0,type:at.has("EXT_color_buffer_half_float")||at.has("EXT_color_buffer_float")?Za:ts,minFilter:Zo,samples:4,stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Dt.workingColorSpace}));const Ee=g.state.transmissionRenderTarget[oe.id],Ne=oe.viewport||R;Ee.setSize(Ne.z,Ne.w);const We=v.getRenderTarget();v.setRenderTarget(Ee),v.getClearColor(C),I=v.getClearAlpha(),I<1&&v.setClearColor(16777215,.5),v.clear(),pe&&et.render(te);const Xe=v.toneMapping;v.toneMapping=Qs;const ct=oe.viewport;if(oe.viewport!==void 0&&(oe.viewport=void 0),g.setupLightsView(oe),G===!0&&Me.setGlobalState(v.clippingPlanes,oe),z(D,te,oe),B.updateMultisampleRenderTarget(Ee),B.updateRenderTargetMipmap(Ee),at.has("WEBGL_multisampled_render_to_texture")===!1){let _t=!1;for(let Ke=0,Ut=H.length;Ke<Ut;Ke++){const Jt=H[Ke],on=Jt.object,Ci=Jt.geometry,Wt=Jt.material,Qe=Jt.group;if(Wt.side===Jr&&on.layers.test(oe.layers)){const Ys=Wt.side;Wt.side=ri,Wt.needsUpdate=!0,we(on,te,oe,Ci,Wt,Qe),Wt.side=Ys,Wt.needsUpdate=!0,_t=!0}}_t===!0&&(B.updateMultisampleRenderTarget(Ee),B.updateRenderTargetMipmap(Ee))}v.setRenderTarget(We),v.setClearColor(C,I),ct!==void 0&&(oe.viewport=ct),v.toneMapping=Xe}function z(D,H,te){const oe=H.isScene===!0?H.overrideMaterial:null;for(let K=0,Ee=D.length;K<Ee;K++){const Ne=D[K],We=Ne.object,Xe=Ne.geometry,ct=oe===null?Ne.material:oe,_t=Ne.group;We.layers.test(te.layers)&&we(We,H,te,Xe,ct,_t)}}function we(D,H,te,oe,K,Ee){D.onBeforeRender(v,H,te,oe,K,Ee),D.modelViewMatrix.multiplyMatrices(te.matrixWorldInverse,D.matrixWorld),D.normalMatrix.getNormalMatrix(D.modelViewMatrix),K.onBeforeRender(v,H,te,oe,D,Ee),K.transparent===!0&&K.side===Jr&&K.forceSinglePass===!1?(K.side=ri,K.needsUpdate=!0,v.renderBufferDirect(te,H,oe,K,D,Ee),K.side=Zs,K.needsUpdate=!0,v.renderBufferDirect(te,H,oe,K,D,Ee),K.side=Jr):v.renderBufferDirect(te,H,oe,K,D,Ee),D.onAfterRender(v,H,te,oe,K,Ee)}function Ue(D,H,te){H.isScene!==!0&&(H=je);const oe=Ze.get(D),K=g.state.lights,Ee=g.state.shadowsArray,Ne=K.state.version,We=Ge.getParameters(D,K.state,Ee,H,te),Xe=Ge.getProgramCacheKey(We);let ct=oe.programs;oe.environment=D.isMeshStandardMaterial?H.environment:null,oe.fog=H.fog,oe.envMap=(D.isMeshStandardMaterial?se:N).get(D.envMap||oe.environment),oe.envMapRotation=oe.environment!==null&&D.envMap===null?H.environmentRotation:D.envMapRotation,ct===void 0&&(D.addEventListener("dispose",ht),ct=new Map,oe.programs=ct);let _t=ct.get(Xe);if(_t!==void 0){if(oe.currentProgram===_t&&oe.lightsStateVersion===Ne)return It(D,We),_t}else We.uniforms=Ge.getUniforms(D),D.onBeforeCompile(We,v),_t=Ge.acquireProgram(We,Xe),ct.set(Xe,_t),oe.uniforms=We.uniforms;const Ke=oe.uniforms;return(!D.isShaderMaterial&&!D.isRawShaderMaterial||D.clipping===!0)&&(Ke.clippingPlanes=Me.uniform),It(D,We),oe.needsLights=wt(D),oe.lightsStateVersion=Ne,oe.needsLights&&(Ke.ambientLightColor.value=K.state.ambient,Ke.lightProbe.value=K.state.probe,Ke.directionalLights.value=K.state.directional,Ke.directionalLightShadows.value=K.state.directionalShadow,Ke.spotLights.value=K.state.spot,Ke.spotLightShadows.value=K.state.spotShadow,Ke.rectAreaLights.value=K.state.rectArea,Ke.ltc_1.value=K.state.rectAreaLTC1,Ke.ltc_2.value=K.state.rectAreaLTC2,Ke.pointLights.value=K.state.point,Ke.pointLightShadows.value=K.state.pointShadow,Ke.hemisphereLights.value=K.state.hemi,Ke.directionalShadowMap.value=K.state.directionalShadowMap,Ke.directionalShadowMatrix.value=K.state.directionalShadowMatrix,Ke.spotShadowMap.value=K.state.spotShadowMap,Ke.spotLightMatrix.value=K.state.spotLightMatrix,Ke.spotLightMap.value=K.state.spotLightMap,Ke.pointShadowMap.value=K.state.pointShadowMap,Ke.pointShadowMatrix.value=K.state.pointShadowMatrix),oe.currentProgram=_t,oe.uniformsList=null,_t}function lt(D){if(D.uniformsList===null){const H=D.currentProgram.getUniforms();D.uniformsList=Rd.seqWithValue(H.seq,D.uniforms)}return D.uniformsList}function It(D,H){const te=Ze.get(D);te.outputColorSpace=H.outputColorSpace,te.batching=H.batching,te.batchingColor=H.batchingColor,te.instancing=H.instancing,te.instancingColor=H.instancingColor,te.instancingMorph=H.instancingMorph,te.skinning=H.skinning,te.morphTargets=H.morphTargets,te.morphNormals=H.morphNormals,te.morphColors=H.morphColors,te.morphTargetsCount=H.morphTargetsCount,te.numClippingPlanes=H.numClippingPlanes,te.numIntersection=H.numClipIntersection,te.vertexAlphas=H.vertexAlphas,te.vertexTangents=H.vertexTangents,te.toneMapping=H.toneMapping}function Yt(D,H,te,oe,K){H.isScene!==!0&&(H=je),B.resetTextureUnits();const Ee=H.fog,Ne=oe.isMeshStandardMaterial?H.environment:null,We=A===null?v.outputColorSpace:A.isXRRenderTarget===!0?A.texture.colorSpace:tl,Xe=(oe.isMeshStandardMaterial?se:N).get(oe.envMap||Ne),ct=oe.vertexColors===!0&&!!te.attributes.color&&te.attributes.color.itemSize===4,_t=!!te.attributes.tangent&&(!!oe.normalMap||oe.anisotropy>0),Ke=!!te.morphAttributes.position,Ut=!!te.morphAttributes.normal,Jt=!!te.morphAttributes.color;let on=Qs;oe.toneMapped&&(A===null||A.isXRRenderTarget===!0)&&(on=v.toneMapping);const Ci=te.morphAttributes.position||te.morphAttributes.normal||te.morphAttributes.color,Wt=Ci!==void 0?Ci.length:0,Qe=Ze.get(oe),Ys=g.state.lights;if(G===!0&&(ee===!0||D!==S)){const ir=D===S&&oe.id===M;Me.setState(oe,D,ir)}let qt=!1;oe.version===Qe.__version?(Qe.needsLights&&Qe.lightsStateVersion!==Ys.state.version||Qe.outputColorSpace!==We||K.isBatchedMesh&&Qe.batching===!1||!K.isBatchedMesh&&Qe.batching===!0||K.isBatchedMesh&&Qe.batchingColor===!0&&K.colorTexture===null||K.isBatchedMesh&&Qe.batchingColor===!1&&K.colorTexture!==null||K.isInstancedMesh&&Qe.instancing===!1||!K.isInstancedMesh&&Qe.instancing===!0||K.isSkinnedMesh&&Qe.skinning===!1||!K.isSkinnedMesh&&Qe.skinning===!0||K.isInstancedMesh&&Qe.instancingColor===!0&&K.instanceColor===null||K.isInstancedMesh&&Qe.instancingColor===!1&&K.instanceColor!==null||K.isInstancedMesh&&Qe.instancingMorph===!0&&K.morphTexture===null||K.isInstancedMesh&&Qe.instancingMorph===!1&&K.morphTexture!==null||Qe.envMap!==Xe||oe.fog===!0&&Qe.fog!==Ee||Qe.numClippingPlanes!==void 0&&(Qe.numClippingPlanes!==Me.numPlanes||Qe.numIntersection!==Me.numIntersection)||Qe.vertexAlphas!==ct||Qe.vertexTangents!==_t||Qe.morphTargets!==Ke||Qe.morphNormals!==Ut||Qe.morphColors!==Jt||Qe.toneMapping!==on||Qe.morphTargetsCount!==Wt)&&(qt=!0):(qt=!0,Qe.__version=oe.version);let Rr=Qe.currentProgram;qt===!0&&(Rr=Ue(oe,H,K));let Ic=!1,Hi=!1,Fh=!1;const an=Rr.getUniforms(),Yr=Qe.uniforms;if(Je.useProgram(Rr.program)&&(Ic=!0,Hi=!0,Fh=!0),oe.id!==M&&(M=oe.id,Hi=!0),Ic||S!==D){Je.buffers.depth.getReversed()?(J.copy(D.projectionMatrix),dI(J),fI(J),an.setValue(q,"projectionMatrix",J)):an.setValue(q,"projectionMatrix",D.projectionMatrix),an.setValue(q,"viewMatrix",D.matrixWorldInverse);const zo=an.map.cameraPosition;zo!==void 0&&zo.setValue(q,be.setFromMatrixPosition(D.matrixWorld)),pt.logarithmicDepthBuffer&&an.setValue(q,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(oe.isMeshPhongMaterial||oe.isMeshToonMaterial||oe.isMeshLambertMaterial||oe.isMeshBasicMaterial||oe.isMeshStandardMaterial||oe.isShaderMaterial)&&an.setValue(q,"isOrthographic",D.isOrthographicCamera===!0),S!==D&&(S=D,Hi=!0,Fh=!0)}if(K.isSkinnedMesh){an.setOptional(q,K,"bindMatrix"),an.setOptional(q,K,"bindMatrixInverse");const ir=K.skeleton;ir&&(ir.boneTexture===null&&ir.computeBoneTexture(),an.setValue(q,"boneTexture",ir.boneTexture,B))}K.isBatchedMesh&&(an.setOptional(q,K,"batchingTexture"),an.setValue(q,"batchingTexture",K._matricesTexture,B),an.setOptional(q,K,"batchingIdTexture"),an.setValue(q,"batchingIdTexture",K._indirectTexture,B),an.setOptional(q,K,"batchingColorTexture"),K._colorsTexture!==null&&an.setValue(q,"batchingColorTexture",K._colorsTexture,B));const Uh=te.morphAttributes;if((Uh.position!==void 0||Uh.normal!==void 0||Uh.color!==void 0)&&st.update(K,te,Rr),(Hi||Qe.receiveShadow!==K.receiveShadow)&&(Qe.receiveShadow=K.receiveShadow,an.setValue(q,"receiveShadow",K.receiveShadow)),oe.isMeshGouraudMaterial&&oe.envMap!==null&&(Yr.envMap.value=Xe,Yr.flipEnvMap.value=Xe.isCubeTexture&&Xe.isRenderTargetTexture===!1?-1:1),oe.isMeshStandardMaterial&&oe.envMap===null&&H.environment!==null&&(Yr.envMapIntensity.value=H.environmentIntensity),Hi&&(an.setValue(q,"toneMappingExposure",v.toneMappingExposure),Qe.needsLights&&Rt(Yr,Fh),Ee&&oe.fog===!0&&Oe.refreshFogUniforms(Yr,Ee),Oe.refreshMaterialUniforms(Yr,oe,$,W,g.state.transmissionRenderTarget[D.id]),Rd.upload(q,lt(Qe),Yr,B)),oe.isShaderMaterial&&oe.uniformsNeedUpdate===!0&&(Rd.upload(q,lt(Qe),Yr,B),oe.uniformsNeedUpdate=!1),oe.isSpriteMaterial&&an.setValue(q,"center",K.center),an.setValue(q,"modelViewMatrix",K.modelViewMatrix),an.setValue(q,"normalMatrix",K.normalMatrix),an.setValue(q,"modelMatrix",K.matrixWorld),oe.isShaderMaterial||oe.isRawShaderMaterial){const ir=oe.uniformsGroups;for(let zo=0,Go=ir.length;zo<Go;zo++){const hN=ir[zo];Y.update(hN,Rr),Y.bind(hN,Rr)}}return Rr}function Rt(D,H){D.ambientLightColor.needsUpdate=H,D.lightProbe.needsUpdate=H,D.directionalLights.needsUpdate=H,D.directionalLightShadows.needsUpdate=H,D.pointLights.needsUpdate=H,D.pointLightShadows.needsUpdate=H,D.spotLights.needsUpdate=H,D.spotLightShadows.needsUpdate=H,D.rectAreaLights.needsUpdate=H,D.hemisphereLights.needsUpdate=H}function wt(D){return D.isMeshLambertMaterial||D.isMeshToonMaterial||D.isMeshPhongMaterial||D.isMeshStandardMaterial||D.isShadowMaterial||D.isShaderMaterial&&D.lights===!0}this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return E},this.getRenderTarget=function(){return A},this.setRenderTargetTextures=function(D,H,te){Ze.get(D.texture).__webglTexture=H,Ze.get(D.depthTexture).__webglTexture=te;const oe=Ze.get(D);oe.__hasExternalTextures=!0,oe.__autoAllocateDepthBuffer=te===void 0,oe.__autoAllocateDepthBuffer||at.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),oe.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(D,H){const te=Ze.get(D);te.__webglFramebuffer=H,te.__useDefaultFramebuffer=H===void 0},this.setRenderTarget=function(D,H=0,te=0){A=D,w=H,E=te;let oe=!0,K=null,Ee=!1,Ne=!1;if(D){const Xe=Ze.get(D);if(Xe.__useDefaultFramebuffer!==void 0)Je.bindFramebuffer(q.FRAMEBUFFER,null),oe=!1;else if(Xe.__webglFramebuffer===void 0)B.setupRenderTarget(D);else if(Xe.__hasExternalTextures)B.rebindTextures(D,Ze.get(D.texture).__webglTexture,Ze.get(D.depthTexture).__webglTexture);else if(D.depthBuffer){const Ke=D.depthTexture;if(Xe.__boundDepthTexture!==Ke){if(Ke!==null&&Ze.has(Ke)&&(D.width!==Ke.image.width||D.height!==Ke.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");B.setupDepthRenderbuffer(D)}}const ct=D.texture;(ct.isData3DTexture||ct.isDataArrayTexture||ct.isCompressedArrayTexture)&&(Ne=!0);const _t=Ze.get(D).__webglFramebuffer;D.isWebGLCubeRenderTarget?(Array.isArray(_t[H])?K=_t[H][te]:K=_t[H],Ee=!0):D.samples>0&&B.useMultisampledRTT(D)===!1?K=Ze.get(D).__webglMultisampledFramebuffer:Array.isArray(_t)?K=_t[te]:K=_t,R.copy(D.viewport),O.copy(D.scissor),P=D.scissorTest}else R.copy(k).multiplyScalar($).floor(),O.copy(re).multiplyScalar($).floor(),P=he;if(Je.bindFramebuffer(q.FRAMEBUFFER,K)&&oe&&Je.drawBuffers(D,K),Je.viewport(R),Je.scissor(O),Je.setScissorTest(P),Ee){const Xe=Ze.get(D.texture);q.framebufferTexture2D(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_CUBE_MAP_POSITIVE_X+H,Xe.__webglTexture,te)}else if(Ne){const Xe=Ze.get(D.texture),ct=H||0;q.framebufferTextureLayer(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,Xe.__webglTexture,te||0,ct)}M=-1},this.readRenderTargetPixels=function(D,H,te,oe,K,Ee,Ne){if(!(D&&D.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let We=Ze.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Ne!==void 0&&(We=We[Ne]),We){Je.bindFramebuffer(q.FRAMEBUFFER,We);try{const Xe=D.texture,ct=Xe.format,_t=Xe.type;if(!pt.textureFormatReadable(ct)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!pt.textureTypeReadable(_t)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}H>=0&&H<=D.width-oe&&te>=0&&te<=D.height-K&&q.readPixels(H,te,oe,K,yt.convert(ct),yt.convert(_t),Ee)}finally{const Xe=A!==null?Ze.get(A).__webglFramebuffer:null;Je.bindFramebuffer(q.FRAMEBUFFER,Xe)}}},this.readRenderTargetPixelsAsync=async function(D,H,te,oe,K,Ee,Ne){if(!(D&&D.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let We=Ze.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Ne!==void 0&&(We=We[Ne]),We){const Xe=D.texture,ct=Xe.format,_t=Xe.type;if(!pt.textureFormatReadable(ct))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!pt.textureTypeReadable(_t))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(H>=0&&H<=D.width-oe&&te>=0&&te<=D.height-K){Je.bindFramebuffer(q.FRAMEBUFFER,We);const Ke=q.createBuffer();q.bindBuffer(q.PIXEL_PACK_BUFFER,Ke),q.bufferData(q.PIXEL_PACK_BUFFER,Ee.byteLength,q.STREAM_READ),q.readPixels(H,te,oe,K,yt.convert(ct),yt.convert(_t),0);const Ut=A!==null?Ze.get(A).__webglFramebuffer:null;Je.bindFramebuffer(q.FRAMEBUFFER,Ut);const Jt=q.fenceSync(q.SYNC_GPU_COMMANDS_COMPLETE,0);return q.flush(),await hI(q,Jt,4),q.bindBuffer(q.PIXEL_PACK_BUFFER,Ke),q.getBufferSubData(q.PIXEL_PACK_BUFFER,0,Ee),q.deleteBuffer(Ke),q.deleteSync(Jt),Ee}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(D,H=null,te=0){D.isTexture!==!0&&(Wc("WebGLRenderer: copyFramebufferToTexture function signature has changed."),H=arguments[0]||null,D=arguments[1]);const oe=Math.pow(2,-te),K=Math.floor(D.image.width*oe),Ee=Math.floor(D.image.height*oe),Ne=H!==null?H.x:0,We=H!==null?H.y:0;B.setTexture2D(D,0),q.copyTexSubImage2D(q.TEXTURE_2D,te,0,0,Ne,We,K,Ee),Je.unbindTexture()},this.copyTextureToTexture=function(D,H,te=null,oe=null,K=0){D.isTexture!==!0&&(Wc("WebGLRenderer: copyTextureToTexture function signature has changed."),oe=arguments[0]||null,D=arguments[1],H=arguments[2],K=arguments[3]||0,te=null);let Ee,Ne,We,Xe,ct,_t,Ke,Ut,Jt;const on=D.isCompressedTexture?D.mipmaps[K]:D.image;te!==null?(Ee=te.max.x-te.min.x,Ne=te.max.y-te.min.y,We=te.isBox3?te.max.z-te.min.z:1,Xe=te.min.x,ct=te.min.y,_t=te.isBox3?te.min.z:0):(Ee=on.width,Ne=on.height,We=on.depth||1,Xe=0,ct=0,_t=0),oe!==null?(Ke=oe.x,Ut=oe.y,Jt=oe.z):(Ke=0,Ut=0,Jt=0);const Ci=yt.convert(H.format),Wt=yt.convert(H.type);let Qe;H.isData3DTexture?(B.setTexture3D(H,0),Qe=q.TEXTURE_3D):H.isDataArrayTexture||H.isCompressedArrayTexture?(B.setTexture2DArray(H,0),Qe=q.TEXTURE_2D_ARRAY):(B.setTexture2D(H,0),Qe=q.TEXTURE_2D),q.pixelStorei(q.UNPACK_FLIP_Y_WEBGL,H.flipY),q.pixelStorei(q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,H.premultiplyAlpha),q.pixelStorei(q.UNPACK_ALIGNMENT,H.unpackAlignment);const Ys=q.getParameter(q.UNPACK_ROW_LENGTH),qt=q.getParameter(q.UNPACK_IMAGE_HEIGHT),Rr=q.getParameter(q.UNPACK_SKIP_PIXELS),Ic=q.getParameter(q.UNPACK_SKIP_ROWS),Hi=q.getParameter(q.UNPACK_SKIP_IMAGES);q.pixelStorei(q.UNPACK_ROW_LENGTH,on.width),q.pixelStorei(q.UNPACK_IMAGE_HEIGHT,on.height),q.pixelStorei(q.UNPACK_SKIP_PIXELS,Xe),q.pixelStorei(q.UNPACK_SKIP_ROWS,ct),q.pixelStorei(q.UNPACK_SKIP_IMAGES,_t);const Fh=D.isDataArrayTexture||D.isData3DTexture,an=H.isDataArrayTexture||H.isData3DTexture;if(D.isRenderTargetTexture||D.isDepthTexture){const Yr=Ze.get(D),Uh=Ze.get(H),ir=Ze.get(Yr.__renderTarget),zo=Ze.get(Uh.__renderTarget);Je.bindFramebuffer(q.READ_FRAMEBUFFER,ir.__webglFramebuffer),Je.bindFramebuffer(q.DRAW_FRAMEBUFFER,zo.__webglFramebuffer);for(let Go=0;Go<We;Go++)Fh&&q.framebufferTextureLayer(q.READ_FRAMEBUFFER,q.COLOR_ATTACHMENT0,Ze.get(D).__webglTexture,K,_t+Go),D.isDepthTexture?(an&&q.framebufferTextureLayer(q.DRAW_FRAMEBUFFER,q.COLOR_ATTACHMENT0,Ze.get(H).__webglTexture,K,Jt+Go),q.blitFramebuffer(Xe,ct,Ee,Ne,Ke,Ut,Ee,Ne,q.DEPTH_BUFFER_BIT,q.NEAREST)):an?q.copyTexSubImage3D(Qe,K,Ke,Ut,Jt+Go,Xe,ct,Ee,Ne):q.copyTexSubImage2D(Qe,K,Ke,Ut,Jt+Go,Xe,ct,Ee,Ne);Je.bindFramebuffer(q.READ_FRAMEBUFFER,null),Je.bindFramebuffer(q.DRAW_FRAMEBUFFER,null)}else an?D.isDataTexture||D.isData3DTexture?q.texSubImage3D(Qe,K,Ke,Ut,Jt,Ee,Ne,We,Ci,Wt,on.data):H.isCompressedArrayTexture?q.compressedTexSubImage3D(Qe,K,Ke,Ut,Jt,Ee,Ne,We,Ci,on.data):q.texSubImage3D(Qe,K,Ke,Ut,Jt,Ee,Ne,We,Ci,Wt,on):D.isDataTexture?q.texSubImage2D(q.TEXTURE_2D,K,Ke,Ut,Ee,Ne,Ci,Wt,on.data):D.isCompressedTexture?q.compressedTexSubImage2D(q.TEXTURE_2D,K,Ke,Ut,on.width,on.height,Ci,on.data):q.texSubImage2D(q.TEXTURE_2D,K,Ke,Ut,Ee,Ne,Ci,Wt,on);q.pixelStorei(q.UNPACK_ROW_LENGTH,Ys),q.pixelStorei(q.UNPACK_IMAGE_HEIGHT,qt),q.pixelStorei(q.UNPACK_SKIP_PIXELS,Rr),q.pixelStorei(q.UNPACK_SKIP_ROWS,Ic),q.pixelStorei(q.UNPACK_SKIP_IMAGES,Hi),K===0&&H.generateMipmaps&&q.generateMipmap(Qe),Je.unbindTexture()},this.copyTextureToTexture3D=function(D,H,te=null,oe=null,K=0){return D.isTexture!==!0&&(Wc("WebGLRenderer: copyTextureToTexture3D function signature has changed."),te=arguments[0]||null,oe=arguments[1]||null,D=arguments[2],H=arguments[3],K=arguments[4]||0),Wc('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(D,H,te,oe,K)},this.initRenderTarget=function(D){Ze.get(D).__webglFramebuffer===void 0&&B.setupRenderTarget(D)},this.initTexture=function(D){D.isCubeTexture?B.setTextureCube(D,0):D.isData3DTexture?B.setTexture3D(D,0):D.isDataArrayTexture||D.isCompressedArrayTexture?B.setTexture2DArray(D,0):B.setTexture2D(D,0),Je.unbindTexture()},this.resetState=function(){w=0,E=0,A=null,Je.reset(),Ht.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return is}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorspace=Dt._getDrawingBufferColorSpace(e),n.unpackColorSpace=Dt._getUnpackColorSpace()}}let VF=class extends gi{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new so,this.environmentIntensity=1,this.environmentRotation=new so,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}},$F=class{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=zg,this.updateRanges=[],this.version=0,this.uuid=rs()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,n,i){e*=this.stride,i*=n.stride;for(let s=0,o=this.stride;s<o;s++)this.array[e+s]=n.array[i+s];return this}set(e,n=0){return this.array.set(e,n),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=rs()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const n=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(n,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=rs()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}};const oi=new V;let I1=class vN{constructor(e,n,i,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=n,this.offset=i,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let n=0,i=this.data.count;n<i;n++)oi.fromBufferAttribute(this,n),oi.applyMatrix4(e),this.setXYZ(n,oi.x,oi.y,oi.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)oi.fromBufferAttribute(this,n),oi.applyNormalMatrix(e),this.setXYZ(n,oi.x,oi.y,oi.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)oi.fromBufferAttribute(this,n),oi.transformDirection(e),this.setXYZ(n,oi.x,oi.y,oi.z);return this}getComponent(e,n){let i=this.array[e*this.data.stride+this.offset+n];return this.normalized&&(i=ar(i,this.array)),i}setComponent(e,n,i){return this.normalized&&(i=Xt(i,this.array)),this.data.array[e*this.data.stride+this.offset+n]=i,this}setX(e,n){return this.normalized&&(n=Xt(n,this.array)),this.data.array[e*this.data.stride+this.offset]=n,this}setY(e,n){return this.normalized&&(n=Xt(n,this.array)),this.data.array[e*this.data.stride+this.offset+1]=n,this}setZ(e,n){return this.normalized&&(n=Xt(n,this.array)),this.data.array[e*this.data.stride+this.offset+2]=n,this}setW(e,n){return this.normalized&&(n=Xt(n,this.array)),this.data.array[e*this.data.stride+this.offset+3]=n,this}getX(e){let n=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(n=ar(n,this.array)),n}getY(e){let n=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(n=ar(n,this.array)),n}getZ(e){let n=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(n=ar(n,this.array)),n}getW(e){let n=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(n=ar(n,this.array)),n}setXY(e,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(n=Xt(n,this.array),i=Xt(i,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=i,this}setXYZ(e,n,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(n=Xt(n,this.array),i=Xt(i,this.array),s=Xt(s,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=i,this.data.array[e+2]=s,this}setXYZW(e,n,i,s,o){return e=e*this.data.stride+this.offset,this.normalized&&(n=Xt(n,this.array),i=Xt(i,this.array),s=Xt(s,this.array),o=Xt(o,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=i,this.data.array[e+2]=s,this.data.array[e+3]=o,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let i=0;i<this.count;i++){const s=i*this.data.stride+this.offset;for(let o=0;o<this.itemSize;o++)n.push(this.data.array[s+o])}return new Wi(new this.array.constructor(n),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new vN(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let i=0;i<this.count;i++){const s=i*this.data.stride+this.offset;for(let o=0;o<this.itemSize;o++)n.push(this.data.array[s+o])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:n,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},L1=class extends ia{static get type(){return"SpriteMaterial"}constructor(e){super(),this.isSpriteMaterial=!0,this.color=new Et(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},bl;const Jc=new V,Sl=new V,Tl=new V,wl=new Pe,eu=new Pe,O1=new tn,Pd=new V,tu=new V,Dd=new V,F1=new Pe,S0=new Pe,U1=new Pe;class jF extends gi{constructor(e=new L1){if(super(),this.isSprite=!0,this.type="Sprite",bl===void 0){bl=new Di;const n=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new $F(n,5);bl.setIndex([0,1,2,0,2,3]),bl.setAttribute("position",new I1(i,3,0,!1)),bl.setAttribute("uv",new I1(i,2,3,!1))}this.geometry=bl,this.material=e,this.center=new Pe(.5,.5)}raycast(e,n){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Sl.setFromMatrixScale(this.matrixWorld),O1.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Tl.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Sl.multiplyScalar(-Tl.z);const i=this.material.rotation;let s,o;i!==0&&(o=Math.cos(i),s=Math.sin(i));const a=this.center;Id(Pd.set(-.5,-.5,0),Tl,a,Sl,s,o),Id(tu.set(.5,-.5,0),Tl,a,Sl,s,o),Id(Dd.set(.5,.5,0),Tl,a,Sl,s,o),F1.set(0,0),S0.set(1,0),U1.set(1,1);let l=e.ray.intersectTriangle(Pd,tu,Dd,!1,Jc);if(l===null&&(Id(tu.set(-.5,.5,0),Tl,a,Sl,s,o),S0.set(0,1),l=e.ray.intersectTriangle(Pd,Dd,tu,!1,Jc),l===null))return;const c=e.ray.origin.distanceTo(Jc);c<e.near||c>e.far||n.push({distance:c,point:Jc.clone(),uv:fl.getInterpolation(Jc,Pd,tu,Dd,F1,S0,U1,new Pe),face:null,object:this})}copy(e,n){return super.copy(e,n),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Id(r,e,n,i,s,o){wl.subVectors(r,n).addScalar(.5).multiply(i),s!==void 0?(eu.x=o*wl.x-s*wl.y,eu.y=s*wl.x+o*wl.y):eu.copy(wl),r.copy(e),r.x+=eu.x,r.y+=eu.y,r.applyMatrix4(O1)}let B1=class extends ia{static get type(){return"LineBasicMaterial"}constructor(e){super(),this.isLineBasicMaterial=!0,this.color=new Et(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}};const Ld=new V,Od=new V,k1=new tn,nu=new dd,Fd=new cd,T0=new V,z1=new V;class HF extends gi{constructor(e=new Di,n=new B1){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[0];for(let s=1,o=n.count;s<o;s++)Ld.fromBufferAttribute(n,s-1),Od.fromBufferAttribute(n,s),i[s]=i[s-1],i[s]+=Ld.distanceTo(Od);e.setAttribute("lineDistance",new yn(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,n){const i=this.geometry,s=this.matrixWorld,o=e.params.Line.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Fd.copy(i.boundingSphere),Fd.applyMatrix4(s),Fd.radius+=o,e.ray.intersectsSphere(Fd)===!1)return;k1.copy(s).invert(),nu.copy(e.ray).applyMatrix4(k1);const l=o/((this.scale.x+this.scale.y+this.scale.z)/3),c=l*l,u=this.isLineSegments?2:1,h=i.index,f=i.attributes.position;if(h!==null){const p=Math.max(0,a.start),m=Math.min(h.count,a.start+a.count);for(let _=p,y=m-1;_<y;_+=u){const g=h.getX(_),x=h.getX(_+1),b=Ud(this,e,nu,c,g,x);b&&n.push(b)}if(this.isLineLoop){const _=h.getX(m-1),y=h.getX(p),g=Ud(this,e,nu,c,_,y);g&&n.push(g)}}else{const p=Math.max(0,a.start),m=Math.min(f.count,a.start+a.count);for(let _=p,y=m-1;_<y;_+=u){const g=Ud(this,e,nu,c,_,_+1);g&&n.push(g)}if(this.isLineLoop){const _=Ud(this,e,nu,c,m-1,p);_&&n.push(_)}}}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const s=n[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,a=s.length;o<a;o++){const l=s[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=o}}}}}function Ud(r,e,n,i,s,o){const a=r.geometry.attributes.position;if(Ld.fromBufferAttribute(a,s),Od.fromBufferAttribute(a,o),n.distanceSqToSegment(Ld,Od,T0,z1)>i)return;T0.applyMatrix4(r.matrixWorld);const c=e.ray.origin.distanceTo(T0);if(!(c<e.near||c>e.far))return{distance:c,point:z1.clone().applyMatrix4(r.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:r}}class WF extends Ri{constructor(e,n,i,s,o,a,l,c,u){super(e,n,i,s,o,a,l,c,u),this.isCanvasTexture=!0,this.needsUpdate=!0}}class ds{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,n){const i=this.getUtoTmapping(e);return this.getPoint(i,n)}getPoints(e=5){const n=[];for(let i=0;i<=e;i++)n.push(this.getPoint(i/e));return n}getSpacedPoints(e=5){const n=[];for(let i=0;i<=e;i++)n.push(this.getPointAt(i/e));return n}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let i,s=this.getPoint(0),o=0;n.push(0);for(let a=1;a<=e;a++)i=this.getPoint(a/e),o+=i.distanceTo(s),n.push(o),s=i;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n){const i=this.getLengths();let s=0;const o=i.length;let a;n?a=n:a=e*i[o-1];let l=0,c=o-1,u;for(;l<=c;)if(s=Math.floor(l+(c-l)/2),u=i[s]-a,u<0)l=s+1;else if(u>0)c=s-1;else{c=s;break}if(s=c,i[s]===a)return s/(o-1);const h=i[s],f=i[s+1]-h,p=(a-h)/f;return(s+p)/(o-1)}getTangent(e,n){let s=e-1e-4,o=e+1e-4;s<0&&(s=0),o>1&&(o=1);const a=this.getPoint(s),l=this.getPoint(o),c=n||(a.isVector2?new Pe:new V);return c.copy(l).sub(a).normalize(),c}getTangentAt(e,n){const i=this.getUtoTmapping(e);return this.getTangent(i,n)}computeFrenetFrames(e,n){const i=new V,s=[],o=[],a=[],l=new V,c=new tn;for(let p=0;p<=e;p++){const m=p/e;s[p]=this.getTangentAt(m,new V)}o[0]=new V,a[0]=new V;let u=Number.MAX_VALUE;const h=Math.abs(s[0].x),d=Math.abs(s[0].y),f=Math.abs(s[0].z);h<=u&&(u=h,i.set(1,0,0)),d<=u&&(u=d,i.set(0,1,0)),f<=u&&i.set(0,0,1),l.crossVectors(s[0],i).normalize(),o[0].crossVectors(s[0],l),a[0].crossVectors(s[0],o[0]);for(let p=1;p<=e;p++){if(o[p]=o[p-1].clone(),a[p]=a[p-1].clone(),l.crossVectors(s[p-1],s[p]),l.length()>Number.EPSILON){l.normalize();const m=Math.acos(Un(s[p-1].dot(s[p]),-1,1));o[p].applyMatrix4(c.makeRotationAxis(l,m))}a[p].crossVectors(s[p],o[p])}if(n===!0){let p=Math.acos(Un(o[0].dot(o[e]),-1,1));p/=e,s[0].dot(l.crossVectors(o[0],o[e]))>0&&(p=-p);for(let m=1;m<=e;m++)o[m].applyMatrix4(c.makeRotationAxis(s[m],p*m)),a[m].crossVectors(s[m],o[m])}return{tangents:s,normals:o,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class G1 extends ds{constructor(e=0,n=0,i=1,s=1,o=0,a=Math.PI*2,l=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=n,this.xRadius=i,this.yRadius=s,this.aStartAngle=o,this.aEndAngle=a,this.aClockwise=l,this.aRotation=c}getPoint(e,n=new Pe){const i=n,s=Math.PI*2;let o=this.aEndAngle-this.aStartAngle;const a=Math.abs(o)<Number.EPSILON;for(;o<0;)o+=s;for(;o>s;)o-=s;o<Number.EPSILON&&(a?o=0:o=s),this.aClockwise===!0&&!a&&(o===s?o=-s:o=o-s);const l=this.aStartAngle+e*o;let c=this.aX+this.xRadius*Math.cos(l),u=this.aY+this.yRadius*Math.sin(l);if(this.aRotation!==0){const h=Math.cos(this.aRotation),d=Math.sin(this.aRotation),f=c-this.aX,p=u-this.aY;c=f*h-p*d+this.aX,u=f*d+p*h+this.aY}return i.set(c,u)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class qF extends G1{constructor(e,n,i,s,o,a){super(e,n,i,i,s,o,a),this.isArcCurve=!0,this.type="ArcCurve"}}function w0(){let r=0,e=0,n=0,i=0;function s(o,a,l,c){r=o,e=l,n=-3*o+3*a-2*l-c,i=2*o-2*a+l+c}return{initCatmullRom:function(o,a,l,c,u){s(a,l,u*(l-o),u*(c-a))},initNonuniformCatmullRom:function(o,a,l,c,u,h,d){let f=(a-o)/u-(l-o)/(u+h)+(l-a)/h,p=(l-a)/h-(c-a)/(h+d)+(c-l)/d;f*=h,p*=h,s(a,l,f,p)},calc:function(o){const a=o*o,l=a*o;return r+e*o+n*a+i*l}}}const Bd=new V,M0=new w0,E0=new w0,A0=new w0;class XF extends ds{constructor(e=[],n=!1,i="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=n,this.curveType=i,this.tension=s}getPoint(e,n=new V){const i=n,s=this.points,o=s.length,a=(o-(this.closed?0:1))*e;let l=Math.floor(a),c=a-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/o)+1)*o:c===0&&l===o-1&&(l=o-2,c=1);let u,h;this.closed||l>0?u=s[(l-1)%o]:(Bd.subVectors(s[0],s[1]).add(s[0]),u=Bd);const d=s[l%o],f=s[(l+1)%o];if(this.closed||l+2<o?h=s[(l+2)%o]:(Bd.subVectors(s[o-1],s[o-2]).add(s[o-1]),h=Bd),this.curveType==="centripetal"||this.curveType==="chordal"){const p=this.curveType==="chordal"?.5:.25;let m=Math.pow(u.distanceToSquared(d),p),_=Math.pow(d.distanceToSquared(f),p),y=Math.pow(f.distanceToSquared(h),p);_<1e-4&&(_=1),m<1e-4&&(m=_),y<1e-4&&(y=_),M0.initNonuniformCatmullRom(u.x,d.x,f.x,h.x,m,_,y),E0.initNonuniformCatmullRom(u.y,d.y,f.y,h.y,m,_,y),A0.initNonuniformCatmullRom(u.z,d.z,f.z,h.z,m,_,y)}else this.curveType==="catmullrom"&&(M0.initCatmullRom(u.x,d.x,f.x,h.x,this.tension),E0.initCatmullRom(u.y,d.y,f.y,h.y,this.tension),A0.initCatmullRom(u.z,d.z,f.z,h.z,this.tension));return i.set(M0.calc(c),E0.calc(c),A0.calc(c)),i}copy(e){super.copy(e),this.points=[];for(let n=0,i=e.points.length;n<i;n++){const s=e.points[n];this.points.push(s.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let n=0,i=this.points.length;n<i;n++){const s=this.points[n];e.points.push(s.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let n=0,i=e.points.length;n<i;n++){const s=e.points[n];this.points.push(new V().fromArray(s))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function V1(r,e,n,i,s){const o=(i-e)*.5,a=(s-n)*.5,l=r*r,c=r*l;return(2*n-2*i+o+a)*c+(-3*n+3*i-2*o-a)*l+o*r+n}function YF(r,e){const n=1-r;return n*n*e}function KF(r,e){return 2*(1-r)*r*e}function ZF(r,e){return r*r*e}function iu(r,e,n,i){return YF(r,e)+KF(r,n)+ZF(r,i)}function QF(r,e){const n=1-r;return n*n*n*e}function JF(r,e){const n=1-r;return 3*n*n*r*e}function eU(r,e){return 3*(1-r)*r*r*e}function tU(r,e){return r*r*r*e}function ru(r,e,n,i,s){return QF(r,e)+JF(r,n)+eU(r,i)+tU(r,s)}class nU extends ds{constructor(e=new Pe,n=new Pe,i=new Pe,s=new Pe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=n,this.v2=i,this.v3=s}getPoint(e,n=new Pe){const i=n,s=this.v0,o=this.v1,a=this.v2,l=this.v3;return i.set(ru(e,s.x,o.x,a.x,l.x),ru(e,s.y,o.y,a.y,l.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class $1 extends ds{constructor(e=new V,n=new V,i=new V,s=new V){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=n,this.v2=i,this.v3=s}getPoint(e,n=new V){const i=n,s=this.v0,o=this.v1,a=this.v2,l=this.v3;return i.set(ru(e,s.x,o.x,a.x,l.x),ru(e,s.y,o.y,a.y,l.y),ru(e,s.z,o.z,a.z,l.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class iU extends ds{constructor(e=new Pe,n=new Pe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=n}getPoint(e,n=new Pe){const i=n;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,n){return this.getPoint(e,n)}getTangent(e,n=new Pe){return n.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,n){return this.getTangent(e,n)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class rU extends ds{constructor(e=new V,n=new V){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=n}getPoint(e,n=new V){const i=n;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,n){return this.getPoint(e,n)}getTangent(e,n=new V){return n.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,n){return this.getTangent(e,n)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class sU extends ds{constructor(e=new Pe,n=new Pe,i=new Pe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=n,this.v2=i}getPoint(e,n=new Pe){const i=n,s=this.v0,o=this.v1,a=this.v2;return i.set(iu(e,s.x,o.x,a.x),iu(e,s.y,o.y,a.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class C0 extends ds{constructor(e=new V,n=new V,i=new V){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=n,this.v2=i}getPoint(e,n=new V){const i=n,s=this.v0,o=this.v1,a=this.v2;return i.set(iu(e,s.x,o.x,a.x),iu(e,s.y,o.y,a.y),iu(e,s.z,o.z,a.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class oU extends ds{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,n=new Pe){const i=n,s=this.points,o=(s.length-1)*e,a=Math.floor(o),l=o-a,c=s[a===0?a:a-1],u=s[a],h=s[a>s.length-2?s.length-1:a+1],d=s[a>s.length-3?s.length-1:a+2];return i.set(V1(l,c.x,u.x,h.x,d.x),V1(l,c.y,u.y,h.y,d.y)),i}copy(e){super.copy(e),this.points=[];for(let n=0,i=e.points.length;n<i;n++){const s=e.points[n];this.points.push(s.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let n=0,i=this.points.length;n<i;n++){const s=this.points[n];e.points.push(s.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let n=0,i=e.points.length;n<i;n++){const s=e.points[n];this.points.push(new Pe().fromArray(s))}return this}}var aU=Object.freeze({__proto__:null,ArcCurve:qF,CatmullRomCurve3:XF,CubicBezierCurve:nU,CubicBezierCurve3:$1,EllipseCurve:G1,LineCurve:iU,LineCurve3:rU,QuadraticBezierCurve:sU,QuadraticBezierCurve3:C0,SplineCurve:oU});class R0 extends Di{constructor(e=1,n=32,i=0,s=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:n,thetaStart:i,thetaLength:s},n=Math.max(3,n);const o=[],a=[],l=[],c=[],u=new V,h=new Pe;a.push(0,0,0),l.push(0,0,1),c.push(.5,.5);for(let d=0,f=3;d<=n;d++,f+=3){const p=i+d/n*s;u.x=e*Math.cos(p),u.y=e*Math.sin(p),a.push(u.x,u.y,u.z),l.push(0,0,1),h.x=(a[f]/e+1)/2,h.y=(a[f+1]/e+1)/2,c.push(h.x,h.y)}for(let d=1;d<=n;d++)o.push(d,d+1,0);this.setIndex(o),this.setAttribute("position",new yn(a,3)),this.setAttribute("normal",new yn(l,3)),this.setAttribute("uv",new yn(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new R0(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class kd extends Di{constructor(e=1,n=1,i=1,s=32,o=1,a=!1,l=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:n,height:i,radialSegments:s,heightSegments:o,openEnded:a,thetaStart:l,thetaLength:c};const u=this;s=Math.floor(s),o=Math.floor(o);const h=[],d=[],f=[],p=[];let m=0;const _=[],y=i/2;let g=0;x(),a===!1&&(e>0&&b(!0),n>0&&b(!1)),this.setIndex(h),this.setAttribute("position",new yn(d,3)),this.setAttribute("normal",new yn(f,3)),this.setAttribute("uv",new yn(p,2));function x(){const v=new V,T=new V;let w=0;const E=(n-e)/i;for(let A=0;A<=o;A++){const M=[],S=A/o,R=S*(n-e)+e;for(let O=0;O<=s;O++){const P=O/s,C=P*c+l,I=Math.sin(C),L=Math.cos(C);T.x=R*I,T.y=-S*i+y,T.z=R*L,d.push(T.x,T.y,T.z),v.set(I,E,L).normalize(),f.push(v.x,v.y,v.z),p.push(P,1-S),M.push(m++)}_.push(M)}for(let A=0;A<s;A++)for(let M=0;M<o;M++){const S=_[M][A],R=_[M+1][A],O=_[M+1][A+1],P=_[M][A+1];(e>0||M!==0)&&(h.push(S,R,P),w+=3),(n>0||M!==o-1)&&(h.push(R,O,P),w+=3)}u.addGroup(g,w,0),g+=w}function b(v){const T=m,w=new Pe,E=new V;let A=0;const M=v===!0?e:n,S=v===!0?1:-1;for(let O=1;O<=s;O++)d.push(0,y*S,0),f.push(0,S,0),p.push(.5,.5),m++;const R=m;for(let O=0;O<=s;O++){const C=O/s*c+l,I=Math.cos(C),L=Math.sin(C);E.x=M*L,E.y=y*S,E.z=M*I,d.push(E.x,E.y,E.z),f.push(0,S,0),w.x=I*.5+.5,w.y=L*.5*S+.5,p.push(w.x,w.y),m++}for(let O=0;O<s;O++){const P=T+O,C=R+O;v===!0?h.push(C,C+1,P):h.push(C+1,C,P),A+=3}u.addGroup(g,A,v===!0?1:2),g+=A}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new kd(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class N0 extends kd{constructor(e=1,n=1,i=32,s=1,o=!1,a=0,l=Math.PI*2){super(0,e,n,i,s,o,a,l),this.type="ConeGeometry",this.parameters={radius:e,height:n,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l}}static fromJSON(e){return new N0(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}let j1=class xN extends Di{constructor(e=1,n=32,i=16,s=0,o=Math.PI*2,a=0,l=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:n,heightSegments:i,phiStart:s,phiLength:o,thetaStart:a,thetaLength:l},n=Math.max(3,Math.floor(n)),i=Math.max(2,Math.floor(i));const c=Math.min(a+l,Math.PI);let u=0;const h=[],d=new V,f=new V,p=[],m=[],_=[],y=[];for(let g=0;g<=i;g++){const x=[],b=g/i;let v=0;g===0&&a===0?v=.5/n:g===i&&c===Math.PI&&(v=-.5/n);for(let T=0;T<=n;T++){const w=T/n;d.x=-e*Math.cos(s+w*o)*Math.sin(a+b*l),d.y=e*Math.cos(a+b*l),d.z=e*Math.sin(s+w*o)*Math.sin(a+b*l),m.push(d.x,d.y,d.z),f.copy(d).normalize(),_.push(f.x,f.y,f.z),y.push(w+v,1-b),x.push(u++)}h.push(x)}for(let g=0;g<i;g++)for(let x=0;x<n;x++){const b=h[g][x+1],v=h[g][x],T=h[g+1][x],w=h[g+1][x+1];(g!==0||a>0)&&p.push(b,v,w),(g!==i-1||c<Math.PI)&&p.push(v,T,w)}this.setIndex(p),this.setAttribute("position",new yn(m,3)),this.setAttribute("normal",new yn(_,3)),this.setAttribute("uv",new yn(y,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new xN(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};class P0 extends Di{constructor(e=new C0(new V(-1,-1,0),new V(-1,1,0),new V(1,1,0)),n=64,i=1,s=8,o=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:n,radius:i,radialSegments:s,closed:o};const a=e.computeFrenetFrames(n,o);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const l=new V,c=new V,u=new Pe;let h=new V;const d=[],f=[],p=[],m=[];_(),this.setIndex(m),this.setAttribute("position",new yn(d,3)),this.setAttribute("normal",new yn(f,3)),this.setAttribute("uv",new yn(p,2));function _(){for(let b=0;b<n;b++)y(b);y(o===!1?n:0),x(),g()}function y(b){h=e.getPointAt(b/n,h);const v=a.normals[b],T=a.binormals[b];for(let w=0;w<=s;w++){const E=w/s*Math.PI*2,A=Math.sin(E),M=-Math.cos(E);c.x=M*v.x+A*T.x,c.y=M*v.y+A*T.y,c.z=M*v.z+A*T.z,c.normalize(),f.push(c.x,c.y,c.z),l.x=h.x+i*c.x,l.y=h.y+i*c.y,l.z=h.z+i*c.z,d.push(l.x,l.y,l.z)}}function g(){for(let b=1;b<=n;b++)for(let v=1;v<=s;v++){const T=(s+1)*(b-1)+(v-1),w=(s+1)*b+(v-1),E=(s+1)*b+v,A=(s+1)*(b-1)+v;m.push(T,w,A),m.push(w,E,A)}}function x(){for(let b=0;b<=n;b++)for(let v=0;v<=s;v++)u.x=b/n,u.y=v/s,p.push(u.x,u.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new P0(new aU[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}let lU=class extends ia{static get type(){return"MeshLambertMaterial"}constructor(e){super(),this.isMeshLambertMaterial=!0,this.color=new Et(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Et(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bS,this.normalScale=new Pe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new so,this.combine=ng,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};const H1={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class cU{constructor(e,n,i){const s=this;let o=!1,a=0,l=0,c;const u=[];this.onStart=void 0,this.onLoad=e,this.onProgress=n,this.onError=i,this.itemStart=function(h){l++,o===!1&&s.onStart!==void 0&&s.onStart(h,a,l),o=!0},this.itemEnd=function(h){a++,s.onProgress!==void 0&&s.onProgress(h,a,l),a===l&&(o=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(h){s.onError!==void 0&&s.onError(h)},this.resolveURL=function(h){return c?c(h):h},this.setURLModifier=function(h){return c=h,this},this.addHandler=function(h,d){return u.push(h,d),this},this.removeHandler=function(h){const d=u.indexOf(h);return d!==-1&&u.splice(d,2),this},this.getHandler=function(h){for(let d=0,f=u.length;d<f;d+=2){const p=u[d],m=u[d+1];if(p.global&&(p.lastIndex=0),p.test(h))return m}return null}}}const uU=new cU;class D0{constructor(e){this.manager=e!==void 0?e:uU,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,n){const i=this;return new Promise(function(s,o){i.load(e,s,n,o)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}D0.DEFAULT_MATERIAL_NAME="__DEFAULT";class hU extends D0{constructor(e){super(e)}load(e,n,i,s){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,a=H1.get(e);if(a!==void 0)return o.manager.itemStart(e),setTimeout(function(){n&&n(a),o.manager.itemEnd(e)},0),a;const l=Hc("img");function c(){h(),H1.add(e,this),n&&n(this),o.manager.itemEnd(e)}function u(d){h(),s&&s(d),o.manager.itemError(e),o.manager.itemEnd(e)}function h(){l.removeEventListener("load",c,!1),l.removeEventListener("error",u,!1)}return l.addEventListener("load",c,!1),l.addEventListener("error",u,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(l.crossOrigin=this.crossOrigin),o.manager.itemStart(e),l.src=e,l}}class dU extends D0{constructor(e){super(e)}load(e,n,i,s){const o=new Ri,a=new hU(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(l){o.image=l,o.needsUpdate=!0,n!==void 0&&n(o)},i,s),o}}let W1=class extends gi{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new Et(e),this.intensity=n}dispose(){}copy(e,n){return super.copy(e,n),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const n=super.toJSON(e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,this.groundColor!==void 0&&(n.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(n.object.distance=this.distance),this.angle!==void 0&&(n.object.angle=this.angle),this.decay!==void 0&&(n.object.decay=this.decay),this.penumbra!==void 0&&(n.object.penumbra=this.penumbra),this.shadow!==void 0&&(n.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(n.object.target=this.target.uuid),n}};const I0=new tn,q1=new V,X1=new V;let fU=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Pe(512,512),this.map=null,this.mapPass=null,this.matrix=new tn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new h0,this._frameExtents=new Pe(1,1),this._viewportCount=1,this._viewports=[new Sn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,i=this.matrix;q1.setFromMatrixPosition(e.matrixWorld),n.position.copy(q1),X1.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(X1),n.updateMatrixWorld(),I0.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(I0),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(I0)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},pU=class extends fU{constructor(){super(new d0(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},mU=class extends W1{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(gi.DEFAULT_UP),this.updateMatrix(),this.target=new gi,this.shadow=new pU}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},gU=class extends W1{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}};class Y1{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=K1(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const n=K1();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function K1(){return performance.now()}const Z1=new tn;class Q1{constructor(e,n,i=0,s=1/0){this.ray=new dd(e,n),this.near=i,this.far=s,this.camera=null,this.layers=new Zg,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,n){this.ray.set(e,n)}setFromCamera(e,n){n.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(n.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(n).sub(this.ray.origin).normalize(),this.camera=n):n.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(n.near+n.far)/(n.near-n.far)).unproject(n),this.ray.direction.set(0,0,-1).transformDirection(n.matrixWorld),this.camera=n):console.error("THREE.Raycaster: Unsupported camera type: "+n.type)}setFromXRController(e){return Z1.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Z1),this}intersectObject(e,n=!0,i=[]){return L0(e,this,i,n),i.sort(J1),i}intersectObjects(e,n=!0,i=[]){for(let s=0,o=e.length;s<o;s++)L0(e[s],this,i,n);return i.sort(J1),i}}function J1(r,e){return r.distance-e.distance}function L0(r,e,n,i){let s=!0;if(r.layers.test(e.layers)&&r.raycast(e,n)===!1&&(s=!1),s===!0&&i===!0){const o=r.children;for(let a=0,l=o.length;a<l;a++)L0(o[a],e,n,!0)}}class eT{constructor(e=1,n=0,i=0){return this.radius=e,this.phi=n,this.theta=i,this}set(e,n,i){return this.radius=e,this.phi=n,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,i){return this.radius=Math.sqrt(e*e+n*n+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(Un(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class zd extends Jo{constructor(e,n=null){super(),this.object=e,this.domElement=n,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Kh}})),typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Kh);function tT(r,e,n){var i,s=1;r==null&&(r=0),e==null&&(e=0),n==null&&(n=0);function o(){var a,l=i.length,c,u=0,h=0,d=0;for(a=0;a<l;++a)c=i[a],u+=c.x||0,h+=c.y||0,d+=c.z||0;for(u=(u/l-r)*s,h=(h/l-e)*s,d=(d/l-n)*s,a=0;a<l;++a)c=i[a],u&&(c.x-=u),h&&(c.y-=h),d&&(c.z-=d)}return o.initialize=function(a){i=a},o.x=function(a){return arguments.length?(r=+a,o):r},o.y=function(a){return arguments.length?(e=+a,o):e},o.z=function(a){return arguments.length?(n=+a,o):n},o.strength=function(a){return arguments.length?(s=+a,o):s},o}function yU(r){const e=+this._x.call(null,r);return nT(this.cover(e),e,r)}function nT(r,e,n){if(isNaN(e))return r;var i,s=r._root,o={data:n},a=r._x0,l=r._x1,c,u,h,d,f;if(!s)return r._root=o,r;for(;s.length;)if((h=e>=(c=(a+l)/2))?a=c:l=c,i=s,!(s=s[d=+h]))return i[d]=o,r;if(u=+r._x.call(null,s.data),e===u)return o.next=s,i?i[d]=o:r._root=o,r;do i=i?i[d]=new Array(2):r._root=new Array(2),(h=e>=(c=(a+l)/2))?a=c:l=c;while((d=+h)==(f=+(u>=c)));return i[f]=s,i[d]=o,r}function _U(r){Array.isArray(r)||(r=Array.from(r));const e=r.length,n=new Float64Array(e);let i=1/0,s=-1/0;for(let o=0,a;o<e;++o)isNaN(a=+this._x.call(null,r[o]))||(n[o]=a,a<i&&(i=a),a>s&&(s=a));if(i>s)return this;this.cover(i).cover(s);for(let o=0;o<e;++o)nT(this,n[o],r[o]);return this}function vU(r){if(isNaN(r=+r))return this;var e=this._x0,n=this._x1;if(isNaN(e))n=(e=Math.floor(r))+1;else{for(var i=n-e||1,s=this._root,o,a;e>r||r>=n;)switch(a=+(r<e),o=new Array(2),o[a]=s,s=o,i*=2,a){case 0:n=e+i;break;case 1:e=n-i;break}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._x1=n,this}function xU(){var r=[];return this.visit(function(e){if(!e.length)do r.push(e.data);while(e=e.next)}),r}function bU(r){return arguments.length?this.cover(+r[0][0]).cover(+r[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function fs(r,e,n){this.node=r,this.x0=e,this.x1=n}function SU(r,e){var n,i=this._x0,s,o,a=this._x1,l=[],c=this._root,u,h;for(c&&l.push(new fs(c,i,a)),e==null?e=1/0:(i=r-e,a=r+e);u=l.pop();)if(!(!(c=u.node)||(s=u.x0)>a||(o=u.x1)<i))if(c.length){var d=(s+o)/2;l.push(new fs(c[1],d,o),new fs(c[0],s,d)),(h=+(r>=d))&&(u=l[l.length-1],l[l.length-1]=l[l.length-1-h],l[l.length-1-h]=u)}else{var f=Math.abs(r-+this._x.call(null,c.data));f<e&&(e=f,i=r-f,a=r+f,n=c.data)}return n}function TU(r){if(isNaN(c=+this._x.call(null,r)))return this;var e,n=this._root,i,s,o,a=this._x0,l=this._x1,c,u,h,d,f;if(!n)return this;if(n.length)for(;;){if((h=c>=(u=(a+l)/2))?a=u:l=u,e=n,!(n=n[d=+h]))return this;if(!n.length)break;e[d+1&1]&&(i=e,f=d)}for(;n.data!==r;)if(s=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,s?(o?s.next=o:delete s.next,this):e?(o?e[d]=o:delete e[d],(n=e[0]||e[1])&&n===(e[1]||e[0])&&!n.length&&(i?i[f]=n:this._root=n),this):(this._root=o,this)}function wU(r){for(var e=0,n=r.length;e<n;++e)this.remove(r[e]);return this}function MU(){return this._root}function EU(){var r=0;return this.visit(function(e){if(!e.length)do++r;while(e=e.next)}),r}function AU(r){var e=[],n,i=this._root,s,o,a;for(i&&e.push(new fs(i,this._x0,this._x1));n=e.pop();)if(!r(i=n.node,o=n.x0,a=n.x1)&&i.length){var l=(o+a)/2;(s=i[1])&&e.push(new fs(s,l,a)),(s=i[0])&&e.push(new fs(s,o,l))}return this}function CU(r){var e=[],n=[],i;for(this._root&&e.push(new fs(this._root,this._x0,this._x1));i=e.pop();){var s=i.node;if(s.length){var o,a=i.x0,l=i.x1,c=(a+l)/2;(o=s[0])&&e.push(new fs(o,a,c)),(o=s[1])&&e.push(new fs(o,c,l))}n.push(i)}for(;i=n.pop();)r(i.node,i.x0,i.x1);return this}function RU(r){return r[0]}function NU(r){return arguments.length?(this._x=r,this):this._x}function iT(r,e){var n=new O0(e??RU,NaN,NaN);return r==null?n:n.addAll(r)}function O0(r,e,n){this._x=r,this._x0=e,this._x1=n,this._root=void 0}function rT(r){for(var e={data:r.data},n=e;r=r.next;)n=n.next={data:r.data};return e}var _i=iT.prototype=O0.prototype;_i.copy=function(){var r=new O0(this._x,this._x0,this._x1),e=this._root,n,i;if(!e)return r;if(!e.length)return r._root=rT(e),r;for(n=[{source:e,target:r._root=new Array(2)}];e=n.pop();)for(var s=0;s<2;++s)(i=e.source[s])&&(i.length?n.push({source:i,target:e.target[s]=new Array(2)}):e.target[s]=rT(i));return r},_i.add=yU,_i.addAll=_U,_i.cover=vU,_i.data=xU,_i.extent=bU,_i.find=SU,_i.remove=TU,_i.removeAll=wU,_i.root=MU,_i.size=EU,_i.visit=AU,_i.visitAfter=CU,_i.x=NU;function PU(r){const e=+this._x.call(null,r),n=+this._y.call(null,r);return sT(this.cover(e,n),e,n,r)}function sT(r,e,n,i){if(isNaN(e)||isNaN(n))return r;var s,o=r._root,a={data:i},l=r._x0,c=r._y0,u=r._x1,h=r._y1,d,f,p,m,_,y,g,x;if(!o)return r._root=a,r;for(;o.length;)if((_=e>=(d=(l+u)/2))?l=d:u=d,(y=n>=(f=(c+h)/2))?c=f:h=f,s=o,!(o=o[g=y<<1|_]))return s[g]=a,r;if(p=+r._x.call(null,o.data),m=+r._y.call(null,o.data),e===p&&n===m)return a.next=o,s?s[g]=a:r._root=a,r;do s=s?s[g]=new Array(4):r._root=new Array(4),(_=e>=(d=(l+u)/2))?l=d:u=d,(y=n>=(f=(c+h)/2))?c=f:h=f;while((g=y<<1|_)===(x=(m>=f)<<1|p>=d));return s[x]=o,s[g]=a,r}function DU(r){var e,n,i=r.length,s,o,a=new Array(i),l=new Array(i),c=1/0,u=1/0,h=-1/0,d=-1/0;for(n=0;n<i;++n)isNaN(s=+this._x.call(null,e=r[n]))||isNaN(o=+this._y.call(null,e))||(a[n]=s,l[n]=o,s<c&&(c=s),s>h&&(h=s),o<u&&(u=o),o>d&&(d=o));if(c>h||u>d)return this;for(this.cover(c,u).cover(h,d),n=0;n<i;++n)sT(this,a[n],l[n],r[n]);return this}function IU(r,e){if(isNaN(r=+r)||isNaN(e=+e))return this;var n=this._x0,i=this._y0,s=this._x1,o=this._y1;if(isNaN(n))s=(n=Math.floor(r))+1,o=(i=Math.floor(e))+1;else{for(var a=s-n||1,l=this._root,c,u;n>r||r>=s||i>e||e>=o;)switch(u=(e<i)<<1|r<n,c=new Array(4),c[u]=l,l=c,a*=2,u){case 0:s=n+a,o=i+a;break;case 1:n=s-a,o=i+a;break;case 2:s=n+a,i=o-a;break;case 3:n=s-a,i=o-a;break}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=i,this._x1=s,this._y1=o,this}function LU(){var r=[];return this.visit(function(e){if(!e.length)do r.push(e.data);while(e=e.next)}),r}function OU(r){return arguments.length?this.cover(+r[0][0],+r[0][1]).cover(+r[1][0],+r[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function ai(r,e,n,i,s){this.node=r,this.x0=e,this.y0=n,this.x1=i,this.y1=s}function FU(r,e,n){var i,s=this._x0,o=this._y0,a,l,c,u,h=this._x1,d=this._y1,f=[],p=this._root,m,_;for(p&&f.push(new ai(p,s,o,h,d)),n==null?n=1/0:(s=r-n,o=e-n,h=r+n,d=e+n,n*=n);m=f.pop();)if(!(!(p=m.node)||(a=m.x0)>h||(l=m.y0)>d||(c=m.x1)<s||(u=m.y1)<o))if(p.length){var y=(a+c)/2,g=(l+u)/2;f.push(new ai(p[3],y,g,c,u),new ai(p[2],a,g,y,u),new ai(p[1],y,l,c,g),new ai(p[0],a,l,y,g)),(_=(e>=g)<<1|r>=y)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-_],f[f.length-1-_]=m)}else{var x=r-+this._x.call(null,p.data),b=e-+this._y.call(null,p.data),v=x*x+b*b;if(v<n){var T=Math.sqrt(n=v);s=r-T,o=e-T,h=r+T,d=e+T,i=p.data}}return i}function UU(r){if(isNaN(h=+this._x.call(null,r))||isNaN(d=+this._y.call(null,r)))return this;var e,n=this._root,i,s,o,a=this._x0,l=this._y0,c=this._x1,u=this._y1,h,d,f,p,m,_,y,g;if(!n)return this;if(n.length)for(;;){if((m=h>=(f=(a+c)/2))?a=f:c=f,(_=d>=(p=(l+u)/2))?l=p:u=p,e=n,!(n=n[y=_<<1|m]))return this;if(!n.length)break;(e[y+1&3]||e[y+2&3]||e[y+3&3])&&(i=e,g=y)}for(;n.data!==r;)if(s=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,s?(o?s.next=o:delete s.next,this):e?(o?e[y]=o:delete e[y],(n=e[0]||e[1]||e[2]||e[3])&&n===(e[3]||e[2]||e[1]||e[0])&&!n.length&&(i?i[g]=n:this._root=n),this):(this._root=o,this)}function BU(r){for(var e=0,n=r.length;e<n;++e)this.remove(r[e]);return this}function kU(){return this._root}function zU(){var r=0;return this.visit(function(e){if(!e.length)do++r;while(e=e.next)}),r}function GU(r){var e=[],n,i=this._root,s,o,a,l,c;for(i&&e.push(new ai(i,this._x0,this._y0,this._x1,this._y1));n=e.pop();)if(!r(i=n.node,o=n.x0,a=n.y0,l=n.x1,c=n.y1)&&i.length){var u=(o+l)/2,h=(a+c)/2;(s=i[3])&&e.push(new ai(s,u,h,l,c)),(s=i[2])&&e.push(new ai(s,o,h,u,c)),(s=i[1])&&e.push(new ai(s,u,a,l,h)),(s=i[0])&&e.push(new ai(s,o,a,u,h))}return this}function VU(r){var e=[],n=[],i;for(this._root&&e.push(new ai(this._root,this._x0,this._y0,this._x1,this._y1));i=e.pop();){var s=i.node;if(s.length){var o,a=i.x0,l=i.y0,c=i.x1,u=i.y1,h=(a+c)/2,d=(l+u)/2;(o=s[0])&&e.push(new ai(o,a,l,h,d)),(o=s[1])&&e.push(new ai(o,h,l,c,d)),(o=s[2])&&e.push(new ai(o,a,d,h,u)),(o=s[3])&&e.push(new ai(o,h,d,c,u))}n.push(i)}for(;i=n.pop();)r(i.node,i.x0,i.y0,i.x1,i.y1);return this}function $U(r){return r[0]}function jU(r){return arguments.length?(this._x=r,this):this._x}function HU(r){return r[1]}function WU(r){return arguments.length?(this._y=r,this):this._y}function oT(r,e,n){var i=new F0(e??$U,n??HU,NaN,NaN,NaN,NaN);return r==null?i:i.addAll(r)}function F0(r,e,n,i,s,o){this._x=r,this._y=e,this._x0=n,this._y0=i,this._x1=s,this._y1=o,this._root=void 0}function aT(r){for(var e={data:r.data},n=e;r=r.next;)n=n.next={data:r.data};return e}var li=oT.prototype=F0.prototype;li.copy=function(){var r=new F0(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,n,i;if(!e)return r;if(!e.length)return r._root=aT(e),r;for(n=[{source:e,target:r._root=new Array(4)}];e=n.pop();)for(var s=0;s<4;++s)(i=e.source[s])&&(i.length?n.push({source:i,target:e.target[s]=new Array(4)}):e.target[s]=aT(i));return r},li.add=PU,li.addAll=DU,li.cover=IU,li.data=LU,li.extent=OU,li.find=FU,li.remove=UU,li.removeAll=BU,li.root=kU,li.size=zU,li.visit=GU,li.visitAfter=VU,li.x=jU,li.y=WU;function qU(r){const e=+this._x.call(null,r),n=+this._y.call(null,r),i=+this._z.call(null,r);return lT(this.cover(e,n,i),e,n,i,r)}function lT(r,e,n,i,s){if(isNaN(e)||isNaN(n)||isNaN(i))return r;var o,a=r._root,l={data:s},c=r._x0,u=r._y0,h=r._z0,d=r._x1,f=r._y1,p=r._z1,m,_,y,g,x,b,v,T,w,E,A;if(!a)return r._root=l,r;for(;a.length;)if((v=e>=(m=(c+d)/2))?c=m:d=m,(T=n>=(_=(u+f)/2))?u=_:f=_,(w=i>=(y=(h+p)/2))?h=y:p=y,o=a,!(a=a[E=w<<2|T<<1|v]))return o[E]=l,r;if(g=+r._x.call(null,a.data),x=+r._y.call(null,a.data),b=+r._z.call(null,a.data),e===g&&n===x&&i===b)return l.next=a,o?o[E]=l:r._root=l,r;do o=o?o[E]=new Array(8):r._root=new Array(8),(v=e>=(m=(c+d)/2))?c=m:d=m,(T=n>=(_=(u+f)/2))?u=_:f=_,(w=i>=(y=(h+p)/2))?h=y:p=y;while((E=w<<2|T<<1|v)===(A=(b>=y)<<2|(x>=_)<<1|g>=m));return o[A]=a,o[E]=l,r}function XU(r){Array.isArray(r)||(r=Array.from(r));const e=r.length,n=new Float64Array(e),i=new Float64Array(e),s=new Float64Array(e);let o=1/0,a=1/0,l=1/0,c=-1/0,u=-1/0,h=-1/0;for(let d=0,f,p,m,_;d<e;++d)isNaN(p=+this._x.call(null,f=r[d]))||isNaN(m=+this._y.call(null,f))||isNaN(_=+this._z.call(null,f))||(n[d]=p,i[d]=m,s[d]=_,p<o&&(o=p),p>c&&(c=p),m<a&&(a=m),m>u&&(u=m),_<l&&(l=_),_>h&&(h=_));if(o>c||a>u||l>h)return this;this.cover(o,a,l).cover(c,u,h);for(let d=0;d<e;++d)lT(this,n[d],i[d],s[d],r[d]);return this}function YU(r,e,n){if(isNaN(r=+r)||isNaN(e=+e)||isNaN(n=+n))return this;var i=this._x0,s=this._y0,o=this._z0,a=this._x1,l=this._y1,c=this._z1;if(isNaN(i))a=(i=Math.floor(r))+1,l=(s=Math.floor(e))+1,c=(o=Math.floor(n))+1;else{for(var u=a-i||1,h=this._root,d,f;i>r||r>=a||s>e||e>=l||o>n||n>=c;)switch(f=(n<o)<<2|(e<s)<<1|r<i,d=new Array(8),d[f]=h,h=d,u*=2,f){case 0:a=i+u,l=s+u,c=o+u;break;case 1:i=a-u,l=s+u,c=o+u;break;case 2:a=i+u,s=l-u,c=o+u;break;case 3:i=a-u,s=l-u,c=o+u;break;case 4:a=i+u,l=s+u,o=c-u;break;case 5:i=a-u,l=s+u,o=c-u;break;case 6:a=i+u,s=l-u,o=c-u;break;case 7:i=a-u,s=l-u,o=c-u;break}this._root&&this._root.length&&(this._root=h)}return this._x0=i,this._y0=s,this._z0=o,this._x1=a,this._y1=l,this._z1=c,this}function KU(){var r=[];return this.visit(function(e){if(!e.length)do r.push(e.data);while(e=e.next)}),r}function ZU(r){return arguments.length?this.cover(+r[0][0],+r[0][1],+r[0][2]).cover(+r[1][0],+r[1][1],+r[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function Qt(r,e,n,i,s,o,a){this.node=r,this.x0=e,this.y0=n,this.z0=i,this.x1=s,this.y1=o,this.z1=a}function QU(r,e,n,i){var s,o=this._x0,a=this._y0,l=this._z0,c,u,h,d,f,p,m=this._x1,_=this._y1,y=this._z1,g=[],x=this._root,b,v;for(x&&g.push(new Qt(x,o,a,l,m,_,y)),i==null?i=1/0:(o=r-i,a=e-i,l=n-i,m=r+i,_=e+i,y=n+i,i*=i);b=g.pop();)if(!(!(x=b.node)||(c=b.x0)>m||(u=b.y0)>_||(h=b.z0)>y||(d=b.x1)<o||(f=b.y1)<a||(p=b.z1)<l))if(x.length){var T=(c+d)/2,w=(u+f)/2,E=(h+p)/2;g.push(new Qt(x[7],T,w,E,d,f,p),new Qt(x[6],c,w,E,T,f,p),new Qt(x[5],T,u,E,d,w,p),new Qt(x[4],c,u,E,T,w,p),new Qt(x[3],T,w,h,d,f,E),new Qt(x[2],c,w,h,T,f,E),new Qt(x[1],T,u,h,d,w,E),new Qt(x[0],c,u,h,T,w,E)),(v=(n>=E)<<2|(e>=w)<<1|r>=T)&&(b=g[g.length-1],g[g.length-1]=g[g.length-1-v],g[g.length-1-v]=b)}else{var A=r-+this._x.call(null,x.data),M=e-+this._y.call(null,x.data),S=n-+this._z.call(null,x.data),R=A*A+M*M+S*S;if(R<i){var O=Math.sqrt(i=R);o=r-O,a=e-O,l=n-O,m=r+O,_=e+O,y=n+O,s=x.data}}return s}const JU=(r,e,n,i,s,o)=>Math.sqrt((r-i)**2+(e-s)**2+(n-o)**2);function eB(r,e,n,i){const s=[],o=r-i,a=e-i,l=n-i,c=r+i,u=e+i,h=n+i;return this.visit((d,f,p,m,_,y,g)=>{if(!d.length)do{const x=d.data;JU(r,e,n,this._x(x),this._y(x),this._z(x))<=i&&s.push(x)}while(d=d.next);return f>c||p>u||m>h||_<o||y<a||g<l}),s}function tB(r){if(isNaN(f=+this._x.call(null,r))||isNaN(p=+this._y.call(null,r))||isNaN(m=+this._z.call(null,r)))return this;var e,n=this._root,i,s,o,a=this._x0,l=this._y0,c=this._z0,u=this._x1,h=this._y1,d=this._z1,f,p,m,_,y,g,x,b,v,T,w;if(!n)return this;if(n.length)for(;;){if((x=f>=(_=(a+u)/2))?a=_:u=_,(b=p>=(y=(l+h)/2))?l=y:h=y,(v=m>=(g=(c+d)/2))?c=g:d=g,e=n,!(n=n[T=v<<2|b<<1|x]))return this;if(!n.length)break;(e[T+1&7]||e[T+2&7]||e[T+3&7]||e[T+4&7]||e[T+5&7]||e[T+6&7]||e[T+7&7])&&(i=e,w=T)}for(;n.data!==r;)if(s=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,s?(o?s.next=o:delete s.next,this):e?(o?e[T]=o:delete e[T],(n=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&n===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!n.length&&(i?i[w]=n:this._root=n),this):(this._root=o,this)}function nB(r){for(var e=0,n=r.length;e<n;++e)this.remove(r[e]);return this}function iB(){return this._root}function rB(){var r=0;return this.visit(function(e){if(!e.length)do++r;while(e=e.next)}),r}function sB(r){var e=[],n,i=this._root,s,o,a,l,c,u,h;for(i&&e.push(new Qt(i,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=e.pop();)if(!r(i=n.node,o=n.x0,a=n.y0,l=n.z0,c=n.x1,u=n.y1,h=n.z1)&&i.length){var d=(o+c)/2,f=(a+u)/2,p=(l+h)/2;(s=i[7])&&e.push(new Qt(s,d,f,p,c,u,h)),(s=i[6])&&e.push(new Qt(s,o,f,p,d,u,h)),(s=i[5])&&e.push(new Qt(s,d,a,p,c,f,h)),(s=i[4])&&e.push(new Qt(s,o,a,p,d,f,h)),(s=i[3])&&e.push(new Qt(s,d,f,l,c,u,p)),(s=i[2])&&e.push(new Qt(s,o,f,l,d,u,p)),(s=i[1])&&e.push(new Qt(s,d,a,l,c,f,p)),(s=i[0])&&e.push(new Qt(s,o,a,l,d,f,p))}return this}function oB(r){var e=[],n=[],i;for(this._root&&e.push(new Qt(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));i=e.pop();){var s=i.node;if(s.length){var o,a=i.x0,l=i.y0,c=i.z0,u=i.x1,h=i.y1,d=i.z1,f=(a+u)/2,p=(l+h)/2,m=(c+d)/2;(o=s[0])&&e.push(new Qt(o,a,l,c,f,p,m)),(o=s[1])&&e.push(new Qt(o,f,l,c,u,p,m)),(o=s[2])&&e.push(new Qt(o,a,p,c,f,h,m)),(o=s[3])&&e.push(new Qt(o,f,p,c,u,h,m)),(o=s[4])&&e.push(new Qt(o,a,l,m,f,p,d)),(o=s[5])&&e.push(new Qt(o,f,l,m,u,p,d)),(o=s[6])&&e.push(new Qt(o,a,p,m,f,h,d)),(o=s[7])&&e.push(new Qt(o,f,p,m,u,h,d))}n.push(i)}for(;i=n.pop();)r(i.node,i.x0,i.y0,i.z0,i.x1,i.y1,i.z1);return this}function aB(r){return r[0]}function lB(r){return arguments.length?(this._x=r,this):this._x}function cB(r){return r[1]}function uB(r){return arguments.length?(this._y=r,this):this._y}function hB(r){return r[2]}function dB(r){return arguments.length?(this._z=r,this):this._z}function cT(r,e,n,i){var s=new U0(e??aB,n??cB,i??hB,NaN,NaN,NaN,NaN,NaN,NaN);return r==null?s:s.addAll(r)}function U0(r,e,n,i,s,o,a,l,c){this._x=r,this._y=e,this._z=n,this._x0=i,this._y0=s,this._z0=o,this._x1=a,this._y1=l,this._z1=c,this._root=void 0}function uT(r){for(var e={data:r.data},n=e;r=r.next;)n=n.next={data:r.data};return e}var Vn=cT.prototype=U0.prototype;Vn.copy=function(){var r=new U0(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,n,i;if(!e)return r;if(!e.length)return r._root=uT(e),r;for(n=[{source:e,target:r._root=new Array(8)}];e=n.pop();)for(var s=0;s<8;++s)(i=e.source[s])&&(i.length?n.push({source:i,target:e.target[s]=new Array(8)}):e.target[s]=uT(i));return r},Vn.add=qU,Vn.addAll=XU,Vn.cover=YU,Vn.data=KU,Vn.extent=ZU,Vn.find=QU,Vn.findAllWithinRadius=eB,Vn.remove=tB,Vn.removeAll=nB,Vn.root=iB,Vn.size=rB,Vn.visit=sB,Vn.visitAfter=oB,Vn.x=lB,Vn.y=uB,Vn.z=dB;function ps(r){return function(){return r}}function ms(r){return(r()-.5)*1e-6}function fB(r){return r.index}function hT(r,e){var n=r.get(e);if(!n)throw new Error("node not found: "+e);return n}function dT(r){var e=fB,n=f,i,s=ps(30),o,a,l,c,u,h,d=1;r==null&&(r=[]);function f(g){return 1/Math.min(c[g.source.index],c[g.target.index])}function p(g){for(var x=0,b=r.length;x<d;++x)for(var v=0,T,w,E,A=0,M=0,S=0,R,O;v<b;++v)T=r[v],w=T.source,E=T.target,A=E.x+E.vx-w.x-w.vx||ms(h),l>1&&(M=E.y+E.vy-w.y-w.vy||ms(h)),l>2&&(S=E.z+E.vz-w.z-w.vz||ms(h)),R=Math.sqrt(A*A+M*M+S*S),R=(R-o[v])/R*g*i[v],A*=R,M*=R,S*=R,E.vx-=A*(O=u[v]),l>1&&(E.vy-=M*O),l>2&&(E.vz-=S*O),w.vx+=A*(O=1-O),l>1&&(w.vy+=M*O),l>2&&(w.vz+=S*O)}function m(){if(a){var g,x=a.length,b=r.length,v=new Map(a.map((w,E)=>[e(w,E,a),w])),T;for(g=0,c=new Array(x);g<b;++g)T=r[g],T.index=g,typeof T.source!="object"&&(T.source=hT(v,T.source)),typeof T.target!="object"&&(T.target=hT(v,T.target)),c[T.source.index]=(c[T.source.index]||0)+1,c[T.target.index]=(c[T.target.index]||0)+1;for(g=0,u=new Array(b);g<b;++g)T=r[g],u[g]=c[T.source.index]/(c[T.source.index]+c[T.target.index]);i=new Array(b),_(),o=new Array(b),y()}}function _(){if(a)for(var g=0,x=r.length;g<x;++g)i[g]=+n(r[g],g,r)}function y(){if(a)for(var g=0,x=r.length;g<x;++g)o[g]=+s(r[g],g,r)}return p.initialize=function(g,...x){a=g,h=x.find(b=>typeof b=="function")||Math.random,l=x.find(b=>[1,2,3].includes(b))||2,m()},p.links=function(g){return arguments.length?(r=g,m(),p):r},p.id=function(g){return arguments.length?(e=g,p):e},p.iterations=function(g){return arguments.length?(d=+g,p):d},p.strength=function(g){return arguments.length?(n=typeof g=="function"?g:ps(+g),_(),p):n},p.distance=function(g){return arguments.length?(s=typeof g=="function"?g:ps(+g),y(),p):s},p}var pB={value:()=>{}};function su(){for(var r=0,e=arguments.length,n={},i;r<e;++r){if(!(i=arguments[r]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new Gd(n)}function Gd(r){this._=r}function mB(r,e){return r.trim().split(/^|\s+/).map(function(n){var i="",s=n.indexOf(".");if(s>=0&&(i=n.slice(s+1),n=n.slice(0,s)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}Gd.prototype=su.prototype={constructor:Gd,on:function(r,e){var n=this._,i=mB(r+"",n),s,o=-1,a=i.length;if(arguments.length<2){for(;++o<a;)if((s=(r=i[o]).type)&&(s=gB(n[s],r.name)))return s;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<a;)if(s=(r=i[o]).type)n[s]=fT(n[s],r.name,e);else if(e==null)for(s in n)n[s]=fT(n[s],r.name,null);return this},copy:function(){var r={},e=this._;for(var n in e)r[n]=e[n].slice();return new Gd(r)},call:function(r,e){if((s=arguments.length-2)>0)for(var n=new Array(s),i=0,s,o;i<s;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(o=this._[r],i=0,s=o.length;i<s;++i)o[i].value.apply(e,n)},apply:function(r,e,n){if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(var i=this._[r],s=0,o=i.length;s<o;++s)i[s].value.apply(e,n)}};function gB(r,e){for(var n=0,i=r.length,s;n<i;++n)if((s=r[n]).name===e)return s.value}function fT(r,e,n){for(var i=0,s=r.length;i<s;++i)if(r[i].name===e){r[i]=pB,r=r.slice(0,i).concat(r.slice(i+1));break}return n!=null&&r.push({name:e,value:n}),r}var Ml=0,ou=0,au=0,pT=1e3,Vd,lu,$d=0,ha=0,jd=0,cu=typeof performance=="object"&&performance.now?performance:Date,mT=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function B0(){return ha||(mT(yB),ha=cu.now()+jd)}function yB(){ha=0}function Hd(){this._call=this._time=this._next=null}Hd.prototype=k0.prototype={constructor:Hd,restart:function(r,e,n){if(typeof r!="function")throw new TypeError("callback is not a function");n=(n==null?B0():+n)+(e==null?0:+e),!this._next&&lu!==this&&(lu?lu._next=this:Vd=this,lu=this),this._call=r,this._time=n,z0()},stop:function(){this._call&&(this._call=null,this._time=1/0,z0())}};function k0(r,e,n){var i=new Hd;return i.restart(r,e,n),i}function _B(){B0(),++Ml;for(var r=Vd,e;r;)(e=ha-r._time)>=0&&r._call.call(void 0,e),r=r._next;--Ml}function gT(){ha=($d=cu.now())+jd,Ml=ou=0;try{_B()}finally{Ml=0,xB(),ha=0}}function vB(){var r=cu.now(),e=r-$d;e>pT&&(jd-=e,$d=r)}function xB(){for(var r,e=Vd,n,i=1/0;e;)e._call?(i>e._time&&(i=e._time),r=e,e=e._next):(n=e._next,e._next=null,e=r?r._next=n:Vd=n);lu=r,z0(i)}function z0(r){if(!Ml){ou&&(ou=clearTimeout(ou));var e=r-ha;e>24?(r<1/0&&(ou=setTimeout(gT,r-cu.now()-jd)),au&&(au=clearInterval(au))):(au||($d=cu.now(),au=setInterval(vB,pT)),Ml=1,mT(gT))}}function yT(r,e,n){var i=new Hd;return e=e==null?0:+e,i.restart(s=>{i.stop(),r(s+e)},e,n),i}const bB=1664525,SB=1013904223,_T=4294967296;function TB(){let r=1;return()=>(r=(bB*r+SB)%_T)/_T}var vT=3;function G0(r){return r.x}function xT(r){return r.y}function wB(r){return r.z}var MB=10,EB=Math.PI*(3-Math.sqrt(5)),AB=Math.PI*20/(9+Math.sqrt(221));function bT(r,e){e=e||2;var n=Math.min(vT,Math.max(1,Math.round(e))),i,s=1,o=.001,a=1-Math.pow(o,1/300),l=0,c=.6,u=new Map,h=k0(p),d=su("tick","end"),f=TB();r==null&&(r=[]);function p(){m(),d.call("tick",i),s<o&&(h.stop(),d.call("end",i))}function m(g){var x,b=r.length,v;g===void 0&&(g=1);for(var T=0;T<g;++T)for(s+=(l-s)*a,u.forEach(function(w){w(s)}),x=0;x<b;++x)v=r[x],v.fx==null?v.x+=v.vx*=c:(v.x=v.fx,v.vx=0),n>1&&(v.fy==null?v.y+=v.vy*=c:(v.y=v.fy,v.vy=0)),n>2&&(v.fz==null?v.z+=v.vz*=c:(v.z=v.fz,v.vz=0));return i}function _(){for(var g=0,x=r.length,b;g<x;++g){if(b=r[g],b.index=g,b.fx!=null&&(b.x=b.fx),b.fy!=null&&(b.y=b.fy),b.fz!=null&&(b.z=b.fz),isNaN(b.x)||n>1&&isNaN(b.y)||n>2&&isNaN(b.z)){var v=MB*(n>2?Math.cbrt(.5+g):n>1?Math.sqrt(.5+g):g),T=g*EB,w=g*AB;n===1?b.x=v:n===2?(b.x=v*Math.cos(T),b.y=v*Math.sin(T)):(b.x=v*Math.sin(T)*Math.cos(w),b.y=v*Math.cos(T),b.z=v*Math.sin(T)*Math.sin(w))}(isNaN(b.vx)||n>1&&isNaN(b.vy)||n>2&&isNaN(b.vz))&&(b.vx=0,n>1&&(b.vy=0),n>2&&(b.vz=0))}}function y(g){return g.initialize&&g.initialize(r,f,n),g}return _(),i={tick:m,restart:function(){return h.restart(p),i},stop:function(){return h.stop(),i},numDimensions:function(g){return arguments.length?(n=Math.min(vT,Math.max(1,Math.round(g))),u.forEach(y),i):n},nodes:function(g){return arguments.length?(r=g,_(),u.forEach(y),i):r},alpha:function(g){return arguments.length?(s=+g,i):s},alphaMin:function(g){return arguments.length?(o=+g,i):o},alphaDecay:function(g){return arguments.length?(a=+g,i):+a},alphaTarget:function(g){return arguments.length?(l=+g,i):l},velocityDecay:function(g){return arguments.length?(c=1-g,i):1-c},randomSource:function(g){return arguments.length?(f=g,u.forEach(y),i):f},force:function(g,x){return arguments.length>1?(x==null?u.delete(g):u.set(g,y(x)),i):u.get(g)},find:function(){var g=Array.prototype.slice.call(arguments),x=g.shift()||0,b=(n>1?g.shift():null)||0,v=(n>2?g.shift():null)||0,T=g.shift()||1/0,w=0,E=r.length,A,M,S,R,O,P;for(T*=T,w=0;w<E;++w)O=r[w],A=x-O.x,M=b-(O.y||0),S=v-(O.z||0),R=A*A+M*M+S*S,R<T&&(P=O,T=R);return P},on:function(g,x){return arguments.length>1?(d.on(g,x),i):d.on(g)}}}function ST(){var r,e,n,i,s,o=ps(-30),a,l=1,c=1/0,u=.81;function h(m){var _,y=r.length,g=(e===1?iT(r,G0):e===2?oT(r,G0,xT):e===3?cT(r,G0,xT,wB):null).visitAfter(f);for(s=m,_=0;_<y;++_)n=r[_],g.visit(p)}function d(){if(r){var m,_=r.length,y;for(a=new Array(_),m=0;m<_;++m)y=r[m],a[y.index]=+o(y,m,r)}}function f(m){var _=0,y,g,x=0,b,v,T,w,E=m.length;if(E){for(b=v=T=w=0;w<E;++w)(y=m[w])&&(g=Math.abs(y.value))&&(_+=y.value,x+=g,b+=g*(y.x||0),v+=g*(y.y||0),T+=g*(y.z||0));_*=Math.sqrt(4/E),m.x=b/x,e>1&&(m.y=v/x),e>2&&(m.z=T/x)}else{y=m,y.x=y.data.x,e>1&&(y.y=y.data.y),e>2&&(y.z=y.data.z);do _+=a[y.data.index];while(y=y.next)}m.value=_}function p(m,_,y,g,x){if(!m.value)return!0;var b=[y,g,x][e-1],v=m.x-n.x,T=e>1?m.y-n.y:0,w=e>2?m.z-n.z:0,E=b-_,A=v*v+T*T+w*w;if(E*E/u<A)return A<c&&(v===0&&(v=ms(i),A+=v*v),e>1&&T===0&&(T=ms(i),A+=T*T),e>2&&w===0&&(w=ms(i),A+=w*w),A<l&&(A=Math.sqrt(l*A)),n.vx+=v*m.value*s/A,e>1&&(n.vy+=T*m.value*s/A),e>2&&(n.vz+=w*m.value*s/A)),!0;if(m.length||A>=c)return;(m.data!==n||m.next)&&(v===0&&(v=ms(i),A+=v*v),e>1&&T===0&&(T=ms(i),A+=T*T),e>2&&w===0&&(w=ms(i),A+=w*w),A<l&&(A=Math.sqrt(l*A)));do m.data!==n&&(E=a[m.data.index]*s/A,n.vx+=v*E,e>1&&(n.vy+=T*E),e>2&&(n.vz+=w*E));while(m=m.next)}return h.initialize=function(m,..._){r=m,i=_.find(y=>typeof y=="function")||Math.random,e=_.find(y=>[1,2,3].includes(y))||2,d()},h.strength=function(m){return arguments.length?(o=typeof m=="function"?m:ps(+m),d(),h):o},h.distanceMin=function(m){return arguments.length?(l=m*m,h):Math.sqrt(l)},h.distanceMax=function(m){return arguments.length?(c=m*m,h):Math.sqrt(c)},h.theta=function(m){return arguments.length?(u=m*m,h):Math.sqrt(u)},h}function TT(r,e,n,i){var s,o,a=ps(.1),l,c;typeof r!="function"&&(r=ps(+r)),e==null&&(e=0),n==null&&(n=0),i==null&&(i=0);function u(d){for(var f=0,p=s.length;f<p;++f){var m=s[f],_=m.x-e||1e-6,y=(m.y||0)-n||1e-6,g=(m.z||0)-i||1e-6,x=Math.sqrt(_*_+y*y+g*g),b=(c[f]-x)*l[f]*d/x;m.vx+=_*b,o>1&&(m.vy+=y*b),o>2&&(m.vz+=g*b)}}function h(){if(s){var d,f=s.length;for(l=new Array(f),c=new Array(f),d=0;d<f;++d)c[d]=+r(s[d],d,s),l[d]=isNaN(c[d])?0:+a(s[d],d,s)}}return u.initialize=function(d,...f){s=d,o=f.find(p=>[1,2,3].includes(p))||2,h()},u.strength=function(d){return arguments.length?(a=typeof d=="function"?d:ps(+d),h(),u):a},u.radius=function(d){return arguments.length?(r=typeof d=="function"?d:ps(+d),h(),u):r},u.x=function(d){return arguments.length?(e=+d,u):e},u.y=function(d){return arguments.length?(n=+d,u):n},u.z=function(d){return arguments.length?(i=+d,u):i},u}var V0=function(e){RB(e);var n=CB(e);return e.on=n.on,e.off=n.off,e.fire=n.fire,e};function CB(r){var e=Object.create(null);return{on:function(n,i,s){if(typeof i!="function")throw new Error("callback is expected to be a function");var o=e[n];return o||(o=e[n]=[]),o.push({callback:i,ctx:s}),r},off:function(n,i){var s=typeof n>"u";if(s)return e=Object.create(null),r;if(e[n]){var o=typeof i!="function";if(o)delete e[n];else for(var a=e[n],l=0;l<a.length;++l)a[l].callback===i&&a.splice(l,1)}return r},fire:function(n){var i=e[n];if(!i)return r;var s;arguments.length>1&&(s=Array.prototype.splice.call(arguments,1));for(var o=0;o<i.length;++o){var a=i[o];a.callback.apply(a.ctx,s)}return r}}}function RB(r){if(!r)throw new Error("Eventify cannot use falsy object as events subject");for(var e=["on","fire","off"],n=0;n<e.length;++n)if(r.hasOwnProperty(e[n]))throw new Error("Subject cannot be eventified, since it already has property '"+e[n]+"'")}var NB=DB,PB=V0;function DB(r){if(r=r||{},"uniqueLinkId"in r&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n",`
4317
+ }`;class FF{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n,i){if(this.texture===null){const s=new Ri,o=e.properties.get(s);o.__webglTexture=n.texture,(n.depthNear!=i.depthNear||n.depthFar!=i.depthFar)&&(this.depthNear=n.depthNear,this.depthFar=n.depthFar),this.texture=s}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,i=new Ir({vertexShader:LF,fragmentShader:OF,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new yi(new Zc(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class UF extends Jo{constructor(e,n){super();const i=this;let s=null,o=1,a=null,l="local-floor",c=1,u=null,h=null,d=null,f=null,p=null,m=null;const _=new FF,y=n.getContextAttributes();let g=null,x=null;const b=[],v=[],T=new Pe;let w=null;const E=new Xi;E.viewport=new Sn;const A=new Xi;A.viewport=new Sn;const M=[E,A],S=new DF;let R=null,O=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(F){let G=b[F];return G===void 0&&(G=new b0,b[F]=G),G.getTargetRaySpace()},this.getControllerGrip=function(F){let G=b[F];return G===void 0&&(G=new b0,b[F]=G),G.getGripSpace()},this.getHand=function(F){let G=b[F];return G===void 0&&(G=new b0,b[F]=G),G.getHandSpace()};function P(F){const G=v.indexOf(F.inputSource);if(G===-1)return;const ee=b[G];ee!==void 0&&(ee.update(F.inputSource,F.frame,u||a),ee.dispatchEvent({type:F.type,data:F.inputSource}))}function C(){s.removeEventListener("select",P),s.removeEventListener("selectstart",P),s.removeEventListener("selectend",P),s.removeEventListener("squeeze",P),s.removeEventListener("squeezestart",P),s.removeEventListener("squeezeend",P),s.removeEventListener("end",C),s.removeEventListener("inputsourceschange",I);for(let F=0;F<b.length;F++){const G=v[F];G!==null&&(v[F]=null,b[F].disconnect(G))}R=null,O=null,_.reset(),e.setRenderTarget(g),p=null,f=null,d=null,s=null,x=null,he.stop(),i.isPresenting=!1,e.setPixelRatio(w),e.setSize(T.width,T.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(F){o=F,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(F){l=F,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return u||a},this.setReferenceSpace=function(F){u=F},this.getBaseLayer=function(){return f!==null?f:p},this.getBinding=function(){return d},this.getFrame=function(){return m},this.getSession=function(){return s},this.setSession=async function(F){if(s=F,s!==null){if(g=e.getRenderTarget(),s.addEventListener("select",P),s.addEventListener("selectstart",P),s.addEventListener("selectend",P),s.addEventListener("squeeze",P),s.addEventListener("squeezestart",P),s.addEventListener("squeezeend",P),s.addEventListener("end",C),s.addEventListener("inputsourceschange",I),y.xrCompatible!==!0&&await n.makeXRCompatible(),w=e.getPixelRatio(),e.getSize(T),s.renderState.layers===void 0){const G={antialias:y.antialias,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:o};p=new XRWebGLLayer(s,n,G),s.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),x=new eo(p.framebufferWidth,p.framebufferHeight,{format:or,type:ts,colorSpace:e.outputColorSpace,stencilBuffer:y.stencil})}else{let G=null,ee=null,J=null;y.depth&&(J=y.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,G=y.stencil?el:Ja,ee=y.stencil?Qa:Qo);const ue={colorFormat:n.RGBA8,depthFormat:J,scaleFactor:o};d=new XRWebGLBinding(s,n),f=d.createProjectionLayer(ue),s.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),x=new eo(f.textureWidth,f.textureHeight,{format:or,type:ts,depthTexture:new u1(f.textureWidth,f.textureHeight,ee,void 0,void 0,void 0,void 0,void 0,void 0,G),stencilBuffer:y.stencil,colorSpace:e.outputColorSpace,samples:y.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1})}x.isXRRenderTarget=!0,this.setFoveation(c),u=null,a=await s.requestReferenceSpace(l),he.setContext(s),he.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function I(F){for(let G=0;G<F.removed.length;G++){const ee=F.removed[G],J=v.indexOf(ee);J>=0&&(v[J]=null,b[J].disconnect(ee))}for(let G=0;G<F.added.length;G++){const ee=F.added[G];let J=v.indexOf(ee);if(J===-1){for(let be=0;be<b.length;be++)if(be>=v.length){v.push(ee),J=be;break}else if(v[be]===null){v[be]=ee,J=be;break}if(J===-1)break}const ue=b[J];ue&&ue.connect(ee)}}const L=new V,W=new V;function $(F,G,ee){L.setFromMatrixPosition(G.matrixWorld),W.setFromMatrixPosition(ee.matrixWorld);const J=L.distanceTo(W),ue=G.projectionMatrix.elements,be=ee.projectionMatrix.elements,Te=ue[14]/(ue[10]-1),je=ue[14]/(ue[10]+1),pe=(ue[9]+1)/ue[5],ot=(ue[9]-1)/ue[5],q=(ue[8]-1)/ue[0],Ct=(be[8]+1)/be[0],at=Te*q,pt=Te*Ct,Je=J/(-q+Ct),Ot=Je*-q;if(G.matrixWorld.decompose(F.position,F.quaternion,F.scale),F.translateX(Ot),F.translateZ(Je),F.matrixWorld.compose(F.position,F.quaternion,F.scale),F.matrixWorldInverse.copy(F.matrixWorld).invert(),ue[10]===-1)F.projectionMatrix.copy(G.projectionMatrix),F.projectionMatrixInverse.copy(G.projectionMatrixInverse);else{const Ze=Te+Je,B=je+Je,N=at-Ot,se=pt+(J-Ot),ve=pe*je/B*Ze,Se=ot*je/B*Ze;F.projectionMatrix.makePerspective(N,se,ve,Se,Ze,B),F.projectionMatrixInverse.copy(F.projectionMatrix).invert()}}function ie(F,G){G===null?F.matrixWorld.copy(F.matrix):F.matrixWorld.multiplyMatrices(G.matrixWorld,F.matrix),F.matrixWorldInverse.copy(F.matrixWorld).invert()}this.updateCamera=function(F){if(s===null)return;let G=F.near,ee=F.far;_.texture!==null&&(_.depthNear>0&&(G=_.depthNear),_.depthFar>0&&(ee=_.depthFar)),S.near=A.near=E.near=G,S.far=A.far=E.far=ee,(R!==S.near||O!==S.far)&&(s.updateRenderState({depthNear:S.near,depthFar:S.far}),R=S.near,O=S.far),E.layers.mask=F.layers.mask|2,A.layers.mask=F.layers.mask|4,S.layers.mask=E.layers.mask|A.layers.mask;const J=F.parent,ue=S.cameras;ie(S,J);for(let be=0;be<ue.length;be++)ie(ue[be],J);ue.length===2?$(S,E,A):S.projectionMatrix.copy(E.projectionMatrix),U(F,S,J)};function U(F,G,ee){ee===null?F.matrix.copy(G.matrixWorld):(F.matrix.copy(ee.matrixWorld),F.matrix.invert(),F.matrix.multiply(G.matrixWorld)),F.matrix.decompose(F.position,F.quaternion,F.scale),F.updateMatrixWorld(!0),F.projectionMatrix.copy(G.projectionMatrix),F.projectionMatrixInverse.copy(G.projectionMatrixInverse),F.isPerspectiveCamera&&(F.fov=$c*2*Math.atan(1/F.projectionMatrix.elements[5]),F.zoom=1)}this.getCamera=function(){return S},this.getFoveation=function(){if(!(f===null&&p===null))return c},this.setFoveation=function(F){c=F,f!==null&&(f.fixedFoveation=F),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=F)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(S)};let k=null;function re(F,G){if(h=G.getViewerPose(u||a),m=G,h!==null){const ee=h.views;p!==null&&(e.setRenderTargetFramebuffer(x,p.framebuffer),e.setRenderTarget(x));let J=!1;ee.length!==S.cameras.length&&(S.cameras.length=0,J=!0);for(let be=0;be<ee.length;be++){const Te=ee[be];let je=null;if(p!==null)je=p.getViewport(Te);else{const ot=d.getViewSubImage(f,Te);je=ot.viewport,be===0&&(e.setRenderTargetTextures(x,ot.colorTexture,f.ignoreDepthValues?void 0:ot.depthStencilTexture),e.setRenderTarget(x))}let pe=M[be];pe===void 0&&(pe=new Xi,pe.layers.enable(be),pe.viewport=new Sn,M[be]=pe),pe.matrix.fromArray(Te.transform.matrix),pe.matrix.decompose(pe.position,pe.quaternion,pe.scale),pe.projectionMatrix.fromArray(Te.projectionMatrix),pe.projectionMatrixInverse.copy(pe.projectionMatrix).invert(),pe.viewport.set(je.x,je.y,je.width,je.height),be===0&&(S.matrix.copy(pe.matrix),S.matrix.decompose(S.position,S.quaternion,S.scale)),J===!0&&S.cameras.push(pe)}const ue=s.enabledFeatures;if(ue&&ue.includes("depth-sensing")){const be=d.getDepthInformation(ee[0]);be&&be.isValid&&be.texture&&_.init(e,be,s.renderState)}}for(let ee=0;ee<b.length;ee++){const J=v[ee],ue=b[ee];J!==null&&ue!==void 0&&ue.update(J,G,u||a)}k&&k(F,G),G.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:G}),m=null}const he=new n1;he.setAnimationLoop(re),this.setAnimationLoop=function(F){k=F},this.dispose=function(){}}}const ua=new so,BF=new tn;function kF(r,e){function n(y,g){y.matrixAutoUpdate===!0&&y.updateMatrix(),g.value.copy(y.matrix)}function i(y,g){g.color.getRGB(y.fogColor.value,KS(r)),g.isFog?(y.fogNear.value=g.near,y.fogFar.value=g.far):g.isFogExp2&&(y.fogDensity.value=g.density)}function s(y,g,x,b,v){g.isMeshBasicMaterial||g.isMeshLambertMaterial?o(y,g):g.isMeshToonMaterial?(o(y,g),d(y,g)):g.isMeshPhongMaterial?(o(y,g),h(y,g)):g.isMeshStandardMaterial?(o(y,g),f(y,g),g.isMeshPhysicalMaterial&&p(y,g,v)):g.isMeshMatcapMaterial?(o(y,g),m(y,g)):g.isMeshDepthMaterial?o(y,g):g.isMeshDistanceMaterial?(o(y,g),_(y,g)):g.isMeshNormalMaterial?o(y,g):g.isLineBasicMaterial?(a(y,g),g.isLineDashedMaterial&&l(y,g)):g.isPointsMaterial?c(y,g,x,b):g.isSpriteMaterial?u(y,g):g.isShadowMaterial?(y.color.value.copy(g.color),y.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function o(y,g){y.opacity.value=g.opacity,g.color&&y.diffuse.value.copy(g.color),g.emissive&&y.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(y.map.value=g.map,n(g.map,y.mapTransform)),g.alphaMap&&(y.alphaMap.value=g.alphaMap,n(g.alphaMap,y.alphaMapTransform)),g.bumpMap&&(y.bumpMap.value=g.bumpMap,n(g.bumpMap,y.bumpMapTransform),y.bumpScale.value=g.bumpScale,g.side===ri&&(y.bumpScale.value*=-1)),g.normalMap&&(y.normalMap.value=g.normalMap,n(g.normalMap,y.normalMapTransform),y.normalScale.value.copy(g.normalScale),g.side===ri&&y.normalScale.value.negate()),g.displacementMap&&(y.displacementMap.value=g.displacementMap,n(g.displacementMap,y.displacementMapTransform),y.displacementScale.value=g.displacementScale,y.displacementBias.value=g.displacementBias),g.emissiveMap&&(y.emissiveMap.value=g.emissiveMap,n(g.emissiveMap,y.emissiveMapTransform)),g.specularMap&&(y.specularMap.value=g.specularMap,n(g.specularMap,y.specularMapTransform)),g.alphaTest>0&&(y.alphaTest.value=g.alphaTest);const x=e.get(g),b=x.envMap,v=x.envMapRotation;b&&(y.envMap.value=b,ua.copy(v),ua.x*=-1,ua.y*=-1,ua.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(ua.y*=-1,ua.z*=-1),y.envMapRotation.value.setFromMatrix4(BF.makeRotationFromEuler(ua)),y.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=g.reflectivity,y.ior.value=g.ior,y.refractionRatio.value=g.refractionRatio),g.lightMap&&(y.lightMap.value=g.lightMap,y.lightMapIntensity.value=g.lightMapIntensity,n(g.lightMap,y.lightMapTransform)),g.aoMap&&(y.aoMap.value=g.aoMap,y.aoMapIntensity.value=g.aoMapIntensity,n(g.aoMap,y.aoMapTransform))}function a(y,g){y.diffuse.value.copy(g.color),y.opacity.value=g.opacity,g.map&&(y.map.value=g.map,n(g.map,y.mapTransform))}function l(y,g){y.dashSize.value=g.dashSize,y.totalSize.value=g.dashSize+g.gapSize,y.scale.value=g.scale}function c(y,g,x,b){y.diffuse.value.copy(g.color),y.opacity.value=g.opacity,y.size.value=g.size*x,y.scale.value=b*.5,g.map&&(y.map.value=g.map,n(g.map,y.uvTransform)),g.alphaMap&&(y.alphaMap.value=g.alphaMap,n(g.alphaMap,y.alphaMapTransform)),g.alphaTest>0&&(y.alphaTest.value=g.alphaTest)}function u(y,g){y.diffuse.value.copy(g.color),y.opacity.value=g.opacity,y.rotation.value=g.rotation,g.map&&(y.map.value=g.map,n(g.map,y.mapTransform)),g.alphaMap&&(y.alphaMap.value=g.alphaMap,n(g.alphaMap,y.alphaMapTransform)),g.alphaTest>0&&(y.alphaTest.value=g.alphaTest)}function h(y,g){y.specular.value.copy(g.specular),y.shininess.value=Math.max(g.shininess,1e-4)}function d(y,g){g.gradientMap&&(y.gradientMap.value=g.gradientMap)}function f(y,g){y.metalness.value=g.metalness,g.metalnessMap&&(y.metalnessMap.value=g.metalnessMap,n(g.metalnessMap,y.metalnessMapTransform)),y.roughness.value=g.roughness,g.roughnessMap&&(y.roughnessMap.value=g.roughnessMap,n(g.roughnessMap,y.roughnessMapTransform)),g.envMap&&(y.envMapIntensity.value=g.envMapIntensity)}function p(y,g,x){y.ior.value=g.ior,g.sheen>0&&(y.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),y.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(y.sheenColorMap.value=g.sheenColorMap,n(g.sheenColorMap,y.sheenColorMapTransform)),g.sheenRoughnessMap&&(y.sheenRoughnessMap.value=g.sheenRoughnessMap,n(g.sheenRoughnessMap,y.sheenRoughnessMapTransform))),g.clearcoat>0&&(y.clearcoat.value=g.clearcoat,y.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(y.clearcoatMap.value=g.clearcoatMap,n(g.clearcoatMap,y.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,n(g.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(y.clearcoatNormalMap.value=g.clearcoatNormalMap,n(g.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===ri&&y.clearcoatNormalScale.value.negate())),g.dispersion>0&&(y.dispersion.value=g.dispersion),g.iridescence>0&&(y.iridescence.value=g.iridescence,y.iridescenceIOR.value=g.iridescenceIOR,y.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(y.iridescenceMap.value=g.iridescenceMap,n(g.iridescenceMap,y.iridescenceMapTransform)),g.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=g.iridescenceThicknessMap,n(g.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),g.transmission>0&&(y.transmission.value=g.transmission,y.transmissionSamplerMap.value=x.texture,y.transmissionSamplerSize.value.set(x.width,x.height),g.transmissionMap&&(y.transmissionMap.value=g.transmissionMap,n(g.transmissionMap,y.transmissionMapTransform)),y.thickness.value=g.thickness,g.thicknessMap&&(y.thicknessMap.value=g.thicknessMap,n(g.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=g.attenuationDistance,y.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(y.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(y.anisotropyMap.value=g.anisotropyMap,n(g.anisotropyMap,y.anisotropyMapTransform))),y.specularIntensity.value=g.specularIntensity,y.specularColor.value.copy(g.specularColor),g.specularColorMap&&(y.specularColorMap.value=g.specularColorMap,n(g.specularColorMap,y.specularColorMapTransform)),g.specularIntensityMap&&(y.specularIntensityMap.value=g.specularIntensityMap,n(g.specularIntensityMap,y.specularIntensityMapTransform))}function m(y,g){g.matcap&&(y.matcap.value=g.matcap)}function _(y,g){const x=e.get(g).light;y.referencePosition.value.setFromMatrixPosition(x.matrixWorld),y.nearDistance.value=x.shadow.camera.near,y.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function zF(r,e,n,i){let s={},o={},a=[];const l=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function c(x,b){const v=b.program;i.uniformBlockBinding(x,v)}function u(x,b){let v=s[x.id];v===void 0&&(m(x),v=h(x),s[x.id]=v,x.addEventListener("dispose",y));const T=b.program;i.updateUBOMapping(x,T);const w=e.render.frame;o[x.id]!==w&&(f(x),o[x.id]=w)}function h(x){const b=d();x.__bindingPointIndex=b;const v=r.createBuffer(),T=x.__size,w=x.usage;return r.bindBuffer(r.UNIFORM_BUFFER,v),r.bufferData(r.UNIFORM_BUFFER,T,w),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,b,v),v}function d(){for(let x=0;x<l;x++)if(a.indexOf(x)===-1)return a.push(x),x;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(x){const b=s[x.id],v=x.uniforms,T=x.__cache;r.bindBuffer(r.UNIFORM_BUFFER,b);for(let w=0,E=v.length;w<E;w++){const A=Array.isArray(v[w])?v[w]:[v[w]];for(let M=0,S=A.length;M<S;M++){const R=A[M];if(p(R,w,M,T)===!0){const O=R.__offset,P=Array.isArray(R.value)?R.value:[R.value];let C=0;for(let I=0;I<P.length;I++){const L=P[I],W=_(L);typeof L=="number"||typeof L=="boolean"?(R.__data[0]=L,r.bufferSubData(r.UNIFORM_BUFFER,O+C,R.__data)):L.isMatrix3?(R.__data[0]=L.elements[0],R.__data[1]=L.elements[1],R.__data[2]=L.elements[2],R.__data[3]=0,R.__data[4]=L.elements[3],R.__data[5]=L.elements[4],R.__data[6]=L.elements[5],R.__data[7]=0,R.__data[8]=L.elements[6],R.__data[9]=L.elements[7],R.__data[10]=L.elements[8],R.__data[11]=0):(L.toArray(R.__data,C),C+=W.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,O,R.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function p(x,b,v,T){const w=x.value,E=b+"_"+v;if(T[E]===void 0)return typeof w=="number"||typeof w=="boolean"?T[E]=w:T[E]=w.clone(),!0;{const A=T[E];if(typeof w=="number"||typeof w=="boolean"){if(A!==w)return T[E]=w,!0}else if(A.equals(w)===!1)return A.copy(w),!0}return!1}function m(x){const b=x.uniforms;let v=0;const T=16;for(let E=0,A=b.length;E<A;E++){const M=Array.isArray(b[E])?b[E]:[b[E]];for(let S=0,R=M.length;S<R;S++){const O=M[S],P=Array.isArray(O.value)?O.value:[O.value];for(let C=0,I=P.length;C<I;C++){const L=P[C],W=_(L),$=v%T,ie=$%W.boundary,U=$+ie;v+=ie,U!==0&&T-U<W.storage&&(v+=T-U),O.__data=new Float32Array(W.storage/Float32Array.BYTES_PER_ELEMENT),O.__offset=v,v+=W.storage}}}const w=v%T;return w>0&&(v+=T-w),x.__size=v,x.__cache={},this}function _(x){const b={boundary:0,storage:0};return typeof x=="number"||typeof x=="boolean"?(b.boundary=4,b.storage=4):x.isVector2?(b.boundary=8,b.storage=8):x.isVector3||x.isColor?(b.boundary=16,b.storage=12):x.isVector4?(b.boundary=16,b.storage=16):x.isMatrix3?(b.boundary=48,b.storage=48):x.isMatrix4?(b.boundary=64,b.storage=64):x.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",x),b}function y(x){const b=x.target;b.removeEventListener("dispose",y);const v=a.indexOf(b.__bindingPointIndex);a.splice(v,1),r.deleteBuffer(s[b.id]),delete s[b.id],delete o[b.id]}function g(){for(const x in s)r.deleteBuffer(s[x]);a=[],s={},o={}}return{bind:c,update:u,dispose:g}}class GF{constructor(e={}){const{canvas:n=uI(),context:i=null,depth:s=!0,stencil:o=!1,alpha:a=!1,antialias:l=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:u=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1,reverseDepthBuffer:f=!1}=e;this.isWebGLRenderer=!0;let p;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=i.getContextAttributes().alpha}else p=a;const m=new Uint32Array(4),_=new Int32Array(4);let y=null,g=null;const x=[],b=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=mi,this.toneMapping=Qs,this.toneMappingExposure=1;const v=this;let T=!1,w=0,E=0,A=null,M=-1,S=null;const R=new Sn,O=new Sn;let P=null;const C=new Et(0);let I=0,L=n.width,W=n.height,$=1,ie=null,U=null;const k=new Sn(0,0,L,W),re=new Sn(0,0,L,W);let he=!1;const F=new h0;let G=!1,ee=!1;const J=new tn,ue=new tn,be=new V,Te=new Sn,je={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let pe=!1;function ot(){return A===null?$:1}let q=i;function Ct(D,H){return n.getContext(D,H)}try{const D={alpha:!0,depth:s,stencil:o,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:u,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Kh}`),n.addEventListener("webglcontextlost",xe,!1),n.addEventListener("webglcontextrestored",Be,!1),n.addEventListener("webglcontextcreationerror",ke,!1),q===null){const H="webgl2";if(q=Ct(H,D),q===null)throw Ct(H)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw console.error("THREE.WebGLRenderer: "+D.message),D}let at,pt,Je,Ot,Ze,B,N,se,ve,Se,me,Ge,Oe,ze,tt,Me,Ve,et,st,$e,St,yt,Ht,Y;function De(){at=new W3(q),at.init(),yt=new PF(q,at),pt=new z3(q,at,e,yt),Je=new CF(q,at),pt.reverseDepthBuffer&&f&&Je.buffers.depth.setReversed(!0),Ot=new Y3(q),Ze=new fF,B=new NF(q,at,Je,Ze,pt,yt,Ot),N=new V3(v),se=new H3(v),ve=new FI(q),Ht=new B3(q,ve),Se=new q3(q,ve,Ot,Ht),me=new Z3(q,Se,ve,Ot),st=new K3(q,pt,B),Me=new G3(Ze),Ge=new dF(v,N,se,at,pt,Ht,Me),Oe=new kF(v,Ze),ze=new mF,tt=new bF(at),et=new U3(v,N,se,Je,me,p,c),Ve=new EF(v,me,pt),Y=new zF(q,Ot,pt,Je),$e=new k3(q,at,Ot),St=new X3(q,at,Ot),Ot.programs=Ge.programs,v.capabilities=pt,v.extensions=at,v.properties=Ze,v.renderLists=ze,v.shadowMap=Ve,v.state=Je,v.info=Ot}De();const le=new UF(v,q);this.xr=le,this.getContext=function(){return q},this.getContextAttributes=function(){return q.getContextAttributes()},this.forceContextLoss=function(){const D=at.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=at.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return $},this.setPixelRatio=function(D){D!==void 0&&($=D,this.setSize(L,W,!1))},this.getSize=function(D){return D.set(L,W)},this.setSize=function(D,H,te=!0){if(le.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}L=D,W=H,n.width=Math.floor(D*$),n.height=Math.floor(H*$),te===!0&&(n.style.width=D+"px",n.style.height=H+"px"),this.setViewport(0,0,D,H)},this.getDrawingBufferSize=function(D){return D.set(L*$,W*$).floor()},this.setDrawingBufferSize=function(D,H,te){L=D,W=H,$=te,n.width=Math.floor(D*te),n.height=Math.floor(H*te),this.setViewport(0,0,D,H)},this.getCurrentViewport=function(D){return D.copy(R)},this.getViewport=function(D){return D.copy(k)},this.setViewport=function(D,H,te,oe){D.isVector4?k.set(D.x,D.y,D.z,D.w):k.set(D,H,te,oe),Je.viewport(R.copy(k).multiplyScalar($).round())},this.getScissor=function(D){return D.copy(re)},this.setScissor=function(D,H,te,oe){D.isVector4?re.set(D.x,D.y,D.z,D.w):re.set(D,H,te,oe),Je.scissor(O.copy(re).multiplyScalar($).round())},this.getScissorTest=function(){return he},this.setScissorTest=function(D){Je.setScissorTest(he=D)},this.setOpaqueSort=function(D){ie=D},this.setTransparentSort=function(D){U=D},this.getClearColor=function(D){return D.copy(et.getClearColor())},this.setClearColor=function(){et.setClearColor.apply(et,arguments)},this.getClearAlpha=function(){return et.getClearAlpha()},this.setClearAlpha=function(){et.setClearAlpha.apply(et,arguments)},this.clear=function(D=!0,H=!0,te=!0){let oe=0;if(D){let K=!1;if(A!==null){const Ee=A.texture.format;K=Ee===fg||Ee===dg||Ee===hg}if(K){const Ee=A.texture.type,Ne=Ee===ts||Ee===Qo||Ee===Gc||Ee===Qa||Ee===cg||Ee===ug,We=et.getClearColor(),Xe=et.getClearAlpha(),ct=We.r,_t=We.g,Ke=We.b;Ne?(m[0]=ct,m[1]=_t,m[2]=Ke,m[3]=Xe,q.clearBufferuiv(q.COLOR,0,m)):(_[0]=ct,_[1]=_t,_[2]=Ke,_[3]=Xe,q.clearBufferiv(q.COLOR,0,_))}else oe|=q.COLOR_BUFFER_BIT}H&&(oe|=q.DEPTH_BUFFER_BIT),te&&(oe|=q.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),q.clear(oe)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",xe,!1),n.removeEventListener("webglcontextrestored",Be,!1),n.removeEventListener("webglcontextcreationerror",ke,!1),ze.dispose(),tt.dispose(),Ze.dispose(),N.dispose(),se.dispose(),me.dispose(),Ht.dispose(),Y.dispose(),Ge.dispose(),le.dispose(),le.removeEventListener("sessionstart",Ih),le.removeEventListener("sessionend",Lh),Xs.stop()};function xe(D){D.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function Be(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;const D=Ot.autoReset,H=Ve.enabled,te=Ve.autoUpdate,oe=Ve.needsUpdate,K=Ve.type;De(),Ot.autoReset=D,Ve.enabled=H,Ve.autoUpdate=te,Ve.needsUpdate=oe,Ve.type=K}function ke(D){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",D.statusMessage)}function ht(D){const H=D.target;H.removeEventListener("dispose",ht),fn(H)}function fn(D){On(D),Ze.remove(D)}function On(D){const H=Ze.get(D).programs;H!==void 0&&(H.forEach(function(te){Ge.releaseProgram(te)}),D.isShaderMaterial&&Ge.releaseShaderCache(D))}this.renderBufferDirect=function(D,H,te,oe,K,Ee){H===null&&(H=je);const Ne=K.isMesh&&K.matrixWorld.determinant()<0,We=Yt(D,H,te,oe,K);Je.setMaterial(oe,Ne);let Xe=te.index,ct=1;if(oe.wireframe===!0){if(Xe=Se.getWireframeAttribute(te),Xe===void 0)return;ct=2}const _t=te.drawRange,Ke=te.attributes.position;let Ut=_t.start*ct,Jt=(_t.start+_t.count)*ct;Ee!==null&&(Ut=Math.max(Ut,Ee.start*ct),Jt=Math.min(Jt,(Ee.start+Ee.count)*ct)),Xe!==null?(Ut=Math.max(Ut,0),Jt=Math.min(Jt,Xe.count)):Ke!=null&&(Ut=Math.max(Ut,0),Jt=Math.min(Jt,Ke.count));const on=Jt-Ut;if(on<0||on===1/0)return;Ht.setup(K,oe,We,te,Xe);let Ci,Wt=$e;if(Xe!==null&&(Ci=ve.get(Xe),Wt=St,Wt.setIndex(Ci)),K.isMesh)oe.wireframe===!0?(Je.setLineWidth(oe.wireframeLinewidth*ot()),Wt.setMode(q.LINES)):Wt.setMode(q.TRIANGLES);else if(K.isLine){let Qe=oe.linewidth;Qe===void 0&&(Qe=1),Je.setLineWidth(Qe*ot()),K.isLineSegments?Wt.setMode(q.LINES):K.isLineLoop?Wt.setMode(q.LINE_LOOP):Wt.setMode(q.LINE_STRIP)}else K.isPoints?Wt.setMode(q.POINTS):K.isSprite&&Wt.setMode(q.TRIANGLES);if(K.isBatchedMesh)if(K._multiDrawInstances!==null)Wt.renderMultiDrawInstances(K._multiDrawStarts,K._multiDrawCounts,K._multiDrawCount,K._multiDrawInstances);else if(at.get("WEBGL_multi_draw"))Wt.renderMultiDraw(K._multiDrawStarts,K._multiDrawCounts,K._multiDrawCount);else{const Qe=K._multiDrawStarts,Ys=K._multiDrawCounts,qt=K._multiDrawCount,Rr=Xe?ve.get(Xe).bytesPerElement:1,Ic=Ze.get(oe).currentProgram.getUniforms();for(let Hi=0;Hi<qt;Hi++)Ic.setValue(q,"_gl_DrawID",Hi),Wt.render(Qe[Hi]/Rr,Ys[Hi])}else if(K.isInstancedMesh)Wt.renderInstances(Ut,on,K.count);else if(te.isInstancedBufferGeometry){const Qe=te._maxInstanceCount!==void 0?te._maxInstanceCount:1/0,Ys=Math.min(te.instanceCount,Qe);Wt.renderInstances(Ut,on,Ys)}else Wt.render(Ut,on)};function Ft(D,H,te){D.transparent===!0&&D.side===Jr&&D.forceSinglePass===!1?(D.side=ri,D.needsUpdate=!0,Ue(D,H,te),D.side=Zs,D.needsUpdate=!0,Ue(D,H,te),D.side=Jr):Ue(D,H,te)}this.compile=function(D,H,te=null){te===null&&(te=D),g=tt.get(te),g.init(H),b.push(g),te.traverseVisible(function(K){K.isLight&&K.layers.test(H.layers)&&(g.pushLight(K),K.castShadow&&g.pushShadow(K))}),D!==te&&D.traverseVisible(function(K){K.isLight&&K.layers.test(H.layers)&&(g.pushLight(K),K.castShadow&&g.pushShadow(K))}),g.setupLights();const oe=new Set;return D.traverse(function(K){if(!(K.isMesh||K.isPoints||K.isLine||K.isSprite))return;const Ee=K.material;if(Ee)if(Array.isArray(Ee))for(let Ne=0;Ne<Ee.length;Ne++){const We=Ee[Ne];Ft(We,te,K),oe.add(We)}else Ft(Ee,te,K),oe.add(Ee)}),b.pop(),g=null,oe},this.compileAsync=function(D,H,te=null){const oe=this.compile(D,H,te);return new Promise(K=>{function Ee(){if(oe.forEach(function(Ne){Ze.get(Ne).currentProgram.isReady()&&oe.delete(Ne)}),oe.size===0){K(D);return}setTimeout(Ee,10)}at.get("KHR_parallel_shader_compile")!==null?Ee():setTimeout(Ee,10)})};let ji=null;function Cr(D){ji&&ji(D)}function Ih(){Xs.stop()}function Lh(){Xs.start()}const Xs=new n1;Xs.setAnimationLoop(Cr),typeof self<"u"&&Xs.setContext(self),this.setAnimationLoop=function(D){ji=D,le.setAnimationLoop(D),D===null?Xs.stop():Xs.start()},le.addEventListener("sessionstart",Ih),le.addEventListener("sessionend",Lh),this.render=function(D,H){if(H!==void 0&&H.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;if(D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),H.parent===null&&H.matrixWorldAutoUpdate===!0&&H.updateMatrixWorld(),le.enabled===!0&&le.isPresenting===!0&&(le.cameraAutoUpdate===!0&&le.updateCamera(H),H=le.getCamera()),D.isScene===!0&&D.onBeforeRender(v,D,H,A),g=tt.get(D,b.length),g.init(H),b.push(g),ue.multiplyMatrices(H.projectionMatrix,H.matrixWorldInverse),F.setFromProjectionMatrix(ue),ee=this.localClippingEnabled,G=Me.init(this.clippingPlanes,ee),y=ze.get(D,x.length),y.init(),x.push(y),le.enabled===!0&&le.isPresenting===!0){const Ee=v.xr.getDepthSensingMesh();Ee!==null&&Oh(Ee,H,-1/0,v.sortObjects)}Oh(D,H,0,v.sortObjects),y.finish(),v.sortObjects===!0&&y.sort(ie,U),pe=le.enabled===!1||le.isPresenting===!1||le.hasDepthSensing()===!1,pe&&et.addToRenderList(y,D),this.info.render.frame++,G===!0&&Me.beginShadows();const te=g.state.shadowsArray;Ve.render(te,D,H),G===!0&&Me.endShadows(),this.info.autoReset===!0&&this.info.reset();const oe=y.opaque,K=y.transmissive;if(g.setupLights(),H.isArrayCamera){const Ee=H.cameras;if(K.length>0)for(let Ne=0,We=Ee.length;Ne<We;Ne++){const Xe=Ee[Ne];mm(oe,K,D,Xe)}pe&&et.render(D);for(let Ne=0,We=Ee.length;Ne<We;Ne++){const Xe=Ee[Ne];pm(y,D,Xe,Xe.viewport)}}else K.length>0&&mm(oe,K,D,H),pe&&et.render(D),pm(y,D,H);A!==null&&(B.updateMultisampleRenderTarget(A),B.updateRenderTargetMipmap(A)),D.isScene===!0&&D.onAfterRender(v,D,H),Ht.resetDefaultState(),M=-1,S=null,b.pop(),b.length>0?(g=b[b.length-1],G===!0&&Me.setGlobalState(v.clippingPlanes,g.state.camera)):g=null,x.pop(),x.length>0?y=x[x.length-1]:y=null};function Oh(D,H,te,oe){if(D.visible===!1)return;if(D.layers.test(H.layers)){if(D.isGroup)te=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(H);else if(D.isLight)g.pushLight(D),D.castShadow&&g.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||F.intersectsSprite(D)){oe&&Te.setFromMatrixPosition(D.matrixWorld).applyMatrix4(ue);const Ne=me.update(D),We=D.material;We.visible&&y.push(D,Ne,We,te,Te.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||F.intersectsObject(D))){const Ne=me.update(D),We=D.material;if(oe&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),Te.copy(D.boundingSphere.center)):(Ne.boundingSphere===null&&Ne.computeBoundingSphere(),Te.copy(Ne.boundingSphere.center)),Te.applyMatrix4(D.matrixWorld).applyMatrix4(ue)),Array.isArray(We)){const Xe=Ne.groups;for(let ct=0,_t=Xe.length;ct<_t;ct++){const Ke=Xe[ct],Ut=We[Ke.materialIndex];Ut&&Ut.visible&&y.push(D,Ne,Ut,te,Te.z,Ke)}}else We.visible&&y.push(D,Ne,We,te,Te.z,null)}}const Ee=D.children;for(let Ne=0,We=Ee.length;Ne<We;Ne++)Oh(Ee[Ne],H,te,oe)}function pm(D,H,te,oe){const K=D.opaque,Ee=D.transmissive,Ne=D.transparent;g.setupLightsView(te),G===!0&&Me.setGlobalState(v.clippingPlanes,te),oe&&Je.viewport(R.copy(oe)),K.length>0&&z(K,H,te),Ee.length>0&&z(Ee,H,te),Ne.length>0&&z(Ne,H,te),Je.buffers.depth.setTest(!0),Je.buffers.depth.setMask(!0),Je.buffers.color.setMask(!0),Je.setPolygonOffset(!1)}function mm(D,H,te,oe){if((te.isScene===!0?te.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[oe.id]===void 0&&(g.state.transmissionRenderTarget[oe.id]=new eo(1,1,{generateMipmaps:!0,type:at.has("EXT_color_buffer_half_float")||at.has("EXT_color_buffer_float")?Za:ts,minFilter:Zo,samples:4,stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Dt.workingColorSpace}));const Ee=g.state.transmissionRenderTarget[oe.id],Ne=oe.viewport||R;Ee.setSize(Ne.z,Ne.w);const We=v.getRenderTarget();v.setRenderTarget(Ee),v.getClearColor(C),I=v.getClearAlpha(),I<1&&v.setClearColor(16777215,.5),v.clear(),pe&&et.render(te);const Xe=v.toneMapping;v.toneMapping=Qs;const ct=oe.viewport;if(oe.viewport!==void 0&&(oe.viewport=void 0),g.setupLightsView(oe),G===!0&&Me.setGlobalState(v.clippingPlanes,oe),z(D,te,oe),B.updateMultisampleRenderTarget(Ee),B.updateRenderTargetMipmap(Ee),at.has("WEBGL_multisampled_render_to_texture")===!1){let _t=!1;for(let Ke=0,Ut=H.length;Ke<Ut;Ke++){const Jt=H[Ke],on=Jt.object,Ci=Jt.geometry,Wt=Jt.material,Qe=Jt.group;if(Wt.side===Jr&&on.layers.test(oe.layers)){const Ys=Wt.side;Wt.side=ri,Wt.needsUpdate=!0,we(on,te,oe,Ci,Wt,Qe),Wt.side=Ys,Wt.needsUpdate=!0,_t=!0}}_t===!0&&(B.updateMultisampleRenderTarget(Ee),B.updateRenderTargetMipmap(Ee))}v.setRenderTarget(We),v.setClearColor(C,I),ct!==void 0&&(oe.viewport=ct),v.toneMapping=Xe}function z(D,H,te){const oe=H.isScene===!0?H.overrideMaterial:null;for(let K=0,Ee=D.length;K<Ee;K++){const Ne=D[K],We=Ne.object,Xe=Ne.geometry,ct=oe===null?Ne.material:oe,_t=Ne.group;We.layers.test(te.layers)&&we(We,H,te,Xe,ct,_t)}}function we(D,H,te,oe,K,Ee){D.onBeforeRender(v,H,te,oe,K,Ee),D.modelViewMatrix.multiplyMatrices(te.matrixWorldInverse,D.matrixWorld),D.normalMatrix.getNormalMatrix(D.modelViewMatrix),K.onBeforeRender(v,H,te,oe,D,Ee),K.transparent===!0&&K.side===Jr&&K.forceSinglePass===!1?(K.side=ri,K.needsUpdate=!0,v.renderBufferDirect(te,H,oe,K,D,Ee),K.side=Zs,K.needsUpdate=!0,v.renderBufferDirect(te,H,oe,K,D,Ee),K.side=Jr):v.renderBufferDirect(te,H,oe,K,D,Ee),D.onAfterRender(v,H,te,oe,K,Ee)}function Ue(D,H,te){H.isScene!==!0&&(H=je);const oe=Ze.get(D),K=g.state.lights,Ee=g.state.shadowsArray,Ne=K.state.version,We=Ge.getParameters(D,K.state,Ee,H,te),Xe=Ge.getProgramCacheKey(We);let ct=oe.programs;oe.environment=D.isMeshStandardMaterial?H.environment:null,oe.fog=H.fog,oe.envMap=(D.isMeshStandardMaterial?se:N).get(D.envMap||oe.environment),oe.envMapRotation=oe.environment!==null&&D.envMap===null?H.environmentRotation:D.envMapRotation,ct===void 0&&(D.addEventListener("dispose",ht),ct=new Map,oe.programs=ct);let _t=ct.get(Xe);if(_t!==void 0){if(oe.currentProgram===_t&&oe.lightsStateVersion===Ne)return It(D,We),_t}else We.uniforms=Ge.getUniforms(D),D.onBeforeCompile(We,v),_t=Ge.acquireProgram(We,Xe),ct.set(Xe,_t),oe.uniforms=We.uniforms;const Ke=oe.uniforms;return(!D.isShaderMaterial&&!D.isRawShaderMaterial||D.clipping===!0)&&(Ke.clippingPlanes=Me.uniform),It(D,We),oe.needsLights=wt(D),oe.lightsStateVersion=Ne,oe.needsLights&&(Ke.ambientLightColor.value=K.state.ambient,Ke.lightProbe.value=K.state.probe,Ke.directionalLights.value=K.state.directional,Ke.directionalLightShadows.value=K.state.directionalShadow,Ke.spotLights.value=K.state.spot,Ke.spotLightShadows.value=K.state.spotShadow,Ke.rectAreaLights.value=K.state.rectArea,Ke.ltc_1.value=K.state.rectAreaLTC1,Ke.ltc_2.value=K.state.rectAreaLTC2,Ke.pointLights.value=K.state.point,Ke.pointLightShadows.value=K.state.pointShadow,Ke.hemisphereLights.value=K.state.hemi,Ke.directionalShadowMap.value=K.state.directionalShadowMap,Ke.directionalShadowMatrix.value=K.state.directionalShadowMatrix,Ke.spotShadowMap.value=K.state.spotShadowMap,Ke.spotLightMatrix.value=K.state.spotLightMatrix,Ke.spotLightMap.value=K.state.spotLightMap,Ke.pointShadowMap.value=K.state.pointShadowMap,Ke.pointShadowMatrix.value=K.state.pointShadowMatrix),oe.currentProgram=_t,oe.uniformsList=null,_t}function lt(D){if(D.uniformsList===null){const H=D.currentProgram.getUniforms();D.uniformsList=Rd.seqWithValue(H.seq,D.uniforms)}return D.uniformsList}function It(D,H){const te=Ze.get(D);te.outputColorSpace=H.outputColorSpace,te.batching=H.batching,te.batchingColor=H.batchingColor,te.instancing=H.instancing,te.instancingColor=H.instancingColor,te.instancingMorph=H.instancingMorph,te.skinning=H.skinning,te.morphTargets=H.morphTargets,te.morphNormals=H.morphNormals,te.morphColors=H.morphColors,te.morphTargetsCount=H.morphTargetsCount,te.numClippingPlanes=H.numClippingPlanes,te.numIntersection=H.numClipIntersection,te.vertexAlphas=H.vertexAlphas,te.vertexTangents=H.vertexTangents,te.toneMapping=H.toneMapping}function Yt(D,H,te,oe,K){H.isScene!==!0&&(H=je),B.resetTextureUnits();const Ee=H.fog,Ne=oe.isMeshStandardMaterial?H.environment:null,We=A===null?v.outputColorSpace:A.isXRRenderTarget===!0?A.texture.colorSpace:tl,Xe=(oe.isMeshStandardMaterial?se:N).get(oe.envMap||Ne),ct=oe.vertexColors===!0&&!!te.attributes.color&&te.attributes.color.itemSize===4,_t=!!te.attributes.tangent&&(!!oe.normalMap||oe.anisotropy>0),Ke=!!te.morphAttributes.position,Ut=!!te.morphAttributes.normal,Jt=!!te.morphAttributes.color;let on=Qs;oe.toneMapped&&(A===null||A.isXRRenderTarget===!0)&&(on=v.toneMapping);const Ci=te.morphAttributes.position||te.morphAttributes.normal||te.morphAttributes.color,Wt=Ci!==void 0?Ci.length:0,Qe=Ze.get(oe),Ys=g.state.lights;if(G===!0&&(ee===!0||D!==S)){const ir=D===S&&oe.id===M;Me.setState(oe,D,ir)}let qt=!1;oe.version===Qe.__version?(Qe.needsLights&&Qe.lightsStateVersion!==Ys.state.version||Qe.outputColorSpace!==We||K.isBatchedMesh&&Qe.batching===!1||!K.isBatchedMesh&&Qe.batching===!0||K.isBatchedMesh&&Qe.batchingColor===!0&&K.colorTexture===null||K.isBatchedMesh&&Qe.batchingColor===!1&&K.colorTexture!==null||K.isInstancedMesh&&Qe.instancing===!1||!K.isInstancedMesh&&Qe.instancing===!0||K.isSkinnedMesh&&Qe.skinning===!1||!K.isSkinnedMesh&&Qe.skinning===!0||K.isInstancedMesh&&Qe.instancingColor===!0&&K.instanceColor===null||K.isInstancedMesh&&Qe.instancingColor===!1&&K.instanceColor!==null||K.isInstancedMesh&&Qe.instancingMorph===!0&&K.morphTexture===null||K.isInstancedMesh&&Qe.instancingMorph===!1&&K.morphTexture!==null||Qe.envMap!==Xe||oe.fog===!0&&Qe.fog!==Ee||Qe.numClippingPlanes!==void 0&&(Qe.numClippingPlanes!==Me.numPlanes||Qe.numIntersection!==Me.numIntersection)||Qe.vertexAlphas!==ct||Qe.vertexTangents!==_t||Qe.morphTargets!==Ke||Qe.morphNormals!==Ut||Qe.morphColors!==Jt||Qe.toneMapping!==on||Qe.morphTargetsCount!==Wt)&&(qt=!0):(qt=!0,Qe.__version=oe.version);let Rr=Qe.currentProgram;qt===!0&&(Rr=Ue(oe,H,K));let Ic=!1,Hi=!1,Fh=!1;const an=Rr.getUniforms(),Yr=Qe.uniforms;if(Je.useProgram(Rr.program)&&(Ic=!0,Hi=!0,Fh=!0),oe.id!==M&&(M=oe.id,Hi=!0),Ic||S!==D){Je.buffers.depth.getReversed()?(J.copy(D.projectionMatrix),dI(J),fI(J),an.setValue(q,"projectionMatrix",J)):an.setValue(q,"projectionMatrix",D.projectionMatrix),an.setValue(q,"viewMatrix",D.matrixWorldInverse);const zo=an.map.cameraPosition;zo!==void 0&&zo.setValue(q,be.setFromMatrixPosition(D.matrixWorld)),pt.logarithmicDepthBuffer&&an.setValue(q,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(oe.isMeshPhongMaterial||oe.isMeshToonMaterial||oe.isMeshLambertMaterial||oe.isMeshBasicMaterial||oe.isMeshStandardMaterial||oe.isShaderMaterial)&&an.setValue(q,"isOrthographic",D.isOrthographicCamera===!0),S!==D&&(S=D,Hi=!0,Fh=!0)}if(K.isSkinnedMesh){an.setOptional(q,K,"bindMatrix"),an.setOptional(q,K,"bindMatrixInverse");const ir=K.skeleton;ir&&(ir.boneTexture===null&&ir.computeBoneTexture(),an.setValue(q,"boneTexture",ir.boneTexture,B))}K.isBatchedMesh&&(an.setOptional(q,K,"batchingTexture"),an.setValue(q,"batchingTexture",K._matricesTexture,B),an.setOptional(q,K,"batchingIdTexture"),an.setValue(q,"batchingIdTexture",K._indirectTexture,B),an.setOptional(q,K,"batchingColorTexture"),K._colorsTexture!==null&&an.setValue(q,"batchingColorTexture",K._colorsTexture,B));const Uh=te.morphAttributes;if((Uh.position!==void 0||Uh.normal!==void 0||Uh.color!==void 0)&&st.update(K,te,Rr),(Hi||Qe.receiveShadow!==K.receiveShadow)&&(Qe.receiveShadow=K.receiveShadow,an.setValue(q,"receiveShadow",K.receiveShadow)),oe.isMeshGouraudMaterial&&oe.envMap!==null&&(Yr.envMap.value=Xe,Yr.flipEnvMap.value=Xe.isCubeTexture&&Xe.isRenderTargetTexture===!1?-1:1),oe.isMeshStandardMaterial&&oe.envMap===null&&H.environment!==null&&(Yr.envMapIntensity.value=H.environmentIntensity),Hi&&(an.setValue(q,"toneMappingExposure",v.toneMappingExposure),Qe.needsLights&&Rt(Yr,Fh),Ee&&oe.fog===!0&&Oe.refreshFogUniforms(Yr,Ee),Oe.refreshMaterialUniforms(Yr,oe,$,W,g.state.transmissionRenderTarget[D.id]),Rd.upload(q,lt(Qe),Yr,B)),oe.isShaderMaterial&&oe.uniformsNeedUpdate===!0&&(Rd.upload(q,lt(Qe),Yr,B),oe.uniformsNeedUpdate=!1),oe.isSpriteMaterial&&an.setValue(q,"center",K.center),an.setValue(q,"modelViewMatrix",K.modelViewMatrix),an.setValue(q,"normalMatrix",K.normalMatrix),an.setValue(q,"modelMatrix",K.matrixWorld),oe.isShaderMaterial||oe.isRawShaderMaterial){const ir=oe.uniformsGroups;for(let zo=0,Go=ir.length;zo<Go;zo++){const hN=ir[zo];Y.update(hN,Rr),Y.bind(hN,Rr)}}return Rr}function Rt(D,H){D.ambientLightColor.needsUpdate=H,D.lightProbe.needsUpdate=H,D.directionalLights.needsUpdate=H,D.directionalLightShadows.needsUpdate=H,D.pointLights.needsUpdate=H,D.pointLightShadows.needsUpdate=H,D.spotLights.needsUpdate=H,D.spotLightShadows.needsUpdate=H,D.rectAreaLights.needsUpdate=H,D.hemisphereLights.needsUpdate=H}function wt(D){return D.isMeshLambertMaterial||D.isMeshToonMaterial||D.isMeshPhongMaterial||D.isMeshStandardMaterial||D.isShadowMaterial||D.isShaderMaterial&&D.lights===!0}this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return E},this.getRenderTarget=function(){return A},this.setRenderTargetTextures=function(D,H,te){Ze.get(D.texture).__webglTexture=H,Ze.get(D.depthTexture).__webglTexture=te;const oe=Ze.get(D);oe.__hasExternalTextures=!0,oe.__autoAllocateDepthBuffer=te===void 0,oe.__autoAllocateDepthBuffer||at.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),oe.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(D,H){const te=Ze.get(D);te.__webglFramebuffer=H,te.__useDefaultFramebuffer=H===void 0},this.setRenderTarget=function(D,H=0,te=0){A=D,w=H,E=te;let oe=!0,K=null,Ee=!1,Ne=!1;if(D){const Xe=Ze.get(D);if(Xe.__useDefaultFramebuffer!==void 0)Je.bindFramebuffer(q.FRAMEBUFFER,null),oe=!1;else if(Xe.__webglFramebuffer===void 0)B.setupRenderTarget(D);else if(Xe.__hasExternalTextures)B.rebindTextures(D,Ze.get(D.texture).__webglTexture,Ze.get(D.depthTexture).__webglTexture);else if(D.depthBuffer){const Ke=D.depthTexture;if(Xe.__boundDepthTexture!==Ke){if(Ke!==null&&Ze.has(Ke)&&(D.width!==Ke.image.width||D.height!==Ke.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");B.setupDepthRenderbuffer(D)}}const ct=D.texture;(ct.isData3DTexture||ct.isDataArrayTexture||ct.isCompressedArrayTexture)&&(Ne=!0);const _t=Ze.get(D).__webglFramebuffer;D.isWebGLCubeRenderTarget?(Array.isArray(_t[H])?K=_t[H][te]:K=_t[H],Ee=!0):D.samples>0&&B.useMultisampledRTT(D)===!1?K=Ze.get(D).__webglMultisampledFramebuffer:Array.isArray(_t)?K=_t[te]:K=_t,R.copy(D.viewport),O.copy(D.scissor),P=D.scissorTest}else R.copy(k).multiplyScalar($).floor(),O.copy(re).multiplyScalar($).floor(),P=he;if(Je.bindFramebuffer(q.FRAMEBUFFER,K)&&oe&&Je.drawBuffers(D,K),Je.viewport(R),Je.scissor(O),Je.setScissorTest(P),Ee){const Xe=Ze.get(D.texture);q.framebufferTexture2D(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_CUBE_MAP_POSITIVE_X+H,Xe.__webglTexture,te)}else if(Ne){const Xe=Ze.get(D.texture),ct=H||0;q.framebufferTextureLayer(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,Xe.__webglTexture,te||0,ct)}M=-1},this.readRenderTargetPixels=function(D,H,te,oe,K,Ee,Ne){if(!(D&&D.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let We=Ze.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Ne!==void 0&&(We=We[Ne]),We){Je.bindFramebuffer(q.FRAMEBUFFER,We);try{const Xe=D.texture,ct=Xe.format,_t=Xe.type;if(!pt.textureFormatReadable(ct)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!pt.textureTypeReadable(_t)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}H>=0&&H<=D.width-oe&&te>=0&&te<=D.height-K&&q.readPixels(H,te,oe,K,yt.convert(ct),yt.convert(_t),Ee)}finally{const Xe=A!==null?Ze.get(A).__webglFramebuffer:null;Je.bindFramebuffer(q.FRAMEBUFFER,Xe)}}},this.readRenderTargetPixelsAsync=async function(D,H,te,oe,K,Ee,Ne){if(!(D&&D.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let We=Ze.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Ne!==void 0&&(We=We[Ne]),We){const Xe=D.texture,ct=Xe.format,_t=Xe.type;if(!pt.textureFormatReadable(ct))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!pt.textureTypeReadable(_t))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(H>=0&&H<=D.width-oe&&te>=0&&te<=D.height-K){Je.bindFramebuffer(q.FRAMEBUFFER,We);const Ke=q.createBuffer();q.bindBuffer(q.PIXEL_PACK_BUFFER,Ke),q.bufferData(q.PIXEL_PACK_BUFFER,Ee.byteLength,q.STREAM_READ),q.readPixels(H,te,oe,K,yt.convert(ct),yt.convert(_t),0);const Ut=A!==null?Ze.get(A).__webglFramebuffer:null;Je.bindFramebuffer(q.FRAMEBUFFER,Ut);const Jt=q.fenceSync(q.SYNC_GPU_COMMANDS_COMPLETE,0);return q.flush(),await hI(q,Jt,4),q.bindBuffer(q.PIXEL_PACK_BUFFER,Ke),q.getBufferSubData(q.PIXEL_PACK_BUFFER,0,Ee),q.deleteBuffer(Ke),q.deleteSync(Jt),Ee}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(D,H=null,te=0){D.isTexture!==!0&&(Wc("WebGLRenderer: copyFramebufferToTexture function signature has changed."),H=arguments[0]||null,D=arguments[1]);const oe=Math.pow(2,-te),K=Math.floor(D.image.width*oe),Ee=Math.floor(D.image.height*oe),Ne=H!==null?H.x:0,We=H!==null?H.y:0;B.setTexture2D(D,0),q.copyTexSubImage2D(q.TEXTURE_2D,te,0,0,Ne,We,K,Ee),Je.unbindTexture()},this.copyTextureToTexture=function(D,H,te=null,oe=null,K=0){D.isTexture!==!0&&(Wc("WebGLRenderer: copyTextureToTexture function signature has changed."),oe=arguments[0]||null,D=arguments[1],H=arguments[2],K=arguments[3]||0,te=null);let Ee,Ne,We,Xe,ct,_t,Ke,Ut,Jt;const on=D.isCompressedTexture?D.mipmaps[K]:D.image;te!==null?(Ee=te.max.x-te.min.x,Ne=te.max.y-te.min.y,We=te.isBox3?te.max.z-te.min.z:1,Xe=te.min.x,ct=te.min.y,_t=te.isBox3?te.min.z:0):(Ee=on.width,Ne=on.height,We=on.depth||1,Xe=0,ct=0,_t=0),oe!==null?(Ke=oe.x,Ut=oe.y,Jt=oe.z):(Ke=0,Ut=0,Jt=0);const Ci=yt.convert(H.format),Wt=yt.convert(H.type);let Qe;H.isData3DTexture?(B.setTexture3D(H,0),Qe=q.TEXTURE_3D):H.isDataArrayTexture||H.isCompressedArrayTexture?(B.setTexture2DArray(H,0),Qe=q.TEXTURE_2D_ARRAY):(B.setTexture2D(H,0),Qe=q.TEXTURE_2D),q.pixelStorei(q.UNPACK_FLIP_Y_WEBGL,H.flipY),q.pixelStorei(q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,H.premultiplyAlpha),q.pixelStorei(q.UNPACK_ALIGNMENT,H.unpackAlignment);const Ys=q.getParameter(q.UNPACK_ROW_LENGTH),qt=q.getParameter(q.UNPACK_IMAGE_HEIGHT),Rr=q.getParameter(q.UNPACK_SKIP_PIXELS),Ic=q.getParameter(q.UNPACK_SKIP_ROWS),Hi=q.getParameter(q.UNPACK_SKIP_IMAGES);q.pixelStorei(q.UNPACK_ROW_LENGTH,on.width),q.pixelStorei(q.UNPACK_IMAGE_HEIGHT,on.height),q.pixelStorei(q.UNPACK_SKIP_PIXELS,Xe),q.pixelStorei(q.UNPACK_SKIP_ROWS,ct),q.pixelStorei(q.UNPACK_SKIP_IMAGES,_t);const Fh=D.isDataArrayTexture||D.isData3DTexture,an=H.isDataArrayTexture||H.isData3DTexture;if(D.isRenderTargetTexture||D.isDepthTexture){const Yr=Ze.get(D),Uh=Ze.get(H),ir=Ze.get(Yr.__renderTarget),zo=Ze.get(Uh.__renderTarget);Je.bindFramebuffer(q.READ_FRAMEBUFFER,ir.__webglFramebuffer),Je.bindFramebuffer(q.DRAW_FRAMEBUFFER,zo.__webglFramebuffer);for(let Go=0;Go<We;Go++)Fh&&q.framebufferTextureLayer(q.READ_FRAMEBUFFER,q.COLOR_ATTACHMENT0,Ze.get(D).__webglTexture,K,_t+Go),D.isDepthTexture?(an&&q.framebufferTextureLayer(q.DRAW_FRAMEBUFFER,q.COLOR_ATTACHMENT0,Ze.get(H).__webglTexture,K,Jt+Go),q.blitFramebuffer(Xe,ct,Ee,Ne,Ke,Ut,Ee,Ne,q.DEPTH_BUFFER_BIT,q.NEAREST)):an?q.copyTexSubImage3D(Qe,K,Ke,Ut,Jt+Go,Xe,ct,Ee,Ne):q.copyTexSubImage2D(Qe,K,Ke,Ut,Jt+Go,Xe,ct,Ee,Ne);Je.bindFramebuffer(q.READ_FRAMEBUFFER,null),Je.bindFramebuffer(q.DRAW_FRAMEBUFFER,null)}else an?D.isDataTexture||D.isData3DTexture?q.texSubImage3D(Qe,K,Ke,Ut,Jt,Ee,Ne,We,Ci,Wt,on.data):H.isCompressedArrayTexture?q.compressedTexSubImage3D(Qe,K,Ke,Ut,Jt,Ee,Ne,We,Ci,on.data):q.texSubImage3D(Qe,K,Ke,Ut,Jt,Ee,Ne,We,Ci,Wt,on):D.isDataTexture?q.texSubImage2D(q.TEXTURE_2D,K,Ke,Ut,Ee,Ne,Ci,Wt,on.data):D.isCompressedTexture?q.compressedTexSubImage2D(q.TEXTURE_2D,K,Ke,Ut,on.width,on.height,Ci,on.data):q.texSubImage2D(q.TEXTURE_2D,K,Ke,Ut,Ee,Ne,Ci,Wt,on);q.pixelStorei(q.UNPACK_ROW_LENGTH,Ys),q.pixelStorei(q.UNPACK_IMAGE_HEIGHT,qt),q.pixelStorei(q.UNPACK_SKIP_PIXELS,Rr),q.pixelStorei(q.UNPACK_SKIP_ROWS,Ic),q.pixelStorei(q.UNPACK_SKIP_IMAGES,Hi),K===0&&H.generateMipmaps&&q.generateMipmap(Qe),Je.unbindTexture()},this.copyTextureToTexture3D=function(D,H,te=null,oe=null,K=0){return D.isTexture!==!0&&(Wc("WebGLRenderer: copyTextureToTexture3D function signature has changed."),te=arguments[0]||null,oe=arguments[1]||null,D=arguments[2],H=arguments[3],K=arguments[4]||0),Wc('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(D,H,te,oe,K)},this.initRenderTarget=function(D){Ze.get(D).__webglFramebuffer===void 0&&B.setupRenderTarget(D)},this.initTexture=function(D){D.isCubeTexture?B.setTextureCube(D,0):D.isData3DTexture?B.setTexture3D(D,0):D.isDataArrayTexture||D.isCompressedArrayTexture?B.setTexture2DArray(D,0):B.setTexture2D(D,0),Je.unbindTexture()},this.resetState=function(){w=0,E=0,A=null,Je.reset(),Ht.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return is}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorspace=Dt._getDrawingBufferColorSpace(e),n.unpackColorSpace=Dt._getUnpackColorSpace()}}let VF=class extends gi{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new so,this.environmentIntensity=1,this.environmentRotation=new so,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}},$F=class{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=zg,this.updateRanges=[],this.version=0,this.uuid=rs()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,n,i){e*=this.stride,i*=n.stride;for(let s=0,o=this.stride;s<o;s++)this.array[e+s]=n.array[i+s];return this}set(e,n=0){return this.array.set(e,n),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=rs()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const n=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(n,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=rs()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}};const oi=new V;let I1=class vN{constructor(e,n,i,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=n,this.offset=i,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let n=0,i=this.data.count;n<i;n++)oi.fromBufferAttribute(this,n),oi.applyMatrix4(e),this.setXYZ(n,oi.x,oi.y,oi.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)oi.fromBufferAttribute(this,n),oi.applyNormalMatrix(e),this.setXYZ(n,oi.x,oi.y,oi.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)oi.fromBufferAttribute(this,n),oi.transformDirection(e),this.setXYZ(n,oi.x,oi.y,oi.z);return this}getComponent(e,n){let i=this.array[e*this.data.stride+this.offset+n];return this.normalized&&(i=ar(i,this.array)),i}setComponent(e,n,i){return this.normalized&&(i=Xt(i,this.array)),this.data.array[e*this.data.stride+this.offset+n]=i,this}setX(e,n){return this.normalized&&(n=Xt(n,this.array)),this.data.array[e*this.data.stride+this.offset]=n,this}setY(e,n){return this.normalized&&(n=Xt(n,this.array)),this.data.array[e*this.data.stride+this.offset+1]=n,this}setZ(e,n){return this.normalized&&(n=Xt(n,this.array)),this.data.array[e*this.data.stride+this.offset+2]=n,this}setW(e,n){return this.normalized&&(n=Xt(n,this.array)),this.data.array[e*this.data.stride+this.offset+3]=n,this}getX(e){let n=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(n=ar(n,this.array)),n}getY(e){let n=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(n=ar(n,this.array)),n}getZ(e){let n=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(n=ar(n,this.array)),n}getW(e){let n=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(n=ar(n,this.array)),n}setXY(e,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(n=Xt(n,this.array),i=Xt(i,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=i,this}setXYZ(e,n,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(n=Xt(n,this.array),i=Xt(i,this.array),s=Xt(s,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=i,this.data.array[e+2]=s,this}setXYZW(e,n,i,s,o){return e=e*this.data.stride+this.offset,this.normalized&&(n=Xt(n,this.array),i=Xt(i,this.array),s=Xt(s,this.array),o=Xt(o,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=i,this.data.array[e+2]=s,this.data.array[e+3]=o,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let i=0;i<this.count;i++){const s=i*this.data.stride+this.offset;for(let o=0;o<this.itemSize;o++)n.push(this.data.array[s+o])}return new Wi(new this.array.constructor(n),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new vN(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let i=0;i<this.count;i++){const s=i*this.data.stride+this.offset;for(let o=0;o<this.itemSize;o++)n.push(this.data.array[s+o])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:n,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},L1=class extends ia{static get type(){return"SpriteMaterial"}constructor(e){super(),this.isSpriteMaterial=!0,this.color=new Et(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},bl;const Jc=new V,Sl=new V,Tl=new V,wl=new Pe,eu=new Pe,O1=new tn,Pd=new V,tu=new V,Dd=new V,F1=new Pe,S0=new Pe,U1=new Pe;class jF extends gi{constructor(e=new L1){if(super(),this.isSprite=!0,this.type="Sprite",bl===void 0){bl=new Di;const n=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new $F(n,5);bl.setIndex([0,1,2,0,2,3]),bl.setAttribute("position",new I1(i,3,0,!1)),bl.setAttribute("uv",new I1(i,2,3,!1))}this.geometry=bl,this.material=e,this.center=new Pe(.5,.5)}raycast(e,n){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Sl.setFromMatrixScale(this.matrixWorld),O1.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Tl.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Sl.multiplyScalar(-Tl.z);const i=this.material.rotation;let s,o;i!==0&&(o=Math.cos(i),s=Math.sin(i));const a=this.center;Id(Pd.set(-.5,-.5,0),Tl,a,Sl,s,o),Id(tu.set(.5,-.5,0),Tl,a,Sl,s,o),Id(Dd.set(.5,.5,0),Tl,a,Sl,s,o),F1.set(0,0),S0.set(1,0),U1.set(1,1);let l=e.ray.intersectTriangle(Pd,tu,Dd,!1,Jc);if(l===null&&(Id(tu.set(-.5,.5,0),Tl,a,Sl,s,o),S0.set(0,1),l=e.ray.intersectTriangle(Pd,Dd,tu,!1,Jc),l===null))return;const c=e.ray.origin.distanceTo(Jc);c<e.near||c>e.far||n.push({distance:c,point:Jc.clone(),uv:fl.getInterpolation(Jc,Pd,tu,Dd,F1,S0,U1,new Pe),face:null,object:this})}copy(e,n){return super.copy(e,n),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Id(r,e,n,i,s,o){wl.subVectors(r,n).addScalar(.5).multiply(i),s!==void 0?(eu.x=o*wl.x-s*wl.y,eu.y=s*wl.x+o*wl.y):eu.copy(wl),r.copy(e),r.x+=eu.x,r.y+=eu.y,r.applyMatrix4(O1)}let B1=class extends ia{static get type(){return"LineBasicMaterial"}constructor(e){super(),this.isLineBasicMaterial=!0,this.color=new Et(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}};const Ld=new V,Od=new V,k1=new tn,nu=new dd,Fd=new cd,T0=new V,z1=new V;class HF extends gi{constructor(e=new Di,n=new B1){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[0];for(let s=1,o=n.count;s<o;s++)Ld.fromBufferAttribute(n,s-1),Od.fromBufferAttribute(n,s),i[s]=i[s-1],i[s]+=Ld.distanceTo(Od);e.setAttribute("lineDistance",new yn(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,n){const i=this.geometry,s=this.matrixWorld,o=e.params.Line.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Fd.copy(i.boundingSphere),Fd.applyMatrix4(s),Fd.radius+=o,e.ray.intersectsSphere(Fd)===!1)return;k1.copy(s).invert(),nu.copy(e.ray).applyMatrix4(k1);const l=o/((this.scale.x+this.scale.y+this.scale.z)/3),c=l*l,u=this.isLineSegments?2:1,h=i.index,f=i.attributes.position;if(h!==null){const p=Math.max(0,a.start),m=Math.min(h.count,a.start+a.count);for(let _=p,y=m-1;_<y;_+=u){const g=h.getX(_),x=h.getX(_+1),b=Ud(this,e,nu,c,g,x);b&&n.push(b)}if(this.isLineLoop){const _=h.getX(m-1),y=h.getX(p),g=Ud(this,e,nu,c,_,y);g&&n.push(g)}}else{const p=Math.max(0,a.start),m=Math.min(f.count,a.start+a.count);for(let _=p,y=m-1;_<y;_+=u){const g=Ud(this,e,nu,c,_,_+1);g&&n.push(g)}if(this.isLineLoop){const _=Ud(this,e,nu,c,m-1,p);_&&n.push(_)}}}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const s=n[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,a=s.length;o<a;o++){const l=s[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=o}}}}}function Ud(r,e,n,i,s,o){const a=r.geometry.attributes.position;if(Ld.fromBufferAttribute(a,s),Od.fromBufferAttribute(a,o),n.distanceSqToSegment(Ld,Od,T0,z1)>i)return;T0.applyMatrix4(r.matrixWorld);const c=e.ray.origin.distanceTo(T0);if(!(c<e.near||c>e.far))return{distance:c,point:z1.clone().applyMatrix4(r.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:r}}class WF extends Ri{constructor(e,n,i,s,o,a,l,c,u){super(e,n,i,s,o,a,l,c,u),this.isCanvasTexture=!0,this.needsUpdate=!0}}class ds{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,n){const i=this.getUtoTmapping(e);return this.getPoint(i,n)}getPoints(e=5){const n=[];for(let i=0;i<=e;i++)n.push(this.getPoint(i/e));return n}getSpacedPoints(e=5){const n=[];for(let i=0;i<=e;i++)n.push(this.getPointAt(i/e));return n}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let i,s=this.getPoint(0),o=0;n.push(0);for(let a=1;a<=e;a++)i=this.getPoint(a/e),o+=i.distanceTo(s),n.push(o),s=i;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n){const i=this.getLengths();let s=0;const o=i.length;let a;n?a=n:a=e*i[o-1];let l=0,c=o-1,u;for(;l<=c;)if(s=Math.floor(l+(c-l)/2),u=i[s]-a,u<0)l=s+1;else if(u>0)c=s-1;else{c=s;break}if(s=c,i[s]===a)return s/(o-1);const h=i[s],f=i[s+1]-h,p=(a-h)/f;return(s+p)/(o-1)}getTangent(e,n){let s=e-1e-4,o=e+1e-4;s<0&&(s=0),o>1&&(o=1);const a=this.getPoint(s),l=this.getPoint(o),c=n||(a.isVector2?new Pe:new V);return c.copy(l).sub(a).normalize(),c}getTangentAt(e,n){const i=this.getUtoTmapping(e);return this.getTangent(i,n)}computeFrenetFrames(e,n){const i=new V,s=[],o=[],a=[],l=new V,c=new tn;for(let p=0;p<=e;p++){const m=p/e;s[p]=this.getTangentAt(m,new V)}o[0]=new V,a[0]=new V;let u=Number.MAX_VALUE;const h=Math.abs(s[0].x),d=Math.abs(s[0].y),f=Math.abs(s[0].z);h<=u&&(u=h,i.set(1,0,0)),d<=u&&(u=d,i.set(0,1,0)),f<=u&&i.set(0,0,1),l.crossVectors(s[0],i).normalize(),o[0].crossVectors(s[0],l),a[0].crossVectors(s[0],o[0]);for(let p=1;p<=e;p++){if(o[p]=o[p-1].clone(),a[p]=a[p-1].clone(),l.crossVectors(s[p-1],s[p]),l.length()>Number.EPSILON){l.normalize();const m=Math.acos(Un(s[p-1].dot(s[p]),-1,1));o[p].applyMatrix4(c.makeRotationAxis(l,m))}a[p].crossVectors(s[p],o[p])}if(n===!0){let p=Math.acos(Un(o[0].dot(o[e]),-1,1));p/=e,s[0].dot(l.crossVectors(o[0],o[e]))>0&&(p=-p);for(let m=1;m<=e;m++)o[m].applyMatrix4(c.makeRotationAxis(s[m],p*m)),a[m].crossVectors(s[m],o[m])}return{tangents:s,normals:o,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class G1 extends ds{constructor(e=0,n=0,i=1,s=1,o=0,a=Math.PI*2,l=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=n,this.xRadius=i,this.yRadius=s,this.aStartAngle=o,this.aEndAngle=a,this.aClockwise=l,this.aRotation=c}getPoint(e,n=new Pe){const i=n,s=Math.PI*2;let o=this.aEndAngle-this.aStartAngle;const a=Math.abs(o)<Number.EPSILON;for(;o<0;)o+=s;for(;o>s;)o-=s;o<Number.EPSILON&&(a?o=0:o=s),this.aClockwise===!0&&!a&&(o===s?o=-s:o=o-s);const l=this.aStartAngle+e*o;let c=this.aX+this.xRadius*Math.cos(l),u=this.aY+this.yRadius*Math.sin(l);if(this.aRotation!==0){const h=Math.cos(this.aRotation),d=Math.sin(this.aRotation),f=c-this.aX,p=u-this.aY;c=f*h-p*d+this.aX,u=f*d+p*h+this.aY}return i.set(c,u)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class qF extends G1{constructor(e,n,i,s,o,a){super(e,n,i,i,s,o,a),this.isArcCurve=!0,this.type="ArcCurve"}}function w0(){let r=0,e=0,n=0,i=0;function s(o,a,l,c){r=o,e=l,n=-3*o+3*a-2*l-c,i=2*o-2*a+l+c}return{initCatmullRom:function(o,a,l,c,u){s(a,l,u*(l-o),u*(c-a))},initNonuniformCatmullRom:function(o,a,l,c,u,h,d){let f=(a-o)/u-(l-o)/(u+h)+(l-a)/h,p=(l-a)/h-(c-a)/(h+d)+(c-l)/d;f*=h,p*=h,s(a,l,f,p)},calc:function(o){const a=o*o,l=a*o;return r+e*o+n*a+i*l}}}const Bd=new V,M0=new w0,E0=new w0,A0=new w0;class XF extends ds{constructor(e=[],n=!1,i="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=n,this.curveType=i,this.tension=s}getPoint(e,n=new V){const i=n,s=this.points,o=s.length,a=(o-(this.closed?0:1))*e;let l=Math.floor(a),c=a-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/o)+1)*o:c===0&&l===o-1&&(l=o-2,c=1);let u,h;this.closed||l>0?u=s[(l-1)%o]:(Bd.subVectors(s[0],s[1]).add(s[0]),u=Bd);const d=s[l%o],f=s[(l+1)%o];if(this.closed||l+2<o?h=s[(l+2)%o]:(Bd.subVectors(s[o-1],s[o-2]).add(s[o-1]),h=Bd),this.curveType==="centripetal"||this.curveType==="chordal"){const p=this.curveType==="chordal"?.5:.25;let m=Math.pow(u.distanceToSquared(d),p),_=Math.pow(d.distanceToSquared(f),p),y=Math.pow(f.distanceToSquared(h),p);_<1e-4&&(_=1),m<1e-4&&(m=_),y<1e-4&&(y=_),M0.initNonuniformCatmullRom(u.x,d.x,f.x,h.x,m,_,y),E0.initNonuniformCatmullRom(u.y,d.y,f.y,h.y,m,_,y),A0.initNonuniformCatmullRom(u.z,d.z,f.z,h.z,m,_,y)}else this.curveType==="catmullrom"&&(M0.initCatmullRom(u.x,d.x,f.x,h.x,this.tension),E0.initCatmullRom(u.y,d.y,f.y,h.y,this.tension),A0.initCatmullRom(u.z,d.z,f.z,h.z,this.tension));return i.set(M0.calc(c),E0.calc(c),A0.calc(c)),i}copy(e){super.copy(e),this.points=[];for(let n=0,i=e.points.length;n<i;n++){const s=e.points[n];this.points.push(s.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let n=0,i=this.points.length;n<i;n++){const s=this.points[n];e.points.push(s.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let n=0,i=e.points.length;n<i;n++){const s=e.points[n];this.points.push(new V().fromArray(s))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function V1(r,e,n,i,s){const o=(i-e)*.5,a=(s-n)*.5,l=r*r,c=r*l;return(2*n-2*i+o+a)*c+(-3*n+3*i-2*o-a)*l+o*r+n}function YF(r,e){const n=1-r;return n*n*e}function KF(r,e){return 2*(1-r)*r*e}function ZF(r,e){return r*r*e}function iu(r,e,n,i){return YF(r,e)+KF(r,n)+ZF(r,i)}function QF(r,e){const n=1-r;return n*n*n*e}function JF(r,e){const n=1-r;return 3*n*n*r*e}function eU(r,e){return 3*(1-r)*r*r*e}function tU(r,e){return r*r*r*e}function ru(r,e,n,i,s){return QF(r,e)+JF(r,n)+eU(r,i)+tU(r,s)}class nU extends ds{constructor(e=new Pe,n=new Pe,i=new Pe,s=new Pe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=n,this.v2=i,this.v3=s}getPoint(e,n=new Pe){const i=n,s=this.v0,o=this.v1,a=this.v2,l=this.v3;return i.set(ru(e,s.x,o.x,a.x,l.x),ru(e,s.y,o.y,a.y,l.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class $1 extends ds{constructor(e=new V,n=new V,i=new V,s=new V){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=n,this.v2=i,this.v3=s}getPoint(e,n=new V){const i=n,s=this.v0,o=this.v1,a=this.v2,l=this.v3;return i.set(ru(e,s.x,o.x,a.x,l.x),ru(e,s.y,o.y,a.y,l.y),ru(e,s.z,o.z,a.z,l.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class iU extends ds{constructor(e=new Pe,n=new Pe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=n}getPoint(e,n=new Pe){const i=n;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,n){return this.getPoint(e,n)}getTangent(e,n=new Pe){return n.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,n){return this.getTangent(e,n)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class rU extends ds{constructor(e=new V,n=new V){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=n}getPoint(e,n=new V){const i=n;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,n){return this.getPoint(e,n)}getTangent(e,n=new V){return n.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,n){return this.getTangent(e,n)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class sU extends ds{constructor(e=new Pe,n=new Pe,i=new Pe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=n,this.v2=i}getPoint(e,n=new Pe){const i=n,s=this.v0,o=this.v1,a=this.v2;return i.set(iu(e,s.x,o.x,a.x),iu(e,s.y,o.y,a.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class C0 extends ds{constructor(e=new V,n=new V,i=new V){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=n,this.v2=i}getPoint(e,n=new V){const i=n,s=this.v0,o=this.v1,a=this.v2;return i.set(iu(e,s.x,o.x,a.x),iu(e,s.y,o.y,a.y),iu(e,s.z,o.z,a.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class oU extends ds{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,n=new Pe){const i=n,s=this.points,o=(s.length-1)*e,a=Math.floor(o),l=o-a,c=s[a===0?a:a-1],u=s[a],h=s[a>s.length-2?s.length-1:a+1],d=s[a>s.length-3?s.length-1:a+2];return i.set(V1(l,c.x,u.x,h.x,d.x),V1(l,c.y,u.y,h.y,d.y)),i}copy(e){super.copy(e),this.points=[];for(let n=0,i=e.points.length;n<i;n++){const s=e.points[n];this.points.push(s.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let n=0,i=this.points.length;n<i;n++){const s=this.points[n];e.points.push(s.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let n=0,i=e.points.length;n<i;n++){const s=e.points[n];this.points.push(new Pe().fromArray(s))}return this}}var aU=Object.freeze({__proto__:null,ArcCurve:qF,CatmullRomCurve3:XF,CubicBezierCurve:nU,CubicBezierCurve3:$1,EllipseCurve:G1,LineCurve:iU,LineCurve3:rU,QuadraticBezierCurve:sU,QuadraticBezierCurve3:C0,SplineCurve:oU});class R0 extends Di{constructor(e=1,n=32,i=0,s=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:n,thetaStart:i,thetaLength:s},n=Math.max(3,n);const o=[],a=[],l=[],c=[],u=new V,h=new Pe;a.push(0,0,0),l.push(0,0,1),c.push(.5,.5);for(let d=0,f=3;d<=n;d++,f+=3){const p=i+d/n*s;u.x=e*Math.cos(p),u.y=e*Math.sin(p),a.push(u.x,u.y,u.z),l.push(0,0,1),h.x=(a[f]/e+1)/2,h.y=(a[f+1]/e+1)/2,c.push(h.x,h.y)}for(let d=1;d<=n;d++)o.push(d,d+1,0);this.setIndex(o),this.setAttribute("position",new yn(a,3)),this.setAttribute("normal",new yn(l,3)),this.setAttribute("uv",new yn(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new R0(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class kd extends Di{constructor(e=1,n=1,i=1,s=32,o=1,a=!1,l=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:n,height:i,radialSegments:s,heightSegments:o,openEnded:a,thetaStart:l,thetaLength:c};const u=this;s=Math.floor(s),o=Math.floor(o);const h=[],d=[],f=[],p=[];let m=0;const _=[],y=i/2;let g=0;x(),a===!1&&(e>0&&b(!0),n>0&&b(!1)),this.setIndex(h),this.setAttribute("position",new yn(d,3)),this.setAttribute("normal",new yn(f,3)),this.setAttribute("uv",new yn(p,2));function x(){const v=new V,T=new V;let w=0;const E=(n-e)/i;for(let A=0;A<=o;A++){const M=[],S=A/o,R=S*(n-e)+e;for(let O=0;O<=s;O++){const P=O/s,C=P*c+l,I=Math.sin(C),L=Math.cos(C);T.x=R*I,T.y=-S*i+y,T.z=R*L,d.push(T.x,T.y,T.z),v.set(I,E,L).normalize(),f.push(v.x,v.y,v.z),p.push(P,1-S),M.push(m++)}_.push(M)}for(let A=0;A<s;A++)for(let M=0;M<o;M++){const S=_[M][A],R=_[M+1][A],O=_[M+1][A+1],P=_[M][A+1];(e>0||M!==0)&&(h.push(S,R,P),w+=3),(n>0||M!==o-1)&&(h.push(R,O,P),w+=3)}u.addGroup(g,w,0),g+=w}function b(v){const T=m,w=new Pe,E=new V;let A=0;const M=v===!0?e:n,S=v===!0?1:-1;for(let O=1;O<=s;O++)d.push(0,y*S,0),f.push(0,S,0),p.push(.5,.5),m++;const R=m;for(let O=0;O<=s;O++){const C=O/s*c+l,I=Math.cos(C),L=Math.sin(C);E.x=M*L,E.y=y*S,E.z=M*I,d.push(E.x,E.y,E.z),f.push(0,S,0),w.x=I*.5+.5,w.y=L*.5*S+.5,p.push(w.x,w.y),m++}for(let O=0;O<s;O++){const P=T+O,C=R+O;v===!0?h.push(C,C+1,P):h.push(C+1,C,P),A+=3}u.addGroup(g,A,v===!0?1:2),g+=A}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new kd(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class N0 extends kd{constructor(e=1,n=1,i=32,s=1,o=!1,a=0,l=Math.PI*2){super(0,e,n,i,s,o,a,l),this.type="ConeGeometry",this.parameters={radius:e,height:n,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l}}static fromJSON(e){return new N0(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}let j1=class xN extends Di{constructor(e=1,n=32,i=16,s=0,o=Math.PI*2,a=0,l=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:n,heightSegments:i,phiStart:s,phiLength:o,thetaStart:a,thetaLength:l},n=Math.max(3,Math.floor(n)),i=Math.max(2,Math.floor(i));const c=Math.min(a+l,Math.PI);let u=0;const h=[],d=new V,f=new V,p=[],m=[],_=[],y=[];for(let g=0;g<=i;g++){const x=[],b=g/i;let v=0;g===0&&a===0?v=.5/n:g===i&&c===Math.PI&&(v=-.5/n);for(let T=0;T<=n;T++){const w=T/n;d.x=-e*Math.cos(s+w*o)*Math.sin(a+b*l),d.y=e*Math.cos(a+b*l),d.z=e*Math.sin(s+w*o)*Math.sin(a+b*l),m.push(d.x,d.y,d.z),f.copy(d).normalize(),_.push(f.x,f.y,f.z),y.push(w+v,1-b),x.push(u++)}h.push(x)}for(let g=0;g<i;g++)for(let x=0;x<n;x++){const b=h[g][x+1],v=h[g][x],T=h[g+1][x],w=h[g+1][x+1];(g!==0||a>0)&&p.push(b,v,w),(g!==i-1||c<Math.PI)&&p.push(v,T,w)}this.setIndex(p),this.setAttribute("position",new yn(m,3)),this.setAttribute("normal",new yn(_,3)),this.setAttribute("uv",new yn(y,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new xN(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};class P0 extends Di{constructor(e=new C0(new V(-1,-1,0),new V(-1,1,0),new V(1,1,0)),n=64,i=1,s=8,o=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:n,radius:i,radialSegments:s,closed:o};const a=e.computeFrenetFrames(n,o);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const l=new V,c=new V,u=new Pe;let h=new V;const d=[],f=[],p=[],m=[];_(),this.setIndex(m),this.setAttribute("position",new yn(d,3)),this.setAttribute("normal",new yn(f,3)),this.setAttribute("uv",new yn(p,2));function _(){for(let b=0;b<n;b++)y(b);y(o===!1?n:0),x(),g()}function y(b){h=e.getPointAt(b/n,h);const v=a.normals[b],T=a.binormals[b];for(let w=0;w<=s;w++){const E=w/s*Math.PI*2,A=Math.sin(E),M=-Math.cos(E);c.x=M*v.x+A*T.x,c.y=M*v.y+A*T.y,c.z=M*v.z+A*T.z,c.normalize(),f.push(c.x,c.y,c.z),l.x=h.x+i*c.x,l.y=h.y+i*c.y,l.z=h.z+i*c.z,d.push(l.x,l.y,l.z)}}function g(){for(let b=1;b<=n;b++)for(let v=1;v<=s;v++){const T=(s+1)*(b-1)+(v-1),w=(s+1)*b+(v-1),E=(s+1)*b+v,A=(s+1)*(b-1)+v;m.push(T,w,A),m.push(w,E,A)}}function x(){for(let b=0;b<=n;b++)for(let v=0;v<=s;v++)u.x=b/n,u.y=v/s,p.push(u.x,u.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new P0(new aU[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}let lU=class extends ia{static get type(){return"MeshLambertMaterial"}constructor(e){super(),this.isMeshLambertMaterial=!0,this.color=new Et(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Et(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bS,this.normalScale=new Pe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new so,this.combine=ng,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};const H1={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class cU{constructor(e,n,i){const s=this;let o=!1,a=0,l=0,c;const u=[];this.onStart=void 0,this.onLoad=e,this.onProgress=n,this.onError=i,this.itemStart=function(h){l++,o===!1&&s.onStart!==void 0&&s.onStart(h,a,l),o=!0},this.itemEnd=function(h){a++,s.onProgress!==void 0&&s.onProgress(h,a,l),a===l&&(o=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(h){s.onError!==void 0&&s.onError(h)},this.resolveURL=function(h){return c?c(h):h},this.setURLModifier=function(h){return c=h,this},this.addHandler=function(h,d){return u.push(h,d),this},this.removeHandler=function(h){const d=u.indexOf(h);return d!==-1&&u.splice(d,2),this},this.getHandler=function(h){for(let d=0,f=u.length;d<f;d+=2){const p=u[d],m=u[d+1];if(p.global&&(p.lastIndex=0),p.test(h))return m}return null}}}const uU=new cU;class D0{constructor(e){this.manager=e!==void 0?e:uU,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,n){const i=this;return new Promise(function(s,o){i.load(e,s,n,o)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}D0.DEFAULT_MATERIAL_NAME="__DEFAULT";class hU extends D0{constructor(e){super(e)}load(e,n,i,s){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,a=H1.get(e);if(a!==void 0)return o.manager.itemStart(e),setTimeout(function(){n&&n(a),o.manager.itemEnd(e)},0),a;const l=Hc("img");function c(){h(),H1.add(e,this),n&&n(this),o.manager.itemEnd(e)}function u(d){h(),s&&s(d),o.manager.itemError(e),o.manager.itemEnd(e)}function h(){l.removeEventListener("load",c,!1),l.removeEventListener("error",u,!1)}return l.addEventListener("load",c,!1),l.addEventListener("error",u,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(l.crossOrigin=this.crossOrigin),o.manager.itemStart(e),l.src=e,l}}class dU extends D0{constructor(e){super(e)}load(e,n,i,s){const o=new Ri,a=new hU(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(l){o.image=l,o.needsUpdate=!0,n!==void 0&&n(o)},i,s),o}}let W1=class extends gi{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new Et(e),this.intensity=n}dispose(){}copy(e,n){return super.copy(e,n),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const n=super.toJSON(e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,this.groundColor!==void 0&&(n.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(n.object.distance=this.distance),this.angle!==void 0&&(n.object.angle=this.angle),this.decay!==void 0&&(n.object.decay=this.decay),this.penumbra!==void 0&&(n.object.penumbra=this.penumbra),this.shadow!==void 0&&(n.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(n.object.target=this.target.uuid),n}};const I0=new tn,q1=new V,X1=new V;let fU=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Pe(512,512),this.map=null,this.mapPass=null,this.matrix=new tn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new h0,this._frameExtents=new Pe(1,1),this._viewportCount=1,this._viewports=[new Sn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,i=this.matrix;q1.setFromMatrixPosition(e.matrixWorld),n.position.copy(q1),X1.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(X1),n.updateMatrixWorld(),I0.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(I0),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(I0)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},pU=class extends fU{constructor(){super(new d0(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},mU=class extends W1{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(gi.DEFAULT_UP),this.updateMatrix(),this.target=new gi,this.shadow=new pU}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},gU=class extends W1{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}};class Y1{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=K1(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const n=K1();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function K1(){return performance.now()}const Z1=new tn;class Q1{constructor(e,n,i=0,s=1/0){this.ray=new dd(e,n),this.near=i,this.far=s,this.camera=null,this.layers=new Zg,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,n){this.ray.set(e,n)}setFromCamera(e,n){n.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(n.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(n).sub(this.ray.origin).normalize(),this.camera=n):n.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(n.near+n.far)/(n.near-n.far)).unproject(n),this.ray.direction.set(0,0,-1).transformDirection(n.matrixWorld),this.camera=n):console.error("THREE.Raycaster: Unsupported camera type: "+n.type)}setFromXRController(e){return Z1.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Z1),this}intersectObject(e,n=!0,i=[]){return L0(e,this,i,n),i.sort(J1),i}intersectObjects(e,n=!0,i=[]){for(let s=0,o=e.length;s<o;s++)L0(e[s],this,i,n);return i.sort(J1),i}}function J1(r,e){return r.distance-e.distance}function L0(r,e,n,i){let s=!0;if(r.layers.test(e.layers)&&r.raycast(e,n)===!1&&(s=!1),s===!0&&i===!0){const o=r.children;for(let a=0,l=o.length;a<l;a++)L0(o[a],e,n,!0)}}class eT{constructor(e=1,n=0,i=0){return this.radius=e,this.phi=n,this.theta=i,this}set(e,n,i){return this.radius=e,this.phi=n,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,i){return this.radius=Math.sqrt(e*e+n*n+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(Un(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class zd extends Jo{constructor(e,n=null){super(),this.object=e,this.domElement=n,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Kh}})),typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Kh);function tT(r,e,n){var i,s=1;r==null&&(r=0),e==null&&(e=0),n==null&&(n=0);function o(){var a,l=i.length,c,u=0,h=0,d=0;for(a=0;a<l;++a)c=i[a],u+=c.x||0,h+=c.y||0,d+=c.z||0;for(u=(u/l-r)*s,h=(h/l-e)*s,d=(d/l-n)*s,a=0;a<l;++a)c=i[a],u&&(c.x-=u),h&&(c.y-=h),d&&(c.z-=d)}return o.initialize=function(a){i=a},o.x=function(a){return arguments.length?(r=+a,o):r},o.y=function(a){return arguments.length?(e=+a,o):e},o.z=function(a){return arguments.length?(n=+a,o):n},o.strength=function(a){return arguments.length?(s=+a,o):s},o}function yU(r){const e=+this._x.call(null,r);return nT(this.cover(e),e,r)}function nT(r,e,n){if(isNaN(e))return r;var i,s=r._root,o={data:n},a=r._x0,l=r._x1,c,u,h,d,f;if(!s)return r._root=o,r;for(;s.length;)if((h=e>=(c=(a+l)/2))?a=c:l=c,i=s,!(s=s[d=+h]))return i[d]=o,r;if(u=+r._x.call(null,s.data),e===u)return o.next=s,i?i[d]=o:r._root=o,r;do i=i?i[d]=new Array(2):r._root=new Array(2),(h=e>=(c=(a+l)/2))?a=c:l=c;while((d=+h)==(f=+(u>=c)));return i[f]=s,i[d]=o,r}function _U(r){Array.isArray(r)||(r=Array.from(r));const e=r.length,n=new Float64Array(e);let i=1/0,s=-1/0;for(let o=0,a;o<e;++o)isNaN(a=+this._x.call(null,r[o]))||(n[o]=a,a<i&&(i=a),a>s&&(s=a));if(i>s)return this;this.cover(i).cover(s);for(let o=0;o<e;++o)nT(this,n[o],r[o]);return this}function vU(r){if(isNaN(r=+r))return this;var e=this._x0,n=this._x1;if(isNaN(e))n=(e=Math.floor(r))+1;else{for(var i=n-e||1,s=this._root,o,a;e>r||r>=n;)switch(a=+(r<e),o=new Array(2),o[a]=s,s=o,i*=2,a){case 0:n=e+i;break;case 1:e=n-i;break}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._x1=n,this}function xU(){var r=[];return this.visit(function(e){if(!e.length)do r.push(e.data);while(e=e.next)}),r}function bU(r){return arguments.length?this.cover(+r[0][0]).cover(+r[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function fs(r,e,n){this.node=r,this.x0=e,this.x1=n}function SU(r,e){var n,i=this._x0,s,o,a=this._x1,l=[],c=this._root,u,h;for(c&&l.push(new fs(c,i,a)),e==null?e=1/0:(i=r-e,a=r+e);u=l.pop();)if(!(!(c=u.node)||(s=u.x0)>a||(o=u.x1)<i))if(c.length){var d=(s+o)/2;l.push(new fs(c[1],d,o),new fs(c[0],s,d)),(h=+(r>=d))&&(u=l[l.length-1],l[l.length-1]=l[l.length-1-h],l[l.length-1-h]=u)}else{var f=Math.abs(r-+this._x.call(null,c.data));f<e&&(e=f,i=r-f,a=r+f,n=c.data)}return n}function TU(r){if(isNaN(c=+this._x.call(null,r)))return this;var e,n=this._root,i,s,o,a=this._x0,l=this._x1,c,u,h,d,f;if(!n)return this;if(n.length)for(;;){if((h=c>=(u=(a+l)/2))?a=u:l=u,e=n,!(n=n[d=+h]))return this;if(!n.length)break;e[d+1&1]&&(i=e,f=d)}for(;n.data!==r;)if(s=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,s?(o?s.next=o:delete s.next,this):e?(o?e[d]=o:delete e[d],(n=e[0]||e[1])&&n===(e[1]||e[0])&&!n.length&&(i?i[f]=n:this._root=n),this):(this._root=o,this)}function wU(r){for(var e=0,n=r.length;e<n;++e)this.remove(r[e]);return this}function MU(){return this._root}function EU(){var r=0;return this.visit(function(e){if(!e.length)do++r;while(e=e.next)}),r}function AU(r){var e=[],n,i=this._root,s,o,a;for(i&&e.push(new fs(i,this._x0,this._x1));n=e.pop();)if(!r(i=n.node,o=n.x0,a=n.x1)&&i.length){var l=(o+a)/2;(s=i[1])&&e.push(new fs(s,l,a)),(s=i[0])&&e.push(new fs(s,o,l))}return this}function CU(r){var e=[],n=[],i;for(this._root&&e.push(new fs(this._root,this._x0,this._x1));i=e.pop();){var s=i.node;if(s.length){var o,a=i.x0,l=i.x1,c=(a+l)/2;(o=s[0])&&e.push(new fs(o,a,c)),(o=s[1])&&e.push(new fs(o,c,l))}n.push(i)}for(;i=n.pop();)r(i.node,i.x0,i.x1);return this}function RU(r){return r[0]}function NU(r){return arguments.length?(this._x=r,this):this._x}function iT(r,e){var n=new O0(e??RU,NaN,NaN);return r==null?n:n.addAll(r)}function O0(r,e,n){this._x=r,this._x0=e,this._x1=n,this._root=void 0}function rT(r){for(var e={data:r.data},n=e;r=r.next;)n=n.next={data:r.data};return e}var _i=iT.prototype=O0.prototype;_i.copy=function(){var r=new O0(this._x,this._x0,this._x1),e=this._root,n,i;if(!e)return r;if(!e.length)return r._root=rT(e),r;for(n=[{source:e,target:r._root=new Array(2)}];e=n.pop();)for(var s=0;s<2;++s)(i=e.source[s])&&(i.length?n.push({source:i,target:e.target[s]=new Array(2)}):e.target[s]=rT(i));return r},_i.add=yU,_i.addAll=_U,_i.cover=vU,_i.data=xU,_i.extent=bU,_i.find=SU,_i.remove=TU,_i.removeAll=wU,_i.root=MU,_i.size=EU,_i.visit=AU,_i.visitAfter=CU,_i.x=NU;function PU(r){const e=+this._x.call(null,r),n=+this._y.call(null,r);return sT(this.cover(e,n),e,n,r)}function sT(r,e,n,i){if(isNaN(e)||isNaN(n))return r;var s,o=r._root,a={data:i},l=r._x0,c=r._y0,u=r._x1,h=r._y1,d,f,p,m,_,y,g,x;if(!o)return r._root=a,r;for(;o.length;)if((_=e>=(d=(l+u)/2))?l=d:u=d,(y=n>=(f=(c+h)/2))?c=f:h=f,s=o,!(o=o[g=y<<1|_]))return s[g]=a,r;if(p=+r._x.call(null,o.data),m=+r._y.call(null,o.data),e===p&&n===m)return a.next=o,s?s[g]=a:r._root=a,r;do s=s?s[g]=new Array(4):r._root=new Array(4),(_=e>=(d=(l+u)/2))?l=d:u=d,(y=n>=(f=(c+h)/2))?c=f:h=f;while((g=y<<1|_)===(x=(m>=f)<<1|p>=d));return s[x]=o,s[g]=a,r}function DU(r){var e,n,i=r.length,s,o,a=new Array(i),l=new Array(i),c=1/0,u=1/0,h=-1/0,d=-1/0;for(n=0;n<i;++n)isNaN(s=+this._x.call(null,e=r[n]))||isNaN(o=+this._y.call(null,e))||(a[n]=s,l[n]=o,s<c&&(c=s),s>h&&(h=s),o<u&&(u=o),o>d&&(d=o));if(c>h||u>d)return this;for(this.cover(c,u).cover(h,d),n=0;n<i;++n)sT(this,a[n],l[n],r[n]);return this}function IU(r,e){if(isNaN(r=+r)||isNaN(e=+e))return this;var n=this._x0,i=this._y0,s=this._x1,o=this._y1;if(isNaN(n))s=(n=Math.floor(r))+1,o=(i=Math.floor(e))+1;else{for(var a=s-n||1,l=this._root,c,u;n>r||r>=s||i>e||e>=o;)switch(u=(e<i)<<1|r<n,c=new Array(4),c[u]=l,l=c,a*=2,u){case 0:s=n+a,o=i+a;break;case 1:n=s-a,o=i+a;break;case 2:s=n+a,i=o-a;break;case 3:n=s-a,i=o-a;break}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=i,this._x1=s,this._y1=o,this}function LU(){var r=[];return this.visit(function(e){if(!e.length)do r.push(e.data);while(e=e.next)}),r}function OU(r){return arguments.length?this.cover(+r[0][0],+r[0][1]).cover(+r[1][0],+r[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function ai(r,e,n,i,s){this.node=r,this.x0=e,this.y0=n,this.x1=i,this.y1=s}function FU(r,e,n){var i,s=this._x0,o=this._y0,a,l,c,u,h=this._x1,d=this._y1,f=[],p=this._root,m,_;for(p&&f.push(new ai(p,s,o,h,d)),n==null?n=1/0:(s=r-n,o=e-n,h=r+n,d=e+n,n*=n);m=f.pop();)if(!(!(p=m.node)||(a=m.x0)>h||(l=m.y0)>d||(c=m.x1)<s||(u=m.y1)<o))if(p.length){var y=(a+c)/2,g=(l+u)/2;f.push(new ai(p[3],y,g,c,u),new ai(p[2],a,g,y,u),new ai(p[1],y,l,c,g),new ai(p[0],a,l,y,g)),(_=(e>=g)<<1|r>=y)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-_],f[f.length-1-_]=m)}else{var x=r-+this._x.call(null,p.data),b=e-+this._y.call(null,p.data),v=x*x+b*b;if(v<n){var T=Math.sqrt(n=v);s=r-T,o=e-T,h=r+T,d=e+T,i=p.data}}return i}function UU(r){if(isNaN(h=+this._x.call(null,r))||isNaN(d=+this._y.call(null,r)))return this;var e,n=this._root,i,s,o,a=this._x0,l=this._y0,c=this._x1,u=this._y1,h,d,f,p,m,_,y,g;if(!n)return this;if(n.length)for(;;){if((m=h>=(f=(a+c)/2))?a=f:c=f,(_=d>=(p=(l+u)/2))?l=p:u=p,e=n,!(n=n[y=_<<1|m]))return this;if(!n.length)break;(e[y+1&3]||e[y+2&3]||e[y+3&3])&&(i=e,g=y)}for(;n.data!==r;)if(s=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,s?(o?s.next=o:delete s.next,this):e?(o?e[y]=o:delete e[y],(n=e[0]||e[1]||e[2]||e[3])&&n===(e[3]||e[2]||e[1]||e[0])&&!n.length&&(i?i[g]=n:this._root=n),this):(this._root=o,this)}function BU(r){for(var e=0,n=r.length;e<n;++e)this.remove(r[e]);return this}function kU(){return this._root}function zU(){var r=0;return this.visit(function(e){if(!e.length)do++r;while(e=e.next)}),r}function GU(r){var e=[],n,i=this._root,s,o,a,l,c;for(i&&e.push(new ai(i,this._x0,this._y0,this._x1,this._y1));n=e.pop();)if(!r(i=n.node,o=n.x0,a=n.y0,l=n.x1,c=n.y1)&&i.length){var u=(o+l)/2,h=(a+c)/2;(s=i[3])&&e.push(new ai(s,u,h,l,c)),(s=i[2])&&e.push(new ai(s,o,h,u,c)),(s=i[1])&&e.push(new ai(s,u,a,l,h)),(s=i[0])&&e.push(new ai(s,o,a,u,h))}return this}function VU(r){var e=[],n=[],i;for(this._root&&e.push(new ai(this._root,this._x0,this._y0,this._x1,this._y1));i=e.pop();){var s=i.node;if(s.length){var o,a=i.x0,l=i.y0,c=i.x1,u=i.y1,h=(a+c)/2,d=(l+u)/2;(o=s[0])&&e.push(new ai(o,a,l,h,d)),(o=s[1])&&e.push(new ai(o,h,l,c,d)),(o=s[2])&&e.push(new ai(o,a,d,h,u)),(o=s[3])&&e.push(new ai(o,h,d,c,u))}n.push(i)}for(;i=n.pop();)r(i.node,i.x0,i.y0,i.x1,i.y1);return this}function $U(r){return r[0]}function jU(r){return arguments.length?(this._x=r,this):this._x}function HU(r){return r[1]}function WU(r){return arguments.length?(this._y=r,this):this._y}function oT(r,e,n){var i=new F0(e??$U,n??HU,NaN,NaN,NaN,NaN);return r==null?i:i.addAll(r)}function F0(r,e,n,i,s,o){this._x=r,this._y=e,this._x0=n,this._y0=i,this._x1=s,this._y1=o,this._root=void 0}function aT(r){for(var e={data:r.data},n=e;r=r.next;)n=n.next={data:r.data};return e}var li=oT.prototype=F0.prototype;li.copy=function(){var r=new F0(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,n,i;if(!e)return r;if(!e.length)return r._root=aT(e),r;for(n=[{source:e,target:r._root=new Array(4)}];e=n.pop();)for(var s=0;s<4;++s)(i=e.source[s])&&(i.length?n.push({source:i,target:e.target[s]=new Array(4)}):e.target[s]=aT(i));return r},li.add=PU,li.addAll=DU,li.cover=IU,li.data=LU,li.extent=OU,li.find=FU,li.remove=UU,li.removeAll=BU,li.root=kU,li.size=zU,li.visit=GU,li.visitAfter=VU,li.x=jU,li.y=WU;function qU(r){const e=+this._x.call(null,r),n=+this._y.call(null,r),i=+this._z.call(null,r);return lT(this.cover(e,n,i),e,n,i,r)}function lT(r,e,n,i,s){if(isNaN(e)||isNaN(n)||isNaN(i))return r;var o,a=r._root,l={data:s},c=r._x0,u=r._y0,h=r._z0,d=r._x1,f=r._y1,p=r._z1,m,_,y,g,x,b,v,T,w,E,A;if(!a)return r._root=l,r;for(;a.length;)if((v=e>=(m=(c+d)/2))?c=m:d=m,(T=n>=(_=(u+f)/2))?u=_:f=_,(w=i>=(y=(h+p)/2))?h=y:p=y,o=a,!(a=a[E=w<<2|T<<1|v]))return o[E]=l,r;if(g=+r._x.call(null,a.data),x=+r._y.call(null,a.data),b=+r._z.call(null,a.data),e===g&&n===x&&i===b)return l.next=a,o?o[E]=l:r._root=l,r;do o=o?o[E]=new Array(8):r._root=new Array(8),(v=e>=(m=(c+d)/2))?c=m:d=m,(T=n>=(_=(u+f)/2))?u=_:f=_,(w=i>=(y=(h+p)/2))?h=y:p=y;while((E=w<<2|T<<1|v)===(A=(b>=y)<<2|(x>=_)<<1|g>=m));return o[A]=a,o[E]=l,r}function XU(r){Array.isArray(r)||(r=Array.from(r));const e=r.length,n=new Float64Array(e),i=new Float64Array(e),s=new Float64Array(e);let o=1/0,a=1/0,l=1/0,c=-1/0,u=-1/0,h=-1/0;for(let d=0,f,p,m,_;d<e;++d)isNaN(p=+this._x.call(null,f=r[d]))||isNaN(m=+this._y.call(null,f))||isNaN(_=+this._z.call(null,f))||(n[d]=p,i[d]=m,s[d]=_,p<o&&(o=p),p>c&&(c=p),m<a&&(a=m),m>u&&(u=m),_<l&&(l=_),_>h&&(h=_));if(o>c||a>u||l>h)return this;this.cover(o,a,l).cover(c,u,h);for(let d=0;d<e;++d)lT(this,n[d],i[d],s[d],r[d]);return this}function YU(r,e,n){if(isNaN(r=+r)||isNaN(e=+e)||isNaN(n=+n))return this;var i=this._x0,s=this._y0,o=this._z0,a=this._x1,l=this._y1,c=this._z1;if(isNaN(i))a=(i=Math.floor(r))+1,l=(s=Math.floor(e))+1,c=(o=Math.floor(n))+1;else{for(var u=a-i||1,h=this._root,d,f;i>r||r>=a||s>e||e>=l||o>n||n>=c;)switch(f=(n<o)<<2|(e<s)<<1|r<i,d=new Array(8),d[f]=h,h=d,u*=2,f){case 0:a=i+u,l=s+u,c=o+u;break;case 1:i=a-u,l=s+u,c=o+u;break;case 2:a=i+u,s=l-u,c=o+u;break;case 3:i=a-u,s=l-u,c=o+u;break;case 4:a=i+u,l=s+u,o=c-u;break;case 5:i=a-u,l=s+u,o=c-u;break;case 6:a=i+u,s=l-u,o=c-u;break;case 7:i=a-u,s=l-u,o=c-u;break}this._root&&this._root.length&&(this._root=h)}return this._x0=i,this._y0=s,this._z0=o,this._x1=a,this._y1=l,this._z1=c,this}function KU(){var r=[];return this.visit(function(e){if(!e.length)do r.push(e.data);while(e=e.next)}),r}function ZU(r){return arguments.length?this.cover(+r[0][0],+r[0][1],+r[0][2]).cover(+r[1][0],+r[1][1],+r[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function Qt(r,e,n,i,s,o,a){this.node=r,this.x0=e,this.y0=n,this.z0=i,this.x1=s,this.y1=o,this.z1=a}function QU(r,e,n,i){var s,o=this._x0,a=this._y0,l=this._z0,c,u,h,d,f,p,m=this._x1,_=this._y1,y=this._z1,g=[],x=this._root,b,v;for(x&&g.push(new Qt(x,o,a,l,m,_,y)),i==null?i=1/0:(o=r-i,a=e-i,l=n-i,m=r+i,_=e+i,y=n+i,i*=i);b=g.pop();)if(!(!(x=b.node)||(c=b.x0)>m||(u=b.y0)>_||(h=b.z0)>y||(d=b.x1)<o||(f=b.y1)<a||(p=b.z1)<l))if(x.length){var T=(c+d)/2,w=(u+f)/2,E=(h+p)/2;g.push(new Qt(x[7],T,w,E,d,f,p),new Qt(x[6],c,w,E,T,f,p),new Qt(x[5],T,u,E,d,w,p),new Qt(x[4],c,u,E,T,w,p),new Qt(x[3],T,w,h,d,f,E),new Qt(x[2],c,w,h,T,f,E),new Qt(x[1],T,u,h,d,w,E),new Qt(x[0],c,u,h,T,w,E)),(v=(n>=E)<<2|(e>=w)<<1|r>=T)&&(b=g[g.length-1],g[g.length-1]=g[g.length-1-v],g[g.length-1-v]=b)}else{var A=r-+this._x.call(null,x.data),M=e-+this._y.call(null,x.data),S=n-+this._z.call(null,x.data),R=A*A+M*M+S*S;if(R<i){var O=Math.sqrt(i=R);o=r-O,a=e-O,l=n-O,m=r+O,_=e+O,y=n+O,s=x.data}}return s}const JU=(r,e,n,i,s,o)=>Math.sqrt((r-i)**2+(e-s)**2+(n-o)**2);function eB(r,e,n,i){const s=[],o=r-i,a=e-i,l=n-i,c=r+i,u=e+i,h=n+i;return this.visit((d,f,p,m,_,y,g)=>{if(!d.length)do{const x=d.data;JU(r,e,n,this._x(x),this._y(x),this._z(x))<=i&&s.push(x)}while(d=d.next);return f>c||p>u||m>h||_<o||y<a||g<l}),s}function tB(r){if(isNaN(f=+this._x.call(null,r))||isNaN(p=+this._y.call(null,r))||isNaN(m=+this._z.call(null,r)))return this;var e,n=this._root,i,s,o,a=this._x0,l=this._y0,c=this._z0,u=this._x1,h=this._y1,d=this._z1,f,p,m,_,y,g,x,b,v,T,w;if(!n)return this;if(n.length)for(;;){if((x=f>=(_=(a+u)/2))?a=_:u=_,(b=p>=(y=(l+h)/2))?l=y:h=y,(v=m>=(g=(c+d)/2))?c=g:d=g,e=n,!(n=n[T=v<<2|b<<1|x]))return this;if(!n.length)break;(e[T+1&7]||e[T+2&7]||e[T+3&7]||e[T+4&7]||e[T+5&7]||e[T+6&7]||e[T+7&7])&&(i=e,w=T)}for(;n.data!==r;)if(s=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,s?(o?s.next=o:delete s.next,this):e?(o?e[T]=o:delete e[T],(n=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&n===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!n.length&&(i?i[w]=n:this._root=n),this):(this._root=o,this)}function nB(r){for(var e=0,n=r.length;e<n;++e)this.remove(r[e]);return this}function iB(){return this._root}function rB(){var r=0;return this.visit(function(e){if(!e.length)do++r;while(e=e.next)}),r}function sB(r){var e=[],n,i=this._root,s,o,a,l,c,u,h;for(i&&e.push(new Qt(i,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=e.pop();)if(!r(i=n.node,o=n.x0,a=n.y0,l=n.z0,c=n.x1,u=n.y1,h=n.z1)&&i.length){var d=(o+c)/2,f=(a+u)/2,p=(l+h)/2;(s=i[7])&&e.push(new Qt(s,d,f,p,c,u,h)),(s=i[6])&&e.push(new Qt(s,o,f,p,d,u,h)),(s=i[5])&&e.push(new Qt(s,d,a,p,c,f,h)),(s=i[4])&&e.push(new Qt(s,o,a,p,d,f,h)),(s=i[3])&&e.push(new Qt(s,d,f,l,c,u,p)),(s=i[2])&&e.push(new Qt(s,o,f,l,d,u,p)),(s=i[1])&&e.push(new Qt(s,d,a,l,c,f,p)),(s=i[0])&&e.push(new Qt(s,o,a,l,d,f,p))}return this}function oB(r){var e=[],n=[],i;for(this._root&&e.push(new Qt(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));i=e.pop();){var s=i.node;if(s.length){var o,a=i.x0,l=i.y0,c=i.z0,u=i.x1,h=i.y1,d=i.z1,f=(a+u)/2,p=(l+h)/2,m=(c+d)/2;(o=s[0])&&e.push(new Qt(o,a,l,c,f,p,m)),(o=s[1])&&e.push(new Qt(o,f,l,c,u,p,m)),(o=s[2])&&e.push(new Qt(o,a,p,c,f,h,m)),(o=s[3])&&e.push(new Qt(o,f,p,c,u,h,m)),(o=s[4])&&e.push(new Qt(o,a,l,m,f,p,d)),(o=s[5])&&e.push(new Qt(o,f,l,m,u,p,d)),(o=s[6])&&e.push(new Qt(o,a,p,m,f,h,d)),(o=s[7])&&e.push(new Qt(o,f,p,m,u,h,d))}n.push(i)}for(;i=n.pop();)r(i.node,i.x0,i.y0,i.z0,i.x1,i.y1,i.z1);return this}function aB(r){return r[0]}function lB(r){return arguments.length?(this._x=r,this):this._x}function cB(r){return r[1]}function uB(r){return arguments.length?(this._y=r,this):this._y}function hB(r){return r[2]}function dB(r){return arguments.length?(this._z=r,this):this._z}function cT(r,e,n,i){var s=new U0(e??aB,n??cB,i??hB,NaN,NaN,NaN,NaN,NaN,NaN);return r==null?s:s.addAll(r)}function U0(r,e,n,i,s,o,a,l,c){this._x=r,this._y=e,this._z=n,this._x0=i,this._y0=s,this._z0=o,this._x1=a,this._y1=l,this._z1=c,this._root=void 0}function uT(r){for(var e={data:r.data},n=e;r=r.next;)n=n.next={data:r.data};return e}var Vn=cT.prototype=U0.prototype;Vn.copy=function(){var r=new U0(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,n,i;if(!e)return r;if(!e.length)return r._root=uT(e),r;for(n=[{source:e,target:r._root=new Array(8)}];e=n.pop();)for(var s=0;s<8;++s)(i=e.source[s])&&(i.length?n.push({source:i,target:e.target[s]=new Array(8)}):e.target[s]=uT(i));return r},Vn.add=qU,Vn.addAll=XU,Vn.cover=YU,Vn.data=KU,Vn.extent=ZU,Vn.find=QU,Vn.findAllWithinRadius=eB,Vn.remove=tB,Vn.removeAll=nB,Vn.root=iB,Vn.size=rB,Vn.visit=sB,Vn.visitAfter=oB,Vn.x=lB,Vn.y=uB,Vn.z=dB;function ps(r){return function(){return r}}function ms(r){return(r()-.5)*1e-6}function fB(r){return r.index}function hT(r,e){var n=r.get(e);if(!n)throw new Error("node not found: "+e);return n}function dT(r){var e=fB,n=f,i,s=ps(30),o,a,l,c,u,h,d=1;r==null&&(r=[]);function f(g){return 1/Math.min(c[g.source.index],c[g.target.index])}function p(g){for(var x=0,b=r.length;x<d;++x)for(var v=0,T,w,E,A=0,M=0,S=0,R,O;v<b;++v)T=r[v],w=T.source,E=T.target,A=E.x+E.vx-w.x-w.vx||ms(h),l>1&&(M=E.y+E.vy-w.y-w.vy||ms(h)),l>2&&(S=E.z+E.vz-w.z-w.vz||ms(h)),R=Math.sqrt(A*A+M*M+S*S),R=(R-o[v])/R*g*i[v],A*=R,M*=R,S*=R,E.vx-=A*(O=u[v]),l>1&&(E.vy-=M*O),l>2&&(E.vz-=S*O),w.vx+=A*(O=1-O),l>1&&(w.vy+=M*O),l>2&&(w.vz+=S*O)}function m(){if(a){var g,x=a.length,b=r.length,v=new Map(a.map((w,E)=>[e(w,E,a),w])),T;for(g=0,c=new Array(x);g<b;++g)T=r[g],T.index=g,typeof T.source!="object"&&(T.source=hT(v,T.source)),typeof T.target!="object"&&(T.target=hT(v,T.target)),c[T.source.index]=(c[T.source.index]||0)+1,c[T.target.index]=(c[T.target.index]||0)+1;for(g=0,u=new Array(b);g<b;++g)T=r[g],u[g]=c[T.source.index]/(c[T.source.index]+c[T.target.index]);i=new Array(b),_(),o=new Array(b),y()}}function _(){if(a)for(var g=0,x=r.length;g<x;++g)i[g]=+n(r[g],g,r)}function y(){if(a)for(var g=0,x=r.length;g<x;++g)o[g]=+s(r[g],g,r)}return p.initialize=function(g,...x){a=g,h=x.find(b=>typeof b=="function")||Math.random,l=x.find(b=>[1,2,3].includes(b))||2,m()},p.links=function(g){return arguments.length?(r=g,m(),p):r},p.id=function(g){return arguments.length?(e=g,p):e},p.iterations=function(g){return arguments.length?(d=+g,p):d},p.strength=function(g){return arguments.length?(n=typeof g=="function"?g:ps(+g),_(),p):n},p.distance=function(g){return arguments.length?(s=typeof g=="function"?g:ps(+g),y(),p):s},p}var pB={value:()=>{}};function su(){for(var r=0,e=arguments.length,n={},i;r<e;++r){if(!(i=arguments[r]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new Gd(n)}function Gd(r){this._=r}function mB(r,e){return r.trim().split(/^|\s+/).map(function(n){var i="",s=n.indexOf(".");if(s>=0&&(i=n.slice(s+1),n=n.slice(0,s)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}Gd.prototype=su.prototype={constructor:Gd,on:function(r,e){var n=this._,i=mB(r+"",n),s,o=-1,a=i.length;if(arguments.length<2){for(;++o<a;)if((s=(r=i[o]).type)&&(s=gB(n[s],r.name)))return s;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<a;)if(s=(r=i[o]).type)n[s]=fT(n[s],r.name,e);else if(e==null)for(s in n)n[s]=fT(n[s],r.name,null);return this},copy:function(){var r={},e=this._;for(var n in e)r[n]=e[n].slice();return new Gd(r)},call:function(r,e){if((s=arguments.length-2)>0)for(var n=new Array(s),i=0,s,o;i<s;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(o=this._[r],i=0,s=o.length;i<s;++i)o[i].value.apply(e,n)},apply:function(r,e,n){if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(var i=this._[r],s=0,o=i.length;s<o;++s)i[s].value.apply(e,n)}};function gB(r,e){for(var n=0,i=r.length,s;n<i;++n)if((s=r[n]).name===e)return s.value}function fT(r,e,n){for(var i=0,s=r.length;i<s;++i)if(r[i].name===e){r[i]=pB,r=r.slice(0,i).concat(r.slice(i+1));break}return n!=null&&r.push({name:e,value:n}),r}var Ml=0,ou=0,au=0,pT=1e3,Vd,lu,$d=0,ha=0,jd=0,cu=typeof performance=="object"&&performance.now?performance:Date,mT=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function B0(){return ha||(mT(yB),ha=cu.now()+jd)}function yB(){ha=0}function Hd(){this._call=this._time=this._next=null}Hd.prototype=k0.prototype={constructor:Hd,restart:function(r,e,n){if(typeof r!="function")throw new TypeError("callback is not a function");n=(n==null?B0():+n)+(e==null?0:+e),!this._next&&lu!==this&&(lu?lu._next=this:Vd=this,lu=this),this._call=r,this._time=n,z0()},stop:function(){this._call&&(this._call=null,this._time=1/0,z0())}};function k0(r,e,n){var i=new Hd;return i.restart(r,e,n),i}function _B(){B0(),++Ml;for(var r=Vd,e;r;)(e=ha-r._time)>=0&&r._call.call(void 0,e),r=r._next;--Ml}function gT(){ha=($d=cu.now())+jd,Ml=ou=0;try{_B()}finally{Ml=0,xB(),ha=0}}function vB(){var r=cu.now(),e=r-$d;e>pT&&(jd-=e,$d=r)}function xB(){for(var r,e=Vd,n,i=1/0;e;)e._call?(i>e._time&&(i=e._time),r=e,e=e._next):(n=e._next,e._next=null,e=r?r._next=n:Vd=n);lu=r,z0(i)}function z0(r){if(!Ml){ou&&(ou=clearTimeout(ou));var e=r-ha;e>24?(r<1/0&&(ou=setTimeout(gT,r-cu.now()-jd)),au&&(au=clearInterval(au))):(au||($d=cu.now(),au=setInterval(vB,pT)),Ml=1,mT(gT))}}function yT(r,e,n){var i=new Hd;return e=e==null?0:+e,i.restart(s=>{i.stop(),r(s+e)},e,n),i}const bB=1664525,SB=1013904223,_T=4294967296;function TB(){let r=1;return()=>(r=(bB*r+SB)%_T)/_T}var vT=3;function G0(r){return r.x}function xT(r){return r.y}function wB(r){return r.z}var MB=10,EB=Math.PI*(3-Math.sqrt(5)),AB=Math.PI*20/(9+Math.sqrt(221));function bT(r,e){e=e||2;var n=Math.min(vT,Math.max(1,Math.round(e))),i,s=1,o=.001,a=1-Math.pow(o,1/300),l=0,c=.6,u=new Map,h=k0(p),d=su("tick","end"),f=TB();r==null&&(r=[]);function p(){m(),d.call("tick",i),s<o&&(h.stop(),d.call("end",i))}function m(g){var x,b=r.length,v;g===void 0&&(g=1);for(var T=0;T<g;++T)for(s+=(l-s)*a,u.forEach(function(w){w(s)}),x=0;x<b;++x)v=r[x],v.fx==null?v.x+=v.vx*=c:(v.x=v.fx,v.vx=0),n>1&&(v.fy==null?v.y+=v.vy*=c:(v.y=v.fy,v.vy=0)),n>2&&(v.fz==null?v.z+=v.vz*=c:(v.z=v.fz,v.vz=0));return i}function _(){for(var g=0,x=r.length,b;g<x;++g){if(b=r[g],b.index=g,b.fx!=null&&(b.x=b.fx),b.fy!=null&&(b.y=b.fy),b.fz!=null&&(b.z=b.fz),isNaN(b.x)||n>1&&isNaN(b.y)||n>2&&isNaN(b.z)){var v=MB*(n>2?Math.cbrt(.5+g):n>1?Math.sqrt(.5+g):g),T=g*EB,w=g*AB;n===1?b.x=v:n===2?(b.x=v*Math.cos(T),b.y=v*Math.sin(T)):(b.x=v*Math.sin(T)*Math.cos(w),b.y=v*Math.cos(T),b.z=v*Math.sin(T)*Math.sin(w))}(isNaN(b.vx)||n>1&&isNaN(b.vy)||n>2&&isNaN(b.vz))&&(b.vx=0,n>1&&(b.vy=0),n>2&&(b.vz=0))}}function y(g){return g.initialize&&g.initialize(r,f,n),g}return _(),i={tick:m,restart:function(){return h.restart(p),i},stop:function(){return h.stop(),i},numDimensions:function(g){return arguments.length?(n=Math.min(vT,Math.max(1,Math.round(g))),u.forEach(y),i):n},nodes:function(g){return arguments.length?(r=g,_(),u.forEach(y),i):r},alpha:function(g){return arguments.length?(s=+g,i):s},alphaMin:function(g){return arguments.length?(o=+g,i):o},alphaDecay:function(g){return arguments.length?(a=+g,i):+a},alphaTarget:function(g){return arguments.length?(l=+g,i):l},velocityDecay:function(g){return arguments.length?(c=1-g,i):1-c},randomSource:function(g){return arguments.length?(f=g,u.forEach(y),i):f},force:function(g,x){return arguments.length>1?(x==null?u.delete(g):u.set(g,y(x)),i):u.get(g)},find:function(){var g=Array.prototype.slice.call(arguments),x=g.shift()||0,b=(n>1?g.shift():null)||0,v=(n>2?g.shift():null)||0,T=g.shift()||1/0,w=0,E=r.length,A,M,S,R,O,P;for(T*=T,w=0;w<E;++w)O=r[w],A=x-O.x,M=b-(O.y||0),S=v-(O.z||0),R=A*A+M*M+S*S,R<T&&(P=O,T=R);return P},on:function(g,x){return arguments.length>1?(d.on(g,x),i):d.on(g)}}}function ST(){var r,e,n,i,s,o=ps(-30),a,l=1,c=1/0,u=.81;function h(m){var _,y=r.length,g=(e===1?iT(r,G0):e===2?oT(r,G0,xT):e===3?cT(r,G0,xT,wB):null).visitAfter(f);for(s=m,_=0;_<y;++_)n=r[_],g.visit(p)}function d(){if(r){var m,_=r.length,y;for(a=new Array(_),m=0;m<_;++m)y=r[m],a[y.index]=+o(y,m,r)}}function f(m){var _=0,y,g,x=0,b,v,T,w,E=m.length;if(E){for(b=v=T=w=0;w<E;++w)(y=m[w])&&(g=Math.abs(y.value))&&(_+=y.value,x+=g,b+=g*(y.x||0),v+=g*(y.y||0),T+=g*(y.z||0));_*=Math.sqrt(4/E),m.x=b/x,e>1&&(m.y=v/x),e>2&&(m.z=T/x)}else{y=m,y.x=y.data.x,e>1&&(y.y=y.data.y),e>2&&(y.z=y.data.z);do _+=a[y.data.index];while(y=y.next)}m.value=_}function p(m,_,y,g,x){if(!m.value)return!0;var b=[y,g,x][e-1],v=m.x-n.x,T=e>1?m.y-n.y:0,w=e>2?m.z-n.z:0,E=b-_,A=v*v+T*T+w*w;if(E*E/u<A)return A<c&&(v===0&&(v=ms(i),A+=v*v),e>1&&T===0&&(T=ms(i),A+=T*T),e>2&&w===0&&(w=ms(i),A+=w*w),A<l&&(A=Math.sqrt(l*A)),n.vx+=v*m.value*s/A,e>1&&(n.vy+=T*m.value*s/A),e>2&&(n.vz+=w*m.value*s/A)),!0;if(m.length||A>=c)return;(m.data!==n||m.next)&&(v===0&&(v=ms(i),A+=v*v),e>1&&T===0&&(T=ms(i),A+=T*T),e>2&&w===0&&(w=ms(i),A+=w*w),A<l&&(A=Math.sqrt(l*A)));do m.data!==n&&(E=a[m.data.index]*s/A,n.vx+=v*E,e>1&&(n.vy+=T*E),e>2&&(n.vz+=w*E));while(m=m.next)}return h.initialize=function(m,..._){r=m,i=_.find(y=>typeof y=="function")||Math.random,e=_.find(y=>[1,2,3].includes(y))||2,d()},h.strength=function(m){return arguments.length?(o=typeof m=="function"?m:ps(+m),d(),h):o},h.distanceMin=function(m){return arguments.length?(l=m*m,h):Math.sqrt(l)},h.distanceMax=function(m){return arguments.length?(c=m*m,h):Math.sqrt(c)},h.theta=function(m){return arguments.length?(u=m*m,h):Math.sqrt(u)},h}function TT(r,e,n,i){var s,o,a=ps(.1),l,c;typeof r!="function"&&(r=ps(+r)),e==null&&(e=0),n==null&&(n=0),i==null&&(i=0);function u(d){for(var f=0,p=s.length;f<p;++f){var m=s[f],_=m.x-e||1e-6,y=(m.y||0)-n||1e-6,g=(m.z||0)-i||1e-6,x=Math.sqrt(_*_+y*y+g*g),b=(c[f]-x)*l[f]*d/x;m.vx+=_*b,o>1&&(m.vy+=y*b),o>2&&(m.vz+=g*b)}}function h(){if(s){var d,f=s.length;for(l=new Array(f),c=new Array(f),d=0;d<f;++d)c[d]=+r(s[d],d,s),l[d]=isNaN(c[d])?0:+a(s[d],d,s)}}return u.initialize=function(d,...f){s=d,o=f.find(p=>[1,2,3].includes(p))||2,h()},u.strength=function(d){return arguments.length?(a=typeof d=="function"?d:ps(+d),h(),u):a},u.radius=function(d){return arguments.length?(r=typeof d=="function"?d:ps(+d),h(),u):r},u.x=function(d){return arguments.length?(e=+d,u):e},u.y=function(d){return arguments.length?(n=+d,u):n},u.z=function(d){return arguments.length?(i=+d,u):i},u}var V0=function(e){RB(e);var n=CB(e);return e.on=n.on,e.off=n.off,e.fire=n.fire,e};function CB(r){var e=Object.create(null);return{on:function(n,i,s){if(typeof i!="function")throw new Error("callback is expected to be a function");var o=e[n];return o||(o=e[n]=[]),o.push({callback:i,ctx:s}),r},off:function(n,i){var s=typeof n>"u";if(s)return e=Object.create(null),r;if(e[n]){var o=typeof i!="function";if(o)delete e[n];else for(var a=e[n],l=0;l<a.length;++l)a[l].callback===i&&a.splice(l,1)}return r},fire:function(n){var i=e[n];if(!i)return r;var s;arguments.length>1&&(s=Array.prototype.splice.call(arguments,1));for(var o=0;o<i.length;++o){var a=i[o];a.callback.apply(a.ctx,s)}return r}}}function RB(r){if(!r)throw new Error("Eventify cannot use falsy object as events subject");for(var e=["on","fire","off"],n=0;n<e.length;++n)if(r.hasOwnProperty(e[n]))throw new Error("Subject cannot be eventified, since it already has property '"+e[n]+"'")}var NB=DB,PB=V0;function DB(r){if(r=r||{},"uniqueLinkId"in r&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n",`
4318
4318
  `,`Note: there is also change in default behavior: From now on each graph
4319
4319
  is considered to be not a multigraph by default (each edge is unique).`),r.multigraph=r.uniqueLinkId),r.multigraph===void 0&&(r.multigraph=!1),typeof Map!="function")throw new Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var e=new Map,n=new Map,i={},s=0,o=r.multigraph?v:b,a=[],l=L,c=L,u=L,h=L,d={version:20,addNode:_,addLink:x,removeLink:A,removeNode:g,getNode:y,getNodeCount:T,getLinkCount:w,getEdgeCount:w,getLinksCount:w,getNodesCount:T,getLinks:E,forEachNode:ie,forEachLinkedNode:P,forEachLink:O,beginUpdate:u,endUpdate:h,clear:R,hasLink:S,hasNode:y,getLink:S};return PB(d),f(),d;function f(){var U=d.on;d.on=k;function k(){return d.beginUpdate=u=W,d.endUpdate=h=$,l=p,c=m,d.on=U,U.apply(d,arguments)}}function p(U,k){a.push({link:U,changeType:k})}function m(U,k){a.push({node:U,changeType:k})}function _(U,k){if(U===void 0)throw new Error("Invalid node identifier");u();var re=y(U);return re?(re.data=k,c(re,"update")):(re=new IB(U,k),c(re,"add")),e.set(U,re),h(),re}function y(U){return e.get(U)}function g(U){var k=y(U);if(!k)return!1;u();var re=k.links;return re&&(re.forEach(M),k.links=null),e.delete(U),c(k,"remove"),h(),!0}function x(U,k,re){u();var he=y(U)||_(U),F=y(k)||_(k),G=o(U,k,re),ee=n.has(G.id);return n.set(G.id,G),wT(he,G),U!==k&&wT(F,G),l(G,ee?"update":"add"),h(),G}function b(U,k,re){var he=Wd(U,k),F=n.get(he);return F?(F.data=re,F):new MT(U,k,re,he)}function v(U,k,re){var he=Wd(U,k),F=i.hasOwnProperty(he);if(F||S(U,k)){F||(i[he]=0);var G="@"+ ++i[he];he=Wd(U+G,k+G)}return new MT(U,k,re,he)}function T(){return e.size}function w(){return n.size}function E(U){var k=y(U);return k?k.links:null}function A(U,k){return k!==void 0&&(U=S(U,k)),M(U)}function M(U){if(!U||!n.get(U.id))return!1;u(),n.delete(U.id);var k=y(U.fromId),re=y(U.toId);return k&&k.links.delete(U),re&&re.links.delete(U),l(U,"remove"),h(),!0}function S(U,k){if(!(U===void 0||k===void 0))return n.get(Wd(U,k))}function R(){u(),ie(function(U){g(U.id)}),h()}function O(U){if(typeof U=="function")for(var k=n.values(),re=k.next();!re.done;){if(U(re.value))return!0;re=k.next()}}function P(U,k,re){var he=y(U);if(he&&he.links&&typeof k=="function")return re?I(he.links,U,k):C(he.links,U,k)}function C(U,k,re){for(var he,F=U.values(),G=F.next();!G.done;){var ee=G.value,J=ee.fromId===k?ee.toId:ee.fromId;if(he=re(e.get(J),ee),he)return!0;G=F.next()}}function I(U,k,re){for(var he,F=U.values(),G=F.next();!G.done;){var ee=G.value;if(ee.fromId===k&&(he=re(e.get(ee.toId),ee),he))return!0;G=F.next()}}function L(){}function W(){s+=1}function $(){s-=1,s===0&&a.length>0&&(d.fire("changed",a),a.length=0)}function ie(U){if(typeof U!="function")throw new Error("Function is expected to iterate over graph nodes. You passed "+U);for(var k=e.values(),re=k.next();!re.done;){if(U(re.value))return!0;re=k.next()}}}function IB(r,e){this.id=r,this.links=null,this.data=e}function wT(r,e){r.links?r.links.add(e):r.links=new Set([e])}function MT(r,e,n,i){this.fromId=r,this.toId=e,this.data=n,this.id=i}function Wd(r,e){return r.toString()+"👉 "+e.toString()}const LB=_m(NB);var $0={exports:{}},uu={exports:{}},ET=function(e){return e===0?"x":e===1?"y":e===2?"z":"c"+(e+1)};const OB=ET;var El=function(e){return n;function n(i,s){let o=s&&s.indent||0,a=s&&s.join!==void 0?s.join:`
4320
4320
  `,l=Array(o+1).join(" "),c=[];for(let u=0;u<e;++u){let h=OB(u),d=u===0?"":l;c.push(d+i.replace(/{var}/g,h))}return c.join(a)}};const AT=El;uu.exports=FB,uu.exports.generateCreateBodyFunctionBody=CT,uu.exports.getVectorCode=NT,uu.exports.getBodyCode=RT;function FB(r,e){let n=CT(r,e),{Body:i}=new Function(n)();return i}function CT(r,e){return`